Commit 9ef9235f by chenwq

汇总-产值

1 parent 08d7928b
...@@ -10,7 +10,7 @@ Component({ ...@@ -10,7 +10,7 @@ Component({
type: Object, type: Object,
value: () => { }, value: () => { },
observer(n) { observer(n) {
this.dealStaffList() n && this.dealStaffList()
} }
}, },
}, },
...@@ -25,10 +25,10 @@ Component({ ...@@ -25,10 +25,10 @@ Component({
name: 'totalNum' name: 'totalNum'
}, { }, {
label: '总订单', label: '总订单',
name: 'totalAmount' name: 'totalOrderCount'
}, { }, {
label: '成交金额', label: '成交金额',
name: 'totalOrderCount', name: 'totalAmount',
prefix: '¥' prefix: '¥'
}], }],
merchantFormList: [{ merchantFormList: [{
...@@ -77,7 +77,7 @@ Component({ ...@@ -77,7 +77,7 @@ Component({
methods: { methods: {
dealStaffList() { dealStaffList() {
var list = this.data.orderObj var list = this.data.orderObj
list && list.activityList.forEach(item => { list && list.activityList?.forEach(item => {
// 0-未开始;1-活动中;2-已结束 // 0-未开始;1-活动中;2-已结束
let sliceNum = item.actStatus == 2 ? 3 : 10 let sliceNum = item.actStatus == 2 ? 3 : 10
item.showStaffList = item.staffList.length > sliceNum ? item.staffList.slice(0, sliceNum) : item.staffList item.showStaffList = item.staffList.length > sliceNum ? item.staffList.slice(0, sliceNum) : item.staffList
......
...@@ -74,7 +74,6 @@ Page({ ...@@ -74,7 +74,6 @@ Page({
}, },
setCurActivity() { setCurActivity() {
console.log(this.data.activityActive)
this.setData({ this.setData({
activityList: JSON.parse(JSON.stringify(this.data.sceneActivityObj['scene' + (this.data.sceneActive)])) activityList: JSON.parse(JSON.stringify(this.data.sceneActivityObj['scene' + (this.data.sceneActive)]))
}) })
...@@ -95,7 +94,6 @@ Page({ ...@@ -95,7 +94,6 @@ Page({
['searchForm.scene' + this.data.sceneActive + 'Idx']: res.tapIndex ['searchForm.scene' + this.data.sceneActive + 'Idx']: res.tapIndex
}) })
this.data.sceneActive != 4 ? this.getCustomerDetail() : this.getActivityRevenue() this.data.sceneActive != 4 ? this.getCustomerDetail() : this.getActivityRevenue()
console.log('调接口---')
} }
}) })
}, },
...@@ -110,24 +108,31 @@ Page({ ...@@ -110,24 +108,31 @@ Page({
wx.$router.go('packageOutput.openBusiness', params) wx.$router.go('packageOutput.openBusiness', params)
}, },
getSceneProStatus(sceneCode) { getSceneProStatus(sceneCode, isFirst = false) {
var params = { var params = {
serviceMerchantId: this.data.merchantInfo.pMerchantId, serviceMerchantId: this.data.merchantInfo.pMerchantId,
merchant4sId: this.data.merchantInfo.merchantId, merchant4sId: this.data.merchantInfo.merchantId,
sceneCode: sceneCode sceneCode: sceneCode
} }
outputApi.getSceneProStatus(params).then(res => { outputApi.getSceneProStatus(params).then(res => {
var proList = res.find(item => item.sceneCode == sceneCode) // var proList = res.find(item => item.sceneCode == sceneCode)
// 删--- // 删---
// proList.productList[1].productStatus = 2 // proList.productList[1].productStatus = 2
this.setData({ this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: proList.productList ['sceneActivityObj.scene1']: res[0].productList,
['sceneActivityObj.scene2']: res[1].productList,
['sceneActivityObj.scene3']: res[2].productList,
['sceneActivityObj.scene4']: res[3].productList
}) })
if ([2, 3].includes(+this.data.sceneActive)) { if ([2, 3].includes(+this.data.sceneActive)) {
this.getCustomerDetail() this.getCustomerDetail()
} else if (this.data.sceneActive == 4) { } else if (this.data.sceneActive == 4) {
this.getActivityRevenue() this.getActivityRevenue()
} else { } else {
if (isFirst) {
this.getCustomerDetail(isFirst)
this.getActivityRevenue(isFirst)
}
this.setCurActivity() this.setCurActivity()
} }
}) })
...@@ -157,15 +162,14 @@ Page({ ...@@ -157,15 +162,14 @@ Page({
/** 1.1和1.2场景产品数据处理 /** 1.1和1.2场景产品数据处理
* 调同一个接口,返回两个服务下面的全部产品的数据 * 调同一个接口,返回两个服务下面的全部产品的数据
*/ */
getCustomerDetail() { getCustomerDetail(isFirst = false) {
var params = this.dealSearchTime() var params = this.dealSearchTime()
outputApi.getCustomerDetail({ merchantId: this.data.merchantInfo.merchantId, ...params }).then(res => { outputApi.getCustomerDetail({ merchantId: this.data.merchantInfo.merchantId, ...params }).then(res => {
var actList = this.data.sceneActivityObj['scene' + this.data.sceneActive] var actList = this.data.sceneActivityObj['scene' + (isFirst ? 2 : this.data.sceneActive)]
var actCodeList = actList.map(item => item.productCode) var actCodeList = actList.map(item => item.productCode)
console.log(actCodeList)
var curTotal = 0 var curTotal = 0
var otherTotal = 0 var otherTotal = 0
var otherScene = this.data.sceneActive == 2 ? 3 : 2 var otherScene = isFirst ? 2 : (this.data.sceneActive == 2 ? 3 : 2)
res.forEach(item => { res.forEach(item => {
var idx = actCodeList.findIndex(i => i == item.productCode) var idx = actCodeList.findIndex(i => i == item.productCode)
if (idx != -1) { if (idx != -1) {
...@@ -184,14 +188,17 @@ Page({ ...@@ -184,14 +188,17 @@ Page({
otherTotal = otherTotal + (item.orderTotal?.totalSubOrderOrderMoney || 0) otherTotal = otherTotal + (item.orderTotal?.totalSubOrderOrderMoney || 0)
} }
}) })
if (!isFirst) {
this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: actList
})
}
// 总金额 // 总金额
this.setData({ this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: actList, ['scenePriceList[' + (isFirst ? 1 : (this.data.sceneActive - 1)) + '].total']: curTotal,
['scenePriceList[' + (this.data.sceneActive - 1) + '].total']: curTotal, ['scenePriceList[' + (isFirst ? 2 : (otherScene - 1)) + '].total']: otherTotal
['scenePriceList[' + (otherScene - 1) + '].total']: otherTotal
}) })
console.log(this.data.sceneActivityObj['scene' + this.data.sceneActive]) !isFirst && this.setCurActivity()
this.setCurActivity()
}) })
}, },
...@@ -218,13 +225,17 @@ Page({ ...@@ -218,13 +225,17 @@ Page({
}, },
/** 查询场景4的产值 */ /** 查询场景4的产值 */
getActivityRevenue() { getActivityRevenue(isFirst = false) {
wx.showLoading() !isFirst && wx.showLoading()
var params = this.dealSearchStatus() var params = this.dealSearchStatus()
outputApi.getActivityRevenue({ merchantId: this.data.merchantInfo.merchantId, ...params }).then(res => { outputApi.getActivityRevenue({ merchantId: this.data.merchantInfo.merchantId, ...params }).then(res => {
// console.log(res) // console.log(res)
// console.log(this.data.sceneActivityObj, '++++++') // console.log(this.data.sceneActivityObj, '++++++')
var actList = this.data.sceneActivityObj['scene' + this.data.sceneActive] var actList = this.data.sceneActivityObj['scene' + (isFirst ? 4 : this.data.sceneActive)]
var total = 0
res.forEach(item => {
total = total + item.totalAmount
})
actList.forEach((item, idx) => { actList.forEach((item, idx) => {
var curItem = res.find(k => k.goodsCategoryCode == item.productCode) var curItem = res.find(k => k.goodsCategoryCode == item.productCode)
if (curItem) { if (curItem) {
...@@ -270,12 +281,19 @@ Page({ ...@@ -270,12 +281,19 @@ Page({
} }
}) })
actList[idx].outputData = curItem actList[idx].outputData = curItem
} else {
actList[idx].outputData = []
} }
}) })
if (!isFirst) {
this.setData({ this.setData({
['sceneActivityObj.scene' + this.data.sceneActive]: actList ['sceneActivityObj.scene' + this.data.sceneActive]: actList
}) })
this.setCurActivity() }
this.setData({
['scenePriceList[3].total']: total
})
!isFirst && this.setCurActivity()
}).finally(() => { }).finally(() => {
wx.hideLoading() wx.hideLoading()
}) })
...@@ -295,8 +313,8 @@ Page({ ...@@ -295,8 +313,8 @@ Page({
// }, // },
// sceneCodeList: ['SC001', 'SC002', 'SC003', 'SC004'] // sceneCodeList: ['SC001', 'SC002', 'SC003', 'SC004']
// }) // })
// this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1])
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1])
wx.$router.getData(obj => { wx.$router.getData(obj => {
var scene = {} var scene = {}
Object.keys(this.data.sceneObj).forEach(item => { Object.keys(this.data.sceneObj).forEach(item => {
...@@ -308,7 +326,7 @@ Page({ ...@@ -308,7 +326,7 @@ Page({
sceneCodeList: obj.sceneCodeList sceneCodeList: obj.sceneCodeList
}) })
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1]) this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1], true)
}) })
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!