准备联调抄表记录

This commit is contained in:
2025-09-16 17:35:49 +08:00
194 changed files with 6560 additions and 1095 deletions

View File

@@ -20,9 +20,7 @@ Page({
*/
onLoad(options) {
const querys = decodeURIComponent(options.scene)
console.log('querys', querys)
const id = querys.slice(querys.indexOf("=") + 1)
console.log("id", id)
this.getInfo(id);
},
async getInfo(id) {

View File

@@ -1,5 +1,5 @@
import { getBillList } from "../../service/accounting"
import { alertInfo } from "../../utils/index";
import { alertInfo, loadingFunc } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
@@ -17,11 +17,19 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init();
const that = this;
loadingFunc(async () => {
await that.init();
})
},
async init() {
const { page, list } = this.data;
const { code, data, message } = await getBillList(page)
if (code !== OK) {
alertInfo(message)
return;
}
if (!data?.length) {
alertInfo("没有更多了")
return;
@@ -33,8 +41,9 @@ Page({
},
jumpToDetail(e) {
const { id: report } = e.currentTarget.dataset
const tenement = wx.getStorageSync('tenement')?.id || ""
wx.navigateTo({
url: '/childPackage/pages/billDetail/index?id=' + report,
url: `/childPackage/pages/billDetail/index?id=${report}&tenement=${tenement}`,
})
},
})

View File

@@ -0,0 +1,87 @@
// pages/billMeterDetail/index.js
import { getRoundNumber } from "../../utils/index"
Page({
/**
* 页面的初始数据
*/
data: {
data: {},
headers: [
{ key: 'type', title: '' },
{ title: '尖',renderBody: (item) => { return item?.sharp } },
{ title: '峰',renderBody: (item) => { return item?.peak } },
{ title: '平',renderBody: (item) => { return item?.flat } },
{ title: '谷',renderBody: (item) => { return item?.valley } },
],
list: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const data = JSON.parse(options.data) || {}
this.setData({
data: data,
list: [
{ type: "起码", sharp: data.startSharp, peak: data.startPeak, flat: data.startFlat, valley: data.startValley },
{ type: "止码", sharp: data.endSharp, peak: data.endPeak, flat: data.endFlat, valley: data.endValley },
{ type: "退补电量", sharp: data.refundSharp, peak: data.refundPeak, flat: data.refundFlat, valley: data.refundValley },
{ type: "从表电量", sharp: getRoundNumber(data.nestSharp), peak: getRoundNumber(data.nestPeak), flat: getRoundNumber(data.nestFlat), valley: getRoundNumber(data.nestValley) },
{ type: "电度电量", sharp: getRoundNumber(data?.critical?.amount), peak: getRoundNumber(data.peak?.amount), flat: getRoundNumber(data.flat?.amount), valley: getRoundNumber(data.valley?.amount) },
{ type: "分时单价", sharp: data.critical?.price, peak: data.peak?.price, flat: data.flat?.price, valley: data.valley?.price },
{ type: "电费", sharp: getRoundNumber(data.chargeSharp), peak: getRoundNumber(data.chargePeak), flat: getRoundNumber(data.chargeFlat), valley: getRoundNumber(data.chargeValley) },
]
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,10 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"van-field": "@vant/weapp/field/index",
"table": "/components/table/table"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,45 @@
<!--pages/billMeterDetail/index.wxml-->
<navigator title="详情" canBack="{{true}}" />
<view class="contentWrapper">
<van-field
label="电表编号"
readonly="{{true}}"
border="{{false}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
value="{{data.meterNo}}"
/>
<van-field
label="电表地址"
readonly="{{true}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{false}}"
value="{{data.address}}"
/>
<van-field
label="倍率"
readonly="{{true}}"
border="{{false}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
value="{{data.ratio}}"
/>
<view class="table">
<table header="{{headers}}" list="{{list}}" />
</view>
<view class="total">
<van-row>
<van-col span="12">
<view class="totalNumber">
电度电量:{{data.overall.amount}}
</view>
</van-col>
<van-col span="12">
<view class="totalNumber">
电度电费:{{data.overall.fee}}
</view>
</van-col>
</van-row>
</view>
</view>

View File

@@ -0,0 +1,22 @@
/* pages/billMeterDetail/index.wxss */
.infoItem {
word-break: break-all;
}
.contentWrapper {
margin: 20rpx;
}
.table {
border: 1rpx solid rgba(204,204,204,.5);
margin-bottom: 40rpx;
}
.total {
padding-top: 30rpx;
padding-bottom: 40rpx;
}
.totalNumber {
word-break: break-all;
}

View File

@@ -0,0 +1,120 @@
// pages/discountCoupon/index.js
import request from "../../utils/request"
import { getCurrentCoupons, getCurrentIntegral, getRedeemableCoupons } from "../../service/system";
import { alertInfo, loadingFunc } from "../../utils/index";
const { OK } = request;
Page({
/**
* 页面的初始数据
*/
data: {
currentList: [],
canGetList: [],
active: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
onChange(e) {
this.setData({
active: e.detail.index,
}, () => {
const { active } = this.data;
this.init(active);
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
const { active } = this.data;
this.init(active);
},
init(active) {
switch(active) {
case 0:
this.getCurrent()
break;
case 1:
this.getCanGet();
break;
}
},
async getCurrent() {
const that = this;
loadingFunc(async() => {
const { code, message, data = [], } = await getCurrentCoupons();
if (code !== OK) {
alertInfo(message)
return
}
that.setData({
currentList: data
})
})
},
getCanGet() {
const that = this;
loadingFunc(async() => {
const { code, message, data = [], } = await getRedeemableCoupons({ type: 1 });
if (code !== OK) {
alertInfo(message)
return
}
that.setData({
canGetList: data
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,10 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"discount-coupon": "/components/discountCoupon/index",
"empty": "/components/empty/index"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,20 @@
<!--pages/discountCoupon/index.wxml-->
<navigator title="我的优惠券" canBack="{{true}}" />
<van-tabs active="{{ active }}" bind:change="onChange">
<van-tab title="我的优惠券">
<view wx:if="{{currentList.length}}">
<view wx:for="{{currentList}}" wx:key="id" class="item">
<discount-coupon data="{{item}}" type="{{3}}" />
</view>
</view>
<empty wx:else bind:refresh="getCurrent" />
</van-tab>
<van-tab title="领券中心">
<view wx:if="{{canGetList.length}}">
<view wx:for="{{canGetList}}" wx:key="id" class="item">
<discount-coupon data="{{item}}" type="{{1}}" bind:get="getCanGet" />
</view>
</view>
<empty wx:else bind:refresh="getCanGet" />
</van-tab>
</van-tabs>

View File

@@ -0,0 +1,8 @@
/* pages/discountCoupon/index.wxss */
page {
background-color: rgb(242,243,245);
}
.item {
margin: 20rpx;
}

View File

@@ -2,6 +2,7 @@
import { userValidate } from "../../service/user";
import { alertInfo, alertSuccess, loadingFunc, wxLogin } from "../../utils/index";
import request from "../../utils/request"
import Dialog from '@vant/weapp/dialog/dialog';
const { OK } = request;
Page({
@@ -93,11 +94,37 @@ Page({
})
})
},
onParkFocus(e) {
this.setData({
show: true,
title: "园区",
type: 'park'
})
},
onTenementFocus(e) {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
show: true,
title: "公司",
type: 'tenement'
})
},
showTooltip() {
Dialog.alert({
title: '提示',
message: '该手机号为开户时预留的手机号,一般为接收电费欠费短信的管理员手机号。',
}).then(() => {
// on close
});
},
scan() {
wx.scanCode({
scanType: "qrCode",
success: ({ path }) => {
console.log('path', path)
wx.navigateTo({
url: '/' + path,
})
@@ -108,4 +135,28 @@ Page({
}
})
},
onConfirm(e) {
const { type, data = {} } = e.detail;
switch(type) {
case "park":
this.setData({
park: data.id,
parkName: data.name,
})
break;
case "tenement":
this.setData({
tenement: data.id,
tenementName: data.name,
})
}
this.onCancel();
},
onCancel() {
this.setData({
show: false,
title: "",
type: "",
})
},
})

View File

@@ -2,12 +2,14 @@
"usingComponents": {
"topbar": "/components/topbar/index",
"select": "/components/select/index",
"search-select": "/components/searchSelect/index",
"van-button": "@vant/weapp/button/index",
"van-field": "@vant/weapp/field/index",
"van-icon": "@vant/weapp/icon/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"navigator": "/components/navigator/index"
"navigator": "/components/navigator/index",
"van-dialog": "@vant/weapp/dialog/index"
},
"navigationStyle": "custom"
}

View File

@@ -17,16 +17,48 @@
</van-tab>
<van-tab title="手动绑定">
<view>
<select label="园区" type="0" bind:choose="onChoosePark" park="{{park}}" parkName="{{parkName}}" required="{{true}}" />
<select label="公司名称" type="1" bind:choose="onChooseTenement" park="{{park}}" tenement="{{tenement}}" tenementName="{{tenementName}}" required="{{true}}" />
<van-field
required
value="{{ parkName }}"
label="园区"
placeholder="请选择园区"
border="{{ true }}"
readonly
use-button-slot
>
<van-button slot="button" size="small" type="info" bind:click="onParkFocus">
选择
</van-button>
</van-field>
<van-field
required
value="{{ tenementName }}"
label="商户"
placeholder="请选择商户"
border="{{ true }}"
readonly
use-button-slot
>
<van-button slot="button" size="small" type="info" bind:click="onTenementFocus">
选择
</van-button>
</van-field>
<van-field
required
value="{{ phone }}"
label="预留手机号"
placeholder="请输入预留手机号"
border="{{ true }}"
bind:change="onChangePhone"
/>
>
<view slot="label">
手机号
<van-icon
name="question-o"
style="margin-left: 8rpx;font-size: 36rpx;"
bind:tap="showTooltip"
/>
</view>
</van-field>
<van-field
required
value="{{ name }}"
@@ -49,3 +81,13 @@
</view>
</van-tab>
</van-tabs>
<van-dialog id="van-dialog" />
<search-select
show="{{show}}"
title="{{title}}"
type="{{type}}"
park="{{park}}"
bindconfirm="onConfirm"
bindcancel="onCancel"
/>

View File

@@ -56,7 +56,7 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
async changeMeter() {
const { meterList = [] } = this.data;
@@ -115,6 +115,12 @@ Page({
show: false,
})
},
jumpToMeterBalanceRecord(e) {
const id = e.currentTarget.dataset.id
wx.navigateTo({
url: `/pages/meterBalanceRecord/index?id=${id}`,
})
},
changeMoney(e) {
const { money } = e.currentTarget.dataset;
this.setData({
@@ -124,8 +130,26 @@ Page({
onChangeMoney(e) {
this.setData({ money: e.detail })
},
jumpToMeterList() {
const { tenement, user } = this.data;
if (!user) {
alertInfo("请先登录")
return
}
if (!tenement) {
alertInfo("请先选择商户")
return
}
wx.navigateTo({
url: '/pages/meterList/index?id=' + tenement?.id,
})
},
async recharge() {
const { user, money, meter, tenement, park } = this.data;
if (!user || !user.id) {
alertInfo("请先登录")
return;
}
const { code, message, data } = await getTenementExceptionalCase(park?.id, tenement?.id);
if (code !== OK) {
alertInfo(message)

View File

@@ -60,11 +60,27 @@
<view class="cardItem">
<view class="cardItemLabel"> 电表余额: </view>
<view class="cardItemValue" style="position: relative;">
<view class="text" wx:if="{{user.id}}"> {{meter.money}} </view>
<view
class="text primaryTextBtn"
wx:if="{{user.id}}"
bind:tap="jumpToMeterBalanceRecord"
data-id="{{meter.id}}"
> {{meter.money}} </view>
<view class="text" wx:else> --- </view>
<van-button type="info" size="small" plain="{{true}}" custom-style="position: absolute; right: -20rpx; bottom: -20rpx;z-index: 99;" bind:click="refreshMeter" wx:if="{{user.id}}">
<view style="width: 160rpx;display: flex;justify-content: center;"><van-icon name="replay" />
刷新</view>
<!-- bind:click="refreshMeter" -->
<van-button
type="info"
size="small"
plain="{{true}}"
custom-style="position: absolute; right: -20rpx; bottom: -20rpx;z-index: 99;"
wx:if="{{user.id}}"
bind:click="jumpToMeterList"
>
<view style="width: 160rpx;display: flex;justify-content: center;">
<!-- <van-icon name="replay" /> -->
查看全部
<!-- 刷新 -->
</view>
</van-button>
</view>
</view>

View File

@@ -1,6 +1,10 @@
/* pages/home/index.wxss */
@import "/app.wxss";
.balanceText {
color: var(--primary-color)
}
.top {
background-color: var(--deep-green);
position: fixed;

112
pages/integral/index.js Normal file
View File

@@ -0,0 +1,112 @@
// pages/integral/index.js
import request from "../../utils/request"
import { getCurrentIntegral, getRedeemableCoupons } from "../../service/system";
import { alertInfo, loadingFunc } from "../../utils/index";
const { OK } = request;
Page({
/**
* 页面的初始数据
*/
data: {
integral: 0,
page: 1,
size: 20,
list: [],
totalPage: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getIntegral();
this.getCoupons();
},
async getCoupons() {
const { page, size } = this.data
const { code, message, data, total } = await getRedeemableCoupons({ page, size, type: 2 })
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
list: data,
totalPage: Math.ceil(total / size),
})
},
refresh() {
const that = this;
that.setData({
page: 1,
size: 20
}, () => {
that.getCoupons()
})
},
jumpToRecord() {
wx.navigateTo({
url: '/pages/integralRecord/index',
})
},
async getIntegral() {
const { code, message, data } = await getCurrentIntegral();
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
integral: data?.balance || 0
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,8 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"discount-coupon": "/components/discountCoupon/index",
"empty": "/components/empty/index"
},
"navigationStyle": "custom"
}

14
pages/integral/index.wxml Normal file
View File

@@ -0,0 +1,14 @@
<!--pages/integral/index.wxml-->
<navigator title="积分兑换" canBack="{{true}}" />
<view class="integralWrapper">
<view class="currentIntegral">
<view class="number"> 当前积分: {{ integral }} </view>
<view class="primaryTextBtn" bind:tap="jumpToRecord"> 查看积分明细 </view>
</view>
<view class="ticketList" wx:if="{{list.length}}">
<view wx:for="{{list}}" wx:key="id" class="item">
<discount-coupon data="{{item}}" type="{{2}}" />
</view>
</view>
<empty wx:else bind:refresh="refresh" text="暂无可兑换的优惠券" />
</view>

23
pages/integral/index.wxss Normal file
View File

@@ -0,0 +1,23 @@
/* pages/integral/index.wxss */
page {
background-color: rgb(242,243,245);
}
.item {
margin: 20rpx;
}
.integralWrapper {
padding: 20rpx;
}
.currentIntegral {
font-size: 34rpx;
display: flex;
justify-content: space-between;
}
.ticketList {
margin-top: 20rpx;
}

View File

@@ -0,0 +1,113 @@
// pages/integralRecord/index.js
import request from "../../utils/request"
import { getIntegralRecord } from "../../service/system";
import { alertInfo, loadingFunc } from "../../utils/index";
const { OK } = request;
Page({
/**
* 页面的初始数据
*/
data: {
page: 1,
size: 20,
list: [],
total: 0,
totalPage: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
async init() {
const { page, size } = this.data;
const { code, message, data, total } = await getIntegralRecord({ page, size })
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
list: data?.map(item => {
item.type = ['充值增加', '系统增加', '系统减少', '冲正减少', '退费减少', '兑换优惠券', '积分清零'][item.type - 1]
item.nowBalance = Number(item.nowBalance || 0)
item.lastBalance = Number(item.lastBalance || 0)
item.value = item.nowBalance - item.lastBalance;
item.value = item.value > 0 ? `+${item.value}` : item.value
return item
}) || [],
total,
totalPage: Math.ceil(total / size),
})
},
refresh() {
const that = this;
this.setData({
page: 1,
size: 20,
}, () => {
that.init();
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
const that = this;
loadingFunc(async () => {
await that.init();
})
},
async onChangePage(e) {
const page = e.detail.currentIndex;
const that = this;
this.setData({
page
}, () => {
that.init();
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,10 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"empty": "/components/empty/index",
"pagination": "/components/pagination/index"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,23 @@
<!--pages/integralRecord/index.wxml-->
<navigator title="积分明细" canBack="{{true}}" />
<view wx:if="{{list.length}}">
<van-cell-group>
<van-cell
wx:for="{{list}}"
wx:key="id"
title="{{item.type}}"
value="{{item.value}}"
label="{{item.createdAt}}"
/>
</van-cell-group>
<pagination
currentIndex="{{page}}"
totalPage="{{totalPage}}"
bind:pagingChange="onChangePage"
/>
</view>
<view wx:else>
<empty bind:refresh="refresh" />
</view>

View File

@@ -0,0 +1 @@
/* pages/integralRecord/index.wxss */

View File

@@ -80,13 +80,32 @@ Page({
}
wx.openDocument({
filePath: res.tempFilePath,
showMenu: true,
// fileType: sheetRes.tapIndex === 0 ? 'xml' : "pdf", // 3. 这个必须写合法类型,不然下载不了
success: function (res) {
},
fail: function (e) {
alertError("打开失败")
console.log('打开失败错误为', e)
// alertError("打开失败")
// console.log('打开失败错误为', e)
wx.showModal({
title: '提示',
content: '打开失败,请复制链接后通过浏览器打开',
complete: (res) => {
if (res.cancel) {
}
if (res.confirm) {
wx.setClipboardData({
data: data,
success: () => {
alertSuccess("复制成功")
}
})
}
}
})
}
})
}

View File

@@ -43,6 +43,15 @@ Component({
page: page + 1,
})
},
refresh() {
const that = this;
that.setData({
page: 1,
list: []
}, () => {
loadingFunc(() => that.getList())
})
},
onRefresh() {
loadingFunc(() => this.getList())
},

View File

@@ -2,6 +2,9 @@
<scroll-view wx:if="{{list.length}}" scroll-y lower-threshold="100px" bindscrolltolower="scrollToLower" style="height: 80vh;" scroll-top="{{topHeight}}px" class="scrView">
<view style="margin: 18rpx 30rpx;">
<van-button type="info" size="small" icon="replay" bind:click="refresh"> 刷新 </van-button>
</view>
<view class="card" wx:for="{{list}}">
<view class="left">
<view class="title">
@@ -28,7 +31,7 @@
</view>
</view>
<view class="{{item.status === 1 ? 'approving' : 'already'}}">
<view wx:if="{{item.status === 1}}"> 审核中 </view>
<view wx:if="{{item.status === 1}}"> 开票中 </view>
<view wx:else> 已开票 </view>
</view>
</view>

View File

@@ -38,11 +38,15 @@ Component({
alertInfo(message)
return;
}
this.setData({ detail: {...data,name: wx.getStorageSync('tenement')?.name, },editType: 'detail', })
this.setData({ detail: {...data,name: data?.name || wx.getStorageSync('tenement')?.name, },editType: 'detail', })
},
async getUser() {
const tenement = wx.getStorageSync('tenement');
const tenement = wx.getStorageSync('tenement')
const { code, message, data } = await getUserInfo(tenement?.id)
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({ user: data });
},
changeEditType() {

View File

@@ -143,7 +143,19 @@
value="{{detail.address || '-'}}"
>
</van-field>
<van-field
label="电话"
wx:if="{{editType === 'detail' }}"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{editType === 'detail'}}"
autosize="{{true}}"
title-width="132rpx"
border="{{ editType === 'detail' ? false : true }}"
bind:change="onChangeText"
data-name="tenementPhone"
value="{{detail.tenementPhone || '-'}}"
>
</van-field>
<van-field
label="备注"
wx:if="{{editType === 'detail' }}"
@@ -255,10 +267,19 @@
bind:change="onChangeText"
data-name="address"
/>
<van-field
value="{{formData.tenementPhone}}"
label="备注"
placeholder="{{'请输入电话'}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{true }}"
bind:change="onChangeText"
data-name="tenementPhone"
/>
<van-field
value="{{formData.remark}}"
label="备注"
label="电话"
placeholder="{{'请输入备注'}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"

View File

@@ -14,7 +14,7 @@ Component({
},
lifetimes: {
attached() {
this.init();
loadingFunc(async () => await this.init())
}
},
/**
@@ -42,7 +42,7 @@ Component({
this.setData({ list: data, selectList: new Array(data?.length).map(() => false), allChecked: false, })
},
onRefresh() {
loadingFunc(() => this.init())
loadingFunc(async () => await this.init())
},
onChange(e) {
const { id, index } = e.currentTarget.dataset;

View File

@@ -13,7 +13,7 @@
{{ item.tenement.name }}
</view>
<view class="bottom">
{{ item.range[0] }} - {{ item.range[1] }}
{{ item.range[0] }} {{ item.range[1] }}
</view>
</view>
<view class="rightMoney"> ¥ {{ item.money }} </view>
@@ -23,14 +23,15 @@
</view>
</view>
</van-checkbox-group>
<view style="height: 60rpx"></view>
<view class="allSelect">
<van-checkbox value="{{ allChecked }}" bind:change="onAllChecked">
全选
</van-checkbox>
<view style="flex: 1; display: flex; align-items: center; justify-content: flex-end;">
<view style="flex: 1; display: flex; align-items: center; justify-content: flex-end;white-space: normal;word-break: keep-all;">
<view class="allNumber"> {{ selectCount }} </view>
订单,共
笔,共
<view class="allMoney"> ¥ {{selectMoney}} </view>
<van-button size="small" type="info" bind:click="next" disabled="{{!selectCount}}"> 下一步 </van-button>
</view>

View File

@@ -18,6 +18,10 @@
.middle {
margin-top: 26rpx;
font-size: 32rpx;
overflow: hidden;
width: 350rpx;
text-overflow: ellipsis;
white-space: nowrap;
}
.bottom {

View File

@@ -33,7 +33,7 @@ Page({
alertInfo(message)
return;
}
if (!data?.tenement?.id || !data?.name || !data?.phone || !data?.email) {
if (!data?.id) {
const user = wx.getStorageSync('user')
if (user.isAdmin) {
wx.showModal({
@@ -82,18 +82,17 @@ Page({
loadingFunc(async() => {
const {ids = [], remark } = this.data;
const tenement = wx.getStorageSync('tenement')
setTimeout(() => {
wx.redirectTo({
url: '/pages/invoiceList/index?tab=1',
})
}, 500)
const { code, message, data } = await makeInvoice({ ids, tenement: tenement.id, remark })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("操作成功")
setTimeout(() => {
wx.redirectTo({
url: '/pages/invoiceList/index?tab=1',
})
}, 500)
})
},
changeShow() {

View File

@@ -73,7 +73,7 @@
<van-field
value="{{ detail.phone }}"
wx:if="{{detail.headerType === 0}}"
label="电话"
label="手机号"
readonly
title-width="132rpx"
disabled="{{true}}"
@@ -104,7 +104,7 @@
>
<view class="modalContentWrapper">
<van-field
value="{{ tenementName }}"
value="{{ detail.name }}"
label="发票抬头"
readonly
type="textarea"

View File

@@ -54,7 +54,7 @@ Page({
this.noPermission()
return;
}
alertSuccess("注册成功")
alertSuccess("登录成功")
const { token, ...user } = data
wx.setStorageSync('user', user)
wx.setStorageSync('token', data?.token)

View File

@@ -0,0 +1,149 @@
import dayjs from "../../utils/dayjs"
import { getDayCalcList } from "../../service/calc"
import { alertError } from "../../utils/index";
import request from "../../utils/request"
const { OK } = request
// pages/meterBalanceRecord/index.js
Page({
/**
* 页面的初始数据
*/
data: {
time: "",
timeStamp: undefined,
list: [],
page: 1,
size: 999,
header: [
{ key: 'day', title: '日期', },
{ key: "money", title: '充值金额', renderBody: (item) => {
if (item.type === 1 || item.type === 7) {
return item.topFee
} else if (item.type === 5 || item.type === 6 || item.type === 8) {
return `-${item.topFee}`
} else {
return 0
}
} },
{ key: 'overall', title: '电费', renderBody: (item) => {
if (item.type == 1 || item.type === 5 || item.type === 6 || item.type === 7 || item.type === 8) {
return 0;
} else {
return item.money
}
} },
{ key: 'balance', title: '电表余额' },
],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { id } = options
const that = this;
this.setData({
id,
time: dayjs().format("YYYY-MM"),
timeStamp: Date.now()
}, () => {
that.getList()
})
},
clickTime() {
this.setData({
timeVisible: true
})
},
async getList() {
const { id, time, page, size } = this.data;
const { code, message, data } = await getDayCalcList({
page,
size,
startTime: dayjs(time).subtract(1, 'month').endOf('month').format("YYYY-MM-DD"),
endTime: dayjs(time).endOf('month').format("YYYY-MM-DD"),
codeId: id,
})
if (code !== OK) {
alertError(message)
return
}
this.setData({
list: data?.map(item => {
item.day = dayjs(item.endTime).format("DD日")
return item;
})
})
},
onTimeConfirm(e) {
const { time } = e.detail;
const that = this;
this.setData({
time,
timeStamp: new Date(time).getTime(),
timeVisible: false,
}, () => {
that.getList()
})
},
onTimeCancel() {
this.setData({
timeVisible: false,
})
},
onTimeClose() {
this.setData({
timeVisible: false,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,13 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"timePicker": "/components/timePicker/index",
"van-icon": "@vant/weapp/icon/index",
"van-tag": "@vant/weapp/tag/index",
"van-row": "@vant/weapp/row/index",
"empty": "/components/empty/index",
"table": "/components/table/table",
"van-col": "@vant/weapp/col/index"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,74 @@
<!--pages/meterBalanceRecord/index.wxml-->
<navigator title="电费扣款记录" canBack="{{true}}" />
<view class="pageWrapper">
<view class="timeChooseWrapper">
<view> 选择时间 </view>
<view class="time" bind:tap="clickTime">
<view class="timeText"> {{time}} </view>
<van-icon name="arrow-down" />
</view>
</view>
<view class="customTable" wx:if="{{list.length}}">
<!-- <view class="customTableTile">
<van-row>
<van-col span="4">
<view style="text-align: center;"> 日期 </view>
</van-col>
<van-col span="6">
<view style="text-align: center;"> 充值金额 </view>
</van-col>
<van-col span="6">
<view style="text-align: center;"> 电费 </view>
</van-col>
<van-col span="8">
<view style="text-align: center;"> 电表余额 </view>
</van-col>
</van-row>
</view>
<view class="customTableContent" wx:for="{{list}}" wx:key="id">
<view class="tableRow">
<van-row>
<van-col span="4">
<view style="text-align: center;"> {{ item.day }} </view>
</van-col>
<van-col span="6">
<view style="text-align: center;" wx:if="{{item.type === 1 || item.type === 7}}"> {{ item.topFee }} </view>
<view style="text-align: center;" wx:elif="{{item.type === 5 || item.type === 6 || item.type === 8}}"> -{{ item.topFee }} </view>
<view style="text-align: center;" wx:else> 0 </view>
</van-col>
<van-col span="6">
<view style="text-align: center;" wx:if="{{item.type == 1 || item.type === 5 || item.type === 6 || item.type === 7 || item.type === 8}}">
0
</view>
<view style="text-align: center;" wx:else> {{item.money}} </view>
</van-col>
<van-col span="8">
<view style="text-align: center;"> {{item.balance}} </view>
</van-col>
</van-row>
</view>
</view> -->
<table
header="{{header}}"
list="{{list}}"
border="{{true}}"
topStyle="text-align: center"
bodyStyle="text-align: center"
topColor="rgb(242,248,246)"
/>
</view>
<empty bind:refresh="getList" wx:else />
</view>
<timePicker
type="month"
currentDate="{{timeStamp}}"
show="{{timeVisible}}"
bind:cancel="onTimeCancel"
bind:close="onTimeClose"
bind:confirm="onTimeConfirm"
/>

View File

@@ -0,0 +1,91 @@
/* pages/meterBalanceRecord/index.wxss */
.pageWrapper {
margin: 30rpx;
}
.time {
flex: 1;
margin-left: 30rpx;
margin-right: 30rpx;
display: flex;
padding: 10rpx 20rpx;
border-radius: 12rpx;
border: 1rpx solid #ccc;
background-color: #fff;
}
.timeChooseWrapper {
display: flex;
align-items: center;
font-size: 36rpx;
}
.timeText {
flex: 1;
}
.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;
}
.customTable {
margin: 20rpx 0;
padding-bottom: 30rpx;
}
.customTableTile {
background-color: var(--light-green);
padding: 16rpx;
box-sizing: border-box;
font-weight: 700;
}
.tableRow {
padding: 16rpx;
border: 1rpx solid #ccc;
border-top: 0rpx;
font-size: 32rpx;
}
page {
background-color: var(--transparent-green);
}

94
pages/meterList/index.js Normal file
View File

@@ -0,0 +1,94 @@
// pages/meterList/index.js
import { getTenementMeterList } from "../../service/meter";
import dayjs from "../../utils/dayjs";
import { alertInfo, loadingFunc } from "../../utils/index";
import request from '../../utils/request';
const { OK } = request;
Page({
/**
* 页面的初始数据
*/
data: {
header: [
{ key: 'address', title: '电表地址' },
{ key: "money", title: '电表余额', },
{ key: 'overall', title: '电表总量' },
],
list: [],
},
async getMeters({ id }) {
const { code, message, data } = await getTenementMeterList(id);
if (code !== OK) {
alertInfo(message)
this.setData({ meterList: [], meter: {} })
wx.setStorageSync('meter', {})
return;
}
this.setData({
list: data || [],
})
// if (!storageMeter) {
wx.setStorageSync('meter', data?.[0] || {} )
// }
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
loadingFunc(async () => {
await this.getMeters({ id: options?.id })
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.setData({
time: dayjs().format("YYYY-MM-DD HH:mm:ss"),
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,7 @@
{
"usingComponents": {
"table": "/components/table/table",
"navigator": "/components/navigator/index"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,13 @@
<!--pages/meterList/index.wxml-->
<navigator title="电表列表" canBack="{{true}}" />
<view class="time">{{ time }} </view>
<view style="margin: 0 24rpx;">
<table
header="{{header}}"
list="{{list}}"
border="{{true}}"
topStyle="text-align: center"
bodyStyle="text-align: center"
topColor="rgb(242,248,246)"
/>
</view>

View File

@@ -0,0 +1,10 @@
/* pages/meterList/index.wxss */
.time {
margin: 20rpx 24rpx;
font-size: 28rpx;
color: rgb(97, 93, 93);
}
page {
background-color: var(--transparent-green);
}

View File

@@ -4,8 +4,10 @@ import Dialog from '@vant/weapp/dialog/dialog';
import { getUserInfo, logout } from "../../service/user";
import { getDot } from "../../utils/system";
import request from "../../utils/request"
import { getCurrentIntegral } from "../../service/system";
const { OK } = request;
Page({
/**
@@ -15,6 +17,7 @@ Page({
user: {},
tenement: {},
visible: false,
integral: 0,
},
/**
@@ -63,9 +66,20 @@ Page({
}
this.init()
this.getUnReadNumber()
this.getIntegral()
const tenement = wx.getStorageSync('tenement')
this.setData({ tenement })
},
async getIntegral() {
const { code, message, data } = await getCurrentIntegral();
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
integral: data?.balance || 0
})
},
async init() {
const tenement = wx.getStorageSync('tenement')
const result = await getUserInfo(tenement?.id);
@@ -86,6 +100,16 @@ Page({
url: '/pages/workBench/index',
})
},
jumpToIntegral() {
wx.navigateTo({
url: '/pages/integral/index',
})
},
jumpToDiscountCoupon() {
wx.navigateTo({
url: '/pages/discountCoupon/index',
})
},
async getUnReadNumber() {
const dot = await getDot();
this.setData({
@@ -120,15 +144,27 @@ Page({
})
},
connect() {
Dialog.alert({
title: '提示',
message: '将进入咨询客服页面',
confirmButtonOpenType: "contact",
showCancelButton: true,
}).then(() => {
// on close
});
// Dialog.alert({
// title: '提示',
// message: '将进入咨询客服页面',
// "confirm-button-open-type": "contact",
// showCancelButton: true,
// }).then(() => {
// // on close
// });
this.setData({
connectShow: true
})
},
bindConnect() {
this.setData({
connectShow: false
})
},
bindCancelConnect() {
this.setData({
connectShow: false
})
},
jumpToFinance() {
wx.navigateTo({

View File

@@ -8,7 +8,8 @@
"navigator": "/components/navigator/index",
"van-grid": "@vant/weapp/grid/index",
"avatar": "/components/avatar/index",
"van-grid-item": "@vant/weapp/grid-item/index"
"van-grid-item": "@vant/weapp/grid-item/index",
"van-image": "@vant/weapp/image/index"
},
"navigationBarTitleText": "我的",
"navigationStyle": "custom"

View File

@@ -8,17 +8,68 @@
<view class="info">
<view class="nickName"> {{ user.nickName }} </view>
<view class="tenement"> {{ tenement.name }} </view>
<view class="integration"> 积分: - </view>
<view class="integration"> 积分: {{ integral }} </view>
</view>
</view>
<view style="margin-bottom: 20rpx;border-radius: 16rpx; overflow: hidden;">
<van-grid column-num="3">
<van-grid-item icon="friends-o" text="财税援助" bind:click="jumpToFinance" />
<van-grid-item icon="envelop-o" text="法律援助" bind:click="jumpToLaw" />
<van-grid-item icon="notes-o" text="电力百科" bind:click="jumpToEncyclopedia" />
<van-grid column-num="3" >
<van-grid-item
bind:click="jumpToLaw"
use-slot
>
<van-image
width="140rpx"
height="140rpx"
style="margin-top: 20rpx;"
src="/assets/images/law.png"
/>
<view style="margin-top: 20rpx;font-size: 34rpx;"> 法律援助 </view>
</van-grid-item>
<van-grid-item
bind:click="jumpToFinance"
use-slot
>
<van-image
style="margin-top: 20rpx;"
width="140rpx"
height="140rpx"
src="/assets/images/finance.png"
/>
<view style="margin-top: 20rpx;font-size: 34rpx;"> 财税援助 </view>
</van-grid-item>
<van-grid-item
bind:click="jumpToEncyclopedia"
use-slot
>
<van-image
width="140rpx"
height="140rpx"
style="margin-top: 20rpx;"
src="/assets/images/baike.png"
/>
<view style="margin-top: 20rpx;font-size: 34rpx;"> 电力百科 </view>
</van-grid-item>
</van-grid>
</view>
<view style="margin-bottom: 20rpx;border-radius: 16rpx; overflow: hidden;">
<van-cell
title="积分兑换"
value=""
is-link
bind:tap="jumpToIntegral"
icon="diamond-o"
/>
<van-cell
title="我的优惠券"
value=""
is-link
bind:tap="jumpToDiscountCoupon"
icon="label-o"
/>
</view>
<view style="border-radius: 16rpx; overflow: hidden;">
<!-- <button open-type="contact" class="connect"> 联系客服 </button> -->
<van-cell title="联系客服" value="" is-link bind:tap="connect" icon="service-o" />
<van-cell icon="qr" wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
<van-cell icon="friends-o" wx:if="{{!!user.isAdmin}}" is-link bind:click="jumpToMember">
@@ -29,7 +80,7 @@
</view>
</view>
</van-cell>
<van-cell title="发票抬头" icon="discount-o" value="" is-link bind:tap="jumpToUpdateInvoice">
<van-cell title="发票抬头" icon="notes-o" value="" is-link bind:tap="jumpToUpdateInvoice">
</van-cell>
<van-cell title="绑定企业" icon="exchange" value="" is-link bind:tap="bindTenement" />
<van-cell title="常见问题" icon="question-o" value="" is-link bind:tap="jumpToQuestions" />
@@ -38,4 +89,18 @@
</view>
<van-dialog id="van-dialog" />
</view>
</view>
<van-dialog
title="提示"
message="将进入咨询客服页面"
show="{{ connectShow }}"
custom-class="my-custom-class"
show-cancel-button
use-confirm-button-slot="{{true}}"
use-cancel-button-slot="{{true}}"
>
<button slot="cancel-button" style="width: 50%;background-color: transparent;border: 0px;border-radius: 0;" bind:tap="bindCancelConnect"> 取消 </button>
<button open-type="contact" slot="confirm-button" style="width: 50%;background-color: transparent;border: 0px;border-radius: 0;" bind:tap="bindConnect"> 确认 </button>
</van-dialog>

View File

@@ -40,3 +40,6 @@
margin-top: 6rpx;
}
.connect {
display: none;
}

View File

@@ -0,0 +1,84 @@
// pages/workBench/components/tenement/components/bindMeter/index.js
// 0015980101
import { bindMeter, } from "../../../../service/tenement"
import { getWorkMeterDetail } from "../../../../service/meter"
import { alertInfo, alertSuccess } from "../../../../utils/index";
import request from "../../../../utils/request"
import dayjs from "../../../../utils/dayjs"
const { OK } = request
Component({
/**
* 组件的属性列表
*/
properties: {
visible: Boolean,
title: String,
timeProps: String,
numberProps: String,
id: String
},
observers: {
"timeProps": function(newValue) {
this.setData({
time: newValue
})
},
"numberProps": function(newValue) {
this.setData({
number: newValue
})
},
},
/**
* 组件的初始数据
*/
data: {
dateTimeShow: false,
},
/**
* 组件的方法列表
*/
methods: {
onCancel() {
this.setData({
show: false,
title: "",
type: "",
})
// this.triggerEvent("close")
},
onClose() {
this.setData({
show: false,
title: "",
type: "",
})
},
onChange(e) {
const { name } = e.currentTarget.dataset;
this.setData({
[name]: e.detail
})
},
async onSubmit() {
const { time, number } = this.data;
if (time == null || number == null) {
alertInfo("请正确填写后保存")
return;
}
this.triggerEvent("ok")
},
dateTimeConfirm(e) {
this.setData({ time: e.detail.time, dateTimeShow: false })
},
dateTimeCancal(e) {
this.setData({ dateTimeShow: false })
},
onTimeFocus() {
this.setData({ dateTimeShow: true })
}
}
})

View File

@@ -0,0 +1,10 @@
{
"component": true,
"usingComponents": {
"van-dialog": "@vant/weapp/dialog/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index",
"date-time-picker": "/components/DateTimePicker/index"
}
}

View File

@@ -0,0 +1,50 @@
<!--pages/workBench/components/tenement/components/bindMeter/index.wxml-->
<van-dialog
use-slot
title="{{title}}"
show="{{ visible }}"
show-cancel-button
bind:confirm="onSubmit"
bind:close="onClose"
>
<view class="modalContentWrapper">
<van-field
value="{{ time }}"
placeholder="请选择绑定时间"
label="时间"
readonly
border="{{ false }}"
use-button-slot
title-width="100rpx"
>
<van-button slot="button" size="small" type="info" bind:click="onTimeFocus">
选择
</van-button>
</van-field>
<van-field
value="{{ number }}"
placeholder="请输入读数"
label="读数"
type="digit"
border="{{ false }}"
title-width="100rpx"
>
</van-field>
</view>
</van-dialog>
<search-select
show="{{show}}"
title="{{title}}"
type="{{type}}"
park="{{park}}"
bindconfirm="onConfirm"
bindcancel="onCancel"
/>
<date-time-picker
show="{{dateTimeShow}}"
bind:confirm="dateTimeConfirm"
bind:cancel="dateTimeCancal"
/>

View File

@@ -0,0 +1 @@
/* pages/workBench/components/tenement/components/bindMeter/index.wxss */

View File

@@ -5,7 +5,7 @@ Component({
* 组件的属性列表
*/
properties: {
meterInfo: Object,
},
/**

View File

@@ -2,10 +2,15 @@
<view class="wrapper">
<view class="title">
<view class="address">
标1东-307
{{meterInfo.address}}
</view>
<view class="status">
正常运行中
<view wx:if="{{meterInfo.enabled}}">
正常
</view>
<view wx:else>
停用
</view>
</view>
</view>
<view class="detail">
@@ -16,7 +21,7 @@
设备编号
</view>
<view>
1202312423524
{{meterInfo.meterSn}}
</view>
</view>
</van-col>
@@ -26,7 +31,15 @@
电表类型
</view>
<view>
1202312423524
<view wx:if="{{meterInfo.meterBelongType === 0}}">
商户电表
</view>
<view wx:elif="{{meterInfo.meterBelongType === 1}}">
公区电表
</view>
<view wx:elif="{{meterInfo.meterBelongType === 2}}">
公摊电表
</view>
</view>
</view>
</van-col>
@@ -36,7 +49,7 @@
最近读数
</view>
<view>
1202312423524
{{meterInfo.overall}}
</view>
</view>
</van-col>
@@ -46,7 +59,7 @@
读数日期
</view>
<view>
1202312423524
{{meterInfo.readAt}}
</view>
</view>
</van-col>

View File

@@ -1,27 +1,73 @@
// pages/readingHistory/index.js
import { getMeterReadingRouteMeterDetail } from "../../service/workBench"
import request from "../../utils/request"
import { alertInfo, alertSuccess, alertError } from "../../utils/index"
const { OK } = request;
Page({
/**
* 页面的初始数据
*/
data: {
list: [{time: "2025-05-05 14:10:09", number: 90803.87}]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { meter, park } = options;
this.setData({
meter,
park
})
this.getMeterInfo(meter);
},
async getMeterInfo(id) {
const { code, message, data } = await getMeterReadingRouteMeterDetail(id)
if (code !== OK) {
alertError(message)
return;
}
this.setData({ meterInfo: data })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
handleCreate() {
this.setData({
title: "新增记录",
visible: true
})
},
handleUpdate() {
this.setData({
title: "编辑记录",
visible: true,
time: "2025-09-11",
number: 100,
id: ""
})
},
handleDelete(e) {
const { id } = e.currentTarget.dataset;
wx.showModal({
title: '删除确认',
content: '确认要删除这一项记录吗?',
complete: (res) => {
if (res.cancel) {
}
if (res.confirm) {
}
}
})
},
/**
* 生命周期函数--监听页面显示
*/

View File

@@ -2,7 +2,9 @@
"usingComponents": {
"navigator": "/components/navigator/index",
"meterInfo": "./components/meterInfo/index",
"van-button": "@vant/weapp/button/index"
"van-button": "@vant/weapp/button/index",
"van-icon": "@vant/weapp/icon/index",
"editModal": "./components/editModal/index"
},
"navigationStyle": "custom"
}

View File

@@ -2,11 +2,48 @@
<navigator title="历史抄表记录" canBack="{{true}}" />
<view class="wrapper">
<meterInfo />
<meterInfo meterInfo="{{meterInfo}}" />
<view class="historyTitle">
<view class="text">
抄表记录历史
</view>
<van-button type="info" size="small" icon="plus" > 新增记录 </van-button>
<van-button type="info" size="small" icon="plus" bind:tap="handleCreate"> 新增记录 </van-button>
</view>
<view>
<view wx:if="{{list.length}}">
<view class="tableWrapper">
<view class="table">
<view class="thead">
<view class="th" style="width: 40%; text-align: center;"> 抄表时间 </view>
<view class="th" style="width: 35%; text-align: center;"> 抄表读数 </view>
<view class="th" style="width: 25%; text-align: center;"> 操作 </view>
</view>
<view class="tbody">
<view wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
<view class="tr" style="display: flex; align-items: center; ">
<view class="th" style="width: 40%; text-align: center; font-size: 30rpx;">
{{ item.time }}
</view>
<view class="th" style="width: 35%; text-align: center; font-size: 30rpx;">
{{ item.number }}
</view>
<view class="th" style="width: 25%; text-align: center; justify-content: center; display: flex; align-items: center;">
<van-icon name="edit" size="40rpx" bind:tap="handleUpdate" data-data="{{item}}" color="#15755e" />
<van-icon name="delete" size="40rpx" bind:tap="handleDelete" data-id="{{item.id}}" color="#15755e" custom-style="margin-left: 20rpx" />
</view>
</view>
</view>
</view>
</view>
</view>
<pagination currentIndex="{{page}}" totalPage="{{totalPage}}" bind:pagingChange="onChangePage" />
</view>
<empty bind:refresh="init" wx:else />
</view>
</view>
<editModal title="{{title}}" visible="{{visible}}" timeProps="{{time}}" numberProps="{{number}}" id="{{id}}" />

View File

@@ -3,7 +3,70 @@ page {
background-color: #ebedf0;
}
.wrapper {
padding: 0 20rpx 20rpx;
box-sizing: border-box;
}
.historyTitle {
display: flex;
justify-content: space-between;
}
}
.table {
width: 100%;
}
.tableWrapper {
width: 100%;
margin-top: 30rpx;
background-color: #fff;
overflow-x: auto;
padding: 20rpx 12rpx;
box-sizing: border-box;
}
.thead {
display: flex;
flex-wrap: nowrap;
}
.thead .th {
padding: 10rpx;
white-space: nowrap;
text-align: center;
box-sizing: border-box;
}
.primaryTextBtn {
color: #1989fa;
}
.tbody {
width: 100%;
}
.tbody .tr {
padding: 10rpx;
border-bottom: 1rpx solid #EEEEEE;
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.tbody .tr {
word-break: break-all;
text-align: center;
}
.more-icon {
padding: 20rpx;
color: #1989fa;
display: flex;
justify-content: center;
align-items: center;
}

View File

@@ -94,6 +94,7 @@ Page({
wx.openDocument({
filePath: res.tempFilePath,
fileType: [ "pdf"], // 3. 这个必须写合法类型,不然下载不了
showMenu: true,
success: function (res) {
resolve()
},

View File

@@ -11,7 +11,7 @@
border="{{ false }}"
/>
<van-field
value="{{detail.meter.code}}"
value="{{detail.meter.sn}}(SN)"
label="电表编号"
readonly
autosize="{{true}}"

View File

@@ -102,7 +102,6 @@ Page({
},
onChangePay(e) {
const { id, name } = e;
console.log('e', e)
const { year, codeId } = this.data;
this.setData({
payType: name,

View File

@@ -71,11 +71,9 @@ Page({
})
},
fail: (res) => {
console.log('fail', res)
alertInfo("请稍后重试")
},
complete: (res) => {
console.log('complete')
that.handleGetMeterDetail(meter.id)
}
})

View File

@@ -0,0 +1,74 @@
import { alertInfo, alertSuccess } from "../../../../../../utils/index";
import { createTenementWxUser } from "../../../../../../service/tenement";
import request from "../../../../../../utils/request"
const { OK } = request
// pages/workBench/components/account/components/editModal/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
type: String,
title: String,
visible: Boolean,
onCancel: Function,
park: String,
tenement: String,
parentPhone:String,
parentName:String,
parentId:String,
},
observers: {
"parentName,parentId,parentPhone": function(newName, newId, newPhone) {
this.setData({ data: { name: newName, id: newId, phone: newPhone } })
},
},
/**
* 组件的初始数据
*/
data: {
data: { name: "", phone: "", id: "" }
},
/**
* 组件的方法列表
*/
methods: {
async onSubmit() {
const { data = {}, tenement, park, type } = this.data;
if (!data.phone) {
alertInfo("请输入手机号")
return
}
if (!data.name) {
alertInfo("请输入昵称")
return
}
const { code, message } = await createTenementWxUser({ ...data, tenement, park })
if (code !== OK) {
alertInfo(message)
this.triggerEvent("cancel")
return;
}
alertSuccess("操作成功")
this.triggerEvent("ok")
this.setData({ data: {} })
return;
},
onChange(e) {
const { name } = e.currentTarget.dataset;
const newData = this.data.data;
newData[name] = e.detail;
this.setData({
data: newData,
})
},
onCancel() {
this.setData({ data: {} })
this.triggerEvent("cancel")
}
}
})

View File

@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"van-dialog": "@vant/weapp/dialog/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index"
}
}

View File

@@ -0,0 +1,34 @@
<!--pages/workBench/components/account/components/editModal/index.wxml-->
<van-dialog
use-slot
title="{{title}}"
show="{{ visible }}"
show-cancel-button
bind:confirm="onSubmit"
bind:cancel="onCancel"
>
<view class="modalContentWrapper">
<van-field
value="{{data.name}}"
label="昵称"
placeholder="请输入昵称"
type="textarea"
autosize="{{true}}"
title-width="120rpx"
border="{{false}}"
data-name="name"
bind:change="onChange"
/>
<van-field
value="{{ data.phone }}"
placeholder="请输入手机号"
label="手机号"
border="{{ false }}"
title-width="120rpx"
data-name="phone"
bind:change="onChange"
>
</van-field>
</view>
</van-dialog>

View File

@@ -0,0 +1 @@
/* pages/workBench/components/account/components/editModal/index.wxss */

View File

@@ -0,0 +1,68 @@
// pages/workBench/components/account/components/updatePhoneModa/index.js
import { alertInfo, alertSuccess } from "../../../../../../utils/index";
import { updateAdminPhone } from "../../../../../../service/tenement";
import request from "../../../../../../utils/request"
const { OK } = request
Component({
/**
* 组件的属性列表
*/
properties: {
type: String,
title: String,
visible: Boolean,
onCancel: Function,
park: String,
tenement: String,
parentPhone:String,
parentName:String,
parentId:String,
},
observers: {
"parentPhone": function (newPhone) {
this.setData({ phone: newPhone })
}
},
/**
* 组件的初始数据
*/
data: {
phone: "",
},
/**
* 组件的方法列表
*/
methods: {
async onSubmit() {
const { phone, tenement, park, type } = this.data;
if (!phone) {
alertInfo("请输入手机号")
return
}
const { code, message } = await updateAdminPhone({tenement, phone: phone })
if (code !== OK) {
alertInfo(message)
this.triggerEvent("cancel")
return;
}
alertSuccess("操作成功")
this.triggerEvent("ok")
this.setData({ phone: "" })
return;
},
onChange(e) {
this.setData({
phone: e.detail,
})
},
onCancel() {
this.setData({ phone: "" })
this.triggerEvent("cancel")
}
}
})

View File

@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"van-dialog": "@vant/weapp/dialog/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index"
}
}

View File

@@ -0,0 +1,23 @@
<!--pages/workBench/components/account/components/updatePhoneModa/index.wxml-->
<van-dialog
use-slot
title="编辑管理员手机号"
show="{{ visible }}"
show-cancel-button
bind:confirm="onSubmit"
bind:cancel="onCancel"
>
<view class="modalContentWrapper">
<van-field
value="{{ phone }}"
placeholder="请输入新管理员手机号"
label="手机号"
border="{{ false }}"
title-width="120rpx"
data-name="phone"
bind:change="onChange"
>
</van-field>
</view>
</van-dialog>

View File

@@ -0,0 +1 @@
/* pages/workBench/components/account/components/updatePhoneModa/index.wxss */

View File

@@ -0,0 +1,182 @@
// pages/workBench/components/account/index.js
import request from "../../../../utils/request"
import { getTenementBackInfo, updateUserApp} from "../../../../service/tenement"
import { getBackApproveList, removeUser } from "../../../../service/user"
import { alertInfo, alertSuccess, wxModal } from "../../../../utils/index"
const { OK } = request
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
list: [],
tenementInfo: {},
},
/**
* 组件的方法列表
*/
methods: {
onParkFocus(e) {
this.setData({
show: true,
title: "园区",
type: 'park'
})
},
onTenementFocus(e) {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
show: true,
title: "商户",
type: 'tenement'
})
},
onConfirm(e) {
const that = this;
const { type, data } = e.detail;
switch(type) {
case "park":
this.setData({
park: data.id,
parkName: data.name,
show: false,
})
break;
case "tenement":
this.setData({
tenement: data.id,
tenementName: data.name,
show: false,
}, () => {
that.initUserList();
that.getTenementInfo();
})
break;
}
},
async setAdmin(e) {
const { id, name } = e.currentTarget.dataset;
const { tenement } = this.data;
await wxModal({ content: `确认要将${name}设置为管理吗?` })
const { code, message } = await updateUserApp({ userId: id, type: 2, tenement: tenement })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("转交成功")
this.initUserList();
this.getTenementInfo();
},
onCancel() {
this.setData({
show: false,
})
},
handleDelete(e) {
const { id, name } = e.currentTarget.dataset;
const { tenement } = this.data;
const that = this;
wx.showModal({
title: '提示',
content: `确认要移除${name}吗?`,
complete: async (res) => {
if (res.cancel) {
}
if (res.confirm) {
const { code, message } = await removeUser(id, tenement)
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("删除成功")
that.initUserList();
}
}
})
},
onEditConfirm() {
this.initUserList()
this.handleCancel();
},
onUpdatePhoneConfirm() {
this.setData({ parentPhone: "", phone: "", type: "", title: "" })
this.getTenementInfo();
this.initUserList()
},
async getTenementInfo() {
const { tenement, park } = this.data;
const { code, message, tenement: data } = await getTenementBackInfo(park, tenement)
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
tenementInfo: data,
})
},
async initUserList() {
const { tenement } = this.data;
const { code, message, data } = await getBackApproveList(tenement, 1);
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
list: data,
})
},
handleAddSon() {
this.setData({
visible: true,
type: "add",
title: "新建子账号"
})
},
handleChangeMain() {
const { tenementInfo = {} } = this.data;
this.setData({
updatePhoneVisible: true,
type: "update",
title: "编辑管理员",
parentPhone: tenementInfo.phone,
// name: main.WechatUserName,
// id: main.WechatUserID,
})
},
handleUpdatePhoneCancel() {
this.setData({
updatePhoneVisible: false,
type: "",
phone: "",
parentPhone: "",
name: "",
id: "",
})
},
handleCancel() {
this.setData({
visible: false,
type: "",
phone: "",
name: "",
id: "",
})
}
}
})

View File

@@ -0,0 +1,21 @@
{
"component": true,
"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",
"edit-modal": "./components/editModal/index",
"updatePhoneModal": "./components/updatePhoneModal/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"searchSelectWrapper": "/components/searchSelectWrapper/index",
"van-image": "@vant/weapp/image/index"
}
}

View File

@@ -0,0 +1,142 @@
<!--pages/workBench/components/account/index.wxml-->
<view>
<searchSelectWrapper
label="园区"
placeholder="请选择园区"
text="{{ parkName }}"
bind:search="onParkFocus"
/>
<searchSelectWrapper
label="商户"
placeholder="请选择商户"
text="{{ tenementName }}"
bind:search="onTenementFocus"
/>
</view>
<van-empty wx:if="{{!tenement}}" description="选择园区和商户后查看" />
<view wx:else>
<view class="operateBox">
<van-button type="info" size="small" style="margin-right: 20rpx;" bind:click="handleAddSon"> 添加子账号 </van-button>
<van-button type="info" size="small" style="margin-right: 20rpx;" bind:click="handleChangeMain"> 修改主账号 </van-button>
</view>
<view class="customTable">
<view class="customTableTile">
<van-row>
<van-col span="24">
<view class="tableTitleRow">
<view class="tableTitleRow">
<view class="tbody">
<view class="tr">
<view class="th" style="width: 200rpx;text-align: center;"> {{tenementInfo.shortName}} </view>
<view> {{tenementInfo.fullName}} </view>
</view>
</view>
</view>
</view>
</van-col>
<van-col span="24">
<view class="tableTitleRow">
<view class="tbody">
<view class="tr">
<view
class="th"
style="width: 200rpx;text-align: center;"
wx:if="{{tenementInfo.feeType === 0}}"
> 华昌宝能收费 </view>
<view
class="th"
style="width: 200rpx;text-align: center;"
wx:if="{{tenementInfo.feeType === 1}}"
> 物业代收1 </view>
<view
class="th"
style="width: 200rpx;text-align: center;"
wx:if="{{tenementInfo.feeType === 2}}"
> 物业代收2 </view>
<view
class="th"
style="width: 200rpx;text-align: center;"
wx:if="{{tenementInfo.feeType === 3}}"
> 物业代收线损 </view>
<view style="margin-left: 26rpx;"> {{tenementInfo.contact}} {{tenementInfo.phone}} </view>
</view>
</view>
</view>
</van-col>
</van-row>
</view>
<view class="customTableContent">
<van-row wx:if="{{list.length}}">
<van-radio-group value="{{ record }}" bind:change="onChangeSelectRecharge">
<block wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
<view class="tbody">
<view class="tr tableRow">
<view class="th" style="width: 200rpx;border-right: 1rpx solid #ccc;"> {{ item.WechatUserName }} </view>
<view class="th" style="width: 250rpx;border-right: 1rpx solid #ccc;"> {{ item.WechatPhone }} </view>
<view class="th" style="display: flex;">
<view style="margin-left: 16rpx;">
<view wx:if="{{!item.Permissions}}" style="display: inline-block;">
<view
class="primaryTextBtn"
bind:tap="handleDelete"
data-id="{{item.WechatUserID}}"
data-name="{{item.WechatUserName}}"
>
<van-image width="40rpx" height="40rpx" src="/assets/images/stop.png" />
</view>
<view
class="primaryTextBtn"
bind:tap="setAdmin"
data-id="{{item.WechatUserID}}"
data-name="{{item.WechatUserName}}"
style="margin-left: 16rpx;"
>
<van-image width="40rpx" height="40rpx" src="/assets/images/tihuan.png" />
</view>
</view>
<van-tag type="primary" wx:else>管理员</van-tag>
</view>
</view>
</view>
</view>
</block>
</van-radio-group>
</van-row>
<empty wx:else bind:refresh="initUserList" />
</view>
</view>
</view>
<search-select
show="{{show}}"
title="{{title}}"
type="{{type}}"
park="{{park}}"
isBack="{{true}}"
bindconfirm="onConfirm"
bindcancel="onCancel"
/>
<edit-modal
visible="{{visible}}"
type="{{type}}"
title="{{title}}"
tenement="{{tenement}}"
park="{{park}}"
parentPhone="{{phone}}"
parentName="{{name}}"
parentId="{{id}}"
bind:ok="onEditConfirm"
bind:cancel="handleCancel"
/>
<updatePhoneModal
visible="{{updatePhoneVisible}}"
tenement="{{tenement}}"
park="{{park}}"
parentPhone="{{parentPhone}}"
bind:ok="onUpdatePhoneConfirm"
bind:cancel="handleUpdatePhoneCancel"
/>

View File

@@ -0,0 +1,71 @@
/* pages/workBench/components/account/index.wxss */
.operateBox {
margin: 20rpx;
}
.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;
}
.tr {
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.tbody .th {
word-break: break-all;
text-align: center;
}
.primaryTextBtn {
color: #1989fa;
display: inline-block;
}
.customTable {
margin: 20rpx;
font-size: 32rpx;
}
.customTableTile {
background-color: var(--light-green);
box-sizing: border-box;
}
.tableTitleRow {
padding: 16rpx;
font-weight: 700;
}
.tableRow {
padding: 16rpx;
border: 1rpx solid #ccc;
border-top: 0rpx;
}
page {
background-color: rgb(228,240,236);
font-size: 32rpx;
}

View File

@@ -1,179 +0,0 @@
// 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({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
keyword: "",
keywordTemp: "",
page: 1,
},
lifetimes: {
attached() {
this.init();
}
},
/**
* 组件的方法列表
*/
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) {
this.setData({
reason: e.detail,
})
},
onApproveClose() {
this.setData({
reason: "",
approveShow: false,
})
},
onApproveConfirm() {
const { reason, record } = this.data;
const that = this;
if (!reason) {
alertInfo("请输入拒绝理由")
return;
}
loadingFunc(async () => {
const { code, message } = await rechargeApprove({ id: record, status: 1, reason })
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
})
}
}
})

View File

@@ -1,114 +0,0 @@
<!--pages/workBench/components/approve/index.wxml-->
<!--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-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.money }} </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>
<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>

View File

@@ -1,45 +0,0 @@
/* 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;
}

View File

@@ -1,6 +1,6 @@
// pages/workBench/components/reading/index.js
import { getMeterReadingRouteList } from "../../../../service/workBench"
import { alertError, loadingFunc } from "../../../../utils/index"
import { getMeterReadingRouteList, changeMeterRouteStatus } from "../../../../service/workBench"
import { alertError, alertSuccess, loadingFunc } from "../../../../utils/index"
import request from "../../../../utils/request"
const { OK } = request
@@ -66,8 +66,32 @@ Component({
jumpToReading(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: '/pages/writeReading/index',
url: `/pages/writeReading/index?id=${id}`,
})
},
async changeStartStatus(e) {
const that = this;
const { id } = e.currentTarget.dataset;
const { code, message } = await changeMeterRouteStatus({ id, status: 1 })
if (code !== OK) {
alertError(message)
return
}
alertSuccess("操作成功")
this.init()
setTimeout(() => {
that.jumpToReading()
}, 500)
},
async changeEndStatus(e) {
const { id } = e.currentTarget.dataset;
const { code, message } = await changeMeterRouteStatus({ id, status: 0 })
if (code !== OK) {
alertError(message)
return
}
alertSuccess("操作成功")
this.init()
}
}
})

View File

@@ -28,11 +28,34 @@
<van-cell
wx:for="{{list}}"
wx:key="id"
title="路线1"
label="包含12个抄表点"
title="{{item.readingRouteName}}"
label="包含{{item.meterRoute}}个抄表点"
>
<view slot="right-icon">
<van-button type="primary" size="small" type="primary"> 去抄表 </van-button>
<van-button
type="primary"
size="small"
type="primary"
bind:tap="changeStartStatus"
custom-style="margin-right: 20rpx;"
data-id="{{item.id}}"
wx:if="{{item.status === 0}}"
> 开始抄表 </van-button>
<van-button
type="primary"
size="small"
bind:tap="jumpToReading"
data-id="{{item.id}}"
custom-style="margin-right: 20rpx;"
wx:if="{{item.status === 1}}"
> 去抄表 </van-button>
<van-button
size="small"
type="danger"
bind:tap="changeEndStatus"
data-id="{{item.id}}"
wx:if="{{item.status === 1}}"
> 结束抄表 </van-button>
</view>
</van-cell>
</view>

View File

@@ -0,0 +1,279 @@
// pages/workBench/components/recharge/components/waitApprove/index.js
import {
alertInfo,
alertSuccess,
loadingFunc
} from "../../../../../../utils/index";
import {
getRechargeApproveList,
rechargeApprove
} from "../../../../../../service/recharge"
import request from "../../../../../../utils/request"
import dayjs from "../../../../../../utils/dayjs"
const {
OK
} = request
// pages/workBench/components/record/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
status: Number
},
/**
* 组件的初始数据
*/
data: {
keyword: "",
keywordTemp: "",
page: 1,
currentActionSheet: null,
actionItems: [{
name: '查看详细',
value: 'detail'
}],
},
lifetimes: {
attached() {
loadingFunc(async () => {
await this.init();
})
}
},
/**
* 组件的方法列表
*/
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.onCancel();
},
onSearchKeyword(e) {
const that = this;
that.setData({
keyword: e.detail
}, () => {
loadingFunc(async () => {
await that.init();
})
})
},
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,
status
} = this.data;
const {
code,
message,
data,
total
} = await getRechargeApproveList({
park,
page,
keyword,
status
})
if (code !== OK) {
alertInfo(message);
return;
}
this.setData({
list: data.map(item => {
item.topTime = dayjs(item.topTime).format("MM-DD")
return item
}),
total: total,
totalPage: Math.ceil(total / 20)
})
},
onChangeReason(e) {
this.setData({
reason: e.detail,
})
},
onApproveClose() {
this.setData({
reason: "",
approveShow: false,
})
},
onApproveConfirm() {
const {
reason,
record
} = this.data;
const that = this;
if (!reason) {
alertInfo("请输入拒绝理由")
return;
}
loadingFunc(async () => {
const {
code,
message
} = await rechargeApprove({
id: record,
status: 1,
reason
})
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();
})
}
}
})
},
showActionMenu(e) {
this.setData({
currentActionSheet: e.currentTarget.dataset.id
});
},
hideActionMenu() {
this.setData({
currentActionSheet: null
});
},
onMenuSelect(e) {
const {
value
} = e.detail;
const id = e.currentTarget.dataset.id;
if (value === 'detail') {
this.jumpToDetail({
currentTarget: {
dataset: {
id
}
}
});
}
},
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();
})
})
},
onCancel() {
this.setData({
show: false,
title: "",
type: "",
})
},
onChangeSelectRecharge(e) {
this.setData({
record: e.detail
})
}
}
})

View File

@@ -10,6 +10,9 @@
"empty": "/components/empty/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-dialog": "@vant/weapp/dialog/index"
"van-dialog": "@vant/weapp/dialog/index",
"searchSelectWrapper": "/components/searchSelectWrapper/index",
"van-icon": "@vant/weapp/icon/index",
"van-action-sheet": "@vant/weapp/action-sheet/index"
}
}

View File

@@ -0,0 +1,66 @@
<!--pages/workBench/components/recharge/components/waitApprove/index.wxml-->
<searchSelectWrapper label="园区" placeholder="请选择园区" text="{{parkName}}" bind:search="onParkFocus" />
<searchSelectWrapper label="关键字" placeholder="请输入关键字" text="{{meterName}}" bind:searchKeyword="onSearchKeyword" type="inputSearch" />
<view>
<view wx:if="{{list.length}}">
<view class="operate" wx:if="{{status === 2}}">
<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 class="tableWrapper">
<view class="table">
<view class="thead">
<view class="th" style="flex: 0 0 80rpx; display: {{status === 2 ? 'block' : 'none'}};"> </view>
<!-- <view class="th" style="flex: 0 0 0rpx; display: {{status === 1 ? 'block' : 'none'}};"> </view> -->
<view class="th" style="flex: 0 0 130rpx;"> 商户名字</view>
<view class="th" style="flex: 0 0 150rpx;"> 充值金额 </view>
<view class="th" style="flex: 0 0 150rpx; display: {{status === 1 ? 'block' : 'none'}};">状态</view>
<view class="th" style="flex: 0 0 150rpx;">提交时间</view>
<view class="th"style="flex: 0 0 120rpx; justify-content: flex-end; display: flex; align-items: center;"> 操作 </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" style="display: flex; align-items: center; ">
<view class="th" style="flex: 0 0 80rpx; ; display: {{status === 2 ? 'block' : 'none'}};">
<van-radio wx:if="{{status === 2}}" name="{{item.id}}"></van-radio>
</view>
<view class="th" style="flex: 0 0 130rpx;">
{{ item.tenement.shortName }}
</view>
<view class="th" style="flex: 0 0 150rpx;">
{{ item.money }}
</view>
<view class="th" style="flex: 0 0 150rpx; display: {{status === 1 ? 'block' : 'none'}};">
<view class="tag">{{item.orderStatus}}</view>
</view>
<view class="th" style="flex: 0 0 150rpx; font-size: 30rpx;">
{{item.topTime}}
</view>
<view class="th" style="flex: 0 0 120rpx; justify-content: flex-end; display: flex; align-items: center;">
<van-icon name="ellipsis" size="24px" bind:tap="showActionMenu" data-id="{{item.id}}" class="more-icon" />
<van-action-sheet show="{{ currentActionSheet === item.id }}" actions="{{ actionItems }}" bind:close="hideActionMenu" bind:select="onMenuSelect" data-id="{{item.id}}" close-on-click-action />
</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>
<search-select show="{{show}}" title="{{title}}" type="{{type}}" park="{{park}}" bindconfirm="onConfirm" bindcancel="onCancel" />
<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>

View File

@@ -0,0 +1,70 @@
/* pages/workBench/components/recharge/components/waitApprove/index.wxss */
.table {
width: 500rpx;
}
.tableWrapper {
width: 100vw;
overflow-x: auto;
}
.thead {
display: flex;
flex-wrap: nowrap;
}
.thead .th {
padding: 10rpx;
white-space: nowrap;
text-align: center;
box-sizing: border-box;
}
.primaryTextBtn {
color: #1989fa;
}
.tbody {
width: 500rpx;
}
.tbody .tr {
padding: 10rpx;
border-bottom: 1rpx solid #EEEEEE;
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.tbody .tr {
word-break: break-all;
text-align: center;
}
.more-icon {
padding: 20rpx;
color: #1989fa;
display: flex;
justify-content: center;
align-items: center;
}
/* 基础标签样式 */
.tag {
display: inline-block;
padding: 4px 5px;
margin-right: 0px;
border-radius: 16px;
background: #07c160;
color: white;
font-size: 25rpx;
}
/* 激活状态样式 */
.tag.active {
background: #07c160;
color: white;
}

View File

@@ -0,0 +1,152 @@
// pages/workBench/components/recharge/components/reharge/index.js
import { handleRecharge } from "../../../../../../service/recharge";
import { alertInfo, alertSuccess, loadingFunc } from "../../../../../../utils/index";
import request from '../../../../../../utils/request'
const { OK } = request;
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
onParkFocus() {
this.setData({
show: true,
title: "园区",
type: 'park'
})
},
onMeterFocus() {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
show: true,
title: "电表",
type: 'meter'
})
},
onConfirm(e) {
const { data, type, way } = e.detail;
switch(type) {
case "park":
this.setData({
parkName: data.name,
park: data.id,
})
break;
case "meter":
this.setData({
meterName: `${data.meterNo}-${data.address}${data.tenement?.name ? '-' + data.tenement?.name : ''}`,
meter: data.id,
})
break;
case "pay":
this.setData({
payName: data,
way: way,
});
break;
}
this.onCancel();
},
onCancel() {
this.setData({
show: false,
title: "",
type: "",
})
},
onPayFocus() {
this.setData({
show: true,
title: "付款方式",
type: 'pay'
})
},
onChangeMoney(e) {
this.setData({ money: e.detail })
},
onChangeVoucherNo(e) {
this.setData({ voucherNo: e.detail })
},
handleClear() {
this.setData({
park: "",
parkName: "",
meter: "",
meterName: "",
way: "",
payName: "",
show: false,
title: "",
type: "",
money: null,
voucherNo: null
})
},
async handleSubmit() {
const that = this;
const { park, meter, money, way, voucherNo } = this.data;
if (!park) {
alertInfo("请选择园区");
return;
}
if (!meter) {
alertInfo("请选择电表")
return;
}
if (!money) {
alertInfo("请输入金额")
return
}
if (!way && way !== 0) {
alertInfo("请选择付款方式")
return
}
if (!voucherNo) {
alertInfo("请输入凭证号")
return
}
loadingFunc(async () => {
const { code, message } = await handleRecharge(park, {
amount: `${money || ''}`,
meter,
paymentType: way,
voucherNo,
type: 0
})
if (code !== OK) {
alertInfo(message)
return
}
alertSuccess("充值成功")
setTimeout(() => {
that.handleClear()
that.setData({
})
}, 500)
})
}
}
})

