index.vue 35 KB

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