index.vue 34 KB

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