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,38 +114,84 @@ Page({ ...@@ -114,38 +114,84 @@ Page({
if (!userInfo) { if (!userInfo) {
return; return;
} }
wx.$util.showLoading("加载中..."); // sceneType 1是精品0是权益
api if (userInfo.sceneType == 1) {
.userStat({ wx.$util.showLoading("加载中...");
merchantId: userInfo?.shopMerchantId || undefined, api
}) .userStat({
.then((result) => { merchantId: userInfo?.shopMerchantId || undefined,
let { code, data } = result; })
if (code == 0) { .then((result) => {
const needDefaultCodeList = Object.keys(reportFirstAutoObj); let { code, data } = result;
console.log(needDefaultCodeList, "needDefaultCodeList----"); if (code == 0) {
if (needDefaultCodeList.includes(routeParams.code)) { const needDefaultCodeList = Object.keys(reportFirstAutoObj);
reportFirstAutoObj[routeParams.code]?.list.forEach((item) => { if (needDefaultCodeList.includes(routeParams.code)) {
tmlpFormData[item.attrName] = reportFirstAutoObj[routeParams.code]?.list.forEach((item) => {
data[item.valueObj].totalOrderMoney + ""; tmlpFormData[item.attrName] =
}); data[item.valueObj].totalOrderMoney + "";
this.setData( });
{ this.setData(
tmlpFormData: tmlpFormData, {
tabChange: false, tmlpFormData: tmlpFormData,
}, tabChange: false,
() => { },
this.setData({ () => {
tabChange: true, this.setData({
}); tabChange: true,
} });
); }
);
}
} }
} })
}) .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) {
...@@ -815,8 +861,8 @@ Page({ ...@@ -815,8 +861,8 @@ Page({
if (k.key.includes("attendingStaff")) { if (k.key.includes("attendingStaff")) {
this.data["staffCheckList" + trainSuffix] = k.value this.data["staffCheckList" + trainSuffix] = k.value
? k.value.split(",").map((item) => { ? k.value.split(",").map((item) => {
return { staffName: item }; return { staffName: item };
}) })
: []; : [];
} }
if (k.key.includes("trainingPhotos") && k.value) { if (k.key.includes("trainingPhotos") && k.value) {
...@@ -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!