Explorar o código

【新增】打印单据

莫绍宝 %!s(int64=3) %!d(string=hai) anos
pai
achega
b79a8ca784

+ 40 - 0
src/components/Common/print-guangzhou.vue

@@ -0,0 +1,40 @@
+<template>
+  <div>
+    <el-button size="small" type="primary" :icon="isIcon ? 'el-icon-download':''" @click="handleExport">{{exText}}</el-button>
+  </div>
+</template>
+
+<script>
+import { downloadFiles } from '@/utils/util'
+
+export default {
+  name: 'ExportButton',
+  props: {
+    exText: {
+      type: String,
+      default: '导出数据'
+    },
+    isIcon: {
+      type: Boolean,
+      default: true
+    },
+    exUrl: {
+      type: String,
+      default: '',
+    },
+    exParams: {
+      type: Object,
+      default: null
+    }
+  },
+  methods: {
+    handleExport() {
+      downloadFiles(this.exUrl, this.exParams);
+    }
+  }
+}
+</script>
+
+<style>
+
+</style>

+ 53 - 19
src/views/supply/pickup/check.vue

@@ -59,13 +59,13 @@
 
       <div class="mymain-container">
         <div class="table">
-          <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe @selection-change="handleSelectionChange">
-            <!-- <el-table-column align="center" type="selection" width="55"></el-table-column> -->
-            <el-table-column align="center" label="操作" width="100" fixed="left">
+          <el-table ref="table" v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe @select="handleSelect">
+            <el-table-column align="center" type="selection" width="55"></el-table-column>
+            <!-- <el-table-column align="center" label="操作" width="100" fixed="left">
               <template slot-scope="scope">
                 <el-button type="text" @click="toPrint(scope.row)">打印</el-button>
               </template>
-            </el-table-column>
+            </el-table-column> -->
             <el-table-column align="center" label="状态" min-width="100" show-overflow-tooltip>
               <template slot-scope="scope">
                 {{ scope.row.printNum ? '已打单(' + scope.row.printNum + ')' : '未打单' }}
@@ -109,7 +109,7 @@
           </el-table>
         </div>
       </div>
-      <div class="pagination clearfix">
+      <!-- <div class="pagination clearfix">
         <div class="fr">
           <el-pagination
             @size-change="handleSizeChange"
@@ -121,13 +121,13 @@
             :total="listTotal">
           </el-pagination>
         </div>
-      </div>
+      </div> -->
 
-      <!-- <div class="page-footer">
+      <div class="page-footer">
         <div class="footer">
-          <el-button type="primary" @click="toPrint" :disabled="multipleSelection.length < 1">打印发货单</el-button>
+          <el-button type="primary" @click="toPrint" :disabled="tableSelection.length < 1">打印发货单</el-button>
         </div>
-      </div> -->
+      </div>
 
     </div>
 
