lilei 4 năm trước cách đây
mục cha
commit
64de0b6dd2

+ 17 - 7
src/views/salesManagement/salesQuery/chooseActive.vue

@@ -13,7 +13,10 @@
         class="sTable"
         ref="table"
         size="small"
-        :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+        :row-selection="{
+          selectedRowKeys: selectedRowKeys,
+          onChange: onSelectChange,
+        }"
         :rowKey="(record) => record.id"
         :columns="columns"
         :data-source="list"
@@ -33,10 +36,16 @@
         </template>
       </a-table>
       <div style="display: flex;justify-content: center;padding: 10px 0;">
-        <a-button size="large" type="primary" class="button-primary" @click="handleSubmit" style="padding: 0 60px;">
+        <a-button
+          size="large"
+          type="primary"
+          :loading="newLoading"
+          class="button-primary"
+          @click="handleSubmit"
+          style="padding: 0 60px;">
           确定
         </a-button>
-        <a-button size="large" style="padding: 0 60px;margin-left: 15px;font-size: 12px;" @click="cansel">
+        <a-button size="large" :loading="newLoading" style="padding: 0 60px;margin-left: 15px;font-size: 12px;" @click="cansel">
           取消
         </a-button>
       </div>
@@ -58,7 +67,8 @@ export default {
     buyerSn: {
       type: String,
       default: ''
-    }
+    },
+    newLoading: Boolean
   },
   data () {
     return {
@@ -71,7 +81,7 @@ export default {
         { title: '促销价', dataIndex: 'goodsPrice', align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
         { title: '数量', dataIndex: 'qty', scopedSlots: { customRender: 'salesNums' }, align: 'center' },
         { title: '单位', dataIndex: 'product.unit', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '促销类型', dataIndex: 'promotionSourceSn', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '促销类型', dataIndex: 'promoRuleTypeName', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       selectedRowKeys: [], // Check here to configure the default column
       selectedRows: [],
@@ -85,10 +95,10 @@ export default {
       this.loading = true
       this.salesBillDetailSn = row.salesBillDetailSn
       getPromoGoodsList({ salesBillDetailSn: row.salesBillDetailSn, buyerSn: this.buyerSn }).then(res => {
-        this.list = res.data
-        this.list.map(item => {
+        res.data.map(item => {
           item.qty = 1
         })
+        this.list = res.data
         this.loading = false
       })
     },

+ 10 - 10
src/views/salesManagement/salesQuery/edit.vue

@@ -86,7 +86,7 @@
             :max="999999"
             :min="1"
             :precision="0"
-            @change="onCellChange(record.id, 'qty', $event)" />
+            @change="onCellChange(record, $event)" />
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
@@ -127,7 +127,7 @@
         </div>
       </a-alert>
       <!-- 已选促销品列表 -->
-      <queryPromotable ref="promotable" :salesBillSn="$route.params.sn" @onCellChange="onCellChange" @del="handleDel"></queryPromotable>
+      <queryPromotable ref="promotable" :salesBillSn="$route.params.sn" :delLoading="delLoading" @onCellChange="onCellChange" @del="handleDel"></queryPromotable>
     </a-card>
     <a-affix :offset-bottom="0">
       <div
@@ -149,6 +149,7 @@
       :buyerSn="detailData&&detailData.buyerSn"
       :openModal="newActive"
       @ok="addNewActive"
+      :newLoading="isInster"
       @close="newActive=false"></ChooseActive>
   </div>
 </template>
@@ -209,15 +210,10 @@ export default {
     }
   },
   methods: {
-    onCellChange (id, key, value) {
-      console.log(id, key, value)
-      const dataSource = [...this.dataSource]
-      const row = dataSource.find(item => item.id === id)
+    onCellChange (row, value) {
+      console.log(row, value)
       if (row) {
-        row[key] = Number(value)
-        this.dataSource = dataSource
-      }
-      if (key == 'qty') {
+        row['qty'] = Number(value)
         salesDetailUpdateQty({
           salesBillDetailSn: row.salesBillDetailSn,
           qty: row.qty,
@@ -371,9 +367,13 @@ export default {
           purchaseBillNo: this.detailData.purchaseBillNo
         }))
       })
+      this.isInster == true
       addPromoGoods(temp).then(res => {
         if (res.status == 200) {
           this.$refs.promotable.getData()
+          this.getOrderDetail()
+          this.newActive = false
+          this.isInster == false
         }
       })
     }

+ 7 - 6
src/views/salesManagement/salesQuery/queryPromotable.vue

@@ -23,7 +23,7 @@
         :max="999999"
         :min="1"
         :precision="0"
-        @change="onCellChange(record.id, 'qty', $event)" />
+        @change="onCellChange(record, $event)" />
     </template>
     <!-- 操作 -->
     <template slot="action" slot-scope="text, record">
@@ -41,15 +41,16 @@
 <script>
 import { salesDetailList } from '@/api/salesDetail'
 import { STable, VSelect } from '@/components'
+import EditableCell from '@/views/common/editInput.js'
 export default {
   name: 'Promotable',
-  components: { STable, VSelect },
+  components: { STable, VSelect, EditableCell },
   props: {
     salesBillSn: {
       type: [Number, String],
       default: ''
     },
-    newLoading: Boolean
+    delLoading: Boolean
   },
   data () {
     return {
@@ -65,7 +66,7 @@ export default {
         { title: '成本价', dataIndex: 'showCost', width: 150, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
         { title: '原售价', dataIndex: 'origPrice', width: 150, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
         { title: '促销价', dataIndex: 'price', width: 150, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
-        { title: '数量', scopedSlots: { customRender: 'salesNums' }, width: 150, align: 'center' },
+        { title: '数量', dataIndex: 'qty', scopedSlots: { customRender: 'salesNums' }, width: 150, align: 'center' },
         { title: '单位', dataIndex: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '促销类型', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
@@ -90,8 +91,8 @@ export default {
       this.$refs.table.refresh()
     },
     // 修改数量
-    onCellChange (id, key, $event) {
-      this.$emit('onCellChange', id, key, $event)
+    onCellChange (row, $event) {
+      this.$emit('onCellChange', row, $event)
     },
     // 删除
     handleDel (row) {