index.vue 34 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 v-if="isLogin" 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 v-if="isLogin" 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. if (e.detail.errMsg == 'getPhoneNumber:ok') {
  528. Routine.getCode()
  529. .then(code => {
  530. let data = {
  531. code,
  532. iv: e.detail.iv,
  533. encryptedData: e.detail.encryptedData,
  534. }
  535. mpBindingPhone(data).then(res => {
  536. this.getUserInfo()
  537. this.$util.Tips({
  538. title: res.msg,
  539. icon: 'success'
  540. });
  541. }).catch(err => {
  542. return this.$util.Tips({
  543. title: err
  544. });
  545. })
  546. })
  547. .catch(error => {
  548. uni.hideLoading();
  549. });
  550. }
  551. },
  552. /**
  553. * 获取个人用户信息
  554. */
  555. getUserInfo: function() {
  556. let that = this;
  557. getUserInfo().then(res => {
  558. that.userInfo = res.data
  559. that.$store.commit("SETUID", res.data.uid);
  560. that.orderMenu.forEach((item, index) => {
  561. switch (item.title) {
  562. case '待付款':
  563. item.num = res.data.orderStatusNum.unpaid_count
  564. break
  565. case '待发货':
  566. item.num = res.data.orderStatusNum.unshipped_count
  567. break
  568. case '待收货':
  569. item.num = res.data.orderStatusNum.received_count
  570. break
  571. case '待评价':
  572. item.num = res.data.orderStatusNum.evaluated_count
  573. break
  574. case '售后/退款':
  575. item.num = res.data.orderStatusNum.refunding_count
  576. break
  577. }
  578. })
  579. uni.stopPullDownRefresh();
  580. });
  581. },
  582. //小程序授权api替换 getUserInfo
  583. getUserProfile() {
  584. toLogin();
  585. },
  586. /**
  587. *
  588. * 获取个人中心图标
  589. */
  590. switchTab(order) {
  591. this.orderMenu.forEach((item, index) => {
  592. switch (item.title) {
  593. case '待付款':
  594. item.img = order.dfk
  595. break
  596. case '待发货':
  597. item.img = order.dfh
  598. break
  599. case '待收货':
  600. item.img = order.dsh
  601. break
  602. case '待评价':
  603. item.img = order.dpj
  604. break
  605. case '售后/退款':
  606. item.img = order.sh
  607. break
  608. }
  609. })
  610. },
  611. getMyMenus: function() {
  612. let that = this;
  613. // if (this.MyMenus.length) return;
  614. getMenuList().then(res => {
  615. let storeMenu = []
  616. let myMenu = []
  617. res.data.routine_my_menus.forEach((el, index, arr) => {
  618. if (el.url == '/pages/admin/order/index' || el.url ==
  619. '/pages/admin/order_cancellation/index' || el.name ==
  620. '客服接待') {
  621. storeMenu.push(el)
  622. } else {
  623. myMenu.push(el)
  624. }
  625. })
  626. this.member_style = Number(res.data.diy_data.value)
  627. this.my_banner_status = res.data.diy_data.my_banner_status
  628. let order01 = {
  629. dfk: 'icon-daifukuan',
  630. dfh: 'icon-daifahuo',
  631. dsh: 'icon-daishouhuo',
  632. dpj: 'icon-daipingjia',
  633. sh: 'icon-a-shouhoutuikuan'
  634. }
  635. let order02 = {
  636. dfk: 'icon-daifukuan-lan',
  637. dfh: 'icon-daifahuo-lan',
  638. dsh: 'icon-daishouhuo-lan',
  639. dpj: 'icon-daipingjia-lan',
  640. sh: 'icon-shouhou-tuikuan-lan'
  641. }
  642. let order03 = {
  643. dfk: 'icon-daifukuan-ju',
  644. dfh: 'icon-daifahuo-ju',
  645. dsh: 'icon-daishouhuo-ju',
  646. dpj: 'icon-daipingjia-ju',
  647. sh: 'icon-shouhou-tuikuan-ju'
  648. }
  649. let order04 = {
  650. dfk: 'icon-daifukuan-fen',
  651. dfh: 'icon-daifahuo-fen',
  652. dsh: 'icon-daishouhuo-fen',
  653. dpj: 'icon-daipingjia-fen',
  654. sh: 'icon-a-shouhoutuikuan-fen'
  655. }
  656. let order05 = {
  657. dfk: 'icon-daifukuan-lv',
  658. dfh: 'icon-daifahuo-lv',
  659. dsh: 'icon-daishouhuo-lv',
  660. dpj: 'icon-daipingjia-lv',
  661. sh: 'icon-shouhou-tuikuan-lv'
  662. }
  663. switch (res.data.diy_data.order_status) {
  664. case 1:
  665. this.switchTab(order01)
  666. break
  667. case 2:
  668. this.switchTab(order02)
  669. break
  670. case 3:
  671. this.switchTab(order03)
  672. break
  673. case 4:
  674. this.switchTab(order04)
  675. break
  676. case 5:
  677. this.switchTab(order05)
  678. break
  679. }
  680. that.$set(that, 'MyMenus', myMenu);
  681. that.$set(that, 'storeMenu', storeMenu);
  682. this.imgUrls = res.data.routine_my_banner
  683. this.routineContact = Number(res.data.routine_contact_type)
  684. });
  685. },
  686. // 编辑页面
  687. goEdit() {
  688. if (this.isLogin == false) {
  689. toLogin();
  690. } else {
  691. // #ifdef MP
  692. if (this.userInfo.is_default_avatar) {
  693. this.editModal = true
  694. return
  695. }
  696. // #endif
  697. uni.navigateTo({
  698. url: '/pages/users/user_info/index'
  699. })
  700. }
  701. },
  702. // 签到
  703. goSignIn() {
  704. uni.navigateTo({
  705. url: '/pages/users/user_sgin/index'
  706. })
  707. },
  708. // goMenuPage
  709. goMenuPage(url, name) {
  710. if (this.isLogin) {
  711. if (url.indexOf('http') === -1) {
  712. // #ifdef H5 || APP-PLUS
  713. if (name && name === '客服接待') {
  714. // return window.location.href = `${location.origin}${url}`
  715. return uni.navigateTo({
  716. url: `/pages/annex/web_view/index?url=${location.origin}${url}`
  717. });
  718. } else if (name && name === '联系客服') {
  719. return getCustomer(url)
  720. } else if (name === '订单核销') {
  721. return uni.navigateTo({
  722. url: url
  723. });
  724. // return window.location.href = `${location.origin}${url}`
  725. }
  726. // #endif
  727. // #ifdef MP
  728. if (name && name === '联系客服') {
  729. return getCustomer(url)
  730. }
  731. if (url != '#' && url == '/pages/users/user_info/index') {
  732. uni.openSetting({
  733. success: function(res) {}
  734. });
  735. }
  736. // #endif
  737. uni.navigateTo({
  738. url: url,
  739. fail(err) {
  740. uni.switchTab({
  741. url: url
  742. })
  743. }
  744. })
  745. } else {
  746. uni.navigateTo({
  747. url: `/pages/annex/web_view/index?url=${url}`
  748. });
  749. }
  750. } else {
  751. // #ifdef MP
  752. this.openAuto()
  753. // #endif
  754. }
  755. },
  756. goRouter(item) {
  757. var pages = getCurrentPages();
  758. var page = (pages[pages.length - 1]).$page.fullPath;
  759. if (item.link == page) return
  760. uni.switchTab({
  761. url: item.link,
  762. fail(err) {
  763. uni.redirectTo({
  764. url: item.link
  765. })
  766. }
  767. })
  768. },
  769. getCopyRight() {
  770. const copyRight = uni.getStorageSync('copyRight')
  771. if (copyRight.copyrightImage) {
  772. this.copyRightPic = copyRight.copyrightImage
  773. }
  774. }
  775. }
  776. }
  777. </script>
  778. <style lang="scss">
  779. page,
  780. body {
  781. height: 100%;
  782. }
  783. .height {
  784. margin-top: -100rpx !important;
  785. }
  786. .unBg {
  787. background-color: unset !important;
  788. .user-info {
  789. .info {
  790. .name {
  791. color: #333333 !important;
  792. font-weight: 600;
  793. }
  794. .num {
  795. color: #333 !important;
  796. .num-txt {
  797. height: 38rpx;
  798. background-color: rgba(51, 51, 51, 0.13);
  799. padding: 0 12rpx;
  800. border-radius: 16rpx;
  801. }
  802. }
  803. }
  804. }
  805. .num-wrapper {
  806. color: #333 !important;
  807. font-weight: 600;
  808. .num-item {
  809. .txt {
  810. color: rgba(51, 51, 51, 0.7) !important;
  811. }
  812. }
  813. }
  814. .message {
  815. .iconfont {
  816. color: #333 !important;
  817. }
  818. .num {
  819. color: #fff !important;
  820. background-color: var(--view-theme) !important;
  821. }
  822. }
  823. .setting {
  824. .iconfont {
  825. color: #333 !important;
  826. }
  827. }
  828. }
  829. .cardVipB {
  830. background-color: #343A48;
  831. width: 100%;
  832. height: 124rpx;
  833. border-radius: 16rpx 16rpx 0 0;
  834. padding: 22rpx 30rpx 0 30rpx;
  835. margin-top: 16px;
  836. .left-box {
  837. .small {
  838. color: #F8D5A8;
  839. font-size: 28rpx;
  840. margin-left: 18rpx;
  841. }
  842. .pictrue {
  843. width: 40rpx;
  844. height: 45rpx;
  845. image {
  846. width: 100%;
  847. height: 100%;
  848. }
  849. }
  850. }
  851. .btn {
  852. color: #BBBBBB;
  853. font-size: 26rpx;
  854. }
  855. .icon-xiangyou {
  856. margin-top: 6rpx;
  857. }
  858. }
  859. .cardVipA {
  860. position: absolute;
  861. background: url('~@/static/images/member.png') no-repeat;
  862. background-size: 100% 100%;
  863. width: 750rpx;
  864. height: 84rpx;
  865. bottom: -2rpx;
  866. left: 0;
  867. padding: 0 56rpx 0 135rpx;
  868. .left-box {
  869. font-size: 26rpx;
  870. color: #905100;
  871. font-weight: 400;
  872. }
  873. .btn {
  874. color: #905100;
  875. font-weight: 400;
  876. font-size: 24rpx;
  877. }
  878. .iconfont {
  879. font-size: 20rpx;
  880. margin: 4rpx 0 0 4rpx;
  881. }
  882. }
  883. .new-users {
  884. display: flex;
  885. flex-direction: column;
  886. height: 100%;
  887. .sys-head {
  888. position: relative;
  889. width: 100%;
  890. // background: linear-gradient(90deg, $bg-star1 0%, $bg-end1 100%);
  891. .bg {
  892. position: absolute;
  893. left: 0;
  894. top: 0;
  895. width: 100%;
  896. height: 100%;
  897. background: var(--view-theme);
  898. background-size: 100% auto;
  899. background-position: left bottom;
  900. }
  901. .sys-title {
  902. z-index: 10;
  903. position: relative;
  904. height: 43px;
  905. text-align: center;
  906. line-height: 43px;
  907. font-size: 36rpx;
  908. color: #FFFFFF;
  909. }
  910. }
  911. .head {
  912. // background: #fff;
  913. .user-card {
  914. position: relative;
  915. width: 100%;
  916. height: 380rpx;
  917. margin: 0 auto;
  918. padding: 35rpx 28rpx;
  919. background-image: url("~@/static/images/user01.png");
  920. background-size: 100% auto;
  921. background-color: var(--view-theme);
  922. .user-info {
  923. z-index: 20;
  924. position: relative;
  925. display: flex;
  926. .headwear {
  927. position: absolute;
  928. right: -4rpx;
  929. top: -14rpx;
  930. width: 44rpx;
  931. height: 44rpx;
  932. image {
  933. width: 100%;
  934. height: 100%;
  935. }
  936. }
  937. .live {
  938. width: 28rpx;
  939. height: 28rpx;
  940. margin-left: 20rpx;
  941. }
  942. .bntImg {
  943. width: 120rpx;
  944. height: 120rpx;
  945. border-radius: 50%;
  946. text-align: center;
  947. line-height: 120rpx;
  948. background-color: unset;
  949. position: relative;
  950. .avatarName {
  951. font-size: 16rpx;
  952. color: #fff;
  953. text-align: center;
  954. background-color: rgba(0, 0, 0, 0.6);
  955. height: 37rpx;
  956. line-height: 37rpx;
  957. position: absolute;
  958. bottom: 0;
  959. left: 0;
  960. width: 100%;
  961. }
  962. }
  963. .avatar-box {
  964. position: relative;
  965. display: flex;
  966. align-items: center;
  967. justify-content: center;
  968. width: 120rpx;
  969. height: 120rpx;
  970. border-radius: 50%;
  971. &.on {
  972. .avatar {
  973. border: 2px solid #FFAC65;
  974. border-radius: 50%;
  975. box-sizing: border-box;
  976. }
  977. }
  978. }
  979. .avatar {
  980. position: relative;
  981. width: 120rpx;
  982. height: 120rpx;
  983. border-radius: 50%;
  984. }
  985. .info {
  986. flex: 1;
  987. display: flex;
  988. flex-direction: column;
  989. justify-content: space-between;
  990. margin-left: 20rpx;
  991. padding: 15rpx 0;
  992. .name {
  993. display: flex;
  994. align-items: center;
  995. color: #fff;
  996. font-size: 31rpx;
  997. .nickname {
  998. max-width: 8em;
  999. }
  1000. .vip {
  1001. margin-left: 10rpx;
  1002. image {
  1003. width: 78rpx;
  1004. height: 30rpx;
  1005. display: block;
  1006. }
  1007. }
  1008. }
  1009. .num {
  1010. display: flex;
  1011. align-items: center;
  1012. font-size: 26rpx;
  1013. color: rgba(255, 255, 255, 0.6);
  1014. image {
  1015. width: 22rpx;
  1016. height: 23rpx;
  1017. margin-left: 20rpx;
  1018. }
  1019. }
  1020. }
  1021. }
  1022. .message {
  1023. align-self: flex-start;
  1024. position: relative;
  1025. margin-top: 15rpx;
  1026. margin-right: 20rpx;
  1027. .num {
  1028. position: absolute;
  1029. top: -8rpx;
  1030. left: 18rpx;
  1031. padding: 0 6rpx;
  1032. height: 28rpx;
  1033. border-radius: 12rpx;
  1034. background-color: #fff;
  1035. font-size: 18rpx;
  1036. line-height: 28rpx;
  1037. text-align: center;
  1038. color: var(--view-theme);
  1039. }
  1040. .iconfont {
  1041. font-size: 40rpx;
  1042. color: #fff;
  1043. }
  1044. }
  1045. .num-wrapper {
  1046. z-index: 30;
  1047. position: relative;
  1048. display: flex;
  1049. align-items: center;
  1050. justify-content: space-between;
  1051. margin-top: 22rpx;
  1052. // padding: 0 47rpx;
  1053. color: #fff;
  1054. .num-item {
  1055. width: 33.33%;
  1056. text-align: center;
  1057. &~.num-item {
  1058. position: relative;
  1059. &:before {
  1060. content: '';
  1061. position: absolute;
  1062. width: 1rpx;
  1063. height: 28rpx;
  1064. top: 50%;
  1065. margin-top: -14rpx;
  1066. background-color: rgba(255, 255, 255, 0.4);
  1067. left: 0;
  1068. }
  1069. }
  1070. .num {
  1071. font-size: 42rpx;
  1072. font-weight: bold;
  1073. }
  1074. .txt {
  1075. margin-top: 8rpx;
  1076. font-size: 26rpx;
  1077. color: rgba(255, 255, 255, 0.6);
  1078. }
  1079. }
  1080. }
  1081. .sign {
  1082. z-index: 200;
  1083. position: absolute;
  1084. right: -12rpx;
  1085. top: 80rpx;
  1086. display: flex;
  1087. align-items: center;
  1088. justify-content: center;
  1089. width: 120rpx;
  1090. height: 60rpx;
  1091. background: linear-gradient(90deg, rgba(255, 225, 87, 1) 0%, rgba(238, 193, 15, 1) 100%);
  1092. border-radius: 29rpx 4rpx 4rpx 29rpx;
  1093. color: #282828;
  1094. font-size: 28rpx;
  1095. font-weight: bold;
  1096. }
  1097. }
  1098. .order-wrapper {
  1099. background: #fff;
  1100. margin: 0 30rpx;
  1101. border-radius: 16rpx;
  1102. position: relative;
  1103. margin-top: -10rpx;
  1104. .order-hd {
  1105. justify-content: space-between;
  1106. padding: 30rpx 20rpx 10rpx 30rpx;
  1107. margin-top: 25rpx;
  1108. font-size: 30rpx;
  1109. color: #282828;
  1110. .left {
  1111. font-weight: bold;
  1112. }
  1113. .right {
  1114. display: flex;
  1115. align-items: center;
  1116. color: #666666;
  1117. font-size: 26rpx;
  1118. .icon-xiangyou {
  1119. margin-left: 5rpx;
  1120. font-size: 26rpx;
  1121. }
  1122. }
  1123. }
  1124. .order-bd {
  1125. display: flex;
  1126. padding: 0 0;
  1127. .order-item {
  1128. display: flex;
  1129. flex-direction: column;
  1130. justify-content: center;
  1131. align-items: center;
  1132. width: 20%;
  1133. height: 140rpx;
  1134. .pic {
  1135. position: relative;
  1136. text-align: center;
  1137. .iconfont {
  1138. font-size: 48rpx;
  1139. color: var(--view-theme);
  1140. }
  1141. image {
  1142. width: 58rpx;
  1143. height: 48rpx;
  1144. }
  1145. }
  1146. .txt {
  1147. margin-top: 6rpx;
  1148. font-size: 26rpx;
  1149. color: #333;
  1150. }
  1151. }
  1152. }
  1153. }
  1154. }
  1155. .slider-wrapper {
  1156. margin: 20rpx 30rpx;
  1157. height: 130rpx;
  1158. swiper,
  1159. swiper-item {
  1160. height: 100%;
  1161. }
  1162. image {
  1163. width: 100%;
  1164. height: 130rpx;
  1165. border-radius: 16rpx;
  1166. }
  1167. }
  1168. .user-menus {
  1169. background-color: #fff;
  1170. margin: 0 30rpx;
  1171. border-radius: 16rpx;
  1172. .menu-title {
  1173. padding: 30rpx 30rpx 40rpx;
  1174. font-size: 30rpx;
  1175. color: #282828;
  1176. font-weight: bold;
  1177. }
  1178. .list-box {
  1179. display: flex;
  1180. flex-wrap: wrap;
  1181. padding: 0;
  1182. }
  1183. .item {
  1184. position: relative;
  1185. display: flex;
  1186. align-items: center;
  1187. justify-content: space-between;
  1188. flex-direction: column;
  1189. width: 25%;
  1190. margin-bottom: 47rpx;
  1191. font-size: 26rpx;
  1192. color: #333333;
  1193. image {
  1194. width: 52rpx;
  1195. height: 52rpx;
  1196. margin-bottom: 18rpx;
  1197. }
  1198. &:last-child::before {
  1199. display: none;
  1200. }
  1201. }
  1202. button {
  1203. font-size: 28rpx;
  1204. }
  1205. }
  1206. .phone {
  1207. color: #fff;
  1208. background-color: #CCC;
  1209. border-radius: 15px;
  1210. width: max-content;
  1211. font-size: 28rpx;
  1212. padding: 0 10px;
  1213. }
  1214. .order-status-num {
  1215. min-width: 12rpx;
  1216. background-color: #fff;
  1217. color: var(--view-theme);
  1218. border-radius: 15px;
  1219. position: absolute;
  1220. right: -14rpx;
  1221. top: -15rpx;
  1222. font-size: 20rpx;
  1223. padding: 0 8rpx;
  1224. border: 1px solid var(--view-theme);
  1225. }
  1226. .support {
  1227. width: 219rpx;
  1228. height: 74rpx;
  1229. margin: 54rpx auto;
  1230. display: block;
  1231. }
  1232. }
  1233. .card-vip {
  1234. display: flex;
  1235. align-items: center;
  1236. justify-content: space-between;
  1237. position: relative;
  1238. width: 690rpx;
  1239. height: 134rpx;
  1240. margin: -72rpx auto 0;
  1241. background: url('~@/static/images/user_vip.png');
  1242. background-size: cover;
  1243. padding-left: 118rpx;
  1244. padding-right: 34rpx;
  1245. .left-box {
  1246. font-size: 24rpx;
  1247. color: #AE5A2A;
  1248. .big {
  1249. font-size: 28rpx;
  1250. }
  1251. .small {
  1252. opacity: 0.8;
  1253. margin-top: 10rpx;
  1254. }
  1255. }
  1256. .btn {
  1257. height: 52rpx;
  1258. line-height: 52rpx;
  1259. padding: 0 10rpx;
  1260. text-align: center;
  1261. background: #fff;
  1262. border-radius: 28rpx;
  1263. font-size: 26rpx;
  1264. color: #AE5A2A;
  1265. }
  1266. }
  1267. .setting {
  1268. margin-top: 15rpx;
  1269. margin-left: 15rpx;
  1270. color: #fff;
  1271. .iconfont {
  1272. font-size: 40rpx;
  1273. }
  1274. }
  1275. .new-users {
  1276. padding-bottom: 0;
  1277. padding-bottom: constant(safe-area-inset-bottom);
  1278. padding-bottom: env(safe-area-inset-bottom);
  1279. }
  1280. </style>