Merge branch 'couponV2.0' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend into couponV2.0
This commit is contained in:
commit
a1061ddf63
|
@ -192,7 +192,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
|||
examinePopShow: false,
|
||||
payType: 3,
|
||||
payment_direction: ["对私账户", "对公账户", "预付款扣除"],
|
||||
isState: "",
|
||||
isState: sessionStorage.getItem("isState"), // 是否编辑和复制
|
||||
coupon_batch_id: "",
|
||||
isEdit: false,
|
||||
oldProduct: {}, // 旧数据,为编辑做准备
|
||||
|
@ -221,7 +221,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
|||
|
||||
const isEditFun = () => {
|
||||
// 是否是编辑
|
||||
if (sessionStorage.getItem("isState") === "2") {
|
||||
if (state.isState === "2") {
|
||||
setState({
|
||||
isEdit: true,
|
||||
});
|
||||
|
@ -240,22 +240,17 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
|||
// 第一步:1.判断组件是否是 优惠券管理 couponType
|
||||
console.log("couponType =>", couponType);
|
||||
console.log("editData =>", editData);
|
||||
let isState = sessionStorage.getItem("isState");
|
||||
setState({
|
||||
isState: isState,
|
||||
});
|
||||
if (couponType === 0) {
|
||||
// 1.1 获取归属计划下拉框数据
|
||||
await getPlanList().then((arr) => {
|
||||
console.log("arr =>", arr);
|
||||
// 1.2 优惠券管理判断是新增还是编辑
|
||||
if (editData && editData !== "") {
|
||||
isEditFun();
|
||||
|
||||
// 1.3 设置归属计划数据
|
||||
let plan_row = arr.find(
|
||||
(item) => item.text === editData.plan_title
|
||||
);
|
||||
|
||||
if (
|
||||
plan_row &&
|
||||
plan_row !== undefined &&
|
||||
|
@ -691,14 +686,20 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
|||
);
|
||||
};
|
||||
const onDisabledRange = (date, type) => {
|
||||
let disabled = false;
|
||||
if (type === "end") {
|
||||
disabled = moment(date.getTime()).add(1, "days") <= new Date().getTime();
|
||||
}
|
||||
let isDisabled = false;
|
||||
let str = moment(date).format("YYYY-MM-DD HH:mm:ss");
|
||||
if (type === "start") {
|
||||
disabled = date.getTime() <= new Date().getTime();
|
||||
isDisabled =
|
||||
moment(str).isBefore(form_info_data.date_time[0]) ||
|
||||
moment(str).isAfter(form_info_data.date_time[1]);
|
||||
}
|
||||
return disabled;
|
||||
|
||||
if (type === "end") {
|
||||
isDisabled =
|
||||
moment(str).add(1, "days").isBefore(form_info_data.date_time[0]) ||
|
||||
moment(str).isAfter(form_info_data.date_time[1]);
|
||||
}
|
||||
return isDisabled;
|
||||
};
|
||||
const onPageChange = () => {};
|
||||
const onCountChange = () => {};
|
||||
|
@ -1029,7 +1030,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
|||
renderOptionList={renderOptionList}
|
||||
options={state.plan_OPTIONS}
|
||||
value={form_info_data.plan_id}
|
||||
disabled={state.isState === "2" ? true : false}
|
||||
disabled={
|
||||
state.isState === "2" || state.isState === "1" ? true : false
|
||||
}
|
||||
onChange={(e) => {
|
||||
changePlan(e);
|
||||
}}
|
||||
|
@ -1045,7 +1048,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
|||
renderOptionList={renderOptionList}
|
||||
options={state.key_OPTIONS}
|
||||
value={form_info_data.key_batch_id}
|
||||
disabled={state.isState === "2" ? true : false}
|
||||
disabled={
|
||||
state.isState === "2" || state.isState === "1" ? true : false
|
||||
}
|
||||
onChange={(e) => {
|
||||
setForm_info_data({ key_batch_id: e });
|
||||
}}
|
||||
|
|
|
@ -25,7 +25,6 @@ const CouponAddEdit = () => {
|
|||
) {
|
||||
getCouponDetails(coupon_batch_id).then((res) => {
|
||||
handelResponse(res, (req, msg) => {
|
||||
console.log("优惠券详情 =>", req);
|
||||
setState({ editModel: req, isShow: true });
|
||||
});
|
||||
});
|
||||
|
|
|
@ -166,7 +166,6 @@ const UseCouponList = () => {
|
|||
page: state.page,
|
||||
limit: state.limit,
|
||||
};
|
||||
console.log("getParam =>", param);
|
||||
param = _.omitBy(
|
||||
{
|
||||
...param,
|
||||
|
|
|
@ -881,7 +881,7 @@ export default class acclist extends React.Component {
|
|||
data.batch_name = this.state.model.batch_name;
|
||||
data.style = this.state.model.style;
|
||||
data.quantity = this.state.model.quantity;
|
||||
data.bind_object = this.state.keyType;
|
||||
data.bind_object = [this.state.keyType];
|
||||
data.allow_repetition = this.state.model.allow_repetition;
|
||||
data.allow_loss = this.state.model.allow_loss;
|
||||
data.merge_stock = this.state.model.merge_stock;
|
||||
|
@ -969,7 +969,7 @@ export default class acclist extends React.Component {
|
|||
}
|
||||
|
||||
onBindNum(e, row, rowIndex) {
|
||||
if (this.props.keyType === 1) {
|
||||
if (this.state.keyType === 1) {
|
||||
this.state.distdata[rowIndex].restrict = e.target.value;
|
||||
this.setState({ distdata: this.state.distdata });
|
||||
} else {
|
||||
|
|
|
@ -228,6 +228,7 @@ export default class acclist extends React.Component {
|
|||
// key 批次的处理
|
||||
keyFormat(data) {
|
||||
console.log("data =>", data);
|
||||
return;
|
||||
// 兑换码
|
||||
if (Number(data.bind_object[0]) === 1) {
|
||||
let temp = [];
|
||||
|
@ -1443,7 +1444,7 @@ export default class acclist extends React.Component {
|
|||
<FormItem labelname="绑定类型" prop="bind_object" id="bind_object">
|
||||
<Radio.Group
|
||||
value={this.state.keyType}
|
||||
disabled={this.state.isEdit}
|
||||
disabled={true}
|
||||
onChange={(e) => {
|
||||
this.onCheckChange(e);
|
||||
}}
|
||||
|
|
Loading…
Reference in New Issue