爱简收旧衣按件回收前端代码仓库
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.
 
 
 
 

259 lines
8.3 KiB

"use strict";
const common_vendor = require("../../common/vendor.js");
const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
const _sfc_main = {
mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
data() {
return {
currentTab: 0,
tuiList: [],
applyList: [
{ name: "周小艺", phone: "18899102278", time: "6小时", applyTime: "2025-03-20 11:00", status: "待审批" },
{ name: "周小艺", phone: "18899102278", time: "6小时", applyTime: "2025-03-20 11:00", status: "已驳回" },
{ name: "周小艺", phone: "18899102278", time: "6小时", applyTime: "2025-03-20 11:00", status: "已确认" },
{ name: "周小艺", phone: "18899102278", time: "6小时", applyTime: "2025-03-20 11:00", status: "待审批" }
],
statusBarHeight: 0,
navBarRealHeight: 0,
tabBarHeight: 80,
// px
searchMode: false,
searchText: ""
};
},
computed: {
navbarStyle() {
return `padding-top: ${this.statusBarHeight}px;`;
},
filteredTuiList() {
if (!this.searchText)
return this.tuiList;
const text = this.searchText.toLowerCase();
return this.tuiList.filter(
(item) => item.name && item.name.toLowerCase().includes(text) || item.phone && item.phone.toLowerCase().includes(text)
);
},
filteredApplyList() {
if (!this.searchText)
return this.applyList;
const text = this.searchText.toLowerCase();
return this.applyList.filter(
(item) => item.name && item.name.toLowerCase().includes(text) || item.phone && item.phone.toLowerCase().includes(text)
);
}
},
onLoad() {
common_vendor.index.getSystemInfo({
success: (res) => {
this.statusBarHeight = res.statusBarHeight || 20;
}
});
this.$nextTick(() => {
common_vendor.index.createSelectorQuery().select(".navbar").boundingClientRect((rect) => {
if (rect) {
this.navBarRealHeight = rect.height;
}
}).exec();
});
this.fetchPromotionList();
this.fetchPromotionApplyList();
},
onShow() {
this.fetchPromotionList();
this.fetchPromotionApplyList();
},
methods: {
goBack() {
common_vendor.index.navigateBack();
},
switchTab(idx) {
this.currentTab = idx;
},
goTuiDetail(tui) {
common_vendor.index.navigateTo({
url: "/pages/manager/tui-detail",
success: (res) => {
res.eventChannel.emit("tuiDetail", tui);
}
});
},
goApplyDetail(apply) {
common_vendor.index.navigateTo({
url: "/pages/manager/tui-apply-detail",
success: (res) => {
res.eventChannel.emit("applyDetail", apply);
}
});
},
refreshData() {
},
async onRefresh() {
await this.refreshData && this.refreshData();
},
async fetchPromotionList() {
try {
const res = await this.$api("getPromotionList", { pageSize: 1e3, current: 1 });
if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
this.tuiList = res.result.records.map((user) => ({
name: user.name || user.nickName || "-",
level1: 0,
// 一级推广数,暂定
level2: 0,
// 二级推广数,暂定
totalAmount: user.money || 0,
commission: user.price || 0,
phone: user.phone || ""
}));
}
} catch (e) {
common_vendor.index.showToast({ title: "获取推广官列表失败", icon: "none" });
}
},
async fetchPromotionApplyList() {
try {
const res = await this.$api("getPromotionApplyListPage", { pageSize: 1e3, current: 1 });
if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
this.applyList = res.result.records.map((user) => ({
id: user.id,
name: user.name || user.nickName || "-",
phone: user.phone || "",
time: user.userTime || "",
applyTime: user.createTime || "",
status: user.status === 0 ? "待审批" : user.status === 1 ? "已确认" : user.status === 2 ? "已驳回" : ""
}));
}
} catch (e) {
common_vendor.index.showToast({ title: "获取申请列表失败", icon: "none" });
}
},
onSearchIconClick() {
this.searchMode = true;
this.$nextTick(() => {
this.$refs.searchInput && this.$refs.searchInput.focus();
});
},
onClearSearch() {
this.searchText = "";
},
onCancelSearch() {
this.searchText = "";
this.searchMode = false;
}
},
onPullDownRefresh() {
Promise.all([
this.fetchPromotionList(),
this.fetchPromotionApplyList()
]).finally(() => {
common_vendor.index.stopPullDownRefresh();
});
}
};
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 common_vendor.e({
a: common_vendor.p({
type: "back",
size: "24",
color: "#222"
}),
b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
c: common_vendor.s($options.navbarStyle),
d: !$data.searchMode
}, !$data.searchMode ? {
e: common_vendor.n({
active: $data.currentTab === 0
}),
f: common_vendor.o(($event) => $options.switchTab(0)),
g: common_vendor.n({
active: $data.currentTab === 1
}),
h: common_vendor.o(($event) => $options.switchTab(1)),
i: common_vendor.o($options.onSearchIconClick),
j: common_vendor.p({
type: "search",
size: "28",
color: "#222"
})
} : common_vendor.e({
k: common_vendor.p({
type: "search",
size: "22",
color: "#999"
}),
l: $data.searchText,
m: common_vendor.o(($event) => $data.searchText = $event.detail.value),
n: $data.searchText
}, $data.searchText ? {
o: common_vendor.o($options.onClearSearch),
p: common_vendor.p({
type: "close",
size: "22",
color: "#ccc"
})
} : {}, {
q: common_vendor.o((...args) => $options.onCancelSearch && $options.onCancelSearch(...args))
}), {
r: $data.navBarRealHeight + "px",
s: $data.currentTab === 0
}, $data.currentTab === 0 ? {
t: common_vendor.f($options.filteredTuiList, (item, idx, i0) => {
return {
a: common_vendor.t(item.name),
b: common_vendor.t(item.level1),
c: common_vendor.t(item.level2),
d: common_vendor.t(item.totalAmount),
e: common_vendor.t(item.commission),
f: idx,
g: common_vendor.o(($event) => $options.goTuiDetail(item), idx)
};
})
} : {}, {
v: $data.currentTab === 1
}, $data.currentTab === 1 ? {
w: common_vendor.f($options.filteredApplyList, (item, idx, i0) => {
return common_vendor.e({
a: common_vendor.t(item.name),
b: common_vendor.t(item.phone),
c: common_vendor.t(item.time),
d: common_vendor.t(item.applyTime),
e: item.status === "待审批"
}, item.status === "待审批" ? {} : item.status === "已驳回" ? {} : item.status === "已确认" ? {} : {}, {
f: item.status === "已驳回",
g: item.status === "已确认",
h: item.status === "待审批"
}, item.status === "待审批" ? {
i: "0446c0b6-4-" + i0,
j: common_vendor.p({
type: "undo",
size: "32",
color: "#999"
})
} : {}, {
k: item.status === "待审批"
}, item.status === "待审批" ? {
l: "0446c0b6-5-" + i0,
m: common_vendor.p({
type: "person",
size: "32",
color: "#999"
})
} : {}, {
n: idx,
o: common_vendor.o(($event) => $options.goApplyDetail(item), idx)
});
})
} : {}, {
x: $data.navBarRealHeight + $data.tabBarHeight + "px"
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0446c0b6"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/manager/tui.js.map