mine.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. <template>
  2. <view class="pageBg">
  3. <view class="header">
  4. <DtCustomBar title="我的"></DtCustomBar>
  5. <view @tap="tapToWhich('/pagesM/pages/mine_info')" style="display: flex;align-items: center;margin: 0 30upx;">
  6. <view class="member_head_img">
  7. <block v-if="isLogin">
  8. <image v-if="userDetail.avatar" :src="userDetail.avatar"></image>
  9. <button v-else class="avatar-wrap" open-type="getUserInfo" @getuserinfo="tapGetUserInfo" @tap.stop="() => false">
  10. <image src="http://139.9.103.171:1888/img/image/avatar.png"></image>
  11. </button>
  12. </block>
  13. <image v-else src="http://139.9.103.171:1888/img/image/avatar.png"></image>
  14. </view>
  15. <view v-if="isLogin" class="member_info">
  16. <view class="member_name_box">
  17. <view class="member_name">{{ userDetail.username }}</view>
  18. <!-- <view class="member_level">钻石卡</view> -->
  19. </view>
  20. <!-- <view v-if="userDetail.mobile" class="member_phone_box">
  21. <view class="member_phone">{{ userDetail.mobile }}</view>
  22. <image src="http://139.9.103.171:1888/img/image/edit_icon.png"></image>
  23. </view> -->
  24. </view>
  25. <view v-else class="no_login"><button class="no_login_btn">游客(未登录)</button></view>
  26. <view style="flex:1"></view>
  27. <!-- <view v-if="isLogin" @tap.stop="tapToWhich('/pages/mine_interest')" class="member_benefits">
  28. <image src="http://139.9.103.171:1888/img/image/diamond_icon.png"></image>
  29. <view class="member_benefits_text">会员权益</view>
  30. </view> -->
  31. </view>
  32. <view style="display: flex;margin: 22upx 64upx 0;justify-content: space-between;">
  33. <view @tap="tapHeadMenu(0)" style="text-align: center;">
  34. <view style="font-size: 28upx;color: #fff;">{{dataDetail.couponNum?dataDetail.couponNum:0}}</view>
  35. <view style="font-size: 24upx;color: #fff;margin-top: 10upx;">我的优惠券</view>
  36. </view>
  37. <view @tap="tapHeadMenu(1)" style="text-align: center;">
  38. <view style="font-size: 28upx;color: #fff;">{{dataDetail.favoriteNum?dataDetail.favoriteNum:0}}</view>
  39. <view style="font-size: 24upx;color: #fff;margin-top: 10upx;">收藏商品</view>
  40. </view>
  41. <view @tap="tapHeadMenu(2)" style="text-align: center;">
  42. <view style="font-size: 28upx;color: #fff;">{{dataDetail.browseNum?dataDetail.browseNum:0}}</view>
  43. <view style="font-size: 24upx;color: #fff;margin-top: 10upx;">浏览记录</view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- <view class="coupon_point" v-if="false">
  48. <view @tap="tapToWhich('/pages/coupon_list')" class="item">
  49. <view class="item_box">
  50. <view class="item_content">1</view>
  51. <view class="item_unit">张</view>
  52. </view>
  53. <text class="item_text">优惠券</text>
  54. </view>
  55. <view class="line"></view>
  56. <view @tap="tapToWhich('/pages/integral')" class="item">
  57. <view class="item_box">
  58. <view class="item_content">100</view>
  59. <view class="item_unit"></view>
  60. </view>
  61. <text class="item_text">我的积分</text>
  62. </view>
  63. </view> -->
  64. <view class="mine_order_statue">
  65. <view class="order_wrap">
  66. <view class="mine_order_text">我的订单</view>
  67. <view @tap="tapToOrder(0)" class="jump_all_order">
  68. <text style="color:#C1C1C1;font-size: 24upx;">查看全部</text>
  69. <image src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  70. </view>
  71. </view>
  72. <view class="order_statue_list">
  73. <view class="order_statue_item" v-for="(item, index) in orderStateList" :key="index" @tap="tapToOrder(item.state)">
  74. <image :src="item.icon" mode="aspectFit"></image>
  75. <text>{{ item.statueName }}</text>
  76. <!-- 待付款数量 -->
  77. <view v-if="index == 0 && orderStatusNum.pendingPayment > 0" class="tip_count">{{ orderStatusNum.pendingPayment }}</view>
  78. <!-- 待发货数量 -->
  79. <view v-if="index == 1 && orderStatusNum.pendingShipment > 0" class="tip_count">{{ orderStatusNum.pendingShipment }}</view>
  80. <!-- 待收货数量 -->
  81. <view v-if="index == 2 && orderStatusNum.shipped > 0" class="tip_count">{{ orderStatusNum.shipped }}</view>
  82. <!-- 待评论数量 -->
  83. <view v-if="index == 3 && orderStatusNum.pendingReview > 0" class="tip_count">{{ orderStatusNum.pendingReview }}</view>
  84. <!-- 售后数量 -->
  85. <view v-if="index == 4 && orderStatusNum.afterSale > 0" class="tip_count">{{ orderStatusNum.afterSale }}</view>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="item_list">
  90. <view class="item" v-for="(item, index) in mineItemList" :key="index" @tap="tapToMenu(index,item.itemName)">
  91. <view class="item_content">
  92. <image :src="item.itemIcon"></image>
  93. <text>{{ item.itemName }}</text>
  94. </view>
  95. <view class="">
  96. <text v-if="index==0" style="padding-right: 16rpx;color: #D43A39;font-size: 26rpx;">已认证</text>
  97. <image src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  98. </view>
  99. </view>
  100. </view>
  101. <!-- 微信客服 -->
  102. <DtService />
  103. <DtLogin ref="dialogLogin" @signIn="onSignIn" />
  104. </view>
  105. </template>
  106. <script>
  107. import DtLogin from '../comps/dt_login.vue';
  108. import DtService from '../comps/dt_service.vue';
  109. import DtCustomBar from '../comps/dt_custom_bar.vue'
  110. export default {
  111. components: {
  112. DtLogin,
  113. DtService,
  114. DtCustomBar
  115. },
  116. data() {
  117. return {
  118. orderStateList: [
  119. {
  120. statueName: '待付款',
  121. icon: 'http://139.9.103.171:1888/img/image/wait_pay.png',
  122. count: 1,
  123. state: 1
  124. },
  125. {
  126. statueName: '待发货',
  127. icon: 'http://139.9.103.171:1888/img/image/wait_ship.png',
  128. count: 2,
  129. state: 2
  130. },
  131. {
  132. statueName: '待收货',
  133. icon: 'http://139.9.103.171:1888/img/image/wait_receipt.png',
  134. count: 2,
  135. state: 3
  136. },
  137. {
  138. statueName: '待评价',
  139. icon: 'http://139.9.103.171:1888/img/image/wait_comment.png',
  140. count: 2,
  141. state: 5
  142. },
  143. {
  144. statueName: '退款/售后',
  145. icon: 'http://139.9.103.171:1888/img/image/wait_refund.png',
  146. count: 2,
  147. state: 7
  148. }
  149. ],
  150. mineItemList: [
  151. {
  152. itemName: '住户认证',
  153. itemIcon: 'http://139.9.103.171:1888/img/image/item_problem_feedback.png'
  154. },
  155. {
  156. itemName: '我的消息',
  157. itemIcon: 'http://139.9.103.171:1888/img/image/item_problem_feedback.png'
  158. },
  159. {
  160. itemName: '收货地址',
  161. itemIcon: 'http://139.9.103.171:1888/img/image/item_address_icon.png'
  162. },
  163. {
  164. itemName: '问题反馈',
  165. itemIcon: 'http://139.9.103.171:1888/img/image/item_problem_feedback.png'
  166. },
  167. {
  168. itemName: '客服中心',
  169. itemIcon: 'http://139.9.103.171:1888/img/image/item_concat_icon.png'
  170. },
  171. {
  172. itemName: '使用说明',
  173. itemIcon: 'http://139.9.103.171:1888/img/image/item_problem_feedback.png'
  174. },
  175. ],
  176. memberId: '',
  177. dataDetail: {},
  178. orderStatusNum: {},
  179. userDetail: {},
  180. isLogin: false,
  181. };
  182. },
  183. computed: {
  184. orderState() {
  185. return this.$global.orderState;
  186. }
  187. },
  188. methods: {
  189. async tapGetUserInfo(e) {
  190. console.log(158, e);
  191. if (e.detail.errMsg == 'getUserInfo:ok') {
  192. let userInfo = e.detail.userInfo;
  193. let resp = await this.$api.updateIcon({
  194. _isShowLoading: true,
  195. userId: this.memberId,
  196. avatar: userInfo.avatarUrl
  197. });
  198. this.userDetail.avatar = userInfo.avatarUrl;
  199. }
  200. },
  201. showLogin() {
  202. this.$refs.dialogLogin.show();
  203. },
  204. // 登录成功响应事件
  205. onSignIn(resp) {
  206. console.log(143, resp);
  207. this.$util.refreshPage(['pages/home', 'pages/shop_car']);
  208. this.onPullDownRefreshPage();
  209. },
  210. tapToWhich(aimUrl) {
  211. if (!this.$auth.isAuth) {
  212. this.showLogin();
  213. return;
  214. }
  215. uni.navigateTo({
  216. url: aimUrl
  217. });
  218. },
  219. tapToOrder(state) {
  220. if (!this.$auth.isAuth) {
  221. this.showLogin();
  222. return;
  223. }
  224. // console.log(180, state)
  225. // if(state==7){
  226. // uni.navigateTo({
  227. // url: '/pages/mine_sale_list'
  228. // })
  229. // }else{
  230. uni.navigateTo({
  231. url: '/pagesM/pages/mine_order_list?state=' + state
  232. });
  233. // }
  234. },
  235. onShareAppMessage: function(e) {
  236. return {
  237. path: '/pagesM/pages/home'
  238. }
  239. },
  240. tapHeadMenu(index){
  241. let url;
  242. if(index==0){
  243. url = '/pagesM/pages/coupon_list'
  244. }else if(index==1){
  245. url = '/pagesM/pages/mine_collection'
  246. }else if(index==2){
  247. url = '/pagesM/pages/browse_records'
  248. }
  249. uni.navigateTo({
  250. url: url
  251. });
  252. },
  253. tapToMenu(idx,name) {
  254. if (!this.$auth.isAuth) {
  255. this.showLogin();
  256. return;
  257. }
  258. if(name=='分销商品'&&!this.$auth.isPromoter())return;
  259. switch (idx) {
  260. case 0: // 分销商品
  261. uni.navigateTo({
  262. url: '/pagesM/pages/discounts_goods'
  263. });
  264. break;
  265. case 1: // 团长收益
  266. uni.navigateTo({
  267. url: '/pagesM/pages/mine_income'
  268. });
  269. break;
  270. case 2: // 在线客服
  271. this.makePhoneCall(this.dataDetail.serviceTel);
  272. break;
  273. case 3: // 收货地址
  274. uni.navigateTo({
  275. url: '/pagesM/pages/address_list'
  276. });
  277. break;
  278. case 4: // 快速取货
  279. uni.navigateTo({
  280. url: "/pagesM/pages/claim_goods"
  281. })
  282. break;
  283. case 5: // 问题反馈
  284. uni.navigateTo({
  285. url: '/pagesM/pages/user_feedback'
  286. });
  287. break;
  288. case 6: // 关于新邻
  289. uni.navigateTo({
  290. url: '/pagesM/pages/about_us'
  291. });
  292. break;
  293. case 7: // 分享商城
  294. this.onShareAppMessage();
  295. break;
  296. default:
  297. break;
  298. }
  299. },
  300. // 获取会员信息
  301. async getData() {
  302. let resp = await this.$api.BCmy({
  303. _isShowLoading: true
  304. });
  305. resp.name = resp.username;
  306. this.dataDetail = resp;
  307. },
  308. async getMyBaseDatas() {
  309. let resp = await this.$api.getMyBaseDatas({
  310. _isReject: true,
  311. _isPull: this.isPull,
  312. memberId: this.memberId
  313. });
  314. console.log(resp)
  315. this.$auth.getMineBase(resp);
  316. this.dataDetail = resp;
  317. this.orderStatusNum = resp.orderStatusNum || {};
  318. this.userDetail = resp.user || {};
  319. },
  320. onLoadPage() {
  321. // wx.hideShareMenu();
  322. this.isLogin = this.$auth.isAuth;
  323. this.memberId = this.$auth.getMemberId();
  324. this.getMyBaseDatas();
  325. // this.getData()
  326. }
  327. },
  328. onLoad() {
  329. wx.showShareMenu({
  330. withShareTicket: true
  331. })
  332. },
  333. onReady() {
  334. if (!this.$auth.isAuth) {
  335. this.showLogin();
  336. return;
  337. } else {
  338. this.$refs.dialogLogin.hide();
  339. }
  340. },
  341. onShow() {
  342. this.onShowPage();
  343. },
  344. onPullDownRefresh() {
  345. this.onPullDownRefreshPage();
  346. }
  347. };
  348. </script>
  349. <!-- 旧的主题色#8467dd -->
  350. <style lang="scss" scoped>
  351. .pageBg {
  352. background-color: #F6F4F5;
  353. }
  354. button::after {
  355. border: none;
  356. }
  357. .header {
  358. background-image: url(http://139.9.103.171:1888/img/image/mine_head_bg.png);
  359. height: 480upx;
  360. background-repeat: no-repeat;
  361. background-size: 100% 100%;
  362. .member_head_img {
  363. margin-right: 30upx;
  364. image {
  365. width: 88upx;
  366. height: 88upx;
  367. border-radius: 59rpx;
  368. }
  369. .avatar-wrap {
  370. display: inline-flex;
  371. border: 0;
  372. background-color: transparent;
  373. }
  374. }
  375. .no_login {
  376. display: flex;
  377. flex-direction: column;
  378. .no_login_btn {
  379. border-radius: 25px;
  380. font-size: 26upx;
  381. color: #fff;
  382. width: fit-content;
  383. padding: 0 15upx;
  384. height: 60upx;
  385. line-height: 60upx;
  386. background: transparent;
  387. }
  388. }
  389. .member_info {
  390. display: flex;
  391. flex-direction: column;
  392. .member_name_box {
  393. display: flex;
  394. flex-direction: row;
  395. align-items: center;
  396. .member_name {
  397. font-size: 32upx;
  398. color: #fff;
  399. font-weight: bold;
  400. }
  401. .member_level {
  402. background: #ffc600;
  403. color: #fff;
  404. font-size: 22upx;
  405. border-radius: 4upx;
  406. padding: 5upx 10upx;
  407. margin-left: 10upx;
  408. }
  409. }
  410. .member_phone_box {
  411. display: flex;
  412. flex-direction: row;
  413. align-items: center;
  414. .member_phone {
  415. margin-top: -20rpx;
  416. font-size: 24upx;
  417. color: #999999;
  418. }
  419. image {
  420. width: 19upx;
  421. height: 19upx;
  422. padding: 20upx;
  423. }
  424. }
  425. }
  426. .member_benefits {
  427. background: #fff;
  428. width: 180upx;
  429. display: flex;
  430. flex-direction: row;
  431. align-items: center;
  432. text-align: center;
  433. border-radius: 27upx 0px 0px 27upx;
  434. height: 54upx;
  435. text-align: center;
  436. position: absolute;
  437. right: 0;
  438. image {
  439. width: 26upx;
  440. height: 23upx;
  441. padding: 0 10upx 0 30upx;
  442. }
  443. .member_benefits_text {
  444. font-size: 24upx;
  445. color: $dt-color-primary;
  446. letter-spacing: 2upx;
  447. }
  448. }
  449. button::after {
  450. border: none;
  451. }
  452. }
  453. .coupon_point {
  454. display: flex;
  455. flex-direction: row;
  456. align-items: center;
  457. height: 110upx;
  458. background: #fff;
  459. justify-content: space-around;
  460. .item {
  461. display: flex;
  462. flex-direction: column;
  463. align-items: center;
  464. width: 50%;
  465. .item_box {
  466. display: flex;
  467. flex-direction: row;
  468. align-items: center;
  469. letter-spacing: 2upx;
  470. .item_content {
  471. color: $dt-color-primary;
  472. font-size: 34upx;
  473. }
  474. .item_unit {
  475. color: $dt-color-primary;
  476. font-size: 22upx;
  477. margin-top: 6upx;
  478. }
  479. }
  480. .item_text {
  481. color: #333333;
  482. font-size: 22upx;
  483. }
  484. }
  485. .line {
  486. width: 1upx;
  487. height: 50upx;
  488. background: #e5e5e5;
  489. }
  490. }
  491. .mine_order_statue {
  492. margin: -100upx 20upx 0;
  493. background: #fff;
  494. padding: 30upx 40upx;
  495. border-radius: 20rpx;
  496. .order_wrap {
  497. display: flex;
  498. flex-direction: row;
  499. align-items: center;
  500. justify-content: space-between;
  501. box-sizing: border-box;
  502. .mine_order_text {
  503. font-size: 28upx;
  504. font-weight: bold;
  505. color: #333333;
  506. }
  507. .jump_all_order {
  508. display: flex;
  509. flex-direction: row;
  510. align-items: center;
  511. text {
  512. color: #999999;
  513. font-size: 22upx;
  514. margin-right: 10upx;
  515. }
  516. image {
  517. width: 10upx;
  518. height: 18upx;
  519. }
  520. }
  521. }
  522. .order_statue_list {
  523. display: flex;
  524. flex-direction: row;
  525. align-items: center;
  526. justify-content: space-between;
  527. .order_statue_item {
  528. display: flex;
  529. flex-direction: column;
  530. align-items: center;
  531. position: relative;
  532. margin-top: 32upx;
  533. image {
  534. width: 40upx;
  535. height: 40upx;
  536. }
  537. text {
  538. font-size: 24rpx;
  539. color: #333333;
  540. letter-spacing: 1upx;
  541. margin-top: 10upx;
  542. }
  543. .tip_count {
  544. position: absolute;
  545. right: 0upx;
  546. top: -6rpx;
  547. width: 24upx;
  548. height: 24upx;
  549. border-radius: 50%;
  550. background-color: #ff3b30;
  551. color: #fff;
  552. font-size: 18upx;
  553. text-align: center;
  554. line-height: 24upx;
  555. }
  556. }
  557. }
  558. }
  559. .item_list {
  560. display: flex;
  561. flex-direction: column;
  562. background: #fff;
  563. margin-top: 20upx;
  564. margin-left: 20rpx;
  565. margin-right: 20rpx;
  566. border-radius: 20rpx;
  567. .item {
  568. display: flex;
  569. flex-direction: row;
  570. align-items: center;
  571. justify-content: space-between;
  572. padding: 0 30upx;
  573. height: 90upx;
  574. border-bottom: 1upx solid #e5e5e5;
  575. .item_content {
  576. display: flex;
  577. flex-direction: row;
  578. align-items: center;
  579. image {
  580. width: 38upx;
  581. height: 38upx;
  582. }
  583. text {
  584. font-size: 28upx;
  585. color: #333333;
  586. margin-left: 20upx;
  587. }
  588. }
  589. image {
  590. width: 10upx;
  591. height: 18upx;
  592. }
  593. }
  594. .item:last-child {
  595. border: none;
  596. }
  597. }
  598. </style>