parkingSiteDes.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="container">
  3. <u-navbar title="停车场主页" :background="{backgroundColor: '#ffffff'}" class="top-navbar" title-size="30">
  4. </u-navbar>
  5. <view class="parking-panel">
  6. <view class="panel-left">
  7. <view>
  8. <text class="left-title">{{parkingSite.parking_name}}</text>
  9. <u-icon name="edit-pen" size="32" color="#4a4a4a" style="margin-left:100rpx;padding:10rpx;" @tap="editParking"></u-icon>
  10. </view>
  11. <view class="left-txt">
  12. <text>总车位数 </text><text class="num-txt">{{parkingSite.total_parking_number}}</text>
  13. </view>
  14. <view class="left-txt">剩余车位数<text class="num-txt">{{parkingSite.surplus_parking_number}}</text></view>
  15. </view>
  16. <image :src="parkingSite.pic_url" style="width:200rpx;height:160rpx;border-radius: 10rpx;"></image>
  17. </view>
  18. <view class="parking-adr">
  19. <view style="padding-left:30rpx;line-height:60rpx;height: 60rpx;position: absolute;z-index: 2;width:100%;background-color: rgba(255,255,255,0.9);">{{parkingSite.address_}}</view>
  20. <image src="../../static/img/addrbg.png" style="height: 60rpx;width:100%;position: fixed;z-index: 1;"></image>
  21. </view>
  22. <view class="li-title">收费规则</view>
  23. <view class="li-con">
  24. <text space="emsp"> {{chargeRule.rule_txt}}</text>
  25. <!-- <view style="margin-top:15rpx;"><text space="emsp"> {{chargeRule.oth_rule_txt}}</text></view> -->
  26. </view>
  27. <view class="li-title">设备列表</view>
  28. <view class="li-con" v-for="(item,index) in devs">
  29. <view class="dev-tit">
  30. <text>{{item.channel_name}}</text>
  31. <u-button type="primary" :custom-style="{height:'60rpx',margin:'0rpx 30rpx'}" :plain="true" @tap="manualPass(item.id,item.channel_name)">手动放行</u-button>
  32. <!-- <view class="dev-view"><text>查看</text><u-icon name="arrow-right"></u-icon></view> -->
  33. </view>
  34. <view class="dev-stat">
  35. <view><text style="margin-right:10rpx;">闸口状态:{{item.channel_status=='1'?'在线':'离线'}} </text>
  36. <u-icon :name="item.channel_status=='1'?'checkmark-circle-fill':'error-circle-fill'" size="30" :color="item.channel_status=='1'?'#15b53a':'#888888'"></u-icon>
  37. <!-- <text style="margin:0rpx 10rpx 0rpx 40rpx;">摄像头状态:正常 </text><u-icon name="checkmark-circle-fill" size="30" color="#15b53a"></u-icon> -->
  38. </view>
  39. </view>
  40. </view>
  41. <!-- <u-button type="primary" style="margin:50rpx 50rpx;" @tap="manualPass">出口抬杆放行</u-button> -->
  42. <u-modal v-model="showModal" :title="modalTitle" :show-cancel-button="true" @confirm="exePass">
  43. <view class="slot-content">
  44. <u-field v-model="passNote" label="" placeholder="请填写放行说明" type="textarea" label-width="0" :auto-height="false" :field-style="{height:'140rpx'}"/>
  45. </view>
  46. </u-modal>
  47. <u-modal v-model="showEditModal" ref="editModal" title="车位数编辑" :show-cancel-button="true" :async-close="true" @confirm="submitSeat">
  48. <view class="slot-content">
  49. <u-field type="number" v-model="seatModel.total" label="总车位数" :label-width="150" :field-style="{'border-bottom':'1px solid #55aaff'}"/>
  50. <u-field type="number" v-model="seatModel.idle" label="剩余车位数" :label-width="150" :field-style="{'border-bottom':'1px solid #55aaff'}"/>
  51. </view>
  52. </u-modal>
  53. </view>
  54. </template>
  55. <script>
  56. import * as api from '@/apis/myparkings.js'
  57. export default {
  58. data() {
  59. return {
  60. showModal:false,
  61. modalTitle:'放行说明',
  62. passNote:'',
  63. opening:false,
  64. openingChannel:'',
  65. parkingSite:{},
  66. chargeRule:{},
  67. othChargeRule:[],
  68. devs:[],
  69. showEditModal:false,
  70. seatModel:{
  71. total:null,
  72. idle:null
  73. }
  74. }
  75. },
  76. onLoad(opt){
  77. this.loadPageData(opt.park_id);
  78. },
  79. methods: {
  80. editParking(){
  81. this.showEditModal=true;
  82. this.seatModel.total=this.parkingSite.total_parking_number;
  83. this.seatModel.idle=this.parkingSite.surplus_parking_number;
  84. },
  85. closeEditModal(isClose){
  86. if(isClose){
  87. this.showEditModal=false;
  88. }
  89. else{
  90. this.$refs.editModal.clearLoading();
  91. }
  92. },
  93. submitSeat(){
  94. api.updateParkingSeat(this.parkingSite.id,this.seatModel.total,this.seatModel.idle).then(resp=>{
  95. if(!resp.success){
  96. uni.showToast({
  97. title:resp.msg||'保存数据失败',
  98. icon:'none'
  99. })
  100. this.closeEditModal()
  101. return;
  102. }
  103. uni.showToast({
  104. title:'操作成功',
  105. icon:'success'
  106. })
  107. this.closeEditModal(true)
  108. //编辑后的值设置到显示对象中,不用请求后台
  109. this.parkingSite.total_parking_number=this.seatModel.total;
  110. this.parkingSite.surplus_parking_number=this.seatModel.idle;
  111. }).catch(err=>{
  112. uni.showToast({
  113. title:'保存数据出错',
  114. icon:'none'
  115. })
  116. this.closeEditModal()
  117. })
  118. },
  119. manualPass(channelId,channelName){
  120. if(this.opening){
  121. uni.showToast({
  122. title:'开门中,勿重复操作',
  123. icon:'none'
  124. })
  125. return;
  126. }
  127. this.modalTitle=channelName+"放行";
  128. this.showModal=true;
  129. this.openingChannel=channelId;
  130. },
  131. exePass(){
  132. if(!this.openingChannel){
  133. uni.showToast({
  134. title:'未选择要开启设备',
  135. icon:'none'
  136. })
  137. return;
  138. }
  139. uni.showLoading({
  140. title:'开门中...'
  141. });
  142. api.manualPass(this.openingChannel,this.passNote).then(resp => {
  143. this.opening=false;
  144. uni.hideLoading();
  145. if(!resp.success){
  146. uni.showToast({
  147. title:resp.msg||'开门失败',
  148. icon:'none'
  149. })
  150. }
  151. else{
  152. uni.showToast({
  153. title:'手动开门已执行',
  154. icon:'none'
  155. })
  156. }
  157. }).catch(error => {
  158. this.opening=false;
  159. uni.hideLoading();
  160. });
  161. this.opening=true;
  162. },
  163. loadPageData(id){
  164. uni.showLoading({
  165. title:'加载中...'
  166. });
  167. api.loadParkingCompose(id).then(resp => {
  168. console.log(resp);
  169. uni.hideLoading();
  170. if(!resp.success){
  171. uni.showToast({
  172. title:resp.msg||'加载数据失败',
  173. icon:'none'
  174. })
  175. return;
  176. }
  177. this.parkingSite=resp.data.parkInfo;
  178. if(!this.parkingSite.pic_url){
  179. this.parkingSite.pic_url="../../static/img/header_bg.png";
  180. }
  181. this.chargeRule=resp.data.chargeRule;
  182. let othchargeRule=resp.data.othchargeRule||[];
  183. let othRuleTxt={ryc:[],xny:[]};
  184. othchargeRule.forEach((item) => {
  185. if(item.car_type=='1'){ //燃油车
  186. othRuleTxt.ryc.push(`${item.min_section}-${item.max_section}分钟:${item.parking_cost}元`);
  187. }
  188. else if(item.car_type=='2'){ //新能源车
  189. othRuleTxt.xny.push(`${item.min_section}-${item.max_section}分钟:${item.parking_cost}元`);
  190. }
  191. });
  192. this.chargeRule['rule_txt']=`燃油车\n 免费时长:${this.chargeRule.free_duration}分钟,每小时费用:${this.chargeRule.hour_cost}元,${othRuleTxt.ryc.join(',')} \n新能源车\n 免费时长:${this.chargeRule.new_energy_free_duration}分钟,每小时费用:${this.chargeRule.new_energy_hour_cost}元,${othRuleTxt.xny.join(',')} \n每日封顶费用:${this.chargeRule.day_capping_cost}元`;
  193. //this.chargeRule['oth_rule_txt']=othRuleTxt.join(' ');
  194. this.devs=resp.data.devs;
  195. }).catch(error => {
  196. uni.hideLoading();
  197. });
  198. }
  199. }
  200. }
  201. </script>
  202. <style>
  203. page{
  204. background-color: #f4f4f4;
  205. font-family: '华文行楷';
  206. }
  207. .parking-panel{
  208. background-color: #ffffff;
  209. border-radius: 10rpx;
  210. padding:20rpx;
  211. display: flex;
  212. flex-flow: row nowrap;
  213. justify-content: space-between;
  214. align-items: center;
  215. }
  216. .parking-panel .panel-left{
  217. display: flex;
  218. flex-flow: column nowrap;
  219. justify-content: space-between;
  220. align-items: flex-start;
  221. font-family: '华文行楷';
  222. }
  223. .parking-panel .panel-left .left-txt{
  224. font-size:24rpx;
  225. color:#695f5f;
  226. margin-top:15rpx;
  227. }
  228. .parking-panel .panel-left .left-title{
  229. font-weight: bold;
  230. font-size:32rpx;
  231. color:#000000;
  232. }
  233. .left-txt .num-txt{
  234. font-size: 28rpx;
  235. font-weight: bold;
  236. margin:0rpx 10rpx;
  237. }
  238. .newpower-txt{
  239. color:#27bf3e;
  240. margin:0rpx 10rpx;
  241. }
  242. .parking-adr{
  243. background-color: #ffffff;
  244. /* padding:15rpx 20rpx; */
  245. font-size: 28rpx;
  246. height: 60rpx;
  247. }
  248. .li-title{
  249. margin:30rpx 20rpx 15rpx;
  250. border-left:6rpx solid #1b68e3;
  251. padding:0rpx 20rpx;
  252. }
  253. .li-con{
  254. background-color: #ffffff;
  255. padding:15rpx;
  256. font-size: 26rpx;
  257. color:#4a4a4a;
  258. margin-bottom: 5rpx;
  259. }
  260. .dev-tit{
  261. display: flex;
  262. flex-flow: row nowrap;
  263. justify-content: space-between;
  264. align-items: center;
  265. }
  266. .dev-tit>text{
  267. font-size:32rpx;
  268. font-weight: bold;
  269. }
  270. .dev-tit .dev-view>text{
  271. font-size: 24rpx;
  272. color:#1B68E3;
  273. margin-right:10rpx;
  274. }
  275. .dev-stat{
  276. font-size:24rpx;
  277. color:#646464;
  278. margin:20rpx 0rpx 0rpx;
  279. }
  280. /deep/.u-textarea-inner{
  281. background-color: #ececec;
  282. }
  283. </style>