feat: 增加包码结算

This commit is contained in:
zhangds 2024-02-19 13:57:37 +08:00
parent 42aa0f6af3
commit dfe9d59a41
3 changed files with 112 additions and 7 deletions

View File

@ -45,7 +45,9 @@ export default class add extends React.Component {
whiteStyle: false, whiteStyle: false,
keyStyle: 1, keyStyle: 1,
direct_reseller_id: 0, direct_reseller_id: 0,
keyType: 1 keyType: 1,
isSettlement: 2,
settlementData: null
} }
} }
@ -100,6 +102,16 @@ export default class add extends React.Component {
onPayTypeChange(e) { onPayTypeChange(e) {
this.setState({ paytype: e.target.value }) this.setState({ paytype: e.target.value })
} }
// 设置 是否是包码
setTlementType = (type) => {
console.log("type =>", type)
this.setState({ isSettlement: type })
}
// 设置 包码数据
setTlementData = (data) => {
console.log("data =>", data)
this.setState({ settlementData: data })
}
async onNextStep() { async onNextStep() {
if (this.state.curstep >= 1) { if (this.state.curstep >= 1) {
@ -109,7 +121,6 @@ export default class add extends React.Component {
return return
} }
} }
if (this.state.curstep >= 2) { if (this.state.curstep >= 2) {
let temp = [] let temp = []
for (let i = 0; i < this.state.keys.length; i++) { for (let i = 0; i < this.state.keys.length; i++) {
@ -333,6 +344,8 @@ export default class add extends React.Component {
<Card style={{ width: "100%" }} title={this.state.step1_pagetitle}> <Card style={{ width: "100%" }} title={this.state.step1_pagetitle}>
<Step1 <Step1
ref="step1" ref="step1"
setTlementType={(e) => this.setTlementType(e)}
setTlementData={(e) => this.setTlementData(e)}
onGetDirectResellerId={(data) => this.getDirectResellerId(data)} onGetDirectResellerId={(data) => this.getDirectResellerId(data)}
/> />
</Card> </Card>
@ -382,6 +395,8 @@ export default class add extends React.Component {
direct_reseller_id={this.state.direct_reseller_id} direct_reseller_id={this.state.direct_reseller_id}
name={index} name={index}
whiteStyle={this.state.whiteStyle} whiteStyle={this.state.whiteStyle}
isSettlement={this.state.isSettlement}
settlementData={this.state.settlementData}
/> />
</Card> </Card>
) : null ) : null

View File

@ -87,7 +87,6 @@ export default class accList extends React.Component {
let obj = {} let obj = {}
obj.key = o.settlement_type obj.key = o.settlement_type
obj.text = o.settlement_text obj.text = o.settlement_text
obj.direct_reseller_id = o.direct_reseller_id
return obj return obj
}) })
this.setState({ settlementOptions: arr }) this.setState({ settlementOptions: arr })
@ -226,6 +225,18 @@ export default class accList extends React.Component {
} }
return disabled return disabled
} }
// 包码结算-返回是否是包码结算和包码结算方式
getSettlementData = () => {
let s = this.state.isSettlement
if (s === 1) {
let s_type = this.state.model.settlement_type
return s_type
} else {
return 2
}
}
render() { render() {
//校验规则 //校验规则
const rules = { const rules = {
@ -288,6 +299,7 @@ export default class accList extends React.Component {
<RadioGroup <RadioGroup
disabled={this.props.disabled} disabled={this.props.disabled}
onChange={(e) => { onChange={(e) => {
this.props.setTlementType(e.target.value)
this.setState({ isSettlement: e.target.value }) this.setState({ isSettlement: e.target.value })
}} }}
value={this.state.isSettlement} value={this.state.isSettlement}
@ -308,6 +320,7 @@ export default class accList extends React.Component {
let model = this.state.model let model = this.state.model
model.settlement_type = e model.settlement_type = e
this.setState({ model }) this.setState({ model })
this.props.setTlementData(e)
}} }}
/> />
</FormItem> </FormItem>

View File

@ -72,7 +72,9 @@ export default class acclist extends React.Component {
merge_stock: 1, merge_stock: 1,
code_batch: "", code_batch: "",
draw_title: "", draw_title: "",
batch_name: "" batch_name: "",
key_official_price: "",
key_cost_price: ""
}, },
drawerVisible: false, drawerVisible: false,
drawerVisible2: false, drawerVisible2: false,
@ -1012,7 +1014,23 @@ export default class acclist extends React.Component {
//校验规则 //校验规则
const rules = { const rules = {
bind_object: [{ type: "required", message: "请选择绑定类型" }], bind_object: [{ type: "required", message: "请选择绑定类型" }],
batch_name: [{ type: "required", message: "请输入key批次名称" }] batch_name: [{ type: "required", message: "请输入key批次名称" }],
key_official_price: [
{ type: "required", message: "请输入官方价" },
{
type: "regExp",
message: "最多保留4位小数",
reg: "^[0-9]+(.[0-9]{1,4})?$"
}
],
key_cost_price: [
{ type: "required", message: "请输入成本价" },
{
type: "regExp",
message: "最多保留4位小数",
reg: "^[0-9]+(.[0-9]{1,4})?$"
}
]
} }
// 优惠券范围 // 优惠券范围
@ -1038,18 +1056,77 @@ export default class acclist extends React.Component {
<RadioButton value={1} disabled={this.props.name > 0 && this.state.model.style == 6}> <RadioButton value={1} disabled={this.props.name > 0 && this.state.model.style == 6}>
串码 串码
</RadioButton> </RadioButton>
<RadioButton value={2} disabled={this.props.name > 0 && this.state.model.style == 6}>
<RadioButton
value={2}
disabled={
(this.props.name > 0 && this.state.model.style == 6) ||
(this.props.isSettlement === 1 && this.props.settlementData.key === 2)
}
>
链接 链接
</RadioButton> </RadioButton>
<RadioButton value={4} disabled={this.props.name > 0 && this.state.model.style == 6}>
<RadioButton
value={4}
disabled={
(this.props.name > 0 && this.state.model.style == 6) ||
(this.props.isSettlement === 1 && this.props.settlementData.key === 2)
}
>
二维码 二维码
</RadioButton> </RadioButton>
<RadioButton value={6} disabled={this.props.name > 0 && this.state.model.style != 6}> <RadioButton value={6} disabled={this.props.name > 0 && this.state.model.style != 6}>
白名单 白名单
</RadioButton> </RadioButton>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem labelname="成本价" prop="key_cost_price" id="key_cost_price">
<Ipt
onChange={(e) => {
let model2 = this.state.model
model2.key_cost_price = e
this.setState({ model: model2 })
}}
onClearItem={(e) => {
let model2 = this.state.model
model2.key_cost_price = ""
this.setState({ model: model2 })
}}
value={this.state.model.key_cost_price}
placeholder={"请输入"}
labelWidth={"0px"}
maxLength={12}
height={"36px"}
width={"520px"}
alignment={"left"}
/>
</FormItem>
<FormItem labelname="官方价" prop="key_official_price" id="key_official_price">
<Ipt
onChange={(e) => {
let model2 = this.state.model
model2.key_official_price = e
this.setState({ model: model2 })
}}
onClearItem={(e) => {
let model2 = this.state.model
model2.key_official_price = ""
this.setState({ model: model2 })
}}
value={this.state.model.key_official_price}
placeholder={"请输入"}
labelWidth={"0px"}
maxLength={12}
height={"36px"}
width={"520px"}
alignment={"left"}
/>
</FormItem>
{this.state.isload ? ( {this.state.isload ? (
<FormItem labelname="key批次名称" prop="batch_name" id="batch_name"> <FormItem labelname="key批次名称" prop="batch_name" id="batch_name">
<Ipt <Ipt