|
@@ -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>
|
|
|
|
|
@@ -99,20 +99,18 @@ export default {
|
|
|
disableSelectedRowKeys: [],
|
|
|
// 行选择改变事件
|
|
|
selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
|
- console.log(row, isSelected, selectedRowKeys)
|
|
|
// 当前勾选产品
|
|
|
const endSelProduct = selectedRowKeys[selectedRowKeys.length - 1]
|
|
|
// 叠加多选
|
|
|
- if (endSelProduct && row.stackFlag == '1') {
|
|
|
- this.checkboxOption.selectedRowKeys = selectedRowKeys
|
|
|
+ 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 = isSelected ? [endSelProduct] : []
|
|
|
}
|
|
|
- console.log(this.checkboxOption.selectedRowKeys)
|
|
|
// 查询此活动下的已选产品列表
|
|
|
- const salesPromoSn = this.activeList.filter(item => this.checkboxOption.selectedRowKeys.includes(item.id)).map(item => item.salesPromoSn)
|
|
|
- this.$emit('selected', isSelected ? salesPromoSn : null)
|
|
|
+ this.$emit('selected', isSelected ? this.checkboxOption.selectedRowKeys : null)
|
|
|
}
|
|
|
},
|
|
|
// 单元格样式
|
|
@@ -159,21 +157,30 @@ export default {
|
|
|
return ++rowIndex
|
|
|
}
|
|
|
},
|
|
|
- { field: 'promotionRuleType',
|
|
|
+ {
|
|
|
+ field: 'promotionRuleType',
|
|
|
key: 'ruletype',
|
|
|
width: 100,
|
|
|
title: '活动类型',
|
|
|
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>
|
|
|
- {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>)
|
|
|
+ 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',
|
|
@@ -437,9 +444,10 @@ export default {
|
|
|
],
|
|
|
tableData: [],
|
|
|
openDetailModal: false, // 规则详情弹框
|
|
|
- detailSn: null,
|
|
|
+ detailSn: null, // 销售单sn
|
|
|
disabledActiveOption: null,
|
|
|
- openGuideModal: false // 导入产品引导
|
|
|
+ openGuideModal: false, // 导入产品引导
|
|
|
+ uyGiftsInfo: null // 买赠产品弹窗详情信息
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -474,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({
|
|
@@ -493,6 +501,7 @@ export default {
|
|
|
geteBalance, // 差额 = 配额 - 已选 - 累计
|
|
|
// 正价
|
|
|
regularUnit, // 单位
|
|
|
+ regularQuota, // 配额
|
|
|
regularSelected, // 已选
|
|
|
regularTotal, // 累计
|
|
|
regularBalance, // 差额 = 配额 - 已选 - 累计
|
|
@@ -538,6 +547,16 @@ export default {
|
|
|
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) {
|
|
|
const _this = this
|