|
|
|
|
import{J as e,B as a,z as t,s,C as n,K as l,y as i,L as o,o as u,c as r,w as d,n as c,e as f,i as m,a as g,f as p,t as h,b as y,d as k,F as x,g as _,r as T,k as L,j as v}from"./index-ae8bbb19.js";import{A}from"./index.0c0be40a.js";import{R as b}from"./index.b9e5c444.js";import{C}from"./index.88bc1a11.js";import{i as j,a as w}from"./user.421e3ae2.js";import{t as I}from"./order.76bebd87.js";import{_ as z}from"./_plugin-vue_export-helper.1b428a4d.js";import"./index.c0835ba6.js";const D=""+new URL("user-header2-307aec49.png",import.meta.url).href,P=[{id:"all",name:"全部订单",icon:"qpdingdan"},{id:"payment",name:"待支付",icon:"daifukuan",count:0},{id:"delivery",name:"待发货",icon:"daifahuo",count:0},{id:"received",name:"待收货",icon:"daishouhuo",count:0}],S=e([{id:"address",name:"收货地址",icon:"shouhuodizhi",type:"link",url:"pages/address/index"},{id:"coupon",name:"领券中心",icon:"lingquan",type:"link",url:"pages/coupon/index",moduleKey:"market-coupon"},{id:"myCoupon",name:"优惠券",icon:"youhuiquan",type:"link",url:"pages/my-coupon/index",moduleKey:"market-coupon"},{id:"refund",name:"退换/售后",icon:"shouhou",type:"link",url:"pages/refund/index",count:0},{id:"contact",name:"在线客服",icon:"kefu",type:"contact"},{id:"points",name:"我的积分",icon:"jifen",type:"link",url:"pages/points/log",moduleKey:"market-coupon"},{id:"dealer",name:"分销中心",icon:"fenxiao",type:"link",url:"pages/dealer/index",moduleKey:"apps-dealer"},{id:"groupon",name:"我的拼团",icon:"pintuan",type:"link",url:"pages/groupon/index?tab=1",moduleKey:"apps-groupon"},{id:"bargain",name:"我的砍价",icon:"kanjia",type:"link",url:"pages/bargain/index?tab=1",moduleKey:"apps-bargain"},{id:"orderCenter",name:"订单中心",icon:"order-c",type:"link",url:"pages/order/center"},{id:"help",name:"我的帮助",icon:"bangzhu",type:"link",url:"pages/help/index",moduleKey:"content-help"}]);const M=z({components:{AvatarImage:A,Recommended:b,CustomerBtn:C},data:()=>({inArray:a,SettingKeyEnum:t,isLoading:!0,isFirstload:!0,isLogin:!1,setting:{},userInfo:{},assets:{balance:"--",points:"--",coupon:"--"},service:S,orderNavbar:P,todoCounts:{payment:0,deliver:0,received:0}}),onLoad(e){},onShow(e){this.onRefreshPage()},methods:{onRefreshPage(){s(),this.isLogin=n(),this.getPageData()},getPageData(e){const a=this;a.isLoading=!0,Promise.all([a.getSetting(),a.getUserInfo(),a.getUserAssets(),a.getTodoCounts()]).then((t=>{a.isFirstload=!1,a.initService(),a.initOrderTabbar(),e&&e()})).catch((e=>console.log("catch",e))).finally((()=>a.isLoading=!1))},async initService(){const e=this,a=await l.isEnabledDealer(),s=await i.isShowCustomerBtn(),n=[];S.forEach((l=>{l.enabled=!0,"points"===l.id&&(l.name="我的"+e.setting[t.POINTS.value].points_name),"dealer"!==l.id||a||(l.enabled=!1),"contact"!==l.id||s||(l.enabled=!1),null!=l.count&&(l.count=e.todoCounts[l.id]),n.push(l)})),e.service=n},initOrderTabbar(){const e=this,a=[];P.forEach((t=>{null!=t.count&&(t.count=e.todoCounts[t.id]),a.push(t)})),e.orderNavbar=a},getSetting(){const e=this;return new Promise(((a,t)=>{i.data().then((t=>{e.setting=t,a(t)})).catch(t)}))},getUserInfo(){const e=this;return new Promise(((a,t)=>{e.isLogin?j({},{load:e.isFirstload}).then((t=>{e.userInfo=t.data.userInfo,a(e.userInfo)})).catch((s=>{s.result&&401==s.result.status?(e.isLogin=!1,a(null)):t(s)})):a(null)}))},getUserAssets(){const e=this;return new Promise(((a,t)=>{e.isLogin?w({},{load:e.isFirstload}).then((t=>{e.assets=t.data.assets,a(e.assets)})).catch((s=>{s.result&&401==s.result.status?(e.isLogin=!1,a(null)):t(s)})):a(null)}))},getTodoCounts(){const e=this;return new Promise(((a,t)=>{e.isLogin?I({},{load:e.isFirstload}).then((t=>{e.todoCounts=t.data.counts,a(e.todoCounts)})).catch((s=>{s.result&&401==s.result.status?(e.isLogin=!1,a(null)):t(s)})):a(null)}))},handleLogin(){!this.isLogin&&this.$navTo("pages/login/index")},handleBindMobile(){this.$navTo("pages/user/bind/index")},handlePersonal(){this.$navTo("pages/user/personal/index")},handleLogout(){const e=this;uni.showModal({title:"友情提示",content:"您确定<EFBFBD><EFBFBD>
|