index.vue 35 KB

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