From fccaee5f2b74f3f6796acb2eb0108fa664ce76c8 Mon Sep 17 00:00:00 2001
From: ZiHangQin <1420014281@qq.com>
Date: Mon, 21 Jul 2025 14:10:05 +0800
Subject: [PATCH] =?UTF-8?q?C=E7=AB=AF=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E4=BC=98=E5=8C=96=20=E5=B7=A5=E4=BD=9C=E5=8F=B0?=
=?UTF-8?q?=E9=83=A8=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../recharge/components/approve/index.js | 441 +++++++++++-------
.../recharge/components/approve/index.json | 4 +-
.../recharge/components/approve/index.wxml | 105 ++---
.../recharge/components/approve/index.wxss | 24 +
project.private.config.json | 11 +-
5 files changed, 336 insertions(+), 249 deletions(-)
diff --git a/pages/workBench/components/recharge/components/approve/index.js b/pages/workBench/components/recharge/components/approve/index.js
index 004ed18..351877d 100644
--- a/pages/workBench/components/recharge/components/approve/index.js
+++ b/pages/workBench/components/recharge/components/approve/index.js
@@ -1,190 +1,279 @@
// pages/workBench/components/recharge/components/waitApprove/index.js
-import { alertInfo, alertSuccess, loadingFunc } from "../../../../../../utils/index";
-import { getRechargeApproveList, rechargeApprove } from "../../../../../../service/recharge"
+import {
+ alertInfo,
+ alertSuccess,
+ loadingFunc
+} from "../../../../../../utils/index";
+import {
+ getRechargeApproveList,
+ rechargeApprove
+} from "../../../../../../service/recharge"
import request from "../../../../../../utils/request"
-const { OK } = request
+import dayjs from "../../../../../../utils/dayjs"
+const {
+ OK
+} = request
// pages/workBench/components/record/index.js
Component({
- /**
- * 组件的属性列表
- */
- properties: {
- status: Number
- },
-
- /**
- * 组件的初始数据
- */
- data: {
- keyword: "",
- keywordTemp: "",
- page: 1,
- },
- lifetimes: {
- attached() {
- loadingFunc(async () => {
- await this.init();
- })
- }
- },
- /**
- * 组件的方法列表
- */
- methods: {
- onParkFocus(e) {
- this.setData({
- show: true,
- title: "园区",
- type: 'park'
- })
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+ status: Number
},
- onConfirm(e) {
- const { data } = e.detail;
- const that = this;
- this.setData({
- parkName: data.name,
- park: data.id,
- }, () => {
- loadingFunc(async () => {
- await that.init();
- })
- })
- this.onCancel();
+
+ /**
+ * 组件的初始数据
+ */
+ data: {
+ keyword: "",
+ keywordTemp: "",
+ page: 1,
+ currentActionSheet: null,
+ actionItems: [{
+ name: '查看详细',
+ value: 'detail'
+ }],
},
- 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,
- 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) {
+
+ lifetimes: {
+ attached() {
loadingFunc(async () => {
- const { code, message } = await rechargeApprove({ id: record, status: 0, })
- if (code !== OK) {
- alertInfo(message)
- return;
- }
- alertSuccess("已同意")
- that.init();
+ await this.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();
- })
- })
- },
- onCancel() {
- this.setData({
- show: false,
- title: "",
- type: "",
- })
- },
- onChangeSelectRecharge(e) {
- this.setData({
- record: e.detail
- })
+ /**
+ * 组件的方法列表
+ */
+ 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 HH:mm:ss")
+ 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/recharge/components/approve/index.json b/pages/workBench/components/recharge/components/approve/index.json
index c064e73..145ec1b 100644
--- a/pages/workBench/components/recharge/components/approve/index.json
+++ b/pages/workBench/components/recharge/components/approve/index.json
@@ -11,6 +11,8 @@
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-dialog": "@vant/weapp/dialog/index",
- "searchSelectWrapper": "/components/searchSelectWrapper/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
index a1795ce..9849d66 100644
--- a/pages/workBench/components/recharge/components/approve/index.wxml
+++ b/pages/workBench/components/recharge/components/approve/index.wxml
@@ -1,100 +1,65 @@
-
+
-
+
- 同意
- 拒绝
+ 同意
+ 拒绝
-
- 商户名字
- 充值金额
- 操作
+
+ 商户名字
+ 充值金额
+ 状态
+ 提交时间
+ 操作
-
-
+
+
- {{ item.tenement.shortName }}
- {{ item.money }}
-
-
- 查看详细
-
+
+ {{ 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
index 311c82e..bb7ede4 100644
--- a/pages/workBench/components/recharge/components/approve/index.wxss
+++ b/pages/workBench/components/recharge/components/approve/index.wxss
@@ -43,3 +43,27 @@
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: 8px 16px;
+ margin-right: 12px;
+ border-radius: 16px;
+ background: #07c160;
+ color: white;
+ }
+
+ /* 激活状态样式 */
+ .tag.active {
+ background: #07c160;
+ color: white;
+ }
\ No newline at end of file
diff --git a/project.private.config.json b/project.private.config.json
index b843307..09bced0 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -24,12 +24,19 @@
"miniprogram": {
"list": [
{
- "name": "childPackage/pages/electricQuery/index",
- "pathName": "childPackage/pages/electricQuery/index",
+ "name": "pages/workBench/index",
+ "pathName": "pages/workBench/index",
"query": "",
"scene": null,
"launchMode": "default"
},
+ {
+ "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",