index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. <template>
  2. <view>
  3. <!-- ===================================== 搜索栏 ===================================== -->
  4. <view class="header-bar">
  5. <view class="city" @click="handleCitySelect">
  6. <view class="city-name">{{ city }}</view>
  7. <u-icon name="arrow-down" color="#fff" size="32"></u-icon>
  8. </view>
  9. <u-search placeholder="搜索停车点" :show-action="false" @search="handleSearch" v-model="keyword"></u-search>
  10. </view>
  11. <!-- ===================================== 轮播图 ===================================== -->
  12. <view v-if="bannerList.length">
  13. <u-swiper :list="bannerList" border-radius="0" mode="none" @click="swiperClick"></u-swiper>
  14. </view>
  15. <!-- ===================================== 城市选择器 ===================================== -->
  16. <u-city-select v-model="cityOpen" @city-change="cityChange" :areaCode="['52', '5201']"></u-city-select>
  17. <!-- ===================================== 滚动信息栏 ===================================== -->
  18. <view class="notice-bar-wrap u-flex" v-if="noticeList.length" @click="openPage('pages/message/message', true)">
  19. <u-icon custom-prefix="custom-icon" size="50" name="xiaoxi" color="#008CFF"></u-icon>
  20. <u-notice-bar
  21. class="u-flex-1"
  22. mode="vertical"
  23. :autoplay="true"
  24. :list="noticeList"
  25. :volume-icon="false"
  26. bg-color="#fff"
  27. color="#727272"
  28. :more-icon="true"
  29. ></u-notice-bar>
  30. </view>
  31. <!-- ===================================== 宫格菜单 ===================================== -->
  32. <u-card :show-head="false" :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
  33. <view class="content-nav" slot="body">
  34. <view class="content-nav-item" v-for="(grid, index) in gridList" :key="'g-' + index" @click="openPage(grid.url, true)">
  35. <view class="content-nav-item-icon-wrap">
  36. <u-image :src="grid.imageUrl" :width="grid.width || '95rpx'" :height="grid.height || '95rpx'" :mode="grid.mode || 'heightFix'"></u-image>
  37. </view>
  38. <view class="content-nav-item-icon-text">{{ grid.title }}</view>
  39. </view>
  40. </view>
  41. </u-card>
  42. <u-card :show-head="false" :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
  43. <view slot="body" class="myorders">
  44. <view class="myorders-item"
  45. >当前已缴费<text style="color: #008cff">{{ totalCount || '0' }}</text
  46. >笔,合计<text style="color: #008cff">{{ totalActualAmount || '0' }}</text
  47. >元</view
  48. >
  49. <view class="myorders-item"
  50. >当前欠费<text style="color: #ff482b">{{ totalPayCount || '0' }}</text
  51. >笔,合计<text style="color: #ff482b">{{ totalPayAmount || '0' }}</text
  52. >元</view
  53. >
  54. </view>
  55. </u-card>
  56. <!-- ===================================== 停车列表 ===================================== -->
  57. <view v-for="item in orderList" :key="item.id">
  58. <u-card :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
  59. <view class="pending-order-head" slot="head">
  60. <view class="pending-order-head-left">
  61. <b>P</b>
  62. {{ item.roadName }}
  63. </view>
  64. <view class="pending-order-head-right" @click="onRoadInfo(item)">
  65. <u-icon class="arrow-down" name="arrow-down" size="32" color="#aaa"></u-icon>
  66. </view>
  67. </view>
  68. <view class="pending-order-body" slot="body">
  69. <view class="pending-order-body-nav">
  70. <view class="nav-item nav-manual" @click="orderNavclick()" :class="{ active: orderNav == 0 }"> 手动缴费</view>
  71. <view class="nav-item nav-auto" @click="orderNavclick()" :class="{ active: orderNav == 1 }">无感支付 </view>
  72. </view>
  73. <view class="pending-order-body-wrap" v-show="orderNav == 0">
  74. <view class="pending-order-body-left">
  75. <view class="car-number">{{ item.vehicleNo }}</view>
  76. <view class="item-cell">
  77. <span class="pending-order-body-left-label">入场时间:</span>
  78. <span>{{ item.inTime }}</span>
  79. </view>
  80. <view class="item-cell">
  81. <span class="pending-order-body-left-label">出场时间:</span>
  82. <span>{{ item.outTime || '未出场' }}</span>
  83. </view>
  84. <view class="item-cell">
  85. <span class="pending-order-body-left-label">预计金额:</span>
  86. <span>{{ item.payAmount || 0 }}</span>
  87. </view>
  88. <view class="item-cell" v-if="item.vehicleNo == ''">
  89. <span class="pending-order-body-left-label">车牌信息:</span>
  90. <span class="pending-order-body-center-label" @click="addvehicleNo(item.orderId)">添加车牌</span>
  91. </view>
  92. <view class="item-cell" v-else>
  93. <span class="pending-order-body-left-label">车牌信息:</span>
  94. <span>{{ item.vehicleNo }}</span>
  95. <!-- <span class="pending-order-body-right-label" @click="changevehicleNo(item.orderId)">更换</span> -->
  96. </view>
  97. <!-- <view class="item-cell">
  98. <span class="pending-order-body-left-label">出场时间:</span>
  99. <span>{{item.outTime||'停放中'}}</span>
  100. </view>
  101. <view class="item-cell">
  102. <span class="pending-order-body-left-label">停留时间:</span>
  103. <span>{{item.duration||'停放中'}}</span>
  104. </view>
  105. <view class="item-cell cost">
  106. <span class="pending-order-body-left-label">停车费用:</span>
  107. <span>
  108. <span class="number" v-if="item.payAmount">¥{{item.payAmount}}</span>
  109. <span class="number" v-else>停放中</span>
  110. </span>
  111. </view>-->
  112. </view>
  113. <view class="pending-order-body-right">
  114. <view class="order">停车泊位:{{ item.spaceName }}</view>
  115. </view>
  116. <view class="go-pay-wrap" v-if="Number(item.deviceType) !== 2">
  117. <view class="go-pay" @click="goPay(item)" v-if="item.payAmount != 0">出场缴费</view>
  118. <view class="go-pay1" v-else>出场缴费</view>
  119. </view>
  120. </view>
  121. <view class="pending-order-body-wrap" v-show="orderNav == 1">
  122. <view v-if="contractStatus == 0" class="nosign">
  123. <view class="nosign1">您的车牌未签约贵州银行无感支付</view>
  124. <view class="nosign2">请下载贵州银行手机银行app进行签约</view>
  125. </view>
  126. <view v-if="contractStatus == 1" class="sign">
  127. <view class="sign1">您已签约贵州银行无感支付</view>
  128. <view class="sign2">停车出场时将默认使用无感支付进行支付</view>
  129. </view>
  130. </view>
  131. </view>
  132. </u-card>
  133. </view>
  134. <!-- ===================================== 无停车信息 ===================================== -->
  135. <view class="empty-data-box" v-if="!orderList.length">
  136. <u-empty text="暂无停车信息" mode="list"></u-empty>
  137. </view>
  138. <!-- ===================================== 优惠活动 ===================================== -->
  139. <view class="promotion-box">
  140. <view class="promotion-title">
  141. <text>优惠活动</text>
  142. </view>
  143. <view class="promotion-banner">
  144. <u-swiper :list="promotionBannerList" @click="promotionBannerClick" height="221"></u-swiper>
  145. </view>
  146. </view>
  147. <!-- ===================================== 绑定车牌号弹框 ===================================== -->
  148. <u-modal
  149. v-model="bindCarShow"
  150. title="绑定车牌号"
  151. :show-cancel-button="true"
  152. confirm-text="去绑定"
  153. content="首次使用请先绑定您的车牌"
  154. @confirm="$u.route({ url: 'pages/myCars/myCars' })"
  155. />
  156. <!-- ===================================== 停车场信息弹框 ===================================== -->
  157. <u-popup class="popup-order-details" v-model="showOrderDetails" mode="center" width="90%" border-radius="20">
  158. <view class="popup-order-details-til">停车场信息</view>
  159. <view class="popup-order-details-con">
  160. <dl>
  161. <dt>路段名称:</dt>
  162. <dd>{{ popupOrderDetails.roadName }}</dd>
  163. </dl>
  164. <dl>
  165. <dt>路段编码:</dt>
  166. <dd>{{ popupOrderDetails.roadNo }}</dd>
  167. </dl>
  168. <dl>
  169. <dt>联系人:</dt>
  170. <dd>{{ popupOrderDetails.manager }}</dd>
  171. </dl>
  172. <dl>
  173. <dt>联系电话:</dt>
  174. <dd @click="phoneCall(popupOrderDetails.telephone)">{{ popupOrderDetails.telephone }}</dd>
  175. </dl>
  176. </view>
  177. <view class="popup-order-details-footer" @click="closeOrderDetails">知道了</view>
  178. </u-popup>
  179. <!-- ===================================== 0元提示弹出层 ===================================== -->
  180. <u-modal v-model="jumpMsgModal" :content="jumpMsgContent" :show-title="false" :show-confirm-button="false" />
  181. <u-toast ref="uToast" />
  182. <!-- ===================================== 添加车牌弹出层 ===================================== -->
  183. <u-popup class="popup-vehicleNo" v-model="ShowaddvehicleNo" mode="center" border-radius="20" width="710rpx" height="auto">
  184. <view class="popup-vehicleNo-title">添加车牌</view>
  185. <view class="popup-vehicleNo-center"></view>
  186. <view class="popup-vehicleNo-content">
  187. <view class="new-plate-number">
  188. <view class="message-input-wrap" @click="messageInputClick">
  189. <u-message-input :maxlength="8" width="70" font-size="50" :disabled-keyboard="true" v-model="newPlateNumber"></u-message-input>
  190. </view>
  191. </view>
  192. </view>
  193. <view class="popup-vehicleNo-select">暂无绑定车牌</view>
  194. <view class="vehicleNo-btn">
  195. <u-button type="primary" @click="handleAddCar">确认</u-button>
  196. <u-button type="primary" plain @click="ShowaddvehicleNo = false">取消</u-button>
  197. </view>
  198. </u-popup>
  199. <u-action-sheet :list="colorList" @click="confirmColor" v-model="colorShow"></u-action-sheet>
  200. <u-keyboard ref="uKeyboard" mode="car" @change="keyboardChange" @confirm="keyboardConfirm" @backspace="backspace" v-model="keyboardshow" />
  201. <!-- ===================================== 更换车牌弹出层 ===================================== -->
  202. <u-popup class="popup-vehicleNo" v-model="ShowchangevehicleNo" mode="center" border-radius="20" width="710rpx" height="auto">
  203. <view class="popup-vehicleNo-title">更换车牌</view>
  204. <view class="popup-vehicleNo-center"></view>
  205. <view class="popup-vehicleNo-content">
  206. <view class="new-plate-number">
  207. <view class="message-input-wrap" @click="messageInputClick">
  208. <u-message-input :maxlength="8" width="70" font-size="50" :disabled-keyboard="true" v-model="newPlateNumber"></u-message-input>
  209. </view>
  210. </view>
  211. </view>
  212. <view class="popup-vehicleNo-select">
  213. <u-collapse ref="refValue">
  214. <u-collapse-item title="点击选择车牌" align="center">
  215. <u-cell-group>
  216. <u-cell-item :title="item.vehicleNo" v-for="(item, index) in groupList" :key="index" :arrow="false">
  217. <u-radio-group v-model="selectvalue" @change="radioGroupChange">
  218. <u-radio :name="item.vehicleNo" :key="index"></u-radio>
  219. </u-radio-group>
  220. </u-cell-item>
  221. </u-cell-group>
  222. </u-collapse-item>
  223. </u-collapse>
  224. </view>
  225. <view class="vehicleNo-btn">
  226. <u-button type="primary" @click="handleAddCar">确认</u-button>
  227. <u-button type="primary" plain @click="ShowchangevehicleNo = false">取消</u-button>
  228. </view>
  229. </u-popup>
  230. <!-- 选择支付 -->
  231. <ChoosePayment ref="choosePayment" :curOrderList="curOrderList" :jumpUrl="jumpUrl" @closePaymentMethod="closePaymentMethod" />
  232. </view>
  233. </template>
  234. <script>
  235. import getUrlParams from '../../utils/getUrlParams.js';
  236. // import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue';
  237. import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
  238. import { jsonp } from 'vue-jsonp';
  239. export default {
  240. components: {
  241. // PaymentMethod,
  242. ChoosePayment
  243. },
  244. data() {
  245. return {
  246. orderid: '',
  247. selectvalue: null,
  248. groupList: [],
  249. radiogroupList: [],
  250. keyboardshow: false,
  251. colorShow: false,
  252. colorList: [
  253. { text: '蓝色', colorCode: 0 },
  254. { text: '黄色', colorCode: 1 },
  255. { text: '黑色', colorCode: 2 },
  256. { text: '白色', colorCode: 3 },
  257. { text: '绿色', colorCode: 4 },
  258. { text: '其他', colorCode: 99 }
  259. ],
  260. vehicleColor: 0,
  261. newPlateNumber: '',
  262. //更换车牌弹窗
  263. ShowchangevehicleNo: false,
  264. //添加车牌弹窗
  265. ShowaddvehicleNo: false,
  266. // 城市选择框
  267. cityOpen: false,
  268. // 选中城市
  269. city: '贵州省',
  270. // 搜索框值
  271. keyword: '',
  272. // 轮播图
  273. bannerList: [],
  274. // 订单列表
  275. orderList: [],
  276. // 微信code
  277. code: null,
  278. // 手动,无感
  279. orderNav: '',
  280. // 绑定车询问弹窗
  281. bindCarShow: false,
  282. // 是否线上订单细节
  283. showOrderDetails: false,
  284. // 订单详情
  285. popupOrderDetails: [],
  286. // 消息列表
  287. noticeList: [],
  288. // 优惠活动广告图
  289. promotionBannerList: [
  290. {
  291. id: 1,
  292. image: '/static/img/promotion-banner-1.png',
  293. title: '1分钱停车'
  294. },
  295. {
  296. id: 2,
  297. image: '/static/img/promotion-banner-2.png',
  298. title: '八折停车'
  299. }
  300. ],
  301. // 签约状态
  302. contractStatus: '',
  303. vehicleId: '',
  304. recordList: [],
  305. // 支付方式弹框
  306. payWayPop: false,
  307. // 订单号
  308. curOrderList: [],
  309. // 当前位置经纬度
  310. latLongItude: {},
  311. // 跳转地址
  312. jumpUrl: '',
  313. // 宫格菜单列表
  314. gridList: [
  315. {
  316. url: 'pages/payLists/payLists',
  317. imageUrl: '../../static/img/index-content-nav-01.png',
  318. title: '停车缴费'
  319. },
  320. {
  321. url: 'pages/favourableActivity/favourableActivity',
  322. imageUrl: '../../static/img/index-content-nav-02.png',
  323. title: '优惠活动'
  324. },
  325. {
  326. url: 'pages/myCars/myCars',
  327. imageUrl: '../../static/img/index-content-nav-03.png',
  328. title: '车辆管理'
  329. },
  330. {
  331. url: 'pages/searchparking/searchparking',
  332. imageUrl: '../../static/img/index-content-nav-04.png',
  333. title: '我的停车'
  334. }
  335. ],
  336. totalActualAmount: '', //缴费总额
  337. totalPayAmount: '', //应支付总额
  338. totalCount: '', //缴费总笔数
  339. totalPayCount: '', //应支付总笔数
  340. // 0元提示框
  341. jumpMsgModal: false,
  342. // 0元提示内容
  343. jumpMsgContent: ''
  344. };
  345. },
  346. onLoad(page) {
  347. const locationLocaturl = location.href;
  348. // 微信聚合支付完成跳转过来重定向到详情页
  349. const type = getUrlParams(locationLocaturl, 'type');
  350. if (type && type === 'jumpurl') {
  351. const jumpurl = localStorage.getItem('jumpUrl');
  352. if (jumpurl) {
  353. uni.showLoading({
  354. title: '正在跳转中...'
  355. });
  356. setTimeout(() => {
  357. uni.hideLoading();
  358. location.href = jumpurl;
  359. }, 0);
  360. }
  361. }
  362. // 0元支付情况添加一个加载层
  363. const jumpMsg = getUrlParams(locationLocaturl, 'jumpMsg');
  364. if (jumpMsg) {
  365. this.jumpMsgModal = true;
  366. this.jumpMsgContent = jumpMsg;
  367. setTimeout(() => {
  368. this.jumpMsgModal = false;
  369. }, 3000);
  370. }
  371. // this.getParams();
  372. this.getLocation();
  373. this.handleGetIndexData();
  374. },
  375. methods: {
  376. /**
  377. * @description: 获取参数免费时长
  378. * @return {*}
  379. */
  380. async getParams() {
  381. const { code, msg } = await this.$u.api.getParamsApi({
  382. key: 'park.lock.freetime'
  383. });
  384. if (code === 200) {
  385. this.$u.vuex('free_time', msg);
  386. }
  387. },
  388. radioGroupChange(e) {
  389. this.newPlateNumber = e;
  390. },
  391. // 获取车辆列表
  392. handlegetMycars() {
  393. let that = this;
  394. this.$u.api.getMycars().then((res) => {
  395. if (res.code === 200) {
  396. this.groupList = res.data.rows;
  397. this.radiogroupList = res.data.rows;
  398. this.$nextTick(() => {
  399. // dom元素更新后执行,因此这里能正确打印更改之后的值
  400. console.log(that.$refs.refValue.init()); // 改变了的值
  401. });
  402. }
  403. });
  404. },
  405. //更换车牌信息
  406. changevehicleNo(id) {
  407. this.orderid = id;
  408. this.ShowchangevehicleNo = true;
  409. this.handlegetMycars();
  410. },
  411. // 添加车辆
  412. handleAddCar() {
  413. if (!this.$u.test.carNo(this.newPlateNumber)) {
  414. this.$refs.uToast.show({
  415. title: '请正确填写车牌号',
  416. type: 'error'
  417. });
  418. return;
  419. }
  420. let param = {
  421. orderId: this.orderid,
  422. vehicleNo: this.newPlateNumber,
  423. vehicleColor: this.vehicleColor
  424. };
  425. this.$u.api.bindVehicleNo(param).then((res) => {
  426. if (res.code === 200) {
  427. this.$refs.uToast.show({
  428. title: res.msg,
  429. type: 'success'
  430. });
  431. this.handleGetIndexData();
  432. this.ShowchangevehicleNo = false;
  433. }
  434. });
  435. },
  436. //新增车牌
  437. addvehicleNo() {
  438. this.ShowaddvehicleNo = true;
  439. },
  440. // 点击输入框
  441. messageInputClick() {
  442. this.keyboardshow = true;
  443. },
  444. // 按键被点击(点击退格键不会触发此事件)
  445. keyboardChange(val) {
  446. // 将每次按键的值拼接到value变量中,注意+=写法
  447. this.newPlateNumber += val;
  448. },
  449. // 退格键被点击
  450. backspace() {
  451. // 删除value的最后一个字符
  452. if (this.newPlateNumber.length) this.newPlateNumber = this.newPlateNumber.substr(0, this.newPlateNumber.length - 1);
  453. },
  454. // 键盘输入完成后确认
  455. keyboardConfirm() {
  456. this.colorShow = true;
  457. },
  458. // 确认颜色
  459. confirmColor(e) {
  460. this.vehicleColor = this.colorList[e].colorCode;
  461. },
  462. //添加车牌
  463. addvehicleNo(id) {
  464. this.orderid = id;
  465. this.ShowaddvehicleNo = true;
  466. },
  467. // 定位
  468. getLocation() {
  469. const that = this;
  470. if (navigator.geolocation) {
  471. // 判断是否有这个对象
  472. navigator.geolocation.getCurrentPosition(
  473. function (pos) {
  474. that.latLongItude = {
  475. latitude: pos.coords.latitude,
  476. longitude: pos.coords.longitude
  477. };
  478. that.latitude = pos.coords.latitude;
  479. that.longitude = pos.coords.longitude;
  480. that.getCityNameByLonLat(that.latLongItude);
  481. },
  482. function (err) {
  483. uni.getLocation({
  484. type: 'gcj02',
  485. success: function (res) {
  486. that.latLongItude = {
  487. latitude: res.latitude,
  488. longitude: res.longitude
  489. };
  490. that.latitude = res.latitude;
  491. that.longitude = res.longitude;
  492. that.getCityNameByLonLat(that.latLongItude);
  493. }
  494. });
  495. }
  496. );
  497. } else {
  498. alert('当前系统不支持GPS API');
  499. }
  500. },
  501. // 通过经纬度获取地区详细信息
  502. getCityNameByLonLat({ longitude, latitude } = {}) {
  503. const that = this;
  504. uni.showLoading({
  505. title: '加载中',
  506. mask: true
  507. });
  508. const str = `output=jsonp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL&location=${latitude},${longitude}`;
  509. jsonp('https://apis.map.qq.com/ws/geocoder/v1/?' + str, {}).then((res) => {
  510. uni.hideLoading();
  511. if (res.status == 0) {
  512. if (res.result.ad_info) {
  513. that.city = res.result.ad_info.district;
  514. }
  515. }
  516. });
  517. },
  518. // 轮播图点击
  519. swiperClick(item) {
  520. this.$u.route({
  521. url: 'pages/bannerDetails/bannerDetails',
  522. params: {
  523. id: this.bannerList[item].id
  524. }
  525. });
  526. },
  527. // 切换无感和手动
  528. orderNavclick() {
  529. uni.showLoading({
  530. title: '加载中'
  531. });
  532. console.log('this.recordList[1]', this.recordList[1]);
  533. console.log('orderNav', this.orderNav);
  534. if (!this.recordList[1]) {
  535. uni.hideLoading();
  536. return;
  537. }
  538. this.$u.api
  539. .feePay({
  540. vehicleId: this.recordList[1]
  541. })
  542. .then((res) => {
  543. console.log('res', res);
  544. if (res?.code == 200) {
  545. this.handleGetIndexData();
  546. }
  547. uni.hideLoading();
  548. });
  549. },
  550. /**
  551. * 跳转页面
  552. * path 跳转路径
  553. * flag 是否存储
  554. * */
  555. openPage(path, flag) {
  556. this.$u.route({
  557. url: path
  558. });
  559. if (flag) {
  560. uni.setStorage({
  561. key: 'messageBack',
  562. data: 'pages/index/index'
  563. });
  564. }
  565. },
  566. // 搜索
  567. handleSearch() {
  568. uni.reLaunch({
  569. url: `/pages/parkingLists/parkingLists?keyword=${this.keyword}`
  570. });
  571. },
  572. // 城市选择
  573. handleCitySelect() {
  574. this.cityOpen = true;
  575. },
  576. // 城市选择下拉变化
  577. cityChange(e) {
  578. if (e.area) {
  579. this.city = e.area.label;
  580. } else if (e.city) {
  581. this.city = e.city.label;
  582. } else {
  583. this.city = e.province.label;
  584. }
  585. },
  586. // 获取首页数据
  587. handleGetIndexData() {
  588. this.$u.api.getIndexData().then((res) => {
  589. if (res.code === 200) {
  590. // 轮播
  591. this.bannerList = (res?.data?.advs ?? []).map((item) => {
  592. return {
  593. image: item.bannerUrl,
  594. id: item.id,
  595. name: item.name,
  596. content: item.content
  597. };
  598. });
  599. // 是否有绑定车牌: 没有则通过弹框去绑定
  600. const vehicleList = res.data?.vehicleList ?? [];
  601. if (vehicleList.length === 0) {
  602. this.bindCarShow = true;
  603. }
  604. // 无感和手动
  605. const enableFeepay = [];
  606. const orderList = res.data?.orderList ?? [];
  607. orderList.forEach((item) => {
  608. if (item.enableFeepay) {
  609. enableFeepay.push(item.enableFeepay);
  610. } else {
  611. enableFeepay.push(0);
  612. }
  613. enableFeepay.push(item.vehicleId);
  614. if (item.contractStatus) {
  615. enableFeepay.push(item.contractStatus);
  616. } else {
  617. enableFeepay.push(0);
  618. }
  619. });
  620. this.recordList = enableFeepay;
  621. if (enableFeepay.length) this.orderNav = enableFeepay[0];
  622. if (enableFeepay.length === 3) this.contractStatus = enableFeepay[2];
  623. // 统计
  624. this.totalActualAmount = res.data?.payedInfo?.totalActualAmount;
  625. this.totalCount = res.data?.payedInfo?.totalCount;
  626. this.totalPayAmount = res.data?.payingInfo?.totalPayAmount;
  627. this.totalPayCount = res.data?.payingInfo?.totalCount;
  628. this.orderList = orderList;
  629. // 消息提示
  630. const newsList = [];
  631. const news = res.data?.news ?? [];
  632. news.forEach((item) => {
  633. newsList.push(item.content);
  634. });
  635. this.noticeList = newsList;
  636. }
  637. });
  638. },
  639. // 去支付,选择支付方式
  640. goPay(item) {
  641. const href = location.origin;
  642. this.jumpUrl = href + '/pages/center/order/orderDetails/orderDetails?orderId=' + item.id + '&type=open';
  643. this.curOrderList = [];
  644. this.curOrderList.push(item.id);
  645. this.$refs['choosePayment'].openPopup({ ...item }, 'single', 'road');
  646. },
  647. // 获取路段详情
  648. async onRoadInfo(item) {
  649. const { code, data } = await this.$u.api.roadInfoById({
  650. id: item.roadId
  651. });
  652. if (code === 200) {
  653. if (data) {
  654. this.popupOrderDetails = data;
  655. this.showOrderDetails = true;
  656. } else {
  657. this.$refs.uToast.show({
  658. title: '暂无停车点数据!',
  659. type: 'warning'
  660. });
  661. }
  662. }
  663. },
  664. // 关闭路段详情弹框
  665. closeOrderDetails() {
  666. this.showOrderDetails = false;
  667. },
  668. // 打电话
  669. phoneCall(phone) {
  670. uni.makePhoneCall({
  671. phoneNumber: phone
  672. });
  673. },
  674. /**
  675. * 点击优惠活动的广告图
  676. * */
  677. promotionBannerClick(cur) {
  678. this.promotionBannerList.forEach((item, index) => {
  679. if (cur === index) {
  680. this.$u.route({
  681. url: 'pages/favourableActivity/favourableActivity',
  682. params: {
  683. title: item.title,
  684. id: item.id
  685. }
  686. });
  687. }
  688. });
  689. },
  690. // 关闭支付弹框
  691. closePaymentMethod() {
  692. // this.payWayPop = false;
  693. }
  694. }
  695. };
  696. </script>
  697. <style lang="scss" scoped>
  698. @import './index.scss';
  699. </style>