index.vue 34 KB

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