index.js 4.8 KB

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