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

  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
  4. const _sfc_main = {
  5. mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
  6. data() {
  7. return {
  8. currentTab: 0,
  9. tuiList: [],
  10. applyList: [
  11. { name: "周小艺", phone: "18899102278", time: "6小时", applyTime: "2025-03-20 11:00", status: "待审批" },
  12. { name: "周小艺", phone: "18899102278", time: "6小时", applyTime: "2025-03-20 11:00", status: "已驳回" },
  13. { name: "周小艺", phone: "18899102278", time: "6小时", applyTime: "2025-03-20 11:00", status: "已确认" },
  14. { name: "周小艺", phone: "18899102278", time: "6小时", applyTime: "2025-03-20 11:00", status: "待审批" }
  15. ],
  16. statusBarHeight: 0,
  17. navBarRealHeight: 0,
  18. tabBarHeight: 80,
  19. // px
  20. searchMode: false,
  21. searchText: ""
  22. };
  23. },
  24. computed: {
  25. navbarStyle() {
  26. return `padding-top: ${this.statusBarHeight}px;`;
  27. },
  28. filteredTuiList() {
  29. if (!this.searchText)
  30. return this.tuiList;
  31. const text = this.searchText.toLowerCase();
  32. return this.tuiList.filter(
  33. (item) => item.name && item.name.toLowerCase().includes(text) || item.phone && item.phone.toLowerCase().includes(text)
  34. );
  35. },
  36. filteredApplyList() {
  37. if (!this.searchText)
  38. return this.applyList;
  39. const text = this.searchText.toLowerCase();
  40. return this.applyList.filter(
  41. (item) => item.name && item.name.toLowerCase().includes(text) || item.phone && item.phone.toLowerCase().includes(text)
  42. );
  43. }
  44. },
  45. onLoad() {
  46. common_vendor.index.getSystemInfo({
  47. success: (res) => {
  48. this.statusBarHeight = res.statusBarHeight || 20;
  49. }
  50. });
  51. this.$nextTick(() => {
  52. common_vendor.index.createSelectorQuery().select(".navbar").boundingClientRect((rect) => {
  53. if (rect) {
  54. this.navBarRealHeight = rect.height;
  55. }
  56. }).exec();
  57. });
  58. this.fetchPromotionList();
  59. this.fetchPromotionApplyList();
  60. },
  61. onShow() {
  62. this.fetchPromotionList();
  63. this.fetchPromotionApplyList();
  64. },
  65. methods: {
  66. goBack() {
  67. common_vendor.index.navigateBack();
  68. },
  69. switchTab(idx) {
  70. this.currentTab = idx;
  71. },
  72. goTuiDetail(tui) {
  73. common_vendor.index.navigateTo({
  74. url: "/pages/manager/tui-detail",
  75. success: (res) => {
  76. res.eventChannel.emit("tuiDetail", tui);
  77. }
  78. });
  79. },
  80. goApplyDetail(apply) {
  81. common_vendor.index.navigateTo({
  82. url: "/pages/manager/tui-apply-detail",
  83. success: (res) => {
  84. res.eventChannel.emit("applyDetail", apply);
  85. }
  86. });
  87. },
  88. refreshData() {
  89. },
  90. async onRefresh() {
  91. await this.refreshData && this.refreshData();
  92. },
  93. async fetchPromotionList() {
  94. try {
  95. const res = await this.$api("getPromotionList", { pageSize: 1e3, current: 1 });
  96. if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
  97. this.tuiList = res.result.records.map((user) => ({
  98. name: user.name || user.nickName || "-",
  99. level1: 0,
  100. // 一级推广数,暂定
  101. level2: 0,
  102. // 二级推广数,暂定
  103. totalAmount: user.money || 0,
  104. commission: user.price || 0,
  105. phone: user.phone || ""
  106. }));
  107. }
  108. } catch (e) {
  109. common_vendor.index.showToast({ title: "获取推广官列表失败", icon: "none" });
  110. }
  111. },
  112. async fetchPromotionApplyList() {
  113. try {
  114. const res = await this.$api("getPromotionApplyListPage", { pageSize: 1e3, current: 1 });
  115. if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
  116. this.applyList = res.result.records.map((user) => ({
  117. id: user.id,
  118. name: user.name || user.nickName || "-",
  119. phone: user.phone || "",
  120. time: user.userTime || "",
  121. applyTime: user.createTime || "",
  122. status: user.status === 0 ? "待审批" : user.status === 1 ? "已确认" : user.status === 2 ? "已驳回" : ""
  123. }));
  124. }
  125. } catch (e) {
  126. common_vendor.index.showToast({ title: "获取申请列表失败", icon: "none" });
  127. }
  128. },
  129. onSearchIconClick() {
  130. this.searchMode = true;
  131. this.$nextTick(() => {
  132. this.$refs.searchInput && this.$refs.searchInput.focus();
  133. });
  134. },
  135. onClearSearch() {
  136. this.searchText = "";
  137. },
  138. onCancelSearch() {
  139. this.searchText = "";
  140. this.searchMode = false;
  141. }
  142. },
  143. onPullDownRefresh() {
  144. Promise.all([
  145. this.fetchPromotionList(),
  146. this.fetchPromotionApplyList()
  147. ]).finally(() => {
  148. common_vendor.index.stopPullDownRefresh();
  149. });
  150. }
  151. };
  152. if (!Array) {
  153. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  154. _easycom_uni_icons2();
  155. }
  156. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  157. if (!Math) {
  158. _easycom_uni_icons();
  159. }
  160. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  161. return common_vendor.e({
  162. a: common_vendor.p({
  163. type: "back",
  164. size: "24",
  165. color: "#222"
  166. }),
  167. b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
  168. c: common_vendor.s($options.navbarStyle),
  169. d: !$data.searchMode
  170. }, !$data.searchMode ? {
  171. e: common_vendor.n({
  172. active: $data.currentTab === 0
  173. }),
  174. f: common_vendor.o(($event) => $options.switchTab(0)),
  175. g: common_vendor.n({
  176. active: $data.currentTab === 1
  177. }),
  178. h: common_vendor.o(($event) => $options.switchTab(1)),
  179. i: common_vendor.o($options.onSearchIconClick),
  180. j: common_vendor.p({
  181. type: "search",
  182. size: "28",
  183. color: "#222"
  184. })
  185. } : common_vendor.e({
  186. k: common_vendor.p({
  187. type: "search",
  188. size: "22",
  189. color: "#999"
  190. }),
  191. l: $data.searchText,
  192. m: common_vendor.o(($event) => $data.searchText = $event.detail.value),
  193. n: $data.searchText
  194. }, $data.searchText ? {
  195. o: common_vendor.o($options.onClearSearch),
  196. p: common_vendor.p({
  197. type: "close",
  198. size: "22",
  199. color: "#ccc"
  200. })
  201. } : {}, {
  202. q: common_vendor.o((...args) => $options.onCancelSearch && $options.onCancelSearch(...args))
  203. }), {
  204. r: $data.navBarRealHeight + "px",
  205. s: $data.currentTab === 0
  206. }, $data.currentTab === 0 ? {
  207. t: common_vendor.f($options.filteredTuiList, (item, idx, i0) => {
  208. return {
  209. a: common_vendor.t(item.name),
  210. b: common_vendor.t(item.level1),
  211. c: common_vendor.t(item.level2),
  212. d: common_vendor.t(item.totalAmount),
  213. e: common_vendor.t(item.commission),
  214. f: idx,
  215. g: common_vendor.o(($event) => $options.goTuiDetail(item), idx)
  216. };
  217. })
  218. } : {}, {
  219. v: $data.currentTab === 1
  220. }, $data.currentTab === 1 ? {
  221. w: common_vendor.f($options.filteredApplyList, (item, idx, i0) => {
  222. return common_vendor.e({
  223. a: common_vendor.t(item.name),
  224. b: common_vendor.t(item.phone),
  225. c: common_vendor.t(item.time),
  226. d: common_vendor.t(item.applyTime),
  227. e: item.status === "待审批"
  228. }, item.status === "待审批" ? {} : item.status === "已驳回" ? {} : item.status === "已确认" ? {} : {}, {
  229. f: item.status === "已驳回",
  230. g: item.status === "已确认",
  231. h: item.status === "待审批"
  232. }, item.status === "待审批" ? {
  233. i: "0446c0b6-4-" + i0,
  234. j: common_vendor.p({
  235. type: "undo",
  236. size: "32",
  237. color: "#999"
  238. })
  239. } : {}, {
  240. k: item.status === "待审批"
  241. }, item.status === "待审批" ? {
  242. l: "0446c0b6-5-" + i0,
  243. m: common_vendor.p({
  244. type: "person",
  245. size: "32",
  246. color: "#999"
  247. })
  248. } : {}, {
  249. n: idx,
  250. o: common_vendor.o(($event) => $options.goApplyDetail(item), idx)
  251. });
  252. })
  253. } : {}, {
  254. x: $data.navBarRealHeight + $data.tabBarHeight + "px"
  255. });
  256. }
  257. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0446c0b6"]]);
  258. wx.createPage(MiniProgramPage);
  259. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/manager/tui.js.map