Commit 465b8ffd by yaxiLiuu

修fixed the damageFunction â€

parent b7561aaf
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
import * as actionTypes from '../actiontype/ScanBarCode'; import * as actionTypes from '../actiontype/ScanBarCode';
const domain = 'http://test.mjitech.com'; import actionTypes_error from '../actiontype/error'
let domain = 'http://192.168.10.189:8083';
const fakeJsonData = { const fakeJsonData = {
"meta": { "meta": {
"code": "200", "code": "200",
...@@ -78,24 +79,31 @@ const fakeJsonData2 = { ...@@ -78,24 +79,31 @@ const fakeJsonData2 = {
"data": {}} "data": {}}
export function scanBarCodeGetProductInfo(postData) { export function scanBarCodeGetProductInfo(postData) {
return (dispatch) => { return (dispatch) => {
/* let url = String(domain+'/web/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,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
mode : 'cors', mode : 'cors',
headers: {
'content-type':'application/json;charset=UTF-8',
},
body : JSON.stringify(postData) body : JSON.stringify(postData)
}).then((response) => response.json()) }).then((response) => response.json())
.then( .then(
(json)=>{ (json)=>{
if(json.is_succ){ //处理数据如果
let success = json.meta.success;
if(success){
dispatch(initSuccess(json.data))
}else{ }else{
dispatch(throwError(json.meta.message))
} }
} }
).catch(e=>dispatch(console.log("出现错误")) ).catch(e=>dispatch(console.log("出现错误"))
)*/ )
dispatch(initSuccess(fakeJsonData.data)) /*dispatch(initSuccess(fakeJsonData.data))*/
} }
} }
...@@ -136,3 +144,9 @@ function submitProductSuccess(data) { ...@@ -136,3 +144,9 @@ function submitProductSuccess(data) {
data data
} }
} }
function throwError(data) {
return{
type:actionTypes_error.ADDERRORINFO,
errMsg:data
}
}
\ No newline at end of file
...@@ -5,8 +5,8 @@ export default class ProductDetailItem extends React.Component{ ...@@ -5,8 +5,8 @@ export default class ProductDetailItem extends React.Component{
constructor(props){ constructor(props){
super(props) super(props)
this.state = { this.state = {
currentPosition:"", currentPosition:undefined,
currentPakageStatus:"" currentPakageStatus:undefined
} }
} }
handleSelectPosition(event){ handleSelectPosition(event){
...@@ -14,17 +14,12 @@ export default class ProductDetailItem extends React.Component{ ...@@ -14,17 +14,12 @@ export default class ProductDetailItem extends React.Component{
this.setState({ this.setState({
currentPosition:currentValue currentPosition:currentValue
}) })
console.log("选位置");
console.log(event)
} }
handleSelectStaus(event){ handleSelectStaus(event){
let currentValue = event.currentTarget.getAttribute('date-value'); let currentValue = event.currentTarget.getAttribute('date-value');
this.setState({ this.setState({
currentPakageStatus:currentValue currentPakageStatus:currentValue
}) })
console.log("选位置");
console.log(event)
console.log("选状态")
} }
handleSubmit(){ handleSubmit(){
...@@ -34,8 +29,6 @@ export default class ProductDetailItem extends React.Component{ ...@@ -34,8 +29,6 @@ export default class ProductDetailItem extends React.Component{
data.lossPostion = this.state.currentPosition; data.lossPostion = this.state.currentPosition;
data.packingStatus = this.state.currentPakageStatus; data.packingStatus = this.state.currentPakageStatus;
data.packingStatusImageIds = []; data.packingStatusImageIds = [];
console.log(data)
handleSubmitProductInfo(data)
} }
render(){ render(){
...@@ -45,16 +38,16 @@ export default class ProductDetailItem extends React.Component{ ...@@ -45,16 +38,16 @@ export default class ProductDetailItem extends React.Component{
let positonUi = positionList.map((item,index)=>{ let positonUi = positionList.map((item,index)=>{
return <li return <li
key={"position"+index} key={"position"+index}
date-value = {item} date-value = {index}
className={item == this.state.currentPosition?"checkLi":""} className={index == this.state.currentPosition?"checkLi":""}
onClick={this.handleSelectPosition.bind(this)} onClick={this.handleSelectPosition.bind(this)}
>{item}</li> >{item}</li>
}) })
let statusUi = packingList.map((item,index)=>{ let statusUi = packingList.map((item,index)=>{
return <li return <li
key={"pakingStatus"+index} key={"pakingStatus"+index}
date-value = {item} date-value = {index}
className={item == this.state.currentPakageStatus?"checkLi":""} className={index == this.state.currentPakageStatus?"checkLi":""}
onClick={this.handleSelectStaus.bind(this)} onClick={this.handleSelectStaus.bind(this)}
>{item}</li> >{item}</li>
}) })
...@@ -91,13 +84,15 @@ export default class ProductDetailItem extends React.Component{ ...@@ -91,13 +84,15 @@ export default class ProductDetailItem extends React.Component{
</div> </div>
<div className={"uploadContainer clearfix"}> <div className={"uploadContainer clearfix"}>
<div className={"uploadImgRight"}> <div className={"uploadImgRight"}>
<ImgToolComponent {/* <ImgToolComponent
type={"custom"} type={"custom"}
noCloseBtn ={false} noCloseBtn ={false}
imgSrc = { require('./img/lol.gif')} imgSrc = { require('./img/lol.gif')}
handleClikCloseFunc = {props.handleDeleteImg} handleClikCloseFunc = {props.handleDeleteImg}
></ImgToolComponent> ></ImgToolComponent>*/}
</div> </div>
{
this.state.currentPakageStatus == 2?(
<div className={"operationLeft"}> <div className={"operationLeft"}>
<ImgToolComponent <ImgToolComponent
type={"refresh"} type={"refresh"}
...@@ -110,10 +105,17 @@ export default class ProductDetailItem extends React.Component{ ...@@ -110,10 +105,17 @@ export default class ProductDetailItem extends React.Component{
handleClikImgFunc = {props.handleAddImg} handleClikImgFunc = {props.handleAddImg}
></ImgToolComponent> ></ImgToolComponent>
</div> </div>
):""
}
</div> </div>
<div className={"btnContainer"}> <div className={"btnContainer"}>
<button onClick={this.handleSubmit.bind(this)} className={"submitEditBtn"}>提交</button> <button
onClick={this.handleSubmit.bind(this)}
className={"submitEditBtn"+(this.state.currentPosition!=undefined && this.state.currentPakageStatus!=undefined?" selectBtn":"")}
disabled={this.state.currentPosition==undefined || this.state.currentPakageStatus==undefined?true:false}
>提交</button>
</div> </div>
</div> </div>
) )
......
...@@ -57,9 +57,7 @@ ...@@ -57,9 +57,7 @@
margin-right: 80px; margin-right: 80px;
} }
.productContainer .detailContainer{ .productContainer .detailContainer{
overflow: auto; overflow: auto;
width: 870px;
} }
.productContainer .detailContainer li{ .productContainer .detailContainer li{
box-sizing: border-box; box-sizing: border-box;
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import React from 'react'; import React from 'react';
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent' import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
import ProductDetailItem from '../../components/ScanBarCodeComponent/ProductDetailComponent/ProductDetailItem' import ProductDetailItem from '../../components/ScanBarCodeComponent/ProductDetailComponent/ProductDetailItem'
import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent'
import ButtonComponent from '../../components/CommonComponent/ButtonComponent/ButtonComponent'
require('./index.css'); require('./index.css');
export default class ScanBarCodeContainer extends React.Component{ export default class ScanBarCodeContainer extends React.Component{
...@@ -13,7 +15,9 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -13,7 +15,9 @@ export default class ScanBarCodeContainer extends React.Component{
this.state = { this.state = {
"barCodeValue":'', "barCodeValue":'',
"canChangeBtnColor":false, "canChangeBtnColor":false,
"showProductInfo":false "showProductInfo":false,
"showPopup":false,
"popupInfo":{}
} }
} }
...@@ -24,39 +28,80 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -24,39 +28,80 @@ export default class ScanBarCodeContainer extends React.Component{
componentDidUpdate() { componentDidUpdate() {
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
//显示查询到的商品的数据
let {state} = nextProps; let {state} = nextProps;
let {scanBarCode} = state; let {scanBarCode,userInfo,storeInfo} = state;
console.log(String(scanBarCode)) let productInfo = state.scanBarCode;
if(scanBarCode.skuBaseInfoVo && scanBarCode.skuBaseInfoVo.skuId){ let {inventorylossId,skuBaseInfoVo,packingList,positionList} = productInfo;
let productDetailUi = <ProductDetailItem
skuBaseInfoVo = {skuBaseInfoVo}
packingList = {packingList}
positionList = {positionList}
handleAddImg ={this.handleAddImg.bind(this)}
handleDeleteImg ={this.handleDeleteImg.bind(this)}
handleRefreshImg ={this.handleRefreshImg.bind(this)}
handleSubmitProductInfo = {this.handleSubmitProductInfo.bind(this)}
/>
if(scanBarCode.skuBaseInfoVo && scanBarCode.skuBaseInfoVo.skuId && this.state.showProductInfo){
this.setState({ this.setState({
showProductInfo:true popupInfo:{
showPopup:true,
popupChild:productDetailUi
}
}) })
} }
} }
componentWillUnmount() { componentWillUnmount() {
} }
handleInputBarCode(evnet){ // 输入条形码改变 onchange事件监听 条形码的值
console.log("onchange"); handleSaveInputBarCode(event){
let barCodeValue = evnet.target.value; let barCodeValue = event.target.value;
this.setState({ this.setState({
barCodeValue :barCodeValue barCodeValue :barCodeValue
},()=>{}) },()=>{})
} }
// 点击输入条形码 确定按钮
handleSubmitInputClick(){ handleSubmitInputClick(){
let {getProductInfo} = this.props; // 1. 检查输入的条形码是否为空
if(!this.state.barCodeValue){
this.setState({
showPopup:true,
popupInfo:{
"popupText":"输入合法的条形码",
"showPopup":true,
"popupButtons": [<ButtonComponent key={"btn"+this.state.barCodeValue} option={this.handleTryAgainClick.bind(this)} text={"再次尝试"}/>]
}
})
return
}
// 2. 请求查询接口
//准备查询数据
let {getProductInfo,state} = this.props;
let {headerInfo} = state;
let postData = {}; let postData = {};
postData.warehouseId = Number("123456"); postData.warehouseId = headerInfo.storeId?Number(headerInfo.storeId):Number("7");
postData.taskId = Number("123456"); postData.taskId = headerInfo.taskId?Number(headerInfo.taskId):Number("1");
postData.sellOrderId = Number("123456"); postData.sellOrderId = headerInfo.sellOrderId?Number(headerInfo.sellOrderId):Number(21);
postData.skuBarcode = String(this.state.barCodeValue); postData.skuBarcode = String(this.state.barCodeValue);
getProductInfo(postData) //设置弹窗显示:
this.setState({ this.setState({
showProductInfo:true
},()=>{
//发送查询action
getProductInfo(postData)
})
}
// 点击再次再次尝试
handleTryAgainClick(){
this.setState({
showPopup:false
}) })
} }
handleInputBarCode(){ handleInputBarCode(){
console.log("dfdf")
this.setState({ this.setState({
canChangeBtnColor:true canChangeBtnColor:true
}) })
...@@ -75,6 +120,7 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -75,6 +120,7 @@ export default class ScanBarCodeContainer extends React.Component{
handleRefreshImg(data){ handleRefreshImg(data){
console.log("刷新照片") console.log("刷新照片")
} }
//点击编辑报损的商品的提交按钮
handleSubmitProductInfo(data){ handleSubmitProductInfo(data){
let {submitProductInfo} = this.props; let {submitProductInfo} = this.props;
let postaData ={}; let postaData ={};
...@@ -84,15 +130,21 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -84,15 +130,21 @@ export default class ScanBarCodeContainer extends React.Component{
postaData.packingStatus = data.packingStatus; postaData.packingStatus = data.packingStatus;
postaData.packingStatusImageIds = data.packingStatusImageIds; postaData.packingStatusImageIds = data.packingStatusImageIds;
console.log(postaData) console.log(postaData)
submitProductInfo(postaData) submitProductInfo(postaData);
console.log("提交") //让弹窗消失
this.setState({
showProductInfo:false,
popupInfo:{
"showPopup":false,
}
})
} }
render() { render() {
let {state} = this.props; let {state} = this.props;
let {userInfo,storeInfo} = state; let {userInfo,storeInfo} = state;
let productInfo = state.scanBarCode; let productInfo = state.scanBarCode;
let {inventorylossId,skuBaseInfoVo,packingList,positionList} = productInfo; let {inventorylossId,skuBaseInfoVo,packingList,positionList} = productInfo;
console.log(productInfo)
return ( return (
<div className={"scanBarCodeContainer"}> <div className={"scanBarCodeContainer"}>
<HeaderComponent <HeaderComponent
...@@ -100,22 +152,20 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -100,22 +152,20 @@ export default class ScanBarCodeContainer extends React.Component{
userinfo={userInfo} userinfo={userInfo}
storeInfo={storeInfo} storeInfo={storeInfo}
/> />
{
this.state.showPopup?(
<PopupComponent popupInfo = {this.state.popupInfo} />
):""
}
<div className={"container"}> <div className={"container"}>
<div className={"inputContaienr"}> <div className={"inputContaienr"}>
<input onFocus={()=>{this.handleInputBarCode.bind(this)()}} placeholder={"点击输入条形码 "} className={"barcodeValueInput"} type="text"/> <input
<button onClick={this.handleSubmitInputClick.bind(this)} className={this.state.canChangeBtnColor?"submitBtn btnFous":"submitBtn"}>确定</button> 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> </div>
{ {
this.state.showProductInfo?( this.state.showProductInfo?(
<ProductDetailItem <PopupComponent popupInfo = {this.state.popupInfo}/>
skuBaseInfoVo = {skuBaseInfoVo}
packingList = {packingList}
positionList = {positionList}
handleAddImg ={this.handleAddImg.bind(this)}
handleDeleteImg ={this.handleDeleteImg.bind(this)}
handleRefreshImg ={this.handleRefreshImg.bind(this)}
handleSubmitProductInfo = {this.handleSubmitProductInfo.bind(this)}
/>
):"" ):""
} }
</div> </div>
......
...@@ -61,8 +61,8 @@ input:-ms-input-placeholder, textarea:-ms-input-placeholder { ...@@ -61,8 +61,8 @@ input:-ms-input-placeholder, textarea:-ms-input-placeholder {
/*商品弹窗样式start*/ /*商品弹窗样式start*/
.scanBarCodeContainer .productContainer { .scanBarCodeContainer .productContainer {
position: absolute; position: absolute;
left: 367px; left: 75px;
top: 35px; top: 8px;
background-color: #fff; background-color: #fff;
} }
......
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