index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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"></u-swiper>
  13. <u-city-select v-model="cityOpen" @city-change="cityChange" :areaCode='["52", "5201"]' ></u-city-select>
  14. <u-card :show-head="false" :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
  15. <view class="content-nav" slot="body">
  16. <view class="content-nav-item" @click="openPage('pages/payLists/payLists')">
  17. <view class="content-nav-item-icon-wrap">
  18. <u-image src="../../static/img/index-content-nav-01.png" width="95rpx" height="95rpx" mode="heightFix"></u-image>
  19. </view>
  20. <view class="content-nav-item-icon-text">停车缴费</view>
  21. </view>
  22. <view class="content-nav-item" @click="$refs.uToast.show({title: '建设中'})">
  23. <view class="content-nav-item-icon-wrap">
  24. <u-image src="../../static/img/index-content-nav-02.png" width="95rpx" height="95rpx" mode="heightFix"></u-image>
  25. </view>
  26. <view class="content-nav-item-icon-text">优惠活动</view>
  27. </view>
  28. <view class="content-nav-item" @click="openPage('pages/myCars/myCars')">
  29. <view class="content-nav-item-icon-wrap">
  30. <u-image src="../../static/img/index-content-nav-03.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/searchparking/searchparking')">
  35. <view class="content-nav-item-icon-wrap">
  36. <u-image src="../../static/img/index-content-nav-04.png" width="95rpx" height="95rpx" mode="heightFix"></u-image>
  37. </view>
  38. <view class="content-nav-item-icon-text">我的停车</view>
  39. </view>
  40. </view>
  41. </u-card>
  42. <u-empty text="暂无停车信息" mode="list" class="u-m-t-80" v-if="!orderList||orderList.length<1"></u-empty>
  43. <template v-for="(item, index) in orderList">
  44. <u-card :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
  45. <view class="pending-order-head" slot="head">
  46. <view class="pending-order-head-left"><b>P</b>{{item.roadName}}</view>
  47. <view class="pending-order-head-right" @click="onRoadInfo(item)"><u-icon class="arrow-down" name="arrow-down" size="32" color="#aaa"></u-icon></view>
  48. </view>
  49. <view class="pending-order-body" slot="body">
  50. <!-- <view class="pending-order-body-nav">
  51. <view class="nav-item nav-manual" @click="orderNav=0" :class="{active:orderNav==0}">手动缴费</view>
  52. <view class="nav-item nav-auto" @click="orderNav=1" :class="{active:orderNav==1}">无感支付</view>
  53. </view> -->
  54. <view class="pending-order-body-wrap" v-show="orderNav==0">
  55. <view class="pending-order-body-left">
  56. <view class="car-number">{{item.vehicleNo}}</view>
  57. <view class="duration">
  58. <span class="pending-order-body-left-label">入场时间:</span>
  59. <span>{{item.inTime}}</span>
  60. </view>
  61. <view class="duration">
  62. <span class="pending-order-body-left-label">出场时间:</span>
  63. <span>{{item.outTime}}</span>
  64. </view>
  65. <view class="duration">
  66. <span class="pending-order-body-left-label">停留时间:</span>
  67. <span>{{item.duration}}</span>
  68. </view>
  69. <view class="cost">
  70. <span class="pending-order-body-left-label">停车费用:</span>
  71. <span>
  72. <span class="number">¥{{item.payAmount}}</span>
  73. </span>
  74. </view>
  75. </view>
  76. <view class="pending-order-body-right">
  77. <view class="order">停车泊位:{{item.spaceName}}</view>
  78. <view class="go-pay-wrap">
  79. <view class="go-pay" @click="goPay(item.id)">去支付</view>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="pending-order-body-wrap" v-show="orderNav==1">
  84. </view>
  85. </view>
  86. </u-card>
  87. </template>
  88. <view class="promotion">
  89. <view class="promotion-header u-flex u-row-between">
  90. <view class="promotion-header-til">优惠活动</view>
  91. <view class="promotion-header-con">去领取</view>
  92. </view>
  93. <view class="promotion-body">
  94. <view class="promotion-body-til">停车5折|享受出行时光,专享停车优惠</view>
  95. <view class="promotion-body-con">世界那么大,我想去看看。这话你已经说了一万遍但是却一直没有兑现原因竟然是“停车”可太难了</view>
  96. </view>
  97. </view>
  98. <u-modal
  99. v-model="bindCarShow"
  100. title="绑定车牌号"
  101. :show-cancel-button="true"
  102. confirm-text="去绑定"
  103. content="首次使用请先绑定您的车牌"
  104. @confirm="$u.route({url:'pages/myCars/myCars'})"></u-modal>
  105. <!-- 订单细节 -->
  106. <u-modal v-model="showOrderDetails" title="停车场信息" confirm-text="知道了" :title-style="{color: '#008CFF'}">
  107. <view class="slot-content">
  108. <rich-text class="orderDetails" :nodes="content"></rich-text>
  109. </view>
  110. </u-modal>
  111. <u-toast ref="uToast" />
  112. </view>
  113. </template>
  114. <script>
  115. import getUrlParams from "../../utils/getUrlParams.js";
  116. export default {
  117. // components: {
  118. // citySelect
  119. // },
  120. data() {
  121. return {
  122. city: '贵阳市',
  123. keyword:'',
  124. bannerList:[
  125. {image: '/static/img/index-banner01.png',title: ''}
  126. ],
  127. orderList:[],
  128. cityOpen:false,
  129. pendingOrder:[],
  130. code:null,//微信code
  131. orderNav:0,//手动,无感
  132. bindCarShow:false,//绑定车询问弹窗
  133. showOrderDetails:false,//是否线上订单细节
  134. content:`
  135. <dl>
  136. <dt>车场名称:</dt>
  137. <dd>贵阳云岩区甜蜜小镇D18组团停车场</dd>
  138. </dl>
  139. <dl>
  140. <dt>免费时长:</dt>
  141. <dd>15分钟</dd>
  142. </dl>
  143. `,
  144. }
  145. },
  146. onShow() {
  147. this.handleGetIndexData();
  148. // this.getLocation();
  149. let locationLocaturl = window.location.search;
  150. this.code = getUrlParams(locationLocaturl,"code");
  151. if(this.code&&!this.$store.state.vuex_wxinfo.openId){this.handleGetWXInfo(this.code)};
  152. },
  153. methods: {
  154. // getLocation(){
  155. // console.log("请求定位")
  156. // uni.getLocation({
  157. // type:"gcj02",
  158. // success : function (res) {
  159. // console.log("定位返回信息:", res)
  160. // alert(res.longitude + "," + res.latitude )
  161. // },
  162. // fail: function(res){
  163. // console.log("请求错误:", res)
  164. // }
  165. // })
  166. // },
  167. openPage(path) {
  168. console.log('path',path);
  169. this.$u.route({
  170. url: path
  171. })
  172. },
  173. handleSearch(){
  174. console.log('this.keyword',this.keyword);
  175. this.$u.route({
  176. url:'pages/parkingLists/parkingLists',
  177. type:'tab',
  178. params: {
  179. keyword: this.keyword
  180. }
  181. })
  182. },
  183. handleCitySelect(){
  184. this.cityOpen = true;
  185. },
  186. cityChange(e){
  187. console.log('cityChange',e);
  188. this.city = e.city.label;
  189. },
  190. handleGetIndexData(){
  191. this.$u.api.getIndexData()
  192. .then(res=>{
  193. if(res.data.vehicleList.length<1){
  194. this.bindCarShow = true;
  195. }
  196. this.orderList = res.data.orderList;
  197. }).catch(err=>{
  198. // alert(err.msg);
  199. console.log('getIndexData err',err)
  200. });
  201. },
  202. goPay(orderId){
  203. let orderList=[];
  204. orderList.push(orderId);
  205. this.$u.api.payGzbank({orderList: orderList}).then(res=>{
  206. let payUrl = res.data.url;
  207. this.currentPayUrl=encodeURIComponent(res.data.url);
  208. // return;
  209. this.$u.route({
  210. url: 'pages/payLists/pay',
  211. params: {
  212. currentPayUrl:this.currentPayUrl
  213. }
  214. });
  215. }).catch(err=>{
  216. this.$refs.uToast.show({
  217. title: err.msg,
  218. type: 'error',
  219. });
  220. });
  221. // this.$u.route({
  222. // url: 'pages/payPage/payPage',
  223. // params: {
  224. // orderId: orderId
  225. // }
  226. // });
  227. },
  228. //
  229. onRoadInfo(item){
  230. this.$u.api.roadInfoById({id:item.roadId})
  231. .then(res=>{
  232. this.content = `
  233. <dl><dt>路段名称:</dt> <dd>` + res.data.roadName + `</dd></dl>`
  234. + `<dl><dt>路段编码:</dt><dd>` + res.data.roadNo + `</dd></dl>`
  235. + `<dl><dt>联系人:</dt><dd>` + res.data.manager + `</dd></dl>`
  236. + `<dl><dt>联系电话:</dt><dd>` + res.data.telephone + `</dd></dl>`;
  237. this.showOrderDetails = true;
  238. }).catch(err=>{
  239. // alert(err.msg);
  240. console.log('getIndexData err',err)
  241. });
  242. }
  243. }
  244. }
  245. </script>
  246. <style lang="scss" scoped>
  247. @import "./index.scss";
  248. </style>