lilei 2 dni temu
rodzic
commit
3d8defb673

BIN
public/templ/销售退货价格修改模板.xlsx


+ 25 - 0
src/api/salesReturnDetail.js

@@ -224,4 +224,29 @@ export const insertByCustomerService = (params) => {
         'module': encodeURIComponent('新增产品(客服确认添加)')
     }
   })
+}
+
+// 批量导入-修改价格
+export const updateBatchUpdatePrice = (params) => {
+  return axios({
+    url: '/salesReturn/detail/updateBatchUpdatePrice',
+    data: params,
+    method: 'post',
+    headers:{
+        'module': encodeURIComponent('批量导入修改价格')
+    }
+  })
+}
+
+// 批量导入修改价格错误项
+export const salesReturnDetailExportErrorUpdatePrice = (params) => {
+  return axios({
+    url: '/salesReturn/detail/exportErrorUpdatePrice',
+    data: params,
+    method: 'post',
+    responseType: 'blob',
+    headers:{
+        'module': encodeURIComponent('批量导入修改价格错误项')
+    }
+  })
 }

+ 196 - 0
src/views/salesReturnManagement/custConfirm/chooseImportModal.vue

@@ -0,0 +1,196 @@
+<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>
+      </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="errorMsg" slot-scope="text,record">
+          <a-popover placement="topRight">
+            <template slot="content">
+              <p v-for="d in record.importErrorMsgSet">{{ 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="unLoadData.length?'button-grey':'button-primary'"
+          @click="handleSubmit"
+          style="padding: 0 40px;">确认导入</a-button>
+        <a-button
+          id="chooseImport-cancel"
+          size="large"
+          class="button-cancel"
+          @click="isShow=false"
+          style="padding: 0 40px;margin-left: 15px;">取消</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-error"
+          size="large"
+          class="button-error"
+          @click="handleError"
+          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { salesReturnDetailExportErrorUpdatePrice } from '@/api/salesReturnDetail.js'
+export default {
+  name: 'ChooseImportModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    paramsData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    const _this = this
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      nowColumns: [
+        { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省级价', dataIndex: 'provincePrice', width: '15%', align: 'center', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        { title: '市级价', dataIndex: 'cityPrice', width: '15%', align: 'center', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        { title: '特约价', dataIndex: 'specialPrice', width: '15%', align: 'center', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        { title: '退货单价说明', dataIndex: 'priceRemark', width: '30%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      loadData: [],
+      nowUnColumns: [
+        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省级价', dataIndex: 'provincePrice', width: '12%', align: 'center', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        { title: '市级价', dataIndex: 'cityPrice', width: '12%', align: 'center', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        { title: '特约价', dataIndex: 'specialPrice', width: '12%', align: 'center', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        { title: '退货单价说明', dataIndex: 'priceRemark', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '错误说明', scopedSlots: { customRender: 'errorMsg' }, width: '23%', 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
+      })
+      this.unLoadData.map((item, index) => {
+        item.no = index + 1
+        item.importErrorMsgSet = item.remarks.split(',')
+      })
+    },
+    // 确认导入
+    handleSubmit () {
+      if (this.unLoadData.length) {
+        this.$message.warning('有错误数据不可导入,请修改正确后再试!')
+      } else {
+        const data = this.paramsData.rightList
+        this.$emit('ok', data)
+        this.isShow = false
+      }
+    },
+    // 导出
+    handleError () {
+      const _this = this
+      if (_this.paramsData.errorList.length < 1) {
+        _this.$message.info('暂无可导出错误项~')
+        return
+      }
+      const rightList = _this.paramsData.rightList || []
+      const errorList = _this.paramsData.errorList || []
+      const exportData = errorList.concat(rightList)
+      _this.spinning = true
+      hdExportExcel(salesReturnDetailExportErrorUpdatePrice, exportData, '批量导入修改价格错误项', function () {
+        _this.spinning = 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>

+ 203 - 0
src/views/salesReturnManagement/custConfirm/importGuideModal.vue

@@ -0,0 +1,203 @@
+<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) 导入的Excel文件中必须包含"产品编码"、"省级价"、"市级价"、"特约价"、"退货单价说明"5列</li>
+            <li>2) 产品编码必须系统中已经存在的产品</li>
+            <li>3) 产品编码、省级价、市级价、特约价不能为空</li>
+            <li>
+              <a :href="filePath" style="margin: 5px 0 0;display: block;">
+                <a-icon type="download" style="padding-right: 5px;" />下载导入模板
+              </a>
+            </li>
+          </ul>
+        </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
+    },
+    goodFlag: {
+      type: [String, Number],
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      openImportModal: false, //  导入
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/salesReturn/detail/importUpdatePrice',
+      paramsData: null,
+      uploadParams: {
+        savePathType: 'local',
+        salesReturnBillSn: this.params.salesReturnBillSn
+      },
+      filePath: ''
+    }
+  },
+  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) {
+      if (obj && obj.length > 0) {
+        this.$emit('ok', obj)
+        this.isShow = false
+      }
+    },
+    // 关闭
+    handleClose () {
+      this.openImportModal = false
+      this.isShow = false
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.resetSearchForm()
+      } else {
+        this.filePath = location.protocol + '//' + location.host + '/templ/销售退货价格修改模板.xlsx'
+      }
+    }
+  }
+}
+</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>

