From 623cf6b92610396d09f2d4525c4b21502c54d898 Mon Sep 17 00:00:00 2001 From: zhangds Date: Wed, 28 Sep 2022 16:32:10 +0800 Subject: [PATCH] =?UTF-8?q?key=20=E6=89=B9=E6=AC=A1=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 4 - src/components/UseCouponAddEdit/index.jsx | 3 +- src/pages/plan/key/edit copy.js | 1229 ++++++++++++--------- src/pages/plan/key/edit.js | 132 +-- src/pages/plan/key/list.js | 8 +- 5 files changed, 770 insertions(+), 606 deletions(-) diff --git a/src/assets/api.js b/src/assets/api.js index d1f630b0..0c22aeaf 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -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) { diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index 546f9af4..041fb884 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -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(); } } diff --git a/src/pages/plan/key/edit copy.js b/src/pages/plan/key/edit copy.js index 00913a09..d2c20784 100644 --- a/src/pages/plan/key/edit copy.js +++ b/src/pages/plan/key/edit copy.js @@ -45,7 +45,9 @@ import "./edit.less"; import moment from "moment"; import { isSameDay } from "date-fns"; import KnockGold from "@/components/knockGold"; +import UseCouponAddEdit from "@/components/UseCouponAddEdit"; // 优惠券 import { divNum } from "@/tools/number"; /* 立减金 */ + const TabPanel = Tabs.TabPanel; const initArray = (targetNum) => { @@ -80,7 +82,6 @@ export default class acclist extends React.Component { }, drawerVisible: false, drawerVisible2: false, - checkedList: [1], productData: [], codeInfo: { //数据模型不可少 @@ -114,6 +115,113 @@ export default class acclist extends React.Component { direct_reseller_id: 0, addIsType: "", newGoldLoading: false, + keyType: 1, + couponData: [], + Column: [ + { + title: "兑换名称", + 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", + }, + ], + Column_coupon: [ + { + title: "优惠券名称", + name: "title", + prop: "title", + type: "normal", + width: "auto", + }, + { + title: "优惠券范围", + prop: "product", + name: "product", + width: "auto", + type: "slot", + }, + { + 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", + }, + ], + rowCouponData: "", }; } @@ -142,7 +250,6 @@ export default class acclist extends React.Component { if (req.status == 7) { this.setState({ isCancel: true }); } - if (req.status == 1) { this.setState({ isEdit: false }); } else { @@ -155,28 +262,12 @@ export default class acclist extends React.Component { 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) => { + console.log("req =>", req); + return; /*当为创建中和审核驳回时 转换数据结构 */ req.code_batch.map((item) => { const newProduct = []; @@ -188,7 +279,6 @@ export default class acclist extends React.Component { ...item1, }); }); - item.product.reduce.map((item1) => { newProduct.push({ type: 2, @@ -209,10 +299,14 @@ export default class acclist extends React.Component { ...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 = []; @@ -223,13 +317,7 @@ export default class acclist extends React.Component { 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]); - } - if (req.payment_direction) { - let index = this.state.payment_direction.indexOf( - req.payment_direction - ); - this.setState({ paytype: index + 1 }); + // temp.push(req.code_batch[i]); } }); }); @@ -243,15 +331,45 @@ export default class acclist extends React.Component { allow_loss: req.allow_loss, stock: req.stock, code_batch: req.code_batch, + coupon: req.coupon, plan_title: req.plan_title, }; - this.setState({ checkedList: req.bind_object }); + this.setState({ keyType: req.bind_object[0] }); this.setState({ model: model }); this.setState({ endtime: req.end_time }); this.setState({ begintime: req.begin_time }); - this.setState({ distdata: temp }); this.setState({ mobile_excel: req.mobile_excel }); this.setState({ mobile_repeat: req.mobile_repeat }); + + // 兑换码 + if (Number(req.bind_object[0]) === 1) { + 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]); + } + this.setState({ distdata: temp }); + } else { + let temp = _.map(req.coupon, (o) => { + o.checked = true; + o.disabled = true; + return o; + }); + this.setState({ couponData: temp }); + } }, (err) => {} ); @@ -308,9 +426,8 @@ export default class acclist extends React.Component { parentComponent: this, }); } - onCheckChange = (arr) => { - this.setState({ checkedList: arr }); - let checkedList = arr; + onCheckChange = (e) => { + this.setState({ keyType: e.target.value }); }; onStyleChange(e) { @@ -554,6 +671,28 @@ export default class acclist extends React.Component { } codeSubmit() { + // 优惠券数据 + if (this.state.keyType === 2) { + let coupon_validator = this.refs.addEditCouponEl.submit(); + if (coupon_validator) { + let param = this.refs.addEditCouponEl.getModel(); + let tempdata = this.state.couponData; + // 优惠券编辑 + if (this.state.rowIndex > -1) { + tempdata[this.state.rowIndex] = param; + this.setState({ couponData: tempdata }); + } else { + // 优惠券新增 + tempdata.push(param); + this.setState({ couponData: tempdata }); + } + this.setState({ + drawerVisible: false, + }); + } + return; + } + if (this.refs.code_info.validator() && this.refs.code_rule.validator()) { let productlist = _.filter(this.state.tempdata, (item) => { return item.checked == true; @@ -674,107 +813,79 @@ export default class acclist extends React.Component { } onConfirm() { - let selection = this.refs.bindObj.getSelectData(); - let formdata = selection.filter((item) => { - return !item.hasOwnProperty("disabled") || item.disabled == false; - }); - // 转换数据 - let dataCopy = _.cloneDeep(formdata); - dataCopy.map((item) => { - item.products = item.product; - }); - - dataCopy.map((item) => - item.products.map(() => { - item.product = { - legal: item.products.filter((item2) => item2.type == 1), - reduce: item.products - .filter((item3) => item3.type === 2) - .map((item4) => item4.origin), - }; - }) - ); - - dataCopy.map((item) => { - delete item.products; - }); - - //除了创建中 编辑key - if (this.state.isEdit) { - this.setState({ audit_visible: false }); - let approval_id = sessionStorage.getItem("approval_id"); - if (approval_id > 0) { - getApprovalsStatus(approval_id).then((res) => { - handelResponse( - res, - (req, msg) => { - if (req.status == 0) { - this.setState({ recall_visible: true }); - } - if (req.status == 1) { - this.setState({ audit_visible: true }); - } - if (req.status == 2 || req.status == 3) { - // let selection = this.refs.bindObj.getSelectData() - // let dataCopy = selection.filter((item) => { - // return ( - // !item.hasOwnProperty('disabled') || item.disabled == false - // ) - // }) - - let id = sessionStorage.getItem("keybatch_id"); - let data = { - code_batch: dataCopy, - reseller_id: this.state.reseller.id, - reseller_name: this.state.reseller.name, - company_name: this.state.reseller.company_name, - receive_email: this.state.reseller.contact_email[0], - payment_direction: - this.state.payment_direction[this.state.paytype - 1], - }; - - keyEditApproval(id, data).then((res) => { - handelResponse( - res, - (req, msg) => { - Notify.success("成功发起审批"); - setTimeout(() => { - window.history.back(); - }, 1000); - }, - (err) => { - Notify.error(err); - } - ); - }); - } - }, - (err) => { - Notify.error(err); - } - ); - }); - } else { - if (this.state.key_status != 1) { - let id = sessionStorage.getItem("keybatch_id"); - let data = { - code_batch: dataCopy, - reseller_id: this.state.reseller?.id, - reseller_name: this.state.reseller?.name, - company_name: this.state.reseller?.company_name, - receive_email: this.state.reseller?.contact_email[0], - payment_direction: - this.state.payment_direction[this.state.paytype - 1], + // 兑换码 + if (this.state.keyType === 1) { + let selection = this.refs.bindObj.getSelectData(); + let formdata = selection.filter((item) => { + return !item.hasOwnProperty("disabled") || item.disabled == false; + }); + // 转换数据 + let dataCopy = _.cloneDeep(formdata); + dataCopy.map((item) => { + item.products = item.product; + }); + dataCopy.map((item) => + item.products.map(() => { + item.product = { + legal: item.products.filter((item2) => item2.type == 1), + reduce: item.products + .filter((item3) => item3.type === 2) + .map((item4) => item4.origin), }; - - keyEditApproval(id, data).then((res) => { + }) + ); + dataCopy.map((item) => { + delete item.products; + }); + //除了创建中 编辑key + if (this.state.isEdit) { + this.setState({ audit_visible: false }); + let approval_id = sessionStorage.getItem("approval_id"); + if (approval_id > 0) { + getApprovalsStatus(approval_id).then((res) => { handelResponse( res, (req, msg) => { - Notify.success("成功发起审批"); - setTimeout(() => { - window.history.back(); - }, 1000); + if (req.status == 0) { + this.setState({ recall_visible: true }); + } + if (req.status == 1) { + this.setState({ audit_visible: true }); + } + if (req.status == 2 || req.status == 3) { + // let selection = this.refs.bindObj.getSelectData() + // let dataCopy = selection.filter((item) => { + // return ( + // !item.hasOwnProperty('disabled') || item.disabled == false + // ) + // }) + + let id = sessionStorage.getItem("keybatch_id"); + let data = { + code_batch: dataCopy, + reseller_id: this.state.reseller.id, + reseller_name: this.state.reseller.name, + company_name: this.state.reseller.company_name, + receive_email: this.state.reseller.contact_email[0], + payment_direction: + this.state.payment_direction[this.state.paytype - 1], + }; + + keyEditApproval(id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + Notify.success("成功发起审批"); + setTimeout(() => { + window.history.back(); + }, 1000); + }, + (err) => { + Notify.error(err); + } + ); + }); + } }, (err) => { Notify.error(err); @@ -782,44 +893,154 @@ export default class acclist extends React.Component { ); }); } else { - let data = { - batch_name: this.state.model.batch_name, - style: this.state.model.style, - quantity: this.state.model.quantity, - bind_object: this.state.checkedList, - allow_repetition: this.state.model.allow_repetition, - allow_loss: this.state.model.allow_loss, - merge_stock: this.state.model.merge_stock, - mobile_excel: this.state.mobile_excel, - mobile_repeat: this.state.mobile_repeat, - code_batch: dataCopy, - reseller_id: this.state.reseller.id, - reseller_name: this.state.reseller.name, - company_name: this.state.reseller.company_name, - receive_email: this.state.reseller.contact_email[0], - payment_direction: - this.state.payment_direction[this.state.paytype - 1], - }; + if (this.state.key_status != 1) { + let id = sessionStorage.getItem("keybatch_id"); + let data = { + code_batch: dataCopy, + reseller_id: this.state.reseller?.id, + reseller_name: this.state.reseller?.name, + company_name: this.state.reseller?.company_name, + receive_email: this.state.reseller?.contact_email[0], + payment_direction: + this.state.payment_direction[this.state.paytype - 1], + }; - let id = sessionStorage.getItem("keybatch_id"); - putKeyBatchDetail(id, data).then((res) => { + keyEditApproval(id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + Notify.success("成功发起审批"); + setTimeout(() => { + window.history.back(); + }, 1000); + }, + (err) => { + Notify.error(err); + } + ); + }); + } else { + let data = { + batch_name: this.state.model.batch_name, + style: this.state.model.style, + quantity: this.state.model.quantity, + bind_object: this.state.keyType, + allow_repetition: this.state.model.allow_repetition, + allow_loss: this.state.model.allow_loss, + merge_stock: this.state.model.merge_stock, + mobile_excel: this.state.mobile_excel, + mobile_repeat: this.state.mobile_repeat, + code_batch: dataCopy, + reseller_id: this.state.reseller.id, + reseller_name: this.state.reseller.name, + company_name: this.state.reseller.company_name, + receive_email: this.state.reseller.contact_email[0], + payment_direction: + this.state.payment_direction[this.state.paytype - 1], + }; + + let id = sessionStorage.getItem("keybatch_id"); + putKeyBatchDetail(id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + // keyApproval(this.state.plan_id, id, data).then((res) => { + // handelResponse( + // res, + // (req, msg) => { + Notify.success(res.message); + setTimeout(() => { + this.props.history.push("/home/key-list/"); + }, 2000); + // }, + // (err) => { + // Notify.error(err) + // } + // ) + // }) + }, + (err) => { + Notify.error(err); + } + ); + }); + } + } + } else { + //创建中 编辑key + let data = { + batch_name: this.state.model.batch_name, + style: this.state.model.style, + quantity: this.state.model.quantity, + bind_object: this.state.keyType, + allow_repetition: this.state.model.allow_repetition, + allow_loss: this.state.model.allow_loss, + merge_stock: this.state.model.merge_stock, + mobile_excel: this.state.mobile_excel, + mobile_repeat: this.state.mobile_repeat, + code_batch: dataCopy, + reseller_id: this.state.reseller.id, + reseller_name: this.state.reseller.name, + company_name: this.state.reseller.company_name, + receive_email: this.state.reseller.contact_email[0], + payment_direction: + this.state.payment_direction[this.state.paytype - 1], + }; + + let id = sessionStorage.getItem("keybatch_id"); + let approval_id = sessionStorage.getItem("approval_id"); + if (approval_id > 0) { + getApprovalsStatus(approval_id).then((res) => { handelResponse( res, (req, msg) => { - // keyApproval(this.state.plan_id, id, data).then((res) => { - // handelResponse( - // res, - // (req, msg) => { - Notify.success(res.message); + if (req.status == 0) { + this.setState({ recall_visible: true }); + } + if (req.status == 1) { + this.setState({ audit_visible: true }); + } + if (req.status == 2 || req.status == 3) { + putKeyBatchDetail(id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + // keyApproval(this.state.plan_id, id, data).then((res) => { + // handelResponse( + // res, + // (req, msg) => { + Notify.success(res.message); + setTimeout(() => { + this.props.history.push("/home/key-list/"); + }, 2000); + // }, + // (err) => { + // Notify.error(err) + // } + // ) + // }) + }, + (err) => { + Notify.error(err); + } + ); + }); + } + }, + (err) => { + Notify.error(err); + } + ); + }); + } else { + keyApproval(this.state.plan_id, id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + Notify.success("成功发起审批"); setTimeout(() => { this.props.history.push("/home/key-list/"); }, 2000); - // }, - // (err) => { - // Notify.error(err) - // } - // ) - // }) }, (err) => { Notify.error(err); @@ -829,96 +1050,43 @@ export default class acclist extends React.Component { } } } else { - //创建中 编辑key - let data = { - batch_name: this.state.model.batch_name, - style: this.state.model.style, - quantity: this.state.model.quantity, - bind_object: this.state.checkedList, - allow_repetition: this.state.model.allow_repetition, - allow_loss: this.state.model.allow_loss, - merge_stock: this.state.model.merge_stock, - mobile_excel: this.state.mobile_excel, - mobile_repeat: this.state.mobile_repeat, - code_batch: dataCopy, + // 优惠券 + let coupon_data = this.state.couponData.filter((item) => !item.id); + let param = { + coupon: coupon_data, reseller_id: this.state.reseller.id, reseller_name: this.state.reseller.name, company_name: this.state.reseller.company_name, receive_email: this.state.reseller.contact_email[0], payment_direction: this.state.payment_direction[this.state.paytype - 1], }; - let id = sessionStorage.getItem("keybatch_id"); - let approval_id = sessionStorage.getItem("approval_id"); - if (approval_id > 0) { - getApprovalsStatus(approval_id).then((res) => { - handelResponse( - res, - (req, msg) => { - if (req.status == 0) { - this.setState({ recall_visible: true }); - } - if (req.status == 1) { - this.setState({ audit_visible: true }); - } - if (req.status == 2 || req.status == 3) { - putKeyBatchDetail(id, data).then((res) => { - handelResponse( - res, - (req, msg) => { - // keyApproval(this.state.plan_id, id, data).then((res) => { - // handelResponse( - // res, - // (req, msg) => { - Notify.success(res.message); - setTimeout(() => { - this.props.history.push("/home/key-list/"); - }, 2000); - // }, - // (err) => { - // Notify.error(err) - // } - // ) - // }) - }, - (err) => { - Notify.error(err); - } - ); - }); - } - }, - (err) => { - Notify.error(err); - } - ); - }); - } else { - keyApproval(this.state.plan_id, id, data).then((res) => { - handelResponse( - res, - (req, msg) => { - Notify.success("成功发起审批"); - setTimeout(() => { - this.props.history.push("/home/key-list/"); - }, 2000); - }, - (err) => { - Notify.error(err); - } - ); - }); - } + console.log("大提交 =>", param); + keyEditApproval(id, param).then((res) => { + handelResponse( + res, + (req, msg) => { + Notify.success("成功发起审批"); + setTimeout(() => { + window.history.back(); + }, 1000); + }, + (err) => { + Notify.error(err); + } + ); + }); } } - onBindNum(e, row) { - let index = this.state.distdata.findIndex((o) => { - return o == row; - }); - - this.state.distdata[index].restrict = e.target.value; - this.setState({ distdata: this.state.distdata }); + onBindNum(e, row, rowIndex) { + if (this.state.keyType === 1) { + this.state.distdata[rowIndex].restrict = e.target.value; + this.setState({ distdata: this.state.distdata }); + } else { + this.state.couponData[rowIndex].restrict = e.target.value; + this.setState({ couponData: this.state.couponData }); + } } onDisabledCombinedDate = (val) => { @@ -961,39 +1129,46 @@ export default class acclist extends React.Component { } rowItemClick(row, rowIndex) { - let codeInfo = { - //数据模型不可少 - code_name: row.title, - issued: row.quantity, //发放总量 - describe: row.describe, - date_time: [row.begin_time, row.end_time], - range: row.range, - restrict: row.restrict, - }; + // 编辑兑换码 + if (this.props.keyType === 1) { + let codeInfo = { + //数据模型不可少 + code_name: row.title, + issued: row.quantity, //发放总量 + describe: row.describe, + date_time: [row.begin_time, row.end_time], + range: row.range, + restrict: row.restrict, + }; + this.setState({ codeInfo: codeInfo }); + let arr = _.map(row.product, (res) => { + let obj = {}; + obj.key = res.only; + obj.text = res.product_name; + return obj; + }); + this.setState({ + draw_title: "编辑兑换码", + rankoptions: arr, + rank: arr, + rowIndex: rowIndex, + }); - this.setState({ codeInfo: codeInfo }); - - let arr = _.map(row.product, (res) => { - let obj = {}; - obj.key = res.only; - obj.text = res.product_name; - return obj; - }); - - this.setState({ - draw_title: "编辑兑换码", - rankoptions: arr, - rank: arr, - rowIndex: rowIndex, - }); - - let temp = _.map(row.product, (o) => { - o.checked = true; - return o; - }); - sessionStorage.setItem("productData", JSON.stringify(row.product)); - sessionStorage.setItem("knockGoldData", JSON.stringify(row.product)); - this.setState({ tempdata: temp, drawerVisible: true }); + let temp = _.map(row.product, (o) => { + o.checked = true; + return o; + }); + sessionStorage.setItem("productData", JSON.stringify(row.product)); + sessionStorage.setItem("knockGoldData", JSON.stringify(row.product)); + this.setState({ tempdata: temp, drawerVisible: true }); + } else { + this.setState({ + draw_title: "编辑优惠券", + rowIndex: rowIndex, + rowCouponData: row, + drawerVisible: true, + }); + } } onUpload = (file, report) => { @@ -1252,6 +1427,15 @@ export default class acclist extends React.Component { rank: [{ type: "required", message: "请选择商品范围" }], }; + // 优惠券范围 + const coupon_range = (product) => { + let arr_legal = product.legal.map((item) => item.product_name); + let arr_reduce = product.reduce.map((item) => item.batch_goods_name); + let arr = arr_legal.concat(arr_reduce); + arr = arr.join(","); + return {arr}; + }; + return (
- { this.onCheckChange(e); }} - disabled={this.state.isEdit} > - 兑换码 - - 优惠券 - - {/* 立减金 */} - + 兑换码 + 优惠券 + - {this.state.checkedList.length > 0 ? ( - - {this.state.checkedList.indexOf(1) > -1 ? ( - - ) : null} - - ) : null} + + + {this.state.keyType === 1 ? ( + + ) : ( + + )} + + { - this.onBindNum(e, rowData); + this.onBindNum(e, rowData, rowIndex); }} disabled={rowData.disabled} /> ); } + // 优惠券范围 + if (com === "product" && this.state.keyType === 2) { + return coupon_range(rowData.product); + } if (com == "edit") { let str = ( -
- -
-
- + +
+ - { - let model = this.state.codeInfo; - model.code_name = e; - this.setState({ codeInfo: model }); - }} - onClearItem={(e) => { - let model = this.state.codeInfo; - model.code_name = ""; - this.setState({ codeInfo: model }); - }} - value={this.state.codeInfo.code_name} - placeholder={"请输入兑换码名称"} - labelWidth={"0px"} - maxLength={10} - height={"36px"} - width={"520px"} - alignment={"left"} - /> - - - { - let model = this.state.codeInfo; - model.issued = e; - this.setState({ codeInfo: model }); - }} - onClearItem={(e) => { - let model = this.state.codeInfo; - model.issued = ""; - this.setState({ codeInfo: model }); - }} - unit="条" - countShow={false} - value={this.state.codeInfo.issued} - placeholder={"请输入发放总量"} - labelWidth={"0px"} - maxLength={12} - height={"36px"} - width={"520px"} - alignment={"left"} - /> - - - { - let model = this.state.codeInfo; - model.describe = e.target.value; - console.log(model.describe); - this.setState({ codeInfo: model }); - }} - /> - - -
-
- -
-
- - { - Bus.emit("change", "date_time", e); - this.onChangeCombinedDate(e); - }} - disabledTime={this.onDisabledTime} - disabledDate={this.onDisabledRange} - /> - - -
- { + let model = this.state.codeInfo; + model.describe = e.target.value; + console.log(model.describe); + this.setState({ codeInfo: model }); }} /> -
+ + +
+
+ + - 新建商品 - - -
-
- - { - this.pageChange(e); - }} - checkChange={(selection) => { - let arr = []; - _.map(selection, (res) => { - let obj = {}; - obj.key = res.only; - obj.text = res.product_name; - arr.push(obj); - return obj; - }); - this.setState({ rank: arr }); - }} - ComponentHandler={(com, rowData, rowIndex) => { - if (com == "type") { - return <>{rowData.type === 2 ? "立减金" : "商品"}; - } - if (com == "cost_price") { - return ( - <> - {rowData.type === 2 - ? rowData.official_price - : rowData.cost_price} - - ); - } - if (com == "edit") { - return ( - { - this.keyProductClick(rowData, rowIndex); - }} - style={{ color: "#2B66F2" }} - > - 编辑 - - ); - } - }} - /> - - -
-
-
+ disabledTime={this.onDisabledTime} + disabledDate={this.onDisabledRange} + /> + + +
+