index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <view>
  3. <!-- <u-navbar :is-back='false' :border-bottom="false" :background="{ background: '#008CFF' }" title=""></u-navbar> -->
  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. <u-swiper :list="bannerList" border-radius="0" mode="none"></u-swiper>
  13. <u-city-select v-model="cityOpen" @city-change="cityChange" :areaCode='["52", "5201"]' ></u-city-select>
  14. <view class="notice-bar-wrap u-flex" v-if="noticeList.length>=1" @click="openPage('pages/message/message')">
  15. <u-icon custom-prefix="custom-icon" size="50" name="xiaoxi" color="#008CFF"></u-icon>
  16. <u-notice-bar
  17. class="u-flex-1"
  18. mode="vertical"
  19. :autoplay="true"
  20. :list="noticeList"
  21. :volume-icon="false"
  22. bg-color="#fff"
  23. color="#727272"
  24. :more-icon="true"></u-notice-bar>
  25. </view>
  26. <u-card :show-head="false" :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
  27. <view class="content-nav" slot="body">
  28. <view class="content-nav-item" @click="openPage('pages/payLists/payLists')">
  29. <view class="content-nav-item-icon-wrap">
  30. <u-image src="../../static/img/index-content-nav-01.png" width="95rpx" height="95rpx" mode="heightFix"></u-image>
  31. </view>
  32. <view class="content-nav-item-icon-text">停车缴费</view>
  33. </view>
  34. <view class="content-nav-item" @click="openPage('pages/favourableActivity/favourableActivity')">
  35. <view class="content-nav-item-icon-wrap">
  36. <u-image src="../../static/img/index-content-nav-02.png" width="95rpx" height="95rpx" mode="heightFix"></u-image>
  37. </view>
  38. <view class="content-nav-item-icon-text">优惠活动</view>
  39. </view>
  40. <view class="content-nav-item" @click="openPage('pages/myCars/myCars')">
  41. <view class="content-nav-item-icon-wrap">
  42. <u-image src="../../static/img/index-content-nav-03.png" width="95rpx" height="95rpx" mode="heightFix"></u-image>
  43. </view>
  44. <view class="content-nav-item-icon-text">车辆管理</view>
  45. </view>
  46. <view class="content-nav-item" @click="openPage('pages/searchparking/searchparking')">
  47. <view class="content-nav-item-icon-wrap">
  48. <u-image src="../../static/img/index-content-nav-04.png" width="95rpx" height="95rpx" mode="heightFix"></u-image>
  49. </view>
  50. <view class="content-nav-item-icon-text">我的停车</view>
  51. </view>
  52. </view>
  53. </u-card>
  54. <view class="empty-data-box" v-if="!orderList||orderList.length<1">
  55. <u-empty text="暂无停车信息" mode="list"></u-empty>
  56. </view>
  57. <template v-for="(item, index) in orderList">
  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"><b>P</b>{{item.roadName}}</view>
  61. <view class="pending-order-head-right" @click="onRoadInfo(item)"><u-icon class="arrow-down" name="arrow-down" size="32" color="#aaa"></u-icon></view>
  62. </view>
  63. <view class="pending-order-body" slot="body">
  64. <view class="pending-order-body-nav">
  65. <view class="nav-item nav-manual" @click="orderNavclick()" :class="{active:orderNav==0}">手动缴费</view>
  66. <view class="nav-item nav-auto" @click="orderNavclick()" :class="{active:orderNav==1}">无感支付</view>
  67. </view>
  68. <view class="pending-order-body-wrap" v-show="orderNav==0">
  69. <view class="pending-order-body-left">
  70. <view class="car-number">{{item.vehicleNo}}</view>
  71. <view class="item-cell">
  72. <span class="pending-order-body-left-label">入场时间:</span>
  73. <span>{{item.inTime}}</span>
  74. </view>
  75. <view class="item-cell">
  76. <span class="pending-order-body-left-label">出场时间:</span>
  77. <span>{{item.outTime}}</span>
  78. </view>
  79. <view class="item-cell">
  80. <span class="pending-order-body-left-label">预计金额:</span>
  81. <span>{{item.payAmount}}</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.duration||'停放中'}}</span>
  90. </view>
  91. <view class="item-cell cost">
  92. <span class="pending-order-body-left-label">停车费用:</span>
  93. <span>
  94. <span class="number" v-if="item.payAmount">¥{{item.payAmount}}</span>
  95. <span class="number" v-else>停放中</span>
  96. </span>
  97. </view> -->
  98. </view>
  99. <view class="pending-order-body-right">
  100. <view class="order">停车泊位:{{item.spaceName}}</view>
  101. </view>
  102. <view class="go-pay-wrap">
  103. <view class="go-pay" @click="goPay(item.id)">出场缴费</view>
  104. </view>
  105. </view>
  106. <view class="pending-order-body-wrap" v-show="orderNav==1">
  107. <view v-if="contractStatus==0" class="nosign">
  108. <view class="nosign1">您的车牌未签约贵州银行无感支付</view>
  109. <view class="nosign2">请下载贵州银行手机银行app进行签约</view>
  110. </view>
  111. <view v-if="contractStatus==1" class="sign">
  112. <view class="sign1">您已签约贵州银行无感支付</view>
  113. <view class="sign2">停车出场时将默认使用无感支付进行支付</view>
  114. </view>
  115. </view>
  116. </view>
  117. </u-card>
  118. </template>
  119. <!-- <view class="promotion" @click="$refs.uToast.show({title: '建设中'})">
  120. <view class="promotion-header u-flex u-row-between">
  121. <view class="promotion-header-til">优惠活动</view>
  122. <view class="promotion-header-con">去领取</view>
  123. </view>
  124. <view class="promotion-body">
  125. <view class="promotion-body-til">八折停车</view>
  126. <view class="promotion-body-con">从客户启用贵州银行行卡支付的第四个月开始,使用我行卡支付永久享受八折优惠(单日不限次数)...</view>
  127. </view>
  128. </view> -->
  129. <view class="promotion-box">
  130. <view class="promotion-title">
  131. <text>优惠活动</text>
  132. </view>
  133. <view class="promotion-banner">
  134. <!-- <swiper
  135. class="promotion-banner-swiper"
  136. :indicator-dots="true"
  137. indicator-color="rgba(170, 216, 255, 1)"
  138. indicator-active-color="#008CFF"
  139. :autoplay="true"
  140. :duration="500"
  141. mode="dot"
  142. :interval="3000"
  143. :circular="true">
  144. <swiper-item v-for="(item, index) in promotionBannerList" :key="'bannner' + index">
  145. <view class="promotion-banner-item">
  146. <image :src="item.image" mode=""></image>
  147. </view>
  148. </swiper-item>
  149. </swiper> -->
  150. <u-swiper
  151. :list="promotionBannerList"
  152. @click="promotionBannerClick"
  153. height="221"></u-swiper>
  154. </view>
  155. </view>
  156. <u-modal
  157. v-model="bindCarShow"
  158. title="绑定车牌号"
  159. :show-cancel-button="true"
  160. confirm-text="去绑定"
  161. content="首次使用请先绑定您的车牌"
  162. @confirm="$u.route({url:'pages/myCars/myCars'})"></u-modal>
  163. <u-popup class="popup-order-details" v-model="showOrderDetails" mode="center" width="90%" border-radius="20">
  164. <view class="popup-order-details-til">停车场信息</view>
  165. <view class="popup-order-details-con">
  166. <dl><dt>路段名称:</dt> <dd>{{popupOrderDetails.roadName}}</dd></dl>
  167. <dl><dt>路段编码:</dt><dd>{{popupOrderDetails.roadNo}}</dd></dl>
  168. <dl><dt>联系人:</dt><dd>{{popupOrderDetails.manager}} </dd></dl>
  169. <dl><dt>联系电话:</dt><dd @click="phoneCall(popupOrderDetails.telephone)">{{popupOrderDetails.telephone}}</dd></dl>
  170. </view>
  171. <view class="popup-order-details-footer" @click="closeOrderDetails">
  172. 知道了
  173. </view>
  174. </u-popup>
  175. <!-- 支付方式 -->
  176. <PaymentMethod
  177. :payWayPop="payWayPop"
  178. :curOrderList="curOrderList"
  179. @closePaymentMethod="closePaymentMethod"></PaymentMethod>
  180. <u-toast ref="uToast" />
  181. </view>
  182. </template>
  183. <script>
  184. import getUrlParams from "../../utils/getUrlParams.js";
  185. import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
  186. export default {
  187. components: {
  188. PaymentMethod
  189. },
  190. data() {
  191. return {
  192. city: '普定县',
  193. keyword:'',
  194. bannerList:[
  195. {image: '/static/img/index-banner01.png',title: ''}
  196. ],
  197. orderList:[],
  198. cityOpen:false,
  199. pendingOrder:[],
  200. code:null,//微信code
  201. orderNav:'',//手动,无感
  202. bindCarShow:false,//绑定车询问弹窗
  203. showOrderDetails:false,//是否线上订单细节
  204. popupOrderDetails:[],
  205. noticeList:[],
  206. // 优惠活动广告图
  207. promotionBannerList: [
  208. {
  209. id: 1,
  210. image: '/static/img/promotion-banner-1.png',
  211. title: '1分钱停车'
  212. },
  213. {
  214. id: 2,
  215. image: '/static/img/promotion-banner-2.png',
  216. title: '八折停车'
  217. }
  218. ],
  219. contractStatus:'',
  220. vehicleId:'',
  221. recordList:[],
  222. // 支付方式
  223. payWayPop: false,
  224. // 订单号
  225. curOrderList: [],
  226. latLongItude:{}
  227. }
  228. },
  229. onShow() {
  230. this.handleGetIndexData();
  231. // this.getLocation();
  232. // this.getCityNameByLonLat({latitude: 26.301447, longitude: 105.743197})
  233. let locationLocaturl = window.location.search;
  234. this.code = getUrlParams(locationLocaturl,"code");
  235. if(this.code&&!this.$store.state.vuex_wxinfo.openId){this.handleGetWXInfo(this.code)};
  236. },
  237. methods: {
  238. // 定位
  239. getLocation(){
  240. const that = this
  241. uni.getLocation({
  242. type: 'wgs84',
  243. geocode: true,
  244. success: (res) => {
  245. that.latLongItude = {latitude: res.latitude,longitude:res.longitude};
  246. that.latitude = res.latitude;
  247. that.longitude = res.longitude;
  248. // that.getCityNameByLonLat(that.latLongItude)
  249. },
  250. fail: () => {
  251. console.log("获取经纬度失败");
  252. }
  253. })
  254. },
  255. // 通过经纬度获取地区详细信息
  256. getCityNameByLonLat({longitude,latitude} = {}){
  257. let that = this;
  258. uni.showLoading({
  259. title: '加载中',
  260. mask:true
  261. });
  262. let str = `output=jsonp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL&location=${latitude},${longitude}`
  263. this.$jsonp('https://apis.map.qq.com/ws/geocoder/v1/?'+ str, {}).then(res=>{
  264. uni.hideLoading();
  265. if(res.status == 0){
  266. console.log(res.result.ad_info)
  267. if (res.result.ad_info) {
  268. that.city = res.result.ad_info.district
  269. }
  270. }
  271. })
  272. },
  273. orderNavclick(){
  274. this.feePay()
  275. },
  276. feePay(){
  277. this.$u.api.feePay({vehicleId: this.recordList[1]})
  278. .then( res=>{
  279. if(res.code == 200){
  280. this.handleGetIndexData()
  281. }
  282. })
  283. },
  284. openPage(path) {
  285. console.log('path',path);
  286. this.$u.route({
  287. url: path
  288. })
  289. },
  290. // 搜索
  291. handleSearch(){
  292. console.log('this.keyword',this.keyword);
  293. uni.reLaunch({
  294. url: `/pages/parkingLists/parkingLists?keyword=${this.keyword}`
  295. })
  296. },
  297. handleCitySelect(){
  298. this.cityOpen = true;
  299. },
  300. cityChange(e){
  301. console.log('cityChange',e);
  302. this.city = e.city.label;
  303. },
  304. handleGetIndexData(){
  305. this.$u.api.getIndexData()
  306. .then(res=>{
  307. if(res.data.vehicleList.length<1){
  308. this.bindCarShow = true;
  309. }
  310. const enableFeepay=[]
  311. res.data.orderList.forEach(item => {
  312. enableFeepay.push(item.enableFeepay);
  313. enableFeepay.push(item.vehicleId);
  314. enableFeepay.push(item.contractStatus);
  315. })
  316. this.recordList=enableFeepay;
  317. // this.vehicleId=enableFeepay.vehicleId;
  318. this.orderNav = enableFeepay[0];
  319. this.contractStatus=enableFeepay[2];
  320. console.log('recordList',this.recordList)
  321. this.orderList = res.data.orderList;
  322. const list = []
  323. res.data.news.forEach(item => {
  324. list.push(item.content)
  325. })
  326. this.noticeList = list;
  327. }).catch(err=>{
  328. // alert(err.msg);
  329. console.log('getIndexData err',err)
  330. });
  331. },
  332. // 去支付,选择支付方式
  333. goPay(orderId){
  334. this.payWayPop = true
  335. this.curOrderList = []
  336. this.curOrderList.push(orderId)
  337. },
  338. onRoadInfo(item){
  339. this.$u.api.roadInfoById({id:item.roadId})
  340. .then(res=>{
  341. this.popupOrderDetails=res.data;
  342. this.showOrderDetails = true;
  343. }).catch(err=>{
  344. // alert(err.msg);
  345. console.log('getIndexData err',err)
  346. });
  347. },
  348. closeOrderDetails(){
  349. this.showOrderDetails = false;
  350. },
  351. phoneCall(phone){
  352. uni.makePhoneCall({
  353. phoneNumber: phone
  354. });
  355. },
  356. /**
  357. * 点击优惠活动的广告图
  358. * */
  359. promotionBannerClick(cur) {
  360. this.promotionBannerList.forEach((item, index) => {
  361. if (cur === index) {
  362. this.$u.route({
  363. url:'pages/favourableActivity/favourableActivity',
  364. params: {
  365. title: item.title,
  366. id: item.id
  367. }
  368. })
  369. }
  370. })
  371. },
  372. // gyBankPay() {
  373. // this.$u.api.payGzbank({orderList: this.curOrderList}).then(res=>{
  374. // let payUrl = res.data.url;
  375. // this.currentPayUrl=encodeURIComponent(res.data.url);
  376. // this.$u.route({
  377. // url: 'pages/payLists/pay',
  378. // params: {
  379. // currentPayUrl: this.currentPayUrl
  380. // }
  381. // });
  382. // }).catch(err=>{
  383. // this.$refs.uToast.show({
  384. // title: err.msg,
  385. // type: 'error',
  386. // });
  387. // });
  388. // },
  389. // // 微信支付
  390. // wechatPay() {
  391. // const openId = this.$store.state.vuex_wxinfo.openId
  392. // if (openId) {
  393. // this.getWXPay(this.curOrderList)
  394. // } else {
  395. // this.getCode()
  396. // }
  397. // },
  398. // async getWXPay(list){
  399. // let params = {
  400. // orderList: list,
  401. // openid: this.$store.state.vuex_wxinfo.openId
  402. // };
  403. // await this.$wxApi.config();
  404. // this.$pay.wechatPay(params).then(res =>{
  405. // if(res.code == 0){
  406. // // 成功
  407. // this.$u.route({
  408. // url:'/',
  409. // });
  410. // }else if(res.code == 1){
  411. // // 取消
  412. // // uni.redirectTo({
  413. // // url: '/pages/userCenter/myOrder/myOrder'
  414. // // })
  415. // }else if(res.code == 2){
  416. // this.$refs.uToast.show({
  417. // title: '支付失败,请检查!',
  418. // type: 'error',
  419. // // url: '/pages/user/index'
  420. // });
  421. // }
  422. // });
  423. // },
  424. // getCode () {
  425. // var local = window.location.href // 获取页面url
  426. // let locationLocaturl = window.location.search;
  427. // this.code = getUrlParams(locationLocaturl,"code"); // 截取code
  428. // if (this.code == null || this.code === '') { // 如果没有code,则去请求
  429. // window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.config.wxAppid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&#wechat_redirect`
  430. // } else {
  431. // this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
  432. // }
  433. // },
  434. // handleGetWXInfo (code) { // 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
  435. // let _this = this
  436. // this.$u.api.getWXInfo(code).then((res) => {
  437. // if (res.code === 200 ) {
  438. // this.$u.vuex('vuex_wxinfo', res.data);
  439. // // 继续支付
  440. // this.getWXPay(this.currentItem)
  441. // }
  442. // }).catch((err) => {
  443. // this.$refs.uToast.show({
  444. // title: err.msg,
  445. // type: 'error',
  446. // });
  447. // })
  448. // },
  449. // 关闭弹框
  450. closePaymentMethod() {
  451. this.payWayPop = false
  452. }
  453. }
  454. }
  455. </script>
  456. <style lang="scss" scoped>
  457. @import "./index.scss";
  458. </style>