feat: 增加组合商品 包码兼容

This commit is contained in:
zhangds 2024-03-04 18:29:30 +08:00
parent 0cc54eedff
commit e17c715a2b
3 changed files with 24 additions and 3 deletions

View File

@ -154,7 +154,7 @@ export default class acclist extends React.Component {
[4, 5, 8].includes(params.keyBatch?.status) && [4, 5, 8].includes(params.keyBatch?.status) &&
[3, 5, 4].includes(params.keyBatch.plan?.status)) [3, 5, 4].includes(params.keyBatch.plan?.status))
if (isCopy) { if (isCopy && params.keyBatch.plan.settlement_type === 0) {
element = ( element = (
<span className="grid-link" style={{}} onClick={(e) => this.addCodeFunction(1, params)}> <span className="grid-link" style={{}} onClick={(e) => this.addCodeFunction(1, params)}>
复制 复制

View File

@ -363,18 +363,21 @@ export default class acclist extends React.Component {
planAddExchangeCoupon(type) { planAddExchangeCoupon(type) {
switch (type) { switch (type) {
case 0: case 0:
sessionStorage.removeItem("has_combining")
this.setState({ draw_title: "新建兑换码", exchangeType: 1, rowExchangeData: null }) this.setState({ draw_title: "新建兑换码", exchangeType: 1, rowExchangeData: null })
setTimeout(() => { setTimeout(() => {
this.refs.addEditExchangeEl.clearExchangeForm() this.refs.addEditExchangeEl.clearExchangeForm()
}, 300) }, 300)
break break
case 1: case 1:
sessionStorage.removeItem("has_combining")
this.setState({ draw_title: "新建优惠券" }) this.setState({ draw_title: "新建优惠券" })
setTimeout(() => { setTimeout(() => {
this.refs.addEditCouponEl.clearCouponForm() this.refs.addEditCouponEl.clearCouponForm()
}, 300) }, 300)
break break
case 2: case 2:
sessionStorage.setItem("has_combining", 1)
this.setState({ draw_title: "新建组合商品", exchangeType: 2, rowExchangeData: null }) this.setState({ draw_title: "新建组合商品", exchangeType: 2, rowExchangeData: null })
setTimeout(() => { setTimeout(() => {
this.refs.addEditExchangeEl.clearExchangeForm() this.refs.addEditExchangeEl.clearExchangeForm()
@ -603,7 +606,7 @@ export default class acclist extends React.Component {
let param = this.refs.addEditExchangeEl.getModel() let param = this.refs.addEditExchangeEl.getModel()
// 第三步:包码只能选一个 // 第三步:包码只能选一个
if (this.props.isSettlement >= 1) { if (this.props.isSettlement >= 1 && !sessionStorage.getItem("has_combining")) {
// 合并数组 // 合并数组
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) { if (all_arr.length > 1) {
@ -1345,6 +1348,14 @@ export default class acclist extends React.Component {
<Pop trigger="hover" content="一次性充值多张立减金"> <Pop trigger="hover" content="一次性充值多张立减金">
<Button <Button
onClick={(e) => { onClick={(e) => {
// 第二步:如果是包码,只能创建一个
if (this.props.isSettlement === 1) {
if (this.state.distdata.length >= 1) {
Notify.error(`只能创建一个兑换码`)
return
}
}
this.planAddExchangeCoupon(2) this.planAddExchangeCoupon(2)
}} }}
> >

View File

@ -563,18 +563,22 @@ const UseKeyAddEdit = () => {
const planAddExchangeCoupon = (type) => { const planAddExchangeCoupon = (type) => {
switch (type) { switch (type) {
case 0: case 0:
sessionStorage.removeItem("has_combining")
setState({ draw_title: "新建兑换码", exchangeType: 1 }) setState({ draw_title: "新建兑换码", exchangeType: 1 })
setTimeout(() => { setTimeout(() => {
addEditExchangeEl.current.clearExchangeForm() addEditExchangeEl.current.clearExchangeForm()
}, 300) }, 300)
break break
case 1: case 1:
sessionStorage.removeItem("has_combining")
setState({ draw_title: "新建优惠券" }) setState({ draw_title: "新建优惠券" })
setTimeout(() => { setTimeout(() => {
addEditCouponEl.current.clearCouponForm() addEditCouponEl.current.clearCouponForm()
}, 300) }, 300)
break break
case 2: case 2:
//
sessionStorage.setItem("has_combining", 1)
setState({ draw_title: "新建组合商品", exchangeType: 2 }) setState({ draw_title: "新建组合商品", exchangeType: 2 })
setTimeout(() => { setTimeout(() => {
addEditExchangeEl.current.clearExchangeForm() addEditExchangeEl.current.clearExchangeForm()
@ -687,7 +691,7 @@ const UseKeyAddEdit = () => {
if (state.isSettlement >= 1) { if (state.isSettlement >= 1) {
// //
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) { if (all_arr.length > 1 && !sessionStorage.getItem("has_combining")) {
Notify.error("包码只能创建一个商品") Notify.error("包码只能创建一个商品")
return return
} }
@ -1239,6 +1243,12 @@ const UseKeyAddEdit = () => {
<Pop trigger="hover" content="一次性充值多张立减金"> <Pop trigger="hover" content="一次性充值多张立减金">
<Button <Button
onClick={(e) => { onClick={(e) => {
if (state.settlement_type > 0) {
if (state.distdata.length >= 1) {
Notify.error(`只能创建一个兑换码`)
return
}
}
planAddExchangeCoupon(2) planAddExchangeCoupon(2)
}} }}
> >