소스 검색

修改bug

chenrui 1 년 전
부모
커밋
2a915dd8bd
2개의 변경된 파일65개의 추가작업 그리고 22개의 파일을 삭제
  1. 12 13
      src/views/salesReturnManagement/custConfirm/grabOrderModal.vue
  2. 53 9
      src/views/salesReturnManagement/custConfirm/setPriceModal.vue

+ 12 - 13
src/views/salesReturnManagement/custConfirm/grabOrderModal.vue

@@ -33,12 +33,12 @@
                 </div>
                 <div v-else-if="record.DISCOUNT&&col==='specialPrice'">
                   <a-radio :value="record.DISCOUNT" >
-                    {{ record.DISCOUNT.specialPrice }}
+                    {{ record.DISCOUNT.price }}
                   </a-radio>
                 </div>
                 <div v-else-if="record.GIFT&&col==='salesPrice'">
                   <a-radio :value="record.GIFT" >
-                    {{ record.GIFT.realSalePrice }}
+                    {{ record.GIFT.price }}
                   </a-radio>
                 </div>
                 <div v-else>--</div>
@@ -58,7 +58,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { VSelect, STable } from '@/components'
-import { grabSalesBill } from '@/api/salesReturn'
+// import { grabSalesBill } from '@/api/salesReturn'
 export default {
   name: 'GrabOrderModal',
   mixins: [commonMixin],
@@ -69,9 +69,9 @@ export default {
       default: false
     },
     infoData: {
-      type: Object,
+      type: Array,
       default: function () {
-        return {}
+        return []
       }
     }
   },
@@ -89,12 +89,12 @@ export default {
     }
   },
   methods: {
-    // 获取列表数据
-    getDataList () {
-      grabSalesBill(this.infoData).then(res => {
-        this.grabSalesList = res.data
-      })
-    },
+    // // 获取列表数据
+    // getDataList () {
+    //   grabSalesBill(this.infoData).then(res => {
+    //     this.grabSalesList = res.data
+    //   })
+    // },
     // 重置选择
     reSetSelect () {
       this.grabSalesList.map(item => { item.resultVal = null })
@@ -126,11 +126,10 @@ export default {
     },
     isShow (nVal, oVal) {
       if (!nVal) {
-        this.reSetSelect()
         this.$emit('close')
       } else {
         if (this.infoData) {
-          this.getDataList()
+          this.grabSalesList = this.infoData
         }
       }
     }

+ 53 - 9
src/views/salesReturnManagement/custConfirm/setPriceModal.vue

@@ -46,7 +46,7 @@
             销售单号:
             <a-input placeholder="请输入销售单号" v-model.trim="form.salesBillNo" :maxLength="50" @change="fetchUser" @blur="handleBlur"/>
             <span class="mleft">{{ buyerName }}</span>
-            <a-button type="primary" :disabled="disabled" @click="handleSave" class="button-error">设置完成</a-button>
+            <a-button type="primary" v-if="salesBillSnList&&salesBillSnList.length>0" :disabled="disabled" @click="handleSave('salesBillNo')" class="button-error">设置完成</a-button>
           </div>
         </div>
         <a-divider>请给以下产品设置新的退货单价</a-divider>
@@ -84,7 +84,7 @@
           </template>
         </s-table>
       </div>
-      <grabOrderModal ref="grabOrder" :infoData="objInfo" :openModal="openGrabOrderModal" @ok="handleGrabOrderOk" @close="closeGrabOrder"></grabOrderModal>
+      <grabOrderModal ref="grabOrder" :infoData="listInfo" :openModal="openGrabOrderModal" @ok="handleGrabOrderOk" @close="closeGrabOrder"></grabOrderModal>
     </a-spin>
   </a-modal>
 </template>
@@ -95,6 +95,7 @@ import debounce from 'lodash/debounce'
 import { STable, VSelect } from '@/components'
 import { salesDetailByNo } from '@/api/sales'
 import { setReturnPrice } from '@/api/salesReturnDetail'
+import { grabSalesBill } from '@/api/salesReturn'
 import grabOrderModal from './grabOrderModal.vue'
 export default {
   name: 'SetPriceModal',
@@ -161,7 +162,8 @@ export default {
       },
       buyerName: '',
       openGrabOrderModal: false,
-      objInfo: null,
+      listInfo: null,
+      noShowBillSnList: null,
       salesBillSnList: []
     }
   },
@@ -186,22 +188,63 @@ export default {
         return
       }
       const productArr = this.chooseData.map(item => { return { productSn: item.productSn, code: item.productEntity.code, salesReturnDetailSn: item.salesReturnDetailSn } })
-      this.objInfo = {
+      const objInfo = {
         salesReturnBillSn: this.$route.params.sn,
         salesBillNo: this.form.salesBillNo,
         productList: productArr
       }
-      this.openGrabOrderModal = true
+      grabSalesBill(objInfo).then(res => {
+        const newList = res.data
+        const _this = this
+        if (newList && newList.length > 0) {
+          const flag = newList.some(item => Object.keys(item).length > 2)
+          if (flag) {
+            this.listInfo = newList.filter(con => Object.keys(con).length > 2)
+            this.openGrabOrderModal = true
+            const noShowList = newList.filter(con => Object.keys(con).length <= 2)
+            this.noShowBillSnList = _this.getNewSalesBillList(noShowList)
+          } else {
+            const resultVal = _this.getNewSalesBillList(newList)
+            this.salesBillSnList = resultVal
+          }
+        }
+      })
+    },
+    getNewSalesBillList (list) {
+      const resultVal = list.map(item => {
+        const nameArr = Object.getOwnPropertyNames(item)
+        let newName = ''
+        nameArr.forEach(con => {
+          if (con != 'product') {
+            newName = con
+          }
+        })
+        const newobj = {
+          salesReturnDetailSn: item.product.salesReturnDetailSn, salesBillDetailSn: item[newName].salesBillDetailSn
+        }
+        return newobj
+      })
+      return resultVal
     },
     handleGrabOrderOk (con) {
-      this.salesBillSnList = con
+      if (this.noShowBillSnList && this.noShowBillSnList.length > 0) {
+        this.salesBillSnList = this.salesBillSnList.concat(con)
+      } else {
+        this.salesBillSnList = con
+      }
     },
     closeGrabOrder () {
-      this.objInfo = null
+      this.listInfo = null
       this.openGrabOrderModal = false
     },
     // 设置价格
-    handleSave () {
+    handleSave (type) {
+      if (type && type === 'salesBillNo') {
+        if (!this.buyerName) {
+          this.$message.warning('请输入正确的销售单号!')
+          return
+        }
+      }
       // 不抓单且打折
       if (this.form.grabFlag == 0 && this.form.discountFlag == 1) {
         if (!this.form.discount) {
@@ -220,8 +263,9 @@ export default {
         this.form.salesReturnBillDetailList = this.salesBillSnList
       } else {
         const snList = []
+        this.form.salesBillNo = ''
         this.chooseData.map(item => {
-          snList.push(item.salesReturnDetailSn)
+          snList.push({ salesReturnDetailSn: item.salesReturnDetailSn })
         })
         this.form.salesReturnBillDetailList = snList
       }