Browse Source

bug 修复

lilei 2 years ago
parent
commit
d7ae43e18a
1 changed files with 12 additions and 37 deletions
  1. 12 37
      src/views/salesReturnManagement/salesReturn/salesReturnEdit.vue

+ 12 - 37
src/views/salesReturnManagement/salesReturn/salesReturnEdit.vue

@@ -98,19 +98,6 @@
               @blur="e => onCellBlur(e.target.value, record, 'qty')"
               style="width: 100%;" />
           </template>
-          <!-- 退货单价 -->
-          <template slot="price" slot-scope="text, record">
-            <a-input-number
-              id="salesReturn-price"
-              size="small"
-              v-model="record.price"
-              :precision="2"
-              :min="0"
-              :max="999999"
-              placeholder="请输入"
-              @blur="e => onCellBlur(e.target.value, record, 'price')"
-              style="width: 100%;" />
-          </template>
           <!-- 退货原因 -->
           <template slot="returnReason" slot-scope="text, record">
             <a-select
@@ -234,10 +221,8 @@ export default {
         { 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.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
-        // { title: '参考退货单价', dataIndex: 'price', align: 'center', width: '8%', scopedSlots: { customRender: 'price' } },
         { title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '8%', scopedSlots: { customRender: 'qty' } },
         { title: '退货原因', dataIndex: 'returnReason', align: 'center', width: '13%', scopedSlots: { customRender: 'returnReason' } },
-        // { title: '参考退货金额', align: 'center', dataIndex: 'totalAmount', width: '8%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
       if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
@@ -254,14 +239,7 @@ export default {
     },
     // 已选产品  blur
     onCellBlur (val, record, type) {
-      let valBackups
-      if (type) {
-        if (type == 'qty') {
-          valBackups = record.qtyBackups
-        } else if (type == 'price') {
-          valBackups = record.priceBackups
-        }
-      }
+      const valBackups = record.qtyBackups
       //  光标移出,值发生改变再调用编辑接口
       if (val && val != valBackups) {
         this.spinning = true
@@ -271,19 +249,17 @@ export default {
           price: record.price
         }).then(res => {
           if (res.status == 200) {
-            this.resetSearchForm(true)
+            this.resetTable(false)
             this.$message.success(res.message)
             this.spinning = false
+            record.qtyBackups = record.qty
           } else {
             this.spinning = false
+            record.qty = valBackups
           }
         })
       } else {
-        if (type == 'qty') {
-          record.qty = valBackups
-        } else if (type == 'price') {
-          record.price = valBackups
-        }
+        record.qty = valBackups
       }
     },
     // 修改退货原因
@@ -294,16 +270,12 @@ export default {
         returnReason: row.returnReason
       }).then(res => {
         if (res.status == 200) {
-          this.resetSearchForm(true)
+          this.resetTable(false)
           this.$message.success(res.message)
         }
         this.spinning = false
       })
     },
-    // 重置列表
-    resetForm () {
-      this.$refs.table.refresh(true)
-    },
     // 获取单据详细
     getOrderDetail () {
       salesReturnDetail({ sn: this.orderSn }).then(res => {
@@ -323,7 +295,7 @@ export default {
           _this.spinning = true
           salesReturnDetailDel({ salesReturnDetailSn: row.salesReturnDetailSn }).then(res => {
             if (res.status == 200) {
-              _this.resetSearchForm(true)
+              _this.resetTable(false)
             }
             _this.$message.info(res.message)
             _this.delLoading = false
@@ -332,6 +304,10 @@ export default {
         }
       })
     },
+    resetTable (flag) {
+      this.$refs.table.refresh(flag)
+      this.getOrderDetail()
+    },
     //  重置
     resetSearchForm (flag) {
       this.productForm.productName = ''
@@ -395,8 +371,7 @@ export default {
     hanldeOk (obj) {
       salesReturnBatchInsert(obj).then(res => {
         if (res.status == 200) {
-          this.$refs.table.refresh(true)
-          this.getOrderDetail()
+          this.resetTable(true)
         }
       })
     },