|
@@ -8,7 +8,7 @@
|
|
border-y
|
|
border-y
|
|
border-x
|
|
border-x
|
|
border-around
|
|
border-around
|
|
- row-key-field-name="id"
|
|
|
|
|
|
+ row-key-field-name="salesPromoSn"
|
|
:checkbox-option="checkboxOption"
|
|
:checkbox-option="checkboxOption"
|
|
:column-width-resize-option="columnWidthResizeOption"
|
|
:column-width-resize-option="columnWidthResizeOption"
|
|
:cell-style-option="cellStyleOption"
|
|
:cell-style-option="cellStyleOption"
|
|
@@ -29,7 +29,7 @@
|
|
<!-- 查看累计产品 -->
|
|
<!-- 查看累计产品 -->
|
|
<totalProductDetailModal ref="totalProductModal" :show="openTotalProductModal" @close="openTotalProductModal=false"></totalProductDetailModal>
|
|
<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>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -95,22 +95,23 @@ export default {
|
|
checkboxOption: {
|
|
checkboxOption: {
|
|
hideSelectAll: true,
|
|
hideSelectAll: true,
|
|
selectedRowKeys: [],
|
|
selectedRowKeys: [],
|
|
|
|
+ // 禁用的选择(禁止勾选或者禁止取消勾选)
|
|
|
|
+ disableSelectedRowKeys: [],
|
|
// 行选择改变事件
|
|
// 行选择改变事件
|
|
selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
- console.log(row, isSelected, selectedRowKeys)
|
|
|
|
// 当前勾选产品
|
|
// 当前勾选产品
|
|
const endSelProduct = selectedRowKeys[selectedRowKeys.length - 1]
|
|
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 {
|
|
} 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: {
|
|
cellStyleOption: {
|
|
@@ -156,20 +157,30 @@ export default {
|
|
return ++rowIndex
|
|
return ++rowIndex
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- { field: 'promotionRuleType',
|
|
|
|
|
|
+ {
|
|
|
|
+ field: 'promotionRuleType',
|
|
key: 'ruletype',
|
|
key: 'ruletype',
|
|
width: 100,
|
|
width: 100,
|
|
title: '活动类型',
|
|
title: '活动类型',
|
|
align: 'center',
|
|
align: 'center',
|
|
fixed: 'left',
|
|
fixed: 'left',
|
|
renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
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',
|
|
{ field: 'promotionRuleDesc',
|
|
@@ -220,7 +231,7 @@ export default {
|
|
]
|
|
]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '正价产品(金额)',
|
|
|
|
|
|
+ title: '正价产品(数量或金额)',
|
|
children: [
|
|
children: [
|
|
{
|
|
{
|
|
field: 'regularQuota',
|
|
field: 'regularQuota',
|
|
@@ -323,7 +334,7 @@ export default {
|
|
]
|
|
]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '特价产品(数量/金额)',
|
|
|
|
|
|
+ title: '特价产品(数量或金额)',
|
|
children: [
|
|
children: [
|
|
{
|
|
{
|
|
field: 'specialPriceQuota',
|
|
field: 'specialPriceQuota',
|
|
@@ -433,20 +444,14 @@ export default {
|
|
],
|
|
],
|
|
tableData: [],
|
|
tableData: [],
|
|
openDetailModal: false, // 规则详情弹框
|
|
openDetailModal: false, // 规则详情弹框
|
|
- detailSn: null,
|
|
|
|
|
|
+ detailSn: null, // 销售单sn
|
|
disabledActiveOption: null,
|
|
disabledActiveOption: null,
|
|
- openGuideModal: false // 导入产品引导
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- // 禁用未启用产品
|
|
|
|
- computed: {
|
|
|
|
- distabledProductList () {
|
|
|
|
- const disabledArr = this.tableData.map(item => item.id)
|
|
|
|
- return disabledArr
|
|
|
|
|
|
+ openGuideModal: false, // 导入产品引导
|
|
|
|
+ uyGiftsInfo: null // 买赠产品弹窗详情信息
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- async getDataList () {
|
|
|
|
|
|
+ getDataList () {
|
|
this.hasInit = true
|
|
this.hasInit = true
|
|
for (let i = 0; i < this.activeList.length; i++) {
|
|
for (let i = 0; i < this.activeList.length; i++) {
|
|
const item = this.activeList[i]
|
|
const item = this.activeList[i]
|
|
@@ -461,9 +466,10 @@ export default {
|
|
const isYuan1 = item.regularRuleUnit == 'YUAN'
|
|
const isYuan1 = item.regularRuleUnit == 'YUAN'
|
|
const regularUnit = isYuan1 ? '元' : '个' // 单位
|
|
const regularUnit = isYuan1 ? '元' : '个' // 单位
|
|
const regularQuota = item.gateQuotaAmount // 配额
|
|
const regularQuota = item.gateQuotaAmount // 配额
|
|
|
|
+ const regularRuleValue = item.regularRuleValue // 额度
|
|
const regularSelected = isYuan1 ? item.regularTotalAmount : item.regularTotalQty // 已选
|
|
const regularSelected = isYuan1 ? item.regularTotalAmount : item.regularTotalQty // 已选
|
|
const regularTotal = isYuan1 ? item.regularBorrowAmount : item.regularBorrowQty // 累计
|
|
const regularTotal = isYuan1 ? item.regularBorrowAmount : item.regularBorrowQty // 累计
|
|
- const regularBalance = 0 // 差额 = 额度 - 已选 - 累计
|
|
|
|
|
|
+ const regularBalance = regularRuleValue - regularSelected - regularTotal // 差额 = 额度 - 已选 - 累计
|
|
// 促销品
|
|
// 促销品
|
|
const promoUnit = '个'
|
|
const promoUnit = '个'
|
|
const promoLimit = 0 // 额度
|
|
const promoLimit = 0 // 额度
|
|
@@ -476,11 +482,11 @@ export default {
|
|
const purchaseSurplus = (purchaseLimit - purchaseSelected) || 0 // 结余
|
|
const purchaseSurplus = (purchaseLimit - purchaseSelected) || 0 // 结余
|
|
const purchaseOverspend = (purchaseSelected - purchaseLimit) || 0 // 超支
|
|
const purchaseOverspend = (purchaseSelected - purchaseLimit) || 0 // 超支
|
|
// 特价产品
|
|
// 特价产品
|
|
- const isYuan2 = item.specialPriceUnit == 'YUAN'
|
|
|
|
|
|
+ const isYuan2 = item.gateRuleUnit == 'YUAN'
|
|
const specialPriceUnit = isYuan2 ? '元' : '个' // 单位
|
|
const specialPriceUnit = isYuan2 ? '元' : '个' // 单位
|
|
const specialPriceQuota = (isYuan2 ? item.specialPriceQuotaAmount : item.specialPriceQuotaQty) || 0 // 配额
|
|
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({
|
|
this.tableData.push({
|
|
@@ -495,6 +501,7 @@ export default {
|
|
geteBalance, // 差额 = 配额 - 已选 - 累计
|
|
geteBalance, // 差额 = 配额 - 已选 - 累计
|
|
// 正价
|
|
// 正价
|
|
regularUnit, // 单位
|
|
regularUnit, // 单位
|
|
|
|
+ regularQuota, // 配额
|
|
regularSelected, // 已选
|
|
regularSelected, // 已选
|
|
regularTotal, // 累计
|
|
regularTotal, // 累计
|
|
regularBalance, // 差额 = 配额 - 已选 - 累计
|
|
regularBalance, // 差额 = 配额 - 已选 - 累计
|
|
@@ -516,15 +523,39 @@ export default {
|
|
specialPriceBalance // 差额
|
|
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) {
|
|
refashRow (item, enable) {
|
|
|
|
+ console.log(enable, 'enable')
|
|
// 刷新产品列表
|
|
// 刷新产品列表
|
|
this.$emit('refash', '')
|
|
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
|
|
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) {
|
|
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) {
|
|
changeDaOpt (e) {
|
|
this.disabledActiveOption = e.target.value
|
|
this.disabledActiveOption = e.target.value
|