index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. <template>
  2. <view class="new-users">
  3. <view class="head">
  4. <view class="user-card">
  5. <view class="bg"></view>
  6. <view class="user-info">
  7. <image class="avatar" :src='userInfo.avatar' v-if="userInfo.avatar" @click="goEdit()"></image>
  8. <image v-else class="avatar" src="/static/images/f.png" mode="" @click="goEdit()"></image>
  9. <view class="info">
  10. <!-- #ifdef MP -->
  11. <view class="name" v-if="!userInfo.uid" @tap="openAuto">
  12. 请点击授权
  13. </view>
  14. <!-- #endif -->
  15. <view class="name" v-if="userInfo.uid">
  16. {{userInfo.nickname}}
  17. <view class="vip" v-if="userInfo.vip">
  18. <image :src="userInfo.vip_icon" alt="">
  19. <view style="margin-left: 10rpx;" class="vip-txt">{{userInfo.vip_name}}</view>
  20. </view>
  21. </view>
  22. <view class="num" v-if="userInfo.phone" @click="goEdit()">
  23. <view class="num-txt">ID:{{userInfo.uid}}</view>
  24. <view class="icon">
  25. <image src="/static/images/edit.png" mode=""></image>
  26. </view>
  27. </view>
  28. <view class="phone" v-if="!userInfo.phone && isLogin" @tap="bindPhone">绑定手机号</view>
  29. </view>
  30. </view>
  31. <view class="num-wrapper">
  32. <view class="num-item" @click="goMenuPage('/pages/users/user_goods_collection/index')">
  33. <text class="num">{{userInfo.total_collect_product || 0}}</text>
  34. <view class="txt">我的收藏</view>
  35. </view>
  36. <view v-if="hide_mer_status == 0" class="num-item" @click="goMenuPage('/pages/users/user_store_attention/index')">
  37. <text class="num">{{userInfo.total_collect_store || 0}}</text>
  38. <view class="txt">关注店铺</view>
  39. </view>
  40. <view class="num-item" @click="goMenuPage('/pages/users/browsingHistory/index')">
  41. <text class="num">{{userInfo.total_visit_product || 0}}</text>
  42. <view class="txt">浏览记录</view>
  43. </view>
  44. <view class="num-item" @click="goMenuPage('/pages/users/user_coupon/index')">
  45. <text class="num">{{userInfo.total_coupon || 0}}</text>
  46. <view class="txt">优惠券</view>
  47. </view>
  48. </view>
  49. <view class="right-btn">
  50. <view class="iconfont icon-shezhi" @click="goEdit()" v-if="userInfo.phone"></view>
  51. <navigator class="btn" url="/pages/chat/customer_list/index?type=0" hover-class="none">
  52. <view class="iconfont icon-xiaoxi"></view>
  53. <text class="iconnum" v-if="userInfo.total_unread">{{userInfo.total_unread}}</text>
  54. </navigator>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="wrapper">
  59. <view class="order-wrapper">
  60. <view class="order-hd flex">
  61. <view class="left">我的订单</view>
  62. <navigator class="right flex" hover-class="none" url="/pages/users/order_list/index" open-type="navigate">
  63. 全部订单
  64. <text class="iconfont icon-xiangyou"></text>
  65. </navigator>
  66. </view>
  67. <view class="order-bd">
  68. <block v-for="(item,index) in orderMenu" :key="index">
  69. <navigator class="order-item" hover-class="none" :url="item.url">
  70. <view class="pic">
  71. <image :src="item.img" mode=""></image>
  72. <text class="order-status-num" v-if="item.num > 0">{{ item.num }}</text>
  73. </view>
  74. <view class="txt">{{item.title}}</view>
  75. </navigator>
  76. </block>
  77. </view>
  78. </view>
  79. <!-- 轮播 -->
  80. <view class="slider-wrapper" v-if="imgUrls.length>0">
  81. <swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration"
  82. indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
  83. <block v-for="(item,index) in imgUrls" :key="index">
  84. <swiper-item>
  85. <navigator :url='item.url' class='slide-navigator acea-row row-between-wrapper' hover-class='none'>
  86. <image :src="item.pic" class="slide-image"></image>
  87. </navigator>
  88. </swiper-item>
  89. </block>
  90. </swiper>
  91. </view>
  92. <!-- 会员菜单 -->
  93. <view class="user-menus" style="margin-top: 20rpx;">
  94. <view class="title">我的服务</view>
  95. <view class="menu-box" v-if="isLogin">
  96. <navigator url="/pages/users/user_money/index" class="item" hover-class="none" v-if="balance_func_status == 1">
  97. <image src="/static/images/user-menu-001.png"></image>
  98. <text>我的余额</text>
  99. </navigator>
  100. <navigator url="/pages/users/user_spread_user/index" class="item" hover-class="none" v-if="is_promoter == 1 && extension_status == 1">
  101. <image src="/static/images/user_menu11.png"></image>
  102. <text>分销推广</text>
  103. </navigator>
  104. <navigator url="/pages/users/distributor/index" class="item" hover-class="none" v-if="is_promoter == 0 && extension_status == 1">
  105. <image src="/static/images/user_menu11.png"></image>
  106. <text>分销推广</text>
  107. </navigator>
  108. <view class="item" @click="goUrl(item.url)"
  109. v-for="(item,index) in MyMenus" :key="index">
  110. <image :src="item.pic"></image>
  111. <text>{{item.name}}</text>
  112. </view>
  113. <navigator url="/pages/admin/order/index" class="item" hover-class="none" v-if="userInfo.service && userInfo.service.customer === 1">
  114. <image src="/static/images/user-menu-002.png"></image>
  115. <text>订单管理</text>
  116. </navigator>
  117. <navigator url="/pages/store/settled/index" class="item" hover-class="none" v-if="mer_intention_open == 1 && hide_mer_status == 0">
  118. <image src="/static/images/user-menu-003.png"></image>
  119. <text>商家入驻</text>
  120. </navigator>
  121. <navigator class="item" hover-class="none" url="/pages/admin/order_cancellation/index" v-if="userInfo.service && userInfo.service.is_verify">
  122. <block v-if="userInfo.service.is_verify == 1">
  123. <image src="/static/images/user_menu10.png"></image>
  124. <text>订单核销</text>
  125. </block>
  126. </navigator>
  127. <navigator url="/pages/activity/assist_record/index" class="item" hover-class="none">
  128. <image src="/static/images/user-menu-004.png"></image>
  129. <text>助力记录</text>
  130. </navigator>
  131. <view class="item" hover-class="none" @click="goChat" v-if="userInfo.service">
  132. <image src="/static/images/user_menu08.png"></image>
  133. <text>联系客服</text>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <view class="copy-right">
  139. <view class="iconfont icon-crmeb"></view>
  140. <view class="text">众邦科技提供技术支持</view>
  141. </view>
  142. <view style="height: 50rpx;"></view>
  143. <!-- #ifdef MP -->
  144. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  145. <!-- #endif -->
  146. </view>
  147. </template>
  148. <script>
  149. import {
  150. getMenuList,
  151. getUserInfo,
  152. setVisit
  153. } from '@/api/user.js';
  154. import {
  155. toLogin
  156. } from '@/libs/login.js';
  157. import {
  158. orderData
  159. } from '@/api/order.js'
  160. import {
  161. getconfig
  162. } from '@/api/public.js'
  163. import {
  164. mapGetters
  165. } from "vuex";
  166. // #ifdef MP
  167. import authorize from '@/components/Authorize';
  168. // #endif
  169. const app = getApp();
  170. export default {
  171. components: {
  172. // #ifdef MP
  173. authorize
  174. // #endif
  175. },
  176. computed: mapGetters(['isLogin']),
  177. data() {
  178. return {
  179. orderMenu: [{
  180. img: '/static/images/order1.png',
  181. title: '待付款',
  182. url: '/pages/users/order_list/index?status=0',
  183. num: 0
  184. },
  185. {
  186. img: '/static/images/order2.png',
  187. title: '待发货',
  188. url: '/pages/users/order_list/index?status=1',
  189. num: 0
  190. },
  191. {
  192. img: '/static/images/order3.png',
  193. title: '待收货',
  194. url: '/pages/users/order_list/index?status=2',
  195. num: 0
  196. },
  197. {
  198. img: '/static/images/order4.png',
  199. title: '待评价',
  200. url: '/pages/users/order_list/index?status=3',
  201. num: 0
  202. },
  203. {
  204. img: '/static/images/order5.png',
  205. title: '售后/退款',
  206. url: '/pages/users/refund/list',
  207. num: 0
  208. },
  209. ],
  210. imgUrls: [],
  211. userMenu: [],
  212. autoplay: true,
  213. circular: true,
  214. interval: 3000,
  215. duration: 500,
  216. isAuto: false, //没有授权的不会自动授权
  217. isShowAuth: false, //是否隐藏授权
  218. orderStatusNum: {},
  219. userInfo: {},
  220. MyMenus: [],
  221. balance_func_status: 0, //余额开关 1开
  222. is_promoter: 0, //推广人开关 1开
  223. extension_status: 0,
  224. mer_intention_open: 0,
  225. hide_mer_status: 1,
  226. }
  227. },
  228. onLoad() {
  229. getconfig().then(res => {
  230. this.balance_func_status = res.data.balance_func_status
  231. this.mer_intention_open = res.data.mer_intention_open
  232. this.hide_mer_status = res.data.hide_mer_status
  233. try {
  234. uni.setStorageSync('SUBSCRIBE_MESSAGE', res.data.tempid);
  235. } catch (e) {
  236. // error
  237. }
  238. // #ifdef H5
  239. this.setOpenShare(res.data);
  240. // #endif
  241. }).catch(err => {})
  242. let that = this;
  243. // #ifdef H5 || APP-PLUS
  244. if (that.isLogin == false) {
  245. toLogin();
  246. }
  247. // #endif
  248. },
  249. onReady() {
  250. uni.$on('update',(data)=>{
  251. this.balance_func_status = data.balance_func_status
  252. this.mer_intention_open = data.mer_intention_open
  253. this.hide_mer_status = data.hide_mer_status
  254. })
  255. },
  256. mounted: function() {
  257. const app = getApp();
  258. this.$nextTick(() => {
  259. this.hide_mer_status = app.globalData.hide_mer_status
  260. this.balance_func_status = app.globalData.balance_func_status
  261. this.mer_intention_open = app.globalData.mer_intention_open
  262. this.hide_mer_status = app.globalData.hide_mer_status
  263. });
  264. },
  265. onShow: function() {
  266. let that = this;
  267. if (that.isLogin) {
  268. this.getUserInfo();
  269. this.orderNum();
  270. this.getMyMenus();
  271. // this.setVisit();
  272. } else {
  273. // #ifdef H5 || APP-PLUS
  274. toLogin();
  275. // #endif
  276. }
  277. },
  278. methods: {
  279. goUrl(url){
  280. // if(url == '/pages/users/user_address_list/index'){
  281. // window.location.href = url
  282. // }else{
  283. // uni.navigateTo({
  284. // url
  285. // })
  286. // }
  287. uni.navigateTo({
  288. url
  289. })
  290. },
  291. // 去聊天列表
  292. goChat() {
  293. let type = this.userInfo.service ? 1 : 0
  294. uni.navigateTo({
  295. url: `/pages/chat/customer_list/index?type=${type}`
  296. })
  297. },
  298. // 记录会员访问
  299. setVisit() {
  300. setVisit({
  301. url: '/pages/user/index'
  302. }).then(res => {})
  303. },
  304. // 打开授权
  305. openAuto() {
  306. this.isAuto = true;
  307. this.isShowAuth = true
  308. },
  309. // 授权回调
  310. onLoadFun() {
  311. this.getUserInfo();
  312. this.getMyMenus();
  313. this.orderNum();
  314. this.isShowAuth = false
  315. },
  316. Setting: function() {
  317. uni.openSetting({
  318. success: function(res) {
  319. console.log(res.authSetting)
  320. }
  321. });
  322. },
  323. // 授权关闭
  324. authColse: function(e) {
  325. this.isShowAuth = e
  326. },
  327. // 绑定手机
  328. bindPhone() {
  329. uni.navigateTo({
  330. url: '/pages/users/user_phone/index'
  331. })
  332. },
  333. /**
  334. * 获取个人用户信息
  335. */
  336. getUserInfo: function() {
  337. let that = this;
  338. getUserInfo().then(res => {
  339. that.userInfo = res.data,
  340. that.is_promoter = res.data.is_promoter
  341. that.extension_status = res.data.extension_status
  342. });
  343. },
  344. // 订单数字
  345. orderNum() {
  346. orderData().then(({
  347. data
  348. }) => {
  349. this.orderMenu.forEach((item, index) => {
  350. console.log('item')
  351. switch (item.title) {
  352. case '待付款':
  353. item.num = data.noPay
  354. break
  355. case '待发货':
  356. item.num = data.noPostage
  357. break
  358. case '待收货':
  359. item.num = data.noDeliver
  360. break
  361. case '待评价':
  362. item.num = data.noComment
  363. break
  364. case '售后/退款':
  365. item.num = data.refund
  366. break
  367. }
  368. })
  369. })
  370. },
  371. /**
  372. *
  373. * 获取个人中心图标
  374. */
  375. getMyMenus: function() {
  376. let that = this;
  377. if (this.MyMenus.length) return;
  378. getMenuList().then(res => {
  379. that.$set(that, 'MyMenus', res.data.menu);
  380. this.imgUrls = res.data.banner
  381. });
  382. },
  383. // 编辑页面
  384. goEdit() {
  385. uni.navigateTo({
  386. url: '/pages/users/user_info/index'
  387. })
  388. },
  389. // 签到
  390. goSignIn() {
  391. uni.navigateTo({
  392. url: '/pages/users/user_sgin/index'
  393. })
  394. },
  395. // goMenuPage
  396. goMenuPage(url) {
  397. if (this.isLogin) {
  398. uni.navigateTo({
  399. url
  400. })
  401. } else {
  402. // #ifdef MP
  403. this.openAuto()
  404. // #endif
  405. }
  406. }
  407. }
  408. }
  409. </script>
  410. <style lang="scss">
  411. .new-users {
  412. .head {
  413. background: #fff;
  414. .user-card {
  415. position: relative;
  416. width: 100%;
  417. padding: 35rpx 0 70rpx;
  418. background: linear-gradient(90deg, #EB3C3C 0%, #FF5D43 100%);
  419. .bg {
  420. position: absolute;
  421. left: 0;
  422. top: 0;
  423. width: 100%;
  424. height: 100%;
  425. background-image: url('~@/static/images/user_bg.png');
  426. background-size: 100% 100%;
  427. }
  428. .user-info {
  429. z-index: 20;
  430. position: relative;
  431. display: flex;
  432. padding: 0 28rpx;
  433. .avatar {
  434. width: 120rpx;
  435. height: 120rpx;
  436. border-radius: 50%;
  437. }
  438. .info {
  439. flex: 1;
  440. display: flex;
  441. flex-direction: column;
  442. justify-content: space-between;
  443. margin-left: 20rpx;
  444. padding: 15rpx 0;
  445. .name {
  446. display: flex;
  447. align-items: center;
  448. color: #fff;
  449. font-size: 31rpx;
  450. .vip {
  451. display: flex;
  452. align-items: center;
  453. height: 36rpx;
  454. padding: 0 20rpx;
  455. background: rgba(0, 0, 0, 0.2);
  456. border-radius: 18px;
  457. font-size: 20rpx;
  458. margin-left: 12rpx;
  459. image {
  460. width: 27rpx;
  461. height: 27rpx;
  462. }
  463. }
  464. }
  465. .num {
  466. display: flex;
  467. align-items: center;
  468. font-size: 26rpx;
  469. color: rgba(255, 255, 255, 0.6);
  470. image {
  471. width: 22rpx;
  472. height: 23rpx;
  473. margin-left: 20rpx;
  474. }
  475. }
  476. }
  477. }
  478. .num-wrapper {
  479. z-index: 30;
  480. position: relative;
  481. display: flex;
  482. align-items: center;
  483. justify-content: space-between;
  484. margin-top: 30rpx;
  485. // padding: 0 47rpx;
  486. color: #fff;
  487. .num-item {
  488. width: 25%;
  489. text-align: center;
  490. .num {
  491. font-size: 42rpx;
  492. font-weight: bold;
  493. }
  494. .txt {
  495. margin-top: 8rpx;
  496. font-size: 22rpx;
  497. color: rgba(255, 255, 255, 0.6);
  498. }
  499. }
  500. }
  501. .sign {
  502. z-index: 200;
  503. position: absolute;
  504. right: -12rpx;
  505. top: 80rpx;
  506. display: flex;
  507. align-items: center;
  508. justify-content: center;
  509. width: 120rpx;
  510. height: 60rpx;
  511. background: linear-gradient(90deg, rgba(255, 225, 87, 1) 0%, rgba(238, 193, 15, 1) 100%);
  512. border-radius: 29rpx 4rpx 4rpx 29rpx;
  513. color: #282828;
  514. font-size: 28rpx;
  515. font-weight: bold;
  516. }
  517. }
  518. }
  519. .wrapper {
  520. position: relative;
  521. top: -44rpx;
  522. padding: 0 20rpx;
  523. }
  524. .order-wrapper {
  525. background-color: #fff;
  526. border-radius: 12rpx;
  527. .order-hd {
  528. height: 80rpx;
  529. align-items: center;
  530. justify-content: space-between;
  531. border-bottom: 1px dashed #DDDDDD;
  532. padding: 0 30rpx;
  533. font-size: 30rpx;
  534. color: #282828;
  535. .right {
  536. align-items: center;
  537. color: #666666;
  538. font-size: 26rpx;
  539. .icon-xiangyou {
  540. margin-left: 5rpx;
  541. margin-top: 6rpx;
  542. font-size: 26rpx;
  543. }
  544. }
  545. }
  546. .order-bd {
  547. display: flex;
  548. // padding: 0 24rpx;
  549. .order-item {
  550. display: flex;
  551. flex-direction: column;
  552. justify-content: center;
  553. align-items: center;
  554. width: 20%;
  555. height: 160rpx;
  556. .pic {
  557. position: relative;
  558. text-align: center;
  559. image {
  560. width: 56rpx;
  561. height: 56rpx;
  562. }
  563. }
  564. .txt {
  565. margin-top: 15rpx;
  566. font-size: 26rpx;
  567. color: #454545;
  568. }
  569. }
  570. }
  571. }
  572. .slider-wrapper {
  573. margin: 20rpx 0;
  574. height: 130rpx;
  575. swiper,
  576. swiper-item {
  577. height: 100%;
  578. }
  579. image {
  580. width: 100%;
  581. height: 130rpx;
  582. }
  583. }
  584. .user-menus {
  585. padding-bottom: 30rpx;
  586. background-color: #fff;
  587. .title {
  588. height: 80rpx;
  589. line-height: 80rpx;
  590. padding: 0 30rpx;
  591. border-bottom: 1px dashed #DDDDDD;
  592. }
  593. .item {
  594. position: relative;
  595. display: flex;
  596. flex-direction: column;
  597. align-items: center;
  598. justify-content: space-between;
  599. width: 25%;
  600. line-height: 28rpx;
  601. height: 90rpx;
  602. margin-top: 30rpx;
  603. text-align: center;
  604. image {
  605. width: 52rpx;
  606. height: 52rpx;
  607. }
  608. text {
  609. margin-top: 10rpx;
  610. font-size: 26rpx;
  611. color: #282828;
  612. text-overflow: ellipsis;
  613. overflow: hidden;
  614. white-space: nowrap;
  615. width: 78%;
  616. }
  617. &:last-child::before {
  618. display: none;
  619. }
  620. }
  621. button {
  622. font-size: 28rpx;
  623. }
  624. }
  625. .phone {
  626. color: #fff;
  627. }
  628. .order-status-num {
  629. min-width: 12rpx;
  630. background-color: #fff;
  631. color: #ee5a52;
  632. border-radius: 15px;
  633. position: absolute;
  634. right: -14rpx;
  635. top: -15rpx;
  636. font-size: 20rpx;
  637. padding: 0 8rpx;
  638. border: 1px solid #ee5a52;
  639. }
  640. }
  641. .copy-right {
  642. display: flex;
  643. flex-direction: column;
  644. justify-content: center;
  645. align-items: center;
  646. color: #CCCCCC;
  647. font-size: 22rpx;
  648. .iconfont {
  649. font-size: 60rpx;
  650. }
  651. }
  652. .menu-box {
  653. display: flex;
  654. flex-wrap: wrap;
  655. }
  656. .right-btn {
  657. z-index: 99;
  658. position: absolute;
  659. right: 30rpx;
  660. top: 40rpx;
  661. display: flex;
  662. align-items: center;
  663. color: #fff;
  664. .iconfont {
  665. font-size: 40rpx;
  666. margin-left: 33rpx;
  667. }
  668. .btn {
  669. position: relative;
  670. }
  671. .iconnum {
  672. min-width: 6px;
  673. background-color: #fff;
  674. color: $theme-color;
  675. border-radius: 15rpx;
  676. position: absolute;
  677. right: -10rpx;
  678. top: -10rpx;
  679. font-size: 10px;
  680. padding: 0 4px;
  681. }
  682. }
  683. </style>