Commit caa938c6302411841b0e2c33a3e5e31c36499cd8
Merge branch 'order_jzr' into 'master'
Order jzr See merge request !246
Showing
4 changed files
with
25 additions
and
14 deletions
src/pages/order3/FinancialCreditMail/api.ts
1 | 1 | import { http } from '@/typing/http'; |
2 | 2 | import request from '@/utils/request'; |
3 | 3 | import { ORDER3, FINANCE2_HOST } from '@/utils/host'; |
4 | -import { common } from '@/typing/common'; | |
4 | +import { PageParams } from '@/typing/common'; | |
5 | 5 | |
6 | -interface Params extends common.PageParams { | |
6 | +interface Params extends PageParams { | |
7 | 7 | } |
8 | 8 | |
9 | 9 | interface FinParmas { |
... | ... | @@ -29,21 +29,21 @@ export interface Shop { |
29 | 29 | export interface SaveParam { |
30 | 30 | financeCompanyId?: number, // 金融公司id |
31 | 31 | financeCompanyName?: string, // 金融公司名称 |
32 | - shopInfo?: Shop[] | |
32 | + shopList?: Shop[] | |
33 | 33 | } |
34 | 34 | /** 信贷资料金融公司不邮寄列表 */ |
35 | 35 | export function getFinancialListApi(): http.PromiseResp<SaveParam[]> { |
36 | - return request.get(`${ORDER3}/erp/system/order/loan/material/post/config`); | |
36 | + return request.get(`${ORDER3}/erp/system/loan/material/post/config`); | |
37 | 37 | } |
38 | 38 | |
39 | 39 | /**保存信贷资料金融公司不邮寄 */ |
40 | 40 | export function saveFinancialApi(params: SaveParam): http.PromiseResp<any> { |
41 | - return request.post(`${ORDER3}/erp/system/order/loan/material/post/config/save`, params); | |
41 | + return request.post(`${ORDER3}/erp/system/loan/material/post/config/save`, params); | |
42 | 42 | } |
43 | 43 | |
44 | 44 | /**删除信贷资料金融公司不邮寄 */ |
45 | 45 | export function deleteFinancialApi(params : any): http.PromiseResp<any> { |
46 | - return request.post(`${ORDER3}/erp/system/order/loan/material/post/config/delete`, params, { contentType: 'form-urlencoded' }); | |
46 | + return request.post(`${ORDER3}/erp/system/loan/material/post/config/delete`, params, { contentType: 'form-urlencoded' }); | |
47 | 47 | } |
48 | 48 | /** 查询金融公司 */ |
49 | 49 | export function getCompanyList(params: FinParmas) : http.PromiseResp<CompanyList[]> { | ... | ... |
src/pages/order3/FinancialCreditMail/components/EditModal.tsx
... | ... | @@ -3,6 +3,7 @@ import { Modal, Button, message, Form, Select } from 'antd'; |
3 | 3 | import {useStore} from '../index'; |
4 | 4 | import {SaveParam, saveFinancialApi, Shop} from '../api'; |
5 | 5 | import _ from 'lodash'; |
6 | +import ShopSelectNew from '@/components/ShopSelectNew'; | |
6 | 7 | |
7 | 8 | export default function DetailModal() { |
8 | 9 | const {visible, setVisible, data, setLoading: setPageLoading, companyList, shopData, currentData, setIsEdit, isEdit} = useStore(); |
... | ... | @@ -15,8 +16,8 @@ export default function DetailModal() { |
15 | 16 | useEffect(() => { |
16 | 17 | if (visible && currentData.current) { |
17 | 18 | setFiancial({financeCompanyId: currentData.current.financeCompanyId, financeCompanyName: currentData.current.financeCompanyName}); |
18 | - setShop(currentData.current.shopInfo); | |
19 | - const _shop = currentData.current?.shopInfo.map((item: any) => item.shopId); | |
19 | + setShop(currentData.current.shopList); | |
20 | + const _shop = currentData.current?.shopList.map((item: any) => ({label: item.shopName, value: item.shopId})); | |
20 | 21 | form.setFieldsValue({ |
21 | 22 | shop: _shop || [], |
22 | 23 | company: currentData.current?.financeCompanyId || undefined |
... | ... | @@ -32,8 +33,9 @@ export default function DetailModal() { |
32 | 33 | |
33 | 34 | async function onFinish() { |
34 | 35 | const param = await form.validateFields(); |
36 | + const _shop = param.shop.map((v: any) => ({shopId: v.value, shopName: v.label})); | |
35 | 37 | setConfirmLoading(true); |
36 | - const params = {financeCompanyId: financial.financeCompanyId, financeCompanyName: financial.financeCompanyName, shopInfo: shop}; | |
38 | + const params = {financeCompanyId: financial.financeCompanyId, financeCompanyName: financial.financeCompanyName, shopList: _shop}; | |
37 | 39 | saveFinancialApi(params) |
38 | 40 | .then(res => { |
39 | 41 | message.success(res.result); |
... | ... | @@ -68,6 +70,7 @@ export default function DetailModal() { |
68 | 70 | maskClosable={false} |
69 | 71 | onCancel={handleCancel} |
70 | 72 | afterClose={form.resetFields} |
73 | + width="50%" | |
71 | 74 | footer={[ |
72 | 75 | <Button key="cancel" loading={confirmLoading} onClick={handleCancel} style={{marginLeft: 10}}>取消</Button>, |
73 | 76 | <Button key="submit" onClick={_.debounce(onFinish, 380)} type="primary" htmlType="submit" loading={confirmLoading}>确认</Button> |
... | ... | @@ -88,13 +91,14 @@ export default function DetailModal() { |
88 | 91 | </Select> |
89 | 92 | </Form.Item> |
90 | 93 | <Form.Item label="门店" rules={[{required: true, message: '请选择门店'}]} name="shop"> |
91 | - <Select allowClear mode="multiple" placeholder="请选择门店" showSearch optionFilterProp="label" onChange={(key, value) => _onChangeShop(key, value)}> | |
94 | + <ShopSelectNew defaultOptions={{bizTypes: "1"}} placeholder="请选择门店" multiple /> | |
95 | + {/* <Select allowClear mode="multiple" placeholder="请选择门店" showSearch optionFilterProp="label" onChange={(key, value) => _onChangeShop(key, value)}> | |
92 | 96 | {shopData.length > 0 && shopData.map(role => ( |
93 | 97 | <Select.Option key={role.id} value={role.id} label={role.name}> |
94 | 98 | {role.name} |
95 | 99 | </Select.Option> |
96 | 100 | ))} |
97 | - </Select> | |
101 | + </Select> */} | |
98 | 102 | </Form.Item> |
99 | 103 | </Form> |
100 | 104 | </Modal> | ... | ... |
src/pages/order3/FinancialCreditMail/components/List.tsx
1 | 1 | import React from 'react'; |
2 | 2 | import { Table, Popconfirm, message, Space } from 'antd'; |
3 | 3 | import { useStore } from '../index'; |
4 | -import {SaveParam, deleteFinancialApi} from '../api'; | |
4 | +import {SaveParam, deleteFinancialApi, Shop} from '../api'; | |
5 | 5 | |
6 | 6 | const Column = Table.Column; |
7 | 7 | |
... | ... | @@ -28,6 +28,13 @@ export default function LargeList() { |
28 | 28 | setVisible(true); |
29 | 29 | setIsEdit(true); |
30 | 30 | } |
31 | + | |
32 | + function renderShop(shopList: Shop[] = []) { | |
33 | + if (!shopList.length) { | |
34 | + return '--'; | |
35 | + } | |
36 | + return `${shopList[0].shopName}等${shopList.length}个门店`; | |
37 | + } | |
31 | 38 | return ( |
32 | 39 | <Table |
33 | 40 | dataSource={data || []} |
... | ... | @@ -36,7 +43,7 @@ export default function LargeList() { |
36 | 43 | pagination={false} |
37 | 44 | > |
38 | 45 | <Column title="金融公司" dataIndex="financeCompanyName" align="left" /> |
39 | - <Column title="适用门店" dataIndex="shopInfo" align="left" render={(_text, record) => <span style={{color: "#4189FD"}} onClick={() => lookShop(record)}>查看</span>} /> | |
46 | + <Column title="适用门店" dataIndex="shopList" align="left" render={(_text, record: any) => <span style={{color: "#4189FD", cursor: 'pointer'}} onClick={() => lookShop(record)}>{renderShop(record?.shopList)}</span>} /> | |
40 | 47 | <Column |
41 | 48 | title="操作" |
42 | 49 | align="center" | ... | ... |
src/pages/order3/FinancialCreditMail/components/ShopModal.tsx