key 批次审核
This commit is contained in:
parent
f9c4b9f3a8
commit
623cf6b926
|
@ -137,8 +137,6 @@ const getData = (method, url, params, responseType) => {
|
|||
let http = fetch(url, obj).then((res) => {
|
||||
window.timeshow = res.headers.get("Date-Time");
|
||||
if (res.status == 200) {
|
||||
console.log("当前返回", res.body);
|
||||
|
||||
return res.text();
|
||||
} else {
|
||||
switch (res.status) {
|
||||
|
@ -219,8 +217,6 @@ const req = (method, url, params, responseType) => {
|
|||
let http = fetch(url, obj).then((res) => {
|
||||
window.timeshow = res.headers.get("Date-Time");
|
||||
if (res.status == 200) {
|
||||
console.log("当前返回", res.body);
|
||||
|
||||
return res.json();
|
||||
} else {
|
||||
switch (res.status) {
|
||||
|
|
|
@ -228,7 +228,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
|||
console.log("arr =>1", arr);
|
||||
// 1.2 优惠券管理判断是新增还是编辑
|
||||
if (editData && editData !== "") {
|
||||
setState({ isEdit: true });
|
||||
// 1.3 设置归属计划数据
|
||||
let plan_row = arr.find(
|
||||
(item) => item.text === editData.plan_title
|
||||
|
@ -275,6 +274,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
|||
|
||||
// 1.8 编辑
|
||||
if (isState && isState === "2") {
|
||||
setState({ isEdit: true });
|
||||
setState({
|
||||
oldProduct: editData.product,
|
||||
});
|
||||
|
@ -284,7 +284,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
|
|||
} else {
|
||||
// 1.3 计划的优惠券编辑
|
||||
if (editData && editData !== "") {
|
||||
setState({ isEdit: true });
|
||||
editFun();
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -225,6 +225,40 @@ export default class acclist extends React.Component {
|
|||
};
|
||||
}
|
||||
|
||||
// key 批次的处理
|
||||
keyFormat(data) {
|
||||
console.log("data =>", data);
|
||||
// 兑换码
|
||||
if (Number(data.bind_object[0]) === 1) {
|
||||
let temp = [];
|
||||
for (let i = 0; i < data.code_batch.length; i++) {
|
||||
let code_batch = data.code_batch[i];
|
||||
let range = [];
|
||||
for (let j = 0; j < code_batch.product.length; j++) {
|
||||
let product = code_batch.product[j];
|
||||
/* 区分立减金和商品 */
|
||||
if (product.type === 1) {
|
||||
range.push(product.entity.product_name);
|
||||
} else {
|
||||
range.push(product.entity.batch_goods_name);
|
||||
}
|
||||
}
|
||||
data.code_batch[i].disabled = true;
|
||||
data.code_batch[i].checked = true;
|
||||
data.code_batch[i].range = range.toString();
|
||||
temp.push(data.code_batch[i]);
|
||||
}
|
||||
this.setState({ distdata: temp });
|
||||
} else {
|
||||
let temp = _.map(data.coupon, (o) => {
|
||||
o.checked = true;
|
||||
o.disabled = true;
|
||||
return o;
|
||||
});
|
||||
this.setState({ couponData: temp });
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount(e) {
|
||||
sessionStorage.setItem("knockGoldData", "");
|
||||
let batch_id = sessionStorage.getItem("keybatch_id");
|
||||
|
@ -256,89 +290,9 @@ export default class acclist extends React.Component {
|
|||
this.setState({ isEdit: true });
|
||||
}
|
||||
this.setState({ key_status: req.status });
|
||||
|
||||
this.setState({ plan_id: req.plan_id });
|
||||
|
||||
req.code_batch = req.code_batch ? req.code_batch : [];
|
||||
this.setState({ pagetitle: "编辑key" });
|
||||
|
||||
let temp = [];
|
||||
for (let i = 0; i < req.code_batch.length; i++) {
|
||||
let code_batch = req.code_batch[i];
|
||||
let range = [];
|
||||
for (let j = 0; j < code_batch.product.length; j++) {
|
||||
let product = code_batch.product[j];
|
||||
/* 区分立减金和商品 */
|
||||
if (product.type === 1) {
|
||||
range.push(product.entity.product_name);
|
||||
} else {
|
||||
range.push(product.entity.batch_goods_name);
|
||||
}
|
||||
}
|
||||
req.code_batch[i].disabled = true;
|
||||
req.code_batch[i].checked = true;
|
||||
req.code_batch[i].range = range.toString();
|
||||
temp.push(req.code_batch[i]);
|
||||
}
|
||||
//获取审批单信息
|
||||
if (approval_id > 0) {
|
||||
getApprovalsInfo(approval_id).then((res) => {
|
||||
handelResponse(res, (req, msg) => {
|
||||
/*当为创建中和审核驳回时 转换数据结构 */
|
||||
req.code_batch.map((item) => {
|
||||
const newProduct = [];
|
||||
item.product.legal.map((item1) => {
|
||||
newProduct.push({
|
||||
type: 1,
|
||||
only: item1.product_id,
|
||||
upstream: "直连天下",
|
||||
...item1,
|
||||
});
|
||||
});
|
||||
item.product.reduce.map((item1) => {
|
||||
newProduct.push({
|
||||
type: 2,
|
||||
only: item1.channel_activity_id,
|
||||
upstream:
|
||||
String(item.channel) === "1" ? "支付宝" : "微信",
|
||||
origin: item1,
|
||||
product_name: item1.batch_goods_name,
|
||||
effectDate:
|
||||
item1.time_limit?.effect_time.start_time +
|
||||
" 至 " +
|
||||
item1.time_limit?.effect_time.end_time, //有效时间
|
||||
contract_price: item1.price, //单价
|
||||
official_price: item1.reduce_amount, //官方价
|
||||
quantity: parseInt(
|
||||
divNum(item1.all_budget, item1.reduce_amount)
|
||||
), //总库
|
||||
...item1,
|
||||
});
|
||||
});
|
||||
item.product = [...newProduct];
|
||||
});
|
||||
if (req.payment_direction) {
|
||||
let index = this.state.payment_direction.indexOf(
|
||||
req.payment_direction
|
||||
);
|
||||
this.setState({ paytype: index + 1 });
|
||||
}
|
||||
for (let i = 0; i < req.code_batch.length; i++) {
|
||||
let code_batch = req.code_batch[i];
|
||||
let range = [];
|
||||
for (let j = 0; j < code_batch.product.length; j++) {
|
||||
let product = code_batch.product[j];
|
||||
range.push(product.product_name);
|
||||
}
|
||||
req.code_batch[i].disabled = false;
|
||||
req.code_batch[i].checked = false;
|
||||
req.code_batch[i].range = range.toString();
|
||||
temp.push(req.code_batch[i]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
let model = {
|
||||
style: req.style,
|
||||
batch_name: req.batch_name,
|
||||
|
@ -357,16 +311,16 @@ export default class acclist extends React.Component {
|
|||
this.setState({ mobile_excel: req.mobile_excel });
|
||||
this.setState({ mobile_repeat: req.mobile_repeat });
|
||||
|
||||
// 兑换码
|
||||
if (req.bind_object[0] === 1) {
|
||||
this.setState({ distdata: temp });
|
||||
} else {
|
||||
let temp = _.map(req.coupon, (o) => {
|
||||
o.checked = true;
|
||||
o.disabled = true;
|
||||
return o;
|
||||
// 如果有审批单的数据
|
||||
if (approval_id > 0) {
|
||||
console.log("获取审批单数据");
|
||||
getApprovalsInfo(approval_id).then((res) => {
|
||||
handelResponse(res, (appReq, msg) => {
|
||||
this.keyFormat(appReq);
|
||||
});
|
||||
});
|
||||
this.setState({ couponData: temp });
|
||||
} else {
|
||||
this.keyFormat(req);
|
||||
}
|
||||
},
|
||||
(err) => {}
|
||||
|
|
|
@ -307,8 +307,9 @@ export default class acclist extends React.Component {
|
|||
res,
|
||||
(req, msg) => {
|
||||
console.log("req =>", req);
|
||||
sessionStorage.setItem("isKeyAdd", req.data[0].bind_object[0]);
|
||||
|
||||
if (req.data.length > 0) {
|
||||
sessionStorage.setItem("isKeyAdd", req.data[0].bind_object[0]);
|
||||
}
|
||||
const newData = req.data.map((item) => {
|
||||
if (![4, 5].includes(item.status)) {
|
||||
item.disabled = true;
|
||||
|
@ -524,7 +525,6 @@ export default class acclist extends React.Component {
|
|||
});
|
||||
}
|
||||
onEditRow(status, row) {
|
||||
this.props.history.push("/home/key-edit");
|
||||
sessionStorage.setItem("pathname2", "/home/key-edit");
|
||||
let activerou = [
|
||||
{
|
||||
|
@ -549,6 +549,7 @@ export default class acclist extends React.Component {
|
|||
sessionStorage.setItem("keybatch_id", row.id);
|
||||
sessionStorage.setItem("key_reseller_id", row.reseller_id);
|
||||
sessionStorage.setItem("approval_id", row.approval_id);
|
||||
this.props.history.push("/home/key-edit");
|
||||
}
|
||||
|
||||
//敲回车查询
|
||||
|
@ -901,6 +902,7 @@ export default class acclist extends React.Component {
|
|||
str = (
|
||||
<span>
|
||||
<a className="grid-link disabled">编辑</a>
|
||||
|
||||
{[1, 2, 8].includes(rowData.status) ||
|
||||
[2, 6, 8, 7].includes(this.state.planStatus) ? (
|
||||
<a className="grid-link disabled">复制</a>
|
||||
|
|
Loading…
Reference in New Issue