|
@@ -218,6 +218,11 @@ export default {
|
|
|
tooglePanel(item){
|
|
|
item.isActive=!item.isActive
|
|
|
this.activeList.splice()
|
|
|
+ // 刷新当前表格
|
|
|
+ if(item.isActive){
|
|
|
+ const row = this.$refs['productList-'+item.promoRuleSn][0]
|
|
|
+ row&&row.resetSearchForm()
|
|
|
+ }
|
|
|
},
|
|
|
// 销售单详情
|
|
|
getOrderDetail (flag) {
|
|
@@ -239,6 +244,45 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 判断是否全部调用完
|
|
|
+ isAllLoadFinish(mlist){
|
|
|
+ const nid = setInterval(()=>{
|
|
|
+ const ret = []
|
|
|
+ mlist.map(item => {
|
|
|
+ const da = item.disabled
|
|
|
+ ret.push(da)
|
|
|
+ })
|
|
|
+ // 加载完了
|
|
|
+ if(!ret.includes(true)){
|
|
|
+ clearInterval(nid)
|
|
|
+ this.spinning = false
|
|
|
+ }
|
|
|
+ console.log(ret)
|
|
|
+ }, 50)
|
|
|
+ },
|
|
|
+ // 刷新所有表格数据
|
|
|
+ updateAllTable(flag){
|
|
|
+ const activeList = this.activeList.filter(item=>item.isActive)
|
|
|
+ const mlist = []
|
|
|
+ this.spinning = true
|
|
|
+ // 加载正常产品列表
|
|
|
+ this.$refs.productNormalList.resetSearchForm()
|
|
|
+ mlist.push(this.$refs.productNormalList)
|
|
|
+ // 刷新所有活动产品列表
|
|
|
+ activeList.map(item => {
|
|
|
+ const row = this.$refs['productList-' + item.promoRuleSn][0]
|
|
|
+ row&&row.resetSearchForm()
|
|
|
+ mlist.push(row)
|
|
|
+ })
|
|
|
+
|
|
|
+ // 判断是否全部调用完
|
|
|
+ this.isAllLoadFinish(mlist)
|
|
|
+
|
|
|
+ // 是否刷新详情
|
|
|
+ if(flag){
|
|
|
+ this.getOrderDetail()
|
|
|
+ }
|
|
|
+ },
|
|
|
// 获取销售单参与的活动列表
|
|
|
async getActiveList(){
|
|
|
// 已参与活动列表
|
|
@@ -249,9 +293,9 @@ export default {
|
|
|
item.disabled = item.enabledFlag == 0
|
|
|
this.activeDesKey['search-'+item.promoRuleSn] = false
|
|
|
})
|
|
|
- // 加载正常产品列表
|
|
|
+
|
|
|
setTimeout(()=> {
|
|
|
- this.$refs.productNormalList.resetSearchForm()
|
|
|
+ this.updateAllTable()
|
|
|
}, 500)
|
|
|
},
|
|
|
// 获取是否有新活动
|
|
@@ -267,9 +311,11 @@ export default {
|
|
|
this.getOrderDetail(true)
|
|
|
},
|
|
|
// 添加产品,包括正常和活动的产品
|
|
|
- closeProductModal(){
|
|
|
+ closeProductModal(type){
|
|
|
this.cpCurRefId = ''
|
|
|
this.showCpModal = false
|
|
|
+ // 刷新表格
|
|
|
+ this.insterActiveOk(['normal','promo'][type])
|
|
|
},
|
|
|
// 打开选择产品弹框
|
|
|
openProductModal(type, refId){
|
|
@@ -281,16 +327,25 @@ export default {
|
|
|
},
|
|
|
// 添加活动产品成功的回调
|
|
|
insterActiveOk(type){
|
|
|
+ console.log(type)
|
|
|
+ const mlist = []
|
|
|
+ this.spinning = true
|
|
|
if(type == 'promo'){
|
|
|
// 刷新正常产品列表
|
|
|
this.$refs.productNormalList.resetSearchForm()
|
|
|
+ mlist.push(this.$refs.productNormalList)
|
|
|
}
|
|
|
if(type == 'normal'){
|
|
|
// 刷新活动产品列表
|
|
|
- this.activeList.map(item => {
|
|
|
- this.$refs['productList-' + item.promoRuleSn][0].resetSearchForm()
|
|
|
+ const activeList = this.activeList.filter(item=>item.isActive)
|
|
|
+ activeList.map(item => {
|
|
|
+ const row = this.$refs['productList-' + item.promoRuleSn][0]
|
|
|
+ row&&row.resetSearchForm()
|
|
|
+ mlist.push(row)
|
|
|
})
|
|
|
}
|
|
|
+ // 判断是否全部调用完
|
|
|
+ this.isAllLoadFinish(mlist)
|
|
|
this.getOrderDetail()
|
|
|
},
|
|
|
// 新增产品
|
|
@@ -315,14 +370,26 @@ export default {
|
|
|
...params
|
|
|
}).then(res => {
|
|
|
if(res.status == 200){
|
|
|
+ const mlist = []
|
|
|
+ const nt = this.$refs['productList-'+promo[1]][0]
|
|
|
+ const ot = this.$refs['productList-'+oldPromo.promoRuleSn][0]
|
|
|
+ const pnt = this.$refs.productNormalList
|
|
|
+ this.spinning = true
|
|
|
// 刷新新参与活动
|
|
|
if(data != 0){
|
|
|
- this.$refs['productList-'+promo[1]][0].resetSearchForm()
|
|
|
+ nt&&nt.resetSearchForm()
|
|
|
+ mlist.push(nt)
|
|
|
}
|
|
|
// 刷新正常活动
|
|
|
- this.$refs.productNormalList.resetSearchForm()
|
|
|
+ pnt&&pnt.resetSearchForm()
|
|
|
+ mlist.push(pnt)
|
|
|
// 刷新当前活动
|
|
|
- this.$refs['productList-'+oldPromo.promoRuleSn][0].upAcitveSuccess()
|
|
|
+ ot&&ot.upAcitveSuccess()
|
|
|
+ mlist.push(ot)
|
|
|
+
|
|
|
+ // 判断是否全部调用完
|
|
|
+ this.isAllLoadFinish(mlist)
|
|
|
+
|
|
|
// 刷新详情统计
|
|
|
this.getOrderDetail()
|
|
|
}
|
|
@@ -449,14 +516,16 @@ export default {
|
|
|
salesPromoSn: item.salesPromoSn
|
|
|
}).then(res => {
|
|
|
if(res.status == 200){
|
|
|
- _this.$refs['productList-'+item.promoRuleSn][0].disableActive(false)
|
|
|
item.disabled = false
|
|
|
item.isActive = true
|
|
|
_this.activeList.splice()
|
|
|
+ // 禁用按钮
|
|
|
+ _this.$refs['productList-'+item.promoRuleSn][0].disableActive(false)
|
|
|
+
|
|
|
+ // 刷新所有表格
|
|
|
+ _this.updateAllTable(true)
|
|
|
+
|
|
|
_this.spinning = false
|
|
|
- // 刷新正常活动
|
|
|
- _this.$refs.productNormalList.resetSearchForm()
|
|
|
- _this.insterActiveOk('normal')
|
|
|
_this.$message.success("操作成功,请添加产品")
|
|
|
}
|
|
|
})
|
|
@@ -472,15 +541,17 @@ export default {
|
|
|
salesDisableType: _this.disabledActiveOption
|
|
|
}).then(res => {
|
|
|
if(res.status == 200){
|
|
|
- _this.$refs['productList-'+item.promoRuleSn][0].disableActive(true)
|
|
|
- // 刷新所有表格
|
|
|
- _this.$refs.productNormalList.resetSearchForm()
|
|
|
- _this.insterActiveOk('normal')
|
|
|
- _this.spinning = false
|
|
|
- _this.disabledActiveOption = null
|
|
|
item.disabled = true
|
|
|
item.isActive = false
|
|
|
_this.activeList.splice()
|
|
|
+ // 启用按钮
|
|
|
+ _this.$refs['productList-'+item.promoRuleSn][0].disableActive(true)
|
|
|
+
|
|
|
+ // 刷新所有表格
|
|
|
+ _this.updateAllTable(true)
|
|
|
+
|
|
|
+ _this.disabledActiveOption = null
|
|
|
+ _this.spinning = false
|
|
|
_this.$message.success("操作成功")
|
|
|
}
|
|
|
})
|