diff --git a/components/Segmented/index.js b/components/Segmented/index.js index 13fe062..432db7c 100644 --- a/components/Segmented/index.js +++ b/components/Segmented/index.js @@ -5,7 +5,8 @@ Component({ * 组件的属性列表 */ properties: { - list: Array + list: Array, + active: Number, }, /** @@ -19,6 +20,13 @@ Component({ * 组件的方法列表 */ methods: { - + handleChange(e) { + console.log(e, this.data.active) + 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.wxml b/components/Segmented/index.wxml index 3b51e43..a15e8f8 100644 --- a/components/Segmented/index.wxml +++ b/components/Segmented/index.wxml @@ -1,4 +1,12 @@ - - + + + {{ item }} + \ No newline at end of file diff --git a/components/Segmented/index.wxss b/components/Segmented/index.wxss index 74130e5..6d69e65 100644 --- a/components/Segmented/index.wxss +++ b/components/Segmented/index.wxss @@ -1 +1,19 @@ -/* components/Segmented/index.wxss */ \ No newline at end of file +/* 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/pages/workBench/components/account/index.js b/pages/workBench/components/account/index.js index f66d8c6..7b6173b 100644 --- a/pages/workBench/components/account/index.js +++ b/pages/workBench/components/account/index.js @@ -72,6 +72,10 @@ Component({ } } }) + }, + async init() { + const { tenementName } = this.data; + const { code, message, data } = await } } }) \ No newline at end of file diff --git a/pages/workBench/components/approve/index.js b/pages/workBench/components/approve/index.js index 6fbd81c..92b90bf 100644 --- a/pages/workBench/components/approve/index.js +++ b/pages/workBench/components/approve/index.js @@ -1,179 +1 @@ // 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.json b/pages/workBench/components/approve/index.json index c992ee6..4a42478 100644 --- a/pages/workBench/components/approve/index.json +++ b/pages/workBench/components/approve/index.json @@ -1,15 +1,6 @@ { "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-dialog": "@vant/weapp/dialog/index" + } } \ No newline at end of file diff --git a/pages/workBench/components/approve/index.wxml b/pages/workBench/components/approve/index.wxml index 219b909..a3dae99 100644 --- a/pages/workBench/components/approve/index.wxml +++ b/pages/workBench/components/approve/index.wxml @@ -1,114 +1,3 @@ - - - 选择 - - - - - 搜索 - - - - - - - - - 商户名字 - 充值金额 - 操作 - - - - - - - - - {{ item.tenement.shortName }} - {{ item.money }} - - - 查看详细 - - - - - - - - - - - - - - - - 同意 - 拒绝 - - - - - - - - - - diff --git a/pages/workBench/components/approve/index.wxss b/pages/workBench/components/approve/index.wxss index 0c73220..bf99be5 100644 --- a/pages/workBench/components/approve/index.wxss +++ b/pages/workBench/components/approve/index.wxss @@ -1,45 +1 @@ /* 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/recharge/components/approve/index.js b/pages/workBench/components/recharge/components/approve/index.js new file mode 100644 index 0000000..b4b2c3a --- /dev/null +++ b/pages/workBench/components/recharge/components/approve/index.js @@ -0,0 +1,178 @@ +// 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" +const { OK } = request + +// pages/workBench/components/record/index.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + status: Number + }, + + /** + * 组件的初始数据 + */ + 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, status } = this.data; + const { code, message, data, total } = await getRechargeApproveList({ park, page, keyword, status }) + 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/recharge/components/approve/index.json b/pages/workBench/components/recharge/components/approve/index.json new file mode 100644 index 0000000..c992ee6 --- /dev/null +++ b/pages/workBench/components/recharge/components/approve/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", + "table": "/components/table/table", + "pagination": "/components/pagination/index", + "empty": "/components/empty/index", + "van-radio": "@vant/weapp/radio/index", + "van-radio-group": "@vant/weapp/radio-group/index", + "van-dialog": "@vant/weapp/dialog/index" + } +} \ 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..998179f --- /dev/null +++ b/pages/workBench/components/recharge/components/approve/index.wxml @@ -0,0 +1,113 @@ + + + + 选择 + + + + + + 搜索 + + + + + + + + + 商户名字 + 充值金额 + 操作 + + + + + + + + + {{ item.tenement.shortName }} + {{ item.money }} + + + 查看详细 + + + + + + + + + + + + + + + + 同意 + 拒绝 + + + + + + + + + + \ 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..311c82e --- /dev/null +++ b/pages/workBench/components/recharge/components/approve/index.wxss @@ -0,0 +1,45 @@ +/* pages/workBench/components/recharge/components/waitApprove/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/recharge/components/reharge/index.js b/pages/workBench/components/recharge/components/reharge/index.js new file mode 100644 index 0000000..34d4e18 --- /dev/null +++ b/pages/workBench/components/recharge/components/reharge/index.js @@ -0,0 +1,153 @@ +// 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.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/components/reharge/index.json b/pages/workBench/components/recharge/components/reharge/index.json new file mode 100644 index 0000000..779a6e1 --- /dev/null +++ b/pages/workBench/components/recharge/components/reharge/index.json @@ -0,0 +1,9 @@ +{ + "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" + } +} \ 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..bfb23c7 --- /dev/null +++ b/pages/workBench/components/recharge/components/reharge/index.wxml @@ -0,0 +1,81 @@ + + + + + 选择 + + + + + 选择 + + + + + + + 选择 + + + + + + + 确认 + 清空 + + 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..83eb4e8 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,21 @@ Component({ * 组件的初始数据 */ data: { - show: false, + active: 0, + segmentedList: ['待审核', '已审核', '充值'], }, /** * 组件的方法列表 */ methods: { - onParkFocus(e) { + handleChange(e) { + console.log("change", e) + const { index } = e.detail; this.setData({ - show: true, - title: "园区", - type: 'park' + active: index }) }, - 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..a540c5c 100644 --- a/pages/workBench/components/recharge/index.json +++ b/pages/workBench/components/recharge/index.json @@ -1,9 +1,9 @@ { "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" } } \ No newline at end of file diff --git a/pages/workBench/components/recharge/index.wxml b/pages/workBench/components/recharge/index.wxml index f337f3a..432691f 100644 --- a/pages/workBench/components/recharge/index.wxml +++ b/pages/workBench/components/recharge/index.wxml @@ -1,81 +1,10 @@ - - - - 选择 - - - - - 选择 - - - - - - - 选择 - - - - - - - 确认 - 清空 - - + + + + \ No newline at end of file diff --git a/pages/workBench/index.js b/pages/workBench/index.js index e257546..99e26d3 100644 --- a/pages/workBench/index.js +++ b/pages/workBench/index.js @@ -5,7 +5,7 @@ Page({ * 页面的初始数据 */ data: { - active: 3 + active: 2 }, /** diff --git a/service/recharge.js b/service/recharge.js index ed18b7b..e53d768 100644 --- a/service/recharge.js +++ b/service/recharge.js @@ -34,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=${replaceSpecialIcon(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/tenement.js b/service/tenement.js index e3f360c..5f25a96 100644 --- a/service/tenement.js +++ b/service/tenement.js @@ -38,3 +38,8 @@ export const updateTenement = async function(pid, data) { export const unbindMeter = async function(pid, tid, code) { return await POST(`/tenement/${pid}/${tid}/binding/${code}/unbind`) } + +// 获取b端用户 +export const getTenementUsers = async function(id) { + return await GET(`/records/getWxUserList`); +} \ No newline at end of file