爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

103 lines
3.1 KiB

"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
data() {
return {
tabActive: 0,
teamList: [],
teamList1: [],
// 一级团队
teamList2: []
// 二级团队
};
},
computed: {
orderedCount() {
return this.teamList.filter((item) => item.orders > 0).length;
},
notOrderedCount() {
return this.teamList.filter((item) => item.orders == 0).length;
}
},
watch: {
tabActive(val) {
this.teamList = val === 0 ? this.teamList1 : this.teamList2;
}
},
mounted() {
this.fetchTeamList(0);
this.fetchTeamList(1);
},
methods: {
goBack() {
common_vendor.index.navigateBack();
},
fetchTeamList(state) {
this.$api("getHanHaiMemberUser", { state }, (res) => {
if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
const list = res.result.records.map((item) => {
let days = 0;
if (item.createTime) {
const joinDate = new Date(item.createTime.replace(/-/g, "/"));
const now = /* @__PURE__ */ new Date();
days = Math.floor((now - joinDate) / (1e3 * 60 * 60 * 24));
}
return {
avatar: item.headImage,
name: item.nickName,
days,
orders: item.orderNum,
amount: item.commission
};
});
if (state === 0) {
this.teamList1 = list;
if (this.tabActive === 0)
this.teamList = list;
} else {
this.teamList2 = list;
if (this.tabActive === 1)
this.teamList = list;
}
}
});
}
}
};
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
type: "left",
size: "20"
}),
b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
c: common_vendor.n($data.tabActive === 0 ? "active" : ""),
d: common_vendor.o(($event) => $data.tabActive = 0),
e: common_vendor.n($data.tabActive === 1 ? "active" : ""),
f: common_vendor.o(($event) => $data.tabActive = 1),
g: common_vendor.t($data.teamList.length),
h: common_vendor.t($options.orderedCount),
i: common_vendor.t($options.notOrderedCount),
j: common_vendor.f($data.teamList, (item, idx, i0) => {
return {
a: item.avatar,
b: common_vendor.t(item.name),
c: common_vendor.t(item.days),
d: common_vendor.t(item.orders),
e: common_vendor.t(item.amount),
f: idx
};
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-f0795b19"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/subcomponent/promotion-team.js.map