|
@@ -2,6 +2,7 @@
|
|
|
<div style="padding:10px;">
|
|
|
<ve-table
|
|
|
style="width:100%"
|
|
|
+ :max-height="300"
|
|
|
:scroll-width="0"
|
|
|
border-y
|
|
|
border-x
|
|
@@ -9,17 +10,31 @@
|
|
|
row-key-field-name="id"
|
|
|
:checkbox-option="checkboxOption"
|
|
|
:column-width-resize-option="columnWidthResizeOption"
|
|
|
+ :row-style-option="{clickHighlight: true}"
|
|
|
+ :cellSelectionOption="{enable: false}"
|
|
|
+ :virtual-scroll-option="{enable: false}"
|
|
|
:columns="columns"
|
|
|
:table-data="tableData" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { salesPromoDetailCount } from '@/api/salesDetailNew'
|
|
|
export default {
|
|
|
props: {
|
|
|
activeList: {
|
|
|
type: Array,
|
|
|
default: () => []
|
|
|
+ },
|
|
|
+ // 仓库sn
|
|
|
+ warehouseSn: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ // 销售单sn
|
|
|
+ salesBillSn: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -55,7 +70,8 @@ export default {
|
|
|
type: 'checkbox',
|
|
|
title: '',
|
|
|
width: 30,
|
|
|
- align: 'center'
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
},
|
|
|
{
|
|
|
field: '',
|
|
@@ -63,12 +79,13 @@ export default {
|
|
|
title: '序号',
|
|
|
width: 40,
|
|
|
align: 'center',
|
|
|
+ fixed: 'left',
|
|
|
renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
return ++rowIndex
|
|
|
}
|
|
|
},
|
|
|
- { field: 'promotionRuleType', key: 'ruletype', width: 100, title: '活动类型', align: 'center' },
|
|
|
- { field: 'promotionRuleDesc', key: 'ruledesc', width: 150, title: '规则简称', align: 'center' },
|
|
|
+ { field: 'promotionRuleType', key: 'ruletype', width: 100, title: '活动类型', align: 'center', fixed: 'left' },
|
|
|
+ { field: 'promotionRuleDesc', key: 'ruledesc', width: 150, title: '规则简称', align: 'center', fixed: 'left' },
|
|
|
{
|
|
|
title: '门槛产品(数量/金额)',
|
|
|
children: [
|
|
@@ -227,18 +244,19 @@ export default {
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
- { field: 'totalKs', key: 'ks', title: '款数', width: 100, align: 'center' },
|
|
|
- { field: 'totalNums', key: 'dsl', title: '数量', width: 100, align: 'center' },
|
|
|
- { field: 'totalAmount', key: 'dje', title: '总金额', width: 100, align: 'center' },
|
|
|
- { field: 'totalYhAmount', key: 'dyhje', title: '优惠金额', width: 100, align: 'center' },
|
|
|
+ { field: 'totalCategory', key: 'ks', title: '款数', width: 100, align: 'center', fixed: 'right' },
|
|
|
+ { field: 'totalQty', key: 'dsl', title: '数量', width: 100, align: 'center', fixed: 'right' },
|
|
|
+ { field: 'totalAmount', key: 'dje', title: '总金额', width: 100, align: 'center', fixed: 'right' },
|
|
|
+ { field: 'lossAmount', key: 'dyhje', title: '优惠金额', width: 100, align: 'center', fixed: 'right' },
|
|
|
{
|
|
|
field: '',
|
|
|
key: 'action',
|
|
|
title: '操作',
|
|
|
width: 250,
|
|
|
center: 'center',
|
|
|
+ fixed: 'right',
|
|
|
renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
- // 导入产品
|
|
|
+ // 导入产品按钮
|
|
|
const importButton = []
|
|
|
if (row && row.promotionRule && row.promotionRule.gateFlag === '1') {
|
|
|
importButton.push({ key: 'GATE', name: '门槛产品' })
|
|
@@ -257,11 +275,12 @@ export default {
|
|
|
<a-button
|
|
|
type="link"
|
|
|
size="small"
|
|
|
+ class={row.disabled ? 'button-success' : 'button-error'}
|
|
|
on-click={() => this.enableRow(row)}
|
|
|
>
|
|
|
- 禁用规则
|
|
|
+ {row.disabled ? '启用' : '禁用'}规则
|
|
|
</a-button>
|
|
|
- <a-dropdown>
|
|
|
+ {!row.disabled ? <a-dropdown>
|
|
|
<a-menu slot="overlay" on-click={(e) => this.handleImportClick(e, row)} id={'salesEdit-menu-import-' + row.id}>
|
|
|
{importButton.map(item => {
|
|
|
return (
|
|
@@ -272,18 +291,19 @@ export default {
|
|
|
<a-button
|
|
|
id={'salesEdit-menu-import-plaction-' + row.id}
|
|
|
type="link"
|
|
|
- class={row.disabled ? 'button-gray' : 'button-info'}>
|
|
|
+ class="button-primary"
|
|
|
+ >
|
|
|
导入产品 <a-icon type="down" />
|
|
|
</a-button>
|
|
|
- </a-dropdown>
|
|
|
- <a-button
|
|
|
+ </a-dropdown> : ''}
|
|
|
+ {!row.disabled ? <a-button
|
|
|
type="link"
|
|
|
size="small"
|
|
|
class="button-primary"
|
|
|
on-click={() => this.addProduct(row)}
|
|
|
>
|
|
|
添加产品
|
|
|
- </a-button>
|
|
|
+ </a-button> : ''}
|
|
|
</div>
|
|
|
)
|
|
|
}
|
|
@@ -293,18 +313,41 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- getDataList () {
|
|
|
- this.activeList.forEach(item => {
|
|
|
+ async getDataList () {
|
|
|
+ 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 = {
|
|
|
+ promoRuleSn: item.promoRuleSn,
|
|
|
+ promoSn: item.promoSn,
|
|
|
+ salesPromoSn: item.salesPromoSn,
|
|
|
+ ...params
|
|
|
+ }
|
|
|
+ // 获取活动产品统计
|
|
|
+ acTotal = await salesPromoDetailCount(activeParams).then(res => 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.push({
|
|
|
...item,
|
|
|
promotionRuleType: item.promotionRule.promotionRuleTypeDictValue,
|
|
|
promotionRuleDesc: item.promotionRule.description,
|
|
|
- totalKs: item.kq + item.jw,
|
|
|
- totalNums: item.n + item.kq + item.jw,
|
|
|
- totalAmount: item.m + item.n + item.kq + item.jw,
|
|
|
- totalYhAmount: item.mpe + item.nyx + item.jce
|
|
|
+ ...acTotal
|
|
|
})
|
|
|
- })
|
|
|
+ }
|
|
|
},
|
|
|
// 禁用启用
|
|
|
enableRow (row) {
|