fix: 增加计划卡密兑换
This commit is contained in:
parent
d58dd8e6a8
commit
02f9c97b28
|
@ -22,7 +22,7 @@ import _ from "lodash";
|
||||||
import { isSameDay } from "date-fns";
|
import { isSameDay } from "date-fns";
|
||||||
import { isAmount } from "@/tools/validate";
|
import { isAmount } from "@/tools/validate";
|
||||||
import { mulNum } from "@/tools/number";
|
import { mulNum } from "@/tools/number";
|
||||||
import { knockGoldFun } from "@/tools/index";
|
import { knockGoldFun, submitIsKm } from "@/tools/index";
|
||||||
import {
|
import {
|
||||||
handelResponse,
|
handelResponse,
|
||||||
queryKeyBatch,
|
queryKeyBatch,
|
||||||
|
@ -602,24 +602,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 判断卡密是否能提交
|
|
||||||
const submitIsKm = (data) => {
|
|
||||||
let visible = true;
|
|
||||||
let deDateTime = JSON.parse(sessionStorage.getItem("datetime"));
|
|
||||||
let end_time = new Date(deDateTime[1]).getTime(); // 计划结束时间
|
|
||||||
// 校验 卡密商品数据 结束时间
|
|
||||||
let legal_km = data.filter((item) => item.product_type === 2);
|
|
||||||
for (let i = 0; i < legal_km.length; i++) {
|
|
||||||
let end_time_km = new Date(legal_km[i].end_time).getTime();
|
|
||||||
if (end_time < end_time_km) {
|
|
||||||
Notify.error("卡密兑换有效期,不能超过计划时间");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return visible;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onAuditSubmit = () => {
|
const onAuditSubmit = () => {
|
||||||
setState({
|
setState({
|
||||||
isLoadingBtn: true,
|
isLoadingBtn: true,
|
||||||
|
|
|
@ -104,6 +104,8 @@ export default class add extends React.Component {
|
||||||
payment_direction: this.state.payment_direction[this.state.paytype - 1],
|
payment_direction: this.state.payment_direction[this.state.paytype - 1],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log("大提交 =>", data);
|
||||||
|
return;
|
||||||
approvals(plan_id, data).then((res) => {
|
approvals(plan_id, data).then((res) => {
|
||||||
handelResponse(
|
handelResponse(
|
||||||
res,
|
res,
|
||||||
|
|
|
@ -231,6 +231,7 @@ export default class add extends React.Component {
|
||||||
sessionStorage.setItem("keyType", type);
|
sessionStorage.setItem("keyType", type);
|
||||||
return req.keys;
|
return req.keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
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()) {
|
||||||
|
@ -253,7 +254,6 @@ export default class add extends React.Component {
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
temp.push(data);
|
temp.push(data);
|
||||||
console.log("大提交 =>", temp);
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -271,6 +271,10 @@ export default class add extends React.Component {
|
||||||
};
|
};
|
||||||
let plan_id = sessionStorage.getItem("plan_id");
|
let plan_id = sessionStorage.getItem("plan_id");
|
||||||
|
|
||||||
|
console.log("key批次提交 =>", obj);
|
||||||
|
// 校验key批次卡密时间
|
||||||
|
|
||||||
|
return;
|
||||||
await addPlanStep(plan_id, obj).then((res) => {
|
await addPlanStep(plan_id, obj).then((res) => {
|
||||||
handelResponse(
|
handelResponse(
|
||||||
res,
|
res,
|
||||||
|
@ -477,6 +481,8 @@ export default class add extends React.Component {
|
||||||
payment_direction: this.state.payment_direction[this.state.paytype - 1],
|
payment_direction: this.state.payment_direction[this.state.paytype - 1],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log("大提交 =>", data);
|
||||||
|
return;
|
||||||
approvals(plan_id, data).then((res) => {
|
approvals(plan_id, data).then((res) => {
|
||||||
handelResponse(
|
handelResponse(
|
||||||
res,
|
res,
|
||||||
|
|
|
@ -34,6 +34,7 @@ import UseCouponAddEdit from "@/components/UseCouponAddEdit"; // 优惠券
|
||||||
import UseExchangeAddEdit from "@/components/UseExchangeAddEdit"; // 兑换码
|
import UseExchangeAddEdit from "@/components/UseExchangeAddEdit"; // 兑换码
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { uploadImg } from "@/assets/api.js";
|
import { uploadImg } from "@/assets/api.js";
|
||||||
|
import { submitIsKm } from "@/tools/index";
|
||||||
import "./add.less";
|
import "./add.less";
|
||||||
import { isSameDay } from "date-fns";
|
import { isSameDay } from "date-fns";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
@ -294,6 +295,16 @@ export default class acclist extends React.Component {
|
||||||
data.coupon = param;
|
data.coupon = param;
|
||||||
data.mobile_excel = this.state.mobile_excel;
|
data.mobile_excel = this.state.mobile_excel;
|
||||||
data.mobile_repeat = this.state.mobile_repeat;
|
data.mobile_repeat = this.state.mobile_repeat;
|
||||||
|
console.log("data =>", data);
|
||||||
|
|
||||||
|
// 校验 卡密时间判断
|
||||||
|
|
||||||
|
for (let i = 0; i < param.length; i++) {
|
||||||
|
if (submitIsKm(param[i].product.legal) === false) {
|
||||||
|
return valide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { divNum } from "./number";
|
import { divNum } from "./number";
|
||||||
|
import { Notify } from "zent";
|
||||||
|
|
||||||
// 判断
|
// 判断
|
||||||
const kgType = (item) => {
|
const kgType = (item) => {
|
||||||
|
@ -33,3 +34,24 @@ export const knockGoldFun = (item) => {
|
||||||
table_obj.create_time = item.create_time; // 创建时间
|
table_obj.create_time = item.create_time; // 创建时间
|
||||||
return table_obj;
|
return table_obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 卡密判断
|
||||||
|
export const submitIsKm = (data) => {
|
||||||
|
console.log("submitIsKm =>", data);
|
||||||
|
let visible = true;
|
||||||
|
let deDateTime = JSON.parse(sessionStorage.getItem("datetime"));
|
||||||
|
console.log("计划时间 =>", deDateTime[1]);
|
||||||
|
|
||||||
|
let end_time = new Date(deDateTime[1]).getTime(); // 计划结束时间
|
||||||
|
// 校验 卡密商品数据 结束时间
|
||||||
|
let legal_km = data.filter((item) => Number(item.product_type) === 2);
|
||||||
|
for (let i = 0; i < legal_km.length; i++) {
|
||||||
|
console.log("卡密时间 =>", legal_km[i].end_time);
|
||||||
|
let end_time_km = new Date(legal_km[i].end_time).getTime();
|
||||||
|
if (end_time < end_time_km) {
|
||||||
|
Notify.error("卡密兑换有效期,不能超过计划时间");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return visible;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue