refactor(clinic): 重构处方订单相关功能
- 删除废弃的处方订单模型定义文件 - 删除处方订单相关的API接口文件 - 更新处方API返回类型为ClinicPrescription - 移除新增处方订单页面配置文件 - 移除新增处方订单页面组件文件 - 移除处方订单管理页面配置文件 - 移除处方订单管理页面组件文件 - 修改医生确认订单页面逻辑,分离处方与订单创建流程- 更新医生订单列表页面,使用处方数据替代经销商订单数据- 调整订单数据结构,关联处方ID和处方编号 -优化订单创建流程,先创建处方再创建订单 - 移除冗余的经销商订单相关导入和类型定义
This commit is contained in:
@@ -1,101 +0,0 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api/index';
|
||||
import type { ClinicOrder, ClinicOrderParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询处方订单
|
||||
*/
|
||||
export async function pageClinicOrder(params: ClinicOrderParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ClinicOrder>>>(
|
||||
'/clinic/clinic-order/page',
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询处方订单列表
|
||||
*/
|
||||
export async function listClinicOrder(params?: ClinicOrderParam) {
|
||||
const res = await request.get<ApiResult<ClinicOrder[]>>(
|
||||
'/clinic/clinic-order',
|
||||
params
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加处方订单
|
||||
*/
|
||||
export async function addClinicOrder(data: ClinicOrder) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/clinic/clinic-order',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改处方订单
|
||||
*/
|
||||
export async function updateClinicOrder(data: ClinicOrder) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/clinic/clinic-order',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除处方订单
|
||||
*/
|
||||
export async function removeClinicOrder(id?: number) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/clinic/clinic-order/' + id
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除处方订单
|
||||
*/
|
||||
export async function removeBatchClinicOrder(data: (number | undefined)[]) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/clinic/clinic-order/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询处方订单
|
||||
*/
|
||||
export async function getClinicOrder(id: number) {
|
||||
const res = await request.get<ApiResult<ClinicOrder>>(
|
||||
'/clinic/clinic-order/' + id
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
import type { PageParam } from '@/api/index';
|
||||
|
||||
/**
|
||||
* 处方订单
|
||||
*/
|
||||
export interface ClinicOrder {
|
||||
// 订单号
|
||||
orderId?: number;
|
||||
// 订单编号
|
||||
orderNo?: string;
|
||||
// 订单类型,0商城订单 1预定订单/外卖 2会员卡
|
||||
type?: number;
|
||||
// 订单标题
|
||||
title?: string;
|
||||
// 快递/自提
|
||||
deliveryType?: number;
|
||||
// 下单渠道,0小程序预定 1俱乐部训练场 3活动订场
|
||||
channel?: number;
|
||||
// 微信支付交易号号
|
||||
transactionId?: string;
|
||||
// 微信退款订单号
|
||||
refundOrder?: string;
|
||||
// 商户ID
|
||||
merchantId?: number;
|
||||
// 商户名称
|
||||
merchantName?: string;
|
||||
// 商户编号
|
||||
merchantCode?: string;
|
||||
// 使用的优惠券id
|
||||
couponId?: number;
|
||||
// 使用的会员卡id
|
||||
cardId?: string;
|
||||
// 关联管理员id
|
||||
adminId?: number;
|
||||
// 核销管理员id
|
||||
confirmId?: number;
|
||||
// IC卡号
|
||||
icCard?: string;
|
||||
// 真实姓名
|
||||
realName?: string;
|
||||
// 关联收货地址
|
||||
addressId?: number;
|
||||
// 收货地址
|
||||
address?: string;
|
||||
//
|
||||
addressLat?: string;
|
||||
//
|
||||
addressLng?: string;
|
||||
// 买家留言
|
||||
buyerRemarks?: string;
|
||||
// 自提店铺id
|
||||
selfTakeMerchantId?: number;
|
||||
// 自提店铺
|
||||
selfTakeMerchantName?: string;
|
||||
// 配送开始时间
|
||||
sendStartTime?: string;
|
||||
// 配送结束时间
|
||||
sendEndTime?: string;
|
||||
// 发货店铺id
|
||||
expressMerchantId?: number;
|
||||
// 发货店铺
|
||||
expressMerchantName?: string;
|
||||
// 订单总额
|
||||
totalPrice?: string;
|
||||
// 减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格
|
||||
reducePrice?: string;
|
||||
// 实际付款
|
||||
payPrice?: string;
|
||||
// 用于统计
|
||||
price?: string;
|
||||
// 价钱,用于积分赠送
|
||||
money?: string;
|
||||
// 取消时间
|
||||
cancelTime?: string;
|
||||
// 取消原因
|
||||
cancelReason?: string;
|
||||
// 退款金额
|
||||
refundMoney?: string;
|
||||
// 教练价格
|
||||
coachPrice?: string;
|
||||
// 购买数量
|
||||
totalNum?: number;
|
||||
// 教练id
|
||||
coachId?: number;
|
||||
// 商品ID
|
||||
formId?: number;
|
||||
// 支付的用户id
|
||||
payUserId?: number;
|
||||
// 0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付
|
||||
payType?: number;
|
||||
// 微信支付子类型:JSAPI小程序支付,NATIVE扫码支付
|
||||
wechatPayType?: string;
|
||||
// 0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付
|
||||
friendPayType?: number;
|
||||
// 0未付款,1已付款
|
||||
payStatus?: string;
|
||||
// 0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款
|
||||
orderStatus?: number;
|
||||
// 发货状态(10未发货 20已发货 30部分发货)
|
||||
deliveryStatus?: number;
|
||||
// 无需发货备注
|
||||
deliveryNote?: string;
|
||||
// 发货时间
|
||||
deliveryTime?: string;
|
||||
// 评价状态(0未评价 1已评价)
|
||||
evaluateStatus?: number;
|
||||
// 评价时间
|
||||
evaluateTime?: string;
|
||||
// 优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡
|
||||
couponType?: number;
|
||||
// 优惠说明
|
||||
couponDesc?: string;
|
||||
// 二维码地址,保存订单号,支付成功后才生成
|
||||
qrcode?: string;
|
||||
// vip月卡年卡、ic月卡年卡回退次数
|
||||
returnNum?: number;
|
||||
// vip充值回退金额
|
||||
returnMoney?: string;
|
||||
// 预约详情开始时间数组
|
||||
startTime?: string;
|
||||
// 是否已开具发票:0未开发票,1已开发票,2不能开具发票
|
||||
isInvoice?: string;
|
||||
// 发票流水号
|
||||
invoiceNo?: string;
|
||||
// 商家留言
|
||||
merchantRemarks?: string;
|
||||
// 支付时间
|
||||
payTime?: string;
|
||||
// 退款时间
|
||||
refundTime?: string;
|
||||
// 申请退款时间
|
||||
refundApplyTime?: string;
|
||||
// 过期时间
|
||||
expirationTime?: string;
|
||||
// 自提码
|
||||
selfTakeCode?: string;
|
||||
// 是否已收到赠品
|
||||
hasTakeGift?: string;
|
||||
// 对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单
|
||||
checkBill?: number;
|
||||
// 订单是否已结算(0未结算 1已结算)
|
||||
isSettled?: number;
|
||||
// 系统版本号 0当前版本 value=其他版本
|
||||
version?: number;
|
||||
// 用户id
|
||||
userId?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方订单搜索条件
|
||||
*/
|
||||
export interface ClinicOrderParam extends PageParam {
|
||||
orderId?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
@@ -37,12 +37,12 @@ export async function listClinicPrescription(params?: ClinicPrescriptionParam) {
|
||||
|
||||
*/
|
||||
export async function addClinicPrescription(data: ClinicPrescription) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
const res = await request.post<ApiResult<ClinicPrescription>>(
|
||||
'/clinic/clinic-prescription',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
return res.data; // 返回处方数据,包含处方ID
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '新增处方订单',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
@@ -1,98 +0,0 @@
|
||||
import {useEffect, useState, useRef} from "react";
|
||||
import {useRouter} from '@tarojs/taro'
|
||||
import {Button, Loading, CellGroup, Input, TextArea, Form} from '@nutui/nutui-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {View} from '@tarojs/components'
|
||||
import {ClinicOrder} from "@/api/clinic/clinicOrder/model";
|
||||
import {getClinicOrder, listClinicOrder, updateClinicOrder, addClinicOrder} from "@/api/clinic/clinicOrder";
|
||||
|
||||
const AddClinicOrder = () => {
|
||||
const {params} = useRouter();
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const [FormData, setFormData] = useState<ClinicOrder>({})
|
||||
const formRef = useRef<any>(null)
|
||||
|
||||
const reload = async () => {
|
||||
if (params.id) {
|
||||
const data = await getClinicOrder(Number(params.id))
|
||||
setFormData(data)
|
||||
} else {
|
||||
setFormData({})
|
||||
}
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
const submitSucceed = async (values: any) => {
|
||||
try {
|
||||
if (params.id) {
|
||||
// 编辑模式
|
||||
await updateClinicOrder({
|
||||
...values,
|
||||
id: Number(params.id)
|
||||
})
|
||||
} else {
|
||||
// 新增模式
|
||||
await addClinicOrder(values)
|
||||
}
|
||||
|
||||
Taro.showToast({
|
||||
title: `操作成功`,
|
||||
icon: 'success'
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
return Taro.navigateBack()
|
||||
}, 1000)
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: `操作失败`,
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const submitFailed = (error: any) => {
|
||||
console.log(error, 'err...')
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload().then(() => {
|
||||
setLoading(false)
|
||||
})
|
||||
}, []);
|
||||
|
||||
if (loading) {
|
||||
return <Loading className={'px-2'}>加载中</Loading>
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form
|
||||
ref={formRef}
|
||||
divider
|
||||
initialValues={FormData}
|
||||
labelPosition="left"
|
||||
onFinish={(values) => submitSucceed(values)}
|
||||
onFinishFailed={(errors) => submitFailed(errors)}
|
||||
footer={
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
nativeType="submit"
|
||||
type="success"
|
||||
size="large"
|
||||
className={'w-full'}
|
||||
block
|
||||
>
|
||||
{params.id ? '更新' : '保存'}
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<CellGroup style={{padding: '4px 0'}}>
|
||||
<Form.Item name="orderId" label="订单号" initialValue={FormData.orderId} required>
|
||||
@@ -1,4 +0,0 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '处方订单管理',
|
||||
navigationBarTextStyle: 'black'
|
||||
})
|
||||
@@ -1,64 +0,0 @@
|
||||
import {useState} from "react";
|
||||
import Taro, {useDidShow} from '@tarojs/taro'
|
||||
import {Button, Cell, CellGroup, Space, Empty, ConfigProvider, Divider} from '@nutui/nutui-react-taro'
|
||||
import {Dongdong, ArrowRight, CheckNormal, Checked} from '@nutui/icons-react-taro'
|
||||
import {View} from '@tarojs/components'
|
||||
import {ClinicOrder} from "@/api/clinic/clinicOrder/model";
|
||||
import {listClinicOrder, removeClinicOrder, updateClinicOrder} from "@/api/clinic/clinicOrder";
|
||||
|
||||
const ClinicOrderList = () => {
|
||||
const [list, setList] = useState<ClinicOrder[]>([])
|
||||
|
||||
const reload = () => {
|
||||
listClinicOrder({
|
||||
// 添加查询条件
|
||||
})
|
||||
.then(data => {
|
||||
setList(data || [])
|
||||
})
|
||||
.catch(() => {
|
||||
Taro.showToast({
|
||||
title: '获取数据失败',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const onDel = async (id?: number) => {
|
||||
await removeClinicOrder(id)
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
reload();
|
||||
}
|
||||
|
||||
useDidShow(() => {
|
||||
reload()
|
||||
});
|
||||
|
||||
if (list.length == 0) {
|
||||
return (
|
||||
<ConfigProvider>
|
||||
<div className={'h-full flex flex-col justify-center items-center'} style={{
|
||||
height: 'calc(100vh - 300px)',
|
||||
}}>
|
||||
<Empty
|
||||
style={{
|
||||
backgroundColor: 'transparent'
|
||||
}}
|
||||
description="暂无数据"
|
||||
/>
|
||||
<Space>
|
||||
<Button onClick={() => Taro.navigateTo({url: '/clinic/clinicOrder/add'})}>新增处方订单</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</ConfigProvider>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{list.map((item, _) => (
|
||||
<Cell.Group key={item.
|
||||
@@ -14,7 +14,8 @@ import Taro from '@tarojs/taro'
|
||||
import FixedButton from "@/components/FixedButton";
|
||||
import {ClinicPatientUser} from "@/api/clinic/clinicPatientUser/model";
|
||||
import {ClinicPrescription} from "@/api/clinic/clinicPrescription/model";
|
||||
import {addClinicOrder} from "@/api/clinic/clinicOrder";
|
||||
import {addClinicPrescription} from "@/api/clinic/clinicPrescription";
|
||||
import {addClinicPrescriptionItem} from "@/api/clinic/clinicPrescriptionItem";
|
||||
import './confirm.scss'
|
||||
|
||||
// 订单数据接口
|
||||
@@ -84,32 +85,84 @@ const DoctorOrderConfirm = () => {
|
||||
try {
|
||||
setSubmitLoading(true)
|
||||
|
||||
// 构建诊所订单数据
|
||||
const doctorId = Taro.getStorageSync('UserId') // 当前医生ID
|
||||
|
||||
// 第一步:创建处方主表记录
|
||||
console.log('开始创建处方记录...')
|
||||
const prescriptionData: ClinicPrescription = {
|
||||
userId: orderData.patient.userId,
|
||||
doctorId: doctorId,
|
||||
prescriptionType: orderData.prescription?.prescriptionType || 0, // 处方类型
|
||||
diagnosis: orderData.diagnosis, // 诊断结果
|
||||
treatmentPlan: orderData.treatmentPlan, // 治疗方案
|
||||
decoctionInstructions: orderData.decoctionInstructions, // 煎药说明
|
||||
image: orderData.images ? JSON.stringify(orderData.images) : '', // 病例图片
|
||||
orderPrice: getTotalPrice(), // 订单总金额
|
||||
price: getMedicinePrice(), // 药品单价
|
||||
payPrice: getTotalPrice(), // 实付金额
|
||||
status: 0, // 状态:0正常
|
||||
isInvalid: 0, // 未失效
|
||||
isSettled: 0, // 未结算
|
||||
comments: `患者:${orderData.patient.realName},年龄:${orderData.patient.age}岁`
|
||||
}
|
||||
|
||||
const createdPrescription = await addClinicPrescription(prescriptionData)
|
||||
console.log('处方创建成功:', createdPrescription)
|
||||
|
||||
if (!createdPrescription || !createdPrescription.id) {
|
||||
throw new Error('处方创建失败,未返回处方ID')
|
||||
}
|
||||
|
||||
const prescriptionId = createdPrescription.id
|
||||
|
||||
// 第二步:创建处方明细记录(药品列表)
|
||||
if (orderData.prescription?.items && orderData.prescription.items.length > 0) {
|
||||
console.log('开始创建处方明细...')
|
||||
for (const item of orderData.prescription.items) {
|
||||
const prescriptionItemData = {
|
||||
prescriptionId: prescriptionId, // 关联处方ID
|
||||
prescriptionNo: createdPrescription.orderNo, // 处方编号
|
||||
medicineId: item.medicineId,
|
||||
medicineName: item.medicineName,
|
||||
specification: item.specification,
|
||||
dosage: item.dosage,
|
||||
usageFrequency: item.usageFrequency,
|
||||
days: item.days,
|
||||
amount: item.amount,
|
||||
unitPrice: item.unitPrice,
|
||||
quantity: item.quantity,
|
||||
userId: orderData.patient.userId,
|
||||
comments: item.comments
|
||||
}
|
||||
await addClinicPrescriptionItem(prescriptionItemData)
|
||||
}
|
||||
console.log('处方明细创建成功')
|
||||
}
|
||||
|
||||
// 第三步:创建订单记录,关联处方ID
|
||||
console.log('开始创建订单记录...')
|
||||
const clinicOrderData = {
|
||||
userId: orderData.patient.userId,
|
||||
doctorId: Taro.getStorageSync('UserId'), // 当前医生ID
|
||||
doctorId: doctorId,
|
||||
type: 0, // 订单类型:诊所订单
|
||||
title: `${orderData.patient.realName}的处方订单`,
|
||||
totalPrice: getTotalPrice(),
|
||||
payPrice: getTotalPrice(),
|
||||
buyerRemarks: orderData.diagnosis,
|
||||
buyerRemarks: `诊断:${orderData.diagnosis}`,
|
||||
merchantRemarks: orderData.treatmentPlan,
|
||||
comments: JSON.stringify({
|
||||
diagnosis: orderData.diagnosis,
|
||||
treatmentPlan: orderData.treatmentPlan,
|
||||
decoctionInstructions: orderData.decoctionInstructions,
|
||||
prescriptionId: orderData.prescription?.id,
|
||||
images: orderData.images
|
||||
prescriptionId: prescriptionId, // 关联处方ID
|
||||
prescriptionNo: createdPrescription.orderNo, // 处方编号
|
||||
patientName: orderData.patient.realName,
|
||||
patientAge: orderData.patient.age
|
||||
}),
|
||||
payStatus: '0', // 未付款
|
||||
orderStatus: 0, // 待支付
|
||||
deliveryStatus: 10, // 未发货
|
||||
}
|
||||
|
||||
console.log('提交订单数据:', clinicOrderData)
|
||||
|
||||
// 调用API创建订单
|
||||
await addClinicOrder(clinicOrderData)
|
||||
await addClinicPrescription(clinicOrderData)
|
||||
console.log('订单创建成功')
|
||||
|
||||
// 清除临时数据
|
||||
Taro.removeStorageSync('tempOrderData')
|
||||
@@ -128,7 +181,7 @@ const DoctorOrderConfirm = () => {
|
||||
}, 2000)
|
||||
|
||||
} catch (error: any) {
|
||||
console.error('创建订单失败:', error)
|
||||
console.error('创建处方/订单失败:', error)
|
||||
Taro.showToast({
|
||||
title: error.message || '发送失败,请重试',
|
||||
icon: 'error'
|
||||
|
||||
@@ -2,21 +2,15 @@ import React, {useState, useEffect, useCallback} from 'react'
|
||||
import {View, Text, ScrollView} from '@tarojs/components'
|
||||
import {Empty, Tag, PullToRefresh, Loading} from '@nutui/nutui-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {pageShopDealerOrder} from '@/api/shop/shopDealerOrder'
|
||||
import {useDealerUser} from '@/hooks/useDealerUser'
|
||||
import type {ShopDealerOrder} from '@/api/shop/shopDealerOrder/model'
|
||||
|
||||
interface OrderWithDetails extends ShopDealerOrder {
|
||||
orderNo?: string
|
||||
customerName?: string
|
||||
userCommission?: string
|
||||
}
|
||||
import {ClinicPrescription} from "@/api/clinic/clinicPrescription/model";
|
||||
import {pageClinicPrescription} from "@/api/clinic/clinicPrescription";
|
||||
|
||||
const DealerOrders: React.FC = () => {
|
||||
const [loading, setLoading] = useState<boolean>(false)
|
||||
const [refreshing, setRefreshing] = useState<boolean>(false)
|
||||
const [loadingMore, setLoadingMore] = useState<boolean>(false)
|
||||
const [orders, setOrders] = useState<OrderWithDetails[]>([])
|
||||
const [orders, setOrders] = useState<ClinicPrescription[]>([])
|
||||
const [currentPage, setCurrentPage] = useState<number>(1)
|
||||
const [hasMore, setHasMore] = useState<boolean>(true)
|
||||
|
||||
@@ -24,8 +18,7 @@ const DealerOrders: React.FC = () => {
|
||||
|
||||
// 获取订单数据
|
||||
const fetchOrders = useCallback(async (page: number = 1, isRefresh: boolean = false) => {
|
||||
if (!dealerUser?.userId) return
|
||||
|
||||
console.log('获取订单数据')
|
||||
try {
|
||||
if (isRefresh) {
|
||||
setRefreshing(true)
|
||||
@@ -35,17 +28,14 @@ const DealerOrders: React.FC = () => {
|
||||
setLoadingMore(true)
|
||||
}
|
||||
|
||||
const result = await pageShopDealerOrder({
|
||||
const result = await pageClinicPrescription({
|
||||
page,
|
||||
limit: 10
|
||||
})
|
||||
|
||||
if (result?.list) {
|
||||
const newOrders = result.list.map(order => ({
|
||||
...order,
|
||||
orderNo: `${order.orderId}`,
|
||||
customerName: `用户${order.userId}`,
|
||||
userCommission: order.firstMoney || '0.00'
|
||||
...order
|
||||
}))
|
||||
|
||||
if (page === 1) {
|
||||
@@ -102,7 +92,7 @@ const DealerOrders: React.FC = () => {
|
||||
return 'warning'
|
||||
}
|
||||
|
||||
const renderOrderItem = (order: OrderWithDetails) => (
|
||||
const renderOrderItem = (order: ClinicPrescription) => (
|
||||
<View key={order.id} className="bg-white rounded-lg p-4 mb-3 shadow-sm">
|
||||
<View className="flex justify-between items-start mb-1">
|
||||
<Text className="font-semibold text-gray-800">
|
||||
@@ -117,15 +107,9 @@ const DealerOrders: React.FC = () => {
|
||||
<Text className="text-sm text-gray-400">
|
||||
订单金额:¥{order.orderPrice || '0.00'}
|
||||
</Text>
|
||||
<Text className="text-sm text-orange-500 font-semibold">
|
||||
我的佣金:¥{order.userCommission}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View className="flex justify-between items-center">
|
||||
<Text className="text-sm text-gray-400">
|
||||
客户:{order.customerName}
|
||||
</Text>
|
||||
<Text className="text-sm text-gray-400">
|
||||
{order.createTime}
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user