index.vue 33 KB

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