lilei před 8 měsíci
rodič
revize
6c3478903c

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1728720080850
+  "version": 1728723855804
 }

+ 51 - 25
src/views/purchasingManagement/purchaseReturnOutSync/edit.vue

@@ -96,7 +96,7 @@
                   size="small"
                   type="link"
                   class="button-primary"
-                  @click="handleAdd(record)"
+                  @click="handleAddNew(record)"
                   id="purchaseReturnEdit-add-btn">添加</a-button>
               </template>
             </s-table>
@@ -341,17 +341,35 @@ export default {
       this.chooseQueryParam.productName = ''
       this.$refs.chooseTable.refresh(true)
     },
-    //  添加/编辑
-    handleAdd (row, isEdit) {
-      // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
-      if (!isEdit && (row.returnPrice === null || row.returnPrice == undefined || Number(row.returnPrice).toString().trim().length === 0)) {
-        this.$message.warning('请输入退货价格')
+    // 添加
+    handleAddNew (record) {
+      const _this = this
+      if (record.returnQty === null || record.returnQty === undefined || Number(record.returnQty).toString().trim().length === 0) {
+        this.$message.warning('请输入退货数量')
         return
       }
-      if (!isEdit && !row.returnQty) {
-        this.$message.warning('请输入退货数量')
+      if (record.returnPrice === '' || record.returnPrice === null || record.returnPrice === undefined || Number(record.returnPrice).toString().trim().length === 0) {
+        this.$message.warning('请输入退货价格')
         return
       }
+      if (record.returnPrice === 0) {
+        this.$confirm({
+          title: '提示',
+          content: '退货单价为0,确定添加?',
+          centered: true,
+          onOk () {
+            _this.handleAdd(record)
+          },
+          onCancel () {
+            record.returnPrice = ''
+          }
+        })
+      } else {
+        _this.handleAdd(record)
+      }
+    },
+    //  添加/编辑
+    handleAdd (row, isEdit) {
       const params = {
         id: isEdit ? row.id : undefined,
         purchaseReturnSn: this.$route.params.sn,
@@ -371,17 +389,6 @@ export default {
         remarks: row.remarks,
         promotionFlag: row.promotionFlag
       }
-      if (isEdit) { // 编辑
-        // 清空退货数量时,值应保持未清空前的值,因退货数量都不可为空
-        if (!row.qty) {
-          row.qty = row.qtyBackups
-          return
-        }
-        if (!row.cost) {
-          row.cost = row.costBackups
-          return
-        }
-      }
       this.spinning = true
       purchaseReturnDetailSave(params).then(res => {
         if (res.status == 200) {
@@ -395,10 +402,6 @@ export default {
         }
       })
     },
-    // 双击快速添加
-    handleClickRow (record) {
-      this.handleAdd(record)
-    },
     // 导入明细
     handleImport () {},
     //  删除
@@ -460,6 +463,10 @@ export default {
     },
     // 已选产品 退货数量  blur
     qtyBlur (val, record) {
+      if (val === '') {
+        record.qty = record.qtyBackups
+        return
+      }
       //  光标移出,值发生改变再调用编辑接口
       if (val != record.qtyBackups) {
         this.handleAdd(record, 'edit')
@@ -467,8 +474,27 @@ export default {
     },
     // 已选产品 退货单价  blur
     costBlur (val, record) {
-      if (val && (val != record.costBackups)) {
-        this.handleAdd(record, 'edit')
+      const _this = this
+      if (val === '') {
+        record.cost = record.costBackups
+        return
+      }
+      if (Number(val) !== record.costBackups) {
+        if (Number(val) === 0) {
+          this.$confirm({
+            title: '提示',
+            content: '确定将退货单价修改为0?',
+            centered: true,
+            onOk () {
+              _this.handleAdd(record, 'edit')
+            },
+            onCancel () {
+              record.cost = record.costBackups
+            }
+          })
+        } else {
+          _this.handleAdd(record, 'edit')
+        }
       }
     },
     // 仓库

+ 51 - 21
src/views/purchasingManagement/purchaseReturnOutSync/grapEdit.vue

@@ -86,7 +86,7 @@
                   size="small"
                   type="link"
                   class="button-primary"
-                  @click="handleAdd(record)"
+                  @click="handleAddNew(record)"
                   id="purchaseReturnEdit-add-btn">添加</a-button>
               </template>
             </s-table>
@@ -343,17 +343,35 @@ export default {
       this.chooseQueryParam.productName = ''
       this.$refs.chooseTable.refresh(true)
     },
-    //  添加/编辑
-    handleAdd (row, isEdit) {
-      // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
-      if (!isEdit && (row.returnPrice === null || row.returnPrice == undefined || Number(row.returnPrice).toString().trim().length === 0)) {
-        this.$message.warning('请输入退货价格')
+    // 添加
+    handleAddNew (record) {
+      const _this = this
+      if (record.returnQty === null || record.returnQty === undefined || Number(record.returnQty).toString().trim().length === 0) {
+        this.$message.warning('请输入退货数量')
         return
       }
-      if (!isEdit && !row.returnQty) {
-        this.$message.warning('请输入退货数量')
+      if (record.returnPrice === '' || record.returnPrice === null || record.returnPrice === undefined || Number(record.returnPrice).toString().trim().length === 0) {
+        this.$message.warning('请输入退货价格')
         return
       }
+      if (record.returnPrice === 0) {
+        this.$confirm({
+          title: '提示',
+          content: '退货单价为0,确定添加?',
+          centered: true,
+          onOk () {
+            _this.handleAdd(record)
+          },
+          onCancel () {
+            record.returnPrice = ''
+          }
+        })
+      } else {
+        _this.handleAdd(record)
+      }
+    },
+    //  添加/编辑
+    handleAdd (row, isEdit) {
       const params = {
         id: isEdit ? row.id : undefined,
         purchaseReturnSn: this.$route.params.sn,
@@ -366,17 +384,6 @@ export default {
         remarks: row.remarks,
         promotionFlag: row.promotionFlag
       }
-      if (isEdit) { // 编辑
-        // 清空退货数量时,值应保持未清空前的值,因退货数量都不可为空
-        if (!row.qty) {
-          row.qty = row.qtyBackups
-          return
-        }
-        if (!row.cost) {
-          row.cost = row.costBackups
-          return
-        }
-      }
       this.spinning = true
       purchaseReturnDetailSave(params).then(res => {
         if (res.status == 200) {
@@ -451,6 +458,10 @@ export default {
     },
     // 已选产品 退货数量  blur
     qtyBlur (val, record) {
+      if (val === '') {
+        record.qty = record.qtyBackups
+        return
+      }
       //  光标移出,值发生改变再调用编辑接口
       if (val != record.qtyBackups) {
         this.handleAdd(record, 'edit')
@@ -458,8 +469,27 @@ export default {
     },
     // 已选产品 退货单价  blur
     costBlur (val, record) {
-      if (val && (val != record.costBackups)) {
-        this.handleAdd(record, 'edit')
+      const _this = this
+      if (val === '') {
+        record.cost = record.costBackups
+        return
+      }
+      if (Number(val) !== record.costBackups) {
+        if (Number(val) === 0) {
+          this.$confirm({
+            title: '提示',
+            content: '确定将退货单价修改为0?',
+            centered: true,
+            onOk () {
+              _this.handleAdd(record, 'edit')
+            },
+            onCancel () {
+              record.cost = record.costBackups
+            }
+          })
+        } else {
+          _this.handleAdd(record, 'edit')
+        }
       }
     },
     // 获取详情