lilei 1 year ago
parent
commit
5e820df068

BIN
public/templ/销售退货(不良品)产品明细模板.xlsx


BIN
public/templ/销售退货(良品)产品明细模板.xlsx


+ 8 - 0
src/api/salesReturnDetail.js

@@ -63,6 +63,14 @@ export const salesReturnDetailSetReason = (params) => {
     method: 'post'
     method: 'post'
   })
   })
 }
 }
+// 生成新的销退单
+export const salesReturnAgainCreate = (params) => {
+  return axios({
+    url: '/salesReturn/againCreate',
+    data: params,
+    method: 'post'
+  })
+}
 // 修改销售退货明细实收数量
 // 修改销售退货明细实收数量
 export const salesReturnDetailUpdateReceiveQty = (params) => {
 export const salesReturnDetailUpdateReceiveQty = (params) => {
   return axios({
   return axios({

+ 16 - 17
src/store/modules/app.js

@@ -34,7 +34,8 @@ const app = {
     loadingStatus: false,
     loadingStatus: false,
     closeTabPages: [], // 已关闭的页面
     closeTabPages: [], // 已关闭的页面
     employeeList: [], // 申请人列表
     employeeList: [], // 申请人列表
-    returnReason: [], // 申请退货原因列表
+    defectiveReturnReason: [], // 不良品申请退货列表
+    goodReturnReason: [], // 良品申请退货列表
     tempBillOfData: null, // 临时存储收货单数据
     tempBillOfData: null, // 临时存储收货单数据
     authMenusList: [], // 权限菜单数据
     authMenusList: [], // 权限菜单数据
     priceAuthOptions: [], // 价格权限选项
     priceAuthOptions: [], // 价格权限选项
@@ -102,8 +103,8 @@ const app = {
     SET_employeeList: (state, val) => {
     SET_employeeList: (state, val) => {
       state.employeeList = val
       state.employeeList = val
     },
     },
-    SET_returnReason: (state, val) => {
-      state.returnReason = val
+    SET_returnReason:(state, obj) => {
+      state[obj.key] = obj.val
     },
     },
     SET_showPdfPrint: (state, val) => {
     SET_showPdfPrint: (state, val) => {
       state.showPdfPrintView = val
       state.showPdfPrintView = val
@@ -164,20 +165,18 @@ const app = {
         }
         }
       })
       })
     },
     },
-    getReturnReasonData ({ commit }, code) {
-      getLookUpData({
-        pageNo: 1,
-        pageSize: 1000,
-        lookupCode: code,
-        isEnable: 1
-      }).then(res => {
-        if (res.status == 200) {
-          commit('SET_returnReason', res.data.list)
-        } else {
-          commit('SET_returnReason', [])
-        }
-      })
-    }
+    getLookUpDataByCode({ commit }, params) {
+        getLookUpData({
+          pageNo: 1,
+          pageSize: 1000,
+          lookupCode: params.code,
+          isEnable: params.isEnable
+        }).then(res => {
+          if (res.status == 200) {
+            commit('SET_returnReason', {key: params.key, val: res.data.list})
+          }
+        })
+    },
   }
   }
 }
 }
 
 

+ 13 - 2
src/views/Home.vue

