Merge branch 'couponV2.0' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend into couponV2.0

This commit is contained in:
wangsongsole 2022-09-30 11:45:09 +08:00
commit a1061ddf63
5 changed files with 25 additions and 21 deletions

View File

@ -192,7 +192,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
examinePopShow: false, examinePopShow: false,
payType: 3, payType: 3,
payment_direction: ["对私账户", "对公账户", "预付款扣除"], payment_direction: ["对私账户", "对公账户", "预付款扣除"],
isState: "", isState: sessionStorage.getItem("isState"), //
coupon_batch_id: "", coupon_batch_id: "",
isEdit: false, isEdit: false,
oldProduct: {}, // , oldProduct: {}, // ,
@ -221,7 +221,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
const isEditFun = () => { const isEditFun = () => {
// //
if (sessionStorage.getItem("isState") === "2") { if (state.isState === "2") {
setState({ setState({
isEdit: true, isEdit: true,
}); });
@ -240,22 +240,17 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
// 1. couponType // 1. couponType
console.log("couponType =>", couponType); console.log("couponType =>", couponType);
console.log("editData =>", editData); console.log("editData =>", editData);
let isState = sessionStorage.getItem("isState");
setState({
isState: isState,
});
if (couponType === 0) { if (couponType === 0) {
// 1.1 // 1.1
await getPlanList().then((arr) => { await getPlanList().then((arr) => {
console.log("arr =>", arr);
// 1.2 // 1.2
if (editData && editData !== "") { if (editData && editData !== "") {
isEditFun(); isEditFun();
// 1.3 // 1.3
let plan_row = arr.find( let plan_row = arr.find(
(item) => item.text === editData.plan_title (item) => item.text === editData.plan_title
); );
if ( if (
plan_row && plan_row &&
plan_row !== undefined && plan_row !== undefined &&
@ -691,14 +686,20 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
); );
}; };
const onDisabledRange = (date, type) => { const onDisabledRange = (date, type) => {
let disabled = false; let isDisabled = false;
if (type === "end") { let str = moment(date).format("YYYY-MM-DD HH:mm:ss");
disabled = moment(date.getTime()).add(1, "days") <= new Date().getTime();
}
if (type === "start") { 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 onPageChange = () => {};
const onCountChange = () => {}; const onCountChange = () => {};
@ -1029,7 +1030,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
renderOptionList={renderOptionList} renderOptionList={renderOptionList}
options={state.plan_OPTIONS} options={state.plan_OPTIONS}
value={form_info_data.plan_id} value={form_info_data.plan_id}
disabled={state.isState === "2" ? true : false} disabled={
state.isState === "2" || state.isState === "1" ? true : false
}
onChange={(e) => { onChange={(e) => {
changePlan(e); changePlan(e);
}} }}
@ -1045,7 +1048,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
renderOptionList={renderOptionList} renderOptionList={renderOptionList}
options={state.key_OPTIONS} options={state.key_OPTIONS}
value={form_info_data.key_batch_id} value={form_info_data.key_batch_id}
disabled={state.isState === "2" ? true : false} disabled={
state.isState === "2" || state.isState === "1" ? true : false
}
onChange={(e) => { onChange={(e) => {
setForm_info_data({ key_batch_id: e }); setForm_info_data({ key_batch_id: e });
}} }}

View File

@ -25,7 +25,6 @@ const CouponAddEdit = () => {
) { ) {
getCouponDetails(coupon_batch_id).then((res) => { getCouponDetails(coupon_batch_id).then((res) => {
handelResponse(res, (req, msg) => { handelResponse(res, (req, msg) => {
console.log("优惠券详情 =>", req);
setState({ editModel: req, isShow: true }); setState({ editModel: req, isShow: true });
}); });
}); });

View File

@ -166,7 +166,6 @@ const UseCouponList = () => {
page: state.page, page: state.page,
limit: state.limit, limit: state.limit,
}; };
console.log("getParam =>", param);
param = _.omitBy( param = _.omitBy(
{ {
...param, ...param,

View File

@ -881,7 +881,7 @@ export default class acclist extends React.Component {
data.batch_name = this.state.model.batch_name; data.batch_name = this.state.model.batch_name;
data.style = this.state.model.style; data.style = this.state.model.style;
data.quantity = this.state.model.quantity; 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_repetition = this.state.model.allow_repetition;
data.allow_loss = this.state.model.allow_loss; data.allow_loss = this.state.model.allow_loss;
data.merge_stock = this.state.model.merge_stock; data.merge_stock = this.state.model.merge_stock;
@ -969,7 +969,7 @@ export default class acclist extends React.Component {
} }
onBindNum(e, row, rowIndex) { onBindNum(e, row, rowIndex) {
if (this.props.keyType === 1) { if (this.state.keyType === 1) {
this.state.distdata[rowIndex].restrict = e.target.value; this.state.distdata[rowIndex].restrict = e.target.value;
this.setState({ distdata: this.state.distdata }); this.setState({ distdata: this.state.distdata });
} else { } else {

View File

@ -228,6 +228,7 @@ export default class acclist extends React.Component {
// key 批次的处理 // key 批次的处理
keyFormat(data) { keyFormat(data) {
console.log("data =>", data); console.log("data =>", data);
return;
// 兑换码 // 兑换码
if (Number(data.bind_object[0]) === 1) { if (Number(data.bind_object[0]) === 1) {
let temp = []; let temp = [];
@ -1443,7 +1444,7 @@ export default class acclist extends React.Component {
<FormItem labelname="绑定类型" prop="bind_object" id="bind_object"> <FormItem labelname="绑定类型" prop="bind_object" id="bind_object">
<Radio.Group <Radio.Group
value={this.state.keyType} value={this.state.keyType}
disabled={this.state.isEdit} disabled={true}
onChange={(e) => { onChange={(e) => {
this.onCheckChange(e); this.onCheckChange(e);
}} }}