From f0125555af8eda1639b17711c77f087b982e1622 Mon Sep 17 00:00:00 2001 From: zhangds Date: Tue, 19 Apr 2022 16:10:16 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=89=20=E4=BF=AE=E6=94=B9=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangecode/commodity/goodedit.js | 1434 +++++++++--------- src/pages/exchangecode/product/add copy.js | 2 +- src/pages/exchangecode/product/add.js | 2 +- src/pages/plan/add/step2.js | 2 +- src/pages/plan/product/add.js | 2 +- 5 files changed, 724 insertions(+), 718 deletions(-) diff --git a/src/pages/exchangecode/commodity/goodedit.js b/src/pages/exchangecode/commodity/goodedit.js index fd82e7cd..c03c6f38 100644 --- a/src/pages/exchangecode/commodity/goodedit.js +++ b/src/pages/exchangecode/commodity/goodedit.js @@ -1,735 +1,741 @@ -import ReactDOM from 'react-dom'; -import React from "react" -import Ipt from "../../../components/input/main" -import Form from "../../../components/form/main" -import FormItem from "../../../components/form-item/main" -import {Card, Select,Button,ImageUpload ,onUpload,Sweetalert,RadioButton,RadioGroup,Notify} from "zent" -import Bus from "../../../assets/eventBus.js" -import {getProductInfoSelect,handelResponse,uploadImg,getCodeProduct,putCodeProduct} from "../../../assets/api.js" +import ReactDOM from "react-dom"; +import React from "react"; +import Ipt from "../../../components/input/main"; +import Form from "../../../components/form/main"; +import FormItem from "../../../components/form-item/main"; +import { + Card, + Select, + Button, + ImageUpload, + onUpload, + Sweetalert, + RadioButton, + RadioGroup, + Notify, +} from "zent"; +import Bus from "../../../assets/eventBus.js"; +import { + getProductInfoSelect, + handelResponse, + uploadImg, + getCodeProduct, + putCodeProduct, +} from "../../../assets/api.js"; import _ from "lodash"; -import "./commodity.less" -import "./goodedit.less" -import Swiper from 'swiper/dist/js/swiper.js' -import 'swiper/dist/css/swiper.min.css' +import "./commodity.less"; +import "./goodedit.less"; +import Swiper from "swiper/dist/js/swiper.js"; +import "swiper/dist/css/swiper.min.css"; var mySwiper = null; -var timer = null -export default class adduserinfo extends React.Component{ - - constructor(props){ - super(props) - this.state={ - model:{ //数据模型不可少 - id:"", - type:"1", - contract_price:"", - official_price:"", - cost_price:"", - stock:"", - quantity:"", - usage:"", - name:"", - show_url:"", - loadshow:false, - describe_url:"", - map_product_name:'', - detail_url:"", - }, - cur_product:null, - productOption:[], - productpic:[] - } +var timer = null; +export default class adduserinfo extends React.Component { + constructor(props) { + super(props); + this.state = { + model: { + //数据模型不可少 + id: "", + type: "1", + contract_price: "", + official_price: "", + cost_price: "", + stock: "", + quantity: "", + usage: "", + name: "", + show_url: "", + loadshow: false, + describe_url: "", + map_product_name: "", + detail_url: "", + }, + cur_product: null, + productOption: [], + productpic: [], + }; } + componentDidMount() { + mySwiper = new Swiper(".swiper-container", { + slidesPerView: 1, + centeredSlides: true, + loop: true, + autoplay: 3000, + initialSlide: 0, + observer: true, // 修改swiper自己或子元素时,自动初始化swiper + observeParents: true, // 修改swiper的父元素时,自动初始化swiper + pagination: ".swiper-pagination", + }); + } - - -componentDidMount() { - - mySwiper = new Swiper('.swiper-container', { - slidesPerView: 1, - centeredSlides: true, - loop : true, - autoplay : 3000, - initialSlide :0, - observer: true, // 修改swiper自己或子元素时,自动初始化swiper - observeParents: true, // 修改swiper的父元素时,自动初始化swiper - pagination: '.swiper-pagination', - - }) - } + componentWillMount(e) { + //获取商品信息 + this.getProductInfo(); + } + componentWillReceiveProps() { + mySwiper.update(); + } + //获取直连天下商品映射信息 + getProductInfo() { + let productList = sessionStorage.getItem("productsList"); + productList = JSON.parse(productList); - componentWillMount(e){ - //获取商品信息 - this.getProductInfo() - } - componentWillReceiveProps() { - mySwiper.update(); - } - //获取直连天下商品映射信息 - getProductInfo(){ - - - let productList = sessionStorage.getItem("productsList") - productList = JSON.parse(productList); - - let product_data = [] - if(sessionStorage.getItem("productData")) - { - product_data = JSON.parse( sessionStorage.getItem("productData")) ; - } - - let checked_product= product_data ? product_data : []; - - let arr = []; - this.setState({products:productList}) - _.map(productList,(res)=>{ - let obj = {}; - obj.key = res.id; - obj.text= res.title; - obj.disabled = checked_product.findIndex((item)=>{return item.id == res.id}) > -1; - if(obj.disabled) - { + let product_data = []; + if (sessionStorage.getItem("productData")) { + product_data = JSON.parse(sessionStorage.getItem("productData")); + } - } - - arr.push(obj) - - return obj; - }) - this.setState({"productOption":arr}) - let product_id = sessionStorage.getItem("dataInfo"); - let code_batch_id = sessionStorage.getItem("code_id") - - getCodeProduct(code_batch_id,product_id).then(res=>{ - handelResponse(res,(req,msg)=>{ - - let defaultPic = [] - let arr = [] - let pics = "" - if(Array.isArray(req.describe_url)) - { - pics = req.describe_url - } - else{ - - if(req.describe_url!="") - { - pics = req.describe_url.split(',') - } - else{ - pics = [] - } - - } - - - - - let temp_productpic = this.state.productpic - for(let i = 0;i < pics.length;i++) - { - - if(pics[i]=="") - { - continue - } - let obj = {} - let nameArr = pics[i].split('/'); - obj.name = nameArr[5] - obj.src = pics[i]; - defaultPic.push(obj) - let obj2={ - name:nameArr[5], - url:pics[i] - } - temp_productpic.push(obj2) - } - this.setState({temp_productpic}) - - let temp ={ //数据模型不可少 - id:req.product_id, - type:req.product_type, - account_type:req.account_type, - contract_price:req.contract_price, - official_price:req.official_price, - cost_price:req.cost_price, - quantity:req.quantity, - stock:req.stock, - usage:req.usage, - name:req.product_name, - show_url:req.show_url[0], - describe_url: defaultPic , - map_product_name:req.map_product_name, - detail_url:req.detail_url[0] - } - - let sel_item = this.state.productOption.find((o)=>{ - return o.key == temp.id - }) - - this.setState({cur_product:sel_item}) - this.setState({model:temp,loadshow:true}) - },(err)=>{ - - }) - }).catch(err=>{ - }); + let checked_product = product_data ? product_data : []; - } - - cancel(){ - //取消二次弹出框 - Sweetalert.confirm({ - type:'warning', - closeBtn:true, - title:'确认操作', - content:

是否取消本次操作?

, - onConfirm:()=>{ - window.history.back() - }, - onCancel: this.onCancel, - className:'questModal', - parentComponent: this - }); - } - - - submit(){ - if(this.refs.form1.validator()) - { - let product_id = sessionStorage.getItem("dataInfo"); - let code_batch_id = sessionStorage.getItem("code_id") - - - if(this.state.model.quantity < this.state.model.usage) - { - Notify.error(`商品总库存量不能小于已使用数量`); - return; - } - - - - let urls = _.map(this.state.productpic,(o)=>{ - return o.url - }) - - if(urls.length <= 0) - { - Notify.error(`商品图至少请上传一张`); - return; - } - - let formdata = { - "product_type": this.state.model.type, - "product_name": this.state.model.name, - "cost_price":this.state.model.cost_price, - "contract_price": this.state.model.contract_price, - "account_type":this.state.model.account_type, - "official_price":this.state.model.official_price, - "quantity": this.state.model.quantity, - "usage": this.state.model.usage, - "stock":this.state.model.quantity - this.state.model.usage, - "show_url": this.state.model.show_url, - "describe_url": urls.toString(), - "detail_url":this.state.model.detail_url, - "map_product_name": this.state.model.map_product_name - } - - putCodeProduct(code_batch_id,product_id,formdata).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.history.back() - },1000); - },(error)=>{ - Notify.error(error); - }) - }); - } - } - onProductChange(e){ - this.setState({cur_product:e}) - let cur_product = this.state.products.find((item)=>{return item.id == e.key}) - let picItem = window.goods.find((item)=>{return item.id == cur_product.product_category_id}) - let model2 = { - id:cur_product.id, - type:cur_product.type, - contract_price:this.state.model.contract_price, - official_price:cur_product.official_price, - cost_price:cur_product.cost_price, - quantity:this.state.model.quantity, - name:this.state.model.name, - usage: this.state.model.usage, - stock:this.state.model.quantity - this.state.model.usage, - account_type:cur_product.account_type, - show_url:picItem ? picItem.pic : "", - describe_url:this.state.model.describe_url , - map_product_name:cur_product.title, - detail_url:"" - } - - this.setState({model:model2}) - } - onTypeChange(e){ - let model2 = this.state.model; - model2.type = e.target.value; - this.setState({model:model2}) - } - + let arr = []; + this.setState({ products: productList }); + _.map(productList, (res) => { + let obj = {}; + obj.key = res.id; + obj.text = res.title; + obj.disabled = + checked_product.findIndex((item) => { + return item.id == res.id; + }) > -1; + if (obj.disabled) { + } - - 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); - }); - - }; - - - - onUploadChange(files){ - if(files.length > 0 ) - { - if(files[0].file.size > 20000) - { - Notify.error(`图片大小不能超过 20KB`); - return; - } - let formdata= new FormData(); - formdata.append("file",files[0].file) - formdata.append("path","common_image") - uploadImg(formdata).then((res)=>{ - handelResponse(res,(req,msg)=>{ - let path = req.path; - let model = this.state.model; - model.show_url = path; - this.setState({model:model}) - },(err)=>{ - - }) - }); - } - else{ - let model = this.state.model; - model.show_url = ""; - this.setState({model:model}) - } - }; - onUploadChange1(files){ - - if(files.length > 0 ) - { - if(files[0].file.size > 20000) - { - Notify.error(`图片大小不能超过 20KB`); - return; - } - let formdata= new FormData(); - formdata.append("file",files[0].file) - formdata.append("path","common_image") - uploadImg(formdata).then((res)=>{ - handelResponse(res,(req,msg)=>{ - let path = req.path; - let model = this.state.model; - model.describe_url = path; - this.setState({model:model}) - },(err)=>{ - - }) - }); - } - else{ - let model = this.state.model; - model.describe_url = ""; - this.setState({model:model}) - } - - - - }; - - onUploadError = (type, data) => { - if (type === 'overMaxAmount') { - Notify.error(`最多可上传 ${data.maxAmount} 张图片`); - } else if (type === 'overMaxSize') { - Notify.error(`图片大小不能超过 ${data.formattedMaxSize}`); - } - }; - - - onUploadChange3(files,e){ - let arr =_.map(files,(o)=>{ - return o.name - }) - if(mySwiper !==0) - { - mySwiper.destroy(); - } - mySwiper = new Swiper('.swiper-container', { - observer: true,//修改swiper自己或子元素时,自动初始化swiper - observeParents: true,//修改swiper的父元素时,自动初始化swiper - pagination: '.swiper-pagination', - paginationClickable:true, - autoplay : 3000, - }) - - clearTimeout(timer); - timer = setTimeout(()=>{ - - if(arr.length > this.state.productpic.length) - { - //新增 - for(let i = 0;i < arr.length;i++) - { - - let index = this.state.productpic.findIndex((o)=>{ - return o.name == arr[i] - }) - if(index < 0) - { - let path = "" - let formdata= new FormData(); - - if(files[i].file.size > 1024 * 1024 * 2) - { - Notify.error(`图片大小不能超过2M`); - console.log(77777) - return; - } - - formdata.append("file",files[i].file) - formdata.append("path","common_image") - - uploadImg(formdata).then((res)=>{ - handelResponse(res,(req,msg)=>{ - path = req.path; - let obj={ - name:files[i].name, - url:path - } - let arr = this.state.productpic; - arr.push(obj) - this.setState({arr}) - },(err)=>{ - - }) - }); - - } - - } - - - } - if(arr.length < this.state.productpic.length) - { - let temp_arr = Object.assign([],this.state.productpic); - this.setState({productpic:[]}) - this.state.productpic = [] - let temp_arr2 = this.state.productpic - for(let i = 0;i < temp_arr.length;i++ ) - { - let temp =temp_arr[i] - if(arr.indexOf(temp.name) > -1) - { - temp_arr2.push(temp) - } - } - this.setState({temp_arr2}) - } - - // //调整位置 - if(arr.length == this.state.productpic.length) - { - let temp_arr = [] - let pic_arr = this.state.productpic - for(let i = 0;i < arr.length;i++ ) - { - let temp = pic_arr.find((o)=>{return o.name == arr[i]}) - temp_arr[i] = temp - } - this.setState({productpic:temp_arr}) - } - - },500) - }; - onUploadChange2(files){ - if(files.length > 0 ) - { - let formdata= new FormData(); - formdata.append("file",files[0].file) - formdata.append("path","common_image") - uploadImg(formdata).then((res)=>{ - handelResponse(res,(req,msg)=>{ - let path = req.path; - let model = this.state.model; - model.detail_url = path; - - this.setState({model:model}) - },(err)=>{ - - }) - }); - } - else{ - let model = this.state.model; - model.detail_url = ""; - this.setState({model:model}) - } - } + arr.push(obj); + return obj; + }); + this.setState({ productOption: arr }); + let product_id = sessionStorage.getItem("dataInfo"); + let code_batch_id = sessionStorage.getItem("code_id"); + getCodeProduct(code_batch_id, product_id) + .then((res) => { + handelResponse( + res, + (req, msg) => { + let defaultPic = []; + let arr = []; + let pics = ""; + if (Array.isArray(req.describe_url)) { + pics = req.describe_url; + } else { + if (req.describe_url != "") { + pics = req.describe_url.split(","); + } else { + pics = []; + } + } + let temp_productpic = this.state.productpic; + for (let i = 0; i < pics.length; i++) { + if (pics[i] == "") { + continue; + } + let obj = {}; + let nameArr = pics[i].split("/"); + obj.name = nameArr[5]; + obj.src = pics[i]; + defaultPic.push(obj); + let obj2 = { + name: nameArr[5], + url: pics[i], + }; + temp_productpic.push(obj2); + } + this.setState({ temp_productpic }); - render(){ + let temp = { + //数据模型不可少 + id: req.product_id, + type: req.product_type, + account_type: req.account_type, + contract_price: req.contract_price, + official_price: req.official_price, + cost_price: req.cost_price, + quantity: req.quantity, + stock: req.stock, + usage: req.usage, + name: req.product_name, + show_url: req.show_url[0], + describe_url: defaultPic, + map_product_name: req.map_product_name, + detail_url: req.detail_url[0], + }; + let sel_item = this.state.productOption.find((o) => { + return o.key == temp.id; + }); - //校验规则 - const rules = { - product: [ - { type: "required", message: "请选择映射商品"}, - - ], - quantity: [ - { type: "required", message: "请输入商品库存"}, - ], - contract_price:[ - { type: "required", message: "请输入合同价"}, - ], - name:[ - { type: "required", message: "请输入商品名称"}, - ], - - } + this.setState({ cur_product: sel_item }); + this.setState({ model: temp, loadshow: true }); + }, + (err) => {} + ); + }) + .catch((err) => {}); + } + cancel() { + //取消二次弹出框 + Sweetalert.confirm({ + type: "warning", + closeBtn: true, + title: "确认操作", + content:

是否取消本次操作?

, + onConfirm: () => { + window.history.back(); + }, + onCancel: this.onCancel, + className: "questModal", + parentComponent: this, + }); + } - return( + submit() { + if (this.refs.form1.validator()) { + let product_id = sessionStorage.getItem("dataInfo"); + let code_batch_id = sessionStorage.getItem("code_id"); + + if (this.state.model.quantity < this.state.model.usage) { + Notify.error(`商品总库存量不能小于已使用数量`); + return; + } + + let urls = _.map(this.state.productpic, (o) => { + return o.url; + }); + + if (urls.length <= 0) { + Notify.error(`商品图至少请上传一张`); + return; + } + + let formdata = { + product_type: this.state.model.type, + product_name: this.state.model.name, + cost_price: this.state.model.cost_price, + contract_price: this.state.model.contract_price, + account_type: this.state.model.account_type, + official_price: this.state.model.official_price, + quantity: this.state.model.quantity, + usage: this.state.model.usage, + stock: this.state.model.quantity - this.state.model.usage, + show_url: this.state.model.show_url, + describe_url: urls.toString(), + detail_url: this.state.model.detail_url, + map_product_name: this.state.model.map_product_name, + }; + + putCodeProduct(code_batch_id, product_id, formdata).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.history.back(); + }, 1000); + }, + (error) => { + Notify.error(error); + } + ); + }); + } + } + onProductChange(e) { + this.setState({ cur_product: e }); + let cur_product = this.state.products.find((item) => { + return item.id == e.key; + }); + let picItem = window.goods.find((item) => { + return item.id == cur_product.product_category_id; + }); + let model2 = { + id: cur_product.id, + type: cur_product.type, + contract_price: this.state.model.contract_price, + official_price: cur_product.official_price, + cost_price: cur_product.cost_price, + quantity: this.state.model.quantity, + name: this.state.model.name, + usage: this.state.model.usage, + stock: this.state.model.quantity - this.state.model.usage, + account_type: cur_product.account_type, + show_url: picItem ? picItem.pic : "", + describe_url: this.state.model.describe_url, + map_product_name: cur_product.title, + detail_url: "", + }; + + this.setState({ model: model2 }); + } + onTypeChange(e) { + let model2 = this.state.model; + model2.type = e.target.value; + this.setState({ model: model2 }); + } + + 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); + }); + }; + + onUploadChange(files) { + if (files.length > 0) { + if (files[0].file.size > 20000) { + Notify.error(`图片大小不能超过 20KB`); + return; + } + let formdata = new FormData(); + formdata.append("file", files[0].file); + formdata.append("path", "common_image"); + uploadImg(formdata).then((res) => { + handelResponse( + res, + (req, msg) => { + let path = req.path; + let model = this.state.model; + model.show_url = path; + this.setState({ model: model }); + }, + (err) => {} + ); + }); + } else { + let model = this.state.model; + model.show_url = ""; + this.setState({ model: model }); + } + } + onUploadChange1(files) { + if (files.length > 0) { + if (files[0].file.size > 20000) { + Notify.error(`图片大小不能超过 20KB`); + return; + } + let formdata = new FormData(); + formdata.append("file", files[0].file); + formdata.append("path", "common_image"); + uploadImg(formdata).then((res) => { + handelResponse( + res, + (req, msg) => { + let path = req.path; + let model = this.state.model; + model.describe_url = path; + this.setState({ model: model }); + }, + (err) => {} + ); + }); + } else { + let model = this.state.model; + model.describe_url = ""; + this.setState({ model: model }); + } + } + + onUploadError = (type, data) => { + if (type === "overMaxAmount") { + Notify.error(`最多可上传 ${data.maxAmount} 张图片`); + } else if (type === "overMaxSize") { + Notify.error(`图片大小不能超过 ${data.formattedMaxSize}`); + } + }; + + onUploadChange3(files, e) { + let arr = _.map(files, (o) => { + return o.name; + }); + if (mySwiper !== 0) { + mySwiper.destroy(); + } + mySwiper = new Swiper(".swiper-container", { + observer: true, //修改swiper自己或子元素时,自动初始化swiper + observeParents: true, //修改swiper的父元素时,自动初始化swiper + pagination: ".swiper-pagination", + paginationClickable: true, + autoplay: 3000, + }); + + clearTimeout(timer); + timer = setTimeout(() => { + if (arr.length > this.state.productpic.length) { + //新增 + for (let i = 0; i < arr.length; i++) { + let index = this.state.productpic.findIndex((o) => { + return o.name == arr[i]; + }); + if (index < 0) { + let path = ""; + let formdata = new FormData(); + + if (files[i].file.size > 1024 * 1024 * 2) { + Notify.error(`图片大小不能超过2M`); + console.log(77777); + return; + } + + formdata.append("file", files[i].file); + formdata.append("path", "common_image"); + + uploadImg(formdata).then((res) => { + handelResponse( + res, + (req, msg) => { + path = req.path; + let obj = { + name: files[i].name, + url: path, + }; + let arr = this.state.productpic; + arr.push(obj); + this.setState({ arr }); + }, + (err) => {} + ); + }); + } + } + } + if (arr.length < this.state.productpic.length) { + let temp_arr = Object.assign([], this.state.productpic); + this.setState({ productpic: [] }); + this.state.productpic = []; + let temp_arr2 = this.state.productpic; + for (let i = 0; i < temp_arr.length; i++) { + let temp = temp_arr[i]; + if (arr.indexOf(temp.name) > -1) { + temp_arr2.push(temp); + } + } + this.setState({ temp_arr2 }); + } + + // //调整位置 + if (arr.length == this.state.productpic.length) { + let temp_arr = []; + let pic_arr = this.state.productpic; + for (let i = 0; i < arr.length; i++) { + let temp = pic_arr.find((o) => { + return o.name == arr[i]; + }); + temp_arr[i] = temp; + } + this.setState({ productpic: temp_arr }); + } + }, 500); + } + onUploadChange2(files) { + if (files.length > 0) { + let formdata = new FormData(); + formdata.append("file", files[0].file); + formdata.append("path", "common_image"); + uploadImg(formdata).then((res) => { + handelResponse( + res, + (req, msg) => { + let path = req.path; + let model = this.state.model; + model.detail_url = path; + + this.setState({ model: model }); + }, + (err) => {} + ); + }); + } else { + let model = this.state.model; + model.detail_url = ""; + this.setState({ model: model }); + } + } + + render() { + //校验规则 + const rules = { + product: [{ type: "required", message: "请选择映射商品" }], + quantity: [{ type: "required", message: "请输入商品库存" }], + contract_price: [{ type: "required", message: "请输入合同价" }], + name: [{ type: "required", message: "请输入商品名称" }], + }; + + return (
- - -
- - { + this.onProductChange(e); + Bus.emit("change", "product", e); + }} + /> + + + { + this.onTypeChange(e); + }} + value={this.state.model.type} + > + 直充 + + 卡密 + + + + +
{this.state.model.cost_price}
+
+ {this.state.loadshow ? ( + + { + let model2 = this.state.model; + + model2.quantity = e; + model2.stock = model2.quantity - model2.usage; + this.setState({ model: model2 }); + }} + onClearItem={(e) => { + let model2 = this.state.model; + model2.quantity = ""; + this.setState({ model: model2 }); + }} + value={this.state.model.quantity} + placeholder={"请输入"} + labelWidth={"0px"} + maxLength={7} + height={"36px"} + width={"520px"} + alignment={"left"} + /> + + ) : null} + {this.state.loadshow ? ( + +
{this.state.model.stock}
+
+ ) : null} + {this.state.loadshow ? ( + +
{this.state.model.usage}
+
+ ) : null} + {this.state.loadshow ? ( + + { + let model2 = this.state.model; + model2.contract_price = e; + this.setState({ model: model2 }); + }} + onClearItem={(e) => { + let model2 = this.state.model; + model2.contract_price = ""; + this.setState({ model: model2 }); + }} + value={this.state.model.contract_price} + placeholder={"请输入"} + labelWidth={"0px"} + maxLength={16} + height={"36px"} + width={"520px"} + alignment={"left"} + /> + + ) : null} + {this.state.loadshow ? ( + + { + let model2 = this.state.model; + model2.name = e; + this.setState({ model: model2 }); + }} + onClearItem={(e) => { + let model2 = this.state.model; + model2.name = ""; + this.setState({ model: model2 }); + }} + value={this.state.model.name} + placeholder={"请输入"} + labelWidth={"0px"} + maxLength={16} + height={"36px"} + width={"520px"} + alignment={"left"} + /> + + ) : null} + + +
+ {this.state.model.official_price} +
+
+ {this.state.loadshow ? ( + + { + this.onUploadChange(e); + }} + onUpload={this.onUpload} + fileList={ + this.state.model.show_url + ? [{ src: this.state.model.show_url }] + : null + } + value={this.state.model.show_url} + /> + + ) : null} + + {this.state.loadshow ? ( + + { + this.onUploadChange3(e); + }} + /> + + ) : null} + {this.state.loadshow ? ( + + { + this.onUploadChange2(e); + }} + /> + + ) : null} +
+ +
+
+ {this.state.productpic ? ( +
+
+ {this.state.productpic.map((item, index) => { + return ( +
+ +
+ ); + })} +
+
+
+ ) : null} +
+
+
+ {this.state.model.detail_url ? ( + + ) : null} +
+
+
+ +
+ + +
- ) + ); } } - diff --git a/src/pages/exchangecode/product/add copy.js b/src/pages/exchangecode/product/add copy.js index a2e5c92e..b94cb177 100644 --- a/src/pages/exchangecode/product/add copy.js +++ b/src/pages/exchangecode/product/add copy.js @@ -447,7 +447,7 @@ export default class adduserinfo extends React.Component { 卡密 - +
{this.state.model.cost_price}
diff --git a/src/pages/exchangecode/product/add.js b/src/pages/exchangecode/product/add.js index d398025d..733e0796 100644 --- a/src/pages/exchangecode/product/add.js +++ b/src/pages/exchangecode/product/add.js @@ -460,7 +460,7 @@ export default class adduserinfo extends React.Component { 卡密 - +
{this.state.model.cost_price}
diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index 9b50f0f6..4bf24b1e 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -60,7 +60,7 @@ export default class acclist extends React.Component { model: { //数据模型不可少 style: 1, - quantity: 0, + quantity: 1, allow_repetition: 0, allow_loss: 0, merge_stock: 1, diff --git a/src/pages/plan/product/add.js b/src/pages/plan/product/add.js index b6f11980..5b3dab4f 100644 --- a/src/pages/plan/product/add.js +++ b/src/pages/plan/product/add.js @@ -486,7 +486,7 @@ export default class adduserinfo extends React.Component { 卡密 - +
{this.state.model.cost_price}