lilei há 1 ano atrás
pai
commit
500731724c

+ 31 - 32
src/views/salesManagement/waitDispatchNew/detailProductList.vue

@@ -110,35 +110,31 @@
       },
       columns () {
         const _this = this
-            const priceFormat = function(data){
-              return _this.toThousands(data) || '--'
-            }
-            const numsFormat = function(data){
-              return data || data == 0 ? data : '--'
-            }
-            const codeFormat = function(record,data,h){
-              let ftext = ''
-              let fcolor = ''
-              if(record.promotionFlag == 'GIFT'){
-                ftext = '促'
-                fcolor = '#52c41a'
-              }
-              // if(record.promotionFlag == 'REGULAR'){
-              //   ftext = '正'
-              //   fcolor = '#108ee9'
-              // }
-              if(record.promotionFlag == 'DISCOUNT'){
-                ftext = '特'
-                fcolor = '#faad14'
-              }
-              return (
-                      <div>
-                          <span style="padding-right: 15px;">{data}</span>
-                          {ftext?(<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom:'80%' }}></a-badge>):''}
-                          {Number(record.stockQty||0) < Number(record.unpushedQty||0)?(<a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>):''}
-                      </div>
-                  )
-            }
+        const priceFormat = function(data){
+          return _this.toThousands(data) || '--'
+        }
+        const numsFormat = function(data){
+          return data || data == 0 ? data : '--'
+        }
+        const codeFormat = function(record,data,h){
+          let ftext = ''
+          let fcolor = ''
+          if(record.promotionFlag == 'GIFT'){
+            ftext = '促'
+            fcolor = '#52c41a'
+          }
+          if(record.promotionFlag == 'DISCOUNT'){
+            ftext = '特'
+            fcolor = '#faad14'
+          }
+          return (
+                  <div>
+                      <span style="padding-right: 15px;">{data}</span>
+                      {ftext?(<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom:'80%' }}></a-badge>):''}
+                      {Number(record.stockQty||0) < Number(record.unpushedQty||0)?(<a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>):''}
+                  </div>
+              )
+        }
         // 输入框
         const inputFormat = function(record,data,h) {
           if(record.surplusQty>0){
@@ -147,7 +143,8 @@
                 <a-input-number
                   size="small"
                   value={record.qty}
-                  onChange={e => _this.cancelNumsChange(e,record)}
+                  onChange={e => record.qty = e}
+                  onBlur={e => _this.cancelNumsChange(e,record)}
                   precision={0}
                   min={1}
                   max={record.surplusQty}
@@ -269,9 +266,10 @@
          this.selectedRowKeys = []
       },
       // 已选产品  blur
-      cancelNumsChange (val, record) {
+      cancelNumsChange (e, record) {
         const _this = this
-        if (val && val != record.qtyBackups) {
+        const val = e.target.value
+        if (val && val != record.qtyBackups && val<=record.surplusQty) {
           _this.spinning = true
           updateQty({
             dispatchBillDetailSn: record.dispatchBillDetailSn,
@@ -284,6 +282,7 @@
               _this.spinning = false
               _this.$emit('refashTable')
             } else {
+              record.qty = record.qtyBackups
               _this.spinning = false
             }
           })