View File

@@ -0,0 +1,10 @@
{
"component": true,
"usingComponents": {
"van-popup": "@vant/weapp/popup/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index",
"searchSelectWrapper": "/components/searchSelectWrapper/index"
}
}

View File

@@ -0,0 +1,50 @@
<!--pages/workBench/components/recharge/components/reharge/index.wxml-->
<van-cell-group>
<searchSelectWrapper
label="园区"
placeholder="请选择园区"
text="{{parkName}}"
bind:search="onParkFocus"
/>
<searchSelectWrapper
label="电表"
placeholder="请选择电表"
text="{{meterName}}"
bind:search="onMeterFocus"
/>
<searchSelectWrapper
label="金额"
placeholder="请输入金额"
text="{{meterName}}"
fieldType="number"
type="input"
bind:changeText="onChangeMoney"
/>
<searchSelectWrapper
label="付款方式"
placeholder="请选择付款方式"
text="{{payName}}"
bind:search="onPayFocus"
/>
<searchSelectWrapper
label="凭证"
placeholder="请输入凭证"
type="input"
bind:changeText="onChangeVoucherNo"
/>
</van-cell-group>
<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 size="small" bind:click="handleClear"> 清空 </van-button>
</view>
<search-select
show="{{show}}"
title="{{title}}"
type="{{type}}"
park="{{park}}"
bindconfirm="onConfirm"
bindcancel="onCancel"
wx:if="{{show}}"
/>

