diff --git a/src/assets/api.js b/src/assets/api.js index f9a268a9..7415c000 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -461,6 +461,17 @@ export const getCodeProduct = (batch_id,id) => { } +//获取商品库存明细 +export const getIsRequireApproval = (id,data) => { + return req('post', baseurl + "/codes/"+id+"/is_require_approval",data) +} + + + + + + + // //蓝色兄弟映射商品 export const getProductInfoSelect = (params) => { return req('get', baseurl + "/product/market/products",params) diff --git a/src/pages/exchangecode/edit/edit.js b/src/pages/exchangecode/edit/edit.js index b20f9eed..b6281de3 100644 --- a/src/pages/exchangecode/edit/edit.js +++ b/src/pages/exchangecode/edit/edit.js @@ -5,7 +5,7 @@ import Form from "../../../components/form/main" import FormItem from "../../../components/form-item/main" import {Card,Radio,Icon, Drawer, Select,Button,ImageUpload ,DateRangePicker,onUpload,Sweetalert,RadioButton,RadioGroup,Notify,Input,CombinedDateRangePicker} from "zent" import Bus from "../../../assets/eventBus.js" -import {getApprovalsStatus,getReseller,getApprovalsInfo,terminateApprovals,getProductInfoSelect,handelResponse,uploadImg,getCodeProduct,putCodeProduct,getCodesDetail,putCodes,putCodesBatch} from "../../../assets/api.js" +import {getIsRequireApproval,getApprovalsStatus,getReseller,getApprovalsInfo,terminateApprovals,getProductInfoSelect,handelResponse,uploadImg,getCodeProduct,putCodeProduct,getCodesDetail,putCodes,putCodesBatch} from "../../../assets/api.js" import _ from "lodash"; import Productform from "../product/add" import "./edit.less" @@ -56,7 +56,7 @@ export default class exchangedit extends React.Component{ paytype:3, reseller:null, payment_direction:["对私账户","对公账户","预付款扣除"], - + isAudit:false, } } @@ -254,15 +254,7 @@ export default class exchangedit extends React.Component{ } - - submitCodeData(){ - - if(!this.state.reseller) - { - Notify.error("该兑换码对应分销商不存在") - return - } - + buildData(){ let code_batch_id = sessionStorage.getItem("code_id") let range = [] @@ -311,15 +303,6 @@ export default class exchangedit extends React.Component{ let deleteProduct= _.differenceWith(this.state.oldProduct, updateIds, _.isEqual); - console.log("分销商",this.state.reseller) - - - // _.filter(deleteProduct,(item)=>{ - // this.state.new_product.indexOf(item) - // }) - - - deleteProduct = deleteProduct.filter((item)=>{return this.state.new_product.indexOf(item) < 0}) console.log(this.state.new_product) if(this.state.deleteProduct.length > 0) @@ -390,6 +373,18 @@ export default class exchangedit extends React.Component{ "update_product":updateProduct, "delete_product": deleteProduct, } + return data + } + 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)=>{ console.log(req) @@ -423,7 +418,26 @@ export default class exchangedit extends React.Component{ Notify.error("还有图片上传中,不可提交") return } - this.setState({audit_visible:true}) + let code_batch_id = sessionStorage.getItem("code_id") + let data = this.buildData() + 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) + }) + }) + + } } diff --git a/src/pages/plan/key/list.js b/src/pages/plan/key/list.js index f4e69a43..01f2fca1 100644 --- a/src/pages/plan/key/list.js +++ b/src/pages/plan/key/list.js @@ -122,7 +122,7 @@ export default class acclist extends React.Component{ dataCount:0, page:1, limit:10, - tabList:[{title:"全部"},{title:"创建中"},{title:"审核中"},{title:"进行中"},{title:"暂停中"},{title:"已完结"},{title:"已作废"},{title:"审批驳回"}], + tabList:[{title:"全部"},{title:"创建中"},{title:"审核中"},{title:"审批驳回"},{title:"进行中"},{title:"暂停中"},{title:"已完结"},{title:"已作废"}], distdata:[], combinedValue:[], distdata2:[{id:12313123213123,name:'爱奇艺月卡兑换券',time:'2021-11-08 14:21:06至2021-11-08 15:06:04',plan:'营销计划2',belongid:3123213,send:100,record:58,used:41,dead:11,fail:12,status:'1'}], @@ -311,6 +311,8 @@ export default class acclist extends React.Component{ } tabFn(index){ this.setState({activepage:index,key_word:''}); + console.log(index) + if(index == 1) { this.setState({activepage:1}); @@ -321,21 +323,21 @@ export default class acclist extends React.Component{ } if(index==3){ - this.setState({activepage:4}); + this.setState({activepage:8}); } if(index==4){ - this.setState({activepage:5}); + this.setState({activepage:4}); } if(index==5){ - this.setState({activepage:6}); + this.setState({activepage:5}); } if(index==6){ - this.setState({activepage:7}); + this.setState({activepage:6}); } if(index == 7) { - this.setState({activepage:8}); + this.setState({activepage:7}); } this.setState({page:1,limit:10})