Commit ed6e5f49 by chenwq

feat(会员权益): 添加会员权益产值统计功能

在api.js中添加outputValueStatistics接口用于获取会员权益产值统计数据
在supervisorDaily.js中新增getOutputValueStatistics方法处理权益场景下的数据展示
根据sceneType区分精品和权益场景,展示不同的统计信息
1 parent 9fabe599
...@@ -407,4 +407,9 @@ module.exports = { ...@@ -407,4 +407,9 @@ module.exports = {
userStat(data) { userStat(data) {
return api.post("dj.api.smartcarlife.user.stat", data); return api.post("dj.api.smartcarlife.user.stat", data);
}, },
/** 2.1 会员权益产值统计 */
outputValueStatistics(data) {
return api.post('dj.api.smartcarlife.vehicle.damage.upgrade.quotation.outputValueStatistics', data)
},
}; };
...@@ -114,6 +114,8 @@ Page({ ...@@ -114,6 +114,8 @@ Page({
if (!userInfo) { if (!userInfo) {
return; return;
} }
// sceneType 1是精品0是权益
if (userInfo.sceneType == 1) {
wx.$util.showLoading("加载中..."); wx.$util.showLoading("加载中...");
api api
.userStat({ .userStat({
...@@ -123,7 +125,6 @@ Page({ ...@@ -123,7 +125,6 @@ Page({
let { code, data } = result; let { code, data } = result;
if (code == 0) { if (code == 0) {
const needDefaultCodeList = Object.keys(reportFirstAutoObj); const needDefaultCodeList = Object.keys(reportFirstAutoObj);
console.log(needDefaultCodeList, "needDefaultCodeList----");
if (needDefaultCodeList.includes(routeParams.code)) { if (needDefaultCodeList.includes(routeParams.code)) {
reportFirstAutoObj[routeParams.code]?.list.forEach((item) => { reportFirstAutoObj[routeParams.code]?.list.forEach((item) => {
tmlpFormData[item.attrName] = tmlpFormData[item.attrName] =
...@@ -146,6 +147,51 @@ Page({ ...@@ -146,6 +147,51 @@ Page({
.finally(() => { .finally(() => {
wx.hideLoading(); wx.hideLoading();
}); });
} else {
this.getOutputValueStatistics(userInfo)
}
},
async getOutputValueStatistics(userInfo) {
let today = new Date()
const { routeParams, tmlpFormData, tmlpInitData } = this.data;
let thisMonth = new Date(new Date().setDate(1)).format('yyyy-MM-dd')
const dataobj = {
today: {
startTime: today.format('yyyy-MM-dd') + ' 00:00:00',
endTime: today.format('yyyy-MM-dd') + ' 23:59:59'
},
month: {
startTime: thisMonth + ' 00:00:00',
endTime: today.format('yyyy-MM-dd') + ' 23:59:59'
},
}
let resObj = { staffTodayTotal: {}, staffMonthTotal: {} }
resObj.staffTodayTotal = await api.outputValueStatistics({
...dataobj.today,
shopMerchantId: userInfo?.default4SStoreInfo?.merchantId
})
resObj.staffMonthTotal = await api.outputValueStatistics({
...dataobj.month,
shopMerchantId: userInfo?.default4SStoreInfo?.merchantId
})
console.log(resObj)
const needDefaultCodeList = Object.keys(reportFirstAutoObj);
if (needDefaultCodeList.includes(routeParams.code)) {
reportFirstAutoObj[routeParams.code]?.list.forEach((item) => {
tmlpFormData[item.attrName] = resObj[item.valueObj]?.data.totalOutputValue + "";
});
this.setData(
{
tmlpFormData: tmlpFormData,
tabChange: false,
},
() => {
this.setData({
tabChange: true,
});
}
);
}
}, },
async initData(options) { async initData(options) {
...@@ -1107,7 +1153,7 @@ Page({ ...@@ -1107,7 +1153,7 @@ Page({
confirmText: "好的", confirmText: "好的",
confirmColor: "#347BFF", confirmColor: "#347BFF",
showCancel: false, showCancel: false,
success(res) {}, success(res) { },
}); });
return true; return true;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!