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 = {
|
export const ENV_CONFIG = {
|
||||||
// 开发环境
|
// 开发环境
|
||||||
development: {
|
development: {
|
||||||
API_BASE_URL: 'https://cms-api.websoft.top/api',
|
API_BASE_URL: 'http://127.0.0.1:9200/api',
|
||||||
APP_NAME: '开发环境',
|
APP_NAME: '开发环境',
|
||||||
DEBUG: 'true',
|
DEBUG: 'true',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -313,12 +313,12 @@ const AddShopDealerApply = () => {
|
|||||||
<View className={'bg-gray-100 h-3'}></View>
|
<View className={'bg-gray-100 h-3'}></View>
|
||||||
<CellGroup style={{padding: '4px 0'}}>
|
<CellGroup style={{padding: '4px 0'}}>
|
||||||
<Form.Item name="dealerName" label="公司名称" initialValue={FormData?.dealerName} required>
|
<Form.Item name="dealerName" label="公司名称" initialValue={FormData?.dealerName} required>
|
||||||
<Input placeholder="公司名称" maxLength={10} disabled={isEditMode}/>
|
<Input placeholder="公司名称" disabled={isEditMode}/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="realName" label="联系人" initialValue={FormData?.realName} required>
|
<Form.Item name="realName" label="联系人" initialValue={FormData?.realName} required>
|
||||||
<Input placeholder="请输入联系人" disabled={isEditMode}/>
|
<Input placeholder="请输入联系人" disabled={isEditMode}/>
|
||||||
</Form.Item>
|
</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}/>
|
<Input placeholder="请输入手机号" disabled={isEditMode} maxLength={11}/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="address" label="公司地址" initialValue={FormData?.address} required>
|
<Form.Item name="address" label="公司地址" initialValue={FormData?.address} required>
|
||||||
|
|||||||
@@ -63,18 +63,22 @@ const DealerOrder: React.FC = () => {
|
|||||||
} else {
|
} else {
|
||||||
setLoadingMore(true)
|
setLoadingMore(true)
|
||||||
}
|
}
|
||||||
console.log(selectedUserId, selectedFirstUserId, selectedSecondUserId,'selectedUserIds...')
|
|
||||||
let where = {
|
let where = {
|
||||||
userId: selectedUserId,
|
userId: selectedUserId,
|
||||||
firstUserId: selectedSecondUserId,
|
firstUserId: selectedSecondUserId,
|
||||||
secondUserId: selectedSecondUserId,
|
secondUserId: selectedSecondUserId,
|
||||||
isInvalid: 0,
|
isInvalid: 0,
|
||||||
isSettled: 1,
|
isSettled: 1,
|
||||||
resourceId: getResourceId(),
|
resourceId: user?.userId,
|
||||||
month: date,
|
month: date,
|
||||||
page,
|
page,
|
||||||
limit: 10
|
limit: 10
|
||||||
};
|
};
|
||||||
|
if (hasRole('superAdmin') || hasRole('admin')) {
|
||||||
|
console.log('>>>>>>>>>>>>是管理员')
|
||||||
|
where = {...where, resourceId: undefined}
|
||||||
|
}
|
||||||
if(selectedUserId){
|
if(selectedUserId){
|
||||||
where = {...where,userId: selectedUserId}
|
where = {...where,userId: selectedUserId}
|
||||||
}
|
}
|
||||||
@@ -127,14 +131,15 @@ const DealerOrder: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getResourceId = () => {
|
// const getResourceId = () => {
|
||||||
if (hasRole('superAdmin')) {
|
// if (hasRole('superAdmin')) {
|
||||||
return undefined
|
// return undefined
|
||||||
}
|
// }
|
||||||
if (hasRole('admin')) {
|
// if (hasRole('admin')) {
|
||||||
return user?.userId
|
// return user?.userId
|
||||||
}
|
// }
|
||||||
}
|
// return user?.userId;
|
||||||
|
// }
|
||||||
|
|
||||||
// 检查是否有特定角色
|
// 检查是否有特定角色
|
||||||
const hasRole = (roleCode: string) => {
|
const hasRole = (roleCode: string) => {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
PullToRefresh,
|
PullToRefresh,
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
|
Image,
|
||||||
TextArea
|
TextArea
|
||||||
} from '@nutui/nutui-react-taro'
|
} from '@nutui/nutui-react-taro'
|
||||||
import Taro from '@tarojs/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 {ShopDealerBank} from "@/api/shop/shopDealerBank/model";
|
||||||
import {listShopDealerBank} from "@/api/shop/shopDealerBank";
|
import {listShopDealerBank} from "@/api/shop/shopDealerBank";
|
||||||
import {pushNoticeOfWithdrawalToAccount} from "@/api/sdy/sdyTemplateMessage";
|
import {pushNoticeOfWithdrawalToAccount} from "@/api/sdy/sdyTemplateMessage";
|
||||||
|
import {uploadFile} from "@/api/system/file";
|
||||||
|
|
||||||
interface WithdrawRecordWithDetails extends ShopDealerWithdraw {
|
interface WithdrawRecordWithDetails extends ShopDealerWithdraw {
|
||||||
accountDisplay?: string
|
accountDisplay?: string
|
||||||
@@ -196,18 +198,27 @@ const DealerWithdraw: React.FC = () => {
|
|||||||
// 上传打款凭证
|
// 上传打款凭证
|
||||||
const handleUploadPaymentImage = async () => {
|
const handleUploadPaymentImage = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await Taro.chooseImage({
|
// 直接调用uploadFile,它内部会处理图片选择和上传
|
||||||
count: 3 - paymentImages.length, // 最多3张
|
const data = await uploadFile();
|
||||||
sizeType: ['compressed'],
|
console.log(data.url, 'uploaded image url');
|
||||||
sourceType: ['album', 'camera']
|
|
||||||
})
|
// 确保url存在再添加到状态中
|
||||||
|
if (data.url) {
|
||||||
// 这里应该上传到服务器,获取图片URL
|
// 将返回的图片URL添加到状态中
|
||||||
// 暂时使用本地路径演示
|
const newImages = [...paymentImages, data.url];
|
||||||
const newImages = [...paymentImages, ...res.tempFilePaths]
|
setPaymentImages(newImages.slice(0, 3));
|
||||||
setPaymentImages(newImages.slice(0, 3))
|
} else {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '图片上传失败:未返回有效URL',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (error) {
|
} 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">
|
<View className="flex flex-wrap gap-2">
|
||||||
{paymentImages.map((img, index) => (
|
{paymentImages.map((img, index) => (
|
||||||
<View key={index} className="relative w-20 h-20">
|
<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
|
<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"
|
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)}
|
onClick={() => handleRemovePaymentImage(index)}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ let baseUrl = Taro.getStorageSync('ApiUrl') || BaseUrl;
|
|||||||
|
|
||||||
// 开发环境配置
|
// 开发环境配置
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// baseUrl = 'http://localhost:9200/api'
|
baseUrl = 'http://localhost:9200/api'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求拦截器
|
// 请求拦截器
|
||||||
|
|||||||
Reference in New Issue
Block a user