소스 검색

退货原因修改

lilei 2 년 전
부모
커밋
302b15218e

+ 8 - 0
src/api/salesReturnDetail.js

@@ -55,6 +55,14 @@ export const salesReturnDetailUpdateReason = (params) => {
     method: 'post'
   })
 }
+// 批量修改销售退货明细退货原因
+export const salesReturnDetailSetReason = (params) => {
+  return axios({
+    url: '/salesReturn/detail/setReturnReason',
+    data: params,
+    method: 'post'
+  })
+}
 // 修改销售退货明细实收数量
 export const salesReturnDetailUpdateReceiveQty = (params) => {
   return axios({

+ 38 - 22
src/views/common/returnReason.js

@@ -1,19 +1,25 @@
 const ReturnReason = {
   template: `
-       <a-input-group compact :id="id">
-        <a-input style="width: 80%" allowClear @change="handleChange" :placeholder="placeholder" :value="defaultVal"/>
         <a-select
-          style="width: 80px"
-          @change="changeSel"
-          :dropdownMatchSelectWidth="false"
-          placeholder="选择"
-          option-filter-prop="children"
-          :filter-option="filterOption">
-          <a-select-option v-for="item in list" :key="item" :value="item">
-          {{ item }}
-          </a-select-option>
-        </a-select>
-      </a-input-group>
+            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"
+            :open="open"
+          >
+            <a-select-option v-for="item in list" :key="item" :value="item">
+              {{item}}
+            </a-select-option>
+          </a-select>
     `,
   props: {
     value: {
@@ -28,10 +34,15 @@ const ReturnReason = {
       type: String,
       default: '请输入退货原因'
     },
+    size: {
+      type: String,
+      default: 'small'
+    }
   },
   data() {
     return {
       defaultVal: this.value,
+      open: false,
       list: [
         '漏油或者不上油',
         '外观不良:脏污、破损、脱胶、变形等',
@@ -72,24 +83,29 @@ const ReturnReason = {
     value(newValue, oldValue) {
       this.defaultVal = newValue
     },
+    defaultVal(newValue, oldValue) {
+      if(!newValue){
+        this.open = true
+      }
+    },
   },
   methods: {
-    filterOption (input, option) {
+    filterOption(input, option) {
       return (
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
-    },
-    changeSel(value){
-      this.defaultVal = value;
-      this.$emit('change', value);
-      this.$emit('input', value);
+      );
     },
-    handleChange(e) {
-      const value = e.target.value
+    onChange(value) {
+      console.log('onChange', value);
       this.defaultVal = value;
+      this.open = false;
       this.$emit('change', value);
       this.$emit('input', value);
     },
+    onBlur(value){
+      this.open = false;
+      this.$emit('blur', value);
+    }
   },
 };
 

+ 68 - 10
src/views/salesReturnManagement/custConfirm/list.vue

@@ -24,7 +24,8 @@
         <div style="border-top:1px solid #eee;padding-top:10px;">
           <a-button type="primary" :loading="loading" class="button-info" @click="openProductModal=true">新增产品</a-button>
           <a-button type="primary" :loading="loading" class="button-error" @click="handlePlss">批量设置退货单价</a-button>
-          <span v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys&&rowSelectionInfo.selectedRowKeys.length">已选{{ rowSelectionInfo.selectedRowKeys.length }}项</span>
+          <a-button style="margin-left:5px;" :loading="loading" @click="openPlSetReason">批量设置退货原因</a-button>
+          <span style="margin-left:10px;" v-if="selNums">已选{{ selNums }}项</span>
           <div style="float:right;color:#999;margin-top:8px;">说明:红色行表示收货时新增的产品;黄色表示客服确认时新增的产品</div>
         </div>
         <!-- 已选配件列表 -->
@@ -114,7 +115,7 @@
           </template>
           <!-- 退货原因 -->
           <template slot="returnReason" slot-scope="text, record">
-            <returnReason v-if="record.isEdit" v-model="record.returnReason"></returnReason>
+            <returnReason v-if="record.isEdit" v-model="record.returnReason" @blur="blurReason(record)"></returnReason>
             <span v-else>{{ record.returnReason||'--' }}</span>
           </template>
           <!-- 操作 -->
@@ -178,7 +179,21 @@
       @setOk="setPriceOk"
       @cancel="showSetPriceModal=false"></setPriceModal>
     <!-- 添加产品 -->
-    <chooseProductsModal ref="chooseProduct" :openModal="openProductModal" :buyerSn="$route.params.buyerSn" @close="openProductModal=false" @addProduct="addProduct"></chooseProductsModal>
+    <chooseProductsModal
+      ref="chooseProduct"
+      :openModal="openProductModal"
+      :buyerSn="$route.params.buyerSn"
+      @close="openProductModal=false"
+      @addProduct="addProduct"></chooseProductsModal>
+    <!-- 批量设置退货原因 -->
+    <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="line-height: 24px;">
+          <div><returnReason size="large" v-model="plReturnReason"></returnReason></div>
+        </div>
+      </div>
+    </commonModal>
   </div>
 </template>
 
@@ -186,10 +201,11 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import setPriceModal from './setPriceModal.vue'
+import commonModal from '@/views/common/commonModal.vue'
 import returnReason from '@/views/common/returnReason'
 import chooseProductsModal from '../receiveCheck/chooseProductsModal.vue'
 import { salesReturnDetail, customerServiceConfirm } from '@/api/salesReturn'
-import { salesReturnDetailList, updateByCustomerService, deleteByCustomerService, insertByCustomerService } from '@/api/salesReturnDetail'
+import { salesReturnDetailList, updateByCustomerService, deleteByCustomerService, insertByCustomerService, salesReturnDetailSetReason } from '@/api/salesReturnDetail'
 export default {
   name: 'CustConfirm',
   mixins: [commonMixin],
@@ -198,7 +214,8 @@ export default {
     VSelect,
     setPriceModal,
     chooseProductsModal,
-    returnReason
+    returnReason,
+    commonModal
   },
   data () {
     return {
@@ -226,6 +243,7 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
               data.list[i].isEdit = false
+              data.list[i].returnReasonBackups = data.list[i].returnReason
             }
             this.disabled = false
           }
@@ -235,10 +253,15 @@ export default {
       rowSelectionInfo: null,
       showSetPriceModal: false,
       chooseData: [],
-      openProductModal: false
+      openProductModal: false,
+      plReturnReason: '',
+      showPlModal: false
     }
   },
   computed: {
+    selNums () {
+      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
+    },
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
@@ -294,12 +317,11 @@ export default {
     },
     // 批量设置退货单价
     handlePlss () {
-      const _this = this
-      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
-        _this.$message.warning('请先选择产品!')
+      if (!this.selNums) {
+        this.$message.warning('请先选择产品!')
         return
       }
-      this.chooseData = _this.rowSelectionInfo.selectedRows
+      this.chooseData = this.rowSelectionInfo.selectedRows
       this.showSetPriceModal = true
     },
     // 设置价格成功
@@ -308,6 +330,42 @@ export default {
       this.$refs.table.clearSelected()
       this.resetSearchForm(false)
     },
+    blurReason (row) {
+      if (!row.returnReason || row.returnReason == row.returnReasonBackups) {
+        row.returnReason = row.returnReasonBackups
+      }
+    },
+    // 批量设置退货原因
+    openPlSetReason () {
+      if (this.selNums) {
+        this.showPlModal = true
+      } else {
+        this.$message.warning('请先选择产品!')
+      }
+    },
+    setPlReturnReason () {
+      if (this.plReturnReason == '') {
+        this.$message.warning('请输入退货原因!')
+      } else {
+        this.spinning = true
+        const snList = []
+        const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
+        arr.map(item => {
+          snList.push(item.salesReturnDetailSn)
+        })
+        salesReturnDetailSetReason({
+          salesReturnBillDetailSnList: snList,
+          returnReason: this.plReturnReason
+        }).then(res => {
+          if (res.status == 200) {
+            this.showPlModal = false
+            this.$refs.table.clearSelected()
+            this.resetSearchForm(false)
+          }
+          this.spinning = false
+        })
+      }
+    },
     // 保存
     handleSave (record) {
       if (!record.returnReason) {

+ 82 - 6
src/views/salesReturnManagement/receiveCheck/checking.vue

@@ -24,7 +24,8 @@
         <div style="border-top:1px solid #eee;padding-top:10px;">
           <a-button type="primary" :loading="loading" class="button-info" @click="plSetQty(1)">批量设置良品数量</a-button>
           <a-button type="primary" :loading="loading" class="button-error" @click="plSetQty(2)">批量设置返库数量</a-button>
-          <span v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys&&rowSelectionInfo.selectedRowKeys.length">已选{{ rowSelectionInfo.selectedRowKeys.length }}项</span>
+          <a-button style="margin-left:5px;" :loading="loading" @click="openPlSetReason">批量设置退货原因</a-button>
+          <span style="margin-left:10px;" v-if="selNums">已选{{ selNums }}项</span>
           <div style="float:right;color:#999;margin-top:8px;">说明:红色行表示收货时新增的产品</div>
         </div>
         <!-- 已选配件列表 -->
@@ -67,6 +68,10 @@
               @blur="e => updateBackStockQty(e.target.value, record)"
               style="width: 100%;" />
           </template>
+          <!-- 退货原因 -->
+          <template slot="returnReason" slot-scope="text, record">
+            <returnReason v-model="record.returnReason" @blur="updateReason(record)"></returnReason>
+          </template>
         </s-table>
         <div class="footer-btn">
           <a-button
@@ -82,14 +87,25 @@
     </a-spin>
     <!-- 选中批量操作 -->
     <chooseTypeModal :openModal="openTypeModal" :type="actionType" @close="openTypeModal=false" @confirm="plconfirm"></chooseTypeModal>
+    <!-- 批量设置退货原因 -->
+    <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="line-height: 24px;">
+          <div><returnReason size="large" v-model="plReturnReason"></returnReason></div>
+        </div>
+      </div>
+    </commonModal>
   </div>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
+import commonModal from '@/views/common/commonModal.vue'
+import returnReason from '@/views/common/returnReason'
 import { salesReturnDetail, salesReturnCheck } from '@/api/salesReturn'
-import { salesReturnDetailList, updateBatchBackStockQty, updateBatchGoodQty } from '@/api/salesReturnDetail'
+import { salesReturnDetailList, updateBatchBackStockQty, updateBatchGoodQty, salesReturnDetailSetReason, salesReturnDetailUpdateReason } from '@/api/salesReturnDetail'
 import chooseTypeModal from './chooseTypeModal.vue'
 export default {
   name: 'SalesReturnCheck',
@@ -97,7 +113,9 @@ export default {
   components: {
     STable,
     VSelect,
-    chooseTypeModal
+    chooseTypeModal,
+    returnReason,
+    commonModal
   },
   data () {
     return {
@@ -136,6 +154,7 @@ export default {
               data.list[i].backStockQty = data.list[i].backStockQty || 0
               data.list[i].goodQtyBackups = data.list[i].goodQty
               data.list[i].backStockQtyBackups = data.list[i].backStockQty
+              data.list[i].returnReasonBackups = data.list[i].returnReason
             }
             this.disabled = false
             this.chooseLoadData = data.list
@@ -143,10 +162,15 @@ export default {
           return data
         })
       },
-      rowSelectionInfo: null
+      rowSelectionInfo: null,
+      plReturnReason: '',
+      showPlModal: false
     }
   },
   computed: {
+    selNums () {
+      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
+    },
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
@@ -158,7 +182,7 @@ export default {
         { title: '坏件数量', dataIndex: 'badQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '良品数量', dataIndex: 'goodQty', width: '10%', align: 'center', scopedSlots: { customRender: 'goodQty' } },
         { title: '返库数量', dataIndex: 'backStockQty', width: '10%', align: 'center', scopedSlots: { customRender: 'backStockQty' } },
-        { title: '退货原因', dataIndex: 'returnReasonDictValue', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '退货原因', dataIndex: 'returnReason', width: '20%', align: 'center', scopedSlots: { customRender: 'returnReason' } }
       ]
       return arr
     }
@@ -175,7 +199,7 @@ export default {
     // 批量设置
     plSetQty (type) {
       const _this = this
-      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+      if (!this.selNums) {
         _this.$message.warning('请先选择产品!')
         return
       }
@@ -236,6 +260,58 @@ export default {
         this.openTypeModal = false
       })
     },
+    // 批量设置退货原因
+    openPlSetReason () {
+      if (this.selNums) {
+        this.showPlModal = true
+      } else {
+        this.$message.warning('请先选择产品!')
+      }
+    },
+    setPlReturnReason () {
+      if (this.plReturnReason == '') {
+        this.$message.warning('请输入退货原因!')
+      } else {
+        this.spinning = true
+        const snList = []
+        const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
+        arr.map(item => {
+          snList.push(item.salesReturnDetailSn)
+        })
+        salesReturnDetailSetReason({
+          salesReturnBillDetailSnList: snList,
+          returnReason: this.plReturnReason
+        }).then(res => {
+          if (res.status == 200) {
+            this.showPlModal = false
+            this.$refs.table.clearSelected()
+            this.$refs.table.refresh()
+          }
+          this.spinning = false
+        })
+      }
+    },
+    // 修改退货原因
+    updateReason (row) {
+      // 空或没有改变时不保存数据
+      if (!row.returnReason || row.returnReason == row.returnReasonBackups) {
+        row.returnReason = row.returnReasonBackups
+        return
+      }
+      this.spinning = true
+      salesReturnDetailUpdateReason({
+        salesReturnDetailSn: row.salesReturnDetailSn,
+        returnReason: row.returnReason
+      }).then(res => {
+        if (res.status == 200) {
+          this.$refs.table.refresh()
+          this.$message.success(res.message)
+        } else {
+          row.returnReason = row.returnReasonBackups
+        }
+        this.spinning = false
+      })
+    },
     // 修改良品数量
     updateGoodQty (val, record) {
       if (record.backStockQty > record.goodQty) {

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

@@ -51,16 +51,7 @@
       <!-- 退货原因 -->
       <template slot="returnReason" slot-scope="text, record">
         <div @dblclick.stop>
-          <a-select
-            size="small"
-            style="width:100%;"
-            v-model="record.returnReason"
-            placeholder="请选择退货原因"
-            allowClear>
-            <a-select-option v-for="item in returnReasonList" :value="item.code">
-              {{ item.dispName }}
-            </a-select-option>
-          </a-select>
+          <returnReason v-model="record.returnReason"></returnReason>
         </div>
       </template>
       <span slot="customTitle">
@@ -90,13 +81,13 @@
 
 <script>
 import { queryStockProductPage } from '@/api/stock'
+import returnReason from '@/views/common/returnReason'
 import { STable, VSelect } from '@/components'
 export default {
   name: 'QueryPart',
-  components: { STable, VSelect },
+  components: { STable, VSelect, returnReason },
   props: {
     newLoading: Boolean,
-    returnReasonList: Array,
     isShowPrice: {
       type: Boolean,
       default: true

+ 87 - 25
src/views/salesReturnManagement/salesReturn/salesReturnEdit.vue

@@ -38,7 +38,7 @@
       </a-page-header>
       <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
         <!-- 查询配件列表 -->
-        <queryPart ref="partQuery" :returnReasonList="returnReasonList" :newLoading="isInster" @add="saveProduct"></queryPart>
+        <queryPart ref="partQuery" :newLoading="isInster" @add="saveProduct"></queryPart>
       </a-card>
       <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
         <a-alert style="margin-bottom: 10px;" type="info">
@@ -50,7 +50,7 @@
           </div>
         </a-alert>
         <div class="table-page-search-wrapper" style="display:flex;align-items: center;justify-content: space-between;">
-          <div style="width:80%;">
+          <div style="flex-grow:1;">
             <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
               <a-row :gutter="15">
                 <a-col :md="6" :sm="24">
@@ -71,6 +71,8 @@
             </a-form>
           </div>
           <div>
+            <span style="margin-right: 10px;" v-if="selNums">已选{{ selNums }}项</span>
+            <a-button type="default" class="button-info" @click="openPlSetReason">批量设置退货原因</a-button>
             <a-button type="primary" class="button-info" id="salesReturnEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
           </div>
         </div>
@@ -80,6 +82,8 @@
           ref="table"
           size="small"
           :rowKey="(record) => record.id"
+          :row-selection="{ columnWidth: 40 }"
+          @rowSelection="rowSelectionFun"
           :columns="columns"
           :data="loadData"
           :defaultLoadData="false"
@@ -100,16 +104,7 @@
           </template>
           <!-- 退货原因 -->
           <template slot="returnReason" slot-scope="text, record">
-            <a-select
-              style="width:100%;"
-              v-model="record.returnReason"
-              @change="updateReason(record)"
-              placeholder="请选择退货原因"
-            >
-              <a-select-option v-for="item in returnReasonList" :value="item.code">
-                {{ item.dispName }}
-              </a-select-option>
-            </a-select>
+            <returnReason v-model="record.returnReason" @blur="updateReason(record)"></returnReason>
           </template>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
@@ -138,6 +133,15 @@
     <chooseDepartUserModal :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" />
+    <!-- 批量设置退货原因 -->
+    <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="line-height: 24px;">
+          <div><returnReason size="large" v-model="plReturnReason"></returnReason></div>
+        </div>
+      </div>
+    </commonModal>
   </div>
 </template>
 
@@ -147,15 +151,24 @@ import { STable, VSelect } from '@/components'
 import { printFun, exportExcel } from '@/libs/JGPrint.js'
 import ImportGuideModal from './importGuideModal.vue'
 import queryPart from './queryPart.vue'
+import commonModal from '@/views/common/commonModal.vue'
 import EditableCell from '@/views/common/editInput.js'
 import chooseDepartUserModal from './chooseDepartUserModal.vue'
-import { salesReturnDetail, salesReturnSubmit, salesReturnBatchInsert, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
+import returnReason from '@/views/common/returnReason'
+import {
+  salesReturnDetail,
+  salesReturnSubmit,
+  salesReturnBatchInsert,
+  salesReturnPrint,
+  salesReturnExport
+} from '@/api/salesReturn'
 import {
   salesReturnDetailList,
   salesReturnDetailDel,
   salesReturnDetailInsert,
   salesReturnDetailUpdateQty,
-  salesReturnDetailUpdateReason
+  salesReturnDetailUpdateReason,
+  salesReturnDetailSetReason
 } from '@/api/salesReturnDetail'
 export default {
   name: 'SalesReturnEdit',
@@ -166,7 +179,9 @@ export default {
     queryPart,
     EditableCell,
     ImportGuideModal,
-    chooseDepartUserModal
+    chooseDepartUserModal,
+    returnReason,
+    commonModal
   },
   data () {
     return {
@@ -200,7 +215,7 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
               data.list[i].qtyBackups = data.list[i].initialQty
-              data.list[i].priceBackups = data.list[i].price
+              data.list[i].returnReasonBackups = data.list[i].returnReason
             }
             this.disabled = false
             this.chooseLoadData = data.list
@@ -211,10 +226,15 @@ export default {
       },
       openGuideModal: false, //  导入产品引导
       total: 0,
-      returnReasonList: [] // 申请退货列表
+      rowSelectionInfo: null,
+      plReturnReason: '',
+      showPlModal: false
     }
   },
   computed: {
+    selNums () {
+      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
+    },
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
@@ -237,6 +257,10 @@ export default {
     handleBack () {
       this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
     },
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
     // 已选产品  blur
     onCellBlur (val, record, type) {
       const valBackups = record.qtyBackups
@@ -264,6 +288,12 @@ export default {
     },
     // 修改退货原因
     updateReason (row) {
+      console.log(row.returnReason)
+      // 空或没有改变时不保存数据
+      if (!row.returnReason || row.returnReason == row.returnReasonBackups) {
+        row.returnReason = row.returnReasonBackups
+        return
+      }
       this.spinning = true
       salesReturnDetailUpdateReason({
         salesReturnDetailSn: row.salesReturnDetailSn,
@@ -272,10 +302,43 @@ export default {
         if (res.status == 200) {
           this.resetTable(false)
           this.$message.success(res.message)
+        } else {
+          row.returnReason = row.returnReasonBackups
         }
         this.spinning = false
       })
     },
+    // 批量设置退货原因
+    openPlSetReason () {
+      if (this.selNums) {
+        this.showPlModal = true
+      } else {
+        this.$message.warning('请先选择产品!')
+      }
+    },
+    setPlReturnReason () {
+      if (this.plReturnReason == '') {
+        this.$message.warning('请输入退货原因!')
+      } else {
+        this.spinning = true
+        const snList = []
+        const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
+        arr.map(item => {
+          snList.push(item.salesReturnDetailSn)
+        })
+        salesReturnDetailSetReason({
+          salesReturnBillDetailSnList: snList,
+          returnReason: this.plReturnReason
+        }).then(res => {
+          if (res.status == 200) {
+            this.showPlModal = false
+            this.$refs.table.clearSelected()
+            this.resetTable(false)
+          }
+          this.spinning = false
+        })
+      }
+    },
     // 获取单据详细
     getOrderDetail () {
       salesReturnDetail({ sn: this.orderSn }).then(res => {
@@ -317,15 +380,10 @@ export default {
     },
     // 添加或修改产品
     saveProduct (row) {
-      console.log(row)
       // 防止多次添加产品
       if (this.isInster) {
         return
       }
-      if (!row.returnReason) {
-        this.$message.info('请选择退货原因')
-        return
-      }
       this.isInster = true
       const params = {
         'salesReturnBillSn': this.orderSn,
@@ -348,9 +406,14 @@ export default {
     },
     beforeSubmit () {
       if (this.total) {
-        this.openDepartUserModal = true
+        const hasKong = this.chooseLoadData.find(item => !item.returnReason)
+        if (hasKong) {
+          this.$message.warning('请输入退货原因!')
+        } else {
+          this.openDepartUserModal = true
+        }
       } else {
-        this.$message.info('请添加产品')
+        this.$message.warning('请添加产品!')
       }
     },
     // 提交销售退货
@@ -399,7 +462,6 @@ export default {
       this.buyerSn = this.$route.params.buyerSn
       this.resetSearchForm(true)
       this.$refs.partQuery.pageInit(this.buyerSn, 0)
-      this.returnReasonList = this.$store.state.app.returnReason
     }
   },
   mounted () {

+ 1 - 1
vue.config.js

@@ -107,7 +107,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.0.215/ocs-admin',
+        target: 'http://192.168.0.102:8602/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  Á·Ï°
         // target: 'http://p.ocs.360arrow.com/ocs-admin', //  Ô¤·¢²¼
         ws: false,