index.vue 36 KB

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