Ver Fonte

feature:bug修复

chenqilong há 2 anos atrás
pai
commit
9e42879088

+ 26 - 0
src/utils/common.js

@@ -109,6 +109,32 @@ export const numToFixed = num => {
   return num.replace(/(\d)(?=(\d{3})+$)/g, '$1,')
 }
 
+/**
+ *
+ * @param {*} fn  是我们需要包装的事件回调
+ * @param {*} delay 是每次推迟执行的等待时间
+ */
+export const debounce = (fn, delay = 1000) => {
+  // 定时器
+  let timer = null
+  // 将debounce处理结果当作函数返回
+  return function () {
+    // 保留调用时的this上下文
+    let context = this
+    // 保留调用时传入的参数
+    let args = arguments
+    // 每次事件被触发时,都去清除之前的旧定时器
+    // console.log(timer)
+    if (timer) {
+      clearTimeout(timer)
+    }
+    // 设立新定时器
+    timer = setTimeout(function () {
+      fn.apply(context, args)
+    }, delay)
+  }
+}
+
 export default {
   successMsg,
   errorMsg,

+ 13 - 6
src/views/supply/retail/components/retail_return.vue

@@ -3,7 +3,9 @@
     <el-page-header @back="goBack" content="退订"></el-page-header>
 
     <div class="main-title">
-      <div class="title">订单信息 <span style="margin-left: 20px">经销商名称:{{detailData.customerName}}</span></div>
+      <div class="title">
+        订单信息 <span style="margin-left: 20px">经销商名称:{{ detailData.customerName }}</span>
+      </div>
     </div>
 
     <div class="diy-table-1">
@@ -45,9 +47,9 @@
           <div class="value">{{ detailData.closeName }}</div>
         </el-col>
         <el-col :span="24" class="item">
-            <div class="label">是否直调</div>
-            <div class="value">{{ detailData.isAllDirect?'是':'否' }}</div>
-          </el-col>
+          <div class="label">是否直调</div>
+          <div class="value">{{ detailData.isAllDirect ? '是' : '否' }}</div>
+        </el-col>
       </el-row>
     </div>
 
@@ -116,7 +118,13 @@
           </template>
         </el-table-column>
         <el-table-column align="right" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="退订数量" prop="tdQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column
+          align="center"
+          label="已退订数量"
+          prop="retiredQty"
+          min-width="100"
+          show-overflow-tooltip
+        ></el-table-column>
 
         <el-table-column align="right" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip>
           <template slot-scope="scope">
@@ -326,7 +334,6 @@ export default {
         .then(res => {
           this.$successMsg('退订成功')
           this.goBack()
-     
         })
         .finally(res => {
           this.formLoading = false

+ 89 - 57
src/views/supply/transferOrder/transferOrderForm.vue

@@ -48,7 +48,7 @@
     <!-- 审核 /详情-->
     <div v-if="moduleType === 3 || moduleType === 2">
       <el-button v-if="moduleType === 3" type="primary" size="mini" @click="onExamine('OK')">同意</el-button>
-      <el-button size="mini" @click="onInvoice('SAVE')">撤回</el-button>
+      <el-button v-if="formData.status === 'OK'" size="mini" @click="onInvoice('SAVE')">撤回</el-button>
     </div>
   </div>
 </template>
@@ -58,6 +58,8 @@ import TemplatePage from '@/components/template/template-page-1.vue'
 import { getcustomerFrontList } from '@/api/stock'
 import { getListCostBillV2 } from '@/api/logisticsBill'
 
+import { debounce } from '@/utils/common'
+
 import { getStagecustomerListV2, getDealerListV2 } from '@/api/basic_data/dealer'
 import {
   addCustomerTransfer,
@@ -178,7 +180,6 @@ export default {
             valueFormat: 'yyyy-MM-dd HH:mm:ss',
             disabled: this.comDisabled,
             pickerOptions: this.setDisabled
-
           },
           formItemAttributes: { label: '调整日期', prop: 'transferTime' }
         },
@@ -192,7 +193,7 @@ export default {
           name: 'el-select',
           options: this.sonCustomerNumberList,
           events: {
-            change: (e) => this.handleChange(e, 'transferCustomerNumber')
+            change: e => this.handleChange(e, 'transferCustomerNumber')
           },
           md: 6,
           attributes: {
@@ -207,7 +208,7 @@ export default {
           options: this.sonCustomerNameList,
           md: 6,
           events: {
-            change: (e) => this.handleChange(e, 'transferCustomerName')
+            change: e => this.handleChange(e, 'transferCustomerName')
           },
           attributes: {
             clearable: true,
@@ -285,11 +286,13 @@ export default {
         },
         ...(() => {
           if (~[1].indexOf(this.moduleType)) {
-            return [{
-              columnAttributes: {
-                label: '可调拨库存数',
-                prop: 'frontStockNum'
-              }}
+            return [
+              {
+                columnAttributes: {
+                  label: '可调拨库存数',
+                  prop: 'frontStockNum'
+                }
+              }
             ]
           }
           return []
@@ -302,14 +305,18 @@ export default {
           },
           render: (h, { column, row, index }) => {
             return (
-              <div style='margin:0 20px'>
+              <div style="margin:0 20px">
                 <el-input
-                  type='number'
+                  type="number"
                   disabled={this.comDisabled}
                   value={row.qty}
-                  onInput={e => (row.qty = e)}
-                  placeholder='调拨数量'
-                  size='mini'
+                  // onInput={e => (row.qty = e)}
+                  onInput={value => {
+                    row.qty = value
+                    this.debounceChange(value, index)
+                  }}
+                  placeholder="调拨数量"
+                  size="mini"
                 ></el-input>
               </div>
             )
@@ -323,12 +330,12 @@ export default {
           render: (h, { column, row, index }) => {
             return (
               <el-input
-                type='text'
+                type="text"
                 value={row.notes}
                 disabled={this.comDisabled}
                 onInput={e => (row.notes = e)}
-                placeholder='备注'
-                size='mini'
+                placeholder="备注"
+                size="mini"
               ></el-input>
             )
           }
@@ -349,8 +356,8 @@ export default {
               <div>
                 {!this.comDisabled ? (
                   <el-button
-                    type='text'
-                    size='default'
+                    type="text"
+                    size="default"
                     onClick={() => {
                       this.handleDel(index)
                     }}
@@ -369,29 +376,29 @@ export default {
         ...[
           !this.comDisabled
             ? {
-              name: 'slot-component',
-              md: 24,
-              attributes: { disabled: false },
-              formItemAttributes: { label: '', prop: '' },
-              render: (h, { props, onInput }) => {
-                return (
-                  <div>
-                    <el-button
-                      size='mini'
-                      onClick={() => {
-                        this.visible = true
-                        this.recordSelected = []
-                      }}
-                    >
+                name: 'slot-component',
+                md: 24,
+                attributes: { disabled: false },
+                formItemAttributes: { label: '', prop: '' },
+                render: (h, { props, onInput }) => {
+                  return (
+                    <div>
+                      <el-button
+                        size="mini"
+                        onClick={() => {
+                          this.visible = true
+                          this.recordSelected = []
+                        }}
+                      >
                         添加
-                    </el-button>
-                    <el-button size='mini' onClick={() => this.handleAllDel()}>
+                      </el-button>
+                      <el-button size="mini" onClick={() => this.handleAllDel()}>
                         删除
-                    </el-button>
-                  </div>
-                )
+                      </el-button>
+                    </div>
+                  )
+                }
               }
-            }
             : {}
         ],
         {
@@ -534,109 +541,127 @@ export default {
             prop: 'materialCostType',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '产品名称',
             prop: 'materialName',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '规格型号',
             prop: 'materialSpecification',
             width: 350
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '物料类型',
             prop: 'materialType',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '商家编码',
             prop: 'merchantCode',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '商家名称',
             prop: 'merchantName',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '订单号',
             prop: 'orderCode',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '订单时间',
             prop: 'orderDate',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '订单类型',
             prop: 'orderType',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '订单类型细分',
             prop: 'orderTypeDetail',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '收货送货地址',
             prop: 'receiptAddress',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '退货单号',
             prop: 'returnOrderCode',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '补贴结算系数',
             prop: 'subsidyCoefficient',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '嘉贤创建时间',
             prop: 'time',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '费用汇总',
             prop: 'totalCost',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '单价计算',
             prop: 'unitPrice',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '卸货上楼结算系数',
             prop: 'unloadUpstairsCoefficient',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '上楼卸货费用',
             prop: 'unloadUpstairsCost',
             width: 200
           }
-        }, {
+        },
+        {
           columnAttributes: {
             label: '发货仓库编码',
             prop: 'warehouseCode',
@@ -833,6 +858,13 @@ export default {
     }
   },
   methods: {
+    debounceChange: debounce(function (val, index) {
+      if (val <= 0) {
+        this.selectData[index].qty = 1
+      } else {
+        this.selectData[index].qty = parseInt(val)
+      }
+    }, 500),
     // 列表请求函数
     getList(...p) {
       this.recordSelected = []