修复bug
This commit is contained in:
parent
dc5182fb89
commit
8ebc169d5a
|
@ -138,7 +138,7 @@ export default class acclist extends React.Component{
|
|||
}
|
||||
return valide
|
||||
}
|
||||
onCancel(){
|
||||
Cancel(){
|
||||
Sweetalert.confirm({
|
||||
type:'warning',
|
||||
closeBtn:true,
|
||||
|
@ -195,9 +195,11 @@ export default class acclist extends React.Component{
|
|||
date_time:"",
|
||||
range:""
|
||||
};
|
||||
this.state.rank = null
|
||||
this.state.tempdata = []
|
||||
this.setState({tempdata:[]})
|
||||
this.setState({rank:null})
|
||||
this.setState({rankoptions:[]})
|
||||
this.setState({drawerVisible:true})
|
||||
sessionStorage.setItem("productData","")
|
||||
}
|
||||
closeDraw(){
|
||||
this.setState({drawerVisible:false})
|
||||
|
@ -253,6 +255,21 @@ export default class acclist extends React.Component{
|
|||
if(this.refs.code_info.validator() && this.refs.code_rule.validator())
|
||||
{
|
||||
|
||||
|
||||
|
||||
let productlist = _.filter(this.state.tempdata,(item)=>{return item.checked == true})
|
||||
let sum = 0;
|
||||
_.forEach(productlist,(o)=>{
|
||||
sum += parseInt(o.quantity);
|
||||
})
|
||||
console.log("总数"+sum)
|
||||
if(sum < this.state.codeInfo.issued)
|
||||
{
|
||||
Notify.error("所选商品库存总数小于发放量")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.setState({drawerVisible:false})
|
||||
let rank = _.map(this.state.rank,(item)=>{
|
||||
return item.text
|
||||
|
@ -271,7 +288,6 @@ export default class acclist extends React.Component{
|
|||
|
||||
}
|
||||
|
||||
let productlist = _.filter(this.state.tempdata,(item)=>{return item.checked == true})
|
||||
let arr = _.map(productlist,(item)=>{
|
||||
let obj={}
|
||||
obj.product_id = item.id;
|
||||
|
@ -620,7 +636,7 @@ export default class acclist extends React.Component{
|
|||
|
||||
<div className="addkey-btn-group">
|
||||
<Button type="primary" onClick={()=>this.onAudit()}>提交审核</Button>
|
||||
<Button type="normal" onClick={()=>this.onCancel()}>取消</Button>
|
||||
<Button type="normal" onClick={()=>this.Cancel()}>取消</Button>
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -637,7 +653,7 @@ export default class acclist extends React.Component{
|
|||
}
|
||||
visible={this.state.drawerVisible}
|
||||
onClose={(e) =>{this.closeDraw()} }
|
||||
maskClosable
|
||||
|
||||
>
|
||||
<div className="draw">
|
||||
<Card style={{ width:'90%',"margin":"10px auto"}} title={'基本信息'}>
|
||||
|
@ -768,7 +784,7 @@ export default class acclist extends React.Component{
|
|||
}
|
||||
visible={this.state.drawerVisible2}
|
||||
onClose={(e) =>{this.setState({drawerVisible2:false})} }
|
||||
maskClosable
|
||||
|
||||
>
|
||||
<div className="draw2">
|
||||
<Card style={{ width:'90%',"margin":"10px auto" }} >
|
||||
|
|
|
@ -9,6 +9,7 @@ import {getProductInfoSelect,handelResponse,uploadImg,getCodeProduct,putCodeProd
|
|||
import _ from "lodash";
|
||||
import Productform from "../product/add"
|
||||
import "./edit.less"
|
||||
import moment from "moment";
|
||||
import Grid from "../../../components/gird/main.js"
|
||||
const data = [{"id":21,"title":"爱奇艺周卡组合商品测试专用","type":1,"official_price":"13.0000","cost_price":"78.8400","account_type":5},{"id":22,"title":"喜马拉雅18月卡组合卡","type":1,"official_price":"218.0000","cost_price":"163.8000","account_type":1},{"id":23,"title":"爱奇艺月卡与美团外卖会员月卡组合","type":1,"official_price":"25.0000","cost_price":"33.3000","account_type":3},{"id":24,"title":"腾讯视频月卡和Q绿钻月卡组合","type":1,"official_price":"20.0000","cost_price":"247.2000","account_type":1},{"id":25,"title":"优酷月卡和百度文库3天卡组合","type":1,"official_price":"20.0000","cost_price":"144.5400","account_type":5},{"id":26,"title":"爱奇艺年卡和饿了么年卡组合","type":1,"official_price":"248.0000","cost_price":"10.0000","account_type":4},{"id":27,"title":"优酷年卡和网易云音乐年卡组合","type":1,"official_price":"198.0000","cost_price":"33.6400","account_type":4},{"id":28,"title":"芒果PC年卡和喜马拉雅季卡组合","type":1,"official_price":"198.0000","cost_price":"40.9500","account_type":1},{"id":88,"title":"测试商品-爱艺奇周卡-石竹","type":1,"official_price":"13.0000","cost_price":"7.5000","account_type":1},{"id":101,"title":"优酷周卡","type":1,"official_price":"9.0000","cost_price":"4.8150","account_type":1},{"id":102,"title":"优酷月卡","type":1,"official_price":"20.0000","cost_price":"12.0000","account_type":1},{"id":103,"title":"优酷季卡","type":1,"official_price":"56.0000","cost_price":"33.6000","account_type":1},{"id":104,"title":"优酷年卡","type":1,"official_price":"198.0000","cost_price":"118.8000","account_type":1},{"id":105,"title":"爱奇艺黄金会员天卡","type":1,"official_price":"8.0000","cost_price":"2.3400","account_type":1},{"id":106,"title":"爱奇艺黄金会员周卡","type":1,"official_price":"13.0000","cost_price":"4.0000","account_type":1},{"id":107,"title":"爱奇艺黄金会员月卡","type":1,"official_price":"25.0000","cost_price":"12.8700","account_type":1},{"id":108,"title":"爱奇艺黄金会员季卡","type":1,"official_price":"68.0000","cost_price":"37.7000","account_type":1},{"id":109,"title":"爱奇艺黄金会员半年卡","type":1,"official_price":"130.0000","cost_price":"70.2000","account_type":1},{"id":110,"title":"爱奇艺黄金会员年卡","type":1,"official_price":"248.0000","cost_price":"128.7000","account_type":1},{"id":111,"title":"爱奇艺钻石月卡","type":1,"official_price":"60.0000","cost_price":"27.0000","account_type":1},{"id":112,"title":"爱奇艺钻石季卡","type":1,"official_price":"168.0000","cost_price":"65.5200","account_type":1},{"id":113,"title":"爱奇艺钻石半年卡","type":1,"official_price":"328.0000","cost_price":"127.9200","account_type":1},{"id":114,"title":"爱奇艺钻石年卡","type":1,"official_price":"618.0000","cost_price":"247.2000","account_type":1},{"id":115,"title":"腾讯视频会员月卡","type":1,"official_price":"20.0000","cost_price":"11.2000","account_type":5},{"id":116,"title":"腾讯视频会员季卡","type":1,"official_price":"58.0000","cost_price":"34.8000","account_type":5},{"id":117,"title":"腾讯视频会员年卡","type":1,"official_price":"198.0000","cost_price":"118.8000","account_type":5},{"id":118,"title":"腾讯视频会员月卡微信","type":1,"official_price":"20.0000","cost_price":"13.0000","account_type":5},{"id":119,"title":"腾讯视频会员季卡微信","type":1,"official_price":"58.0000","cost_price":"37.7000","account_type":5},{"id":120,"title":"腾讯视频会员年卡微信","type":1,"official_price":"198.0000","cost_price":"110.0000","account_type":5},{"id":121,"title":"腾讯视频会员周卡","type":1,"official_price":"9.0000","cost_price":"5.0000","account_type":13}]
|
||||
|
||||
|
@ -216,7 +217,7 @@ export default class exchangedit extends React.Component{
|
|||
|
||||
|
||||
onUploadChange(files){
|
||||
if(files[0].file)
|
||||
if(files&&files[0].file)
|
||||
{
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",files[0].file)
|
||||
|
@ -233,7 +234,7 @@ export default class exchangedit extends React.Component{
|
|||
console.log(files);
|
||||
};
|
||||
onUploadChange1(files){
|
||||
if(files[0].file)
|
||||
if(files&&files[0].file)
|
||||
{
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",files[0].file)
|
||||
|
@ -288,6 +289,12 @@ export default class exchangedit extends React.Component{
|
|||
},500)
|
||||
}
|
||||
}
|
||||
|
||||
onDisabledCombinedDate = (val)=>{
|
||||
let str = moment(val).format("YYYY-MM-DD HH:mm:ss")
|
||||
let isBetween = moment(str).isBetween(this.state.codeInfo.date_time[0],this.state.codeInfo.date_time[1]);
|
||||
return !isBetween
|
||||
}
|
||||
render(){
|
||||
const options = [
|
||||
{
|
||||
|
@ -460,6 +467,7 @@ export default class exchangedit extends React.Component{
|
|||
<CombinedDateRangePicker canClear={false}
|
||||
className="zent-datepicker-plan"
|
||||
value={this.state.codeInfo.date_time}
|
||||
disabledDate={this.onDisabledCombinedDate}
|
||||
showTime={{
|
||||
format: 'HH:mm:ss',
|
||||
defaultTime: ['12:00:00', '23:59:59'],
|
||||
|
|
|
@ -138,7 +138,7 @@ export default class adduserinfo extends React.Component{
|
|||
|
||||
|
||||
onUploadChange(files){
|
||||
if(files[0].file)
|
||||
if(files && files[0].file)
|
||||
{
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",files[0].file)
|
||||
|
@ -155,7 +155,7 @@ export default class adduserinfo extends React.Component{
|
|||
console.log(files);
|
||||
};
|
||||
onUploadChange1(files){
|
||||
if(files[0].file)
|
||||
if(files && files[0].file)
|
||||
{
|
||||
let formdata= new FormData();
|
||||
formdata.append("file",files[0].file)
|
||||
|
@ -180,25 +180,7 @@ export default class adduserinfo extends React.Component{
|
|||
};
|
||||
|
||||
render(){
|
||||
const options = [
|
||||
{
|
||||
key: '1',
|
||||
text: 'Option 1',
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
text: 'Option 2',
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
text: 'Option 3',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
key: '4',
|
||||
text: `君不见,黄河之水天上来,奔流到海不复回`,
|
||||
},
|
||||
];
|
||||
|
||||
//校验规则
|
||||
const rules = {
|
||||
product: [
|
||||
|
@ -214,12 +196,8 @@ export default class adduserinfo extends React.Component{
|
|||
product_name:[
|
||||
{ type: "required", message: "请输入商品名称"},
|
||||
],
|
||||
show_url:[
|
||||
{ type: "required", message: "请上传商品展示"},
|
||||
],
|
||||
describe_url:[
|
||||
{ type: "required", message: "请上传商品描述"},
|
||||
]
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ export default class add extends React.Component{
|
|||
</div>
|
||||
</div>
|
||||
<div className="audit-btn-group">
|
||||
<Button onClick={(e)=>{this.cancel(e)}}>取消</Button>
|
||||
<Button onClick={(e)=>{this.onCancel(e)}}>取消</Button>
|
||||
<Button type="primary" onClick={(e)=>{this.send(e)}} >发送</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -211,6 +211,22 @@ export default class acclist extends React.Component{
|
|||
if(this.refs.code_info.validator() && this.refs.code_rule.validator())
|
||||
{
|
||||
|
||||
|
||||
let productlist = _.filter(this.state.tempdata,(item)=>{return item.checked == true})
|
||||
let sum = 0;
|
||||
|
||||
|
||||
_.forEach(productlist,(o)=>{
|
||||
sum += o.quantity;
|
||||
})
|
||||
if(sum < this.state.codeInfo.issued)
|
||||
{
|
||||
Notify.error("所选商品库存总数小于发放量")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.setState({drawerVisible:false})
|
||||
let rank = _.map(this.state.rank,(item)=>{
|
||||
return item.text
|
||||
|
@ -229,8 +245,6 @@ export default class acclist extends React.Component{
|
|||
|
||||
}
|
||||
|
||||
let productlist = _.filter(this.state.tempdata,(item)=>{return item.checked == true})
|
||||
console.log(productlist)
|
||||
let arr = _.map(productlist,(item)=>{
|
||||
let obj={}
|
||||
obj.product_id = item.id;
|
||||
|
|
Loading…
Reference in New Issue