Commit 38ba5926 by wujiabao

fix bug add pop

parent 916df3fc
......@@ -3,7 +3,6 @@ import {saveCommonInfo} from './common'
import barcodeActionType from '../actiontype/barcodeCommon'
import replenishAction from './replenish'
let domain = ENV.domain;
let domain1='http://192.168.10.176:8080/web/'
//test 输入条形码获取商品信息
const getBarCodeProductInfo = (data)=>{
......@@ -21,43 +20,48 @@ const getBarCodeProductInfo = (data)=>{
mode : 'cors'
}).then((response)=>response.json())
.then((json)=>{
if(json.meta.success&&json.data){
dispatch(replenishAction.emptyErrorInfo()); //补货清空错误数据
let info = Object.assign({},{taskList:json.data});
dispatch(saveCommonInfo(info))
dispatch(saveProductInfo(json.data))
if(!json.meta.success&&!json.data){
dispatch(saveProductInfo(json.meta))
}else{
dispatch(saveProductInfo({}));
switch (taskInfo.currentTaskType){
case 3 :
//回收任务
break;
case 'ADDR' :
//补货任务
let errorType = json.data && json.data.errorType ? json.data.errorType : "";
let errorMessage = json.meta.message;
switch (errorType){
case "NT":
errorMessage = "不在本次补货范围内";
break;
case "NA" :
errorMessage = "不在本区补货范围";
break;
case "NS":
errorMessage = "需要补完上一次的商品";
break;
case "TW":
errorMessage = "拿错货品";
break;
}
let errorInfo = {
errorType : errorType,
errorMessage : errorMessage
};
dispatch(replenishAction.wrongQrcode(errorInfo));
break;
if(json.meta.success&&json.data){
dispatch(replenishAction.emptyErrorInfo()); //补货清空错误数据
let info = Object.assign({},{taskList:json.data});
dispatch(saveCommonInfo(info))
dispatch(saveProductInfo(json.data))
}else{
dispatch(saveProductInfo({}));
switch (taskInfo.currentTaskType){
case 3 :
//回收任务
break;
case 'ADDR' :
//补货任务
let errorType = json.data && json.data.errorType ? json.data.errorType : "";
let errorMessage = json.meta.message;
switch (errorType){
case "NT":
errorMessage = "不在本次补货范围内";
break;
case "NA" :
errorMessage = "不在本区补货范围";
break;
case "NS":
errorMessage = "需要补完上一次的商品";
break;
case "TW":
errorMessage = "拿错货品";
break;
}
let errorInfo = {
errorType : errorType,
errorMessage : errorMessage
};
dispatch(replenishAction.wrongQrcode(errorInfo));
break;
}
}
}
})
}
......@@ -70,6 +74,11 @@ const saveProductInfo = (data)=>{
data
}
}
const saveStatus = (data)=>{
return {
type : barcodeActionType.GETSTATUS,
data
}
}
export {getBarCodeProductInfo,saveProductInfo}
\ No newline at end of file
import fetch from 'isomorphic-fetch'
import {getTaskList} from "./common";
import breakageActionType from '../actiontype/breakageContainer'
let domain = ENV.domain;
let domain1='http://192.168.10.176:8080/web/'
//提交遗留上报的商品
let myHeaders = new Headers({
// 'Access-Control-Allow-Origin': '*',
......@@ -11,7 +11,6 @@ let myHeaders = new Headers({
});
const submitBreakageProduct = (data)=>{
console.log(data,"执行了提交遗留上报")
let {productDetail,commonInfo}=data;
let userId=commonInfo.userInfo.id;
let {taskId}=commonInfo.taskInfo;
......@@ -19,7 +18,7 @@ const submitBreakageProduct = (data)=>{
let {skuPosition,skuId,skuStatus}=productDetail;
let bodyData={skuPosition,skuId,skuStatus,machineId,taskId}
let url=domain+`machine_pad/lr/${userId}`
return ()=>{
return (dispatch)=>{
fetch(url,{
// credentials : 'include',
method : 'POST',
......@@ -31,7 +30,8 @@ const submitBreakageProduct = (data)=>{
body:JSON.stringify(bodyData)
}).then((response)=>response.json())
.then((json)=>{
console.log(json)
console.log(json,'breakageContainerjs')
dispatch(getSubmitStatus(json.meta))
})
}
}
......@@ -55,4 +55,10 @@ const hasNoSku = (commonInfo)=>{
}
}
const getSubmitStatus = (data)=>{
return {
type:breakageActionType.SUBMITSTATUS,
data
}
}
export {submitBreakageProduct,hasNoSku}
\ No newline at end of file
......@@ -67,7 +67,6 @@ const getUserinfo = (employeeId,storeId)=>{
//拉取工单
const getTaskList = (data={})=>{
let {storeInfo={},userInfo={},taskInfo={}} = data;
console.log("getTaskList ",data)
let taskId=taskInfo.taskId || 0;
let url =`${domain}machine_pad/work/list/${storeInfo.id}/${taskInfo.area}/${taskId}/${userInfo.id}`;
return (dispatch)=>{
......@@ -84,7 +83,6 @@ const getTaskList = (data={})=>{
}).then(response=>response.json())
.then((json)=>{
let data =Object.assign({});
console.log("拉取工单 ",json)
if(json.meta.success && json.data){
data.taskInfo = Object.assign({},json.data.flatCommonVo);
// if(json.data.flatCommonVo.currentTaskType !== 'ADDR'){
......
const breakActionType={
GETPRODUCTINFO:'GETPRODUCTINFO'
GETPRODUCTINFO:'GETPRODUCTINFO',
GETSTATUS:'GETSTATUS'
}
export default breakActionType
\ No newline at end of file
const breakageActionType={
SUBMITSTATUS:'SUBMITSTATUS'
}
export default breakageActionType
\ No newline at end of file
......@@ -16,6 +16,7 @@ class BreakageCode extends React.Component{
</div>
<BarcodeComponent getBarCodeProductInfo={this.props.getBarCodeProductInfo}
changePage={this.props.changePage}
breakageProductInfo={this.props.breakageProductInfo}
/>
</div>
)
......
......@@ -35,11 +35,18 @@ class BarcodeComponent extends React.Component{
//验证输入的条形码是否为空
if(barcode){
props.getBarCodeProductInfo(barcode);
props.changePage&&props.changePage(2)
this.setState({barcodeWord:false})
// props.changePage&&props.changePage(2)
this.setState({barcodeWord:false,barcode:''});
}else{
this.setState({barcodeWord:true})
}
}
componentWillReceiveProps(nextProps){
let props=this.props;
if(nextProps.breakageProductInfo.product&&nextProps.breakageProductInfo.product.success!==false){
props.changePage&&props.changePage(2)
}
}
}
export default BarcodeComponent;
\ No newline at end of file
......@@ -16,14 +16,15 @@ class BreakageContainer extends React.Component {
showPage:1,//初始显示的页面
isShow:true,//控制扫码页的显示隐藏
SanCodePage:'SanCode',//控制显示扫码或手动输入
popShow:false //控制弹框
popShow:false, //控制弹框,
pop1Show:true //控制异常弹窗显示
}
this.changePage=this.changePage.bind(this);
}
render(){
let props=this.props;
let {isShow,popShow}=this.state;
let {isShow,popShow,pop1Show}=this.state;
return (
<div className={"BreakageContainer"}>
{
......@@ -39,13 +40,26 @@ class BreakageContainer extends React.Component {
}
{
popShow?<div style={{width:'100%',height:'100%',background:'rgba(0,0,0,.8)',position:'absolute',top:'0',left:'0'}}>
<PopModel popupTitle={"货品匹配成功"} classContainer={"recoveryPopInfo"}>
<div className={"icon iconfont icon-correct font150 col27ce61"} />
<PopModel popupTitle={props.breakageContainer.status&&props.breakageContainer.status.success?"货品匹配成功":'货品匹配失败'} classContainer={"recoveryPopInfo"}>
<div className={props.breakageContainer.status&&props.breakageContainer.status.success?"icon iconfont icon-correct font150 col27ce61":"icon iconfont icon-exclamation font150 colfffd00"} />
<div className={"text font40 col000"}>
<p>请将货品放入回收箱</p>
<p>{props.breakageContainer.status&&props.breakageContainer.status.message}</p>
</div>
<div className={"btn"}>
<Button text={'已放入'} btnContainer={'font32 backff775c colfff'} option={this.changePopHide.bind(this)} />
<Button text={props.breakageContainer.status&&props.breakageContainer.status.success?"已放入":'关闭'} btnContainer={'font32 backff775c colfff'} option={this.changePopHide.bind(this,props.breakageContainer.status&&props.breakageContainer.status.success)} />
</div>
</PopModel>
</div>:null
}
{
!pop1Show?<div style={{width:'100%',height:'100%',background:'rgba(0,0,0,.8)',position:'absolute',top:'0',left:'0'}}>
<PopModel popupTitle={"货品异常"} classContainer={"recoveryPopInfo"}>
<div className={"icon iconfont icon-exclamation font150 colfffd00"} />
<div className={"text font40 col000"}>
<p>{props.breakageProductInfo.product.message}</p>
</div>
<div className={"btn"}>
<Button text={'关闭'} btnContainer={'font32 backff775c colfff'} option={this.changePopHideReturn.bind(this)} />
</div>
</PopModel>
</div>:null
......@@ -55,11 +69,22 @@ class BreakageContainer extends React.Component {
}
//控制弹框消失
changePopHide(){
this.changePopShow(false)
this.changePage(1)
changePopHide(bool){
this.changePopShow(false);
if(bool){
this.changePage(1)
}else{
this.changeCodePage(false);
this.changeSanCodePage('HandCode');
}
}
//控制弹框消失返回输入条形码页
changePopHideReturn(){
this.setState({
pop1Show:true
})
this.changeSanCodePage('HandCode')
}
//改变显示的组件
changePage(page){
this.setState({
......@@ -109,6 +134,7 @@ class BreakageContainer extends React.Component {
getSanCodePgae(){
let {SanCodePage}=this.state;
let SanPage=null;
let props=this.props;
switch(SanCodePage){
case 'SanCode' :
SanPage=<SanCodeComponent changeSanCodePage={this.changeSanCodePage.bind(this)}
......@@ -116,7 +142,12 @@ class BreakageContainer extends React.Component {
/>
break;
case 'HandCode' :
SanPage=<BreakageCode changePage={this.changePage.bind(this)} changeSanCodePage={this.changeSanCodePage.bind(this)} getBarCodeProductInfo={this.getproductCode.bind(this)} />
SanPage=<BreakageCode changePage={this.changePage.bind(this)}
changeSanCodePage={this.changeSanCodePage.bind(this)}
getBarCodeProductInfo={this.getproductCode.bind(this)}
breakageProductInfo={props.breakageProductInfo}
/>
break;
}
return SanPage;
......@@ -136,5 +167,12 @@ class BreakageContainer extends React.Component {
changePopShow(bool){
this.setState({popShow:bool})
}
componentWillReceiveProps(nextProps){
if(nextProps.breakageProductInfo.product&&nextProps.breakageProductInfo.product.success===false){
this.setState({pop1Show:nextProps.breakageProductInfo.product.success})
}else{
this.setState({pop1Show:true})
}
}
}
export default BreakageContainer
\ No newline at end of file
......@@ -617,6 +617,7 @@ class PageContainer extends React.Component {
headerInfo={commonInfo}
getBarCodeProductInfo={(barcode)=>{dispatch(getBarCodeProductInfo({barcode,commonInfo}))}}
breakageProductInfo={state.barcodeCommon}
breakageContainer ={state.breakageContainer}
submitBreakageProduct={(productDetail)=>{dispatch(submitBreakageProduct({commonInfo,productDetail}))}}
/>;
break;
......
......@@ -6,10 +6,16 @@ const saveProductInfo = (data,content)=>{
let newState = JSON.parse(JSON.stringify(data));
return Object.assign({},newState,{product:content})
}
const saveStatus = (data,content)=>{
let newState = JSON.parse(JSON.stringify(data));
return Object.assign({},newState,{status:content})
}
export default function(state={}, action) {
switch (action.type) {
case barcodeActionType.GETPRODUCTINFO:
return saveProductInfo(state,action.data);
case barcodeActionType.GETSTATUS :
return saveStatus(state,action.data)
default:
return state;
}
......
import breakageActionType from '../actiontype/breakageContainer'
//扫码商品的信息
const saveStatus = (data,content)=>{
let newState = JSON.parse(JSON.stringify(data));
return Object.assign({},newState,{status:content})
}
export default function(state={}, action) {
switch (action.type) {
case breakageActionType.SUBMITSTATUS :
return saveStatus(state,action.data)
default:
return state;
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import barcodeCommon from './barcodeCommon'
import replenishInfo from './replenish'
import recoveryInfo from './recovery'
import TokeStokeContainer from './TokeStokeContainer'
import breakageContainer from './breakageContainer'
export default combineReducers({
troubleList,
storeInfo,
......@@ -27,7 +28,8 @@ export default combineReducers({
barcodeCommon,
replenishInfo,
recoveryInfo,
TokeStokeContainer
TokeStokeContainer,
breakageContainer
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment