You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/public/assets/pages-user-index.0c551d24.js

2 lines
12 KiB

11 months ago
import{C as e,A as a,s as t,D as s,S as n,z as l,J as i,K 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 k,d as y,F as x,g as _,r as T,l as L,k as v}from"./index-4ddb689d.js";import{A}from"./index.1169d7d7.js";import{R as b}from"./index.5efbe1fd.js";import{C}from"./index.cdfc996d.js";import{i as j,a as w}from"./user.2171e17f.js";import{t as D}from"./order.42b61037.js";import{_ as I}from"./_plugin-vue_export-helper.1b428a4d.js";import"./index.85d62ccb.js";const z=""+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=[{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=I({components:{AvatarImage:A,Recommended:b,CustomerBtn:C},data:()=>({inArray:e,SettingKeyEnum:a,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(){t(),this.isLogin=s(),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,t=await n.isEnabledDealer(),s=await l.isShowCustomerBtn(),o=[];S.forEach((n=>{n.enabled=!0,"points"===n.id&&(n.name="我的"+e.setting[a.POINTS.value].points_name),"dealer"!==n.id||t||(n.enabled=!1),"contact"!==n.id||s||(n.enabled=!1),null!=n.count&&(n.count=e.todoCounts[n.id]),o.push(n)})),e.service=i(o)},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)=>{l.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?D({},{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:"您确