index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. <template>
  2. <view class="user-index" v-if="!loadding">
  3. <!-- #ifdef APP-PLUS -->
  4. <header-bar :bcolor="'#e2231a'"></header-bar>
  5. <!-- #endif -->
  6. <!--个人信息-->
  7. <view class="user-header">
  8. <view class="user-header-inner">
  9. <view class="user-info">
  10. <view class="photo">
  11. <image :src="detail.avatarUrl" mode="aspectFill"></image>
  12. </view>
  13. <view class="info">
  14. <view class="d-c-c mb23">
  15. <view class="name">{{ detail.nickName }}</view>
  16. <text class="ml20 grade" v-if="detail.grade_id > 0">
  17. {{ detail.grade.name }}
  18. </text>
  19. </view>
  20. <view class="tel d-s-c">
  21. <text class="f26">会员号:{{ detail.user_no }}</text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <!--我的订单-->
  27. <view class="my-order">
  28. <view class="list d-a-c flex-1">
  29. <view class="item d-c-c d-c" @click="jumpPage('/pages/user/my-wallet/my-wallet')">
  30. <view class=" red_mini">{{ detail.balance }}</view>
  31. <text class="pt16 f24 gray3">账号余额</text>
  32. </view>
  33. <view v-if="setting.is_show_personal_points != 0" class="item order_center d-c-c d-c"
  34. @click="jumpPage('/pages/user/points/points')">
  35. <view class=" red_mini">{{ detail.points }}</view>
  36. <text class="pt16 f24 gray3">{{setting.points_name}}</text>
  37. </view>
  38. <view class="item d-c-c d-c" @click="jumpPage('/pages/user/my-coupon/my-coupon')">
  39. <view class="red_mini">{{ coupon }}</view>
  40. <text class="pt16 f24 gray3">优惠券</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="bind_phone" v-if="!detail.mobile">
  46. <view class="bind_content">
  47. <view class="bind_txt">确保账户安全,请绑定手机号</view>
  48. <!-- #ifdef MP-WEIXIN -->
  49. <button open-type="getPhoneNumber" class="bind_btn" @getphonenumber="getPhoneNumber">去绑定</button>
  50. <!-- #endif -->
  51. <!-- #ifndef MP-WEIXIN -->
  52. <button class="bind_btn" @click="bindMobile">去绑定</button>
  53. <!-- #endif -->
  54. </view>
  55. </view>
  56. <!--我的资产-->
  57. <view class="my-assets">
  58. <view class="my-assets-all">
  59. <view class="f30 fb">我的订单</view>
  60. <view class="gray9 f26" @click="jumpPage('/pages/order/myorder?dataType=all')">全部订单<text
  61. class="icon iconfont icon-jiantou"></text></view>
  62. </view>
  63. <view class="d-b-c w100">
  64. <view class="item" @click="jumpPage('/pages/order/myorder?dataType=payment')">
  65. <view class="icon-box pr">
  66. <image src="../../../static/icon/icon-icon.png" mode=""></image>
  67. <text class="dot d-c-c"
  68. v-if="orderCount.payment != null && orderCount.payment > 0">{{ orderCount.payment }}</text>
  69. </view>
  70. <text>待付款</text>
  71. </view>
  72. <view class="item" @click="jumpPage('/pages/order/myorder?dataType=delivery')">
  73. <view class="icon-box pr">
  74. <image src="../../../static/icon/icon-daifahuo.png" mode=""></image>
  75. <text class="dot d-c-c"
  76. v-if="orderCount.delivery != null && orderCount.delivery > 0">{{ orderCount.delivery }}</text>
  77. </view>
  78. <text class="">待发货</text>
  79. </view>
  80. <view class="item" @click="jumpPage('/pages/order/myorder?dataType=received')">
  81. <view class="icon-box pr">
  82. <image src="../../../static/icon/icon-daishouhuo.png" mode=""></image>
  83. <text class="dot d-c-c"
  84. v-if="orderCount.received != null && orderCount.received > 0">{{ orderCount.received }}</text>
  85. </view>
  86. <text>待收货</text>
  87. </view>
  88. <view class="item" @click="jumpPage('/pages/order/myorder?dataType=comment')">
  89. <view class="icon-box pr">
  90. <image src="../../../static/icon/icon-quanbudingdan.png" mode=""></image>
  91. <text class="dot d-c-c"
  92. v-if="orderCount.comment != null && orderCount.comment > 0">{{ orderCount.comment }}</text>
  93. </view>
  94. <text>待评价</text>
  95. </view>
  96. <view class="item" @click="jumpPage('/pages/order/refund/index/index')">
  97. <view class="icon-box pr">
  98. <image src="../../../static/icon/icon-tuikuan.png" mode=""></image>
  99. <text class="dot d-c-c"
  100. v-if="orderCount.refund != null && orderCount.refund > 0">{{ orderCount.refund }}</text>
  101. </view>
  102. <text>退款/售后</text>
  103. </view>
  104. </view>
  105. </view>
  106. <!--菜单-->
  107. <view class="menu-wrap">
  108. <view class="group-bd f-w">
  109. <view :class="'item ' + item.icon + '-box'" v-for="(item, index) in menus" :key="index"
  110. @click="jumpPage(item.path)">
  111. <view class="icon-round d-c-c">
  112. <image class="icon-round" :src="item.icon" mode="aspectFill"></image>
  113. </view>
  114. <text class="name">{{ item.name }}</text>
  115. </view>
  116. </view>
  117. </view>
  118. <view v-if="invitation.is_open && invitation.invitation_id > 0">
  119. <view class="activity_img" @click="toinvitation(invitation.invitation_id)">
  120. <image :src="invitation.image" mode=""></image>
  121. </view>
  122. </view>
  123. <!--推荐-->
  124. <view>
  125. <recommendProduct :location="20"></recommendProduct>
  126. </view>
  127. </view>
  128. </template>
  129. <script>
  130. import recommendProduct from '@/components/recommendProduct/recommendProduct.vue';
  131. export default {
  132. components: {
  133. recommendProduct
  134. },
  135. data() {
  136. return {
  137. /*签到数据*/
  138. sign: {},
  139. /*是否加载完成*/
  140. loadding: true,
  141. indicatorDots: true,
  142. autoplay: true,
  143. interval: 2000,
  144. duration: 500,
  145. /*菜单*/
  146. menus: [],
  147. invitation: {},
  148. detail: {
  149. balance: 0,
  150. points: 0,
  151. grade: {
  152. name: ''
  153. },
  154. },
  155. orderCount: {},
  156. coupon: 0,
  157. setting: {},
  158. user_type: '', //用户状态
  159. sessionKey: ''
  160. };
  161. },
  162. onShow() {
  163. /*获取个人中心数据*/
  164. this.getData();
  165. },
  166. onLoad(e) {
  167. let self = this;
  168. if (e.invitation_id) {
  169. uni.setStorageSync('invitation_id', e.invitation_id);
  170. }
  171. if (e.referee_id) {
  172. uni.setStorageSync('referee_id', e.referee_id);
  173. }
  174. //#ifdef MP-WEIXIN
  175. wx.login({
  176. success(res) {
  177. // 发送用户信息
  178. self._post('user.user/getSession', {
  179. code: res.code
  180. }, result => {
  181. self.sessionKey = result.data.session_key;
  182. });
  183. }
  184. });
  185. //#endif
  186. },
  187. methods: {
  188. /*获取数据*/
  189. getData() {
  190. let self = this;
  191. uni.showLoading({
  192. title: '加载中'
  193. });
  194. self._post('user.index/detail', {
  195. source: self.getPlatform()
  196. }, function(res) {
  197. //#ifdef MP-WEIXIN
  198. if (res.data.getPhone) {
  199. //#ifdef MP-WEIXIN
  200. self.gotoPage('/pages/login/bindmobile');
  201. //#endif
  202. //#ifndef MP-WEIXIN
  203. self.bindMobile();
  204. //#endif
  205. return;
  206. }
  207. //#endif
  208. self.detail = res.data.userInfo;
  209. self.sign = res.data.sign;
  210. self.coupon = res.data.coupon;
  211. self.orderCount = res.data.orderCount;
  212. self.menus = res.data.menus;
  213. self.invitation = res.data.invitation;
  214. self.setting = res.data.setting;
  215. self.loadding = false;
  216. uni.hideLoading();
  217. });
  218. },
  219. bindMobile() {
  220. this.gotoPage("/pages/user/modify-phone/modify-phone");
  221. },
  222. /*跳转页面*/
  223. jumpPage(path) {
  224. this.gotoPage(path);
  225. },
  226. toinvitation(id) {
  227. if (id == 0) {
  228. uni.showToast({
  229. title: '暂无活动'
  230. })
  231. } else {
  232. this.gotoPage('/pages/user/invite/invite?invitation_gift_id=' + id);
  233. }
  234. },
  235. getPhoneNumber(e) {
  236. var self = this;
  237. console.log(e.detail);
  238. if (e.detail.errMsg !== 'getPhoneNumber:ok') {
  239. return false;
  240. }
  241. uni.showLoading({
  242. title: "正在提交",
  243. mask: true
  244. });
  245. // 发送用户信息
  246. self._post('user.user/bindMobile', {
  247. session_key: self.sessionKey,
  248. encrypted_data: e.detail.encryptedData,
  249. iv: e.detail.iv,
  250. }, result => {
  251. uni.showToast({
  252. title: '绑定成功'
  253. });
  254. // 执行回调函数
  255. self.detail.mobile = result.data.mobile;
  256. }, false, () => {
  257. uni.hideLoading();
  258. });
  259. },
  260. }
  261. };
  262. </script>
  263. <style lang="scss">
  264. page {
  265. background-color: #EBEBEB;
  266. }
  267. .w100 {
  268. width: 100%;
  269. }
  270. .foot_ {
  271. height: 98rpx;
  272. width: 100%;
  273. }
  274. .user-header {
  275. position: relative;
  276. background: $dominant-color;
  277. }
  278. .user-header .user-header-inner {
  279. position: relative;
  280. padding: 30rpx 30rpx 120rpx;
  281. display: flex;
  282. justify-content: space-between;
  283. align-items: center;
  284. overflow: hidden;
  285. margin-bottom: 100rpx;
  286. }
  287. .user-header .user-header-inner::after,
  288. .user-header .user-header-inner::before {
  289. display: block;
  290. content: '';
  291. position: absolute;
  292. border-radius: 50%;
  293. z-index: 0;
  294. }
  295. .user-header .user-header-inner::after {
  296. width: 400rpx;
  297. height: 400rpx;
  298. right: -100rpx;
  299. bottom: -200rpx;
  300. background-image: radial-gradient(90deg, rgba(255, 255, 255, 0.2) 10%, rgba(255, 255, 255, 0));
  301. }
  302. .user-header .user-header-inner::before {
  303. width: 200rpx;
  304. height: 200rpx;
  305. left: -60rpx;
  306. top: -20rpx;
  307. background-image: radial-gradient(-90deg, rgba(255, 255, 255, 0.2) 10%, rgba(255, 255, 255, 0));
  308. }
  309. .user-header .user-info {
  310. display: flex;
  311. justify-content: flex-start;
  312. align-items: center;
  313. }
  314. .user-header .photo,
  315. .user-header .photo image {
  316. width: 100rpx;
  317. height: 100rpx;
  318. border-radius: 50%;
  319. }
  320. .user-header .photo {
  321. border: 4rpx solid #ffffff;
  322. }
  323. .user-header .info {
  324. padding-left: 20rpx;
  325. box-sizing: border-box;
  326. overflow: hidden;
  327. color: #ffffff;
  328. }
  329. .user-header .info .name {
  330. font-weight: bold;
  331. font-size: 32rpx;
  332. }
  333. .user-header .info .tel {
  334. font-size: 26rpx;
  335. }
  336. .user-header .info .grade {
  337. display: block;
  338. padding: 4px 16rpx;
  339. font-size: 22rpx;
  340. /* height: 36rpx; */
  341. line-height: 36rpx;
  342. border-radius: 40rpx;
  343. background: #B90F00;
  344. color: #ffffff;
  345. font-family: PingFang SC;
  346. opacity: 0;
  347. }
  348. .user-header .sign-box {
  349. position: absolute;
  350. right: 20rpx;
  351. padding: 0 10rpx;
  352. height: 50rpx;
  353. border: 1px solid #ffe300;
  354. border-radius: 25rpx;
  355. font-size: 24rpx;
  356. color: #ffe300;
  357. z-index: 10;
  358. }
  359. .user-header .sign-box .iconfont {
  360. color: #ffe300;
  361. }
  362. .user-header .my-order {
  363. position: absolute;
  364. padding: 0 30rpx;
  365. /* height: 240rpx; */
  366. right: 20rpx;
  367. bottom: -75rpx;
  368. left: 20rpx;
  369. box-sizing: border-box;
  370. border-radius: 16rpx;
  371. /* box-shadow: 0 0 6rpx 0 rgba(0, 0, 0, 0.1); */
  372. background: #ffffff;
  373. z-index: 10;
  374. }
  375. .order_center {
  376. border-left: 1rpx solid #D9D9D9;
  377. border-right: 1rpx solid #D9D9D9;
  378. }
  379. .my-order .item {
  380. display: flex;
  381. margin: 20rpx 0;
  382. flex-direction: column;
  383. justify-content: center;
  384. align-items: center;
  385. font-size: 26rpx;
  386. flex: 1;
  387. }
  388. .my-assets .icon-box image {
  389. width: 48rpx;
  390. height: 48rpx;
  391. margin-bottom: 16rpx;
  392. }
  393. .my-order .icon-box,
  394. .my-assets .icon-box {
  395. width: 60rpx;
  396. height: 60rpx;
  397. }
  398. .my-order .icon-box .iconfont,
  399. .my-assets .icon-box .iconfont {
  400. font-size: 50rpx;
  401. color: #333333;
  402. }
  403. .my-assets .icon-box .dot {
  404. position: absolute;
  405. top: -13rpx;
  406. right: -8rpx;
  407. height: 25rpx;
  408. min-width: 25rpx;
  409. padding: 4rpx;
  410. border-radius: 20rpx;
  411. font-size: 20rpx;
  412. background: #f00808;
  413. color: #ffffff;
  414. }
  415. .my-assets {
  416. margin: 0 20rpx;
  417. padding: 30rpx;
  418. padding-top: 0;
  419. background: #ffffff;
  420. border-radius: 12rpx;
  421. }
  422. .my-assets .item {
  423. display: flex;
  424. flex-direction: column;
  425. justify-content: center;
  426. align-items: center;
  427. }
  428. .my-wallet {
  429. position: relative;
  430. width: 200rpx;
  431. border-left: 1px solid #dddddd;
  432. }
  433. .my-wallet::after {
  434. position: absolute;
  435. display: block;
  436. content: '';
  437. left: 0;
  438. border: 8rpx solid transparent;
  439. border-left-color: #dddddd;
  440. }
  441. .menu-wrap {
  442. margin: 0 20rpx;
  443. margin-top: 30rpx;
  444. background: #ffffff;
  445. /* box-shadow: 0 0 6rpx 0 rgba(0, 0, 0, 0.1); */
  446. border-radius: 12rpx;
  447. }
  448. .menu-wrap .group-bd {
  449. display: flex;
  450. justify-content: flex-start;
  451. align-items: flex-start;
  452. }
  453. .menu-wrap .item {
  454. display: flex;
  455. justify-content: center;
  456. align-items: center;
  457. flex-direction: column;
  458. width: 142rpx;
  459. height: 150rpx;
  460. font-size: 24rpx;
  461. }
  462. .menu-wrap .item.icon-dizhi1-box .icon-round {
  463. background-image: linear-gradient(135deg, #67b4e2 10%, #356dce 70%, #5c8fe8 90%);
  464. }
  465. .menu-wrap .item.icon-youhuiquan1-box .icon-round {
  466. background-image: linear-gradient(135deg, #e87ea4 10%, #ff268a 70%, #fe0d76 90%);
  467. }
  468. .menu-wrap .item.icon-youhuiquan--box .icon-round {
  469. background-image: linear-gradient(135deg, #ff5a30 10%, #ff2b3c 70%, #ff1740 90%);
  470. }
  471. .menu-wrap .item.icon-fenxiao1-box .icon-round {
  472. background-image: linear-gradient(135deg, #7ceeba 10%, #1ed2b7 70%, #17c0ad 90%);
  473. }
  474. .menu-wrap .item.icon-kanjia-box .icon-round {
  475. background-image: linear-gradient(135deg, #f2a904 10%, #f27d04 70%, #eaa031 90%);
  476. }
  477. .menu-wrap .item.icon-shezhi1-box .icon-round {
  478. background-image: linear-gradient(135deg, #615f6c 10%, #4c4a58 70%, #615f6c 90%);
  479. }
  480. .menu-wrap .icon-round {
  481. width: 48rpx;
  482. height: 48rpx;
  483. color: #ffffff;
  484. }
  485. .menu-wrap .item .iconfont {
  486. font-size: 40rpx;
  487. color: #ffffff;
  488. }
  489. .menu-wrap .item .name {
  490. margin-top: 19rpx;
  491. }
  492. .bind_phone {
  493. width: 100%;
  494. height: 80rpx;
  495. padding: 0 30rpx;
  496. box-sizing: border-box;
  497. margin-bottom: 30rpx;
  498. }
  499. .bind_content {
  500. display: flex;
  501. justify-content: space-between;
  502. align-items: center;
  503. background: #ffffff;
  504. /* box-shadow: 0 0 6rpx 0 rgba(0, 0, 0, 0.1); */
  505. border-radius: 16rpx;
  506. height: 100%;
  507. padding: 0 20rpx;
  508. }
  509. .bind_txt {}
  510. .bind_btn {
  511. width: 134rpx;
  512. height: 50rpx;
  513. line-height: 50rpx;
  514. font-size: 22rpx;
  515. border-radius: 25rpx;
  516. text-align: center;
  517. color: #FFFFFF;
  518. background-color: $dominant-color;
  519. }
  520. .vertical {
  521. position: absolute;
  522. top: 10px;
  523. right: 53px;
  524. z-index: 100000;
  525. }
  526. .vertical_img {
  527. width: 100rpx;
  528. height: 100rpx;
  529. }
  530. .f20 {
  531. margin-left: 5rpx;
  532. font-size: 19rpx;
  533. }
  534. .red_mini {
  535. color: #333333;
  536. font-size: 36rpx;
  537. font-weight: bold;
  538. }
  539. .icon-zhuanshutequan {
  540. color: #f5dca6;
  541. margin-right: 3px;
  542. }
  543. .news {
  544. position: absolute;
  545. top: 40rpx;
  546. right: 20rpx;
  547. z-index: 100;
  548. }
  549. .news .chat {
  550. width: 40rpx;
  551. height: 40rpx;
  552. }
  553. .news .icon-xiaoxi {
  554. font-size: 50rpx;
  555. color: #FFFFFF;
  556. }
  557. .news_num {
  558. position: absolute;
  559. top: 24rpx;
  560. right: 44rpx;
  561. z-index: 100;
  562. border-radius: 50%;
  563. width: 25rpx;
  564. height: 25rpx;
  565. text-align: center;
  566. line-height: 25rpx;
  567. color: #FFFFFF;
  568. background-color: #ff6633;
  569. padding: 5rpx;
  570. font-size: 20rpx;
  571. }
  572. .activity_img {}
  573. .activity_img image {
  574. width: 676rpx;
  575. height: 188rpx;
  576. border: 5rpx solid #ff2b3c;
  577. margin: 0 auto;
  578. margin-top: 15rpx;
  579. }
  580. .my-assets-all {
  581. display: flex;
  582. justify-content: space-between;
  583. align-items: center;
  584. height: 90rpx;
  585. line-height: 90rpx;
  586. }
  587. .my-assets-all .icon.icon-jiantou {
  588. font-size: 12px;
  589. color: #999999;
  590. }
  591. </style>