From 8ebc169d5ab37c3d5be8bef976f35ea278e83af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com> Date: Thu, 25 Nov 2021 15:51:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangecode/add/add.js | 30 +++++++++++++++++++------ src/pages/exchangecode/edit/edit.js | 12 ++++++++-- src/pages/exchangecode/product/add.js | 32 +++++---------------------- src/pages/plan/add/add.js | 2 +- src/pages/plan/add/step2.js | 18 +++++++++++++-- 5 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/pages/exchangecode/add/add.js b/src/pages/exchangecode/add/add.js index e4c3adfc..0cad5e0c 100644 --- a/src/pages/exchangecode/add/add.js +++ b/src/pages/exchangecode/add/add.js @@ -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{
- +
@@ -637,7 +653,7 @@ export default class acclist extends React.Component{ } visible={this.state.drawerVisible} onClose={(e) =>{this.closeDraw()} } - maskClosable + >
@@ -768,7 +784,7 @@ export default class acclist extends React.Component{ } visible={this.state.drawerVisible2} onClose={(e) =>{this.setState({drawerVisible2:false})} } - maskClosable + >
diff --git a/src/pages/exchangecode/edit/edit.js b/src/pages/exchangecode/edit/edit.js index b0b5a9d1..635b186f 100644 --- a/src/pages/exchangecode/edit/edit.js +++ b/src/pages/exchangecode/edit/edit.js @@ -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{
- +
diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index 50ac8d0a..eb102c05 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -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;