wode2.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  1. <template>
  2. <view class="">
  3. <view class="pageBg">
  4. <view class="header">
  5. <DtCustomBar title="我的"></DtCustomBar>
  6. <view @tap="tapToWhich('/pagesM/pages/mine_info')"
  7. style="display: flex;align-items: center;margin: 0 30upx;">
  8. <view class="member_head_img">
  9. <block v-if="isLogin">
  10. <image v-if="userDetail.avatar" :src="userDetail.avatar"></image>
  11. <button v-else class="avatar-wrap" open-type="getUserInfo" @getuserinfo="tapGetUserInfo"
  12. @tap.stop="() => false">
  13. <image src="https://szsq.nxzhsq.cn/community/miniofile/image/avatar.png"></image>
  14. </button>
  15. </block>
  16. <image v-else src="https://szsq.nxzhsq.cn/community/miniofile/image/avatar.png"></image>
  17. </view>
  18. <view v-if="isLogin" class="member_info">
  19. <view class="member_name_box">
  20. <view class="member_name">{{ userDetail.username }}</view>
  21. </view>
  22. <view class="member_name_box">
  23. <view class="member_mobile">{{shopPhone}}</view>
  24. </view>
  25. </view>
  26. <view v-else class="no_login">
  27. <button class="no_login_btn">游客(未登录)</button>
  28. </view>
  29. <view style="flex:1"></view>
  30. <image src="/static/wode/item_setting_icon.png" mode="aspectFit" @tap.stop="tapOther(1)"
  31. style="width: 56upx;height: 56upx;"></image>
  32. </view>
  33. <view style="display: flex;margin: 22upx 64upx 0;justify-content: space-between;">
  34. <view @tap="tapHeadMenu(0)" style="text-align: center;">
  35. <view style="font-size: 28upx;color: #fff;">{{dataDetail.couponNum?dataDetail.couponNum:0}}
  36. </view>
  37. <view style="font-size: 24upx;color: #fff;margin-top: 10upx;">我的优惠券</view>
  38. </view>
  39. <view @tap="tapHeadMenu(1)" style="text-align: center;">
  40. <view style="font-size: 28upx;color: #fff;">
  41. {{dataDetail.favoriteNum?dataDetail.favoriteNum:0}}
  42. </view>
  43. <view style="font-size: 24upx;color: #fff;margin-top: 10upx;">收藏商品</view>
  44. </view>
  45. <view @tap="tapHeadMenu(2)" style="text-align: center;">
  46. <view style="font-size: 28upx;color: #fff;">{{dataDetail.browseNum?dataDetail.browseNum:0}}
  47. </view>
  48. <view style="font-size: 24upx;color: #fff;margin-top: 10upx;">浏览记录</view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="mine_order_statue">
  53. <view class="order_wrap">
  54. <view class="mine_order_text">我的订单</view>
  55. <view @tap="tapToOrder(0)" class="jump_all_order">
  56. <text style="color:#C1C1C1;font-size: 24upx;">查看全部</text>
  57. <image src="https://szsq.nxzhsq.cn/community/miniofile/image/arrow.png"></image>
  58. </view>
  59. </view>
  60. <view class="order_statue_list">
  61. <view class="order_statue_item" v-for="(item, index) in orderStateList" :key="index"
  62. @tap="tapToOrder(item.state)">
  63. <image :src="item.icon" mode="aspectFit"></image>
  64. <text>{{ item.statueName }}</text>
  65. <!-- 待付款数量 -->
  66. <view v-if="index == 0 && orderStatusNum.pendingPayment > 0" class="tip_count">{{
  67. orderStatusNum.pendingPayment }}
  68. </view>
  69. <!-- 待发货数量 -->
  70. <view v-if="index == 1 && orderStatusNum.pendingShipment > 0" class="tip_count">{{
  71. orderStatusNum.pendingShipment }}
  72. </view>
  73. <!-- 待收货数量 -->
  74. <view v-if="index == 2 && orderStatusNum.shipped > 0" class="tip_count">{{
  75. orderStatusNum.shipped }}
  76. </view>
  77. <!-- 待评论数量 -->
  78. <view v-if="index == 3 && orderStatusNum.pendingReview > 0" class="tip_count">{{
  79. orderStatusNum.pendingReview }}
  80. </view>
  81. <!-- 售后数量 -->
  82. <view v-if="index == 4 && orderStatusNum.afterSale > 0" class="tip_count">{{
  83. orderStatusNum.afterSale }}
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="item_list">
  89. <view class="item" v-for="(item, index) in mineItemList" :key="index" @tap="tapToMenu(item.index)">
  90. <view class="item_content">
  91. <image :src="item.itemIcon"></image>
  92. <text>{{ item.itemName }}</text>
  93. </view>
  94. <view class="">
  95. <text v-if="item.index==0" style="padding-right: 16rpx;color: #D43A39;font-size: 26rpx;">
  96. {{authStatus}}
  97. </text>
  98. <image src="https://szsq.nxzhsq.cn/community/miniofile/image/arrow.png"></image>
  99. </view>
  100. </view>
  101. </view>
  102. <!-- 微信客服 -->
  103. <DtService/>
  104. <DtLogin ref="dialogLogin" @signIn="onSignIn"/>
  105. </view>
  106. </view>
  107. </template>
  108. <script>
  109. var app = getApp()
  110. import DtLogin from '../../comps/dt_login.vue';
  111. import DtService from '../../comps/dt_service.vue';
  112. import DtCustomBar from '../../comps/dt_custom_bar.vue'
  113. export default {
  114. components: {
  115. DtLogin,
  116. DtService,
  117. DtCustomBar
  118. },
  119. data() {
  120. return {
  121. isFirst: false,
  122. //社区 begin
  123. state: null,
  124. anyHousePass: false,
  125. //社区end
  126. orderStateList: [
  127. {
  128. statueName: '待付款',
  129. icon: 'https://szsq.nxzhsq.cn/community/miniofile/image/wait_pay.png',
  130. count: 1,
  131. state: 1
  132. },
  133. {
  134. statueName: '待发货',
  135. icon: 'https://szsq.nxzhsq.cn/community/miniofile/image/wait_ship.png',
  136. count: 2,
  137. state: 2
  138. },
  139. {
  140. statueName: '待收货',
  141. icon: 'https://szsq.nxzhsq.cn/community/miniofile/image/wait_receipt.png',
  142. count: 2,
  143. state: 3
  144. },
  145. {
  146. statueName: '待评价',
  147. icon: 'https://szsq.nxzhsq.cn/community/miniofile/image/wait_comment.png',
  148. count: 2,
  149. state: 5
  150. },
  151. {
  152. statueName: '退款/售后',
  153. icon: 'https://szsq.nxzhsq.cn/community/miniofile/image/wait_refund.png',
  154. count: 2,
  155. state: 7
  156. }
  157. ],
  158. mineItemList: [
  159. {
  160. itemName: '住户认证',
  161. itemIcon: '/static/icon/renzheng.png',
  162. index: 0
  163. },
  164. {
  165. itemName: '我的消息',
  166. itemIcon: '/static/icon/msg.png',
  167. index: 1
  168. },
  169. {
  170. itemName: '收货地址',
  171. itemIcon: '/static/icon/address.png',
  172. index: 2
  173. },
  174. {
  175. itemName: '问题反馈',
  176. itemIcon: '/static/icon/fankui.png',
  177. index: 3
  178. },
  179. {
  180. itemName: '客服中心',
  181. itemIcon: '/static/icon/kefu.png',
  182. index: 4
  183. },
  184. {
  185. itemName: '使用说明',
  186. itemIcon: '/static/icon/shuoming.png',
  187. index: 5
  188. },
  189. ],
  190. //商城绑定的手机号
  191. shopPhone: '',
  192. memberId: '',
  193. dataDetail: {},
  194. orderStatusNum: {},
  195. userDetail: {},
  196. isLogin: false,
  197. };
  198. },
  199. computed: {
  200. orderState() {
  201. return this.$global.orderState;
  202. },
  203. //社区begin
  204. authStatus: {
  205. get() {
  206. if (this.state == 0 && this.anyHousePass == false) {
  207. return "未认证"
  208. } else if (this.state == 1 && this.anyHousePass == false) {
  209. return "待审核"
  210. } else if (this.state == 2 || this.anyHousePass == true) {
  211. return "已认证"
  212. } else {
  213. return "未注册"
  214. }
  215. }
  216. },
  217. //社区 end
  218. },
  219. methods: {
  220. async tapGetUserInfo(e) {
  221. console.log(158, e);
  222. if (e.detail.errMsg == 'getUserInfo:ok') {
  223. let userInfo = e.detail.userInfo;
  224. let resp = await this.$api.updateIcon({
  225. _isShowLoading: true,
  226. userId: this.memberId,
  227. avatar: userInfo.avatarUrl
  228. });
  229. this.userDetail.avatar = userInfo.avatarUrl;
  230. }
  231. },
  232. showLogin() {
  233. this.$refs.dialogLogin.show();
  234. },
  235. // 登录成功响应事件
  236. onSignIn(resp) {
  237. this.shopPhone = this.$auth.getMineBase().user.mobile || ''
  238. console.log(143, resp);
  239. this.onPullDownRefreshPage();
  240. },
  241. tapToWhich(aimUrl) {
  242. if (!this.$auth.isAuth) {
  243. this.showLogin();
  244. return;
  245. }
  246. uni.navigateTo({
  247. url: aimUrl
  248. });
  249. },
  250. tapToOrder(state) {
  251. if (!this.$auth.isAuth) {
  252. this.showLogin();
  253. return;
  254. }
  255. uni.navigateTo({
  256. url: '/pagesM/pages/mine_order_list?state=' + state
  257. });
  258. },
  259. tapOther(key) {
  260. if (key == 1) {
  261. uni.navigateTo({
  262. url: '/pagesM/pages/mine_setting'
  263. });
  264. }
  265. },
  266. onShareAppMessage: function (e) {
  267. return {
  268. path: 'pages/index/index'
  269. }
  270. },
  271. tapHeadMenu(index) {
  272. let url;
  273. if (index == 0) {
  274. url = '/pagesM/pages/coupon_list'
  275. } else if (index == 1) {
  276. url = '/pagesM/pages/mine_collection'
  277. } else if (index == 2) {
  278. url = '/pagesM/pages/browse_records'
  279. }
  280. uni.navigateTo({
  281. url: url
  282. });
  283. },
  284. tapToMenu(idx) {
  285. if (idx == 0) {
  286. //住户认证
  287. this.buttonMethod(1)
  288. return
  289. } else if (idx == 1) {
  290. //我的消息
  291. this.buttonMethod(2)
  292. return
  293. } else if (idx == 5) {
  294. //使用教程
  295. this.buttonMethod(3)
  296. return
  297. }
  298. if (!this.$auth.isAuth) {
  299. this.showLogin();
  300. return;
  301. }
  302. switch (idx) {
  303. case 2: // 收货地址
  304. uni.navigateTo({
  305. url: '/pagesM/pages/address_list'
  306. });
  307. break;
  308. case 3: // 问题反馈
  309. uni.navigateTo({
  310. url: "./feedback/feedback"
  311. })
  312. break;
  313. case 4: // 客服中心
  314. let phone = this.dataDetail.serviceTel
  315. console.log(phone);
  316. this.makePhoneCall(phone);
  317. break;
  318. default:
  319. break;
  320. }
  321. },
  322. async getMyBaseDatas() {
  323. let resp = await this.$api.getMyBaseDatas({
  324. _isReject: true,
  325. _isPull: this.isPull,
  326. memberId: this.memberId
  327. });
  328. this.shopPhone = resp.user.mobile
  329. console.log(this.shopPhone);
  330. this.$auth.getMineBase(resp);
  331. this.dataDetail = resp;
  332. this.orderStatusNum = resp.orderStatusNum || {};
  333. this.userDetail = resp.user || {};
  334. },
  335. onLoadPage() {
  336. wx.hideShareMenu();
  337. this.communityInitData()
  338. this.isLogin = this.$auth.isAuth;
  339. this.memberId = this.$auth.getMemberId();
  340. this.getMyBaseDatas();
  341. },
  342. // 社区 begin
  343. communityInitData() {
  344. var that = this; //从全局变量中获取用户信息
  345. if (app.globalData.member) {
  346. that.setData({
  347. state: app.globalData.member.state,
  348. anyHousePass: app.globalData.anyHousePass
  349. });
  350. }
  351. },
  352. //用户认证信息
  353. buttonMethod: function (type) {
  354. if (type == 3) {
  355. uni.navigateTo({
  356. url: 'direction/direction'
  357. });
  358. return;
  359. }
  360. var that = this; //会员认证状态:{ 0:未认证,1:待审审核,2:已认证 }
  361. var member = app.globalData.member;
  362. var anyHousePass = app.globalData.anyHousePass;
  363. if (member == null) {
  364. //未注册
  365. uni.navigateTo({
  366. url: "../empty/empty"
  367. })
  368. return;
  369. } else if (member.state == 0 && !anyHousePass) {
  370. //2未认证
  371. uni.navigateTo({
  372. url: "../empty/empty?type=2"
  373. })
  374. return;
  375. } else if (member.state == 1 && !anyHousePass) {
  376. //待审核
  377. that.pending();
  378. return;
  379. } else if (member.state == 2 || anyHousePass) {
  380. //已认证
  381. if (type == 1) {
  382. uni.navigateTo({
  383. url: 'myInfo/myInfo'
  384. });
  385. } else if (type == 2) {
  386. uni.navigateTo({
  387. url: '/pages/wode/news/news'
  388. });
  389. }
  390. }
  391. },
  392. //提示用户身份注册
  393. footaddmore: function () {
  394. uni.showModal({
  395. title: '提示',
  396. content: ' 请先完成注册',
  397. //cancelText:'去绑定',
  398. cancelText: '取消',
  399. confirmText: '去注册',
  400. success: function (res) {
  401. if (res.confirm) {
  402. console.log('用户点击了确认-去认证'); //跳转到认证页面
  403. uni.navigateTo({
  404. url: '../register/register'
  405. });
  406. } else {//res.cancel
  407. //绑定界面--暂时不用
  408. // wx.navigateTo({
  409. // url: '/pages/binding/binding',
  410. // })
  411. }
  412. }
  413. });
  414. },
  415. //用户信息待审核中
  416. pending: function () {
  417. let that = this;
  418. var openid = uni.getStorageSync("openid");
  419. let params = {};
  420. params['openid'] = openid;
  421. let operation = 'miniprogram/getMemberByOpenid';
  422. app.globalData.postRequest(params, operation, function (res) {
  423. //获取成功
  424. if (res.data.result_code == 1) {
  425. let member = res.data.member; //待审核
  426. if (member.state == 1 && !res.data.anyHousePass) {
  427. app.globalData.oneFailHint('亲,你的信息正在审核,请耐心等待');
  428. } else if (member.state == 2) {
  429. app.globalData.oneFailHint('亲,你的信息已审核通过', function () {
  430. that.setData({
  431. state: member.state
  432. });
  433. });
  434. }
  435. app.globalData.member = member;
  436. app.globalData.anyHousePass = res.data.anyHousePass;
  437. } else {
  438. app.globalData.oneFailHint(res.data.result_msg);
  439. }
  440. });
  441. },
  442. // 社区 end
  443. },
  444. onLoad() {
  445. this.isFirst = true
  446. },
  447. onReady() {
  448. if (!this.$auth.isAuth) {
  449. this.showLogin();
  450. return;
  451. } else {
  452. this.$refs.dialogLogin.hide();
  453. }
  454. },
  455. onShow() {
  456. if (this.isFirst) {
  457. this.isFirst = false
  458. } else {
  459. this.onShowPage();
  460. this.onLoadPage()
  461. }
  462. },
  463. onPullDownRefresh() {
  464. this.onPullDownRefreshPage();
  465. }
  466. };
  467. </script>
  468. <style lang="scss" scoped>
  469. .pageBg {
  470. background-color: #F6F4F5;
  471. }
  472. button::after {
  473. border: none;
  474. }
  475. .header {
  476. background-image: url(https://szsq.nxzhsq.cn/community/miniofile/image/mine_head_bg.png);
  477. height: 500 upx;
  478. background-repeat: no-repeat;
  479. background-size: 100% 100%;
  480. .member_head_img {
  481. margin-right: 30 upx;
  482. image {
  483. width: 110 upx;
  484. height: 110 upx;
  485. border-radius: 59 rpx;
  486. }
  487. .avatar-wrap {
  488. display: inline-flex;
  489. border: 0;
  490. background-color: transparent;
  491. }
  492. }
  493. .no_login {
  494. display: flex;
  495. flex-direction: column;
  496. .no_login_btn {
  497. border-radius: 25px;
  498. font-size: 26 upx;
  499. color: #fff;
  500. width: fit-content;
  501. padding: 0 15 upx;
  502. height: 60 upx;
  503. line-height: 60 upx;
  504. background: transparent;
  505. }
  506. }
  507. .member_info {
  508. display: flex;
  509. flex-direction: column;
  510. .member_name_box {
  511. display: flex;
  512. flex-direction: row;
  513. align-items: center;
  514. .member_name {
  515. padding-bottom: 20 rpx;
  516. font-size: 32 upx;
  517. color: #fff;
  518. font-weight: bold;
  519. }
  520. .member_mobile {
  521. padding-bottom: 10 rpx;
  522. font-size: 26 upx;
  523. color: #fff;
  524. font-weight: bold;
  525. }
  526. .member_level {
  527. background: #ffc600;
  528. color: #fff;
  529. font-size: 22 upx;
  530. border-radius: 4 upx;
  531. padding: 5 upx 10 upx;
  532. margin-left: 10 upx;
  533. }
  534. }
  535. .member_phone_box {
  536. display: flex;
  537. flex-direction: row;
  538. align-items: center;
  539. .member_phone {
  540. margin-top: -20rpx;
  541. font-size: 24 upx;
  542. color: #999999;
  543. }
  544. image {
  545. width: 19 upx;
  546. height: 19 upx;
  547. padding: 20 upx;
  548. }
  549. }
  550. }
  551. .member_benefits {
  552. background: #fff;
  553. width: 180 upx;
  554. display: flex;
  555. flex-direction: row;
  556. align-items: center;
  557. text-align: center;
  558. border-radius: 27 upx 0px 0px 27 upx;
  559. height: 54 upx;
  560. text-align: center;
  561. position: absolute;
  562. right: 0;
  563. image {
  564. width: 26 upx;
  565. height: 23 upx;
  566. padding: 0 10 upx 0 30 upx;
  567. }
  568. .member_benefits_text {
  569. font-size: 24 upx;
  570. color: $dt-color-primary;
  571. letter-spacing: 2 upx;
  572. }
  573. }
  574. button::after {
  575. border: none;
  576. }
  577. }
  578. .coupon_point {
  579. display: flex;
  580. flex-direction: row;
  581. align-items: center;
  582. height: 110 upx;
  583. background: #fff;
  584. justify-content: space-around;
  585. .item {
  586. display: flex;
  587. flex-direction: column;
  588. align-items: center;
  589. width: 50%;
  590. .item_box {
  591. display: flex;
  592. flex-direction: row;
  593. align-items: center;
  594. letter-spacing: 2 upx;
  595. .item_content {
  596. color: $dt-color-primary;
  597. font-size: 34 upx;
  598. }
  599. .item_unit {
  600. color: $dt-color-primary;
  601. font-size: 22 upx;
  602. margin-top: 6 upx;
  603. }
  604. }
  605. .item_text {
  606. color: #333333;
  607. font-size: 22 upx;
  608. }
  609. }
  610. .line {
  611. width: 1 upx;
  612. height: 50 upx;
  613. background: #e5e5e5;
  614. }
  615. }
  616. .mine_order_statue {
  617. margin: -100upx 20 upx 0;
  618. background: #fff;
  619. padding: 30 upx 40 upx;
  620. border-radius: 20 rpx;
  621. .order_wrap {
  622. display: flex;
  623. flex-direction: row;
  624. align-items: center;
  625. justify-content: space-between;
  626. box-sizing: border-box;
  627. .mine_order_text {
  628. font-size: 28 upx;
  629. font-weight: bold;
  630. color: #333333;
  631. }
  632. .jump_all_order {
  633. display: flex;
  634. flex-direction: row;
  635. align-items: center;
  636. text {
  637. color: #999999;
  638. font-size: 22 upx;
  639. margin-right: 10 upx;
  640. }
  641. image {
  642. width: 10 upx;
  643. height: 18 upx;
  644. }
  645. }
  646. }
  647. .order_statue_list {
  648. display: flex;
  649. flex-direction: row;
  650. align-items: center;
  651. justify-content: space-between;
  652. .order_statue_item {
  653. display: flex;
  654. flex-direction: column;
  655. align-items: center;
  656. position: relative;
  657. margin-top: 32 upx;
  658. image {
  659. width: 40 upx;
  660. height: 40 upx;
  661. }
  662. text {
  663. font-size: 24 rpx;
  664. color: #333333;
  665. letter-spacing: 1 upx;
  666. margin-top: 10 upx;
  667. }
  668. .tip_count {
  669. position: absolute;
  670. right: 0 upx;
  671. top: -6rpx;
  672. width: 24 upx;
  673. height: 24 upx;
  674. border-radius: 50%;
  675. background-color: #ff3b30;
  676. color: #fff;
  677. font-size: 18 upx;
  678. text-align: center;
  679. line-height: 24 upx;
  680. }
  681. }
  682. }
  683. }
  684. .item_list {
  685. display: flex;
  686. flex-direction: column;
  687. background: #fff;
  688. margin: 20 rpx;
  689. border-radius: 20 rpx;
  690. .item {
  691. display: flex;
  692. flex-direction: row;
  693. align-items: center;
  694. justify-content: space-between;
  695. padding: 0 30 upx;
  696. height: 90 upx;
  697. border-bottom: 1 upx solid #e5e5e5;
  698. .item_content {
  699. display: flex;
  700. flex-direction: row;
  701. align-items: center;
  702. image {
  703. width: 38 upx;
  704. height: 38 upx;
  705. }
  706. text {
  707. font-size: 28 upx;
  708. color: #333333;
  709. margin-left: 20 upx;
  710. }
  711. }
  712. image {
  713. width: 10 upx;
  714. height: 18 upx;
  715. }
  716. }
  717. .item:last-child {
  718. border: none;
  719. }
  720. }
  721. </style>