index.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367
  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="goPages(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. goPages(url) {
  744. this.$util.JumpPath(url);
  745. },
  746. goRouter(item) {
  747. var pages = getCurrentPages();
  748. var page = (pages[pages.length - 1]).$page.fullPath;
  749. if (item.link == page) return
  750. uni.switchTab({
  751. url: item.link,
  752. fail(err) {
  753. uni.redirectTo({
  754. url: item.link
  755. })
  756. }
  757. })
  758. },
  759. getCopyRight() {
  760. const copyRight = uni.getStorageSync('copyRight')
  761. if (copyRight.copyrightImage) {
  762. this.copyRightPic = copyRight.copyrightImage
  763. }
  764. }
  765. }
  766. }
  767. </script>
  768. <style lang="scss">
  769. page,
  770. body {
  771. height: 100%;
  772. }
  773. .height {
  774. margin-top: -100rpx !important;
  775. }
  776. .unBg {
  777. background-color: unset !important;
  778. .user-info {
  779. .info {
  780. .name {
  781. color: #333333 !important;
  782. font-weight: 600;
  783. }
  784. .num {
  785. color: #333 !important;
  786. .num-txt {
  787. height: 38rpx;
  788. background-color: rgba(51, 51, 51, 0.13);
  789. padding: 0 12rpx;
  790. border-radius: 16rpx;
  791. }
  792. }
  793. }
  794. }
  795. .num-wrapper {
  796. color: #333 !important;
  797. font-weight: 600;
  798. .num-item {
  799. .txt {
  800. color: rgba(51, 51, 51, 0.7) !important;
  801. }
  802. }
  803. }
  804. .message {
  805. .iconfont {
  806. color: #333 !important;
  807. }
  808. .num {
  809. color: #fff !important;
  810. background-color: var(--view-theme) !important;
  811. }
  812. }
  813. .setting {
  814. .iconfont {
  815. color: #333 !important;
  816. }
  817. }
  818. }
  819. .cardVipB {
  820. background-color: #343A48;
  821. width: 100%;
  822. height: 124rpx;
  823. border-radius: 16rpx 16rpx 0 0;
  824. padding: 22rpx 30rpx 0 30rpx;
  825. margin-top: 16px;
  826. .left-box {
  827. .small {
  828. color: #F8D5A8;
  829. font-size: 28rpx;
  830. margin-left: 18rpx;
  831. }
  832. .pictrue {
  833. width: 40rpx;
  834. height: 45rpx;
  835. image {
  836. width: 100%;
  837. height: 100%;
  838. }
  839. }
  840. }
  841. .btn {
  842. color: #BBBBBB;
  843. font-size: 26rpx;
  844. }
  845. .icon-xiangyou {
  846. margin-top: 6rpx;
  847. }
  848. }
  849. .cardVipA {
  850. position: absolute;
  851. background: url('~@/static/images/member.png') no-repeat;
  852. background-size: 100% 100%;
  853. width: 750rpx;
  854. height: 84rpx;
  855. bottom: -2rpx;
  856. left: 0;
  857. padding: 0 56rpx 0 135rpx;
  858. .left-box {
  859. font-size: 26rpx;
  860. color: #905100;
  861. font-weight: 400;
  862. }
  863. .btn {
  864. color: #905100;
  865. font-weight: 400;
  866. font-size: 24rpx;
  867. }
  868. .iconfont {
  869. font-size: 20rpx;
  870. margin: 4rpx 0 0 4rpx;
  871. }
  872. }
  873. .new-users {
  874. display: flex;
  875. flex-direction: column;
  876. height: 100%;
  877. .sys-head {
  878. position: relative;
  879. width: 100%;
  880. // background: linear-gradient(90deg, $bg-star1 0%, $bg-end1 100%);
  881. .bg {
  882. position: absolute;
  883. left: 0;
  884. top: 0;
  885. width: 100%;
  886. height: 100%;
  887. background: var(--view-theme);
  888. background-size: 100% auto;
  889. background-position: left bottom;
  890. }
  891. .sys-title {
  892. z-index: 10;
  893. position: relative;
  894. height: 43px;
  895. text-align: center;
  896. line-height: 43px;
  897. font-size: 36rpx;
  898. color: #FFFFFF;
  899. }
  900. }
  901. .head {
  902. // background: #fff;
  903. .user-card {
  904. position: relative;
  905. width: 100%;
  906. height: 380rpx;
  907. margin: 0 auto;
  908. padding: 35rpx 28rpx;
  909. background-image: url("~@/static/images/user01.png");
  910. background-size: 100% auto;
  911. background-color: var(--view-theme);
  912. .user-info {
  913. z-index: 20;
  914. position: relative;
  915. display: flex;
  916. .headwear {
  917. position: absolute;
  918. right: -4rpx;
  919. top: -14rpx;
  920. width: 44rpx;
  921. height: 44rpx;
  922. image {
  923. width: 100%;
  924. height: 100%;
  925. }
  926. }
  927. .live {
  928. width: 28rpx;
  929. height: 28rpx;
  930. margin-left: 20rpx;
  931. }
  932. .bntImg {
  933. width: 120rpx;
  934. height: 120rpx;
  935. border-radius: 50%;
  936. text-align: center;
  937. line-height: 120rpx;
  938. background-color: unset;
  939. position: relative;
  940. .avatarName {
  941. font-size: 16rpx;
  942. color: #fff;
  943. text-align: center;
  944. background-color: rgba(0, 0, 0, 0.6);
  945. height: 37rpx;
  946. line-height: 37rpx;
  947. position: absolute;
  948. bottom: 0;
  949. left: 0;
  950. width: 100%;
  951. }
  952. }
  953. .avatar-box {
  954. position: relative;
  955. display: flex;
  956. align-items: center;
  957. justify-content: center;
  958. width: 120rpx;
  959. height: 120rpx;
  960. border-radius: 50%;
  961. &.on {
  962. .avatar {
  963. border: 2px solid #FFAC65;
  964. border-radius: 50%;
  965. box-sizing: border-box;
  966. }
  967. }
  968. }
  969. .avatar {
  970. position: relative;
  971. width: 120rpx;
  972. height: 120rpx;
  973. border-radius: 50%;
  974. }
  975. .info {
  976. flex: 1;
  977. display: flex;
  978. flex-direction: column;
  979. justify-content: space-between;
  980. margin-left: 20rpx;
  981. padding: 20rpx 0;
  982. .name {
  983. display: flex;
  984. align-items: center;
  985. color: #fff;
  986. font-size: 31rpx;
  987. .nickname {
  988. max-width: 8em;
  989. }
  990. .vip {
  991. margin-left: 10rpx;
  992. image {
  993. width: 78rpx;
  994. height: 30rpx;
  995. display: block;
  996. }
  997. }
  998. }
  999. .num {
  1000. display: flex;
  1001. align-items: center;
  1002. font-size: 26rpx;
  1003. color: rgba(255, 255, 255, 0.6);
  1004. image {
  1005. width: 22rpx;
  1006. height: 23rpx;
  1007. margin-left: 20rpx;
  1008. }
  1009. }
  1010. }
  1011. }
  1012. .message {
  1013. align-self: flex-start;
  1014. position: relative;
  1015. margin-top: 15rpx;
  1016. margin-right: 20rpx;
  1017. .num {
  1018. position: absolute;
  1019. top: -8rpx;
  1020. left: 18rpx;
  1021. padding: 0 6rpx;
  1022. height: 28rpx;
  1023. border-radius: 12rpx;
  1024. background-color: #fff;
  1025. font-size: 18rpx;
  1026. line-height: 28rpx;
  1027. text-align: center;
  1028. color: var(--view-theme);
  1029. }
  1030. .iconfont {
  1031. font-size: 40rpx;
  1032. color: #fff;
  1033. }
  1034. }
  1035. .num-wrapper {
  1036. z-index: 30;
  1037. position: relative;
  1038. display: flex;
  1039. align-items: center;
  1040. justify-content: space-between;
  1041. margin-top: 22rpx;
  1042. // padding: 0 47rpx;
  1043. color: #fff;
  1044. .num-item {
  1045. width: 33.33%;
  1046. text-align: center;
  1047. &~.num-item {
  1048. position: relative;
  1049. &:before {
  1050. content: '';
  1051. position: absolute;
  1052. width: 1rpx;
  1053. height: 28rpx;
  1054. top: 50%;
  1055. margin-top: -14rpx;
  1056. background-color: rgba(255, 255, 255, 0.4);
  1057. left: 0;
  1058. }
  1059. }
  1060. .num {
  1061. font-size: 42rpx;
  1062. font-weight: bold;
  1063. }
  1064. .txt {
  1065. margin-top: 8rpx;
  1066. font-size: 26rpx;
  1067. color: rgba(255, 255, 255, 0.6);
  1068. }
  1069. }
  1070. }
  1071. .sign {
  1072. z-index: 200;
  1073. position: absolute;
  1074. right: -12rpx;
  1075. top: 80rpx;
  1076. display: flex;
  1077. align-items: center;
  1078. justify-content: center;
  1079. width: 120rpx;
  1080. height: 60rpx;
  1081. background: linear-gradient(90deg, rgba(255, 225, 87, 1) 0%, rgba(238, 193, 15, 1) 100%);
  1082. border-radius: 29rpx 4rpx 4rpx 29rpx;
  1083. color: #282828;
  1084. font-size: 28rpx;
  1085. font-weight: bold;
  1086. }
  1087. }
  1088. .order-wrapper {
  1089. background: #fff;
  1090. margin: 0 30rpx;
  1091. border-radius: 16rpx;
  1092. position: relative;
  1093. margin-top: -10rpx;
  1094. .order-hd {
  1095. justify-content: space-between;
  1096. padding: 30rpx 20rpx 10rpx 30rpx;
  1097. margin-top: 25rpx;
  1098. font-size: 30rpx;
  1099. color: #282828;
  1100. .left {
  1101. font-weight: bold;
  1102. }
  1103. .right {
  1104. display: flex;
  1105. align-items: center;
  1106. color: #666666;
  1107. font-size: 26rpx;
  1108. .icon-xiangyou {
  1109. margin-left: 5rpx;
  1110. font-size: 26rpx;
  1111. }
  1112. }
  1113. }
  1114. .order-bd {
  1115. display: flex;
  1116. padding: 0 0;
  1117. .order-item {
  1118. display: flex;
  1119. flex-direction: column;
  1120. justify-content: center;
  1121. align-items: center;
  1122. width: 20%;
  1123. height: 140rpx;
  1124. .pic {
  1125. position: relative;
  1126. text-align: center;
  1127. .iconfont {
  1128. font-size: 48rpx;
  1129. color: var(--view-theme);
  1130. }
  1131. image {
  1132. width: 58rpx;
  1133. height: 48rpx;
  1134. }
  1135. }
  1136. .txt {
  1137. margin-top: 6rpx;
  1138. font-size: 26rpx;
  1139. color: #333;
  1140. }
  1141. }
  1142. }
  1143. }
  1144. }
  1145. .slider-wrapper {
  1146. margin: 20rpx 30rpx;
  1147. height: 130rpx;
  1148. swiper,
  1149. swiper-item {
  1150. height: 100%;
  1151. }
  1152. image {
  1153. width: 100%;
  1154. height: 130rpx;
  1155. border-radius: 16rpx;
  1156. }
  1157. }
  1158. .user-menus {
  1159. background-color: #fff;
  1160. margin: 0 30rpx;
  1161. border-radius: 16rpx;
  1162. .menu-title {
  1163. padding: 30rpx 30rpx 40rpx;
  1164. font-size: 30rpx;
  1165. color: #282828;
  1166. font-weight: bold;
  1167. }
  1168. .list-box {
  1169. display: flex;
  1170. flex-wrap: wrap;
  1171. padding: 0;
  1172. }
  1173. .item {
  1174. position: relative;
  1175. display: flex;
  1176. align-items: center;
  1177. justify-content: space-between;
  1178. flex-direction: column;
  1179. width: 25%;
  1180. margin-bottom: 47rpx;
  1181. font-size: 26rpx;
  1182. color: #333333;
  1183. image {
  1184. width: 52rpx;
  1185. height: 52rpx;
  1186. margin-bottom: 18rpx;
  1187. }
  1188. &:last-child::before {
  1189. display: none;
  1190. }
  1191. }
  1192. button {
  1193. font-size: 28rpx;
  1194. }
  1195. }
  1196. .phone {
  1197. color: #fff;
  1198. background-color: #ffffff80;
  1199. border-radius: 15px;
  1200. width: max-content;
  1201. font-size: 24rpx;
  1202. padding: 2px 10px;
  1203. margin-top: 8rpx;
  1204. }
  1205. .order-status-num {
  1206. min-width: 12rpx;
  1207. background-color: #fff;
  1208. color: var(--view-theme);
  1209. border-radius: 15px;
  1210. position: absolute;
  1211. right: -14rpx;
  1212. top: -15rpx;
  1213. font-size: 20rpx;
  1214. padding: 0 8rpx;
  1215. border: 1px solid var(--view-theme);
  1216. }
  1217. .support {
  1218. width: 219rpx;
  1219. height: 74rpx;
  1220. margin: 54rpx auto;
  1221. display: block;
  1222. }
  1223. }
  1224. .card-vip {
  1225. display: flex;
  1226. align-items: center;
  1227. justify-content: space-between;
  1228. position: relative;
  1229. width: 690rpx;
  1230. height: 134rpx;
  1231. margin: -72rpx auto 0;
  1232. background: url('~@/static/images/user_vip.png');
  1233. background-size: cover;
  1234. padding-left: 118rpx;
  1235. padding-right: 34rpx;
  1236. .left-box {
  1237. font-size: 24rpx;
  1238. color: #AE5A2A;
  1239. .big {
  1240. font-size: 28rpx;
  1241. }
  1242. .small {
  1243. opacity: 0.8;
  1244. margin-top: 10rpx;
  1245. }
  1246. }
  1247. .btn {
  1248. height: 52rpx;
  1249. line-height: 52rpx;
  1250. padding: 0 10rpx;
  1251. text-align: center;
  1252. background: #fff;
  1253. border-radius: 28rpx;
  1254. font-size: 26rpx;
  1255. color: #AE5A2A;
  1256. }
  1257. }
  1258. .setting {
  1259. margin-top: 15rpx;
  1260. margin-left: 15rpx;
  1261. color: #fff;
  1262. .iconfont {
  1263. font-size: 40rpx;
  1264. }
  1265. }
  1266. .new-users {
  1267. padding-bottom: 0;
  1268. padding-bottom: constant(safe-area-inset-bottom);
  1269. padding-bottom: env(safe-area-inset-bottom);
  1270. }
  1271. </style>