lilei 7 月之前
父节点
当前提交
652dcdbee9

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

@@ -18,7 +18,7 @@
             <li>1) 导入的Excel文件中必须包含名为“产品编码”、“数量”、“出库仓库”的列,且名称必须相同</li>
             <li>2) 除了“产品编码”、“数量”、“出库仓库”三列,其他列可自定义,不影响数据导入</li>
             <li>3) 如果导入的产品已经存在,则不会导入该行</li>
-            <li v-if="params&&params.salesPromoSn">4) 导入的活动产品必须是活动规则中的产品 </li>
+            <li v-if="uploadParams&&uploadParams.salesPromoSn">4) 导入的活动产品必须是活动规则中的产品 </li>
             <li>
               <a :href="filePath" style="margin: 5px 0 0;display: block;">
                 <a-icon type="download" style="padding-right: 5px;" />下载导入模板

+ 57 - 92
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -40,41 +40,49 @@
     <div class="table-page-search-wrapper">
       <a-row :gutter="15" type="flex" justify="space-between" align="middle">
         <a-col :md="8" :sm="24" style="text-align:left;">
-          <span v-if="selectTotal" style="margin-right:5px;">已选{{ selectTotal }}项</span>
-        </a-col>
-        <a-col :md="12" :sm="24" style="text-align:right;">
-          <a-button
-            :id="'salesEdit-searchBox-'+id"
-            type="link"
-            class="button-info"
-            @click="showSearchBox=!showSearchBox" ><a-icon :type="showSearchBox?'close':'search'"/> 筛选</a-button>
-          <!-- // 操作按钮 -->
           <a-dropdown>
             <a-menu slot="overlay" @click="handleMenuClick" :id="'salesEdit-menu-'+id">
-              <a-menu-item key="3" :id="'salesEdit-menu-3-'+id">
-                全部仓库设置
-              </a-menu-item>
               <a-menu-item key="0" :id="'salesEdit-menu-0-'+id">
-                部分仓库设置
+                批量仓库设置
               </a-menu-item>
-              <a-menu-divider />
               <a-menu-item key="1" :id="'salesEdit-menu-1-'+id">
-                删除已选项
-              </a-menu-item>
-              <a-menu-item key="2" :id="'salesEdit-menu-2-'+id">
-                全部删除
+                批量删除
               </a-menu-item>
-              <a-menu-divider />
               <a-menu-item key="4" :id="'salesEdit-menu-4-'+id">
                 批量取消促销
               </a-menu-item>
             </a-menu>
             <a-button
               :id="'salesEdit-plaction-'+id"
-              type="link"
+              type="default"
               class="button-info"
-            > 批量操作 <a-icon type="down" /> </a-button>
+              size="small"
+            >批量操作<a-icon type="down" /> </a-button>
           </a-dropdown>
+          <span v-if="selectTotal" style="margin-left:10px;">已选{{ selectTotal }}项</span>
+        </a-col>
+        <a-col :md="12" :sm="24" style="text-align:right;">
+          <a-button
+            :id="'salesEdit-searchBox-'+id"
+            type="link"
+            class="button-info"
+            @click="showSearchBox=!showSearchBox" ><a-icon :type="showSearchBox?'close':'search'"/> 筛选</a-button>
+          <a-button
+            :id="'salesEdit-setAllWarehouse-'+id"
+            type="link"
+            class="button-info"
+            @click="handleMenuClick({key:3})"
+          >
+            <a-icon type="setting" /> 全部仓库设置
+          </a-button>
+          <a-button
+            :id="'salesEdit-setAllDel-'+id"
+            type="link"
+            class="button-error"
+            @click="handleMenuClick({key:2})"
+          >
+            <a-icon type="delete" /> 全部删除
+          </a-button>
         </a-col>
       </a-row>
     </div>
@@ -166,16 +174,6 @@
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
         <div>