View File

@@ -0,0 +1 @@
/* pages/workBench/components/recharge/components/reharge/index.wxss */

View File

@@ -1,8 +1,4 @@
import { handleRecharge } from "../../../../service/recharge";
import { alertInfo, alertSuccess, loadingFunc } from "../../../../utils/index";
import request from '../../../../utils/request'
const { OK } = request;
// pages/workBench/components/recharge/index.js
Component({
@@ -18,135 +14,20 @@ Component({
* 组件的初始数据
*/
data: {
show: false,
active: 0,
segmentedList: ['待审核', '已审核', '充值'],
},
/**
* 组件的方法列表
*/
methods: {
onParkFocus(e) {
changeQueryType(e) {
const { type } = e.currentTarget.dataset;
this.setData({
show: true,
title: "园区",
type: 'park'
active: type
})
},
onMeterFocus(e) {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
show: true,
title: "电表",
type: 'meter'
})
},
onConfirm(e) {
const { data, type, way } = e.detail;
switch(type) {
case "park":
this.setData({
parkName: data.name,
park: data.id,
})
break;
case "meter":
this.setData({
meterName: `${data.meterNo}-${data.address}${data.tenement?.name ? '-' + data.tenement?.name : ''}`,
meter: data.id,
})
break;
case "pay":
this.setData({
payName: data,
way: way,
});
break;
}
this.onConcal();
},
onConcal() {
this.setData({
show: false,
title: "",
type: "",
})
},
onPayFocus() {
this.setData({
show: true,
title: "付款方式",
type: 'pay'
})
},
onChangeMoney(e) {
this.setData({ money: e.detail })
},
onChangeVoucherNo(e) {
this.setData({ voucherNo: e.detail })
},
handleClear() {
this.setData({
park: "",
parkName: "",
meter: "",
meterName: "",
way: "",
payName: "",
show: false,
title: "",
type: "",
money: null,
voucherNo: null
})
},
async handleSubmit() {
const that = this;
const { park, meter, money, way, voucherNo } = this.data;
if (!park) {
alertInfo("请选择园区");
return;
}
if (!meter) {
alertInfo("请选择电表")
return;
}
if (!money) {
alertInfo("请输入金额")
return
}
if (!way && way !== 0) {
alertInfo("请选择付款方式")
return
}
if (!voucherNo) {
alertInfo("请输入凭证号")
return
}
loadingFunc(async () => {
const { code, message } = await handleRecharge(park, {
amount: `${money || ''}`,
meter,
paymentType: way,
voucherNo,
type: 0
})
if (code !== OK) {
alertInfo(message)
return
}
alertSuccess("充值成功")
setTimeout(() => {
that.handleClear()
that.setData({
})
}, 500)
})
}
}
})

View File

@@ -1,9 +1,11 @@
{
"component": true,
"usingComponents": {
"van-popup": "@vant/weapp/popup/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
"van-button": "@vant/weapp/button/index",
"segmented": "/components/Segmented/index",
"recharge": "./components/reharge/index",
"approve": "./components/approve/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index"
}
}

View File

@@ -1,81 +1,20 @@
<!--pages/workBench/components/recharge/index.wxml-->
<van-cell-group>
<van-field
value="{{ parkName }}"
placeholder="请选择园区"
label="园区"
readonly
border="{{ false }}"
use-button-slot
title-width="70rpx"
>
<van-button slot="button" size="small" type="primary" bind:click="onParkFocus">
选择
</van-button>
</van-field>
<van-field
value="{{ meterName }}"
placeholder="请选择电表"
label="电表"
readonly
border="{{ false }}"
use-button-slot
title-width="70rpx"
>
<van-button slot="button" size="small" type="primary" bind:click="onMeterFocus">
选择
</van-button>
</van-field>
<van-field
value="{{ money }}"
placeholder="请输入金额"
label="金额"
type="number"
border="{{ false }}"
use-button-slot
title-width="70rpx"
bind:change="onChangeMoney"
>
</van-field>
<van-field
value="{{ payName }}"
placeholder="请选择付款方式"
label="付款方式"
readonly
border="{{ false }}"
use-button-slot
title-width="140rpx"
>
<van-button
slot="button"
size="small"
type="primary"
bind:click="onPayFocus"
>
选择
</van-button>
</van-field>
<van-field
value="{{ voucherNo }}"
placeholder="请输入凭证"
label="凭证"
border="{{ false }}"
use-button-slot
title-width="70rpx"
bind:change="onChangeVoucherNo"
/>
</van-cell-group>
<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 size="small" bind:click="handleClear"> 清空 </van-button>
<view style="">
<view class="typeQuery">
<van-row>
<van-col span="8">
<view class="typeQueryText" style="color: {{active === 0 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{0}}"> 待审核 </view>
</van-col>
<van-col span="8">
<view class="typeQueryText" style="color: {{active === 1 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{1}}"> 已审核 </view>
</van-col>
<van-col span="8">
<view class="typeQueryText" style="color: {{active === 2 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{2}}"> 充值 </view>
</van-col>
</van-row>
</view>
</view>
<search-select
show="{{show}}"
title="{{title}}"
type="{{type}}"
park="{{park}}"
bindconfirm="onConfirm"
bindcancel="onConcal"
wx:if="{{show}}"
/>
<approve status="{{2}}" wx:if="{{active === 0}}" />
<approve status="{{1}}" wx:if="{{active === 1}}" />
<recharge wx:if="{{active === 2}}" />

View File

@@ -1 +1,27 @@
/* pages/workBench/components/recharge/index.wxss */
/* pages/workBench/components/recharge/index.wxss */
page {
background-color: rgb(228,240,236);
font-size: 32rpx;
}
.query {
margin: 20rpx 0rpx;
}
.typeQueryText {
text-align: center;
padding: 20rpx;
background-color: var(--light-green);
font-size: 32rpx;
}
.select {
border: 1rpx solid #ccc;
padding: 12rpx;
border-radius: 12rpx;
flex: 1;
display: flex;
justify-content: space-between;
font-size: 30rpx;
}

View File

@@ -33,18 +33,41 @@ Component({
type: 'park'
})
},
onConfirm(e) {
const { data } = e.detail;
const that = this;
onMeterFocus(e) {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
parkName: data.name,
park: data.id,
}, () => {
loadingFunc(async () => {
await that.init();
})
show: true,
title: "电表",
type: 'meter'
})
this.onConcal();
},
onConfirm(e) {
const { data, type } = e.detail;
const that = this;
switch(type) {
case "park":
this.setData({
parkName: data.name,
park: data.id,
})
break;
case "meter":
this.setData({
meterName: data.address,
meter: data.id,
}, () => {
loadingFunc(async () => {
await that.init();
})
})
break;
}
this.onCancel();
},
onChangeKeyword(e) {
this.setData({ keywordTemp: e.detail })
@@ -60,11 +83,11 @@ Component({
})
},
async init() {
const { page, keyword, park } = this.data;
const { page, park, meter } = this.data;
if (!park) {
return;
}
const { code, message, data, total } = await getParkMeterList({ park, keyword, page })
const { code, message, data, total } = await getParkMeterList({ park, keyword: meter, page })
if (code !== OK) {
alertInfo(message);
return;
@@ -86,7 +109,7 @@ Component({
})
})
},
onConcal() {
onCancel() {
this.setData({
show: false,
title: "",
@@ -100,11 +123,10 @@ Component({
},
async handleMeterSwitchOn() {
const that = this;
const { meter, list } = this.data;
const item = list.find(ele => ele.id === meter)
const { meter, meterName } = this.data;
wx.showModal({
title: '提示',
content: `您确认要对${item?.address || 当前电表}进行合闸吗?`,
content: `您确认要对${meterName || 当前电表}进行合闸吗?`,
complete: async (res) => {
if (res.cancel) {
@@ -127,11 +149,10 @@ Component({
},
async handleMeterSwitchOff() {
const that = this;
const { meter, list } = this.data;
const item = list.find(ele => ele.id === meter)
const { meter, meterName } = this.data;
wx.showModal({
title: '提示',
content: `您确认要对${item?.address || 当前电表}进行拉闸吗?`,
content: `您确认要对${meterName || 当前电表}进行拉闸吗?`,
complete: async (res) => {
if (res.cancel) {
return;

View File

@@ -10,6 +10,9 @@
"empty": "/components/empty/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-tag": "@vant/weapp/tag/index"
"van-tag": "@vant/weapp/tag/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"searchSelectWrapper": "/components/searchSelectWrapper/index"
}
}

View File

@@ -1,84 +1,22 @@
<!--pages/workBench/components/record/index.wxml-->
<van-field
value="{{ parkName }}"
<searchSelectWrapper
label="园区"
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>
text="{{parkName}}"
bind:search="onParkFocus"
/>
<van-empty wx:if="{{!park}}" description="选择园区后查看" />
<searchSelectWrapper
label="电表"
placeholder="请选择电表"
text="{{meterName}}"
bind:search="onMeterFocus"
/>
<van-empty wx:if="{{!meter}}" 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 wx:if="{{list.length}}">
<view class="operate">
<view style="margin-top: 60rpx; margin-bottom: 60rpx;display: flex; justify-content: center; align-items: center;">
<view style="margin-top: 24rpx; margin-bottom: 24rpx;display: flex; justify-content: center; align-items: center;">
<van-button
type="info"
size="small"
@@ -88,8 +26,68 @@
> 合闸 </van-button>
<van-button size="small" bind:click="handleClear" disabled="{{!meter}}" bind:click="handleMeterSwitchOff"> 拉闸 </van-button>
</view>
</view>
<view class="customTable" wx:for="{{list}}" wx:key="id">
<view class="customTableTile">
<van-row>
<van-col span="8">
<view style="text-align: center;"> {{item.tenement.shortName}} </view>
</van-col>
<van-col span="16"><view style="margin-left: 16rpx;">{{item.tenement.name}}</view> </van-col>
</van-row>
</view>
<view class="customTableContent">
<van-row >
<van-col span="24">
<view class="tableRow">
<van-row gutter="5">
<van-col span="8" wx:if="{{item.type === 0}}">
<view style="text-align: center;border-right: 1rpx solid #ccc;"> 商户电表 </view></van-col>
<van-col span="8" wx:elif="{{item.type === 2}}">
<view style="text-align: center;border-right: 1rpx solid #ccc;"> 公摊电表 </view></van-col>
<van-col span="8" wx:else>
<view style="text-align: center;border-right: 1rpx solid #ccc;"> 园区电表 </view></van-col>
<van-col span="16">表号:{{item.meterNo}}</van-col>
</van-row>
</view>
</van-col>
<van-col span="24">
<view class="tableRow">
<van-row gutter="5">
<van-col span="8">
<view style="text-align: center;border-right: 1rpx solid #ccc;"> {{item.address}} </view>
</van-col>
<van-col span="16">SN{{item.meterSn}}</van-col>
</van-row>
</view>
</van-col>
<van-col span="24">
<view class="tableRow">
<van-row gutter="5">
<van-col span="8">
<view style="text-align: center;border-right: 1rpx solid #ccc;"> 表字:{{item.amount}} </view>
</van-col>
<van-col span="16">余额:{{item.money}}</van-col>
</van-row>
</view>
</van-col>
<van-col span="24">
<view class="tableRow">
<van-row gutter="5">
<van-col span="8" wx:if="{{item.onPosition === 0}}">
<view style="text-align: center;border-right: 1rpx solid #ccc;">合闸</view> </van-col>
<van-col span="8" wx:else><view style="text-align: center;border-right: 1rpx solid #ccc;">拉闸</view> </van-col>
<van-col span="8" wx:if="{{item.canConnect}}"><view style="text-align: center;">在线</view> </van-col>
<van-col span="8" wx:else><view style="text-align: center;">失联</view> </van-col>
</van-row>
</view>
</van-col>
</van-row>
</view>
</view>
</view>
<empty bind:refresh="init" wx:else />
</view>
<search-select
@@ -98,6 +96,6 @@
type="{{type}}"
park="{{park}}"
bindconfirm="onConfirm"
bindcancel="onConcal"
bindcancel="onCancel"
wx:if="{{show}}"
/>

View File

@@ -39,3 +39,25 @@
word-break: break-all;
text-align: center;
}
.customTable {
margin: 20rpx;
}
.customTableTile {
background-color: var(--light-green);
padding: 16rpx;
box-sizing: border-box;
font-weight: 700;
}
.tableRow {
padding: 16rpx;
border: 1rpx solid #ccc;
border-top: 0rpx;
}
page {
background-color: rgb(228,240,236);
font-size: 32rpx;
}

View File

@@ -0,0 +1,122 @@
// pages/workBench/components/tenement/components/bindMeter/index.js
// 0015980101
import { bindMeter, } from "../../../../../../service/tenement"
import { getWorkMeterDetail } from "../../../../../../service/meter"
import { alertInfo, alertSuccess } from "../../../../../../utils/index";
import request from "../../../../../../utils/request"
import dayjs from "../../../../../../utils/dayjs"
const { OK } = request
Component({
/**
* 组件的属性列表
*/
properties: {
tenement: String,
tenementName: String,
park: String,
visible: Boolean,
meterId: String,
},
/**
* 组件的初始数据
*/
data: {
dateTimeShow: false,
},
/**
* 组件的方法列表
*/
methods: {
onMeterFocus(e) {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
show: true,
title: "电表",
type: 'meter'
})
},
onCancel() {
this.setData({
show: false,
title: "",
type: "",
})
// this.triggerEvent("close")
},
onClose() {
this.setData({
show: false,
title: "",
type: "",
})
},
onChange(e) {
const { name } = e.currentTarget.dataset;
this.setData({
[name]: e.detail
})
},
async onSubmit() {
const { overall, critical, peak, valley, park, tenement, meter, readAt } = this.data;
const { code, message } = await bindMeter(
park,
tenement,
{
code: meter,
overall:overall? Number(overall) : overall,
critical : critical ? Number(critical) : critical,
peak: peak ? Number(peak) : peak,
valley : valley ? Number(valley) : valley,
readAt: readAt || dayjs().format('YYYY-MM-DD HH:mm:ss')
}
)
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("绑定成功")
this.triggerEvent("ok")
},
onConfirm(e) {
const { type, data } = e.detail;
const that = this;
switch(type) {
case "meter":
this.setData({
meter: data.id,
meterName: data.address,
show: false,
})
this.getMeterDetail(data.id);
break;
}
},
async getMeterDetail(id) {
const { code, message, data } = await getWorkMeterDetail(id)
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
overall: Number(data?.overall || 0),
status: data?.breakType ? '合闸' : "分闸"
})
},
dateTimeConfirm(e) {
this.setData({ readAt: e.detail.time, dateTimeShow: false })
},
dateTimeCancal(e) {
this.setData({ dateTimeShow: false })
},
onTimeFocus() {
this.setData({ dateTimeShow: true })
}
}
})

View File

@@ -0,0 +1,10 @@
{
"component": true,
"usingComponents": {
"van-dialog": "@vant/weapp/dialog/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index",
"date-time-picker": "/components/DateTimePicker/index"
}
}

View File

@@ -0,0 +1,121 @@
<!--pages/workBench/components/tenement/components/bindMeter/index.wxml-->
<van-dialog
use-slot
title="绑定表计"
show="{{ visible }}"
show-cancel-button
bind:confirm="onSubmit"
bind:close="onClose"
>
<view class="modalContentWrapper">
<van-field
value="{{tenementName}}"
label="商户名称"
readonly
type="textarea"
autosize="{{true}}"
title-width="132rpx"
border="{{false}}"
/>
<van-field
value="{{ meterName }}"
placeholder="请选择电表"
label="电表"
readonly
border="{{ false }}"
use-button-slot
title-width="100rpx"
>
<van-button slot="button" size="small" type="info" bind:click="onMeterFocus">
选择
</van-button>
</van-field>
<van-field
value="{{ status }}"
label="状态"
title-width="132rpx"
border="{{false}}"
readonly
type="digit"
/>
<van-field
value="{{ readAt }}"
placeholder="请选择绑定时间"
label="时间"
readonly
border="{{ false }}"
use-button-slot
title-width="100rpx"
>
<van-button slot="button" size="small" type="info" bind:click="onTimeFocus">
选择
</van-button>
</van-field>
<van-field
value="{{ overall }}"
label="表字"
title-width="132rpx"
border="{{false}}"
bind:change="onChange"
data-name="overall"
placeholder="请输入表字"
type="digit"
/>
<van-field
value="{{ critical }}"
label="尖"
title-width="132rpx"
border="{{false}}"
bind:change="onChange"
data-name="critical"
placeholder="请输入有功(尖)"
type="digit"
/>
<van-field
value="{{ peak }}"
label="峰"
title-width="132rpx"
border="{{false}}"
bind:change="onChange"
data-name="peak"
placeholder="请输入有功(峰)"
type="digit"
/>
<van-field
value="{{ overall }}"
label="平"
title-width="132rpx"
border="{{false}}"
bind:change="onChange"
data-name="overall"
placeholder="请输入有功(平)"
type="digit"
/>
<van-field
value="{{ valley }}"
label="谷"
title-width="132rpx"
border="{{false}}"
bind:change="onChange"
data-name="valley"
type="digit"
placeholder="请输入有功(谷)"
/>
</view>
</van-dialog>
<search-select
show="{{show}}"
title="{{title}}"
type="{{type}}"
park="{{park}}"
bindconfirm="onConfirm"
bindcancel="onCancel"
/>
<date-time-picker
show="{{dateTimeShow}}"
bind:confirm="dateTimeConfirm"
bind:cancel="dateTimeCancal"
/>

View File

@@ -0,0 +1 @@
/* pages/workBench/components/tenement/components/bindMeter/index.wxss */

View File

@@ -0,0 +1,103 @@
// pages/workBench/components/tenement/components/createTenement/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData(options)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
onBuildingFocus() {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
show: true,
title: "建筑",
type: 'building'
})
},
onFeeTypeFocus() {
const { park } = this.data;
if (!park) {
alertInfo("请先选择园区")
return;
}
this.setData({
show: true,
title: "建筑",
type: 'building'
})
},
beforeBack() {
let pages = getCurrentPages(); // 获取当前页面栈
let prevPage = pages[pages.length - 2]; // 获取上一页
const { tenement = '', tenementName = '', park = '', parkName = '' } = this.data;
// 修改上一页的数据
prevPage.setData({
needBackShow: true,
tenement,
tenementName,
park,
parkName
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,8 @@
{
"usingComponents": {
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index",
"navigator": "/components/navigator/index"
}
}

Some files were not shown because too many files have changed in this diff Show More