index.vue 34 KB

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