mine.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const utils_assets = require("../../utils/assets.js");
  4. const ErpTabBar = () => "../../components/erp-tab-bar/erp-tab-bar.js";
  5. const _sfc_main = {
  6. components: {
  7. ErpTabBar
  8. },
  9. data() {
  10. return {
  11. assets: utils_assets.assets,
  12. isLogin: false,
  13. // 控制登录状态
  14. orderStates: [
  15. { label: "待审核", icon: utils_assets.assets.minePendingReview },
  16. { label: "待签批", icon: utils_assets.assets.minePendingSign },
  17. { label: "生产中", icon: utils_assets.assets.mineProducing },
  18. { label: "已完成", icon: utils_assets.assets.mineCompleted }
  19. ],
  20. menuList: [
  21. { label: "用户协议", icon: utils_assets.assets.mineProtocol, id: "agreement" },
  22. { label: "隐私政策", icon: utils_assets.assets.minePrivacy, id: "privacy" },
  23. { label: "投诉与建议", icon: utils_assets.assets.mineComplaint, id: "complaint" },
  24. { label: "联系客服", icon: utils_assets.assets.mineService, id: "service" }
  25. ]
  26. };
  27. },
  28. onShow() {
  29. this.isLogin = !!common_vendor.index.getStorageSync("isLogin");
  30. },
  31. methods: {
  32. goToLogin() {
  33. common_vendor.index.navigateTo({ url: "/pages/login/login?redirect=" + encodeURIComponent("/pages/mine/mine") });
  34. },
  35. // 跳转至设置页面
  36. goToSettings() {
  37. if (this.isLogin) {
  38. common_vendor.index.navigateTo({
  39. url: "/pages/mine/settings"
  40. });
  41. }
  42. },
  43. // 新增:跳转至订单列表
  44. goToOrderList(status) {
  45. if (!this.isLogin) {
  46. return this.goToLogin();
  47. }
  48. common_vendor.index.navigateTo({
  49. url: `/pages/order/list?tab=${status}`
  50. });
  51. },
  52. handleLogout() {
  53. common_vendor.index.showModal({
  54. title: "退出提示",
  55. content: "确认退出当前账号吗?",
  56. confirmColor: "#C1001C",
  57. success: (res) => {
  58. if (res.confirm) {
  59. common_vendor.index.removeStorageSync("isLogin");
  60. this.isLogin = false;
  61. }
  62. }
  63. });
  64. },
  65. // 新增:菜单点击处理
  66. handleMenuClick(menu) {
  67. if (menu.id === "agreement") {
  68. common_vendor.index.navigateTo({ url: "/pages/mine/agreement" });
  69. } else if (menu.id === "privacy") {
  70. common_vendor.index.navigateTo({ url: "/pages/mine/privacy" });
  71. } else if (menu.id === "complaint") {
  72. common_vendor.index.navigateTo({ url: "/pages/mine/complaint" });
  73. } else if (menu.id === "service") {
  74. common_vendor.index.showModal({
  75. title: "联系客服",
  76. content: "客服电话:138-8888-8888",
  77. confirmText: "立即拨打",
  78. confirmColor: "#C1001C",
  79. cancelColor: "#999999",
  80. success: (res) => {
  81. if (res.confirm) {
  82. common_vendor.index.makePhoneCall({
  83. phoneNumber: "13888888888"
  84. });
  85. }
  86. }
  87. });
  88. }
  89. }
  90. }
  91. };
  92. if (!Array) {
  93. const _easycom_erp_tab_bar2 = common_vendor.resolveComponent("erp-tab-bar");
  94. _easycom_erp_tab_bar2();
  95. }
  96. const _easycom_erp_tab_bar = () => "../../components/erp-tab-bar/erp-tab-bar.js";
  97. if (!Math) {
  98. _easycom_erp_tab_bar();
  99. }
  100. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  101. return common_vendor.e({
  102. a: $data.isLogin
  103. }, $data.isLogin ? {
  104. b: $data.assets.mineSettings,
  105. c: common_vendor.o((...args) => $options.goToSettings && $options.goToSettings(...args))
  106. } : {
  107. d: $data.assets.mineArrow,
  108. e: common_vendor.o((...args) => $options.goToLogin && $options.goToLogin(...args))
  109. }, {
  110. f: $data.assets.mineArrow,
  111. g: common_vendor.o(($event) => $options.goToOrderList(0)),
  112. h: common_vendor.f($data.orderStates, (item, index, i0) => {
  113. return {
  114. a: item.icon,
  115. b: common_vendor.t(item.label),
  116. c: index,
  117. d: common_vendor.o(($event) => $options.goToOrderList(index + 1), index)
  118. };
  119. }),
  120. i: common_vendor.f($data.menuList, (menu, index, i0) => {
  121. return {
  122. a: menu.icon,
  123. b: common_vendor.t(menu.label),
  124. c: index,
  125. d: common_vendor.o(($event) => $options.handleMenuClick(menu), index)
  126. };
  127. }),
  128. j: $data.assets.mineArrow,
  129. k: $data.isLogin
  130. }, $data.isLogin ? {
  131. l: common_vendor.o((...args) => $options.handleLogout && $options.handleLogout(...args))
  132. } : {}, {
  133. m: common_vendor.p({
  134. active: "mine"
  135. })
  136. });
  137. }
  138. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7c2ebfa5"]]);
  139. wx.createPage(MiniProgramPage);
  140. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine/mine.js.map