user.vue 16 KB

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