fix: 修复组合商品为立减金,禁用

This commit is contained in:
zhangds 2024-03-06 21:12:54 +08:00
parent 02c54c9812
commit 89f2d1742d
2 changed files with 34 additions and 21 deletions

View File

@ -237,8 +237,10 @@ const UseKeyAddEdit = () => {
white_visible: false, white_visible: false,
keyCodeId: "", keyCodeId: "",
settlement_type: 0, settlement_type: 0,
isSettlement: Number(sessionStorage.getItem("plan_list_settlement_type")), isSettlement: sessionStorage.getItem("isSettlement") ? 1 : 2,
settlementData: null settlementData: sessionStorage.getItem("plan_list_settlement")
? JSON.parse(sessionStorage.getItem("plan_list_settlement"))
: null
}) })
const keyFormEl = useRef(null) const keyFormEl = useRef(null)
const bindObjEl = useRef(null) const bindObjEl = useRef(null)
@ -322,19 +324,15 @@ const UseKeyAddEdit = () => {
} }
/**包码TODO: 包码结算方式 0不是*/ /**包码TODO: 包码结算方式 0不是*/
let plan_list_settlement_type = sessionStorage.getItem("plan_list_settlement_type") // let plan_list_settlement_type = sessionStorage.getItem("plan_list_settlement_type")
if (plan_list_settlement_type) { // if (plan_list_settlement_type) {
let settlement_type = Number(plan_list_settlement_type) // let settlement_type = Number(plan_list_settlement_type)
setState({ // setState({
// isSettlement: settlement_type > 0 ? 1 : 0, // // isSettlement: settlement_type > 0 ? 1 : 0,
settlementData: settlement_type > 0 ? { key: settlement_type } : null, // settlementData: settlement_type > 0 ? { key: settlement_type } : null,
settlement_type // settlement_type
}) // })
// }
// setTimeout(() => {
// keyFormEl.current.validator()
// }, 300)
}
} }
//#endRegion init ***************************/ //#endRegion init ***************************/
@ -685,7 +683,7 @@ 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 && state.exchangeType !== 2) { if (state.isSettlement === 1 && state.exchangeType !== 2) {
// //
let all_arr = [...param.product.legal, ...param.product.reduce, ...param.product.cash] let all_arr = [...param.product.legal, ...param.product.reduce, ...param.product.cash]
if (all_arr.length > 1 && !sessionStorage.getItem("has_combining")) { if (all_arr.length > 1 && !sessionStorage.getItem("has_combining")) {
@ -1094,7 +1092,7 @@ const UseKeyAddEdit = () => {
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
{state.isSettlement >= 1 ? ( {state.isSettlement === 1 ? (
<FormItem labelname="成本价" prop="key_cost_price" id="key_cost_price"> <FormItem labelname="成本价" prop="key_cost_price" id="key_cost_price">
<Ipt <Ipt
onChange={(e) => { onChange={(e) => {
@ -1119,7 +1117,7 @@ const UseKeyAddEdit = () => {
</FormItem> </FormItem>
) : null} ) : null}
{state.isSettlement >= 1 ? ( {state.isSettlement === 1 ? (
<FormItem labelname="官方价" prop="key_official_price" id="key_official_price"> <FormItem labelname="官方价" prop="key_official_price" id="key_official_price">
<Ipt <Ipt
onChange={(e) => { onChange={(e) => {
@ -1239,6 +1237,11 @@ const UseKeyAddEdit = () => {
</Button> </Button>
<Pop trigger="hover" content="一次性充值多张立减金"> <Pop trigger="hover" content="一次性充值多张立减金">
<Button <Button
disabled={
state.isSettlement === 1 &&
state.settlementData &&
state.settlementData.key === 7
}
onClick={(e) => { onClick={(e) => {
if (state.settlement_type > 0) { if (state.settlement_type > 0) {
if (state.distdata.length >= 1) { if (state.distdata.length >= 1) {
@ -1282,11 +1285,13 @@ const UseKeyAddEdit = () => {
return ( return (
<Input <Input
placeholder="请输入数量" placeholder="请输入数量"
value={rowData.restrict} value={state.isSettlement === 1 ? 1 : rowData.restrict}
disabled={
rowData.disabled || rowData.recharge_type == 2 || state.isSettlement === 1
}
onChange={(e) => { onChange={(e) => {
onBindNum(e, rowData, rowIndex) onBindNum(e, rowData, rowIndex)
}} }}
disabled={rowData.disabled || rowData.recharge_type == 2}
/> />
) )
} }

View File

@ -470,7 +470,15 @@ 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)
if (row.settlement_type > 0) {
sessionStorage.setItem("isSettlement", 1)
sessionStorage.setItem("plan_list_settlement", JSON.stringify({ key: row.settlement_type }))
} else {
sessionStorage.removeItem("isSettlement")
sessionStorage.removeItem("plan_list_settlement")
}
// sessionStorage.setItem( // sessionStorage.setItem(
// "datetime", // "datetime",
// JSON.stringify([row.begin_time, row.end_time]) // JSON.stringify([row.begin_time, row.end_time])