index.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  1. <template>
  2. <view class="new-users copy-data" :style="{height:pageHeight}">
  3. <view class="top" :style="colorStyle">
  4. <!-- #ifdef MP || APP-PLUS -->
  5. <view class="sys-head">
  6. <view class="sys-bar" :style="{height:sysHeight}"></view>
  7. <!-- #ifdef MP -->
  8. <view class="sys-title" :style="member_style==3?'color:#333':''">{{$t('个人中心')}}</view>
  9. <!-- #endif -->
  10. <view class="bg" :style="member_style==3?'background:#f5f5f5':''"></view>
  11. </view>
  12. <!-- #endif -->
  13. </view>
  14. <view class="mid" style="flex:1;overflow: hidden;" :style="colorStyle">
  15. <scroll-view scroll-y="true" style="height: 100%;">
  16. <view class="head">
  17. <view class="user-card" :class="member_style==3?'unBg':''">
  18. <view class="bg"></view>
  19. <view class="user-info">
  20. <view>
  21. <!-- 注释这个是加的bnt -->
  22. <!-- #ifdef H5 -->
  23. <!-- <button class="bntImg" v-if="userInfo.is_complete == 0 && isWeixin"
  24. @click="getWechatuserinfo">
  25. <image class="avatar" src='/static/images/f.png'></image>
  26. <view class="avatarName">{{$t('获取头像')}}</view>
  27. </button> -->
  28. <!-- #endif -->
  29. <!-- #ifndef APP-PLUS -->
  30. <view class="avatar-box" :class="{on:userInfo.is_money_level}">
  31. <image class="avatar" :src='userInfo.avatar' v-if="userInfo.avatar"
  32. @click="goEdit()">
  33. </image>
  34. <image v-else class="avatar" src="/static/images/f.png" mode="" @click="goEdit()">
  35. </image>
  36. <view class="headwear" v-if="userInfo.is_money_level && userInfo.svip_open">
  37. <image src="/static/images/headwear.png"></image>
  38. </view>
  39. </view>
  40. <!-- #endif -->
  41. <!-- #ifdef APP-PLUS -->
  42. <view class="avatar-box" :class="{on:userInfo.is_money_level}">
  43. <image class="avatar" :src='userInfo.avatar' v-if="userInfo.avatar"
  44. @click="goEdit()">
  45. </image>
  46. <image v-else class="avatar" src="/static/images/f.png" mode="" @click="goEdit()">
  47. </image>
  48. <view class="headwear" v-if="userInfo.is_money_level && userInfo.svip_open">
  49. <image src="/static/images/headwear.png"></image>
  50. </view>
  51. </view>
  52. <!-- #endif -->
  53. </view>
  54. <view class="info">
  55. <!-- #ifdef MP -->
  56. <view class="name" v-if="!userInfo.uid" @click="openAuto"
  57. style="height: 100%; display: flex; align-items: center;">
  58. {{$t('请点击授权')}}
  59. </view>
  60. <!-- #endif -->
  61. <!-- #ifdef H5 -->
  62. <view class="name" v-if="!userInfo.uid && isWeixin" @click="openAuto"
  63. style="height: 100%; display: flex; align-items: center;">
  64. {{$t('请点击授权')}}
  65. </view>
  66. <!-- #endif -->
  67. <view class="name" v-if="userInfo.uid">
  68. {{userInfo.nickname}}
  69. <image class="live" :src="userInfo.vip_icon" v-if="userInfo.vip_icon"></image>
  70. <view class="vip" v-if="userInfo.is_money_level> 0 && userInfo.svip_open">
  71. <image src="/static/images/svip.png"></image>
  72. </view>
  73. </view>
  74. <view class="num" v-if="userInfo.phone" @click="goEdit()">
  75. <view class="num-txt">ID:{{userInfo.uid}}</view>
  76. <!-- <view class="icon">
  77. <image src="/static/images/edit.png" mode=""></image>
  78. </view> -->
  79. </view>
  80. <view class="phone" v-if="!userInfo.phone && isLogin" @tap="bindPhone">
  81. {{$t('绑定手机号')}}
  82. </view>
  83. </view>
  84. <view class="message">
  85. <navigator url="/pages/users/user_info/index" hover-class="none">
  86. <view class="iconfont icon-shezhi"></view>
  87. </navigator>
  88. </view>
  89. <view class="message">
  90. <navigator url="/pages/users/message_center/index" hover-class="none">
  91. <view v-if="userInfo.service_num" class="num">
  92. {{userInfo.service_num >= 100 ? '99+' : userInfo.service_num}}
  93. </view>
  94. <view class="iconfont icon-s-kefu"></view>
  95. </navigator>
  96. </view>
  97. <!-- #ifdef MP -->
  98. <!-- <view class="setting" @click="Setting"><text class="iconfont icon-shezhi"></text></view> -->
  99. <!-- #endif -->
  100. </view>
  101. <view class="num-wrapper">
  102. <view class="num-item" v-if="userInfo.balance_func_status"
  103. @click="goMenuPage('/pages/users/user_money/index')">
  104. <text class="num">{{userInfo.now_money || 0}}</text>
  105. <view class="txt">{{$t('余额')}}</view>
  106. </view>
  107. <view class="num-item" v-else
  108. @click="goMenuPage('/pages/users/user_goods_collection/index')">
  109. <text class="num">{{userInfo.collectCount || 0}}</text>
  110. <view class="txt">{{$t('收藏')}}</view>
  111. </view>
  112. <view class="num-item" @click="goMenuPage('/pages/users/user_coupon/index')">
  113. <text class="num">{{userInfo.couponCount || 0}}</text>
  114. <view class="txt">{{$t('优惠券')}}</view>
  115. </view>
  116. <view class="num-item" @click="goMenuPage('/pages/users/user_integral/index')">
  117. <text class="num">{{userInfo.integral || 0}}</text>
  118. <view class="txt">{{$t('积分')}}</view>
  119. </view>
  120. </view>
  121. <!-- <view class="sign" @click="goSignIn">签到</view> -->
  122. <view class="cardVipA acea-row row-between-wrapper"
  123. v-if="userInfo.svip_open && member_style==1">
  124. <view class="left-box">
  125. <view v-if="userInfo.vip_status == 1" class="small">{{$t('永久')}}</view>
  126. <view v-else-if="userInfo.vip_status == 3" class="small">{{$t('会员到期')}}
  127. {{ userInfo.overdue_time | dateFormat }}
  128. </view>
  129. <view v-else-if="userInfo.vip_status == -1" class="small">{{$t('已过期')}}</view>
  130. <view v-else-if="userInfo.vip_status == 2" class="small">{{$t('未开通会员')}}
  131. </view>
  132. </view>
  133. <view class="acea-row row-middle">
  134. <navigator v-if="userInfo.vip_status == 1" url="/pages/annex/vip_paid/index"
  135. hover-class="none" class="btn">{{$t('查看会员权益')}}</navigator>
  136. <navigator v-else url="/pages/annex/vip_paid/index" hover-class="none" class="btn">
  137. {{ userInfo.overdue_time ? $t('立即续费') : $t('立即激活') }}
  138. </navigator>
  139. <text class="iconfont icon-xiangyou"></text>
  140. </view>
  141. </view>
  142. <view class="cardVipB acea-row row-between" v-if="userInfo.svip_open && member_style==3">
  143. <view class="left-box acea-row">
  144. <view class="pictrue">
  145. <image src="../../static/images/member01.png"></image>
  146. </view>
  147. <view v-if="userInfo.vip_status == 1" class="small">{{$t('永久')}}</view>
  148. <view v-else-if="userInfo.vip_status == 3" class="small">{{$t('会员到期')}}
  149. {{ userInfo.overdue_time | dateFormat }}
  150. </view>
  151. <view v-else-if="userInfo.vip_status == -1" class="small">{{$t('已过期')}}</view>
  152. <view v-else-if="userInfo.vip_status == 2" class="small">{{$t('未开通会员')}}
  153. </view>
  154. </view>
  155. <view class="acea-row">
  156. <navigator v-if="userInfo.vip_status == 1" url="/pages/annex/vip_paid/index"
  157. hover-class="none" class="btn">{{$t('会员可享多项权益')}}</navigator>
  158. <navigator v-else url="/pages/annex/vip_paid/index" hover-class="none" class="btn">
  159. {{ userInfo.overdue_time ? $t('立即续费') : $t('立即激活') }}
  160. </navigator>
  161. <text class="iconfont icon-xiangyou btn"></text>
  162. </view>
  163. </view>
  164. </view>
  165. <view class="card-vip" v-if="userInfo.svip_open && member_style==2">
  166. <view class="left-box">
  167. <view class="big">{{$t('会员可享多项权益')}}</view>
  168. <view v-if="userInfo.vip_status == 1" class="small">{{$t('永久')}}</view>
  169. <view v-else-if="userInfo.vip_status == 3" class="small">{{$t('会员到期')}}
  170. {{ userInfo.overdue_time | dateFormat }}
  171. </view>
  172. <view v-else-if="userInfo.vip_status == -1" class="small">{{$t('已过期')}}</view>
  173. <view v-else-if="userInfo.vip_status == 2" class="small">{{$t('未开通会员')}}
  174. </view>
  175. </view>
  176. <navigator v-if="userInfo.vip_status == 1" url="/pages/annex/vip_paid/index" hover-class="none"
  177. class="btn">{{$t('查看会员权益')}}</navigator>
  178. <navigator v-else url="/pages/annex/vip_paid/index" hover-class="none" class="btn">
  179. {{ userInfo.overdue_time ? $t('立即续费') : $t('立即激活') }}
  180. </navigator>
  181. </view>
  182. <view class="order-wrapper" :class="userInfo.svip_open?'':'height'">
  183. <view class="order-hd flex">
  184. <view class="left">{{$t('订单中心')}}</view>
  185. <navigator class="right flex" hover-class="none" url="/pages/goods/order_list/index"
  186. open-type="navigate">
  187. {{$t('查看全部')}}
  188. <text class="iconfont icon-xiangyou"></text>
  189. </navigator>
  190. </view>
  191. <view class="order-bd">
  192. <block v-for="(item,index) in orderMenu" :key="index">
  193. <navigator class="order-item" hover-class="none" :url="item.url">
  194. <view class="pic">
  195. <!-- <image :src="item.img" mode=""></image> -->
  196. <text class="iconfont" :class="item.img"></text>
  197. <text class="order-status-num" v-if="item.num > 0">{{ item.num }}</text>
  198. </view>
  199. <view class="txt">{{$t(item.title)}}</view>
  200. </navigator>
  201. </block>
  202. </view>
  203. </view>
  204. </view>
  205. <!-- 轮播 -->
  206. <view class="slider-wrapper" v-if="imgUrls.length>0 && my_banner_status">
  207. <swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval"
  208. :duration="duration" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
  209. <block v-for="(item,index) in imgUrls" :key="index">
  210. <swiper-item>
  211. <view @click="goMenuPage(item.url)" class='slide-navigator acea-row row-between-wrapper'
  212. hover-class='none'>
  213. <image :src="item.pic" class="slide-image"></image>
  214. </view>
  215. </swiper-item>
  216. </block>
  217. </swiper>
  218. </view>
  219. <!-- 会员菜单 -->
  220. <view class="user-menus" style="margin-top: 20rpx;">
  221. <view class="menu-title">{{$t('我的服务')}}</view>
  222. <view class="list-box">
  223. <!-- #ifdef APP-PLUS || H5 -->
  224. <block v-for="(item,index) in MyMenus" :key="index">
  225. <view class="item" v-if="item.url!='#' && item.url!='/pages/service/index'"
  226. @click="goMenuPage(item.url, item.name)">
  227. <image :src="item.pic"></image>
  228. <text>{{$t(item.name)}}</text>
  229. </view>
  230. </block>
  231. <!-- #endif -->
  232. <!-- #ifdef MP -->
  233. <block v-for="(item,index) in MyMenus" :key="index">
  234. <view class="item" v-if="item.url!='#'
  235. && item.url!='/pages/service/index'
  236. && item.url!='/pages/extension/customer_list/chat'
  237. || (item.url=='/pages/extension/customer_list/chat' && routineContact == 0)"
  238. @click="goMenuPage(item.url, item.name)">
  239. <image :src="item.pic"></image>
  240. <text>{{$t(item.name)}}</text>
  241. </view>
  242. </block>
  243. <button class="item" open-type='contact' v-if="routineContact == 1">
  244. <image src="/static/images/contact.png"></image>
  245. <text>{{$t('联系客服')}}</text>
  246. </button>
  247. <!-- #endif -->
  248. <!-- #ifdef APP-PLUS -->
  249. <view class="item" hover-class="none" @click="goMenuPage('/pages/users/privacy/index?type=3')">
  250. <image src="/static/images/menu.png"></image>
  251. <text>{{$t('隐私协议')}}</text>
  252. </view>
  253. <!-- #endif -->
  254. </view>
  255. </view>
  256. <view class="user-menus" style="margin-top: 20rpx;" v-if="storeMenu.length">
  257. <view class="menu-title">{{$t('商家管理')}}</view>
  258. <view class="list-box">
  259. <block v-for="(item,index) in storeMenu" :key="index">
  260. <view class="item" :url="item.url" hover-class="none"
  261. v-if="item.url!='#' && item.url!='/pages/service/index'"
  262. @click="goMenuPage(item.url, item.name)">
  263. <image :src="item.pic"></image>
  264. <text>{{$t(item.name)}}</text>
  265. </view>
  266. </block>
  267. </view>
  268. </view>
  269. <image :src="copyRightPic" alt="" class='support'></image>
  270. <view class="uni-p-b-98"></view>
  271. </scroll-view>
  272. </view>
  273. <tabBar v-if="!is_diy" :pagePath="'/pages/user/index'"></tabBar>
  274. <pageFooter v-else></pageFooter>
  275. </view>
  276. </template>
  277. <script>
  278. let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  279. import {
  280. getMenuList,
  281. getUserInfo,
  282. setVisit,
  283. updateUserInfo
  284. } from '@/api/user.js';
  285. import {
  286. wechatAuthV2,
  287. silenceAuth
  288. } from '@/api/public.js'
  289. import {
  290. toLogin
  291. } from '@/libs/login.js';
  292. import {
  293. mapState,
  294. mapGetters
  295. } from "vuex";
  296. // #ifdef H5
  297. import Auth from '@/libs/wechat';
  298. // #endif
  299. const app = getApp();
  300. import dayjs from '@/plugin/dayjs/dayjs.min.js';
  301. import Routine from '@/libs/routine';
  302. import colors from '@/mixins/color';
  303. import tabBar from "@/pages/index/visualization/components/tabBar.vue";
  304. import pageFooter from '@/components/pageFooter/index.vue'
  305. import {
  306. getCustomer
  307. } from '@/utils/index.js'
  308. export default {
  309. components: {
  310. tabBar,
  311. pageFooter
  312. },
  313. // computed: mapGetters(['isLogin','cartNum']),
  314. computed: {
  315. ...mapGetters({
  316. cartNum: 'cartNum',
  317. isLogin: 'isLogin'
  318. })
  319. },
  320. filters: {
  321. coundTime(val) {
  322. var setTime = val * 1000
  323. var nowTime = new Date()
  324. var rest = setTime - nowTime.getTime()
  325. var day = parseInt(rest / (60 * 60 * 24 * 1000))
  326. // var hour = parseInt(rest/(60*60*1000)%24) //小时
  327. return day + this.$t('day')
  328. },
  329. dateFormat: function(value) {
  330. return dayjs(value * 1000).format('YYYY-MM-DD');
  331. }
  332. },
  333. mixins: [colors],
  334. data() {
  335. return {
  336. storeMenu: [], // 商家管理
  337. orderMenu: [{
  338. img: 'icon-daifukuan',
  339. title: '待付款',
  340. url: '/pages/goods/order_list/index?status=0'
  341. },
  342. {
  343. img: 'icon-daifahuo',
  344. title: '待发货',
  345. url: '/pages/goods/order_list/index?status=1'
  346. },
  347. {
  348. img: 'icon-daishouhuo',
  349. title: '待收货',
  350. url: '/pages/goods/order_list/index?status=2'
  351. },
  352. {
  353. img: 'icon-daipingjia',
  354. title: '待评价',
  355. url: '/pages/goods/order_list/index?status=3'
  356. },
  357. {
  358. img: 'icon-a-shouhoutuikuan',
  359. title: '售后/退款',
  360. url: '/pages/users/user_return_list/index'
  361. },
  362. ],
  363. imgUrls: [],
  364. autoplay: true,
  365. circular: true,
  366. interval: 3000,
  367. duration: 500,
  368. isAuto: false, //没有授权的不会自动授权
  369. isShowAuth: false, //是否隐藏授权
  370. orderStatusNum: {},
  371. userInfo: {},
  372. MyMenus: [],
  373. sysHeight: sysHeight,
  374. mpHeight: 0,
  375. showStatus: 1,
  376. activeRouter: '',
  377. // #ifdef H5 || MP
  378. pageHeight: '100%',
  379. routineContact: 0,
  380. // #endif
  381. // #ifdef APP-PLUS
  382. pageHeight: app.globalData.windowHeight,
  383. // #endif
  384. // #ifdef H5
  385. isWeixin: Auth.isWeixin(),
  386. //#endif
  387. footerSee: false,
  388. member_style: 1,
  389. my_banner_status: 1,
  390. is_diy: uni.getStorageSync('is_diy'),
  391. copyRightPic: '/static/images/support.png', //版权图片
  392. }
  393. },
  394. onLoad(option) {
  395. uni.hideTabBar()
  396. let that = this;
  397. // #ifdef MP
  398. // 小程序静默授权
  399. if (!this.$store.getters.isLogin) {
  400. // Routine.getCode()
  401. // .then(code => {
  402. // Routine.silenceAuth(code).then(res => {
  403. // this.onLoadFun();
  404. // })
  405. // })
  406. // .catch(res => {
  407. // uni.hideLoading();
  408. // });
  409. }
  410. // #endif
  411. // #ifdef H5 || APP-PLUS
  412. if (that.isLogin == false) {
  413. toLogin()
  414. }
  415. //获取用户信息回来后授权
  416. let cacheCode = this.$Cache.get('snsapi_userinfo_code');
  417. let res1 = cacheCode ? option.code != cacheCode : true;
  418. if (this.isWeixin && option.code && res1 && option.scope === 'snsapi_userinfo') {
  419. this.$Cache.set('snsapi_userinfo_code', option.code);
  420. Auth.auth(option.code).then(res => {
  421. this.getUserInfo();
  422. }).catch(err => {})
  423. }
  424. // #endif
  425. // #ifdef APP-PLUS
  426. that.$set(that, 'pageHeight', app.globalData.windowHeight);
  427. // #endif
  428. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  429. let curRoute = routes[routes.length - 1].route //获取当前页面路由
  430. this.activeRouter = '/' + curRoute
  431. this.getCopyRight();
  432. },
  433. onReady() {
  434. let self = this
  435. // #ifdef MP
  436. let info = uni.createSelectorQuery().select(".sys-head");
  437. info.boundingClientRect(function(data) { //data - 各种参数
  438. self.mpHeight = data.height
  439. }).exec()
  440. // #endif
  441. },
  442. onShow: function() {
  443. let that = this;
  444. // #ifdef APP-PLUS
  445. uni.getSystemInfo({
  446. success: function(res) {
  447. that.pageHeight = res.windowHeight + 'px'
  448. }
  449. });
  450. // #endif
  451. if (that.isLogin) {
  452. this.getUserInfo();
  453. this.getMyMenus();
  454. this.setVisit();
  455. };
  456. this.getCopyRight();
  457. },
  458. onPullDownRefresh() {
  459. this.onLoadFun();
  460. },
  461. methods: {
  462. getWechatuserinfo() {
  463. //#ifdef H5
  464. Auth.isWeixin() && Auth.toAuth('snsapi_userinfo', '/pages/user/index');
  465. //#endif
  466. },
  467. getRoutineUserInfo(e) {
  468. updateUserInfo({
  469. userInfo: e.detail.userInfo
  470. }).then(res => {
  471. this.getUserInfo();
  472. return this.$util.Tips(this.$t('更新用户信息成功'));
  473. }).catch(res => {
  474. })
  475. },
  476. // 记录会员访问
  477. setVisit() {
  478. setVisit({
  479. url: '/pages/user/index'
  480. }).then(res => {})
  481. },
  482. // 打开授权
  483. openAuto() {
  484. toLogin();
  485. },
  486. // 授权回调
  487. onLoadFun() {
  488. this.getUserInfo();
  489. this.getMyMenus();
  490. this.setVisit();
  491. },
  492. Setting: function() {
  493. uni.openSetting({
  494. success: function(res) {}
  495. });
  496. },
  497. // 授权关闭
  498. authColse: function(e) {
  499. this.isShowAuth = e
  500. },
  501. // 绑定手机
  502. bindPhone() {
  503. uni.navigateTo({
  504. url: '/pages/users/user_phone/index'
  505. })
  506. },
  507. /**
  508. * 获取个人用户信息
  509. */
  510. getUserInfo: function() {
  511. let that = this;
  512. getUserInfo().then(res => {
  513. that.userInfo = res.data
  514. that.$store.commit("SETUID", res.data.uid);
  515. that.orderMenu.forEach((item, index) => {
  516. switch (item.title) {
  517. case '待付款':
  518. item.num = res.data.orderStatusNum.unpaid_count
  519. break
  520. case '待发货':
  521. item.num = res.data.orderStatusNum.unshipped_count
  522. break
  523. case '待收货':
  524. item.num = res.data.orderStatusNum.received_count
  525. break
  526. case '待评价':
  527. item.num = res.data.orderStatusNum.evaluated_count
  528. break
  529. case '售后/退款':
  530. item.num = res.data.orderStatusNum.refunding_count
  531. break
  532. }
  533. })
  534. uni.stopPullDownRefresh();
  535. });
  536. },
  537. //小程序授权api替换 getUserInfo
  538. getUserProfile() {
  539. toLogin();
  540. },
  541. /**
  542. *
  543. * 获取个人中心图标
  544. */
  545. switchTab(order) {
  546. this.orderMenu.forEach((item, index) => {
  547. switch (item.title) {
  548. case '待付款':
  549. item.img = order.dfk
  550. break
  551. case '待发货':
  552. item.img = order.dfh
  553. break
  554. case '待收货':
  555. item.img = order.dsh
  556. break
  557. case '待评价':
  558. item.img = order.dpj
  559. break
  560. case '售后/退款':
  561. item.img = order.sh
  562. break
  563. }
  564. })
  565. },
  566. getMyMenus: function() {
  567. let that = this;
  568. // if (this.MyMenus.length) return;
  569. getMenuList().then(res => {
  570. let storeMenu = []
  571. let myMenu = []
  572. res.data.routine_my_menus.forEach((el, index, arr) => {
  573. if (el.url == '/pages/admin/order/index' || el.url ==
  574. '/pages/admin/order_cancellation/index' || el.name ==
  575. '客服接待') {
  576. storeMenu.push(el)
  577. } else {
  578. myMenu.push(el)
  579. }
  580. })
  581. this.member_style = Number(res.data.diy_data.value)
  582. this.my_banner_status = res.data.diy_data.my_banner_status
  583. let order01 = {
  584. dfk: 'icon-daifukuan',
  585. dfh: 'icon-daifahuo',
  586. dsh: 'icon-daishouhuo',
  587. dpj: 'icon-daipingjia',
  588. sh: 'icon-a-shouhoutuikuan'
  589. }
  590. let order02 = {
  591. dfk: 'icon-daifukuan-lan',
  592. dfh: 'icon-daifahuo-lan',
  593. dsh: 'icon-daishouhuo-lan',
  594. dpj: 'icon-daipingjia-lan',
  595. sh: 'icon-shouhou-tuikuan-lan'
  596. }
  597. let order03 = {
  598. dfk: 'icon-daifukuan-ju',
  599. dfh: 'icon-daifahuo-ju',
  600. dsh: 'icon-daishouhuo-ju',
  601. dpj: 'icon-daipingjia-ju',
  602. sh: 'icon-shouhou-tuikuan-ju'
  603. }
  604. let order04 = {
  605. dfk: 'icon-daifukuan-fen',
  606. dfh: 'icon-daifahuo-fen',
  607. dsh: 'icon-daishouhuo-fen',
  608. dpj: 'icon-daipingjia-fen',
  609. sh: 'icon-a-shouhoutuikuan-fen'
  610. }
  611. let order05 = {
  612. dfk: 'icon-daifukuan-lv',
  613. dfh: 'icon-daifahuo-lv',
  614. dsh: 'icon-daishouhuo-lv',
  615. dpj: 'icon-daipingjia-lv',
  616. sh: 'icon-shouhou-tuikuan-lv'
  617. }
  618. switch (res.data.diy_data.order_status) {
  619. case 1:
  620. this.switchTab(order01)
  621. break
  622. case 2:
  623. this.switchTab(order02)
  624. break
  625. case 3:
  626. this.switchTab(order03)
  627. break
  628. case 4:
  629. this.switchTab(order04)
  630. break
  631. case 5:
  632. this.switchTab(order05)
  633. break
  634. }
  635. that.$set(that, 'MyMenus', myMenu);
  636. that.$set(that, 'storeMenu', storeMenu);
  637. this.imgUrls = res.data.routine_my_banner
  638. this.routineContact = Number(res.data.routine_contact_type)
  639. });
  640. },
  641. // 编辑页面
  642. goEdit() {
  643. if (this.isLogin == false) {
  644. toLogin();
  645. } else {
  646. uni.navigateTo({
  647. url: '/pages/users/user_info/index'
  648. })
  649. }
  650. },
  651. // 签到
  652. goSignIn() {
  653. uni.navigateTo({
  654. url: '/pages/users/user_sgin/index'
  655. })
  656. },
  657. // goMenuPage
  658. goMenuPage(url, name) {
  659. if (this.isLogin) {
  660. if (url.indexOf('http') === -1) {
  661. // #ifdef H5 || APP-PLUS
  662. if (name && name === '客服接待') {
  663. // return window.location.href = `${location.origin}${url}`
  664. return uni.navigateTo({
  665. url: `/pages/annex/web_view/index?url=${location.origin}${url}`
  666. });
  667. } else if (name && name === '联系客服') {
  668. return getCustomer(url)
  669. } else if (name === '订单核销') {
  670. return uni.navigateTo({
  671. url: url
  672. });
  673. // return window.location.href = `${location.origin}${url}`
  674. }
  675. // #endif
  676. // #ifdef MP
  677. if (name && name === '联系客服') {
  678. return getCustomer(url)
  679. }
  680. if (url != '#' && url == '/pages/users/user_info/index') {
  681. uni.openSetting({
  682. success: function(res) {}
  683. });
  684. }
  685. // #endif
  686. uni.navigateTo({
  687. url: url,
  688. fail(err) {
  689. uni.switchTab({
  690. url: url
  691. })
  692. }
  693. })
  694. } else {
  695. uni.navigateTo({
  696. url: `/pages/annex/web_view/index?url=${url}`
  697. });
  698. }
  699. } else {
  700. // #ifdef MP
  701. this.openAuto()
  702. // #endif
  703. }
  704. },
  705. goRouter(item) {
  706. var pages = getCurrentPages();
  707. var page = (pages[pages.length - 1]).$page.fullPath;
  708. if (item.link == page) return
  709. uni.switchTab({
  710. url: item.link,
  711. fail(err) {
  712. uni.redirectTo({
  713. url: item.link
  714. })
  715. }
  716. })
  717. },
  718. getCopyRight() {
  719. const copyRight = uni.getStorageSync('copyRight')
  720. if (copyRight.copyrightImage) {
  721. this.copyRightPic = copyRight.copyrightImage
  722. }
  723. }
  724. }
  725. }
  726. </script>
  727. <style lang="scss">
  728. page,
  729. body {
  730. height: 100%;
  731. }
  732. .height {
  733. margin-top: -100rpx !important;
  734. }
  735. .unBg {
  736. background-color: unset !important;
  737. .user-info {
  738. .info {
  739. .name {
  740. color: #333333 !important;
  741. font-weight: 600;
  742. }
  743. .num {
  744. color: #333 !important;
  745. .num-txt {
  746. height: 38rpx;
  747. background-color: rgba(51, 51, 51, 0.13);
  748. padding: 0 12rpx;
  749. border-radius: 16rpx;
  750. }
  751. }
  752. }
  753. }
  754. .num-wrapper {
  755. color: #333 !important;
  756. font-weight: 600;
  757. .num-item {
  758. .txt {
  759. color: rgba(51, 51, 51, 0.7) !important;
  760. }
  761. }
  762. }
  763. .message {
  764. .iconfont {
  765. color: #333 !important;
  766. }
  767. .num {
  768. color: #fff !important;
  769. background-color: var(--view-theme) !important;
  770. }
  771. }
  772. .setting {
  773. .iconfont {
  774. color: #333 !important;
  775. }
  776. }
  777. }
  778. .cardVipB {
  779. background-color: #343A48;
  780. width: 100%;
  781. height: 124rpx;
  782. border-radius: 16rpx 16rpx 0 0;
  783. padding: 22rpx 30rpx 0 30rpx;
  784. margin-top: 16px;
  785. .left-box {
  786. .small {
  787. color: #F8D5A8;
  788. font-size: 28rpx;
  789. margin-left: 18rpx;
  790. }
  791. .pictrue {
  792. width: 40rpx;
  793. height: 45rpx;
  794. image {
  795. width: 100%;
  796. height: 100%;
  797. }
  798. }
  799. }
  800. .btn {
  801. color: #BBBBBB;
  802. font-size: 26rpx;
  803. }
  804. .icon-xiangyou {
  805. margin-top: 6rpx;
  806. }
  807. }
  808. .cardVipA {
  809. position: absolute;
  810. background: url('~@/static/images/member.png') no-repeat;
  811. background-size: 100% 100%;
  812. width: 750rpx;
  813. height: 84rpx;
  814. bottom: -2rpx;
  815. left: 0;
  816. padding: 0 56rpx 0 135rpx;
  817. .left-box {
  818. font-size: 26rpx;
  819. color: #905100;
  820. font-weight: 400;
  821. }
  822. .btn {
  823. color: #905100;
  824. font-weight: 400;
  825. font-size: 24rpx;
  826. }
  827. .iconfont {
  828. font-size: 20rpx;
  829. margin: 4rpx 0 0 4rpx;
  830. }
  831. }
  832. .new-users {
  833. display: flex;
  834. flex-direction: column;
  835. height: 100%;
  836. .sys-head {
  837. position: relative;
  838. width: 100%;
  839. // background: linear-gradient(90deg, $bg-star1 0%, $bg-end1 100%);
  840. .bg {
  841. position: absolute;
  842. left: 0;
  843. top: 0;
  844. width: 100%;
  845. height: 100%;
  846. background: var(--view-theme);
  847. background-size: 100% auto;
  848. background-position: left bottom;
  849. }
  850. .sys-title {
  851. z-index: 10;
  852. position: relative;
  853. height: 43px;
  854. text-align: center;
  855. line-height: 43px;
  856. font-size: 36rpx;
  857. color: #FFFFFF;
  858. }
  859. }
  860. .head {
  861. // background: #fff;
  862. .user-card {
  863. position: relative;
  864. width: 100%;
  865. height: 380rpx;
  866. margin: 0 auto;
  867. padding: 35rpx 28rpx;
  868. background-image: url("~@/static/images/user01.png");
  869. background-size: 100% auto;
  870. background-color: var(--view-theme);
  871. .user-info {
  872. z-index: 20;
  873. position: relative;
  874. display: flex;
  875. .headwear {
  876. position: absolute;
  877. right: -4rpx;
  878. top: -14rpx;
  879. width: 44rpx;
  880. height: 44rpx;
  881. image {
  882. width: 100%;
  883. height: 100%;
  884. }
  885. }
  886. .live {
  887. width: 28rpx;
  888. height: 28rpx;
  889. margin-left: 20rpx;
  890. }
  891. .bntImg {
  892. width: 120rpx;
  893. height: 120rpx;
  894. border-radius: 50%;
  895. text-align: center;
  896. line-height: 120rpx;
  897. background-color: unset;
  898. position: relative;
  899. .avatarName {
  900. font-size: 16rpx;
  901. color: #fff;
  902. text-align: center;
  903. background-color: rgba(0, 0, 0, 0.6);
  904. height: 37rpx;
  905. line-height: 37rpx;
  906. position: absolute;
  907. bottom: 0;
  908. left: 0;
  909. width: 100%;
  910. }
  911. }
  912. .avatar-box {
  913. position: relative;
  914. display: flex;
  915. align-items: center;
  916. justify-content: center;
  917. width: 120rpx;
  918. height: 120rpx;
  919. border-radius: 50%;
  920. &.on {
  921. .avatar {
  922. border: 2px solid #FFAC65;
  923. border-radius: 50%;
  924. box-sizing: border-box;
  925. }
  926. }
  927. }
  928. .avatar {
  929. position: relative;
  930. width: 120rpx;
  931. height: 120rpx;
  932. border-radius: 50%;
  933. }
  934. .info {
  935. flex: 1;
  936. display: flex;
  937. flex-direction: column;
  938. justify-content: space-between;
  939. margin-left: 20rpx;
  940. padding: 15rpx 0;
  941. .name {
  942. display: flex;
  943. align-items: center;
  944. color: #fff;
  945. font-size: 31rpx;
  946. .vip {
  947. margin-left: 10rpx;
  948. image {
  949. width: 78rpx;
  950. height: 30rpx;
  951. display: block;
  952. }
  953. }
  954. }
  955. .num {
  956. display: flex;
  957. align-items: center;
  958. font-size: 26rpx;
  959. color: rgba(255, 255, 255, 0.6);
  960. image {
  961. width: 22rpx;
  962. height: 23rpx;
  963. margin-left: 20rpx;
  964. }
  965. }
  966. }
  967. }
  968. .message {
  969. align-self: flex-start;
  970. position: relative;
  971. margin-top: 15rpx;
  972. margin-right: 20rpx;
  973. .num {
  974. position: absolute;
  975. top: -8rpx;
  976. left: 18rpx;
  977. padding: 0 6rpx;
  978. height: 28rpx;
  979. border-radius: 12rpx;
  980. background-color: #fff;
  981. font-size: 18rpx;
  982. line-height: 28rpx;
  983. text-align: center;
  984. color: var(--view-theme);
  985. }
  986. .iconfont {
  987. font-size: 40rpx;
  988. color: #fff;
  989. }
  990. }
  991. .num-wrapper {
  992. z-index: 30;
  993. position: relative;
  994. display: flex;
  995. align-items: center;
  996. justify-content: space-between;
  997. margin-top: 22rpx;
  998. // padding: 0 47rpx;
  999. color: #fff;
  1000. .num-item {
  1001. width: 33.33%;
  1002. text-align: center;
  1003. &~.num-item {
  1004. position: relative;
  1005. &:before {
  1006. content: '';
  1007. position: absolute;
  1008. width: 1rpx;
  1009. height: 28rpx;
  1010. top: 50%;
  1011. margin-top: -14rpx;
  1012. background-color: rgba(255, 255, 255, 0.4);
  1013. left: 0;
  1014. }
  1015. }
  1016. .num {
  1017. font-size: 42rpx;
  1018. font-weight: bold;
  1019. }
  1020. .txt {
  1021. margin-top: 8rpx;
  1022. font-size: 26rpx;
  1023. color: rgba(255, 255, 255, 0.6);
  1024. }
  1025. }
  1026. }
  1027. .sign {
  1028. z-index: 200;
  1029. position: absolute;
  1030. right: -12rpx;
  1031. top: 80rpx;
  1032. display: flex;
  1033. align-items: center;
  1034. justify-content: center;
  1035. width: 120rpx;
  1036. height: 60rpx;
  1037. background: linear-gradient(90deg, rgba(255, 225, 87, 1) 0%, rgba(238, 193, 15, 1) 100%);
  1038. border-radius: 29rpx 4rpx 4rpx 29rpx;
  1039. color: #282828;
  1040. font-size: 28rpx;
  1041. font-weight: bold;
  1042. }
  1043. }
  1044. .order-wrapper {
  1045. background: #fff;
  1046. margin: 0 30rpx;
  1047. border-radius: 16rpx;
  1048. position: relative;
  1049. margin-top: -10rpx;
  1050. .order-hd {
  1051. justify-content: space-between;
  1052. padding: 30rpx 20rpx 10rpx 30rpx;
  1053. margin-top: 25rpx;
  1054. font-size: 30rpx;
  1055. color: #282828;
  1056. .left {
  1057. font-weight: bold;
  1058. }
  1059. .right {
  1060. display: flex;
  1061. align-items: center;
  1062. color: #666666;
  1063. font-size: 26rpx;
  1064. .icon-xiangyou {
  1065. margin-left: 5rpx;
  1066. font-size: 26rpx;
  1067. }
  1068. }
  1069. }
  1070. .order-bd {
  1071. display: flex;
  1072. padding: 0 0;
  1073. .order-item {
  1074. display: flex;
  1075. flex-direction: column;
  1076. justify-content: center;
  1077. align-items: center;
  1078. width: 20%;
  1079. height: 140rpx;
  1080. .pic {
  1081. position: relative;
  1082. text-align: center;
  1083. .iconfont {
  1084. font-size: 48rpx;
  1085. color: var(--view-theme);
  1086. }
  1087. image {
  1088. width: 58rpx;
  1089. height: 48rpx;
  1090. }
  1091. }
  1092. .txt {
  1093. margin-top: 6rpx;
  1094. font-size: 26rpx;
  1095. color: #333;
  1096. }
  1097. }
  1098. }
  1099. }
  1100. }
  1101. .slider-wrapper {
  1102. margin: 20rpx 30rpx;
  1103. height: 130rpx;
  1104. swiper,
  1105. swiper-item {
  1106. height: 100%;
  1107. }
  1108. image {
  1109. width: 100%;
  1110. height: 130rpx;
  1111. border-radius: 16rpx;
  1112. }
  1113. }
  1114. .user-menus {
  1115. background-color: #fff;
  1116. margin: 0 30rpx;
  1117. border-radius: 16rpx;
  1118. .menu-title {
  1119. padding: 30rpx 30rpx 40rpx;
  1120. font-size: 30rpx;
  1121. color: #282828;
  1122. font-weight: bold;
  1123. }
  1124. .list-box {
  1125. display: flex;
  1126. flex-wrap: wrap;
  1127. padding: 0;
  1128. }
  1129. .item {
  1130. position: relative;
  1131. display: flex;
  1132. align-items: center;
  1133. justify-content: space-between;
  1134. flex-direction: column;
  1135. width: 25%;
  1136. margin-bottom: 47rpx;
  1137. font-size: 26rpx;
  1138. color: #333333;
  1139. image {
  1140. width: 52rpx;
  1141. height: 52rpx;
  1142. margin-bottom: 18rpx;
  1143. }
  1144. &:last-child::before {
  1145. display: none;
  1146. }
  1147. }
  1148. button {
  1149. font-size: 28rpx;
  1150. }
  1151. }
  1152. .phone {
  1153. color: #fff;
  1154. background-color: #CCC;
  1155. border-radius: 15px;
  1156. width: max-content;
  1157. padding: 0 10px;
  1158. }
  1159. .order-status-num {
  1160. min-width: 12rpx;
  1161. background-color: #fff;
  1162. color: var(--view-theme);
  1163. border-radius: 15px;
  1164. position: absolute;
  1165. right: -14rpx;
  1166. top: -15rpx;
  1167. font-size: 20rpx;
  1168. padding: 0 8rpx;
  1169. border: 1px solid var(--view-theme);
  1170. }
  1171. .support {
  1172. width: 219rpx;
  1173. height: 74rpx;
  1174. margin: 54rpx auto;
  1175. display: block;
  1176. }
  1177. }
  1178. .card-vip {
  1179. display: flex;
  1180. align-items: center;
  1181. justify-content: space-between;
  1182. position: relative;
  1183. width: 690rpx;
  1184. height: 134rpx;
  1185. margin: -72rpx auto 0;
  1186. background: url('~@/static/images/user_vip.png');
  1187. background-size: cover;
  1188. padding-left: 118rpx;
  1189. padding-right: 34rpx;
  1190. .left-box {
  1191. font-size: 24rpx;
  1192. color: #AE5A2A;
  1193. .big {
  1194. font-size: 28rpx;
  1195. }
  1196. .small {
  1197. opacity: 0.8;
  1198. margin-top: 10rpx;
  1199. }
  1200. }
  1201. .btn {
  1202. height: 52rpx;
  1203. line-height: 52rpx;
  1204. padding: 0 10rpx;
  1205. text-align: center;
  1206. background: #fff;
  1207. border-radius: 28rpx;
  1208. font-size: 26rpx;
  1209. color: #AE5A2A;
  1210. }
  1211. }
  1212. .setting {
  1213. margin-top: 15rpx;
  1214. margin-left: 15rpx;
  1215. color: #fff;
  1216. .iconfont {
  1217. font-size: 40rpx;
  1218. }
  1219. }
  1220. .new-users {
  1221. padding-bottom: 0;
  1222. padding-bottom: constant(safe-area-inset-bottom);
  1223. padding-bottom: env(safe-area-inset-bottom);
  1224. }
  1225. </style>