index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <template>
  2. <view>
  3. <view class="userHead" @click="toData">
  4. <view class="userHead-img">
  5. <u-avatar :src="userId ? headImg : '../../assets/img/head.png'" size="96"></u-avatar>
  6. </view>
  7. <view class="userHead-text">
  8. <h3 :style="elderStatus ? 'font-size: 28px;' : ''">{{userId ? userPhone : '点击登录/注册'}}</h3>
  9. </view>
  10. </view>
  11. <view class="userData">
  12. <view class="userData-num" @click="toBalance">
  13. <view class="userData-data oldTextjp" oldstyle="font-size: 28px;">{{personAccount.availableAmount != null ? personAccount.availableAmount.toFixed(2) : '0.00'}}元</view>
  14. <view class="userData-foot" :style="elderStatus ? 'font-size: 16px;' : ''">可用余额{{" "}}<span class="userData-foot-look">查看</span></view>
  15. </view>
  16. <view class="line">
  17. </view>
  18. <view class="userData-num" @click="toMyCoupon">
  19. <view class="userData-data oldTextjp" oldstyle="font-size: 28px;">{{recordsTotal}}张</view>
  20. <view class="userData-foot" :style="elderStatus ? 'font-size: 16px;' : ''">优惠券{{" "}}<span class="userData-foot-look">查看</span></view>
  21. </view>
  22. </view>
  23. <view class="userBanner">
  24. <!-- <u-image width="100%" height="80px" src="../../static/img/banner.jpg" border-radius="16"></u-image>
  25. --> <u-swiper bg-color="#fff"
  26. :img-mode="'scaleToFill'" height="160"
  27. :list="bannerList" @click="clickBanner" :name="'picUrl'" >
  28. </u-swiper>
  29. </view>
  30. <view class="userIcon">
  31. <view class="userIcon-tit" :style="elderStatus ? 'font-size: 20px;' : ''">
  32. <h3>我的服务</h3>
  33. </view>
  34. <!-- <view class="userIcon-main">
  35. <view class="userIcon-item" @click="getScanCode">
  36. <view class="userIcon-icon userIcon-icon1">
  37. <u-icon name="qr-scan-2-line" custom-prefix="custom-icon" " size="36"></u-icon>
  38. </view>
  39. <p :style="elderStatus ? 'font-size: 18px;' : ''">扫码充电</p>
  40. </view>
  41. <view class="userIcon-item" @click="fastRecharge">
  42. <view class="userIcon-icon userIcon-icon2">
  43. <u-icon name="wallet-3-line" custom-prefix="custom-icon" color="#fff" size="36"></u-icon>
  44. </view>
  45. <p :style="elderStatus ? 'font-size: 18px;' : ''">快速充值</p>
  46. </view>
  47. <view class="userIcon-item" @click="chargingRecord">
  48. <view class="userIcon-icon userIcon-icon3">
  49. <u-icon name="todo-line" custom-prefix="custom-icon" color="#fff" size="36"></u-icon>
  50. </view>
  51. <p :style="elderStatus ? 'font-size: 18px;' : ''">充电记录</p>
  52. </view>
  53. <view class="userIcon-item" @click="toSearchPile">
  54. <view class="userIcon-icon userIcon-icon4">
  55. <u-icon name="road-map-line" custom-prefix="custom-icon" color="#fff" size="36"></u-icon>
  56. </view>
  57. <p :style="elderStatus ? 'font-size: 18px;' : ''">附近站点</p>
  58. </view>
  59. </view> -->
  60. <view class="userIcon-main">
  61. <view class="userIcon-item" @click="chargingRecord">
  62. <view class="userIcon-icon">
  63. <img src="../../static/img/riFill-file-list-3-fill@1x.png" alt="">
  64. </view>
  65. <p :style="elderStatus ? 'font-size: 18px;' : ''">充电记录</p>
  66. </view>
  67. <view class="userIcon-item" @click="carManage">
  68. <view class="userIcon-icon">
  69. <img src="../../static/img/riFill-car-fill@1x.png" alt="">
  70. </view>
  71. <p :style="elderStatus ? 'font-size: 18px;' : ''">车辆管理</p>
  72. </view>
  73. <view class="userIcon-item" @click="myAppointment">
  74. <view class="userIcon-icon">
  75. <img src="../../static/img/riFill-map-pin-time-fill.svg" alt="">
  76. </view>
  77. <p :style="elderStatus ? 'font-size: 18px;' : ''">我的预约</p>
  78. </view>
  79. <view class="userIcon-item " @click="toInvoice" >
  80. <view class="userIcon-icon">
  81. <img src="../../static/img/riFill-money-cny-box-fill.svg" alt="">
  82. </view>
  83. <p :style="elderStatus ? 'font-size: 18px;' : ''">我的发票</p>
  84. </view>
  85. <view class="userIcon-item" @click="toFreeInstallation">
  86. <view class="userIcon-icon">
  87. <img src="../../static/img/riFill-file-add-fill.svg" alt="">
  88. </view>
  89. <p :style="elderStatus ? 'font-size: 18px;' : ''">免费安桩</p>
  90. </view>
  91. <view class="userIcon-item" @click="toJoin">
  92. <view class="userIcon-icon">
  93. <img src="../../static/img/riFill-service-fill.svg" alt="">
  94. </view>
  95. <p :style="elderStatus ? 'font-size: 18px;' : ''">我要加盟</p>
  96. </view>
  97. <view class="userIcon-item lucency" >
  98. <view class="userIcon-icon">
  99. <img src="../../static/img/riFill-tools-fill.svg" alt="">
  100. </view>
  101. <p :style="elderStatus ? 'font-size: 18px;' : ''">我要报修</p>
  102. </view>
  103. <view class="userIcon-item lucency" >
  104. <view class="userIcon-icon">
  105. <img src="../../static/img/riFill-shield-user-fill.svg" alt="">
  106. </view>
  107. <p :style="elderStatus ? 'font-size: 18px;' : ''">实名认证</p>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="userCell">
  112. <!-- <view class="userCell-item" @click="carManage">
  113. <view class="userCell-title oldTextjp" oldstyle="font-size: 20px;">
  114. <u-icon name="menu_cwcl" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  115. <p>车辆管理</p>
  116. </view>
  117. <view>
  118. <text class="add" :style="elderStatus ? 'font-size: 16px;' : ''">添加车牌号</text>
  119. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  120. </view>
  121. </view> -->
  122. <view class="userCell-item" @click="gotoUrl('pages/user/help')">
  123. <view class="userCell-title oldTextjp" oldstyle="font-size: 20px;">
  124. <u-icon name="compass-3-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  125. <p>操作指南</p>
  126. </view>
  127. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  128. </view>
  129. <view class="userCell-item" @click="feedback">
  130. <view class="userCell-title oldTextjp" oldstyle="font-size: 20px;">
  131. <u-icon name="feedback-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  132. <p>意见反馈</p>
  133. </view>
  134. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  135. </view>
  136. <view class="userCell-item" @click="gotoUrl('pages/user/about')">
  137. <view class="userCell-title oldTextjp" oldstyle="font-size: 20px;">
  138. <u-icon name="information-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  139. <p>关于我们</p>
  140. </view>
  141. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  142. </view>
  143. <view class="userCell-item" @click="openModal">
  144. <view class="userCell-title oldTextjp" oldstyle="font-size: 20px;">
  145. <u-icon name="customer-service-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  146. <p>联系客服</p>
  147. </view>
  148. <span :style="elderStatus ? 'font-size: 16px;' : ''">{{content}}</span>
  149. </view>
  150. <view>
  151. <u-modal v-model="show" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266" :show-cancel-button="true" ref="uModal"
  152. :asyncClose="true" :title="title" :content="content" :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  153. </view>
  154. <view class="userCell-item" @click="setUp">
  155. <view class="userCell-title oldTextjp" oldstyle="font-size: 20px;">
  156. <u-icon name="settings-4-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  157. <p>设置</p>
  158. </view>
  159. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  160. </view>
  161. </view>
  162. <Tabbar :current="2" ref="tabbarMain" :elderStatus="elderStatus"></Tabbar>
  163. </view>
  164. </template>
  165. <script>
  166. import * as API from '@/apis/index.js'
  167. import * as userApi from '@/apis/user.js'
  168. import * as loginApi from '@/apis/login.js'
  169. import * as WxJsApi from '@/utils/wxJsApi.js'
  170. import Tabbar from '@/components/Tabbar.vue'
  171. import * as newsApi from '@/apis/news.js'
  172. export default {
  173. components: {
  174. Tabbar
  175. },
  176. data() {
  177. return {
  178. recordsTotal: 0,
  179. myCouponList: [],
  180. elderStatus: false,
  181. personAccount: {},
  182. userId: '',
  183. headImg: '',
  184. userPhone: '',
  185. show: false,
  186. title: '联系客服',
  187. content: '400-8899-619',
  188. confirmText: '拨打电话',
  189. bannerList:[],
  190. background:{
  191. background: 'none'
  192. },
  193. }
  194. },
  195. onShow() {
  196. if(this.carhelp.getPersonInfo()) {
  197. this.userId = this.carhelp.getPersonInfo().id;
  198. this.getCarPersonAccount();
  199. this.getUserInfo();
  200. this.getCouponList();
  201. }
  202. if(this.$refs.tabbarMain){
  203. this.$refs.tabbarMain.setcount(2);
  204. }
  205. if(this.carhelp.get("getElderModeClass") == "长辈模式") {
  206. this.elderStatus = true;
  207. } else {
  208. this.elderStatus = false;
  209. }
  210. },
  211. onReady() {
  212. WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
  213. // //(res)
  214. }).catch(error => {
  215. //(error)
  216. })
  217. var consumerPhone=this.carhelp.getConfig().consumerPhone
  218. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  219. if(consumerPhone){
  220. this.content=consumerPhone
  221. }
  222. this.getBannerInfo("userinfo")
  223. },
  224. methods: {
  225. clickBanner(index){
  226. var mod= this.bannerList[index]
  227. if(mod.linkUrl.indexOf('http')==0){
  228. window.location=mod.linkUrl;
  229. }
  230. else if(mod.linkUrl.indexOf('#/')==0){
  231. if(mod.linkUrl.indexOf("?")==-1){
  232. mod.linkUrl+='?';
  233. }
  234. //window.location=mod.linkUrl;
  235. var url=mod.linkUrl.split("#")[1]
  236. //window.location = mod.clickUrl;
  237. uni.navigateTo({
  238. url: url
  239. })
  240. }
  241. else if(mod.linkUrl=='#'||mod.linkUrl==''){
  242. }
  243. else{
  244. uni.navigateTo({
  245. url:mod.linkUrl
  246. })
  247. }
  248. },
  249. getBannerInfo(code){
  250. uni.showLoading({
  251. title: "加载中",
  252. mask: true,
  253. })
  254. newsApi.getBannerInfo(code).then((res) => {
  255. uni.hideLoading();
  256. this.bannerList =res.data;
  257. // document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 300px;"
  258. }).catch(error => {
  259. uni.showToast({
  260. title: error,icon: "none"
  261. })
  262. })
  263. },
  264. getCouponList() {
  265. uni.showLoading({
  266. title: "加载中",
  267. mask: true,
  268. })
  269. userApi.couponList({
  270. status: '0'
  271. }).then((res) => {
  272. uni.hideLoading();
  273. this.myCouponList = res.data.data;
  274. this.recordsTotal = res.data.recordsTotal;
  275. }).catch(error => {
  276. uni.showToast({
  277. title: error,
  278. icon: "none"
  279. })
  280. })
  281. },
  282. //微信扫二维码
  283. getScanCode() {
  284. if (this.userId) {
  285. WxJsApi.scanQRCode(1).then(res => {
  286. if(res) {
  287. API.scanCode(res).then((response) => {
  288. }).catch(error => {
  289. uni.showToast({
  290. title: error,
  291. icon: "none"
  292. })
  293. })
  294. }
  295. }).catch(error => {
  296. })
  297. } else {
  298. uni.navigateTo({
  299. url: '/pages/login/login'
  300. })
  301. }
  302. },
  303. fastRecharge() {
  304. if (this.userId) {
  305. uni.navigateTo({
  306. url: '/pages/user/finance/recharge'
  307. })
  308. } else {
  309. uni.navigateTo({
  310. url: '/pages/login/login'
  311. })
  312. }
  313. },
  314. toInvoice(){
  315. if (this.userId) {
  316. uni.navigateTo({
  317. url: '/pages/MyInvoice/invoiceManagement'
  318. })
  319. } else {
  320. uni.navigateTo({
  321. url: '/pages/login/login'
  322. })
  323. }
  324. },
  325. chargingRecord() {
  326. if (this.userId) {
  327. uni.navigateTo({
  328. url: '/pages/record/index'
  329. })
  330. } else {
  331. uni.navigateTo({
  332. url: '/pages/login/login'
  333. })
  334. }
  335. },
  336. toSearchPile() {
  337. uni.navigateTo({
  338. url: '/pages/searchPile/searchPile'
  339. })
  340. },
  341. getUserInfo() {
  342. uni.showLoading({
  343. title: "加载中",
  344. mask: true,
  345. })
  346. loginApi.findByOpenId({
  347. openId: this.carhelp.getOpenId()
  348. }).then((res) => {
  349. uni.hideLoading();
  350. this.headImg = res.data.regUser.headImg;
  351. var phone = res.data.regUser.phone;
  352. var phone1 = phone.slice(0,3);
  353. var phone2 = phone.slice(-4);
  354. this.userPhone = phone1 + '****' + phone2;
  355. }).catch(error => {
  356. uni.showToast({
  357. title: error,
  358. icon: "none"
  359. })
  360. })
  361. },
  362. toData() {
  363. if(this.userId) {
  364. uni.navigateTo({
  365. url: '/pages/user/data'
  366. })
  367. } else {
  368. uni.navigateTo({
  369. url: '/pages/login/login'
  370. })
  371. }
  372. },
  373. toBalance() {
  374. if(this.userId) {
  375. uni.navigateTo({
  376. url: '/pages/user/finance/balance'
  377. })
  378. } else {
  379. uni.navigateTo({
  380. url: '/pages/login/login'
  381. })
  382. }
  383. },
  384. toMyCoupon() {
  385. if(this.userId) {
  386. uni.navigateTo({
  387. url: '/pages/user/coupon/myCoupon'
  388. })
  389. } else {
  390. uni.navigateTo({
  391. url: '/pages/login/login'
  392. })
  393. }
  394. },
  395. toRecharge() {
  396. if(this.userId) {
  397. uni.navigateTo({
  398. url: '/pages/user/finance/recharge'
  399. })
  400. } else {
  401. uni.navigateTo({
  402. url: '/pages/login/login'
  403. })
  404. }
  405. },
  406. carManage() {
  407. if(this.userId) {
  408. uni.navigateTo({
  409. url: '/pages/user/car/index'
  410. })
  411. } else {
  412. uni.navigateTo({
  413. url: '/pages/login/login'
  414. })
  415. }
  416. },
  417. myAppointment() {
  418. if(this.userId) {
  419. uni.navigateTo({
  420. url: '/pages/user/myReservation/myReservation'
  421. })
  422. } else {
  423. uni.navigateTo({
  424. url: '/pages/login/login'
  425. })
  426. }
  427. },
  428. toFreeInstallation() {
  429. if(this.userId) {
  430. uni.navigateTo({
  431. url: '/pages/user/freeInstallment?isback=1'
  432. })
  433. } else {
  434. uni.navigateTo({
  435. url: '/pages/login/login'
  436. })
  437. }
  438. },
  439. toJoin() {
  440. if(this.userId) {
  441. uni.navigateTo({
  442. url: '/pages/user/toJoin?isback=1'
  443. })
  444. } else {
  445. uni.navigateTo({
  446. url: '/pages/login/login'
  447. })
  448. }
  449. },
  450. feedback() {
  451. if(this.userId) {
  452. uni.navigateTo({
  453. url: '/pages/user/message'
  454. })
  455. } else {
  456. uni.navigateTo({
  457. url: '/pages/login/login'
  458. })
  459. }
  460. },
  461. setUp() {
  462. if(this.userId) {
  463. uni.navigateTo({
  464. url: '/pages/user/setting'
  465. })
  466. } else {
  467. uni.navigateTo({
  468. url: '/pages/login/login'
  469. })
  470. }
  471. },
  472. openModal() {
  473. this.show = true;
  474. },
  475. confirmPhone(){
  476. this.show = false;
  477. uni.makePhoneCall({
  478. phoneNumber:this.content //仅为示例
  479. });
  480. },
  481. getCarPersonAccount() {
  482. uni.showLoading({
  483. title: "加载中",
  484. mask: true,
  485. })
  486. userApi.carPersonAccount().then((res) => {
  487. uni.hideLoading();
  488. this.personAccount = res.data;
  489. }).catch(error => {
  490. uni.showToast({
  491. title: error,
  492. icon: "none"
  493. })
  494. })
  495. }
  496. }
  497. }
  498. </script>
  499. <style>
  500. page{
  501. background:url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  502. background-size: 100%;
  503. }
  504. </style>
  505. <style lang="scss" scoped>
  506. .userBanner{
  507. margin: 16px;
  508. }
  509. .userIcon{
  510. background-color: #fff;
  511. margin: 16px;
  512. border-radius: 8px;
  513. padding: 16px;
  514. }
  515. .userIcon-item{
  516. display: flex;
  517. flex-direction: column;
  518. align-items: center;
  519. margin-top: 18px;
  520. width: 25%;
  521. font-size: 14px
  522. }
  523. .lucency{
  524. opacity: 0.5;
  525. }
  526. .userIcon-main{
  527. display: flex;
  528. justify-content: space-between;
  529. flex-wrap: wrap;
  530. font-size: 16px;
  531. }
  532. .userIcon-icon{
  533. display: flex;
  534. flex-direction: column;
  535. align-items: center;
  536. justify-content: center;
  537. height: 40px;
  538. width: 40px;
  539. border-radius: 50%;
  540. margin-bottom: 6px;
  541. }
  542. .userIcon-icon1{background-color: #59D96E;}
  543. .userIcon-icon2{background-color: #4BD2C0;}
  544. .userIcon-icon3{background-color: #6FA5FF;}
  545. .userIcon-icon4{background-color: #9D9FFF;}
  546. .userCell{
  547. background-color: #fff;
  548. border-radius: 8px;
  549. margin: 16px;
  550. .userCell-item{
  551. display: flex;
  552. justify-content: space-between;
  553. align-items: center;
  554. padding: 16px;
  555. .userCell-title{
  556. font-size: 16px;
  557. display: flex;
  558. align-items: center;
  559. p{
  560. margin-left: 8px;
  561. }
  562. }
  563. span{
  564. color:#999;
  565. }
  566. .add{
  567. color:#999;
  568. }
  569. }
  570. }
  571. .userHead{
  572. display: flex;
  573. align-items: center;
  574. align-items: center;
  575. padding:40px 20px 0;
  576. .userHead-img{
  577. }
  578. .userHead-text{
  579. margin-left: 12px;
  580. h3{
  581. font-size: 20px;
  582. color:#fff;
  583. font-weight: normal;
  584. }
  585. }
  586. }
  587. .userData{
  588. background-color: #fff;
  589. margin: 16px;
  590. padding: 16px ;
  591. border-radius: 8px;
  592. display: flex;
  593. align-items: center;
  594. justify-content: space-around;
  595. }
  596. .userData-num{
  597. width: 50%;
  598. display: flex;
  599. flex-direction: column;
  600. align-items: center;
  601. justify-content:space-between;
  602. padding-right: 5px;
  603. .userData-data{
  604. font-size: 24px;
  605. font-weight: 600;
  606. }
  607. .userData-name{
  608. font-size: 16px;
  609. }
  610. .userData-foot{
  611. margin-top: 4px;
  612. color:#999;
  613. font-size: 12px;
  614. .userData-foot-look {
  615. color: #00B962;
  616. }
  617. }
  618. }
  619. .userInfo-btn{
  620. padding: 6px 30px;
  621. // background-color: #00B962;
  622. // color:#fff;
  623. // border-radius: 15px;
  624. }
  625. .line{
  626. width: 0px;
  627. height: 36px;
  628. border: 1px solid rgba(237, 237, 237, 100);
  629. }
  630. </style>