"use strict"; const common_vendor = require("../../common/vendor.js"); const store_modules_user = require("../../store/modules/user.js"); const api_booking_users_index = require("../../api/booking/users/index.js"); const api_cms_mpMenu_index = require("../../api/cms/mp-menu/index.js"); const api_booking_userCard_index = require("../../api/booking/userCard/index.js"); const api_shop_users_index = require("../../api/shop/users/index.js"); const utils_common = require("../../utils/common.js"); const api_passport_login_index = require("../../api/passport/login/index.js"); const store_modules_tenant = require("../../store/modules/tenant.js"); const tenantStore = store_modules_tenant.useTenantStore(); const userStore = store_modules_user.useUserStore(); const _sfc_main = { data() { return { statusBarHeight: 104, isLogin: false, userInfo: {}, fields: {}, logo: "", bookingUser: {}, merchantList: [], server: [], order: [], hideUser: true, hideTools: true, // 是否拥有场馆管理员权限 hasMerchantRole: false, // 是否拥有场馆职员权限 hasMerchantClerkRole: false, // 是否拥有超级管理员权限 hasSuperAdminRole: false }; }, onLoad() { this.reload(); }, methods: { async reload(e) { const app = this; common_vendor.index.getSystemInfo({ success(data) { if (data) { app.statusBarHeight = data.statusBarHeight + 50; } } }); const tenantInfo = await tenantStore.fetchTenantInfo(); app.logo = tenantInfo.websiteLogo; if (tenantInfo.fields) { tenantInfo.fields.map((d) => { const key = d.name; app.fields[key] = d.value; }); } const userInfo = await userStore.fetchUserInfo(); if (Object.keys(userInfo).length > 0) { app.isLogin = true; app.userInfo = userInfo; common_vendor.index.setStorageSync("user_id", app.userInfo.userId); app.hasMerchantRole = userInfo.roles.find((d) => d.roleCode === "merchant"); app.hasMerchantClerkRole = userInfo.roles.find((d) => d.roleCode === "merchantClerk"); app.hasSuperAdminRole = userInfo.roles.find((d) => d.roleCode === "superAdmin"); api_booking_users_index.getByPhone({ phone: userInfo.phone }).then((data) => { if (data) { app.hideUser = false; app.userInfo.ouid = data.uid; common_vendor.index.setStorageSync("ouid", data.uid); app.userInfo = Object.assign({}, app.userInfo, data); } }); if (!common_vendor.index.getStorageSync("openid")) { common_vendor.index.login({ success: (res) => { api_passport_login_index.getWxOpenId({ code: res.code }).then((response) => { common_vendor.index.setStorageSync("openid", response.openid); api_shop_users_index.updateUsers({ uid: app.userInfo.ouid, openid: response.openid, sessionKey: response.session_key, unionid: response.unionid }); }); } }); } } else { app.isLogin = false; app.userInfo = {}; } api_cms_mpMenu_index.pageMpMenu({ type: 0, limit: 100 }).then((res) => { app.order = res.list.filter((d) => d.rows == 0); app.server = res.list.filter((d) => d.rows == 1); if (!app.hasMerchantRole && !app.hasMerchantClerkRole) { app.server = res.list.filter((d) => d.rows == 1 && d.adminShow == 0); } app.hideTools = false; }).catch(() => { common_vendor.index.showToast({ title: "请检查您的网络.", icon: "none" }); app.hideTools = false; }); api_booking_userCard_index.pageUserCard({ payStatus: 1, userId: common_vendor.index.getStorageSync("user_id") }).then((res) => { console.log("res8888889: ", res); app.userInfo.cards = res.count; app.userInfo.coupon = 1; }); }, navTo(item) { if (!this.isLogin) { this.$refs.login.open("bottom"); return false; } else { utils_common.openUrl(item); } }, // 弹出登录提示框 openLogin() { if (!this.isLogin) { this.$refs.login.open("bottom"); return false; } } } }; if (!Array) { const _easycom_ws_user_card2 = common_vendor.resolveComponent("ws-user-card"); const _easycom_uv_skeleton2 = common_vendor.resolveComponent("uv-skeleton"); const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card"); const _easycom_ws_my_asset2 = common_vendor.resolveComponent("ws-my-asset"); const _easycom_uni_list_item2 = common_vendor.resolveComponent("uni-list-item"); const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list"); const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login"); const _easycom_ws_logout2 = common_vendor.resolveComponent("ws-logout"); (_easycom_ws_user_card2 + _easycom_uv_skeleton2 + _easycom_uni_card2 + _easycom_ws_my_asset2 + _easycom_uni_list_item2 + _easycom_uni_list2 + _easycom_ws_login2 + _easycom_ws_logout2)(); } const _easycom_ws_user_card = () => "../../uni_modules/ws-user-card/components/ws-user-card/ws-user-card.js"; const _easycom_uv_skeleton = () => "../../uni_modules/uv-skeleton/components/uv-skeleton/uv-skeleton.js"; const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js"; const _easycom_ws_my_asset = () => "../../uni_modules/ws-my-asset/components/ws-my-asset/ws-my-asset.js"; const _easycom_uni_list_item = () => "../../uni_modules/uni-list/components/uni-list-item/uni-list-item.js"; const _easycom_uni_list = () => "../../uni_modules/uni-list/components/uni-list/uni-list.js"; const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js"; const _easycom_ws_logout = () => "../../uni_modules/ws-logout/components/ws-logout/ws-logout.js"; if (!Math) { (_easycom_ws_user_card + _easycom_uv_skeleton + _easycom_uni_card + _easycom_ws_my_asset + _easycom_uni_list_item + _easycom_uni_list + _easycom_ws_login + _easycom_ws_logout)(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: common_vendor.s("margin-top: " + $data.statusBarHeight + "px"), b: common_vendor.o($options.openLogin), c: common_vendor.p({ data: $data.userInfo, ["is-login"]: $data.isLogin }), d: $data.hideTools }, $data.hideTools ? { e: common_vendor.p({ rows: "2", loading: $data.hideTools, title: false }), f: common_vendor.p({ border: false, padding: "18px 8px" }), g: common_vendor.p({ rows: "9", loading: $data.hideTools, title: false }), h: common_vendor.p({ border: false, padding: "18px 8px" }) } : common_vendor.e({ i: common_vendor.o($options.openLogin), j: common_vendor.p({ data: $data.userInfo, ["is-login"]: $data.isLogin }), k: $data.hasMerchantRole || $data.hasMerchantClerkRole }, $data.hasMerchantRole || $data.hasMerchantClerkRole ? { l: common_vendor.f($data.server, (item, index, i0) => { return { a: common_vendor.t(item.title), b: item.color ? item.color : "#333333", c: common_vendor.o(($event) => $options.navTo(item), index), d: "a9018ea2-8-" + i0 + ",a9018ea2-7", e: common_vendor.p({ thumb: item.icon, link: true }), f: index }; }), m: common_vendor.p({ border: false }) } : { n: common_vendor.f($data.server, (item, index, i0) => { return { a: common_vendor.t(item.title), b: item.color ? item.color : "#333333", c: common_vendor.o(($event) => $options.navTo(item), index), d: "a9018ea2-10-" + i0 + ",a9018ea2-9", e: common_vendor.p({ thumb: item.icon, link: true }), f: index }; }), o: common_vendor.p({ border: false }) }, { p: common_vendor.p({ border: false, padding: 0 }), q: common_vendor.sr("login", "a9018ea2-11"), r: common_vendor.o($options.reload), s: common_vendor.p({ logo: $data.logo }), t: $data.isLogin }, $data.isLogin ? { v: common_vendor.o($options.reload) } : {})); } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/pages/user/user.vue"]]); wx.createPage(MiniProgramPage);