Bläddra i källkod

Merge branch 'master' of http://183.56.220.107:50005/MayDos/occ-mobile

chenzhfa 2 år sedan
förälder
incheckning
67939d4438

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 66 - 66
android/app/src/main/assets/index.android.bundle


+ 1 - 1
android/app/src/main/assets/index.android.bundle.meta

@@ -1 +1 @@
-=ֲ¯c­t;Qֵ®„�£/…£��(
+¦�לד“1•=י]טָ‚״וא¸^

+ 6 - 3
app/containers/commodity/commoditydetail/OptFlatList.js

@@ -189,7 +189,7 @@ class OptFlatList extends Component {
             justifyContent: 'center',
             alignItems: 'center',
             marginRight: 15,
-            width: 80,
+            width: 160,
             marginTop : 5
           }}
           onPress={() => {
@@ -234,6 +234,7 @@ class OptFlatList extends Component {
   //根据色卡号查询调色
   getColorByCode(colorCode) {
     const { optionData } = this.props
+    console.log('getColorByCode==========>',colorCode)
     this.props.dispatch(
       createAction('optional/getColorByGroups')({
         id : optionData[0].goodsId,
@@ -244,6 +245,7 @@ class OptFlatList extends Component {
   }
 
   render() {
+    console.log(this.props)
     const { optionData, chooseOpt,colorData } = this.props
     if (this.props.havaOpt) {
       const optChoose = []
@@ -296,7 +298,7 @@ class OptFlatList extends Component {
         </View>
       )
     } else {
-      optionData.sort((a, b) => a.isOptionalAttr - b.isOptionalAttr)
+      // optionData.sort((a, b) => a.isOptionalAttr - b.isOptionalAttr)
       return (
         <View>
           {/* <FlatList
@@ -346,6 +348,7 @@ class OptFlatList extends Component {
             placeholderSize={8}
             placeholder = {'请输入颜色编码'}
             onchangeFn={e => {
+            // onSubmitEditing={e => {
               this.getColorByCode(e)
             }}
           />
@@ -365,7 +368,7 @@ class OptFlatList extends Component {
             style={{height:280}} 
             data={colorData&&colorData.length&&colorData[0].goodsAttrVals}
             renderItem={({ item, key}) => this._colorList(item, key,colorData[0].goodsAttrVals)}
-            numColumns= {4}
+            numColumns= {2}
           />
         </View>
       )

+ 142 - 1
app/containers/order/OrderEdit.js

@@ -22,6 +22,7 @@ import Collapsible from 'react-native-collapsible'
 import CountNum from '../../components/CountNum'
 import Input from '../../components/input'
 import png from '../../static/images/defaultimg.jpg'
+import morePng from '../../static/images/ic-moredian.png'
 import { ImageBaseUrl } from '../../utils/fetch/Fetchx'
 import {
   ScaleUtil,
@@ -45,6 +46,7 @@ import deletePng from '../../static/images/delete.png'
 import moment from 'moment'
 import Toast from 'react-native-root-toast'
 import DetailModels from '../../models/commodity/DetailModels'
+import OptFlatList from '../commodity/commoditydetail/OptFlatList'
 /**
  * saleModel
  *
@@ -54,6 +56,7 @@ import DetailModels from '../../models/commodity/DetailModels'
  *  CostReturn("04", "货补退货", "货补退货");
  */
 const { width, height } = Dimensions.get('window')
+let currRow = {}  // 当前操作行
 
 @connect(({ theme, mine, orderedit, optional }) => ({
   ...theme,
@@ -66,8 +69,11 @@ class OrderEdit extends Component {
     const date = new Date()
     super(props)
     this.state = {
+      optionData: [],
+      showOptModal : false,
       modalVisible : false,
       activeSection: true,
+      optLoading: false,
       // activeAllCollaps: true,
       optCollapse: 'shouqi',
       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) {
     this.state.EditPromData.splice(indexParent, 1)
@@ -1317,6 +1399,9 @@ class OrderEdit extends Component {
     // let optFlag = true,
     let optFlag = false,
       isOptArrs = []
+    if (item.baseGoodsOptId) {
+      item.isOptional = 1
+     }
     if (item.isOptional) {
       isOptArrs.push(item.isOptional)
     } else if (item.reqOrderItemBoms && item.reqOrderItemBoms.length > 0) {
@@ -1529,6 +1614,12 @@ class OrderEdit extends Component {
             justifyContent: 'space-between',
           }}
         >
+          <TouchableOpacity
+            activeOpacity={1}
+            onPress={() => {
+              this.openOptView(item)
+            }}
+          >          
           <View style={{ flexDirection: 'row' }}>
             <Text style={{ fontSize: 12, lineHeight: 17, color: '#333' }}>
               {reqBomText && reqBomText.length > 0 ? '选配项:' : '选   配:'}
@@ -1551,8 +1642,13 @@ class OrderEdit extends Component {
                   : item.baseGoodsOptValue
                 : item.baseGoodsOptValue}
             </Text>
+            <Image
+                resizeMode="contain"
+                source={morePng}
+                style={{ width: 24, height: 5, alignSelf: 'center' }}
+              />            
           </View>
-
+          </TouchableOpacity>              
           {collaseFlag ? (
             <View style={{ flexDirection: 'row' }}>
               {/* <TouchableOpacity
@@ -2338,6 +2434,51 @@ class OrderEdit extends Component {
               </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
             animationType="slide"
             presentationStyle="formSheet"

+ 40 - 4
app/containers/shoppingcart/ShoppingCartHome.js

@@ -140,6 +140,26 @@ class ShoppingCartHome extends Component {
     this.setState({ Amount: amount })
   }
 
+  // 删除选中商品
+  delSelectCart() {
+    const { ShopList } = this.props
+    let seletCart = []
+    ShopList.forEach(e => {
+      seletCart = seletCart.concat(e.data.filter(i => i.isChecked))
+    })
+    console.log(seletCart)
+    if (seletCart.length > 0) {
+      this.props.dispatch(
+        createAction('shoppingcart/deleteShop')({
+          params: {
+            customer: CUSTOMERINFO.id,
+            id: seletCart.map(e => e.id).join(",")
+          },
+        })
+      )
+    }
+  }
+
   render() {
     const { appTheme, ShopList, TotalNum } = this.props
     return (
@@ -190,7 +210,7 @@ class ShoppingCartHome extends Component {
             >
               购物车
             </Text>
-            {/* {ShopList && ShopList.length > 0 ? (
+            {ShopList && ShopList.length > 0 ? (
               <TouchableOpacity
                 style={{ position: "absolute", right: 10 }}
                 onPress={() => {
@@ -213,7 +233,7 @@ class ShoppingCartHome extends Component {
                   编辑
                 </Text>
               </TouchableOpacity>
-            ) : null} */}
+            ) : null}
           </View>
         </View>
 
@@ -365,7 +385,23 @@ class ShoppingCartHome extends Component {
               </View>
             ) : null}
             {this.state.edited ? (
-              <TouchableOpacity style={{ alignSelf: 'center' }}>
+              <TouchableOpacity style={{ alignSelf: 'center' }}
+                onPress={
+                  () => {
+                    if (this.toast) {
+                      Toast.hide(this.toast)
+                    }
+                    console.log(ShopList);
+                    if (!this.state.Loading && ShopList && ShopList.length > 0) {
+                      this.delSelectCart()
+                    } else {
+                      this.toast = Toast.show('购物车为空!', {
+                        position: toastHeight,
+                      })
+                    }
+                  }
+                }
+              >
                 <Text
                   style={{
                     fontSize: 14,
@@ -413,7 +449,7 @@ class ShoppingCartHome extends Component {
                   color: '#333',
                 }}
               >
-                移入关注
+                清空购物车
               </Text>
             </TouchableOpacity>
           ) : (