user.vue 16 KB

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