feat: 完成营销系统包码结算

This commit is contained in:
zhangds 2024-02-20 18:14:15 +08:00
parent e2baf44891
commit 60383b44ac
3 changed files with 81 additions and 3 deletions

View File

@ -64,7 +64,9 @@ export default class add extends React.Component {
whiteStyle: false, whiteStyle: false,
btn_loading: false, btn_loading: false,
direct_reseller_id: 0, direct_reseller_id: 0,
keyType: 1 // 1兑换码 2优惠券 keyType: 1, // 1兑换码 2优惠券
isSettlement: 2,
settlementData: null
} }
} }
@ -88,6 +90,18 @@ export default class add extends React.Component {
} }
componentDidMount(e) { componentDidMount(e) {
// 是否是包码
let bm_obj_str = sessionStorage.getItem("bm_obj")
if (bm_obj_str) {
let bm_obj = JSON.parse(bm_obj_str)
if (bm_obj.settlement_type > 0) {
this.setState({
isSettlement: 1,
settlementData: { key: bm_obj.settlement_type, text: bm_obj.settlement_type_text }
})
}
}
let plan_status = sessionStorage.getItem("plan_status") let plan_status = sessionStorage.getItem("plan_status")
if (plan_status == 3 || plan_status == 4 || plan_status == 5 || plan_status == 2) { if (plan_status == 3 || plan_status == 4 || plan_status == 5 || plan_status == 2) {
this.setState({ disabled: true }) this.setState({ disabled: true })
@ -113,7 +127,6 @@ export default class add extends React.Component {
if (req.info) { if (req.info) {
sessionStorage.setItem("step1", JSON.stringify(req.info)) sessionStorage.setItem("step1", JSON.stringify(req.info))
this.refs.step1.edit(req.info) this.refs.step1.edit(req.info)
return
} }
if (req.keys.length > 0 && this.state.disabled == false) { if (req.keys.length > 0 && this.state.disabled == false) {
this.setState({ curstep: 2 }) this.setState({ curstep: 2 })
@ -217,6 +230,19 @@ export default class add extends React.Component {
return req.keys return req.keys
} }
// 设置 是否是包码
setTlementType = (type) => {
this.setState({ isSettlement: type })
this.setState({ keys: ["step2-0"] })
this.refs["step2-0"].clearTableData()
}
// 设置 包码数据
setTlementData = (data) => {
this.setState({ settlementData: data })
this.setState({ keys: ["step2-0"] })
this.refs["step2-0"].clearTableData()
}
async onNextStep() { async onNextStep() {
if (this.state.curstep >= 1) { if (this.state.curstep >= 1) {
if (await this.refs.step1.submit()) { if (await this.refs.step1.submit()) {
@ -593,6 +619,8 @@ export default class add extends React.Component {
data={this.state.step1_data} data={this.state.step1_data}
disabled={this.state.disabled} disabled={this.state.disabled}
onGetDirectResellerId={(data) => this.getDirectResellerId(data)} onGetDirectResellerId={(data) => this.getDirectResellerId(data)}
setTlementType={(e) => this.setTlementType(e)}
setTlementData={(e) => this.setTlementData(e)}
/> />
</Card> </Card>
</div> </div>
@ -643,6 +671,8 @@ export default class add extends React.Component {
data={item} data={item}
direct_reseller_id={this.state.direct_reseller_id} direct_reseller_id={this.state.direct_reseller_id}
disabled={this.state.disabled} disabled={this.state.disabled}
isSettlement={this.state.isSettlement}
settlementData={this.state.settlementData}
/> />
</Card> </Card>
) : null ) : null

View File

@ -56,7 +56,9 @@ export default class add extends React.Component {
step2_data: null, step2_data: null,
step3_data: null, step3_data: null,
disabled: false, disabled: false,
keyType: 1 keyType: 1,
isSettlement: 2,
settlementData: null
} }
} }
@ -79,6 +81,18 @@ export default class add extends React.Component {
}) })
} }
componentDidMount(e) { componentDidMount(e) {
// 是否是包码
let bm_obj_str = sessionStorage.getItem("bm_obj")
if (bm_obj_str) {
let bm_obj = JSON.parse(bm_obj_str)
if (bm_obj.settlement_type > 0) {
this.setState({
isSettlement: 1,
settlementData: { key: bm_obj.settlement_type, text: bm_obj.settlement_type_text }
})
}
}
sessionStorage.setItem("plan_id", "") sessionStorage.setItem("plan_id", "")
let plan_id_copy = sessionStorage.getItem("plan_id_copy") let plan_id_copy = sessionStorage.getItem("plan_id_copy")
this.setState({ plan_id_detail: plan_id_copy }) this.setState({ plan_id_detail: plan_id_copy })
@ -181,6 +195,19 @@ export default class add extends React.Component {
this.setState({ paytype: e.target.value }) this.setState({ paytype: e.target.value })
} }
// 设置 是否是包码
setTlementType = (type) => {
this.setState({ isSettlement: type })
this.setState({ keys: ["step2-0"] })
this.refs["step2-0"].clearTableData()
}
// 设置 包码数据
setTlementData = (data) => {
this.setState({ settlementData: data })
this.setState({ keys: ["step2-0"] })
this.refs["step2-0"].clearTableData()
}
async onNextStep() { async onNextStep() {
if (this.state.curstep >= 1) { if (this.state.curstep >= 1) {
if ((await this.refs.step1.submit()) == true) { if ((await this.refs.step1.submit()) == true) {
@ -404,6 +431,8 @@ export default class add extends React.Component {
ref="step1" ref="step1"
data={this.state.step1_data} data={this.state.step1_data}
onGetDirectResellerId={(data) => this.getDirectResellerId(data)} onGetDirectResellerId={(data) => this.getDirectResellerId(data)}
setTlementType={(e) => this.setTlementType(e)}
setTlementData={(e) => this.setTlementData(e)}
/> />
</Card> </Card>
</div> </div>
@ -453,6 +482,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

@ -673,6 +673,23 @@ export default class acclist extends React.Component {
code_batch: data.code_batch, code_batch: data.code_batch,
draw_title: data.draw_title draw_title: data.draw_title
} }
// 是否是包码
let bm_obj_str = sessionStorage.getItem("bm_obj")
if (bm_obj_str) {
let bm_obj = JSON.parse(bm_obj_str)
if (bm_obj.settlement_type > 0) {
this.setState({
isSettlement: 1
})
model.settlement_type = { key: bm_obj.settlement_type, text: bm_obj.settlement_type_text }
} else {
this.setState({
isSettlement: 2
})
}
}
if (model.style == 6) { if (model.style == 6) {
sessionStorage.setItem("white", 1) sessionStorage.setItem("white", 1)
this.setState({ white_visible: true }) this.setState({ white_visible: true })