|
@@ -47,6 +47,8 @@ import moment from 'moment'
|
|
import Toast from 'react-native-root-toast'
|
|
import Toast from 'react-native-root-toast'
|
|
import DetailModels from '../../models/commodity/DetailModels'
|
|
import DetailModels from '../../models/commodity/DetailModels'
|
|
import OptFlatList from '../commodity/commoditydetail/OptFlatList'
|
|
import OptFlatList from '../commodity/commoditydetail/OptFlatList'
|
|
|
|
+import GoodsFlatList from '../commodity/commoditydetail/GoodsFlatList'
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* saleModel
|
|
* saleModel
|
|
*
|
|
*
|
|
@@ -70,6 +72,7 @@ class OrderEdit extends Component {
|
|
super(props)
|
|
super(props)
|
|
this.state = {
|
|
this.state = {
|
|
optionData: [],
|
|
optionData: [],
|
|
|
|
+ showGoodsModal: false, // 增加商品列表
|
|
showOptModal : false,
|
|
showOptModal : false,
|
|
modalVisible : false,
|
|
modalVisible : false,
|
|
activeSection: true,
|
|
activeSection: true,
|
|
@@ -307,6 +310,14 @@ class OrderEdit extends Component {
|
|
console.log(result)
|
|
console.log(result)
|
|
if (result.data && result.data.length && result.data[0].goodsOptDtos.length) {
|
|
if (result.data && result.data.length && result.data[0].goodsOptDtos.length) {
|
|
newRow.baseGoodsOptId = result.data[0].goodsOptDtos[0].id
|
|
newRow.baseGoodsOptId = result.data[0].goodsOptDtos[0].id
|
|
|
|
+ let existIndex = this.state.EditPromData.findIndex(e => e.goodsId == newRow.goodsId && e.ext05 == colorData.children.attrValId);
|
|
|
|
+ if (existIndex >= 0 && existIndex != selectRow) {
|
|
|
|
+ Toast.show("已存在相同颜色的商品,请重新选择颜色!",{position : toastHeight});
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.toast = Toast.show("改颜色未设置价格,请重新选择颜色!",{position : toastHeight});
|
|
|
|
+ return
|
|
}
|
|
}
|
|
newRow.baseGoodsOptValue = colorData.children.custDocGroupName + ":" + colorData.children.attrValName
|
|
newRow.baseGoodsOptValue = colorData.children.custDocGroupName + ":" + colorData.children.attrValName
|
|
newRow.ext05 = colorData.children.attrValId
|
|
newRow.ext05 = colorData.children.attrValId
|
|
@@ -321,8 +332,10 @@ class OrderEdit extends Component {
|
|
let newEditPromData = [...this.state.EditPromData];
|
|
let newEditPromData = [...this.state.EditPromData];
|
|
newEditPromData.splice(selectRow, 1, newRow)
|
|
newEditPromData.splice(selectRow, 1, newRow)
|
|
let totalAmount = 0
|
|
let totalAmount = 0
|
|
|
|
+ let totalNum = 0
|
|
newEditPromData.forEach(item => {
|
|
newEditPromData.forEach(item => {
|
|
totalAmount = totalAmount + item.amount
|
|
totalAmount = totalAmount + item.amount
|
|
|
|
+ totalNum = totalNum + item.orderNum
|
|
})
|
|
})
|
|
let goodsAmount = totalAmount
|
|
let goodsAmount = totalAmount
|
|
let totalAmountCopy = totalAmount
|
|
let totalAmountCopy = totalAmount
|
|
@@ -331,6 +344,7 @@ class OrderEdit extends Component {
|
|
EditPromData : newEditPromData,
|
|
EditPromData : newEditPromData,
|
|
totalAmount,
|
|
totalAmount,
|
|
goodsAmount,
|
|
goodsAmount,
|
|
|
|
+ totalNum,
|
|
totalAmountCopy
|
|
totalAmountCopy
|
|
})
|
|
})
|
|
currRow = {}
|
|
currRow = {}
|
|
@@ -343,6 +357,92 @@ class OrderEdit extends Component {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ addGoods(goods) {
|
|
|
|
+ console.log('goods==========>',goods)
|
|
|
|
+ console.log('this.state.EditPromData======>',this.state.EditPromData)
|
|
|
|
+ let existItem = this.state.EditPromData.find(e => e.goodsCode == goods.code && !e.baseGoodsOptId)
|
|
|
|
+ if (existItem) {
|
|
|
|
+ Toast.show("已存在重复的商品,请重新选择!",{position : toastHeight});
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (goods.id) {
|
|
|
|
+ let newItem = {
|
|
|
|
+ amount: goods.basePrice,
|
|
|
|
+ baseGoodsOptId: "",
|
|
|
|
+ baseGoodsOptValue: "",
|
|
|
|
+ basePrice: goods.basePrice,
|
|
|
|
+ conversionRate: 1,
|
|
|
|
+ dealAmount: goods.basePrice,
|
|
|
|
+ dealPrice: goods.basePrice,
|
|
|
|
+ deliveryNum: 0,
|
|
|
|
+ dr: 0,
|
|
|
|
+ expenseOrderCode: "",
|
|
|
|
+ ext14: goods.categoryCode,
|
|
|
|
+ ext15: goods.categoryName,
|
|
|
|
+ goodsCode: goods.code,
|
|
|
|
+ goodsDisplayName: goods.displayName,
|
|
|
|
+ goodsId: goods.id,
|
|
|
|
+ goodsName: goods.name,
|
|
|
|
+ id: '',
|
|
|
|
+ isGift: 0,
|
|
|
|
+ isOptional: goods.isOptional,
|
|
|
|
+ mainNum: 1,
|
|
|
|
+ mainNumUnitCode: goods.basicUnitCode,
|
|
|
|
+ mainNumUnitId: goods.basicUnitId,
|
|
|
|
+ mainNumUnitName: goods.basicUnitName,
|
|
|
|
+ model: goods.model,
|
|
|
|
+ ncProductCode: goods.ncProductCode,
|
|
|
|
+ offsetAmount: 0,
|
|
|
|
+ orderNum: 1,
|
|
|
|
+ orderNumUnitCode: goods.basicUnitCode,
|
|
|
|
+ orderNumUnitId: goods.basicUnitId,
|
|
|
|
+ orderNumUnitName: goods.basicUnitName,
|
|
|
|
+ originalGoodsId: goods.id,
|
|
|
|
+ persistStatus: 'nrm',
|
|
|
|
+ productGradeCode: goods.productGradeCode,
|
|
|
|
+ productGradeId: goods.productGradeId,
|
|
|
|
+ productGradeName: goods.productGradeName,
|
|
|
|
+ productId: goods.productId,
|
|
|
|
+ productLineCode: goods.productLineCode,
|
|
|
|
+ productLineId: goods.productLineId,
|
|
|
|
+ productLineName: goods.productLineName,
|
|
|
|
+ promAmount: 0,
|
|
|
|
+ promPrice: goods.basePrice,
|
|
|
|
+ refundNum: 0,
|
|
|
|
+ reqOrderAttachments: [],
|
|
|
|
+ reqOrderId: this.props.promData.reqOrderItems[0].reqOrderId,
|
|
|
|
+ reqOrderItemBoms: [],
|
|
|
|
+ reqOrderPromRels: [],
|
|
|
|
+ returnMaxOrderNum: 0,
|
|
|
|
+ returnNum: 0,
|
|
|
|
+ // rowNum: (this.state.EditPromData.length * 10) + "",
|
|
|
|
+ salePrice: goods.basePrice,
|
|
|
|
+ signNum: 0,
|
|
|
|
+ specification: goods.specification,
|
|
|
|
+ stockInNum: 0,
|
|
|
|
+ stockOutNum: 0,
|
|
|
|
+ weight: goods.netWeight
|
|
|
|
+ }
|
|
|
|
+ const newData = [...this.state.EditPromData];
|
|
|
|
+ newData.push(newItem);
|
|
|
|
+ console.log('this.props.promData.reqOrderItems[0].reqOrderId',this.props.promData.reqOrderItems[0].reqOrderId)
|
|
|
|
+ let totalAmount = 0
|
|
|
|
+ let totalNum = 0
|
|
|
|
+ newData.forEach(item => {
|
|
|
|
+ totalAmount = totalAmount + item.amount
|
|
|
|
+ totalNum = totalNum + item.orderNum
|
|
|
|
+ })
|
|
|
|
+ let goodsAmount = totalAmount
|
|
|
|
+ let totalAmountCopy = totalAmount
|
|
|
|
+ this.setState({EditPromData: newData,
|
|
|
|
+ showGoodsModal: false,
|
|
|
|
+ totalAmount,
|
|
|
|
+ totalNum,
|
|
|
|
+ goodsAmount,
|
|
|
|
+ totalAmountCopy})
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//删除商品
|
|
//删除商品
|
|
deleteGoodsFn(indexParent) {
|
|
deleteGoodsFn(indexParent) {
|
|
this.state.EditPromData.splice(indexParent, 1)
|
|
this.state.EditPromData.splice(indexParent, 1)
|
|
@@ -1415,7 +1515,7 @@ class OrderEdit extends Component {
|
|
optFlag = true
|
|
optFlag = true
|
|
}
|
|
}
|
|
return (
|
|
return (
|
|
- <View>
|
|
|
|
|
|
+ <View key={item.rowNum}>
|
|
<View style={{ padding: 10, marginTop: 10, backgroundColor: '#FFF' }}>
|
|
<View style={{ padding: 10, marginTop: 10, backgroundColor: '#FFF' }}>
|
|
{/* 满减/买赠 */}
|
|
{/* 满减/买赠 */}
|
|
<View style={{ paddingBottom: 10 }}>
|
|
<View style={{ paddingBottom: 10 }}>
|
|
@@ -2269,6 +2369,24 @@ class OrderEdit extends Component {
|
|
</View>
|
|
</View>
|
|
) : null}
|
|
) : null}
|
|
|
|
|
|
|
|
+ {/* 增加商品 */}
|
|
|
|
+ <View style={{ marginTop: 10, padding: 10, backgroundColor: '#FFF' }}>
|
|
|
|
+ <View
|
|
|
|
+ style={{
|
|
|
|
+ flexDirection: 'row',
|
|
|
|
+ justifyContent: 'center',
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <TouchableOpacity onPress={() =>{
|
|
|
|
+ this.setState({
|
|
|
|
+ showGoodsModal: true
|
|
|
|
+ })
|
|
|
|
+ }}>
|
|
|
|
+ <Text style={styles.text666}>增加商品+</Text>
|
|
|
|
+ </TouchableOpacity>
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
|
|
+
|
|
{/* 总体积、数量 */}
|
|
{/* 总体积、数量 */}
|
|
<View style={{ marginTop: 10, padding: 10, backgroundColor: '#FFF' }}>
|
|
<View style={{ marginTop: 10, padding: 10, backgroundColor: '#FFF' }}>
|
|
<View
|
|
<View
|
|
@@ -2441,6 +2559,54 @@ class OrderEdit extends Component {
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
|
|
+
|
|
|
|
+ {/* 增加商品 */}
|
|
|
|
+ <Modal
|
|
|
|
+ animationType="slide"
|
|
|
|
+ presentationStyle="formSheet"
|
|
|
|
+ transparent={true}
|
|
|
|
+ visible={this.state.showGoodsModal}
|
|
|
|
+ onRequestClose={() => {
|
|
|
|
+ this.setState({
|
|
|
|
+ showGoodsModal: false
|
|
|
|
+ })
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <View
|
|
|
|
+ style={{
|
|
|
|
+ backgroundColor:'#FFF',
|
|
|
|
+ top:'50%',
|
|
|
|
+ paddingBottom: 50,
|
|
|
|
+ width:'100%',
|
|
|
|
+ height:'50%',
|
|
|
|
+ alignItems : 'center',
|
|
|
|
+ elevation : 5,
|
|
|
|
+ }}>
|
|
|
|
+ {this.state.optLoading ? (
|
|
|
|
+ <View style={{marginTop:100}}>
|
|
|
|
+ <ActivityIndicator />
|
|
|
|
+ </View>
|
|
|
|
+ ) : <View>
|
|
|
|
+ <View style={{flexDirection:'row'}}>
|
|
|
|
+ <Text style={{ fontSize: 13, lineHeight: 18, color: '#333',width:'90%',marginTop:10 }}>选择商品</Text>
|
|
|
|
+ <TouchableOpacity onPress={() =>{
|
|
|
|
+ this.setState({
|
|
|
|
+ showGoodsModal: false
|
|
|
|
+ })
|
|
|
|
+ }}>
|
|
|
|
+ <Image
|
|
|
|
+ source={deletePng}
|
|
|
|
+ style={{ width: 20, height: 20}}
|
|
|
|
+ />
|
|
|
|
+ </TouchableOpacity>
|
|
|
|
+ </View>
|
|
|
|
+ <GoodsFlatList addGoods={this.addGoods.bind(this)}/>
|
|
|
|
+ </View>
|
|
|
|
+ }
|
|
|
|
+ </View>
|
|
|
|
+ </Modal>
|
|
|
|
+
|
|
|
|
+ {/* 颜色选配 */}
|
|
<Modal
|
|
<Modal
|
|
animationType="slide"
|
|
animationType="slide"
|
|
presentationStyle="formSheet"
|
|
presentationStyle="formSheet"
|