提交工作台和首页的更改

This commit is contained in:
qiaomu 2025-07-16 17:33:15 +08:00
parent 7bd4da3c84
commit ac0a4b02c7
25 changed files with 368 additions and 29 deletions

View File

@ -33,7 +33,8 @@
"pages/integralRecord/index",
"pages/meterList/index",
"pages/workBench/components/tenement/components/createTenement/index",
"pages/billMeterDetail/index"
"pages/billMeterDetail/index",
"pages/meterBalanceRecord/index"
],
"subPackages": [
{

View File

@ -0,0 +1,37 @@
// components/datePicker/index.js
import dayjs from "../../utils/dayjs"
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
},
/**
* 组件的初始数据
*/
data: {
currentDate: new Date().getTime(),
maxDate: new Date().getTime(),
minDate: new Date(2024, 1, 1).getTime(),
},
lifetimes: {
attached() {
console.log("attached", this.data.show)
}
},
/**
* 组件的方法列表
*/
methods: {
onCancel() {
this.triggerEvent("cancel")
},
onConfirm(e) {
this.triggerEvent("confirm", { time: dayjs(e.detail).format("YYYY-MM-DD HH:mm:ss") })
}
}
})

View File

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"van-popup": "@vant/weapp/popup/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
}
}

View File

@ -0,0 +1,18 @@
<!--components/datePicker/index.wxml-->
<van-popup
show="{{ show }}"
position="bottom"
bind:close="onClose"
z-index="10000"
>
<van-datetime-picker
type="datetime"
value="{{ currentDate }}"
min-date="{{ minDate }}"
max-date="{{ maxDate }}"
bind:confirm="onConfirm"
bind:cancel="onCancel"
/>
</van-popup>

View File

@ -0,0 +1 @@
/* components/datePicker/index.wxss */

View File

@ -23,6 +23,7 @@ Component({
year: String,
month: Number,
day: Number,
currentDate: Number,
},
/**
* 组件的初始数据

View File

@ -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({

View File

@ -60,7 +60,12 @@
<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>
<!-- bind:click="refreshMeter" -->
<van-button

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;

View File

@ -0,0 +1,98 @@
import dayjs from "../../utils/dayjs"
// pages/meterBalanceRecord/index.js
Page({
/**
* 页面的初始数据
*/
data: {
time: "",
timeStamp: undefined,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { id } = options
console.log("id---", id)
this.setData({
id,
time: dayjs().format("YYYY-MM"),
timeStamp: Date.now()
})
},
clickTime() {
this.setData({
timeVisible: true
})
},
onTimeConfirm(e) {
console.log('e', e)
const { time } = e.detail;
this.setData({
time,
timeStamp: new Date(time).getTime(),
timeVisible: false,
})
},
onTimeCancel() {
this.setData({
timeVisible: false,
})
},
onTimeClose() {
this.setData({
timeVisible: false,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,8 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"timePicker": "/components/timePicker/index",
"van-icon": "@vant/weapp/icon/index"
},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,22 @@
<!--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>
<timePicker
type="month"
currentDate="{{timeStamp}}"
show="{{timeVisible}}"
bind:cancel="onTimeCancel"
bind:close="onTimeClose"
bind:confirm="onTimeConfirm"
/>

View File

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

View File

@ -144,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

@ -69,6 +69,7 @@
/>
</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">
@ -87,5 +88,19 @@
<van-cell title="退出登录" icon="revoke" value="" is-link bind:tap="logout" />
</view>
<van-dialog id="van-dialog" />
<!-- <van-dialog id="van-dialog" /> -->
</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

@ -23,7 +23,7 @@ Component({
* 组件的初始数据
*/
data: {
dateTimeShow: false,
},
/**
@ -64,11 +64,19 @@ Component({
})
},
async onSubmit() {
const { overall, critical, peak, valley, park, tenement, meter } = 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: dayjs().format('YYYY-MM-DD HH:mm:ss') })
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;
@ -101,6 +109,15 @@ Component({
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

@ -4,6 +4,7 @@
"van-dialog": "@vant/weapp/dialog/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
"van-button": "@vant/weapp/button/index",
"date-time-picker": "/components/DateTimePicker/index"
}
}

View File

@ -38,6 +38,19 @@
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="表字"
@ -100,3 +113,9 @@
bindconfirm="onConfirm"
bindcancel="onCancel"
/>
<date-time-picker
show="{{dateTimeShow}}"
bind:confirm="dateTimeConfirm"
bind:cancel="dateTimeCancal"
/>

View File

@ -5,6 +5,7 @@ import request from "../../../../../../utils/request"
import { alertInfo, alertSuccess } from "../../../../../../utils/index";
const { OK } = request
import { getWorkMeterDetail } from "../../../../../../service/meter"
import dayjs from "../../../../../../utils/dayjs"
Component({
@ -28,7 +29,7 @@ Component({
* 组件的初始数据
*/
data: {
dateTimeShow: false
},
/**
@ -68,13 +69,17 @@ Component({
})
},
async onSubmit() {
const { overall, critical, peak, valley, park, tenement, meterId } = this.data;
const { code, message, } = await unbindMeter(park, tenement, meterId,
const { overall, critical, peak, valley, park, tenement, meterId,readAt } = this.data;
const { code, message, } = await unbindMeter(
park,
tenement,
meterId,
{
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)
@ -82,6 +87,15 @@ Component({
}
alertSuccess("解绑成功")
this.triggerEvent("ok")
},
dateTimeConfirm(e) {
this.setData({ readAt: e.detail.time, dateTimeShow: false })
},
dateTimeCancal(e) {
this.setData({ dateTimeShow: false })
},
onTimeFocus() {
this.setData({ dateTimeShow: true })
}
}
})

View File

@ -3,6 +3,8 @@
"usingComponents": {
"van-dialog": "@vant/weapp/dialog/index",
"search-select": "/components/searchSelect/index",
"van-field": "@vant/weapp/field/index"
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index",
"date-time-picker": "/components/DateTimePicker/index"
}
}

View File

@ -26,6 +26,19 @@
title-width="132rpx"
border="{{false}}"
/>
<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="表字"
@ -79,3 +92,9 @@
</view>
</van-dialog>
<date-time-picker
show="{{dateTimeShow}}"
bind:confirm="dateTimeConfirm"
bind:cancel="dateTimeCancal"
/>

View File

@ -183,6 +183,9 @@ Component({
bindVisible: false,
})
this.getTenementMeters();
},
onTimeConfirm(e) {
console.log('e', e)
}
}
})

View File

@ -45,8 +45,8 @@ export function getConfigByEnv() {
switch (envVersion) {
// 开发版
case 'develop':
// api = "http://localhost:8000"
api = "https://zgd.hbhcbn.com/api3"
api = "http://localhost:8000"
// api = "https://zgd.hbhcbn.com/api3"
// api = "https://zgd.hbhcbn.com/wxApi"
// api = "http://127.0.0.1:4523/m1/4143821-0-default"
break;