index.vue 35 KB

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