From 77d9687cef3e19b1cd0fdb6e75ae0fde70c292c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Tue, 2 Dec 2025 08:51:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(dealer):=20=E4=BC=98=E5=8C=96=E7=BB=8F?= =?UTF-8?q?=E9=94=80=E5=95=86=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=E4=B8=8E?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除客户添加表单中公司名称输入框的maxLength限制 - 更新联系方式1标签为联系方式 - 在提现管理中引入Image组件并替换原生img标签 - 实现上传打款凭证的新逻辑,支持选择和上传图片 - 配置开发环境API基础URL为本地地址 - 修改订单查询条件,管理员可查看所有用户订单 - 注释掉不再使用的getResourceId方法 - 启用request.ts中的本地开发环境baseUrl配置 --- config/env.ts | 2 +- src/dealer/customer/add.tsx | 4 ++-- src/dealer/orders/index.tsx | 25 +++++++++++++++---------- src/dealer/withdraw/admin.tsx | 35 +++++++++++++++++++++++------------ src/utils/request.ts | 2 +- 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/config/env.ts b/config/env.ts index 525dff5..f624194 100644 --- a/config/env.ts +++ b/config/env.ts @@ -2,7 +2,7 @@ export const ENV_CONFIG = { // 开发环境 development: { - API_BASE_URL: 'https://cms-api.websoft.top/api', + API_BASE_URL: 'http://127.0.0.1:9200/api', APP_NAME: '开发环境', DEBUG: 'true', }, diff --git a/src/dealer/customer/add.tsx b/src/dealer/customer/add.tsx index 881d310..b6f5563 100644 --- a/src/dealer/customer/add.tsx +++ b/src/dealer/customer/add.tsx @@ -313,12 +313,12 @@ const AddShopDealerApply = () => { - + - + diff --git a/src/dealer/orders/index.tsx b/src/dealer/orders/index.tsx index 89e2ac7..2ea967e 100644 --- a/src/dealer/orders/index.tsx +++ b/src/dealer/orders/index.tsx @@ -63,18 +63,22 @@ const DealerOrder: React.FC = () => { } else { setLoadingMore(true) } - console.log(selectedUserId, selectedFirstUserId, selectedSecondUserId,'selectedUserIds...') + let where = { userId: selectedUserId, firstUserId: selectedSecondUserId, secondUserId: selectedSecondUserId, isInvalid: 0, isSettled: 1, - resourceId: getResourceId(), + resourceId: user?.userId, month: date, page, limit: 10 }; + if (hasRole('superAdmin') || hasRole('admin')) { + console.log('>>>>>>>>>>>>是管理员') + where = {...where, resourceId: undefined} + } if(selectedUserId){ where = {...where,userId: selectedUserId} } @@ -127,14 +131,15 @@ const DealerOrder: React.FC = () => { } } - const getResourceId = () => { - if (hasRole('superAdmin')) { - return undefined - } - if (hasRole('admin')) { - return user?.userId - } - } + // const getResourceId = () => { + // if (hasRole('superAdmin')) { + // return undefined + // } + // if (hasRole('admin')) { + // return user?.userId + // } + // return user?.userId; + // } // 检查是否有特定角色 const hasRole = (roleCode: string) => { diff --git a/src/dealer/withdraw/admin.tsx b/src/dealer/withdraw/admin.tsx index c7ed5b8..f7cde87 100644 --- a/src/dealer/withdraw/admin.tsx +++ b/src/dealer/withdraw/admin.tsx @@ -10,6 +10,7 @@ import { PullToRefresh, Button, Dialog, + Image, TextArea } from '@nutui/nutui-react-taro' import Taro from '@tarojs/taro' @@ -19,6 +20,7 @@ import type {ShopDealerWithdraw} from '@/api/shop/shopDealerWithdraw/model' import {ShopDealerBank} from "@/api/shop/shopDealerBank/model"; import {listShopDealerBank} from "@/api/shop/shopDealerBank"; import {pushNoticeOfWithdrawalToAccount} from "@/api/sdy/sdyTemplateMessage"; +import {uploadFile} from "@/api/system/file"; interface WithdrawRecordWithDetails extends ShopDealerWithdraw { accountDisplay?: string @@ -196,18 +198,27 @@ const DealerWithdraw: React.FC = () => { // 上传打款凭证 const handleUploadPaymentImage = async () => { try { - const res = await Taro.chooseImage({ - count: 3 - paymentImages.length, // 最多3张 - sizeType: ['compressed'], - sourceType: ['album', 'camera'] - }) - - // 这里应该上传到服务器,获取图片URL - // 暂时使用本地路径演示 - const newImages = [...paymentImages, ...res.tempFilePaths] - setPaymentImages(newImages.slice(0, 3)) + // 直接调用uploadFile,它内部会处理图片选择和上传 + const data = await uploadFile(); + console.log(data.url, 'uploaded image url'); + + // 确保url存在再添加到状态中 + if (data.url) { + // 将返回的图片URL添加到状态中 + const newImages = [...paymentImages, data.url]; + setPaymentImages(newImages.slice(0, 3)); + } else { + Taro.showToast({ + title: '图片上传失败:未返回有效URL', + icon: 'none' + }); + } } catch (error) { - console.error('选择图片失败:', error) + console.error('上传图片失败:', error); + Taro.showToast({ + title: '上传失败: ' + (error instanceof Error ? error.message : '未知错误'), + icon: 'none' + }); } } @@ -459,7 +470,7 @@ const DealerWithdraw: React.FC = () => { {paymentImages.map((img, index) => ( - + handleRemovePaymentImage(index)} diff --git a/src/utils/request.ts b/src/utils/request.ts index d515bf9..3a47418 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -57,7 +57,7 @@ let baseUrl = Taro.getStorageSync('ApiUrl') || BaseUrl; // 开发环境配置 if (process.env.NODE_ENV === 'development') { - // baseUrl = 'http://localhost:9200/api' + baseUrl = 'http://localhost:9200/api' } // 请求拦截器