所有模块新增权重

This commit is contained in:
wangsongsole 2022-06-14 11:49:52 +08:00
parent 4b8dd3ab27
commit 79374f201b
7 changed files with 393 additions and 320 deletions

View File

@ -388,6 +388,7 @@ export default class addKnockGold extends Component {
real_name: text,
mobile: key
})),
weight: this.state.model.weight,
receive_conf: {
type: this.state.model.receive_type,
num: this.state.model.receive_number

View File

@ -562,6 +562,7 @@ export default class acclist extends React.Component {
obj.origin = item.origin // 原始数据
}
obj.only = item.only
obj.weight = item.weight
obj.type = item.type
obj.upstream = item.upstream
return obj

View File

@ -406,6 +406,7 @@ export default class exchangedit extends React.Component {
_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

View File

@ -1,9 +1,9 @@
import ReactDOM from "react-dom";
import React from "react";
import "./add.less";
import Ipt from "../../../components/input/main";
import Form from "../../../components/form/main";
import FormItem from "../../../components/form-item/main";
import ReactDOM from 'react-dom'
import React from 'react'
import './add.less'
import Ipt from '../../../components/input/main'
import Form from '../../../components/form/main'
import FormItem from '../../../components/form-item/main'
import {
Select,
Button,
@ -12,51 +12,52 @@ import {
Sweetalert,
RadioButton,
RadioGroup,
Notify,
} from "zent";
import Swiper from "swiper/dist/js/swiper.js";
import "swiper/dist/css/swiper.min.css";
import Bus from "../../../assets/eventBus.js";
Notify
} from 'zent'
import Swiper from 'swiper/dist/js/swiper.js'
import 'swiper/dist/css/swiper.min.css'
import Bus from '../../../assets/eventBus.js'
import {
getProductInfoSelect,
handelResponse,
uploadImg,
} from "../../../assets/api.js";
import _ from "lodash";
uploadImg
} from '../../../assets/api.js'
import _ from 'lodash'
var mySwiper = null;
var timer = null;
var mySwiper = null
var timer = null
export default class adduserinfo extends React.Component {
constructor(props) {
super(props);
super(props)
this.state = {
model: {
//数据模型不可少
product_id: "",
product_type: "1",
contract_price: "",
official_price: "",
cost_price: "",
quantity: "",
product_name: "",
show_url: "",
product_id: '',
product_type: '1',
contract_price: '',
official_price: '',
cost_price: '',
quantity: '',
product_name: '',
weight: '',
show_url: '',
describe_url: [],
detail_url: "",
stock: "",
usage: "",
detail_url: "",
map_product_name: "",
detail_url: '',
stock: '',
usage: '',
detail_url: '',
map_product_name: ''
},
cur_product: null,
productOption: [],
products: [],
productpic: [],
productsList: [],
isSelectGoods: false,
};
isSelectGoods: false
}
}
componentDidMount() {
mySwiper = new Swiper(".swiper-container", {
mySwiper = new Swiper('.swiper-container', {
slidesPerView: 1,
centeredSlides: true,
loop: true,
@ -64,114 +65,115 @@ export default class adduserinfo extends React.Component {
initialSlide: 0,
observer: true, // 修改swiper自己或子元素时自动初始化swiper
observeParents: true, // 修改swiper的父元素时自动初始化swiper
pagination: ".swiper-pagination",
});
pagination: '.swiper-pagination'
})
}
componentWillReceiveProps() {
mySwiper.update();
mySwiper.update()
}
componentWillMount(e) {
//获取商品信息
if (this.props.data) {
let model_temp = this.props.data;
let model_temp = this.props.data
let model = this.state.model;
model.product_id = model_temp.product_id;
model.product_type = model_temp.product_type;
let model = this.state.model
model.product_id = model_temp.product_id
model.product_type = model_temp.product_type
model.contract_price = model_temp.contract_price;
model.official_price = model_temp.official_price;
model.cost_price = model_temp.cost_price;
model.quantity = model_temp.quantity;
model.product_name = model_temp.product_name;
model.show_url = model_temp.show_url;
model.account_type = model_temp.account_type;
model.detail_url = model_temp.detail_url;
let defaultPic = [];
let arr = [];
model.contract_price = model_temp.contract_price
model.official_price = model_temp.official_price
model.cost_price = model_temp.cost_price
model.quantity = model_temp.quantity
model.product_name = model_temp.product_name
model.weight = model_temp.weight
model.show_url = model_temp.show_url
model.account_type = model_temp.account_type
model.detail_url = model_temp.detail_url
let defaultPic = []
let arr = []
let temp_productpic = this.state.productpic;
let pics = "";
let temp_productpic = this.state.productpic
let pics = ''
if (Array.isArray(model_temp.describe_url)) {
pics = model_temp.describe_url;
pics = model_temp.describe_url
} else {
if (
model_temp.describe_url != "" &&
model_temp.describe_url != '' &&
model_temp.describe_url != undefined
) {
pics = model_temp.describe_url.split(",");
pics = model_temp.describe_url.split(',')
} else {
pics = [];
pics = []
}
}
for (let i = 0; i < pics.length; i++) {
let obj = {};
let nameArr = pics[i].split("/");
obj.name = nameArr[5];
obj.src = pics[i];
defaultPic.push(obj);
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);
url: pics[i]
}
temp_productpic.push(obj2)
}
this.setState({ temp_productpic });
model.describe_url = defaultPic;
model.stock = model_temp.stock;
model.usage = model_temp.usage;
model.map_product_name = model_temp.map_product_name;
this.setState({ model: model });
this.setState({ temp_productpic })
model.describe_url = defaultPic
model.stock = model_temp.stock
model.usage = model_temp.usage
model.map_product_name = model_temp.map_product_name
this.setState({ model: model })
}
this.getProductInfo();
this.getProductInfo()
}
//获取直连天下商品映射信息
getProductInfo() {
let productList = sessionStorage.getItem("productsList");
productList = JSON.parse(productList);
let productList = sessionStorage.getItem('productsList')
productList = JSON.parse(productList)
let product_data = [];
if (sessionStorage.getItem("productData")) {
product_data = JSON.parse(sessionStorage.getItem("productData"));
let product_data = []
if (sessionStorage.getItem('productData')) {
product_data = JSON.parse(sessionStorage.getItem('productData'))
}
let checked_product = product_data ? product_data : [];
console.log("product_data ==>1", product_data);
let checked_product = product_data ? product_data : []
console.log('product_data ==>1', product_data)
let arr = [];
this.setState({ products: productList });
let arr = []
this.setState({ products: productList })
_.map(productList, (res) => {
let index = checked_product.findIndex((item) => {
return item.product_id == res.id;
});
let obj = {};
obj.key = res.id;
obj.text = res.title;
obj.disabled = index > -1 ? true : false;
return item.product_id == res.id
})
let obj = {}
obj.key = res.id
obj.text = res.title
obj.disabled = index > -1 ? true : false
if (obj.disabled) {
}
obj.in = index > -1 ? checked_product[index].in : false;
arr.push(obj);
return obj;
});
obj.in = index > -1 ? checked_product[index].in : false
arr.push(obj)
return obj
})
this.setState({ productOption: arr });
console.log("this.state.model.product_id =>", this.state.model.product_id);
this.setState({ productOption: arr })
console.log('this.state.model.product_id =>', this.state.model.product_id)
if (this.state.model.product_id) {
let cur_product = arr.find((item) => {
return item.key == this.state.model.product_id;
});
this.setState({ cur_product: cur_product });
return item.key == this.state.model.product_id
})
this.setState({ cur_product: cur_product })
console.log("cur_product ==>2", cur_product);
console.log("arr ==>", arr);
console.log('cur_product ==>2', cur_product)
console.log('arr ==>', arr)
if (cur_product && cur_product.in) {
this.setState({ isSelectGoods: true });
this.setState({ isSelectGoods: true })
}
}
}
@ -179,80 +181,81 @@ export default class adduserinfo extends React.Component {
async submit() {
if (this.refs.form1.validator()) {
if (this.props.data) {
let temp = [];
if (sessionStorage.getItem("productData")) {
temp = JSON.parse(sessionStorage.getItem("productData"));
let temp = []
if (sessionStorage.getItem('productData')) {
temp = JSON.parse(sessionStorage.getItem('productData'))
let index = temp.findIndex((item) => {
return item.product_id == this.props.data.product_id;
});
return item.product_id == this.props.data.product_id
})
temp[index].product_name = this.state.model.product_name;
temp[index].account_type = this.state.model.account_type;
temp[index].product_id = this.state.model.product_id;
temp[index].product_type = this.state.model.product_type;
temp[index].contract_price = this.state.model.contract_price;
temp[index].official_price = this.state.model.official_price;
temp[index].cost_price = this.state.model.cost_price;
temp[index].quantity = this.state.model.quantity;
temp[index].stock = this.state.model.quantity;
temp[index].usage = this.state.model.usage;
temp[index].show_url = this.state.model.show_url;
temp[index].detail_url = this.state.model.detail_url;
temp[index].product_name = this.state.model.product_name
temp[index].weight = this.state.model.weight
temp[index].account_type = this.state.model.account_type
temp[index].product_id = this.state.model.product_id
temp[index].product_type = this.state.model.product_type
temp[index].contract_price = this.state.model.contract_price
temp[index].official_price = this.state.model.official_price
temp[index].cost_price = this.state.model.cost_price
temp[index].quantity = this.state.model.quantity
temp[index].stock = this.state.model.quantity
temp[index].usage = this.state.model.usage
temp[index].show_url = this.state.model.show_url
temp[index].detail_url = this.state.model.detail_url
let urls = _.map(this.state.productpic, (o) => {
return o.url;
});
return o.url
})
if (urls.length <= 0) {
Notify.error(`商品图至少请上传一张`);
return;
Notify.error(`商品图至少请上传一张`)
return
}
temp[index].describe_url = urls;
temp[index].map_product_name = this.state.model.map_product_name;
temp[index].account_type = this.state.model.account_type;
temp[index].describe_url = urls
temp[index].map_product_name = this.state.model.map_product_name
temp[index].account_type = this.state.model.account_type
sessionStorage.setItem("productData", JSON.stringify(temp));
sessionStorage.setItem('productData', JSON.stringify(temp))
}
} else {
let model = this.state.model;
let model = this.state.model
let urls = _.map(this.state.productpic, (o) => {
return o.url;
});
return o.url
})
if (urls.length <= 0) {
Notify.error(`商品图至少请上传一张`);
return;
Notify.error(`商品图至少请上传一张`)
return
}
model.describe_url = urls;
model.describe_url = urls
this.setState({ model: model });
this.setState({ model: model })
if (this.state.model.show_url == "") {
Notify.error(`请上传商品Logo`);
return;
if (this.state.model.show_url == '') {
Notify.error(`请上传商品Logo`)
return
}
let temp = [];
if (sessionStorage.getItem("productData")) {
temp = JSON.parse(sessionStorage.getItem("productData"));
let temp = []
if (sessionStorage.getItem('productData')) {
temp = JSON.parse(sessionStorage.getItem('productData'))
}
let data = temp ? temp : [];
data.push(this.state.model);
sessionStorage.setItem("productData", JSON.stringify(data));
let data = temp ? temp : []
data.push(this.state.model)
sessionStorage.setItem('productData', JSON.stringify(data))
}
return true;
return true
}
}
onProductChange(e) {
this.setState({ cur_product: e });
this.setState({ cur_product: e })
let cur_product = this.state.products.find((item) => {
return item.id == e.key;
});
return item.id == e.key
})
let picItem = window.goods.find((item) => {
return item.id == cur_product.product_category_id;
});
let quantity = this.state.model.quantity;
return item.id == cur_product.product_category_id
})
let quantity = this.state.model.quantity
let model2 = {
product_id: cur_product.id,
product_type: cur_product.type,
@ -263,294 +266,324 @@ export default class adduserinfo extends React.Component {
stock: quantity,
usage: 0,
product_name: cur_product.title,
show_url: picItem ? picItem.pic : "",
describe_url: "",
detail_url: "",
weight: cur_product.weight,
show_url: picItem ? picItem.pic : '',
describe_url: '',
detail_url: '',
map_product_name: cur_product.title,
account_type: cur_product.account_type,
};
this.setState({ model: model2 });
account_type: cur_product.account_type
}
this.setState({ model: model2 })
}
onTypeChange(e) {
let model2 = this.state.model;
model2.type = e.target.value;
this.setState({ model: model2 });
let model2 = this.state.model
model2.type = e.target.value
this.setState({ model: model2 })
}
onUpload = (file, report) => {
return new Promise((resolve, reject) => {});
};
return new Promise((resolve, reject) => {})
}
onUploadChange(files) {
if (files.length > 0) {
let formdata = new FormData();
formdata.append("file", files[0].file);
formdata.append("path", "common_image");
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;
let path = req.path
let model = this.state.model
model.show_url = path
this.setState({ model: model });
this.setState({ model: model })
},
(err) => {}
);
});
)
})
} else {
let model = this.state.model;
model.show_url = "";
this.setState({ model: model });
let model = this.state.model
model.show_url = ''
this.setState({ model: model })
}
}
onUploadChange1(files, e) {
let arr = _.map(files, (o) => {
return o.name;
});
return o.name
})
if (mySwiper !== 0) {
mySwiper.destroy();
mySwiper.destroy()
}
mySwiper = new Swiper(".swiper-container", {
mySwiper = new Swiper('.swiper-container', {
observer: true, //修改swiper自己或子元素时自动初始化swiper
observeParents: true, //修改swiper的父元素时自动初始化swiper
pagination: ".swiper-pagination",
pagination: '.swiper-pagination',
paginationClickable: true,
autoplay: 3000,
});
clearTimeout(timer);
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];
});
return o.name == arr[i]
})
if (index < 0) {
let path = "";
let formdata = new FormData();
formdata.append("file", files[i].file);
formdata.append("path", "common_image");
let path = ''
let formdata = new FormData()
formdata.append('file', files[i].file)
formdata.append('path', 'common_image')
uploadImg(formdata).then((res) => {
handelResponse(
res,
(req, msg) => {
path = req.path;
path = req.path
let obj = {
name: files[i].name,
url: path,
};
let arr = this.state.productpic;
arr.push(obj);
this.setState({ arr });
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;
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];
let temp = temp_arr[i]
if (arr.indexOf(temp.name) > -1) {
temp_arr2.push(temp);
temp_arr2.push(temp)
}
}
this.setState({ temp_arr2 });
this.setState({ temp_arr2 })
}
// //调整位置
if (arr.length == this.state.productpic.length) {
let temp_arr = [];
let pic_arr = this.state.productpic;
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;
return o.name == arr[i]
})
temp_arr[i] = temp
}
this.setState({ productpic: temp_arr });
this.setState({ productpic: temp_arr })
}
}, 500);
}, 500)
}
onUploadError = (type, data) => {
if (type === "overMaxAmount") {
Notify.error(`最多可上传 ${data.maxAmount} 张图片`);
} else if (type === "overMaxSize") {
Notify.error(`图片大小不能超过 ${data.formattedMaxSize}`);
if (type === 'overMaxAmount') {
Notify.error(`最多可上传 ${data.maxAmount} 张图片`)
} else if (type === 'overMaxSize') {
Notify.error(`图片大小不能超过 ${data.formattedMaxSize}`)
}
};
}
onUploadChange2(files) {
if (files.length > 0) {
let formdata = new FormData();
formdata.append("file", files[0].file);
formdata.append("path", "common_image");
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;
let path = req.path
let model = this.state.model
model.detail_url = path
this.setState({ model: model });
this.setState({ model: model })
},
(err) => {}
);
});
)
})
} else {
let model = this.state.model;
model.detail_url = "";
this.setState({ model: model });
let model = this.state.model
model.detail_url = ''
this.setState({ model: model })
}
}
render() {
//校验规则
const rules = {
product: [{ type: "required", message: "请选择映射商品" }],
product: [{ type: 'required', message: '请选择映射商品' }],
quantity: [
{ type: "required", message: "请输入商品库存" },
{ type: 'required', message: '请输入商品库存' },
{
type: "regExp",
message: "请输入小于100万的整数",
reg: "^(?!0)(?:[0-9]{1,6}|1000000)$",
},
type: 'regExp',
message: '请输入小于100万的整数',
reg: '^(?!0)(?:[0-9]{1,6}|1000000)$'
}
],
contract_price: [
{ type: "required", message: "请输入合同价" },
{ type: 'required', message: '请输入合同价' },
{
type: "regExp",
message: "最多保留4位小数",
reg: "^[0-9]+(.[0-9]{1,4})?$",
},
type: 'regExp',
message: '最多保留4位小数',
reg: '^[0-9]+(.[0-9]{1,4})?$'
}
],
product_name: [{ type: "required", message: "请输入商品名称" }],
};
product_name: [{ type: 'required', message: '请输入商品名称' }],
/* 权重 */
weight: [
{ type: 'required', message: '请输入权重' },
{
type: 'regExp',
message: '请输入0~100权重数字',
reg: '^([0-9]{0,2}|100)$'
}
]
}
return (
<div id="addproduct">
<Form model={this.state.model} rules={rules} ref="form1">
<FormItem labelname="映射商品" prop="product" id="product">
<div id='addproduct'>
<Form model={this.state.model} rules={rules} ref='form1'>
<FormItem labelname='映射商品' prop='product' id='product'>
<Select
options={this.state.productOption}
width={500}
placeholder="请选择商品"
placeholder='请选择商品'
value={this.state.cur_product}
disabled={this.state.isSelectGoods}
onChange={(e) => {
this.onProductChange(e);
Bus.emit("change", "product", e);
this.onProductChange(e)
Bus.emit('change', 'product', e)
}}
/>
</FormItem>
<FormItem labelname="商品类型" prop="type" id="type">
<FormItem labelname='商品类型' prop='type' id='type'>
<RadioGroup
onChange={(e) => {
this.onTypeChange(e);
this.onTypeChange(e)
}}
value={this.state.model.product_type}
>
value={this.state.model.product_type}>
<RadioButton value={1}>直充</RadioButton>
<RadioButton value={2}>卡密</RadioButton>
</RadioGroup>
</FormItem>
<FormItem labelname="预估成本价" prop="cost_price" id="cost_price">
<div className="line-value">{this.state.model.cost_price}</div>
<FormItem labelname='预估成本价' prop='cost_price' id='cost_price'>
<div className='line-value'>{this.state.model.cost_price}</div>
</FormItem>
<FormItem labelname="库存总数量" prop="quantity" id="quantity">
<FormItem labelname='商品权重' prop='weight' id='weight'>
<Ipt
onChange={(e) => {
let model2 = this.state.model;
model2.quantity = e;
model2.stock = e;
this.setState({ model: model2 });
let model2 = this.state.model
model2.weight = e
this.setState({ model: model2 })
}}
onClearItem={(e) => {
let model2 = this.state.model;
model2.quantity = "";
model2.stock = 0;
this.setState({ model: model2 });
let model2 = this.state.model
model2.weight = ''
this.setState({ model: model2 })
}}
value={this.state.model.weight}
placeholder={'请输入'}
labelWidth={'0px'}
maxLength={3}
height={'36px'}
countShow={false}
width={'520px'}
alignment={'left'}
/>
</FormItem>
<FormItem labelname='库存总数量' prop='quantity' id='quantity'>
<Ipt
onChange={(e) => {
let model2 = this.state.model
model2.quantity = e
model2.stock = e
this.setState({ model: model2 })
}}
onClearItem={(e) => {
let model2 = this.state.model
model2.quantity = ''
model2.stock = 0
this.setState({ model: model2 })
}}
value={this.state.model.quantity}
placeholder={"请输入"}
labelWidth={"0px"}
placeholder={'请输入'}
labelWidth={'0px'}
maxLength={7}
height={"36px"}
width={"520px"}
alignment={"left"}
height={'36px'}
width={'520px'}
alignment={'left'}
/>
</FormItem>
<FormItem
id="contract_price"
labelname="合同价"
prop="contract_price"
>
id='contract_price'
labelname='合同价'
prop='contract_price'>
<Ipt
onChange={(e) => {
let model2 = this.state.model;
model2.contract_price = e;
this.setState({ model: model2 });
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 });
let model2 = this.state.model
model2.contract_price = ''
this.setState({ model: model2 })
}}
value={this.state.model.contract_price}
placeholder={"请输入"}
labelWidth={"0px"}
placeholder={'请输入'}
labelWidth={'0px'}
maxLength={16}
height={"36px"}
width={"520px"}
alignment={"left"}
height={'36px'}
width={'520px'}
alignment={'left'}
/>
</FormItem>
<FormItem id="product_name" labelname="商品名称" prop="product_name">
<FormItem id='product_name' labelname='商品名称' prop='product_name'>
<Ipt
onChange={(e) => {
let model2 = this.state.model;
model2.product_name = e;
this.setState({ model: model2 });
let model2 = this.state.model
model2.product_name = e
this.setState({ model: model2 })
}}
onClearItem={(e) => {
let model2 = this.state.model;
model2.product_name = "";
this.setState({ model: model2 });
let model2 = this.state.model
model2.product_name = ''
this.setState({ model: model2 })
}}
value={this.state.model.product_name}
placeholder={"请输入"}
labelWidth={"0px"}
placeholder={'请输入'}
labelWidth={'0px'}
maxLength={16}
height={"36px"}
width={"520px"}
alignment={"left"}
height={'36px'}
width={'520px'}
alignment={'left'}
/>
</FormItem>
<FormItem
id="official_price"
labelname="商品官方价"
prop="official_price"
>
<div className="line-value">{this.state.model.official_price}</div>
id='official_price'
labelname='商品官方价'
prop='official_price'>
<div className='line-value'>{this.state.model.official_price}</div>
</FormItem>
<FormItem id="show_url" prop="show_url" labelname="商品Logo">
<FormItem id='show_url' prop='show_url' labelname='商品Logo'>
<ImageUpload
className="zent-image-upload-demo"
className='zent-image-upload-demo'
maxSize={2 * 1024 * 1024}
tips="图片不超过 2M"
tips='图片不超过 2M'
maxAmount={1}
onError={this.onUploadError}
onChange={(e) => {
this.onUploadChange(e);
this.onUploadChange(e)
}}
fileList={
this.state.model.show_url
@ -560,11 +593,11 @@ export default class adduserinfo extends React.Component {
value={this.state.model.show_url}
/>
</FormItem>
<FormItem prop="describe_url" labelname="商品图" id="describe_url">
<FormItem prop='describe_url' labelname='商品图' id='describe_url'>
<ImageUpload
className="good-image-upload-demo"
className='good-image-upload-demo'
maxSize={2 * 1024 * 1024}
tips="图片不超过 2M"
tips='图片不超过 2M'
maxAmount={9}
sortable
onError={this.onUploadError}
@ -572,20 +605,19 @@ export default class adduserinfo extends React.Component {
multiple
onUpload={this.onUpload}
onChange={(e) => {
this.onUploadChange1(e);
this.onUploadChange1(e)
}}
/>
</FormItem>
<FormItem
prop="detail_url"
labelname="商品详情"
id="detail_url"
required={false}
>
prop='detail_url'
labelname='商品详情'
id='detail_url'
required={false}>
<ImageUpload
className="zent-image-upload-demo"
className='zent-image-upload-demo'
maxSize={2 * 1024 * 1024}
tips="图片不超过 2M"
tips='图片不超过 2M'
maxAmount={1}
onError={this.onUploadError}
fileList={
@ -595,37 +627,37 @@ export default class adduserinfo extends React.Component {
}
onUpload={this.onUpload}
onChange={(e) => {
this.onUploadChange2(e);
this.onUploadChange2(e)
}}
/>
</FormItem>
</Form>
<div className="mobile">
<div className="mobile_top">
<div className='mobile'>
<div className='mobile_top'>
{this.state.productpic ? (
<div className="swiper-container">
<div className="swiper-wrapper" ref="swiperwrapper">
<div className='swiper-container'>
<div className='swiper-wrapper' ref='swiperwrapper'>
{this.state.productpic.map((item, index) => {
return (
<div className="swiper-slide">
<div className='swiper-slide'>
<img src={item.url} />
</div>
);
)
})}
</div>
<div className="swiper-pagination"></div>
<div className='swiper-pagination'></div>
</div>
) : null}
</div>
<div className="mobile_center"></div>
<div className="mobile_bottom">
<div className='mobile_center'></div>
<div className='mobile_bottom'>
{this.state.model.detail_url ? (
<img src={this.state.model.detail_url} />
) : null}
</div>
</div>
</div>
);
)
}
}

