暂存工作台模块,初步完成待测试和优化
This commit is contained in:
		| @@ -1,5 +1,5 @@ | |||||||
| import { getParkList } from "../../service/park" | import { getParkList } from "../../service/park" | ||||||
| import { getParkMeterList } from "../../service/meter" | import { getParkSimpleMeterList } from "../../service/meter" | ||||||
| import { alertInfo } from "../../utils/index"; | import { alertInfo } from "../../utils/index"; | ||||||
| import request from "../../utils/request" | import request from "../../utils/request" | ||||||
| import { payWays } from "../../utils/data"; | import { payWays } from "../../utils/data"; | ||||||
| @@ -80,13 +80,11 @@ Component({ | |||||||
|     }, |     }, | ||||||
|     onSearch() { |     onSearch() { | ||||||
|       const { type } = this.data; |       const { type } = this.data; | ||||||
|       console.log('type', type) |  | ||||||
|       switch(type) { |       switch(type) { | ||||||
|         case "park": |         case "park": | ||||||
|           this.onSearchPark(); |           this.onSearchPark(); | ||||||
|           return; |           return; | ||||||
|         case "meter": |         case "meter": | ||||||
|           console.log("meter") |  | ||||||
|           this.onSearchMeter(); |           this.onSearchMeter(); | ||||||
|           return; |           return; | ||||||
|       } |       } | ||||||
| @@ -105,8 +103,7 @@ Component({ | |||||||
|     }, |     }, | ||||||
|     async onSearchMeter() { |     async onSearchMeter() { | ||||||
|       const { searchText = "", park } = this.data; |       const { searchText = "", park } = this.data; | ||||||
|       console.log('this.data', this.data) |       const { code, message, data: parks = [] } = await getParkSimpleMeterList({keyword: searchText, park}); | ||||||
|       const { code, message, data: parks = [] } = await getParkMeterList({keyword: searchText, park}); |  | ||||||
|       if (code !== OK) { |       if (code !== OK) { | ||||||
|         alertInfo(message) |         alertInfo(message) | ||||||
|         return |         return | ||||||
|   | |||||||
| @@ -1,4 +1,11 @@ | |||||||
| // pages/workBench/components/approve/index.js | // pages/workBench/components/approve/index.js | ||||||
|  | import { alertInfo, alertSuccess, loadingFunc } from "../../../../utils/index"; | ||||||
|  | import { getParkMeterList, handleOperateMeterSwitch } from "../../../../service/meter" | ||||||
|  | import { getRechargeApproveList, rechargeApprove } from "../../../../service/recharge" | ||||||
|  | import request from "../../../../utils/request" | ||||||
|  | const { OK } = request | ||||||
|  |  | ||||||
|  | // pages/workBench/components/record/index.js | ||||||
| Component({ | Component({ | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
| @@ -12,13 +19,162 @@ Component({ | |||||||
|    * 组件的初始数据 |    * 组件的初始数据 | ||||||
|    */ |    */ | ||||||
|   data: { |   data: { | ||||||
|  |     keyword: "", | ||||||
|  |     keywordTemp: "", | ||||||
|  |     page: 1, | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 组件的方法列表 |    * 组件的方法列表 | ||||||
|    */ |    */ | ||||||
|   methods: { |   methods: { | ||||||
|  |     onParkFocus(e) { | ||||||
|  |       this.setData({ | ||||||
|  |         show: true, | ||||||
|  |         title: "园区", | ||||||
|  |         type: 'park' | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onConfirm(e) { | ||||||
|  |       const { data } = e.detail; | ||||||
|  |       const that = this; | ||||||
|  |       this.setData({ | ||||||
|  |         parkName: data.name, | ||||||
|  |         park: data.id, | ||||||
|  |       }, () => { | ||||||
|  |         loadingFunc(async () => { | ||||||
|  |           await that.init(); | ||||||
|  |         }) | ||||||
|  |       }) | ||||||
|  |       this.onConcal(); | ||||||
|  |     }, | ||||||
|  |     onChangeKeyword(e) { | ||||||
|  |       this.setData({ keywordTemp: e.detail }) | ||||||
|  |     }, | ||||||
|  |     onSearch() { | ||||||
|  |       const that = this; | ||||||
|  |       that.setData({ | ||||||
|  |         keyword: that.data.keywordTemp | ||||||
|  |       }, () => { | ||||||
|  |         loadingFunc(async () => { | ||||||
|  |           await that.init(); | ||||||
|  |         }) | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     async init() { | ||||||
|  |       const { page, keyword, park } = this.data; | ||||||
|  |       const { code, message, data, total } = await getRechargeApproveList({ park, page, keyword }) | ||||||
|  |       if (code !== OK) { | ||||||
|  |         alertInfo(message); | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |       this.setData({ | ||||||
|  |         list: data, | ||||||
|  |         total: total, | ||||||
|  |         totalPage: Math.ceil(total / 20) | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onChangeReason(e) { | ||||||
|  |       console.log('e.detail', e.detail) | ||||||
|  |       this.setData({ | ||||||
|  |         reason: e.detail, | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onApproveClose() { | ||||||
|  |       this.setData({ | ||||||
|  |         reason: "", | ||||||
|  |         approveShow: false, | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onApproveConfirm() { | ||||||
|  |       const { reason, record } = this.data; | ||||||
|  |       const that = this; | ||||||
|  |       if (!reason) { | ||||||
|  |         alertInfo("请输入拒绝理由") | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |       console.log('1') | ||||||
|  |       loadingFunc(async () => { | ||||||
|  |         console.log('2') | ||||||
|  |         const { code, message } = await rechargeApprove({ id: record, status: 1, reason }) | ||||||
|  |         console.log('3') | ||||||
|  |         if (code !== OK) { | ||||||
|  |           alertInfo(message) | ||||||
|  |           return; | ||||||
|  |         } | ||||||
|  |         alertSuccess("已拒绝") | ||||||
|  |         that.init(); | ||||||
|  |         that.setData({ | ||||||
|  |           reason: "", | ||||||
|  |           approveShow: false, | ||||||
|  |           record: "", | ||||||
|  |         }) | ||||||
|  |       }) | ||||||
|  |        | ||||||
|  |     }, | ||||||
|  |     handleApprove(e) { | ||||||
|  |       const status = e.currentTarget.dataset.status; | ||||||
|  |       const that = this; | ||||||
|  |       if (status === '1') { | ||||||
|  |         this.setData({ | ||||||
|  |           approveShow: true | ||||||
|  |         }) | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |       const { record, list } = this.data; | ||||||
|  |       const item = list.find(ele => ele.id === record) | ||||||
|  |      | ||||||
|  |       wx.showModal({ | ||||||
|  |         title: '提示', | ||||||
|  |         content: `您确认要同意${item?.tenement?.shortName || 当前记录}吗?`, | ||||||
|  |         complete: async (res) => { | ||||||
|  |           if (res.cancel) { | ||||||
|  |              | ||||||
|  |           } | ||||||
|  |        | ||||||
|  |           if (res.confirm) { | ||||||
|  |             loadingFunc(async () => { | ||||||
|  |               const { code, message } = await rechargeApprove({ id: record, status: 0,  }) | ||||||
|  |               if (code !== OK) { | ||||||
|  |                 alertInfo(message) | ||||||
|  |                 return; | ||||||
|  |               } | ||||||
|  |               alertSuccess("已同意") | ||||||
|  |               that.init(); | ||||||
|  |             }) | ||||||
|  |              | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     jumpToDetail(e) { | ||||||
|  |       const { id } = e.currentTarget.dataset; | ||||||
|  |       wx.navigateTo({ | ||||||
|  |         url: '/pages/rechargeDetail/index?id=' + id, | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     async onChangePage(e) { | ||||||
|  |       const page = e.detail.currentIndex; | ||||||
|  |       const that = this; | ||||||
|  |       this.setData({ | ||||||
|  |         page | ||||||
|  |       }, () => { | ||||||
|  |         loadingFunc(async () => { | ||||||
|  |           await that.init(); | ||||||
|  |         }) | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onConcal() { | ||||||
|  |       this.setData({ | ||||||
|  |         show: false, | ||||||
|  |         title: "", | ||||||
|  |         type: "", | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onChangeSelectRecharge(e) { | ||||||
|  |       this.setData({ | ||||||
|  |         record: e.detail | ||||||
|  |       }) | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| @@ -1,4 +1,15 @@ | |||||||
| { | { | ||||||
|   "component": true, |   "component": true, | ||||||
|   "usingComponents": {} |   "usingComponents": { | ||||||
|  |     "van-field": "@vant/weapp/field/index", | ||||||
|  |     "van-button": "@vant/weapp/button/index", | ||||||
|  |     "search-select": "/components/searchSelect/index", | ||||||
|  |     "van-empty": "@vant/weapp/empty/index", | ||||||
|  |     "table": "/components/table/table", | ||||||
|  |     "pagination": "/components/pagination/index", | ||||||
|  |     "empty": "/components/empty/index", | ||||||
|  |     "van-radio": "@vant/weapp/radio/index", | ||||||
|  |     "van-radio-group": "@vant/weapp/radio-group/index", | ||||||
|  |     "van-dialog": "@vant/weapp/dialog/index" | ||||||
|  |   } | ||||||
| } | } | ||||||
| @@ -1,2 +1,116 @@ | |||||||
| <!--pages/workBench/components/approve/index.wxml--> | <!--pages/workBench/components/approve/index.wxml--> | ||||||
| <text>pages/workBench/components/approve/index.wxml</text> | <!--pages/workBench/components/record/index.wxml--> | ||||||
|  | <van-field | ||||||
|  |     value="{{ parkName }}" | ||||||
|  |     placeholder="请选择园区" | ||||||
|  |     label="园区" | ||||||
|  |     readonly | ||||||
|  |     border="{{ false }}" | ||||||
|  |     use-button-slot | ||||||
|  |     title-width="100rpx" | ||||||
|  | > | ||||||
|  |     <van-button slot="button" size="small" type="primary" bind:click="onParkFocus"> | ||||||
|  |       选择 | ||||||
|  |     </van-button> | ||||||
|  | </van-field> | ||||||
|  |  | ||||||
|  | <van-empty wx:if="{{!park}}" description="选择园区后查看" /> | ||||||
|  | <view wx:else> | ||||||
|  |     <van-field | ||||||
|  |         value="{{ keyword }}" | ||||||
|  |         placeholder="请输入关键字" | ||||||
|  |         label="关键字" | ||||||
|  |         border="{{ false }}" | ||||||
|  |         use-button-slot | ||||||
|  |         bind:change="onChangeKeyword" | ||||||
|  |         title-width="100rpx" | ||||||
|  |     > | ||||||
|  |         <van-button slot="button" size="small" type="primary" bind:click="onSearch"> | ||||||
|  |         搜索 | ||||||
|  |         </van-button> | ||||||
|  |     </van-field> | ||||||
|  |     <view> | ||||||
|  |         <view wx:if="{{list.length}}"> | ||||||
|  |             <view class="tableWrapper"> | ||||||
|  |                 <view class="table"> | ||||||
|  |                     <view class="thead"> | ||||||
|  |                         <view class="th" style="width: 70rpx">  </view> | ||||||
|  |                         <view class="th" style="width: 250rpx"> 商户名字 </view> | ||||||
|  |                         <view class="th" style="width: 150rpx"> 充值金额 </view> | ||||||
|  |                         <view class="th" style="width: 200rpx"> 操作 </view> | ||||||
|  |                     </view> | ||||||
|  |                     <view class="tbody"> | ||||||
|  |                         <van-radio-group value="{{ record }}" bind:change="onChangeSelectRecharge"> | ||||||
|  |                             <block wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item"> | ||||||
|  |                                 <view class="tr"> | ||||||
|  |                                     <view class="th" style="width: 60rpx"> | ||||||
|  |                                         <van-radio wx:if="{{item.orderStatus !== '已退回'}}" name="{{item.id}}"></van-radio> | ||||||
|  |                                     </view> | ||||||
|  |                                     <view class="th" style="width: 200rpx"> {{ item.tenement.shortName }} </view> | ||||||
|  |                                     <view class="th" style="width: 200rpx"> {{ item.amount }} </view> | ||||||
|  |                                     <view class="th" style="width: 200rpx"> | ||||||
|  |                                         <view class="primaryTextBtn" bind:tap="jumpToDetail" data-id="{{item.id}}"> | ||||||
|  |                                             查看详细 | ||||||
|  |                                         </view> | ||||||
|  |                                     </view> | ||||||
|  |                                 </view> | ||||||
|  |                             </block> | ||||||
|  |                         </van-radio-group> | ||||||
|  |                     </view> | ||||||
|  |                 </view> | ||||||
|  |             </view> | ||||||
|  |              | ||||||
|  |             <pagination  | ||||||
|  |                 currentIndex="{{page}}"  | ||||||
|  |                 totalPage="{{totalPage}}"  | ||||||
|  |                 bind:pagingChange="onChangePage"   | ||||||
|  |             /> | ||||||
|  |              | ||||||
|  |         </view> | ||||||
|  |         <empty bind:refresh="init" wx:else /> | ||||||
|  |         <view class="operate"> | ||||||
|  |             <view style="margin-top: 60rpx; margin-bottom: 60rpx;display: flex; justify-content: center; align-items: center;"> | ||||||
|  |                 <van-button  | ||||||
|  |                     type="info"  | ||||||
|  |                     size="small"  | ||||||
|  |                     style="margin-right: 30rpx;"  | ||||||
|  |                     bind:click="handleApprove" | ||||||
|  |                     data-status="0" | ||||||
|  |                     disabled="{{!record}}" | ||||||
|  |                 > 同意 </van-button> | ||||||
|  |                 <van-button  | ||||||
|  |                     size="small"  | ||||||
|  |                     bind:click="handleClear"   | ||||||
|  |                     disabled="{{!record}}"  | ||||||
|  |                     bind:click="handleApprove" | ||||||
|  |                     data-status="1" | ||||||
|  |                 > 拒绝 </van-button> | ||||||
|  |             </view> | ||||||
|  |         </view> | ||||||
|  |     </view> | ||||||
|  | </view> | ||||||
|  |  | ||||||
|  | <search-select  | ||||||
|  |     show="{{show}}"  | ||||||
|  |     title="{{title}}"  | ||||||
|  |     type="{{type}}"  | ||||||
|  |     park="{{park}}" | ||||||
|  |     bindconfirm="onConfirm" | ||||||
|  |     bindcancel="onConcal" | ||||||
|  | /> | ||||||
|  |  | ||||||
|  | <van-dialog | ||||||
|  |   use-slot | ||||||
|  |   title="审核" | ||||||
|  |   show="{{ approveShow }}" | ||||||
|  |   show-cancel-button | ||||||
|  |   bind:close="onApproveClose" | ||||||
|  |   bind:confirm="onApproveConfirm" | ||||||
|  | > | ||||||
|  |     <van-field | ||||||
|  |         label="拒绝理由" | ||||||
|  |         value="{{ reason }}" | ||||||
|  |         placeholder="请输入拒绝理由" | ||||||
|  |         bind:change="onChangeReason" | ||||||
|  |     /> | ||||||
|  | </van-dialog> | ||||||
|   | |||||||
| @@ -1 +1,45 @@ | |||||||
| /* pages/workBench/components/approve/index.wxss */ | /* pages/workBench/components/approve/index.wxss */ | ||||||
|  | .table { | ||||||
|  |     width: 810rpx; | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tableWrapper { | ||||||
|  |     width: 100vw; | ||||||
|  |     overflow-x: auto; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .thead { | ||||||
|  |      | ||||||
|  |     display: flex; | ||||||
|  |     flex-wrap: nowrap; | ||||||
|  |   | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .thead  .th { | ||||||
|  |     padding: 20rpx; | ||||||
|  |     white-space: nowrap; | ||||||
|  |     text-align: center; | ||||||
|  |     box-sizing: border-box; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .primaryTextBtn { | ||||||
|  |     color: #1989fa; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | .tbody { | ||||||
|  |     width: 810rpx; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tbody .tr { | ||||||
|  |     padding: 20rpx; | ||||||
|  |     border-bottom: 1rpx solid #EEEEEE; | ||||||
|  |     display: flex; | ||||||
|  |     align-items: center; | ||||||
|  |     flex-wrap: nowrap; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tbody .tr { | ||||||
|  |     word-break: break-all; | ||||||
|  |     text-align: center; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
|  |  | ||||||
| import { handleRecharge } from "../../../../service/recharge"; | import { handleRecharge } from "../../../../service/recharge"; | ||||||
| import { alertInfo, alertSuccess } from "../../../../utils/index"; | import { alertInfo, alertSuccess, loadingFunc } from "../../../../utils/index"; | ||||||
| import request from '../../../../utils/request' | import request from '../../../../utils/request' | ||||||
| const { OK } = request; | const { OK } = request; | ||||||
|  |  | ||||||
| @@ -45,9 +45,7 @@ Component({ | |||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
|     onConfirm(e) { |     onConfirm(e) { | ||||||
|       // console.log('e', e) |  | ||||||
|       const { data, type, way } = e.detail; |       const { data, type, way } = e.detail; | ||||||
|       console.log('e.detail', e.detail) |  | ||||||
|       switch(type) { |       switch(type) { | ||||||
|         case "park": |         case "park": | ||||||
|           this.setData({ |           this.setData({ | ||||||
| @@ -85,14 +83,28 @@ Component({ | |||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
|     onChangeMoney(e) { |     onChangeMoney(e) { | ||||||
|       console.log('e', e) |  | ||||||
|       this.setData({ money: e.detail }) |       this.setData({ money: e.detail }) | ||||||
|     }, |     }, | ||||||
|     onChangeVoucherNo(e) { |     onChangeVoucherNo(e) { | ||||||
|       console.log('e', e) |  | ||||||
|       this.setData({ voucherNo: e.detail }) |       this.setData({ voucherNo: e.detail }) | ||||||
|     }, |     }, | ||||||
|  |     handleClear() { | ||||||
|  |       this.setData({ | ||||||
|  |         park: "", | ||||||
|  |         parkName: "", | ||||||
|  |         meter: "", | ||||||
|  |         meterName: "", | ||||||
|  |         way: "", | ||||||
|  |         payName: "", | ||||||
|  |         show: false, | ||||||
|  |         title: "", | ||||||
|  |         type: "", | ||||||
|  |         money: null, | ||||||
|  |         voucherNo: null | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|     async handleSubmit() { |     async handleSubmit() { | ||||||
|  |       const that = this; | ||||||
|       const { park, meter, money, way, voucherNo } = this.data; |       const { park, meter, money, way, voucherNo } = this.data; | ||||||
|       if (!park) { |       if (!park) { | ||||||
|         alertInfo("请选择园区"); |         alertInfo("请选择园区"); | ||||||
| @@ -114,18 +126,27 @@ Component({ | |||||||
|         alertInfo("请输入凭证号") |         alertInfo("请输入凭证号") | ||||||
|         return |         return | ||||||
|       } |       } | ||||||
|       const { code, message } = await handleRecharge(park, {  |       loadingFunc(async () => { | ||||||
|         amount: `${money || ''}`,  |         const { code, message } = await handleRecharge(park, {  | ||||||
|         meter,  |           amount: `${money || ''}`,  | ||||||
|         paymentType: way,  |           meter,  | ||||||
|         voucherNo,  |           paymentType: way,  | ||||||
|         type: "0"  |           voucherNo,  | ||||||
|  |           type: 0  | ||||||
|  |         }) | ||||||
|  |         if (code !== OK) { | ||||||
|  |           alertInfo(message) | ||||||
|  |           return | ||||||
|  |         } | ||||||
|  |         alertSuccess("充值成功") | ||||||
|  |         setTimeout(() => { | ||||||
|  |           that.handleClear() | ||||||
|  |           that.setData({ | ||||||
|  |              | ||||||
|  |           }) | ||||||
|  |         }, 500) | ||||||
|       }) |       }) | ||||||
|       if (code !== OK) { |        | ||||||
|         alertInfo(message) |  | ||||||
|         return |  | ||||||
|       } |  | ||||||
|       alertSuccess("充值成功") |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| @@ -68,7 +68,7 @@ | |||||||
|  |  | ||||||
| <view style="margin-top: 60rpx;display: flex; justify-content: center; align-items: center;"> | <view style="margin-top: 60rpx;display: flex; justify-content: center; align-items: center;"> | ||||||
|   <van-button type="info" size="small" style="margin-right: 30rpx;" bind:click="handleSubmit"> 确认 </van-button> |   <van-button type="info" size="small" style="margin-right: 30rpx;" bind:click="handleSubmit"> 确认 </van-button> | ||||||
|   <van-button size="small"> 取消 </van-button> |   <van-button size="small" bind:click="handleClear"> 清空 </van-button> | ||||||
| </view> | </view> | ||||||
| <search-select  | <search-select  | ||||||
|   show="{{show}}"  |   show="{{show}}"  | ||||||
| @@ -77,4 +77,5 @@ | |||||||
|   park="{{park}}" |   park="{{park}}" | ||||||
|   bindconfirm="onConfirm" |   bindconfirm="onConfirm" | ||||||
|   bindcancel="onConcal" |   bindcancel="onConcal" | ||||||
|  |   wx:if="{{show}}" | ||||||
| /> | /> | ||||||
|   | |||||||
| @@ -1,3 +1,8 @@ | |||||||
|  | import { alertInfo, alertSuccess, loadingFunc } from "../../../../utils/index"; | ||||||
|  | import { getParkMeterList, handleOperateMeterSwitch } from "../../../../service/meter" | ||||||
|  | import request from "../../../../utils/request" | ||||||
|  | const { OK } = request | ||||||
|  |  | ||||||
| // pages/workBench/components/record/index.js | // pages/workBench/components/record/index.js | ||||||
| Component({ | Component({ | ||||||
|  |  | ||||||
| @@ -12,13 +17,135 @@ Component({ | |||||||
|    * 组件的初始数据 |    * 组件的初始数据 | ||||||
|    */ |    */ | ||||||
|   data: { |   data: { | ||||||
|  |     keyword: "", | ||||||
|  |     keywordTemp: "", | ||||||
|  |     page: 1, | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 组件的方法列表 |    * 组件的方法列表 | ||||||
|    */ |    */ | ||||||
|   methods: { |   methods: { | ||||||
|  |     onParkFocus(e) { | ||||||
|  |       this.setData({ | ||||||
|  |         show: true, | ||||||
|  |         title: "园区", | ||||||
|  |         type: 'park' | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onConfirm(e) { | ||||||
|  |       const { data } = e.detail; | ||||||
|  |       const that = this; | ||||||
|  |       this.setData({ | ||||||
|  |         parkName: data.name, | ||||||
|  |         park: data.id, | ||||||
|  |       }, () => { | ||||||
|  |         loadingFunc(async () => { | ||||||
|  |           await that.init(); | ||||||
|  |         }) | ||||||
|  |       }) | ||||||
|  |       this.onConcal(); | ||||||
|  |     }, | ||||||
|  |     onChangeKeyword(e) { | ||||||
|  |       this.setData({ keywordTemp: e.detail }) | ||||||
|  |     }, | ||||||
|  |     onSearch() { | ||||||
|  |       const that = this; | ||||||
|  |       that.setData({ | ||||||
|  |         keyword: that.data.keywordTemp | ||||||
|  |       }, () => { | ||||||
|  |         loadingFunc(async () => { | ||||||
|  |           await that.init(); | ||||||
|  |         }) | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     async init() { | ||||||
|  |       const { page, keyword, park } = this.data; | ||||||
|  |       const { code, message, data, total } = await getParkMeterList({ park, keyword, page }) | ||||||
|  |       if (code !== OK) { | ||||||
|  |         alertInfo(message); | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |       this.setData({ | ||||||
|  |         list: data, | ||||||
|  |         total: total, | ||||||
|  |         totalPage: Math.ceil(total / 20) | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     async onChangePage(e) { | ||||||
|  |       const page = e.detail.currentIndex; | ||||||
|  |       const that = this; | ||||||
|  |       this.setData({ | ||||||
|  |         page | ||||||
|  |       }, () => { | ||||||
|  |         loadingFunc(async () => { | ||||||
|  |           await that.init(); | ||||||
|  |         }) | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onConcal() { | ||||||
|  |       this.setData({ | ||||||
|  |         show: false, | ||||||
|  |         title: "", | ||||||
|  |         type: "", | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     onChangeSelectMeter(e) { | ||||||
|  |       this.setData({ | ||||||
|  |         meter: e.detail | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     async handleMeterSwitchOn() { | ||||||
|  |       const that = this; | ||||||
|  |       const { meter, list } = this.data; | ||||||
|  |       const item = list.find(ele => ele.id === meter) | ||||||
|  |       wx.showModal({ | ||||||
|  |         title: '提示', | ||||||
|  |         content: `您确认要对${item?.address || 当前电表}进行合闸吗?`, | ||||||
|  |         complete: async (res) => { | ||||||
|  |           if (res.cancel) { | ||||||
|  |              | ||||||
|  |           } | ||||||
|  |        | ||||||
|  |           if (res.confirm) { | ||||||
|  |             loadingFunc(async () => { | ||||||
|  |               const { code, message } = await handleOperateMeterSwitch({ ids: [meter], status: 0 }) | ||||||
|  |               if (code !== OK) { | ||||||
|  |                 alertInfo(message) | ||||||
|  |                 return; | ||||||
|  |               } | ||||||
|  |               alertSuccess("合闸成功") | ||||||
|  |               that.init(); | ||||||
|  |             }) | ||||||
|  |              | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     async handleMeterSwitchOff() { | ||||||
|  |       const that = this; | ||||||
|  |       const { meter, list } = this.data; | ||||||
|  |       const item = list.find(ele => ele.id === meter) | ||||||
|  |       wx.showModal({ | ||||||
|  |         title: '提示', | ||||||
|  |         content: `您确认要对${item?.address || 当前电表}进行拉闸吗?`, | ||||||
|  |         complete: async (res) => { | ||||||
|  |           if (res.cancel) { | ||||||
|  |             return; | ||||||
|  |           } | ||||||
|  |           if (res.confirm) { | ||||||
|  |             loadingFunc(async () => { | ||||||
|  |               const { code, message } = await handleOperateMeterSwitch({ ids: [meter], status: 1 }) | ||||||
|  |               if (code !== OK) { | ||||||
|  |                 alertInfo(message) | ||||||
|  |                 return; | ||||||
|  |               } | ||||||
|  |               alertSuccess("拉闸成功") | ||||||
|  |               that.init(); | ||||||
|  |             }) | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| @@ -1,4 +1,15 @@ | |||||||
| { | { | ||||||
|   "component": true, |   "component": true, | ||||||
|   "usingComponents": {} |   "usingComponents": { | ||||||
|  |     "van-field": "@vant/weapp/field/index", | ||||||
|  |     "van-button": "@vant/weapp/button/index", | ||||||
|  |     "search-select": "/components/searchSelect/index", | ||||||
|  |     "van-empty": "@vant/weapp/empty/index", | ||||||
|  |     "table": "/components/table/table", | ||||||
|  |     "pagination": "/components/pagination/index", | ||||||
|  |     "empty": "/components/empty/index", | ||||||
|  |     "van-radio": "@vant/weapp/radio/index", | ||||||
|  |     "van-radio-group": "@vant/weapp/radio-group/index", | ||||||
|  |     "van-tag": "@vant/weapp/tag/index" | ||||||
|  |   } | ||||||
| } | } | ||||||
| @@ -1,2 +1,103 @@ | |||||||
| <!--pages/workBench/components/record/index.wxml--> | <!--pages/workBench/components/record/index.wxml--> | ||||||
| <text>pages/workBench/components/record/index.wxml</text> | <van-field | ||||||
|  |     value="{{ parkName }}" | ||||||
|  |     placeholder="请选择园区" | ||||||
|  |     label="园区" | ||||||
|  |     readonly | ||||||
|  |     border="{{ false }}" | ||||||
|  |     use-button-slot | ||||||
|  |     title-width="100rpx" | ||||||
|  | > | ||||||
|  |     <van-button slot="button" size="small" type="primary" bind:click="onParkFocus"> | ||||||
|  |       选择 | ||||||
|  |     </van-button> | ||||||
|  | </van-field> | ||||||
|  |  | ||||||
|  | <van-empty wx:if="{{!park}}" description="选择园区后查看" /> | ||||||
|  | <view wx:else> | ||||||
|  |     <van-field | ||||||
|  |         value="{{ keyword }}" | ||||||
|  |         placeholder="请输入关键字" | ||||||
|  |         label="关键字" | ||||||
|  |         border="{{ false }}" | ||||||
|  |         use-button-slot | ||||||
|  |         bind:change="onChangeKeyword" | ||||||
|  |         title-width="100rpx" | ||||||
|  |     > | ||||||
|  |         <van-button slot="button" size="small" type="primary" bind:click="onSearch"> | ||||||
|  |         搜索 | ||||||
|  |         </van-button> | ||||||
|  |     </van-field> | ||||||
|  |     <view> | ||||||
|  |         <view wx:if="{{list.length}}"> | ||||||
|  |             <van-radio-group value="{{ radio }}" bind:change="onChangeSelectMeter"> | ||||||
|  |                 <view class="classWrapper"> | ||||||
|  |                     <view class="table"> | ||||||
|  |                         <view class="thead"> | ||||||
|  |                             <view class="th" style="width: 80rpx">  </view> | ||||||
|  |                             <view class="th" style="width: 200rpx"> 商户名称 </view> | ||||||
|  |                             <view class="th" style="width: 200rpx"> 电表地址 </view> | ||||||
|  |                             <view class="th" style="width: 150rpx"> 电表余额 </view> | ||||||
|  |                             <view class="th" style="width: 130rpx"> 拉合闸 </view> | ||||||
|  |                             <view class="th" style="width: 130rpx"> 是否失联 </view> | ||||||
|  |                         </view> | ||||||
|  |                         <view class="tbody"> | ||||||
|  |                                 <view wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item" class="tr"> | ||||||
|  |                              | ||||||
|  |                                     <view class="th" style="width: 80rpx"> | ||||||
|  |                                         <van-radio name="{{item.id}}"></van-radio> | ||||||
|  |                                     </view> | ||||||
|  |                                     <view class="th" style="width: 200rpx"> {{ item.tenement.shortName }} </view> | ||||||
|  |                                     <view class="th" style="width: 200rpx"> {{ item.address }} </view> | ||||||
|  |                                     <view class="th" style="width: 150rpx"> {{ item.amount }} </view> | ||||||
|  |                                     <view class="th" style="width: 130rpx" wx:if="{{item.onPosition}}"> | ||||||
|  |                                         <van-tag type="warning">拉闸</van-tag> | ||||||
|  |                                     </view> | ||||||
|  |                                     <view class="th" style="width: 130rpx" wx:else> | ||||||
|  |                                         <van-tag type="primary">合闸</van-tag> | ||||||
|  |                                     </view> | ||||||
|  |                                     <view class="th" style="width: 130rpx" wx:if="{{canConnect}}"> | ||||||
|  |                                         <van-tag type="primary">在线</van-tag> | ||||||
|  |                                     </view> | ||||||
|  |                                     <view class="th" style="width: 130rpx" wx:else> | ||||||
|  |                                         <van-tag type="danger">失联</van-tag> | ||||||
|  |                                     </view> | ||||||
|  |                              | ||||||
|  |                                 </view> | ||||||
|  |                         </view> | ||||||
|  |                     </view> | ||||||
|  |                 </view> | ||||||
|  |                  | ||||||
|  |             </van-radio-group> | ||||||
|  |             <pagination  | ||||||
|  |                 currentIndex="{{page}}"  | ||||||
|  |                 totalPage="{{totalPage}}"  | ||||||
|  |                 bind:pagingChange="onChangePage"   | ||||||
|  |             /> | ||||||
|  |              | ||||||
|  |         </view> | ||||||
|  |         <empty bind:refresh="init" wx:else /> | ||||||
|  |         <view class="operate"> | ||||||
|  |             <view style="margin-top: 60rpx; margin-bottom: 60rpx;display: flex; justify-content: center; align-items: center;"> | ||||||
|  |                 <van-button  | ||||||
|  |                     type="info"  | ||||||
|  |                     size="small"  | ||||||
|  |                     style="margin-right: 30rpx;"  | ||||||
|  |                     bind:click="handleMeterSwitchOn" | ||||||
|  |                     disabled="{{!meter}}" | ||||||
|  |                 > 合闸 </van-button> | ||||||
|  |                 <van-button size="small" bind:click="handleClear"  disabled="{{!meter}}" bind:click="handleMeterSwitchOff"> 拉闸 </van-button> | ||||||
|  |             </view> | ||||||
|  |         </view> | ||||||
|  |     </view> | ||||||
|  | </view> | ||||||
|  |  | ||||||
|  | <search-select  | ||||||
|  |     show="{{show}}"  | ||||||
|  |     title="{{title}}"  | ||||||
|  |     type="{{type}}"  | ||||||
|  |     park="{{park}}" | ||||||
|  |     bindconfirm="onConfirm" | ||||||
|  |     bindcancel="onConcal" | ||||||
|  |     wx:if="{{show}}" | ||||||
|  | /> | ||||||
|   | |||||||
| @@ -1 +1,41 @@ | |||||||
| /* pages/workBench/components/record/index.wxss */ | /* pages/workBench/components/record/index.wxss */ | ||||||
|  | .table { | ||||||
|  |     width: 890rpx; | ||||||
|  |      | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .classWrapper { | ||||||
|  |     width: 100vw; | ||||||
|  |     overflow-x: auto; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .thead { | ||||||
|  |     display: flex; | ||||||
|  |     flex-wrap: nowrap; | ||||||
|  |     border-bottom: 1rpx solid #EEEEEE; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .thead  .th { | ||||||
|  |     padding: 20rpx; | ||||||
|  |     white-space: nowrap; | ||||||
|  |     text-align: center; | ||||||
|  |     box-sizing: border-box; | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tbody { | ||||||
|  |     width: 890rpx; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tbody .tr { | ||||||
|  |     padding: 20rpx; | ||||||
|  |     border-bottom: 1rpx solid #EEEEEE; | ||||||
|  |     display: flex; | ||||||
|  |     align-items: center; | ||||||
|  |     flex-wrap: nowrap; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tbody .th { | ||||||
|  |     word-break: break-all; | ||||||
|  |     text-align: center; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -17,6 +17,19 @@ export const getTenementMeterList = async function(tid) { | |||||||
| } | } | ||||||
|  |  | ||||||
| // 获取某一园区下的电表列表 | // 获取某一园区下的电表列表 | ||||||
| export const getParkMeterList = async function({park = "", keyword = ""}) { | export const getParkMeterList = async function({park = "", keyword = "", page = 1}) { | ||||||
|   return await GET(`/equipment/getOperateMeterList?page=1&park=${park}&keyword=${keyword}`); |   return await GET(`/equipment/getOperateMeterList?page=${page}&park=${park}&keyword=${keyword}`); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 获取某一园区下的简洁电表列表 | ||||||
|  | export const getParkSimpleMeterList = async function({park = "", keyword = "", page = 1}) { | ||||||
|  |   return await GET(`/work/getWorkMeter?page=${page}&park=${park}&keyword=${keyword}`); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | // 拉合闸 | ||||||
|  | export const handleOperateMeterSwitch = async function({ ids = [], status }) { | ||||||
|  |   return await PUT(`/equipment/batchSwtich`, { ids, status }); | ||||||
| } | } | ||||||
| @@ -30,4 +30,14 @@ export const createPublicTopUp = async function(data) { | |||||||
| // 后台充值 | // 后台充值 | ||||||
| export const handleRecharge = async function(park, data) { | export const handleRecharge = async function(park, data) { | ||||||
|   return await POST(`/wechatTopup/${park}`, data) |   return await POST(`/wechatTopup/${park}`, data) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 获取后台审核列表 | ||||||
|  | export const getRechargeApproveList = async function({park, page, keyword}) { | ||||||
|  |   return await GET(`/wx/getTopExamineList?park=${park}&page=${page}&keyword=${keyword}`) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 对公审核 | ||||||
|  | export const rechargeApprove = async function({ id, status, reason }) { | ||||||
|  |   return await PUT(`/wx/updateTopExamineList/`, { id, status, reason }) | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user