diff --git a/libs/list/index.jsx b/libs/list/index.jsx index 6b48414a..b60dd057 100644 --- a/libs/list/index.jsx +++ b/libs/list/index.jsx @@ -78,7 +78,6 @@ const UseCouponList = () => { const getTable = () => { let param = getParam(); - console.log("调用接口 ...", param); }; useEffect(() => { diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index a848d782..5822034d 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -658,8 +658,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => { return item.goods_id; } }); - - console.log("编辑 大提交 =>", param); editCoupon(editData.id, param).then((res) => { handelResponse( res, @@ -730,8 +728,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }); return; } - - console.log("大提交 =>", param); addCoupon(param).then((res) => { handelResponse( res, @@ -880,7 +876,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 获取已经选择的商品数据(禁用商品选择) const getCheckedProduct = () => { - console.log("已选 =>", state.tableData); let arr = state.tableData.map((item) => Number(item.product_id)); return arr; }; @@ -935,7 +930,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 编辑 const productEditShow = (rowData, index) => { - console.log("编辑数据 1 => ", rowData); try { // 第一步:获取直连天下的商品数据需要分销商 id const direct_reseller_ids = state.direct_reseller_id; diff --git a/src/components/UseGoodsScopePop/index.jsx b/src/components/UseGoodsScopePop/index.jsx index ce51787c..591622d2 100644 --- a/src/components/UseGoodsScopePop/index.jsx +++ b/src/components/UseGoodsScopePop/index.jsx @@ -42,7 +42,6 @@ const UseGoodsScopePop = forwardRef((props, ref) => { Number(form_model.quantity) ); form_model.effectDate = "-"; - console.log("new_tableData[table_index] 1=>", new_tableData[table_index]); if (product_title === "编辑商品") { if (table_index !== -1) { let ck = new_tableData[table_index].checked; @@ -60,7 +59,6 @@ const UseGoodsScopePop = forwardRef((props, ref) => { let new_tableData = tableData; let form_model = knockGold_el.current.state.form_data; let table_obj = knockGoldFun(form_model); - console.log("new_tableData[table_index] 2=>", new_tableData[table_index]); if (product_title === "编辑立减金") { if (table_index !== -1) { let ck = new_tableData[table_index].checked; @@ -92,7 +90,6 @@ const UseGoodsScopePop = forwardRef((props, ref) => { } else { form_data = format_knockGold_model(); } - console.log("form_data =>", form_data); submit(form_data); onClose(); } diff --git a/src/components/UseProductPop/index.jsx b/src/components/UseProductPop/index.jsx index a70e805d..b43561cc 100644 --- a/src/components/UseProductPop/index.jsx +++ b/src/components/UseProductPop/index.jsx @@ -174,7 +174,6 @@ const UseProductPop = forwardRef((props, ref) => { setState({ productDataAll: req.data, }); - console.log("所有商品数据 =>", req.data); let optArr = req.data.map((item) => { return { key: item.id, diff --git a/src/components/UseUploadExcel/index.jsx b/src/components/UseUploadExcel/index.jsx index 12a22fbb..42e095ec 100644 --- a/src/components/UseUploadExcel/index.jsx +++ b/src/components/UseUploadExcel/index.jsx @@ -38,7 +38,6 @@ const UseUploadExcel = (props) => { useEffect(() => { try { let el = uploadInputRef.current; - console.log(el); if (el) { el.click(); } @@ -51,7 +50,6 @@ const UseUploadExcel = (props) => { setFilesTip(200); setHash(res.data.hash); setDisabledSureBtn(false); - console.log("res => 成功", res); }; const bachUploadState_0 = (res) => { @@ -111,7 +109,6 @@ const UseUploadExcel = (props) => { return; } } else { - console.log("res =>", res); Notify.error(res.message); setFilesTip(0); } @@ -128,7 +125,6 @@ const UseUploadExcel = (props) => { setFilesName(my_file.name); setShowUpType(true); excelParseFun(my_file); // 文件解析 - console.log("file =>", my_file); }; /** diff --git a/src/pages/coupon/commodity/index.jsx b/src/pages/coupon/commodity/index.jsx index 9e1ba400..a248ecc1 100644 --- a/src/pages/coupon/commodity/index.jsx +++ b/src/pages/coupon/commodity/index.jsx @@ -170,7 +170,6 @@ const UseCouponCommodity = () => { }); } }); - console.log("resData =>", resData); setState({ tableData: resData }); }); }); diff --git a/src/pages/plan/key/UseKeyAddEdit.jsx b/src/pages/plan/key/UseKeyAddEdit.jsx index 78d65dff..433f1b6e 100644 --- a/src/pages/plan/key/UseKeyAddEdit.jsx +++ b/src/pages/plan/key/UseKeyAddEdit.jsx @@ -490,7 +490,6 @@ const UseKeyAddEdit = () => { return o; }); } - console.log("newData =>", newData); if (Number(data.bind_object[0]) === 1) { setState({ distdata: newData }); } else { @@ -563,7 +562,6 @@ const UseKeyAddEdit = () => { // 编辑 const rowEditClick = (row, rowIndex) => { - console.log("编辑 -01"); if (state.keyType === 1) { setState({ draw_title: "编辑兑换码", @@ -797,7 +795,6 @@ const UseKeyAddEdit = () => { * @param {*} data */ const couponExchangeSubmit = (apiType, data) => { - console.log("apiType =>", apiType); let keyBatch_id = sessionStorage.getItem("keybatch_id"); if (apiType === 0) { let create_param = { @@ -875,7 +872,6 @@ const UseKeyAddEdit = () => { // 优惠券 const couponTools = () => { - console.log("state.couponData =>", state.couponData); // 第一步:整理数据 编辑优惠券数据 let editCouponData = state.couponData.filter( (item) => diff --git a/src/pages/plan/key/edit copy.js b/src/pages/plan/key/edit copy.js deleted file mode 100644 index 1007a006..00000000 --- a/src/pages/plan/key/edit copy.js +++ /dev/null @@ -1,1512 +0,0 @@ -/*此页面 创建中 进行中 审核驳回可编辑 */ - -import React from "react"; -import { deWeightThree } from "../../../utils"; -import { - Radio, - Card, - Sweetalert, - Drawer, - Button, - Tabs, - Notify, - DateRangePicker, - ImageUpload, - Select, - Input, - Checkbox, - Icon, - RadioGroup, - RadioButton, -} from "zent"; -import Ipt from "../../../components/input/main"; -import Form from "../../../components/form/main"; -import FormItem from "../../../components/form-item/main"; -import Grid from "../../../components/gird/main.js"; -import { - addPlanStep, - getApprovalsInfo, - handelResponse, - getKeyBatchDetail, - getReseller, - putKeyBatchDetail, - uploadImg, - keyApproval, - keyEditApproval, - terminateApprovals, - getApprovalsStatus, - approvals, - getProductInfoSelect, - addKeysBatchInfo, -} from "../../../assets/api.js"; -import Productform from "@/pages/plan/product/add"; -import _ from "lodash"; -import "./edit.less"; -import moment from "moment"; -import { isSameDay } from "date-fns"; -import KnockGold from "@/components/knockGold"; -import UseCouponAddEdit from "@/components/UseCouponAddEdit"; // 优惠券 -import UseExchangeAddEdit from "@/components/UseExchangeAddEdit"; // 兑换码 -import { divNum } from "@/tools/number"; /* 立减金 */ - -const TabPanel = Tabs.TabPanel; - -const initArray = (targetNum) => { - return Array.from({ length: targetNum }, (_, index) => index); -}; - -export default class acclist extends React.Component { - constructor(props) { - super(props); - this.state = { - keys: [ - { - style: 1, - quantity: "", - allow_repetition: 0, - allow_loss: 0, - merge_stock: 1, - code_batch: "", - draw_title: "", - }, - ], - model: { - //数据模型不可少 - plan_title: "", - style: 1, - quantity: "", - allow_repetition: 0, - allow_loss: 0, - merge_stock: 1, - code_batch: "", - draw_title: "", - batch_name: "", - }, - drawerVisible: false, - drawerVisible2: false, - productData: [], - codeInfo: { - //数据模型不可少 - code_name: "", - issued: "", //发放总量 - describe: "", - date_time: "", - range: "", - }, - product_title: "新建商品", - rank: null, - rankoptions: [], - tempdata: [], - distdata: [], - pagetitle: "编辑key", - isEdit: false, - begintime: "", - endtime: "", - isCancel: false, - rowIndex: -1, - paytype: 3, - reseller: null, - payment_direction: ["对私账户", "对公账户", "预付款扣除"], - recall_visible: false, - timer: 3, - plan_id: 0, - key_status: -1, - mobile_excel: "", - mobile_repeat: "", - newGoodsBtnLoading: false, - direct_reseller_id: 0, - addIsType: "", - newGoldLoading: false, - keyType: 1, - couponData: [], - Column: [ - { - 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", - }, - ], - 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: "", - rowExChangeData: "", - id: "", - white_visible: false, - planTime: "", - audit_visible: false, - }; - } - - // key 批次的处理 - keyFormat(data) { - let newData = []; - // 兑换码 - if (Number(data.bind_object[0]) === 1) { - newData = data.code_batch; - } else { - newData = data.coupon; - } - // 注意!!!!!!!!!!7审核驳回 -1创建中 可编辑 status 是优惠券或者兑换码的状态不是key批次状态!!!!!!!!!!!!!!! - let temp = _.map(newData, (o) => { - o.checked = true; - if (o.status && o.status !== -1 && o.status !== 7) { - o.disabled = true; - } - return o; - }); - if (Number(data.bind_object[0]) === 1) { - this.setState({ distdata: temp }); - } else { - this.setState({ couponData: temp }); - } - } - - componentDidMount(e) { - sessionStorage.setItem("knockGoldData", ""); - let batch_id = sessionStorage.getItem("keybatch_id"); - let reseller_id = sessionStorage.getItem("key_reseller_id"); - - let planTime = sessionStorage.getItem("datetime"); - if (planTime) { - this.setState({ planTime: JSON.parse(planTime) }); - console.log("计划时间 =>", JSON.parse(planTime)); - } - - //编辑 - if (batch_id > 0) { - getReseller(reseller_id).then((res) => { - handelResponse(res, (req, msg) => { - this.setState({ reseller: req }); - this.setState({ phone_list: req.contact_phone }); - this.setState({ email_list: req.contact_email }); - this.setState({ - direct_reseller_id: req.direct_reseller_id, - }); - }); - }); - - getKeyBatchDetail(batch_id).then((res) => { - handelResponse( - res, - (req, msg) => { - console.log("详情 =>", req); - if (req.status == 7) { - this.setState({ isCancel: true }); - } - if (req.status == 1) { - this.setState({ isEdit: false }); - } else { - this.setState({ isEdit: true }); - } - this.setState({ key_status: req.status }); - this.setState({ plan_id: req.plan_id }); - this.setState({ pagetitle: "编辑key" }); - - let model = { - style: req.style, - batch_name: req.batch_name, - quantity: req.quantity, - allow_repetition: req.allow_repetition, - allow_loss: req.allow_loss, - stock: req.stock, - code_batch: req.code_batch, - coupon: req.coupon, - plan_title: req.plan_title, - }; - this.setState({ keyType: Number(req.bind_object[0]) }); - this.setState({ model: model }); - this.setState({ endtime: req.end_time }); - this.setState({ begintime: req.begin_time }); - this.setState({ mobile_excel: req.mobile_excel }); - this.setState({ mobile_repeat: req.mobile_repeat }); - this.setState({ status: req.status }); - this.setState({ id: req.id }); - console.log("详情 =>", req); - this.keyFormat(req); - }, - (err) => {} - ); - }); - } - } - - async submit() { - let valide = false; - if (this.state.direct_reseller_id <= 0) { - // 老数据不能进行新增商品操作 - Notify.error(`请添加映射分销商`); - return; - } - if (this.refs.form1.validator()) { - let data = {}; - data.style = this.state.model.style; - data.quantity = this.state.model.quantity; - data.bind_object = [this.state.model.bind_object]; - data.allow_repetition = this.state.model.allow_repetition; - data.allow_loss = this.state.model.allow_loss; - data.stock = this.state.model.stock; - data.code_batch = this.state.distdata; - let formdata = {}; - formdata.step = "key"; - formdata.data = data; - await addPlanStep("", formdata).then((res) => { - handelResponse( - res, - (req, msg) => { - sessionStorage.setItem("plan_id", req.id); - valide = true; - return; - }, - (err) => { - Notify.error(err); - } - ); - }); - } - return valide; - } - Cancel() { - Sweetalert.confirm({ - type: "warning", - closeBtn: true, - title: "确认操作", - content:

是否取消本次操作?

, - onConfirm: () => { - window.history.back(); - }, - onCancel: this.onCancel, - className: "questModal", - parentComponent: this, - }); - } - onCheckChange = (e) => { - this.setState({ keyType: e.target.value }); - }; - - onStyleChange(e) { - let model2 = this.state.model; - model2.style = e.target.value; - this.setState({ model: model2 }); - } - - onRepetitionChange(e) { - let model2 = this.state.model; - model2.allow_repetition = e.target.value; - this.setState({ model: model2 }); - } - - onLossChange(e) { - let model2 = this.state.model; - model2.allow_loss = e.target.value; - this.setState({ model: model2 }); - } - checkIndex(e) { - switch (e) { - case 0: - this.setState({ draw_title: "新建兑换码" }); - break; - case 1: - this.setState({ draw_title: "新建优惠券" }); - break; - case 2: - this.setState({ draw_title: "新建立减金" }); - break; - default: - return; - } - this.setState({ rowIndex: -1 }); - this.setState({ drawerVisible: true }); - if (this.state.keyType === 2) { - setTimeout(() => { - this.refs.addEditCouponEl.clearCouponForm(); - }); - } else { - setTimeout(() => { - this.refs.addEditExChangeEl.clearCouponForm(); - }); - } - sessionStorage.setItem("productData", ""); - sessionStorage.setItem("knockGoldData", ""); - } - closeDraw() { - if (this.state.keyType === 2) { - setTimeout(() => { - this.refs.addEditCouponEl.clearCouponForm(); - }); - } - this.setState({ drawerVisible: false }); - } - - async productSubmit() { - let visible = ""; - if (this.state.addIsType === "addProduct") { - visible = await this.refs.product.submit(); - } else { - visible = await this.refs.knockGold.submit(); - } - if (visible) { - Notify.success("保存成功"); - this.setState({ drawerVisible2: false }); - setTimeout(() => { - let data = null; - let temp = null; - let concatData = []; - /* 处理商品 */ - if (this.state.addIsType === "addProduct") { - data = JSON.parse(sessionStorage.getItem("productData")).filter( - (item) => item.type != 2 - ); - concatData = this.state.tempdata.filter((item) => item.type !== 1); - temp = _.map(data, (item) => { - let index = this.state.tempdata.findIndex((o) => { - return o.product_id == item.product_id; - }); - - if (index > -1) { - item.checked = this.state.tempdata[index].checked; - } - - item.type = 1; - item.only = item.product_id; - item.upstream = "直连天下"; - return item; - }); - } else { - /* 处理立减金 */ - data = JSON.parse(sessionStorage.getItem("knockGoldData")).filter( - (item) => item.type != 1 - ); - concatData = this.state.tempdata.filter((item) => item.type !== 2); - temp = _.map(data, (item) => { - let index = this.state.tempdata.findIndex((o) => { - return o.channel_activity_id === item.channel_activity_id; - }); - - if (index > -1) { - item.checked = this.state.tempdata[index].checked; - } - - /* 转换商品结构 */ - // temp - const newObj = {}; - newObj.product_name = item.batch_goods_name - ? item.batch_goods_name - : item.product_name; //名字 - newObj.channel_activity_id = item.channel_activity_id; //批次号 - newObj.only = item.channel_activity_id; //批次号 - newObj.type = 2; //类型 - newObj.checked = item?.checked; - newObj.upstream = String(item.channel) === "1" ? "支付宝" : "微信"; //上游 - newObj.edit = "edit"; - newObj.effectDate = item.effectDate - ? item.effectDate - : item.time_limit?.effect_time.start_time + - " 至 " + - item.time_limit?.effect_time.end_time; //有效时间 - newObj.contract_price = item.contract_price - ? item.contract_price - : item.price; //单价 - newObj.official_price = item.official_price - ? item.official_price - : item.reduce_amount; //官方价 - newObj.quantity = item.quantity - ? item.quantity - : parseInt(divNum(item.all_budget, item.reduce_amount)); //总库 - newObj.origin = item.origin ? item.origin : item; - newObj.id = item.goods_id ? item.goods_id : item.id; - return newObj; - }); - } - let newArray = deWeightThree(temp.concat(concatData), "only"); - - //select数据 - let arr = []; - let rank = []; - _.map(newArray, (res) => { - arr.push({ key: res.only, text: res.product_name }); - if (res.checked) { - rank.push({ key: res.only, text: res.product_name }); - } - }); - - arr = deWeightThree(arr, "key"); - - this.setState({ tempdata: newArray, rankoptions: arr, rank }); - }, 500); - } - } - - onChangeCombinedDate(e) { - let model2 = this.state.codeInfo; - model2.date_time = e; - this.setState({ codeInfo: model2 }); - } - submit2() { - this.refs.form2.validator(); - } - onRankChange(e) { - _.forEach(this.state.tempdata, (item) => { - item.checked = - e.findIndex((checks) => { - return checks.key == item.only; - }) > -1; - }); - this.setState({ tempdata: this.state.tempdata }); - this.setState({ rank: e }); - } - - onUploadChange1(file, row) { - if (file.length > 0 && file[0].status == "success") { - let rowIndex = this.state.tempdata.findIndex((o) => { - return o.product_id == row.product_id; - }); - this.state.tempdata[rowIndex].show_url = file[0].src; - this.setState({ tempdata: this.state.tempdata }); - } - } - onUploadChange2(file, row) { - if (file.length > 0 && file[0].status == "success") { - let rowIndex = this.state.tempdata.findIndex((o) => { - return o.product_id == row.product_id; - }); - - this.state.tempdata[rowIndex].describe_url = file[0].src; - this.setState({ tempdata: this.state.tempdata }); - } - } - - codeSubmit() { - // 优惠券数据 - if (this.state.keyType === 2) { - let coupon_validator = this.refs.addEditCouponEl.submit(); - if (coupon_validator) { - let param = this.refs.addEditCouponEl.getModel(); - console.log("param =>", param); - 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; - } else { - // 兑换码 - let ex_validator = this.refs.addEditExChangeEl.submit(); - if (ex_validator) { - let param = this.refs.addEditExChangeEl.getModel(); - console.log("兑换码 param =>", param); - let tempdata = this.state.distdata; - // 优惠券编辑 - if (this.state.rowIndex > -1) { - tempdata[this.state.rowIndex] = param; - this.setState({ distdata: tempdata }); - } else { - // 优惠券新增 - tempdata.push(param); - this.setState({ distdata: tempdata }); - } - this.setState({ - drawerVisible: false, - }); - } - } - } - onAddKey() { - let obj = { - style: "1", - quantity: "", - allow_repetition: "1", - allow_loss: "1", - merge_stock: "1", - code_batch: "", - draw_title: "", - }; - let keys = this.state.keys; - keys.push(obj); - - this.setState({ keys: keys }); - } - - onReCall() { - let approval_id = sessionStorage.getItem("approval_id"); - this.setState({ recall_visible: false }); - if (approval_id > 0) { - terminateApprovals(approval_id).then((res) => { - handelResponse( - res, - (req, msg) => { - this.setState({ approvalLoading: true }); - let timer_c = setInterval(() => { - if (this.state.timer <= 0) { - clearInterval(timer_c); - this.setState({ approvalLoading: false }); - Notify.success("撤销成功,请重新提交审核"); - } - let time = this.state.timer - 1; - this.setState({ timer: time }); - }, 1000); - }, - (err) => { - Notify.error(err); - } - ); - }); - } - } - - onSubmit() { - this.setState({ audit_visible: true }); - } - - onConfirm() { - // 判断类型 keyType 1兑换码 2优惠券 - if (this.state.keyType === 1) { - this.exchangeSubmit(); - } else { - this.couponSubmit(); - } - } - - /** - * - * @param {0新增addKeysBatchInfo,1编辑keyEditApproval} apiType - * @param {*} data - */ - couponExchangeSubmitApi(apiType, data) { - let keybatch_id = sessionStorage.getItem("keybatch_id"); - if (apiType === 0) { - let create_param = { - id: this.state.id, - 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, - 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) { - create_param.code_batch = data; - } else { - create_param.coupon = data; - } - addKeysBatchInfo(this.state.plan_id, create_param).then((res) => { - handelResponse( - res, - (req, msg) => { - Notify.success("成功发起审批"); - setTimeout(() => { - window.history.back(); - }, 1000); - }, - (err) => { - Notify.error(err); - } - ); - }); - } else { - let edit_param = { - 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) { - edit_param.code_batch = data; - } else { - edit_param.coupon = data; - } - keyEditApproval(keybatch_id, edit_param).then((res) => { - handelResponse( - res, - (req, msg) => { - Notify.success("成功发起审批"); - setTimeout(() => { - window.history.back(); - }, 1000); - }, - (err) => { - Notify.error(err); - } - ); - }); - } - } - - // 优惠券 - couponSubmit() { - // 第一步:整理数据 编辑优惠券数据 - let editCouponData = this.state.couponData.filter( - (item) => - item.checked === true && - (item.status === -1 || item.status === 7 || item.id === "" || !item.id) - ); - // 第二步:是否是 创建中或者驳回 - if (this.state.key_status === 1) { - // 第三步:是否有原数据 - let couponArr = this.state.couponData.filter( - (item) => item.id && item.id !== "" - ); - if (couponArr.length > 0) { - // 编辑接口 - this.couponExchangeSubmitApi(1, editCouponData); - } else { - // 新增接口 - let addCouponData = this.state.couponData.filter( - (item) => item.checked === true && !item.id - ); - this.couponExchangeSubmitApi(0, addCouponData); - } - } else { - // 其它状态 - this.couponExchangeSubmitApi(1, editCouponData); - } - } - - // 兑换码 - exchangeSubmit() { - // 第一步:整理数据 编辑兑换码数据 - let editExchangeData = this.state.distdata.filter( - (item) => - item.checked === true && - (item.status === -1 || item.status === 7 || item.id === "" || !item.id) - ); - - // 第二步:是否是 创建中或者驳回 - if (this.state.key_status === 1) { - // 第三步:是否有原数据 - let arr = editExchangeData.filter((item) => item.id && item.id !== ""); - if (arr.length > 0) { - // 编辑接口 - this.couponExchangeSubmitApi(1, editExchangeData); - } else { - // 新增接口 - let addArr = this.state.distdata.filter( - (item) => item.checked === true && !item.id - ); - this.couponExchangeSubmitApi(0, addArr); - } - } else { - // 其它状态 - this.couponExchangeSubmitApi(1, editExchangeData); - } - } - - 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) => { - let str = moment(val).format("YYYY-MM-DD HH:mm:ss"); - - let now = moment(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss"); - let isBetween = moment(str).isBetween(now, this.state.endtime, null, "(]"); - return !isBetween; - }; - - onNameChange(e, row, rowIndex) { - this.state.tempdata[rowIndex].product_name = e.target.value; - - let arr = _.map(this.state.tempdata, (res) => { - let obj = {}; - obj.key = res.product_id; - obj.text = res.product_name; - return obj; - }); - this.setState({ rankoptions: arr }); - this.setState({ rank: arr }); - this.setState({ tempdata: this.state.tempdata }); - } - onQuantityChange(e, row, rowIndex) { - let value = e.target.value == "" ? 0 : e.target.value; - - this.state.tempdata[rowIndex].quantity = value; - this.setState({ tempdata: this.state.tempdata }); - } - onPriceChange(e, row, rowIndex) { - let str = e.target.value; - let value = str - .replace(/[^\d^\.]+/g, "") - .replace(".", "$#$") - .replace(/\./g, "") - .replace("$#$", "."); - - this.state.tempdata[rowIndex].contract_price = value; - this.setState({ tempdata: this.state.tempdata }); - } - - rowItemClick(row, rowIndex) { - console.log("row =>", row); - // 编辑兑换码 - if (this.state.keyType === 1) { - this.setState({ - draw_title: "编辑兑换码", - rowIndex: rowIndex, - rowExChangeData: row, - drawerVisible: true, - }); - } else { - this.setState({ - draw_title: "编辑优惠券", - rowIndex: rowIndex, - rowCouponData: row, - drawerVisible: true, - }); - } - } - - onUpload = (file, report) => { - return new Promise((resolve, reject) => { - let path = ""; - let formdata = new FormData(); - formdata.append("file", file); - formdata.append("path", "common_image"); - uploadImg(formdata).then((res) => { - handelResponse( - res, - (req, msg) => { - path = req.path; - }, - (err) => { - reject(); - } - ); - }); - - let count = 0; - const update = () => { - if (path) { - resolve(path); - } else { - if (count < 100) { - count += 2; - report(count); - setTimeout(update, 500); - } else { - reject(); - } - } - }; - setTimeout(update, 500); - }); - }; - - onDisabledTime = (date, type) => { - const min = new Date(); - const hour = min.getHours(); - const minute = min.getMinutes(); - const second = min.getSeconds(); - const isSame = isSameDay(date, min); - - return isSame - ? { - disabledHours: () => initArray(hour), - disabledMinutes: (hourValue) => - hourValue === hour ? initArray(minute) : [], - disabledSeconds: (hourValue, minuteValue) => - hourValue === hour && minuteValue === minute - ? initArray(second) - : [], - } - : {}; - }; - - onDisabledRange = (date, type) => { - let isdisabled = false; - let str = moment(date).format("YYYY-MM-DD HH:mm:ss"); - let beign_time = this.state.codeInfo.date_time[0]; - let end_time = this.state.codeInfo.date_time[1]; - if (type == "start") { - isdisabled = - moment(str).isBefore(beign_time) || moment(str).isAfter(end_time); - } - - if (type == "end") { - isdisabled = - moment(str).isBefore(beign_time) || moment(str).isAfter(end_time); - } - return isdisabled; - }; - onPayTypeChange(e) { - this.setState({ paytype: e.target.value }); - } - - keyProductClick(row, index) { - console.log("keyProductClick 13==>", row); - if (this.state.direct_reseller_id > 0) { - /* 区分立减金 */ - if (row.type === 2) { - this.setState({ - product_title: "编辑立减金", - productData: row.origin, - addIsType: "addKnockGold", - drawerVisible2: true, - }); - } else { - this.setState({ - product_title: "编辑商品", - productData: row, - addIsType: "addProduct", - drawerVisible2: true, - }); - } - } else { - // 老数据不能进行新增商品操作 - Notify.error(`请添加映射分销商`); - return; - } - } - - render() { - //校验规则 - const rules = { - bind_object: [{ type: "required", message: "请选择绑定类型" }], - }; - - const Column2 = [ - { - title: "商品ID", - name: "product_id", - prop: "product_id", - width: "auto", - type: "normal", - }, - { - title: "商品名称", - width: "auto", - prop: "product_name", - name: "product_name", - type: "normal", - }, - { - title: "立减金平台批次号", - width: "250px", - prop: "channel_activity_id", - name: "channel_activity_id", - type: "normal", - }, - { - title: "类型", - width: "auto", - prop: "type", - name: "type", - type: "slot", - }, - { - title: "上游平台", - width: "auto", - prop: "upstream", - name: "upstream", - type: "normal", - }, - { - title: "有效时间段", - width: "575px", - prop: "effectDate", - name: "effectDate", - type: "normal", - }, - { - title: "当前成本价格", - prop: "cost_price", - name: "cost_price", - width: "200px", - type: "slot", - }, - { - title: "合同价", - name: "contract_price", - prop: "contract_price", - type: "normal", - width: "auto", - }, - { - title: "商品官方价", - type: "normal", - prop: "official_price", - width: "auto", - }, - { - title: "库存", - type: "normal", - prop: "quantity", - width: "auto", - }, - { - title: "操作", - prop: "edit", - name: "edit", - type: "slot", - width: "auto", - }, - ]; - - //基本信息 - const codeInfo = { - code_name: [{ type: "required", message: "请输入兑换码名称" }], - issued: [ - { type: "required", message: "请输入发放总量" }, - { - type: "regExp", - message: "请输入正整数", - reg: "^([1-9][0-9]*){1,3}$", - }, - ], - }; - - //基本规则 - const rulesInfo = { - date_time: [{ type: "required", message: "请选择生效时间段" }], - 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.state.model.plan_title}
-
- - - { - let model2 = this.state.model; - model2.batch_name = e; - this.setState({ model: model2 }); - }} - onClearItem={(e) => { - let model2 = this.state.model; - model2.batch_name = ""; - this.setState({ model: model2 }); - }} - value={this.state.model.batch_name} - placeholder={"请输入"} - labelWidth={"0px"} - maxLength={12} - height={"36px"} - width={"400px"} - alignment={"left"} - /> - - - { - this.onStyleChange(e); - }} - value={this.state.model.style} - disabled={this.state.isEdit} - > - - 串码 - - - 链接 - - - 二维码 - - - 白名单 - - - - - {this.state.white_visible ? ( - - ) : null} - - - {this.state.key_status === 1 ? ( - { - let model2 = this.state.model; - model2.quantity = e; - this.setState({ model: model2 }); - }} - value={this.state.model.quantity} - disabled={this.state.model.style == 6} - placeholder={"请输入"} - labelWidth={"0px"} - maxLength={5} - height={"36px"} - width={"400px"} - alignment={"left"} - /> - ) : ( -
{this.state.model.quantity}
- )} -
- - {this.state.key_status === 1 ? null : ( - -
{this.state.model.stock}
-
- )} - - - { - this.onCheckChange(e); - }} - > - 兑换码 - 优惠券 - - - - - {this.state.keyType === 1 ? ( - - ) : ( - - )} - - - - { - this.pageChange(e); - }} - checkChange={(selection) => {}} - ComponentHandler={(com, rowData, rowIndex) => { - if (com == "restrict") { - return ( - { - this.onBindNum(e, rowData, rowIndex); - }} - disabled={rowData.disabled} - /> - ); - } - // 优惠券范围 - if (com === "product") { - return coupon_range(rowData.product); - } - if (com == "edit") { - let str = ( - { - this.rowItemClick(rowData, rowIndex); - }} - style={{ color: "#2B66F2" }} - > - 编辑 - - ); - let str1 = 编辑; - - return rowData.disabled ? str1 : str; - } - }} - /> - - - this.onRepetitionChange(e)} - value={this.state.model.allow_repetition} - > - - - - - - - this.onLossChange(e)} - value={this.state.model.allow_loss} - > - - - - -
-
- -
- {this.state.isCancel ? null : ( - - )} - - -
- - - - -
- } - visible={this.state.drawerVisible} - onClose={(e) => { - this.closeDraw(); - }} - maskClosable={false} - > - {this.state.keyType === 1 ? ( - - ) : ( - - )} - - - - - - } - visible={this.state.drawerVisible2} - onClose={(e) => { - this.setState({ drawerVisible2: false }); - }} - maskClosable={false} - > -
- - {this.state.addIsType === "addKnockGold" ? ( - - ) : ( - - )} - -
-
- {this.state.audit_visible ? ( -
-
-
- { - this.setState({ audit_visible: false }); - }} - /> -
提交审核
-
- { - this.onPayTypeChange(e); - }} - value={this.state.paytype} - className="audit-obj" - > - 预付款扣除 - 对私账户 - 对公账户 - -
-
- - -
-
-
- ) : null} - - {this.state.recall_visible ? ( -
-
-
- { - this.setState({ recall_visible: false }); - }} - /> -
当前正在审核中
-
- 提交审核会将原来审批撤回才可进行提交,是否撤回? -
-
- - -
-
-
- ) : null} - {this.state.approvalLoading ? ( -
-
-
-
撤销审批中
-
- 正在发起撤销...,请等待 - {this.state.timer}秒 -
-
-
- ) : null} - - ); - } -} diff --git a/src/pages/plan/key/list.js b/src/pages/plan/key/list.js index 74e4e1f0..df61de1d 100644 --- a/src/pages/plan/key/list.js +++ b/src/pages/plan/key/list.js @@ -308,7 +308,6 @@ export default class acclist extends React.Component { handelResponse( res, (req, msg) => { - console.log("req =>", req); if (req.data.length > 0) { sessionStorage.setItem("keyType", req.data[0].bind_object[0]); }