fix: 增加计划新建商品类型

This commit is contained in:
zhangds 2022-10-24 16:36:15 +08:00
parent 89dbb1c3e8
commit b255755b18
1 changed files with 3 additions and 56 deletions

View File

@ -1,7 +1,5 @@
/* 新增营销计划 */
import ReactDOM from "react-dom";
import React, { Component } from "react";
import { HashRouter as Router, Route, Link } from "react-router-dom";
import React from "react";
import {
Button,
Card,
@ -9,9 +7,7 @@ import {
Notify,
Radio,
RadioGroup,
smoothScroll,
Sweetalert,
Input,
} from "zent";
import "./add.less";
import Step1 from "./step1.js";
@ -24,10 +20,8 @@ import {
getReseller,
planSend,
approvals,
getDraftInfo,
get_copy_data,
} from "../../../assets/api.js";
import { divNum } from "@/tools/number";
} from "@/assets/api.js";
export default class add extends React.Component {
constructor(props) {
@ -160,54 +154,7 @@ export default class add extends React.Component {
keyType: type,
});
sessionStorage.setItem("keyType", type);
if (type === 2) {
// 优惠券的转译-弹窗已做了优化
return req.keys;
} else {
// 兑换码的转译
req.keys.map((item) => {
item.code_batch.map((item1) => {
item1.products = [];
});
});
req.keys.map((item) => {
item.code_batch.map((item1) => {
item1.product.legal.map((item2) => {
item2.only = item2.product_id;
item2.type = 1;
item2.upstream = "直连天下";
item1.products.push(item2);
});
item1.product.reduce.map((item3) => {
let obj = {};
obj.product_name = item3.batch_goods_name; //名字
obj.channel_activity_id = item3.channel_activity_id; //批次号
obj.only = item3.channel_activity_id;
obj.type = 2; //类型
obj.upstream = String(item3.channel) === "1" ? "支付宝" : "微信"; //上游
obj.effectDate =
item3.time_limit.effect_time.start_time +
" 至 " +
item3.time_limit.effect_time.end_time; //有效时间
obj.contract_price = item3.price; //单价
obj.official_price = item3.reduce_amount; //官方价
obj.quantity = parseInt(
divNum(item3.all_budget, item3.reduce_amount)
); //总库存
obj.origin = item3;
item1.products.push(obj);
});
});
});
req.keys.map((item) => {
item.code_batch.map((item1) => {
item1.product = item1.products;
delete item1.products;
});
});
return req.keys;
}
return req.keys;
}
// 获取落地页