-          <a-button
-            :id="'salesEdit-del-'+id+'-'+record.id"
-            size="small"
-            type="link"
-            :loading="delLoading"
-            class="button-error"
-            v-if="!(record.promotionFlag == 'GIFT'&&record.salesPromoDetailParentSn)"
-            @click="handleDel(record)"
-          >删除</a-button>
-
           <a-button
             :id="'salesEdit-upactive-'+id+'-'+record.id"
             size="small"
@@ -185,28 +183,17 @@
             v-if="record.promotionFlag != 'GIFT'"
             @click="handleUpdateActive(record)"
           >换促销</a-button>
+          <a-button
+            :id="'salesEdit-del-'+id+'-'+record.id"
+            size="small"
+            type="link"
+            :loading="delLoading"
+            class="button-error"
+            v-if="!(record.promotionFlag == 'GIFT'&&record.salesPromoDetailParentSn)"
+            @click="handleDel(record)"
+          >删除</a-button>
         </div>
       </template>
-      <template slot="footer" slot-scope="currentPageData">
-        <!-- 总计 -->
-        <a-alert type="info" banner :showIcon="false">
-          <div slot="message" class="alert-bar">
-            <div class="countData" v-html="boldAmounts(countData&&countData.remarks||'')"></div>
-            <div style="display: flex;">
-              <div>
-                款数:<strong>{{ countData&&(countData.totalCategory || countData.totalCategory==0) ? countData.totalCategory : 0 }}</strong>
-              </div>
-              <div style="padding: 0 10px;">
-                数量:<strong>{{ countData&&(countData.totalQty || countData.totalQty==0) ? countData.totalQty : 0 }}</strong>
-              </div>
-              <div>
-                <div v-if="$hasPermissions('B_salesEdit_salesPrice')">总金额:<strong>{{ countData&&(countData.totalAmount || countData.totalAmount==0) ? toThousands(countData.totalAmount) : '0.00' }}</strong></div>
-                <div v-if="$hasPermissions('B_salesEdit_salesPrice')&&countData&&countData.lossAmount">优惠金额:<strong>{{ toThousands(countData.lossAmount) }}</strong></div>
-              </div>
-            </div>
-          </div>
-        </a-alert>
-      </template>
     </s-table>
 
     <!-- 仓库设置 -->
