浏览代码

销售退货接口

lilei 2 年之前
父节点
当前提交
aec9301061

+ 1 - 11
src/config/router.config.js

@@ -547,22 +547,12 @@ export const asyncRouterMap = [
                    // permission: 'M_salesReturn'
                  }
                },
-               {
-                 path: 'salesReturnGrabEdit/:sn/:buyerSn',
-                 name: 'salesReturnGrabEdit',
-                 component: () => import(/* webpackChunkName: "salesReturnManagement" */ '@/views/salesReturnManagement/salesReturn/salesReturnGrabEdit.vue'),
-                 meta: {
-                   title: '编辑销售退货(抓单)',
-                   icon: 'fund',
-                   hidden: true
-                 }
-               },
                {
                  path: 'salesReturnEdit/:sn/:buyerSn',
                  name: 'salesReturnEdit',
                  component: () => import(/* webpackChunkName: "salesReturnManagement" */ '@/views/salesReturnManagement/salesReturn/salesReturnEdit.vue'),
                  meta: {
-                   title: '编辑销售退货(不抓单)',
+                   title: '编辑销售退货',
                    icon: 'fund',
                    hidden: true
                  }

+ 6 - 6
src/views/salesReturnManagement/salesReturn/chooseCustomModal.vue

@@ -39,12 +39,12 @@
         </a-row>
         <a-row :gutter="15">
           <a-col :span="20">
-            <a-form-model-item label="是否同步" prop="grabFlag">
+            <a-form-model-item label="是否同步" prop="syncFlag">
               <v-select
                 code="FLAG"
                 showType="radio"
-                id="chooseCustom-grabFlag"
-                v-model="form.grabFlag"
+                id="chooseCustom-syncFlag"
+                v-model="form.syncFlag"
                 allowClear
                 placeholder="请选择"></v-select>
             </a-form-model-item>
@@ -94,11 +94,11 @@ export default {
         countySn: '', // 区
         countyName: '',
         customerAddr: '', //  详细地址
-        grabFlag: undefined // 是否抓单
+        syncFlag: undefined // 是否同步
       },
       rules: {
         buyerSn: [{ required: true, message: '请选择客户', trigger: ['change', 'blur'] }],
-        grabFlag: [{ required: true, message: '请选择是否同步', trigger: ['change', 'blur'] }]
+        syncFlag: [{ required: true, message: '请选择是否同步', trigger: ['change', 'blur'] }]
       },
       fetching: false,
       dealerData: []
@@ -189,7 +189,7 @@ export default {
         countySn: '', // 区
         countyName: '',
         customerAddr: '', //  详细地址
-        grabFlag: undefined // 是否抓单
+        syncFlag: undefined // 是否同步
       }
       this.$refs.ruleForm.resetFields()
       this.dealerData = []

+ 7 - 5
src/views/salesReturnManagement/salesReturn/list.vue

@@ -45,9 +45,9 @@
               <a-col :md="6" :sm="24">
                 <a-form-item label="是否同步给客户">
                   <v-select
-                    v-model="queryParam.syncToCustomFlag"
-                    ref="syncToCustom"
-                    id="salesReturn-syncToCustom"
+                    v-model="queryParam.syncFlag"
+                    ref="syncFlag"
+                    id="salesReturn-syncFlag"
                     code="FLAG"
                     placeholder="请选择是否同步给客户"
                     allowClear></v-select>
@@ -229,6 +229,7 @@ export default {
         buyerSn: undefined, //  客户名称
         salesReturnBillNo: undefined, //  总部销退单号
         purchaseReturnBillNo: '',
+        syncFlag: undefined, // 是否同步给客户
         billStatus: undefined, // 业务状态
         subareaSn: undefined,
         shippingAddrProvinceSn: undefined,
@@ -264,7 +265,7 @@ export default {
         { title: '编号', dataIndex: 'no', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单据来源', dataIndex: 'salesReturnBillSourceDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '是否同步给客户', dataIndex: 'asyncFlag', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '是否同步给客户', dataIndex: 'syncFlagDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '客户采退申请单号', dataIndex: 'purchaseReturnBillNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '总部销退单号', scopedSlots: { customRender: 'salesReturnBillNo' }, width: '10%', align: 'center' },
         { title: '客户名称', dataIndex: 'buyerName', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
@@ -300,7 +301,7 @@ export default {
     },
     // 编辑
     handleEdit (row) {
-      this.$router.push({ name: row.grabFlag == 1 ? 'salesReturnGrabEdit' : 'salesReturnEdit', params: { sn: row.salesReturnBillSn, buyerSn: row.buyerSn } })
+      this.$router.push({ name: 'salesReturnEdit', params: { sn: row.salesReturnBillSn, buyerSn: row.buyerSn } })
     },
     // 详情
     handleDetail (row) {
@@ -362,6 +363,7 @@ export default {
       this.queryParam.purchaseReturnBillNo = ''
       this.queryParam.billStatus = undefined
       this.queryParam.subareaSn = undefined
+      this.queryParam.syncFlag = undefined
       this.queryParam.salesReturnBillSource = undefined
       this.queryParam.shippingAddrProvinceSn = undefined
       this.$refs.table.refresh(true)

+ 33 - 72
src/views/salesReturnManagement/salesReturn/queryPart.vue

@@ -4,11 +4,6 @@
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
         <a-row :gutter="15">
-          <a-col :md="6" :sm="24" v-if="grabFlag == 1">
-            <a-form-item label="销售单号">
-              <a-input id="salesReturnList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
-            </a-form-item>
-          </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="产品编码">
               <a-input id="salesReturnList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
@@ -35,23 +30,33 @@
       :columns="columns"
       :data="loadData"
       :customRow="handleClickRow"
-      :rowClassName="(record, index) => (grabFlag == '1'&&record.refundableQty==0) ? 'redBg-row':''"
       :defaultLoadData="false"
       :scroll="{ y: 300 }"
       bordered>
-      <!-- 本次退货数量 -->
+      <!-- 申请退货数量 -->
       <template slot="qty" slot-scope="text, record">
         <div @dblclick.stop>
           <a-input-number
             size="small"
             v-model="record.qty"
             :precision="0"
-            :min="0"
+            :min="1"
             :max="999999"
             style="width: 100%;"
             placeholder="请输入" />
         </div>
       </template>
+      <!-- 退货原因 -->
+      <template slot="returnReason" slot-scope="text, record">
+        <div @dblclick.stop>
+          <v-select
+            style="width:100%;"
+            v-model="record.returnReason"
+            code="RETURN_REASON"
+            placeholder="请选择退货原因"
+            allowClear></v-select>
+        </div>
+      </template>
       <span slot="customTitle">
         操作
         <a-popover>
@@ -68,16 +73,16 @@
           type="link"
           class="button-info"
           :loading="newLoading"
-          :disabled="grabFlag == '1'&&record.refundableQty==0"
+          v-if="record.productPrice"
           @click="handleAdd(record)"
         >添加</a-button>
+        <span v-else>--</span>
       </template>
     </s-table>
   </div>
 </template>
 
 <script>
-import { salesQueryByReturn } from '@/api/salesReturn'
 import { queryStockProductPage } from '@/api/stock'
 import { STable, VSelect } from '@/components'
 export default {
@@ -89,10 +94,8 @@ export default {
   data () {
     return {
       buyerSn: '',
-      grabFlag: '',
       priceType: '',
       queryParam: { //  查询条件
-        salesBillNo: '', //  销售单号
         productName: '', // 产品名称
         productCode: '' //  产品编码
       },
@@ -101,16 +104,8 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        // 抓单时
-        if (this.grabFlag == 1) {
-          this.queryParam.buyerSn = this.buyerSn
-        }
-        // 不抓单
-        if (this.grabFlag == 0) {
-          this.queryParam.dealerSn = this.buyerSn
-        }
-        const fun = [queryStockProductPage, salesQueryByReturn]
-        return fun[this.grabFlag](Object.assign(parameter, this.queryParam)).then(res => {
+        this.queryParam.dealerSn = this.buyerSn
+        return queryStockProductPage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -133,68 +128,34 @@ export default {
       return {
         on: {
           dblclick: (event) => {
-            if (_this.grabFlag == '1' && record.refundableQty == 0) {
-              _this.$message.info('该产品暂时不能添加')
-            } else {
-              event.stopPropagation()
-              _this.$emit('add', record)
-            }
+            event.stopPropagation()
+            _this.$emit('add', record)
           }
         }
       }
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.salesBillNo = ''
       this.queryParam.productName = ''
       this.queryParam.productCode = ''
       this.$refs.table.refresh(true)
     },
-    pageInit (buyerSn, grabFlag) {
+    pageInit (buyerSn) {
       this.buyerSn = buyerSn
-      this.grabFlag = grabFlag
-      // 抓单
-      if (this.grabFlag == 1) {
-        const arr = [
-          { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-          { title: '销售单号', dataIndex: 'salesBillNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
-          { title: '产品编码', dataIndex: 'productEntity.code', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-          { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-          // { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-          { title: '剩余可退数量', dataIndex: 'refundableQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-          { title: '本次退货数量', dataIndex: 'qty', width: '8%', align: 'center', scopedSlots: { customRender: 'qty' } },
-          // { title: '采购价', dataIndex: 'showCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-          { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-          { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
-        ]
-        if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-          arr.splice(4, 0, { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-        }
-        if (this.$hasPermissions('B_isShowCost')) { //  成本价权限
-          const ind = this.$hasPermissions('B_isShowPrice') ? 7 : 6
-          arr.splice(ind, 0, { title: '采购价', dataIndex: 'showCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-        }
-        this.columns = arr
-      } else {
-        const arr = [
-          { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
-          { title: '产品编码', dataIndex: 'productCode', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
-          { title: '产品名称', dataIndex: 'productName', width: '27%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-          // { title: '当前售价', dataIndex: 'productPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-          { title: '退货数量', dataIndex: 'qty', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
-          // { title: '采购价', dataIndex: 'lastStockCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-          { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-          { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
-        ]
-        if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-          arr.splice(3, 0, { title: '当前售价', dataIndex: 'productPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-        }
-        if (this.$hasPermissions('B_isShowCost')) { //  成本价权限
-          const ind = this.$hasPermissions('B_isShowPrice') ? 5 : 4
-          arr.splice(ind, 0, { title: '采购价', dataIndex: 'lastStockCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-        }
-        this.columns = arr
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '27%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '当前售价', dataIndex: 'productPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '申请退货数量', dataIndex: 'qty', width: '9%', align: 'center', scopedSlots: { customRender: 'qty' } },
+        { title: '退货原因', dataIndex: 'returnReason', width: '10%', align: 'center', scopedSlots: { customRender: 'returnReason' } },
+        { slots: { title: 'customTitle' }, scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+      ]
+      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
+        arr.splice(4, 0, { title: '当前售价', dataIndex: 'productPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       }
+      this.columns = arr
       this.resetSearchForm()
     },
     // 选择配件

+ 44 - 19
src/views/salesReturnManagement/salesReturn/salesReturnEdit.vue

@@ -18,8 +18,8 @@
           <a-alert style="margin-bottom: 10px;width: 80%;" type="info">
             <div slot="message" class="total-bar">
               <div>
-                <span v-if="$hasPermissions('B_isShowPrice')">退货总金额:{{ ordeDetail&&(ordeDetail.totalAmount || ordeDetail.totalAmount==0) ? ordeDetail.totalAmount : '--' }}元;</span>
-                <span>退货总数量:{{ ordeDetail&&(ordeDetail.totalQty || ordeDetail.totalQty==0) ? ordeDetail.totalQty : '--' }};</span>
+                <span>申请退货数量:{{ ordeDetail&&(ordeDetail.totalQty || ordeDetail.totalQty==0) ? ordeDetail.totalQty : '--' }};</span>
+                <span v-if="$hasPermissions('B_isShowPrice')">参考退货金额:{{ ordeDetail&&(ordeDetail.totalAmount || ordeDetail.totalAmount==0) ? ordeDetail.totalAmount : '--' }}元;</span>
               </div>
             </div>
           </a-alert>
@@ -65,8 +65,14 @@
               style="width: 100%;" />
           </template>
           <!-- 退货原因 -->
-          <template slot="remark" slot-scope="text, record">
-            <a-input size="small" placeholder="30个字符内" :maxLength="30" v-model.trim="record.remark" @blur="updateRemark(record)"></a-input>
+          <template slot="returnReason" slot-scope="text, record">
+            <v-select
+              style="width:100%;"
+              v-model="record.returnReason"
+              @change="updateReason(record)"
+              code="RETURN_REASON"
+              placeholder="请选择退货原因"
+              allowClear></v-select>
           </template>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
@@ -88,9 +94,11 @@
         :disabled="spinning"
         type="primary"
         class="button-primary"
-        @click="handleSubmit()"
+        @click="beforeSubmit()"
         id="salesReturn-handleSubmit">提交</a-button>
     </div>
+    <!-- 选择审核人员 -->
+    <chooseDepartUserModal :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn, grabFlag: ordeDetail.grabFlag}" @close="closeGuideModel" @ok="hanldeOk" />
   </div>
@@ -102,6 +110,7 @@ import { STable, VSelect } from '@/components'
 import ImportGuideModal from './importGuideModal.vue'
 import queryPart from './queryPart.vue'
 import EditableCell from '@/views/common/editInput.js'
+import chooseDepartUserModal from '../../expenseManagement/expenseReimbursement/chooseDepartUserModal.vue'
 import { salesReturnDetail, salesReturnSubmit, salesReturnBatchInsert } from '@/api/salesReturn'
 import {
   salesReturnDetailList,
@@ -118,7 +127,8 @@ export default {
     VSelect,
     queryPart,
     EditableCell,
-    ImportGuideModal
+    ImportGuideModal,
+    chooseDepartUserModal
   },
   data () {
     return {
@@ -128,6 +138,7 @@ export default {
       buyerSn: null,
       disabled: false,
       isInster: false, // 是否正在添加产品
+      openDepartUserModal: false,
       ordeDetail: { discountAmount: 0 },
       delLoading: false,
       // 已选产品
@@ -153,11 +164,13 @@ export default {
             }
             this.disabled = false
             this.chooseLoadData = data.list
+            this.total = res.data.count
           }
           return data
         })
       },
-      openGuideModal: false //  导入产品引导
+      openGuideModal: false, //  导入产品引导
+      total: 0
     }
   },
   computed: {
@@ -166,16 +179,16 @@ export default {
         { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
         { title: '产品编码', dataIndex: 'productEntity.code', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '退货数量', dataIndex: 'qty', align: 'center', width: '8%', scopedSlots: { customRender: 'qty' } },
-        // { title: '退货单价', dataIndex: 'price', align: 'center', width: '8%', scopedSlots: { customRender: 'price' } },
         { title: '单位', dataIndex: 'productEntity.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
-        // { title: '退货小计', align: 'center', dataIndex: 'totalAmount', width: '8%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货原因', dataIndex: 'remark', align: 'center', width: '13%', scopedSlots: { customRender: 'remark' } },
+        // { title: '参考退货单价', dataIndex: 'price', align: 'center', width: '8%', scopedSlots: { customRender: 'price' } },
+        { title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '8%', scopedSlots: { customRender: 'qty' } },
+        { title: '退货原因', dataIndex: 'returnReason', align: 'center', width: '13%', scopedSlots: { customRender: 'returnReason' } },
+        // { title: '参考退货金额', align: 'center', dataIndex: 'totalAmount', width: '8%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
       if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-        arr.splice(4, 0, { title: '退货单价', dataIndex: 'price', align: 'center', width: '8%', scopedSlots: { customRender: 'price' } })
-        arr.splice(6, 0, { title: '退货小计', align: 'center', dataIndex: 'totalAmount', width: '8%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+        arr.splice(4, 0, { title: '参考退货单价', dataIndex: 'price', align: 'center', width: '8%', scopedSlots: { customRender: 'price' } })
+        arr.splice(7, 0, { title: '参考退货金额', align: 'center', dataIndex: 'totalAmount', width: '8%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       }
       return arr
     }
@@ -183,7 +196,7 @@ export default {
   methods: {
     //  返回
     handleBack () {
-      this.$router.push({ path: '/salesManagement/salesReturn/list', query: { closeLastOldTab: true } })
+      this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
     },
     // 已选产品  blur
     onCellBlur (val, record, type) {
@@ -220,11 +233,11 @@ export default {
       }
     },
     // 修改退货原因
-    updateRemark (row) {
+    updateReason (row) {
       this.spinning = true
       salesReturnDetailUpdateReason({
         salesReturnDetailSn: row.salesReturnDetailSn,
-        remark: row.remark
+        returnReason: row.returnReason
       }).then(res => {
         if (res.status == 200) {
           this.resetSearchForm(true)
@@ -277,12 +290,17 @@ export default {
       if (this.isInster) {
         return
       }
+      if (!row.returnReason) {
+        this.$message.info('请选择退货原因')
+        return
+      }
       this.isInster = true
       const params = {
         'salesReturnBillSn': this.orderSn,
         'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
         'price': row.productPrice,
         'cost': row.lastStockCost,
+        'returnReason': row.returnReason,
         'productSn': row.productSn,
         'qty': row.qty
       }
@@ -296,10 +314,17 @@ export default {
         this.spinning = false
       })
     },
-    // 提交销售单
-    handleSubmit () {
+    beforeSubmit () {
+      if (this.total) {
+        this.openDepartUserModal = true
+      } else {
+        this.$message.info('请添加产品')
+      }
+    },
+    // 提交销售退货
+    handleSubmit (data) {
       this.spinning = true
-      salesReturnSubmit({ salesReturnBillSn: this.orderSn }).then(res => {
+      salesReturnSubmit({ salesReturnBillSn: this.orderSn, ...data }).then(res => {
         if (res.status == 200) {
           this.handleBack()
           this.$message.success(res.message)

+ 0 - 378
src/views/salesReturnManagement/salesReturn/salesReturnGrabEdit.vue

@@ -1,378 +0,0 @@
-<template>
-  <div class="salesReturnEdit-wrap">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-page-header :ghost="false" :backIcon="false" class="salesReturnEdit-back" >
-        <!-- 自定义的二级文字标题 -->
-        <template slot="subTitle">
-          <a id="salesReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin: 0 15px;color: #666;">客户名称:{{ ordeDetail&&ordeDetail.buyerName || '--' }}</span>
-        </template>
-      </a-page-header>
-      <a-card size="small" :bordered="false" class="salesReturnEdit-cont" v-show="ordeDetail&&ordeDetail.salesReturnBillSource=='SALES'">
-        <!-- 查询配件列表 -->
-        <queryPart ref="queryPart" :newLoading="isInster" @add="saveProduct"></queryPart>
-      </a-card>
-      <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
-        <div style="position: relative;width: 100%;">
-          <!-- alert -->
-          <a-alert style="margin-bottom: 10px;width:80%;" type="info">
-            <div slot="message" class="total-bar">
-              <div>
-                <span v-if="$hasPermissions('B_isShowPrice')">退货总金额:<strong>{{ ordeDetail&&(ordeDetail.totalAmount || ordeDetail.totalAmount==0) ? ordeDetail.totalAmount : '--' }}</strong>元;</span>
-                <span>退货总数量:<strong>{{ ordeDetail&&(ordeDetail.totalQty || ordeDetail.totalQty==0) ? ordeDetail.totalQty : '--' }}</strong>;</span>
-              </div>
-            </div>
-          </a-alert>
-          <div style="position: absolute;right: 0;top: 3px;">
-            <a-button size="small" type="primary" class="button-info" id="salesReturnEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
-          </div>
-        </div>
-        <!-- 已选配件列表 -->
-        <s-table
-          class="sTable"
-          ref="table"
-          size="small"
-          :rowKey="(record) => record.id"
-          :columns="columns"
-          :data="loadData"
-          :defaultLoadData="false"
-          :scroll="{ y: 300 }"
-          bordered>
-          <!-- 本次退货数量 -->
-          <template slot="qty" slot-scope="text, record">
-            <a-input-number
-              id="salesReturn-qty"
-              size="small"
-              v-model="record.qty"
-              :precision="0"
-              :min="0"
-              :max="999999"
-              placeholder="请输入"
-              @blur="e => onCellBlur(e.target.value, record, 'qty')"
-              style="width: 100%;" />
-          </template>
-          <!-- 退货单价 -->
-          <template slot="price" slot-scope="text, record">
-            <a-input-number
-              id="salesReturn-price"
-              size="small"
-              v-model="record.price"
-              :precision="2"
-              :min="0"
-              :max="999999"
-              placeholder="请输入"
-              @blur="e => onCellBlur(e.target.value, record, 'price')"
-              style="width: 100%;" />
-          </template>
-          <!-- 退货原因 -->
-          <template slot="remark" slot-scope="text, record">
-            <a-input
-              size="small"
-              placeholder="30个字符内"
-              :maxLength="30"
-              v-model.trim="record.remark"
-              @blur="updateRemark(record)"
-              style="width: 100%;"></a-input>
-          </template>
-          <!-- 操作 -->
-          <template slot="action" slot-scope="text, record">
-            <a-button
-              size="small"
-              type="link"
-              :loading="delLoading"
-              class="button-error"
-              @click="handleDel(record)"
-              id="salesReturn-Del">删除</a-button>
-          </template>
-        </s-table>
-      </a-card>
-    </a-spin>
-    <div class="affix-cont">
-      <a-button
-        size="large"
-        style="padding: 0 60px;"
-        :disabled="spinning"
-        type="primary"
-        class="button-primary"
-        @click="handleSubmit()"
-        id="salesReturn-handleSubmit">提交</a-button>
-    </div>
-    <!-- 导入产品 -->
-    <importGuideModal :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn, grabFlag: ordeDetail&&ordeDetail.grabFlag || ''}" @close="openGuideModal=false" @ok="hanldeOk" />
-  </div>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-import { STable, VSelect } from '@/components'
-import ImportGuideModal from './importGuideModal.vue'
-import queryPart from './queryPart.vue'
-import EditableCell from '@/views/common/editInput.js'
-import { salesReturnDetail, salesReturnSubmit, salesReturnBatchInsert } from '@/api/salesReturn'
-import { salesReturnDetailList, salesReturnDetailDel, salesReturnDetailInsert, salesReturnDetailUpdateQty, salesReturnDetailUpdateReason } from '@/api/salesReturnDetail'
-export default {
-  name: 'SalesReturnGrabEdit',
-  mixins: [commonMixin],
-  components: { STable, VSelect, queryPart, EditableCell, ImportGuideModal },
-  data () {
-    return {
-      spinning: false,
-      orderId: null,
-      orderSn: null,
-      buyerSn: null,
-      disabled: false,
-      isInster: false, // 是否正在添加产品
-      ordeDetail: null,
-      delLoading: false,
-      // 已选产品
-      dataSource: [],
-      productForm: {
-        salesReturnBillSn: ''
-      },
-      chooseLoadData: [],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        // 查询总计
-        this.productForm.salesReturnBillSn = this.$route.params.sn
-        return salesReturnDetailList(Object.assign(parameter, this.productForm)).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            const no = (data.pageNo - 1) * data.pageSize
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = no + i + 1
-              data.list[i].qtyBackups = data.list[i].qty
-              data.list[i].priceBackups = data.list[i].price
-            }
-            this.disabled = false
-            this.chooseLoadData = data.list
-          }
-          return data
-        })
-      },
-      openGuideModal: false //  导入产品引导
-    }
-  },
-  computed: {
-    columns () {
-      const arr = [
-        { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
-        { title: '采购单号', dataIndex: 'purchaseBillNo', align: 'center', width: '14%', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'productEntity.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productEntity.name', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '剩余可退数量', dataIndex: 'refundableQty', align: 'center', width: '9%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '本次退货数量', dataIndex: 'qty', align: 'center', width: '9%', scopedSlots: { customRender: 'qty' } },
-        // { title: '退货单价', dataIndex: 'price', align: 'center', width: '8%', scopedSlots: { customRender: 'price' } },
-        { title: '单位', dataIndex: 'productEntity.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
-        // { title: '退货小计', align: 'center', width: '8%', dataIndex: 'totalAmount', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货原因', dataIndex: 'remark', align: 'center', width: '10%', scopedSlots: { customRender: 'remark' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
-      ]
-      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
-        arr.splice(6, 0, { title: '退货单价', dataIndex: 'price', align: 'center', width: '8%', scopedSlots: { customRender: 'price' } })
-        arr.splice(8, 0, { title: '退货小计', align: 'center', width: '8%', dataIndex: 'totalAmount', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
-      return arr
-    }
-  },
-  methods: {
-    //  返回
-    handleBack () {
-      this.$router.push({ path: '/salesManagement/salesReturn/list', query: { closeLastOldTab: true } })
-    },
-    // 已选产品  blur
-    onCellBlur (val, record, type) {
-      let valBackups
-      if (type) {
-        if (type == 'qty') {
-          valBackups = record.qtyBackups
-        } else if (type == 'price') {
-          valBackups = record.priceBackups
-        }
-      }
-      //  光标移出,值发生改变再调用编辑接口
-      if (val && val != valBackups) {
-        if (Number(record.qty) > Number(record.refundableQty)) {
-          this.$message.info('本次退货数量不可大于剩余可退数量')
-          record.qty = record.qtyBackups
-          record.price = record.priceBackups
-        } else {
-          this.spinning = true
-          const params = {
-            salesReturnDetailSn: record.salesReturnDetailSn,
-            qty: record.qty,
-            price: record.price
-          }
-          this.setFun(params)
-        }
-      } else {
-        if (type == 'qty') {
-          record.qty = valBackups
-        } else if (type == 'price') {
-          record.price = valBackups
-        }
-      }
-    },
-    setFun (params) {
-      salesReturnDetailUpdateQty(params).then(res => {
-        if (res.status == 200) {
-          this.resetSearchForm(true)
-          this.$message.success(res.message)
-        }
-        this.spinning = false
-      })
-    },
-    // 修改退货原因
-    updateRemark (row) {
-      this.spinning = true
-      salesReturnDetailUpdateReason({
-        salesReturnDetailSn: row.salesReturnDetailSn,
-        remark: row.remark
-      }).then(res => {
-        if (res.status == 200) {
-          this.resetSearchForm(true)
-          this.$message.success(res.message)
-        }
-        this.spinning = false
-      })
-    },
-    // 获取单据详细
-    getOrderDetail () {
-      salesReturnDetail({ sn: this.$route.params.sn }).then(res => {
-        this.ordeDetail = res.data || null
-      })
-    },
-    // 删除产品
-    handleDel (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要删除吗?',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.delLoading = true
-          _this.spinning = true
-          salesReturnDetailDel({ salesReturnDetailSn: row.salesReturnDetailSn }).then(res => {
-            if (res.status == 200) {
-              _this.resetSearchForm(true)
-            }
-            _this.$message.info(res.message)
-            _this.delLoading = false
-            _this.spinning = false
-          })
-        }
-      })
-    },
-    //  重置
-    resetSearchForm (flag) {
-      this.$refs.table.refresh(!!flag)
-      this.getOrderDetail()
-    },
-    // 添加或修改产品
-    saveProduct (row) {
-      // 防止多次添加产品
-      if (this.isInster) {
-        return
-      }
-      this.isInster = true
-      const params = {
-        'salesReturnBillSn': this.orderSn,
-        'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
-        'salesBillSn': row.salesBillSn,
-        'salesBillNo': row.salesBillNo,
-        'refundableQty': row.refundableQty,
-        'salesBillDetailSn': row.salesBillDetailSn,
-        'price': row.price,
-        'cost': row.showCost,
-        'productSn': row.productSn,
-        'productCode': row.productEntity.code,
-        'qty': row.qty
-      }
-      this.spinning = true
-      salesReturnDetailInsert(params).then(res => {
-        if (res.status == 200) {
-          this.resetSearchForm(true)
-          this.$message.success(res.message)
-          this.$refs.queryPart.refreshData()
-        }
-        this.isInster = false
-        this.spinning = false
-      })
-    },
-    // 提交销售单
-    handleSubmit () {
-      this.spinning = true
-      salesReturnSubmit({ salesReturnBillSn: this.orderSn }).then(res => {
-        if (res.status == 200) {
-          this.handleBack()
-          this.$message.success(res.message)
-        }
-        this.spinning = false
-      })
-    },
-    // 导入产品
-    hanldeOk (obj) {
-      salesReturnBatchInsert(obj).then(res => {
-        if (res.status == 200) {
-          this.$refs.table.refresh(true)
-          this.getOrderDetail()
-        }
-      })
-    },
-    pageInit () {
-      this.orderSn = this.$route.params.sn
-      this.buyerSn = this.$route.params.buyerSn
-      this.getOrderDetail()
-      this.$refs.table.refresh(true)
-      this.$refs.queryPart.pageInit(this.buyerSn, 1)
-    }
-  },
-  mounted () {
-    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-      this.pageInit()
-    }
-  },
-  activated () {
-    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
-    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
-      this.pageInit()
-    }
-  },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {})
-  }
-}
-</script>
-
-<style lang="less">
-  .salesReturnEdit-wrap{
-    position: relative;
-    height: 100%;
-    padding-bottom: 51px;
-    box-sizing: border-box;
-    >.ant-spin-nested-loading{
-      overflow-y: scroll;
-      height: 100%;
-    }
-    .salesReturnEdit-cont{
-      margin-top: 10px;
-      .total-bar{
-        display: flex;
-        align-items: center;
-        justify-content: space-between;
-        > div{
-          &:last-child{
-            display: flex;
-            align-items: center;
-            justify-content: space-between;
-            > div{
-              padding: 0 10px;
-            }
-          }
-        }
-      }
-    }
-  }
-</style>