lilei 6 ماه پیش
والد
کامیت
442e3d63a1

+ 15 - 0
src/api/salesDetailNew.js

@@ -134,6 +134,21 @@ export const salesDetailAllList = (params) => {
   })
 }
 
+// 销售详情列表-不分页-新
+export const salesDetailExtPromoList = (params) => {
+  const url = `/sales/detail/queryExtPromoList`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent((params.salesPromoSnSet ? '产品明细查询(promoRuleSn:' + params.salesPromoSnSet + ')' : '产品明细查询'))
+    }
+  })
+}
+
 //  修改销售明细数量
 export const salesDetailUpdateQty = (params) => {
   return axios({

+ 38 - 1
src/api/salesNew.js

@@ -126,9 +126,46 @@ export const salesPromoQueryList = (params) => {
   return axios({
     url: `/salesPromo/queryExtList`,
     data: params,
-    method: 'post'
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('查询销售单参加的活动')
+    }
+  })
+}
+// 销售单活动统计列表-新
+export const salesPromoQueryStatisticsList = (params) => {
+  return axios({
+    url: `/salesPromo/querySortListBySalesBillSn`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('查询销售单参加的活动统计信息')
+    }
+  })
+}
+// 特价规则优先级-新
+export const salesPromoDiscountSort = (params) => {
+  return axios({
+    url: `/salesPromo/queryStackDiscountPromo/${params.salesBillSn}`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('特价规则优先级排序')
+    }
   })
 }