@@ -56,7 +56,7 @@ export default {
   created () {
   created () {
   },
   },
   methods: {
   methods: {
-    ...mapActions(['GetEmployeeList', 'getReturnReasonData']),
+    ...mapActions(['GetEmployeeList', 'getLookUpDataByCode']),
     // 获取菜单树列表
     // 获取菜单树列表
     getYyMenuList () {
     getYyMenuList () {
       getYyMenuList().then(res => {
       getYyMenuList().then(res => {
@@ -107,7 +107,18 @@ export default {
       } else {
       } else {
         vm.openResetPwd = true
         vm.openResetPwd = true
       }
       }
-      vm.getReturnReasonData('RETURN_REASON')
+      // 退货原因列表
+        vm.getLookUpDataByCode({
+          code: 'GOOD_PRODUCT_RETURN',
+          key: 'goodReturnReason',
+          isEnable: 1
+        })
+        vm.getLookUpDataByCode({
+          code: 'DEFECTIVE_PRODUCT_RETURN',
+          key: 'defectiveReturnReason',
+          isEnable: 1
+        })
+      // 菜单数据
       vm.getYyMenuList()
       vm.getYyMenuList()
       vm.$store.state.app.priceAuthOptions = [
       vm.$store.state.app.priceAuthOptions = [
         { label: '售价', value: 'salesPrice' },
         { label: '售价', value: 'salesPrice' },

+ 42 - 40
src/views/common/returnReason.js

@@ -1,32 +1,26 @@
-import { removeEmptyStr } from '@/libs/tools'
 const ReturnReason = {
 const ReturnReason = {
   template: `
   template: `
-        <a-select
-            allowClear
-            :size="size"
-            mode="combobox"
-            :value="defaultVal"
-            show-search
-            :placeholder="placeholder"
-            option-filter-prop="children"
-            style="width: 100%"
-            :filter-option="filterOption"
-            :dropdownMatchSelectWidth="false"
-            @change="onChange"
-            @blur="onBlur"
-            @focus="open=true"
-            @select="open=false"
-            :open="open"
-          >
-            <a-select-option v-for="item in list" :key="item.code" :value="item.dispName">
-              {{item.dispName}}
-            </a-select-option>
-          </a-select>
+      <a-select
+        :placeholder="placeholder"
+        style="width:100%"
+        :size="size"
+        :id="id"
+        allowClear
+        :value="defaultVal"
+        :showSearch="true"
+        @change="handleChange"
+        option-filter-prop="children"
+        :dropdownMatchSelectWidth="false"
+        :filter-option="filterOption">
+        <a-select-option v-for="item in list" :key="item.code" :value="item.code">
+          {{item.dispName}}
+        </a-select-option>
+      </a-select>
     `,
     `,
   props: {
   props: {
     value: {
     value: {
       type: String,
       type: String,
-      defatut: ''
+      default: undefined
     },
     },
     id: {
     id: {
       type: String,
       type: String,
@@ -34,27 +28,41 @@ const ReturnReason = {
     },
     },
     placeholder: {
     placeholder: {
       type: String,
       type: String,
-      default: '请输入退货原因(最多50字符)'
+      default: '请选择退货原因'
     },
     },
     size: {
     size: {
       type: String,
       type: String,
       default: 'small'
       default: 'small'
+    },
+    goodFlag: {
+      type: String,
+      default: ''
     }
     }
   },
   },
   data() {
   data() {
     return {
     return {
       defaultVal: this.value,
       defaultVal: this.value,
-      open: false,
       list: []
       list: []
     };
     };
   },
   },
-  mounted() {
-    this.list = this.$store.state.app.returnReason
+  created() {
+    // 不良品
+    if(this.goodFlag == 'DEFECTIVE_PRODUCT_RETURN'){
+      this.list = this.$store.state.app.defectiveReturnReason
+    }
+    // 良品
+    if(this.goodFlag == 'GOOD_PRODUCT_RETURN'){
+      this.list = this.$store.state.app.goodReturnReason
+    }
+    // 全部
+    if(!this.goodFlag){
+      this.list = [...this.$store.state.app.goodReturnReason,...this.$store.state.app.defectiveReturnReason]
+    }
   },
   },
   watch: {
   watch: {
     value(newValue, oldValue) {
     value(newValue, oldValue) {
-      this.defaultVal = removeEmptyStr(newValue)
-    },
+      this.defaultVal = newValue || undefined
+    }
   },
   },
   methods: {
   methods: {
     filterOption(input, option) {
     filterOption(input, option) {
@@ -62,17 +70,11 @@ const ReturnReason = {
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       );
       );
     },
     },
-    onChange(value) {
-      console.log(value,'----')
-      this.open = true;
-      const ret = value?value.substr(0,50):'';
-      this.defaultVal = removeEmptyStr(ret);
-      this.$emit('input', this.defaultVal);
-      this.$emit('change', this.defaultVal);
-    },
-    onBlur(value){
-      this.open = false;
-      this.$emit('blur', removeEmptyStr(value));
+    handleChange(value) {
+      this.defaultVal = value;
+      const row = this.list.find(item => item.code == value)
+      this.$emit('change', value, row);
+      this.$emit('input', value);
     }
     }
   },
   },
 };
 };

+ 44 - 41
src/views/salesReturnManagement/custConfirm/list.vue

@@ -116,13 +116,13 @@
           </template>
           </template>
           <!-- 退货原因 -->
           <!-- 退货原因 -->
           <template slot="returnReason" slot-scope="text, record">
           <template slot="returnReason" slot-scope="text, record">
-            <returnReason v-if="record.isEdit" v-model="record.returnReason" @blur="blurReason(record)"></returnReason>
+            <returnReason v-if="record.isEdit" v-model="record.returnReasonCode"></returnReason>
             <span v-else>{{ record.returnReason||'--' }}</span>
             <span v-else>{{ record.returnReason||'--' }}</span>
           </template>
           </template>
           <!-- 备注 -->
           <!-- 备注 -->
           <template slot="remarks" slot-scope="text, record">
           <template slot="remarks" slot-scope="text, record">
-            <a-input v-if="record.isEdit" size="small" v-model.trim="record.remarks" allowClear placeholder="请输入备注信息(最多50字符)"/>
-            <span v-else>{{ record.remarks||'--' }}</span>
+            <a-input v-if="record.isEdit" size="small" :maxlength="50" v-model.trim="record.returnReasonRemarks" allowClear placeholder="请输入备注信息(最多50字符)"/>
+            <span v-else>{{ record.returnReasonRemarks||'--' }}</span>
           </template>
           </template>
           <!-- 操作 -->
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
           <template slot="action" slot-scope="text, record">
@@ -194,20 +194,16 @@
       @addProduct="addProduct"></chooseProductsModal>
       @addProduct="addProduct"></chooseProductsModal>
     <!-- 批量设置退货原因 -->
     <!-- 批量设置退货原因 -->
     <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @cancel="showPlModal=false" @ok="setPlReturnReason">
     <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @cancel="showPlModal=false" @ok="setPlReturnReason">
-      <a-form-model
-        ref="ruleForm"
-        :model="reasonForm"
-        :rules="rules"
-        :label-col="labelCol"
-        :wrapper-col="wrapperCol"
-      >
-        <a-form-model-item label="请选择退货原因" prop="plReturnReason">
-          <returnReason size="middle" v-model="reasonForm.plReturnReason"></returnReason>
-        </a-form-model-item>
-        <a-form-model-item label="备注" prop="remarksInfo">
-          <a-input v-model="reasonForm.remarksInfo" :maxLength="50" placeholder="请输入备注信息(最多50字符)" />
-        </a-form-model-item>
-      </a-form-model>
+      <div style="text-align: left;">
+        <div style="line-height: 24px;">
+          <div><span style="color:red;">*</span>退货原因</div>
+          <div><returnReason size="large" v-model="plReturnReason"></returnReason></div>
+        </div>
+        <div style="line-height: 24px;margin-top:10px;">
+          <div>备注</div>
+          <div><a-input size="large" :maxlength="50" placeholder="请输入备注(最多50字符)" v-model="plReturnRemark"></a-input></div>
+        </div>
+      </div>
     </commonModal>
     </commonModal>
   </div>
   </div>
 </template>
 </template>
@@ -220,7 +216,7 @@ import commonModal from '@/views/common/commonModal.vue'
 import returnReason from '@/views/common/returnReason'
 import returnReason from '@/views/common/returnReason'
 import chooseProductsModal from '../receiveCheck/chooseProductsModal.vue'
 import chooseProductsModal from '../receiveCheck/chooseProductsModal.vue'
 import { salesReturnDetail, customerServiceConfirm } from '@/api/salesReturn'
 import { salesReturnDetail, customerServiceConfirm } from '@/api/salesReturn'
-import { salesReturnDetailList, updateByCustomerService, deleteByCustomerService, insertByCustomerService, salesReturnDetailSetReason } from '@/api/salesReturnDetail'
+import { salesReturnDetailList, updateByCustomerService, deleteByCustomerService, insertByCustomerService, salesReturnDetailSetReason, salesReturnAgainCreate } from '@/api/salesReturnDetail'
 export default {
 export default {
   name: 'CustConfirm',
   name: 'CustConfirm',
   mixins: [commonMixin],
   mixins: [commonMixin],
@@ -245,7 +241,6 @@ export default {
         productName: '',
         productName: '',
         productCode: ''
         productCode: ''
       },
       },
-      reasonForm: { plReturnReason: undefined, remarksInfo: '' },
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.disabled = true
         this.disabled = true
@@ -259,7 +254,6 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
               data.list[i].no = no + i + 1
               data.list[i].isEdit = false
               data.list[i].isEdit = false
-              data.list[i].returnReasonBackups = data.list[i].returnReason
             }
             }
             this.disabled = false
             this.disabled = false
           }
           }
@@ -269,27 +263,27 @@ export default {
       rowSelectionInfo: null,
       rowSelectionInfo: null,
       showSetPriceModal: false,
       showSetPriceModal: false,
       chooseData: [],
       chooseData: [],
+      returnReasonList: [],
       openProductModal: false,
       openProductModal: false,
-      plReturnReason: '',
+      plReturnReason: undefined,
+      plReturnRemark: '',
       showPlModal: false,
       showPlModal: false,
       labelCol: { span: 8 },
       labelCol: { span: 8 },
-      wrapperCol: { span: 14 },
-      rules: {
-        plReturnReason: [
-          { required: true, message: '请选择退货原因', trigger: 'change' }
-        ],
-        remarksInfo: [{ required: true, message: '请输入备注信息', trigger: 'blur' }]
-      }
+      wrapperCol: { span: 14 }
     }
     }
   },
   },
   watch: {
   watch: {
     showPlModal (newValue, oldValue) {
     showPlModal (newValue, oldValue) {
       if (!newValue) {
       if (!newValue) {
-        this.plReturnReason = ''
+        this.plReturnReason = undefined
+        this.plReturnRemark = ''
       }
       }
     }
     }
   },
   },
   computed: {
   computed: {
+    goodFlag() {
+      return this.ordeDetail && this.ordeDetail.goodFlag || ''
+    },
     selNums () {
     selNums () {
       return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
       return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
     },
     },
@@ -323,14 +317,19 @@ export default {
     setNewSalesRetrunOrder () {
     setNewSalesRetrunOrder () {
       const _this = this
       const _this = this
       this.$confirm({
       this.$confirm({
-        title: '生成新销退单',
-        content: '选择的产品将生成新的销退单',
+        title: '提示',
+        content: '选择的产品将生成新的销退单',
         centered: true,
         centered: true,
         closable: true,
         closable: true,
         onOk () {
         onOk () {
           _this.loading = true
           _this.loading = true
           _this.spinning = true
           _this.spinning = true
-          deleteByCustomerService({ salesReturnDetailSn: row.salesReturnDetailSn }).then(res => {
+          const snList = []
+          const arr = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows || []
+          arr.map(item => {
+            snList.push(item.salesReturnDetailSn)
+          })
+          salesReturnAgainCreate({ sourceBillSn: _this.orderSn,salesReturnBillDetailSnList: snList }).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.resetSearchForm(false)
               _this.resetSearchForm(false)
             }
             }
@@ -384,11 +383,6 @@ export default {
       this.$refs.table.clearSelected()
       this.$refs.table.clearSelected()
       this.resetSearchForm(false)
       this.resetSearchForm(false)
     },
     },
-    blurReason (row) {
-      if (!row.returnReason || row.returnReason == row.returnReasonBackups) {
-        row.returnReason = row.returnReasonBackups
-      }
-    },
     // 批量设置退货原因
     // 批量设置退货原因
     openPlSetReason () {
     openPlSetReason () {
       if (this.selNums) {
       if (this.selNums) {
@@ -398,18 +392,22 @@ export default {
       }
       }
     },
     },
     setPlReturnReason () {
     setPlReturnReason () {
-      if (this.plReturnReason == '') {
-        this.$message.warning('请输入退货原因!')
+      if (!this.plReturnReason) {
+        this.$message.warning('请选择退货原因!')
       } else {
       } else {
         this.spinning = true
         this.spinning = true
         const snList = []
         const snList = []
         const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
         const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
+        const rows = this.returnReasonlist.find(item => item.code == this.plReturnReason)
         arr.map(item => {
         arr.map(item => {
           snList.push(item.salesReturnDetailSn)
           snList.push(item.salesReturnDetailSn)
         })
         })
         salesReturnDetailSetReason({
         salesReturnDetailSetReason({
           salesReturnBillDetailSnList: snList,
           salesReturnBillDetailSnList: snList,
-          returnReason: this.plReturnReason
+          salesReturnBillSn : this.orderSn,
+          returnReason: rows ? rows.dispName : '',
+          returnReasonCode: this.plReturnReason,
+          returnReasonRemarks: this.plReturnRemark
         }).then(res => {
         }).then(res => {
           if (res.status == 200) {
           if (res.status == 200) {
             this.showPlModal = false
             this.showPlModal = false
@@ -422,7 +420,7 @@ export default {
     },
     },
     // 保存
     // 保存
     handleSave (record) {
     handleSave (record) {
-      if (!record.returnReason) {
+      if (!record.returnReasonCode) {
         this.$message.warning('请先选择退货原因!')
         this.$message.warning('请先选择退货原因!')
         return
         return
       }
       }
@@ -430,6 +428,8 @@ export default {
         this.$message.warning('仓库实收数量必需等于良品数量和坏件数量之和!')
         this.$message.warning('仓库实收数量必需等于良品数量和坏件数量之和!')
         return
         return
       }
       }
+      const rows = this.returnReasonlist.find(item => item.code == record.returnReasonCode)
+      record.returnReason = rows ? rows.dispName : ''
       this.spinning = true
       this.spinning = true
       updateByCustomerService(record).then(res => {
       updateByCustomerService(record).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
@@ -474,6 +474,9 @@ export default {
     getOrderDetail () {
     getOrderDetail () {
       salesReturnDetail({ sn: this.orderSn }).then(res => {
       salesReturnDetail({ sn: this.orderSn }).then(res => {
         this.ordeDetail = res.data || null
         this.ordeDetail = res.data || null
+        if(res.data){
+          this.returnReasonlist = [...this.$store.state.app.goodReturnReason,...this.$store.state.app.defectiveReturnReason]
+        }
       })
       })
     },
     },
     // 审核销售单
     // 审核销售单

+ 21 - 5
src/views/salesReturnManagement/receiveCheck/chooseProductsModal.vue

@@ -49,6 +49,10 @@ export default {
     isShowPrice: { //  弹框显示状态
     isShowPrice: { //  弹框显示状态
       type: Boolean,
       type: Boolean,
       default: true
       default: true
+    },
+    goodFlag: {
+      type: String,
+      default: ''
     }
     }
   },
   },
   data () {
   data () {
@@ -70,14 +74,16 @@ export default {
         this.$message.info('请输入仓库实收数量')
         this.$message.info('请输入仓库实收数量')
         return
         return
       }
       }
-      if (!row.returnReason) {
+      if (!row.returnReasonCode) {
         this.$message.info('请选择退货原因')
         this.$message.info('请选择退货原因')
         return
         return
       }
       }
+      const rows = this.returnReasonlist.find(item => item.code == row.returnReasonCode)
       const params = {
       const params = {
         'price': row.productPrice,
         'price': row.productPrice,
-        // 'cost': row.lastStockCost,
-        'returnReason': row.returnReason,
+        'returnReasonCode': row.returnReasonCode,
+        'returnReason': rows ? rows.dispName : '',
+        'returnReasonRemarks': row.returnReasonRemarks,
         'productSn': row.productSn,
         'productSn': row.productSn,
         'initialQty': row.qty,
         'initialQty': row.qty,
         'receiveQty': row.receiveQty
         'receiveQty': row.receiveQty
@@ -99,9 +105,19 @@ export default {
       if (!newValue) {
       if (!newValue) {
         this.$emit('close')
         this.$emit('close')
       } else {
       } else {
-        this.returnReasonList = this.$store.state.app.returnReason
+        if(this.goodFlag == 'DEFECTIVE_PRODUCT_RETURN'){
+          this.returnReasonlist = this.$store.state.app.defectiveReturnReason
+        }
+        // 良品
+        if(this.goodFlag == 'GOOD_PRODUCT_RETURN'){
+          this.returnReasonlist = this.$store.state.app.goodReturnReason
+        }
+        // 全部
+        if(!this.goodFlag){
+          this.returnReasonlist = [...this.$store.state.app.goodReturnReason,...this.$store.state.app.defectiveReturnReason]
+        }
         this.$nextTick(() => {
         this.$nextTick(() => {
-          this.$refs.partQuery.pageInit(this.buyerSn, 0)
+          this.$refs.partQuery.pageInit(this.buyerSn, 0, this.goodFlag)
         })
         })
       }
       }
     }
     }

+ 1 - 1
src/views/salesReturnManagement/returnConfirmation/detailModal.vue

@@ -102,7 +102,7 @@ export default {
         { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '退货原因', dataIndex: 'returnReason', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货原因', dataIndex: 'returnReason', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '备注', dataIndex: 'returnReason', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '备注', dataIndex: 'returnReasonRemarks', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
       ]
       if (this.$hasPermissions('B_returnConfirmation_detail_salesPrice')) { //  售价权限
       if (this.$hasPermissions('B_returnConfirmation_detail_salesPrice')) { //  售价权限
         arr.splice(11, 0, { title: '实际退货单价', dataIndex: 'price', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(11, 0, { title: '实际退货单价', dataIndex: 'price', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })

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

@@ -65,14 +65,14 @@
         </a-row>
         </a-row>
         <a-row :gutter="15">
         <a-row :gutter="15">
           <a-col :span="20">
           <a-col :span="20">
-            <a-form-model-item label="退货类型" prop="salesReturnType">
+            <a-form-model-item label="退货类别" prop="goodFlag">
               <v-select
               <v-select
-                code="FLAG"
+                code="GOOD_FLAG"
                 showType="radio"
                 showType="radio"
-                id="chooseCustom-salesReturnType"
-                v-model="form.salesReturnType"
+                id="chooseCustom-goodFlag"
+                v-model="form.goodFlag"
                 allowClear
                 allowClear
-                placeholder="请选择退货类"></v-select>
+                placeholder="请选择退货类"></v-select>
             </a-form-model-item>
             </a-form-model-item>
           </a-col>
           </a-col>
         </a-row>
         </a-row>
@@ -127,13 +127,13 @@ export default {
         customerAddr: '', //  详细地址
         customerAddr: '', //  详细地址
         warehouseSn: undefined, // 退货仓库
         warehouseSn: undefined, // 退货仓库
         syncFlag: undefined, // 是否同步
         syncFlag: undefined, // 是否同步
-        salesReturnType: undefined
+        goodFlag: undefined
       },
       },
       rules: {
       rules: {
         buyerSn: [{ required: true, message: '请选择客户', trigger: ['change', 'blur'] }],
         buyerSn: [{ required: true, message: '请选择客户', trigger: ['change', 'blur'] }],
         warehouseSn: [{ required: true, message: '请选择退货仓库', trigger: 'change' }],
         warehouseSn: [{ required: true, message: '请选择退货仓库', trigger: 'change' }],
         syncFlag: [{ required: true, message: '请选择是否同步', trigger: ['change', 'blur'] }],
         syncFlag: [{ required: true, message: '请选择是否同步', trigger: ['change', 'blur'] }],
-        salesReturnType: [{ required: true, message: '请选择退货类型', trigger: ['change', 'blur'] }]
+        goodFlag: [{ required: true, message: '请选择退货类别', trigger: ['change', 'blur'] }]
       },
       },
       fetching: false,
       fetching: false,
       dealerData: []
       dealerData: []
@@ -172,9 +172,9 @@ export default {
             countyName: data.districtName,
             countyName: data.districtName,
             customerAddr: data.address //  详细地址
             customerAddr: data.address //  详细地址
           })
           })
+          console.log(this.form)
         } else {
         } else {
           this.$message.error('获取客户信息失败')
           this.$message.error('获取客户信息失败')
-          this.$refs.ruleForm.resetFields()
         }
         }
       })
       })
     },
     },
@@ -231,7 +231,7 @@ export default {
         customerAddr: '', //  详细地址
         customerAddr: '', //  详细地址
         warehouseSn: undefined,
         warehouseSn: undefined,
         syncFlag: undefined, // 是否同步
         syncFlag: undefined, // 是否同步
-        salesReturnType: undefined
+        goodFlag: undefined
       }
       }
       this.$refs.ruleForm.resetFields()
       this.$refs.ruleForm.resetFields()
       this.dealerData = []
       this.dealerData = []

+ 4 - 2
src/views/salesReturnManagement/salesReturn/chooseImportModal.vue

@@ -99,7 +99,8 @@ export default {
         { title: '产品编码', dataIndex: 'productCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'productCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '数量', dataIndex: 'qty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '数量', dataIndex: 'qty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货原因', dataIndex: 'returnReason', width: 150, align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '退货原因', dataIndex: 'returnReason', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '备注', dataIndex: 'returnReasonRemarks', width: 150, align: 'center', customRender: function (text) { return text || '--' } }
       ]
       ]
       return arr
       return arr
     },
     },
@@ -109,7 +110,8 @@ export default {
         { title: '产品编码', dataIndex: 'productCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'productCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '数量', dataIndex: 'qty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '数量', dataIndex: 'qty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '退货原因', dataIndex: 'returnReason', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货原因', dataIndex: 'returnReason', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '备注', dataIndex: 'errorDesc', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '备注', dataIndex: 'returnReasonRemarks', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '错误说明', dataIndex: 'errorDesc', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
       ]
       ]
       return arr
       return arr
     }
     }

+ 3 - 4
src/views/salesReturnManagement/salesReturn/detail.vue

@@ -49,10 +49,9 @@
               <a-descriptions-item label="客户采退申请单号">{{ detailData&&detailData.purchaseReturnApplyNo || '--' }}</a-descriptions-item>
               <a-descriptions-item label="客户采退申请单号">{{ detailData&&detailData.purchaseReturnApplyNo || '--' }}</a-descriptions-item>
               <a-descriptions-item label="是否同步给客户">{{ detailData&&detailData.syncFlag ? ['否', '是'][detailData.syncFlag] : '--' }}</a-descriptions-item>
               <a-descriptions-item label="是否同步给客户">{{ detailData&&detailData.syncFlag ? ['否', '是'][detailData.syncFlag] : '--' }}</a-descriptions-item>
               <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
               <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="退货类别">{{ detailData&&detailData.goodFlagDictValue || '--' }}</a-descriptions-item>
               <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
               <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
               <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditTime || '--' }}</a-descriptions-item>
               <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditTime || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="退货类别">良品退货</a-descriptions-item>
-              <a-descriptions-item label="退货类型">{{ detailData&&detailData.salesReturnTypeDictValue || '--' }}</a-descriptions-item>
               <a-descriptions-item label="附件" v-if="detailData" :span="3">
               <a-descriptions-item label="附件" v-if="detailData" :span="3">
                 <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailData.attachmentList" :key="item.id">
                 <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailData.attachmentList" :key="item.id">
                   {{ item.fileName }}
                   {{ item.fileName }}
@@ -206,14 +205,14 @@ export default {
         { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '退货原因', dataIndex: 'returnReason', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货原因', dataIndex: 'returnReason', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '备注', dataIndex: 'returnReason', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '备注', dataIndex: 'returnReasonRemarks', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
       ]
       if (this.$hasPermissions('B_salesReturnDetail_salesPrice') && this.showFlag != 0) { //  售价权限
       if (this.$hasPermissions('B_salesReturnDetail_salesPrice') && this.showFlag != 0) { //  售价权限
         arr.splice(11, 0, { title: '参考退货单价', dataIndex: 'initialPrice', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(11, 0, { title: '参考退货单价', dataIndex: 'initialPrice', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(12, 0, { title: '参考退货金额', dataIndex: 'initialAmount', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(12, 0, { title: '参考退货金额', dataIndex: 'initialAmount', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(13, 0, { title: '实际退货单价', dataIndex: 'price', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(13, 0, { title: '实际退货单价', dataIndex: 'price', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(14, 0, { title: '实际退货金额', dataIndex: 'totalAmount', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(14, 0, { title: '实际退货金额', dataIndex: 'totalAmount', align: 'right', width: '6%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
-        arr.splice(15, 0, { title: '实际退货单价说明', dataIndex: 'priceRemark', width: '12%', align: 'center', customRender: function (text) { return text || '--' } })
+        arr.splice(15, 0, { title: '实际退货单价说明', dataIndex: 'priceRemark', width: '10%', align: 'center', customRender: function (text) { return text || '--' } })
       }
       }
       return arr
       return arr
     }
     }

+ 14 - 25
src/views/salesReturnManagement/salesReturn/importGuideModal.vue

@@ -16,10 +16,14 @@
           </div>
           </div>
           <ul>
           <ul>
             <li>1) 导入的Excel文件中必须包含名为“产品编码”、“数量”、“退货原因”的列,且名称必须相同</li>
             <li>1) 导入的Excel文件中必须包含名为“产品编码”、“数量”、“退货原因”的列,且名称必须相同</li>
-            <li>2) 除了“产品编码”、“数量”、“退货原因”四列,其他列可自定义,不影响数据导入</li>
+            <li>2) 除了“产品编码”、“数量”、“退货原因”、“备注”四列,其他列可自定义,不影响数据导入</li>
             <li>3) 如果导入的产品已经存在,则不会导入该行</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>
           </ul>
-          <a-button type="link" icon="download" style="padding: 0 0 0 23px;" :loading="exportLoading" @click="handleExport">下载导入模板</a-button>
         </div>
         </div>
         <div class="explain-item">
         <div class="explain-item">
           <div class="explain-tit">
           <div class="explain-tit">
@@ -80,6 +84,10 @@ export default {
     params: {
     params: {
       type: Object,
       type: Object,
       default: null
       default: null
+    },
+    goodFlag: {
+      type: [String,Number],
+      default: ''
     }
     }
   },
   },
   data () {
   data () {
@@ -91,7 +99,8 @@ export default {
       uploadParams: {
       uploadParams: {
         savePathType: 'local'
         savePathType: 'local'
       },
       },
-      exportLoading: false
+      exportLoading: false,
+      filePath: ''
     }
     }
   },
   },
   methods: {
   methods: {
@@ -124,28 +133,6 @@ export default {
       this.openImportModal = false
       this.openImportModal = false
       this.isShow = false
       this.isShow = false
     },
     },
-    // 下载模板
-    handleExport () {
-      this.exportLoading = true
-      setTimeout(() => {
-        this.exportLoading = false
-      }, 1000)
-      const link = document.createElement('a')
-      link.style.display = 'none'
-      link.href = 'https://jianguan-images.oss-cn-beijing.aliyuncs.com/template/XiaoShouTuiHuoMingXiDaoRu.xlsx?t=' + new Date().getTime()
-      link.setAttribute('download', '销售退货单产品导入模板' + '.xlsx')
-      document.body.appendChild(link)
-      link.click()
-      document.body.removeChild(link)
-    }
-    //  下载模板
-    // handleExport () {
-    //   const _this = this
-    //   _this.spinning = true
-    //   exportExcel(downLoadTemp, { type: 'XSTHMX' }, '销售退货单产品导入模板', function () {
-    //     _this.spinning = false
-    //   }, true)
-    // }
   },
   },
   watch: {
   watch: {
     //  父页面传过来的弹框状态
     //  父页面传过来的弹框状态
@@ -158,6 +145,8 @@ export default {
         this.$emit('close')
         this.$emit('close')
         this.paramsData = null
         this.paramsData = null
         this.$refs.importUpload.setFileList('')
         this.$refs.importUpload.setFileList('')
+      }else{
+        this.filePath = location.protocol + '//' +location.host + (this.goodFlag==1 ? '/templ/销售退货(良品)产品明细模板.xlsx' : '/templ/销售退货(不良品)产品明细模板.xlsx')
       }
       }
     }
     }
   }
   }

+ 24 - 11
src/views/salesReturnManagement/salesReturn/list.vue

@@ -20,12 +20,12 @@
                 <dealerSubareaScopeList ref="dealerSubareaScopeList" id="salesReturn-buyerSn" @change="custChange" />
                 <dealerSubareaScopeList ref="dealerSubareaScopeList" id="salesReturn-buyerSn" @change="custChange" />
               </a-form-item>
               </a-form-item>
             </a-col>
             </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="总部销退单号">
+                <a-input id="salesReturn-salesReturnBillNo" v-model.trim="queryParam.salesReturnBillNo" allowClear placeholder="请输入总部销退单号"/>
+              </a-form-item>
+            </a-col>
             <template v-if="advanced">
             <template v-if="advanced">
-              <a-col :md="6" :sm="24">
-                <a-form-item label="总部销退单号">
-                  <a-input id="salesReturn-salesReturnBillNo" v-model.trim="queryParam.salesReturnBillNo" allowClear placeholder="请输入总部销退单号"/>
-                </a-form-item>
-              </a-col>
               <a-col :md="6" :sm="24">
               <a-col :md="6" :sm="24">
                 <a-form-item label="客户采退申请单号">
                 <a-form-item label="客户采退申请单号">
                   <a-input id="salesReturn-purchaseReturnApplyNo" v-model.trim="queryParam.purchaseReturnApplyNo" allowClear placeholder="请输入客户采退申请单号"/>
                   <a-input id="salesReturn-purchaseReturnApplyNo" v-model.trim="queryParam.purchaseReturnApplyNo" allowClear placeholder="请输入客户采退申请单号"/>
@@ -42,6 +42,17 @@
                     allowClear></v-select>
                     allowClear></v-select>
                 </a-form-item>
                 </a-form-item>
               </a-col>
               </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="退货类别">
+                  <v-select
+                    v-model="queryParam.goodFlag"
+                    ref="goodFlag"
+                    id="salesReturn-goodFlag"
+                    code="GOOD_FLAG"
+                    placeholder="请选择退货类别"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
               <a-col :md="6" :sm="24">
               <a-col :md="6" :sm="24">
                 <a-form-item label="是否同步给客户">
                 <a-form-item label="是否同步给客户">
                   <v-select
                   <v-select
@@ -80,7 +91,7 @@
                 </a-form-model-item>
                 </a-form-model-item>
               </a-col>
               </a-col>
             </template>
             </template>
-            <a-col :md="6" :sm="24">
+            <a-col :md="24" :sm="24" style="text-align:center;">
               <span class="table-page-search-submitButtons">
               <span class="table-page-search-submitButtons">
                 <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
                 <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
                 <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
                 <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
@@ -261,6 +272,7 @@ export default {
         purchaseReturnApplyNo: '',
         purchaseReturnApplyNo: '',
         syncFlag: undefined, // 是否同步给客户
         syncFlag: undefined, // 是否同步给客户
         billStatus: undefined, // 业务状态
         billStatus: undefined, // 业务状态
+        goodFlag: undefined,
         warehouseSn: undefined, // 仓库
         warehouseSn: undefined, // 仓库
         subareaArea:{
         subareaArea:{
           subareaSn: undefined,
           subareaSn: undefined,
@@ -302,11 +314,12 @@ export default {
         { title: '编号', dataIndex: 'no', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '编号', dataIndex: 'no', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '创建时间', dataIndex: 'createDate', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '创建时间', dataIndex: 'createDate', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单据来源', dataIndex: 'salesReturnBillSourceDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单据来源', dataIndex: 'salesReturnBillSourceDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '退货仓库', dataIndex: 'warehouseName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '是否同步给客户', dataIndex: 'syncFlag', width: '5%', align: 'center', customRender: function (text) { return text ? ['否', '是'][text] : '--' } },
-        { title: '客户采退申请单号', dataIndex: 'purchaseReturnApplyNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '总部销退单号', scopedSlots: { customRender: 'salesReturnBillNo' }, width: '8%', align: 'center' },
-        { title: '客户名称', dataIndex: 'buyerName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '退货仓库', dataIndex: 'warehouseName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '同步给客户', dataIndex: 'syncFlag', width: '5%', align: 'center', customRender: function (text) { return text ? ['否', '是'][text] : '--' } },
+        { title: '客户采退申请单号', dataIndex: 'purchaseReturnApplyNo', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '总部销退单号', scopedSlots: { customRender: 'salesReturnBillNo' }, width: '7%', align: 'center' },
+        { title: '客户名称', dataIndex: 'buyerName', width: '7%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '退货类别', dataIndex: 'goodFlagDictValue', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '申请退货数量', dataIndex: 'totalInitialQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '申请退货数量', dataIndex: 'totalInitialQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '仓库实收数量', dataIndex: 'totalReceiveQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '仓库实收数量', dataIndex: 'totalReceiveQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '坏件数量', dataIndex: 'totalBadQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '坏件数量', dataIndex: 'totalBadQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 6 - 3
src/views/salesReturnManagement/salesReturn/queryPart.vue

@@ -64,13 +64,13 @@
       <!-- 退货原因 -->
       <!-- 退货原因 -->
       <template slot="returnReason" slot-scope="text, record">
       <template slot="returnReason" slot-scope="text, record">
         <div @dblclick.stop>
         <div @dblclick.stop>
-          <returnReason v-model.trim="record.returnReason"></returnReason>
+          <returnReason :goodFlag="goodFlag" v-model.trim="record.returnReasonCode"></returnReason>
         </div>
         </div>
       </template>
       </template>
       <!-- 备注 -->
       <!-- 备注 -->
       <template slot="remarks" slot-scope="text, record">
       <template slot="remarks" slot-scope="text, record">
         <div @dblclick.stop>
         <div @dblclick.stop>
-          <a-input :maxLength="50" size="small" v-model="record.remarks" placeholder="请输入备注(最多50字符)"/>
+          <a-input :maxLength="50" size="small" v-model="record.returnReasonRemarks" placeholder="请输入备注(最多50字符)"/>
         </div>
         </div>
       </template>
       </template>
       <span slot="customTitle">
       <span slot="customTitle">
@@ -133,6 +133,7 @@ export default {
       },
       },
       disabled: false, //  查询、重置按钮是否可操作
       disabled: false, //  查询、重置按钮是否可操作
       columns: [],
       columns: [],
+      goodFlag:'',
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.disabled = true
         this.disabled = true
@@ -146,6 +147,7 @@ export default {
               data.list[i].no = no + i + 1
               data.list[i].no = no + i + 1
               data.list[i].qty = this.showReceiveQty ? 0 : 1
               data.list[i].qty = this.showReceiveQty ? 0 : 1
               data.list[i].receiveQty = 1
               data.list[i].receiveQty = 1
+              data.list[i].returnReasonRemarks = ''
             }
             }
             this.disabled = false
             this.disabled = false
           }
           }
@@ -175,8 +177,9 @@ export default {
       this.queryParam.code = ''
       this.queryParam.code = ''
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
-    pageInit (buyerSn, warehouseSn) {
+    pageInit (buyerSn, warehouseSn, goodFlag) {
       this.buyerSn = buyerSn
       this.buyerSn = buyerSn
+      this.goodFlag = goodFlag
       // this.queryParam.warehouseSn = warehouseSn
       // this.queryParam.warehouseSn = warehouseSn
       const arr = [
       const arr = [
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },

+ 71 - 40
src/views/salesReturnManagement/salesReturn/salesReturnEdit.vue

@@ -6,16 +6,11 @@
         <template slot="subTitle">
         <template slot="subTitle">
           <a id="salesReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
           <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>
           <span style="margin: 0 15px;color: #666;">客户名称:{{ ordeDetail&&ordeDetail.buyerName || '--' }}</span>
-          <span style="margin: 0 15px;color: #666;" v-if="ordeDetail">
-            退货仓库:<warehouse
-              style="width:200px;"
-              :allowClear="false"
-              disabled
-              v-model="ordeDetail.warehouseSn"
-              @change="updateWarehouse"
-              id="basicInfo-warehouseSn"
-              placeholder="请选择退货仓库"
-            />
+          <span style="margin: 0 10px;color: #666;">
+            退货仓库:{{ordeDetail&&ordeDetail.warehouseName}}
+          </span>
+          <span style="margin: 0 10px;color: #666;">
+            退货类别:{{ordeDetail&&ordeDetail.goodFlagDictValue}}
           </span>
           </span>
         </template>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <!-- 操作区,位于 title 行的行尾 -->
@@ -115,7 +110,11 @@
           </template>
           </template>
           <!-- 退货原因 -->
           <!-- 退货原因 -->
           <template slot="returnReason" slot-scope="text, record">
           <template slot="returnReason" slot-scope="text, record">
-            <returnReason v-model="record.returnReason" @blur="updateReason(record)"></returnReason>
+            <returnReason :goodFlag="goodFlag" v-model="record.returnReasonCode" @change="e => updateReason(e, record, 0)"></returnReason>
+          </template>
+          <!-- 备注 -->
+          <template slot="returnRemarks" slot-scope="text, record">
+            <a-input size="small" placeholder="请输入备注" v-model="record.returnReasonRemarks" @blur="e => updateReason(e, record, 1)"></a-input>
           </template>
           </template>
           <!-- 操作 -->
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
           <template slot="action" slot-scope="text, record">
@@ -143,13 +142,17 @@
     <!-- 选择审核人员 -->
     <!-- 选择审核人员 -->
     <chooseDepartUserModal ref="chooseDepart" :showDefUser="true" :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
     <chooseDepartUserModal ref="chooseDepart" :showDefUser="true" :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
     <!-- 导入产品 -->
     <!-- 导入产品 -->
-    <importGuideModal :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" />
+    <importGuideModal :goodFlag="goodFlag == 'GOOD_PRODUCT_RETURN' ? 1 : 0" :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" />
     <!-- 批量设置退货原因 -->
     <!-- 批量设置退货原因 -->
     <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @cancel="showPlModal=false" @ok="setPlReturnReason">
     <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @cancel="showPlModal=false" @ok="setPlReturnReason">
-      <div style="text-align: center;">
-        <div style="margin-bottom: 15px;font-size: 14px;"><strong>请输入退货原因</strong></div>
+      <div style="text-align: left;">
         <div style="line-height: 24px;">
         <div style="line-height: 24px;">
-          <div><returnReason size="large" v-model="plReturnReason"></returnReason></div>
+          <div><span style="color:red;">*</span>退货原因</div>
+          <div><returnReason size="large" :goodFlag="goodFlag" v-model="plReturnReason"></returnReason></div>
+        </div>
+        <div style="line-height: 24px;margin-top:10px;">
+          <div>备注</div>
+          <div><a-input size="large" :maxlength="50" placeholder="请输入备注(最多50字符)" v-model="plReturnRemark"></a-input></div>
         </div>
         </div>
       </div>
       </div>
     </commonModal>
     </commonModal>
@@ -230,7 +233,7 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
               data.list[i].no = no + i + 1
               data.list[i].qtyBackups = data.list[i].initialQty
               data.list[i].qtyBackups = data.list[i].initialQty
-              data.list[i].returnReasonBackups = data.list[i].returnReason
+              data.list[i].returnReasonBackups = data.list[i].returnReasonCode
             }
             }
             this.disabled = false
             this.disabled = false
             this.chooseLoadData = data.list
             this.chooseLoadData = data.list
@@ -242,29 +245,36 @@ export default {
       openGuideModal: false, //  导入产品引导
       openGuideModal: false, //  导入产品引导
       total: 0,
       total: 0,
       rowSelectionInfo: null,
       rowSelectionInfo: null,
-      plReturnReason: '',
-      showPlModal: false
+      plReturnReason: undefined,
+      plReturnRemark: '',
+      showPlModal: false,
+      returnReasonlist: [],
     }
     }
   },
   },
   watch: {
   watch: {
     showPlModal (newValue, oldValue) {
     showPlModal (newValue, oldValue) {
       if (!newValue) {
       if (!newValue) {
-        this.plReturnReason = ''
+        this.plReturnReason = undefined
+        this.plReturnRemark = ''
       }
       }
     }
     }
   },
   },
   computed: {
   computed: {
+    goodFlag() {
+      return this.ordeDetail && this.ordeDetail.goodFlag || ''
+    },
     selNums () {
     selNums () {
       return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
       return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
     },
     },
     columns () {
     columns () {
       const arr = [
       const arr = [
         { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
         { 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: 'productEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '单位', dataIndex: 'productEntity.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'productEntity.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
         { title: '申请退货数量', dataIndex: 'initialQty', align: 'center', width: '8%', scopedSlots: { customRender: 'qty' } },
         { title: '申请退货数量', dataIndex: 'initialQty', align: 'center', width: '8%', scopedSlots: { customRender: 'qty' } },
         { title: '退货原因', dataIndex: 'returnReason', align: 'center', width: '13%', scopedSlots: { customRender: 'returnReason' } },
         { title: '退货原因', dataIndex: 'returnReason', align: 'center', width: '13%', scopedSlots: { customRender: 'returnReason' } },
+        { title: '备注', scopedSlots: { customRender: 'returnRemarks' }, width: '10%', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
       ]
       if (this.$hasPermissions('B_salesReturnEdit_salesPrice')) { //  售价权限
       if (this.$hasPermissions('B_salesReturnEdit_salesPrice')) { //  售价权限
@@ -322,24 +332,31 @@ export default {
       })
       })
     },
     },
     // 修改退货原因
     // 修改退货原因
-    updateReason (row) {
-      console.log(row.returnReason)
-      row.returnReason = removeEmptyStr(row.returnReason)
-      // 空或没有改变时不保存数据
-      if (!row.returnReason || row.returnReason == row.returnReasonBackups) {
-        row.returnReason = row.returnReasonBackups
-        return
+    updateReason (val, record, type) {
+      console.log(val, record, type)
+      const params = {
+        salesReturnDetailSn: record.salesReturnDetailSn,
+        goodFlag: this.goodFlag
+      }
+      // 退货原因
+      if(type == 0){
+        const rows = this.returnReasonlist.find(item => item.code == val)
+        params.returnReasonCode = val||''
+        params.returnReason = rows ? rows.dispName : ''
+      }else{
+        // 备注
+        params.returnReasonRemarks = val.target.value
+        if(!params.returnReasonRemarks){
+          return
+        }
       }
       }
       this.spinning = true
       this.spinning = true
-      salesReturnDetailUpdateReason({
-        salesReturnDetailSn: row.salesReturnDetailSn,
-        returnReason: row.returnReason
-      }).then(res => {
+      salesReturnDetailUpdateReason(params).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           this.resetTable(false)
           this.resetTable(false)
           this.$message.success(res.message)
           this.$message.success(res.message)
         } else {
         } else {
-          row.returnReason = row.returnReasonBackups
+          row.returnReasonCode = record.returnReasonBackups
         }
         }
         this.spinning = false
         this.spinning = false
       })
       })
@@ -353,18 +370,22 @@ export default {
       }
       }
     },
     },
     setPlReturnReason () {
     setPlReturnReason () {
-      if (this.plReturnReason == '') {
-        this.$message.warning('请输入退货原因!')
+      if (!this.plReturnReason) {
+        this.$message.warning('请选择退货原因!')
       } else {
       } else {
         this.spinning = true
         this.spinning = true
         const snList = []
         const snList = []
         const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
         const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
+        const rows = this.returnReasonlist.find(item => item.code == this.plReturnReason)
         arr.map(item => {
         arr.map(item => {
           snList.push(item.salesReturnDetailSn)
           snList.push(item.salesReturnDetailSn)
         })
         })
         salesReturnDetailSetReason({
         salesReturnDetailSetReason({
           salesReturnBillDetailSnList: snList,
           salesReturnBillDetailSnList: snList,
-          returnReason: this.plReturnReason
+          salesReturnBillSn : this.$route.params.sn,
+          returnReason: rows ? rows.dispName : '',
+          returnReasonCode: this.plReturnReason,
+          returnReasonRemarks: this.plReturnRemark
         }).then(res => {
         }).then(res => {
           if (res.status == 200) {
           if (res.status == 200) {
             this.showPlModal = false
             this.showPlModal = false
@@ -379,8 +400,16 @@ export default {
     getOrderDetail (flag) {
     getOrderDetail (flag) {
       salesReturnDetail({ sn: this.orderSn }).then(res => {
       salesReturnDetail({ sn: this.orderSn }).then(res => {
         this.ordeDetail = res.data || null
         this.ordeDetail = res.data || null
+        if(res.data.goodFlag == 'DEFECTIVE_PRODUCT_RETURN'){
+          this.returnReasonlist = this.$store.state.app.defectiveReturnReason
+        }
+        // 良品
+        if(res.data.goodFlag == 'GOOD_PRODUCT_RETURN'){
+          this.returnReasonlist = this.$store.state.app.goodReturnReason
+        }
+        this.$refs.table.refresh(!flag)
         if (!flag) {
         if (!flag) {
-          this.$refs.partQuery.pageInit(this.buyerSn, this.ordeDetail.warehouseSn)
+          this.$refs.partQuery.pageInit(this.buyerSn, this.ordeDetail.warehouseSn, this.goodFlag)
         }
         }
       })
       })
     },
     },
@@ -414,7 +443,6 @@ export default {
     resetSearchForm (flag) {
     resetSearchForm (flag) {
       this.productForm.productName = ''
       this.productForm.productName = ''
       this.productForm.productCode = ''
       this.productForm.productCode = ''
-      this.$refs.table.refresh(!!flag)
       this.getOrderDetail(flag)
       this.getOrderDetail(flag)
     },
     },
     // 添加或修改产品
     // 添加或修改产品
@@ -423,13 +451,16 @@ export default {
       if (this.isInster) {
       if (this.isInster) {
         return
         return
       }
       }
+      // 退货原因
+      const rows = this.returnReasonlist.find(item => item.code == row.returnReasonCode)
       this.isInster = true
       this.isInster = true
       const params = {
       const params = {
         'salesReturnBillSn': this.orderSn,
         'salesReturnBillSn': this.orderSn,
         'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
         'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
         'price': row.productPrice,
         'price': row.productPrice,
-        // 'cost': row.lastStockCost,
-        'returnReason': row.returnReason,
+        'returnReasonCode': row.returnReasonCode,
+        'returnReason': rows ? rows.dispName : '',
+        'goodFlag': this.goodFlag,
         'productSn': row.productSn,
         'productSn': row.productSn,
         'initialQty': row.qty
         'initialQty': row.qty
       }
       }

+ 2 - 2
vue.config.js

@@ -108,9 +108,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
     proxy: {
       '/api': {
       '/api': {
-        // target: 'http://192.168.2.111/ocs-admin',
+        target: 'http://192.168.2.117/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
+        // target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
         ws: false,
         changeOrigin: true,
         changeOrigin: true,
         pathRewrite: {
         pathRewrite: {