|
@@ -1,23 +1,22 @@
|
|
|
<template>
|
|
|
<!-- 已选配件列表 -->
|
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
|
- <ve-table
|
|
|
- border-y
|
|
|
- v-show="!showEmpty"
|
|
|
- :scroll-width="0"
|
|
|
- :max-height="tableHeight"
|
|
|
- :show-header="showTableHead"
|
|
|
- :row-style-option="{clickHighlight: true}"
|
|
|
- :cellSelectionOption="{enable: false}"
|
|
|
- :virtual-scroll-option="{enable: true}"
|
|
|
- :columns="columns"
|
|
|
- :table-data="dataSource"
|
|
|
- row-key-field-name="id"
|
|
|
- :cell-style-option="cellStyleOption"
|
|
|
- :cell-span-option="cellSpanOption"
|
|
|
- :column-width-resize-option="columnWidthResizeOption"
|
|
|
- />
|
|
|
- <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
|
|
|
+ <div style="margin: 10px 0;">
|
|
|
+ <ve-table
|
|
|
+ border-y
|
|
|
+ :scroll-width="0"
|
|
|
+ :max-height="showEmpty?0:tableHeight"
|
|
|
+ :show-header="showTableHead"
|
|
|
+ :row-style-option="{clickHighlight: true}"
|
|
|
+ :cellSelectionOption="{enable: false}"
|
|
|
+ :virtual-scroll-option="{enable: true}"
|
|
|
+ :columns="columns"
|
|
|
+ :table-data="dataSource"
|
|
|
+ row-key-field-name="id"
|
|
|
+ :column-width-resize-option="columnWidthResizeOption"
|
|
|
+ />
|
|
|
+ <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
|
|
|
+ </div>
|
|
|
<!-- 活动规则详情 -->
|
|
|
<detailModal :openModal="openDetailModal" pageType="salesPage" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
|
|
|
</a-spin>
|
|
@@ -27,8 +26,7 @@
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
import { Empty } from 'ant-design-vue'
|
|
|
import detailModal from '@/views/promotionRulesManagement/dealerPromotions/detailModal.vue'
|
|
|
-import { salesPromoQueryList } from '@/api/salesNew'
|
|
|
-import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
|
|
|
+import { salesDetailAllList, salesDetailExtPromoList, salesDetaiCount } from '@/api/salesDetailNew'
|
|
|
export default {
|
|
|
name: 'DetailProductList',
|
|
|
mixins: [commonMixin],
|
|
@@ -39,6 +37,11 @@ export default {
|
|
|
type: Object,
|
|
|
default: function () { return null }
|
|
|
},
|
|
|
+ // 正常 or 活动 产品列表
|
|
|
+ type: {
|
|
|
+ type: String,
|
|
|
+ default: 'normal'
|
|
|
+ },
|
|
|
// 活动规则详情
|
|
|
promo: {
|
|
|
type: Object,
|
|
@@ -90,17 +93,8 @@ export default {
|
|
|
spinning: false,
|
|
|
openDetailModal: false, // 活动规则详情弹框
|
|
|
detailSn: null, // 活动规则详情sn
|
|
|
- activeList: [], // 活动列表
|
|
|
dataSource: [], // 列表原始数据
|
|
|
tableHeight: this.maxHeight, // 表格高度
|
|
|
- // 自定义单元格样式
|
|
|
- cellStyleOption: {
|
|
|
- bodyCellClass: ({ row, column, rowIndex }) => {
|
|
|
- if (row.id.indexOf('promo-') >= 0 && column.field === 'no') {
|
|
|
- return 'table-body-cell-no'
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
// 表格列可拖曳
|
|
|
columnWidthResizeOption: {
|
|
|
// default false
|
|
@@ -108,10 +102,6 @@ export default {
|
|
|
// column resize min width
|
|
|
minWidth: 50
|
|
|
},
|
|
|
- // 自定义单元格内容
|
|
|
- cellSpanOption: {
|
|
|
- bodyCellSpan: this.bodyCellSpan
|
|
|
- },
|
|
|
isCityPrice: false, // 是否显示市级价
|
|
|
outStockStr: '', // 产品库存不足提示信息
|
|
|
showEmpty: false, // 是否显示空数据图片
|
|
@@ -207,54 +197,40 @@ export default {
|
|
|
{ title: '出库仓库', field: 'warehouseName', key: 'e', width: 100, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } }
|
|
|
]
|
|
|
// 计算可合并单元格数
|
|
|
- this.colspanNums = this.showConvertPromoGifts ? 6 : 5
|
|
|
if (this.$hasPermissions(this.authCode + '_costPrice')) { // 成本价权限
|
|
|
- this.colspanNums = this.colspanNums + 1
|
|
|
arr.push({ title: '成本价', field: 'showCost', width: 80, key: 'f', align: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field]) } })
|
|
|
}
|
|
|
- this.colspanNums = this.colspanNums + 2
|
|
|
arr = arr.concat([
|
|
|
{ title: '单位', field: 'productOrigUnit', key: 'g', width: 80, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
|
|
|
{ title: '销售数量', field: 'qty', width: 80, key: 'h', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } }
|
|
|
])
|
|
|
|
|
|
if (this.$hasPermissions(this.authCode + '_provincePrice')) {
|
|
|
- this.colspanNums = this.colspanNums + 1
|
|
|
arr.push({ title: '省级价', field: 'provincePrice', width: 80, key: 'i', align: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field]) } })
|
|
|
}
|
|
|
// 是否勾选市级价格
|
|
|
if (this.isCityPrice) {
|
|
|
- this.colspanNums = this.colspanNums + 1
|
|
|
arr.push({ title: '市级价', field: 'cityPrice', width: 80, key: 'j', align: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field]) } })
|
|
|
if (this.$hasPermissions(this.authCode + '_salesPrice')) { // 售价权限
|
|
|
- this.colspanNums = this.colspanNums + 1
|
|
|
arr.push({ title: '销售价', field: 'price', width: 100, key: 'k', align: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return discountPriceFormat(row, row[column.field], h) } })
|
|
|
}
|
|
|
} else {
|
|
|
if (this.$hasPermissions(this.authCode + '_salesPrice')) { // 售价权限
|
|
|
- this.colspanNums = this.colspanNums + 1
|
|
|
arr.push({ title: '销售价', field: 'price', width: 100, key: 'l', align: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return discountPriceFormat(row, row[column.field], h) } })
|
|
|
}
|
|
|
}
|
|
|
// 审核,需用到库存
|
|
|
if (this.showStock) {
|
|
|
- this.colspanNums = this.colspanNums + 1
|
|
|
arr.push({ title: '库存', field: 'stockQty', width: 80, key: 'm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } })
|
|
|
if (this.showStockCol) {
|
|
|
- this.colspanNums = this.colspanNums + 1
|
|
|
arr.push({ title: '第三方库存', field: 'thirdStockQty', width: 80, key: 'mm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } })
|
|
|
}
|
|
|
}
|
|
|
- this.colspanNums = this.colspanNums + 3
|
|
|
arr = arr.concat([
|
|
|
{ title: '待下推数', field: 'unpushedQty', width: 80, key: 'o', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
|
|
|
{ title: '已下推数', field: 'pushedQty', width: 80, key: 'p', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } }
|
|
|
])
|
|
|
|
|
|
- // 如果有转采购额
|
|
|
- if (this.showConvertPromoGifts) {
|
|
|
- arr.push({ title: '转采购额数量', field: 'convertPromoGiftsQty', width: 100, key: 'z', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row.convertPromoGiftsFlag ? numsFormat(row[column.field]) : '--' } })
|
|
|
- }
|
|
|
arr.push({ title: '已取消数', field: 'cancelQty', width: 80, key: 'q', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } })
|
|
|
return arr
|
|
|
},
|
|
@@ -262,10 +238,6 @@ export default {
|
|
|
hasConvertPromoGifts () {
|
|
|
return this.detailData && this.detailData.totalConvertPromoGiftsQty
|
|
|
},
|
|
|
- // 是否显示可转采购额
|
|
|
- showConvertPromoGifts () {
|
|
|
- return this.activeList && this.activeList.filter(item => item.enabledFlag == 1).find(item => item.promotionRule && item.promotionRule.convertExpenseFlag == 1 && item.promotionRule.promotionRuleType == 'BUY_PROD_GIVE_PROD')
|
|
|
- },
|
|
|
// 是否显示库存列
|
|
|
showStock () {
|
|
|
return this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')
|
|
@@ -283,22 +255,6 @@ export default {
|
|
|
this.detailSn = null
|
|
|
this.openDetailModal = false
|
|
|
},
|
|
|
- // 合并活动分类单元格
|
|
|
- bodyCellSpan ({ row, column, rowIndex }) {
|
|
|
- if (row.id.indexOf('promo-') >= 0) {
|
|
|
- if (column.field == 'no') {
|
|
|
- return {
|
|
|
- rowspan: 1,
|
|
|
- colspan: this.colspanNums
|
|
|
- }
|
|
|
- } else {
|
|
|
- return {
|
|
|
- rowspan: 0,
|
|
|
- colspan: 0
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
// 查看活动详情
|
|
|
showDesc (row) {
|
|
|
this.detailSn = row.promoRuleSn
|
|
@@ -306,14 +262,7 @@ export default {
|
|
|
},
|
|
|
// 获取销售单参与的活动列表
|
|
|
pageInit () {
|
|
|
- salesPromoQueryList({ salesBillSn: this.salesBillSn }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.activeList = res.data || []
|
|
|
- }
|
|
|
- this.$nextTick(() => {
|
|
|
- this.searchTable()
|
|
|
- })
|
|
|
- })
|
|
|
+ this.searchTable()
|
|
|
},
|
|
|
// 显示第三方库存
|
|
|
showThreeStock () {
|
|
@@ -331,66 +280,14 @@ export default {
|
|
|
warehouseSn: this.warehouseSn,
|
|
|
promotionFlag: this.promoFlag == '' ? undefined : this.promoFlag
|
|
|
}
|
|
|
- // 参与活动数据
|
|
|
- const active = this.activeList.filter(item => item.enabledFlag == 1)
|
|
|
-
|
|
|
- // 是否有活动产品
|
|
|
- const hasSearchNormal = !params.promotionFlag || params.promotionFlag == 0
|
|
|
- // 没有活动产品时直接查询正常产品
|
|
|
- const proList = hasSearchNormal ? await salesDetailAllList(params).then(res => res.data) : []
|
|
|
- const norTotal = hasSearchNormal ? await salesDetaiCount(params).then(res => res.data) : null
|
|
|
-
|
|
|
- // 没有活动时,表格不显示统计数据
|
|
|
- let listData = active.length ? (proList.length ? [{
|
|
|
- id: 'promo-normal',
|
|
|
- total: norTotal
|
|
|
- }, ...proList] : []) : proList
|
|
|
-
|
|
|
- // 有促销活动产品时,循环获取每个活动的数据
|
|
|
- if (params.promotionFlag != 0) {
|
|
|
- // 循环获取活动产品
|
|
|
- for (let i = 0; i < active.length; i++) {
|
|
|
- const promo = active[i]
|
|
|
- const activeParams = {
|
|
|
- promoRuleSn: promo.promoRuleSn,
|
|
|
- promoSn: promo.promoSn,
|
|
|
- salesPromoSn: promo.salesPromoSn,
|
|
|
- ...params
|
|
|
- }
|
|
|
|
|
|
- // 获取活动产品统计
|
|
|
- const 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)
|
|
|
- }
|
|
|
- // 有数据时才调用接口,避免做无用的调用
|
|
|
- if (acTotal && acTotal.totalQty) {
|
|
|
- // 获取活动产品列表
|
|
|
- const aclist = await salesDetailAllList(activeParams).then(res => res.data)
|
|
|
- // 合并结果数据
|
|
|
- const retList = aclist.length ? [{
|
|
|
- id: 'promo-' + i,
|
|
|
- promo: promo,
|
|
|
- total: acTotal
|
|
|
- }, ...aclist] : []
|
|
|
- // 将活动产品数据拼接
|
|
|
- listData = aclist && aclist.length ? listData.concat(retList) : listData
|
|
|
- }
|
|
|
- }
|
|
|
- // 如果活动没有任何产品,不显示统计一行
|
|
|
- if (active.length) {
|
|
|
- // 判断是否有活动产品
|
|
|
- const hasAcp = listData.filter(item => item.id != 'promo-normal').filter(item => item.id.indexOf('promo-') >= 0)
|
|
|
- if (hasAcp && hasAcp.length == 0) {
|
|
|
- listData = listData.filter(item => item.id.indexOf('promo-') < 0) || []
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // 查询正常产品明细列表
|
|
|
+ const normalList = this.type == 'normal' ? await salesDetailAllList(params).then(res => res.data) : []
|
|
|
+ const norTotal = this.type == 'normal' ? await salesDetaiCount(params).then(res => res.data) : null
|
|
|
+ // 查询活动产品明细列表
|
|
|
+ const activeList = this.type == 'active' ? await salesDetailExtPromoList({ salesPromoSnSet: [], ...params }).then(res => res.data) : []
|
|
|
// 赋值
|
|
|
- this.dataSource = listData
|
|
|
+ this.dataSource = this.type == 'normal' ? normalList : activeList
|
|
|
|
|
|
// 格式化数据
|
|
|
let f = 0
|