View File

@ -474,6 +474,7 @@ export default class acclist extends React.Component {
obj.origin = item.origin // 原始数据
}
obj.only = item.only
obj.weight = item.weight
obj.type = item.type
obj.upstream = item.upstream
return obj

View File

@ -596,6 +596,7 @@ export default class acclist extends React.Component {
obj.effectDate = item.effectDate //有效时间
obj.origin = item.origin // 原始数据
}
obj.weight = item.weight
obj.only = item.only
obj.type = item.type
obj.upstream = item.upstream

View File

@ -38,6 +38,7 @@ export default class adduserinfo extends React.Component {
official_price: '',
cost_price: '',
quantity: '',
weight: 0,
product_name: '',
show_url: '',
describe_url: '',
@ -82,6 +83,7 @@ export default class adduserinfo extends React.Component {
model.quantity = model_temp.quantity
model.product_name = model_temp.product_name
model.show_url = model_temp.show_url
model.weight = model_temp.weight
model.detail_url = model_temp.detail_url
model.account_type = model_temp.account_type
let defaultPic = []
@ -178,6 +180,7 @@ export default class adduserinfo extends React.Component {
})
temp[index].product_name = this.state.model.product_name
temp[index].weight = this.state.model.weight
temp[index].account_type = this.state.model.account_type
temp[index].product_id = this.state.model.product_id
temp[index].product_type = this.state.model.product_type
@ -248,6 +251,7 @@ export default class adduserinfo extends React.Component {
model2.cost_price = cur_product.cost_price
model2.quantity = this.state.model.quantity
model2.product_name = cur_product.title
model2.weight = cur_product.weight
model2.account_type = cur_product.account_type
model2.show_url = picItem ? picItem.pic : ''
model2.describe_url = ''
@ -458,7 +462,16 @@ export default class adduserinfo extends React.Component {
reg: '^[0-9]+(.[0-9]{1,4})?$'
}
],
product_name: [{ type: 'required', message: '请输入商品名称' }]
product_name: [{ type: 'required', message: '请输入商品名称' }],
/* 权重 */
weight: [
{ type: 'required', message: '请输入权重' },
{
type: 'regExp',
message: '请输入0~100权重数字',
reg: '^([0-9]{0,2}|100)$'
}
]
}
return (
@ -489,6 +502,29 @@ export default class adduserinfo extends React.Component {
<FormItem labelname='预估成本价' prop='cost_price' id='cost_price'>
<div className='line-value'>{this.state.model.cost_price}</div>
</FormItem>
<FormItem labelname='商品权重' prop='weight' id='weight'>
<Ipt
onChange={(e) => {
let model2 = this.state.model
model2.weight = e
this.setState({ model: model2 })
}}
onClearItem={(e) => {
let model2 = this.state.model
model2.weight = ''
this.setState({ model: model2 })
}}
value={this.state.model.weight}
placeholder={'请输入'}
labelWidth={'0px'}
maxLength={3}
height={'36px'}
countShow={false}
width={'520px'}
alignment={'left'}
/>
</FormItem>
<FormItem labelname='商品库存' prop='quantity' id='quantity'>
<Ipt
onChange={(e) => {