user.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. <template>
  2. <view class="box">
  3. <view class="top">
  4. <view class="customerMes">
  5. <image @click="updateUserInfo" v-if="headImg" :src="headImg" mode="" style="width: 88rpx;height: 88rpx;border-radius: 44rpx;"></image>
  6. <image @click="updateUserInfo" 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. <button open-type="share" class="rowBox" >
  128. <view class="leftView">
  129. <image src="../../static/img/icon_me6.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. </button>
  134. <view class="rowBox" @click="gonavigateTo('invite')">
  135. <view class="leftView">
  136. <image src="../../static/img/icon_me7.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 class="rowBox" @click="gonavigateTo('')">
  142. <view class="leftView">
  143. <image src="../../static/img/icon_me8.png" mode="" class="liftIcon"></image>
  144. <view class="rowTitle">清除缓存</view>
  145. </view>
  146. <image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
  147. </view>
  148. </view>
  149. <!-- <view class="signOut" @click="signOut">退出登录</view> -->
  150. <!-- 手机号授权 -->
  151. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  152. <view class="authorizCont" @click.stop="">
  153. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  154. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  155. <button class="authorizContbutton" type="default" open-type="getPhoneNumber"
  156. @getphonenumber="decryptPhoneNumber">授权</button>
  157. </view>
  158. <view style="text-align: center;padding-top: 56rpx;">
  159. <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  160. </view>
  161. </view>
  162. </view>
  163. </template>
  164. <script>
  165. export default {
  166. data() {
  167. return {
  168. iStatusBarHeight: '',
  169. userInfo: '',
  170. shopData: '',
  171. numList: '',
  172. uid: '',
  173. headImg: '',
  174. location: {
  175. lng: '',
  176. lat: '',
  177. },
  178. authorizShow: false,
  179. code: '',
  180. wxOpenData: '',
  181. nickName:'',
  182. phone:'',
  183. ext:'',
  184. }
  185. },
  186. onLoad(opt) {
  187. var that = this;
  188. // uni.getLocation({
  189. // type: 'gcj02',
  190. // success: function(res) {
  191. // console.log(res)
  192. // that.location.lat = res.latitude
  193. // that.location.lng = res.longitude
  194. // that.queryMyDetail()
  195. // },
  196. // fail(err) {
  197. // }
  198. // });
  199. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  200. //const wxOpenData = uni.getStorageSync("wxOpenData");
  201. const wxOpenData = this.$store.state.wxOpenData;
  202. this.wxOpenData=wxOpenData
  203. //console.log()
  204. if (wxOpenData) {
  205. this.headImg = wxOpenData.loginInfo.customerInfo.headImgurl;
  206. this.nickName = wxOpenData.loginInfo.customerInfo.wxNickName;
  207. this.phone = wxOpenData.loginInfo.customerInfo.mobilePhone;
  208. this.uid = wxOpenData.loginInfo.uid;
  209. }
  210. //this.userInfo = uni.getStorageSync("userInfo")
  211. this.ext=this.$common.getExtStoreId();
  212. },
  213. onShow() {
  214. this.userInfo = this.$store.state.userInfo;
  215. if (this.userInfo) {
  216. this.queryMyDetail();
  217. } else {
  218. this.authorizShow = true;
  219. }
  220. },
  221. methods: {
  222. updateUserInfo(){
  223. var that=this;
  224. uni.getUserProfile({
  225. lang:'zh_CN',
  226. desc:'登录',
  227. success:(res)=>{
  228. console.log(res);
  229. that.headImg=res.userInfo.avatarUrl;
  230. that.nickName=res.userInfo.nickName;
  231. that.$http('miniApp2/sys/updateUserInfo', {
  232. nickName:res.userInfo.nickName,
  233. unionId:that.ext.unionId,
  234. headImg: res.userInfo.avatarUrl,
  235. openId: that.wxOpenData.openid
  236. }, 'POST').then(res => {
  237. })
  238. },
  239. fail:(res)=>{
  240. console.log(res)
  241. }
  242. });
  243. },
  244. decryptPhoneNumber: function(e) {
  245. console.log(e);
  246. this.code = e.detail.code
  247. this.wxPhoneLogin()
  248. this.authorizShow = false;
  249. },
  250. wxPhoneLogin() {
  251. var that = this;
  252. this.$http('miniApp2/sys/wxPhoneLogin', {
  253. appId:this.ext.appId,
  254. unionId:this.ext.unionId,
  255. code: this.code,
  256. openId: this.wxOpenData.openid
  257. }, 'POST').then(res => {
  258. var data = res.data;
  259. if (data.loginInfo) {
  260. this.userInfo = data.loginInfo.openUser;
  261. this.wxOpenData = data.loginInfo;
  262. this.$store.commit('mutationswxOpenData', data.loginInfo)
  263. this.$store.commit('mutationsuserInfo', this.userInfo)
  264. this.queryMyDetail()
  265. }
  266. })
  267. },
  268. map() {
  269. console.log("打开地图")
  270. var that = this;
  271. if (!that.numList.shopInfo.lat || !that.numList.shopInfo.lng) {
  272. uni.showToast({
  273. title: '该店铺未设置定位',
  274. icon: 'none',
  275. duration: 3000
  276. });
  277. } else {
  278. uni.openLocation({
  279. latitude: Number(that.numList.shopInfo.lat),
  280. longitude: Number(that.numList.shopInfo.lng),
  281. name: that.numList.shopInfo.shopName,
  282. address: that.numList.shopInfo.provinceName + that.numList.shopInfo.cityName + that.numList
  283. .shopInfo.areaName + that.numList.shopInfo.address,
  284. success: function() {
  285. console.log('success');
  286. },
  287. fail(err) {
  288. console.log(err)
  289. }
  290. });
  291. }
  292. },
  293. call() {
  294. uni.makePhoneCall({
  295. phoneNumber: this.numList.shopInfo.contactorPhone
  296. });
  297. },
  298. goorder(num) {
  299. uni.navigateTo({
  300. url: './myOrder/myOrder?num=' + num
  301. })
  302. },
  303. queryMyDetail() {
  304. uni.showLoading({
  305. title: '加载中'
  306. })
  307. this.$http('openreservation/getInfo', {
  308. lat: this.location.lat ? this.location.lat : '',
  309. lng: this.location.lng ? this.location.lng : '',
  310. }, 'GET').then(res => {
  311. uni.hideLoading();
  312. this.numList = res.data
  313. })
  314. },
  315. gonavigateTo(url) {
  316. uni.navigateTo({
  317. url: url
  318. })
  319. },
  320. signOut() {
  321. //uni.clearStorageSync();
  322. uni.removeStorageSync('logodata');
  323. // uni.navigateTo({
  324. // url: '../login/login'
  325. // })
  326. },
  327. },
  328. onShareAppMessage(res) {
  329. return {
  330. title: this.wxOpenData.miniAppName,
  331. //imageUrl:img,
  332. path: 'pages/index/index',
  333. success(res){
  334. uni.showToast({
  335. title:'分享成功'
  336. })
  337. },
  338. fail(res){
  339. uni.showToast({
  340. title:'分享失败',
  341. icon:'none',
  342. duration: 3000
  343. })
  344. }
  345. }
  346. },
  347. // 下拉刷新
  348. onPullDownRefresh() {
  349. this.queryMyDetail()
  350. setTimeout(function() {
  351. uni.stopPullDownRefresh();
  352. }, 1000);
  353. },
  354. }
  355. </script>
  356. <style scoped>
  357. button::after{
  358. border: none;
  359. }
  360. button{
  361. position: relative;
  362. display: block;
  363. margin-left: 0;
  364. margin-right: 0;
  365. padding-left: 0px;
  366. padding-right: 0px;
  367. box-sizing: border-box;
  368. // font-size: 18px;
  369. text-align: center;
  370. text-decoration: none;
  371. // line-height: 1;
  372. line-height: 1.35;
  373. // border-radius: 5px;
  374. -webkit-tap-highlight-color: transparent;
  375. overflow: hidden;
  376. color: #000000;
  377. background-color: #fff;
  378. height: 100%;
  379. }
  380. .box {
  381. width: 100vw;
  382. min-height: 100vh;
  383. background: #F4F5F7;
  384. padding-bottom: 60rpx;
  385. }
  386. .top {
  387. height: 350rpx;
  388. padding: 20rpx 24rpx 0;
  389. background-color: #D53533;
  390. border-radius: 0 0 5% 5%;
  391. }
  392. .customerMes {
  393. display: flex;
  394. }
  395. .mes {
  396. margin-left: 20rpx;
  397. }
  398. .nick {
  399. margin-bottom: 5rpx;
  400. display: flex;
  401. justify-content: flex-start;
  402. align-items: center;
  403. }
  404. .nickName {
  405. font-size: 34rpx;
  406. color: #FFFFFF;
  407. font-weight: bold;
  408. line-height: 48rpx;
  409. height: 48rpx;
  410. }
  411. .grade {
  412. margin-left: 15rpx;
  413. font-size: 24rpx;
  414. color: #FFFFFF;
  415. padding: 0rpx 10rpx;
  416. border: 1rpx solid #FFFFFF;
  417. border-radius: 4rpx;
  418. height: 36rpx;
  419. }
  420. .phone {
  421. font-size: 24rpx;
  422. color: #FFFFFF;
  423. }
  424. .headerBox {
  425. padding: 30rpx 24rpx;
  426. display: flex;
  427. justify-content: space-around;
  428. }
  429. .quan {
  430. display: flex;
  431. flex-direction: column;
  432. align-items: center;
  433. height: 120rpx;
  434. }
  435. .numStr {
  436. font-size: 40rpx;
  437. font-weight: bold;
  438. color: #FFFFFF;
  439. line-height: 56rpx;
  440. }
  441. .nameStr {
  442. font-size: 24rpx;
  443. color: #FFFFFF;
  444. }
  445. .orderBox {
  446. margin: 0rpx 24rpx;
  447. background: #FFFFFF;
  448. padding: 30rpx 20rpx;
  449. border-radius: 10rpx;
  450. margin-top: -100rpx;
  451. }
  452. .orderTitle {
  453. font-size: 30rpx;
  454. color: #333333;
  455. font-weight: bold;
  456. }
  457. .orderAll {
  458. display: flex;
  459. justify-content: space-between;
  460. align-items: center;
  461. }
  462. .orderLine {
  463. width: 25%;
  464. text-align: center;
  465. }
  466. .orderLineImg {
  467. width: 60rpx;
  468. height: 60rpx;
  469. }
  470. .orderLineTxt {
  471. font-size: 24rpx;
  472. color: #333333;
  473. }
  474. .orderImgBox {
  475. text-align: center;
  476. position: relative;
  477. }
  478. .orderLIneBox {
  479. display: flex;
  480. justify-content: space-between;
  481. padding-top: 30rpx;
  482. }
  483. .orderNum {
  484. height: 26rpx;
  485. line-height: 26rpx;
  486. background: #FF0000;
  487. padding: 0 8rpx;
  488. border-radius: 13rpx;
  489. color: #FFFFFF;
  490. font-size: 20rpx;
  491. position: absolute;
  492. left: 90rpx;
  493. z-index: 11;
  494. }
  495. .big_rightArrow {
  496. margin-right: 20rpx;
  497. width: 30rpx;
  498. height: 30rpx;
  499. }
  500. .rowBoxBg {
  501. margin: 20rpx 24rpx;
  502. background: #FFFFFF;
  503. border-radius: 10rpx;
  504. }
  505. .rowBox {
  506. display: flex;
  507. justify-content: space-between;
  508. background: #FFFFFF;
  509. padding: 35rpx 0rpx;
  510. border-radius: 10rpx;
  511. align-items: center;
  512. }
  513. .leftView {
  514. display: flex;
  515. align-items: center;
  516. }
  517. .rightView {
  518. display: flex;
  519. align-items: center;
  520. }
  521. .liftIcon {
  522. width: 34rpx;
  523. height: 34rpx;
  524. margin: 0rpx 20rpx;
  525. }
  526. .rowTitle {
  527. color: #3C3C3C;
  528. font-size: 28rpx;
  529. }
  530. .signOut {
  531. width: 702rpx;
  532. height: 98rpx;
  533. background: #FFFFFF;
  534. border-radius: 10rpx;
  535. font-size: 30rpx;
  536. color: #FF3B30;
  537. line-height: 98rpx;
  538. text-align: center;
  539. margin: 40rpx 24rpx;
  540. }
  541. .shopBox {
  542. padding: 20rpx;
  543. margin: 20rpx 24rpx;
  544. background-color: #FFFFFF;
  545. border-radius: 10rpx;
  546. }
  547. .shopCont {
  548. display: flex;
  549. justify-content: space-between;
  550. align-items: center;
  551. }
  552. .shopName {
  553. font-size: 30rpx;
  554. font-weight: bold;
  555. color: #3C3C3C;
  556. line-height: 42rpx;
  557. }
  558. .shopRightBox {
  559. display: flex;
  560. justify-content: space-between;
  561. }
  562. .address {
  563. display: flex;
  564. justify-content: space-between;
  565. align-items: center;
  566. }
  567. .Address,
  568. .shopTime,
  569. .distance {
  570. color: #999999;
  571. font-size: 24rpx;
  572. padding-top: 15rpx;
  573. /* 隐藏文字显示 ...不换行 */
  574. overflow: hidden;
  575. text-overflow: ellipsis;
  576. white-space: nowrap;
  577. }
  578. .shopRightBox {}
  579. .shopRightImg {
  580. width: 44rpx;
  581. height: 45rpx;
  582. }
  583. .authorizBox {
  584. width: 100vw;
  585. height: 100vh;
  586. background: rgba(0, 0, 0, 0.5);
  587. position: fixed;
  588. top: 0;
  589. left: 0;
  590. }
  591. .authorizCont {
  592. margin-top: 30vh;
  593. width: 564rpx;
  594. height: 408rpx;
  595. background: #FFFFFF;
  596. border-radius: 24rpx;
  597. margin-left: 93rpx;
  598. position: relative;
  599. }
  600. .authorizCloseImg {
  601. width: 62rpx;
  602. height: 62rpx;
  603. }
  604. .sqLogoBox {
  605. width: 180rpx;
  606. height: 180rpx;
  607. background: #FFFFFF;
  608. border-radius: 90rpx;
  609. text-align: center;
  610. position: absolute;
  611. top: -50rpx;
  612. left: 192rpx;
  613. }
  614. .authorizName {
  615. color: #333333;
  616. line-height: 42rpx;
  617. font-size: 30rpx;
  618. text-align: center;
  619. padding-top: 58rpx;
  620. }
  621. .authorizMs {
  622. color: #999999;
  623. line-height: 36rpx;
  624. font-size: 26rpx;
  625. width: 452rpx;
  626. padding-top: 24rpx;
  627. text-align: center;
  628. margin-left: 56rpx;
  629. }
  630. .authorizContbutton {
  631. width: 422rpx;
  632. height: 88rpx;
  633. background: #D53533;
  634. border-radius: 44rpx;
  635. line-height: 88rpx;
  636. text-align: center;
  637. font-size: 30rpx;
  638. color: #FFFFFF;
  639. margin-top: 62rpx;
  640. margin-left: 71rpx;
  641. }
  642. </style>