index.vue 33 KB

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