Browse Source

付款导入sdy

zhongtianhaoyuan 3 years ago
parent
commit
33bc7184ac

+ 2 - 0
src/api/V2/houseSelfCollect/index.js

@@ -102,3 +102,5 @@ export const API_POST_WORKFLOW_TASK = `/newWorkflow/getTaskWebsocket`
 // 反结算
 // 反结算
 // export const API_POST_SUSPENDINSTANCE ='/api/suspendInstance'
 // export const API_POST_SUSPENDINSTANCE ='/api/suspendInstance'
 export const API_POST_SUSPENDINSTANCE ='/paymentManagement/api/ReSettlement'
 export const API_POST_SUSPENDINSTANCE ='/paymentManagement/api/ReSettlement'
+//导入
+export const API_POST_IMPORT ='/qualityInspectionManagement/api/importQuality'

+ 5 - 2
src/model/houseSelfCollect/index.js

@@ -52,7 +52,8 @@ import {
   API_GAT_INFO,
   API_GAT_INFO,
   API_POST_WORKFLOW_TASK,
   API_POST_WORKFLOW_TASK,
   API_POST_INSPECT_GETWEIGHTDELETE,
   API_POST_INSPECT_GETWEIGHTDELETE,
-  API_POST_SUSPENDINSTANCE
+  API_POST_SUSPENDINSTANCE,
+  API_POST_IMPORT
 } from '@/api/V2/houseSelfCollect'
 } from '@/api/V2/houseSelfCollect'
 //客户管理列表
 //客户管理列表
 export const getCustomerManage = appRx.get(API_GET_CUSTOMER_MANAGE, errorCatcher, errorHandle, filter)
 export const getCustomerManage = appRx.get(API_GET_CUSTOMER_MANAGE, errorCatcher, errorHandle, filter)
