lilei 2 gadi atpakaļ
vecāks
revīzija
3feb08d359

+ 8 - 0
src/api/sendBill.js

@@ -42,6 +42,14 @@ export const sendBillQueryPageList = (params) => {
     method: 'post'
   })
 }
+// 导入发货单 
+export const sendBillInsertBatch = (params) => {
+  return axios({
+    url: '/sendBill/insertBatch',
+    data: params,
+    method: 'post',
+  })
+}
 // 导出
 export const sendBillExcel = (params) => {
   const url = `/sendBill/excel`

+ 261 - 0
src/views/salesManagement/sendOutOrder/chooseImportModal.vue

@@ -0,0 +1,261 @@
+<template>
+  <a-modal
+    centered
+    class="chooseImport-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="确认导入"
+    v-model="isShow"
+    @cancel="isShow=false"
+    width="80%">
+    <div class="chooseImport-con">
+      <!-- 可导入数据 -->
+      <p class="">可导入数据{{ loadData.length }}条</p>
+      <a-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.allocateSn"
+        :columns="nowColumns"
+        :dataSource="loadData"
+        :loading="loading"
+        :scroll="{ y: 200 }"
+        :pagination="false"
+        bordered>
+        <!-- 费用承担方 -->
+        <template slot="fycdf" slot-scope="text,record">
+          <div v-for="(item,index) in record.detailSplitList" :key="item.id+'-'+index">
+            {{ item.splitObjName }}<span v-if="item.childDetailSplit&&item.childDetailSplit.splitObjName">/</span>{{ item.childDetailSplit?item.childDetailSplit.splitObjName:'' }}: ¥{{ item.splitAmount }}
+          </div>
+        </template>
+        <!-- 产品信息 -->
+        <template slot="cpxx" slot-scope="text,record">
+          <div v-for="item in record.detailProductsList" :key="item.id">
+            <div v-if="item.productCode">{{ item.productCode }}: ¥{{ item.expense }}</div>
+            <div v-else-if="item.productBrandName">{{ item.productBrandName }}<span v-if="item.productTypeShowName">/</span>{{ item.productTypeShowName }}: ¥{{ item.expense }}</div>
+            <div v-else>{{ item.productTypeShowName }}: ¥{{ item.expense }}</div>
+          </div>
+          <span v-if="!record.detailProductsList||record.detailProductsList.length==0">--</span>
+        </template>
+      </a-table>
+      <a-divider />
+      <!-- 不可导入数据 -->
+      <p class="red">不可导入数据{{ unLoadData.length }}条</p>
+      <a-table
+        class="unTable"
+        ref="unTable"
+        size="small"
+        :rowKey="(record) => record.errorDesc"
+        :columns="nowUnColumns"
+        :dataSource="unLoadData"
+        :loading="loading"
+        :scroll="{ y: 200 }"
+        :pagination="false"
+        bordered>
+        <!-- 费用承担方 -->
+        <template slot="fycdf" slot-scope="text,record">
+          <div v-for="(item,index) in record.detailSplitList" :key="item.no+'-'+index">
+            {{ item.splitObjName }}<span v-if="item.childDetailSplit&&item.childDetailSplit.splitObjName">/</span>{{ item.childDetailSplit?item.childDetailSplit.splitObjName:'' }}: ¥{{ item.splitAmount }}
+          </div>
+        </template>
+        <!-- 产品信息 -->
+        <template slot="cpxx" slot-scope="text,record">
+          <div v-for="(item,index) in record.detailProductsList" :key="item.no+'-'+index">
+            <div v-if="item.productCode">{{ item.productCode }}: ¥{{ item.expense }}</div>
+            <div v-else-if="item.productBrandName">{{ item.productBrandName }}<span v-if="item.productTypeShowName">/</span>{{ item.productTypeShowName }}: ¥{{ item.expense }}</div>
+            <div v-else>{{ item.productTypeShowName }}: ¥{{ item.expense }}</div>
+          </div>
+          <span v-if="!record.detailProductsList||record.detailProductsList.length==0">--</span>
+        </template>
+        <template slot="errorMsg" slot-scope="text,record">
+          <a-popover placement="topRight">
+            <template slot="content">
+              <p v-for="d in record.importErrorMsgList">{{ d }}</p>
+            </template>
+            <a-button type="link">
+              查看
+            </a-button>
+          </a-popover>
+        </template>
+      </a-table>
+      <!-- 按钮 -->
+      <div class="btn-con">
+        <a-button
+          type="primary"
+          id="chooseImport-submit"
+          size="large"
+          :class="loadData.length==0?'button-grey':'button-primary'"
+          @click="handleSubmit"
+          :loading="bloading"
+          style="padding: 0 40px;">确认导入</a-button>
+        <a-button
+          id="chooseImport-cancel"
+          size="large"
+          class="button-cancel"
+          :loading="bloading"
+          @click="isShow=false"
+          style="padding: 0 40px;margin-left: 15px;">取消</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-error"
+          size="large"
+          class="button-error"
+          :loading="bloading"
+          @click="handleError"
+          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { hdExportExcel } from '@/libs/exportExcel'
+import { sendBillInsertBatch } from '@/api/sendBill'
+export default {
+  name: 'ChooseImportModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    paramsData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      bloading: false,
+      isShow: this.openModal, //  是否打开弹框
+      nowColumns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '客户名称', dataIndex: 'customeName', width: '8%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '物流单号', dataIndex: 'transportNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '物流电话', dataIndex: 'transportTele', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '托运日期', dataIndex: 'sendDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '收货人', dataIndex: 'customerCacateName', width: '6%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '收货电话', dataIndex: 'customerCacatePhone', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '收货地址', dataIndex: 'customerAddressDetail', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '目的地', dataIndex: 'customerAddress', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '付款方式', dataIndex: 'payTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '交货方式', dataIndex: 'handoverTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '货物名称', dataIndex: 'sendBillDetailList.goodsName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '件数', dataIndex: 'sendBillDetailList.goodsQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '体积(m3)', dataIndex: 'sendBillDetailList.goodsVolume', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '立方/元', dataIndex: 'sendBillDetailList.cubeAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '重量(kg)', dataIndex: 'sendBillDetailList.goodsWeight', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '每吨/元', dataIndex: 'sendBillDetailList.tonAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '运费(元)', dataIndex: 'sendBillDetailList.transportAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '送货费(元)', dataIndex: 'sendBillDetailList.sendAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '其他(元)', dataIndex: 'sendBillDetailList.otherAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '保价(万)', dataIndex: 'sendBillDetailList.supportValue', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      ],
+      loadData: [],
+      nowUnColumns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '客户名称', dataIndex: 'customeName', width: '8%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '物流单号', dataIndex: 'transportNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '物流电话', dataIndex: 'transportTele', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '托运日期', dataIndex: 'sendDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '收货人', dataIndex: 'customerCacateName', width: '6%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '收货电话', dataIndex: 'customerCacatePhone', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '收货地址', dataIndex: 'customerAddressDetail', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '目的地', dataIndex: 'customerAddress', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '付款方式', dataIndex: 'payTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '交货方式', dataIndex: 'handoverTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '货物名称', dataIndex: 'sendBillDetailList.goodsName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '件数', dataIndex: 'sendBillDetailList.goodsQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '体积(m3)', dataIndex: 'sendBillDetailList.goodsVolume', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '立方/元', dataIndex: 'sendBillDetailList.cubeAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '重量(kg)', dataIndex: 'sendBillDetailList.goodsWeight', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '每吨/元', dataIndex: 'sendBillDetailList.tonAmountStr', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '运费(元)', dataIndex: 'sendBillDetailList.transportAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '送货费(元)', dataIndex: 'sendBillDetailList.sendAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '其他(元)', dataIndex: 'sendBillDetailList.otherAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '保价(万)', dataIndex: 'sendBillDetailList.supportValue', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '错误说明', scopedSlots: { customRender: 'errorMsg' }, width: '10%', align: 'center' }
+      ],
+      unLoadData: [],
+      loading: false
+    }
+  },
+  methods: {
+    getData () {
+      const paramsData = JSON.parse(JSON.stringify(this.paramsData))
+      this.loadData = paramsData.rightList || []
+      this.unLoadData = paramsData.errorList || []
+      this.loadData.map((item, index) => {
+        item.no = index + 1
+        item.sendBillDetailList = item.sendBillDetailList[0]
+      })
+      this.unLoadData.map((item, index) => {
+        item.no = index + 1
+        item.sendBillDetailList = item.sendBillDetailList[0]
+      })
+    },
+    // 确认导入
+    handleSubmit () {
+      if (this.paramsData.rightList.length == 0) {
+        this.$message.warning('没有可导入的发货单!')
+      } else {
+        const data = this.paramsData.rightList
+        this.bloading = true
+        sendBillInsertBatch(data).then(res => {
+          if (res.status == 200) {
+            this.isShow = false
+            this.$emit('ok')
+          }
+          this.bloading = false
+        })
+      }
+    },
+    // 错误项
+    handleError () {
+      const _this = this
+      if (_this.paramsData.errorList.length < 1) {
+        _this.$message.info('暂无错误项!')
+        return
+      }
+      _this.bloading = true
+      hdExportExcel(expenseFailExcel, _this.paramsData.errorList, '发货单导出错误项', function () {
+        _this.bloading = false
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.loadData = []
+        this.unLoadData = []
+      } else {
+        this.getData()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .chooseImport-modal{
+    .chooseImport-con{
+      .red{
+        color: #f30;
+      }
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel,.button-error{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 199 - 0
src/views/salesManagement/sendOutOrder/importGuideModal.vue

@@ -0,0 +1,199 @@
+<template>
+  <a-modal
+    centered
+    class="importGuide-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="导入费用明细"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="800">
+    <div class="importGuide-con">
+      <div class="explain-con">
+        <div class="explain-item">
+          <div class="explain-tit">
+            <span>1</span>准备导入
+          </div>
+          <ul>
+            <li>1) 请先下载导入模板,模板中已标示出必填项</li>
+            <li>2) 如果物流单号相同,则视为同一个发货单</li>
+            <li>3) 同一个发货单可有多个不同类型的类型,包括易损件、电池、机油</li>
+          </ul>
+          <a-button type="link" icon="download" style="padding: 0 0 0 23px;" @click="handleExport">下载导入模板</a-button>
+        </div>
+        <div class="explain-item">
+          <div class="explain-tit">
+            <span>2</span>上传数据文件
+          </div>
+          <p>目前支持的文件类型*.xls,*.xlsx.</p>
+          <div style="overflow: hidden;padding-left: 23px;">
+            <Upload
+              id="importGuide-attachList"
+              ref="importUpload"
+              :maxNums="1"
+              fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+              uploadType="attach"
+              :action="attachAction"
+              :uploadParams="uploadParams"
+              upText="选择导入文件"
+              @remove="resetSearchForm"
+              @change="changeImport"></Upload>
+          </div>
+        </div>
+      </div>
+      <!-- 按钮 -->
+      <div class="btn-con">
+        <a-button
+          type="primary"
+          id="importGuide-nextStep"
+          size="large"
+          class="button-primary"
+          @click="handlerNextStep"
+          style="padding: 0 60px;">下一步</a-button>
+        <a-button
+          id="importGuide-cancel"
+          size="large"
+          class="button-cancel"
+          @click="isShow=false"
+          style="padding: 0 60px;margin-left: 15px;">取消</a-button>
+      </div>
+    </div>
+    <!-- 导入 -->
+    <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
+  </a-modal>
+</template>
+
+<script>
+import ChooseImportModal from './chooseImportModal.vue'
+import { Upload } from '@/components'
+export default {
+  name: 'ImportGuideModal',
+  components: { ChooseImportModal, Upload },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    params: {
+      type: Object,
+      default: null
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      openImportModal: false, //  导入
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/sendBill/importSendBill',
+      paramsData: null,
+      uploadParams: {
+        savePathType: 'local'
+      }
+    }
+  },
+  methods: {
+    // 清空数据
+    resetSearchForm () {
+      this.$refs.importUpload.setFileList() //  清空导入文件
+      this.paramsData = null //  清空上传数据
+    },
+    // 下一步
+    handlerNextStep () {
+      if (this.paramsData) {
+        this.openImportModal = true
+      } else {
+        this.$message.warning('添加文件后再进行下一步操作!')
+      }
+    },
+    // 上传文件  change
+    changeImport (file) {
+      // console.log(file, JSON.parse(file))
+      if (file && JSON.parse(file).length > 0) {
+        this.paramsData = Object.assign({}, JSON.parse(file)[0] || null, this.params)
+      } else {
+        this.paramsData = null
+      }
+    },
+    // 导入
+    hanldeOk (obj) {
+      this.$emit('ok', obj)
+      this.isShow = false
+    },
+    // 关闭
+    handleClose () {
+      this.openImportModal = false
+      this.isShow = false
+    },
+    // 下载模板
+    handleExport () {
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = 'https://jg-ocs.oss-cn-beijing.aliyuncs.com/templ/promo/sendOutOrderImport.xlsx?t=' + new Date().getTime()
+      link.setAttribute('download', '发货单信息导入模板' + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+      document.body.removeChild(link)
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.resetSearchForm()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .importGuide-modal{
+    .importGuide-con{
+      .explain-con{
+        .explain-item{
+          margin-bottom: 10px;
+          .explain-tit{
+            font-weight: bold;
+            span{
+              display: inline-block;
+              width: 18px;
+              height: 18px;
+              line-height: 16px;
+              text-align: center;
+              margin-right: 5px;
+              border-radius: 50%;
+              border: 1px solid rgba(0, 0, 0, 0.3);
+            }
+          }
+          p{
+            margin: 8px 0;
+            padding-left: 23px;
+          }
+          ul{
+            list-style: none;
+            padding: 0;
+            padding-left: 23px;
+            margin: 0;
+            li{
+              line-height: 26px;
+            }
+          }
+        }
+        #importGuide-attachList{
+          width: 100%;
+        }
+      }
+      .btn-con{
+        margin: 10px 0 20px;
+        text-align: center;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 10 - 2
src/views/salesManagement/sendOutOrder/list.vue

@@ -88,6 +88,10 @@
             </a-col>
           </a-row>
         </a-form>
+        <!-- 操作按钮 -->
+        <div class="table-operator">
+          <a-button type="primary" class="button-error" @click="openGuideModal=true">批量导入</a-button>
+        </div>
       </div>
       <!-- 列表 -->
       <s-table
@@ -130,6 +134,8 @@
     <detailModal ref="detailModal" :openModal="showTipModal" @cancel="showTipModal=false" @ok="sendSuccess"></detailModal>
     <!-- 编辑发货单 -->
     <sendGoodModal ref="sendGoodModal" modalTit="编辑发货单" :openModal="showSendGoodModal" @ok="sendSuccess" @cancel="showSendGoodModal=false"></sendGoodModal>
+    <!-- 导入发货单 -->
+    <importGuideModal :openModal="openGuideModal" @close="openGuideModal=false" @ok="resetSearchForm" />
   </a-card>
 </template>
 
@@ -142,17 +148,19 @@ import detailModal from './detailModal.vue'
 import sendGoodModal from '../outboundOrder/sendGoodModal.vue'
 import Area from '@/views/common/area.js'
 import subarea from '@/views/common/subarea.js'
+import ImportGuideModal from './importGuideModal.vue'
 import { sendBillQueryPageList, sendBillExcel } from '@/api/sendBill'
 export default {
   name: 'SendOutOrderList',
   mixins: [commonMixin],
-  components: { STable, VSelect, rangeDate, detailModal, sendGoodModal, Area, subarea },
+  components: { STable, VSelect, rangeDate, detailModal, sendGoodModal, Area, subarea, ImportGuideModal },
   data () {
     return {
       spinning: false,
       exportLoading: false,
       advanced: true, // 高级搜索 展开/关闭
       disabled: false, //  查询、重置按钮是否可操作
+      openGuideModal: false,
       tableHeight: 0,
       time: [],
       sendtime: [],
@@ -284,7 +292,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 210
+      this.tableHeight = window.innerHeight - tableSearchH - 205
     }
   },
   watch: {