|
|
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
- const common_assets = require("../../common/assets.js");
- const _sfc_main = {
- mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
- data() {
- return {
- value: 2,
- currentTab: 1,
- login_status: false,
- userInfo: {},
- orderTabs: [
- { name: "全部" },
- { name: "进行中", badge: "2" },
- { name: "已完成" }
- ],
- functionList: [
- // { name: '推广官', icon: '/static/my/promote.png' },
- { name: "我的地址", icon: "/static/my/地址.png" },
- { name: "联系客服", icon: "/static/my/客服.png" },
- { name: "修改信息", icon: "/static/my/修改信息.png" },
- { name: "退出登录", icon: "/static/my/退出登录.png" }
- ],
- orderList: [],
- totalOrders: 0
- // 添加累计回收单数字段
- };
- },
- methods: {
- async onRefresh() {
- common_vendor.index.__f__("log", "at pages/component/my.vue:249", "开始刷新");
- try {
- await this.fetchUserInfo();
- common_vendor.index.__f__("log", "at pages/component/my.vue:252", "刷新完成");
- return true;
- } catch (error) {
- common_vendor.index.__f__("error", "at pages/component/my.vue:255", "刷新失败", error);
- throw error;
- }
- },
- changeTo(e) {
- this.value = e;
- common_vendor.index.__f__("log", "at pages/component/my.vue:261", e, "111");
- if (e == 0) {
- common_vendor.index.reLaunch({
- url: "/pages/component/home"
- });
- } else if (e == 1) {
- common_vendor.index.reLaunch({
- url: "/pages/component/recycle"
- });
- }
- },
- goWithdraw() {
- common_vendor.index.navigateTo({
- url: "/pages/subcomponent/wallet"
- });
- },
- viewAllOrders() {
- common_vendor.index.navigateTo({
- url: "/pages/subcomponent/order"
- });
- },
- switchTab(index) {
- this.currentTab = index;
- this.fetchOrderList();
- },
- handleFunction(index) {
- const pages = [
- // '/pages/subcomponent/promotion',
- "/pages/subcomponent/select",
- "/pages/subcomponent/admin_faq",
- "/pages/subcomponent/edit_profile",
- "logout"
- ];
- if (pages[index] === "logout") {
- common_vendor.index.showModal({
- title: "提示",
- content: "确定要退出登录吗?",
- success: (res) => {
- if (res.confirm) {
- getApp().globalData.login_status = false;
- common_vendor.index.__f__("log", "at pages/component/my.vue:302", getApp().globalData.login_status);
- this.login_status = false;
- common_vendor.index.removeStorageSync("token");
- }
- }
- });
- return;
- }
- common_vendor.index.navigateTo({
- url: pages[index]
- });
- },
- logout() {
- common_vendor.index.reLaunch({
- url: "/pages/index/index"
- });
- },
- onShareCommission() {
- common_vendor.index.showToast({ title: "分享赚佣金", icon: "none" });
- common_vendor.index.navigateTo({ url: "/pages/subcomponent/promotion" });
- },
- goOrderManage() {
- common_vendor.index.navigateTo({ url: "/pages/manager/order" });
- },
- goAppletUserManage() {
- common_vendor.index.navigateTo({ url: "/pages/manager/user" });
- },
- goStaffManage() {
- common_vendor.index.navigateTo({ url: "/pages/manager/staff" });
- },
- goTuiManage() {
- common_vendor.index.navigateTo({ url: "/pages/manager/tui" });
- },
- fetchUserInfo() {
- if (common_vendor.index.getStorageSync("token")) {
- this.login_status = getApp().globalData.login_status;
- this.$api("getUserByToken", {}, (res) => {
- if (res.code == 200) {
- this.userInfo = res.result;
- }
- });
- } else {
- this.login_status = false;
- }
- },
- fetchOrderList() {
- let status = "";
- if (this.currentTab === 1)
- status = 1;
- if (this.currentTab === 2)
- status = 3;
- const params = { pageSize: 1, current: 1 };
- if (status !== "")
- params.status = status;
- this.$api && this.$api("getOrderListPage", params, (res) => {
- if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
- this.orderList = res.result.records;
- } else {
- this.orderList = [];
- }
- });
- },
- getTotalOrders() {
- this.$api && this.$api("getOrderListPage", {}, (res) => {
- if (res && res.code === 200 && res.result && Array.isArray(res.result.records)) {
- this.totalOrders = res.result.total || 0;
- } else {
- this.totalOrders = 0;
- }
- });
- }
- },
- computed: {
- customStyle() {
- return {
- // height: '80rpx',
- width: "70%"
- };
- },
- bannerList() {
- return getApp().globalData.bannerList || [];
- }
- },
- onLoad() {
- common_vendor.index.$on("refreshUserInfo", () => {
- this.fetchUserInfo();
- });
- this.fetchUserInfo();
- this.fetchOrderList();
- this.getTotalOrders();
- common_vendor.index.$on("bannerListUpdated", () => {
- this.$forceUpdate && this.$forceUpdate();
- });
- if (getApp().globalData.bannerList && getApp().globalData.bannerList.length > 0) {
- this.$forceUpdate && this.$forceUpdate();
- }
- },
- onShow() {
- this.fetchUserInfo();
- this.getTotalOrders();
- },
- onPullDownRefresh() {
- this.fetchUserInfo();
- this.getTotalOrders();
- setTimeout(() => {
- common_vendor.index.stopPullDownRefresh();
- common_vendor.index.showToast({
- title: "刷新成功",
- icon: "success",
- duration: 2e3
- });
- }, 1e3);
- },
- onUnload() {
- common_vendor.index.$off("bannerListUpdated");
- }
- };
- if (!Array) {
- const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
- const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
- const _easycom_uv_tabbar_item2 = common_vendor.resolveComponent("uv-tabbar-item");
- const _easycom_uv_tabbar2 = common_vendor.resolveComponent("uv-tabbar");
- (_easycom_uv_button2 + _easycom_uni_icons2 + _easycom_uv_tabbar_item2 + _easycom_uv_tabbar2)();
- }
- const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
- const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
- const _easycom_uv_tabbar_item = () => "../../uni_modules/uv-tabbar/components/uv-tabbar-item/uv-tabbar-item.js";
- const _easycom_uv_tabbar = () => "../../uni_modules/uv-tabbar/components/uv-tabbar/uv-tabbar.js";
- if (!Math) {
- (_easycom_uv_button + _easycom_uni_icons + _easycom_uv_tabbar_item + _easycom_uv_tabbar)();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: common_vendor.f($options.bannerList, (item, index, i0) => {
- return {
- a: item.image,
- b: item.id || index
- };
- }),
- b: !$data.login_status
- }, !$data.login_status ? {
- c: common_assets._imports_0$2
- } : {}, {
- d: !$data.login_status
- }, !$data.login_status ? {
- e: common_vendor.o($options.logout),
- f: common_vendor.p({
- type: "primary",
- text: "立即登录",
- ["custom-style"]: $options.customStyle,
- color: "linear-gradient(to right, rgb(255, 190, 61), rgb(255, 171, 2))",
- shape: "circle"
- })
- } : {}, {
- g: $data.login_status
- }, $data.login_status ? {
- h: $data.userInfo.headImage,
- i: common_vendor.t($data.userInfo.nickName),
- j: common_vendor.t($data.userInfo.intentioCode),
- k: common_vendor.t($data.userInfo.money),
- l: common_vendor.p({
- type: "right",
- size: "10",
- color: "#df8155"
- }),
- m: common_vendor.o((...args) => $options.goWithdraw && $options.goWithdraw(...args)),
- n: common_vendor.t($data.totalOrders)
- } : {}, {
- o: $data.login_status
- }, $data.login_status ? {
- p: common_vendor.o((...args) => $options.onShareCommission && $options.onShareCommission(...args))
- } : {}, {
- q: $data.login_status
- }, $data.login_status ? {
- r: common_vendor.f($data.orderTabs, (tab, index, i0) => {
- return {
- a: common_vendor.t(tab.name),
- b: index,
- c: $data.currentTab === index ? 1 : "",
- d: common_vendor.o(($event) => $options.switchTab(index), index)
- };
- }),
- s: common_vendor.o(() => {
- }),
- t: common_vendor.f($data.orderList, (order, k0, i0) => {
- return {
- a: common_vendor.t(order.ordeNo),
- b: order.image || "/static/回收/衣物.png",
- c: common_vendor.t(order.num || 1),
- d: common_vendor.t(order.onePrice || 0),
- e: common_vendor.t(order.price),
- f: common_vendor.t(order.status === 0 ? "【在线预约】" : order.status === 1 ? "【快递上门】" : order.status === 2 ? "【透明质检】" : order.status === 3 ? "【现金打款】" : ""),
- g: common_vendor.t(order.goTime),
- h: order.id
- };
- }),
- v: common_vendor.o((...args) => $options.viewAllOrders && $options.viewAllOrders(...args))
- } : {}, {
- w: $data.login_status && ($data.userInfo.isOrderRole === "Y" || $data.userInfo.isAppletUserRole === "Y" || $data.userInfo.isUserRole === "Y" || $data.userInfo.isTuiRole === "Y")
- }, $data.login_status && ($data.userInfo.isOrderRole === "Y" || $data.userInfo.isAppletUserRole === "Y" || $data.userInfo.isUserRole === "Y" || $data.userInfo.isTuiRole === "Y") ? common_vendor.e({
- x: $data.userInfo.isOrderRole === "Y"
- }, $data.userInfo.isOrderRole === "Y" ? {
- y: common_assets._imports_1$1,
- z: common_vendor.p({
- type: "right",
- size: "15"
- }),
- A: common_vendor.o((...args) => $options.goOrderManage && $options.goOrderManage(...args))
- } : {}, {
- B: $data.userInfo.isAppletUserRole === "Y"
- }, $data.userInfo.isAppletUserRole === "Y" ? {
- C: common_assets._imports_2$1,
- D: common_vendor.p({
- type: "right",
- size: "15"
- }),
- E: common_vendor.o((...args) => $options.goAppletUserManage && $options.goAppletUserManage(...args))
- } : {}, {
- F: $data.userInfo.isUserRole === "Y"
- }, $data.userInfo.isUserRole === "Y" ? {
- G: common_assets._imports_3,
- H: common_vendor.p({
- type: "right",
- size: "15"
- }),
- I: common_vendor.o((...args) => $options.goStaffManage && $options.goStaffManage(...args))
- } : {}, {
- J: $data.userInfo.isTuiRole === "Y"
- }, $data.userInfo.isTuiRole === "Y" ? {
- K: common_assets._imports_4,
- L: common_vendor.p({
- type: "right",
- size: "15"
- }),
- M: common_vendor.o((...args) => $options.goTuiManage && $options.goTuiManage(...args))
- } : {}) : {}, {
- N: $data.login_status
- }, $data.login_status ? {
- O: common_vendor.f($data.functionList, (item, index, i0) => {
- return {
- a: item.icon,
- b: common_vendor.t(item.name),
- c: "6cb840e8-6-" + i0,
- d: index,
- e: common_vendor.o(($event) => $options.handleFunction(index), index)
- };
- }),
- P: common_vendor.p({
- type: "right",
- size: "15"
- })
- } : {}, {
- Q: common_assets._imports_5,
- R: common_assets._imports_6,
- S: common_vendor.p({
- text: "首页"
- }),
- T: common_assets._imports_7,
- U: common_assets._imports_8,
- V: common_vendor.p({
- text: "回收"
- }),
- W: common_assets._imports_9,
- X: common_assets._imports_10,
- Y: common_vendor.p({
- text: "我的"
- }),
- Z: common_vendor.o($options.changeTo),
- aa: common_vendor.p({
- value: $data.value,
- fixed: true
- })
- });
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6cb840e8"]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/component/my.js.map
|