@@ -157,4 +158,6 @@ export const getcartype  = appRx.get(API_GAT_INFO, errorCatcher, errorHandle, fi
 // 审核之后
 // 审核之后
 export const workflowcontent = appRx.get(API_POST_WORKFLOW_TASK, errorCatcher, errorHandle, filter)
 export const workflowcontent = appRx.get(API_POST_WORKFLOW_TASK, errorCatcher, errorHandle, filter)
 // 反结算
 // 反结算
-export const suspendinstance = appRx.post(API_POST_SUSPENDINSTANCE, errorCatcher, errorHandle, filter)
+export const suspendinstance = appRx.post(API_POST_SUSPENDINSTANCE, errorCatcher, errorHandle, filter)
+// 导入
+export const importWord = appRx.post(API_POST_IMPORT, errorCatcher, errorHandle, filter)

+ 162 - 40
src/views/houseSelfCollect/paymentManagement.vue

@@ -78,6 +78,15 @@
         <ws-button type="primary" @click="agreementPrint()"
         <ws-button type="primary" @click="agreementPrint()"
           v-hasPermission="`acquisitionManagement.acquisitionPay.dow`">下载结算单
           v-hasPermission="`acquisitionManagement.acquisitionPay.dow`">下载结算单
         </ws-button>
         </ws-button>
+        <!-- <el-upload :on-change="importClick" action="" :show-file-list="false" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" :auto-upload="false"
+          v-hasPermission="`acquisitionManagement.acquisitionPay.dow`"><el-button type="primary">导入</el-button>
+        </el-upload> -->
+        <el-upload style="margin-left: 8px;" class="upload-demo inline-block margin-right-10" action=""
+          :on-change="importClick" :show-file-list="false"
+          accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
+          :auto-upload="false">
+          <el-button type="primary">导入</el-button>
+        </el-upload>
       </template>
       </template>
       <template slot="right"> </template>
       <template slot="right"> </template>
     </BaseHeaderLayout>
     </BaseHeaderLayout>
@@ -145,7 +154,8 @@
           </span>
           </span>
           <el-button @click="settlement(2, scope.row)" v-hasPermission="`acquisitionManagement.acquisitionPay.view`">查看
           <el-button @click="settlement(2, scope.row)" v-hasPermission="`acquisitionManagement.acquisitionPay.view`">查看
           </el-button>
           </el-button>
-          <el-button  v-if="scope.row.approveStatus&&scope.row.reverseFlag!=1" @click="settleaccounts(scope.row)" v-hasPermission="`acquisitionManagement.acquisitionPay.seet`">反结算
+          <el-button v-if="scope.row.approveStatus&&scope.row.reverseFlag!=1" @click="settleaccounts(scope.row)"
+            v-hasPermission="`acquisitionManagement.acquisitionPay.seet`">反结算
           </el-button>
           </el-button>
           <el-button v-if="
           <el-button v-if="
               scope.row.approveStatus ||
               scope.row.approveStatus ||
@@ -311,16 +321,16 @@
       </el-image>
       </el-image>
     </el-dialog>
     </el-dialog>
     <el-dialog width="30%" title="开票信息" :visible.sync="invoicingshow" :close="invoicingClose">
     <el-dialog width="30%" title="开票信息" :visible.sync="invoicingshow" :close="invoicingClose">
-       <el-form :label-position="labelposition" label-width="200px" style='text-align:center;' class="customer">
+      <el-form :label-position="labelposition" label-width="200px" style='text-align:center;' class="customer">
         <el-form-item label="税控盘:">
         <el-form-item label="税控盘:">
-          <el-select v-model="invoiceFlag" placeholder="请选择税控盘"
-          filterable clearable style="margin: 0 10px">
-          <el-option v-for="item in invoicingList" :key="'invoicing'+item.value" :label="item.label" :value="item.value">
-          </el-option>
-        </el-select>
+          <el-select v-model="invoiceFlag" placeholder="请选择税控盘" filterable clearable style="margin: 0 10px">
+            <el-option v-for="item in invoicingList" :key="'invoicing'+item.value" :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
         </el-form-item>
         </el-form-item>
       </el-form>
       </el-form>
-        <span slot="footer" class="dialog-footer">
+      <span slot="footer" class="dialog-footer">
         <el-button @click="invoicingshow = false">取 消</el-button>
         <el-button @click="invoicingshow = false">取 消</el-button>
         <el-button type="primary" @click="invoicingconfirm">确 定</el-button>
         <el-button type="primary" @click="invoicingconfirm">确 定</el-button>
       </span>
       </span>
@@ -350,7 +360,8 @@
     export1,
     export1,
     settlementEdit,
     settlementEdit,
     workflowcontent,
     workflowcontent,
-    suspendinstance
+    suspendinstance,
+    importWord
   } from '@/model/houseSelfCollect/index'
   } from '@/model/houseSelfCollect/index'
   import {
   import {
     posthandle,
     posthandle,
@@ -371,15 +382,21 @@
         paymentReceipt: '',
         paymentReceipt: '',
         isPreviewPayOrder: false,
         isPreviewPayOrder: false,
         printType: 0,
         printType: 0,
-        invoiceFlag:'',
+        invoiceFlag: '',
         isShowPrintType1: true,
         isShowPrintType1: true,
         isShowPrintType2: true,
         isShowPrintType2: true,
         isShowPrintType3: true,
         isShowPrintType3: true,
         isShowPrintType4: true,
         isShowPrintType4: true,
         customerInfo: false,
         customerInfo: false,
         form: {},
         form: {},
-        labelposition:'right',
-        invoicingList:[{label:'航天信息',value:1},{label:'百旺',value:2}],
+        labelposition: 'right',
+        invoicingList: [{
+          label: '航天信息',
+          value: 1
+        }, {
+          label: '百旺',
+          value: 2
+        }],
         formLabelWidth: '300px',
         formLabelWidth: '300px',
         invoicing: '',
         invoicing: '',
         deleteshow: false,
         deleteshow: false,
@@ -422,7 +439,7 @@
         warehouseNameKey: '',
         warehouseNameKey: '',
         warehouseName: '',
         warehouseName: '',
         isShowPrint: false,
         isShowPrint: false,
-        invoicingshow:false,
+        invoicingshow: false,
         printData: {},
         printData: {},
         warehouse: [],
         warehouse: [],
         disabled: false,
         disabled: false,
@@ -446,6 +463,10 @@
           year: dayjs().format('YYYY'),
           year: dayjs().format('YYYY'),
           month: dayjs().format('MM'),
           month: dayjs().format('MM'),
         },
         },
