浏览代码

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

chenrui 6 月之前
父节点
当前提交
d2b95c781b

+ 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({

+ 2 - 2
src/utils/util.js

@@ -286,12 +286,12 @@ export function getAuthPriceCode (config, router, store) {
     
     // 从所有的权限菜单中查找当前权限code对应的权限菜单数据
     const authNode = treeFind(authTree,(item)=>item.code == authCode)
-    console.log(authNode,url.replace(/\//g,'_'))
+    // console.log(authNode,url.replace(/\//g,'_'))
     if(!authNode){return []}
     if(!authNode.permission){return []}
     // 从找到的对应权限菜单数据中判断当前调用接口的url是否存在,这里和权限菜单中的后台权限code比较
     const hasReqUrl = authNode.permission.split(',').find(item => url.replace(/\//g,'_').indexOf(item)>=0)
-    console.log(hasReqUrl)
+    // console.log(hasReqUrl)
     // 如果存在则返回一个如 [1,0,1,0,0] 的格式的价格权限字符串给后台接口
     if(hasReqUrl&&authNode.children&&authNode.children.length){
       return hasPriceAuth(authNode.children,priceOptions,userAuthCode)

+ 70 - 44
src/views/salesManagement/salesQueryNew/comps/activeStatisticsList.vue

@@ -8,7 +8,7 @@
         border-y
         border-x
         border-around
-        row-key-field-name="id"
+        row-key-field-name="salesPromoSn"
         :checkbox-option="checkboxOption"
         :column-width-resize-option="columnWidthResizeOption"
         :cell-style-option="cellStyleOption"
@@ -29,7 +29,7 @@
     <!-- 查看累计产品 -->
     <totalProductDetailModal ref="totalProductModal" :show="openTotalProductModal" @close="openTotalProductModal=false"></totalProductDetailModal>
     <!-- 查看买赠产品详情 -->
-    <normalProductDetailModal ref="normalProductModal" :openModal="openNormalProductModal" @close="openNormalProductModal=false"></normalProductDetailModal>
+    <normalProductDetailModal ref="normalProductModal" :buyGiftsInfo="buyGiftsInfo" :openModal="openNormalProductModal" @close="openNormalProductModal=false"></normalProductDetailModal>
   </div>
 </template>
 
@@ -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')) {
-            this.checkboxOption.selectedRowKeys = isSelected ? [endSelProduct] : []
+          // 叠加多选
+          if (endSelProduct && row.promotion && row.promotion.stackFlag == '1') {
+            const rows = this.activeList.filter(item => selectedRowKeys.includes(item.salesPromoSn) && item.promotion && item.promotion.stackFlag == '1')
+            this.checkboxOption.selectedRowKeys = rows.map(item => item.salesPromoSn)
           } else {
-            this.checkboxOption.selectedRowKeys = selectedRowKeys
+            // 非叠加单选
+            this.checkboxOption.selectedRowKeys = isSelected ? [endSelProduct] : []
           }
-          // 查询此活动下的产品列表
-          this.$emit('selected', isSelected ? row : null)
-        },
-        // 禁用的选择(禁止勾选或者禁止取消勾选)
-        disableSelectedRowKeys: this.distabledProductList()
+          // 查询此活动下的已选产品列表
+          this.$emit('selected', isSelected ? this.checkboxOption.selectedRowKeys : null)
+        }
       },
       // 单元格样式
       cellStyleOption: {
@@ -156,20 +157,30 @@ export default {
             return ++rowIndex
           }
         },
-        { field: 'promotionRuleType',
+        {
+          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>)
+            const equalWord = <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>
+            // 买产品送产品  同款产品 是累计产品才弹详情窗
+            if (row.promotionRule.promotionRuleType === 'BUY_PROD_GIVE_PROD' && row.promotion.borrowFlag == '1' && row.promotionRule.regularSameFlag == '1') {
+              return (<div style="width:100%;display:flex;justify-content: space-between;">
+                <div class="table-link-text" onClick={() => _this.showBuyGifts(row)} style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title={row[column.field]}>{row[column.field]}</div>
+                {equalWord}
+              </div>)
+            } else {
+              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>
+                {equalWord}
+              </div>)
+            }
           }
         },
         { field: 'promotionRuleDesc',
@@ -220,7 +231,7 @@ export default {
           ]
         },
         {
-          title: '正价产品(金额)',
+          title: '正价产品(数量或金额)',
           children: [
             {
               field: 'regularQuota',
@@ -323,7 +334,7 @@ export default {
           ]
         },
         {
-          title: '特价产品(数量/金额)',
+          title: '特价产品(数量金额)',
           children: [
             {
               field: 'specialPriceQuota',
@@ -433,20 +444,14 @@ export default {
       ],
       tableData: [],
       openDetailModal: false, // 规则详情弹框
-      detailSn: null,
+      detailSn: null, // 销售单sn
       disabledActiveOption: null,
-      openGuideModal: false //  导入产品引导
-    }
-  },
-  // 禁用未启用产品
-  computed: {
-    distabledProductList () {
-      const disabledArr = this.tableData.map(item => item.id)
-      return disabledArr
+      openGuideModal: false, //  导入产品引导
+      uyGiftsInfo: null // 买赠产品弹窗详情信息
     }
   },
   methods: {
-    async getDataList () {
+    getDataList () {
       this.hasInit = true
       for (let i = 0; i < this.activeList.length; i++) {
         const item = this.activeList[i]
@@ -461,9 +466,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 // 额度
@@ -476,11 +482,11 @@ export default {
         const purchaseSurplus = (purchaseLimit - purchaseSelected) || 0 // 结余
         const purchaseOverspend = (purchaseSelected - purchaseLimit) || 0 // 超支
         // 特价产品
-        const isYuan2 = item.specialPriceUnit == 'YUAN'
+        const isYuan2 = item.gateRuleUnit == 'YUAN'
         const specialPriceUnit = isYuan2 ? '元' : '个' // 单位
         const specialPriceQuota = (isYuan2 ? item.specialPriceQuotaAmount : item.specialPriceQuotaQty) || 0 // 配额
-        const specialPriceSelected = isYuan2 ? item.specialPriceTotalAmount : item.specialPriceTotalQty || 0 // 已选
-        const specialPriceBalance = specialPriceQuota - specialPriceSelected || 0// 差额 = 配额 - 已选 - 累计
+        const specialPriceSelected = isYuan2 ? item.discountAmount : item.discountQty || 0 // 已选
+        const specialPriceBalance = !specialPriceQuota ? 0 : (specialPriceQuota - specialPriceSelected)// 差额 = 配额 - 已选 - 累计
 
         // 促销品
         this.tableData.push({
@@ -495,6 +501,7 @@ export default {
           geteBalance, // 差额 = 配额 - 已选 - 累计
           // 正价
           regularUnit, // 单位
+          regularQuota, // 配额
           regularSelected, // 已选
           regularTotal, // 累计
           regularBalance, // 差额 = 配额 - 已选 - 累计
@@ -516,15 +523,39 @@ 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 })
+    },
+    // 显示买赠产品弹窗
+    showBuyGifts (rowVal) {
+      rowVal.promotionRule.salesPromoSn = rowVal.salesPromoSn
+      this.buyGiftsInfo = rowVal.promotionRule
+      this.openNormalProductModal = true
+      const _this = this
+      this.$nextTick(() => {
+        _this.$refs.normalProductModal.resetSearchForm()
+      })
     },
     // 启用规则
     enabledActive (item) {
@@ -606,11 +637,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()

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

@@ -0,0 +1,109 @@
+<template>
+  <a-modal
+    v-model="opened"
+    title="特价规则优先级"
+    centered
+    :maskClosable="false"
+    width="30%"
+    :footer="null"
+    @cancel="cancel"
+  >
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div style="padding: 0 50px;">
+        <div style="padding:10px 0;text-align:left;color:red">
+          注:优先级默认是先直降再打折
+        </div>
+        <div style="padding:10px 0;">
+          <ul style="padding:0;margin:0;">
+            <li style="display:flex;justify-content: space-between;padding:5px 3px;border-bottom:1px solid #eee;">
+              <div style="width:50%;">
+                活动简称-规则简称
+              </div>
+              <div>优先级</div>
+              <div style="width:100px;text-align:center;">操作</div>
+            </li>
+            <li v-for="(item,rowIndex) in activeSortList" :key="item.id" style="display:flex;justify-content: space-between;padding:5px 3px;">
+              <div style="width:50%;">
+                {{ item.promotion.description }}-{{ item.promotionRule.description }}
+              </div>
+              <div> {{ item.sort }} </div>
+              <div style="display:flex;width:100px;justify-content:left;">
+                <span style="width:50px;color:#ed1c24;text-align:center;cursor:pointer;font-size:12px;" title="上移" @click="sortRow(item,rowIndex,1)">{{ rowIndex != 0 ? '⇡上移' : '' }}</span>
+                <span style="width:50px;color:#108ee9;text-align:center;cursor:pointer;font-size:12px;" title="下移" @click="sortRow(item,rowIndex,0)">{{ rowIndex != activeList.length - 1 ? '⇣下移' : '' }}</span>
+              </div>
+            </li>
+          </ul>
+        </div>
+      </div>
+      <div style="margin-top:36px;text-align:center;">
+        <a-button @click="cancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
+        <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { salesPromoSaveSort } from '@/api/salesNew'
+export default {
+  name: 'NewPromoModal',
+  mixins: [commonMixin],
+  props: {
+    show: [Boolean],
+    activeList: [Array],
+    salesBillSn: [String]
+  },
+  data () {
+    return {
+      opened: this.show,
+      spinning: false,
+      confirmLoading: false
+    }
+  },
+  computed: {
+    activeSortList () {
+      return this.activeList.sort((a, b) => {
+        return a.sort - b.sort
+      })
+    }
+  },
+  methods: {
+    //  保存
+    handleSubmit () {
+      const _this = this
+      _this.confirmLoading = true
+      const data = this.activeSortList.map(item => {
+        return {
+          id: item.id,
+          sort: item.sort
+        }
+      })
+      salesPromoSaveSort(data).then(res => {
+        if (res.status == 200) {
+          _this.$emit('ok')
+        }
+        _this.confirmLoading = false
+      })
+    },
+    // 排序
+    sortRow (item, rowIndex, type) {
+      const temp = this.activeList[type == 1 ? rowIndex - 1 : rowIndex + 1]
+      const tempSort = temp.sort
+      temp.sort = item.sort
+      item.sort = tempSort
+    },
+    // 取消
+    cancel () {
+      this.opened = false
+      this.$emit('cancel')
+      this.$emit('ok')
+    }
+  },
+  watch: {
+    show (newValue, oldValue) {
+      this.opened = newValue
+    }
+  }
+}
+</script>

+ 44 - 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" :activeList="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,
+  salesPromoQueryList,
+  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: {
@@ -267,7 +281,7 @@ export default {
         // 刷新正常产品列表
         this.$refs.productNormalList.resetSearchForm()
         // 刷新活动产品列表
-        // this.$refs.productActiveList.resetSearchForm()
+        this.$refs.productActiveList.resetSearchForm()
       }, 500)
     },
     // 获取是否有新活动,
@@ -283,8 +297,30 @@ export default {
       }
     },
     // 新活动弹框确认后
-    showNewActiveOk () {
+    showNewActiveOk (type) {
       this.showNewActiveModal = false
+      // 特价规则排序
+      if (type == 1) {
+        this.getSalesPromoDiscountSort()
+      } else {
+        // 取消加入新活动
+        this.getOrderDetail(true)
+      }
+    },
+    // 特价规则排序
+    getSalesPromoDiscountSort () {
+      this.spinning = true
+      salesPromoDiscountSort({ salesBillSn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.discountActiveList = res.data
+          this.showDiscountSortModal = true
+        }
+        this.spinning = false
+      })
+    },
+    // 特价规则排序完成或取消排序
+    showDiscountSortOk () {
+      this.showDiscountSortModal = false
       this.getOrderDetail(true)
     },
     // 打开选择产品弹框
@@ -298,8 +334,7 @@ export default {
     },
     // 获取指定活动的产品列表
     getActiveProduct (active) {
-      console.log(active, 'active')
-      this.curPromo = active
+      this.salesPromoSnSet = active
     },
     // 添加活动产品成功的回调,刷新产品列表
     refashTableData (type) {

+ 2 - 1
src/views/salesManagement/salesQueryNew/newPromoModal.vue

@@ -59,7 +59,7 @@ export default {
           'promoSnList': _this.newPromoSnList
         }).then(res => {
           if (res.status == 200) {
-            _this.$emit('ok')
+            _this.$emit('ok', 1)
           }
           _this.confirmLoading = false
         })
@@ -72,6 +72,7 @@ export default {
     cancel () {
       this.opened = false
       this.$emit('cancel')
+      this.$emit('ok', 0)
     }
   },
   watch: {

+ 2 - 2
vue.config.js

@@ -108,9 +108,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.2.10/ocs-admin',
+        target: 'http://192.168.2.10/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
+        // target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
         changeOrigin: true,
         pathRewrite: {