diff --git a/app.js b/app.js index 4d26e1f..e590e9d 100644 --- a/app.js +++ b/app.js @@ -1,11 +1,29 @@ import { checkUpgrade, getConfigByEnv } from "./utils/index" -// app.js +function share() { + wx.onAppRoute(function(res) { + const pages = getCurrentPages() + const view = pages[pages.length - 1]; + if (view) { + wx.showShareMenu() + view.onShareAppMessage = () => { + return { + title: "", + path: "/pages/home/index", + imageUrl: "/assets/images/share.png" + } + } + } + + }) +} + App({ onShow() { checkUpgrade(); }, onLaunch() { + share() const { api } = getConfigByEnv(); this.globalData = { ...this.globalData, api, } }, diff --git a/app.json b/app.json index 396bd3f..78684f3 100644 --- a/app.json +++ b/app.json @@ -29,7 +29,14 @@ "pages/aid/detail/index", "pages/aid/consult/index", "pages/writeReading/index", - "pages/readingHistory/index" + "pages/readingHistory/index", + "pages/integral/index", + "pages/discountCoupon/index", + "pages/integralRecord/index", + "pages/meterList/index", + "pages/workBench/components/tenement/components/createTenement/index", + "pages/billMeterDetail/index", + "pages/meterBalanceRecord/index" ], "subPackages": [ { diff --git a/assets/images/baike.png b/assets/images/baike.png new file mode 100644 index 0000000..b82e5b6 Binary files /dev/null and b/assets/images/baike.png differ diff --git a/assets/images/finance.png b/assets/images/finance.png new file mode 100644 index 0000000..653aaa1 Binary files /dev/null and b/assets/images/finance.png differ diff --git a/assets/images/law.png b/assets/images/law.png new file mode 100644 index 0000000..ca9bed4 Binary files /dev/null and b/assets/images/law.png differ diff --git a/assets/images/share.png b/assets/images/share.png new file mode 100644 index 0000000..14ac491 Binary files /dev/null and b/assets/images/share.png differ diff --git a/assets/images/stop.png b/assets/images/stop.png new file mode 100644 index 0000000..6744048 Binary files /dev/null and b/assets/images/stop.png differ diff --git a/assets/images/tihuan.png b/assets/images/tihuan.png new file mode 100644 index 0000000..77b8f47 Binary files /dev/null and b/assets/images/tihuan.png differ diff --git a/childPackage/pages/billDetail/index.js b/childPackage/pages/billDetail/index.js index 91ac35b..a6105ff 100644 --- a/childPackage/pages/billDetail/index.js +++ b/childPackage/pages/billDetail/index.js @@ -1,9 +1,12 @@ import { getReportDetail } from "../../../service/report"; -import { alertInfo, alertSuccess, getPixelRatio } from "../../../utils/index"; +import { alertInfo, alertSuccess, getPixelRatio, loadingFunc } from "../../../utils/index"; import request from '../../../utils/request' import * as echarts from '../../components/echarts/echarts'; +import { getRoundNumber } from "../../../utils/index" const { OK } = request + + // pages/billDetail/index.js Page({ @@ -15,31 +18,34 @@ Page({ time: "", detail: {}, meters: [], - header1: [ - { key: 'address', title: '电表地址' }, - { title: '起码',renderBody: (item) => { return item?.startNumber } }, - { title: '止码',renderBody: (item) => { return item?.endNumber } }, - { title: '倍率',renderBody: (item) => { return item?.displayRatio } }, - ], - header2: [ - { title: '用电量', renderBody: (item) => item?.overall?.amount }, - { title: '线损电量',renderBody: (item) => item?.loss?.amount }, - { title: '公摊电量',renderBody: (item) => item?.publicAmount }, - { title: '合计电量',renderBody: (item) => { + // header1: [ + // { key: 'address', title: '电表地址' }, + // { title: '起码',renderBody: (item) => { return item?.startNumber } }, + // { title: '止码',renderBody: (item) => { return item?.endNumber } }, + // { title: '倍率',renderBody: (item) => { return item?.displayRatio } }, + // ], + // header2: [ + // { title: '用电量', renderBody: (item) => item?.overall?.amount }, + // { title: '线损电量',renderBody: (item) => item?.loss?.amount }, + // { title: '公摊电量',renderBody: (item) => item?.publicAmount }, + // { title: '合计电量',renderBody: (item) => { - } }, - ] + // } }, + // ] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - const { id, time } = options; - this.init(id, time); + const { id, time, tenement } = options; + const that = this; + loadingFunc(async () => { + await that.init(id, time, tenement); + }) }, - async init(id, time) { - const { code, message, detail, amount } = await getReportDetail(id) + async init(id, time, tenement) { + const { code, message, detail, amount } = await getReportDetail(id, tenement) if (code !== OK) { alertInfo(message) return; @@ -50,45 +56,92 @@ Page({ detail, amount: amount, meters: detail?.meters?.map(item => { - const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0) - item.finalAmount = Number(finalAmount).toFixed(2) + if (item?.loss?.amount) { + item.loss.amount = getRoundNumber(Number(item.loss.amount)) + } + // const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0) + item.finalAmount = getRoundNumber(Number(item.finalAmount)) return item; }) }) - const option = { - tooltip: { - trigger: 'item' - }, - legend: { - top: 10, - left: 'center' - }, - label: { - alignTo: 'edge', - formatter: '{name|{b}}\n{value|{c} }', - minMargin: 5, - edgeDistance: 10, - lineHeight: 15, - rich: { - time: { - fontSize: 10, - color: '#999' + if (detail?.park?.meter04kvType === 0) { + const option = { + tooltip: { + trigger: 'item' + }, + legend: { + top: 10, + left: 'center' + }, + label: { + alignTo: 'edge', + formatter: '{name|{b}}\n{value|{c} }', + minMargin: 5, + edgeDistance: 10, + lineHeight: 15, + rich: { + time: { + fontSize: 10, + color: '#999' + } } - } - }, - series: [ - { - type: 'pie', - radius: '50%', - data: [ - { value: detail.comprehensive.lossAmount, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } }, - { value: detail.comprehensive.consumption, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } }, - - ], - } - ] - }; - this.init_pieCharts(option); + }, + series: [ + { + type: 'pie', + radius: '50%', + data: [ + { value: detail.comprehensive.lossAmount, name: '线损电量', itemStyle: { color: 'rgb(104,187,196)' } }, + { value: detail.comprehensive.consumption, name: '电度电量', itemStyle: { color: 'rgb(80,135,236)' } }, + + ], + } + ] + }; + this.init_pieCharts(option); + } else { + // const option = { + // tooltip: { + // trigger: 'item' + // }, + // legend: { + // top: 10, + // left: 'center' + // }, + // label: { + // alignTo: 'edge', + // formatter: '{name|{b}}\n{value|{c} }', + // minMargin: 5, + // edgeDistance: 10, + // lineHeight: 15, + // rich: { + // time: { + // fontSize: 10, + // color: '#999' + // } + // } + // }, + // series: [ + // { + // type: 'pie', + // radius: '50%', + // data: [ + // { + // value: detail.comprehensive.lossAmount, + // name: '线损电量', + // }, + // { + // value: detail.comprehensive.consumption, + // name: '电度电量', + // }, + + // ], + // } + // ] + // }; + // this.init_pieCharts(option); + } + const that = this; wx.getSystemInfo({ success: function (res) { @@ -115,6 +168,12 @@ Page({ return pieChart; }); }, + jumpToDetail(e) { + const { meter } = e.currentTarget.dataset; + wx.navigateTo({ + url: '/pages/billMeterDetail/index?data=' + JSON.stringify(meter), + }) + }, download() { const { id: tenement } = wx.getStorageSync('tenement') const { id } = this.data; diff --git a/childPackage/pages/billDetail/index.wxml b/childPackage/pages/billDetail/index.wxml index 4cfc7fe..443e46a 100644 --- a/childPackage/pages/billDetail/index.wxml +++ b/childPackage/pages/billDetail/index.wxml @@ -1,7 +1,7 @@ - + @@ -11,7 +11,7 @@ - 用电地址: + 商户地址: {{ detail.tenement.address }} @@ -19,20 +19,20 @@ 账单周期: - {{ detail.comprehensive.startDate }} 至 {{ detail.comprehensive.endDate }} + {{ detail.comprehensive.startDate }} 至 {{ detail.comprehensive.endDate }} 下载 - + 本期账单 本期用电量 - {{ amount }} 千瓦时 + {{ amount }} 千瓦时 @@ -50,17 +50,10 @@ 电费构成 - + - (本月电量+本月线损电量)*电单价+摊薄公摊电费+摊薄调整电费 + (电度电量+线损电量)*电单价+摊薄公摊电费+摊薄调整电费 电量明细 @@ -86,7 +79,7 @@ - 用电量 + 电度电量 {{item.overall.amount}} @@ -106,4 +99,97 @@ + + + 本期账单 + + + + 本期用电量 + {{ detail.comprehensive.finalAmount }} 千瓦时 + + + + + 本期电费 + {{ detail.comprehensive.total }} 元 + + + + + 分时明细 + + + + + 分时电量 + (千瓦时) + + 尖: {{ detail.comprehensive.sharpAmount }} + 峰: {{ detail.comprehensive.peakAmount }} + 平: {{ detail.comprehensive.flatAmount }} + 谷: {{ detail.comprehensive.valleyAmount }} + + + + + + 分时单价 + (元/千瓦时) + + 尖: {{ detail.comprehensive.priceSharp }} + 峰: {{ detail.comprehensive.pricePeak }} + 平: {{ detail.comprehensive.priceFlat }} + 谷: {{ detail.comprehensive.priceValley }} + + + + + + (电度电量+线损电量)*单价+摊薄公摊电费+摊薄调整电费 + + + 分时电量明细 + + +
+ {{item.address}} + 详情 +
+ + + + 电度电量 + + + 线损电量 + + + 合计电量 + + + 合计电费 + + + + + {{item.overall.amount}} + + + + {{item.loss.amount}} + + + + {{item.finalAmount}} + + + + {{item.finalTotal}} + + + +
+
+
\ No newline at end of file diff --git a/childPackage/pages/billDetail/index.wxss b/childPackage/pages/billDetail/index.wxss index f89f4f3..4ec732c 100644 --- a/childPackage/pages/billDetail/index.wxss +++ b/childPackage/pages/billDetail/index.wxss @@ -59,12 +59,25 @@ page { text-align: center; font-weight: 500; } + +.colContentTitle2 { + padding: 30rpx 0; + text-align: center; + font-weight: 500; +} + .colContentValue { padding-bottom: 30rpx; text-align: center; overflow: hidden; } +.colContentValue2 { + padding-bottom: 20rpx; + padding-left: 40rpx; + overflow: hidden; +} + .tooltip { font-size: 30rpx; color: rgb(136, 132, 132); @@ -87,10 +100,37 @@ page { background-color: #fff; box-sizing: border-box; flex: 1; + word-break: break-all; } .download { position: absolute; top: 20rpx; right: 20rpx; +} + +.meterListItem { + font-size: 32rpx; +} + +.meterListItem .top { + display: flex; + align-items: center; +} + +.meterListItem .address { + flex: 1; +} + + +/* .top .meterListItem:nth-child(even) .tableContent, +.bottom .meterListItem:nth-child(even) .tableContent, +.top .meterListItem:nth-child(even), +.bottom .meterListItem:nth-child(even) +{ + +} */ + +.meterListItemContent, .meterListItemContent .tableContent { + background-color: #fff; } \ No newline at end of file diff --git a/childPackage/pages/electricQuery/components/accountingCard/index.js b/childPackage/pages/electricQuery/components/accountingCard/index.js index 922326c..e1ed51e 100644 --- a/childPackage/pages/electricQuery/components/accountingCard/index.js +++ b/childPackage/pages/electricQuery/components/accountingCard/index.js @@ -1,24 +1,23 @@ // pages/electricQuery/components/accountingCard/index.js Component({ + /** + * 组件的属性列表 + */ + properties: { + data: Object + }, - /** - * 组件的属性列表 - */ - properties: { - data: Object - }, + /** + * 组件的初始数据 + */ + data: { - /** - * 组件的初始数据 - */ - data: { + }, - }, + /** + * 组件的方法列表 + */ + methods: { - /** - * 组件的方法列表 - */ - methods: { - - } + } }) \ No newline at end of file diff --git a/childPackage/pages/electricQuery/components/accountingCard/index.wxml b/childPackage/pages/electricQuery/components/accountingCard/index.wxml index 45e6978..d49642f 100644 --- a/childPackage/pages/electricQuery/components/accountingCard/index.wxml +++ b/childPackage/pages/electricQuery/components/accountingCard/index.wxml @@ -1,33 +1,86 @@ - - {{data.meter.address}} - - - - 初始余额 - - - 储值累计金额 - - - 电费 - - - 账务余额 - - - {{data.startMoney}} - - - {{data.rechargeMoney}} - - - {{data.electricMoney}} - - - {{data.currentMoney}} - - + + {{data.meter.address}} + 电表编号:{{data.meter.sn}} + + + + + 类目 + 金额 + 更新时间 + + + + + + + 初始余额 + + + {{data.startMoney}} + + + {{data.updateStartMoneyAt || '--'}} + + + + + + + + 累计充值金额 + + + {{data.rechargeMoney}} + + + {{data.updateRechargeMoneyAt || '--'}} + + + + + + + + 电费 + + + {{data.electricMoney}} + + + {{data.updateElectricMoneyAt || '--'}} + + + + + + + + 账务余额 + + + {{data.accountMoney}} + + + {{data.updateAccountMoneyAt || '--'}} + + + + + + + + 电表余额 + + + {{data.meterMoney}} + + + {{data.updateMeterMoneyAt || '--'}} + + + \ No newline at end of file diff --git a/childPackage/pages/electricQuery/components/accountingCard/index.wxss b/childPackage/pages/electricQuery/components/accountingCard/index.wxss index c538ef6..776e121 100644 --- a/childPackage/pages/electricQuery/components/accountingCard/index.wxss +++ b/childPackage/pages/electricQuery/components/accountingCard/index.wxss @@ -17,8 +17,25 @@ } .tableContent { - margin-top: 10rpx; + margin-top: 25rpx; margin-bottom: 20rpx; text-align: center; font-size: 32rpx; -} \ No newline at end of file +} +.table-header { + display: flex; + width: 100%; + background-color: #f5f5f5; + border-bottom: 1rpx solid #eaeaea; + } + .table-header-row { + display: flex; + width: 100%; + } + .table-header-cell { + flex: 1; + text-align: center; + padding: 20rpx 0; + font-size: 25rpx; + color: #333; + } \ No newline at end of file diff --git a/childPackage/pages/electricQuery/components/reading/index.js b/childPackage/pages/electricQuery/components/reading/index.js new file mode 100644 index 0000000..a209838 --- /dev/null +++ b/childPackage/pages/electricQuery/components/reading/index.js @@ -0,0 +1,128 @@ +// childPackage/pages/electricQuery/components/reading/index.js +import { exportElectricityList, getAccountingList, getElectricityList, getMeterReadingList } from "../../../../../service/accounting"; +import { getTenementMeterList } from "../../../../../service/meter"; +import dayjs from "../../../../../utils/dayjs"; +import { getParkInfoByTime } from "../../../../../service/park"; +import request from '../../../../../utils/request'; +import { alertInfo, getPixelRatio, loadingFunc } from "../../../../../utils/index"; +const { OK } = request; +Component({ + + /** + * 组件的属性列表 + */ + properties: { + meter: String, + parkInfo: Object, + }, + observers: { + 'meter': function() { + loadingFunc(async () => { + await this.getReadingList(); + }) + }, + "parkInfo": function(newValue) { + this.setData({ park: newValue }) + } + }, + /** + * 组件的初始数据 + */ + data: { + readingDetailShow: false, + readingDetail: {}, + park: {}, + meterReadingHeader: [ + { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address }, + { title: '倍率', key: 'ratio' }, + { key: 'number', title: '当前表字' }, + ], + meterReadingList: [], + yearMonthDayReading: dayjs().format("YYYY-MM-DD"), + yearMonthDayReadingStamp: new Date().getTime(), + readingPage: 1, + }, + + /** + * 组件的方法列表 + */ + methods: { + clickReadingTime() { + this.setData({ + readingVisible: true + }) + }, + async getReadingList() { + const { meter, yearMonthDayReading, readingPage } = this.data; + const { code, message, data, total } = await getMeterReadingList({ + id: meter, + time: yearMonthDayReading, + page: readingPage + }) + if (code !== OK) { + alertInfo(message) + return; + } + this.setData({ meterReadingList: data, totalPage: Math.ceil(total / 20) }) + }, + onReadingTimeClose() { + this.setData({ readingVisible: false }) + }, + onReadingTimeCancel() { + this.setData({ readingVisible: false }) + }, + onReadingTimeConfirm(e) { + const { time } = e.detail; + + this.setData({ + yearMonthDayReading: time, + yearMonthDayReadingStamp: new Date(time).getTime(), + readingVisible: false, + readingPage: 1, + }, () => { + loadingFunc(async () => { + await this.getParkInfo(time) + await this.getReadingList(); + }) + }) + + }, + async getParkInfo(time) { + const park = wx.getStorageSync('park'); + const { park:parkInfo, code, message } = await getParkInfoByTime(park?.id, `${time}`, `${0}`,) + if (code !== OK) { + alertInfo(message) + return; + } + const that = this; + return new Promise((resolve) => { + + that.setData({ + parkInfo: parkInfo + }, () => { + resolve() + }) + }) + + + }, + showDetail(e) { + const { index, data = {} } = e.detail; + this.setData({ + readingDetailShow: true, + readingDetail: data || {} + }) + }, + async onChangePage(e) { + const page = e.detail.currentIndex; + const that = this; + this.setData({ + readingPage: page + }, () => { + loadingFunc(async () => { + await that.getReadingList(); + }) + }) + }, + } +}) \ No newline at end of file diff --git a/childPackage/pages/electricQuery/components/reading/index.json b/childPackage/pages/electricQuery/components/reading/index.json new file mode 100644 index 0000000..dbe66d1 --- /dev/null +++ b/childPackage/pages/electricQuery/components/reading/index.json @@ -0,0 +1,13 @@ +{ + "component": true, + "usingComponents": { + "custom-picker": "/components/picker/index", + "table": "/components/table/table", + "empty": "/components/empty/index", + "timePicker": "/components/timePicker/index", + "pagination": "/components/pagination/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-field": "@vant/weapp/field/index", + "van-icon": "@vant/weapp/icon/index" + } +} \ No newline at end of file diff --git a/childPackage/pages/electricQuery/components/reading/index.wxml b/childPackage/pages/electricQuery/components/reading/index.wxml new file mode 100644 index 0000000..7aff417 --- /dev/null +++ b/childPackage/pages/electricQuery/components/reading/index.wxml @@ -0,0 +1,150 @@ + + + + 选择时间 + + {{yearMonthDayReading}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 上次抄表记录起,至现在时间内的用电量 + + + + \ No newline at end of file diff --git a/childPackage/pages/electricQuery/components/reading/index.wxss b/childPackage/pages/electricQuery/components/reading/index.wxss new file mode 100644 index 0000000..a9a3c5d --- /dev/null +++ b/childPackage/pages/electricQuery/components/reading/index.wxss @@ -0,0 +1,102 @@ +/* childPackage/pages/electricQuery/components/reading/index.wxss */ + +/* pages/electricQuery/index.wxss */ +page { + background-color: var(--transparent-green); + } + + .queryWrapper { + margin: 20rpx 0rpx; + background-color: #fff; + padding:15rpx 20rpx; + box-sizing: border-box; + border-radius: 20rpx; + display: flex; + align-items: center; + font-size: 32rpx; + } + + .label { + width: 180rpx; + font-size: 32rpx; + } + + .sum { + margin-bottom: 30rpx; + margin-left: 30rpx; + margin-right: 30rpx; + padding-bottom: 50rpx; + } + + .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; + } + + .timeQueryText { + text-align: center; + padding: 20rpx; + background-color: rgb(242,248,246); + font-size: 30rpx; + } + + .wrapper { + margin-left: 30rpx; + margin-right: 30rpx; + padding: 0; + } + + .tooltip { + margin: 20rpx 0; + font-size: 28rpx; + color: rgb(97, 93, 93); + } + .timeChooseWrapper { + display: flex; + align-items: center; + font-size: 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; + } + + .timeText { + flex: 1; + } + + .mychart-bar::after{ + content:""; + display:block; + clear:both + } + + .text{ + font-size: 28rpx; + color: #999999; + margin: 10rpx 0; + text-align: center; + } \ No newline at end of file diff --git a/childPackage/pages/electricQuery/index.js b/childPackage/pages/electricQuery/index.js index a12a3fa..2e15552 100644 --- a/childPackage/pages/electricQuery/index.js +++ b/childPackage/pages/electricQuery/index.js @@ -1,6 +1,7 @@ // pages/electricQuery/index.js import { exportElectricityList, getAccountingList, getElectricityList, getMeterReadingList } from "../../../service/accounting"; import { getTenementMeterList } from "../../../service/meter"; +import { getParkInfoByTime } from "../../../service/park"; import dayjs from "../../../utils/dayjs"; import request from '../../../utils/request'; import * as echarts from '../../components/echarts/echarts'; @@ -22,26 +23,32 @@ Page({ year: dayjs().format('YYYY'), yearMonth: dayjs().format("YYYY-MM"), yearMonthDay: dayjs().format("YYYY-MM-DD"), + yearStamp: new Date().getTime(), yearMonthStamp: new Date().getTime(), yearMonthDayStamp: new Date().getTime(), + + header: [ - { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address }, + // { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address }, { title: '时间',renderBody: (item) => { return item.time } }, { key: 'number', title: '耗量' }, ], - meterReadingHeader: [ - { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address }, - { title: '倍率', key: 'ratio' }, - { key: 'number', title: '抄表记录' }, + valleyHeader: [ + // { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address }, + { title: '时间',renderBody: (item) => { return item.time } }, + { key: 'critical', title: '尖' }, + { key: 'peak', title: '峰' }, + { key: 'flat', title: '平' }, + { key: 'valley', title: '谷' }, ], list: [], visible: false, - meterReadingList: [], accountingList: [], electricNumber: 0, meterNumber: 0, page: 1, + readingPage: 1, }, changeQueryType(e) { const { type } = e.currentTarget.dataset @@ -53,10 +60,10 @@ Page({ }) break; case 1: - loadingFunc(async () => { - await this.getReadingList(); - }) - break; + // loadingFunc(async () => { + // await this.getReadingList(); + // }) + // break; case 2: loadingFunc(async () => { await this.getAccountingBalanceList(); @@ -74,8 +81,9 @@ Page({ visible: true }) }, + changeTimeType(e) { - const { type } = e.currentTarget.dataset + const { type } = e.currentTarget.dataset; const that = this; this.setData({ timeType: type }, () => { loadingFunc(async () => { @@ -89,11 +97,13 @@ Page({ */ onLoad(options) { loadingFunc(async () => { + await this.getMeters() + await this.getParkInfo() await this.init() }) }, async init() { - const { queryType, timeType, meterId, year, yearMonth, yearMonthDay, page } = this.data; + const { queryType, timeType, meterId, year, yearMonth, yearMonthDay, page, parkInfo } = this.data; let time; switch(timeType) { case 1: @@ -128,12 +138,18 @@ Page({ devicePixelRatio: getPixelRatio(), }); const ids = [...new Set(data?.map(item => item?.meter?.id))] + const point = data?.[0]?.time?.slice(-1) + const times = [...new Set(data?.map(item => item.time))]. + map(item => Number(item.replace(point, ""))). + sort((a, b) => a - b). + map(ele => `${ele}${point}`.padStart(3, "0")); + const options = { tooltip: { trigger: 'axis' }, legend: { - data: data?.map(item => item?.meter?.address), + data: data?.map(item => item?.meter?.address), }, grid: { left: '3%', @@ -144,18 +160,25 @@ Page({ xAxis: { type: 'category', boundaryGap: false, - data: [...new Set(data?.map(item => item.time))] + data: times }, yAxis: { type: 'value' }, series: ids?.map(item => { const element = data?.find(i => i?.meter?.id === item) + const list = data?.filter(ele => ele?.meter?.id === item) + const newList = [...times].map(item => { + const exist = list.find(ele => ele.time === item) + if (exist) { + return Number(exist.critical)+ Number(exist.peak)+Number(exist.flat)+Number(exist.valley); + } + return null + }) return { name: element?.meter?.address, type: 'line', - stack: 'Total', - data: data?.filter(ele => ele?.meter?.id === item).map(item => item.number) + data: newList }}) }; @@ -164,15 +187,7 @@ Page({ return pieChart; }); }, - async getReadingList() { - const { meterId } = this.data; - const { code, message, data } = await getMeterReadingList(meterId) - if (code !== OK) { - alertInfo(message) - return; - } - this.setData({ meterReadingList: data, totalPage: 1 }) - }, + async export() { loadingFunc(async () => { const { queryType, timeType, meterId, year, yearMonth, yearMonthDay } = this.data; @@ -196,6 +211,7 @@ Page({ wx.openDocument({ filePath: data.tempFilePath, fileType: ['xlsx'], + showMenu: true, success() { }, fail(err) { @@ -229,15 +245,44 @@ Page({ alertInfo(message) return; } - + const first = data?.[0] this.setData({ meterList: data || [], + meterId: first?.id, + meterAddress: first?.address, + meterCode: first?.code, + }, () => { + const { queryType, } = this.data; + switch(queryType) { + case 1: + loadingFunc(async () => { + await this.getReadingList(); + }) + break; + case 2: + loadingFunc(async () => { + await this.getAccountingBalanceList(); + }) + break; + default: + loadingFunc(async () => { + await this.init(); + }) + break; + } }) }, clickMeter() { this.setData({ type: "meter", - columns: [{ id: "", name: "全部", code: "" }, ...this.data.meterList.map(item => ({ id: item.id, name: `${item.code}-${item.address}`, code: item.code }))], + columns: [ + // { id: "", name: "全部", code: "" }, + ...this.data.meterList.map(item => ({ + id: item.id, + name: `${item.code}-${item.address}`, + code: item.code, + address: item.address + }))], show: true, title: "表计" }) @@ -251,11 +296,12 @@ Page({ }) }, onOk(e) { - const { id, code } = e.detail.value; + const { id, code, address } = e.detail.value; this.setData({ // year: currentYear, meterId: id, meterCode: code, + meterAddress: address, type: "", show: false, title: "" @@ -287,12 +333,14 @@ Page({ onTimeCancel() { this.setData({ visible: false }) }, + onTimeConfirm(e) { const { type, time } = e.detail; switch(type) { case "year": this.setData({ year: time, visible: false, }, () => { loadingFunc(async () => { + await this.getParkInfo() await this.init(); }) }); @@ -301,6 +349,7 @@ Page({ const [year, month] = time.split("-") this.setData({ yearMonth: time, yearMonthStamp: new Date(Number(year), Number(month) - 1, 1).getTime(), visible: false }, () => { loadingFunc(async () => { + await this.getParkInfo() await this.init(); }) }); @@ -313,11 +362,15 @@ Page({ page: 1, }, () => { loadingFunc(async () => { + await this.getParkInfo() await this.init(); }) }) break; } + }, + readingChangeTime(e) { + }, /** * 生命周期函数--监听页面初次渲染完成 @@ -330,9 +383,39 @@ Page({ * 生命周期函数--监听页面显示 */ onShow() { - this.getMeters() - }, + }, + async getParkInfo() { + const park = wx.getStorageSync('park'); + const { timeType, yearMonthDay, yearMonth, year } = this.data; + let time = '' + switch(timeType) { + case 0: + time = yearMonthDay; + break; + case 1: + time = yearMonth; + break; + case 2: + time = year; + } + const { park:parkInfo, code, message } = await getParkInfoByTime(park?.id, `${time}`, `${timeType}`,) + if (code !== OK) { + alertInfo(message) + return; + } + const that = this; + return new Promise((resolve) => { + + that.setData({ + parkInfo: parkInfo + }, () => { + resolve() + }) + }) + + + }, /** * 生命周期函数--监听页面隐藏 */ diff --git a/childPackage/pages/electricQuery/index.json b/childPackage/pages/electricQuery/index.json index 175ba0d..54750e4 100644 --- a/childPackage/pages/electricQuery/index.json +++ b/childPackage/pages/electricQuery/index.json @@ -12,7 +12,10 @@ "accountingCard": "./components/accountingCard/index", "pagination": "/components/pagination/index", "echarts": "/childPackage/components/echarts/ec-canvas", - "listTable": "./components/listTable/index" + "listTable": "./components/listTable/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-field": "@vant/weapp/field/index", + "reading": "./components/reading/index" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/childPackage/pages/electricQuery/index.wxml b/childPackage/pages/electricQuery/index.wxml index 8171e81..4c8c574 100644 --- a/childPackage/pages/electricQuery/index.wxml +++ b/childPackage/pages/electricQuery/index.wxml @@ -7,7 +7,7 @@ - {{ meterCode === "" ? '全部' : meterCode }} + {{ meterAddress === "" ? '-' : meterAddress }} @@ -30,23 +30,25 @@ - 日耗量 + 日用电量 - 月耗量 + 月电用量 - 年耗量 + 年用电量 - 不包括线损电量,显示为电表实际消耗电量。仅供参考,实际能耗电量以电费账单为主。如有疑问,请联系客服。 + 不包括线损电量,显示为电表实际消用电量。仅供参考,实际能用电量以电费账单为主。如有疑问,请联系客服。 - 选择时间 + 选择时间 + 选择日期 + 选择月份 {{yearMonthDay}} {{yearMonth}} @@ -57,13 +59,16 @@ - + - 账务余额更新时间为:每次预存电费后,每次账单发布后,剩余的实际金额。电表余额与账务余额相差较大的用户,每半年统一处理一次。 + 账务余额更新时间为:每次预存电费后,每次发布账单后剩余的实际金额。 + + + 计算公式:账务余额 = 初始余额 + 累充充值金额 - 电费 @@ -81,26 +86,25 @@ --> - + + - 合计:表计数量:{{meterNumber}},耗电量:{{electricNumber}} + 合计:表计数量:{{meterNumber}},用电量:{{electricNumber}} - - -
- - - - - - - + @@ -139,4 +143,5 @@ bind:cancel="onTimeCancel" bind:close="onTimeClose" bind:confirm="onTimeConfirm" -/> \ No newline at end of file +/> + diff --git a/components/DateTimePicker/index.js b/components/DateTimePicker/index.js new file mode 100644 index 0000000..da3090c --- /dev/null +++ b/components/DateTimePicker/index.js @@ -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() { + + } + }, + /** + * 组件的方法列表 + */ + methods: { + onCancel() { + this.triggerEvent("cancel") + }, + onConfirm(e) { + this.triggerEvent("confirm", { time: dayjs(e.detail).format("YYYY-MM-DD HH:mm:ss") }) + } + } +}) \ No newline at end of file diff --git a/components/DateTimePicker/index.json b/components/DateTimePicker/index.json new file mode 100644 index 0000000..c3ceac7 --- /dev/null +++ b/components/DateTimePicker/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-popup": "@vant/weapp/popup/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index" + } +} \ No newline at end of file diff --git a/components/DateTimePicker/index.wxml b/components/DateTimePicker/index.wxml new file mode 100644 index 0000000..a9f405d --- /dev/null +++ b/components/DateTimePicker/index.wxml @@ -0,0 +1,18 @@ + + + + + + diff --git a/components/DateTimePicker/index.wxss b/components/DateTimePicker/index.wxss new file mode 100644 index 0000000..f025676 --- /dev/null +++ b/components/DateTimePicker/index.wxss @@ -0,0 +1 @@ +/* components/datePicker/index.wxss */ \ No newline at end of file diff --git a/components/Segmented/index.js b/components/Segmented/index.js new file mode 100644 index 0000000..1de1ae1 --- /dev/null +++ b/components/Segmented/index.js @@ -0,0 +1,31 @@ +// components/Segmented/index.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + list: Array, + active: Number, + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + handleChange(e) { + const { index } = e.currentTarget.dataset; + if (index === this.data.active) { + return; + } + this.triggerEvent("change", { index, name: this.data.list[index] }) + } + } +}) \ No newline at end of file diff --git a/components/Segmented/index.json b/components/Segmented/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/Segmented/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/Segmented/index.wxml b/components/Segmented/index.wxml new file mode 100644 index 0000000..a15e8f8 --- /dev/null +++ b/components/Segmented/index.wxml @@ -0,0 +1,12 @@ + + + + {{ item }} + + \ No newline at end of file diff --git a/components/Segmented/index.wxss b/components/Segmented/index.wxss new file mode 100644 index 0000000..6d69e65 --- /dev/null +++ b/components/Segmented/index.wxss @@ -0,0 +1,19 @@ +/* components/Segmented/index.wxss */ +.item { + display: inline-block; + padding: 20rpx; + border: 1rpx solid #ccc; + border-right: 0rpx; + font-size: 32rpx; + min-width: 140rpx; + text-align: center; + +} + +.item:nth-last-child(1) { + border-right: 1rpx solid #ccc; +} + +.active { + background-color: var(--middle-green); +} diff --git a/components/aid/index.wxml b/components/aid/index.wxml index 3d3bf5a..6b74870 100644 --- a/components/aid/index.wxml +++ b/components/aid/index.wxml @@ -17,9 +17,11 @@ {{ item.level }} {{item.synopsis}}{{item.synopsis}} {{item.synopsis}} - - - 在线咨询 + + + + 在线咨询 + diff --git a/components/aid/index.wxss b/components/aid/index.wxss index 0a0f96d..8163535 100644 --- a/components/aid/index.wxss +++ b/components/aid/index.wxss @@ -28,7 +28,7 @@ } .synopsis { - height: 80rpx; + height: 75rpx; overflow: hidden; margin-top: 20rpx; margin-bottom: 10rpx; diff --git a/components/discountCoupon/index.js b/components/discountCoupon/index.js index dfbe50d..eeff869 100644 --- a/components/discountCoupon/index.js +++ b/components/discountCoupon/index.js @@ -1,3 +1,8 @@ +import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index" +import { redeemCoupons } from "../../service/system"; +import request from "../../utils/request" +const { OK } = request; + // components/discountCoupon/index.js Component({ @@ -5,7 +10,8 @@ Component({ * 组件的属性列表 */ properties: { - + type: Number, + data: Object }, /** @@ -19,6 +25,52 @@ Component({ * 组件的方法列表 */ methods: { - + handleChange() { + const { data } = this.data; + const that = this; + loadingFunc(async () => { + const { code, message } = await redeemCoupons({ id: data.id, type: 2 }) + if (code !== OK) { + alertInfo(message) + return + } + alertSuccess("兑换成功") + that.triggerEvent("change", { id, type: 2 }) + }) + }, + showRemark() { + wx.showModal({ + title: '备注', + content: this.data?.data?.remark, + showCancel: false, + complete: (res) => { + if (res.cancel) { + + } + + if (res.confirm) { + + } + } + }) + + }, + handleUseIt() { + alertInfo("敬请期待") + }, + async handleUse() { + const { data } = this.data; + const that = this; + loadingFunc(async () => { + const { code, message } = await redeemCoupons({ id: data.id, type: 2 }) + if (code !== OK) { + alertInfo(message) + return; + } + alertSuccess("领取成功") + that.triggerEvent("get", { id, type: 1 }) + }) + + } } }) \ No newline at end of file diff --git a/components/discountCoupon/index.json b/components/discountCoupon/index.json index e8cfaaf..6a35321 100644 --- a/components/discountCoupon/index.json +++ b/components/discountCoupon/index.json @@ -1,4 +1,7 @@ { "component": true, - "usingComponents": {} + "usingComponents": { + "van-button": "@vant/weapp/button/index", + "van-dialog": "@vant/weapp/dialog/index" + } } \ No newline at end of file diff --git a/components/discountCoupon/index.wxml b/components/discountCoupon/index.wxml index f7a650d..4e012c2 100644 --- a/components/discountCoupon/index.wxml +++ b/components/discountCoupon/index.wxml @@ -1,2 +1,39 @@ -components/discountCoupon/index.wxml \ No newline at end of file + + + + + + + 通用优惠券 + 无门槛优惠券 + 满减券 + + + 有效期至 {{ data.endTime }} + + + + + + {{ data.discount }} 折 + {{ data.discountMoney }} 元 + - + + + 满 {{ data.useMin }} 可用 + + + + + + {{data.remark}} + + + 去领取 + 去兑换 + 去使用 + + + + \ No newline at end of file diff --git a/components/discountCoupon/index.wxss b/components/discountCoupon/index.wxss index 96d216b..214f566 100644 --- a/components/discountCoupon/index.wxss +++ b/components/discountCoupon/index.wxss @@ -1 +1,60 @@ -/* components/discountCoupon/index.wxss */ \ No newline at end of file +/* components/discountCoupon/index.wxss */ + +.wrapper { + padding: 24rpx; + border-radius: 16rpx; + background-color: #fff; +} + +.top { + display: flex; + justify-content: space-between; + border-bottom: 1rpx dashed #ccc; + padding-bottom: 30rpx; +} + +.top .right { + color: #fa541c; +} + +.price { + display: flex; + align-items: flex-end; + margin-bottom: 14rpx; +} + +.typeText { + font-weight: 700; + font-size: 36rpx; + margin-bottom: 20rpx; +} + +.time { + font-size: 30rpx; +} + +.price { + font-size: 44rpx; + line-height: 44rpx; +} + +.limit { + font-size: 30rpx; +} + +.bottom { + margin-top: 20rpx; + display: flex; + justify-content: space-between; + align-items: center; +} + +.bottom .left { + flex: 1; + max-width: calc(100vw - 60rpx - 250rpx); + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + font-size: 30rpx; + color: rgba(0, 0, 0, 0.7) +} diff --git a/components/input/index.js b/components/input/index.js deleted file mode 100644 index 0ca0c87..0000000 --- a/components/input/index.js +++ /dev/null @@ -1,24 +0,0 @@ -// components/input/index.js -Component({ - - /** - * 组件的属性列表 - */ - properties: { - - }, - - /** - * 组件的初始数据 - */ - data: { - - }, - - /** - * 组件的方法列表 - */ - methods: { - - } -}) \ No newline at end of file diff --git a/components/input/index.wxml b/components/input/index.wxml deleted file mode 100644 index d423370..0000000 --- a/components/input/index.wxml +++ /dev/null @@ -1,8 +0,0 @@ - - \ No newline at end of file diff --git a/components/input/index.wxss b/components/input/index.wxss deleted file mode 100644 index 172e07a..0000000 --- a/components/input/index.wxss +++ /dev/null @@ -1 +0,0 @@ -/* components/input/index.wxss */ \ No newline at end of file diff --git a/components/navigator/index.js b/components/navigator/index.js index a86a1d7..0be511e 100644 --- a/components/navigator/index.js +++ b/components/navigator/index.js @@ -7,6 +7,7 @@ Component({ properties: { title: String, canBack: Boolean, + beforeBack: Function, }, /** @@ -34,7 +35,11 @@ Component({ * 组件的方法列表 */ methods: { - back() { + async back() { + const { beforeBack } = this; + if (beforeBack) { + await beforeBack(); + } wx.navigateBack(); } } diff --git a/components/searchSelect/index.js b/components/searchSelect/index.js index aef7a6e..c75c854 100644 --- a/components/searchSelect/index.js +++ b/components/searchSelect/index.js @@ -1,9 +1,9 @@ -import { getParkList } from "../../service/park" +import { getLoginParkList, getParkBuildingList } from "../../service/park" import { getParkSimpleMeterList } from "../../service/meter" import { alertInfo } from "../../utils/index"; import request from "../../utils/request" -import { payWays } from "../../utils/data"; - +import { payWays, feeType } from "../../utils/data"; +import { getTenementList, getWxTenementList } from "../../service/tenement"; const { OK } = request; // components/searchSelect/index.js @@ -17,6 +17,7 @@ Component({ type: String, show: Boolean, park: String, + isBack: Boolean, }, observers: { "show,type": function(newShow, newType) { @@ -32,6 +33,7 @@ Component({ columns: [], searchText: "", payWays, + feeType, }, lifetimes: { attached() { @@ -60,6 +62,10 @@ Component({ const { index } = event.detail; const { list = [], type } = this.data; const item = list[index]; + if (!item) { + alertInfo("请选择一项") + return + } this.setData({ columns: [], list: [], @@ -78,6 +84,17 @@ Component({ }) this.triggerEvent("confirm", { data: item, way: index, type } ); }, + onFeeTypeConfirm(event) { + const { index } = event.detail; + const { feeType = [], type } = this.data; + const item = feeType[index]; + this.setData({ + columns: [], + list: [], + searchText: "" + }) + this.triggerEvent("confirm", { data: item, way: index, type } ); + }, onSearch() { const { type } = this.data; switch(type) { @@ -86,12 +103,18 @@ Component({ return; case "meter": this.onSearchMeter(); + return + case "tenement": + this.onSearchTenement(); + return; + case "building": + this.onSearchBuilding(); return; } }, async onSearchPark() { const { searchText = "" } = this.data; - const { code, message, data: parks = [] } = await getParkList({keyword: searchText}); + const { code, message, data: parks = [] } = await getLoginParkList({keyword: searchText}); if (code !== OK) { alertInfo(message) return @@ -109,9 +132,34 @@ Component({ return } this.setData({ - columns: parks?.map(item => `${item.meterNo}-${item.address}${item.shortName ? '-' + item.shortName : ''}`), - list: parks, + columns: parks?.map(item => `${item.meterNo}-${item.address}${item.shortName ? '-' + item.shortName : ''}`) || [], + list: parks || [], }) - } + }, + async onSearchTenement() { + const { searchText = "", park, isBack } = this.data; + const { code, message, data = [] } = isBack ? await getWxTenementList({keyword: searchText, park}) : await getTenementList({keyword: searchText, park}); + if (code !== OK) { + alertInfo(message) + return + } + this.setData({ + columns: data?.length ? data?.map(item => item?.name) : [], + list: data, + }) + }, + async onSearchBuilding() { + const { park } = this.data; + const { code, message, buildings: data = [] } = await getParkBuildingList(park); + if (code !== OK) { + alertInfo(message) + return + } + this.setData({ + columns: data?.length ? data?.map(item => item?.name) : [], + list: data, + }) + }, } -}) \ No newline at end of file +}) + diff --git a/components/searchSelect/index.wxml b/components/searchSelect/index.wxml index fe751bf..6f4c8bc 100644 --- a/components/searchSelect/index.wxml +++ b/components/searchSelect/index.wxml @@ -3,11 +3,33 @@ show="{{ show }}" bind:click="onClickHide" position="bottom" + z-index="100000" + wx:if="{{show}}" > - + + + + + + + @@ -26,14 +48,15 @@ bind:confirm="onConfirm" /> + \ No newline at end of file diff --git a/components/searchSelect/index.wxss b/components/searchSelect/index.wxss index 540bed4..ad01756 100644 --- a/components/searchSelect/index.wxss +++ b/components/searchSelect/index.wxss @@ -1,3 +1 @@ /* components/searchSelect/index.wxss */ -.van-ellipsis van-picker-column__item { -} \ No newline at end of file diff --git a/components/searchSelectWrapper/index.js b/components/searchSelectWrapper/index.js new file mode 100644 index 0000000..8d191c9 --- /dev/null +++ b/components/searchSelectWrapper/index.js @@ -0,0 +1,48 @@ +// components/searchSelectWrapper/index.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + label: String, + placeholder: String, + text: String, + fieldType: { + type: String, + value: "text" + }, + type: { + type: String, + value: "select" + } + }, + + /** + * 组件的初始数据 + */ + data: { + keyword: "", + text: "", + }, + + /** + * 组件的方法列表 + */ + methods: { + onSearch() { + this.triggerEvent("search") + }, + onChangeKeyword(e) { + this.setData({ keyword: e.detail }); + }, + onChangeText(e) { + this.setData({ text: e.detail }); + this.triggerEvent("changeText", e.detail) + }, + onSearchKeyword() { + this.triggerEvent("searchKeyword", this.data.keyword) + this.setData({ keyword: "" }) + } + } +}) \ No newline at end of file diff --git a/components/input/index.json b/components/searchSelectWrapper/index.json similarity index 51% rename from components/input/index.json rename to components/searchSelectWrapper/index.json index d75216e..fda2119 100644 --- a/components/input/index.json +++ b/components/searchSelectWrapper/index.json @@ -1,6 +1,8 @@ { "component": true, "usingComponents": { + "van-icon": "@vant/weapp/icon/index", + "van-button": "@vant/weapp/button/index", "van-field": "@vant/weapp/field/index" } } \ No newline at end of file diff --git a/components/searchSelectWrapper/index.wxml b/components/searchSelectWrapper/index.wxml new file mode 100644 index 0000000..2b781e5 --- /dev/null +++ b/components/searchSelectWrapper/index.wxml @@ -0,0 +1,35 @@ + + + {{ label }} + + {{placeholder}} + {{text}} + + + + + {{ label }} + + + + 搜索 + + + {{ label }} + + + + \ No newline at end of file diff --git a/components/searchSelectWrapper/index.wxss b/components/searchSelectWrapper/index.wxss new file mode 100644 index 0000000..cd7bdc4 --- /dev/null +++ b/components/searchSelectWrapper/index.wxss @@ -0,0 +1,37 @@ +/* components/searchSelectWrapper/index.wxss */ +.wrapper { + display: flex; + align-items: center; + font-size: 30rpx; + padding: 20rpx; +} + +.content { + flex: 1; + margin-left: 30rpx; + margin-right: 30rpx; + display: flex; + padding: 10rpx 20rpx; + border-radius: 12rpx; + border: 1rpx solid #ccc; + background-color: #fff; +} + +.inputContent { + flex: 1; + margin-left: 30rpx; + margin-right: 30rpx; + display: flex; + padding: 0 20rpx; + border-radius: 12rpx; + border: 1rpx solid #ccc; + background-color: #fff; +} + +.text { + flex: 1; +} + +.label { + width: 120rpx; +} \ No newline at end of file diff --git a/components/table/table.js b/components/table/table.js index e4dd2c2..c104dcd 100644 --- a/components/table/table.js +++ b/components/table/table.js @@ -27,6 +27,9 @@ Component({ type: String, value: '#d6e8ff' }, + topColor: String, + topStyle: String, + bodyStyle: String, maxLine: { type: Number, value: 2 diff --git a/components/table/table.wxml b/components/table/table.wxml index 54a5a3b..e46080e 100644 --- a/components/table/table.wxml +++ b/components/table/table.wxml @@ -8,12 +8,19 @@
+ + + + + + 电度电量:{{data.overall.amount}} + + + + + 电度电费:{{data.overall.fee}} + + + + + diff --git a/pages/billMeterDetail/index.wxss b/pages/billMeterDetail/index.wxss new file mode 100644 index 0000000..49322eb --- /dev/null +++ b/pages/billMeterDetail/index.wxss @@ -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; +} \ No newline at end of file diff --git a/pages/discountCoupon/index.js b/pages/discountCoupon/index.js new file mode 100644 index 0000000..f0d079f --- /dev/null +++ b/pages/discountCoupon/index.js @@ -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() { + + } +}) \ No newline at end of file diff --git a/pages/discountCoupon/index.json b/pages/discountCoupon/index.json new file mode 100644 index 0000000..1218b58 --- /dev/null +++ b/pages/discountCoupon/index.json @@ -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" +} \ No newline at end of file diff --git a/pages/discountCoupon/index.wxml b/pages/discountCoupon/index.wxml new file mode 100644 index 0000000..35ef08a --- /dev/null +++ b/pages/discountCoupon/index.wxml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/discountCoupon/index.wxss b/pages/discountCoupon/index.wxss new file mode 100644 index 0000000..bd53e61 --- /dev/null +++ b/pages/discountCoupon/index.wxss @@ -0,0 +1,8 @@ +/* pages/discountCoupon/index.wxss */ +page { + background-color: rgb(242,243,245); +} + +.item { + margin: 20rpx; +} \ No newline at end of file diff --git a/pages/handleLogin/index.js b/pages/handleLogin/index.js index 42d0a09..0698418 100644 --- a/pages/handleLogin/index.js +++ b/pages/handleLogin/index.js @@ -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: "", + }) + }, }) \ No newline at end of file diff --git a/pages/handleLogin/index.json b/pages/handleLogin/index.json index 6d40fc3..febad6d 100644 --- a/pages/handleLogin/index.json +++ b/pages/handleLogin/index.json @@ -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" } \ No newline at end of file diff --git a/pages/handleLogin/index.wxml b/pages/handleLogin/index.wxml index d23c8a9..d045c14 100644 --- a/pages/handleLogin/index.wxml +++ b/pages/handleLogin/index.wxml @@ -17,16 +17,48 @@ - + + + 选择 + + + + + 选择 + + + > + + 手机号 + + + + + + diff --git a/pages/home/index.js b/pages/home/index.js index 6d1b144..cbea2c1 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -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) diff --git a/pages/home/index.wxml b/pages/home/index.wxml index a081e7b..a89aa84 100644 --- a/pages/home/index.wxml +++ b/pages/home/index.wxml @@ -60,11 +60,27 @@ 电表余额: - {{meter.money}} + {{meter.money}} --- - - - 刷新 + + + + + 查看全部 + + diff --git a/pages/home/index.wxss b/pages/home/index.wxss index d5803fc..eefc587 100644 --- a/pages/home/index.wxss +++ b/pages/home/index.wxss @@ -1,6 +1,10 @@ /* pages/home/index.wxss */ @import "/app.wxss"; +.balanceText { + color: var(--primary-color) +} + .top { background-color: var(--deep-green); position: fixed; diff --git a/pages/integral/index.js b/pages/integral/index.js new file mode 100644 index 0000000..f4445f6 --- /dev/null +++ b/pages/integral/index.js @@ -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() { + + } +}) \ No newline at end of file diff --git a/pages/integral/index.json b/pages/integral/index.json new file mode 100644 index 0000000..b96ac58 --- /dev/null +++ b/pages/integral/index.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "navigator": "/components/navigator/index", + "discount-coupon": "/components/discountCoupon/index", + "empty": "/components/empty/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/integral/index.wxml b/pages/integral/index.wxml new file mode 100644 index 0000000..99ad309 --- /dev/null +++ b/pages/integral/index.wxml @@ -0,0 +1,14 @@ + + + + + 当前积分: {{ integral }} + 查看积分明细 + + + + + + + + \ No newline at end of file diff --git a/pages/integral/index.wxss b/pages/integral/index.wxss new file mode 100644 index 0000000..a12343b --- /dev/null +++ b/pages/integral/index.wxss @@ -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; +} diff --git a/pages/integralRecord/index.js b/pages/integralRecord/index.js new file mode 100644 index 0000000..c3f43ef --- /dev/null +++ b/pages/integralRecord/index.js @@ -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() { + + } +}) \ No newline at end of file diff --git a/pages/integralRecord/index.json b/pages/integralRecord/index.json new file mode 100644 index 0000000..58991b7 --- /dev/null +++ b/pages/integralRecord/index.json @@ -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" +} \ No newline at end of file diff --git a/pages/integralRecord/index.wxml b/pages/integralRecord/index.wxml new file mode 100644 index 0000000..0eff632 --- /dev/null +++ b/pages/integralRecord/index.wxml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/integralRecord/index.wxss b/pages/integralRecord/index.wxss new file mode 100644 index 0000000..78be163 --- /dev/null +++ b/pages/integralRecord/index.wxss @@ -0,0 +1 @@ +/* pages/integralRecord/index.wxss */ \ No newline at end of file diff --git a/pages/invoiceDetail/index.js b/pages/invoiceDetail/index.js index 7aa75fd..8414c5c 100644 --- a/pages/invoiceDetail/index.js +++ b/pages/invoiceDetail/index.js @@ -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("复制成功") + } + }) + } + } + }) } }) } diff --git a/pages/invoiceList/components/already/index.js b/pages/invoiceList/components/already/index.js index ca71d3d..be14240 100644 --- a/pages/invoiceList/components/already/index.js +++ b/pages/invoiceList/components/already/index.js @@ -43,6 +43,15 @@ Component({ page: page + 1, }) }, + refresh() { + const that = this; + that.setData({ + page: 1, + list: [] + }, () => { + loadingFunc(() => that.getList()) + }) + }, onRefresh() { loadingFunc(() => this.getList()) }, diff --git a/pages/invoiceList/components/already/index.wxml b/pages/invoiceList/components/already/index.wxml index c380db2..dcb4201 100644 --- a/pages/invoiceList/components/already/index.wxml +++ b/pages/invoiceList/components/already/index.wxml @@ -2,6 +2,9 @@ + + 刷新 + @@ -28,7 +31,7 @@ - 审核中 + 开票中 已开票 diff --git a/pages/invoiceList/components/info/index.js b/pages/invoiceList/components/info/index.js index 5853c83..5448552 100644 --- a/pages/invoiceList/components/info/index.js +++ b/pages/invoiceList/components/info/index.js @@ -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() { diff --git a/pages/invoiceList/components/info/index.wxml b/pages/invoiceList/components/info/index.wxml index 20301b9..e2b3e01 100644 --- a/pages/invoiceList/components/info/index.wxml +++ b/pages/invoiceList/components/info/index.wxml @@ -143,7 +143,19 @@ value="{{detail.address || '-'}}" > - + + - + 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; diff --git a/pages/invoiceList/components/notyet/index.wxml b/pages/invoiceList/components/notyet/index.wxml index 5ab9525..7b63149 100644 --- a/pages/invoiceList/components/notyet/index.wxml +++ b/pages/invoiceList/components/notyet/index.wxml @@ -13,7 +13,7 @@ {{ item.tenement.name }} - {{ item.range[0] }} - {{ item.range[1] }} + {{ item.range[0] }} 至 {{ item.range[1] }} ¥ {{ item.money }} @@ -23,14 +23,15 @@ + 全选 - + {{ selectCount }} - 笔订单,共 + 笔,共 ¥ {{selectMoney}} 下一步 diff --git a/pages/invoiceList/components/notyet/index.wxss b/pages/invoiceList/components/notyet/index.wxss index 65e9424..52e2222 100644 --- a/pages/invoiceList/components/notyet/index.wxss +++ b/pages/invoiceList/components/notyet/index.wxss @@ -18,6 +18,10 @@ .middle { margin-top: 26rpx; font-size: 32rpx; + overflow: hidden; + width: 350rpx; + text-overflow: ellipsis; + white-space: nowrap; } .bottom { diff --git a/pages/invoicing/index.js b/pages/invoicing/index.js index 6430222..80041f8 100644 --- a/pages/invoicing/index.js +++ b/pages/invoicing/index.js @@ -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() { diff --git a/pages/invoicing/index.wxml b/pages/invoicing/index.wxml index 8529c37..29d2b91 100644 --- a/pages/invoicing/index.wxml +++ b/pages/invoicing/index.wxml @@ -73,7 +73,7 @@ { + 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() { + + } +}) \ No newline at end of file diff --git a/pages/meterBalanceRecord/index.json b/pages/meterBalanceRecord/index.json new file mode 100644 index 0000000..0d27767 --- /dev/null +++ b/pages/meterBalanceRecord/index.json @@ -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" +} \ No newline at end of file diff --git a/pages/meterBalanceRecord/index.wxml b/pages/meterBalanceRecord/index.wxml new file mode 100644 index 0000000..e22637d --- /dev/null +++ b/pages/meterBalanceRecord/index.wxml @@ -0,0 +1,74 @@ + + + + + 选择时间 + + + {{time}} + + + + + + +
+ + + + + + \ No newline at end of file diff --git a/pages/meterBalanceRecord/index.wxss b/pages/meterBalanceRecord/index.wxss new file mode 100644 index 0000000..91973bf --- /dev/null +++ b/pages/meterBalanceRecord/index.wxss @@ -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); + } \ No newline at end of file diff --git a/pages/meterList/index.js b/pages/meterList/index.js new file mode 100644 index 0000000..d941831 --- /dev/null +++ b/pages/meterList/index.js @@ -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() { + + } +}) \ No newline at end of file diff --git a/pages/meterList/index.json b/pages/meterList/index.json new file mode 100644 index 0000000..9ead2a1 --- /dev/null +++ b/pages/meterList/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "table": "/components/table/table", + "navigator": "/components/navigator/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/meterList/index.wxml b/pages/meterList/index.wxml new file mode 100644 index 0000000..f867566 --- /dev/null +++ b/pages/meterList/index.wxml @@ -0,0 +1,13 @@ + + +{{ time }} + +
+ \ No newline at end of file diff --git a/pages/meterList/index.wxss b/pages/meterList/index.wxss new file mode 100644 index 0000000..564316e --- /dev/null +++ b/pages/meterList/index.wxss @@ -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); + } \ No newline at end of file diff --git a/pages/my/index.js b/pages/my/index.js index b6acdd6..e15b67b 100644 --- a/pages/my/index.js +++ b/pages/my/index.js @@ -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({ diff --git a/pages/my/index.json b/pages/my/index.json index e3a3189..ac9188c 100644 --- a/pages/my/index.json +++ b/pages/my/index.json @@ -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" diff --git a/pages/my/index.wxml b/pages/my/index.wxml index 489f166..b898aa1 100644 --- a/pages/my/index.wxml +++ b/pages/my/index.wxml @@ -8,17 +8,68 @@ {{ user.nickName }} {{ tenement.name }} - 积分: - + 积分: {{ integral }} - - - - + + + + + 法律援助 + + + + 财税援助 + + + + 电力百科 + + + + + + @@ -29,7 +80,7 @@ - + @@ -38,4 +89,18 @@ - \ No newline at end of file + + + + + + + diff --git a/pages/my/index.wxss b/pages/my/index.wxss index 95e91f8..94988c0 100644 --- a/pages/my/index.wxss +++ b/pages/my/index.wxss @@ -40,3 +40,6 @@ margin-top: 6rpx; } +.connect { + display: none; +} diff --git a/pages/readingHistory/components/editModal/index.js b/pages/readingHistory/components/editModal/index.js new file mode 100644 index 0000000..f066012 --- /dev/null +++ b/pages/readingHistory/components/editModal/index.js @@ -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 }) + } + } +}) \ No newline at end of file diff --git a/pages/readingHistory/components/editModal/index.json b/pages/readingHistory/components/editModal/index.json new file mode 100644 index 0000000..3c2b870 --- /dev/null +++ b/pages/readingHistory/components/editModal/index.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/readingHistory/components/editModal/index.wxml b/pages/readingHistory/components/editModal/index.wxml new file mode 100644 index 0000000..12356ca --- /dev/null +++ b/pages/readingHistory/components/editModal/index.wxml @@ -0,0 +1,50 @@ + + + + + + 选择 + + + + + + + + + + + diff --git a/pages/readingHistory/components/editModal/index.wxss b/pages/readingHistory/components/editModal/index.wxss new file mode 100644 index 0000000..3fb490f --- /dev/null +++ b/pages/readingHistory/components/editModal/index.wxss @@ -0,0 +1 @@ +/* pages/workBench/components/tenement/components/bindMeter/index.wxss */ \ No newline at end of file diff --git a/pages/readingHistory/components/meterInfo/index.js b/pages/readingHistory/components/meterInfo/index.js index 07c269b..9bbb403 100644 --- a/pages/readingHistory/components/meterInfo/index.js +++ b/pages/readingHistory/components/meterInfo/index.js @@ -5,7 +5,7 @@ Component({ * 组件的属性列表 */ properties: { - + meterInfo: Object, }, /** diff --git a/pages/readingHistory/components/meterInfo/index.wxml b/pages/readingHistory/components/meterInfo/index.wxml index 42ad314..7849963 100644 --- a/pages/readingHistory/components/meterInfo/index.wxml +++ b/pages/readingHistory/components/meterInfo/index.wxml @@ -2,10 +2,15 @@ - 标1东-307 + {{meterInfo.address}} - 正常运行中 + + 正常 + + + 停用 + @@ -16,7 +21,7 @@ 设备编号 - 1202312423524 + {{meterInfo.meterSn}} @@ -26,7 +31,15 @@ 电表类型 - 1202312423524 + + 商户电表 + + + 公区电表 + + + 公摊电表 + @@ -36,7 +49,7 @@ 最近读数 - 1202312423524 + {{meterInfo.overall}} @@ -46,7 +59,7 @@ 读数日期 - 1202312423524 + {{meterInfo.readAt}} diff --git a/pages/readingHistory/index.js b/pages/readingHistory/index.js index 547ef70..792222d 100644 --- a/pages/readingHistory/index.js +++ b/pages/readingHistory/index.js @@ -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) { + + } + } + }) + }, /** * 生命周期函数--监听页面显示 */ diff --git a/pages/readingHistory/index.json b/pages/readingHistory/index.json index 4962fec..f773837 100644 --- a/pages/readingHistory/index.json +++ b/pages/readingHistory/index.json @@ -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" } \ No newline at end of file diff --git a/pages/readingHistory/index.wxml b/pages/readingHistory/index.wxml index 0ee35a1..664201d 100644 --- a/pages/readingHistory/index.wxml +++ b/pages/readingHistory/index.wxml @@ -2,11 +2,48 @@ - + 抄表记录历史 - 新增记录 + 新增记录 + + + + + + + 抄表时间 + 抄表读数 + 操作 + + + + + + {{ item.time }} + + + {{ item.number }} + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/readingHistory/index.wxss b/pages/readingHistory/index.wxss index ba5939a..b5113d5 100644 --- a/pages/readingHistory/index.wxss +++ b/pages/readingHistory/index.wxss @@ -3,7 +3,70 @@ page { background-color: #ebedf0; } +.wrapper { + padding: 0 20rpx 20rpx; + box-sizing: border-box; +} + .historyTitle { display: flex; justify-content: space-between; -} \ No newline at end of file +} + +.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; + } + \ No newline at end of file diff --git a/pages/rechargeDetail/index.js b/pages/rechargeDetail/index.js index dcf73f0..c75c42f 100644 --- a/pages/rechargeDetail/index.js +++ b/pages/rechargeDetail/index.js @@ -94,6 +94,7 @@ Page({ wx.openDocument({ filePath: res.tempFilePath, fileType: [ "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!! + showMenu: true, success: function (res) { resolve() }, diff --git a/pages/rechargeDetail/index.wxml b/pages/rechargeDetail/index.wxml index e054c66..c40f38a 100644 --- a/pages/rechargeDetail/index.wxml +++ b/pages/rechargeDetail/index.wxml @@ -11,7 +11,7 @@ border="{{ false }}" /> { - console.log('fail', res) alertInfo("请稍后重试") }, complete: (res) => { - console.log('complete') that.handleGetMeterDetail(meter.id) } }) diff --git a/pages/workBench/components/account/components/editModal/index.js b/pages/workBench/components/account/components/editModal/index.js new file mode 100644 index 0000000..3fcc8dd --- /dev/null +++ b/pages/workBench/components/account/components/editModal/index.js @@ -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") + } + } +}) \ No newline at end of file diff --git a/pages/workBench/components/account/components/editModal/index.json b/pages/workBench/components/account/components/editModal/index.json new file mode 100644 index 0000000..953d7ac --- /dev/null +++ b/pages/workBench/components/account/components/editModal/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-dialog": "@vant/weapp/dialog/index", + "search-select": "/components/searchSelect/index", + "van-field": "@vant/weapp/field/index" + } +} \ No newline at end of file diff --git a/pages/workBench/components/account/components/editModal/index.wxml b/pages/workBench/components/account/components/editModal/index.wxml new file mode 100644 index 0000000..cbf0761 --- /dev/null +++ b/pages/workBench/components/account/components/editModal/index.wxml @@ -0,0 +1,34 @@ + + + + + + + + + \ No newline at end of file diff --git a/pages/workBench/components/account/components/editModal/index.wxss b/pages/workBench/components/account/components/editModal/index.wxss new file mode 100644 index 0000000..5ddf238 --- /dev/null +++ b/pages/workBench/components/account/components/editModal/index.wxss @@ -0,0 +1 @@ +/* pages/workBench/components/account/components/editModal/index.wxss */ \ No newline at end of file diff --git a/pages/workBench/components/account/components/updatePhoneModal/index.js b/pages/workBench/components/account/components/updatePhoneModal/index.js new file mode 100644 index 0000000..6c15979 --- /dev/null +++ b/pages/workBench/components/account/components/updatePhoneModal/index.js @@ -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") + } + } +}) \ No newline at end of file diff --git a/pages/workBench/components/account/components/updatePhoneModal/index.json b/pages/workBench/components/account/components/updatePhoneModal/index.json new file mode 100644 index 0000000..953d7ac --- /dev/null +++ b/pages/workBench/components/account/components/updatePhoneModal/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-dialog": "@vant/weapp/dialog/index", + "search-select": "/components/searchSelect/index", + "van-field": "@vant/weapp/field/index" + } +} \ No newline at end of file diff --git a/pages/workBench/components/account/components/updatePhoneModal/index.wxml b/pages/workBench/components/account/components/updatePhoneModal/index.wxml new file mode 100644 index 0000000..b222848 --- /dev/null +++ b/pages/workBench/components/account/components/updatePhoneModal/index.wxml @@ -0,0 +1,23 @@ + + + + + + + + \ No newline at end of file diff --git a/pages/workBench/components/account/components/updatePhoneModal/index.wxss b/pages/workBench/components/account/components/updatePhoneModal/index.wxss new file mode 100644 index 0000000..d296a65 --- /dev/null +++ b/pages/workBench/components/account/components/updatePhoneModal/index.wxss @@ -0,0 +1 @@ +/* pages/workBench/components/account/components/updatePhoneModa/index.wxss */ \ No newline at end of file diff --git a/pages/workBench/components/account/index.js b/pages/workBench/components/account/index.js new file mode 100644 index 0000000..676b28b --- /dev/null +++ b/pages/workBench/components/account/index.js @@ -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: "", + }) + } + } +}) \ No newline at end of file diff --git a/pages/workBench/components/account/index.json b/pages/workBench/components/account/index.json new file mode 100644 index 0000000..3ef3d13 --- /dev/null +++ b/pages/workBench/components/account/index.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/workBench/components/account/index.wxml b/pages/workBench/components/account/index.wxml new file mode 100644 index 0000000..f10ad16 --- /dev/null +++ b/pages/workBench/components/account/index.wxml @@ -0,0 +1,142 @@ + + + + + + + + + 添加子账号 + 修改主账号 + + + + + + + + + + {{tenementInfo.shortName}} + {{tenementInfo.fullName}} + + + + + + + + + + 华昌宝能收费 + 物业代收1 + 物业代收2 + 物业代收线损 + {{tenementInfo.contact}} {{tenementInfo.phone}} + + + + + + + + + + + + + + + {{ item.WechatUserName }} + {{ item.WechatPhone }} + + + + + + + + + + + + 管理员 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/workBench/components/account/index.wxss b/pages/workBench/components/account/index.wxss new file mode 100644 index 0000000..007d999 --- /dev/null +++ b/pages/workBench/components/account/index.wxss @@ -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; + } \ No newline at end of file diff --git a/pages/workBench/components/approve/index.js b/pages/workBench/components/approve/index.js deleted file mode 100644 index 6fbd81c..0000000 --- a/pages/workBench/components/approve/index.js +++ /dev/null @@ -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 - }) - } - } -}) \ No newline at end of file diff --git a/pages/workBench/components/approve/index.wxml b/pages/workBench/components/approve/index.wxml deleted file mode 100644 index 219b909..0000000 --- a/pages/workBench/components/approve/index.wxml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - 选择 - - - - - - 搜索 - - - - - - - - - 商户名字 - 充值金额 - 操作 - - - - - - - - - {{ item.tenement.shortName }} - {{ item.money }} - - - 查看详细 - - - - - - - - - - - - - - - - 同意 - 拒绝 - - - - - - - - - - diff --git a/pages/workBench/components/approve/index.wxss b/pages/workBench/components/approve/index.wxss deleted file mode 100644 index 0c73220..0000000 --- a/pages/workBench/components/approve/index.wxss +++ /dev/null @@ -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; -} diff --git a/pages/workBench/components/reading/index.js b/pages/workBench/components/reading/index.js index 391d0f7..45709a1 100644 --- a/pages/workBench/components/reading/index.js +++ b/pages/workBench/components/reading/index.js @@ -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() } } }) \ No newline at end of file diff --git a/pages/workBench/components/reading/index.wxml b/pages/workBench/components/reading/index.wxml index a5e6819..31f4711 100644 --- a/pages/workBench/components/reading/index.wxml +++ b/pages/workBench/components/reading/index.wxml @@ -28,11 +28,34 @@ - 去抄表 + 开始抄表 + 去抄表 + 结束抄表 diff --git a/pages/workBench/components/recharge/components/approve/index.js b/pages/workBench/components/recharge/components/approve/index.js new file mode 100644 index 0000000..0a156f7 --- /dev/null +++ b/pages/workBench/components/recharge/components/approve/index.js @@ -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 + }) + } + } +}) \ No newline at end of file diff --git a/pages/workBench/components/approve/index.json b/pages/workBench/components/recharge/components/approve/index.json similarity index 68% rename from pages/workBench/components/approve/index.json rename to pages/workBench/components/recharge/components/approve/index.json index c992ee6..145ec1b 100644 --- a/pages/workBench/components/approve/index.json +++ b/pages/workBench/components/recharge/components/approve/index.json @@ -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" } } \ No newline at end of file diff --git a/pages/workBench/components/recharge/components/approve/index.wxml b/pages/workBench/components/recharge/components/approve/index.wxml new file mode 100644 index 0000000..6e2a30a --- /dev/null +++ b/pages/workBench/components/recharge/components/approve/index.wxml @@ -0,0 +1,66 @@ + + + + + + + + + 同意 + 拒绝 + + + + + + + + 商户名字 + 充值金额 + 状态 + 提交时间 + 操作 + + + + + + + + + + {{ item.tenement.shortName }} + + + {{ item.money }} + + + {{item.orderStatus}} + + + {{item.topTime}} + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/workBench/components/recharge/components/approve/index.wxss b/pages/workBench/components/recharge/components/approve/index.wxss new file mode 100644 index 0000000..641964d --- /dev/null +++ b/pages/workBench/components/recharge/components/approve/index.wxss @@ -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; + } \ No newline at end of file diff --git a/pages/workBench/components/recharge/components/reharge/index.js b/pages/workBench/components/recharge/components/reharge/index.js new file mode 100644 index 0000000..c6ccf9b --- /dev/null +++ b/pages/workBench/components/recharge/components/reharge/index.js @@ -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) + }) + + } + } +}) \ No newline at end of file diff --git a/pages/workBench/components/recharge/components/reharge/index.json b/pages/workBench/components/recharge/components/reharge/index.json new file mode 100644 index 0000000..b387e17 --- /dev/null +++ b/pages/workBench/components/recharge/components/reharge/index.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/workBench/components/recharge/components/reharge/index.wxml b/pages/workBench/components/recharge/components/reharge/index.wxml new file mode 100644 index 0000000..c300e2b --- /dev/null +++ b/pages/workBench/components/recharge/components/reharge/index.wxml @@ -0,0 +1,50 @@ + + + + + + + + + + + + 确认 + 清空 + + diff --git a/pages/workBench/components/recharge/components/reharge/index.wxss b/pages/workBench/components/recharge/components/reharge/index.wxss new file mode 100644 index 0000000..c33c12d --- /dev/null +++ b/pages/workBench/components/recharge/components/reharge/index.wxss @@ -0,0 +1 @@ +/* pages/workBench/components/recharge/components/reharge/index.wxss */ \ No newline at end of file diff --git a/pages/workBench/components/recharge/index.js b/pages/workBench/components/recharge/index.js index 8cbb125..3943ece 100644 --- a/pages/workBench/components/recharge/index.js +++ b/pages/workBench/components/recharge/index.js @@ -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) - }) - - } + } }) \ No newline at end of file diff --git a/pages/workBench/components/recharge/index.json b/pages/workBench/components/recharge/index.json index 779a6e1..f85134b 100644 --- a/pages/workBench/components/recharge/index.json +++ b/pages/workBench/components/recharge/index.json @@ -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" } } \ No newline at end of file diff --git a/pages/workBench/components/recharge/index.wxml b/pages/workBench/components/recharge/index.wxml index f337f3a..4d02b54 100644 --- a/pages/workBench/components/recharge/index.wxml +++ b/pages/workBench/components/recharge/index.wxml @@ -1,81 +1,20 @@ - - - - 选择 - - - - - 选择 - - - - - - - 选择 - - - - - - - 确认 - 清空 + + + + + 待审核 + + + 已审核 + + + 充值 + + + - + + + + \ No newline at end of file diff --git a/pages/workBench/components/recharge/index.wxss b/pages/workBench/components/recharge/index.wxss index fc3e3af..cf8d8a0 100644 --- a/pages/workBench/components/recharge/index.wxss +++ b/pages/workBench/components/recharge/index.wxss @@ -1 +1,27 @@ -/* pages/workBench/components/recharge/index.wxss */ \ No newline at end of file +/* 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; + } \ No newline at end of file diff --git a/pages/workBench/components/record/index.js b/pages/workBench/components/record/index.js index d16e606..dccf749 100644 --- a/pages/workBench/components/record/index.js +++ b/pages/workBench/components/record/index.js @@ -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; diff --git a/pages/workBench/components/record/index.json b/pages/workBench/components/record/index.json index cd9253e..3d5b800 100644 --- a/pages/workBench/components/record/index.json +++ b/pages/workBench/components/record/index.json @@ -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" } } \ No newline at end of file diff --git a/pages/workBench/components/record/index.wxml b/pages/workBench/components/record/index.wxml index 92b5263..259d77b 100644 --- a/pages/workBench/components/record/index.wxml +++ b/pages/workBench/components/record/index.wxml @@ -1,84 +1,22 @@ - - - 选择 - - + text="{{parkName}}" + bind:search="onParkFocus" +/> - + + - - - 搜索 - - - - - - - - - - 商户名称 - 电表地址 - 电表余额 - 拉合闸 - 是否失联 - - - - - - - - {{ item.tenement.shortName }} - {{ item.address }} - {{ item.amount }} - - 拉闸 - - - 合闸 - - - 在线 - - - 失联 - - - - - - - - - - - - + - + 合闸 拉闸 + + + + + + {{item.tenement.shortName}} + + {{item.tenement.name}} + + + + + + + + + 商户电表 + + 公摊电表 + + 园区电表 + 表号:{{item.meterNo}} + + + + + + + + {{item.address}} + + SN:{{item.meterSn}} + + + + + + + + 表字:{{item.amount}} + + 余额:{{item.money}} + + + + + + + + 合闸 + 拉闸 + 在线 + 失联 + + + + + + + diff --git a/pages/workBench/components/record/index.wxss b/pages/workBench/components/record/index.wxss index 34f106c..59a86ed 100644 --- a/pages/workBench/components/record/index.wxss +++ b/pages/workBench/components/record/index.wxss @@ -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; + } diff --git a/pages/workBench/components/tenement/components/bindMeter/index.js b/pages/workBench/components/tenement/components/bindMeter/index.js new file mode 100644 index 0000000..0ad9d61 --- /dev/null +++ b/pages/workBench/components/tenement/components/bindMeter/index.js @@ -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 }) + } + } +}) \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/bindMeter/index.json b/pages/workBench/components/tenement/components/bindMeter/index.json new file mode 100644 index 0000000..3c2b870 --- /dev/null +++ b/pages/workBench/components/tenement/components/bindMeter/index.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/bindMeter/index.wxml b/pages/workBench/components/tenement/components/bindMeter/index.wxml new file mode 100644 index 0000000..0e2ed30 --- /dev/null +++ b/pages/workBench/components/tenement/components/bindMeter/index.wxml @@ -0,0 +1,121 @@ + + + + + + + 选择 + + + + + + 选择 + + + + + + + + + + + + + + diff --git a/pages/workBench/components/tenement/components/bindMeter/index.wxss b/pages/workBench/components/tenement/components/bindMeter/index.wxss new file mode 100644 index 0000000..3fb490f --- /dev/null +++ b/pages/workBench/components/tenement/components/bindMeter/index.wxss @@ -0,0 +1 @@ +/* pages/workBench/components/tenement/components/bindMeter/index.wxss */ \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/createTenement/index.js b/pages/workBench/components/tenement/components/createTenement/index.js new file mode 100644 index 0000000..da2774b --- /dev/null +++ b/pages/workBench/components/tenement/components/createTenement/index.js @@ -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() { + + } +}) \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/createTenement/index.json b/pages/workBench/components/tenement/components/createTenement/index.json new file mode 100644 index 0000000..b97afff --- /dev/null +++ b/pages/workBench/components/tenement/components/createTenement/index.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/createTenement/index.wxml b/pages/workBench/components/tenement/components/createTenement/index.wxml new file mode 100644 index 0000000..e1f06bb --- /dev/null +++ b/pages/workBench/components/tenement/components/createTenement/index.wxml @@ -0,0 +1,74 @@ + + + + + + + + + + + 选择 + + + + + 选择 + + + + + \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/createTenement/index.wxss b/pages/workBench/components/tenement/components/createTenement/index.wxss new file mode 100644 index 0000000..45f4ed9 --- /dev/null +++ b/pages/workBench/components/tenement/components/createTenement/index.wxss @@ -0,0 +1 @@ +/* pages/workBench/components/tenement/components/createTenement/index.wxss */ \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/kaihu/index.js b/pages/workBench/components/tenement/components/kaihu/index.js new file mode 100644 index 0000000..f51c36d --- /dev/null +++ b/pages/workBench/components/tenement/components/kaihu/index.js @@ -0,0 +1,124 @@ +// pages/workBench/components/tenement/components/kaihu/index.js +import { alertInfo, alertSuccess } from "../../../../../../utils/index" +import { createBackTenement, updateTenementBackInfo } from "../../../../../../service/tenement" +import request from "../../../../../../utils/request" +import { payWays, feeType as feeTypeList } from "../../../../../../utils/data"; +const { OK } = request; +Component({ + + /** + * 组件的属性列表 + */ + properties: { + park: String, + visible: Boolean, + defaultValue: Object, + editType: String, + title: String, + }, + observers: { + 'defaultValue': function(defaultValue) { + const { fullName, shortName, phone, id, feeType, address, building, buildingName, contact,} = defaultValue; + this.setData({ + name: fullName, + shortName, + phone, id, feeType, address, building, buildingName, contact, + feeTypeName: feeTypeList[feeType] + }) + } + }, + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + 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: 'feeType' + }) + }, + onConfirm(e) { + const { type, data, way } = e.detail; + switch(type) { + case "building": + this.setData({ + building: data.id, + buildingName: data.name, + show: false, + }) + return; + case "feeType": + this.setData({ + feeTypeName: data, + feeType: way, + show: false, + }) + } + }, + + onCancel() { + this.setData({ show: false }) + }, + onClose() { + this.triggerEvent("close") + }, + onChange(e) { + const { name } = e.currentTarget.dataset; + this.setData({ + [name]: e.detail + }) + }, + clear() { + this.setData({ + name: "", shortName: "", address: "", contact: "", phone: "", + building: "", feeType: "", buildingName: "", feeTypeName: "", id, + }) + }, + async onSubmit() { + const { name, shortName, address, contact, phone, building, feeType, park, editType, id } = this.data; + if (editType === "add") { + const { code, message } = await createBackTenement(park, { name, shortName, address, contact, phone, building, feeType }) + if (code !== OK) { + alertInfo(message) + return + } + alertSuccess("开户成功") + this.triggerEvent("ok") + return; + } + const { code, message } = await updateTenementBackInfo(park, id, { name, shortName, address, contact, phone, building, feeType }) + if (code !== OK) { + alertInfo(message) + return; + } + alertSuccess("编辑成功") + this.triggerEvent("ok") + } + }, + +}) \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/kaihu/index.json b/pages/workBench/components/tenement/components/kaihu/index.json new file mode 100644 index 0000000..f5d5fc8 --- /dev/null +++ b/pages/workBench/components/tenement/components/kaihu/index.json @@ -0,0 +1,10 @@ +{ + "component": true, + "usingComponents": { + "search-select": "/components/searchSelect/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "navigator": "/components/navigator/index", + "van-dialog": "@vant/weapp/dialog/index" + } +} \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/kaihu/index.wxml b/pages/workBench/components/tenement/components/kaihu/index.wxml new file mode 100644 index 0000000..04ff43a --- /dev/null +++ b/pages/workBench/components/tenement/components/kaihu/index.wxml @@ -0,0 +1,100 @@ + + + + + + + + + + + 选择 + + + + + 选择 + + + + + + \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/kaihu/index.wxss b/pages/workBench/components/tenement/components/kaihu/index.wxss new file mode 100644 index 0000000..d4caef1 --- /dev/null +++ b/pages/workBench/components/tenement/components/kaihu/index.wxss @@ -0,0 +1 @@ +/* pages/workBench/components/tenement/components/kaihu/index.wxss */ \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/unBindMeter/index.js b/pages/workBench/components/tenement/components/unBindMeter/index.js new file mode 100644 index 0000000..ebdda83 --- /dev/null +++ b/pages/workBench/components/tenement/components/unBindMeter/index.js @@ -0,0 +1,101 @@ +// pages/workBench/components/tenement/components/bindMeter/index.js + +import { unbindMeter, } from "../../../../../../service/tenement" +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({ + + /** + * 组件的属性列表 + */ + properties: { + tenement: String, + park: String, + tenementName: String, + meterId: String, + meterAddress: String, + visible:Boolean, + }, + observers: { + "meterId": function(newValue) { + this.getMeterDetail(newValue) + } + }, + /** + * 组件的初始数据 + */ + data: { + dateTimeShow: false + }, + + /** + * 组件的方法列表 + */ + methods: { + onMeterFocus(e) { + const { park } = this.data; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "电表", + type: 'meter' + }) + }, + 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 ? '合闸' : "分闸" + }) + }, + onClose() { + this.triggerEvent("close") + }, + onChange(e) { + const { name } = e.currentTarget.dataset; + this.setData({ + [name]: e.detail + }) + }, + async onSubmit() { + 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) + return + } + 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 }) + } + } +}) \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/unBindMeter/index.json b/pages/workBench/components/tenement/components/unBindMeter/index.json new file mode 100644 index 0000000..3c2b870 --- /dev/null +++ b/pages/workBench/components/tenement/components/unBindMeter/index.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/workBench/components/tenement/components/unBindMeter/index.wxml b/pages/workBench/components/tenement/components/unBindMeter/index.wxml new file mode 100644 index 0000000..7a9952f --- /dev/null +++ b/pages/workBench/components/tenement/components/unBindMeter/index.wxml @@ -0,0 +1,100 @@ + + + + + + + + 选择 + + + + + + + + + + + + diff --git a/pages/workBench/components/tenement/components/unBindMeter/index.wxss b/pages/workBench/components/tenement/components/unBindMeter/index.wxss new file mode 100644 index 0000000..3fb490f --- /dev/null +++ b/pages/workBench/components/tenement/components/unBindMeter/index.wxss @@ -0,0 +1 @@ +/* pages/workBench/components/tenement/components/bindMeter/index.wxss */ \ No newline at end of file diff --git a/pages/workBench/components/tenement/index.js b/pages/workBench/components/tenement/index.js new file mode 100644 index 0000000..acf713a --- /dev/null +++ b/pages/workBench/components/tenement/index.js @@ -0,0 +1,190 @@ +import { alertInfo, alertSuccess } from "../../../../utils/index"; +import { getTenementBackInfo, unbindMeter, } from "../../../../service/tenement" +import { getBackTenementMeters, } from "../../../../service/meter" +import request from "../../../../utils/request" +const { OK } = request +// pages/workBench/components/tenement/index.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + defaultValue: {}, + editType: "", + meterList: [], + // bindMeter + }, + /** + * 组件的方法列表 + */ + methods: { + onParkFocus(e) { + this.setData({ + show: true, + title: "园区", + type: 'park' + }) + }, + onTenementFocus(e) { + const { park } = this.data; + const that = this; + if (!park) { + alertInfo("请先选择园区") + return; + } + this.setData({ + show: true, + title: "商户", + type: 'tenement' + }) + }, + async init() { + + }, + async getTenementInfo() { + const { tenement, park } = this.data; + if (!tenement || !park) { + return; + } + const { code, message, tenement: data } = await getTenementBackInfo(park, tenement) + if (code !== OK) { + alertInfo(message) + return; + } + this.setData({ + tenementInfo: data, + }) + }, + onConfirm(e) { + const { type, data } = e.detail; + const that = this; + 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.getTenementInfo(); + that.getTenementMeters(); + }) + break; + } + }, + onCancel() { + this.setData({ + show: false, + }) + }, + startKh() { + this.setData({ + kaihuVisible: true, + editType: "add", + title: "开户", + defaultValue: { feeType: 0, feeTypeName: "华昌宝能收费" } + }) + }, + startUpdateInfo() { + const { tenementInfo } = this.data; + this.setData({ + kaihuVisible: true, + defaultValue: tenementInfo, + editType: "update", + title: "开户" + }) + }, + async getTenementMeters() { + const { park, tenement } = this.data; + const { code, message, data } = await getBackTenementMeters(park, tenement) + if (code !== OK) { + alertInfo(message) + return + } + this.setData({ meterList: data }); + }, + onKaihuClose() { + this.setData({ + kaihuVisible: false, + defaultValue: {}, + title: "编辑", + editType: "", + }) + }, + onBindClose() { + this.setData({ + bindVisible: false, + }) + }, + async onKaihuConfirm() { + this.getTenementInfo(); + this.onKaihuClose(); + }, + unbind(e) { + const that = this; + const { park, tenement } = this.data; + const { address, id } = e.currentTarget.dataset; + this.setData({ + unbindVisible: true, + meterId: id, + meterAddress: address + }) + // wx.showModal({ + // title: '提示', + // content: `确认要解绑${address}吗?`, + // complete: async (res) => { + // if (res.cancel) { + + // } + + // if (res.confirm) { + // const { code, message, } = await unbindMeter(park, tenement, id); + // if (code !== OK) { + // alertInfo(message) + // return + // } + // alertSuccess("解绑成功") + // that.getTenementMeters(); + // return + // } + // } + // }) + }, + onUnbindOk() { + this.setData({ + unbindVisible: false, + meterId: "", + meterAddress: "", + }) + this.getTenementMeters(); + }, + startBind() { + this.setData({ + bindVisible: true + }) + }, + onBindOk() { + this.setData({ + bindVisible: false, + }) + this.getTenementMeters(); + }, + onTimeConfirm(e) { + + } + } +}) \ No newline at end of file diff --git a/pages/workBench/components/tenement/index.json b/pages/workBench/components/tenement/index.json new file mode 100644 index 0000000..f551c64 --- /dev/null +++ b/pages/workBench/components/tenement/index.json @@ -0,0 +1,15 @@ +{ + "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", + "kaihu": "./components/kaihu/index", + "bindMeter": "./components/bindMeter/index", + "unBindMeter": "./components/unBindMeter/index", + "van-row": "@vant/weapp/row/index", + "van-col": "@vant/weapp/col/index", + "searchSelectWrapper": "/components/searchSelectWrapper/index" + } +} \ No newline at end of file diff --git a/pages/workBench/components/tenement/index.wxml b/pages/workBench/components/tenement/index.wxml new file mode 100644 index 0000000..a073cb9 --- /dev/null +++ b/pages/workBench/components/tenement/index.wxml @@ -0,0 +1,135 @@ + + + + + + + + 绑定电表 + 修改信息 + + 开户 + + + + + + + + + + + {{tenementInfo.shortName}} + {{tenementInfo.fullName}} + + + 华昌宝能收费 + 物业代收1 + 物业代收2 + 物业代收线损 + {{tenementInfo.contact}} {{tenementInfo.phone}} + + + + + + + + + + + + + + + + + + + {{ item.address }} + {{ item.meterSn }} + + + 解绑 + + + + + + + + + + + + + + + + diff --git a/pages/workBench/components/tenement/index.wxss b/pages/workBench/components/tenement/index.wxss new file mode 100644 index 0000000..09f3390 --- /dev/null +++ b/pages/workBench/components/tenement/index.wxss @@ -0,0 +1,70 @@ +/* pages/workBench/components/tenement/index.wxss */ + +.table { + width: 890rpx; +} + +.classWrapper { + width: 100vw; + overflow-x: auto; +} + +.thead { + display: flex; + flex-wrap: nowrap; + border-bottom: 1rpx solid #EEEEEE; +} + +.thead .th { + padding: 20rpx; + white-space: nowrap; + text-align: center; + box-sizing: border-box; + +} + +.tbody .tr { + padding: 20rpx; + box-sizing: border-box; + display: flex; + align-items: center; + flex-wrap: nowrap; +} + +.tbody .th { + word-break: break-all; + text-align: center; +} + +.primaryTextBtn { + color: #1989fa; +} + + +.customTable { + margin: 20rpx; + font-size: 32rpx; +} + +.customTableTile { + background-color: var(--light-green); + box-sizing: border-box; + font-weight: 700; +} + +.tableTitleRow { + padding: 16rpx; +} + +.tableRow { + + padding: 16rpx; + border: 1rpx solid #ccc; + border-top: 0rpx; + font-size: 32rpx; +} + +page { + background-color: rgb(228,240,236); + font-size: 32rpx; + } \ No newline at end of file diff --git a/pages/workBench/index.js b/pages/workBench/index.js index 59a7db7..0480db6 100644 --- a/pages/workBench/index.js +++ b/pages/workBench/index.js @@ -5,7 +5,7 @@ Page({ * 页面的初始数据 */ data: { - active: 3 + active: 4 }, /** diff --git a/pages/workBench/index.json b/pages/workBench/index.json index 3ebca20..79d4a84 100644 --- a/pages/workBench/index.json +++ b/pages/workBench/index.json @@ -3,10 +3,11 @@ "van-tab": "@vant/weapp/tab/index", "van-tabs": "@vant/weapp/tabs/index", "navigator": "/components/navigator/index", - "approve": "./components/approve/index", "recharge": "./components/recharge/index", "record": "./components/record/index", - "reading": "./components/reading/index" + "reading": "./components/reading/index", + "tenement": "./components/tenement/index", + "account": "./components/account/index" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/workBench/index.wxml b/pages/workBench/index.wxml index a568bfa..ba382f5 100644 --- a/pages/workBench/index.wxml +++ b/pages/workBench/index.wxml @@ -1,14 +1,17 @@ - - - - + - - + + + + + + + + diff --git a/pages/writeReading/components/meterInfo/index.js b/pages/writeReading/components/meterInfo/index.js index 71eb438..355005b 100644 --- a/pages/writeReading/components/meterInfo/index.js +++ b/pages/writeReading/components/meterInfo/index.js @@ -5,7 +5,7 @@ Component({ * 组件的属性列表 */ properties: { - + meterInfo: Object, }, /** diff --git a/pages/writeReading/components/meterInfo/index.wxml b/pages/writeReading/components/meterInfo/index.wxml index 2212fd0..8321adf 100644 --- a/pages/writeReading/components/meterInfo/index.wxml +++ b/pages/writeReading/components/meterInfo/index.wxml @@ -21,37 +21,46 @@ 编号 - 1202312423524 + {{meterInfo.meterSn}} - 编号 + 类型 - - 1202312423524 + + 商户电表 + + + 公区电表 + + + 公摊电表 - 编号 + 状态 - - 1202312423524 + + 正常 + + + 停用 - 编号 + 读数 - 1202312423524 + {{meterInfo.overall}} diff --git a/pages/writeReading/components/meterList/components/meterItem/index.js b/pages/writeReading/components/meterList/components/meterItem/index.js index 56c111e..8295f38 100644 --- a/pages/writeReading/components/meterList/components/meterItem/index.js +++ b/pages/writeReading/components/meterList/components/meterItem/index.js @@ -6,6 +6,7 @@ Component({ */ properties: { active: Boolean, + meter: Object }, observers: { "active": function (newValue) { diff --git a/pages/writeReading/components/meterList/components/meterItem/index.wxml b/pages/writeReading/components/meterList/components/meterItem/index.wxml index 82ca0b8..e097bcc 100644 --- a/pages/writeReading/components/meterList/components/meterItem/index.wxml +++ b/pages/writeReading/components/meterList/components/meterItem/index.wxml @@ -1,4 +1,4 @@ - 标1东-3071312452636756756857 + {{meter.meterAddress}} \ No newline at end of file diff --git a/pages/writeReading/components/meterList/components/meterItem/index.wxss b/pages/writeReading/components/meterList/components/meterItem/index.wxss index 145c041..c0decfc 100644 --- a/pages/writeReading/components/meterList/components/meterItem/index.wxss +++ b/pages/writeReading/components/meterList/components/meterItem/index.wxss @@ -14,6 +14,8 @@ height: 150rpx; display: flex; align-items: center; + text-align: center; + justify-content: center; } .deepBg { diff --git a/pages/writeReading/components/meterList/index.js b/pages/writeReading/components/meterList/index.js index 6c1e8f8..c63547a 100644 --- a/pages/writeReading/components/meterList/index.js +++ b/pages/writeReading/components/meterList/index.js @@ -1,13 +1,37 @@ // pages/writeReading/components/meterList/index.js +import { getMeterReadingRouteMeterDetail } from "../../../../service/workBench" +import request from "../../../../utils/request" +import { alertInfo, alertSuccess, alertError } from "../../../../utils/index" +const { OK } = request; + Component({ /** * 组件的属性列表 */ properties: { - + list: Array, + active: Number, + meterInfo: Object + }, + observers: { + "active,list": function(newActive, newList) { + if (newActive >= 0 && newList.length) { + this.getMeterInfo(newList?.[newActive]?.meterId, newActive, true) + } + if (newActive === 0) { + this.setData({ scrollLeft: 0 }) + } else if (newActive > 0) { + this.setData({ scrollLeft: 220 * newList.length - 20 }) + } + const { scrollWidth } = this.data; + if (scrollWidth) { + this.setData({ + maxScrollLeft: newList?.length ? 220 * newList.length - (scrollWidth || 0) - 20 : 0, + }) + } + } }, - /** * 组件的初始数据 */ @@ -15,16 +39,22 @@ Component({ animationData: {}, // 存储动画数据 position: 0, scrollLeft: 0, // 当前滚动位置 - maxScrollLeft: 0 // 最大可滚动距离 + maxScrollLeft: 0, // 最大可滚动距离 }, lifetimes: { attached() { + const that = this; const query = this.createSelectorQuery(); - // query.select('.scroll-content').boundingClientRect(); - console.log("query", query) - query.select('.meterListScrollView').boundingClientRect((rect) => { - console.log("rect", rect) - }); + query.select('.meterListScrollView').boundingClientRect() + query.exec(function(res){ + const { list } = that.data; + const length = that.data.list?.length || 0; + that.setData({ + maxScrollLeft:length ? 220 * list.length - (res?.[0]?.width || 0) - 20 : 0, + scrollWidth: res?.[0]?.width || 0 + }) + }) + } }, @@ -61,15 +91,29 @@ Component({ }); }, - onChangeMeter() { - console.log("---------------") + handleSelect(e) { + const { id, index } = e.currentTarget.dataset; + this.getMeterInfo(id, index) }, - onScroll(e) { - // 实时更新当前滚动位置,可用于更复杂的边界判断 - this.setData({ - scrollLeft: e.detail.scrollLeft - }); + async getMeterInfo(id, index, noChange) { + const { code, message, data } = await getMeterReadingRouteMeterDetail(id) + if (code !== OK) { + alertError(message) + return; + } + if (noChange) { + this.triggerEvent("changeMeter", { meter: data }) + return; + } + this.triggerEvent("changeMeterAndIndex", { index: index, meter: data }) }, + // onScroll(e) { + // // 实时更新当前滚动位置,可用于更复杂的边界判断 + // console.log("e", e) + // this.setData({ + // scrollLeft: e.detail.scrollLeft + // }); + // }, scrollLeft() { // 向左滚动:减少 scrollLeft,但不能小于0 diff --git a/pages/writeReading/components/meterList/index.wxml b/pages/writeReading/components/meterList/index.wxml index 7979904..e0929e8 100644 --- a/pages/writeReading/components/meterList/index.wxml +++ b/pages/writeReading/components/meterList/index.wxml @@ -14,16 +14,15 @@ scroll-with-animation="true" > - - - - - - - - - - + diff --git a/pages/writeReading/components/readingInfo/index.js b/pages/writeReading/components/readingInfo/index.js index 8a10b83..5271828 100644 --- a/pages/writeReading/components/readingInfo/index.js +++ b/pages/writeReading/components/readingInfo/index.js @@ -1,18 +1,26 @@ // pages/writeReading/components/readingInfo/index.js + +import { createReading } from "../../../../service/workBench" +import { alertError, alertInfo, alertSuccess } from "../../../../utils/index" +import request from "../../../../utils/request" +const { OK } = request + Component({ /** * 组件的属性列表 */ properties: { - + meterInfo: Object, + showLeft: Boolean, + showRight: Boolean, }, /** * 组件的初始数据 */ data: { - + currentNumber: null }, /** @@ -20,9 +28,79 @@ Component({ */ methods: { jumpToHistory() { + const { meterInfo } = this.data; wx.navigateTo({ - url: '/pages/readingHistory/index', + url: `/pages/readingHistory/index?meter=${meterInfo?.id}&park=${meterInfo?.park}`, }) + }, + handlePrev() { + this.triggerEvent("prev") + }, + handleNext() { + this.triggerEvent("next") + }, + onChange(e) { + this.setData({ + currentNumber: e.detail ? Number(e.detail) : 0 + }) + }, + handleClear() { + this.setData({ + currentNumber: null, + }) + }, + async onSubmit() { + const { meterInfo, currentNumber } = this.data; + const { parkId, id } = meterInfo; + const { code, message } = await createReading(parkId, id, { + overall: `${currentNumber}`, + flat: `${currentNumber}` + }) + if (code !== OK) { + alertError(message) + return + } + alertSuccess("录入成功") + this.handleNext() + this.handleClear() + }, + handleCreateReading() { + const { meterInfo, currentNumber } = this.data; + if (currentNumber == null || currentNumber == undefined) { + alertInfo("请填写本次表字后保存") + return; + } + const that = this; + wx.showModal({ + title: '提示', + content: '确定要录入吗?', + complete: (res) => { + if (res.cancel) { + + } + + if (res.confirm) { + if (meterInfo.consumption < currentNumber) { + wx.showModal({ + title: '提示', + content: '本次用电量已抄过历史平均水平的100%,是否确认录入?', + complete: (res) => { + if (res.cancel) { + + } + + if (res.confirm) { + that.onSubmit() + } + } + }) + } else { + that.onSubmit() + } + } + } + }) + } } }) \ No newline at end of file diff --git a/pages/writeReading/components/readingInfo/index.json b/pages/writeReading/components/readingInfo/index.json index 4f14d22..bb2a743 100644 --- a/pages/writeReading/components/readingInfo/index.json +++ b/pages/writeReading/components/readingInfo/index.json @@ -3,8 +3,8 @@ "usingComponents": { "van-button": "@vant/weapp/button/index", "van-divider": "@vant/weapp/divider/index", - "custom-input": "/components/input/index", "van-icon": "@vant/weapp/icon/index", - "photo": "../photo/index" + "photo": "../photo/index", + "van-field": "@vant/weapp/field/index" } } \ No newline at end of file diff --git a/pages/writeReading/components/readingInfo/index.wxml b/pages/writeReading/components/readingInfo/index.wxml index 26fb653..83ff7f5 100644 --- a/pages/writeReading/components/readingInfo/index.wxml +++ b/pages/writeReading/components/readingInfo/index.wxml @@ -16,12 +16,20 @@ 当前电表 - 标1东-307 + {{meterInfo.address}} - 上一块 - 下一块 + + + 上一块 + + + + 下一块 + + + @@ -30,11 +38,11 @@ 上次表字 - 3318 + {{meterInfo.overall}} - 2025年08月12日 + {{meterInfo.readAt}} @@ -42,8 +50,15 @@ 本次表字 + - + @@ -54,19 +69,19 @@ 表字差 - - 0 + + {{(currentNumber || 0) - meterInfo.overall}} - - 0 + + {{(currentNumber || 0) - meterInfo.overall}} - 确定录入 + 确定录入 - 清除记录 + 清除记录 diff --git a/pages/writeReading/index.js b/pages/writeReading/index.js index ec36139..eb45049 100644 --- a/pages/writeReading/index.js +++ b/pages/writeReading/index.js @@ -1,20 +1,63 @@ // pages/writeReading/index.js +import { getMeterReadingRouteDetail } from "../../service/workBench" +import request from "../../utils/request" +import { alertSuccess, alertInfo, alertError } from "../../utils/index" +const { OK } = request Page({ /** * 页面的初始数据 */ data: { - + meterList: [], + meterInfo: {}, + active: 0, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + const { id } = options; + this.getMeterList(id) + }, + async getMeterList(id) { + const { code, message, data } = await getMeterReadingRouteDetail(id); + if (code !== OK) { + alertError(message) + return; + } + this.setData({ + meterList: data?.meterRouteDetail || [], + meterInfo: data?.meterRouteDetail?.[0] || {} + }) + }, + changeMeter(e) { + this.setData({ + meterInfo: e.detail.meter, + }) + }, + changeMeterAndIndex(e) { + this.setData({ + meterInfo: e.detail.meter, + active: e.detail.index, + }) + }, + handleNext() { + const { active = 0, meterList } = this.data; + let newIndex = active + 1 + if (active > meterList?.length - 1) { + newIndex = meterList?.length - 1 + } + this.setData({ + active: newIndex + }) + }, + handlePrev() { + this.setData({ + active: this.data.active === 0 ? 0 : this.data.active - 1 + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ @@ -62,5 +105,5 @@ Page({ */ onShareAppMessage() { - } + }, }) \ No newline at end of file diff --git a/pages/writeReading/index.wxml b/pages/writeReading/index.wxml index 8223fb7..5d4aabe 100644 --- a/pages/writeReading/index.wxml +++ b/pages/writeReading/index.wxml @@ -1,5 +1,17 @@ - - - \ No newline at end of file + + + \ No newline at end of file diff --git a/project.config.json b/project.config.json index cafe0d2..f3d808a 100644 --- a/project.config.json +++ b/project.config.json @@ -37,7 +37,15 @@ } ], "minifyWXSS": true, - "ignoreUploadUnusedFiles": false + "ignoreUploadUnusedFiles": false, + "compileWorklet": false, + "minifyWXML": true, + "localPlugins": false, + "disableUseStrict": false, + "useCompilerPlugins": false, + "condition": false, + "swc": false, + "disableSWC": true }, "editorSetting": { "tabIndent": "insertSpaces", @@ -48,5 +56,8 @@ "ignore": [], "include": [] }, - "appid": "wxb34b4e70f8a5c6f1" + "appid": "wxb34b4e70f8a5c6f1", + "libVersion": "development", + "simulatorPluginLibVersion": {}, + "projectname": "electricity_bill_calc_wx" } \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index d9527e2..f3e205e 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -4,12 +4,32 @@ "setting": { "compileHotReLoad": true, "urlCheck": false, - "skylineRenderEnable": true + "skylineRenderEnable": true, + "coverView": true, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "autoAudits": false, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "useStaticServer": false, + "useLanDebug": false, + "showES6CompileOption": false, + "checkInvalidKey": true, + "ignoreDevUnusedFiles": true, + "bigPackageSizeSupport": false }, "libVersion": "development", "condition": { "miniprogram": { "list": [ + { + "name": "pages/writeReading/index", + "pathName": "pages/writeReading/index", + "query": "id=PR00117566262804481", + "launchMode": "default", + "scene": null + }, { "name": "pages/readingHistory/index", "pathName": "pages/readingHistory/index", @@ -18,29 +38,15 @@ "scene": null }, { - "name": "pages/writeReading/index", - "pathName": "pages/writeReading/index", + "name": "pages/workBench/index", + "pathName": "pages/workBench/index", "query": "", "launchMode": "default", "scene": null }, { - "name": "pages/aid/consult/index", - "pathName": "pages/aid/consult/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "pages/aid/law/index", - "pathName": "pages/aid/law/index", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "pages/my/index", - "pathName": "pages/my/index", + "name": "pages/workBench/index", + "pathName": "pages/workBench/index", "query": "", "launchMode": "default", "scene": null @@ -60,15 +66,29 @@ "scene": null }, { - "name": "pages/publicTransfer/index", - "pathName": "pages/publicTransfer/index", - "query": "money=50&meterId=METER00071009940341737&tenementId=T00069259189616641&tenementName=%E5%8D%8E%E6%98%8C%E5%AE%9D%E8%83%BD&park=P00070370277523457", + "name": "childPackage/pages/electricQuery/index", + "pathName": "childPackage/pages/electricQuery/index", + "query": "", "launchMode": "default", "scene": null }, { - "name": "pages/special/index", - "pathName": "pages/special/index", + "name": "pages/workBench/index", + "pathName": "pages/workBench/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "childPackage/pages/electricQuery/index", + "pathName": "childPackage/pages/electricQuery/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "childPackage/pages/electricQuery/index", + "pathName": "childPackage/pages/electricQuery/index", "query": "", "launchMode": "default", "scene": null diff --git a/service/accounting.js b/service/accounting.js index 8892afe..5c8ade0 100644 --- a/service/accounting.js +++ b/service/accounting.js @@ -15,9 +15,9 @@ export const getElectricityList = async function({ meter, type, time, page }) { } // 抄表记录列表 -export const getMeterReadingList = async function(meter) { +export const getMeterReadingList = async function({ id = '', time, page }) { const tenement = wx.getStorageSync('tenement')?.id || "" - return await GET(`/wx/getMeterReadingList?tenement=${tenement}&meter=${meter}`); + return await GET(`/wx/getMeterReadingList?tenement=${tenement}&meter=${id}&page=${page}&readAt=${time}`); } // 账务余额列表 export const getAccountingList = async function(meter) { diff --git a/service/calc.js b/service/calc.js new file mode 100644 index 0000000..2479450 --- /dev/null +++ b/service/calc.js @@ -0,0 +1,9 @@ +import apis from '../utils/request'; +import { replaceSpecialIcon } from '../utils/index' +const { GET, POST, PUT, DELETE } = apis + +// 获取电表列表 +export const getDayCalcList = async function({ page, size, startTime, endTime, codeId }) { + const park = wx.getStorageSync('park') + return await GET(`/accounting/getEveryDayAccountingList?park=${park?.id}&page=${page}&size=${size}&startTime=${startTime}&endTime=${endTime}&codeId=${codeId}`); +} \ No newline at end of file diff --git a/service/meter.js b/service/meter.js index 3d1191e..14d3b57 100644 --- a/service/meter.js +++ b/service/meter.js @@ -1,4 +1,5 @@ import apis from '../utils/request'; +import { replaceSpecialIcon } from '../utils/index' const { GET, POST, PUT, DELETE } = apis // 获取电表列表 @@ -18,18 +19,25 @@ export const getTenementMeterList = async function(tid) { // 获取某一园区下的电表列表 export const getParkMeterList = async function({park = "", keyword = "", page = 1}) { - return await GET(`/equipment/getOperateMeterList?page=${page}&park=${park}&keyword=${escape(keyword)}`); + return await GET(`/equipment/getOperateMeterList?page=${page}&park=${park}&keyword=${replaceSpecialIcon(keyword)}`); } // 获取某一园区下的简洁电表列表 export const getParkSimpleMeterList = async function({park = "", keyword = "", page = 1}) { - return await GET(`/work/getWorkMeter?page=${page}&park=${park}&keyword=${escape(keyword)}`); + return await GET(`/work/getWorkMeter?page=${page}&park=${park}&keyword=${replaceSpecialIcon(keyword)}`); } - +// 获取商户下的电表,后台 +export const getBackTenementMeters = async function(park, tenement) { + return await GET(`/vx/getWorkMeterDetails?park=${park}&tenement=${tenement}`); +} // 拉合闸 export const handleOperateMeterSwitch = async function({ ids = [], status }) { return await PUT(`/equipment/batchSwtich`, { ids, status }); +} +// 绑定时获取电表的最新信息 +export const getWorkMeterDetail = async function(code = '') { + return await GET(`/vx/getWorkMeterDetail?code=${code}`); } \ No newline at end of file diff --git a/service/park.js b/service/park.js index 6b8e536..633f289 100644 --- a/service/park.js +++ b/service/park.js @@ -1,4 +1,5 @@ import apis from '../utils/request'; +import { replaceSpecialIcon } from '../utils/index' const { GET, POST, PUT, DELETE } = apis // 获取园区列表 @@ -8,5 +9,15 @@ export const getParkList = async function({ keyword = "" }) { // 获取未登录的园区列表 export const getLoginParkList = async function({ keyword }) { - return await GET(`/wx/getLoginParkList?keyword=${keyword}`); + return await GET(`/wx/getLoginParkList?keyword=${replaceSpecialIcon(keyword)}`); +} + +// 获取建筑列表 +export const getParkBuildingList = async function(pid) { + return await GET(`/vx/park/${pid}/building`); +} + +// 获取指定园区指定月份核算的详细信息 +export const getParkInfoByTime = async function(pid, period, method) { + return await GET(`/park/getReportParkIndex/${pid}?period=${period}&method=${method}`); } \ No newline at end of file diff --git a/service/recharge.js b/service/recharge.js index 723990e..e53d768 100644 --- a/service/recharge.js +++ b/service/recharge.js @@ -1,4 +1,5 @@ import apis from '../utils/request'; +import { replaceSpecialIcon } from '../utils/index' const { GET, POST, PUT, DELETE } = apis // 获取充值记录 @@ -33,8 +34,8 @@ export const handleRecharge = async function(park, data) { } // 获取后台审核列表 -export const getRechargeApproveList = async function({park = "", page, keyword}) { - return await GET(`/wx/getTopExamineList?park=${park}&page=${page}&keyword=${escape(keyword)}`) +export const getRechargeApproveList = async function({park = "", page, keyword, status}) { + return await GET(`/wx/getTopExamineList?park=${park}&page=${page}&keyword=${replaceSpecialIcon(keyword)}&status=${status}`) } // 对公审核 diff --git a/service/report.js b/service/report.js index cc12aff..66062e0 100644 --- a/service/report.js +++ b/service/report.js @@ -2,7 +2,7 @@ import apis from '../utils/request'; const { GET, POST, PUT, DELETE } = apis // 获取电费账单 -export const getReportDetail = async function(id) { +export const getReportDetail = async function(id, tid) { const tenement = wx.getStorageSync('tenement') - return await GET(`/report/${id}/tenement/${tenement?.id}`); + return await GET(`/report/${id}/tenement/${tid || tenement?.id}`); } \ No newline at end of file diff --git a/service/system.js b/service/system.js index 0e81520..d8fd557 100644 --- a/service/system.js +++ b/service/system.js @@ -69,4 +69,30 @@ export const getAidDetail = async function(id) { // 提交财务/律师援助 export const askAid = async function(data) { return await POST(`/wx/aid/approve`, data); -} \ No newline at end of file +} + +// 获取当前积分 +export const getCurrentIntegral = async function() { + return await GET(`/integral/getWxIntegralList`); +} + +// 获取积分明细 +export const getIntegralRecord = async function({ page, size }) { + return await GET(`/integral/getWxIntegralList/detail?page=${page}&size=${size}`); +} + +// 获取优惠券列表 +export const getRedeemableCoupons = async function({ page = '', size = '', type }) { + return await GET(`/wx/getRedeemableCoupons?page=${page}&size=${size}&type=${type}`); +} + +// 兑换/领取优惠券 +export const redeemCoupons = async function({ id, type }) { + return await POST(`/wx/redeemCoupons`, { id, type }); +} + +// 获取当前拥有的优惠券列表 +export const getCurrentCoupons = async function() { + return await GET(`/wx/getCurrentCoupons`); +} + diff --git a/service/tenement.js b/service/tenement.js index dbdfa46..e26e11e 100644 --- a/service/tenement.js +++ b/service/tenement.js @@ -1,9 +1,15 @@ import apis from '../utils/request'; +import { replaceSpecialIcon } from '../utils/index' const { GET, POST, PUT, DELETE } = apis // 获取园区id模糊搜索商户列表 export const getTenementList = async function({ park, keyword }) { - return await GET(`/wx/getTenementList?park=${park}&keyword=${keyword}`); + return await GET(`/wx/getTenementList?park=${park}&keyword=${replaceSpecialIcon(keyword)}`); +} + +// 后台用户获取园区id模糊搜索商户列表 +export const getWxTenementList = async function({ park, keyword }) { + return await GET(`/vx/getTenementList?park=${park}&keyword=${replaceSpecialIcon(keyword)}`); } // 获取名下所有的商户 @@ -11,7 +17,7 @@ export const getOwnTenementList = async function() { return await GET(`/wx/getOwnTenements`); } -// 获取商户详情 +// 获取商户详情(简易) export const getTenementDetail = async function(id) { return await GET(`/wx/getTenementDetail/${id}`); } @@ -19,4 +25,60 @@ export const getTenementDetail = async function(id) { // 获取商户是否限电 export const getTenementExceptionalCase = async function(pid, tid) { return await GET(`/wx/exceptionalCase/${pid}/${tid}`); +} + +// 获取商户详情(b端) +export const getTenementInfoDetail = async function(id) { + return await GET(`/wx/getTenementDetail/${id}`); +} +// 创建商户 +export const createTenement = async function(pid, data) { + return await POST(`/vx/tenement/${pid}`, data) +} +// 修改商户 +export const updateTenement = async function(pid, data) { + return await POST(`/vx/tenement/${pid}`, data) +} +// 解绑电表 +export const unbindMeter = async function(pid, tid, code, data) { + return await PUT(`/vx/${pid}/${tid}/binding/${code}/unbind`,data) +} + +// 获取b端用户 +export const getTenementUsers = async function({ park, keyword }) { + return await GET(`/records/getWxUserList?park=${park}&keyword=${keyword}`); +} + +// c端获取指定商户的详细信息 +export const getTenementBackInfo = async (pid, tid) => { + return await GET(`/vx/${pid}/${tid}`); +} + +// 新增用户 +export const createTenementWxUser = async function(data) { + return await POST(`/wx/createUser`, data) +} + +// 创建商户 +export const createBackTenement = async function(pid, data) { + return await POST(`/vx/tenement/${pid}`, data) +} +// 修改商户信息 +export const updateTenementBackInfo = async function(pid, tid, data) { + return await PUT(`/vx/${pid}/${tid}`, data) +} + +// c端给商户绑定一个表计 +export const bindMeter = async function(pid, tid, data) { + return await POST(`/vx/${pid}/${tid}/binding`,data) +} + +// 修改管理员手机号 +export const updateAdminPhone = async function(data) { + return await PUT(`/wx/updatePhone`, data) +} + +// 工作台移交管理权限 +export const updateUserApp = async function(data) { + return await PUT(`/wx/updateUserApp`, data) } \ No newline at end of file diff --git a/service/user.js b/service/user.js index f0145c5..34568bd 100644 --- a/service/user.js +++ b/service/user.js @@ -13,7 +13,6 @@ export const userValidate = async function(data) { // 获取用户邀请二维码 export const getWxCode = async function(id) { - console.log("id", id) return await GET(`/wx/getWxCode?id=${id}`); } @@ -68,4 +67,9 @@ export const getPrivaciList = async function() { // 获取常见问题 export const getQuestionList = async function(page) { return await GET(`/wx/getQuestions?page=${page}&type=0`); +} + +// 获取扫描二维码的列表 +export const getBackApproveList = async function(tenement) { + return await GET(`/wx/getWorkUserList?tenement=${tenement}`); } \ No newline at end of file diff --git a/service/workBench.js b/service/workBench.js index a71feee..d9a6032 100644 --- a/service/workBench.js +++ b/service/workBench.js @@ -3,5 +3,25 @@ const { GET, POST, PUT, DELETE } = apis // 检索园区路线列表 export const getMeterReadingRouteList = async function(keyword) { - return await GET(`/park/route/list?keyword=${keyword}`); - } \ No newline at end of file + return await GET(`/park/route/list?keyword=${keyword}`); +} + +// 更新园区路线状态 +export const changeMeterRouteStatus = async function(data) { + return await PUT(`/park/route/${data?.id}/status/update`, data); +} + +// 检索电表路线详细 +export const getMeterReadingRouteDetail = async function(id) { + return await GET(`/park/meter/${id}/route/list`); +} + +// 抄表路线中的表计详细信息 +export const getMeterReadingRouteMeterDetail = async function(id) { + return await GET(`/route/meter/${id}`); +} + +// 新建一条抄表记录 +export const createReading = async function(park, code, data) { + return await POST(`/reading/${park}/${code}`, data); +} \ No newline at end of file diff --git a/utils/data.js b/utils/data.js index b4c55db..22c17b0 100644 --- a/utils/data.js +++ b/utils/data.js @@ -8,3 +8,5 @@ export const payWays = ["现金", "银行卡", "支付宝", "微信", "云闪 export const getRechargeOperateWay = (num) => { return payWays[num]; } + +export const feeType = ['华昌宝能收费', "物业代收1", "物业代收2", "物业代收线损"] \ No newline at end of file diff --git a/utils/index.js b/utils/index.js index 0681184..6d79893 100644 --- a/utils/index.js +++ b/utils/index.js @@ -45,10 +45,10 @@ export function getConfigByEnv() { switch (envVersion) { // 开发版 case 'develop': - // api = "http://localhost:8000" + api = "http://localhost:8000" // api = "https://zgd.hbhcbn.com/api3" - api = "https://zgd.hbhcbn.com/api3" - // api = "https://zgd.hbhcbn.com/wxApi" + // TODO: 发布正式时使用此路径 + // api = "https://zgd.hbhcbn.com/wxApi" // api = "http://127.0.0.1:4523/m1/4143821-0-default" break; // 体验版 @@ -198,9 +198,11 @@ export const wxLogin = () => { resolve(res.code) return } + alertInfo("未进行微信登录") reject() }, fail: err => { + alertError(err) reject(err) } }) @@ -225,17 +227,8 @@ export const wxModal = (data) => { } -export const getPixelRatio = () => { - let pixelRatio = 0 - wx.getSystemInfo({ - success: function (res) { - pixelRatio = res.pixelRatio - }, - fail: function () { - pixelRatio = 0 - } - }) - return pixelRatio +export const getPixelRatio = () => { + return wx.getSystemInfoSync()?. pixelRatio } @@ -254,4 +247,12 @@ export function getPageUrl() { /** 根据文件路径获取文件名 */ export function getFileName(path) { return path.slice(path.lastIndexOf("/") + 1, -1) -} \ No newline at end of file +} + +export function replaceSpecialIcon(str) { + return str.replace(/#/g, escape("#")) +} + +export function getRoundNumber(number) { + return (Math.round(number * 100) / 100).toFixed(2) +} diff --git a/utils/request.js b/utils/request.js index 921723b..5418e6f 100644 --- a/utils/request.js +++ b/utils/request.js @@ -35,10 +35,10 @@ const request = async function (options, config = {}) { try { response = await requestWithoutCookie(options); // 服务器没有返回200直接报错 - // if (!response || response.statusCode !== 200) { - // alertError(response?.data?.message || "发生错误,请稍后重试") - // return; - // } + if (!response || response.statusCode !== 200) { + alertError(response?.data?.message || "发生错误,请稍后重试") + return; + } // 处理cookie const setCookie = response.header['set-cookie'] || response.header['Set-Cookie']; @@ -78,16 +78,22 @@ const request = async function (options, config = {}) { // 处理返回结果,默认直接返回数据 const parseResponse = function (response, url) { + console.log('response', response, url) if (!response) { - alertError("服务异常") + wx.redirectTo({ + url: '/pages/login/index', + }) + wx.clearStorageSync() + alertError("无响应,请重试") return + } const { statusCode } = response; if (!statusCode) { - alertError("服务异常") + alertError("服务错误") return } - console.log('url', url,'statusCode', statusCode, 'response.data', response) + console.log('url', url,'statusCode', statusCode, 'response.data', response?.data) if (code === 401) { const currentUrl = getPageUrl() @@ -107,7 +113,7 @@ const parseResponse = function (response, url) { url: '/pages/login/index', }) wx.clearStorageSync() - return { code: 404, message: "服务故障" } + return { code: 404, message: "服务不存在" } } if (500 <= code && code < 600) { return { code: 500, message: "服务错误" } @@ -140,6 +146,7 @@ const CUD = async function (method, uri, data = null) { options.data = data; } const response = await request(options); + console.log("response---------",response) return parseResponse(response); }; diff --git a/utils/system.js b/utils/system.js index c3e0002..433e231 100644 --- a/utils/system.js +++ b/utils/system.js @@ -9,6 +9,9 @@ export const getDot = async () => { return; } const { code, message, data } = await getUnReadApproveNumber(); + if (code !== OK) { + return; + } if (data > 0) { wx.showTabBarRedDot({ index: 2,