Commit 75bddc2e by yaxiLiuu

add changePage â

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