+        accessoryTFs: false,
+        fileList: [],
+        appendixIdsAdd: '',
+        excelFreightspace: [],
       }
       }
     },
     },
     activated() {
     activated() {
@@ -455,37 +476,144 @@
       // this.getList()
       // this.getList()
     },
     },
     updated() {
     updated() {
+
       this.$nextTick(() => {
       this.$nextTick(() => {
         this.$refs['table'].doLayout()
         this.$refs['table'].doLayout()
       })
       })
     },
     },
     methods: {
     methods: {
-      invoicingClose(){
-        this.invoicingshow=false
+      importClick(file, fileList) {
+        this.fileTemp = file.raw
+        let fileName = file.raw.name
+        let fileType = fileName.substring(fileName.lastIndexOf('.') + 1)
+        // 判断上传文件格式
+        if (this.fileTemp) {
+          if (fileType == 'xlsx' || fileType == 'xls') {
+            this.importf(this.fileTemp)
+          } else {
+            this.$message({
+              type: 'warning',
+              message: '附件格式错误,请删除后重新上传!',
+            })
+          }
+        } else {
+          this.$message({
+            type: 'warning',
+            message: '请上传附件!',
+          })
+        }
       },
       },
-      settleaccounts(row){
+      importf(obj) {
+        this.excelFreightspace = []
+        // this.dialogVisible = true;
+        let _this = this;
+        let inputDOM = this.$refs.inputer; // 通过DOM取文件数据
+        this.file = event.currentTarget.files[0];
+        var rABS = false; //是否将文件读取为二进制字符串
+        var f = this.file;
+        var reader = new FileReader();
+        //if (!FileReader.prototype.readAsBinaryString) {
+        FileReader.prototype.readAsBinaryString = function(f) {
+          var binary = "";
+          var rABS = false; //是否将文件读取为二进制字符串
+          var pt = this;
+          var wb; //读取完成的数据
+          var outdata;
+          var reader = new FileReader();
+          reader.onload = function(e) {
+            var bytes = new Uint8Array(reader.result);
+            var length = bytes.byteLength;
+            for (var i = 0; i < length; i++) {
+              binary += String.fromCharCode(bytes[i]);
+            }
+            var XLSX = require('xlsx');
+            if (rABS) {
+              wb = XLSX.read(btoa(fixdata(binary)), { //手动转化
+                type: 'base64',
+                cellDates: true
+              });
+            } else {
+              wb = XLSX.read(binary, {
+                type: 'binary'
+              });
+            }
+            // outdata就是你想要的东西 excel导入的数据
+            outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
+            // excel 数据再处理
+            let arr = []
+            outdata.map(v => {
+              // let jsonString = JSON.stringify(v).replace(/\*/g, '').replace(/\s/ig,'');
+              let jsonString = JSON.stringify(v).replace(/\//g, '').replace(/\s/ig, '');
+              v = JSON.parse(jsonString);
+              let obj = {}
+              //xxx代表列名
+              obj.qualityNo = v.业务编号
+              obj.customerName = v.客户姓名
+              obj.customerNumberCard = v.身份证号
+              obj.customerPhone = v.客户手机号
+              obj.carNumber = v.车牌号
+              obj.grossWeight = v.毛重
+              obj.tare = v.皮重
+              obj.netWeight = v.净重
+              obj.dryGrainPrice = v.单价
+              obj.qualityDate = v.日期
+              _this.excelFreightspace.push(obj)
+            })
+            if (_this.excelFreightspace) {
+              importWord({
+                  warehouseName: _this.warehouseName,
+                  qualityInspectionManagementList: _this.excelFreightspace
+                }).toPromise()
+                .then((response) => {
+                  if (response == 'ok') {
+                    this.$notify({
+                      title: '成功',
+                      message: '导入成功',
+                      type: 'success'
+                    });
+                    _this.getList()
+                  }
+                })
+
+            }
+          }
+          reader.readAsArrayBuffer(f);
+        }
+        if (rABS) {
+          reader.readAsArrayBuffer(f);
+        } else {
+          reader.readAsBinaryString(f);
+        }
+
+      },
+      invoicingClose() {
+        this.invoicingshow = false
+      },
+      settleaccounts(row) {
         this.$confirm('确定将该笔业务进行反结算操作?', '提示', {
         this.$confirm('确定将该笔业务进行反结算操作?', '提示', {
           confirmButtonText: '确定',
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           cancelButtonText: '取消',
           type: 'warning'
           type: 'warning'
         }).then(() => {
         }).then(() => {
 
 
-          suspendinstance({workflowId:row.workflowId,id:row.id}).toPromise()
-          .then((response) => {
-          this.$message({
-            type: 'success',
-            message: '反结算成功!'
-          }); 
-          this.getList()
-          })
+          suspendinstance({
+              workflowId: row.workflowId,
+              id: row.id
+            }).toPromise()
+            .then((response) => {
+              this.$message({
+                type: 'success',
+                message: '反结算成功!'
+              });
+              this.getList()
+            })
         }).catch(() => {
         }).catch(() => {
-          return false       
+          return false
         });
         });
-       
+
       },
       },
       imgshow() {
       imgshow() {
         this.deleteshow = false
         this.deleteshow = false
-        console.log(11111)
       },
       },
       handlePictureCardPreview(file) {
       handlePictureCardPreview(file) {
         this.dialogImageUrl = file.url;
         this.dialogImageUrl = file.url;
@@ -494,8 +622,6 @@
       previewPayOrder(val) {
       previewPayOrder(val) {
         this.paymentReceipt = val.paymentScreenshot
         this.paymentReceipt = val.paymentScreenshot
         this.isPreviewPayOrder = true
         this.isPreviewPayOrder = true
-        console.log(val.paymentScreenshot)
-
       },
       },
       paymentReceiptClose() {},
       paymentReceiptClose() {},
       datechange() {
       datechange() {
@@ -535,7 +661,6 @@
         this.value2 = [formatDate, nowData] // 默认赋值一年时间
         this.value2 = [formatDate, nowData] // 默认赋值一年时间
       },
       },
       selectPrint() {
       selectPrint() {
-        console.log('批量打印数据', this.modification)
         this.printType = 1
         this.printType = 1
         this.isShowPrintType = true
         this.isShowPrintType = true
       },
       },
@@ -555,7 +680,6 @@
         }
         }
       },
       },
       async exportlist() {
       async exportlist() {
-        console.log('导出数据', this.modification)
         let _data = {
         let _data = {
           paymentManagementList: this.modification,
           paymentManagementList: this.modification,
         }
         }
@@ -627,12 +751,12 @@
           xmlhttp.send()
           xmlhttp.send()
         })
         })
       },
       },
