|
@@ -59,14 +59,14 @@
|
|
|
<div slot="title">
|
|
|
<div style="display: flex;justify-content: space-between;">
|
|
|
<span>活动产品</span>
|
|
|
- <a-button size="small" @click="getActiveList(true)" type="link" class="button-info"><a-icon type="reload"/> 刷新</a-button>
|
|
|
+ <a-button size="small" @click="getActiveList(false)" type="link" class="button-info"><a-icon type="reload"/> 刷新</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<activeStatisticsList
|
|
|
ref="activeTjList"
|
|
|
@openCpModal="openProductModal"
|
|
|
@refash="refashTableData"
|
|
|
- @selected="getActiveProduct"
|
|
|
+ @selected="active => salesPromoSnSet = active"
|
|
|
:activeList="activeList"
|
|
|
:warehouseSn="warehouseSn"
|
|
|
:salesBillSn="salesBillSn"
|
|
@@ -256,22 +256,6 @@ export default {
|
|
|
handleBack () {
|
|
|
this.$router.push({ name: 'salesQueryNewList', query: { closeLastOldTab: true } })
|
|
|
},
|
|
|
- // 销售单详情
|
|
|
- getOrderDetail (flag, callback) {
|
|
|
- this.spinning = true
|
|
|
- salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
|
|
|
- this.spinning = false
|
|
|
- if (res.status == 200) {
|
|
|
- this.detailData = res.data
|
|
|
- this.detailData.totalDiscountAmount = Number(this.detailData.totalOrigAmount || 0) - Number(this.detailData.totalAmount || 0)
|
|
|
- if (callback) { callback() }
|
|
|
- }
|
|
|
- if (flag) {
|
|
|
- // 获取活动列表
|
|
|
- this.getActiveList()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 查看参与规则明细
|
|
|
showRuleDetail (sn) {
|
|
|
this.$refs.activeTjList.showDesc({ promoRuleSn: sn })
|
|
@@ -297,104 +281,24 @@ export default {
|
|
|
this.spinning = false
|
|
|
})
|
|
|
},
|
|
|
- // 获取销售单参与的活动列表
|
|
|
- async getActiveList (flag) {
|
|
|
- // 已参与活动列表
|
|
|
- const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
|
|
|
- this.activeList = list.filter(item => item.promotion && item.promotionRule)
|
|
|
- // 触发活动统计查询变量
|
|
|
- this.$nextTick(() => {
|
|
|
- if (this.activeList.length) this.$refs.activeTjList.hasInit = false
|
|
|
- })
|
|
|
- if (!flag) {
|
|
|
- setTimeout(() => {
|
|
|
- // 刷新正常产品列表
|
|
|
- this.$refs.productNormalList.resetSearchForm()
|
|
|
- // 刷新活动产品列表
|
|
|
- if (this.activeList.length) this.$refs.productActiveList.resetSearchForm()
|
|
|
- }, 500)
|
|
|
- }
|
|
|
- },
|
|
|
- // 获取是否有新活动,
|
|
|
- async getNewActive () {
|
|
|
- const hasNewActive = await salesQueryUnPartPromo({ salesBillSn: this.$route.params.sn, enabledFlag: '1' }).then(res => res.data)
|
|
|
- if (hasNewActive.length) {
|
|
|
- this.newActiveList = hasNewActive
|
|
|
- // 有则弹出弹框确认
|
|
|
- this.showNewActiveModal = true
|
|
|
- } else {
|
|
|
- // 获取销售单详情
|
|
|
- this.getOrderDetail(true)
|
|
|
- }
|
|
|
- },
|
|
|
- // 新活动弹框确认后
|
|
|
- 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 = res.data && res.data.length > 1
|
|
|
- if (res.data && res.data.length <= 1) {
|
|
|
- this.getOrderDetail(true)
|
|
|
- }
|
|
|
- }
|
|
|
- this.spinning = false
|
|
|
- })
|
|
|
- },
|
|
|
- // 特价规则排序完成或取消排序
|
|
|
- showDiscountSortOk () {
|
|
|
- this.showDiscountSortModal = false
|
|
|
- this.getOrderDetail(true)
|
|
|
- },
|
|
|
// 打开选择产品弹框,type:0 正常产品,1活动产品,2累计产品
|
|
|
openProductModal (type, promo) {
|
|
|
this.$refs.chooseProduct.pageInit(this.detailData, promo, type)
|
|
|
this.showCpModal = true
|
|
|
},
|
|
|
// 添加产品后,关闭弹框
|
|
|
- closeProductModal (hasRefash) {
|
|
|
+ closeProductModal (hasRefash, type) {
|
|
|
this.showCpModal = false
|
|
|
+ // 刷新产品列表和活动统计列表
|
|
|
if (hasRefash) {
|
|
|
- this.getActiveList()
|
|
|
- }
|
|
|
- },
|
|
|
- // 获取指定活动的产品列表
|
|
|
- getActiveProduct (active) {
|
|
|
- this.salesPromoSnSet = active
|
|
|
- },
|
|
|
- // 添加活动产品成功的回调,刷新产品列表
|
|
|
- // type:normal 正常列表 ,active 活动列表
|
|
|
- // action:add 添加,del 删除,batchDel 批量删除,update 更新数据
|
|
|
- refashTableData (type, action) {
|
|
|
- // 如果是活动产品
|
|
|
- if (type == 'promo') {
|
|
|
- // 刷新正常产品列表
|
|
|
- if (action != 'add') this.$refs.productNormalList.resetSearchForm()
|
|
|
- } else if (type == 'normal') { // 如果是正常产品
|
|
|
- // 刷新活动产品列表
|
|
|
- if (this.activeList.length && action != 'add') this.$refs.productActiveList.resetSearchForm()
|
|
|
- } else {
|
|
|
- // 刷新正常产品列表
|
|
|
- this.$refs.productNormalList.resetSearchForm()
|
|
|
- // 刷新活动产品列表
|
|
|
- if (this.activeList.length) this.$refs.productActiveList.resetSearchForm()
|
|
|
- }
|
|
|
- // 重新获取详情信息
|
|
|
- this.getOrderDetail(false)
|
|
|
- if (action != 'add') {
|
|
|
- // 重新获取参与活动列表
|
|
|
- this.getActiveList(true)
|
|
|
+ this.getActiveList(false)
|
|
|
+ if (type == 0) {
|
|
|
+ // 刷新活动产品列表
|
|
|
+ if (this.activeList.length) this.$refs.productActiveList.resetSearchForm()
|
|
|
+ } else {
|
|
|
+ // 刷新正常产品列表
|
|
|
+ this.$refs.productNormalList.resetSearchForm()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 确定新增产品到列表,
|
|
@@ -408,29 +312,24 @@ export default {
|
|
|
if (cptype == 1) {
|
|
|
if (this.activeList.length) this.$refs.productActiveList.saveNewProduct(row, promo, promoProductClz)
|
|
|
}
|
|
|
+ // 累计产品
|
|
|
if (cptype == 2) {
|
|
|
if (this.activeList.length) this.$refs.productActiveList.accumulateProduct(row, promo, promoProductClz)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- // 更换活动,type 1 促销活动,0 正常活动
|
|
|
+ // type 1 更换活动,0 参与活动
|
|
|
upActive (params, type) {
|
|
|
salesChangePromo(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
+ // 刷新活动统计
|
|
|
+ this.getActiveList(false)
|
|
|
if (type == 1) {
|
|
|
- // 刷新活动产品
|
|
|
- if (this.activeList.length) this.$refs.productActiveList.upAcitveSuccess()
|
|
|
- // 刷新活动统计
|
|
|
- if (this.activeList.length) this.$refs.activeTjList.getDataList()
|
|
|
- // 刷新详情和正常产品列表
|
|
|
- this.refashTableData('promo')
|
|
|
+ // 刷新正常产品列表
|
|
|
+ this.$refs.productNormalList.resetSearchForm()
|
|
|
} else {
|
|
|
- // 刷新正常活动
|
|
|
- this.$refs.productNormalList.addAcitveSuccess()
|
|
|
- // 刷新活动统计
|
|
|
- if (this.activeList.length) this.$refs.activeTjList.getDataList()
|
|
|
- // 刷新详情和活动产品列表
|
|
|
- this.refashTableData('normal')
|
|
|
+ // 刷新活动产品列表
|
|
|
+ if (this.activeList.length) this.$refs.productActiveList.resetSearchForm()
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -487,11 +386,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- // 校验销售价低于成本价提示成功,关闭弹窗
|
|
|
- vaildPriceOk () {
|
|
|
- this.tempData = null
|
|
|
- this.openVaildPriceModal = false
|
|
|
- },
|
|
|
// 提交销售单
|
|
|
async submitOrder (data) {
|
|
|
this.spinning = true
|
|
@@ -512,6 +406,113 @@ export default {
|
|
|
}
|
|
|
this.spinning = false
|
|
|
},
|
|
|
+ // 校验销售价低于成本价提示成功,关闭弹窗
|
|
|
+ vaildPriceOk () {
|
|
|
+ this.tempData = null
|
|
|
+ this.openVaildPriceModal = false
|
|
|
+ },
|
|
|
+ // 刷新查询列表数据
|
|
|
+ getTableListData () {
|
|
|
+ // 刷新正常产品列表
|
|
|
+ this.$refs.productNormalList.resetSearchForm()
|
|
|
+ // 刷新活动产品列表
|
|
|
+ if (this.activeList.length) this.$refs.productActiveList.resetSearchForm()
|
|
|
+ },
|
|
|
+ // 添加活动产品成功的回调,刷新产品列表
|
|
|
+ // type:normal 正常列表 ,active 活动列表
|
|
|
+ // action:add 添加,del 删除,batchDel 批量删除,update 更新数据
|
|
|
+ // 如果添加操作,不实时刷新列表,关闭后再刷新
|
|
|
+ refashTableData (type, action) {
|
|
|
+ // 重新获取详情信息
|
|
|
+ this.getOrderDetail(false)
|
|
|
+ // 如果是活动产品,刷新正常产品列表
|
|
|
+ if (type == 'promo') {
|
|
|
+ if (action != 'add') this.$refs.productNormalList.resetSearchForm()
|
|
|
+ } else if (type == 'normal') { // 如果是正常产品
|
|
|
+ // 刷新活动产品列表
|
|
|
+ if (this.activeList.length && action != 'add') this.$refs.productActiveList.resetSearchForm()
|
|
|
+ } else {
|
|
|
+ // 正常和活动列表都刷新
|
|
|
+ this.getTableListData()
|
|
|
+ }
|
|
|
+ // 非添加操作,重新获取参与活动列表
|
|
|
+ if (action != 'add') {
|
|
|
+ this.getActiveList(false)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取销售单参与的活动列表,flag: true 查询产品明细列表,false 不查
|
|
|
+ async getActiveList (flag) {
|
|
|
+ this.spinning = true
|
|
|
+ // 已参与活动列表
|
|
|
+ const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
|
|
|
+ this.activeList = list.filter(item => item.promotion && item.promotionRule)
|
|
|
+ // 触发活动统计查询变量
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.activeList.length) this.$refs.activeTjList.hasInit = false
|
|
|
+ })
|
|
|
+ this.spinning = false
|
|
|
+ if (flag) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.getTableListData()
|
|
|
+ }, 200)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 销售单详情 flag: true 查询活动列表,false 不查
|
|
|
+ async getOrderDetail (flag) {
|
|
|
+ this.spinning = true
|
|
|
+ const detail = await salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => res.data)
|
|
|
+ if (detail) {
|
|
|
+ this.detailData = detail
|
|
|
+ this.detailData.totalDiscountAmount = Number(this.detailData.totalOrigAmount || 0) - Number(this.detailData.totalAmount || 0)
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ if (flag) {
|
|
|
+ // 获取活动列表
|
|
|
+ this.getActiveList(true)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取是否有新活动,
|
|
|
+ async getNewActive () {
|
|
|
+ const hasNewActive = await salesQueryUnPartPromo({ salesBillSn: this.$route.params.sn, enabledFlag: '1' }).then(res => res.data)
|
|
|
+ if (hasNewActive.length) {
|
|
|
+ this.newActiveList = hasNewActive
|
|
|
+ // 有则弹出参与新活动弹框
|
|
|
+ this.showNewActiveModal = true
|
|
|
+ } else {
|
|
|
+ // 获取销售单详情
|
|
|
+ this.getOrderDetail(true)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 新活动弹框确认后
|
|
|
+ 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 = res.data && res.data.length > 1
|
|
|
+ if (res.data && res.data.length <= 1) {
|
|
|
+ this.getOrderDetail(true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 特价规则排序完成或取消排序
|
|
|
+ showDiscountSortOk () {
|
|
|
+ this.showDiscountSortModal = false
|
|
|
+ this.getOrderDetail(true)
|
|
|
+ },
|
|
|
// 页面初始化
|
|
|
pageInit () {
|
|
|
this.salesBillSn = this.$route.params.sn
|