From f977cb12f6a204c1528bd37d4391e78d60b04860 Mon Sep 17 00:00:00 2001 From: zhangds Date: Sat, 8 Oct 2022 17:26:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0key=E6=89=B9=E6=AC=A1?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=B8=AD=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 4 +++ src/pages/plan/key/edit.js | 53 ++------------------------------------ src/pages/plan/key/list.js | 51 ++++++++++++++++++++++++++---------- 3 files changed, 44 insertions(+), 64 deletions(-) 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)} > - -
- 更多 {" "} -
-
- -
+ 删除 + ) : (