Commit 163cd886 by peii

添加支持客户销售员可自助下单

parent 3a87b630
...@@ -9,7 +9,7 @@ import ProductRightStyle from './ProductRightStyle'; ...@@ -9,7 +9,7 @@ import ProductRightStyle from './ProductRightStyle';
import ProductModel from '../../common/ProductModel'; import ProductModel from '../../common/ProductModel';
import StatusBarView from '../../common/StatusBarView'; import StatusBarView from '../../common/StatusBarView';
import ChooseCardList from '../../common/listDataComponent/ChooseCardList'; import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import { cloneObject, show, isNotBlank } from '../../../utils/Utils'; import { cloneObject, show, isNotBlank, isBlank } from '../../../utils/Utils';
import { reqPurSupplierSearch, reqProCategorySearch, reqSurTempHeadSearch, reqNailEquipHeadSearch, reqScatEquipmentSearch, reqSingleConsumSearch, setSelectProductOpts } from '../../../action/SelfAction'; import { reqPurSupplierSearch, reqProCategorySearch, reqSurTempHeadSearch, reqNailEquipHeadSearch, reqScatEquipmentSearch, reqSingleConsumSearch, setSelectProductOpts } from '../../../action/SelfAction';
import LoadingModel from '../../common/listDataComponent/LoadingModel'; import LoadingModel from '../../common/listDataComponent/LoadingModel';
import LocalVariable from '../../common/LocalVariable'; import LocalVariable from '../../common/LocalVariable';
...@@ -114,6 +114,8 @@ class ChooseProductPage extends Component { ...@@ -114,6 +114,8 @@ class ChooseProductPage extends Component {
const filterSuppliers = R.pluck('supplier_code', authorizations) const filterSuppliers = R.pluck('supplier_code', authorizations)
if (isNotBlank(filterSuppliers)) { if (isNotBlank(filterSuppliers)) {
list = R.filter(R.propSatisfies(R.includes(R.__, filterSuppliers), 'supplier_code'))(local_sele_pro_options) list = R.filter(R.propSatisfies(R.includes(R.__, filterSuppliers), 'supplier_code'))(local_sele_pro_options)
} else {
list = []
} }
} }
...@@ -122,7 +124,9 @@ class ChooseProductPage extends Component { ...@@ -122,7 +124,9 @@ class ChooseProductPage extends Component {
topProcOptionList: list, topProcOptionList: list,
originManufacterList: local_sele_pro_options originManufacterList: local_sele_pro_options
}, () => { }, () => {
that.handleTopNav(list[0], 0) if (isNotBlank(list)) {
that.handleTopNav(list[0], 0)
}
}) })
return return
} }
...@@ -158,6 +162,8 @@ class ChooseProductPage extends Component { ...@@ -158,6 +162,8 @@ class ChooseProductPage extends Component {
const filterSuppliers = R.pluck('supplier_code', authorizations) const filterSuppliers = R.pluck('supplier_code', authorizations)
if (isNotBlank(filterSuppliers)) { if (isNotBlank(filterSuppliers)) {
list = R.filter(R.propSatisfies(R.includes(R.__, filterSuppliers), 'supplier_code'))(topProcOptionList) list = R.filter(R.propSatisfies(R.includes(R.__, filterSuppliers), 'supplier_code'))(topProcOptionList)
} else {
list = []
} }
} }
...@@ -166,7 +172,9 @@ class ChooseProductPage extends Component { ...@@ -166,7 +172,9 @@ class ChooseProductPage extends Component {
originManufacterList: topProcOptionList, originManufacterList: topProcOptionList,
}, () => { }, () => {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
that.handleTopNav(topProcOptionList[0], 0) if (isNotBlank(list)) {
that.handleTopNav(list[0], 0)
}
}) })
} else { } else {
this.refs.LoadingModel.hide() this.refs.LoadingModel.hide()
...@@ -688,6 +696,8 @@ class ChooseProductPage extends Component { ...@@ -688,6 +696,8 @@ class ChooseProductPage extends Component {
if (isNotBlank(auth) && isNotBlank(auth.product_line_category_list)) { if (isNotBlank(auth) && isNotBlank(auth.product_line_category_list)) {
const typeCodes = R.pluck('product_line_category_name', auth.product_line_category_list) const typeCodes = R.pluck('product_line_category_name', auth.product_line_category_list)
list = R.filter(R.propSatisfies(R.includes(R.__, typeCodes), 'surgery_type'))(list) list = R.filter(R.propSatisfies(R.includes(R.__, typeCodes), 'surgery_type'))(list)
} else {
list = []
} }
} }
...@@ -709,22 +719,42 @@ class ChooseProductPage extends Component { ...@@ -709,22 +719,42 @@ class ChooseProductPage extends Component {
* @return {*} * @return {*}
*/ */
rightNameFilter(list = []) { rightNameFilter(list = []) {
const {searchValue, authorizations, productAuthorization, topActiveIndex, topProcOptionList, leftActiveIndex} = this.state if(isBlank(list)) return []
if (productAuthorization === 'Y' && R.includes(leftActiveIndex, [1, 2, 3])) { const {searchValue, authorizations, productAuthorization, topActiveIndex, topProcOptionList, leftActiveIndex} = this.state
if (productAuthorization === 'Y') {
const curSupplier = topProcOptionList[topActiveIndex] const curSupplier = topProcOptionList[topActiveIndex]
const auth = R.find(R.propEq('supplier_code', curSupplier.supplier_code))(authorizations) const auth = R.find(R.propEq('supplier_code', curSupplier.supplier_code))(authorizations)
if (isNotBlank(auth) && isNotBlank(auth.product_line_category_list)) { if (isNotBlank(auth) && isNotBlank(auth.product_line_category_list)) {
const typeCodes = R.pluck('product_line_category_code', auth.product_line_category_list) const typeCodes = R.pluck('product_line_category_code', auth.product_line_category_list)
list = R.filter(R.propSatisfies(R.includes(R.__, typeCodes), 'product_line_category_code'))(list) if (R.compose(R.isNil, R.path([0, 'details']))(list)) {
list = R.filter(R.propSatisfies(R.includes(R.__, typeCodes), 'product_line_category_code'))(list)
} else {
R.map(item => {
if (isBlank(item.details)) return
item.details = R.filter(R.propSatisfies(R.includes(R.__, typeCodes), 'product_line_category_code'))(item.details)
})(list)
}
} else {
list = []
} }
} }
const includes = item => { const includes = item => {
const reg = new RegExp(searchValue, 'g') const reg = new RegExp(searchValue, 'g')
return R.test(reg, item.general_name) || R.test(reg, item.item_name) return R.test(reg, item.general_name) || R.test(reg, item.item_name)
} }
return R.filter(includes, list) return R.filter(includes, list)
// if (R.compose(R.isNil, R.path([0, 'details']))(list)) {
// return R.filter(includes, list)
// } else {
// R.map(item => {
// if (isBlank(item.details)) return
// item.display_details = R.filter(includes, item.details)
// })(list)
// return list
// }
} }
// 返回搜索元素 // 返回搜索元素
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableOpacity, Image, ScrollView, FlatList, SafeAreaView } from 'react-native'; import { View, Text, StyleSheet, TouchableOpacity, Image, ScrollView, FlatList, SafeAreaView } from 'react-native';
import * as R from "ramda";
import { third_text_color, foundation_color, second_text_size, Width, pxSize, font_family_regular, icon_style } from '../../../base/BaseStyle'; import { third_text_color, foundation_color, second_text_size, Width, pxSize, font_family_regular, icon_style } from '../../../base/BaseStyle';
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu'; import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
import { cloneObject } from '../../../utils/Utils'; import { cloneObject } from '../../../utils/Utils';
...@@ -160,7 +161,7 @@ class ProductRightStyle extends Component { ...@@ -160,7 +161,7 @@ class ProductRightStyle extends Component {
let that = this let that = this
if (show && superItem) { if (show && superItem) {
// 大类点击标题 // 大类点击标题
let curRowData = cloneObject(superItem['details']) let curRowData = R.clone(superItem['details'])
curThridObj = { curThridObj = {
superItem: superItem, superItem: superItem,
superIndex: superIndex, superIndex: superIndex,
......
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 sign in to comment