index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. {{city}}<u-icon name="arrow-down" color="#fff" size="32"></u-icon>
  7. </view>
  8. <u-search placeholder="搜索发票、停车场" :show-action="false" @search="handleSearch" v-model="keyword"></u-search>
  9. <u-icon class="scan" name="scan" color="#fff" size="48"></u-icon>
  10. </view>
  11. <u-swiper :list="bannerList" border-radius="0"></u-swiper>
  12. <u-city-select v-model="cityOpen" @city-change="cityChange" :areaCode='["52", "5201"]' ></u-city-select>
  13. <u-card :show-head="false" :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
  14. <view class="content-nav" slot="body">
  15. <view class="content-nav-item">
  16. <view class="content-nav-item-icon-wrap">
  17. <u-image src="../../static/img/index-content-nav-01.png" width="77rpx" height="75rpx" mode="heightFix"></u-image>
  18. </view>
  19. <view class="content-nav-item-icon-text">停车缴费</view>
  20. </view>
  21. <view class="content-nav-item">
  22. <view class="content-nav-item-icon-wrap">
  23. <u-image src="../../static/img/index-content-nav-02.png" width="77rpx" height="75rpx" mode="heightFix"></u-image>
  24. </view>
  25. <view class="content-nav-item-icon-text">优惠活动</view>
  26. </view>
  27. <view class="content-nav-item">
  28. <view class="content-nav-item-icon-wrap">
  29. <u-image src="../../static/img/index-content-nav-03.png" width="77rpx" height="75rpx" mode="heightFix"></u-image>
  30. </view>
  31. <view class="content-nav-item-icon-text">车辆管理</view>
  32. </view>
  33. <view class="content-nav-item">
  34. <view class="content-nav-item-icon-wrap">
  35. <u-image src="../../static/img/index-content-nav-04.png" width="77rpx" height="75rpx" mode="heightFix"></u-image>
  36. </view>
  37. <view class="content-nav-item-icon-text">我的停车</view>
  38. </view>
  39. </view>
  40. </u-card>
  41. <template v-for="(item, index) in orderList">
  42. <u-card :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
  43. <view class="pending-order-head" slot="head">
  44. <view class="pending-order-head-left"><b>P</b>{{item.roadName}}</view>
  45. <view class="pending-order-head-right" @click="onRoadInfo(item)"><u-icon class="arrow-down" name="arrow-down" size="32"></u-icon></view>
  46. </view>
  47. <view class="pending-order-body" slot="body">
  48. <!-- <view class="pending-order-body-nav">
  49. <view class="nav-item nav-manual" @click="orderNav=0" :class="{active:orderNav==0}">手动缴费</view>
  50. <view class="nav-item nav-auto" @click="orderNav=1" :class="{active:orderNav==1}">无感支付</view>
  51. </view> -->
  52. <view class="pending-order-body-wrap" v-show="orderNav==0">
  53. <view class="pending-order-body-left">
  54. <view class="car-number">{{item.vehicleNo}}</view>
  55. <view class="duration">
  56. <span class="pending-order-body-left-label">停车时长:</span>
  57. <span>{{item.duration}}</span>
  58. </view>
  59. </view>
  60. <view class="pending-order-body-right">
  61. <view class="order">订单号:{{item.id}}</view>
  62. <view class="cost">
  63. <span class="pending-order-body-left-label">停车费用:</span>
  64. <span>
  65. <span class="number">¥{{item.payAmount}}</span>
  66. </span>
  67. </view>
  68. </view>
  69. <view class="go-pay-wrap">
  70. <view class="go-pay" @click="goPay(item.id)">去支付</view>
  71. </view>
  72. </view>
  73. <view class="pending-order-body-wrap" v-show="orderNav==1">
  74. </view>
  75. </view>
  76. </u-card>
  77. </template>
  78. <u-modal
  79. v-model="bindCarShow"
  80. title="绑定车牌号"
  81. :show-cancel-button="true"
  82. confirm-text="去绑定"
  83. content="首次使用请先绑定您的车牌"
  84. @confirm="$u.route({url:'pages/myCars/myCars'})"></u-modal>
  85. <!-- 订单细节 -->
  86. <u-modal v-model="showOrderDetails" title="停车场信息" confirm-text="知道了" :title-style="{color: '#008CFF'}">
  87. <view class="slot-content">
  88. <rich-text class="orderDetails" :nodes="content"></rich-text>
  89. </view>
  90. </u-modal>
  91. <u-toast ref="uToast" />
  92. </view>
  93. </template>
  94. <script>
  95. import getUrlParams from "../../utils/getUrlParams.js";
  96. export default {
  97. // components: {
  98. // citySelect
  99. // },
  100. data() {
  101. return {
  102. city: '贵阳市',
  103. keyword:'',
  104. bannerList:[
  105. {image: '/static/img/index-banner01.png',title: ''}
  106. ],
  107. orderList:[],
  108. cityOpen:false,
  109. pendingOrder:[],
  110. code:null,//微信code
  111. orderNav:0,//手动,无感
  112. bindCarShow:false,//绑定车询问弹窗
  113. showOrderDetails:false,//是否线上订单细节
  114. content:`
  115. <dl>
  116. <dt>车场名称:</dt>
  117. <dd>贵阳云岩区甜蜜小镇D18组团停车场</dd>
  118. </dl>
  119. <dl>
  120. <dt>免费时长:</dt>
  121. <dd>15分钟</dd>
  122. </dl>
  123. `,
  124. }
  125. },
  126. onLoad() {
  127. this.handleGetIndexData();
  128. // this.getLocation();
  129. let locationLocaturl = window.location.search;
  130. this.code = getUrlParams(locationLocaturl,"code");
  131. if(this.code&&!this.$store.state.vuex_wxinfo.openId){this.handleGetWXInfo(this.code)};
  132. },
  133. methods: {
  134. // getLocation(){
  135. // console.log("请求定位")
  136. // uni.getLocation({
  137. // type:"gcj02",
  138. // success : function (res) {
  139. // console.log("定位返回信息:", res)
  140. // alert(res.longitude + "," + res.latitude )
  141. // },
  142. // fail: function(res){
  143. // console.log("请求错误:", res)
  144. // }
  145. // })
  146. // },
  147. handleSearch(){
  148. console.log('this.keyword',this.keyword);
  149. this.$u.route({
  150. url:'pages/parkingLists/parkingLists',
  151. params: {
  152. keyword: this.keyword
  153. }
  154. })
  155. },
  156. handleCitySelect(){
  157. this.cityOpen = true;
  158. },
  159. cityChange(e){
  160. console.log('cityChange',e);
  161. this.city = e.city.label;
  162. },
  163. handleGetIndexData(){
  164. this.$u.api.getIndexData()
  165. .then(res=>{
  166. if(res.data.vehicleList.length<1){
  167. this.bindCarShow = true;
  168. }
  169. this.orderList = res.data.orderList;
  170. }).catch(err=>{
  171. // alert(err.msg);
  172. console.log('getIndexData err',err)
  173. });
  174. },
  175. goPay(orderId){
  176. this.$u.route({
  177. url: 'pages/payPage/payPage',
  178. params: {
  179. orderId: orderId
  180. }
  181. });
  182. },
  183. //
  184. onRoadInfo(item){
  185. this.$u.api.roadInfoById({id:item.roadId})
  186. .then(res=>{
  187. this.content = `
  188. <dl><dt>路段名称:</dt> <dd>` + res.data.roadName + `</dd></dl>`
  189. + `<dl><dt>路段编码:</dt><dd>` + res.data.roadNo + `</dd></dl>`
  190. + `<dl><dt>联系人:</dt><dd>` + res.data.manager + `</dd></dl>`
  191. + `<dl><dt>联系电话:</dt><dd>` + res.data.telephone + `</dd></dl>`;
  192. this.showOrderDetails = true;
  193. }).catch(err=>{
  194. // alert(err.msg);
  195. console.log('getIndexData err',err)
  196. });
  197. }
  198. }
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. @import "./index.scss";
  203. </style>