index.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 _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.reLaunch({ url: "/pages/login/index" });
  34. },
  35. // 跳转至设置页面
  36. goToSettings() {
  37. if (this.isLogin) {
  38. common_vendor.index.navigateTo({
  39. url: "/pages/mine/settings/index"
  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/index?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/index" });
  69. } else if (menu.id === "privacy") {
  70. common_vendor.index.navigateTo({ url: "/pages/mine/privacy/index" });
  71. } else if (menu.id === "complaint") {
  72. common_vendor.index.navigateTo({ url: "/pages/mine/complaint/index" });
  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 _component_erp_tab_bar = common_vendor.resolveComponent("erp-tab-bar");
  94. _component_erp_tab_bar();
  95. }
  96. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  97. return common_vendor.e({
  98. a: $data.isLogin
  99. }, $data.isLogin ? {
  100. b: $data.assets.mineSettings,
  101. c: common_vendor.o((...args) => $options.goToSettings && $options.goToSettings(...args), "d8")
  102. } : {
  103. d: $data.assets.mineArrow,
  104. e: common_vendor.o((...args) => $options.goToLogin && $options.goToLogin(...args), "c3")
  105. }, {
  106. f: $data.assets.mineArrow,
  107. g: common_vendor.o(($event) => $options.goToOrderList(0), "11"),
  108. h: common_vendor.f($data.orderStates, (item, index, i0) => {
  109. return {
  110. a: item.icon,
  111. b: common_vendor.t(item.label),
  112. c: index,
  113. d: common_vendor.o(($event) => $options.goToOrderList(index + 1), index)
  114. };
  115. }),
  116. i: common_vendor.f($data.menuList, (menu, index, i0) => {
  117. return {
  118. a: menu.icon,
  119. b: common_vendor.t(menu.label),
  120. c: index,
  121. d: common_vendor.o(($event) => $options.handleMenuClick(menu), index)
  122. };
  123. }),
  124. j: $data.assets.mineArrow,
  125. k: $data.isLogin
  126. }, $data.isLogin ? {
  127. l: common_vendor.o((...args) => $options.handleLogout && $options.handleLogout(...args), "78")
  128. } : {}, {
  129. m: common_vendor.p({
  130. active: "mine"
  131. })
  132. });
  133. }
  134. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-569e925a"]]);
  135. wx.createPage(MiniProgramPage);
  136. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine/index.js.map