| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const utils_assets = require("../../utils/assets.js");
- const api_system_customer = require("../../api/system/customer.js");
- const api_auth_index = require("../../api/auth/index.js");
- const ErpTabBar = () => "../../components/erp-tab-bar.js";
- const ErpNavBar = () => "../../components/erp-nav-bar.js";
- const _sfc_main = {
- components: { ErpTabBar, ErpNavBar },
- data() {
- return {
- assets: utils_assets.assets,
- isLogin: false,
- customerInfo: null,
- orderStates: [
- { label: "待审核", icon: utils_assets.assets.minePendingReview },
- { label: "待签批", icon: utils_assets.assets.minePendingSign },
- { label: "生产中", icon: utils_assets.assets.mineProducing },
- { label: "已完成", icon: utils_assets.assets.mineCompleted }
- ],
- menuList: [
- { label: "用户协议", icon: utils_assets.assets.mineProtocol, id: "agreement" },
- { label: "隐私政策", icon: utils_assets.assets.minePrivacy, id: "privacy" },
- { label: "投诉与建议", icon: utils_assets.assets.mineComplaint, id: "complaint" },
- { label: "联系客服", icon: utils_assets.assets.mineService, id: "service" }
- ]
- };
- },
- onShow() {
- this.isLogin = !!common_vendor.index.getStorageSync("isLogin");
- if (this.isLogin) {
- this.loadCustomerInfo();
- }
- },
- methods: {
- async loadCustomerInfo() {
- try {
- const res = await api_system_customer.getMyInfo();
- this.customerInfo = res.data;
- } catch (e) {
- common_vendor.index.__f__("error", "at pages/mine/index.vue:129", "[mine] 加载客户信息失败", e);
- }
- },
- goToLogin() {
- common_vendor.index.reLaunch({ url: "/pages/login/index" });
- },
- // 跳转至设置页面
- goToSettings() {
- if (this.isLogin) {
- common_vendor.index.navigateTo({
- url: "/pages/mine/settings/index"
- });
- }
- },
- // 新增:跳转至订单列表
- goToOrderList(status) {
- if (!this.isLogin) {
- return this.goToLogin();
- }
- common_vendor.index.navigateTo({
- url: `/pages/order/list/index?tab=${status}`
- });
- },
- handleLogout() {
- common_vendor.index.showModal({
- title: "退出提示",
- content: "确认退出当前账号吗?",
- confirmColor: "#C1001C",
- success: async (res) => {
- if (res.confirm) {
- try {
- await api_auth_index.logout();
- } catch (e) {
- common_vendor.index.__f__("error", "at pages/mine/index.vue:162", "[mine] 退出登录接口失败", e);
- }
- common_vendor.index.removeStorageSync("token");
- common_vendor.index.removeStorageSync("isLogin");
- this.isLogin = false;
- common_vendor.index.reLaunch({ url: "/pages/login/index" });
- }
- }
- });
- },
- // 新增:菜单点击处理
- handleMenuClick(menu) {
- if (menu.id === "agreement") {
- common_vendor.index.navigateTo({ url: "/pages/mine/agreement/index" });
- } else if (menu.id === "privacy") {
- common_vendor.index.navigateTo({ url: "/pages/mine/privacy/index" });
- } else if (menu.id === "complaint") {
- common_vendor.index.navigateTo({ url: "/pages/mine/complaint/index" });
- } else if (menu.id === "service") {
- common_vendor.index.showModal({
- title: "联系客服",
- content: "客服电话:138-8888-8888",
- confirmText: "立即拨打",
- confirmColor: "#C1001C",
- cancelColor: "#999999",
- success: (res) => {
- if (res.confirm) {
- common_vendor.index.makePhoneCall({
- phoneNumber: "13888888888"
- });
- }
- }
- });
- }
- }
- }
- };
- if (!Array) {
- const _component_erp_nav_bar = common_vendor.resolveComponent("erp-nav-bar");
- const _component_erp_tab_bar = common_vendor.resolveComponent("erp-tab-bar");
- (_component_erp_nav_bar + _component_erp_tab_bar)();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: common_vendor.p({
- title: "个人中心",
- ["show-back"]: false,
- ["bg-color"]: "#C1001C",
- ["title-color"]: "#ffffff"
- }),
- b: $data.isLogin
- }, $data.isLogin ? common_vendor.e({
- c: $data.customerInfo && $data.customerInfo.avatarUrl ? $data.customerInfo.avatarUrl : "https://img.icons8.com/color/144/user.png",
- d: common_vendor.t($data.customerInfo ? $data.customerInfo.userName : ""),
- e: $data.customerInfo
- }, $data.customerInfo ? {
- f: common_vendor.t($data.customerInfo.authClientName || "无")
- } : {}, {
- g: common_vendor.t($data.customerInfo ? $data.customerInfo.phone : ""),
- h: $data.assets.mineSettings,
- i: common_vendor.o((...args) => $options.goToSettings && $options.goToSettings(...args), "d5")
- }) : {
- j: $data.assets.mineArrow,
- k: common_vendor.o((...args) => $options.goToLogin && $options.goToLogin(...args), "f2")
- }, {
- l: $data.assets.mineArrow,
- m: common_vendor.o(($event) => $options.goToOrderList(0), "96"),
- n: common_vendor.f($data.orderStates, (item, index, i0) => {
- return {
- a: item.icon,
- b: common_vendor.t(item.label),
- c: index,
- d: common_vendor.o(($event) => $options.goToOrderList(index + 1), index)
- };
- }),
- o: common_vendor.f($data.menuList, (menu, index, i0) => {
- return {
- a: menu.icon,
- b: common_vendor.t(menu.label),
- c: index,
- d: common_vendor.o(($event) => $options.handleMenuClick(menu), index)
- };
- }),
- p: $data.assets.mineArrow,
- q: $data.isLogin
- }, $data.isLogin ? {
- r: common_vendor.o((...args) => $options.handleLogout && $options.handleLogout(...args), "0c")
- } : {}, {
- s: common_vendor.p({
- active: "mine"
- })
- });
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-569e925a"]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine/index.js.map
|