Files
hnxdcount-uniapp/unpackage/dist/dev/mp-alipay/pages/shareList/detail.js
PC-202306242200\Administrator dac42e3b0c first commit
2026-03-28 23:09:02 +08:00

258 lines
7.8 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const api_api = require("../../api/api.js");
const _sfc_main = {
data() {
const currentDate = this.getDate({
format: true
});
return {
screen: {
showcalendar: false
},
shopinfo: {
nickname: "",
username: "",
money: "",
mobile: "",
vip: "",
device_num: "",
id: ""
},
team_device_num: 0,
chartData: {},
opts: {
padding: [15, 10, 0, 15],
enableScroll: false,
legend: {},
xAxis: {
disableGrid: true,
showTitle: false
},
yAxis: {
disabled: true,
gridType: "dash",
dashLength: 2
},
extra: {
line: {
type: "curve",
width: 2,
activeType: "none"
}
}
},
search: {
id: "",
start_time: "",
end_time: "",
weekType: 1
},
dateTime: currentDate,
single: "",
team: {}
};
},
onLoad(option) {
console.log(option.id, "option.id");
if (option && option.id) {
this.search.id = option.id;
}
},
onReady() {
this.getServerData();
},
async onPullDownRefresh() {
this.search.weekType = 1;
this.getServerData();
common_vendor.index.stopPullDownRefresh();
},
methods: {
getDate(type) {
const date = /* @__PURE__ */ new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
date.getDate();
if (type === "start") {
year = year - 60;
} else if (type === "end") {
year = year + 2;
}
month = month > 9 ? month : "0" + month;
return `${year}-${month}`;
},
bindDateChange(e) {
this.dateTime = e.detail.value;
},
getDateRanges() {
const now = /* @__PURE__ */ new Date();
const year = now.getFullYear();
const month = now.getMonth();
const ranges = {
firstRange: {
name: "1号-10号",
start: new Date(year, month, 1),
// 1号
end: new Date(year, month, 10)
// 10号
},
secondRange: {
name: "11号-20号",
start: new Date(year, month, 11),
// 11号
end: new Date(year, month, 20)
// 20号
},
thirdRange: {
name: "21号-月底",
start: new Date(year, month, 21)
// 21号
}
};
const lastDayOfMonth = new Date(year, month + 1, 0);
ranges.thirdRange.end = lastDayOfMonth;
function formatDate(date) {
const yyyy = date.getFullYear();
const mm = String(date.getMonth() + 1).padStart(2, "0");
const dd = String(date.getDate()).padStart(2, "0");
return `${yyyy}-${mm}-${dd}`;
}
return [
{
name: ranges.firstRange.name,
start: formatDate(ranges.firstRange.start),
end: formatDate(ranges.firstRange.end)
},
{
name: ranges.secondRange.name,
start: formatDate(ranges.secondRange.start),
end: formatDate(ranges.secondRange.end)
},
{
name: ranges.thirdRange.name,
start: formatDate(ranges.thirdRange.start),
end: formatDate(ranges.thirdRange.end)
}
];
},
checkTime(e) {
this.search.startTime = e.start;
this.search.endTime = e.end;
this.screen.showcalendar = false;
this.search.weekType = "";
this.getServerData();
},
checkweek(week) {
this.search.weekType = week;
this.search.startTime = "";
this.search.endTime = "";
this.getServerData();
},
maskClick(e) {
this.search.startTime = e[0];
this.search.endTime = e[e.length - 1];
this.search.weekType = "";
this.getServerData();
},
getServerData() {
api_api.shareUserInfo({ id: this.search.id }).then((res) => {
this.shopinfo = res;
});
api_api.shareUserInfoStats(this.search).then((res) => {
this.team = res;
let _list = [
{
name: "7KW",
data: res.stats7.map((item) => {
return item.num;
})
},
{
name: "20KW",
data: res.stats20.map((item) => {
return item.num;
})
},
{
name: "30KW",
data: res.stats30.map((item) => {
return item.num;
})
}
];
this.chartData.categories = res.dayStr;
this.chartData.series = _list;
});
}
}
};
if (!Array) {
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
const _easycom_up_divider2 = common_vendor.resolveComponent("up-divider");
const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
const _easycom_qiun_data_charts2 = common_vendor.resolveComponent("qiun-data-charts");
(_easycom_up_image2 + _easycom_up_divider2 + _easycom_uni_datetime_picker2 + _easycom_qiun_data_charts2)();
}
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
const _easycom_up_divider = () => "../../uni_modules/uview-plus/components/u-divider/u-divider.js";
const _easycom_uni_datetime_picker = () => "../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
const _easycom_qiun_data_charts = () => "../../uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.js";
if (!Math) {
(_easycom_up_image + _easycom_up_divider + _easycom_uni_datetime_picker + _easycom_qiun_data_charts)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.p({
width: "100rpx",
height: "100rpx",
src: $data.shopinfo.avatar,
shape: "circle"
}),
b: common_vendor.t($data.shopinfo.nickName),
c: common_vendor.t($data.shopinfo.userName),
d: common_vendor.t($data.shopinfo.phone),
e: common_vendor.t($data.shopinfo.level),
f: common_vendor.t($data.shopinfo.deviceNum7),
g: common_vendor.t($data.shopinfo.deviceNum20),
h: common_vendor.t($data.shopinfo.deviceNum30),
i: common_vendor.t($data.shopinfo.createTime),
j: common_vendor.t($data.team.myDeviceNum7),
k: common_vendor.t($data.team.myDeviceNum20),
l: common_vendor.t($data.team.myDeviceNum30),
m: common_vendor.t($data.team.deviceNum7),
n: common_vendor.t($data.team.deviceNum20),
o: common_vendor.t($data.team.deviceNum30),
p: common_vendor.n($data.search.weekType === 1 ? "xkl_cur" : "xkl_no"),
q: common_vendor.o(($event) => $options.checkweek(1)),
r: common_vendor.n($data.search.weekType == 2 ? "xkl_cur" : "xkl_no"),
s: common_vendor.o(($event) => $options.checkweek(2)),
t: $data.search.startTime
}, $data.search.startTime ? {
v: common_vendor.t($data.search.startTime),
w: common_vendor.t($data.search.endTime)
} : {}, {
x: common_vendor.n($data.search.weekType === "" ? "xkl_cur" : "xkl_no"),
y: common_vendor.o($options.maskClick),
z: common_vendor.o(($event) => $data.single = $event),
A: common_vendor.p({
type: "daterange",
modelValue: $data.single
}),
B: common_vendor.f($options.getDateRanges(), (item, index, i0) => {
return {
a: common_vendor.t(item.name),
b: index,
c: common_vendor.n($data.search.week === item.name ? "xkl_cur" : "xkl_no"),
d: common_vendor.o(($event) => $options.checkTime(item))
};
}),
C: common_vendor.p({
type: "line",
opts: $data.opts,
chartData: $data.chartData
})
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
my.createPage(MiniProgramPage);