Commit cc1cf84d50b7c77b5845a9711e0ffcfc279c1494
1 parent
69ee5e01
优惠券选车展示配置代码
Showing
2 changed files
with
11 additions
and
12 deletions
src/pages/coupon/CouponConfig/components/WareLimitType/SpecLimit.tsx
... | ... | @@ -14,7 +14,7 @@ const carEnum = { |
14 | 14 | 1: '11', //品牌 |
15 | 15 | 2: '12', //车系 |
16 | 16 | 3: '13', //车型 |
17 | -} | |
17 | +}; | |
18 | 18 | const SpecLimit = (props: Props) => { |
19 | 19 | const { form, value, readonly, onChange, carSelectApi } = props; |
20 | 20 | const [specList, setSpecList] = useState<any[]>([]); |
... | ... | @@ -49,18 +49,17 @@ const SpecLimit = (props: Props) => { |
49 | 49 | function renderTree(specList: any[], carType: number) { |
50 | 50 | return specList.map((spec, index) => { |
51 | 51 | const { label, value, children, type } = spec; |
52 | - const hasChildren = Array.isArray(children) && children.length > 0; | |
53 | - | |
52 | + const hasChildren = (Array.isArray(children) && children.length > 0) || spec.specConfigCodeList; | |
54 | 53 | if (hasChildren) { |
55 | 54 | return ( |
56 | 55 | // disableCheckbox={hasChildren disableCheckbox={readonly} |
57 | 56 | <TreeSelect.TreeNode selectable title={label} value={`${carEnum[carType]}_${value}`} key={`${carEnum[carType]}_${value}`}> |
58 | - {renderTree(children, carType + 1)} | |
57 | + {renderTree(children || spec.specConfigCodeList, carType + 1)} | |
59 | 58 | </TreeSelect.TreeNode> |
60 | 59 | ); |
61 | 60 | } else { |
62 | 61 | data.push(String(value)); |
63 | - return <TreeSelect.TreeNode selectable title={label} value={`${carEnum[carType]}_${value}`} key={`${carEnum[carType]}_${value}`} />; | |
62 | + return <TreeSelect.TreeNode selectable={!!value} checkable={!!value} title={label || spec} value={value ? `${carEnum[carType]}_${value}` : spec} key={value ? `${carEnum[carType]}_${value}` : spec} />; | |
64 | 63 | } |
65 | 64 | }); |
66 | 65 | } | ... | ... |
src/pages/mkt/ActivityCreate/BasicInformation/index.tsx
... | ... | @@ -85,12 +85,12 @@ function Index({ onNext }: Props) { |
85 | 85 | // changePramas[key] = params[key]; |
86 | 86 | // } |
87 | 87 | // } |
88 | - params.bizType = undefined; | |
89 | - params.activityType = undefined; | |
90 | - params.address = undefined; | |
91 | - params.addressType = undefined; | |
92 | - params.startTime = undefined; | |
93 | - params.couponValidTime = undefined; | |
88 | + params.bizType = undefined; | |
89 | + params.activityType = undefined; | |
90 | + params.address = undefined; | |
91 | + params.addressType = undefined; | |
92 | + params.startTime = undefined; | |
93 | + params.couponValidTime = undefined; | |
94 | 94 | } |
95 | 95 | const currentApi = changeEnable ? api.changeBasicInfoApi : api.saveBasicInfoApi; |
96 | 96 | currentApi(params).then((res) => { |
... | ... | @@ -234,7 +234,7 @@ function Index({ onNext }: Props) { |
234 | 234 | {({ getFieldValue }): any => { |
235 | 235 | return getFieldValue("addressType") === 2 ? ( |
236 | 236 | <Form.Item label="地址" name="address" rules={[{ required: true, message: '请选择地址' }]}> |
237 | - <PositionSelector disabled={readOnly} /> | |
237 | + <PositionSelector /> | |
238 | 238 | </Form.Item> |
239 | 239 | ) : null; |
240 | 240 | }} | ... | ... |