lilei 1 year ago
parent
commit
08b6bcf6e4

+ 54 - 47
src/views/salesManagement/salesQueryNew/list.vue

@@ -531,63 +531,70 @@ export default {
     async handleExpense (row) {
       const _this = this
       const hasExpense = await queryCreateBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => res.data || [])
-      const showModalFlag = [hasExpense.exceed, hasExpense.balance, hasExpense.giftConvertAmount]
-      const showModal = 0
-      showModalFlag.map(item => {
-        if (item) {
-          showModal = showModal + 1
+      const showModalFlag = []
+      const optionsKey = [
+        {
+          id: 'balance',
+          name: '采购额结余'
+        },
+        {
+          id: 'exceed',
+          name: '采购额超出'
+        },
+        {
+          id: 'giftConvertAmount',
+          name: '促销产品转采购额'
+        }
+      ]
+      optionsKey.map(key => {
+        if(hasExpense[key.id]){
+          showModalFlag.push(key)
         }
       })
-      console.log(hasExpense)
-      // 有2个以上采购额时
-      if (hasExpense && showModal > 1) {
-        _this.$confirm({
-          title: '转费用报销单?',
-          centered: true,
-          class: 'confirm-center',
-          content: <div>
-            <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
-            <div style="padding:0 0 10px 0;text-align:center;">
-              <aRadioGroup onChange={_this.changeDaOpt}>
-                <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="balance">
-                  采购额结余
-                </aRadio>
-                <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="exceed">
-                  采购额超出
-                </aRadio>
-                <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="giftConvertAmount">
-                  促销产品转采购额
-                </aRadio>
-              </aRadioGroup>
-            </div>
-          </div>,
-          onOk () {
-            if (_this.expenseOption) {
-              _this.expenseSave(hasExpense, _this.expenseOption)
-            } else {
-              _this.$message.info('请选择费用报销单类型!')
-              return true
-            }
-          },
-          onCancel () {
-            _this.expenseOption = null
-          }
-        })
-      } else {
+      
+      if(showModalFlag.length){
         // 直接转费用单
-        _this.expenseSave(hasExpense, null)
+        if(showModalFlag.length == 1){
+          _this.expenseSave(hasExpense[showModalFlag[0].id])
+        }
+        // 有2个以上采购额时
+        if (showModalFlag.length>1) {
+          _this.$confirm({
+            title: '转费用报销单?',
+            centered: true,
+            class: 'confirm-center',
+            content: <div>
+              <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
+              <div style="padding:0 0 10px 0;text-align:center;">
+                <aRadioGroup onChange={_this.changeDaOpt}>
+                  {showModalFlag.map(item => <aRadio key={item.id} style="height: '30px';lineHeight: '30px';padding:5px 0;" value={item.id}>{item.name}</aRadio>)}
+                </aRadioGroup>
+              </div>
+            </div>,
+            onOk () {
+              if (_this.expenseOption) {
+                _this.expenseSave(hasExpense[_this.expenseOption])
+              } else {
+                _this.$message.info('请选择费用报销单类型!')
+                return true
+              }
+            },
+            onCancel () {
+              _this.expenseOption = null
+            }
+          })
+        }
       }
     },
     changeDaOpt (e) {
       this.expenseOption = e.target.value
     },
     // 转费用单
-    expenseSave (data, type) {
-      console.log(data, type)
-      const params = type ? data[type] : (data.balance || data.exceed || data.giftConvertAmount)
-      if (params) {
+    expenseSave (data) {
+      console.log(data)
+      if (data) {
         this.openBaseModal = true
-        this.$refs.expenseModal.setDetail(params, 'sales')
+        this.$refs.expenseModal.setDetail(data, 'sales')
       }
     },
     expenseSaveOk (params) {

+ 8 - 1
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -300,7 +300,7 @@ export default {
                   onChange={e => _this.convertPromoGiftsChange(e,record)}
                   precision={0}
                   min={0}
-                  max={record.unpushedQty}
+                  max={record.maxConvertNums}
                   style="width: 100%;"
                   placeholder="请输入" />
               </div>
@@ -533,6 +533,13 @@ export default {
           item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
           item.productOrigUnit = productOrigUnit || '--'
           item.cancelNums = item.unpushedQty
+          
+          if(item.convertPromoGiftsFlag == 1){
+            item.maxConvertNums = item.unpushedQty + item.convertPromoGiftsQty
+          }else{
+            item.maxConvertNums = 0
+          }
+          
           // 库存为0或待下推数为0,不可添加
           if(!item.unpushedQty || item.unpushedQty<0){
             this.disableSelectedRowKeys.push(item.id)