diff --git a/src/components/subnav/main.js b/src/components/subnav/main.js index 361dbb26..df8e3845 100644 --- a/src/components/subnav/main.js +++ b/src/components/subnav/main.js @@ -90,6 +90,7 @@ export default class topNav extends React.Component { pathnamestr.includes('add') || pathnamestr.includes('aid') || pathnamestr.includes('exchangecode-copyCode') || + pathnamestr.includes('exchangecode-exchangecodeAdd') || pathnamestr.includes('distributor-edit') || pathnamestr.includes('key-list') || pathnamestr.includes('key-detail') || diff --git a/src/pages/exchangecode/exchangecodeAdd/index.jsx b/src/pages/exchangecode/exchangecodeAdd/index.jsx new file mode 100644 index 00000000..9b3f0d68 --- /dev/null +++ b/src/pages/exchangecode/exchangecodeAdd/index.jsx @@ -0,0 +1,1330 @@ +import React from 'react' +import Ipt from '@/components/input/main' +import Form from '@/components/form/main' +import FormItem from '@/components/form-item/main' +import { deWeightThree } from '@/utils' +import { + Card, + Radio, + Icon, + Drawer, + Select, + Button, + DateRangePicker, + Sweetalert, + RadioGroup, + Notify, + Input, + BlockLoading +} from 'zent' +import Bus from '@/assets/eventBus.js' +import { + getIsRequireApproval, + getApprovalsStatus, + getReseller, + getApprovalsInfo, + terminateApprovals, + getProductInfoSelect, + handelResponse, + uploadImg, + getCodesDetail, + putCodesBatch +} from '@/assets/api.js' +import _ from 'lodash' +import ProductForm from '../product/add' /* 商品 */ +import KnockGold from '@/components/knockGold' /* 立减金 */ +import './index.less' +import moment from 'moment' +import Grid from '@/components/gird/main.js' +import { isSameDay } from 'date-fns' +import { Column2, rulesInfo, codeInfo } from './utils' +const initArray = (targetNum) => { + return Array.from({ length: targetNum }, (_, index) => index) +} + +export default class exchangeAdd extends React.Component { + constructor(props) { + super(props) + this.state = { + uploading: false, //上传中 + model: { + //数据模型不可少 + product_id: '', + product_type: '1', + contract_price: '', + official_price: '', + cost_price: '', + quantity: '', + product_name: '', + show_url: '', + describe_url: '', + detail_url: '', + weight: '0' + }, + codeInfo: { + //数据模型不可少 + code_name: '', + issued: '', //发放总量 + describe: '', + date_time: '', + range: '', + stock: '' + }, + isload: false, + tempdata: [], + oldProduct: [], + deleteProduct: [], //审批删除的商品 + new_product: [], + cur_product: null, + productOption: [], + rankoptions: [], + rank: [], + recall_visible: false, + approvalLoading: false, + timer: 3, + paytype: 3, + reseller: null, + payment_direction: ['对私账户', '对公账户', '预付款扣除'], + isAudit: false, + approvalsStatus: false, + oldTable: [], + product_title: '新建商品', + plan_time: '', + direct_reseller_id: 0, + newGoodsBtnLoading: false, + tableLoading: false, + newGoldLoading: false, + addIsType: '', + isState: 0 + } + } + + componentDidMount(e) { + const isState = sessionStorage.getItem('isState') /*复制1 编辑2 */ + this.setState({ isState }) + if (~~isState === 1) { + /* 复制 */ + } else if (~~isState === 2) { + /* 编辑 */ + this.editFunction() + } else { + /* 新增 */ + } + } + + /* 编辑处理数据 */ + editFunction() { + let code_batch_id = sessionStorage.getItem('code_id') + let approval_id = sessionStorage.getItem('approval_id') + let approval_status = sessionStorage.getItem('approval_status') + if (Number(approval_id) > 0) { + //此处为审核中 + getApprovalsInfo(approval_id) + .then((res) => { + handelResponse( + res, + (req, msg) => { + let resller_obj = { + id: req.reseller_id, + name: req.reseller_name, + company_name: req.company_name, + receive_email: req.receive_email + } + + //获取分销商 + getReseller(req.reseller_id).then((res) => { + handelResponse(res, (req1, msg) => { + req1.receive_email = req1.contact_email[0] + this.setState({ reseller: req1 }) + this.setState({ phone_list: req1.contact_phone }) + this.setState({ email_list: req1.contact_email }) + this.setState({ + direct_reseller_id: req1.direct_reseller_id + }) + }) + }) + + this.setState({ reseller: resller_obj }) + + req.update_product = [...this.transFormData1(req.update_product)] + req.new_product = [...this.transFormData1(req.new_product, true)] + + let codeInfo = { + code_name: req.title, + issued: req.quantity, + stock: req.stock, + describe: req.describe, + date_time: [req.begin_time, req.end_time], + range: req.update_product + } + + if (req.new_product.length > 0) { + req.new_product = _.map(req.new_product, (item) => { + item.checked = false + return item + }) + codeInfo.range = codeInfo.range.concat(req.new_product) + } + + let new_ids = _.map(req.new_product, (o) => { + return o.only + }) + + this.setState({ new_product: new_ids }) + let delete_product = req.delete_product + let payment_direction = req.payment_direction + getCodesDetail(code_batch_id) + .then((res) => { + handelResponse( + res, + (req, msg) => { + codeInfo.stock = req.stock + this.setState({ plan_time: req.plan.end_time }) + let reqCopy = _.cloneDeep(req) + const resData = this.transFormData(reqCopy) + this.setState({ oldTable: resData }) + let deleteArr = [] + + for (let i = 0; i < delete_product.length; i++) { + let deleteData = resData.find( + (o) => o.only == delete_product[i] + ) + deleteData.checked = false + deleteArr.push(deleteData) + } + this.setState({ codeInfo: codeInfo }) + this.setState({ isload: true }) + codeInfo.range = codeInfo.range.concat(deleteArr) + let table = _.map(codeInfo.range, (res) => { + let obj = resData.find((o) => o.only == res.only) + + res.usage = obj ? obj.usage : 0 + res.stock = obj ? obj.stock : res.quantity - res.usage + res.checked = res.hasOwnProperty('checked') + ? res.checked + : true + if (approval_status == 7 && obj) { + res.checked = true + } + + return res + }) + + this.setState({ deleteProduct: [] }) + + this.setState({ tempdata: codeInfo.range }) + + let arr = [] + let temp = [] + _.map(codeInfo.range, (res) => { + let obj = {} + obj.key = res.only + obj.text = res.product_name + if (new_ids.indexOf(res.only) < 0) { + this.state.oldProduct.push(res.id) + } + if ( + table.find((o) => o.only == res.only).checked == true + ) { + temp.push(obj) + } + arr.push(obj) + return obj + }) + + this.setState({ rankoptions: arr }) + this.setState({ rank: temp }) + + if (payment_direction) { + let index = + this.state.payment_direction.indexOf( + payment_direction + ) + this.setState({ paytype: index + 1 }) + } + sessionStorage.setItem( + 'productData', + JSON.stringify(codeInfo.range) + ) + sessionStorage.setItem( + 'knockGoldData', + JSON.stringify(codeInfo.range) + ) + }, + (err) => {} + ) + }) + .catch((err) => {}) + }, + (err) => {} + ) + }) + .catch((err) => {}) + } else { + getCodesDetail(code_batch_id) + .then((res) => { + handelResponse( + res, + (req, msg) => { + let reqCopy = _.cloneDeep(req) + const resData = this.transFormData(reqCopy) + reqCopy.goods = resData + let codeInfo = { + code_name: reqCopy.title, + issued: reqCopy.quantity, + stock: reqCopy.stock, + describe: reqCopy.describe, + date_time: [reqCopy.begin_time, reqCopy.end_time], + range: reqCopy.goods + } + + this.setState({ plan_time: reqCopy.plan.end_time }) + //获取分销商 + getReseller(reqCopy.plan.reseller_id).then((res) => { + handelResponse(res, (req1, msg) => { + req1.receive_email = req1.contact_email[0] + this.setState({ reseller: req1 }) + this.setState({ phone_list: req1.contact_phone }) + this.setState({ email_list: req1.contact_email }) + this.setState({ + direct_reseller_id: req1.direct_reseller_id + }) + }) + }) + + this.setState({ codeInfo: codeInfo }) + this.setState({ isload: true }) + _.map(reqCopy.goods, (res) => { + res.checked = true + return res + }) + this.setState({ tempdata: reqCopy.goods || [] }) + + let a1 = reqCopy.goods.map((item) => { + let obj = { + ...item, + in: true + } + return obj + }) + sessionStorage.setItem('productData', JSON.stringify(a1)) + sessionStorage.setItem('knockGoldData', JSON.stringify(a1)) + + let arr = [] + _.map(reqCopy.goods, (res) => { + let obj = {} + obj.key = res.only + obj.text = res.product_name + obj.id = res.id + this.state.oldProduct.push(res.id) + arr.push(obj) + return obj + }) + this.setState({ rankoptions: arr }) + this.setState({ rank: arr }) + }, + (err) => {} + ) + }) + .catch((err) => {}) + } + } + + // 立减金 加款后 商品范围列表数据进行变动 + getTableList() { + if (sessionStorage.getItem('addMoneyData')) { + const addMoneyData = JSON.parse(sessionStorage.getItem('addMoneyData')) + const tempdata = _.cloneDeep(this.state.tempdata).map((item) => { + addMoneyData.map((item1) => { + if (item.channel_activity_id === item1.channel_activity_id) { + item.origin.recharge_amount = item1.recharge_amount + } + }) + return item + }) + this.setState({ tempdata }) + } + } + + transFormData1(req, type) { + const newData = [] + /* 转换数据结构 */ + req.legal.map((item1) => { + item1.type = 1 + item1.only = item1.product_id + item1.upstream = '直连天下' + if (item1?.goods_id) { + item1.id = item1.goods_id + } + newData.push(item1) + }) + + req.reduce.map((item1) => { + let obj = {} + obj.type = 2 + obj.only = item1.channel_activity_id + obj.upstream = String(item1.channel) === '1' ? '支付宝' : '微信' //上游 + obj.origin = item1 + if (item1?.goods_id) { + obj.id = item1?.goods_id + } + obj.product_id = item1?.goods_id + obj.product_type_text = '立减金' + obj.contract_price = item1.price + obj.create_time = item1.create_time + obj.official_price = item1.reduce_amount + obj.channel_activity_id = item1.channel_activity_id + obj.product_name = item1.batch_goods_name + if (type) { + obj.quantity = Math.trunc(item1.all_budget / item1.reduce_amount) + obj.stock = Math.trunc(item1.all_budget / item1.reduce_amount) + obj.usage = 0 + } else { + obj.quantity = item1.stock + obj.stock = Math.trunc( + item1.all_budget / item1.reduce_amount - + item1.used_amount / item1.reduce_amount + ) + obj.usage = Math.trunc( + item1.all_budget / item1.reduce_amount - + (item1.all_budget - item1.used_amount) / item1.reduce_amount + ) + } + obj.effectDate = + item1.time_limit.effect_time.start_time + + ' 至 ' + + item1.time_limit.effect_time.end_time + newData.push(obj) + }) //有效时间 + return newData + } + + /* 转换数据 */ + transFormData(reqCopy) { + const resData = [] + reqCopy.goods.map((item) => { + /* type 1为商品 2为立减金 转译字符方便处理 */ + /* 此处only 商品为product_id 立减金为channel_activity_id */ + if (item.type === 1) { + item.entity.upstream = '直连天下' + item.entity.only = item.entity.product_id + item.entity.id = item.id + item.entity.type = item.type + item.entity.weight = item.weight + resData.push(item.entity) + } else if (item.type === 2) { + item.entity.weight = item.weight + resData.push({ + origin: item.entity, + type: item.type, + product_id: item.entity.goods_id, + product_type_text: '立减金', + only: item.entity.channel_activity_id, + id: item.entity.goods_id, + upstream: String(item.entity.channel) === '1' ? '支付宝' : '微信', + code_batch_id: item.code_batch_id, + contract_price: item.entity.price, + create_time: item.create_time, + official_price: item.entity.reduce_amount, + channel_activity_id: item.entity.channel_activity_id, + product_name: item.entity.batch_goods_name, + quantity: item.entity.stock, + stock: Math.trunc( + item.entity.all_budget / item.entity.reduce_amount - + item.entity.used_amount / item.entity.reduce_amount + ), + usage: Math.trunc( + item.entity.all_budget / item.entity.reduce_amount - + (item.entity.all_budget - item.entity.used_amount) / + item.entity.reduce_amount + ), + effectDate: + item.entity.time_limit.effect_time.start_time + + ' 至 ' + + item.entity.time_limit.effect_time.end_time //有效时间 + }) + } + }) + + return resData + } + + /* select事件 */ + 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 }) + } + + cancel() { + //取消二次弹出框 + Sweetalert.confirm({ + type: 'warning', + closeBtn: true, + title: '确认操作', + content:
是否取消本次操作?
, + onConfirm: () => { + window.location.replace('#/home/exchangecode-list') + }, + onCancel: this.onCancel, + className: 'questModal', + parentComponent: this + }) + } + + buildData() { + let code_batch_id = sessionStorage.getItem('code_id') + + let range = [] + _.map(this.state.rank, (o) => { + // if(this.state.oldProduct.indexOf(o.key) < 0) + // { + range.push(o.text) + // } + }) + let selectData = this.refs.tempdata.getSelectData() + let addProduct = selectData.filter((o) => { + return this.state.oldProduct.indexOf(o.id) < 0 + }) + + let updateIds = [] + let updateProduct = [] + _.map(selectData, (o) => { + if (this.state.oldProduct.indexOf(o.id) > -1) { + updateIds.push(o.id) + let _object = {} + if (o.type === 1) { + _object.contract_price = o.contract_price + _object.cost_price = o.cost_price + _object.describe_url = o.describe_url + _object.official_price = o.official_price + _object.product_id = o.product_id + _object.account_type = o.account_type + _object.product_name = o.product_name + _object.product_type = o.product_type + _object.weight = o.weight + _object.quantity = o.quantity + _object.show_url = o.show_url + _object.detail_url = o.detail_url + _object.map_product_name = o.map_product_name + _object.goods_id = o.goods_id + _object.type = o.type + } else { + _object = { ...o.origin, type: o.type } + } + updateProduct.push(_object) + } + }) + + let deleteProduct = _.differenceWith( + this.state.oldProduct, + updateIds, + _.isEqual + ) + + deleteProduct = deleteProduct.filter((item) => { + return this.state.new_product.indexOf(item) < 0 + }) + + if (this.state.deleteProduct.length > 0) { + deleteProduct = deleteProduct.concat(this.state.deleteProduct).map(Number) + } + + updateIds = _.map(updateProduct, (o) => { + return o.only + }) + + deleteProduct = _.filter(deleteProduct, (o) => { + return updateIds.indexOf(o) < 0 + }) + + /* 处理新增数据 */ + const addProductCopy = { legal: [], reduce: [] } + addProduct.map((item) => { + if (item.type === 2) { + if (item.origin) { + addProductCopy.reduce.push(item.origin) + } + } else { + addProductCopy.legal.push(item) + } + }) + + /* 处理原有数据数据 */ + const updateProductCopy = { legal: [], reduce: [] } + updateProduct.map((item) => { + if (item.type === 2) { + updateProductCopy.reduce.push(item) + } else { + updateProductCopy.legal.push(item) + } + }) + + let 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.receive_email, + payment_direction: this.state.payment_direction[this.state.paytype - 1], + title: this.state.codeInfo.code_name, + range: range, + describe: this.state.codeInfo.describe, + begin_time: this.state.codeInfo.date_time[0], + end_time: this.state.codeInfo.date_time[1], + quantity: this.state.codeInfo.issued, + new_product: addProductCopy, + update_product: updateProductCopy, + delete_product: deleteProduct + } + + return { data, addProduct, updateProduct } + } + + submitCodeData() { + if (!this.state.reseller) { + Notify.error('该兑换码对应分销商不存在') + return + } + + let code_batch_id = sessionStorage.getItem('code_id') + let { data } = this.buildData() + putCodesBatch(code_batch_id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + let model2 = this.state.model + model2.show_url = req.path + this.setState({ model: model2 }) + + Notify.clear() + Notify.success(msg) + setTimeout(() => { + window.location.replace('#/home/exchangecode-list') + }, 1000) + }, + (error) => { + Notify.error(error) + } + ) + }) + } + + submit() { + // if (this.state.direct_reseller_id <= 0) { + // // 老数据不能进行新增商品操作 + // Notify.error(`请添加映射分销商`) + // return + // } + if (this.refs.code_info.validator() && this.refs.code_rule.validator()) { + if (this.state.uploading) { + Notify.error('还有图片上传中,不可提交') + return + } + let code_batch_id = sessionStorage.getItem('code_id') + let { data, addProduct, updateProduct } = this.buildData() + + if ([...updateProduct, ...addProduct].length < 1) { + return Notify.error('请绑定对象') + } + + let approval_id = sessionStorage.getItem('approval_id') + + if (Number(approval_id) <= 0) { + //非审核中状态 + getIsRequireApproval(code_batch_id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + if (req.is_require_approval) { + this.setState({ audit_visible: true }) + } else { + this.submitCodeData() + } + }, + (err) => { + Notify.error(err) + } + ) + }) + } else { + getApprovalsStatus(approval_id).then((res) => { + handelResponse( + res, + (req, msg) => { + if (req.status == 0) { + this.setState({ approvalsStatus: true }) + this.setState({ recall_visible: true }) + } + if (req.status == 1 || req.status == 2 || req.status == 3) { + getIsRequireApproval(code_batch_id, data).then((res) => { + handelResponse( + res, + (req, msg) => { + if (req.is_require_approval) { + this.setState({ audit_visible: true }) + } else { + this.submitCodeData() + } + }, + (err) => { + Notify.error(err) + } + ) + }) + } + }, + (err) => { + Notify.error(err) + } + ) + }) + } + } + } + + onConfirm() { + this.setState({ audit_visible: false }) + this.submitCodeData() + } + + addProduct(type) { + this.setState({ addIsType: type }) /* 类型 */ + let direct_reseller_ids = this.state.direct_reseller_id + if (direct_reseller_ids <= 0) { + // 老数据不能进行新增商品操作 + Notify.error(`请添加映射分销商`) + return + } + if (type === 'addProduct') { + this.setState({ product_title: '新建商品', newGoodsBtnLoading: true }) + } else { + this.setState({ product_title: '新增立减金', newGoldLoading: true }) + } + let param = { + reseller_id: direct_reseller_ids + } + try { + getProductInfoSelect(param).then((res) => { + if (res.code === 200) { + sessionStorage.setItem('productsList', JSON.stringify(res.data.data)) + this.setState({ productData: null }) + this.setState({ drawerVisible2: true }) + } + if (type === 'addProduct') { + this.setState({ newGoodsBtnLoading: false }) + } else { + this.setState({ newGoldLoading: false }) + } + }) + } catch (err) { + if (type === 'addProduct') { + this.setState({ newGoodsBtnLoading: false }) + } else { + this.setState({ newGoldLoading: false }) + } + } + } + + onChangeCombinedDate(e) { + let model2 = this.state.codeInfo + model2.date_time = e + this.setState({ codeInfo: model2 }) + } + + //渲染范围列表数据以及数据转换 + async productSubmit() { + let visible = '' + if (this.state.addIsType === 'addProduct') { + visible = await this.refs.product.submit() + } else { + visible = await this.refs.knockGold.submit() + } + + if (visible) { + 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 + : Math.trunc(item.all_budget / item.reduce_amount) //总库 + newObj.stock = item.quantity + ? item.quantity + : Math.trunc(item.all_budget / item.reduce_amount) //剩余 + newObj.usage = 0 //已使用 + 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 }) + this.getTableList() + }, 500) + } + } + + onDisabledTime = (date) => { + 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') + + if (type == 'end') { + isdisabled = moment(str).isAfter(this.state.plan_time) + } + return isdisabled + } + + onReCall() { + let approval_id = sessionStorage.getItem('approval_id') + this.setState({ recall_visible: false }) + 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) + } + ) + }) + } + + // 获取直连天下商品数据 + getProductInfoSelectData(reseller_id) { + return new Promise((resolve, reject) => { + let param = { + reseller_id: reseller_id + } + getProductInfoSelect(param).then((res) => { + if (res.code === 200) { + resolve(res.data.data) + } else { + reject([]) + } + }) + }) + } + + /* 商品范围列表编辑 */ + productEditShow(rowData) { + if (this.state.direct_reseller_id > 0) { + this.setState({ + tableLoading: true + }) + this.getProductInfoSelectData(this.state.direct_reseller_id).then( + (data) => { + sessionStorage.setItem('productsList', JSON.stringify(data)) + /* 区分立减金 */ + if (rowData.type === 2) { + let temp = rowData.origin + this.setState({ + product_title: '编辑立减金', + productData: temp, + addIsType: 'addKnockGold' + }) + } else { + this.setState({ + product_title: '编辑商品', + productData: rowData, + addIsType: 'addProduct' + }) + } + setTimeout(() => { + this.setState({ + tableLoading: false + }) + this.setState({ drawerVisible2: true }) + }, 300) + } + ) + } else { + // 老数据不能进行新增商品操作 + Notify.error(`请添加映射分销商`) + return + } + } + + render() { + return ( +