user.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  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. ext:'',
  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. this.ext=this.$common.getExtStoreId();
  198. },
  199. onShow() {
  200. this.userInfo = this.$store.state.userInfo;
  201. if (this.userInfo) {
  202. this.queryMyDetail();
  203. } else {
  204. this.authorizShow = true;
  205. }
  206. },
  207. methods: {
  208. decryptPhoneNumber: function(e) {
  209. console.log(e);
  210. this.code = e.detail.code
  211. this.wxPhoneLogin()
  212. this.authorizShow = false;
  213. },
  214. wxPhoneLogin() {
  215. var that = this;
  216. this.$http('miniApp2/sys/wxPhoneLogin', {
  217. appId:this.ext.appId,
  218. unionId:this.ext.unionId,
  219. code: this.code,
  220. openId: this.wxOpenData.openid
  221. }, 'POST').then(res => {
  222. var data = res.data;
  223. if (data.loginInfo) {
  224. this.userInfo = data.loginInfo.openUser;
  225. this.wxOpenData = data.loginInfo;
  226. this.$store.commit('mutationswxOpenData', data.loginInfo)
  227. this.$store.commit('mutationsuserInfo', this.userInfo)
  228. this.queryMyDetail()
  229. }
  230. })
  231. },
  232. map() {
  233. console.log("打开地图")
  234. var that = this;
  235. if (!that.numList.shopInfo.lat || !that.numList.shopInfo.lng) {
  236. uni.showToast({
  237. title: '该店铺未设置定位',
  238. icon: 'none',
  239. duration: 3000
  240. });
  241. } else {
  242. uni.openLocation({
  243. latitude: Number(that.numList.shopInfo.lat),
  244. longitude: Number(that.numList.shopInfo.lng),
  245. name: that.numList.shopInfo.shopName,
  246. address: that.numList.shopInfo.provinceName + that.numList.shopInfo.cityName + that.numList
  247. .shopInfo.areaName + that.numList.shopInfo.address,
  248. success: function() {
  249. console.log('success');
  250. },
  251. fail(err) {
  252. console.log(err)
  253. }
  254. });
  255. }
  256. },
  257. call() {
  258. uni.makePhoneCall({
  259. phoneNumber: this.numList.shopInfo.contactorPhone
  260. });
  261. },
  262. goorder(num) {
  263. uni.navigateTo({
  264. url: './myOrder/myOrder?num=' + num
  265. })
  266. },
  267. queryMyDetail() {
  268. uni.showLoading({
  269. title: '加载中'
  270. })
  271. this.$http('openreservation/getInfo', {
  272. lat: this.location.lat ? this.location.lat : '',
  273. lng: this.location.lng ? this.location.lng : '',
  274. }, 'GET').then(res => {
  275. uni.hideLoading();
  276. this.numList = res.data
  277. })
  278. },
  279. gonavigateTo(url) {
  280. uni.navigateTo({
  281. url: url
  282. })
  283. },
  284. signOut() {
  285. //uni.clearStorageSync();
  286. uni.removeStorageSync('logodata');
  287. // uni.navigateTo({
  288. // url: '../login/login'
  289. // })
  290. },
  291. },
  292. // 下拉刷新
  293. onPullDownRefresh() {
  294. this.queryMyDetail()
  295. setTimeout(function() {
  296. uni.stopPullDownRefresh();
  297. }, 1000);
  298. },
  299. }
  300. </script>
  301. <style scoped>
  302. .box {
  303. width: 100vw;
  304. min-height: 100vh;
  305. background: #F4F5F7;
  306. padding-bottom: 60rpx;
  307. }
  308. .top {
  309. height: 350rpx;
  310. padding: 20rpx 24rpx 0;
  311. background-color: #D53533;
  312. border-radius: 0 0 10% 10%;
  313. }
  314. .customerMes {
  315. display: flex;
  316. }
  317. .mes {
  318. margin-left: 20rpx;
  319. }
  320. .nick {
  321. margin-bottom: 5rpx;
  322. display: flex;
  323. justify-content: flex-start;
  324. align-items: center;
  325. }
  326. .nickName {
  327. font-size: 34rpx;
  328. color: #333333;
  329. font-weight: bold;
  330. line-height: 48rpx;
  331. height: 38rpx;
  332. }
  333. .grade {
  334. margin-left: 15rpx;
  335. font-size: 24rpx;
  336. color: #FFFFFF;
  337. padding: 0rpx 10rpx;
  338. border: 1rpx solid #FFFFFF;
  339. border-radius: 4rpx;
  340. height: 36rpx;
  341. }
  342. .phone {
  343. font-size: 24rpx;
  344. color: #FFFFFF;
  345. }
  346. .headerBox {
  347. padding: 30rpx 24rpx;
  348. display: flex;
  349. justify-content: space-around;
  350. }
  351. .quan {
  352. display: flex;
  353. flex-direction: column;
  354. align-items: center;
  355. height: 120rpx;
  356. }
  357. .numStr {
  358. font-size: 40rpx;
  359. font-weight: bold;
  360. color: #FFFFFF;
  361. line-height: 56rpx;
  362. }
  363. .nameStr {
  364. font-size: 24rpx;
  365. color: #FFFFFF;
  366. }
  367. .orderBox {
  368. margin: 0rpx 24rpx;
  369. background: #FFFFFF;
  370. padding: 30rpx 20rpx;
  371. border-radius: 10rpx;
  372. margin-top: -100rpx;
  373. }
  374. .orderTitle {
  375. font-size: 30rpx;
  376. color: #333333;
  377. font-weight: bold;
  378. }
  379. .orderAll {
  380. display: flex;
  381. justify-content: space-between;
  382. align-items: center;
  383. }
  384. .orderLine {
  385. width: 25%;
  386. text-align: center;
  387. }
  388. .orderLineImg {
  389. width: 60rpx;
  390. height: 60rpx;
  391. }
  392. .orderLineTxt {
  393. font-size: 24rpx;
  394. color: #333333;
  395. }
  396. .orderImgBox {
  397. text-align: center;
  398. position: relative;
  399. }
  400. .orderLIneBox {
  401. display: flex;
  402. justify-content: space-between;
  403. padding-top: 30rpx;
  404. }
  405. .orderNum {
  406. height: 26rpx;
  407. line-height: 26rpx;
  408. background: #FF0000;
  409. padding: 0 8rpx;
  410. border-radius: 13rpx;
  411. color: #FFFFFF;
  412. font-size: 20rpx;
  413. position: absolute;
  414. left: 90rpx;
  415. z-index: 11;
  416. }
  417. .big_rightArrow {
  418. margin-right: 20rpx;
  419. width: 30rpx;
  420. height: 30rpx;
  421. }
  422. .rowBoxBg {
  423. margin: 20rpx 24rpx;
  424. background: #FFFFFF;
  425. border-radius: 10rpx;
  426. }
  427. .rowBox {
  428. display: flex;
  429. justify-content: space-between;
  430. background: #FFFFFF;
  431. padding: 35rpx 0rpx;
  432. border-radius: 10rpx;
  433. align-items: center;
  434. }
  435. .leftView {
  436. display: flex;
  437. align-items: center;
  438. }
  439. .rightView {
  440. display: flex;
  441. align-items: center;
  442. }
  443. .liftIcon {
  444. width: 34rpx;
  445. height: 34rpx;
  446. margin: 0rpx 20rpx;
  447. }
  448. .rowTitle {
  449. color: #3C3C3C;
  450. font-size: 28rpx;
  451. }
  452. .signOut {
  453. width: 702rpx;
  454. height: 98rpx;
  455. background: #FFFFFF;
  456. border-radius: 10rpx;
  457. font-size: 30rpx;
  458. color: #FF3B30;
  459. line-height: 98rpx;
  460. text-align: center;
  461. margin: 40rpx 24rpx;
  462. }
  463. .shopBox {
  464. padding: 20rpx;
  465. margin: 20rpx 24rpx;
  466. background-color: #FFFFFF;
  467. border-radius: 10rpx;
  468. }
  469. .shopCont {
  470. display: flex;
  471. justify-content: space-between;
  472. align-items: center;
  473. }
  474. .shopName {
  475. font-size: 30rpx;
  476. font-weight: bold;
  477. color: #3C3C3C;
  478. line-height: 42rpx;
  479. }
  480. .shopRightBox {
  481. display: flex;
  482. justify-content: space-between;
  483. }
  484. .address {
  485. display: flex;
  486. justify-content: space-between;
  487. align-items: center;
  488. }
  489. .Address,
  490. .shopTime,
  491. .distance {
  492. color: #999999;
  493. font-size: 24rpx;
  494. padding-top: 15rpx;
  495. /* 隐藏文字显示 ...不换行 */
  496. overflow: hidden;
  497. text-overflow: ellipsis;
  498. white-space: nowrap;
  499. }
  500. .shopRightBox {}
  501. .shopRightImg {
  502. width: 44rpx;
  503. height: 45rpx;
  504. }
  505. .authorizBox {
  506. width: 100vw;
  507. height: 100vh;
  508. background: rgba(0, 0, 0, 0.5);
  509. position: fixed;
  510. top: 0;
  511. left: 0;
  512. }
  513. .authorizCont {
  514. margin-top: 30vh;
  515. width: 564rpx;
  516. height: 408rpx;
  517. background: #FFFFFF;
  518. border-radius: 24rpx;
  519. margin-left: 93rpx;
  520. position: relative;
  521. }
  522. .authorizCloseImg {
  523. width: 62rpx;
  524. height: 62rpx;
  525. }
  526. .sqLogoBox {
  527. width: 180rpx;
  528. height: 180rpx;
  529. background: #FFFFFF;
  530. border-radius: 90rpx;
  531. text-align: center;
  532. position: absolute;
  533. top: -50rpx;
  534. left: 192rpx;
  535. }
  536. .authorizName {
  537. color: #333333;
  538. line-height: 42rpx;
  539. font-size: 30rpx;
  540. text-align: center;
  541. padding-top: 58rpx;
  542. }
  543. .authorizMs {
  544. color: #999999;
  545. line-height: 36rpx;
  546. font-size: 26rpx;
  547. width: 452rpx;
  548. padding-top: 24rpx;
  549. text-align: center;
  550. margin-left: 56rpx;
  551. }
  552. .authorizContbutton {
  553. width: 422rpx;
  554. height: 88rpx;
  555. background: #D53533;
  556. border-radius: 44rpx;
  557. line-height: 88rpx;
  558. text-align: center;
  559. font-size: 30rpx;
  560. color: #FFFFFF;
  561. margin-top: 62rpx;
  562. margin-left: 71rpx;
  563. }
  564. </style>