♻️ refactor: 重构京东E卡

This commit is contained in:
wangsongsole 2024-02-19 17:07:16 +08:00
parent c4d585e765
commit 8fb9a7213d
1 changed files with 12 additions and 39 deletions

View File

@ -88,9 +88,7 @@ const UseProductPop = forwardRef((props, ref) => {
account_type: "", account_type: "",
map_product_name: "", map_product_name: "",
end_time: "", end_time: "",
card_show: 2, card_show: 2
messageVerify: 2,
channelVerIfy: undefined
}) })
useEffect(() => { useEffect(() => {
@ -139,9 +137,11 @@ const UseProductPop = forwardRef((props, ref) => {
setState({ loading: true }) setState({ loading: true })
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (directResellerId) { if (directResellerId) {
/* 京东E卡 */
const isECard = model.product_type === 3
let param = { let param = {
reseller_id: directResellerId, reseller_id: directResellerId,
type: model.product_type type: isECard ? 1 : model.product_type
} }
getProductInfoSelect(param).then((res) => { getProductInfoSelect(param).then((res) => {
handelResponse( handelResponse(
@ -177,8 +177,6 @@ const UseProductPop = forwardRef((props, ref) => {
if (productData) { if (productData) {
setModel({ setModel({
goods_id: productData.goods_id, goods_id: productData.goods_id,
messageVerify: productData.messageVerify,
channelVerIfy: productData.channelVerIfy,
cost_price: productData.cost_price, cost_price: productData.cost_price,
weight: String(productData.weight), weight: String(productData.weight),
quantity: productData.quantity, quantity: productData.quantity,
@ -188,7 +186,7 @@ const UseProductPop = forwardRef((props, ref) => {
product_id: productData.product_id, product_id: productData.product_id,
account_type: productData.account_type, account_type: productData.account_type,
map_product_name: productData.map_product_name, map_product_name: productData.map_product_name,
product_type: model.product_type, product_type: productData.isECard ? 1 : model.product_type,
card_show: Number(productData.card_show), card_show: Number(productData.card_show),
code_batch_id: productData.code_batch_id, code_batch_id: productData.code_batch_id,
end_time: productData.end_time, end_time: productData.end_time,
@ -245,9 +243,7 @@ const UseProductPop = forwardRef((props, ref) => {
account_type: "", account_type: "",
map_product_name: "", map_product_name: "",
end_time: "", end_time: "",
card_show: 2, card_show: 2
messageVerify: 2,
channelVerIfy: undefined
}) })
setTimeout(() => { setTimeout(() => {
setState({ isUpdatePic: !state.isUpdatePic }) setState({ isUpdatePic: !state.isUpdatePic })
@ -255,9 +251,12 @@ const UseProductPop = forwardRef((props, ref) => {
} }
// //
const getFormModel = () => { const getFormModel = () => {
/* 京东E卡 */
const isECard = model.product_type === 3
return { return {
product_id: model.product_id, product_id: model.product_id,
product_type: model.product_type, product_type: isECard ? 1 : model.product_type,
isECard,
product_name: model.product_name, product_name: model.product_name,
contract_price: model.contract_price, contract_price: model.contract_price,
cost_price: model.cost_price, cost_price: model.cost_price,
@ -271,9 +270,7 @@ const UseProductPop = forwardRef((props, ref) => {
map_product_name: model.product_name, map_product_name: model.product_name,
goods_id: model.goods_id, goods_id: model.goods_id,
end_time: model.end_time, end_time: model.end_time,
card_show: model.card_show, card_show: model.card_show
messageVerify: model.messageVerify,
channelVerIfy: model.channelVerIfy
} }
} }
@ -514,18 +511,7 @@ const UseProductPop = forwardRef((props, ref) => {
> >
<RadioButton value={1}>直充</RadioButton> <RadioButton value={1}>直充</RadioButton>
<RadioButton value={2}>卡密</RadioButton> <RadioButton value={2}>卡密</RadioButton>
</RadioGroup> <RadioButton value={3}>京东E卡</RadioButton>
</FormItem>
<FormItem labelname="是否短信验证" prop="product_id" id="product">
<RadioGroup
onChange={(e) => {
setModel({ messageVerify: e.target.value })
}}
value={model.messageVerify}
disabled={!!model.code_batch_id}
>
<RadioButton value={1}></RadioButton>
<RadioButton value={2}></RadioButton>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
{model.product_type === 2 ? ( {model.product_type === 2 ? (
@ -556,19 +542,6 @@ const UseProductPop = forwardRef((props, ref) => {
}} }}
/> />
</FormItem> </FormItem>
<FormItem labelname="验证渠道" prop="product_id" id="product">
<Select
clearable
width={520}
options={state.productOption}
placeholder="请选择渠道"
value={model.channelVerIfy}
disabled={!!model.code_batch_id}
onChange={(e) => {
setModel({ channelVerIfy: e })
}}
/>
</FormItem>
{model.product_type === 2 ? ( {model.product_type === 2 ? (
<FormItem id="end_time" labelname="卡密有效期至" prop="end_time"> <FormItem id="end_time" labelname="卡密有效期至" prop="end_time">
<DatePicker <DatePicker