index.vue 14 KB

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