feat(dealer): 优化经销商相关功能与代码细节
- 移除客户添加表单中公司名称输入框的maxLength限制 - 更新联系方式1标签为联系方式 - 在提现管理中引入Image组件并替换原生img标签 - 实现上传打款凭证的新逻辑,支持选择和上传图片 - 配置开发环境API基础URL为本地地址 - 修改订单查询条件,管理员可查看所有用户订单 - 注释掉不再使用的getResourceId方法 - 启用request.ts中的本地开发环境baseUrl配置
This commit is contained in:
@@ -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',
|
||||
},
|
||||
|
||||
@@ -313,12 +313,12 @@ const AddShopDealerApply = () => {
|
||||
<View className={'bg-gray-100 h-3'}></View>
|
||||
<CellGroup style={{padding: '4px 0'}}>
|
||||
<Form.Item name="dealerName" label="公司名称" initialValue={FormData?.dealerName} required>
|
||||
<Input placeholder="公司名称" maxLength={10} disabled={isEditMode}/>
|
||||
<Input placeholder="公司名称" disabled={isEditMode}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="realName" label="联系人" initialValue={FormData?.realName} required>
|
||||
<Input placeholder="请输入联系人" disabled={isEditMode}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="mobile" label="联系方式1" initialValue={FormData?.mobile} required>
|
||||
<Form.Item name="mobile" label="联系方式" initialValue={FormData?.mobile} required>
|
||||
<Input placeholder="请输入手机号" disabled={isEditMode} maxLength={11}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="address" label="公司地址" initialValue={FormData?.address} required>
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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 = () => {
|
||||
<View className="flex flex-wrap gap-2">
|
||||
{paymentImages.map((img, index) => (
|
||||
<View key={index} className="relative w-20 h-20">
|
||||
<img src={img} className="w-full h-full object-cover rounded" />
|
||||
<Image src={img} className="w-full h-full object-cover rounded" />
|
||||
<View
|
||||
className="absolute top-0 right-0 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs"
|
||||
onClick={() => handleRemovePaymentImage(index)}
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
// 请求拦截器
|
||||
|
||||
Reference in New Issue
Block a user