acdr-ui/dist/dev/mp-weixin/modules/mall/commission/team.js

179 lines
6.4 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const common_vendor = require("../../../common/vendor.js");
const sheep_index = require("../../../sheep/index.js");
const sheep_api_trade_brokerage = require("../../../sheep/api/trade/brokerage.js");
if (!Array) {
const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni");
(_easycom_s_layout2 + _component_layout_default_uni)();
}
const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
if (!Math) {
_easycom_s_layout();
}
const _sfc_main = {
__name: "team",
setup(__props) {
common_vendor.useCssVars((_ctx) => ({
"b3d58418": common_vendor.unref(headerBg)
}));
sheep_index.sheep.$platform.device.statusBarHeight * 2;
common_vendor.computed(() => sheep_index.sheep.$store("user").userInfo);
const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png");
common_vendor.onPageScroll((e) => {
state.scrollTop = e.scrollTop <= 100;
});
const sort = common_vendor.ref();
const state = common_vendor.reactive({
summary: {},
pagination: {
pageNo: 1,
pageSize: 8,
list: [],
total: 0
},
loadStatus: "",
// ↓ 新 ui 逻辑
level: 1,
nickname: common_vendor.ref(""),
sortKey: "",
isAsc: ""
});
function submitForm() {
state.pagination.list = [];
getTeamList();
}
function getTeamList() {
return __async(this, null, function* () {
state.loadStatus = "loading";
const { code, data } = yield sheep_api_trade_brokerage.BrokerageApi.getBrokerageUserChildSummaryPage({
pageNo: state.pagination.pageNo,
pageSize: state.pagination.pageSize,
level: state.level,
"sortingField.order": state.isAsc,
"sortingField.field": state.sortKey,
nickname: state.nickname
});
if (code !== 0) {
return;
}
state.pagination.list = common_vendor.lodash.concat(state.pagination.list, data.list);
state.pagination.total = data.total;
state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
});
}
function setType(e) {
state.pagination.list = [];
state.level = e + "";
getTeamList();
}
function setSort(sortKey, isAsc) {
state.pagination.list = [];
sort.value = sortKey + isAsc.toUpperCase();
state.isAsc = isAsc;
state.sortKey = sortKey;
getTeamList();
}
common_vendor.onLoad(() => __async(this, null, function* () {
yield getTeamList();
const { data } = yield sheep_api_trade_brokerage.BrokerageApi.getBrokerageUserSummary();
state.summary = data;
}));
function loadMore() {
if (state.loadStatus === "noMore") {
return;
}
state.pagination.pageNo++;
getTeamList();
}
common_vendor.onReachBottom(() => {
loadMore();
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.t(state.summary.firstBrokerageUserCount + state.summary.secondBrokerageUserCount || 0),
b: common_vendor.t(state.summary.firstBrokerageUserCount || 0),
c: common_vendor.n(state.level == 1 ? "item on" : "item"),
d: common_vendor.o(($event) => setType(1)),
e: common_vendor.t(state.summary.secondBrokerageUserCount || 0),
f: common_vendor.n(state.level == 2 ? "item on" : "item"),
g: common_vendor.o(($event) => setType(2)),
h: common_vendor.o(submitForm),
i: state.nickname,
j: common_vendor.o(($event) => state.nickname = $event.detail.value),
k: common_vendor.o(submitForm),
l: sort.value === "userCountDESC"
}, sort.value === "userCountDESC" ? {
m: common_vendor.o(($event) => setSort("userCount", "asc"))
} : sort.value === "userCountASC" ? {
o: common_vendor.o(($event) => setSort("userCount", "desc"))
} : {
p: common_vendor.o(($event) => setSort("userCount", "desc"))
}, {
n: sort.value === "userCountASC",
q: sort.value === "priceDESC"
}, sort.value === "priceDESC" ? {
r: common_vendor.o(($event) => setSort("price", "asc"))
} : sort.value === "priceASC" ? {
t: common_vendor.o(($event) => setSort("price", "desc"))
} : {
v: common_vendor.o(($event) => setSort("price", "desc"))
}, {
s: sort.value === "priceASC",
w: sort.value === "orderCountDESC"
}, sort.value === "orderCountDESC" ? {
x: common_vendor.o(($event) => setSort("orderCount", "asc"))
} : sort.value === "orderCountASC" ? {
z: common_vendor.o(($event) => setSort("orderCount", "desc"))
} : {
A: common_vendor.o(($event) => setSort("orderCount", "desc"))
}, {
y: sort.value === "orderCountASC",
B: common_vendor.f(state.pagination.list, (item, index, i0) => {
return {
a: item.avatar,
b: common_vendor.t(item.nickname),
c: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(item.brokerageTime, "yyyy-mm-dd hh:MM:ss")),
d: common_vendor.t(item.brokerageUserCount || 0),
e: common_vendor.t(item.orderCount || 0),
f: common_vendor.t(item.brokeragePrice || 0),
g: index
};
}),
C: state.pagination.list.length === 0
}, state.pagination.list.length === 0 ? {} : {}, {
D: common_vendor.n(state.scrollTop ? "team-wrap" : ""),
E: common_vendor.p({
title: "我的团队",
navbar: "inner"
}),
F: common_vendor.s(_ctx.__cssVars())
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b485cb53"]]);
_sfc_main.__runtimeHooks = 1;
wx.createPage(MiniProgramPage);
//# sourceMappingURL=team.js.map