From b04965d39ae30fddc8c79622ad309ba541961d9f Mon Sep 17 00:00:00 2001 From: futian.liu <liufutianyoo@163.com> Date: 星期四, 07 十二月 2023 14:53:12 +0800 Subject: [PATCH] 出库单金额处理 --- admin-web/src/views/stock/accessStock/outbound/detail.vue | 74 ++++++++++++++++++++++++++++++++---- 1 files changed, 65 insertions(+), 9 deletions(-) diff --git a/admin-web/src/views/stock/accessStock/outbound/detail.vue b/admin-web/src/views/stock/accessStock/outbound/detail.vue index 0cd965a..d09af1a 100644 --- a/admin-web/src/views/stock/accessStock/outbound/detail.vue +++ b/admin-web/src/views/stock/accessStock/outbound/detail.vue @@ -24,10 +24,12 @@ <span>{{ detail.dealTime | formatTime }}</span> </el-col> </el-row> - <el-row v-if="detail.procureDoc" :gutter="20" style="margin-top: 20px"> + <el-row v-if="fileList && fileList.length" :gutter="20" style="margin-top: 20px"> <el-col class="img-row" :span="24"> <span>鍑哄簱鎵嬬画锛�</span> - <div class="img-box"></div> + <div class="img-box" v-for="(item, index) in fileList" :key="index" @click="handlePreview(item)"> + <img class="img" :src="getUrl(item.path)" alt=""/> + </div> </el-col> </el-row> <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.fromOutputGoods" :key="goodsIndex"> @@ -57,20 +59,36 @@ {{ scope.row.counts }} </template> </el-table-column> - <el-table-column prop="counts" label="閲戦" align="center"> + <el-table-column prop="totalAmount" label="閲戦" align="center"> <template slot-scope="scope"> - {{ scope.row.price * scope.row.counts | formatPrice}} + {{ scope.row.totalAmount}} </template> </el-table-column> </el-table> </div> + <div id="uploadPreviewImages" style="display: none"> + <span v-for="(src, index) in fileList" :key="index"> + <img + v-if="checkImg(src.name)" + class="v-img" + :src="getUrl(src.path)" + :alt="src.name" + style="width: 100px; height: 100px" + /> + </span> + </div> </win-md> </template> <script> -import { outputDetail } from '@/api/stock/accessStock'; +import {outputDetail} from '@/api/stock/accessStock'; import winMd from '@/components/win/win-md'; import * as DateFormatter from '@/utils/DateFormatter'; +import {getDownUrl} from "@/utils/base"; +import Viewer from 'viewerjs'; +import 'viewerjs/dist/viewer.css'; + +let viewer = null; export default { components: { winMd }, @@ -83,6 +101,7 @@ data() { return { loading:true, + fileList: [], detail: { categoryName: '', businessFormCode: '', @@ -99,18 +118,55 @@ formatTime(time) { if (!time) return; return DateFormatter.LongToDateTime(time); - }, - formatPrice(price) { - return price / 100 } }, created() { outputDetail({ id: this.setting.id }).then((res) => { this.detail = res; - this.loading = false + this.fileList = this.detail.doc ? JSON.parse(this.detail.doc) : []; + this.loading = false; + this.$nextTick(() => { + this.initPreviewImg(); + }); }); }, methods: { + initPreviewImg() { + if (viewer != null) { + viewer.destroy(); + } + const ViewerDom = document.querySelector('#uploadPreviewImages'); + viewer = new Viewer(ViewerDom, {}); + }, + handlePreview(file) { + if (!this.checkImg(file.name)) { + return false; + } + let index = 0; + for (let i = 0; i < this.fileList.length; i++) { + const f = this.fileList[i]; + if (this.checkImg(f.name)) { + if (file.id == f.id) { + break; + } + index++; + } + } + viewer.view(index); + }, + checkImg(name) { + const suffix = name.substring(name.lastIndexOf('.'), name.length); + const imgArray = ['.jpg', '.jpeg', '.png', '.bmp']; + return imgArray.indexOf(suffix) >= 0; + + }, + getUrl(path) { + if (path.substr(0, 7).toLowerCase() == 'http://' || path.substr(0, 8).toLowerCase() == 'https://') { + return path; + } else { + return getDownUrl() + path; + } + }, close() { this.$emit('close') }, -- Gitblit v1.9.1