index.vue 23 KB

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