@@ -201,7 +201,7 @@ export default {
       countDown: 60,
 			timer: null,
 
-      multipleSelection: [],
+      tableSelection: [],
 
       queryItem: {},
       isShowPrint: false,
@@ -279,8 +279,8 @@ export default {
       this.listLoading = true;
 
       let params = {
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
+        pageNum: 1,
+        pageSize: -1,
         takerId: this.screenForm.manId,
         status: this.screenForm.status,
       };
@@ -309,23 +309,57 @@ export default {
       this.isShowPrint = false;
     },
 
-    handleSelectionChange(val) {
-      this.multipleSelection = val;
+    handleSelect(selection, row) {
+      this.$refs.table.toggleRowSelection(row);
+      this.dataList.forEach(item => {
+        if (item.informationKey === row.informationKey) {
+          this.$refs.table.toggleRowSelection(item);
+        }
+      })
+      this.tableSelection = this.$refs.table.selection;
+    },
+
+    // 检查是否一致
+    isAllEqual(array) {
+      if (array.length > 0) {
+        return !array.some(function(item, index) {
+          return item.informationKey !== array[0].informationKey;
+        });
+      } else {
+        return true;
+      }
     },
 
     // 点击打印
-    toPrint(item) {
-      if(!item.printNum) {
-        this.queryItem = item;
+    toPrint() {
+      if(!this.isAllEqual(this.tableSelection)) {
+        return this.$errorMsg('只能选择同一个提货订单');
+      }
+
+      if(!this.tableSelection[0].printNum) {
+        this.queryItem = this.tableSelection;
         this.isShowPrint = true;
       }else {
-        this.queryItem = item;
+        this.queryItem = this.tableSelection;
         this.dialogForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
         this.dialogForm.createDate = this.getDate();
         this.isShowDialog = true;
       }
     },
 
+    // 点击打印
+    // toPrint(item) {
+    //   if(!item.printNum) {
+    //     this.queryItem = item;
+    //     this.isShowPrint = true;
+    //   }else {
+    //     this.queryItem = item;
+    //     this.dialogForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
+    //     this.dialogForm.createDate = this.getDate();
+    //     this.isShowDialog = true;
+    //   }
+    // },
+
     // 关闭弹窗
     cancelDialogForm(){
       this.isShowDialog = false;
@@ -337,7 +371,7 @@ export default {
       this.$refs.dialogForm.validate((valid) => {
         if (valid) {
           let params = {
-            shipId: this.queryItem.invoiceId,
+            shipId: this.queryItem[0].invoiceId,
             password: this.dialogForm.password
           }
           checkPassword(params).then(res => {

+ 26 - 25
src/views/supply/pickup/components/pickup_print.vue

@@ -29,48 +29,39 @@
       <div class="print-table-1">
         <div class="head">
           <el-row :gutter="20">
-            <el-col :span="3">发货单号/订单号</el-col>
-            <el-col :span="2">销售类型</el-col>
+            <el-col :span="4">发货单号/订单号</el-col>
+            <el-col :span="3">销售类型</el-col>
             <el-col :span="3">文件编号</el-col>
-            <el-col :span="6">规格型号</el-col>
-            <el-col :span="2">数量</el-col>
-            <el-col :span="2">单位</el-col>
-            <el-col :span="2">单价</el-col>
-            <el-col :span="2">金额</el-col>
-            <el-col :span="2">折让</el-col>
+            <el-col :span="8">规格型号</el-col>
+            <el-col :span="3">单位</el-col>
+            <el-col :span="3">数量</el-col>
           </el-row>
         </div>
         <div class="body">
           <div v-for="(item, index) in detailData.invoicePickBeans" :key="index">
             <el-row :gutter="20">
-              <el-col :span="3">{{ item.invoiceId || '' }}</el-col>
-              <el-col :span="2">{{ item.saleTypeName || '' }}</el-col>
+              <el-col :span="4">{{ item.invoiceId || '' }}</el-col>
+              <el-col :span="3">{{ item.saleTypeName || '' }}</el-col>
               <el-col :span="3">{{ item.fileNo || '' }}</el-col>
-              <el-col :span="6">{{ item.specification || '' }}</el-col>
-              <el-col :span="2">{{ item.refundableQty || 0 }}</el-col>
-              <el-col :span="2">{{ item.unit || '' }}</el-col>
-              <el-col :span="2">{{ item.price || 0 }}</el-col>
-              <el-col :span="2">{{ item.payAmount || 0 }}</el-col>
-              <el-col :span="2">{{ item.totalDiscAmount || 0 }}</el-col>
+              <el-col :span="8">{{ item.specification || '' }}</el-col>
+              <el-col :span="3">{{ item.unit || '' }}</el-col>
+              <el-col :span="3">{{ item.refundableQty || 0 }}</el-col>
             </el-row>
             <el-row :gutter="20">
-              <el-col :span="3">{{ item.invoiceId || '' }}</el-col>
+              <el-col :span="4">{{ item.invoiceId || '' }}</el-col>
               <el-col :span="2">发货日期</el-col>
               <el-col :span="4">{{ item.theTime || '' }}</el-col>
               <el-col :span="2">工程编号</el-col>
-              <el-col :span="3">{{ item.refEnginRecordNo || '' }}</el-col>
+              <el-col :span="4">{{ item.refEnginRecordNo || '' }}</el-col>
               <el-col :span="2">备注</el-col>
-              <el-col :span="8">{{ item.remark || '' }}</el-col>
+              <el-col :span="6">{{ item.remark || '' }}</el-col>
             </el-row>
           </div>
         </div>
         <div class="foot">
           <el-row :gutter="20">
-            <el-col :span="14">合计</el-col>
-            <el-col :span="2">{{ 0 }}</el-col>
-            <el-col :span="2"></el-col>
-            <el-col :span="2">{{ 0 }}</el-col>
-            <el-col :span="2"></el-col>
+            <el-col :span="21">合计</el-col>
+            <el-col :span="3">{{total}}</el-col>
           </el-row>
         </div>
       </div>
@@ -132,6 +123,16 @@ export default {
     }
   },
 
+  computed: {
+    total() {
+      let num = 0;
+      this.listItem.forEach(item => {
+        num = num + item.refundableQty;
+      });
+      return num;
+    }
+  },
+
   created() {
     this.getDetail();
   },
@@ -160,7 +161,7 @@ export default {
 
     // 获取详情
     getDetail() {
-      getDetail({id: this.listItem.id}).then(res => {
+      getDetail({id: this.listItem[0].id}).then(res => {
         this.detailData = res.data;
       })
     },

+ 1 - 1
src/views/supply/reserve/reserve_list.vue

@@ -100,7 +100,7 @@
             <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="预留数量" prop="reservedNum" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="经销商编码" prop="customerId" min-width="160" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="经销商名称" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>