|
@@ -22,6 +22,7 @@ import Collapsible from 'react-native-collapsible'
|
|
import CountNum from '../../components/CountNum'
|
|
import CountNum from '../../components/CountNum'
|
|
import Input from '../../components/input'
|
|
import Input from '../../components/input'
|
|
import png from '../../static/images/defaultimg.jpg'
|
|
import png from '../../static/images/defaultimg.jpg'
|
|
|
|
+import morePng from '../../static/images/ic-moredian.png'
|
|
import { ImageBaseUrl } from '../../utils/fetch/Fetchx'
|
|
import { ImageBaseUrl } from '../../utils/fetch/Fetchx'
|
|
import {
|
|
import {
|
|
ScaleUtil,
|
|
ScaleUtil,
|
|
@@ -45,6 +46,7 @@ import deletePng from '../../static/images/delete.png'
|
|
import moment from 'moment'
|
|
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'
|
|
/**
|
|
/**
|
|
* saleModel
|
|
* saleModel
|
|
*
|
|
*
|
|
@@ -54,6 +56,7 @@ import DetailModels from '../../models/commodity/DetailModels'
|
|
* CostReturn("04", "货补退货", "货补退货");
|
|
* CostReturn("04", "货补退货", "货补退货");
|
|
*/
|
|
*/
|
|
const { width, height } = Dimensions.get('window')
|
|
const { width, height } = Dimensions.get('window')
|
|
|
|
+let currRow = {} // 当前操作行
|
|
|
|
|
|
@connect(({ theme, mine, orderedit, optional }) => ({
|
|
@connect(({ theme, mine, orderedit, optional }) => ({
|
|
...theme,
|
|
...theme,
|
|
@@ -66,8 +69,11 @@ class OrderEdit extends Component {
|
|
const date = new Date()
|
|
const date = new Date()
|
|
super(props)
|
|
super(props)
|
|
this.state = {
|
|
this.state = {
|
|
|
|
+ optionData: [],
|
|
|
|
+ showOptModal : false,
|
|
modalVisible : false,
|
|
modalVisible : false,
|
|
activeSection: true,
|
|
activeSection: true,
|
|
|
|
+ optLoading: false,
|
|
// activeAllCollaps: true,
|
|
// activeAllCollaps: true,
|
|
optCollapse: 'shouqi',
|
|
optCollapse: 'shouqi',
|
|
baseIndex: 0,
|
|
baseIndex: 0,
|
|
@@ -261,6 +267,82 @@ class OrderEdit extends Component {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ async openOptView(item) {
|
|
|
|
+ currRow = item
|
|
|
|
+ this.setState({
|
|
|
|
+ optLoading: true,
|
|
|
|
+ showOptModal: true,
|
|
|
|
+ optionData: []
|
|
|
|
+ })
|
|
|
|
+ const result = await authService.getColorByGroups({id:item.goodsId,groupId : "", colourCode : ""});
|
|
|
|
+ this.setState({
|
|
|
|
+ optLoading: false,
|
|
|
|
+ optionData: result.data
|
|
|
|
+ })
|
|
|
|
+ this.props.dispatch(createAction("optional/getColorByGroupsReducer")({colorData: result.data}))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //选择的色卡颜色
|
|
|
|
+ async _chooseColor(colorData) {
|
|
|
|
+ console.log(colorData)
|
|
|
|
+ let selectRow = this.state.EditPromData.findIndex(item => item.goodsId == currRow.goodsId && item.baseGoodsOptId == currRow.baseGoodsOptId)
|
|
|
|
+ if (selectRow >= 0) {
|
|
|
|
+ let params = [];
|
|
|
|
+ params[0] = {
|
|
|
|
+ goodsId: colorData.children.goodsId,
|
|
|
|
+ optResult: colorData.children.custDocGroupName + ":" + colorData.children.attrValName,
|
|
|
|
+ uniqueKey: colorData.children.goodsId + "-" + colorData.children.attrValId,
|
|
|
|
+ goodsOptVals: [{
|
|
|
|
+ prodAttrStrucItemId: colorData.children.prodAttrStrucItemId,
|
|
|
|
+ prodAttrStrucItemName: colorData.children.name,
|
|
|
|
+ attrValId: colorData.children.attrValId,
|
|
|
|
+ attrValCode: colorData.children.attrValCode,
|
|
|
|
+ attrValName: colorData.children.attrValName
|
|
|
|
+ }]
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let newRow = {...this.state.EditPromData[selectRow]};
|
|
|
|
+ console.log(params)
|
|
|
|
+ const result = await authService.saveOptional([{goodsOptDtos: params}])
|
|
|
|
+ console.log(result)
|
|
|
|
+ if (result.data && result.data.length && result.data[0].goodsOptDtos.length) {
|
|
|
|
+ newRow.baseGoodsOptId = result.data[0].goodsOptDtos[0].id
|
|
|
|
+ }
|
|
|
|
+ newRow.baseGoodsOptValue = colorData.children.custDocGroupName + ":" + colorData.children.attrValName
|
|
|
|
+ newRow.ext05 = colorData.children.attrValId
|
|
|
|
+ newRow.dealPrice = colorData.goodsPriceByColor[0].price
|
|
|
|
+ newRow.dealAmount = newRow.dealPrice * newRow.orderNum
|
|
|
|
+ newRow.basePrice = newRow.dealPrice
|
|
|
|
+ newRow.amount = newRow.dealAmount
|
|
|
|
+ newRow.promPrice = newRow.dealPrice
|
|
|
|
+ newRow.salePrice = newRow.dealPrice
|
|
|
|
+ newRow.ext09 = newRow.dealPrice + ""
|
|
|
|
+ newRow.ext10 = newRow.dealAmount + ""
|
|
|
|
+ let newEditPromData = [...this.state.EditPromData];
|
|
|
|
+ newEditPromData.splice(selectRow, 1, newRow)
|
|
|
|
+ let totalAmount = 0
|
|
|
|
+ newEditPromData.forEach(item => {
|
|
|
|
+ totalAmount = totalAmount + item.amount
|
|
|
|
+ })
|
|
|
|
+ let goodsAmount = totalAmount
|
|
|
|
+ let totalAmountCopy = totalAmount
|
|
|
|
+ this.setState({
|
|
|
|
+ showOptModal: false,
|
|
|
|
+ EditPromData : newEditPromData,
|
|
|
|
+ totalAmount,
|
|
|
|
+ goodsAmount,
|
|
|
|
+ totalAmountCopy
|
|
|
|
+ })
|
|
|
|
+ currRow = {}
|
|
|
|
+ } else {
|
|
|
|
+ this.toast = Toast.show("选配商品已被删除!",{position : toastHeight});
|
|
|
|
+ this.setState({
|
|
|
|
+ showOptModal: false
|
|
|
|
+ })
|
|
|
|
+ currRow = {}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//删除商品
|
|
//删除商品
|
|
deleteGoodsFn(indexParent) {
|
|
deleteGoodsFn(indexParent) {
|
|
this.state.EditPromData.splice(indexParent, 1)
|
|
this.state.EditPromData.splice(indexParent, 1)
|
|
@@ -1317,6 +1399,9 @@ class OrderEdit extends Component {
|
|
// let optFlag = true,
|
|
// let optFlag = true,
|
|
let optFlag = false,
|
|
let optFlag = false,
|
|
isOptArrs = []
|
|
isOptArrs = []
|
|
|
|
+ if (item.baseGoodsOptId) {
|
|
|
|
+ item.isOptional = 1
|
|
|
|
+ }
|
|
if (item.isOptional) {
|
|
if (item.isOptional) {
|
|
isOptArrs.push(item.isOptional)
|
|
isOptArrs.push(item.isOptional)
|
|
} else if (item.reqOrderItemBoms && item.reqOrderItemBoms.length > 0) {
|
|
} else if (item.reqOrderItemBoms && item.reqOrderItemBoms.length > 0) {
|
|
@@ -1529,6 +1614,12 @@ class OrderEdit extends Component {
|
|
justifyContent: 'space-between',
|
|
justifyContent: 'space-between',
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
|
|
+ <TouchableOpacity
|
|
|
|
+ activeOpacity={1}
|
|
|
|
+ onPress={() => {
|
|
|
|
+ this.openOptView(item)
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
<View style={{ flexDirection: 'row' }}>
|
|
<View style={{ flexDirection: 'row' }}>
|
|
<Text style={{ fontSize: 12, lineHeight: 17, color: '#333' }}>
|
|
<Text style={{ fontSize: 12, lineHeight: 17, color: '#333' }}>
|
|
{reqBomText && reqBomText.length > 0 ? '选配项:' : '选 配:'}
|
|
{reqBomText && reqBomText.length > 0 ? '选配项:' : '选 配:'}
|
|
@@ -1551,8 +1642,13 @@ class OrderEdit extends Component {
|
|
: item.baseGoodsOptValue
|
|
: item.baseGoodsOptValue
|
|
: item.baseGoodsOptValue}
|
|
: item.baseGoodsOptValue}
|
|
</Text>
|
|
</Text>
|
|
|
|
+ <Image
|
|
|
|
+ resizeMode="contain"
|
|
|
|
+ source={morePng}
|
|
|
|
+ style={{ width: 24, height: 5, alignSelf: 'center' }}
|
|
|
|
+ />
|
|
</View>
|
|
</View>
|
|
-
|
|
|
|
|
|
+ </TouchableOpacity>
|
|
{collaseFlag ? (
|
|
{collaseFlag ? (
|
|
<View style={{ flexDirection: 'row' }}>
|
|
<View style={{ flexDirection: 'row' }}>
|
|
{/* <TouchableOpacity
|
|
{/* <TouchableOpacity
|
|
@@ -2338,6 +2434,51 @@ class OrderEdit extends Component {
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
|
|
+ <Modal
|
|
|
|
+ animationType="slide"
|
|
|
|
+ presentationStyle="formSheet"
|
|
|
|
+ transparent={true}
|
|
|
|
+ visible={this.state.showOptModal}
|
|
|
|
+ onRequestClose={() => {
|
|
|
|
+ this.setState({
|
|
|
|
+ showOptModal: 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({
|
|
|
|
+ showOptModal: false
|
|
|
|
+ })
|
|
|
|
+ }}>
|
|
|
|
+ <Image
|
|
|
|
+ source={deletePng}
|
|
|
|
+ style={{ width: 20, height: 20}}
|
|
|
|
+ />
|
|
|
|
+ </TouchableOpacity>
|
|
|
|
+ </View>
|
|
|
|
+ <OptFlatList colorData={this.state.optionData} optionData={[{saleOrgId: supplierDefault.SaleOrSupplierId, goodsId: this.state.optionData.length > 0 ? this.state.optionData[0].id : ""}]} chooseColor={this._chooseColor.bind(this)}/>
|
|
|
|
+ </View>
|
|
|
|
+ }
|
|
|
|
+ </View>
|
|
|
|
+
|
|
|
|
+ </Modal>
|
|
<Modal
|
|
<Modal
|
|
animationType="slide"
|
|
animationType="slide"
|
|
presentationStyle="formSheet"
|
|
presentationStyle="formSheet"
|