index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  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 }}</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">
  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. const locationLocaturl = window.location.search
  368. this.code = getUrlParams(locationLocaturl, 'code')
  369. if (this.code && !this.$store.state.vuex_wxinfo.openId) {
  370. this.handleGetWXInfo(this.code)
  371. };
  372. },
  373. methods: {
  374. radioGroupChange(e){
  375. this.newPlateNumber = e
  376. },
  377. // 获取车辆列表
  378. handlegetMycars(){
  379. let that = this;
  380. this.$u.api.getMycars()
  381. .then(res=>{
  382. if (res.code === 200) {
  383. this.groupList = res.data.rows;
  384. this.radiogroupList = res.data.rows;
  385. this.$nextTick(() => {
  386. // dom元素更新后执行,因此这里能正确打印更改之后的值
  387. console.log(that.$refs.refValue.init()) // 改变了的值
  388. })
  389. } else {
  390. this.$refs.uToast.show({
  391. title: res.msg,
  392. type: 'error'
  393. })
  394. }
  395. })
  396. .catch(err=>{
  397. this.$refs.uToast.show({
  398. title: '操作失败!',
  399. type: 'error'
  400. })
  401. });
  402. },
  403. //更换车牌信息
  404. changevehicleNo(id){
  405. this.orderid = id;
  406. this.ShowchangevehicleNo = true;
  407. this.handlegetMycars();
  408. },
  409. // 添加车辆
  410. handleAddCar(){
  411. if(!this.$u.test.carNo(this.newPlateNumber)){
  412. this.$refs.uToast.show({
  413. title: '请正确填写车牌号',
  414. type: 'error',
  415. });
  416. return
  417. }
  418. let param = {
  419. orderId: this.orderid,
  420. vehicleNo: this.newPlateNumber,
  421. vehicleColor: this.vehicleColor,
  422. };
  423. let that = this;
  424. this.$u.api.bindVehicleNo(param)
  425. .then(res=>{
  426. if (res.code === 200) {
  427. this.$refs.uToast.show({
  428. title: res.msg,
  429. type: 'success',
  430. });
  431. that.handleGetIndexData();
  432. that.ShowchangevehicleNo = false;
  433. } else {
  434. this.$refs.uToast.show({
  435. title: res.msg,
  436. type: 'error',
  437. });
  438. }
  439. })
  440. .catch(err=>{
  441. this.$refs.uToast.show({
  442. title: '操作失败!',
  443. type: 'error',
  444. });
  445. });
  446. },
  447. //新增车牌
  448. addvehicleNo(){
  449. this.ShowaddvehicleNo = true;
  450. },
  451. // 点击输入框
  452. messageInputClick(){
  453. this.keyboardshow = true;
  454. },
  455. // 按键被点击(点击退格键不会触发此事件)
  456. keyboardChange(val) {
  457. // 将每次按键的值拼接到value变量中,注意+=写法
  458. this.newPlateNumber += val;
  459. },
  460. // 退格键被点击
  461. backspace() {
  462. // 删除value的最后一个字符
  463. if(this.newPlateNumber.length) this.newPlateNumber = this.newPlateNumber.substr(0, this.newPlateNumber.length - 1);
  464. },
  465. // 键盘输入完成后确认
  466. keyboardConfirm(){
  467. this.colorShow = true;
  468. },
  469. // 确认颜色
  470. confirmColor(e){
  471. this.vehicleColor = this.colorList[e].colorCode;
  472. },
  473. //添加车牌
  474. addvehicleNo(id){
  475. this.orderid = id;
  476. this.ShowaddvehicleNo = true;
  477. },
  478. // 定位
  479. getLocation() {
  480. const that = this
  481. if (navigator.geolocation) {
  482. // 判断是否有这个对象
  483. navigator.geolocation.getCurrentPosition(function(pos) {
  484. that.latLongItude = {
  485. latitude: pos.coords.latitude,
  486. longitude: pos.coords.longitude
  487. }
  488. that.latitude = pos.coords.latitude
  489. that.longitude = pos.coords.longitude
  490. that.getCityNameByLonLat(that.latLongItude)
  491. }, function(err) {
  492. // 错误处理
  493. switch (err.code) {
  494. case 1:
  495. alert('位置服务被拒绝。')
  496. break
  497. case 2:
  498. alert('暂时获取不到位置信息。')
  499. break
  500. case 3:
  501. alert('获取信息超时。')
  502. break
  503. default:
  504. alert('未知错误。')
  505. break
  506. }
  507. })
  508. } else {
  509. alert('当前系统不支持GPS API')
  510. };
  511. },
  512. // 通过经纬度获取地区详细信息
  513. getCityNameByLonLat({
  514. longitude,
  515. latitude
  516. } = {}) {
  517. const that = this
  518. uni.showLoading({
  519. title: '加载中',
  520. mask: true
  521. })
  522. const str = `output=jsonp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL&location=${latitude},${longitude}`
  523. jsonp('https://apis.map.qq.com/ws/geocoder/v1/?' + str, {}).then(res => {
  524. uni.hideLoading()
  525. if (res.status == 0) {
  526. if (res.result.ad_info) {
  527. that.city = res.result.ad_info.district
  528. }
  529. }
  530. })
  531. },
  532. // 轮播图点击
  533. swiperClick(item) {
  534. this.$u.route({
  535. url: 'pages/bannerDetails/bannerDetails',
  536. params: {
  537. id: this.bannerList[item].id
  538. }
  539. })
  540. },
  541. // 切换无感和手动
  542. orderNavclick() {
  543. uni.showLoading({
  544. title: '加载中'
  545. });
  546. console.log('this.recordList[1]', this.recordList[1]);
  547. console.log('orderNav', this.orderNav)
  548. if (!this.recordList[1]) {
  549. uni.hideLoading();
  550. return
  551. }
  552. this.$u.api.feePay({
  553. vehicleId: this.recordList[1]
  554. })
  555. .then(res => {
  556. console.log('res', res);
  557. if (res?.code == 200) {
  558. this.handleGetIndexData()
  559. } else {
  560. // this.$refs.uToast.show({
  561. // title: res?.msg,
  562. // type: 'error'
  563. // })
  564. }
  565. uni.hideLoading()
  566. }).catch(err => {
  567. console.log('orderNavclick err', err)
  568. })
  569. },
  570. /**
  571. * 跳转页面
  572. * path 跳转路径
  573. * flag 是否存储
  574. * */
  575. openPage(path, flag) {
  576. this.$u.route({
  577. url: path
  578. })
  579. if (flag) {
  580. uni.setStorage({
  581. key: 'messageBack',
  582. data: 'pages/index/index'
  583. })
  584. }
  585. },
  586. // 搜索
  587. handleSearch() {
  588. uni.reLaunch({
  589. url: `/pages/parkingLists/parkingLists?keyword=${this.keyword}`
  590. })
  591. },
  592. // 城市选择
  593. handleCitySelect() {
  594. this.cityOpen = true
  595. },
  596. // 城市选择下拉变化
  597. cityChange(e) {
  598. if (e.area) {
  599. this.city = e.area.label
  600. } else if (e.city) {
  601. this.city = e.city.label
  602. } else {
  603. this.city = e.province.label
  604. }
  605. },
  606. // 获取首页数据
  607. handleGetIndexData() {
  608. uni.showLoading({
  609. title: '加载中'
  610. })
  611. this.$u.api.getIndexData()
  612. .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. uni.hideLoading()
  666. } else {
  667. this.$refs.uToast.show({
  668. title: res.msg,
  669. type: 'error'
  670. })
  671. uni.hideLoading()
  672. }
  673. }).catch(err => {
  674. console.log('err', err)
  675. this.$refs.uToast.show({
  676. title: '系统异常',
  677. type: 'error'
  678. })
  679. uni.hideLoading()
  680. })
  681. },
  682. // 去支付,选择支付方式
  683. goPay(orderId) {
  684. const href = location.href.split('#')
  685. this.jumpUrl = href[0] + '#/pages/center/order/orderDetails/orderDetails?orderId=' + orderId + '&type=open'
  686. this.payWayPop = true
  687. this.curOrderList = []
  688. this.curOrderList.push(orderId)
  689. },
  690. // 获取路段详情
  691. onRoadInfo(item) {
  692. this.$u.api.roadInfoById({
  693. id: item.roadId
  694. })
  695. .then(res => {
  696. this.popupOrderDetails = res.data
  697. this.showOrderDetails = true
  698. }).catch(err => {
  699. this.$refs.uToast.show({
  700. title: '系统异常',
  701. type: 'error'
  702. })
  703. })
  704. },
  705. // 关闭路段详情弹框
  706. closeOrderDetails() {
  707. this.showOrderDetails = false
  708. },
  709. // 打电话
  710. phoneCall(phone) {
  711. uni.makePhoneCall({
  712. phoneNumber: phone
  713. })
  714. },
  715. /**
  716. * 点击优惠活动的广告图
  717. * */
  718. promotionBannerClick(cur) {
  719. this.promotionBannerList.forEach((item, index) => {
  720. if (cur === index) {
  721. this.$u.route({
  722. url: 'pages/favourableActivity/favourableActivity',
  723. params: {
  724. title: item.title,
  725. id: item.id
  726. }
  727. })
  728. }
  729. })
  730. },
  731. // 关闭支付弹框
  732. closePaymentMethod() {
  733. this.payWayPop = false
  734. }
  735. }
  736. }
  737. </script>
  738. <style lang="scss" scoped>
  739. @import "./index.scss";
  740. </style>