Commit ed6e5f49 by chenwq

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

在api.js中添加outputValueStatistics接口用于获取会员权益产值统计数据
在supervisorDaily.js中新增getOutputValueStatistics方法处理权益场景下的数据展示
根据sceneType区分精品和权益场景,展示不同的统计信息
1 parent 9fabe599
......@@ -407,4 +407,9 @@ module.exports = {
userStat(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({
if (!userInfo) {
return;
}
wx.$util.showLoading("加载中...");
api
.userStat({
merchantId: userInfo?.shopMerchantId || undefined,
})
.then((result) => {
let { code, data } = result;
if (code == 0) {
const needDefaultCodeList = Object.keys(reportFirstAutoObj);
console.log(needDefaultCodeList, "needDefaultCodeList----");
if (needDefaultCodeList.includes(routeParams.code)) {
reportFirstAutoObj[routeParams.code]?.list.forEach((item) => {
tmlpFormData[item.attrName] =
data[item.valueObj].totalOrderMoney + "";
});
this.setData(
{
tmlpFormData: tmlpFormData,
tabChange: false,
},
() => {
this.setData({
tabChange: true,
});
}
);
// sceneType 1是精品0是权益
if (userInfo.sceneType == 1) {
wx.$util.showLoading("加载中...");
api
.userStat({
merchantId: userInfo?.shopMerchantId || undefined,
})
.then((result) => {
let { code, data } = result;
if (code == 0) {
const needDefaultCodeList = Object.keys(reportFirstAutoObj);
if (needDefaultCodeList.includes(routeParams.code)) {
reportFirstAutoObj[routeParams.code]?.list.forEach((item) => {
tmlpFormData[item.attrName] =
data[item.valueObj].totalOrderMoney + "";
});
this.setData(
{
tmlpFormData: tmlpFormData,
tabChange: false,
},
() => {
this.setData({
tabChange: true,
});
}
);
}
}
}
})
.finally(() => {
wx.hideLoading();
})
.finally(() => {
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) {
......@@ -815,8 +861,8 @@ Page({
if (k.key.includes("attendingStaff")) {
this.data["staffCheckList" + trainSuffix] = k.value
? k.value.split(",").map((item) => {
return { staffName: item };
})
return { staffName: item };
})
: [];
}
if (k.key.includes("trainingPhotos") && k.value) {
......@@ -1107,7 +1153,7 @@ Page({
confirmText: "好的",
confirmColor: "#347BFF",
showCancel: false,
success(res) {},
success(res) { },
});
return true;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!