Merge branch 'couponV2.0' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend into couponV2.0
This commit is contained in:
commit
d2262ea923
|
@ -217,6 +217,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
||||||
productType: 1,
|
productType: 1,
|
||||||
checkedProduct: [],
|
checkedProduct: [],
|
||||||
KeyPcType: sessionStorage.getItem("KeyPcType"),
|
KeyPcType: sessionStorage.getItem("KeyPcType"),
|
||||||
|
isLoadingBtn: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 基础信息
|
// 基础信息
|
||||||
|
@ -602,6 +603,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onAuditSubmit = () => {
|
const onAuditSubmit = () => {
|
||||||
|
setState({
|
||||||
|
isLoadingBtn: true,
|
||||||
|
});
|
||||||
// 3新增 1编辑
|
// 3新增 1编辑
|
||||||
if (state.KeyPcType === "1") {
|
if (state.KeyPcType === "1") {
|
||||||
let param = {
|
let param = {
|
||||||
|
@ -658,6 +662,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
||||||
console.log("编辑 大提交 =>", param);
|
console.log("编辑 大提交 =>", param);
|
||||||
|
|
||||||
editCoupon(editData.id, param).then((res) => {
|
editCoupon(editData.id, param).then((res) => {
|
||||||
|
setState({
|
||||||
|
isLoadingBtn: false,
|
||||||
|
});
|
||||||
handelResponse(
|
handelResponse(
|
||||||
res,
|
res,
|
||||||
(req, msg) => {
|
(req, msg) => {
|
||||||
|
@ -714,6 +721,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
addCoupon(param).then((res) => {
|
addCoupon(param).then((res) => {
|
||||||
|
setState({
|
||||||
|
isLoadingBtn: false,
|
||||||
|
});
|
||||||
handelResponse(
|
handelResponse(
|
||||||
res,
|
res,
|
||||||
(req, msg) => {
|
(req, msg) => {
|
||||||
|
@ -1115,6 +1125,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
loading={state.isLoadingBtn}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
onAuditSubmit();
|
onAuditSubmit();
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
Sweetalert,
|
Sweetalert,
|
||||||
} from "zent";
|
} from "zent";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import moment from "moment";
|
||||||
import TabPage from "@/components/tabPage/main.js";
|
import TabPage from "@/components/tabPage/main.js";
|
||||||
import Ipt from "@/components/input/main";
|
import Ipt from "@/components/input/main";
|
||||||
import Grid from "@/components/gird/main.js";
|
import Grid from "@/components/gird/main.js";
|
||||||
|
@ -203,13 +204,19 @@ const UseCouponList = () => {
|
||||||
setState({ limit: data, isQuery: !state.isQuery });
|
setState({ limit: data, isQuery: !state.isQuery });
|
||||||
};
|
};
|
||||||
const onChangeCombinedDate = (data) => {
|
const onChangeCombinedDate = (data) => {
|
||||||
setState({ combinedValue: data });
|
|
||||||
if (data[0]) {
|
if (data[0]) {
|
||||||
setState({
|
let years = moment(data[1]).diff(moment(data[0]), "years");
|
||||||
begin_time: data[0],
|
if (years > 2) {
|
||||||
end_time: data[1],
|
Notify.error("查询时间不能超过3年");
|
||||||
isQuery: !state.isQuery,
|
return;
|
||||||
});
|
} else {
|
||||||
|
setState({ combinedValue: data });
|
||||||
|
setState({
|
||||||
|
begin_time: data[0],
|
||||||
|
end_time: data[1],
|
||||||
|
isQuery: !state.isQuery,
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setState({
|
setState({
|
||||||
combinedValue: data,
|
combinedValue: data,
|
||||||
|
|
|
@ -1,4 +1,19 @@
|
||||||
import { divNum } from "./number";
|
import { divNum } from "./number";
|
||||||
|
|
||||||
|
// 判断
|
||||||
|
const kgType = (item) => {
|
||||||
|
let type = sessionStorage.getItem("KeyPcType");
|
||||||
|
if (type === "2" || type === "3") {
|
||||||
|
return parseInt(divNum(item.all_budget, item.reduce_amount));
|
||||||
|
} else {
|
||||||
|
if (item.stock) {
|
||||||
|
return item.stock;
|
||||||
|
} else {
|
||||||
|
return parseInt(divNum(item.all_budget, item.reduce_amount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 立减金对象重构
|
// 立减金对象重构
|
||||||
export const knockGoldFun = (item) => {
|
export const knockGoldFun = (item) => {
|
||||||
let table_obj = {};
|
let table_obj = {};
|
||||||
|
@ -11,9 +26,7 @@ export const knockGoldFun = (item) => {
|
||||||
table_obj.official_price = item.reduce_amount; // 官方价
|
table_obj.official_price = item.reduce_amount; // 官方价
|
||||||
table_obj.contract_price = item.price; // 合同价格
|
table_obj.contract_price = item.price; // 合同价格
|
||||||
table_obj.quantity = item.total_stock; // 库存数量
|
table_obj.quantity = item.total_stock; // 库存数量
|
||||||
table_obj.stock = item.stock
|
table_obj.stock = kgType(item); // 剩余库存数量
|
||||||
? item.stock
|
|
||||||
: divNum(item.all_budget, item.reduce_amount); // 剩余库存数量
|
|
||||||
table_obj.channel_activity_id = item.channel_activity_id; // 批次号
|
table_obj.channel_activity_id = item.channel_activity_id; // 批次号
|
||||||
table_obj.all_budget = Number(item.all_budget); // 总预算
|
table_obj.all_budget = Number(item.all_budget); // 总预算
|
||||||
table_obj.effectDate = `${item.time_limit.effect_time.start_time} 至 ${item.time_limit.effect_time.end_time}`; // 有效时间段
|
table_obj.effectDate = `${item.time_limit.effect_time.start_time} 至 ${item.time_limit.effect_time.end_time}`; // 有效时间段
|
||||||
|
|
Loading…
Reference in New Issue