Commit 465b8ffd by yaxiLiuu

修fixed the damageFunction â€

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