lilei 7 місяців тому
батько
коміт
87771c9b66

+ 22 - 0
src/api/salesNew.js

@@ -493,4 +493,26 @@ export const salesDetailQueryBorrowPageList = (params) => {
       'module': encodeURIComponent('选择累计产品列表')
     }
   })
+}
+// 批量添加累计产品
+export const salesDetailInsertBatchBorrow = (params) => {
+  return axios({
+    url: '/sales/detail/insertBatchBorrow',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('批量添加累计产品')
+    }
+  })
+}
+// 导入累计产品
+export const salesDetailImportBorrow = (params) => {
+  return axios.request({
+    url: '/sales/detail/importBorrow',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('导入累计产品')
+    }
+  })
 }

+ 11 - 2
src/views/salesManagement/salesQueryNew/comps/activeStatisticsList.vue

@@ -335,6 +335,9 @@ export default {
             if (row && row.promotionRule && row.promotionRule.promotionRuleType == 'PROMO_PROD') {
               importButton.push({ key: 'DISCOUNT', name: '特价产品' })
             }
+            if (row && row.promotion && row.promotion.borrowFlag == 1) {
+              importButton.push({ key: 'BORROW', name: '累计产品' })
+            }
             return (
               <div>
                 <a-button
@@ -561,8 +564,14 @@ export default {
     },
     // 导入产品
     handleImportClick (e, row) {
-      this.$refs.importGuideModal.pageInit({ promoProductClz: e.key, salesBillSn: this.salesBillSn, salesPromoSn: row.salesPromoSn }, row)
-      this.openGuideModal = true
+      // 导入累计产品
+      if (e.key == 'BORROW') {
+
+      } else {
+        // 导入活动产品
+        this.$refs.importGuideModal.pageInit({ promoProductClz: e.key, salesBillSn: this.salesBillSn, salesPromoSn: row.salesPromoSn }, row)
+        this.openGuideModal = true
+      }
     },
     // 关闭导入弹框
     closeGuideModel () {

+ 1 - 1
src/views/salesManagement/salesQueryNew/comps/chooseProduct.vue

@@ -72,7 +72,7 @@ export default {
     // 添加产品,
     // row 产品信息, promoProductClz 促销产品类型
     insterProduct (row, promoProductClz) {
-      this.$emit('addProduct', row, this.promoData, promoProductClz)
+      this.$emit('addProduct', row, this.promoData, promoProductClz, this.cptype)
     },
     // 初始化数据,
     // data 订单数据, promo 促销活动数据, type 组件类型

+ 44 - 0
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -207,6 +207,7 @@ import {
   salesDetailList,
   salesDetailUpdateQty,
   salesDetailInsert,
+  salesDetailInsertBatchBorrow,
   salesDetailDel,
   salesDetailBatchDel,
   deleteAll,
@@ -446,6 +447,49 @@ export default {
         this.spinning = false
       })
     },
+    // 累计产品到活动
+    accumulateProduct (row, promo, promoProductClz) {
+      // 防止多次添加产品
+      if (this.isInster) { return }
+      this.$message.loading('正在添加产品...', 1)
+      this.isInster = true
+      this.spinning = true
+      const params = {
+        salesPromoSn: promo.salesPromoSn,
+        promoRuleSn: promo.promoRuleSn,
+        promoSn: promo.promoSn,
+        promoProductClz: promoProductClz,
+        packQty: row.productPackQty,
+        productSn: row.productSn,
+        showCost: row.lastStockCost,
+        price: row.productPrice,
+        origPrice: row.origPrice,
+        promotionGiftsAmount: 0,
+        usePromotionGiftsAmount: 0,
+        qty: row.salesNums,
+        salesBillSn: this.detailData.salesBillSn,
+        salesBillNo: this.detailData.salesBillNo,
+        purchaseBillSn: this.detailData.purchaseBillSn,
+        purchaseBillNo: this.detailData.purchaseBillNo,
+        priceLevel: row.priceLevel,
+        stockSn: row.stockSn,
+        promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
+        promotionFlag: 0, // 促销标记 正品传0,促销品传1
+        warehouseSn: row.warehouseSn
+      }
+      salesDetailInsertBatchBorrow(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success('产品添加成功', 2.5)
+          this.resetSearchForm(true)
+          this.$emit('refash', 'promo')
+        }
+        this.spinning = false
+        this.isInster = false
+      }).catch(err => {
+        this.isInster = false
+        this.spinning = false
+      })
+    },
     // 批量取消出现产品
     handleBatchCancelActive () {
       const _this = this

+ 9 - 4
src/views/salesManagement/salesQueryNew/edit.vue

@@ -321,13 +321,18 @@ export default {
       this.getOrderDetail(false)
     },
     // 确定新增产品到列表,
-    insterProduct (row, promo, type) {
+    insterProduct (row, promo, promoProductClz, cptype) {
       // 正常产品
-      if (type == 0) {
+      if (promoProductClz == 0) {
         this.$refs.productNormalList.saveNewProduct(row, promo)
       } else {
-        // 活动产品对象,type 是 promoProductClz
-        this.$refs.productActiveList.saveNewProduct(row, promo, type)
+        // 活动产品对象
+        if (cptype == 1) {
+          this.$refs.productActiveList.saveNewProduct(row, promo, promoProductClz)
+        }
+        if (cptype == 2) {
+          this.$refs.productActiveList.accumulateProduct(row, promo, promoProductClz)
+        }
       }
     },
     // 正常产品参与活动