Browse Source

Merge branch 'develop_yh50' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh50

chenrui 7 months ago
parent
commit
a0dbce3944

+ 5 - 3
src/views/allocationManagement/transferOut/dsModal.vue

@@ -49,7 +49,7 @@
               v-model.trim="form.explainInfo"
               placeholder="请输入发货说明(最多500个字符)"/>
           </a-form-model-item>
-          <a-form-model-item label="备货打印" prop="printState">
+          <a-form-model-item label="备货打印" prop="printState" v-if="showPrint">
             <a-radio-group id="transferOutDs-printState" v-model="form.printState">
               <a-radio value="NO_PRINT" id="transferOutDs-printState1">
                 允许打印
@@ -112,14 +112,16 @@ export default {
         sendNo: [{ required: true, message: '请输入发货编号', trigger: 'change' }],
         printState: [{ required: true, message: '请选择备货打印', trigger: 'change' }]
       },
-      detailData: null //  详情数据
+      detailData: null, //  详情数据
+      showPrint: false
     }
   },
   methods: {
     // 初始化
     pageInit (data) {
+      this.showPrint = !data.sendNo
       this.form.sendNo = data.sendNo
-      this.form.printState = data.printState
+      this.form.printState = this.showPrint ? data.printState : undefined
       this.form.receiverSn = data.receiverSn
       this.form.receiverName = data.receiverName
       this.form.explainInfo = data.explainInfo

+ 3 - 4
src/views/allocationManagement/transferOut/printModal.vue

@@ -55,7 +55,7 @@
             打印
           </a-checkbox>
         </a-form-model-item>
-        <a-form-model-item label="发货说明" v-if="nowType=='dbPrint'||showExplainInfo">
+        <a-form-model-item label="发货说明" v-if="nowType=='dbPrint'||nowType=='dbflPrint'">
           <a-checkbox @change="onChangeExplainInfo" :checked="explainInfoFlag" id="allocateBill-print-explainInfo">
             打印
           </a-checkbox>
@@ -207,9 +207,7 @@ export default {
               if (_this.form.orderBy != '-1') {
                 obj.orderBy = _this.form.orderBy
               }
-              if (_this.showExplainInfo) {
-                obj.explainInfoFlag = this.form.explainInfoFlag
-              }
+              obj.explainInfoFlag = this.form.explainInfoFlag
             }
           }
           // 打印
@@ -254,6 +252,7 @@ export default {
         explainInfoFlag: 1 // 发货说明  1打印 0不打印
       }
       this.remarkFlag = true
+      this.explainInfoFlag = true
     }
   },
   watch: {

+ 2 - 2
src/views/financialManagement/financialCollection/list.vue

@@ -151,7 +151,7 @@
               审核进度
             </a-button>
             <a-button
-              v-if="record.status=='AUDIT_REJECT'&&$hasPermissions('B_againEdit')"
+              v-if="record.status=='AUDIT_REJECT'&&$hasPermissions('B_againEditFc')"
               size="small"
               type="link"
               class="button-info"
@@ -160,7 +160,7 @@
               再次编辑
             </a-button>
             <a-button
-              v-if="record.status=='AUDIT_PASS'&&$hasPermissions('B_againEdit')"
+              v-if="record.status=='AUDIT_PASS'&&$hasPermissions('B_editFcDetail')"
               size="small"
               type="link"
               class="button-info"

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

@@ -300,7 +300,7 @@ export default {
     },
     // 添加产品
     handleAdd (row) {
-      this.$emit('add', row, 0, this.promoProductClz)
+      this.$emit('add', row, this.promoProductClz)
     },
     // 选择产品分类  change
     changeProductType (val, opt) {

+ 109 - 77
src/views/salesManagement/salesQueryNew/comps/activeStatisticsList.vue

@@ -68,20 +68,23 @@ export default {
     return {
       hasInit: false,
       spinning: false,
+      // 表格列宽拖到
       columnWidthResizeOption: {
         // default false
         enable: true,
         // column resize min width
         minWidth: 50
       },
+      // 表格复选框
       checkboxOption: {
+        hideSelectAll: true,
+        selectedRowKeys: [],
         // 行选择改变事件
         selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
           console.log(row, isSelected, selectedRowKeys)
-        },
-        // 全选改变事件
-        selectedAllChange: ({ isSelected, selectedRowKeys }) => {
-          console.log(isSelected, selectedRowKeys)
+          this.checkboxOption.selectedRowKeys = isSelected ? [selectedRowKeys[selectedRowKeys.length - 1]] : []
+          // 查询此活动下的产品列表
+          this.$emit('selected', isSelected ? row : null)
         }
       },
       // 单元格样式
@@ -106,13 +109,14 @@ export default {
         bodyCellClass: ({ row, column, rowIndex }) => {
         }
       },
+      // 表格列表
       columns: [
         {
           field: '',
           key: 'acheckbox',
           type: 'checkbox',
           title: '',
-          width: 30,
+          width: 23,
           align: 'center',
           fixed: 'left'
         },
@@ -120,15 +124,41 @@ export default {
           field: '',
           key: 'a',
           title: '序号',
-          width: 30,
+          width: 25,
           align: 'center',
           fixed: 'left',
           renderBodyCell: ({ row, column, rowIndex }, h) => {
             return ++rowIndex
           }
         },
-        { field: 'promotionRuleType', key: 'ruletype', width: 100, title: '活动类型', align: 'center', fixed: 'left', ellipsis: { showTitle: true } },
-        { field: 'promotionRuleDesc', key: 'ruledesc', width: 100, title: '规则简称', align: 'center', fixed: 'left', renderBodyCell: ({ row, column, rowIndex }, h) => { return (<div class="table-link-text" onClick={() => _this.showDesc(row)}>{row[column.field]}</div>) } },
+        { field: 'promotionRuleType',
+          key: 'ruletype',
+          width: 100,
+          title: '活动类型',
+          align: 'center',
+          fixed: 'left',
+          renderBodyCell: ({ row, column, rowIndex }, h) => {
+            return (<div style="width:100%;display:flex;justify-content: space-between;">
+              <div style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title={row[column.field]}>{row[column.field]}</div>
+              <div style="display:flex;">
+                <span style="width:12px;color:#ed1c24;text-align:center;margin-left:5px;cursor:pointer;" title="上移">{rowIndex != 0 ? '⇡' : ''}</span>
+                <span style="width:12px;color:#108ee9;text-align:center;cursor:pointer;" title="下移">{rowIndex != _this.activeList.length - 1 ? '⇣' : ''}</span>
+              </div>
+            </div>)
+          }
+        },
+        { field: 'promotionRuleDesc',
+          key: 'ruledesc',
+          width: 100,
+          title: '规则简称',
+          align: 'center',
+          fixed: 'left',
+          renderBodyCell: ({ row, column, rowIndex }, h) => {
+            return (<div class="table-link-text" title={row[column.field]} onClick={() => _this.showDesc(row)}>
+              <div style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title={row[column.field]}>{row[column.field]}</div>
+            </div>)
+          }
+        },
         {
           title: '门槛产品(数量/金额)',
           children: [
@@ -304,12 +334,12 @@ export default {
                 <a-button
                   type="link"
                   size="small"
-                  class={row.disabled ? 'button-success' : 'button-error'}
+                  class={row.enabledFlag == 0 ? 'button-success' : 'button-error'}
                   on-click={() => this.enableRow(row)}
                 >
-                  {row.disabled ? '启用' : '禁用'}
+                  {row.enabledFlag == 0 ? '启用' : '禁用'}
                 </a-button>
-                {!row.disabled ? <a-dropdown>
+                {row.enabledFlag == 1 ? <a-dropdown>
                   <a-menu slot="overlay" on-click={(e) => this.handleImportClick(e, row)} id={'salesEdit-menu-import-' + row.id}>
                     {importButton.map(item => {
                       return (
@@ -323,16 +353,24 @@ export default {
                     class="button-primary"
                     size="small"
                   >
-                    导入产品 <a-icon type="down" />
+                    导入<a-icon style="margin-left:0" type="down" />
                   </a-button>
                 </a-dropdown> : ''}
-                {!row.disabled ? <a-button
+                {row.enabledFlag == 1 ? <a-button
+                  type="link"
+                  size="small"
+                  class="button-primary"
+                  on-click={() => this.addProduct(row)}
+                >
+                 添加
+                </a-button> : ''}
+                {row.enabledFlag == 1 ? <a-button
                   type="link"
                   size="small"
                   class="button-primary"
                   on-click={() => this.addProduct(row)}
                 >
-                 添加产品
+                 累计
                 </a-button> : ''}
               </div>
             )
@@ -351,21 +389,17 @@ export default {
       this.hasInit = true
       for (let i = 0; i < this.activeList.length; i++) {
         const item = this.activeList[i]
-        // 参数
-        const params = {
-          salesBillSn: this.salesBillSn,
-          warehouseSn: this.warehouseSn,
-          promotionFlag: undefined
-        }
         let acTotal = {}
         // 启用的活动数据获取统计信息
         if (item.enabledFlag == 1) {
           // 参数
           const activeParams = {
+            salesBillSn: this.salesBillSn,
+            warehouseSn: this.warehouseSn,
+            promotionFlag: undefined,
             promoRuleSn: item.promoRuleSn,
             promoSn: item.promoSn,
-            salesPromoSn: item.salesPromoSn,
-            ...params
+            salesPromoSn: item.salesPromoSn
           }
           // 获取活动产品统计
           acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
@@ -391,6 +425,50 @@ export default {
       }
     },
     // 禁用启用活动规则
+    // 刷新当前规则
+    refashRow (item, enable) {
+      // 刷新产品列表
+      this.$emit('refash', '')
+      const active = this.activeList.find(k => k.id == item.id)
+      const index = this.tableData.findIndex(k => k.id == item.id)
+      active.enabledFlag = enable
+      console.log(enable, 'enable')
+      // 如果是启用
+      if (enable == 1) {
+      // 参数
+        const activeParams = {
+          salesBillSn: this.salesBillSn,
+          warehouseSn: this.warehouseSn,
+          promotionFlag: undefined,
+          promoRuleSn: item.promoRuleSn,
+          promoSn: item.promoSn,
+          salesPromoSn: item.salesPromoSn
+        }
+        salesPromoDetailCount(activeParams).then(res => {
+          const acTotal = res.data
+          if (acTotal) {
+          // 采购额结余
+            acTotal.cgejyAmount = (Number(acTotal.totalPromoGiftsAmount || 0) - Number(acTotal.totalUsePromoGiftsAmount || 0)).toFixed(2)
+            // 采购额超出
+            acTotal.cgeccAmount = (Number(acTotal.totalUsePromoGiftsAmount || 0) - Number(acTotal.totalPromoGiftsAmount || 0)).toFixed(2)
+          }
+          this.tableData[index] = {
+            ...active,
+            promotionRuleType: active.promotionRule.promotionRuleTypeDictValue,
+            promotionRuleDesc: active.promotionRule.description,
+            ...acTotal,
+            countData: acTotal
+          }
+          this.tableData.splice()
+        })
+      } else {
+        // 禁用活动不显示
+        this.tableData[index] = active
+        this.tableData[index].totalPromoGiftsAmount = undefined
+        this.tableData[index].totalUsePromoGiftsAmount = undefined
+        this.tableData.splice()
+      }
+    },
     // 启用规则
     enabledActive (item) {
       const _this = this
@@ -400,17 +478,15 @@ export default {
         salesPromoSn: item.salesPromoSn
       }).then(res => {
         if (res.status == 200) {
-          item.disabled = false
-          _this.activeList.splice()
-          // 刷新产品表格
-          _this.$emit('refashProduct')
+          // 刷新
+          _this.refashRow(item, 1)
           _this.$message.success('启用成功')
         }
         _this.spinning = false
       })
     },
     // 禁用规则
-    disabledActive (e, item) {
+    disabledActive (item) {
       const _this = this
       _this.spinning = true
       salesDisablePromo({
@@ -420,10 +496,8 @@ export default {
         salesDisableType: _this.disabledActiveOption
       }).then(res => {
         if (res.status == 200) {
-          item.disabled = true
-          _this.activeList.splice()
-          // 刷新产品表格
-          _this.$emit('refashProduct')
+          // 刷新
+          _this.refashRow(item, 0)
           _this.disabledActiveOption = null
           _this.$message.success('禁用成功')
         }
@@ -433,7 +507,7 @@ export default {
     enableRow (item) {
       const _this = this
       // 禁用的直接启用
-      if (item.disabled) {
+      if (item.enabledFlag == 0) {
         this.enabledActive(item)
         return
       }
@@ -503,7 +577,7 @@ export default {
       salesBatchInsert(params).then(res => {
         if (res.status == 200) {
           this.$message.success('产品导入成功', 2.5)
-          this.$emit('insterOk', 'promo')
+          this.$emit('refash', 'promo')
         }
       })
     },
@@ -511,49 +585,6 @@ export default {
     addProduct (row) {
       this.$emit('openCpModal', 1, row)
     },
-    // 保存添加的产品到销售列表
-    saveNewProduct (row, promotionFlag, promoProductClz) {
-      // 防止多次添加产品
-      if (this.isInster) { return }
-      this.$message.loading('正在添加产品...', 1)
-      this.isInster = true
-      this.spinning = true
-      const params = {
-        salesPromoSn: this.promo.salesPromoSn,
-        promoRuleSn: this.promo.promoRuleSn,
-        promoSn: this.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: promotionFlag, // 促销标记 正品传0,促销品传1
-        warehouseSn: row.warehouseSn
-      }
-      salesDetailInsert(params).then(res => {
-        if (res.status == 200) {
-          this.$message.success('产品添加成功', 2.5)
-          this.resetSearchForm(true)
-          this.$emit('insterOk', 'promo')
-        }
-        this.spinning = false
-        this.isInster = false
-      }).catch(err => {
-        this.isInster = false
-        this.spinning = false
-      })
-    },
     // 查看活动详情
     showDesc (row) {
       if (row.promoRuleSn) {
@@ -587,8 +618,9 @@ export default {
     background: #fff3c2 !important;
   }
   .table-link-text{
+    width:100%;
     color: #409EFF;
-    cursor: pointer;
+    display:flex;
     &:hover{
       text-decoration: underline;
     }

+ 6 - 4
src/views/salesManagement/salesQueryNew/comps/chooseProduct.vue

@@ -53,7 +53,8 @@ export default {
       spinning: false,
       cptype: 3, // 组件类型
       isShow: this.openModal, //  是否打开弹框
-      orderData: null // 订单数据
+      orderData: null, // 订单数据
+      promoData: null //  促销活动数据
     }
   },
 
@@ -63,15 +64,16 @@ export default {
       this.$emit('close')
     },
     // 添加产品,
-    // row 产品信息, promotionFlag 是否促销产品, promoProductClz 促销产品类型
-    insterProduct (row, promotionFlag, promoProductClz) {
-      this.$emit('addProduct', row, promotionFlag, promoProductClz)
+    // row 产品信息, promoProductClz 促销产品类型
+    insterProduct (row, promoProductClz) {
+      this.$emit('addProduct', row, this.promoData, promoProductClz)
     },
     // 初始化数据,
     // data 订单数据, promo 促销活动数据, type 组件类型
     pageInit (data, promo, type) {
       this.cptype = type
       this.orderData = data
+      this.promoData = promo
       this.$nextTick(() => {
         this.$refs.partQuery.pageInit(data, promo)
       })

+ 81 - 43
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -42,12 +42,20 @@
         <a-col :md="8" :sm="24" style="text-align:left;">
           <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>
@@ -60,22 +68,6 @@
             >批量操作<a-icon type="down" /> </a-button>
           </a-dropdown>
           <span v-if="selectTotal" style="margin-left:10px;">已选{{ selectTotal }}项</span>
-          <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-col :md="12" :sm="24" style="text-align:right;">
           <a-button
@@ -213,8 +205,8 @@ import ProductBrand from '@/views/common/productBrand.js'
 import productTypeAll from '@/views/common/productTypeAll.js'
 import {
   salesDetailList,
-  salesPromoDetailCount,
   salesDetailUpdateQty,
+  salesDetailInsert,
   salesDetailDel,
   salesDetailBatchDel,
   deleteAll,
@@ -239,9 +231,9 @@ export default {
       default: false
     },
     newLoading: Boolean,
-    activeList: {
-      type: Array,
-      default: () => []
+    promo: {
+      type: Object,
+      default: function () { return null }
     },
     // 详情数据
     detailData: {
@@ -274,9 +266,9 @@ export default {
         this.queryParam.salesBillSn = this.salesBillSn || ''
         return salesDetailList(Object.assign(parameter, this.queryParam, {
           showStock: true,
-          promoRuleSn: '',
-          promoSn: '',
-          salesPromoSn: ''
+          promoRuleSn: this.promo ? this.promo.promoRuleSn : '',
+          promoSn: this.promo ? this.promo.promoSn : '',
+          salesPromoSn: this.promo ? this.promo.salesPromoSn : ''
         })).then(res => {
           let data
           if (res.status == 200) {
@@ -333,14 +325,14 @@ export default {
     columns () {
       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: '20%', align: 'left' },
+        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '12%', align: 'center' },
+        { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '25%', 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' },
         { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '10%', align: 'center' },
         { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ]
       if (this.showStockCol) {
         arr.splice(6, 0, { title: '第三方库存', dataIndex: 'thirdStockQty', width: '6%', align: 'center', customRender: text => ((text || text == 0) ? text : '--') })
@@ -358,6 +350,9 @@ export default {
     salesBillSn (newValue, oldValue) {
       this.resetSearchForm()
     },
+    promo (newValue, oldValue) {
+      this.resetSearchForm()
+    },
     spinning (a, b) {
       if (a) {
         this.$emit('spinning', a)
@@ -408,6 +403,49 @@ export default {
       this.$refs.table.clearSelected()
       this.$refs.table.refresh(!!flag)
     },
+    // 保存添加的产品到销售列表
+    saveNewProduct (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
+      }
+      salesDetailInsert(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
@@ -446,7 +484,7 @@ export default {
             salesBillSn: _this.salesBillSn
           }
           // 更换活动
-          _this.$emit('upActive', null, '0', params)
+          _this.$emit('upActive', '0', params)
         }
       })
     },
@@ -463,10 +501,10 @@ export default {
         centered: true,
         onOk () {
           _this.spinning = true
-          deleteAll({ salesBillSn: _this.salesBillSn, salesPromoSn: '' }).then(res => {
+          deleteAll({ salesBillSn: _this.salesBillSn, salesPromoSn: this.promo ? this.promo.salesPromoSn : '' }).then(res => {
             if (res.status == 200) {
               _this.$refs.table.refresh(true)
-              _this.$emit('insterOk', 'promo')
+              _this.$emit('refash', 'promo')
               _this.$message.success(res.message)
             }
             _this.spinning = false
@@ -493,12 +531,12 @@ export default {
           _this.spinning = true
           salesDetailBatchDel({
             salesBillSn: _this.salesBillSn,
-            salesPromoSn: '',
+            salesPromoSn: this.promo ? this.promo.salesPromoSn : '',
             salesBillDetailSnList: obj
           }).then(res => {
             if (res.status == 200) {
               _this.$refs.table.refresh(false)
-              _this.$emit('insterOk', 'promo')
+              _this.$emit('refash', 'promo')
               _this.$message.success(res.message)
             }
             _this.spinning = false
@@ -513,7 +551,7 @@ export default {
         warehouseSn: row.warehouseSn,
         salesBillDetailSnList: snArr,
         salesBillSn: this.salesBillSn,
-        salesPromoSn: ''
+        salesPromoSn: this.promo ? this.promo.salesPromoSn : ''
       }
       this.setWarehouseInfo(ajax_data)
     },
@@ -528,7 +566,7 @@ export default {
         warehouseSn: sn,
         salesBillDetailSnList: snArr,
         salesBillSn: _this.salesBillSn,
-        salesPromoSn: '',
+        salesPromoSn: _this.promo ? _this.promo.salesPromoSn : '',
         allFlag: _this.warehouseTit ? true : undefined
       }
       _this.setWarehouseInfo(ajax_data)
@@ -541,7 +579,7 @@ export default {
         console.log(res)
         if (res.status == 200) {
           _this.$message.success(res.message)
-          _this.$emit('insterOk', 'promo')
+          _this.$emit('refash', 'promo')
         }
         _this.openWarehouseModal = false
         _this.$refs.table.refresh(false)
@@ -574,7 +612,7 @@ export default {
       this.$refs.updateActive.getActiveList({
         productSn: record.productSn,
         salesBillSn: this.salesBillSn,
-        promoRuleSn: ''
+        promoRuleSn: this.promo ? this.promo.promoRuleSn : ''
       }, record)
       this.openUpActiveModal = true
     },
@@ -588,10 +626,10 @@ export default {
           salesBillDetailSn: record.salesBillDetailSn,
           qty: record.qty,
           salesBillSn: _this.salesBillSn,
-          salesPromoSn: ''
+          salesPromoSn: _this.promo ? _this.promo.salesPromoSn : ''
         }).then(res => {
           if (res.status == 200) {
-            _this.$emit('insterOk', 'promo')
+            _this.$emit('refash', 'promo')
             _this.$message.success(res.message)
           }
           _this.$refs.table.refresh(false)
@@ -612,10 +650,10 @@ export default {
         onOk () {
           _this.delLoading = true
           _this.spinning = true
-          salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn, salesPromoSn: '' }).then(res => {
+          salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn, salesPromoSn: _this.promo ? _this.promo.salesPromoSn : '' }).then(res => {
             if (res.status == 200) {
               _this.$refs.table.refresh(false)
-              _this.$emit('insterOk', 'promo')
+              _this.$emit('refash', 'promo')
               _this.$message.success(res.message)
             }
             _this.delLoading = false
@@ -630,11 +668,11 @@ export default {
       const params = {
         salesBillDetailSn: editRow.salesBillDetailSn,
         salesBillSn: this.salesBillSn,
-        oldSalesPromoSn: '',
+        oldSalesPromoSn: this.promo ? this.promo.salesPromoSn : '',
         priceLevel: editRow.priceLevel
       }
       // 更换活动
-      this.$emit('upActive', null, data, params)
+      this.$emit('upActive', data, params)
     },
     // 更换活动成功
     upAcitveSuccess () {

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

@@ -49,11 +49,18 @@
         <a-col :md="8" :sm="24" style="text-align:left;">
           <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
@@ -64,22 +71,6 @@
             > 批量操作 <a-icon type="down" /> </a-button>
           </a-dropdown>
           <span v-if="selectTotal" style="margin-left:10px;">已选{{ selectTotal }}项</span>
-          <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-col :md="16" :sm="24" style="text-align:right;">
           <a-button
@@ -409,7 +400,7 @@ export default {
             if (res.status == 200) {
               _this.$refs.table.refresh(false)
               // 触发事件给父级组件
-              _this.$emit('insterOk', 'normal')
+              _this.$emit('refash', 'normal')
               _this.$message.success(res.message)
             }
             _this.spinning = false
@@ -441,7 +432,7 @@ export default {
             if (res.status == 200) {
               _this.$refs.table.refresh(false)
               // 触发事件给父级组件
-              _this.$emit('insterOk', 'normal')
+              _this.$emit('refash', 'normal')
               _this.$message.success(res.message)
             }
             _this.spinning = false
@@ -481,7 +472,7 @@ export default {
       updateWarehouse(data).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
-          _this.$emit('insterOk', 'promo')
+          _this.$emit('refash', 'promo')
         }
         _this.$refs.table.refresh(false)
         _this.openWarehouseModal = false
@@ -526,7 +517,7 @@ export default {
           salesBillSn: _this.salesBillSn
         }).then(res => {
           if (res.status == 200) {
-            _this.$emit('insterOk', 'normal')
+            _this.$emit('refash', 'normal')
             _this.$message.success(res.message)
           }
           _this.$refs.table.refresh(false)
@@ -591,7 +582,7 @@ export default {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh(false)
-              _this.$emit('insterOk', 'normal')
+              _this.$emit('refash', 'normal')
             }
             _this.delLoading = false
             _this.spinning = false
@@ -622,14 +613,14 @@ export default {
         priceLevel: row.priceLevel,
         stockSn: row.stockSn,
         promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
-        promotionFlag: promotionFlag, // 促销标记 正品传0,促销品传1
+        promotionFlag: 0, // 促销标记 正品传0,促销品传1
         warehouseSn: row.warehouseSn
       }).then(res => {
         if (res.status == 200) {
           this.$message.success('产品添加成功', 2.5)
           this.resetSearchForm(true)
           // 触发事件给父级组件
-          this.$emit('insterOk', 'normal')
+          this.$emit('refash', 'normal')
         }
         this.spinning = false
         this.isInster = false
@@ -653,7 +644,7 @@ export default {
           this.$message.success('产品导入成功', 2.5)
           this.resetSearchForm(true)
           // 触发事件给父级组件
-          this.$emit('insterOk', 'normal')
+          this.$emit('refash', 'normal')
         }
       })
     }

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

@@ -241,7 +241,7 @@ export default {
     },
     // 选择配件
     handleAdd (row) {
-      this.$emit('add', row, 0, 0)
+      this.$emit('add', row, 0)
     },
     //  产品分类  change
     changeProductType (val, opt) {

+ 7 - 4
src/views/salesManagement/salesQueryNew/comps/updateActiveModal.vue

@@ -4,7 +4,6 @@
     :title="title"
     centered
     :maskClosable="false"
-    :confirmLoading="confirmLoading"
     :width="total?'450px':'300px'"
     :footer="null"
     @cancel="cancel"
@@ -90,9 +89,13 @@ export default {
       }
     },
     cancel () {
-      this.opened = false
-      this.upActiveVal = null
-      this.$emit('cancel')
+      if (!this.confirmLoading) {
+        this.opened = false
+        this.upActiveVal = null
+        this.$emit('cancel')
+      } else {
+        this.$message.info('正在更换促销,请勿关闭!')
+      }
     }
   },
   watch: {

+ 54 - 42
src/views/salesManagement/salesQueryNew/edit.vue

@@ -36,7 +36,7 @@
         <div style="padding: 10px;">
           <productNormalList
             ref="productNormalList"
-            @insterOk="insterActiveOk"
+            @refash="refashTableData"
             @spinning="e=>spinning=e"
             @openCpModal="openProductModal"
             @allThreeStock="searchAllThreeStock"
@@ -59,19 +59,21 @@
         <activeStatisticsList
           ref="activeTjList"
           @openCpModal="openProductModal"
-          @insterOk="insterActiveOk"
-          @upActive="upActive"
+          @refash="refashTableData"
+          @selected="getActiveProduct"
           :activeList="activeList"
           :warehouseSn="warehouseSn"
           :salesBillSn="salesBillSn"
         ></activeStatisticsList>
         <div style="padding:0 10px 10px;">
           <productList
-            ref="productList-active-list"
-            :activeList="activeList"
+            ref="productActiveList"
+            :promo="curPromo"
             :detailData="detailData"
             :warehouseSn="warehouseSn"
-            :salesBillSn="salesBillSn">
+            :salesBillSn="salesBillSn"
+            @refash="refashTableData"
+            @upActive="upActive">
           </productList>
         </div>
       </a-card>
@@ -188,7 +190,8 @@ export default {
       cpCurRefId: 'productList-active-list', // 活动产品列表ref
       disabledActiveOption: null, // 禁用活动选项
       yhDetail: null, // 优惠明细
-      showNewActiveModal: false // 新活动弹框
+      showNewActiveModal: false, // 新活动弹框
+      curPromo: null
     }
   },
   computed: {
@@ -218,18 +221,16 @@ export default {
     getOrderDetail (flag, callback) {
       this.spinning = true
       salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
+        this.spinning = false
         if (res.status == 200) {
           this.detailData = res.data
           this.detailData.totalDiscountAmount = Number(this.detailData.totalOrigAmount || 0) - Number(this.detailData.totalAmount || 0)
-          if (callback) {
-            callback()
-          }
+          if (callback) { callback() }
         }
         if (flag) {
           // 获取活动列表
           this.getActiveList()
         }
-        this.spinning = false
       })
     },
     // 优惠明细查看
@@ -248,41 +249,40 @@ export default {
           // 刷新正常活动产品列表
           this.$refs.productNormalList.searchThreeStockOk()
           // 刷新所有活动产品列表
-          this.$refs[this.cpCurRefId][0].searchThreeStockOk()
+          this.$refs.productActiveList.searchThreeStockOk()
         }
         this.spinning = false
       })
     },
-    // 刷新产品表格数据,包括正常产品和活动产品
-    updateAllTable (flag) {
-      // 刷新正常产品列表
-      this.$refs.productNormalList.resetSearchForm()
-      // 刷新活动产品列表
-      this.$refs[this.cpCurRefId][0].resetSearchForm()
-      // 是否刷新详情
-      if (flag) {
-        this.getOrderDetail()
-      }
-    },
     // 获取销售单参与的活动列表
     async getActiveList () {
       // 已参与活动列表
       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.disabled = item.enabledFlag == 0 })
+      // 触发活动统计查询变量
+      this.$nextTick(() => {
+        this.$refs.activeTjList.hasInit = false
+      })
       setTimeout(() => {
-        this.updateAllTable()
+        // 刷新正常产品列表
+        this.$refs.productNormalList.resetSearchForm()
+        // 刷新活动产品列表
+        // this.$refs.productActiveList.resetSearchForm()
       }, 500)
     },
-    // 获取是否有新活动,有则弹出弹框
+    // 获取是否有新活动,
     async getNewActive () {
       const hasNewActive = await salesQueryUnPartPromo({ salesBillSn: this.$route.params.sn, enabledFlag: '1' }).then(res => res.data)
       if (hasNewActive.length) {
         this.newActiveList = hasNewActive
+        // 有则弹出弹框确认
         this.showNewActiveModal = true
+      } else {
+        // 获取销售单详情
+        this.getOrderDetail(true)
       }
     },
-    // 新活动弹框,确认
+    // 新活动弹框确认
     showNewActiveOk () {
       this.showNewActiveModal = false
       this.getOrderDetail(true)
@@ -296,29 +296,38 @@ export default {
     closeProductModal (type) {
       this.showCpModal = false
     },
+    // 获取指定活动的产品列表
+    getActiveProduct (active) {
+      console.log(active, 'active')
+      this.curPromo = active
+    },
     // 添加活动产品成功的回调,刷新产品列表
-    insterActiveOk (type) {
+    refashTableData (type) {
+      console.log(type, 'refashTableData')
       // 如果是活动产品
       if (type == 'promo') {
         // 刷新正常产品列表
         this.$refs.productNormalList.resetSearchForm()
-      }
-      // 如果时正常产品
-      if (type == 'normal') {
+      } else if (type == 'normal') { // 如果时正常产品
         // 刷新活动产品列表
-        this.$refs[this.cpCurRefId][0].resetSearchForm()
+        this.$refs.productActiveList.resetSearchForm()
+      } else {
+        // 刷新正常产品列表
+        this.$refs.productNormalList.resetSearchForm()
+        // 刷新活动产品列表
+        this.$refs.productActiveList.resetSearchForm()
       }
       // 重新获取详情信息
       this.getOrderDetail(false)
     },
     // 确定新增产品到列表
-    insterProduct (row, promotionFlag, type) {
+    insterProduct (row, promo, type) {
       // 正常产品
       if (type == 0) {
-        this.$refs.productNormalList.saveNewProduct(row, promotionFlag)
+        this.$refs.productNormalList.saveNewProduct(row, promo)
       } else {
         // 活动产品对象
-        this.$refs[this.cpCurRefId][0].saveNewProduct(row, promotionFlag, type)
+        this.$refs.productActiveList.saveNewProduct(row, promo, type)
       }
     },
     // 正常产品参与活动
@@ -333,17 +342,17 @@ export default {
         ...params
       }).then(res => {
         if (res.status == 200) {
-          // 刷新活动列表
-          this.$refs[this.cpCurRefId][0].resetSearchForm()
           // 刷新正常活动
           this.$refs.productNormalList.addAcitveSuccess()
+          // 刷新活动统计
+          this.$refs.activeTjList.refashRow(newSn, 1)
           // 刷新详情统计
-          this.getOrderDetail(false)
+          this.refashTableData('normal')
         }
       })
     },
     // 更换活动
-    upActive (oldPromo, data, params) {
+    upActive (data, params) {
       const promo = data.split('-')
       const newSn = this.activeList.find(item => item.promoRuleSn == promo[1])
       const newSalesPromoSn = newSn && newSn.salesPromoSn || ''
@@ -354,7 +363,12 @@ export default {
         ...params
       }).then(res => {
         if (res.status == 200) {
-          this.updateAllTable(true)
+          // 刷新活动产品
+          this.$refs.productActiveList.upAcitveSuccess()
+          // 刷新活动统计
+          this.$refs.activeTjList.refashRow(newSn, 1)
+          // 刷新详情统计
+          this.refashTableData('promo')
         }
       })
     },
@@ -424,8 +438,6 @@ export default {
     pageInit () {
       this.salesBillSn = this.$route.params.sn
       this.warehouseSn = this.$route.params.sn ? this.$route.params.wSn : ''
-      // 获取销售单详情
-      this.getOrderDetail(true)
       // 是否有新活动
       this.getNewActive()
     }