index.vue 26 KB

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