+// 保存特价排序-新
+export const salesPromoSaveSort = (params) => {
+  return axios({
+    url: `/salesPromo/updateBatchById`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('保存特价活动排序')
+    }
+  })
+}
+
 // 更换促销,可更换活动列表
 export const salesPromoMatchProduct = (params) => {
   return axios({

+ 34 - 29
src/views/salesManagement/salesQueryNew/comps/activeStatisticsList.vue

@@ -95,22 +95,23 @@ export default {
       checkboxOption: {
         hideSelectAll: true,
         selectedRowKeys: [],
+        // 禁用的选择(禁止勾选或者禁止取消勾选)
+        disableSelectedRowKeys: [],
         // 行选择改变事件
         selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
           console.log(row, isSelected, selectedRowKeys)
           // 当前勾选产品
           const endSelProduct = selectedRowKeys[selectedRowKeys.length - 1]
-          console.log('33333:', endSelProduct)
-          if (!(endSelProduct.stackFlag == '1')) {
+          if (endSelProduct && !(endSelProduct.stackFlag == '1')) {
             this.checkboxOption.selectedRowKeys = isSelected ? [endSelProduct] : []
           } else {
+            // 累计多选
             this.checkboxOption.selectedRowKeys = selectedRowKeys
           }
           // 查询此活动下的产品列表
-          this.$emit('selected', isSelected ? row : null)
-        },
-        // 禁用的选择(禁止勾选或者禁止取消勾选)
-        disableSelectedRowKeys: this.distabledProductList()
+          const salesPromoSn = this.activeList.filter(item => this.checkboxOption.selectedRowKeys.includes(item.id)).map(item => item.salesPromoSn)
+          this.$emit('selected', isSelected ? salesPromoSn : null)
+        }
       },
       // 单元格样式
       cellStyleOption: {
@@ -163,12 +164,13 @@ export default {
           align: 'center',
           fixed: 'left',
           renderBodyCell: ({ row, column, rowIndex }, h) => {
+            const isRejia = row && row.promotionRule && row.promotionRule.promotionRuleType == 'PROMO_PROD'
             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>
+              {isRejia ? <div style="display:flex;">
+                <span style="width:12px;color:#ed1c24;text-align:center;margin-left:5px;cursor:pointer;" onClick={() => _this.moveTjRow(row, rowIndex, 'up')} title="上移">{rowIndex != 0 ? '⇡' : ''}</span>
+                <span style="width:12px;color:#108ee9;text-align:center;cursor:pointer;" onClick={() => _this.moveTjRow(row, rowIndex, 'down')} title="下移">{rowIndex != _this.activeList.length - 1 ? '⇣' : ''}</span>
+              </div> : ''}
             </div>)
           }
         },
@@ -220,7 +222,7 @@ export default {
           ]
         },
         {
-          title: '正价产品(金额)',
+          title: '正价产品(数量或金额)',
           children: [
             {
               field: 'regularQuota',
@@ -323,7 +325,7 @@ export default {
           ]
         },
         {
-          title: '特价产品(数量/金额)',
+          title: '特价产品(数量金额)',
           children: [
             {
               field: 'specialPriceQuota',
@@ -438,15 +440,8 @@ export default {
       openGuideModal: false //  导入产品引导
     }
   },
-  // 禁用未启用产品
-  computed: {
-    distabledProductList () {
-      const disabledArr = this.tableData.map(item => item.id)
-      return disabledArr
-    }
-  },
   methods: {
-    async getDataList () {
+    getDataList () {
       this.hasInit = true
       for (let i = 0; i < this.activeList.length; i++) {
         const item = this.activeList[i]
@@ -461,9 +456,10 @@ export default {
         const isYuan1 = item.regularRuleUnit == 'YUAN'
         const regularUnit = isYuan1 ? '元' : '个' // 单位
         const regularQuota = item.gateQuotaAmount // 配额
+        const regularRuleValue = item.regularRuleValue // 额度
         const regularSelected = isYuan1 ? item.regularTotalAmount : item.regularTotalQty // 已选
         const regularTotal = isYuan1 ? item.regularBorrowAmount : item.regularBorrowQty // 累计
-        const regularBalance = 0 // 差额 = 额度 - 已选 - 累计
+        const regularBalance = regularRuleValue - regularSelected - regularTotal // 差额 = 额度 - 已选 - 累计
         // 促销品
         const promoUnit = '个'
         const promoLimit = 0 // 额度
@@ -516,15 +512,29 @@ export default {
           specialPriceBalance // 差额
         })
       }
+      this.disabledActiveIds()
+    },
+    // 禁用的活动规则
+    disabledActiveIds () {
+      this.checkboxOption.disableSelectedRowKeys = this.tableData.filter(item => item.enabledFlag == 0).map(item => item.id)
+    },
+    // 上下移动特价活动
+    moveTjRow (row, index, type) {
+
     },
-    // 禁用启用活动规则
     // 刷新当前规则
     refashRow (item, enable) {
+      console.log(enable, 'enable')
       // 刷新产品列表
       this.$emit('refash', '')
-      const active = this.activeList.find(k => k.id == item.id)
+      const active = this.tableData.find(k => k.id == item.id)
       active.enabledFlag = enable
-      console.log(enable, 'enable')
+      this.disabledActiveIds()
+    },
+    // 查看累计产品 详情
+    openTotalProduct (row) {
+      this.openTotalProductModal = true
+      this.$refs.totalProductModal.pageInit({ salesBillSn: row.salesBillSn, salesPromoSn: row.salesPromoSn })
     },
     // 启用规则
     enabledActive (item) {
@@ -606,11 +616,6 @@ export default {
         }
       })
     },
-    // 查看累计产品 详情
-    openTotalProduct (row) {
-      this.openTotalProductModal = true
-      this.$refs.totalProductModal.pageInit({ salesBillSn: row.salesBillSn, salesPromoSn: row.salesPromoSn })
-    },
     // 选择禁用活动选项
     changeDaOpt (e) {
       this.disabledActiveOption = e.target.value

+ 26 - 33
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -55,6 +55,11 @@
               <v-select code="FLAG" allowClear placeholder="请选择是否满足起订量"></v-select>
             </a-form-item>
           </a-col>
+          <a-col flex="1">
+            <a-form-item label="累计产品">
+              <v-select code="FLAG" allowClear placeholder="请选择是否累计产品"></v-select>
+            </a-form-item>
+          </a-col>
           <a-col flex="2" style="margin-bottom: 10px;">
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" :id="'salesEdit-refresh-'+id">查询</a-button>
             <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" :id="'salesEdit-reset-'+id">重置</a-button>
@@ -96,7 +101,6 @@
           <span v-if="selectTotal" style="margin-left:10px;">已选{{ selectTotal }}项</span>
         </a-col>
         <a-col :md="12" :sm="24" style="text-align:right;">
-          <label><a-checkbox v-model="queryParam.showLj"></a-checkbox> 显示累计产品</label>
           <a-button
             :id="'salesEdit-searchBox-'+id"
             type="link"
@@ -117,7 +121,7 @@
       :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.promotionFlag == 'GIFT'&&!!record.salesPromoDetailParentSn } }) }"
       @rowSelection="rowSelectionFun"
       :defaultLoadData="false"
-      :pageSize="10"
+      :showPagination="false"
       bordered>
       <!-- 产品编码 -->
       <template slot="productCode" slot-scope="text, record">
@@ -154,7 +158,7 @@
       </template>
       <!-- 规则数量 -->
       <template slot="rulesNums" slot-scope="text, record">
-        <a-button type="link" :id="'salesEdit-gzqty-'+id+'-'+record.id" size="small" class="button-info">1</a-button>
+        <a-button type="link" :id="'salesEdit-gzqty-'+id+'-'+record.id" size="small" class="button-info">{{ record.promoRuleNum }}</a-button>
       </template>
       <!-- 销售数量 -->
       <template slot="salesNums" slot-scope="text, record">
@@ -235,7 +239,7 @@ import chooseWarehouse from '@/views/common/chooseWarehouse'
 import ProductBrand from '@/views/common/productBrand.js'
 import productTypeAll from '@/views/common/productTypeAll.js'
 import {
-  salesDetailList,
+  salesDetailExtPromoList,
   salesDetailUpdateQty,
   salesDetailInsert,
   salesDetailInsertBatchBorrow,
@@ -263,10 +267,6 @@ export default {
       default: false
     },
     newLoading: Boolean,
-    promo: {
-      type: Object,
-      default: function () { return null }
-    },
     // 详情数据
     detailData: {
       type: Object,
@@ -277,10 +277,10 @@ export default {
       type: String,
       default: '0'
     },
-    // 仓库sn
-    warehouseSn: {
-      type: String,
-      default: ''
+    // 活动sn
+    salesPromoSnSet: {
+      type: Array,
+      default: () => []
     },
     // 销售单sn
     salesBillSn: {
@@ -296,30 +296,21 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.queryParam.salesBillSn = this.salesBillSn || ''
-        return salesDetailList(Object.assign(parameter, this.queryParam, {
+        this.queryParam.salesPromoSnSet = this.salesPromoSnSet || []
+        return salesDetailExtPromoList(Object.assign(parameter, this.queryParam, {
           showStock: true,
-          promoRuleSn: this.promo ? this.promo.promoRuleSn : '',
-          promoSn: this.promo ? this.promo.promoSn : '',
-          salesPromoSn: this.promo ? this.promo.salesPromoSn : ''
+          promoFlag: this.detailData.promoFlag
         })).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
-            const no = (data.pageNo - 1) * data.pageSize
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = no + i + 1
-              data.list[i].qtyBackups = data.list[i].qty
-              data.list[i].productUnit = data.list[i].productEntity && data.list[i].productEntity.unit
-              // 按数量设置
-              if (data.list[i].unitType && data.list[i].unitType == 'SL') {
-                data.list[i].unitQtyV = data.list[i].unitQty ? (data.list[i].unitQty + data.list[i].productUnit) : '--'
-                data.list[i].unitQtyR = data.list[i].unitQty
-              } else {
-                data.list[i].unitQtyV = data.list[i].packQty && data.list[i].unitQty ? ((data.list[i].unitQty + '*' + data.list[i].packQty) + data.list[i].productUnit) : '--'
-                data.list[i].unitQtyR = data.list[i].packQty * data.list[i].unitQty
-              }
+            const no = 0
+            for (var i = 0; i < data.length; i++) {
+              data[i].no = no + i + 1
+              data[i].qtyBackups = data[i].qty
+              data[i].productUnit = data[i].productEntity && data[i].productEntity.unit
             }
-            this.dataSource = data.list
+            this.dataSource = data
           }
           this.disabled = false
           return data
@@ -336,7 +327,8 @@ export default {
         productBrandSn: undefined, // 产品品牌
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '' //  产品三级分类
+        productTypeSn3: '', //  产品三级分类
+        borrowFlag: undefined // 是否累计产品
       },
       productType: [], // 已选产品分类
       rowSelectionInfo: null, // 已选产品数据
@@ -360,7 +352,7 @@ export default {
         { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '12%', align: 'center' },
         { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '25%', align: 'left' },
         { title: '规则数量', scopedSlots: { customRender: 'rulesNums' }, width: '4%', align: 'center' },
-        { title: '起订量', dataIndex: 'unitQtyV', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '起订量', dataIndex: 'promoUnit', width: '5%', 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: '5%', align: 'center' },
         { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '8%', align: 'center' },
@@ -383,7 +375,7 @@ export default {
     salesBillSn (newValue, oldValue) {
       this.resetSearchForm()
     },
-    promo (newValue, oldValue) {
+    salesPromoSnSet (newValue, oldValue) {
       this.resetSearchForm()
     },
     spinning (a, b) {
@@ -431,6 +423,7 @@ export default {
       this.queryParam.productTypeSn1 = ''
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
+      this.queryParam.borrowFlag = undefined
       this.productType = []
       this.rowSelectionInfo = null
       this.$refs.table.clearSelected()

+ 8 - 0
src/views/salesManagement/salesQueryNew/discountSortModal.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

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

@@ -68,10 +68,9 @@
         <div style="padding:0 10px 10px;">
           <productList
             ref="productActiveList"
-            :promo="curPromo"
             :detailData="detailData"
-            :warehouseSn="warehouseSn"
             :salesBillSn="salesBillSn"
+            :salesPromoSnSet="salesPromoSnSet"
             @refash="refashTableData"
             @upActive="upActive">
           </productList>
@@ -150,6 +149,8 @@
       :newActiveList="newActiveList"
       @ok="showNewActiveOk"
     ></newPromoModal>
+    <!-- 特价活动排序 -->
+    <discountSortModal :show="showDiscountSortModal" :acitveList="discountActiveList" @ok="showDiscountSortOk"></discountSortModal>
   </div>
 </template>
 
@@ -160,8 +161,18 @@ import productNormalList from './comps/productNormalList.vue'
 import activeStatisticsList from './comps/activeStatisticsList.vue'
 import chooseProduct from './comps/chooseProduct.vue'
 import newPromoModal from './newPromoModal.vue'
+import discountSortModal from './discountSortModal.vue'
 import { salesChangePromo } from '@/api/salesDetailNew'
-import { salesDetailBySn, salesPromoQueryCount, salesWriteSubmit, submitCheck, updateBatch, salesPromoQueryList, salesQueryUnPartPromo, salesPromoValidaSubmit, getThirdStockQty } from '@/api/salesNew'
+import {
+  salesDetailBySn,
+  salesPromoQueryCount,
+  salesWriteSubmit,
+  salesPromoQueryStatisticsList,
+  salesPromoDiscountSort,
+  salesQueryUnPartPromo,
+  salesPromoValidaSubmit,
+  getThirdStockQty } from '@/api/salesNew'
+
 export default {
   name: 'SalesNewEdit',
   mixins: [commonMixin],
@@ -170,7 +181,8 @@ export default {
     chooseProduct,
     productNormalList,
     newPromoModal,
-    activeStatisticsList
+    activeStatisticsList,
+    discountSortModal
   },
   data () {
     return {
@@ -191,7 +203,9 @@ export default {
       disabledActiveOption: null, // 禁用活动选项
       yhDetail: null, // 优惠明细
       showNewActiveModal: false, // 新活动弹框
-      curPromo: null
+      salesPromoSnSet: [], // 当前勾选的活动sn
+      showDiscountSortModal: false, // 特价活动排序弹框
+      discountActiveList: [] // 可叠加的特价活动列表
     }
   },
   computed: {
@@ -257,7 +271,7 @@ export default {
     // 获取销售单参与的活动列表
     async getActiveList () {
       // 已参与活动列表
-      const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
+      const list = await salesPromoQueryStatisticsList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
       this.activeList = list.filter(item => item.promotion && item.promotionRule)
       // 触发活动统计查询变量
       this.$nextTick(() => {
@@ -267,7 +281,7 @@ export default {
         // 刷新正常产品列表
         this.$refs.productNormalList.resetSearchForm()
         // 刷新活动产品列表
-        // this.$refs.productActiveList.resetSearchForm()
+        this.$refs.productActiveList.resetSearchForm()
       }, 500)
     },
     // 获取是否有新活动,
@@ -286,6 +300,18 @@ export default {
     showNewActiveOk () {
       this.showNewActiveModal = false
       this.getOrderDetail(true)
+      // 特价规则排序
+      this.getSalesPromoDiscountSort()
+    },
+    // 特价规则排序
+    getSalesPromoDiscountSort () {
+      this.spinning = true
+      salesPromoDiscountSort({ salesBillSn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+
+        }
+        this.spinning = false
+      })
     },
     // 打开选择产品弹框
     openProductModal (type, promo) {
@@ -298,8 +324,8 @@ export default {
     },
     // 获取指定活动的产品列表
     getActiveProduct (active) {
-      console.log(active, 'active')
-      this.curPromo = active
+      console.log(active, 'salesPromoSnSet')
+      this.salesPromoSnSet = active
     },
     // 添加活动产品成功的回调,刷新产品列表
     refashTableData (type) {