+ 25 - 3
src/views/salesReturnManagement/custConfirm/list.vue

@@ -36,7 +36,13 @@
             :loading="loading"
             @click="openPlSetReason">批量设置退货原因</a-button>
           <span style="margin-left:10px;" v-if="selNums">已选{{ selNums }}项</span>
-          <a-button style="margin-left:10px;" type="primary" class="button-error" :loading="loading">批量导入退货单价</a-button>
+          <a-button
+            style="margin-left:10px;"
+            ghost
+            type="primary"
+            @click="openGuideModal=true"
+            class="button-error"
+            :loading="loading">批量导入退货单价</a-button>
           <div style="float:right;color:#999;margin-top:8px;">说明:红色行表示收货时新增的产品;黄色行表示客服确认时新增的产品;退货原因文字显示红色表示退货原因和退货类别不一致;</div>
         </div>
         <!-- 已选配件列表 -->
@@ -227,6 +233,8 @@
         </div>
       </div>
     </commonModal>
+    <!-- 批量导入修改价格 -->
+    <importGuideModal :params="{salesReturnBillSn: $route.params.sn}" :openModal="openGuideModal" @close="openGuideModal=false" @ok="importOk" />
   </div>
 </template>
 
@@ -237,8 +245,9 @@ import setPriceModal from './setPriceModal.vue'
 import commonModal from '@/views/common/commonModal.vue'
 import returnReason from '@/views/common/returnReason'
 import chooseProductsModal from '../receiveCheck/chooseProductsModal.vue'
+import importGuideModal from './importGuideModal.vue'
 import { salesReturnDetail, customerServiceConfirm } from '@/api/salesReturn'
-import { salesReturnDetailList, updateByCustomerService, deleteByCustomerService, insertByCustomerService, salesReturnDetailSetReason, salesReturnAgainCreate } from '@/api/salesReturnDetail'
+import { salesReturnDetailList, updateByCustomerService, deleteByCustomerService, insertByCustomerService, salesReturnDetailSetReason, salesReturnAgainCreate, updateBatchUpdatePrice } from '@/api/salesReturnDetail'
 export default {
   name: 'CustConfirm',
   mixins: [commonMixin],
@@ -248,12 +257,14 @@ export default {
     setPriceModal,
     chooseProductsModal,
     returnReason,
-    commonModal
+    commonModal,
+    importGuideModal
   },
   data () {
     return {
       spinning: false,
       tableHeight: 0, // 表格高度
+      openGuideModal: false,
       orderSn: null,
       disabled: false,
       showEditRemarks: false,
@@ -337,6 +348,17 @@ export default {
     }
   },
   methods: {
+    // 确认批量修改价格
+    importOk (data) {
+      this.spinning = true
+      updateBatchUpdatePrice({ detailList: data, salesReturnBillSn: this.orderSn }).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm(false)
+          this.$message.info(res.message)
+        }
+        this.spinning = false
+      })
+    },
     // 生成新销退单
     setNewSalesRetrunOrder () {
       if (!this.selNums) {

+ 5 - 0
src/views/salesReturnManagement/salesReturn/salesReturnEdit.vue

@@ -295,6 +295,11 @@ export default {
         this.plReturnRemark = undefined
         this.showEditRemarks = false
       }
+    },
+    showEditModal (a, b) {
+      if (!a) {
+        this.newWarehouseSn = undefined
+      }
     }
   },
   computed: {