Commit c816aaf13fa9b4978cff7929d31da44aa948d78a

Authored by boyang
1 parent d6e3f08e

feat: 开发隐私钱包页面

src/pages/Order/Order/components/CheckModal.tsx
... ... @@ -85,12 +85,37 @@ export default ({
85 85 // data: { subOrderIds: subOrderIds },
86 86 // });
87 87  
  88 + // 检查subOrders是否存在且有元素
  89 + if (!subOrders || !subOrders.length) {
  90 + // 如果是预存审核类型,直接返回,不需要处理售后信息
  91 + if (checkType(CHECK_TYPE.PREPAID_AUDIT)) {
  92 + return;
  93 + }
  94 +
  95 + // 对于其他类型,设置一个空的售后信息
  96 + setAfterSalesInfo(
  97 + <div className="my-5">
  98 + <Row gutter={[16, 24]}>
  99 + <Col span={24}>
  100 + <span>暂无售后信息</span>
  101 + </Col>
  102 + </Row>
  103 + </div>,
  104 + );
  105 + return;
  106 + }
  107 +
88 108 //附件
89   - let annex = subOrders[0].afterSalesAnnexList;
  109 + let annex = subOrders[0]?.afterSalesAnnexList || [];
90 110 let index = 1;
91 111 let annexLinks = annex?.map((f) => {
92 112 return (
93   - <Button className="p-0 pr-1" type="link" key="key" href={f}>
  113 + <Button
  114 + className="p-0 pr-1"
  115 + type="link"
  116 + key={`annex-${index}`}
  117 + href={f}
  118 + >
94 119 {'附件' + index++}
95 120 </Button>
96 121 );
... ... @@ -126,27 +151,36 @@ export default ({
126 151 useEffect(() => {
127 152 if (checkType(CHECK_TYPE.CONFIRM_DELIVER)) {
128 153 setAPopoverTitle('确认发货');
  154 + } else if (checkType(CHECK_TYPE.PREPAID_AUDIT)) {
  155 + setAPopoverTitle('预存审核');
129 156 }
130 157 getOrderAfterSalesInfo();
131 158  
132 159 let paymentReceiptsImagesList: any[] = [];
133 160 subOrders?.forEach((item: any) => {
134   - if (item.paymentReceiptAnnexList) {
135   - paymentReceiptsImagesList.push(...item.paymentReceiptAnnexList);
  161 + if (
  162 + item?.paymentReceiptsImages !== null &&
  163 + item?.paymentReceiptsImages !== undefined
  164 + ) {
  165 + paymentReceiptsImagesList.push(...item.paymentReceiptsImages);
136 166 }
137 167 });
138   - //去重
139   - paymentReceiptsImagesList = [...new Set(paymentReceiptsImagesList)];
140 168 setPymentReceiptsImages(paymentReceiptsImagesList);
141 169  
142   - //预存审核的凭证
143 170 let proofImages: any[] = [];
  171 + // 从subOrders获取凭证图片
144 172 subOrders?.forEach((item) => {
145   - let images = item.proofImages;
  173 + let images = item?.proofImages;
146 174 if (images !== null && images !== undefined) {
147 175 proofImages.push(...images);
148 176 }
149 177 });
  178 +
  179 + // 对于预存审核,从data对象中获取凭证图片
  180 + if (checkType(CHECK_TYPE.PREPAID_AUDIT) && data?.proofImages) {
  181 + proofImages = [...data.proofImages];
  182 + }
  183 +
150 184 setPrepaidProofImages(proofImages);
151 185 }, []);
152 186  
... ... @@ -374,12 +408,25 @@ export default ({
374 408 * @param body
375 409 */
376 410 async function doPrepaidAudit(body: any) {
377   - const data = await postPrepaidAudit({
378   - data: body,
  411 + // 确保传递了需要审核的记录ID
  412 + const auditData = {
  413 + ...body,
  414 + ids: [data?.id], // 使用当前记录的ID
  415 + checkPassOrReject: body.checkPassOrReject, // 通过或驳回
  416 + checkNotes: body.name, // 审核意见
  417 + };
  418 +
  419 + console.log('预存审核参数:', auditData);
  420 +
  421 + const result = await postPrepaidAudit({
  422 + data: auditData,
379 423 });
380   - if (data.result === RESPONSE_CODE.SUCCESS) {
381   - message.success(data.message);
  424 +
  425 + if (result.result === RESPONSE_CODE.SUCCESS) {
  426 + message.success(result.message);
382 427 onClose();
  428 + } else {
  429 + message.error(result.message || '审核失败');
383 430 }
384 431 }
385 432  
... ...
src/pages/Order/OrderList/OrderDrawer.tsx
... ... @@ -230,7 +230,11 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
230 230  
231 231 // 查询当前手机号允许使用的预存账号
232 232 if (phone) {
233   - let res = await postPrepaidPhoneAvailableList({ data: { phone: phone } });
  233 + // 从表单中获取 salesCode
  234 + const salesCode = form.getFieldValue('salesCode');
  235 + let res = await postPrepaidPhoneAvailableList({
  236 + data: { phone: phone, salesCode: salesCode },
  237 + });
234 238 if (res && res.result === RESPONSE_CODE.SUCCESS) {
235 239 let uidDetails = res.data;
236 240 for (let detail of uidDetails) {
... ... @@ -890,9 +894,44 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
890 894 if (typeof values.erpCustomerId !== 'string') {
891 895 values.erpCustomerId = values.erpCustomerId?.id;
892 896 }
893   - values.province = province;
894   - values.city = city;
895   - values.district = district;
  897 +
  898 + // Handle the prepaidUid and privatePocket values for API submission
  899 + if (
  900 + values.paymentMethod === 'WITHHOLDING_ADVANCE_DEPOSIT' &&
  901 + values.prepaidUid
  902 + ) {
  903 + console.log('5656原始表单数据:', {
  904 + prepaidUid: values.prepaidUid,
  905 + realPrepaidUid: values.realPrepaidUid,
  906 + privatePocket: values.privatePocket,
  907 + });
  908 +
  909 + // 从选项值中提取原始UID (不包含索引后缀)
  910 + const prepaidUidParts = values.prepaidUid.split('_');
  911 + if (prepaidUidParts.length > 0) {
  912 + // 直接使用第一部分作为实际UID值 (不使用realPrepaidUid)
  913 + values.prepaidUid = parseInt(prepaidUidParts[0], 10);
  914 + console.log('5656使用原始UID进行API提交:', values.prepaidUid);
  915 + }
  916 +
  917 + // 确保privatePocket字段被正确设置
  918 + // 表单中存储的是字符串'true'或'false',需要转换成布尔值
  919 + if (values.privatePocket === 'true') {
  920 + values.privatePocket = true;
  921 + console.log('设置privatePocket=true用于API提交');
  922 + } else {
  923 + values.privatePocket = false;
  924 + console.log('设置privatePocket=false用于API提交');
  925 + }
  926 +
  927 + console.log('最终API提交数据:', {
  928 + prepaidUid: values.prepaidUid,
  929 + privatePocket: values.privatePocket,
  930 + });
  931 + }
  932 +
  933 + console.log(values, '5656values');
  934 +
896 935 //新增
897 936 if (optType('add') || optType('copy')) {
898 937 res = await postServiceOrderAddOrder({ data: values });
... ... @@ -1701,6 +1740,10 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
1701 1740 rules={[{ required: true, message: '支付方式必填' }]}
1702 1741 disabled={optType('after-sales-check')}
1703 1742 />
  1743 + {/* 隐藏字段用于存储真实UID和privatePocket标志 */}
  1744 + <ProFormText name="realPrepaidUid" hidden />
  1745 + <ProFormText name="privatePocket" hidden />
  1746 +
1704 1747 <ProFormSelect
1705 1748 name="prepaidUid"
1706 1749 key="prepaidUid"
... ... @@ -1708,15 +1751,55 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
1708 1751 hidden={paymentMethod !== 'WITHHOLDING_ADVANCE_DEPOSIT'}
1709 1752 showSearch
1710 1753 label="预存账号"
1711   - onChange={(value: any) => {
  1754 + onChange={(value: any, option: any) => {
  1755 + console.log(value, '5656value');
  1756 + console.log(option, '5656option');
  1757 +
  1758 + if (!option) {
  1759 + form.setFieldValue('prepaidUid', undefined);
  1760 + form.setFieldValue('privatePocket', false);
  1761 + return;
  1762 + }
  1763 +
  1764 + // 从选项中获取真实UID和机构信息
  1765 + const selectedData = option || {};
  1766 + const realUid = selectedData.uid;
  1767 + const institution = selectedData.institution;
  1768 +
  1769 + console.log('选中账户信息:', {
  1770 + value: value,
  1771 + realUid: realUid,
  1772 + institution: institution,
  1773 + });
  1774 +
1712 1775 //检查用户额度
1713 1776 let valid = checkAccountMoney(
1714   - value,
  1777 + realUid, // 使用真实UID检查额度
1715 1778 form.getFieldValue('totalPayment'),
1716 1779 );
  1780 +
1717 1781 if (!valid) {
1718 1782 form.setFieldValue('prepaidUid', undefined);
  1783 + form.setFieldValue('privatePocket', false);
  1784 + return;
1719 1785 }
  1786 +
  1787 + // 如果机构是"隐私钱包",则设置privatePocket为true
  1788 + const isPrivacyWallet = institution === '隐私钱包';
  1789 +
  1790 + // 设置真实UID和privatePocket标志
  1791 + form.setFieldValue('realPrepaidUid', realUid);
  1792 + // 存储为字符串'true'或'false',这样在表单中能正确保存
  1793 + form.setFieldValue(
  1794 + 'privatePocket',
  1795 + isPrivacyWallet ? 'true' : 'false',
  1796 + );
  1797 +
  1798 + console.log('设置表单数据:', {
  1799 + prepaidUid: value,
  1800 + realPrepaidUid: realUid,
  1801 + privatePocket: isPrivacyWallet,
  1802 + });
1720 1803 }}
1721 1804 placeholder="请选择预存账号"
1722 1805 rules={[
... ... @@ -1762,7 +1845,17 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
1762 1845 // });
1763 1846 // return options;
1764 1847 // }}
1765   - options={accountOptions}
  1848 + options={accountOptions.map((item, index) => ({
  1849 + ...item,
  1850 + // Use index to create unique value
  1851 + value: `${item.value}_${index}`,
  1852 + // Store original values as custom attributes
  1853 + data: {
  1854 + uid: item.value,
  1855 + institution: item.institution,
  1856 + index: index,
  1857 + },
  1858 + }))}
1766 1859 />
1767 1860 <ProFormSelect
1768 1861 placeholder="选择是否需要开票"
... ...
src/pages/Prepaid/PrepaidAccount/index.tsx
... ... @@ -178,37 +178,41 @@ const PrepaidAccountPage = () =&gt; {
178 178  
179 179 {balanceChangeRecordsModalVisible && (
180 180 <BalanceChangeRecordsModal
181   - visible={balanceChangeRecordsModalVisible}
182   - onCancel={() => {
  181 + setVisible={setBalanceChangeRecordsModalVisible}
  182 + userInfoObj={currentOptUserObj}
  183 + onClose={() => {
183 184 setBalanceChangeRecordsModalVisible(false);
  185 + reloadAccountTable();
184 186 }}
185   - record={currentOptUserObj}
186 187 />
187 188 )}
188 189  
189 190 {pointsExchangeModalVisible && (
190 191 <PointsExchangeModal
191   - visible={pointsExchangeModalVisible}
192   - onCancel={() => {
193   - setPointsExchangeModalVisible(false);
194   - }}
195   - onOk={() => {
  192 + setVisible={setPointsExchangeModalVisible}
  193 + userInfoObj={
  194 + currentOptUserObj
  195 + ? { ...currentOptUserObj, relationEntityType: 'USER' }
  196 + : { uid: '', relationEntityType: 'USER' }
  197 + }
  198 + onClose={() => {
196 199 setPointsExchangeModalVisible(false);
197 200 reloadAccountTable();
198 201 }}
199   - record={currentOptUserObj}
200   - relationEntityType="USER"
201 202 />
202 203 )}
203 204  
204 205 {pointsExchangeRecordsModalVisible && (
205 206 <PointsExchangeRecordsModal
206   - visible={pointsExchangeRecordsModalVisible}
207   - onCancel={() => {
  207 + setVisible={setPointsExchangeRecordsModalVisible}
  208 + userInfoObj={
  209 + currentOptUserObj
  210 + ? { ...currentOptUserObj, relationEntityType: 'USER' }
  211 + : { uid: '', relationEntityType: 'USER' }
  212 + }
  213 + onClose={() => {
208 214 setPointsExchangeRecordsModalVisible(false);
209 215 }}
210   - record={currentOptUserObj}
211   - relationEntityType="USER"
212 216 />
213 217 )}
214 218 </div>
... ...
src/pages/Prepaid/PrepaidRecharge/index.tsx
... ... @@ -205,30 +205,26 @@ const PrepaidRechargePage = () =&gt; {
205 205  
206 206 {rechargePrepaymentModalVisible && (
207 207 <RechargePrepaymentModal
208   - visible={rechargePrepaymentModalVisible}
209   - onCancel={() => {
210   - setRechargePrepaymentModalVisible(false);
211   - }}
212   - onOk={() => {
  208 + setVisible={setRechargePrepaymentModalVisible}
  209 + prepaymentObject={currentOptPrepaymentObj}
  210 + onClose={() => {
213 211 setRechargePrepaymentModalVisible(false);
214 212 reloadPrepaidTable();
215 213 }}
216   - record={currentOptPrepaymentObj}
217 214 />
218 215 )}
219 216  
220 217 {checkVisible && (
221 218 <CheckModal
222   - visible={checkVisible}
223   - onCancel={() => {
224   - setCheckVisible(false);
225   - }}
226   - onOk={() => {
  219 + setCheckVisible={setCheckVisible}
  220 + data={currentOptPrepaymentObj}
  221 + subOrders={[]}
  222 + orderCheckType={CHECK_TYPE.PREPAID_AUDIT}
  223 + openOrderDrawer={null}
  224 + onClose={() => {
227 225 setCheckVisible(false);
228 226 reloadPrepaidTable();
229 227 }}
230   - record={currentOptPrepaymentObj}
231   - type={CHECK_TYPE.PREPAID}
232 228 />
233 229 )}
234 230 </div>
... ...
src/pages/Prepaid/PrivatePocket/components/AddPrivatePocketModal.tsx
... ... @@ -60,7 +60,7 @@ const AddPrivatePocketModal: React.FC&lt;AddPrivatePocketModalProps&gt; = ({
60 60 },
61 61 });
62 62  
63   - if (res?.code === 200 || res?.success) {
  63 + if (res?.result === 0 || res?.code === 200 || res?.success) {
64 64 message.success('添加隐私钱包成功');
65 65 onSuccess();
66 66 } else {
... ...
src/pages/Prepaid/PrivatePocket/constant.tsx
... ... @@ -60,11 +60,11 @@ export const PRIVATE_POCKET_COLUMNS = [
60 60 valueType: 'dateTime',
61 61 hideInSearch: true,
62 62 },
63   - {
64   - title: '更新时间',
65   - dataIndex: 'updateTime',
66   - key: 'updateTime',
67   - valueType: 'dateTime',
68   - hideInSearch: true,
69   - },
  63 + // {
  64 + // title: '更新时间',
  65 + // dataIndex: 'updateTime',
  66 + // key: 'updateTime',
  67 + // valueType: 'dateTime',
  68 + // hideInSearch: true,
  69 + // },
70 70 ];
... ...
src/pages/Prepaid/components/RechargePrepaymentModal.tsx
... ... @@ -30,8 +30,10 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
30 30 salesCode: string;
31 31 rechargeAmount: number;
32 32 notes: string;
  33 + rechargeType: string; // 充值类型
33 34 }>();
34 35 const [salesCodeOptions, setSalesCodeOptions] = useState([]);
  36 + const [setRechargeType] = useState<string>('normal'); // 默认普通充值
35 37 const [isCreate, setIsCreate] = useState(true);
36 38 const [fileList, setFileList] = useState<UploadFile[]>([]);
37 39 const [previewOpen, setPreviewOpen] = useState(false);
... ... @@ -243,7 +245,8 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
243 245 },
244 246 }}
245 247 onFinish={async (values) => {
246   - if (fileList.length <= 0) {
  248 + // 隐私钱包充值不需要凭证
  249 + if (values.rechargeType !== 'privatePocket' && fileList.length <= 0) {
247 250 message.error('凭证不能为空');
248 251 return;
249 252 }
... ... @@ -278,6 +281,12 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
278 281 }
279 282 }
280 283 }
  284 + // 所有充值类型都传递rechargeType参数
  285 + // 如果是隐私钱包充值且不需要凭证,直接创建空凭证数组
  286 + if (values.rechargeType === 'privatePocket' && fileList.length <= 0) {
  287 + values.proofImages = [];
  288 + }
  289 + // 普通充值流程
281 290 let res = await postServiceOrderFileProcess({
282 291 data: formData,
283 292 });
... ... @@ -302,6 +311,8 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
302 311 data: {
303 312 ...values,
304 313 customerName: form.getFieldValue('customerNameString'),
  314 + // 传递充值类型参数
  315 + rechargeType: values.rechargeType || 'normal',
305 316 },
306 317 });
307 318 } else {
... ... @@ -312,7 +323,11 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
312 323 body.customerName = customerNameString;
313 324 }
314 325 res = await postPrepaidUpdate({
315   - data: body,
  326 + data: {
  327 + ...body,
  328 + // 传递充值类型参数
  329 + rechargeType: values.rechargeType || 'normal',
  330 + },
316 331 });
317 332 }
318 333  
... ... @@ -416,6 +431,21 @@ export default ({ setVisible, prepaymentObject, onClose }) =&gt; {
416 431 rules={[{ required: true, message: '销售代表必填' }]}
417 432 options={salesCodeOptions}
418 433 />
  434 + <ProFormSelect
  435 + name="rechargeType"
  436 + label="充值类型"
  437 + initialValue="normal"
  438 + valueEnum={{
  439 + normal: '普通充值',
  440 + privatePocket: '隐私钱包充值',
  441 + }}
  442 + fieldProps={{
  443 + onChange: (value) => {
  444 + setRechargeType(value);
  445 + },
  446 + }}
  447 + rules={[{ required: true, message: '请选择充值类型' }]}
  448 + />
419 449 <ProFormDigit
420 450 name="rechargeAmount"
421 451 label="充值金额(¥)"
... ...
src/services/definition.ts
... ... @@ -4823,6 +4823,45 @@ export interface UserNowMoneyCheckRequest {
4823 4823 uid?: number;
4824 4824 }
4825 4825  
  4826 +export interface UserPrivatePocketBalanceUpdateRequest {
  4827 + /**
  4828 + * @description
  4829 + * 用户账号
  4830 + */
  4831 + account: string;
  4832 + /**
  4833 + * @description
  4834 + * 创建人
  4835 + */
  4836 + createByName?: string;
  4837 + /**
  4838 + * @description
  4839 + * 用户余额
  4840 + */
  4841 + nowMoney?: number;
  4842 + /**
  4843 + * @description
  4844 + * 隐私余额
  4845 + */
  4846 + privateMoney?: number;
  4847 + /**
  4848 + * @description
  4849 + * 真实姓名
  4850 + */
  4851 + realName?: string;
  4852 + /**
  4853 + * @description
  4854 + * 负责销售
  4855 + */
  4856 + salesCode: string;
  4857 + /**
  4858 + * @description
  4859 + * 用户id
  4860 + * @format int32
  4861 + */
  4862 + uid?: number;
  4863 +}
  4864 +
4826 4865 export interface UserPrivatePocketDeleteRequest {
4827 4866 /**
4828 4867 * @description
... ... @@ -5562,6 +5601,11 @@ export interface SalesRechargePrepaymentAuditRequest {
5562 5601 * 手机号
5563 5602 */
5564 5603 phone?: string;
  5604 + /**
  5605 + * @description
  5606 + * 销售代表编码
  5607 + */
  5608 + salescode?: string;
5565 5609 }
5566 5610  
5567 5611 export interface SalesRechargePrepaymentCreateRequest {
... ... @@ -5602,6 +5646,13 @@ export interface SalesRechargePrepaymentCreateRequest {
5602 5646 rechargeSource?: string;
5603 5647 /**
5604 5648 * @description
  5649 + * 充值类型
  5650 + * @example
  5651 + * normal
  5652 + */
  5653 + rechargeType?: string;
  5654 + /**
  5655 + * @description
5605 5656 * 销售代表
5606 5657 */
5607 5658 salesCode?: string;
... ...
src/services/request.ts
... ... @@ -167,6 +167,7 @@ import type {
167 167 UserDetailRequest,
168 168 UserListRequest,
169 169 UserNowMoneyCheckRequest,
  170 + UserPrivatePocketBalanceUpdateRequest,
170 171 UserPrivatePocketDeleteRequest,
171 172 UserPrivatePocketDetailRequest,
172 173 UserPrivatePocketListRequest,
... ... @@ -3429,6 +3430,77 @@ export const postCanrdPrivatePocketSave = /* #__PURE__ */ (() =&gt; {
3429 3430 return request;
3430 3431 })();
3431 3432  
  3433 +/** @description request parameter type for postCanrdPrivatePocketUpdateBalance */
  3434 +export interface PostCanrdPrivatePocketUpdateBalanceOption {
  3435 + /**
  3436 + * @description
  3437 + * request
  3438 + */
  3439 + body: {
  3440 + /**
  3441 + @description
  3442 + request */
  3443 + request: UserPrivatePocketBalanceUpdateRequest;
  3444 + };
  3445 +}
  3446 +
  3447 +/** @description response type for postCanrdPrivatePocketUpdateBalance */
  3448 +export interface PostCanrdPrivatePocketUpdateBalanceResponse {
  3449 + /**
  3450 + * @description
  3451 + * OK
  3452 + */
  3453 + 200: ServerResult;
  3454 + /**
  3455 + * @description
  3456 + * Created
  3457 + */
  3458 + 201: any;
  3459 + /**
  3460 + * @description
  3461 + * Unauthorized
  3462 + */
  3463 + 401: any;
  3464 + /**
  3465 + * @description
  3466 + * Forbidden
  3467 + */
  3468 + 403: any;
  3469 + /**
  3470 + * @description
  3471 + * Not Found
  3472 + */
  3473 + 404: any;
  3474 +}
  3475 +
  3476 +export type PostCanrdPrivatePocketUpdateBalanceResponseSuccess =
  3477 + PostCanrdPrivatePocketUpdateBalanceResponse[200];
  3478 +/**
  3479 + * @description
  3480 + * 更新用户隐私钱包余额
  3481 + * @tags user-private-pocket-controller
  3482 + * @produces *
  3483 + * @consumes application/json
  3484 + */
  3485 +export const postCanrdPrivatePocketUpdateBalance = /* #__PURE__ */ (() => {
  3486 + const method = 'post';
  3487 + const url = '/canrd/privatePocket/updateBalance';
  3488 + function request(
  3489 + option: PostCanrdPrivatePocketUpdateBalanceOption,
  3490 + ): Promise<PostCanrdPrivatePocketUpdateBalanceResponseSuccess> {
  3491 + return requester(request.url, {
  3492 + method: request.method,
  3493 + ...option,
  3494 + }) as unknown as Promise<PostCanrdPrivatePocketUpdateBalanceResponseSuccess>;
  3495 + }
  3496 +
  3497 + /** http method */
  3498 + request.method = method;
  3499 + /** request url */
  3500 + request.url = url;
  3501 + return request;
  3502 +})();
  3503 +
3432 3504 /** @description request parameter type for postCommonAudit */
3433 3505 export interface PostCommonAuditOption {
3434 3506 /**
... ...