index.vue 35 KB

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