wode2.vue 17 KB

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