Jelajahi Sumber

Merge tag 'Hotfix-zh-260' into develop

Finish Hotfix-zh-260
howie 3 tahun lalu
induk
melakukan
bcc7e3194f

+ 8 - 1
src/api/supply/pickup.js

@@ -18,7 +18,14 @@ export function getListInvoiceNumber(params) {
   })
 }
 
-
+// 是否已打印单据
+export function getDetailPrintDisString(params) {
+  return request({
+    url: '/pick/detailPrintDisString',
+    method: 'post',
+    data:params
+  })
+}
 // 获取详情
 export function getDetail(params) {
   return request({

+ 133 - 1
src/utils/util.js

@@ -224,7 +224,7 @@ export function dateFormat(format, date) {
  * @param url {string} pdf地址
  * @param fileName {string} pdf名称
  */
-export function downloadPdf(url, fileName) {
+ export function downloadPdf(url, fileName) {
   axios({
     method: "get",
     url,
@@ -236,3 +236,135 @@ export function downloadPdf(url, fileName) {
     FileSaver(file, fileName);
   });
 }
+
+
+export function changeNumberMoneyToChinese(money) {
+  // 接收数字或者字符串数字
+  if (typeof money === "string") {
+    if (money === "") return "";
+    if (isNaN(parseFloat(money))) {
+      throw Error(`参数有误:${money},请输入数字或字符串数字`);
+    } else {
+      // 去掉分隔符(,)
+      money = money.replace(/,/g, "");
+    }
+  } else if (typeof money === "number") {
+    // 去掉分隔符(,)
+    money = money.toString().replace(/,/g, "");
+  } else {
+    throw Error(`参数有误:${money},请输入数字或字符串数字`);
+  }
+  // 汉字的数字
+  const cnNums = [
+    "零",
+    "壹",
+    "贰",
+    "叁",
+    "肆",
+    "伍",
+    "陆",
+    "柒",
+    "捌",
+    "玖",
+  ];
+  // 基本单位
+  const cnIntRadice = ["", "拾", "佰", "仟"];
+  // 对应整数部分扩展单位
+  const cnIntUnits = ["", "万", "亿", "兆"];
+  // 对应小数部分单位
+  const cnDecUnits = ["角", "分", "毫", "厘"];
+  // 整数金额时后面跟的字符
+  const cnInteger = "整";
+  // 整型完以后的单位
+  const cnIntLast = "元";
+  // 金额整数部分
+  let IntegerNum;
+  // 金额小数部分
+  let DecimalNum;
+  // 输出的中文金额字符串
+  let ChineseStr = "";
+  // 正负值标记
+  let Symbol = "";
+  // 转成浮点数
+  money = parseFloat(money);
+  // 如果是0直接返回结果
+  if (money === 0) {
+    ChineseStr = cnNums[0] + cnIntLast + cnInteger;
+    return ChineseStr;
+  }
+  // 如果小于0,则将Symbol标记为负,并转为正数
+  if (money < 0) {
+    money = -money;
+    Symbol = "负 ";
+  }
+  // 转换为字符串
+  money = money.toString();
+  // 将整数部分和小数部分分别存入IntegerNum和DecimalNum
+  if (money.indexOf(".") === -1) {
+    IntegerNum = money;
+    DecimalNum = "";
+  } else {
+    const moneyArr = money.split(".");
+    IntegerNum = moneyArr[0];
+    DecimalNum = moneyArr[1].substr(0, 4);
+  }
+  // 获取整型部分转换
+  if (parseInt(IntegerNum, 10) > 0) {
+    let zeroCount = 0;
+    let IntLen = IntegerNum.length;
+    for (let i = 0; i < IntLen; i++) {
+      // 获取整数的每一项
+      let term = IntegerNum.substr(i, 1);
+      // 剩余待处理的数量
+      let surplus = IntLen - i - 1;
+      // 用于获取整数部分的扩展单位
+      // 剩余数量除以4,比如12345,term为1时,expandUnit则为1,
+      // cnIntUnits[expandUnit]对应得到的单位为万
+      let expandUnit = surplus / 4;
+      // 用于获取整数部分的基本单位
+      // 剩余数量取余4,比如123,那么第一遍遍历term为1,surplus为2,baseUnit则为2,
+      // 所以cnIntRadice[baseUnit]对应得到的基本单位为'佰'
+      let baseUnit = surplus % 4;
+      if (term === "0") {
+        zeroCount++;
+      } else {
+        // 连续存在多个0的时候需要补'零'
+        if (zeroCount > 0) {
+          ChineseStr += cnNums[0];
+        }
+        // 归零
+        zeroCount = 0;
+        /*
+   cnNums是汉字的零到玖组成的数组,term则是阿拉伯0-9,
+   直接将阿拉伯数字作为下标获取中文数字
+   例如term是0则cnNums[parseInt(term)]取的就是'零',9取的就是'玖'
+   最后加上单位就转换成功了!
+   这里只加十百千的单位
+   */
+        ChineseStr += cnNums[parseInt(term)] + cnIntRadice[baseUnit];
+      }
+      /*
+   如果baseUnit为0,意味着当前项和下一项隔了一个节权位即隔了一个逗号
+   扩展单位只有大单位进阶才需要,判断是否大单位进阶,则通过zeroCount判断
+   baseUnit === 0即存在逗号,baseUnit === 0 && zeroCount < 4 意为大单位进阶
+ */
+      if (baseUnit === 0 && zeroCount < 4) {
+        ChineseStr += cnIntUnits[expandUnit];
+      }
+    }
+    ChineseStr += cnIntLast;
+  }
+  // 小数部分转换
+  if (DecimalNum !== "") {
+    let decLen = DecimalNum.length;
+    for (let i = 0; i < decLen; i++) {
+      // 同理,参考整数部分
+      let term = DecimalNum.substr(i, 1);
+      if (term !== "0") {
+        ChineseStr += cnNums[Number(term)] + cnDecUnits[i];
+      }
+    }
+  }
+  ChineseStr = Symbol + ChineseStr;
+  return ChineseStr;
+}

+ 2 - 23
src/views/finance/components/design/preview.vue

@@ -7,12 +7,11 @@
     @cancel="hideModal"
     :width="350 + 'mm'"
   >
-    <div :spinning="spinning" style="min-height: 100px">
+    <div v-loading="spinning" style="min-height: 100px">
       <div id="preview_content" ref="printDom"></div>
     </div>
     <template slot="title">
       <div>
-        <!-- <div style="margin-right: 20px">打印预览</div> -->
         <el-button
           :loading="waitShowPrinter"
           type="primary"
@@ -20,7 +19,6 @@
           @click.stop="print"
           >打印</el-button
         >
-        <!-- <el-button type="primary" icon="printer" @click.stop="toPdf">pdf</el-button> -->
       </div>
     </template>
     <template slot="footer">
@@ -30,9 +28,6 @@
 </template>
 
 <script>
-// import { downloadPDF } from '@/utils/pdf'
-import { addPrint } from "./print-data";
-import { detailArr } from "./print-data";
 export default {
   name: "printPreview",
   props: {},
@@ -54,9 +49,6 @@ export default {
   created() {},
   mounted() {},
   methods: {
-    // handleExport() {
-    //   downloadPDF(this.$refs.printDom);
-    // },
     hideModal() {
       this.visible = false;
       this.waitShowPrinter = false;
@@ -66,16 +58,6 @@ export default {
       this.visible = true;
       this.width = width;
       this.hiprintTemplate = hiprintTemplate;
-      printData.addPrintHtml({
-        options: {
-          width: 140,
-          height: 35,
-          top: 180,
-          left: 20,
-          content: this.$refs.printData,
-        },
-      });
-
       setTimeout(() => {
         // eslint-disable-next-line no-undef
         $("#preview_content").html(hiprintTemplate.getHtml(printData));
@@ -83,8 +65,7 @@ export default {
       }, 500);
     },
     print() {
-      this.hiprintTemplate.print({});
-
+      this.hiprintTemplate.print();
       setTimeout(() => {
         this.hideModal();
       }, 2000);
@@ -126,6 +107,4 @@ export default {
 .ant-modal-content {
   margin-bottom: 24px;
 }
-
-
 </style>

+ 21 - 23
src/views/finance/components/receipt_print.vue

@@ -5,7 +5,7 @@
           <el-radio-button v-for="(item, index) in typeList" :key="index" :label="item.value">{{item.label}}</el-radio-button>
         </el-radio-group>
       </div> -->
-  
+
       <div id="printMe">
         <template v-for="(item, i) in detailArr">
           <PrintCommon v-if="currentType === 0" :key="i" :detail-data="item" :company="company" />
@@ -14,17 +14,17 @@
           <PrintShaoguan v-if="currentType === 3" :key="i" :detail-data="item" :company="company" />
         </template>
       </div>
-  
+
       <div class="page-footer">
         <div class="footer">
           <el-button v-print="printObj" type="primary" icon="el-icon-printer">打 印</el-button>
           <el-button @click="goBack">关 闭</el-button>
         </div>
       </div>
-  
+
     </div>
   </template>
-  
+
   <script>
   import print from 'vue-print-nb'
   import { getDeliverDetail } from '@/api/supply/deliver'
@@ -34,7 +34,7 @@
   import PrintFoshan from '@/components/Common/print-foshan'
   import PrintGuangzhou from '@/components/Common/print-guangzhou'
   import PrintShaoguan from '@/components/Common/print-shaoguan'
-  
+
   export default {
     name: 'ReturnDetail',
     componentName: 'ReturnDetail',
@@ -68,39 +68,38 @@
         detailArr: []
       }
     },
-  
+
     created() {
       console.log(this.listItem, '454')
     //   this.listItem.map(k => {
     //     this.getDetail(k.id)
     //   })
-  
+
     //   this.getCompanyList()
     },
-  
+
     methods: {
       // 返回列表
       goBack() {
         // this.$emit('backListFormDetail')
       },
       changeType() {
-  
+
       },
-  
+
       // 获取详情
       getDetail(id) {
         getDeliverDetail({ id: id }).then(res => {
           this.detailArr.push(res.data)
-  
         })
       },
-  
+
       getCompanyList() {
         getCompanyList().then(res => {
           this.company = res.data ? res.data[0].companyName : ''
         })
       },
-  
+
       // 添加次数
       addPrint() {
         const ids = this.detailArr.map(item => {
@@ -112,9 +111,9 @@
           } else {
             return item.invoiceOrderId || item.id
           }
-  
+
         })
-  
+
         // console.log(document.execCommand('print'),'4545');
         addPrints({ ids: ids.join(',') }).then(res => {
           // this.$successMsg('提交成功');
@@ -124,16 +123,16 @@
     }
   }
   </script>
-  
+
   <style>
   body {
     height: auto !important;
   }
   </style>
-  
+
   <style scoped lang="scss">
   @media print {
-  
+
     // 1 毫米 [mm] = 3,779 527 559 055 1 像素 [px]
     //  241mm = ~911px
     //  140mm = ~529px
@@ -150,22 +149,21 @@
       // font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif !important;
       color: #000 !important;
     }
-  
+
     .top-container {
       margin: 20px;
     }
-  
+
   }
-  
+
   .detail-container {
     width: 100%;
     height: auto !important;
     margin-bottom: 50px;
     color: #000 !important;
   }
-  
+
   .top-container {
     margin-bottom: 20px;
   }
   </style>
-  

+ 61 - 41
src/views/finance/receipt_list.vue

@@ -126,8 +126,13 @@
       <!-- 按钮 -->
       <div class="btn-group clearfix">
         <div class="fl">
-          <!-- <el-button type="primary" size="mini" @click="toPrint" :disabled="tableSelection.length < 1">打印发货单
-          </el-button> -->
+          <el-button
+            type="primary"
+            size="mini"
+            @click="toPrint"
+            :disabled="tableSelection.length < 1"
+            >打印发货单
+          </el-button>
         </div>
         <div class="fr">
           <!-- <ExportButton :exUrl="'/k3/receipt/export'" :exParams="exParams" class="exportClass" /> -->
@@ -402,15 +407,16 @@ import { disAutoConnect, hiprint } from "vue-plugin-hiprint";
 disAutoConnect();
 import printPreview from "./components/design/preview.vue";
 import { getCustomerList } from "@/api/finance/wallet";
+import { getCompanyList } from "@/api/user";
 import {
   getK3ReceiptList,
+  getK3ReceiptDetail,
   getK3ReceiptAbandon,
 } from "@/api/finance/receipt_list";
 import ReceiptListDetail from "./components/receipt_list-detail";
 import ReceiptPrint from "@/views/finance/components/receipt_print.vue";
-
+import { changeNumberMoneyToChinese } from "@/utils/util";
 import { numToFixed } from "@/filters";
-import ret from "bluebird/js/release/util";
 export default {
   components: {
     ReceiptPrint,
@@ -438,6 +444,7 @@ export default {
       detailId: null,
       queryItem: {},
       tableSelection: [],
+      company: "",
       panel: "",
       hiprintTemplate: "",
     };
@@ -452,6 +459,7 @@ export default {
   created() {
     this.getDataList({ pageSize: this.pageSize, pageNum: this.currentPage });
     this.getCustomerDataList();
+    this.getCompanyList();
   },
   mounted() {},
   methods: {
@@ -559,43 +567,53 @@ export default {
     },
 
     // 点击打印
-    toPrint(row, type) {
+    async toPrint(row, type) {
+      // 初始化模板,否则生成的模板叠加
       hiprint.init();
       this.hiprintTemplate = new hiprint.PrintTemplate();
-      this.panel = this.hiprintTemplate.addPrintPanel({
-        height: 140,
-        width: 241,
-        fontFamily: "黑体",
-        fontSize: 12.5,
-        paperFooter: 340,
-        paperHeader: 10,
-        paperNumberDisabled: true,
-      });
-      this.panel.addPrintHtml({
-        options: {
-          width: 633,
-          top: 30,
-          left: 20,
+      // 兼容批量打印
+      let params = !type ? this.tableSelection : [row.id];
+      let len = params.length;
+      // 使用 i-- 提升for效率
+      for (let i = len; i > 0; i--) {
+        const { data } = await getK3ReceiptDetail({
+          id: params[i - 1].id || params[i - 1],
+        });
+        // 模板基础配置
+        this.panel = this.hiprintTemplate.addPrintPanel({
+          height: 140,
+          width: 241,
           fontFamily: "黑体",
-          fontSize: 12.5,
-          content: this.setTableDom(),
-        },
-      });
-
-      // this.tableSelection = this.$refs.table.selection;
-      if (!type) {
-        // getDetail(this.tableSelection);
-      } else {
-        this.queryItem = row;
-        // getDetail(row.id)
+          fontSize: 13,
+          paperFooter: 340,
+          paperHeader: 10,
+          paperNumberDisabled: true,
+        });
+        // 获取收款单模板和基础配置
+        this.panel.addPrintHtml({
+          options: {
+            width: 633,
+            top: 30,
+            left: 20,
+            fontFamily: "黑体",
+            fontSize: 13,
+            content: this.setTableDom(data),
+          },
+        });
       }
+      // 预览打印内容
       this.$refs.preView.show(this.hiprintTemplate, this.panel);
     },
+    getCompanyList() {
+      getCompanyList().then((res) => {
+        this.company = res.data ? res.data[0].companyName : "";
+      });
+    },
     // 收款单打印模板
-    setTableDom() {
+    setTableDom(data) {
       return `
        <div style="font-family:'黑体';">
-          <h1 style="text-align:center">弘格贸易有限公司其他收款单</h1>
+          <h1 style="text-align:center">${this.company}其他收款单</h1>
           <div >
             <table border=".5" cellspacing="0" width="856" height="250"
              style="border-color: rgb(0,0,0);
@@ -615,28 +633,30 @@ export default {
               word-break: break-all;">
                 <tr>
                   <td>单据编号</td>
-                  <td>January</td>
+                  <td>${data.billNo}</td>
                   <td>业务日期</td>
-                  <td>January</td>
+                  <td>${data.theTime}</td>
                   <td>打印日期</td>
-                  <td>January</td>
+                  <td>${data.createTime}</td>
                 </tr>
                 <tr>
                   <td>付款单位</td>
-                  <td colspan="3">January</td>
+                  <td colspan="3">${data.customerName}</td>
                   <td>项目费用名称</td>
-                  <td>January</td>
+                  <td>${data.customerType}</td>
                 </tr>
                 <tr>
                   <td>钱包</td>
-                  <td>January</td>
+                  <td>${data.walletName}</td>
                   <td>实收金额</td>
-                  <td>January</td>
-                  <td colspan="2"></td>
+                  <td style="text-align:right">${numToFixed(data.amount)}</td>
+                  <td colspan="2">${changeNumberMoneyToChinese(
+                    data.amount
+                  )}</td>
                 </tr>
                 <tr>
                   <td>备注</td>
-                  <td colspan="5">January</td>
+                  <td colspan="5">${data.remark}</td>
                 </tr>
             </table>
           </div>

+ 357 - 109
src/views/supply/pickup/check.vue

@@ -1,72 +1,136 @@
 <template>
   <div class="app-container">
-
     <div v-show="!isShowPrint">
-      <div class="main-title" style="margin-top: 0;">
+      <div class="main-title" style="margin-top: 0">
         <div class="title">仓库提货确认</div>
       </div>
 
       <div>
-        <el-form ref="screenForm" :model="screenForm" label-width="96px" size="mini" label-position="right">
+        <el-form
+          ref="screenForm"
+          :model="screenForm"
+          label-width="96px"
+          size="mini"
+          label-position="right"
+        >
           <el-row :gutter="20">
             <el-col :xs="24" :sm="8" :lg="6">
               <el-form-item label="提货人手机号" prop="phone">
-                <el-input v-model="screenForm.phone" placeholder="请输入提货人手机号"></el-input>
+                <el-input
+                  v-model="screenForm.phone"
+                  placeholder="请输入提货人手机号"
+                ></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="3" :lg="3">
-              <el-button size="mini" type="primary" @click="getCode" :disabled="!screenForm.phone || countDown != 60">{{countDown == 60 ? getCodeText : '重新获取('+countDown+'s)'}}</el-button>
+              <el-button
+                size="mini"
+                type="primary"
+                @click="getCode"
+                :disabled="!screenForm.phone || countDown != 60"
+                >{{
+                  countDown == 60 ? getCodeText : "重新获取(" + countDown + "s)"
+                }}</el-button
+              >
             </el-col>
             <el-col :xs="24" :sm="8" :lg="8">
               <el-form-item label="验证码" prop="code">
-                <el-input v-model="screenForm.code" placeholder="请输入验证码"></el-input>
+                <el-input
+                  v-model="screenForm.code"
+                  placeholder="请输入验证码"
+                ></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="3" :lg="3">
-              <el-button size="mini" type="primary" :disabled="!screenForm.phone || !screenForm.code" @click="getPickupManInfo">确 认</el-button>
+              <el-button
+                size="mini"
+                type="primary"
+                :disabled="!screenForm.phone || !screenForm.code"
+                @click="getPickupManInfo"
+                >确 认</el-button
+              >
             </el-col>
           </el-row>
           <el-row :gutter="20">
             <el-col :xs="24" :sm="8" :lg="8">
               <el-form-item label="提货人姓名" prop="name">
                 <!-- <el-input v-model="screenForm.name" placeholder="请通过手机验证获取" ></el-input> -->
-                 <el-select style="width:100%" v-model="screenForm.name"  placeholder="请选提货人姓名" clearable filterable  @change="onChage">
-                  <el-option v-for="item in userList"
+                <el-select
+                  style="width: 100%"
+                  v-model="screenForm.name"
+                  placeholder="请选提货人姓名"
+                  clearable
+                  filterable
+                  @change="onChage"
+                >
+                  <el-option
+                    v-for="item in userList"
                     :key="item.id"
                     :label="`${item.takerName} - ${item.customerName}`"
-                    :value="item.id">
+                    :value="item.id"
+                  >
                   </el-option>
                 </el-select>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="8" :lg="8">
               <el-form-item label="提货人身份证" prop="idCard">
-                <el-input v-model="screenForm.idCard" placeholder="请通过手机验证获取" readonly></el-input>
+                <el-input
+                  v-model="screenForm.idCard"
+                  placeholder="请通过手机验证获取"
+                  readonly
+                ></el-input>
               </el-form-item>
             </el-col>
           </el-row>
           <el-row :gutter="20">
             <el-col :xs="24" :sm="8" :lg="8">
               <el-form-item label="经销商" prop="customerName">
-                <el-input v-model="screenForm.customerName" placeholder="经销商" readonly></el-input>
+                <el-input
+                  v-model="screenForm.customerName"
+                  placeholder="经销商"
+                  readonly
+                ></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="8" :lg="8">
               <el-form-item label="仓库" prop="warehouse">
-                <el-select v-model="screenForm.warehouse" placeholder="请选择仓库" filterable clearable style="width: 100%">
-                  <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
+                <el-select
+                  v-model="screenForm.warehouse"
+                  placeholder="请选择仓库"
+                  filterable
+                  clearable
+                  style="width: 100%"
+                >
+                  <el-option
+                    :label="item.name"
+                    :value="item.id"
+                    v-for="(item, index) in warehouseList"
+                    :key="index"
+                  ></el-option>
                 </el-select>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="5" :lg="5">
-              <el-button size="mini" type="primary" @click="getList">查 询</el-button>
+              <el-button size="mini" type="primary" @click="getList"
+                >查 询</el-button
+              >
             </el-col>
           </el-row>
           <el-row :gutter="20">
             <el-col :xs="24" :sm="24" :lg="24">
               <el-form-item prop="status" label-width="0">
-                <el-radio-group v-model="screenForm.status" size="mini" @change="getList()">
-                  <el-radio-button v-for="(item, index) in statusList" :key="index" :label="item.value">{{item.label}}</el-radio-button>
+                <el-radio-group
+                  v-model="screenForm.status"
+                  size="mini"
+                  @change="getList()"
+                >
+                  <el-radio-button
+                    v-for="(item, index) in statusList"
+                    :key="index"
+                    :label="item.value"
+                    >{{ item.label }}</el-radio-button
+                  >
                 </el-radio-group>
               </el-form-item>
             </el-col>
@@ -83,98 +147,239 @@
 
       <div class="mymain-container">
         <div class="table">
-          <el-table ref="table" v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe @select="handleSelect" @select-all="handleSelectAll">
-            <el-table-column align="left" type="selection" width="55"></el-table-column>
+          <el-table
+            ref="table"
+            v-loading="listLoading"
+            :data="dataList"
+            element-loading-text="Loading"
+            border
+            fit
+            highlight-current-row
+            stripe
+            @select="handleSelect"
+            @select-all="handleSelectAll"
+          >
+            <el-table-column
+              align="left"
+              type="selection"
+              width="55"
+            ></el-table-column>
             <!-- <el-table-column align="left" 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 align="left" label="状态" min-width="100" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="状态"
+              min-width="100"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
-                {{ scope.row.printNum ? '已打单(' + scope.row.printNum + ')' : '未打单' }}
+                {{
+                  scope.row.printNum
+                    ? "已打单(" + scope.row.printNum + ")"
+                    : "未打单"
+                }}
               </template>
             </el-table-column>
-            <el-table-column align="left" label="信息密钥" prop="informationKey" min-width="120" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="信息密钥"
+              prop="informationKey"
+              min-width="120"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
                 <CopyButton :copyText="scope.row.informationKey" />
-                <span>{{scope.row.informationKey}}</span>
+                <span>{{ scope.row.informationKey }}</span>
               </template>
             </el-table-column>
-            <el-table-column align="left" label="经销商编码" prop="customerNumber" min-width="100" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="经销商编码"
+              prop="customerNumber"
+              min-width="100"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
                 <CopyButton :copyText="scope.row.customerNumber" />
-                <span>{{scope.row.customerNumber}}</span>
+                <span>{{ scope.row.customerNumber }}</span>
               </template>
             </el-table-column>
-            <el-table-column align="left" label="经销商名称" prop="customerName" min-width="250" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="经销商名称"
+              prop="customerName"
+              min-width="250"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
                 <CopyButton :copyText="scope.row.customerName" />
-                <span>{{scope.row.customerName}}</span>
+                <span>{{ scope.row.customerName }}</span>
               </template>
             </el-table-column>
-            <el-table-column align="left" label="预约日期" prop="pickTime" min-width="120" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="预约日期"
+              prop="pickTime"
+              min-width="120"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
                 {{ scope.row.pickTime | dateToDayFilter }}
               </template>
             </el-table-column>
-            <el-table-column align="left" label="提货时段" min-width="100" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="提货时段"
+              min-width="100"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
-                {{ scope.row.pickStatus == '1' ? '上午':'下午' }}
+                {{ scope.row.pickStatus == "1" ? "上午" : "下午" }}
               </template>
             </el-table-column>
-            <el-table-column align="left" label="销售订单号" prop="mainOrderId" min-width="160" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="销售订单号"
+              prop="mainOrderId"
+              min-width="160"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
-                <CopyButton :copyText="(scope.row.orderType == 'HOME' || scope.row.orderType == 'TRADE') ? scope.row.enginOrderNo: scope.row.mainOrderId" />
-                <span>{{ (scope.row.orderType == 'HOME' || scope.row.orderType == 'TRADE') ? scope.row.enginOrderNo: scope.row.mainOrderId }}</span>
+                <CopyButton
+                  :copyText="
+                    scope.row.orderType == 'HOME' ||
+                    scope.row.orderType == 'TRADE'
+                      ? scope.row.enginOrderNo
+                      : scope.row.mainOrderId
+                  "
+                />
+                <span>{{
+                  scope.row.orderType == "HOME" ||
+                  scope.row.orderType == "TRADE"
+                    ? scope.row.enginOrderNo
+                    : scope.row.mainOrderId
+                }}</span>
               </template>
             </el-table-column>
-            <el-table-column align="left" label="发货申请单号" prop="invoiceId" min-width="130" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="发货申请单号"
+              prop="invoiceId"
+              min-width="130"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
                 <CopyButton :copyText="scope.row.invoiceId" />
-                <span>{{scope.row.invoiceId}}</span>
+                <span>{{ scope.row.invoiceId }}</span>
               </template>
             </el-table-column>
-            <el-table-column align="left" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="销售类型"
+              prop="saleTypeName"
+              min-width="100"
+              show-overflow-tooltip
+            ></el-table-column>
+            <el-table-column
+              align="left"
+              label="物料编码"
+              prop="materialCode"
+              min-width="120"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
                 <CopyButton :copyText="scope.row.materialCode" />
-                <span>{{scope.row.materialCode}}</span>
+                <span>{{ scope.row.materialCode }}</span>
               </template>
             </el-table-column>
-            <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="140" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="产品编码"
+              prop="materialOldNumber"
+              min-width="140"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
                 <CopyButton :copyText="scope.row.materialOldNumber" />
-                <span>{{scope.row.materialOldNumber}}</span>
+                <span>{{ scope.row.materialOldNumber }}</span>
               </template>
             </el-table-column>
-            <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="产品名称"
+              prop="materialName"
+              min-width="160"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
                 <CopyButton :copyText="scope.row.materialName" />
-                <span>{{scope.row.materialName}}</span>
+                <span>{{ scope.row.materialName }}</span>
               </template>
             </el-table-column>
-            <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="规格型号"
+              prop="specification"
+              min-width="350"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
                 <CopyButton :copyText="scope.row.specification" />
-                <span>{{scope.row.specification}}</span>
+                <span>{{ scope.row.specification }}</span>
               </template>
             </el-table-column>
-            <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="left" label="数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column
+              align="left"
+              label="单位"
+              prop="unit"
+              min-width="100"
+              show-overflow-tooltip
+            ></el-table-column>
+            <el-table-column
+              align="left"
+              label="数量"
+              prop="refundableQty"
+              min-width="100"
+              show-overflow-tooltip
+            ></el-table-column>
             <!-- <el-table-column align="left" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="left" label="金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="left" label="使用返利金额" prop="payRebateAmount" min-width="120" show-overflow-tooltip></el-table-column>
             <el-table-column align="left" label="格力折扣" prop="totalDiscAmount" min-width="100" show-overflow-tooltip></el-table-column> -->
-            <el-table-column align="left" label="仓库" prop="correspondName" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="left" label="提货方式" prop="pickType" min-width="100" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="仓库"
+              prop="correspondName"
+              min-width="160"
+              show-overflow-tooltip
+            ></el-table-column>
+            <el-table-column
+              align="left"
+              label="提货方式"
+              prop="pickType"
+              min-width="100"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
-                {{ scope.row.pickType == '1' ? '自提':'物流快递' }}
+                {{ scope.row.pickType == "1" ? "自提" : "物流快递" }}
               </template>
             </el-table-column>
-            <el-table-column align="left" label="提货人/物流公司" prop="takerName" min-width="160" show-overflow-tooltip>
+            <el-table-column
+              align="left"
+              label="提货人/物流公司"
+              prop="takerName"
+              min-width="160"
+              show-overflow-tooltip
+            >
               <template slot-scope="scope">
-                {{ scope.row.pickType == '1' ? scope.row.takerName:scope.row.pickLogistics }}
+                {{
+                  scope.row.pickType == "1"
+                    ? scope.row.takerName
+                    : scope.row.pickLogistics
+                }}
               </template>
             </el-table-column>
           </el-table>
@@ -196,18 +401,39 @@
 
       <div class="page-footer">
         <div class="footer">
-          <el-button type="primary" @click="toPrint" :disabled="tableSelection.length < 1" v-if="$checkBtnRole('print', $route.meta.roles)">打印发货单</el-button>
+          <el-button
+            type="primary"
+            @click="toPrint"
+            :disabled="tableSelection.length < 1"
+            v-if="$checkBtnRole('print', $route.meta.roles)"
+            >打印发货单</el-button
+          >
         </div>
       </div>
-
     </div>
 
-    <el-dialog title="密码确认" :visible.sync="isShowDialog" :show-close="false" width="40%" :close-on-click-modal="false">
-      <el-form ref="dialogForm" :model="dialogForm" :rules="dialogFormRules" label-position="right" label-width="70px">
+    <el-dialog
+      title="密码确认"
+      :visible.sync="isShowDialog"
+      :show-close="false"
+      width="40%"
+      :close-on-click-modal="false"
+    >
+      <el-form
+        ref="dialogForm"
+        :model="dialogForm"
+        :rules="dialogFormRules"
+        label-position="right"
+        label-width="70px"
+      >
         <el-row :gutter="20">
           <el-col :xs="24" :sm="24" :lg="24">
             <el-form-item label="密码" prop="password">
-              <el-input v-model="dialogForm.password" autocomplete="off" placeholder="请输入密码"></el-input>
+              <el-input
+                v-model="dialogForm.password"
+                autocomplete="off"
+                placeholder="请输入密码"
+              ></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :lg="12">
@@ -215,9 +441,16 @@
               <el-input v-model="dialogForm.createMan" readonly></el-input>
             </el-form-item>
           </el-col>
-          <el-col :xs="24" :sm="12" :lg="12" style="height: 51px;">
+          <el-col :xs="24" :sm="12" :lg="12" style="height: 51px">
             <el-form-item label="操作日期" prop="createDate">
-              <el-date-picker v-model="dialogForm.createDate" readonly type="date" value-format="yyyy-MM-dd" style="width: 100%;" placeholder="选择日期">
+              <el-date-picker
+                v-model="dialogForm.createDate"
+                readonly
+                type="date"
+                value-format="yyyy-MM-dd"
+                style="width: 100%"
+                placeholder="选择日期"
+              >
               </el-date-picker>
             </el-form-item>
           </el-col>
@@ -231,7 +464,6 @@
     <print-preview ref="preView" />
 
     <!-- <PickupPrint :listItem="queryItem" v-if="isShowPrint" @backListFormDetail="backList" /> -->
-
   </div>
 </template>
 
@@ -242,6 +474,7 @@ import {
   getPickupManInfo,
   checkPassword,
   getWarehouseList,
+  getDetailPrintDisString,
 } from "@/api/supply/pickup";
 import print from "@/mixin/print";
 
@@ -249,12 +482,11 @@ import { getDealerList, getListCustomer } from "@/api/basic_data/dealer";
 
 import PickupPrint from "@/views/supply/pickup/components/pickup_print";
 
-
-import printPreview from './components/design/preview.vue'
+import printPreview from "./components/design/preview.vue";
 export default {
   components: {
     PickupPrint,
-    printPreview
+    printPreview,
   },
   mixins: [print],
   data() {
@@ -272,9 +504,9 @@ export default {
         idCard: "",
         manId: "",
         status: 0,
-        customerName: '',
-        warehouse: '',
-        customerId:''
+        customerName: "",
+        warehouse: "",
+        customerId: "",
       },
       statusList: [
         { label: "未打单", value: 0 },
@@ -290,7 +522,7 @@ export default {
 
       queryItem: {},
       isShowPrint: false,
-      dealerList:[],
+      dealerList: [],
       isShowDialog: false,
       dialogForm: {
         password: "",
@@ -300,7 +532,7 @@ export default {
       dialogFormRules: {
         password: [{ required: true, message: "请输入密码", trigger: "blur" }],
       },
-      userList:[],
+      userList: [],
       isShowDialog: false,
     };
   },
@@ -316,16 +548,15 @@ export default {
 
   created() {
     // this.getDealerList()
-    this.getWarehouseList()
+    this.getWarehouseList();
   },
   // activated(){
   //   this.initPrint()
   // },
   mounted() {
-    this.initPrint()
+    this.initPrint();
   },
   methods: {
-
     getDate() {
       var date = new Date();
       var seperator1 = "-";
@@ -351,10 +582,10 @@ export default {
     getWarehouseList() {
       getWarehouseList({
         pageNum: 1,
-        pageSize: -1
+        pageSize: -1,
       }).then((res) => {
         this.warehouseList = res.data.records;
-      })
+      });
     },
 
     // 获取短信验证码
@@ -383,39 +614,38 @@ export default {
         this.screenForm.name = `${res.data[0].takerName} - ${res.data[0].customerName}`;
         this.screenForm.idCard = res.data[0].identity;
         this.screenForm.manId = res.data[0].id;
-        this.screenForm.customerName = res.data[0].customerName
-        this.screenForm.customerId = res.data[0].customerId
-        this.userList = res.data
-        this.getListCustomer()
+        this.screenForm.customerName = res.data[0].customerName;
+        this.screenForm.customerId = res.data[0].customerId;
+        this.userList = res.data;
+        this.getListCustomer();
       });
     },
 
-    onChage(e){
-       const  userInfo =   this.userList.filter(k=>{
-          return e === k.id
-        })
-     this.screenForm.name = `${userInfo[0].takerName} - ${userInfo[0].customerName}`;
-        this.screenForm.idCard = userInfo[0].identity;
-        this.screenForm.manId = userInfo[0].id;
-        this.screenForm.customerName = userInfo[0].customerName
-        this.screenForm.customerId = userInfo[0].customerId
+    onChage(e) {
+      const userInfo = this.userList.filter((k) => {
+        return e === k.id;
+      });
+      this.screenForm.name = `${userInfo[0].takerName} - ${userInfo[0].customerName}`;
+      this.screenForm.idCard = userInfo[0].identity;
+      this.screenForm.manId = userInfo[0].id;
+      this.screenForm.customerName = userInfo[0].customerName;
+      this.screenForm.customerId = userInfo[0].customerId;
     },
 
-    getListCustomer(){
+    getListCustomer() {
       getListCustomer({
-        keyword:'',
+        keyword: "",
         phone: this.screenForm.phone,
-        pageNum:1,
-        pageSize:-1
-      }).then(res=>{
-        this.dealerList = res.data.records
+        pageNum: 1,
+        pageSize: -1,
+      }).then((res) => {
+        this.dealerList = res.data.records;
         // this.screenForm.customerNumber = this.dataList[0].number
-      })
+      });
     },
 
     // 查询列表
     getList() {
-
       console.log(this.screenForm.customerId);
       if (!this.screenForm.manId) {
         return this.$errorMsg("请先查询提货人信息");
@@ -433,7 +663,7 @@ export default {
         takerPhone: this.screenForm.phone,
         // customerName:this.screenForm.customerName,
         correspondId: this.screenForm.warehouse,
-        customerId:this.screenForm.customerId
+        customerId: this.screenForm.customerId,
       };
       getPickupList(params).then((res) => {
         this.dataList = res.data.records;
@@ -486,24 +716,39 @@ export default {
     },
 
     // 点击打印
-    toPrint() {
-
-      if (!this.tableSelection[0].printNum) {
-        this.queryItem = this.tableSelection;
-        console.log(this.tableSelection);
-        this.getDateil(this.tableSelection,'getDtailPrintDis');
-        this.$refs.preView.show(this.hiprintTemplate, this.outputData);
+    async toPrint() {
+      const params = [];
+      const len = this.tableSelection.length;
+      this.queryItem = this.tableSelection;
+      for (let i = len; i > 0; i--) {
+        params.push({
+          id: this.tableSelection[i - 1].id,
+          invoiceId: this.tableSelection[i - 1].invoiceId,
+        });
+      }
+      const { data } = await getDetailPrintDisString(params);
+      console.log(data);
+      if (data) {
+        this.$confirm(<p class="text">{data}</p>, "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          customClass: "text",
+        })
+          .then(() => {
+            if (this.tableSelection[0].printNum) {
+              this.dialogForm.createMan = JSON.parse(
+                localStorage.getItem("supply_user")
+              ).nickName;
+              this.dialogForm.createDate = this.getDate();
+              this.isShowDialog = true;
+            }
+          })
       } else {
-        this.queryItem = this.tableSelection;
-        this.dialogForm.createMan = JSON.parse(
-          localStorage.getItem("supply_user")
-        ).nickName;
-        this.dialogForm.createDate = this.getDate();
-        this.isShowDialog = true;
+        this.getDateil(this.tableSelection, "getDtailPrintDis");
+        this.$refs.preView.show(this.hiprintTemplate, this.outputData);
       }
     },
 
-
     // 关闭弹窗
     cancelDialogForm() {
       this.isShowDialog = false;
@@ -520,7 +765,7 @@ export default {
           };
           checkPassword(params).then((res) => {
             this.cancelDialogForm();
-            this.getDateil(this.tableSelection,'getDtailPrintDis');
+            this.getDateil(this.tableSelection, "getDtailPrintDis");
             this.$refs.preView.show(this.hiprintTemplate, this.outputData);
           });
         }
@@ -544,4 +789,7 @@ export default {
     padding-left: 10px;
   }
 }
+.text {
+  word-break: break-all !important;
+}
 </style>

+ 1 - 1
src/views/supply/sales/sales_list.vue

@@ -170,7 +170,7 @@
             >
           </div>
           <div class="fr">
-            <ExportButton :exUrl="'sale/order/export'" :exParams="exParams" />
+            <ExportButton :exUrl="'sale/order/exportChuku'" :exParams="exParams" />
           </div>
         </div>
         <div class="table">