Commit 7f99aabb authored by 前端-许冠华's avatar 前端-许冠华

Merge branch 'cherry-pick-d5daf6bd-2' into 'v2-220318'

Merge branch 'fix-v2' into 'v2' See merge request linkseeks-design/pro-platform!39
parents 2aec1de2 861596e3
import React, { useState, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Form, Input, Button, Tooltip, Select, message, Upload, Typography, Tabs } from 'antd'
import { Form, Input, Button, Tooltip, Select, message, Upload, Typography, Tabs, Badge } from 'antd'
import { getIntl, Prompt } from 'umi'
import { inject } from 'mobx-react'
import { QuestionCircleOutlined, DeleteOutlined, CopyOutlined, UploadOutlined, LinkOutlined } from '@ant-design/icons'
......@@ -28,6 +28,14 @@ interface LogisticsInfoPropsType {
const { TabPane } = Tabs;
const defaultCityData = { index: 0, provinceCode: 0, province: '', cityCode: 0, city: '' }
const TabFormErrors = (props) => {
return (
<Badge size="small" count={props.dot} offset={[6, -5]}>
{props.children}
</Badge>
)
}
const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
const { siteUrl, siteId } = props.SiteStore
const [door, setDoor] = useState<string>('');
......@@ -46,6 +54,13 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
const [shopId, setShopId] = useState<number>()
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [mainBusiness, setMainBusiness] = useState<Array<string>>([''])
const [badge, setbadge] = useState<any>([0, 0, 0]);
const getError = (num: number, idx: number) => {
const data = [...badge];
data[idx] = num;
setbadge(data);
}
/** 上传公司画册 */
const [file, setFile] = useState<any>({});
......@@ -53,7 +68,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
const beforeDocUpload = (file: any) => {
const isLt50M = file.size / 1024 / 1024 < 50;
if (!isLt50M) {
message.error(intl.formatMessage({id: 'logistics.shangchuanwenjiandaxiaobuchao'}));
message.error(intl.formatMessage({ id: 'logistics.shangchuanwenjiandaxiaobuchao' }));
}
return isLt50M;
}
......@@ -221,6 +236,16 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
})
}
const getNumber = (arr: string[]) => {
let count: number = 0;
arr.forEach(item => {
if (!item) {
count += 1
}
})
return count
}
const handleSave = (e: any) => {
e.preventDefault()
form.validateFields().then((value: any) => {
......@@ -249,6 +274,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
}
postTemplateWebMemberLogisticsWebSaveCurrMemberLogistics(params).then(res => {
if (res.code === 1000) {
setbadge([0, 0, 0])
fetchShopInfo()
setFormIsHalfFilledOut(false)
}
......@@ -256,6 +282,13 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
}).catch(() => {
setConfirmLoading(false)
})
}).catch(err => {
const { mainBusiness, areaBOList, logo, describe, title, description, keywords } = err.values
if (!mainBusiness || !areaBOList || !logo || !describe) {
getError(getNumber([mainBusiness, areaBOList, logo, describe]), 0)
} else if (!title || !description || !keywords) {
getError(getNumber([title, description, keywords]), 1)
}
})
}
......@@ -263,7 +296,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
const checkareaBOList = (shopAreas) => {
if (isEmpty(shopAreas)) {
message.destroy()
message.error(intl.formatMessage({id: 'logistics.qingxuanzeguishudishi'}))
message.error(intl.formatMessage({ id: 'logistics.qingxuanzeguishudishi' }))
return false
}
......@@ -271,7 +304,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
if (isEmpty(item.provinceCode)) {
message.destroy()
message.error(intl.formatMessage({id: 'logistics.qingxuanzeguishudishi'}))
message.error(intl.formatMessage({ id: 'logistics.qingxuanzeguishudishi' }))
return false
} else {
return true
......@@ -283,7 +316,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
const checkmainBusiness = (shopMainBusiness) => {
if (isEmpty(shopMainBusiness)) {
message.destroy()
message.error(intl.formatMessage({id: 'logistics.qingshuruzhuyingyewu'}))
message.error(intl.formatMessage({ id: 'logistics.qingshuruzhuyingyewu' }))
return false
}
......@@ -291,7 +324,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
if (isEmpty(item)) {
message.destroy()
message.error(intl.formatMessage({id: 'logistics.qingshuruzhuyingyewu'}))
message.error(intl.formatMessage({ id: 'logistics.qingshuruzhuyingyewu' }))
return false
} else {
return true
......@@ -303,7 +336,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
const handleCopyLinke = (link: string) => {
if (copy(link)) {
message.success(intl.formatMessage({id: 'logistics.fuzhichenggong'}))
message.success(intl.formatMessage({ id: 'logistics.fuzhichenggong' }))
}
}
......@@ -379,10 +412,10 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
return (
<PageHeaderWrapper
extra={
<Button type="primary" loading={confirmLoading} onClick={handleSave}>{intl.formatMessage({id: 'logistics.baocun'})}</Button>
<Button type="primary" loading={confirmLoading} onClick={handleSave}>{intl.formatMessage({ id: 'logistics.baocun' })}</Button>
}
>
<Prompt when={formIsHalfFilledOut} message={intl.formatMessage({id: 'logistics.ninhaiyouweibaocundenei'})} />
<Prompt when={formIsHalfFilledOut} message={intl.formatMessage({ id: 'logistics.ninhaiyouweibaocundenei' })} />
<div className={styles.logistics_info}>
<Form
form={form}
......@@ -393,12 +426,12 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
<Tabs
type='card'
>
<TabPane tab={intl.formatMessage({id: 'logistics.jibenxinxi'})} key='1' forceRender>
<TabPane tab={<TabFormErrors dot={badge[0]}>{intl.formatMessage({ id: 'logistics.jibenxinxi' })}</TabFormErrors>} key='1' forceRender>
<Form.Item
labelAlign="left"
name="mainBusiness"
label={<RequireItem label={intl.formatMessage({id: 'logistics.zhuyingyewu'})} isRequire={true} />}
rules={[{ required: true, message: intl.formatMessage({id: 'logistics.qingshuruzhuyingyewu'}) }]}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.zhuyingyewu' })} isRequire={true} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'logistics.qingshuruzhuyingyewu' }) }]}
>
<InputSelect
dataSource={mainBusiness}
......@@ -410,8 +443,8 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
<Form.Item
labelAlign="left"
name="areaBOList"
label={<RequireItem label={intl.formatMessage({id: 'logistics.guishudishi'})}isRequire={true} />}
rules={[{ required: true, message: intl.formatMessage({id: 'logistics.qingxuanzeguishudishi'}) }]}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.guishudishi' })} isRequire={true} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'logistics.qingxuanzeguishudishi' }) }]}
>
<CitySelect
selectData={selectCityData}
......@@ -423,8 +456,8 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
<Form.Item
labelAlign="left"
name="logo"
label={<RequireItem label={intl.formatMessage({id: 'logistics.gongsiLOGO'})} isRequire={true} />}
rules={[{ required: true, message: intl.formatMessage({id: 'logistics.qingshangchuangongsiLOGO'}) }]}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.gongsiLOGO' })} isRequire={true} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'logistics.qingshangchuangongsiLOGO' }) }]}
>
<UploadImage
imgUrl={logo}
......@@ -441,15 +474,15 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
<Form.Item
labelAlign="left"
name="describe"
label={<RequireItem label={intl.formatMessage({id: 'logistics.gongsijianjie'})} isRequire={true} />}
rules={[{ required: true, message: intl.formatMessage({id: 'logistics.qingshurugongsijianjie'}) }]}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.gongsijianjie' })} isRequire={true} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'logistics.qingshurugongsijianjie' }) }]}
>
<Input.TextArea rows={5} className={styles.form_item} placeholder={intl.formatMessage({id: 'logistics.qingshurugongsijianjie'})} maxLength={200} />
<Input.TextArea rows={5} className={styles.form_item} placeholder={intl.formatMessage({ id: 'logistics.qingshurugongsijianjie' })} maxLength={200} />
</Form.Item>
<Form.Item
labelAlign="left"
name="companyPics"
label={<RequireItem label={intl.formatMessage({id: 'logistics.gongsizhaopian'})} />}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.gongsizhaopian' })} />}
>
<div className={styles.form_item_wrap}>
......@@ -475,7 +508,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
<Form.Item
labelAlign="left"
name="honorPics"
label={<RequireItem label={intl.formatMessage({id: 'logistics.zizhirongyu'})} brief={<Tooltip placement="top" title={intl.formatMessage({id: 'logistics.rushangbiaozhucezhengshu'})}><QuestionCircleOutlined /></Tooltip>} />}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.zizhirongyu' })} brief={<Tooltip placement="top" title={intl.formatMessage({ id: 'logistics.rushangbiaozhucezhengshu' })}><QuestionCircleOutlined /></Tooltip>} />}
>
<div className={styles.form_item_wrap}>
<div className={styles.img_list}>
......@@ -500,7 +533,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
<Form.Item
labelAlign="left"
name="albumName"
label={<RequireItem label={intl.formatMessage({id: 'logistics.xuanchuanhuace'})} />}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.xuanchuanhuace' })} />}
className={styles.revise_style}
>
<div className={styles.upload_data}>
......@@ -530,15 +563,15 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
beforeUpload={beforeDocUpload}
onChange={handleChange}
>
<Button loading={fileLoading} icon={<UploadOutlined />}>{intl.formatMessage({id: 'logistics.shangchuanwenjian'})}</Button>
<div style={{ marginTop: '8px' }}>{intl.formatMessage({id: 'logistics.yicishangchuanyigewenjian'})}</div>
<Button loading={fileLoading} icon={<UploadOutlined />}>{intl.formatMessage({ id: 'logistics.shangchuanwenjian' })}</Button>
<div style={{ marginTop: '8px' }}>{intl.formatMessage({ id: 'logistics.yicishangchuanyigewenjian' })}</div>
</Upload>
)}
</Form.Item>
<Form.Item
labelAlign="left"
name="shopId"
label={<RequireItem label={intl.formatMessage({id: 'logistics.menhulianjie'})} />}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.menhulianjie' })} />}
>
<Select allowClear value={shopId} className={styles.form_item} onChange={handleMallSelectChange}>
{
......@@ -549,44 +582,44 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
</Select>
{resUrl && (
<div className={styles.shop_url}>
<span>{intl.formatMessage({id: 'logistics.dangqian'})}{door}{intl.formatMessage({id: 'logistics.lianjie'})}:</span>
<span>{intl.formatMessage({ id: 'logistics.dangqian' })}{door}{intl.formatMessage({ id: 'logistics.lianjie' })}:</span>
<label>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
)}
</Form.Item>
</TabPane>
<TabPane tab='SEO' key='2' forceRender>
<TabPane tab={<TabFormErrors dot={badge[1]}>SEO</TabFormErrors>} key='2' forceRender>
<Form.Item
labelAlign="left"
name="title"
rules={[{ required: true, message: intl.formatMessage({id: 'logistics.qingshurubiaoti'}) }]}
label={<RequireItem label={intl.formatMessage({id: 'logistics.biaoti'})} isRequire={true} brief={<Tooltip placement="top" title={intl.formatMessage({id: 'logistics.yongyuxianshizaiyemiantitle'})}><QuestionCircleOutlined /></Tooltip>} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'logistics.qingshurubiaoti' }) }]}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.biaoti' })} isRequire={true} brief={<Tooltip placement="top" title={intl.formatMessage({ id: 'logistics.yongyuxianshizaiyemiantitle' })}><QuestionCircleOutlined /></Tooltip>} />}
>
<Input placeholder={intl.formatMessage({id: 'logistics.zuichang100gezifu50ge'})} maxLength={100} className={styles.form_item} />
<Input placeholder={intl.formatMessage({ id: 'logistics.zuichang100gezifu50ge' })} maxLength={100} className={styles.form_item} />
</Form.Item>
<Form.Item
labelAlign="left"
name="description"
rules={[{ required: true, message: intl.formatMessage({id: 'logistics.qingshurumiaoshu'}) }]}
label={<RequireItem label={intl.formatMessage({id: 'logistics.miaoshu'})} isRequire={true} brief={<Tooltip placement="top" title={intl.formatMessage({id: 'logistics.yongyuxianshizaiyemiantitle'})}><QuestionCircleOutlined /></Tooltip>} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'logistics.qingshurumiaoshu' }) }]}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.miaoshu' })} isRequire={true} brief={<Tooltip placement="top" title={intl.formatMessage({ id: 'logistics.yongyuxianshizaiyemiantitle' })}><QuestionCircleOutlined /></Tooltip>} />}
>
<Input.TextArea rows={5} className={styles.form_item} placeholder={intl.formatMessage({id: 'logistics.zuichang200gezifu100ge'})} maxLength={200} />
<Input.TextArea rows={5} className={styles.form_item} placeholder={intl.formatMessage({ id: 'logistics.zuichang200gezifu100ge' })} maxLength={200} />
</Form.Item>
<Form.Item
labelAlign="left"
name="keywords"
rules={[{ required: true, message: intl.formatMessage({id: 'logistics.qingshuruguanjianzi'}) }]}
label={<RequireItem label={intl.formatMessage({id: 'logistics.guanjianzi'})} isRequire={true} brief={<Tooltip placement="top" title={intl.formatMessage({id: 'logistics.yongyuxianshizaiyemiantitle'})}><QuestionCircleOutlined /></Tooltip>} />}
rules={[{ required: true, message: intl.formatMessage({ id: 'logistics.qingshuruguanjianzi' }) }]}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.guanjianzi' })} isRequire={true} brief={<Tooltip placement="top" title={intl.formatMessage({ id: 'logistics.yongyuxianshizaiyemiantitle' })}><QuestionCircleOutlined /></Tooltip>} />}
>
<Input.TextArea rows={5} className={styles.form_item} placeholder={intl.formatMessage({id: 'logistics.zuichang200gezifu100ge'})} maxLength={200} />
<Input.TextArea rows={5} className={styles.form_item} placeholder={intl.formatMessage({ id: 'logistics.zuichang200gezifu100ge' })} maxLength={200} />
</Form.Item>
</TabPane>
<TabPane tab={intl.formatMessage({id: 'logistics.shouyelunbotu'})} key='3' forceRender>
<TabPane tab={intl.formatMessage({ id: 'logistics.shouyelunbotu' })} key='3' forceRender>
<Form.Item
labelAlign="left"
name="slideshowBOList"
label={<RequireItem label={intl.formatMessage({id: 'logistics.shouyelunbotu'})}/>}
label={<RequireItem label={intl.formatMessage({ id: 'logistics.shouyelunbotu' })} />}
>
<div>
<div className={styles.form_item_wrap}>
......@@ -598,8 +631,8 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
<img className={styles.upload_img} src={item.imgPath} />
</div>
<div className={styles.jump_link}>
<Typography.Text type='secondary'>{intl.formatMessage({id: 'logistics.tiaozhuanlianjie'})}</Typography.Text>
<Input addonBefore={<Typography.Text type='secondary'>http://</Typography.Text>} onChange={(value) => handleInputIndexPicsItem(value, index)} value={item.link} placeholder={intl.formatMessage({id: 'logistics.lunbotutiaozhuanlianjie'})} />
<Typography.Text type='secondary'>{intl.formatMessage({ id: 'logistics.tiaozhuanlianjie' })}</Typography.Text>
<Input addonBefore={<Typography.Text type='secondary'>http://</Typography.Text>} onChange={(value) => handleInputIndexPicsItem(value, index)} value={item.link} placeholder={intl.formatMessage({ id: 'logistics.lunbotutiaozhuanlianjie' })} />
</div>
</div>
))
......
......@@ -27,7 +27,7 @@ const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = (props: any) => {
const count = (num: any, price: any) => {
let money: any = null;
money = (Number(price) * 1) * Number(num);
return Number(money).toFixed(2);
return Number(money).toFixed(2)
}
const handleChange = (id, e) => {
const { value } = e.target
......@@ -37,6 +37,7 @@ const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = (props: any) => {
v.money = count(v.purchaseCount, value);
}
})
console.log(dataSource)
setDataSource([...dataSource]);
}
......@@ -104,7 +105,8 @@ const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = (props: any) => {
{
title: intl.formatMessage({id: 'dealAbility.jine'}),
key: "money",
dataIndex: "money"
dataIndex: "money",
render: (text: any) => <>{text}</>
},
{
title: intl.formatMessage({ id: 'dealAbility.caozuo' }),
......@@ -221,6 +223,8 @@ const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = (props: any) => {
})
}, [commoditySkuId])
console.log(dataSource)
return (
<Card
id="productQuoteLayout"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment