Commit 75bddc2e by yaxiLiuu

add changePage â

parent 465b8ffd
...@@ -79,7 +79,7 @@ const fakeJsonData2 = { ...@@ -79,7 +79,7 @@ const fakeJsonData2 = {
"data": {}} "data": {}}
export function scanBarCodeGetProductInfo(postData) { export function scanBarCodeGetProductInfo(postData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'/web/machine_pad/scanning_sku_barcode_for_add_loss_task'); /*let url = String(domain+'/web/machine_pad/scanning_sku_barcode_for_add_loss_task');
console.log(url) console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
...@@ -102,11 +102,10 @@ export function scanBarCodeGetProductInfo(postData) { ...@@ -102,11 +102,10 @@ export function scanBarCodeGetProductInfo(postData) {
} }
} }
).catch(e=>dispatch(console.log("出现错误")) ).catch(e=>dispatch(console.log("出现错误"))
) )*/
/*dispatch(initSuccess(fakeJsonData.data))*/ dispatch(initSuccess(fakeJsonData.data))
} }
} }
export function submitProductInfo(postaData) { export function submitProductInfo(postaData) {
return (dispatch)=>{ return (dispatch)=>{
/* let url = String(domain+'/web/ssubmit_add_loss_task'); /* let url = String(domain+'/web/ssubmit_add_loss_task');
...@@ -132,6 +131,15 @@ export function submitProductInfo(postaData) { ...@@ -132,6 +131,15 @@ export function submitProductInfo(postaData) {
dispatch(submitProductSuccess(submit)) dispatch(submitProductSuccess(submit))
} }
} }
export function saveEditProductInfo(data) {
console.log("=========action============")
console.log(data)
return (dispatach) =>{
dispatach(saveEditProductInfoSuccess(data))
}
}
function initSuccess(data) { function initSuccess(data) {
return { return {
type: actionTypes.INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS, type: actionTypes.INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS,
...@@ -144,6 +152,12 @@ function submitProductSuccess(data) { ...@@ -144,6 +152,12 @@ function submitProductSuccess(data) {
data data
} }
} }
function saveEditProductInfoSuccess(data){
return {
type:actionTypes.SAVE_PRODUCTEDITINFO_SUCCESS,
data
}
}
function throwError(data) { function throwError(data) {
return{ return{
type:actionTypes_error.ADDERRORINFO, type:actionTypes_error.ADDERRORINFO,
......
const INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS = 'INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS'; const INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS = 'INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS';
const SUBMIT_PRODUCT_SUCCESS = 'SUBMIT_PRODUCT_SUCCESS'; const SUBMIT_PRODUCT_SUCCESS = 'SUBMIT_PRODUCT_SUCCESS';
const SAVE_PRODUCTEDITINFO_SUCCESS = 'SAVE_PRODUCTEDITINFO_SUCCESS'
module.exports = {INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS,SUBMIT_PRODUCT_SUCCESS} module.exports = {INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS,SUBMIT_PRODUCT_SUCCESS,SAVE_PRODUCTEDITINFO_SUCCESS}
...@@ -6,34 +6,80 @@ export default class ProductDetailItem extends React.Component{ ...@@ -6,34 +6,80 @@ export default class ProductDetailItem extends React.Component{
super(props) super(props)
this.state = { this.state = {
currentPosition:undefined, currentPosition:undefined,
currentPakageStatus:undefined currentPakageStatus:undefined,
currentImgFiles:[]
} }
} }
componentWillMount(){
let {data_currentProblemObj,refreshImg,handleSaveEditProductInfo} = this.props;
this.setState({
currentPosition:data_currentProblemObj.lossPostion,
currentPakageStatus:data_currentProblemObj.packingStatus,
currentImgFiles:refreshImg.files
})
}
componentWillReceiveProps(nextProps){
let {refreshImg,handleSaveEditProductInfo} = nextProps;
let imgList = refreshImg.files && refreshImg.files.length>0 ? refreshImg.files:[];
let lastRefreshImg = this.props.refreshImg;
let lastImgList = lastRefreshImg.files && lastRefreshImg.files.length>0 ? lastRefreshImg.files:[];
if(String(imgList)!= String(lastImgList)){
let newImgIds = imgList.map((item,index)=>{
return Number(item.id);
})
let saveDataObj = {};
this.setState({
currentImgFiles:refreshImg.files
},()=>{
saveDataObj.type = "imgList";
saveDataObj.data = newImgIds;
handleSaveEditProductInfo(saveDataObj)
})
}
}
// 点击选择商品位置
handleSelectPosition(event){ handleSelectPosition(event){
let {handleSaveEditProductInfo} = this.props;
let currentValue = event.currentTarget.getAttribute('date-value'); let currentValue = event.currentTarget.getAttribute('date-value');
let saveDataObj = {};
this.setState({ this.setState({
currentPosition:currentValue currentPosition:currentValue
},()=>{
saveDataObj.type = "productPosition";
saveDataObj.data = currentValue;
handleSaveEditProductInfo(saveDataObj)
}) })
} }
//点击选择商品包装状态
handleSelectStaus(event){ handleSelectStaus(event){
let {handleSaveEditProductInfo} = this.props;
let saveDataObj = {};
let currentValue = event.currentTarget.getAttribute('date-value'); let currentValue = event.currentTarget.getAttribute('date-value');
this.setState({ this.setState({
currentPakageStatus:currentValue currentPakageStatus:currentValue
},()=>{
saveDataObj.type = "productPakingStatus";
saveDataObj.data = currentValue;
handleSaveEditProductInfo(saveDataObj)
}) })
} }
handleSubmit(){ handleSubmit(){
let {inventorylossId,skuBaseInfoVo,handleSubmitProductInfo} = this.props; let {inventorylossId,skuBaseInfoVo,handleSubmitProductInfo,data_currentProblemObj,changePages} = this.props;
let data = {}; let data = {};
data.inventoryLossId = inventorylossId; data.inventoryLossId = inventorylossId;
data.lossPostion = this.state.currentPosition; data.lossPostion = this.state.currentPosition;
data.packingStatus = this.state.currentPakageStatus; data.packingStatus = this.state.currentPakageStatus;
data.packingStatusImageIds = []; data.packingStatusImageIds = [];
handleSubmitProductInfo(data_currentProblemObj);
changePages(CONFIG.showPage[3])
} }
render(){ render(){
let props = this.props; let props = this.props;
let {skuBaseInfoVo,packingList,positionList} = this.props; let {skuBaseInfoVo,packingList,positionList,refreshImg} = this.props;
let imgFileList = refreshImg.files?refreshImg.files:[];
let productContent = ''; let productContent = '';
let positonUi = positionList.map((item,index)=>{ let positonUi = positionList.map((item,index)=>{
return <li return <li
...@@ -51,9 +97,18 @@ export default class ProductDetailItem extends React.Component{ ...@@ -51,9 +97,18 @@ export default class ProductDetailItem extends React.Component{
onClick={this.handleSelectStaus.bind(this)} onClick={this.handleSelectStaus.bind(this)}
>{item}</li> >{item}</li>
}) })
let imgListUi = imgFileList.map((item,index)=>{
return <ImgToolComponent
key={"img"+index}
type={"custom"}
noCloseBtn ={false}
imgSrc = {item.filePath}
handleClikCloseFunc = {()=>{props.handleDeleteImg(item.id)}}
></ImgToolComponent>
})
skuBaseInfoVo.skuAttributesVoList.map((item,index)=>{ skuBaseInfoVo.skuAttributesVoList.map((item,index)=>{
let newText = ""; let newText = "";
newText = item.value+item.unit newText = item.value+item.unit;
productContent+=newText; productContent+=newText;
}) })
return ( return (
...@@ -84,12 +139,7 @@ export default class ProductDetailItem extends React.Component{ ...@@ -84,12 +139,7 @@ export default class ProductDetailItem extends React.Component{
</div> </div>
<div className={"uploadContainer clearfix"}> <div className={"uploadContainer clearfix"}>
<div className={"uploadImgRight"}> <div className={"uploadImgRight"}>
{/* <ImgToolComponent {imgListUi}
type={"custom"}
noCloseBtn ={false}
imgSrc = { require('./img/lol.gif')}
handleClikCloseFunc = {props.handleDeleteImg}
></ImgToolComponent>*/}
</div> </div>
{ {
this.state.currentPakageStatus == 2?( this.state.currentPakageStatus == 2?(
......
...@@ -95,11 +95,12 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -95,11 +95,12 @@ export default class OtherQuestionContainer extends React.Component{
} }
handleSubmitProblemList(){ handleSubmitProblemList(){
let {submitProblemList,state}=this.props; let {submitProblemList,state,changePages}=this.props;
let problemList = state.otherQuestion.data_allProblemList; let problemList = state.otherQuestion.data_allProblemList;
console.log("=========================数量") console.log("=========================数量")
console.log(problemList); console.log(problemList);
submitProblemList(problemList) submitProblemList(problemList)
changePages(CONFIG.showPage[8])
} }
/* /*
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
height: 856px; height: 856px;
width: 100%; width: 100%;
background-color: #f5f5f5; background-color: #f5f5f5;
padding-left: 30px;
position: relative; position: relative;
} }
......
...@@ -5,7 +5,7 @@ import { connect } from 'react-redux'; ...@@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import {getStoreInfo} from "../../actions/getStore"; import {getStoreInfo} from "../../actions/getStore";
import {getTroubleList} from "../../actions/getTroubles"; import {getTroubleList} from "../../actions/getTroubles";
import {initGetOtherProblem,addNewProbem,deleteProblem,editProblemItem,submitProblemList} from "../../actions/otherQuestion" import {initGetOtherProblem,addNewProbem,deleteProblem,editProblemItem,submitProblemList} from "../../actions/otherQuestion"
import {scanBarCodeGetProductInfo,submitProductInfo} from "../../actions/ScanBarCode" import {scanBarCodeGetProductInfo,submitProductInfo,saveEditProductInfo} from "../../actions/ScanBarCode"
import {getReportDamageList,deleteDamageItem} from '../../actions/reportDamageList' import {getReportDamageList,deleteDamageItem} from '../../actions/reportDamageList'
import {getRefreshImg,deleteImg} from "../../actions/refreshImg" import {getRefreshImg,deleteImg} from "../../actions/refreshImg"
import {uploadError,addErrorInfo} from '../../actions/uploadError' import {uploadError,addErrorInfo} from '../../actions/uploadError'
...@@ -387,6 +387,10 @@ class PageContainer extends React.Component { ...@@ -387,6 +387,10 @@ class PageContainer extends React.Component {
pages = <ScanBarCodeContainer pages = <ScanBarCodeContainer
getProductInfo = {(postData)=>dispatch(scanBarCodeGetProductInfo(postData))} getProductInfo = {(postData)=>dispatch(scanBarCodeGetProductInfo(postData))}
submitProductInfo = {(postData)=>dispatch(submitProductInfo(postData))} submitProductInfo = {(postData)=>dispatch(submitProductInfo(postData))}
getRefreshImg={(errorId,type)=>dispatch(getRefreshImg(errorId,type))}
deleteImg={(errorId,type,fileId)=>dispatch(deleteImg(errorId,type,fileId))}
saveEditProductInfo = {(postData)=>dispatch(saveEditProductInfo(postData))}
changePages={(data)=>this.changePages(data)}
state = {state} state = {state}
/>; />;
break; break;
...@@ -394,6 +398,7 @@ class PageContainer extends React.Component { ...@@ -394,6 +398,7 @@ class PageContainer extends React.Component {
pages = <ReportDamagesListContainer pages = <ReportDamagesListContainer
getReportDamageList = {(postData)=>dispatch(getReportDamageList(postData))} getReportDamageList = {(postData)=>dispatch(getReportDamageList(postData))}
deleteDamageItem = {(postData)=>{dispatch(deleteDamageItem(postData))}} deleteDamageItem = {(postData)=>{dispatch(deleteDamageItem(postData))}}
changePages={(data)=>this.changePages(data)}
state = {state} state = {state}
/>; />;
break; break;
...@@ -404,6 +409,7 @@ class PageContainer extends React.Component { ...@@ -404,6 +409,7 @@ class PageContainer extends React.Component {
editProblemItem = {(data)=>dispatch(editProblemItem(data))} editProblemItem = {(data)=>dispatch(editProblemItem(data))}
deleteProblem = {(data)=>dispatch(deleteProblem(data))} deleteProblem = {(data)=>dispatch(deleteProblem(data))}
submitProblemList = {(data)=>dispatch(submitProblemList(data))} submitProblemList = {(data)=>dispatch(submitProblemList(data))}
changePages={(data)=>this.changePages(data)}
state = {state} state = {state}
/>; />;
break; break;
......
...@@ -21,6 +21,15 @@ export default class ReportDamagesListContainer extends React.Component{ ...@@ -21,6 +21,15 @@ export default class ReportDamagesListContainer extends React.Component{
let {deleteDamageItem} = this.props; let {deleteDamageItem} = this.props;
deleteDamageItem(postData) deleteDamageItem(postData)
} }
hanleAddMoreClick(){
let {changePages} = this.props;
changePages(CONFIG.showPage[2])
}
handleNoMoreClick(){
let {changePages} = this.props;
changePages(CONFIG.showPage[4])
}
render(){ render(){
let {reportDamageList,userInfo,storeInfo} = this.props.state; let {reportDamageList,userInfo,storeInfo} = this.props.state;
let reportDamageListUi =[]; let reportDamageListUi =[];
...@@ -60,8 +69,8 @@ export default class ReportDamagesListContainer extends React.Component{ ...@@ -60,8 +69,8 @@ export default class ReportDamagesListContainer extends React.Component{
</SwiperComponent> </SwiperComponent>
</div> </div>
<div className={"opeationContainer clearfix"}> <div className={"opeationContainer clearfix"}>
<button className={"addMoreBtn"}><span>+</span>录入更多</button> <button onClick={this.hanleAddMoreClick.bind(this)} className={"addMoreBtn"}><span>+</span>录入更多</button>
<button className={"noMoreBtn"}>没有更多</button> <button onClick={this.handleNoMoreClick.bind(this)} className={"noMoreBtn"}>没有更多</button>
</div> </div>
</div> </div>
):null ):null
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
height: 856px; height: 856px;
width: 100%; width: 100%;
background-color: f5f5f5; background-color: f5f5f5;
padding-left: 30px;
} }
.ReportDamagesListContainer .damageTitleContainer{ .ReportDamagesListContainer .damageTitleContainer{
......
...@@ -4,20 +4,22 @@ import HeaderComponent from '../../components/CommonComponent/HeaderComponent/He ...@@ -4,20 +4,22 @@ import HeaderComponent from '../../components/CommonComponent/HeaderComponent/He
import ProductDetailItem from '../../components/ScanBarCodeComponent/ProductDetailComponent/ProductDetailItem' import ProductDetailItem from '../../components/ScanBarCodeComponent/ProductDetailComponent/ProductDetailItem'
import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent' import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent'
import ButtonComponent from '../../components/CommonComponent/ButtonComponent/ButtonComponent' import ButtonComponent from '../../components/CommonComponent/ButtonComponent/ButtonComponent'
import Qrcode from '../Qrcode/Qrcode'
require('./index.css'); require('./index.css');
export default class ScanBarCodeContainer extends React.Component{ export default class ScanBarCodeContainer extends React.Component{
constructor(props) { constructor(props) {
super(props); super(props);
const {state, dispatch} = this.props; const {state, dispatch} = this.props;
console.log(state);
console.log(props);
this.state = { this.state = {
"barCodeValue":'', "barCodeValue":'',
"canChangeBtnColor":false, "canChangeBtnColor":false,
"showProductInfo":false, "showProductInfo":false,
"showPopup":false, "showPopup":false,
"popupInfo":{} "popupInfo":{},
"showQr":false,
"qrUrl":"",
"taskTy":"BS"
} }
} }
...@@ -29,18 +31,23 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -29,18 +31,23 @@ export default class ScanBarCodeContainer extends React.Component{
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
//显示查询到的商品的数据 //显示查询到的商品的数据
let {state} = nextProps; let {state,changePages} = nextProps;
let {scanBarCode,userInfo,storeInfo} = state; let {scanBarCode,userInfo,storeInfo,refreshImg} = state;
let productInfo = state.scanBarCode; let productInfo = state.scanBarCode;
let {inventorylossId,skuBaseInfoVo,packingList,positionList} = productInfo; let {inventorylossId,skuBaseInfoVo,packingList,positionList,data_currentProblemObj} = productInfo;
let productDetailUi = <ProductDetailItem let productDetailUi = <ProductDetailItem
skuBaseInfoVo = {skuBaseInfoVo} skuBaseInfoVo = {skuBaseInfoVo}
packingList = {packingList} packingList = {packingList}
positionList = {positionList} positionList = {positionList}
data_currentProblemObj = {data_currentProblemObj}
handleAddImg ={this.handleAddImg.bind(this)} handleAddImg ={this.handleAddImg.bind(this)}
handleDeleteImg ={this.handleDeleteImg.bind(this)} handleDeleteImg ={this.handleDeleteImg.bind(this)}
handleRefreshImg ={this.handleRefreshImg.bind(this)} handleRefreshImg ={this.handleRefreshImg.bind(this)}
handleSubmitProductInfo = {this.handleSubmitProductInfo.bind(this)} handleSubmitProductInfo = {this.handleSubmitProductInfo.bind(this)}
handleSaveEditProductInfo = {this.handleSaveEditProductInfo.bind(this)}
refreshImg = {refreshImg}
changePages = {changePages}
/> />
if(scanBarCode.skuBaseInfoVo && scanBarCode.skuBaseInfoVo.skuId && this.state.showProductInfo){ if(scanBarCode.skuBaseInfoVo && scanBarCode.skuBaseInfoVo.skuId && this.state.showProductInfo){
this.setState({ this.setState({
...@@ -111,13 +118,42 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -111,13 +118,42 @@ export default class ScanBarCodeContainer extends React.Component{
showProductInfo:true showProductInfo:true
}) })
} }
handleAddImg(data){ handleSaveEditProductInfo(data){
console.log("=================储存===")
let {saveEditProductInfo} = this.props;
saveEditProductInfo(data)
}
//二维码返回
handleQrBack(){
this.setState({
showQr:false
})
}
//上传图片
handleAddImg(){
let {state} = this.props;
let {storeInfo} = state;
let tmpUrl = "";
tmpUrl: `${ENV.uploadImg}/${storeInfo.taskId}/${this.state.taskTy}`
this.setState({
"showQr":true,
"taskTy":tmpUrl
},()=>{
console.log(tmpUrl)
})
console.log("添加照片") console.log("添加照片")
} }
handleDeleteImg(data){ handleDeleteImg(id){
console.log("删除照片") console.log(id)
let {deleteImg,state} = this.props;
let {storeInfo} = state;
console.log(this.state.taskTy)
deleteImg(storeInfo.taskId,this.state.taskTy,id);
} }
handleRefreshImg(data){ handleRefreshImg(data){
let {getRefreshImg,state} = this.props;
let {storeInfo} = state;
getRefreshImg(storeInfo.taskId,this.state.taskTy);
console.log("刷新照片") console.log("刷新照片")
} }
//点击编辑报损的商品的提交按钮 //点击编辑报损的商品的提交按钮
...@@ -147,28 +183,35 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -147,28 +183,35 @@ export default class ScanBarCodeContainer extends React.Component{
return ( return (
<div className={"scanBarCodeContainer"}> <div className={"scanBarCodeContainer"}>
<HeaderComponent {this.state.showQr?(
showHeader={CONFIG.headerStatus[1]} <Qrcode goBack={this.handleQrBack.bind(this)} url={this.state.taskTy}></Qrcode>
userinfo={userInfo} ):(
storeInfo={storeInfo} <div>
/> <HeaderComponent
{ showHeader={CONFIG.headerStatus[1]}
this.state.showPopup?( userinfo={userInfo}
<PopupComponent popupInfo = {this.state.popupInfo} /> storeInfo={storeInfo}
):"" />
} {
<div className={"container"}> this.state.showPopup?(
<div className={"inputContaienr"}> <PopupComponent popupInfo = {this.state.popupInfo} />
<input ):""
onChange={this.handleSaveInputBarCode.bind(this)} onFocus={()=>{this.handleInputBarCode.bind(this)()}} placeholder={"点击输入条形码 "} className={"barcodeValueInput"} type="text"/> }
<button disabled={!this.state.canChangeBtnColor?true:false} onClick={this.handleSubmitInputClick.bind(this)} className={this.state.canChangeBtnColor?"submitBtn btnFous":"submitBtn"}>确定</button> <div className={"container"}>
<div className={"inputContaienr"}>
<input
onChange={this.handleSaveInputBarCode.bind(this)} onFocus={()=>{this.handleInputBarCode.bind(this)()}} placeholder={"点击输入条形码 "} className={"barcodeValueInput"} type="text"/>
<button disabled={!this.state.canChangeBtnColor?true:false} onClick={this.handleSubmitInputClick.bind(this)} className={this.state.canChangeBtnColor?"submitBtn btnFous":"submitBtn"}>确定</button>
</div>
{
this.state.showProductInfo?(
<PopupComponent popupInfo = {this.state.popupInfo}/>
):""
}
</div>
</div> </div>
{ )}
this.state.showProductInfo?(
<PopupComponent popupInfo = {this.state.popupInfo}/>
):""
}
</div>
</div> </div>
) )
} }
......
import * as actionTypes from '../actiontype/ScanBarCode'; import * as actionTypes from '../actiontype/ScanBarCode';
let currentProductInfo = {};
function initSuccess(state,data) { function initSuccess(state,data) {
currentProductInfo.inventorylossId = data.inventorylossId;
data.data_currentProblemObj = Object.assign({},currentProductInfo);
let newInfo = Object.assign({},state,data); let newInfo = Object.assign({},state,data);
return newInfo; return newInfo;
} }
...@@ -8,12 +11,31 @@ function submitSuccess(state,data) { ...@@ -8,12 +11,31 @@ function submitSuccess(state,data) {
return newInfo; return newInfo;
} }
function saveInfoSuccess(state,data) {
console.log("====================reducer================")
console.log(data);
if(data.type == "productPosition"){
currentProductInfo.lossPostion = data.data;
}
if(data.type == "productPakingStatus"){
currentProductInfo.packingStatus = data.data;
}
if(data.type == "imgList"){
currentProductInfo.packingStatusImageIds = data.data;
}
let data_currentProblemObj = Object.assign({},currentProductInfo);
let newInfo = Object.assign({},state,{data_currentProblemObj:data_currentProblemObj});
return newInfo;
}
export default function(state={}, action) { export default function(state={}, action) {
switch (action.type) { switch (action.type) {
case actionTypes.INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS: case actionTypes.INIT_SCANBARCODEGETPRODUCTINFO_SUCCESS:
return initSuccess(state,action.data) return initSuccess(state,action.data)
case actionTypes.SUBMIT_PRODUCT_SUCCESS: case actionTypes.SUBMIT_PRODUCT_SUCCESS:
return submitSuccess(state,action.data) return submitSuccess(state,action.data)
case actionTypes.SAVE_PRODUCTEDITINFO_SUCCESS:
return saveInfoSuccess(state,action.data)
default: default:
return state; return state;
} }
......
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