feat: 增加key批次包码

This commit is contained in:
zhangds 2024-02-20 15:51:22 +08:00
parent 6e6c55e6a8
commit 74bda83b3d
3 changed files with 95 additions and 7 deletions

View File

@ -578,6 +578,9 @@ const UseExchangeAddEdit = forwardRef((props, ref) => {
return ( return (
<div className="draw"> <div className="draw">
<Card style={{ width: "95%", margin: "10px auto" }} title={"基本信息"}> <Card style={{ width: "95%", margin: "10px auto" }} title={"基本信息"}>
{/* <p>
2222{props.isSettlement} {JSON.stringify(props.settlementData)}
</p> */}
<div className="addcode"> <div className="addcode">
<Form model={codeInfo} rules={codeInfoRules} ref={codeInfoEl} className="addform"> <Form model={codeInfo} rules={codeInfoRules} ref={codeInfoEl} className="addform">
<FormItem labelname="兑换码名称" prop="code_name" id="code_name"> <FormItem labelname="兑换码名称" prop="code_name" id="code_name">

View File

@ -216,7 +216,10 @@ const UseKeyAddEdit = () => {
copyKeyCodeId: "", copyKeyCodeId: "",
reseller_id: "", reseller_id: "",
white_visible: false, white_visible: false,
keyCodeId: "" keyCodeId: "",
settlement_type: 0,
isSettlement: 0,
settlementData: null
}) })
const keyFormEl = useRef(null) const keyFormEl = useRef(null)
const bindObjEl = useRef(null) const bindObjEl = useRef(null)
@ -232,7 +235,9 @@ const UseKeyAddEdit = () => {
stock: "", stock: "",
merge_stock: 1, merge_stock: 1,
mobile_excel: "", mobile_excel: "",
mobile_repeat: [] mobile_repeat: [],
key_official_price: "",
key_cost_price: ""
}) })
//#endRegion data ***************************/ //#endRegion data ***************************/
@ -260,6 +265,17 @@ const UseKeyAddEdit = () => {
} }
const init = () => { const init = () => {
/**包码TODO: 包码结算方式 0不是*/
let plan_list_settlement_type = sessionStorage.getItem("plan_list_settlement_type")
if (plan_list_settlement_type) {
let settlement_type = Number(plan_list_settlement_type)
setState({
isSettlement: settlement_type > 0 ? 1 : 0,
settlementData: settlement_type > 0 ? { key: settlement_type } : null,
settlement_type
})
}
/* TODO: KeyPcType UseKeyAddEdit 1编辑 2复制 3新增 */ /* TODO: KeyPcType UseKeyAddEdit 1编辑 2复制 3新增 */
let planItem = sessionStorage.getItem("plan_item") let planItem = sessionStorage.getItem("plan_item")
@ -432,7 +448,9 @@ const UseKeyAddEdit = () => {
stock: data.stock, stock: data.stock,
merge_stock: data.merge_stock, merge_stock: data.merge_stock,
mobile_excel: data.mobile_excel, mobile_excel: data.mobile_excel,
mobile_repeat: data.mobile_repeat mobile_repeat: data.mobile_repeat,
key_official_price: data.key_official_price,
key_cost_price: data.key_cost_price
}) })
let newData = [] let newData = []
@ -621,6 +639,12 @@ const UseKeyAddEdit = () => {
let validator = addEditExchangeEl.current.submit() let validator = addEditExchangeEl.current.submit()
if (validator) { if (validator) {
let param = addEditExchangeEl.current.getModel() let param = addEditExchangeEl.current.getModel()
if (state.isSettlement === 1 && param.product.legal.length > 1) {
Notify.error("包码只能创建一个商品")
return
}
let tempData = state.distdata let tempData = state.distdata
// //
if (state.rowIndex > -1) { if (state.rowIndex > -1) {
@ -807,9 +831,11 @@ const UseKeyAddEdit = () => {
receive_email: state.reseller.contact_email[0], receive_email: state.reseller.contact_email[0],
payment_direction: state.payment_direction[state.payType - 1] payment_direction: state.payment_direction[state.payType - 1]
} }
// // keyType 1 2
if (state.keyType === 1) { if (state.keyType === 1) {
create_param.code_batch = data create_param.code_batch = data
create_param.key_official_price = model.key_official_price
create_param.key_cost_price = model.key_cost_price
} else { } else {
create_param.coupon = data create_param.coupon = data
} }
@ -837,7 +863,7 @@ const UseKeyAddEdit = () => {
receive_email: state.reseller.contact_email[0], receive_email: state.reseller.contact_email[0],
payment_direction: state.payment_direction[state.payType - 1] payment_direction: state.payment_direction[state.payType - 1]
} }
// // keyType 1 2
if (state.keyType === 1) { if (state.keyType === 1) {
edit_param.code_batch = data edit_param.code_batch = data
} else { } else {
@ -975,10 +1001,10 @@ const UseKeyAddEdit = () => {
<RadioButton value={1} disabled={model.style == 6}> <RadioButton value={1} disabled={model.style == 6}>
串码 串码
</RadioButton> </RadioButton>
<RadioButton value={2} disabled={model.style == 6}> <RadioButton value={2} disabled={model.style == 6 || state.settlement_type === 2}>
链接 链接
</RadioButton> </RadioButton>
<RadioButton value={4} disabled={model.style == 6}> <RadioButton value={4} disabled={model.style == 6 || state.settlement_type === 2}>
二维码 二维码
</RadioButton> </RadioButton>
<RadioButton value={6} disabled={model.style != 6}> <RadioButton value={6} disabled={model.style != 6}>
@ -987,6 +1013,56 @@ const UseKeyAddEdit = () => {
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
{state.isSettlement === 1 ? (
<FormItem labelname="成本价" prop="key_cost_price" id="key_cost_price">
<Ipt
onChange={(e) => {
setModel({
key_cost_price: e
})
}}
onClearItem={(e) => {
setModel({
key_cost_price: ""
})
}}
value={model.key_cost_price}
placeholder={"请输入"}
labelWidth={"0px"}
maxLength={12}
height={"36px"}
disabled={state.KeyPcType === "1"}
width={"520px"}
alignment={"left"}
/>
</FormItem>
) : null}
{state.isSettlement === 1 ? (
<FormItem labelname="官方价" prop="key_official_price" id="key_official_price">
<Ipt
onChange={(e) => {
setModel({
key_official_price: e
})
}}
onClearItem={(e) => {
setModel({
key_official_price: ""
})
}}
value={model.key_official_price}
placeholder={"请输入"}
labelWidth={"0px"}
disabled={state.KeyPcType === "1"}
maxLength={12}
height={"36px"}
width={"520px"}
alignment={"left"}
/>
</FormItem>
) : null}
{state.KeyPcType === "1" ? null : ( {state.KeyPcType === "1" ? null : (
<FormItem labelname="key数量" prop="quantity" id="quantity"> <FormItem labelname="key数量" prop="quantity" id="quantity">
<div className="key_number"> <div className="key_number">
@ -1068,6 +1144,12 @@ const UseKeyAddEdit = () => {
{state.keyType === 1 ? ( {state.keyType === 1 ? (
<Button <Button
onClick={(e) => { onClick={(e) => {
if (state.settlement_type > 0) {
if (state.distdata.length >= 1) {
Notify.error(`只能创建一个兑换码`)
return
}
}
planAddExchangeCoupon(0) planAddExchangeCoupon(0)
}} }}
> >
@ -1196,6 +1278,8 @@ const UseKeyAddEdit = () => {
direct_reseller_id={state.direct_reseller_id} direct_reseller_id={state.direct_reseller_id}
editData={state.rowExChangeData} editData={state.rowExChangeData}
ref={addEditExchangeEl} ref={addEditExchangeEl}
isSettlement={state.isSettlement}
settlementData={state.settlementData}
></UseExchangeAddEdit> ></UseExchangeAddEdit>
) : ( ) : (
<UseCouponAddEdit <UseCouponAddEdit

View File

@ -470,6 +470,7 @@ export default class acclist extends React.Component {
sessionStorage.setItem("linkshowname", "营销计划管理") sessionStorage.setItem("linkshowname", "营销计划管理")
sessionStorage.setItem("key_plan_id", row.id) sessionStorage.setItem("key_plan_id", row.id)
sessionStorage.setItem("key_plan_status", row.status) sessionStorage.setItem("key_plan_status", row.status)
sessionStorage.setItem("plan_list_settlement_type", row.settlement_type)
// sessionStorage.setItem( // sessionStorage.setItem(
// "datetime", // "datetime",
// JSON.stringify([row.begin_time, row.end_time]) // JSON.stringify([row.begin_time, row.end_time])