@@ -227,7 +214,6 @@ import productTypeAll from '@/views/common/productTypeAll.js'
 import {
   salesDetailList,
   salesPromoDetailCount,
-  salesDetailInsert,
   salesDetailUpdateQty,
   salesDetailDel,
   salesDetailBatchDel,
@@ -262,15 +248,10 @@ export default {
       type: Object,
       default: function () { return null }
     },
-    // 活动规则数据
-    promo: {
-      type: Object,
-      default: function () { return null }
-    },
     // 表格id
     id: {
       type: String,
-      default: ''
+      default: '0'
     },
     // 仓库sn
     warehouseSn: {
@@ -286,16 +267,16 @@ export default {
   data () {
     return {
       spinning: false,
+      dataSource: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.queryParam.salesBillSn = this.salesBillSn || ''
-        this.getCount()
         return salesDetailList(Object.assign(parameter, this.queryParam, {
           showStock: true,
-          promoRuleSn: this.promo.promoRuleSn,
-          promoSn: this.promo.promoSn,
-          salesPromoSn: this.promo.salesPromoSn
+          promoRuleSn: '',
+          promoSn: '',
+          salesPromoSn: ''
         })).then(res => {
           let data
           if (res.status == 200) {
@@ -353,7 +334,7 @@ export default {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '13%', align: 'center' },
-        { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: this.promo.promotionRule.promotionRuleType == 'PROMO_PROD' ? '14%' : '20%', align: 'left' },
+        { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '20%', align: 'left' },
         { title: '起订量', dataIndex: 'unitQtyV', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '6%', align: 'center' },
         { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' },
@@ -370,10 +351,8 @@ export default {
         arr.splice(4, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
         let idx = 0
         // 如果是特价活动,显示折扣
-        if (this.promo.promotionRule.promotionRuleType == 'PROMO_PROD') {
-          idx = idx + 1
-          arr.splice(5, 0, { title: '折扣', dataIndex: 'discountPrice', width: '6%', align: 'right', scopedSlots: { customRender: 'discountPrice' } })
-        }
+        idx = idx + 1
+        arr.splice(5, 0, { title: '折扣', dataIndex: 'discountPrice', width: '6%', align: 'right', scopedSlots: { customRender: 'discountPrice' } })
         arr.splice((this.showStockCol ? 9 : 8) + idx, 0, { title: '售价小计', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
       }
       return arr
@@ -419,19 +398,6 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     },
-    // 统计
-    getCount () {
-      salesPromoDetailCount(Object.assign(this.queryParam, {
-        salesBillSn: this.salesBillSn,
-        promoRuleSn: this.promo.promoRuleSn,
-        promoSn: this.promo.promoSn,
-        salesPromoSn: this.promo.salesPromoSn
-      })).then(res => {
-        if (res.status == 200) {
-          this.countData = res.data
-        }
-      })
-    },
     //  重置查询
     resetSearchForm (flag) {
       this.queryParam.productCode = ''
@@ -481,11 +447,10 @@ export default {
           _this.spinning = true
           const params = {
             salesBillDetailSnList: obj,
-            salesBillSn: _this.salesBillSn,
-            oldSalesPromoSn: _this.promo.salesPromoSn
+            salesBillSn: _this.salesBillSn
           }
           // 更换活动
-          _this.$emit('upActive', _this.promo, '0', params)
+          _this.$emit('upActive', null, '0', params)
         }
       })
     },
@@ -502,7 +467,7 @@ export default {
         centered: true,
         onOk () {
           _this.spinning = true
-          deleteAll({ salesBillSn: _this.salesBillSn, salesPromoSn: _this.promo.salesPromoSn }).then(res => {
+          deleteAll({ salesBillSn: _this.salesBillSn, salesPromoSn: '' }).then(res => {
             if (res.status == 200) {
               _this.$refs.table.refresh(true)
               _this.$emit('insterOk', 'promo')
@@ -532,7 +497,7 @@ export default {
           _this.spinning = true
           salesDetailBatchDel({
             salesBillSn: _this.salesBillSn,
-            salesPromoSn: _this.promo.salesPromoSn,
+            salesPromoSn: '',
             salesBillDetailSnList: obj
           }).then(res => {
             if (res.status == 200) {
@@ -552,7 +517,7 @@ export default {
         warehouseSn: row.warehouseSn,
         salesBillDetailSnList: snArr,
         salesBillSn: this.salesBillSn,
-        salesPromoSn: this.promo.salesPromoSn
+        salesPromoSn: ''
       }
       this.setWarehouseInfo(ajax_data)
     },
@@ -567,7 +532,7 @@ export default {
         warehouseSn: sn,
         salesBillDetailSnList: snArr,
         salesBillSn: _this.salesBillSn,
-        salesPromoSn: _this.promo.salesPromoSn,
+        salesPromoSn: '',
         allFlag: _this.warehouseTit ? true : undefined
       }
       _this.setWarehouseInfo(ajax_data)
@@ -613,7 +578,7 @@ export default {
       this.$refs.updateActive.getActiveList({
         productSn: record.productSn,
         salesBillSn: this.salesBillSn,
-        promoRuleSn: this.promo.promoRuleSn
+        promoRuleSn: ''
       }, record)
       this.openUpActiveModal = true
     },
@@ -627,7 +592,7 @@ export default {
           salesBillDetailSn: record.salesBillDetailSn,
           qty: record.qty,
           salesBillSn: _this.salesBillSn,
-          salesPromoSn: _this.promo.salesPromoSn
+          salesPromoSn: ''
         }).then(res => {
           if (res.status == 200) {
             _this.$emit('insterOk', 'promo')
@@ -651,7 +616,7 @@ export default {
         onOk () {
           _this.delLoading = true
           _this.spinning = true
-          salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn, salesPromoSn: _this.promo.salesPromoSn }).then(res => {
+          salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn, salesPromoSn: '' }).then(res => {
             if (res.status == 200) {
               _this.$refs.table.refresh(false)
               _this.$emit('insterOk', 'promo')
@@ -669,11 +634,11 @@ export default {
       const params = {
         salesBillDetailSn: editRow.salesBillDetailSn,
         salesBillSn: this.salesBillSn,
-        oldSalesPromoSn: this.promo.salesPromoSn,
+        oldSalesPromoSn: '',
         priceLevel: editRow.priceLevel
       }
       // 更换活动
-      this.$emit('upActive', this.promo, data, params)
+      this.$emit('upActive', null, data, params)
     },
     // 更换活动成功
     upAcitveSuccess () {

+ 23 - 17
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -47,35 +47,25 @@
     <div class="table-page-search-wrapper">
       <a-row :gutter="15" type="flex" justify="space-between" align="middle">
         <a-col :md="8" :sm="24" style="text-align:left;">
-          <span v-if="selectTotal" style="margin-right:5px;">已选{{ selectTotal }}项</span>
-        </a-col>
-        <a-col :md="16" :sm="24" style="text-align:right;">
           <a-dropdown>
             <a-menu slot="overlay" @click="handleMenuClick">
-              <a-menu-item key="3" id="salesEdit-pl-3">
-                全部仓库设置
-              </a-menu-item>
               <a-menu-item key="0" id="salesEdit-pl-0">
-                部分仓库设置
+                批量仓库设置
               </a-menu-item>
-              <a-menu-divider />
               <a-menu-item key="1" id="salesEdit-pl-1">
-                删除已选项
-              </a-menu-item>
-              <a-menu-item key="2" id="salesEdit-pl-2">
-                全部删除
+                批量删除
               </a-menu-item>
             </a-menu>
             <a-button
-              type="link"
+              type="default"
               class="button-info"
               id="salesEdit-plaction"
+              size="small"
             > 批量操作 <a-icon type="down" /> </a-button>
           </a-dropdown>
-          <!-- <a-button
-            type="link"
-            class="button-info"
-             @click="showSearch=!showSearch" ><a-icon type="search"/> 筛选</a-button> -->
+          <span v-if="selectTotal" style="margin-left:10px;">已选{{ selectTotal }}项</span>
+        </a-col>
+        <a-col :md="16" :sm="24" style="text-align:right;">
           <a-button
             type="link"
             class="button-info"
@@ -86,6 +76,22 @@
             type="link"
             class="button-info"
             @click="openCpModal"><a-icon type="plus" /> 添加产品</a-button>
+          <a-button
+            id="salesEdit-setAllWarehouse"
+            type="link"
+            class="button-info"
+            @click="handleMenuClick({key:3})"
+          >
+            <a-icon type="setting" /> 全部仓库设置
+          </a-button>
+          <a-button
+            id="salesEdit-setAllDel-"
+            type="link"
+            class="button-error"
+            @click="handleMenuClick({key:2})"
+          >
+            <a-icon type="delete" /> 全部删除
+          </a-button>
         </a-col>
       </a-row>
     </div>

+ 25 - 127
src/views/salesManagement/salesQueryNew/edit.vue

@@ -52,6 +52,7 @@
       <a-card
         size="small"
         :bordered="false"
+        title="活动产品"
         class="salesEdit-cont"
         v-if="activeList.length"
       >
@@ -64,16 +65,7 @@
           :warehouseSn="warehouseSn"
           :salesBillSn="salesBillSn"
         ></activeStatisticsList>
-      </a-card>
-      <!-- 活动产品列表 -->
-      <a-card
-        size="small"
-        :bordered="false"
-        class="salesEdit-cont"
-        title="活动产品"
-        v-if="activeList.length"
-      >
-        <div style="padding: 10px;">
+        <div style="padding:0 10px 10px;">
           <productList
             ref="productList-active-list"
             :activeList="activeList"
@@ -183,7 +175,6 @@ export default {
       spinning: false,
       activeList: [], // 活动列表
       newActiveList: [], // 新活动列表
-      activeDesKey: {}, // 活动规则详情数据
       salesBillSn: null, // 销售单sn
       detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
       warehouseSn: undefined, // 仓库sn
@@ -223,18 +214,9 @@ export default {
     handleBack () {
       this.$router.push({ name: 'salesQueryNewList', query: { closeLastOldTab: true } })
     },
-    // 收起展开活动区域
-    tooglePanel (item) {
-      item.isActive = !item.isActive
-      this.activeList.splice()
-      // 刷新当前表格
-      if (item.isActive) {
-        const row = this.$refs['productList-' + item.promoRuleSn][0]
-        row && row.resetSearchForm()
-      }
-    },
     //  销售单详情
     getOrderDetail (flag, callback) {
+      this.spinning = true
       salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.detailData = res.data
@@ -244,8 +226,10 @@ export default {
           }
         }
         if (flag) {
+          // 获取活动列表
           this.getActiveList()
         }
+        this.spinning = false
       })
     },
     // 优惠明细查看
@@ -256,21 +240,6 @@ export default {
         }
       })
     },
-    // 轮询判断是否全部加载完了
-    isAllLoadFinish (mlist) {
-      const nid = setInterval(() => {
-        const ret = []
-        mlist.map(item => {
-          const da = item.disabled
-          ret.push(da)
-        })
-        // 加载完了
-        if (!ret.includes(true)) {
-          clearInterval(nid)
-          this.spinning = false
-        }
-      }, 50)
-    },
     // 刷新所有第三方库存
     searchAllThreeStock () {
       this.spinning = true
@@ -279,36 +248,17 @@ export default {
           // 刷新正常活动产品列表
           this.$refs.productNormalList.searchThreeStockOk()
           // 刷新所有活动产品列表
-          const activeList = this.activeList
-          activeList.map(item => {
-            item.isActive = true
-            const row = this.$refs['productList-' + item.promoRuleSn][0]
-            row && row.searchThreeStockOk()
-          })
-          activeList.splice()
+          this.$refs[this.cpCurRefId][0].searchThreeStockOk()
         }
         this.spinning = false
       })
     },
-    // 刷新所有表格数据
+    // 刷新产品表格数据,包括正常产品和活动产品
     updateAllTable (flag) {
-      const activeList = this.activeList.filter(item => item.isActive)
-      const mlist = []
-      this.spinning = true
       // 刷新正常产品列表
       this.$refs.productNormalList.resetSearchForm()
-      mlist.push(this.$refs.productNormalList)
-
-      // 刷新所有活动产品列表
-      activeList.map(item => {
-        const row = this.$refs['productList-' + item.promoRuleSn][0]
-        row && row.resetSearchForm()
-        mlist.push(row)
-      })
-
-      // 判断是否全部调用完
-      this.isAllLoadFinish(mlist)
-
+      // 刷新活动产品列表
+      this.$refs[this.cpCurRefId][0].resetSearchForm()
       // 是否刷新详情
       if (flag) {
         this.getOrderDetail()
@@ -319,13 +269,7 @@ export default {
       // 已参与活动列表
       const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
       this.activeList = list.filter(item => item.promotion && item.promotionRule)
-      this.activeList.map(item => {
-        item.isActive = item.enabledFlag == 1
-        item.showDesc = false
-        item.disabled = item.enabledFlag == 0
-        this.activeDesKey['search-' + item.promoRuleSn] = false
-      })
-
+      this.activeList.map(item => { item.disabled = item.enabledFlag == 0 })
       setTimeout(() => {
         this.updateAllTable()
       }, 500)
@@ -343,41 +287,31 @@ export default {
       this.showNewActiveModal = false
       this.getOrderDetail(true)
     },
-    // 添加产品后,关闭弹框
-    closeProductModal (type) {
-      this.showCpModal = false
-    },
     // 打开选择产品弹框
     openProductModal (type, promo) {
       this.$refs.chooseProduct.pageInit(this.detailData, promo, type)
       this.showCpModal = true
     },
-    // 添加活动产品成功的回调
+    // 添加产品后,关闭弹框
+    closeProductModal (type) {
+      this.showCpModal = false
+    },
+    // 添加活动产品成功的回调,刷新产品列表
     insterActiveOk (type) {
-      const mlist = []
-      this.spinning = true
-      // 如果时活动产品
+      // 如果是活动产品
       if (type == 'promo') {
         // 刷新正常产品列表
         this.$refs.productNormalList.resetSearchForm()
-        mlist.push(this.$refs.productNormalList)
       }
       // 如果时正常产品
       if (type == 'normal') {
         // 刷新活动产品列表
-        const activeList = this.activeList.filter(item => item.isActive)
-        activeList.map(item => {
-          const row = this.$refs['productList-' + item.promoRuleSn][0]
-          row && row.resetSearchForm()
-          mlist.push(row)
-        })
+        this.$refs[this.cpCurRefId][0].resetSearchForm()
       }
-      // 判断是否全部调用完
-      this.isAllLoadFinish(mlist)
       // 重新获取详情信息
-      this.getOrderDetail()
+      this.getOrderDetail(false)
     },
-    // 确定新增产品
+    // 确定新增产品到列表
     insterProduct (row, promotionFlag, type) {
       // 正常产品
       if (type == 0) {
@@ -387,7 +321,7 @@ export default {
         this.$refs[this.cpCurRefId][0].saveNewProduct(row, promotionFlag, type)
       }
     },
-    // 正常产品添加到活动
+    // 正常产品参与活动
     addActive (data, params) {
       const promo = data.split('-')
       const newSn = this.activeList.find(item => item.promoRuleSn == promo[1])
@@ -399,25 +333,12 @@ export default {
         ...params
       }).then(res => {
         if (res.status == 200) {
-          const mlist = []
-          this.spinning = true
-          // 刷新新参与活动
-          if (data != 0) {
-            const nt = this.$refs['productList-' + promo[1]][0]
-            nt && nt.resetSearchForm()
-            mlist.push(nt)
-          }
-
+          // 刷新活动列表
+          this.$refs[this.cpCurRefId][0].resetSearchForm()
           // 刷新正常活动
-          const pnt = this.$refs.productNormalList
-          pnt && pnt.addAcitveSuccess()
-          mlist.push(pnt)
-
-          // 判断是否全部调用完
-          this.isAllLoadFinish(mlist)
-
+          this.$refs.productNormalList.addAcitveSuccess()
           // 刷新详情统计
-          this.getOrderDetail()
+          this.getOrderDetail(false)
         }
       })
     },
@@ -433,30 +354,7 @@ export default {
         ...params
       }).then(res => {
         if (res.status == 200) {
-          const mlist = []
-          this.spinning = true
-          // 刷新新参与活动
-          if (data != 0) {
-            const nt = this.$refs['productList-' + promo[1]][0]
-            nt && nt.resetSearchForm()
-            mlist.push(nt)
-          }
-
-          // 刷新正常活动
-          const pnt = this.$refs.productNormalList
-          pnt && pnt.resetSearchForm()
-          mlist.push(pnt)
-
-          // 刷新当前活动
-          const ot = this.$refs['productList-' + oldPromo.promoRuleSn][0]
-          ot && ot.upAcitveSuccess()
-          mlist.push(ot)
-
-          // 判断是否全部调用完
-          this.isAllLoadFinish(mlist)
-
-          // 刷新详情统计
-          this.getOrderDetail()
+          this.updateAllTable(true)
         }
       })
     },