-      invoicingconfirm(){
+      invoicingconfirm() {
         let data = {
         let data = {
           paymentManagementList: this.modification,
           paymentManagementList: this.modification,
         }
         }
         for (let i = 0; i < this.modification.length; i++) {
         for (let i = 0; i < this.modification.length; i++) {
-          this.modification[i].invoiceFlag=this.invoiceFlag
+          this.modification[i].invoiceFlag = this.invoiceFlag
           if (
           if (
             this.modification[i].status != '全部付款' &&
             this.modification[i].status != '全部付款' &&
             this.modification[i].status != '部分付款' &&
             this.modification[i].status != '部分付款' &&
@@ -660,7 +784,7 @@
           .catch(() => {})
           .catch(() => {})
       },
       },
       invoicingClick() {
       invoicingClick() {
-        this.invoicingshow=true
+        this.invoicingshow = true
         // let data = JSON.stringify({
         // let data = JSON.stringify({
         //   paymentManagementList : this.modification
         //   paymentManagementList : this.modification
         // })
         // })
@@ -695,7 +819,6 @@
       },
       },
       //合计
       //合计
       getSummaries(param) {
       getSummaries(param) {
-        console.log(param)
         const {
         const {
           columns,
           columns,
           data
           data
@@ -709,7 +832,6 @@
         }
         }
         if (this.modification.length > 0) {
         if (this.modification.length > 0) {
           columns.forEach((column, index) => {
           columns.forEach((column, index) => {
-            console.log(column, index)
             if (index === 0) {
             if (index === 0) {
               sums[index] = '合计'
               sums[index] = '合计'
             } else if (index === 10 || index === 11 || index === 15 || index === 16) {
             } else if (index === 10 || index === 11 || index === 15 || index === 16) {
@@ -775,7 +897,7 @@
             case '打印检斤单':
             case '打印检斤单':
               this.isShowPrintType4 = !this.isShowPrintType4
               this.isShowPrintType4 = !this.isShowPrintType4
               break
               break
-              case '打印回执单':
+            case '打印回执单':
               this.isShowPrintType5 = !this.isShowPrintType5
               this.isShowPrintType5 = !this.isShowPrintType5
               break
               break
           }
           }
@@ -784,7 +906,7 @@
       typePrintCannelClick() {
       typePrintCannelClick() {
         this.isShowPrintType = false
         this.isShowPrintType = false
       },
       },
-     async typePrintClick(type) {
+      async typePrintClick(type) {
         // type 1批量打印 0单个打印
         // type 1批量打印 0单个打印
         //  this.isShowPrint = true
         //  this.isShowPrint = true
         this.selectCustomerList = []
         this.selectCustomerList = []
@@ -793,7 +915,7 @@
           let index1 = 0
           let index1 = 0
           let index2 = 0
           let index2 = 0
           for (let i = 0; i < this.modification.length; i++) {
           for (let i = 0; i < this.modification.length; i++) {
-          await getCustomerLook({
+            await getCustomerLook({
                 id: this.modification[i].identityId,
                 id: this.modification[i].identityId,
                 authenticationStatusKey: 7,
                 authenticationStatusKey: 7,
               })
               })
@@ -809,7 +931,7 @@
                   // this.isShowPrint = true
                   // this.isShowPrint = true
                   this.printBig()
                   this.printBig()
                 }
                 }
-               getpaymentexamine({
+                getpaymentexamine({
                     id: this.modification[i].id,
                     id: this.modification[i].id,
                   })
                   })
                   .toPromise()
                   .toPromise()