user.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. <template>
  2. <view class="box">
  3. <view class="top">
  4. <view class="customerMes">
  5. <image :src="headImg" mode="" style="width: 88rpx;height: 88rpx;border-radius: 44rpx;"></image>
  6. <view class="mes">
  7. <view class="nick">
  8. <view class="nickName" v-if="userInfo.nickName">{{userInfo.nickName}}</view>
  9. <view class="grade" v-if="numList.levelName">{{numList.levelName}}</view>
  10. </view>
  11. <view class="phone">{{userInfo.mobilePhone}}</view>
  12. </view>
  13. </view>
  14. <view class="headerBox">
  15. <view class="quan" @click="gonavigateTo('../index/discountCard')">
  16. <view class="numStr">{{numList.count?numList.count:0}}</view>
  17. <view class="nameStr">优惠券</view>
  18. </view>
  19. <view class="quan">
  20. <view class="numStr">{{numList.totalIntegral?numList.totalIntegral:0}}</view>
  21. <view class="nameStr">积分</view>
  22. </view>
  23. <view class="quan" @click="gonavigateTo('../index/vipCard')">
  24. <view class="numStr">{{numList.cardNum?numList.cardNum:0}}</view>
  25. <view class="nameStr">会员卡</view>
  26. </view>
  27. </view>
  28. </view>
  29. <!-- 我的订单 -->
  30. <view class="orderBox">
  31. <view class="orderTitle">我的订单</view>
  32. <view class="orderLIneBox">
  33. <view class="orderLine" @click="goorder(1)">
  34. <view class="orderImgBox">
  35. <view class="orderNum" v-show="numList.waitPurchaseSize>0">{{numList.waitPurchaseSize>99?'99+':numList.waitPurchaseSize}}</view>
  36. <image src="../../static/img/icon_daifukuan.png" mode="" class="orderLineImg"></image>
  37. </view>
  38. <view class="orderLineTxt">待付款</view>
  39. </view>
  40. <view class="orderLine" @click="goorder(2)">
  41. <view class="orderImgBox">
  42. <view class="orderNum" v-show="numList.waitServiceSize>0">{{numList.waitServiceSize>99?'99+':numList.waitServiceSize}}</view>
  43. <image src="../../static/img/icon_daifuwu.png" mode="" class="orderLineImg"></image>
  44. </view>
  45. <view class="orderLineTxt">待服务</view>
  46. </view>
  47. <view class="orderLine" @click="goorder(3)">
  48. <view class="orderImgBox">
  49. <view class="orderNum" v-show="numList.hasOverSize>0">{{numList.hasOverSize>99?'99+':numList.hasOverSize}}</view>
  50. <image src="../../static/img/icon_yiwancheng.png" mode="" class="orderLineImg"></image>
  51. </view>
  52. <view class="orderLineTxt">已完成</view>
  53. </view>
  54. <view class="orderLine" @click="goorder(0)">
  55. <view class="orderImgBox">
  56. <view class="orderNum" v-show="numList.allSize>0">{{numList.allSize>99?'99+':numList.allSize}}</view>
  57. <image src="../../static/img/icon_allorder.png" mode="" class="orderLineImg"></image>
  58. </view>
  59. <view class="orderLineTxt">全部</view>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 店铺信息 -->
  64. <view class="shopBox">
  65. <view class="shopCont">
  66. <view class="shopName">{{numList.shopInfo.shopName}}</view>
  67. <view class="shopRightBox">
  68. <image src="../../static/img/icon_ditu.png" mode="" class="shopRightImg"
  69. style="margin-right: 67rpx;" @click="map"></image>
  70. <image src="../../static/img/icon_phone.png" mode="" class="shopRightImg" @click="call"></image>
  71. </view>
  72. </view>
  73. <view class="shopTime" v-if="numList.shopInfo.startTime && numList.shopInfo.endTime">
  74. {{numList.shopInfo.startTime}}-{{numList.shopInfo.endTime}}</view>
  75. <view class="address">
  76. <view class="Address">
  77. {{numList.shopInfo.provinceName}}{{numList.shopInfo.cityName}}{{numList.shopInfo.areaName}}{{numList.shopInfo.address}}
  78. </view>
  79. <!-- <view class="distance" v-if="numList.shopInfo.distance&&numList.shopInfo.distance!= '0.00'">{{numList.shopInfo.distance}}km</view> -->
  80. </view>
  81. </view>
  82. <!-- 我的 相关 -->
  83. <view class="rowBoxBg">
  84. <view class="rowBox" @click="gonavigateTo('../index/shopList')">
  85. <view class="leftView">
  86. <image src="../../static/img/icon_me1.png" mode="" class="liftIcon"></image>
  87. <view class="rowTitle">服务专家</view>
  88. </view>
  89. <image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
  90. </view>
  91. <view class="rowBox" @click="gonavigateTo('./addCar/cailist')">
  92. <view class="leftView">
  93. <image src="../../static/img/icon_me2.png" mode="" class="liftIcon"></image>
  94. <view class="rowTitle">我的车库</view>
  95. </view>
  96. <image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
  97. </view>
  98. <view class="rowBox" @click="gonavigateTo('myBespeak')">
  99. <view class="leftView">
  100. <image src="../../static/img/icon_me3.png" mode="" class="liftIcon"></image>
  101. <view class="rowTitle">我的预约</view>
  102. </view>
  103. <image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
  104. </view>
  105. <view class="rowBox" @click="gonavigateTo('historySpend')">
  106. <view class="leftView">
  107. <image src="../../static/img/icon_me4.png" mode="" class="liftIcon"></image>
  108. <view class="rowTitle">历史消费</view>
  109. </view>
  110. <image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
  111. </view>
  112. <view class="rowBox" @click="gonavigateTo('checkReport')">
  113. <view class="leftView">
  114. <image src="../../static/img/icon_me5.png" mode="" class="liftIcon"></image>
  115. <view class="rowTitle">车检报告</view>
  116. </view>
  117. <image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
  118. </view>
  119. <view class="rowBox" @click="gonavigateTo('invite')">
  120. <view class="leftView">
  121. <image src="../../static/img/icon_me6.png" mode="" class="liftIcon"></image>
  122. <view class="rowTitle">分享给好友</view>
  123. </view>
  124. <image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
  125. </view>
  126. <view class="rowBox" @click="gonavigateTo('invite')">
  127. <view class="leftView">
  128. <image src="../../static/img/icon_me7.png" mode="" class="liftIcon"></image>
  129. <view class="rowTitle">意见反馈</view>
  130. </view>
  131. <image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
  132. </view>
  133. <view class="rowBox" @click="gonavigateTo('')">
  134. <view class="leftView">
  135. <image src="../../static/img/icon_me8.png" mode="" class="liftIcon"></image>
  136. <view class="rowTitle">清除缓存</view>
  137. </view>
  138. <image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
  139. </view>
  140. </view>
  141. <!-- <view class="signOut" @click="signOut">退出登录</view> -->
  142. <!-- 手机号授权 -->
  143. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  144. <view class="authorizCont" @click.stop="">
  145. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  146. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  147. <button class="authorizContbutton" type="default" open-type="getPhoneNumber"
  148. @getphonenumber="decryptPhoneNumber">授权</button>
  149. </view>
  150. <view style="text-align: center;padding-top: 56rpx;">
  151. <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  152. </view>
  153. </view>
  154. </view>
  155. </template>
  156. <script>
  157. export default {
  158. data() {
  159. return {
  160. iStatusBarHeight: '',
  161. userInfo: '',
  162. shopData: '',
  163. numList: '',
  164. uid: '',
  165. headImg: '',
  166. location: {
  167. lng: '',
  168. lat: '',
  169. },
  170. authorizShow: false,
  171. code: '',
  172. wxOpenData: '',
  173. }
  174. },
  175. onLoad(opt) {
  176. var that = this;
  177. // uni.getLocation({
  178. // type: 'gcj02',
  179. // success: function(res) {
  180. // console.log(res)
  181. // that.location.lat = res.latitude
  182. // that.location.lng = res.longitude
  183. // that.queryMyDetail()
  184. // },
  185. // fail(err) {
  186. // }
  187. // });
  188. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  189. //const wxOpenData = uni.getStorageSync("wxOpenData");
  190. const wxOpenData = this.$store.state.wxOpenData;
  191. if (wxOpenData) {
  192. this.headImg = wxOpenData.loginInfo.customerInfo.headImgurl;
  193. this.uid = wxOpenData.loginInfo.uid;
  194. }
  195. //this.userInfo = uni.getStorageSync("userInfo")
  196. },
  197. onShow() {
  198. this.userInfo = this.$store.state.userInfo;
  199. if (this.userInfo) {
  200. this.queryMyDetail();
  201. } else {
  202. this.authorizShow = true;
  203. }
  204. },
  205. methods: {
  206. decryptPhoneNumber: function(e) {
  207. console.log(e);
  208. this.code = e.detail.code
  209. this.wxPhoneLogin()
  210. this.authorizShow = false;
  211. },
  212. wxPhoneLogin() {
  213. var that = this;
  214. this.$http('miniApp2/sys/wxPhoneLogin', {
  215. appId: 'wx33053a645546ec31',
  216. unionId: 'EEADACCD-8A19-499D-8AD7-6975D2C93243',
  217. code: this.code,
  218. openId: this.wxOpenData.openid
  219. }, 'POST').then(res => {
  220. var data = res.data;
  221. if (data.loginInfo) {
  222. this.userInfo = data.loginInfo.openUser;
  223. this.wxOpenData = data.loginInfo;
  224. this.$store.commit('mutationswxOpenData', data.loginInfo)
  225. this.$store.commit('mutationsuserInfo', this.userInfo)
  226. this.queryMyDetail()
  227. }
  228. })
  229. },
  230. map() {
  231. console.log("打开地图")
  232. var that = this;
  233. if (!that.numList.shopInfo.lat || !that.numList.shopInfo.lng) {
  234. uni.showToast({
  235. title: '该店铺未设置定位',
  236. icon: 'none',
  237. duration: 3000
  238. });
  239. } else {
  240. uni.openLocation({
  241. latitude: Number(that.numList.shopInfo.lat),
  242. longitude: Number(that.numList.shopInfo.lng),
  243. name: that.numList.shopInfo.shopName,
  244. address: that.numList.shopInfo.provinceName + that.numList.shopInfo.cityName + that.numList
  245. .shopInfo.areaName + that.numList.shopInfo.address,
  246. success: function() {
  247. console.log('success');
  248. },
  249. fail(err) {
  250. console.log(err)
  251. }
  252. });
  253. }
  254. },
  255. call() {
  256. uni.makePhoneCall({
  257. phoneNumber: this.numList.shopInfo.contactorPhone
  258. });
  259. },
  260. goorder(num) {
  261. uni.navigateTo({
  262. url: './myOrder/myOrder?num=' + num
  263. })
  264. },
  265. queryMyDetail() {
  266. uni.showLoading({
  267. title: '加载中'
  268. })
  269. this.$http('openreservation/getInfo', {
  270. lat: this.location.lat ? this.location.lat : '',
  271. lng: this.location.lng ? this.location.lng : '',
  272. }, 'GET').then(res => {
  273. uni.hideLoading();
  274. this.numList = res.data
  275. })
  276. },
  277. gonavigateTo(url) {
  278. uni.navigateTo({
  279. url: url
  280. })
  281. },
  282. signOut() {
  283. //uni.clearStorageSync();
  284. uni.removeStorageSync('logodata');
  285. // uni.navigateTo({
  286. // url: '../login/login'
  287. // })
  288. },
  289. },
  290. // 下拉刷新
  291. onPullDownRefresh() {
  292. this.queryMyDetail()
  293. setTimeout(function() {
  294. uni.stopPullDownRefresh();
  295. }, 1000);
  296. },
  297. }
  298. </script>
  299. <style scoped>
  300. .box {
  301. width: 100vw;
  302. min-height: 100vh;
  303. background: #F4F5F7;
  304. padding-bottom: 60rpx;
  305. }
  306. .top {
  307. height: 350rpx;
  308. padding: 20rpx 24rpx 0;
  309. background-color: #D53533;
  310. border-radius: 0 0 10% 10%;
  311. }
  312. .customerMes {
  313. display: flex;
  314. }
  315. .mes {
  316. margin-left: 20rpx;
  317. }
  318. .nick {
  319. margin-bottom: 5rpx;
  320. display: flex;
  321. justify-content: flex-start;
  322. align-items: center;
  323. }
  324. .nickName {
  325. font-size: 34rpx;
  326. color: #333333;
  327. font-weight: bold;
  328. line-height: 48rpx;
  329. height: 38rpx;
  330. }
  331. .grade {
  332. margin-left: 15rpx;
  333. font-size: 24rpx;
  334. color: #FFFFFF;
  335. padding: 0rpx 10rpx;
  336. border: 1rpx solid #FFFFFF;
  337. border-radius: 4rpx;
  338. height: 36rpx;
  339. }
  340. .phone {
  341. font-size: 24rpx;
  342. color: #FFFFFF;
  343. }
  344. .headerBox {
  345. padding: 30rpx 24rpx;
  346. display: flex;
  347. justify-content: space-around;
  348. }
  349. .quan {
  350. display: flex;
  351. flex-direction: column;
  352. align-items: center;
  353. height: 120rpx;
  354. }
  355. .numStr {
  356. font-size: 40rpx;
  357. font-weight: bold;
  358. color: #FFFFFF;
  359. line-height: 56rpx;
  360. }
  361. .nameStr {
  362. font-size: 24rpx;
  363. color: #FFFFFF;
  364. }
  365. .orderBox {
  366. margin: 0rpx 24rpx;
  367. background: #FFFFFF;
  368. padding: 30rpx 20rpx;
  369. border-radius: 10rpx;
  370. margin-top: -100rpx;
  371. }
  372. .orderTitle {
  373. font-size: 30rpx;
  374. color: #333333;
  375. font-weight: bold;
  376. }
  377. .orderAll {
  378. display: flex;
  379. justify-content: space-between;
  380. align-items: center;
  381. }
  382. .orderLine {
  383. width: 25%;
  384. text-align: center;
  385. }
  386. .orderLineImg {
  387. width: 60rpx;
  388. height: 60rpx;
  389. }
  390. .orderLineTxt {
  391. font-size: 24rpx;
  392. color: #333333;
  393. }
  394. .orderImgBox {
  395. text-align: center;
  396. position: relative;
  397. }
  398. .orderLIneBox {
  399. display: flex;
  400. justify-content: space-between;
  401. padding-top: 30rpx;
  402. }
  403. .orderNum {
  404. height: 26rpx;
  405. line-height: 26rpx;
  406. background: #FF0000;
  407. padding: 0 8rpx;
  408. border-radius: 13rpx;
  409. color: #FFFFFF;
  410. font-size: 20rpx;
  411. position: absolute;
  412. left: 90rpx;
  413. z-index: 11;
  414. }
  415. .big_rightArrow {
  416. margin-right: 20rpx;
  417. width: 30rpx;
  418. height: 30rpx;
  419. }
  420. .rowBoxBg {
  421. margin: 20rpx 24rpx;
  422. background: #FFFFFF;
  423. border-radius: 10rpx;
  424. }
  425. .rowBox {
  426. display: flex;
  427. justify-content: space-between;
  428. background: #FFFFFF;
  429. padding: 35rpx 0rpx;
  430. border-radius: 10rpx;
  431. align-items: center;
  432. }
  433. .leftView {
  434. display: flex;
  435. align-items: center;
  436. }
  437. .rightView {
  438. display: flex;
  439. align-items: center;
  440. }
  441. .liftIcon {
  442. width: 34rpx;
  443. height: 34rpx;
  444. margin: 0rpx 20rpx;
  445. }
  446. .rowTitle {
  447. color: #3C3C3C;
  448. font-size: 28rpx;
  449. }
  450. .signOut {
  451. width: 702rpx;
  452. height: 98rpx;
  453. background: #FFFFFF;
  454. border-radius: 10rpx;
  455. font-size: 30rpx;
  456. color: #FF3B30;
  457. line-height: 98rpx;
  458. text-align: center;
  459. margin: 40rpx 24rpx;
  460. }
  461. .shopBox {
  462. padding: 20rpx;
  463. margin: 20rpx 24rpx;
  464. background-color: #FFFFFF;
  465. border-radius: 10rpx;
  466. }
  467. .shopCont {
  468. display: flex;
  469. justify-content: space-between;
  470. align-items: center;
  471. }
  472. .shopName {
  473. font-size: 30rpx;
  474. font-weight: bold;
  475. color: #3C3C3C;
  476. line-height: 42rpx;
  477. }
  478. .shopRightBox {
  479. display: flex;
  480. justify-content: space-between;
  481. }
  482. .address {
  483. display: flex;
  484. justify-content: space-between;
  485. align-items: center;
  486. }
  487. .Address,
  488. .shopTime,
  489. .distance {
  490. color: #999999;
  491. font-size: 24rpx;
  492. padding-top: 15rpx;
  493. /* 隐藏文字显示 ...不换行 */
  494. overflow: hidden;
  495. text-overflow: ellipsis;
  496. white-space: nowrap;
  497. }
  498. .shopRightBox {}
  499. .shopRightImg {
  500. width: 44rpx;
  501. height: 45rpx;
  502. }
  503. .authorizBox {
  504. width: 100vw;
  505. height: 100vh;
  506. background: rgba(0, 0, 0, 0.5);
  507. position: fixed;
  508. top: 0;
  509. left: 0;
  510. }
  511. .authorizCont {
  512. margin-top: 30vh;
  513. width: 564rpx;
  514. height: 408rpx;
  515. background: #FFFFFF;
  516. border-radius: 24rpx;
  517. margin-left: 93rpx;
  518. position: relative;
  519. }
  520. .authorizCloseImg {
  521. width: 62rpx;
  522. height: 62rpx;
  523. }
  524. .sqLogoBox {
  525. width: 180rpx;
  526. height: 180rpx;
  527. background: #FFFFFF;
  528. border-radius: 90rpx;
  529. text-align: center;
  530. position: absolute;
  531. top: -50rpx;
  532. left: 192rpx;
  533. }
  534. .authorizName {
  535. color: #333333;
  536. line-height: 42rpx;
  537. font-size: 30rpx;
  538. text-align: center;
  539. padding-top: 58rpx;
  540. }
  541. .authorizMs {
  542. color: #999999;
  543. line-height: 36rpx;
  544. font-size: 26rpx;
  545. width: 452rpx;
  546. padding-top: 24rpx;
  547. text-align: center;
  548. margin-left: 56rpx;
  549. }
  550. .authorizContbutton {
  551. width: 422rpx;
  552. height: 88rpx;
  553. background: #D53533;
  554. border-radius: 44rpx;
  555. line-height: 88rpx;
  556. text-align: center;
  557. font-size: 30rpx;
  558. color: #FFFFFF;
  559. margin-top: 62rpx;
  560. margin-left: 71rpx;
  561. }
  562. </style>