fix: 增加key批次创建中删除接口

This commit is contained in:
zhangds 2022-10-08 17:26:20 +08:00
parent f035698053
commit f977cb12f6
3 changed files with 44 additions and 64 deletions

View File

@ -954,4 +954,8 @@ export const deleteCoupon = (id) => {
return req("delete", baseurl + `/coupon/delete/${id}`);
};
// 删除key批次
export const deleteKeyBatch = (id) => {
return req("delete", baseurl + `/keybatch/${id}`);
};
export { req };

View File

@ -247,6 +247,7 @@ export default class acclist extends React.Component {
data.code_batch[i].range = range.toString();
temp.push(data.code_batch[i]);
}
console.log("兑换码 =>", temp);
this.setState({ distdata: temp });
} else {
let temp = _.map(data.coupon, (o) => {
@ -256,6 +257,7 @@ export default class acclist extends React.Component {
}
return o;
});
console.log("优惠券 =>", temp);
this.setState({ couponData: temp });
}
}
@ -1242,57 +1244,6 @@ export default class acclist extends React.Component {
}
render() {
const Column = [
{
title: "兑换名称1",
name: "title",
prop: "title",
type: "normal",
width: "auto",
},
{
title: "兑换码范围",
type: "normal",
prop: "range",
width: "auto",
},
{
title: "有效开始日期",
prop: "begin_time",
name: "begin_time",
width: "auto",
type: "normal",
},
{
title: "有效结束日期",
name: "end_time",
prop: "end_time",
type: "normal",
width: "auto",
},
{
title: "兑换码数量",
name: "quantity",
type: "normal",
prop: "quantity",
defaultText: "PM",
width: "auto",
},
{
title: "绑定数",
prop: "restrict",
name: "restrict",
type: "slot",
width: "auto",
},
{
title: "操作",
prop: "edit",
name: "edit",
type: "slot",
width: "auto",
},
];
//校验规则
const rules = {
bind_object: [{ type: "required", message: "请选择绑定类型" }],

View File

@ -31,6 +31,7 @@ import {
cancelKey,
getReseller,
batchSend,
deleteKeyBatch,
} from "../../../assets/api.js";
import _ from "lodash";
const Column = [
@ -712,6 +713,34 @@ export default class acclist extends React.Component {
onEmailChange(e) {
this.setState({ email_radio: e.target.value });
}
deleteFun(row) {
Sweetalert.confirm({
type: "warning",
closeBtn: true,
title: "确认操作",
content: <p>你确定要删除该条数据?</p>,
onConfirm: () => {
deleteKeyBatch(row.id).then((res) => {
handelResponse(
res,
(response, msg) => {
Notify.clear();
Notify.success(msg);
setTimeout(() => {
this.getKeyList();
}, 3000);
},
(err) => {
Notify.error(err);
}
);
});
},
onCancel() {},
className: "questModal",
parentComponent: this,
});
}
onReCall(e, rowData) {
let self = this;
let approval_id = rowData.approval_id;
@ -1021,20 +1050,16 @@ export default class acclist extends React.Component {
<span className="grid-link disabled">撤销审批</span>
{/* 创建中 置灰更多按钮 */}
{rowData.status === 1 ? (
<Dropdown
position={DropdownPosition.RightTop}
visible={this.state.menuVisible}
onVisibleChange={(v) =>
this.setState({ visible: v })
}
// 如果是创建中 增加删除
<span
className="grid-link"
style={{
color: "red",
}}
onClick={() => this.deleteFun(rowData)}
>
<DropdownClickTrigger>
<div className="linkmore disabled">
更多 <Icon type={"down"} />{" "}
</div>
</DropdownClickTrigger>
<DropdownContent></DropdownContent>
</Dropdown>
删除
</span>
) : (
<Dropdown
position={DropdownPosition.RightTop}