diff --git a/src/assets/api.js b/src/assets/api.js index c6b19a90..53c512b8 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -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 }; diff --git a/src/pages/plan/key/edit.js b/src/pages/plan/key/edit.js index 6eb7ea2c..ff2479f1 100644 --- a/src/pages/plan/key/edit.js +++ b/src/pages/plan/key/edit.js @@ -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: "请选择绑定类型" }], diff --git a/src/pages/plan/key/list.js b/src/pages/plan/key/list.js index f924dda6..a0583126 100644 --- a/src/pages/plan/key/list.js +++ b/src/pages/plan/key/list.js @@ -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:

你确定要删除该条数据?

, + 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 { 撤销审批 {/* 创建中 置灰更多按钮 */} {rowData.status === 1 ? ( - - this.setState({ visible: v }) - } + // 如果是创建中 增加删除 + this.deleteFun(rowData)} > - -
- 更多 {" "} -
-
- -
+ 删除 + ) : (