Commit 56151aa5 by Denglingling

删除多余代码,以及相关常用变量

(cherry picked from commit fbdeabf3)
parent 9f63e122
...@@ -60,26 +60,26 @@ export default class LocalVariable { ...@@ -60,26 +60,26 @@ export default class LocalVariable {
/** /**
* 手术模板名 * 手术模板名
*/ */
static SURGICAL_TEMPLATE = 'surg_temp' static SURGICAL_TEMPLATE = 'surgical_template_name'
/** /**
* 钉盒名 * 钉盒名
*/ */
static NAIL_BOX = 'screw_box' static NAIL_BOX = 'nail_box_name'
/** /**
* 器械包名 * 器械包名
*/ */
static EQUIPMENT_BAG = 'equip_bag' static EQUIPMENT_BAG = 'equipment_bag_name'
/** /**
* 零散器械名 * 零散器械名
*/ */
static SCATTERED_EQUIPMENT = 'auxili_tool' static SCATTERED_EQUIPMENT = 'scattered_equipment_name'
/** /**
* 单选耗材名 * 单选耗材名
*/ */
static SIGN_SELECT_CONSUMABLES = 'sign_consu' static SIGN_SELECT_CONSUMABLES = 'sign_select_consumables_name'
} }
\ No newline at end of file
...@@ -24,7 +24,6 @@ class LodingModel extends Component { ...@@ -24,7 +24,6 @@ class LodingModel extends Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (this.state.isVisible != nextProps.show) { if (this.state.isVisible != nextProps.show) {
console.log('nextProps.show====', nextProps.show)
this.setState({ this.setState({
isVisible: nextProps.show isVisible: nextProps.show
}) })
...@@ -33,14 +32,12 @@ class LodingModel extends Component { ...@@ -33,14 +32,12 @@ class LodingModel extends Component {
render() { render() {
let { title, size, color, style_back } = this.props let { title, size, color, style_back } = this.props
console.log('!!this.state.isVisible====', !!this.state.isVisible)
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Modal <Modal
transparent={true} transparent={true}
visible={!!this.state.isVisible} visible={!!this.state.isVisible}
animationType={'fade'} animationType={'fade'}
// onRequestClose={() => this.closeModal()}>
> >
<SafeAreaView style={safe_view}> <SafeAreaView style={safe_view}>
<View style={[styles.loding_cont, style_back]}> <View style={[styles.loding_cont, style_back]}>
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { View, Text, StyleSheet, SafeAreaView, Modal, ScrollView, TouchableOpacity, FlatList, Image } from 'react-native'; import { View, Text, StyleSheet, SafeAreaView, Modal, ScrollView, TouchableOpacity, FlatList, Image } from 'react-native';
import { pxHeight, foundation_color, promary_color, second_text_color, third_text_color, first_text_color, second_text_size, Width, pxSize, safe_view, font_family_medium, font_family_light, list_common_item, third_text_size, icon_style, point_color, title_text_color } from '../../base/BaseStyle'; import { pxHeight, foundation_color, promary_color, second_text_color, first_text_color, Width, pxSize, safe_view, font_family_medium, font_family_light, list_common_item, third_text_size, icon_style, point_color, title_text_color } from '../../base/BaseStyle';
import ChooseCardList from '../common/listDataComponent/ChooseCardList'; import ChooseCardList from '../common/listDataComponent/ChooseCardList';
import PicTitDetaiCalcu from '../common/listDataComponent/PicTitDetaiCalcu'; import PicTitDetaiCalcu from '../common/listDataComponent/PicTitDetaiCalcu';
import _ from "lodash"; import _ from "lodash";
import localMockData from '../../containers/selfOrder/module/mock/sen_mock';
import { cloneObject } from '../../utils/Utils';
import LocalVariable from './LocalVariable'; import LocalVariable from './LocalVariable';
const PropTypes = require('prop-types'); const PropTypes = require('prop-types');
// const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
// const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
// const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
// const QUANTITY_FIELD = 'quantity' // 计算的字段
// const CHILDREN_LINE_NAME = 'childrenLineData' // 显示的子类数组名称
// const SUPER_TITLE_NAME = 'super_title_name'
// const SUPER_TITLE_TIP = 'super_title_tip'
// const ONLY_TWO_LEVELS = 'onlyTwoLevels' // 只有两级的耗材
class ProductModel extends Component { class ProductModel extends Component {
static propTypres = { static propTypres = {
...@@ -38,14 +27,6 @@ class ProductModel extends Component { ...@@ -38,14 +27,6 @@ class ProductModel extends Component {
orginOptionList: [], // 原始数据 orginOptionList: [], // 原始数据
} }
} }
componentDidMount(){
// console.log('本地测试数据====localMockData===', localMockData)
// // 赋值测试数据
// this.setState({
// topProcOptionList: localMockData.localBottomOption
// })
}
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
let that = this let that = this
...@@ -89,39 +70,29 @@ class ProductModel extends Component { ...@@ -89,39 +70,29 @@ class ProductModel extends Component {
} }
}) })
otherArr.push(otherChildObj) otherArr.push(otherChildObj)
console.log('修改后的已选数据😁====', otherArr)
this.setState({ this.setState({
topProcOptionList: otherArr topProcOptionList: otherArr
}) })
} }
// 恢复其他所有数据 // 恢复耗材以外的数据
setTopOrginTopData(curOptions){ setTopOrginTopData(curOptions){
let {orginOptionList} = this.state let {orginOptionList} = this.state
// console.log('回调之前的==原始已选数据==', orginOptionList)
// console.log('回调之前的===当前修改后的已选数据==', curOptions)
orginOptionList.map(function(orgItem, orgIndex) { orginOptionList.map(function(orgItem, orgIndex) {
if(orgIndex < 4){ if(orgIndex < 4){
orgItem = curOptions[orgIndex] orgItem = curOptions[orgIndex]
} }
}) })
// console.log('当前修改后的原始数据==', orginOptionList) this.props.modelCallBack(orginOptionList)
this.props.modelCallBack(orginOptionList) // 调用
}
// 共计已选 点击
handleCloseSelected() {
console.log('已选:handleCloseSelected')
this.closeModal()
} }
// 选好了 点击 // 选好了 点击
handleCloseSubmit() { handleCloseSubmit() {
console.log('选好了--handleCloseSubmit')
this.closeModal() this.closeModal()
this.props.closeSubmit() this.props.closeSubmit()
} }
// 关闭弹窗
closeModal() { closeModal() {
this.setState({ this.setState({
isVisible: false isVisible: false
...@@ -131,18 +102,13 @@ class ProductModel extends Component { ...@@ -131,18 +102,13 @@ class ProductModel extends Component {
// 单选耗材清空图标回调 // 单选耗材清空图标回调
handleClearBack(item, index){ handleClearBack(item, index){
let {orginOptionList, topProcOptionList, topActiveIndex} = this.state let {orginOptionList} = this.state
// console.log('清空图标回调---', item, index)
// console.log('原始已选数据==--===--', orginOptionList)
// console.log('当前已选数据==----', topProcOptionList, topActiveIndex)
// 单选耗材当前清空项 // 单选耗材当前清空项
let allCountQuantity = 0 // 初始化 let allCountQuantity = 0 // 初始化
orginOptionList.forEach(function(orgOpts, orgInd) { orginOptionList.forEach(function(orgOpts, orgInd) {
if(orgInd >= 4){ if(orgInd >= 4){
if(orgOpts[LocalVariable.LOCAL_SECOND_DATA] && orgOpts[LocalVariable.LOCAL_SECOND_DATA].length > 0){ if(orgOpts[LocalVariable.LOCAL_SECOND_DATA] && orgOpts[LocalVariable.LOCAL_SECOND_DATA].length > 0){
orgOpts[LocalVariable.LOCAL_SECOND_DATA].forEach(function(localDa, localInd) { orgOpts[LocalVariable.LOCAL_SECOND_DATA].forEach(function(localDa) {
if(localDa[LocalVariable.ONLY_TWO_LEVELS] && localDa['item_code'] === item['item_code']){ if(localDa[LocalVariable.ONLY_TWO_LEVELS] && localDa['item_code'] === item['item_code']){
// 二级 // 二级
localDa[LocalVariable.QUANTITY_FIELD] = 0 localDa[LocalVariable.QUANTITY_FIELD] = 0
...@@ -186,30 +152,23 @@ class ProductModel extends Component { ...@@ -186,30 +152,23 @@ class ProductModel extends Component {
} }
allCountQuantity += orgOpts[LocalVariable.SELECTED_QUQNTITY] allCountQuantity += orgOpts[LocalVariable.SELECTED_QUQNTITY]
}) })
// console.log('修改后的已选=======---', topProcOptionList)
// console.log('修改后的数量---', allCountQuantity)
// console.log('修改后端所有数据---', orginOptionList)
this.props.modelCallBack(orginOptionList) this.props.modelCallBack(orginOptionList)
if(allCountQuantity === 0){ if(allCountQuantity === 0){
this.closeModal() this.closeModal()
} }
} }
// 修改列表计算后数据 // 列表计算后回调
handleCalCallBack(item, index){ handleCalCallBack(item, index){
console.log('回调=====', item, index)
let {topProcOptionList, topActiveIndex} = this.state let {topProcOptionList, topActiveIndex} = this.state
let defauIndex = index let defauIndex = index
defauIndex = item.superIndex defauIndex = item.superIndex
console.log('--当前已选数据 ===',topProcOptionList, topActiveIndex)
if(LocalVariable.SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR]) { if(LocalVariable.SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][LocalVariable.SELECTED_DATA_ARR]) {
let allCountQuantity = 0 // 初始化 let allCountQuantity = 0 // 初始化
topProcOptionList.map(function(listItem, listIndex) { topProcOptionList.map(function(listItem, listIndex) {
if(listIndex === topActiveIndex){ if(listIndex === topActiveIndex){
if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){ if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
//钉盒 零散器械 //钉盒 器械包 零散器械
//初始化 中类 //初始化 中类
let deleFlag = false let deleFlag = false
let deleInd = null let deleInd = null
...@@ -228,6 +187,7 @@ class ProductModel extends Component { ...@@ -228,6 +187,7 @@ class ProductModel extends Component {
listItem[LocalVariable.SELECTED_DATA_ARR].splice(deleInd, 1) listItem[LocalVariable.SELECTED_DATA_ARR].splice(deleInd, 1)
} }
}else { }else {
// 手术模板
let deleFlag = false let deleFlag = false
let deleInd = null let deleInd = null
// 初始化 三级 // 初始化 三级
...@@ -247,8 +207,7 @@ class ProductModel extends Component { ...@@ -247,8 +207,7 @@ class ProductModel extends Component {
}) })
if(deleFlag) { if(deleFlag) {
listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.CHILDREN_LINE_NAME].splice(deleInd, 1) listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex][LocalVariable.CHILDREN_LINE_NAME].splice(deleInd, 1)
} }
// 初始化 中类 // 初始化 中类
listItem[LocalVariable.SELECTED_QUQNTITY] = 0 listItem[LocalVariable.SELECTED_QUQNTITY] = 0
listItem[LocalVariable.SELECTED_DATA_ARR].forEach(function(seDa) { listItem[LocalVariable.SELECTED_DATA_ARR].forEach(function(seDa) {
...@@ -259,11 +218,10 @@ class ProductModel extends Component { ...@@ -259,11 +218,10 @@ class ProductModel extends Component {
}) })
// 已选数量赋值之前默认数据 // 已选数量赋值之前默认数据
let curObj = listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex] let curObj = listItem[LocalVariable.SELECTED_DATA_ARR][defauIndex]
// console.log('curObj----', curObj)
if(listIndex < 4){ if(listIndex < 4){
if(curObj.id){ if(curObj['template_number']){
listItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function(deIt) { listItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function(deIt) {
if(deIt.id === curObj.id){ // 本地测试'id'为唯一值 if(deIt.template_number === curObj.template_number){
deIt = curObj deIt = curObj
} }
}) })
...@@ -295,7 +253,6 @@ class ProductModel extends Component { ...@@ -295,7 +253,6 @@ class ProductModel extends Component {
// 清空 // 清空
handleClearRubbish() { handleClearRubbish() {
let {orginOptionList} = this.state let {orginOptionList} = this.state
// console.log('清空======', orginOptionList)
orginOptionList.map(function(listItem) { orginOptionList.map(function(listItem) {
listItem[LocalVariable.SELECTED_QUQNTITY] = 0 listItem[LocalVariable.SELECTED_QUQNTITY] = 0
listItem[LocalVariable.SELECTED_DATA_ARR] = [] listItem[LocalVariable.SELECTED_DATA_ARR] = []
...@@ -304,9 +261,6 @@ class ProductModel extends Component { ...@@ -304,9 +261,6 @@ class ProductModel extends Component {
deIt[LocalVariable.CHILDREN_LINE_NAME] = [] deIt[LocalVariable.CHILDREN_LINE_NAME] = []
}) })
}) })
// 回调函数
// console.log('---清空之后===== ', orginOptionList)
// this.props.modelCallBack(orginOptionList)
this.props.clearRubbish() this.props.clearRubbish()
this.closeModal() this.closeModal()
} }
...@@ -357,10 +311,6 @@ class ProductModel extends Component { ...@@ -357,10 +311,6 @@ class ProductModel extends Component {
renderContItem() { renderContItem() {
let {topProcOptionList, topActiveIndex} = this.state let {topProcOptionList, topActiveIndex} = this.state
let curData = topProcOptionList[topActiveIndex] let curData = topProcOptionList[topActiveIndex]
// console.log('已选展示信息 === curData---', topProcOptionList)
// console.log('已选展示信息 === curData---', topActiveIndex)
// console.log('已选展示信息 === curData---', curData)
let localBottomContData = [] let localBottomContData = []
if(curData && curData[LocalVariable.SELECTED_DATA_ARR]){ if(curData && curData[LocalVariable.SELECTED_DATA_ARR]){
curData[LocalVariable.SELECTED_DATA_ARR].forEach(function(sedItem, sedInd) { curData[LocalVariable.SELECTED_DATA_ARR].forEach(function(sedItem, sedInd) {
...@@ -381,8 +331,6 @@ class ProductModel extends Component { ...@@ -381,8 +331,6 @@ class ProductModel extends Component {
} }
}) })
} }
// console.log('已选当前模块数据---',curData,topActiveIndex)
// console.log('已选展示信息---',localBottomContData)
return( return(
<View style={styles.edit_cont}> <View style={styles.edit_cont}>
...@@ -405,7 +353,6 @@ class ProductModel extends Component { ...@@ -405,7 +353,6 @@ class ProductModel extends Component {
// 返回每一列元素 // 返回每一列元素
renderContColumnItem(item, index) { renderContColumnItem(item, index) {
let {topActiveIndex} = this.state let {topActiveIndex} = this.state
// let curTit='', curTipOne='', curTipTwo=''
let curTit='', curTipOne='', curTipTwo='', curTipOneTit='', curTipTwoTit='', curIcon='' let curTit='', curTipOne='', curTipTwo='', curTipOneTit='', curTipTwoTit='', curIcon=''
let curListMaxNum = '' let curListMaxNum = ''
if(topActiveIndex === 0){ if(topActiveIndex === 0){
...@@ -425,26 +372,7 @@ class ProductModel extends Component { ...@@ -425,26 +372,7 @@ class ProductModel extends Component {
curTit = LocalVariable.SUPER_TITLE_NAME curTit = LocalVariable.SUPER_TITLE_NAME
curTipOne = LocalVariable.SUPER_TITLE_TIP curTipOne = LocalVariable.SUPER_TITLE_TIP
} }
// if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
// //钉盒 零散器械
// curTit = 'title'
// curTipOne = 'tip1'
// curTipTwo = 'tip2'
// // if(topActiveIndex === 2){
// // curTipOne = 'lineTip'
// // curTipTwo = ''
// // }
// }
// else if(topActiveIndex === 2){
// // 器械包
// curTit = 'item_name'
// curTipOne = 'category_name'
// curTipTwo = 'category_desc'
// }else {
// curTit = 'superTit'
// curTipOne = 'superTip'
// }
return ( return (
<TouchableOpacity <TouchableOpacity
activeOpacity={1} activeOpacity={1}
...@@ -460,7 +388,6 @@ class ProductModel extends Component { ...@@ -460,7 +388,6 @@ class ProductModel extends Component {
tipTextTwo={curTipTwo} tipTextTwo={curTipTwo}
tipTextOneTit={curTipOneTit} tipTextOneTit={curTipOneTit}
tipTextTwoTit={curTipTwoTit} tipTextTwoTit={curTipTwoTit}
// listImgIcon={'superImg'}
listPicType={'SQUARE'} listPicType={'SQUARE'}
listStyleImg={styles.list_icon} listStyleImg={styles.list_icon}
listStyleTit={styles.list_tit} listStyleTit={styles.list_tit}
...@@ -488,14 +415,13 @@ class ProductModel extends Component { ...@@ -488,14 +415,13 @@ class ProductModel extends Component {
sel_tip += `${proItem.category_name}x${proItem[LocalVariable.SELECTED_QUQNTITY]} ` sel_tip += `${proItem.category_name}x${proItem[LocalVariable.SELECTED_QUQNTITY]} `
} }
}) })
console.log('弹窗===', topProcOptionList, sel_tip)
return ( return (
<View style={list_common_item.sub_box}> <View style={list_common_item.sub_box}>
<View style={list_common_item.sub_two_btn}> <View style={list_common_item.sub_two_btn}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={.8}
style={[list_common_item.lef_btn, styles.fo_btn_lef]} style={[list_common_item.lef_btn, styles.fo_btn_lef]}
onPress={() => this.handleCloseSelected()} onPress={() => this.closeModal()}
> >
<Text style={list_common_item.lef_tip} numberOfLines={1}> <Text style={list_common_item.lef_tip} numberOfLines={1}>
{allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'当前已选: '}</Text>} {allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'当前已选: '}</Text>}
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { StyleSheet, Image, Text, TouchableOpacity, View, ScrollView } from 'react-native'; import { StyleSheet, Image, Text, TouchableOpacity, View, ScrollView } from 'react-native';
import { first_text_color, font_family_light, font_family_regular, font_family_semibold, foundation_color, home_background_color, icon_style, point_color, promary_color, pxSize, second_text_color, second_text_size, third_text_color, third_text_size, title_text_color, Width } from '../../../base/BaseStyle'; import { first_text_color, font_family_regular, font_family_semibold, home_background_color, icon_style, point_color, promary_color, pxSize, second_text_color, third_text_size, title_text_color } from '../../../base/BaseStyle';
const PropTypes = require('prop-types'); const PropTypes = require('prop-types');
import localMockData from '../../selfOrder/module/mock/sen_mock';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
/**
* 卡片选择器,可用于顶部,右侧
*/
class ChooseCardList extends Component { class ChooseCardList extends Component {
static propTypres = { static propTypres = {
...@@ -27,19 +29,13 @@ class ChooseCardList extends Component { ...@@ -27,19 +29,13 @@ class ChooseCardList extends Component {
cardListOptions: PropTypes.array, cardListOptions: PropTypes.array,
cardItemTitle: PropTypes.string, cardItemTitle: PropTypes.string,
cardItemIcon: PropTypes.string, cardItemIcon: PropTypes.string,
cardImgName: PropTypes.string,
cardCallBack: PropTypes.func, cardCallBack: PropTypes.func,
curActIndex: PropTypes.number, // 当前已选项index curActIndex: PropTypes.number, // 当前已选项index
cardCountName: PropTypes.string, // 显示计数字段 cardCountName: PropTypes.string, // 显示计数字段
cardStyleType: PropTypes.string, // 计数可选样式 cardStyleType: PropTypes.string, // 计数可选样式
cardCouStyle: PropTypes.object, // 指定计数样式 cardCouStyle: PropTypes.object, // 指定计数样式
cardShowDefIcon: PropTypes.bool, // 是否显示默认无图 cardShowDefIcon: PropTypes.bool, // 是否显示默认无图
cardKeyName: PropTypes.string, // 关键key值
} }
constructor(props) { constructor(props) {
...@@ -51,15 +47,12 @@ class ChooseCardList extends Component { ...@@ -51,15 +47,12 @@ class ChooseCardList extends Component {
} }
render() { render() {
let { cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox, cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardImgName, let { cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox,
cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardCountName, cardStyleType, cardCouStyle, cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon,
global_domain_config, cardShowDefIcon, cardKeyName } = this.props cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardCountName, cardStyleType,
cardCouStyle, global_domain_config, cardShowDefIcon } = this.props
let { countStyleType } = this.state let { countStyleType } = this.state
// let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
// cardListOptions[cardImgName] = localTestImageUrls // 本地测试
return ( return (
<View style={[styles.card_container, cardStyleBox]}> <View style={[styles.card_container, cardStyleBox]}>
<ScrollView <ScrollView
...@@ -72,17 +65,12 @@ class ChooseCardList extends Component { ...@@ -72,17 +65,12 @@ class ChooseCardList extends Component {
{cardListOptions.map((item, index) => { {cardListOptions.map((item, index) => {
let cur_icon = item[cardItemIcon] let cur_icon = item[cardItemIcon]
if (typeof cur_icon === 'string') { if (typeof cur_icon === 'string') {
// global_domain_config = 'https://obs-dev.gyjtsx.com' // 本地测试 cur_icon = { uri: global_domain_config + '/jeecg-boot/sys/common/view/' + cur_icon }
// cur_icon = {uri: global_domain_config+cur_icon} // 测试
cur_icon = { uri: global_domain_config + '/jeecg-boot/sys/common/view/' + cur_icon } // 正式
} else if (cur_icon instanceof Array) { } else if (cur_icon instanceof Array) {
// global_domain_config = 'https://obs-dev.gyjtsx.com' // 本地测试
// cur_icon = {uri: global_domain_config+cur_icon[0]} // 测试
if (cur_icon.length === 0) { if (cur_icon.length === 0) {
cur_icon = require('../../../images/not_img.png') cur_icon = require('../../../images/not_img.png')
} else { } else {
cur_icon = { uri: global_domain_config + '/jeecg-boot/sys/common/view/' + cur_icon[0] } // 正式 cur_icon = { uri: global_domain_config + '/jeecg-boot/sys/common/view/' + cur_icon[0] }
} }
} }
return <View style={styles.card_list_box} key={'choose_card' + index}> return <View style={styles.card_list_box} key={'choose_card' + index}>
......
...@@ -37,9 +37,6 @@ class LoadingModel extends Component { ...@@ -37,9 +37,6 @@ class LoadingModel extends Component {
render() { render() {
let { title, size, color, style_back } = this.props let { title, size, color, style_back } = this.props
// console.log('==aaa=LoadingModel===', this.state.isVisible)
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Modal <Modal
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { StyleSheet, Image, TouchableOpacity, View, Modal, ActivityIndicator, Text, SafeAreaView } from 'react-native'; import { StyleSheet, Image, TouchableOpacity, View } from 'react-native';
import { font_family_medium, font_family_regular, Height, icon_style, pxSize, second_text_color, second_text_size, Width } from '../../../base/BaseStyle'; import { font_family_regular, icon_style, pxSize, second_text_color, second_text_size } from '../../../base/BaseStyle';
import { AsteriskTextStyle, CellTextStyle, ContInputTextStyle, ContTextStyle, ImageTextStyle, TitleTextStyle } from '../CellTextStyle'; import { AsteriskTextStyle, CellTextStyle, ContInputTextStyle, ContTextStyle, TitleTextStyle } from '../CellTextStyle';
const PropTypes = require('prop-types'); const PropTypes = require('prop-types');
/** /**
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { StyleSheet, Image, Text, TouchableOpacity, View } from 'react-native'; import { StyleSheet, Image, Text, TouchableOpacity, View } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { first_text_color, font_family_light, font_family_medium, font_family_regular, font_family_semibold, home_background_color, icon_style, promary_text_color, pxSize, second_text_size, third_text_color, third_text_size } from '../../../base/BaseStyle'; import { first_text_color, font_family_medium, font_family_regular, font_family_semibold, home_background_color, icon_style, pxSize, second_text_size, third_text_color, third_text_size } from '../../../base/BaseStyle';
import PictureZoom from '../../common/listDataComponent/PictureZoom'; import PictureZoom from '../../common/listDataComponent/PictureZoom';
const PropTypes = require('prop-types'); const PropTypes = require('prop-types');
/**
* 列表组件,图片-标题(提示)-计算/关闭
*/
class PicTitDetaiCalcu extends Component { class PicTitDetaiCalcu extends Component {
static propTypres = { static propTypres = {
...@@ -29,7 +32,6 @@ class PicTitDetaiCalcu extends Component { ...@@ -29,7 +32,6 @@ class PicTitDetaiCalcu extends Component {
listStyleImg: PropTypes.objec, listStyleImg: PropTypes.objec,
plusCallBack: PropTypes.func, // 加法的回调函数 plusCallBack: PropTypes.func, // 加法的回调函数
reduceCallBack: PropTypes.func, // 减法的回调函数 reduceCallBack: PropTypes.func, // 减法的回调函数
// listShowChildNum: PropTypes.string, // 已选展示的子类数量,标题显示父级标题
showClearIcon: PropTypes.bool, // 展示减少x图标,不展示加减 showClearIcon: PropTypes.bool, // 展示减少x图标,不展示加减
showClearIndex: PropTypes.number, // 展示index showClearIndex: PropTypes.number, // 展示index
listCardActIndex: PropTypes.number, // 父级index = 展示index listCardActIndex: PropTypes.number, // 父级index = 展示index
...@@ -38,7 +40,6 @@ class PicTitDetaiCalcu extends Component { ...@@ -38,7 +40,6 @@ class PicTitDetaiCalcu extends Component {
onlyShowNum: PropTypes.bool, // 只展示数字 onlyShowNum: PropTypes.bool, // 只展示数字
onlyShowSelect: PropTypes.bool, // 只能单选 onlyShowSelect: PropTypes.bool, // 只能单选
listMaxNum: PropTypes.number, // 数量限制最大值 listMaxNum: PropTypes.number, // 数量限制最大值
listShowNoData: PropTypes.bool, // 展示暂无数据
} }
constructor(props) { constructor(props) {
...@@ -49,11 +50,6 @@ class PicTitDetaiCalcu extends Component { ...@@ -49,11 +50,6 @@ class PicTitDetaiCalcu extends Component {
} }
} }
// // 清空图标
// handelClearCheck(item, index) {
// reduceCallBack(item, index)
// }
// 单选点击 // 单选点击
handelSelectCheck(item, index) { handelSelectCheck(item, index) {
item.select = !!!item.select item.select = !!!item.select
...@@ -69,16 +65,13 @@ class PicTitDetaiCalcu extends Component { ...@@ -69,16 +65,13 @@ class PicTitDetaiCalcu extends Component {
handelCalculation(item, index, isPlus) { handelCalculation(item, index, isPlus) {
let { calField, plusCallBack, reduceCallBack } = this.props let { calField, plusCallBack, reduceCallBack } = this.props
if (!isPlus && reduceCallBack) { if (!isPlus && reduceCallBack) {
// console.log('减法回调======')
reduceCallBack(item, index) reduceCallBack(item, index)
return return
} }
if (isPlus && plusCallBack) { if (isPlus && plusCallBack) {
// console.log('加法回调======', item, index)
plusCallBack(item, index) plusCallBack(item, index)
return return
} }
// console.log('加减======', item, index, isPlus)
item[calField] = Number(item[calField]) item[calField] = Number(item[calField])
if (Number.isNaN(item[calField])) { if (Number.isNaN(item[calField])) {
item[calField] = 0 item[calField] = 0
...@@ -95,7 +88,7 @@ class PicTitDetaiCalcu extends Component { ...@@ -95,7 +88,7 @@ class PicTitDetaiCalcu extends Component {
let { listItem, listIndex, calField, listStyleBox, listStyleTit, listStyleTip, listStyleCalBtn, listPicType, titCallBack, let { listItem, listIndex, calField, listStyleBox, listStyleTit, listStyleTip, listStyleCalBtn, listPicType, titCallBack,
titText, tipTextStr, tipTextOne, tipTextTwo, listImgIcon, listStyleImg, showClearIcon, showClearIndex, listCardActIndex, titText, tipTextStr, tipTextOne, tipTextTwo, listImgIcon, listStyleImg, showClearIcon, showClearIndex, listCardActIndex,
listStyleClearBtn, clearCallBack, onlyShowNum, onlyShowSelect, tipTextStrTit, tipTextOneTit, tipTextTwoTit, listStyleClearBtn, clearCallBack, onlyShowNum, onlyShowSelect, tipTextStrTit, tipTextOneTit, tipTextTwoTit,
global_domain_config, listMaxNum, listShowNoData } = this.props global_domain_config, listMaxNum } = this.props
let { listPicTypeArr, picStyleArr } = this.state let { listPicTypeArr, picStyleArr } = this.state
let picOthStyle = '' let picOthStyle = ''
...@@ -117,94 +110,85 @@ class PicTitDetaiCalcu extends Component { ...@@ -117,94 +110,85 @@ class PicTitDetaiCalcu extends Component {
} }
let cur_photos = [] let cur_photos = []
if (listItem[listImgIcon] instanceof Array) { if (listItem[listImgIcon] instanceof Array) {
// global_domain_config = 'https://obs.uat.sfrx.guke.tech' // 本地测试
listItem[listImgIcon].map((iconIt) => { listItem[listImgIcon].map((iconIt) => {
// cur_photos.push({ url: global_domain_config + iconIt}) // 测试 cur_photos.push({ url: global_domain_config + '/jeecg-boot/sys/common/view/' + iconIt })
cur_photos.push({ url: global_domain_config + '/jeecg-boot/sys/common/view/' + iconIt }) // 正式
}) })
} }
// console.log('每一列----',cur_photos)
return ( return (
<View> <View style={[styles.ri_inner, listStyleBox]}>
{(listImgIcon && cur_photos.length > 0) ?
<PictureZoom
listImageIndex={0}
listImageUrls={cur_photos}
listStyleImage={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}
listPicType={listPicType}
/>
: null}
<View style={styles.ri_text_box}>
<TouchableOpacity
activeOpacity={titCallBack ? .8 : 1}
onPress={() => { titCallBack ? titCallBack(listItem, listIndex) : {} }}
style={styles.oth_box}
>
<Text numberOfLines={1} style={[styles.thr_ot, listStyleTit]}>
{listItem[titText]}
</Text>
{listItem[tipTextStr] ? <Text numberOfLines={1} style={[styles.ri_te_ot, styles.te_ot_str, listStyleTip]}>
{tipTextStrTit ? `${tipTextStrTit}:` : ''}{listItem[tipTextStr]}
</Text> : null}
{listItem[tipTextOne] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>
{tipTextOneTit ? `${tipTextOneTit}:` : ''}{listItem[tipTextOne]}
</Text> : null}
{listItem[tipTextTwo] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>
{tipTextTwoTit ? `${tipTextTwoTit}:` : ''}{listItem[tipTextTwo]}
</Text> : null}
</TouchableOpacity>
</View>
{ {
listShowNoData ? <Text>暂无数据</Text> : (showClearIcon && listCardActIndex === showClearIndex) ?
<View style={[styles.ri_inner, listStyleBox]}> <View style={styles.btn_cle_box}>
{(listImgIcon && cur_photos.length > 0) ? <TouchableOpacity
<PictureZoom activeOpacity={.9}
listImageIndex={0} style={[styles.btn_clear_inner, listStyleClearBtn]}
listImageUrls={cur_photos} onPress={() => clearCallBack(listItem, listIndex)}
listStyleImage={[styles.oth_img_box, styles[picOthStyle], listStyleImg]} >
listPicType={listPicType} <View style={[styles.icon_cle_btn]}>
/> <Image source={require('../../../images/close_icon.png')} style={icon_style}></Image>
: null} </View>
<View style={styles.ri_text_box}> </TouchableOpacity>
</View> :
<View style={[styles.ri_num_box, onlyShowNum ? styles.show_num_box : null]}>
{(listItem[calField] !== 0 && !onlyShowNum && !onlyShowSelect) ?
<TouchableOpacity <TouchableOpacity
activeOpacity={titCallBack ? .8 : 1} activeOpacity={.9}
onPress={() => { titCallBack ? titCallBack(listItem, listIndex) : {} }} style={[styles.btn_inner, listStyleCalBtn]}
style={styles.oth_box} onPress={() => this.handelCalculation(listItem, listIndex)}
> >
<Text numberOfLines={1} style={[styles.thr_ot, listStyleTit]}> <View style={[styles.thr_num_btn, styles.thr_btn_left]}>
{listItem[titText]} <Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image>
</Text>
{listItem[tipTextStr] ? <Text numberOfLines={1} style={[styles.ri_te_ot, styles.te_ot_str, listStyleTip]}>
{tipTextStrTit ? `${tipTextStrTit}:` : ''}{listItem[tipTextStr]}
</Text> : null}
{listItem[tipTextOne] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>
{tipTextOneTit ? `${tipTextOneTit}:` : ''}{listItem[tipTextOne]}
</Text> : null}
{listItem[tipTextTwo] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>
{tipTextTwoTit ? `${tipTextTwoTit}:` : ''}{listItem[tipTextTwo]}
</Text> : null}
</TouchableOpacity>
</View>
{
(showClearIcon && listCardActIndex === showClearIndex) ?
<View style={styles.btn_cle_box}>
<TouchableOpacity
activeOpacity={.9}
style={[styles.btn_clear_inner, listStyleClearBtn]}
onPress={() => clearCallBack(listItem, listIndex)}
>
<View style={[styles.icon_cle_btn]}>
<Image source={require('../../../images/close_icon.png')} style={icon_style}></Image>
</View>
</TouchableOpacity>
</View> :
<View style={[styles.ri_num_box, onlyShowNum ? styles.show_num_box : null]}>
{(listItem[calField] !== 0 && !onlyShowNum && !onlyShowSelect) ?
<TouchableOpacity
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex)}
>
<View style={[styles.thr_num_btn, styles.thr_btn_left]}>
<Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image>
</View>
</TouchableOpacity> : null}
{(listItem[calField] !== 0 && !onlyShowSelect) ? <Text style={[styles.thr_num, onlyShowNum ? styles.show_num : null]}>{listItem[calField]}</Text> : null}
{(!onlyShowNum && !onlyShowSelect && showPlusIcon) ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex, true)}
>
<View style={[styles.thr_num_btn, styles.thr_btn_right]}>
<Image source={calIcon} style={icon_style}></Image>
</View>
</TouchableOpacity> : null}
{onlyShowSelect ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_sel_inner]}
onPress={() => this.handelSelectCheck(listItem, listIndex)}
>
<View style={[styles.thr_sel_btn]}>
<Image source={defSelIcon} style={icon_style}></Image>
</View>
</TouchableOpacity> : null
}
</View> </View>
</TouchableOpacity> : null}
{(listItem[calField] !== 0 && !onlyShowSelect) ? <Text style={[styles.thr_num, onlyShowNum ? styles.show_num : null]}>{listItem[calField]}</Text> : null}
{(!onlyShowNum && !onlyShowSelect && showPlusIcon) ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex, true)}
>
<View style={[styles.thr_num_btn, styles.thr_btn_right]}>
<Image source={calIcon} style={icon_style}></Image>
</View>
</TouchableOpacity> : null}
{onlyShowSelect ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_sel_inner]}
onPress={() => this.handelSelectCheck(listItem, listIndex)}
>
<View style={[styles.thr_sel_btn]}>
<Image source={defSelIcon} style={icon_style}></Image>
</View>
</TouchableOpacity> : null
} }
</View> </View>
} }
...@@ -273,7 +257,6 @@ const styles = StyleSheet.create({ ...@@ -273,7 +257,6 @@ const styles = StyleSheet.create({
btn_sel_inner: {}, btn_sel_inner: {},
btn_cle_box: { btn_cle_box: {
marginRight: 6, marginRight: 6,
// backgroundColor: 'red',
paddingHorizontal: 4, paddingHorizontal: 4,
paddingVertical: 4 paddingVertical: 4
}, },
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { StyleSheet, Image, TouchableOpacity, View, Modal, ActivityIndicator, Text } from 'react-native'; import { StyleSheet, Image, TouchableOpacity, View, Modal, ActivityIndicator, Text } from 'react-native';
import { font_family_medium, Height, icon_style, pxSize, second_text_size, Width } from '../../../base/BaseStyle'; import { font_family_medium, Height, icon_style, pxSize, second_text_size } from '../../../base/BaseStyle';
import ImageViewer from 'react-native-image-zoom-viewer'; import ImageViewer from 'react-native-image-zoom-viewer';
const PropTypes = require('prop-types'); const PropTypes = require('prop-types');
...@@ -131,7 +131,6 @@ const styles = StyleSheet.create({ ...@@ -131,7 +131,6 @@ const styles = StyleSheet.create({
marginBottom: (Height() / 2) - 40 marginBottom: (Height() / 2) - 40
}, },
top_indic: { top_indic: {
// backgroundColor: 'hsla(0, 0%, 100%, .2)',
position: 'absolute', position: 'absolute',
top: 50, top: 50,
left: '46%' left: '46%'
......
...@@ -94,12 +94,9 @@ class TipInfoNeedSelect extends Component { ...@@ -94,12 +94,9 @@ class TipInfoNeedSelect extends Component {
transparent={true} transparent={true}
visible={this.state.isVisible} visible={this.state.isVisible}
animationType={'fade'} animationType={'fade'}
// onRequestClose={() => this.closeModal()}
> >
<View style={safe_view}> <View style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1} <TouchableOpacity style={styles.container} activeOpacity={1}>
// onPress={() => this.closeModal()}
>
{this.renderDialog()} {this.renderDialog()}
</TouchableOpacity> </TouchableOpacity>
</View> </View>
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { View, Text, SafeAreaView, StyleSheet, TouchableOpacity, Image, ScrollView, TextInput, Alert, Linking, NativeModules, Platform, DeviceEventEmitter } from 'react-native'; import { View, Text, SafeAreaView, StyleSheet, TouchableOpacity, Image, ScrollView, TextInput, Alert, Linking, NativeModules, Platform } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { home_background_color, placehold_text_color, promary_color, safe_view, icon_style, list_common_item } from '../../base/BaseStyle'; import { home_background_color, placehold_text_color, promary_color, safe_view, icon_style, list_common_item } from '../../base/BaseStyle';
import { ImageTextStyle, CellTextStyle, FooterBtnStyle } from '../common/CellTextStyle'; import { ImageTextStyle, CellTextStyle, FooterBtnStyle } from '../common/CellTextStyle';
...@@ -15,20 +15,14 @@ import { requestSelfOrganizations, requestSelfSurgeryHospital, requestSelfOrderT ...@@ -15,20 +15,14 @@ import { requestSelfOrganizations, requestSelfSurgeryHospital, requestSelfOrderT
import { exitLoginStatus } from '../../action/LoginAction'; import { exitLoginStatus } from '../../action/LoginAction';
import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE, LOGIN_NO, SELF_SUBMIT_DOING, SELF_SUBMIT_SUCCESS, SELF_SUBMIT_FAILURE } from '../../base/ActionTypes'; import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE, LOGIN_NO, SELF_SUBMIT_DOING, SELF_SUBMIT_SUCCESS, SELF_SUBMIT_FAILURE } from '../../base/ActionTypes';
import PageListArrow from '../common/listDataComponent/PageListArrow'; import PageListArrow from '../common/listDataComponent/PageListArrow';
import EmitterEvents from '../common/EmitterEvents';
import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect'; import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect';
import LocalVariable from '../common/LocalVariable'; import LocalVariable from '../common/LocalVariable';
import LoadingModel from '../common/listDataComponent/LoadingModel';
// const SELECTED_QUQNTITY = 'selectedQuantity'
// const SELECTED_DATA_ARR = 'selectedDataArr'
// const QUANTITY_FIELD = 'quantity' // 计算的字段
class SelfOrderPage extends Component { class SelfOrderPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
canSubFlag: false, // 生成订单按钮样式改变 canSubFlag: false, // 提交按钮样式
listOptionData: [ listOptionData: [
{ {
"id": "0", "id": "0",
...@@ -116,7 +110,7 @@ class SelfOrderPage extends Component { ...@@ -116,7 +110,7 @@ class SelfOrderPage extends Component {
isRecode: true // 录音 isRecode: true // 录音
} }
], ],
subInitListOption: [], // 提交成功后,初始化当前数据 subInitListOption: [], // 存储最初数据
submitOption: { // 提交的信息 submitOption: { // 提交的信息
seller_code: '', // 用户名username seller_code: '', // 用户名username
org_code: '', // 组织 org_code: '', // 组织
...@@ -147,29 +141,20 @@ class SelfOrderPage extends Component { ...@@ -147,29 +141,20 @@ class SelfOrderPage extends Component {
dateModelPop: false, // 日期选择器 dateModelPop: false, // 日期选择器
hasPermission: undefined, //录音 授权状态 hasPermission: undefined, //录音 授权状态
audioPath: AudioUtils.DocumentDirectoryPath + `/self_audio_${new Date().getTime()}.aac`, // 文件路径 audioPath: AudioUtils.DocumentDirectoryPath + `/self_audio_${new Date().getTime()}.aac`, // 文件路径
recording: false, //是否录音 recording: false, //是否录音
pause: false, //录音是否暂停
stop: false, //录音是否停止 stop: false, //录音是否停止
currentTime: 0, //录音时长 currentTime: 0, //录音时长
localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生 localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生
local_tip: {
replace_item_flag: 'N', // 器械包
take_cert_flag: 'N' // 合格证
}
} }
} }
componentDidMount() { componentDidMount() {
this.getSellerName() this.getSellerName()
this.getAudioAuthorize() this.getAudioAuthorize()
// this.subscription = DeviceEventEmitter.addListener(EmitterEvents.BACK_TO_SELF_PAGE, (params) => this.productCallBack(params))
} }
componentWillUnmount() { componentWillUnmount() {
this.props.setSelectProductOpts([]) this.props.setSelectProductOpts([])
// this.subscription.remove()
} }
// 赋值销售员 初始化数据 // 赋值销售员 初始化数据
...@@ -195,7 +180,6 @@ class SelfOrderPage extends Component { ...@@ -195,7 +180,6 @@ class SelfOrderPage extends Component {
.then(isAuthor => { .then(isAuthor => {
console.log('是否授权: ' + isAuthor) console.log('是否授权: ' + isAuthor)
if (!isAuthor) { if (!isAuthor) {
// return alert('APP需要使用录音,请打开录音权限允许APP使用')
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{ return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
text: '设置', text: '设置',
onPress: () => { onPress: () => {
...@@ -252,27 +236,6 @@ class SelfOrderPage extends Component { ...@@ -252,27 +236,6 @@ class SelfOrderPage extends Component {
// 开始录音 // 开始录音
_record = async () => { _record = async () => {
console.log('开始录音==')
// show('录音开始')
// if(!this.state.hasPermission) {
// return alert('没有授权')
// }
// if(this.state.recording) {
// return alert('正在录音中...')
// }
// if(this.state.stop) {
// // 初始化录音
// this.prepareRecordingPath(this.state.audioPath)
// }
// this.setState({recording: true,pause: false})
// try {
// await AudioRecorder.startRecording()
// } catch (err) {
// console.log(err)
// }
if (!this.state.hasPermission) { if (!this.state.hasPermission) {
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{ return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
text: '设置', text: '设置',
...@@ -289,7 +252,6 @@ class SelfOrderPage extends Component { ...@@ -289,7 +252,6 @@ class SelfOrderPage extends Component {
}, { }, {
text: '取消', text: '取消',
}]) }])
// return
} }
show('录音开始') show('录音开始')
if (this.state.stop) { if (this.state.stop) {
...@@ -305,10 +267,8 @@ class SelfOrderPage extends Component { ...@@ -305,10 +267,8 @@ class SelfOrderPage extends Component {
// 停止录音 // 停止录音
_stop = async () => { _stop = async () => {
console.log('----停止录音---', this.state.hasPermission)
if (!this.state.hasPermission) { if (!this.state.hasPermission) {
return return
// return alert('没有授权')
} }
show('录音结束') show('录音结束')
try { try {
...@@ -317,15 +277,6 @@ class SelfOrderPage extends Component { ...@@ -317,15 +277,6 @@ class SelfOrderPage extends Component {
} catch (error) { } catch (error) {
console.log('stop record--error->', error); console.log('stop record--error->', error);
} }
// console.log('tanqi')
// show('录音结束')
// console.log('停止录音',this.state.currentTime)
// try {
// await AudioRecorder.stopRecording();
// this.setState({stop: true, recording: false, paused: false});
// } catch (error) {
// console.error(error);
// }
} }
// 播放录音 // 播放录音
...@@ -346,21 +297,6 @@ class SelfOrderPage extends Component { ...@@ -346,21 +297,6 @@ class SelfOrderPage extends Component {
} }
}) })
}) })
// let self = this
// self.whoosh = new Sound(this.state.audioPath, '', (err) => {
// if(err) {
// show('加载音频失败')
// return console.log(err)
// }
// self.whoosh.play(success => {
// if(success) {
// console.log('success - 播放成功')
// }else {
// console.log('fail - 播放失败')
// show('播放失败')
// }
// })
// })
} }
// 删除录音 // 删除录音
...@@ -377,7 +313,7 @@ class SelfOrderPage extends Component { ...@@ -377,7 +313,7 @@ class SelfOrderPage extends Component {
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
let { self_list_status, loginState, navigation, submit_self_order_status, local_sele_pro_options } = this.props let { self_list_status, loginState, navigation, submit_self_order_status } = this.props
let that = this let that = this
if (self_list_status != nextProps.self_list_status) { if (self_list_status != nextProps.self_list_status) {
switch (nextProps.self_list_status) { switch (nextProps.self_list_status) {
...@@ -418,10 +354,8 @@ class SelfOrderPage extends Component { ...@@ -418,10 +354,8 @@ class SelfOrderPage extends Component {
isSubLoding: false, isSubLoding: false,
lodingTitle: '提交中' lodingTitle: '提交中'
}, () => { }, () => {
console.log('SELF_SUBMIT_SUCCESS===', that.state.isSubLoding)
that.processReturnData() that.processReturnData()
}) })
// that.processReturnData()
break; break;
case SELF_SUBMIT_FAILURE: case SELF_SUBMIT_FAILURE:
that.changeSubLoding(false, '提交中') that.changeSubLoding(false, '提交中')
...@@ -430,12 +364,6 @@ class SelfOrderPage extends Component { ...@@ -430,12 +364,6 @@ class SelfOrderPage extends Component {
break; break;
} }
} }
// console.log('哈哈哈哈😄=====', nextProps.local_sele_pro_options)
// console.log('哈哈哈哈😄=====', local_sele_pro_options)
// if(nextProps.local_sele_pro_options){
// that.productCallBack(nextProps.local_sele_pro_options)
// }
} }
// 修改正在加载 // 修改正在加载
...@@ -484,7 +412,6 @@ class SelfOrderPage extends Component { ...@@ -484,7 +412,6 @@ class SelfOrderPage extends Component {
&& !listOptionData[chIndex].value && !listOptionData[chIndex].value
&& listOptionData[chIndex].name !== '其他') { && listOptionData[chIndex].name !== '其他') {
// 不是主治医生 // 不是主治医生
console.log('tempTit--', tempTit)
tempTit = listOptionData[chIndex].title tempTit = listOptionData[chIndex].title
tempStatus = true tempStatus = true
break break
...@@ -500,7 +427,6 @@ class SelfOrderPage extends Component { ...@@ -500,7 +427,6 @@ class SelfOrderPage extends Component {
// 选择器弹窗回调函数 // 选择器弹窗回调函数
handleCallBack(item, itemTitle) { handleCallBack(item, itemTitle) {
// console.log('选择器弹窗回调函数-----',itemTitle)
let { listOptionData } = this.state let { listOptionData } = this.state
let self = this let self = this
listOptionData.map(function (chItem, index) { listOptionData.map(function (chItem, index) {
...@@ -839,7 +765,6 @@ class SelfOrderPage extends Component { ...@@ -839,7 +765,6 @@ class SelfOrderPage extends Component {
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
}) })
console.log('主治医生---', text, curData, listOptionData[5])
} }
// 手术名称 输入 // 手术名称 输入
...@@ -853,12 +778,10 @@ class SelfOrderPage extends Component { ...@@ -853,12 +778,10 @@ class SelfOrderPage extends Component {
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
}) })
console.log('手术名称---', text, curData, listOptionData[6])
} }
// 手术时间 点击 2020-04-23 17:41 // 手术时间 点击 2020-04-23 17:41
handleSurDateCheck(curData) { handleSurDateCheck(curData) {
console.log('手术时间 点击 ===', curData)
let { listOptionData } = this.state let { listOptionData } = this.state
let date = curData.value let date = curData.value
if (date) { if (date) {
...@@ -883,7 +806,6 @@ class SelfOrderPage extends Component { ...@@ -883,7 +806,6 @@ class SelfOrderPage extends Component {
// 修改当前日期数据 // 修改当前日期数据
dateModalCallback(date, curData) { dateModalCallback(date, curData) {
console.log('修改当前日期数据:', date, curData)
let { listOptionData } = this.state let { listOptionData } = this.state
listOptionData.map(function (item) { listOptionData.map(function (item) {
if (item.title === curData.title) { if (item.title === curData.title) {
...@@ -895,7 +817,6 @@ class SelfOrderPage extends Component { ...@@ -895,7 +817,6 @@ class SelfOrderPage extends Component {
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
}) })
console.log('修改当前日期数据-----', listOptionData[7])
} }
// 手术类型 点击 // 手术类型 点击
...@@ -921,7 +842,7 @@ class SelfOrderPage extends Component { ...@@ -921,7 +842,7 @@ class SelfOrderPage extends Component {
// 订单类型 点击 // 订单类型 点击
handleOrderCheck(curData) { handleOrderCheck(curData) {
let { state, props } = this let { props } = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({ this.setState({
currentTitle: curData.title, currentTitle: curData.title,
...@@ -930,7 +851,6 @@ class SelfOrderPage extends Component { ...@@ -930,7 +851,6 @@ class SelfOrderPage extends Component {
value: curData.value value: curData.value
} }
}, () => { }, () => {
// 在此修改接口
let params = { let params = {
access_token: props.token, access_token: props.token,
value_set_code: 'SUR_ORDER_TYPE' value_set_code: 'SUR_ORDER_TYPE'
...@@ -958,14 +878,11 @@ class SelfOrderPage extends Component { ...@@ -958,14 +878,11 @@ class SelfOrderPage extends Component {
// 选择产品 回调 // 选择产品 回调
productCallBack(params) { productCallBack(params) {
let { listOptionData } = this.state let { listOptionData } = this.state
console.log('哈哈哈哈😄=====')
console.log('选择产品返回=!!!!=', params)
listOptionData[10].name = '请选择' listOptionData[10].name = '请选择'
listOptionData[10].value = '' listOptionData[10].value = ''
listOptionData[10].lines = [] listOptionData[10].lines = []
// let cur_params = params.local_lines
let cur_params = params let cur_params = params
if (params && cur_params) { if (cur_params && cur_params.length > 0) {
cur_params.forEach(loc_item => { cur_params.forEach(loc_item => {
if (loc_item[LocalVariable.SELECTED_QUQNTITY] > 0) { if (loc_item[LocalVariable.SELECTED_QUQNTITY] > 0) {
listOptionData[10].value += `【${loc_item.supplier_short_name}】` listOptionData[10].value += `【${loc_item.supplier_short_name}】`
...@@ -976,8 +893,6 @@ class SelfOrderPage extends Component { ...@@ -976,8 +893,6 @@ class SelfOrderPage extends Component {
listOptionData[10].lines = cloneObject(cur_params) listOptionData[10].lines = cloneObject(cur_params)
} }
} }
console.log('选择产品返回=!!!=', listOptionData[10])
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
}, () => { }, () => {
...@@ -996,12 +911,10 @@ class SelfOrderPage extends Component { ...@@ -996,12 +911,10 @@ class SelfOrderPage extends Component {
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
}) })
console.log('备注---', listOptionData[11])
} }
// 生成订单 点击 // 生成订单 点击
async handleSubmit() { async handleSubmit() {
console.log('生成订单')
this.changeCanSub(true) this.changeCanSub(true)
let { state, props } = this let { state, props } = this
let that = this let that = this
...@@ -1074,41 +987,30 @@ class SelfOrderPage extends Component { ...@@ -1074,41 +987,30 @@ class SelfOrderPage extends Component {
access_token: props.token, access_token: props.token,
data: { ...tempSubOption } data: { ...tempSubOption }
} }
console.log('submitSelfOrder!!!!', params) console.log('params=', params)
props.requestSelfSumbit(params)
// this.processReturnData() // 测试
props.requestSelfSumbit(params) // 正式
} }
// 获取选择产品提交接口需要的数据 // 处理选择产品数据为提交接口需要的格式
getSumLinesOps() { getSumLinesOps() {
let { listOptionData } = this.state let { listOptionData } = this.state
// 修改提交的行数据 // 修改提交的行数据
let local_lines = cloneObject(listOptionData[10].lines) let local_lines = cloneObject(listOptionData[10].lines)
let res_lines = [] let res_lines = []
console.log('提交==', local_lines)
let showPackageTip = false let showPackageTip = false
local_lines.forEach(sup_item => { local_lines.forEach(sup_item => {
if (sup_item[LocalVariable.SELECTED_QUQNTITY] > 0 && sup_item.leftOptionList && sup_item.leftOptionList.length > 0) { if (sup_item[LocalVariable.SELECTED_QUQNTITY] > 0 && sup_item.leftOptionList && sup_item.leftOptionList.length > 0) {
sup_item.leftOptionList.map(lef_item => { sup_item.leftOptionList.map(lef_item => {
let select_arr = lef_item[LocalVariable.SELECTED_DATA_ARR] let select_arr = lef_item[LocalVariable.SELECTED_DATA_ARR]
if (lef_item[LocalVariable.SELECTED_QUQNTITY] > 0 && select_arr && select_arr.length > 0) { if (lef_item[LocalVariable.SELECTED_QUQNTITY] > 0 && select_arr && select_arr.length > 0) {
// console.log('lef_item.category_code--', lef_item.category_code)
if (lef_item.category_code === LocalVariable.SURGICAL_TEMPLATE) { if (lef_item.category_code === LocalVariable.SURGICAL_TEMPLATE) {
// 手术模板 // 手术模板
select_arr.forEach(sel_item => { select_arr.forEach(sel_item => {
let template_number = sel_item.template_number let template_number = sel_item.template_number
// sel_item.childrenLineData[0].lineOptions[0][LocalVariable.SELECTED_DATA_ARR]
if (sel_item[LocalVariable.CHILDREN_LINE_NAME] && sel_item[LocalVariable.CHILDREN_LINE_NAME].length > 0) { if (sel_item[LocalVariable.CHILDREN_LINE_NAME] && sel_item[LocalVariable.CHILDREN_LINE_NAME].length > 0) {
sel_item[LocalVariable.CHILDREN_LINE_NAME].forEach(chi_item => { sel_item[LocalVariable.CHILDREN_LINE_NAME].forEach(chi_item => {
if (chi_item[LocalVariable.LINE_OPTIONS] && chi_item[LocalVariable.LINE_OPTIONS].length > 0) { if (chi_item[LocalVariable.LINE_OPTIONS] && chi_item[LocalVariable.LINE_OPTIONS].length > 0) {
chi_item[LocalVariable.LINE_OPTIONS].forEach(lin_item => { chi_item[LocalVariable.LINE_OPTIONS].forEach(lin_item => {
if (lin_item[LocalVariable.SELECTED_DATA_ARR] && lin_item[LocalVariable.SELECTED_DATA_ARR].length > 0) { if (lin_item[LocalVariable.SELECTED_DATA_ARR] && lin_item[LocalVariable.SELECTED_DATA_ARR].length > 0) {
lin_item[LocalVariable.SELECTED_DATA_ARR].forEach(sel_item => { lin_item[LocalVariable.SELECTED_DATA_ARR].forEach(sel_item => {
sel_item['template_number'] = template_number sel_item['template_number'] = template_number
...@@ -1120,10 +1022,7 @@ class SelfOrderPage extends Component { ...@@ -1120,10 +1022,7 @@ class SelfOrderPage extends Component {
} }
}) })
} }
}) })
} else if (lef_item.category_code === LocalVariable.NAIL_BOX || lef_item.category_code === LocalVariable.EQUIPMENT_BAG) { } else if (lef_item.category_code === LocalVariable.NAIL_BOX || lef_item.category_code === LocalVariable.EQUIPMENT_BAG) {
// 钉盒/器械包 // 钉盒/器械包
if (lef_item.category_code === LocalVariable.EQUIPMENT_BAG) { if (lef_item.category_code === LocalVariable.EQUIPMENT_BAG) {
...@@ -1134,7 +1033,6 @@ class SelfOrderPage extends Component { ...@@ -1134,7 +1033,6 @@ class SelfOrderPage extends Component {
sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD] sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item) res_lines.push(sel_item)
}) })
} }
else if (lef_item.category_code === LocalVariable.SCATTERED_EQUIPMENT) { else if (lef_item.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
// 零散器械 // 零散器械
...@@ -1167,18 +1065,7 @@ class SelfOrderPage extends Component { ...@@ -1167,18 +1065,7 @@ class SelfOrderPage extends Component {
}) })
} }
}) })
console.log('提交==', res_lines)
let test_sum_num = 0
res_lines.map(line => {
test_sum_num += line[LocalVariable.PLAN_QUANTITY]
})
console.log('提交==', test_sum_num)
console.log('提交==', showPackageTip)
console.log('提交==', listOptionData[10].lines)
listOptionData[10].sub_lines = res_lines listOptionData[10].sub_lines = res_lines
if (showPackageTip) { if (showPackageTip) {
this.refs.PackageModel.show() this.refs.PackageModel.show()
} else { } else {
...@@ -1186,8 +1073,6 @@ class SelfOrderPage extends Component { ...@@ -1186,8 +1073,6 @@ class SelfOrderPage extends Component {
} }
} }
// 判断组织是否为空 // 判断组织是否为空
judgeOrgIsNull() { judgeOrgIsNull() {
let { listOptionData } = this.state let { listOptionData } = this.state
...@@ -1214,7 +1099,6 @@ class SelfOrderPage extends Component { ...@@ -1214,7 +1099,6 @@ class SelfOrderPage extends Component {
processReturnData() { processReturnData() {
let { selfOrderOption } = this.props let { selfOrderOption } = this.props
let that = this let that = this
console.log('selfOrderOption----!!!!', selfOrderOption)
that.setState({ that.setState({
isSubLoding: false isSubLoding: false
}) })
...@@ -1224,7 +1108,6 @@ class SelfOrderPage extends Component { ...@@ -1224,7 +1108,6 @@ class SelfOrderPage extends Component {
let { state: { params: { title } } } = that.props.navigation let { state: { params: { title } } } = that.props.navigation
that.props.navigation.navigate('SubSuccPage', { that.props.navigation.navigate('SubSuccPage', {
title: `${title} - 提交成功`, title: `${title} - 提交成功`,
// orderNumber: 'TS_11001100100110' // 测试
orderNumber: selfOrderOption.order_number orderNumber: selfOrderOption.order_number
}) })
} }
...@@ -1233,29 +1116,25 @@ class SelfOrderPage extends Component { ...@@ -1233,29 +1116,25 @@ class SelfOrderPage extends Component {
clearAllData() { clearAllData() {
let { props } = this let { props } = this
let { listOptionData, subInitListOption } = this.state let { listOptionData, subInitListOption } = this.state
props.setSelfInitData() // 清空缓存数据 props.setSelfInitData()
listOptionData = cloneObject(subInitListOption) // 清空本地数据 listOptionData = cloneObject(subInitListOption)
this.setState({ this.setState({
listOptionData, listOptionData,
currentTime: 0, // 清除语音 currentTime: 0,
stop: false stop: false
}) })
} }
// 提交的提示回调函数 // 提交的提示回调函数
modelPackageCertCB(typeName, nowVal) { modelPackageCertCB(typeName, nowVal) {
let { local_tip, listOptionData } = this.state let { listOptionData } = this.state
listOptionData[10][typeName] = nowVal listOptionData[10][typeName] = nowVal
// local_tip[typeName] = nowVal
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
// local_tip: local_tip
}) })
console.log('modelPackageCertCB---', listOptionData[10])
if (typeName === 'replace_item_flag') { if (typeName === 'replace_item_flag') {
this.refs.CertModel.show('需要携带注册证?') this.refs.CertModel.show('需要携带注册证?')
} else { } else {
console.log('请求提交====')
this.submitSelfOrder() this.submitSelfOrder()
} }
} }
...@@ -1375,11 +1254,9 @@ class SelfOrderPage extends Component { ...@@ -1375,11 +1254,9 @@ class SelfOrderPage extends Component {
show={dateModelPop} show={dateModelPop}
callback={(date) => this.dateModalCallback(date, listOptionData[7])} callback={(date) => this.dateModalCallback(date, listOptionData[7])}
/> />
{ this.renderPickerModel()} { this.renderPickerModel()}
{ this.renderTipModelPackage()} { this.renderTipModelPackage()}
{ this.renderTipModelCert()} { this.renderTipModelCert()}
</View> </View>
) )
} }
...@@ -1493,13 +1370,6 @@ class SelfOrderPage extends Component { ...@@ -1493,13 +1370,6 @@ class SelfOrderPage extends Component {
) )
} }
// 返回正在加载中 -- 新
renderLodingItemNew() {
return (
<LoadingModel ref="LoadingModel" />
)
}
// 返回提交器械包提示 // 返回提交器械包提示
renderTipModelPackage() { renderTipModelPackage() {
return ( return (
...@@ -1546,8 +1416,6 @@ class SelfOrderPage extends Component { ...@@ -1546,8 +1416,6 @@ class SelfOrderPage extends Component {
{this.renderLodingItem()} {this.renderLodingItem()}
{this.renderLodingItemNew()}
</SafeAreaView> </SafeAreaView>
</View> </View>
); );
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput, DeviceEventEmitter, SafeAreaView } from 'react-native'; import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput, SafeAreaView } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { foundation_color, home_background_color, Width, third_text_size, pxSize, promary_color, safe_view, font_family_regular, icon_style, title_text_color, font_family_medium, list_common_item, point_color } from '../../../base/BaseStyle'; import { foundation_color, home_background_color, Width, third_text_size, pxSize, promary_color, safe_view, font_family_regular, icon_style, title_text_color, font_family_medium, list_common_item, point_color } from '../../../base/BaseStyle';
import HeadBackItem from '../../common/HeadBackItem'; import HeadBackItem from '../../common/HeadBackItem';
...@@ -9,18 +9,9 @@ import StatusBarView from '../../common/StatusBarView'; ...@@ -9,18 +9,9 @@ import StatusBarView from '../../common/StatusBarView';
import ChooseCardList from '../../common/listDataComponent/ChooseCardList'; import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import { cloneObject, show } from '../../../utils/Utils'; import { cloneObject, show } 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 EmitterEvents from '../../common/EmitterEvents';
import LoadingModel from '../../common/listDataComponent/LoadingModel'; import LoadingModel from '../../common/listDataComponent/LoadingModel';
import LocalVariable from '../../common/LocalVariable'; import LocalVariable from '../../common/LocalVariable';
// const QUANTITY_FIELD = 'quantity' // 计算的字段
// const CHILDREN_LINE_NAME = 'childrenLineData' // 显示的子类数组名称
// const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
// const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
// const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
// const ONLY_TWO_LEVELS = 'onlyTwoLevels' // 只有两级的耗材
class ChooseProductPage extends Component { class ChooseProductPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -29,24 +20,22 @@ class ChooseProductPage extends Component { ...@@ -29,24 +20,22 @@ class ChooseProductPage extends Component {
topActiveIndex: 0, topActiveIndex: 0,
topProcOptionList: [], // 顶部厂家信息 topProcOptionList: [], // 顶部厂家信息
leftActiveIndex: 0, leftActiveIndex: 0,
rightSecondData: [], defaultThridShow: false, // 默认耗材-小类不显示
leftOptionList: [], // 左侧分类数据
defaultThridShow: false, // 默认人体髋关节-小类不显示
selectShowPopup: false, // 共计已选弹窗 selectShowPopup: false, // 共计已选弹窗
defalutLeftItem: [{ defalutLeftItem: [{
"category_code": "surg_temp", "category_code": LocalVariable.SURGICAL_TEMPLATE,
"category_name": "手术模板", "category_name": "手术模板",
"cate_local_icon": require('../../../images/surg_temp.png') "cate_local_icon": require('../../../images/surg_temp.png')
}, { }, {
"category_code": "screw_box", "category_code": LocalVariable.NAIL_BOX,
"category_name": "钉盒", "category_name": "钉盒",
"cate_local_icon": require('../../../images/screw_box.png') "cate_local_icon": require('../../../images/screw_box.png')
}, { }, {
"category_code": "equip_bag", "category_code": LocalVariable.EQUIPMENT_BAG,
"category_name": "器械包", "category_name": "器械包",
"cate_local_icon": require('../../../images/equip_bag.png') "cate_local_icon": require('../../../images/equip_bag.png')
}, { }, {
"category_code": "auxili_tool", "category_code": LocalVariable.SCATTERED_EQUIPMENT,
"category_name": "零散器械", "category_name": "零散器械",
"cate_local_icon": require('../../../images/auxili_tool.png') "cate_local_icon": require('../../../images/auxili_tool.png')
}] }]
...@@ -62,8 +51,6 @@ class ChooseProductPage extends Component { ...@@ -62,8 +51,6 @@ class ChooseProductPage extends Component {
let { topProcOptionList } = this.state let { topProcOptionList } = this.state
let { setSelectProductOpts } = this.props let { setSelectProductOpts } = this.props
setSelectProductOpts(topProcOptionList) setSelectProductOpts(topProcOptionList)
// 并且=======调用返回
// DeviceEventEmitter.emit(EmitterEvents.BACK_TO_SELF_PAGE, { local_lines: topProcOptionList })
this.props.navigation.state.params.productCallBack(topProcOptionList) this.props.navigation.state.params.productCallBack(topProcOptionList)
this.props.navigation.goBack() this.props.navigation.goBack()
} }
...@@ -72,11 +59,6 @@ class ChooseProductPage extends Component { ...@@ -72,11 +59,6 @@ class ChooseProductPage extends Component {
async initGetData() { async initGetData() {
let that = this let that = this
let { token, global_domain_config, navigation, local_sele_pro_options } = that.props let { token, global_domain_config, navigation, local_sele_pro_options } = that.props
// 判断 local_sele_pro_options 是否有值
// 进行本地转换
console.log('local_sele_pro_options====有值吗====>', local_sele_pro_options)
if (local_sele_pro_options && local_sele_pro_options.length > 0) { if (local_sele_pro_options && local_sele_pro_options.length > 0) {
// 之前选择过值 // 之前选择过值
that.setState({ that.setState({
...@@ -84,9 +66,6 @@ class ChooseProductPage extends Component { ...@@ -84,9 +66,6 @@ class ChooseProductPage extends Component {
}) })
return return
} }
console.log('local_sele_pro_options====有值吗====>')
that.refs.LoadingModel.show() that.refs.LoadingModel.show()
let cur_org_code = '' let cur_org_code = ''
if (navigation.state.params.selfData) { if (navigation.state.params.selfData) {
...@@ -97,25 +76,31 @@ class ChooseProductPage extends Component { ...@@ -97,25 +76,31 @@ class ChooseProductPage extends Component {
org_code: cur_org_code, org_code: cur_org_code,
supplier_type: 'MANUFACTURER' // 供应商 supplier_type: 'MANUFACTURER' // 供应商
} }
console.log('params=', params)
let pur_sup_search = await reqPurSupplierSearch(global_domain_config, params) let pur_sup_search = await reqPurSupplierSearch(global_domain_config, params)
console.log('res_1 : ', pur_sup_search) console.log('res_1 : ', pur_sup_search)
if (pur_sup_search.error_code === 0) { if (pur_sup_search.error_code === 0) {
let { data } = pur_sup_search let { data } = pur_sup_search
let { topProcOptionList } = that.state let { topProcOptionList } = that.state
topProcOptionList = cloneObject(data) if (data.length > 0) {
topProcOptionList.forEach(function (topObj) { topProcOptionList = cloneObject(data)
topObj[LocalVariable.SELECTED_QUQNTITY] = 0 topProcOptionList.forEach(function (topObj) {
topObj['leftOptionList'] = [] topObj[LocalVariable.SELECTED_QUQNTITY] = 0
if (!topObj['supplier_short_name']) { topObj['leftOptionList'] = []
topObj.supplier_short_name = topObj.supplier_name.substring(0, 3) if (!topObj['supplier_short_name']) {
} topObj.supplier_short_name = topObj.supplier_name.substring(0, 3)
}) }
that.setState({ })
topProcOptionList that.setState({
}, () => { topProcOptionList
that.refs.LoadingModel.hide() }, () => {
that.handleTopNav(topProcOptionList[0], 0) that.refs.LoadingModel.hide()
}) that.handleTopNav(topProcOptionList[0], 0)
})
} else {
this.refs.LoadingModel.hide()
show('厂家数据为空,请联系管理员配置!')
}
} else { } else {
that.showRrrorTip(pur_sup_search) that.showRrrorTip(pur_sup_search)
} }
...@@ -123,7 +108,6 @@ class ChooseProductPage extends Component { ...@@ -123,7 +108,6 @@ class ChooseProductPage extends Component {
// 顶部产品点击,获取左侧数据 // 顶部产品点击,获取左侧数据
async handleTopNav(topItem, topIndex) { async handleTopNav(topItem, topIndex) {
console.log('top产品--', topItem, topIndex)
let that = this let that = this
let { token, global_domain_config } = that.props let { token, global_domain_config } = that.props
let { topProcOptionList, defalutLeftItem } = this.state let { topProcOptionList, defalutLeftItem } = this.state
...@@ -132,11 +116,10 @@ class ChooseProductPage extends Component { ...@@ -132,11 +116,10 @@ class ChooseProductPage extends Component {
access_token: token, access_token: token,
manufacturer_code: topItem.supplier_code, manufacturer_code: topItem.supplier_code,
} }
console.log('params====', params) console.log('params=', params)
let pro_scate_search = await reqProCategorySearch(global_domain_config, params) let pro_scate_search = await reqProCategorySearch(global_domain_config, params)
console.log('res_2 : ', pro_scate_search) console.log('res_2 : ', pro_scate_search)
if (pro_scate_search.error_code === 0) { if (pro_scate_search.error_code === 0) {
if (topItem[LocalVariable.SELECTED_QUQNTITY] === 0) { if (topItem[LocalVariable.SELECTED_QUQNTITY] === 0) {
let { data } = pro_scate_search let { data } = pro_scate_search
topItem.leftOptionList = defalutLeftItem.concat(data.item) topItem.leftOptionList = defalutLeftItem.concat(data.item)
...@@ -146,7 +129,6 @@ class ChooseProductPage extends Component { ...@@ -146,7 +129,6 @@ class ChooseProductPage extends Component {
}) })
topProcOptionList[topIndex] = topItem topProcOptionList[topIndex] = topItem
} }
that.setState({ that.setState({
topActiveIndex: topIndex, topActiveIndex: topIndex,
topProcOptionList: topProcOptionList topProcOptionList: topProcOptionList
...@@ -154,23 +136,9 @@ class ChooseProductPage extends Component { ...@@ -154,23 +136,9 @@ class ChooseProductPage extends Component {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
that.handleLeftNav(topItem['leftOptionList'][0], 0) that.handleLeftNav(topItem['leftOptionList'][0], 0)
}) })
} else { } else {
topItem.leftOptionList = defalutLeftItem
topProcOptionList[topIndex] = topItem
that.setState({
topActiveIndex: topIndex,
topProcOptionList: topProcOptionList
}, () => {
that.handleLeftNav(topItem['leftOptionList'][0], 0)
})
that.showRrrorTip(pro_scate_search) that.showRrrorTip(pro_scate_search)
} }
// this.setState({
// topActiveIndex: topIndex,
// // leftOptionList: cloneObject(localMockData.localLeftOption)
// })
} }
// 左侧标题点击 // 左侧标题点击
...@@ -178,7 +146,6 @@ class ChooseProductPage extends Component { ...@@ -178,7 +146,6 @@ class ChooseProductPage extends Component {
let that = this let that = this
let { topProcOptionList, topActiveIndex } = that.state let { topProcOptionList, topActiveIndex } = that.state
let { token, global_domain_config, navigation } = that.props let { token, global_domain_config, navigation } = that.props
console.log('左侧标题--', topActiveIndex, leftItem, leftIndex)
if (leftItem[LocalVariable.SELECTED_QUQNTITY] !== 0) { if (leftItem[LocalVariable.SELECTED_QUQNTITY] !== 0) {
that.setState({ that.setState({
leftActiveIndex: leftIndex leftActiveIndex: leftIndex
...@@ -197,7 +164,7 @@ class ChooseProductPage extends Component { ...@@ -197,7 +164,7 @@ class ChooseProductPage extends Component {
org_code: cur_org_code, org_code: cur_org_code,
manufacturer_code: topItem.supplier_code, manufacturer_code: topItem.supplier_code,
} }
console.log('params-', params) console.log('params=', params)
let sur_head_search = await reqSurTempHeadSearch(global_domain_config, params) let sur_head_search = await reqSurTempHeadSearch(global_domain_config, params)
console.log('res_3 : ', sur_head_search) console.log('res_3 : ', sur_head_search)
if (sur_head_search.error_code === 0) { if (sur_head_search.error_code === 0) {
...@@ -247,6 +214,7 @@ class ChooseProductPage extends Component { ...@@ -247,6 +214,7 @@ class ChooseProductPage extends Component {
let params = { let params = {
access_token: token access_token: token
} }
console.log('params=', params)
let scat_head_search = await reqScatEquipmentSearch(global_domain_config, params) let scat_head_search = await reqScatEquipmentSearch(global_domain_config, params)
console.log('res_3 : ', scat_head_search) console.log('res_3 : ', scat_head_search)
if (scat_head_search.error_code === 0) { if (scat_head_search.error_code === 0) {
...@@ -269,14 +237,13 @@ class ChooseProductPage extends Component { ...@@ -269,14 +237,13 @@ class ChooseProductPage extends Component {
access_token: token, access_token: token,
category_code: leftItem.category_code, category_code: leftItem.category_code,
manufacturer_code: topItem.supplier_code, manufacturer_code: topItem.supplier_code,
org_code: cur_org_code, org_code: cur_org_code
leftIndex: leftIndex, // 本地测试
} }
console.log('params=', params)
let single_all_search = await reqSingleConsumSearch(global_domain_config, params) let single_all_search = await reqSingleConsumSearch(global_domain_config, params)
console.log('res_3 : ', single_all_search, leftIndex, leftIndex % 2) console.log('res_3 : ', single_all_search, leftIndex, leftIndex % 2)
if (single_all_search.error_code === 0) { if (single_all_search.error_code === 0) {
let { data } = single_all_search let { data } = single_all_search
console.log('data : ', data, data.items)
if (data && data.items) { if (data && data.items) {
//大-中-小类 //大-中-小类
data.items = data.items.filter(fi_item => fi_item.details && fi_item.details.length > 0) data.items = data.items.filter(fi_item => fi_item.details && fi_item.details.length > 0)
...@@ -290,13 +257,6 @@ class ChooseProductPage extends Component { ...@@ -290,13 +257,6 @@ class ChooseProductPage extends Component {
}) })
} }
}) })
// topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem)
// that.setState({
// leftActiveIndex: leftIndex,
// topProcOptionList: topProcOptionList
// }, () => {
// that.refs.LoadingModel.hide()
// })
} else if (data && data.details) { } else if (data && data.details) {
//大-小类 //大-小类
leftItem[LocalVariable.LOCAL_SECOND_DATA] = cloneObject(data.details) leftItem[LocalVariable.LOCAL_SECOND_DATA] = cloneObject(data.details)
...@@ -304,23 +264,9 @@ class ChooseProductPage extends Component { ...@@ -304,23 +264,9 @@ class ChooseProductPage extends Component {
righDa[LocalVariable.ONLY_TWO_LEVELS] = true righDa[LocalVariable.ONLY_TWO_LEVELS] = true
righDa[LocalVariable.QUANTITY_FIELD] = 0 // 默认 righDa[LocalVariable.QUANTITY_FIELD] = 0 // 默认
}) })
// topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem)
// that.setState({
// leftActiveIndex: leftIndex,
// topProcOptionList: topProcOptionList
// }, () => {
// that.refs.LoadingModel.hide()
// })
} else { } else {
// 空数据 // 空数据
leftItem.localSecondData = [] leftItem.localSecondData = []
// topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem)
// that.setState({
// leftActiveIndex: leftIndex,
// topProcOptionList: topProcOptionList
// }, () => {
// that.refs.LoadingModel.hide()
// })
} }
topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem) topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem)
that.setState({ that.setState({
...@@ -347,7 +293,7 @@ class ChooseProductPage extends Component { ...@@ -347,7 +293,7 @@ class ChooseProductPage extends Component {
return cloneObject(leftItem) return cloneObject(leftItem)
} }
// 修改 // 修改小类回调
handleChangeThrShow(show) { handleChangeThrShow(show) {
this.setState({ this.setState({
defaultThridShow: show defaultThridShow: show
...@@ -356,14 +302,11 @@ class ChooseProductPage extends Component { ...@@ -356,14 +302,11 @@ class ChooseProductPage extends Component {
// 计算中级数量回调 // 计算中级数量回调
handleChangeCount(count, coutFieName) { handleChangeCount(count, coutFieName) {
let { leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex, defaultThridShow } = this.state let { leftActiveIndex, topProcOptionList, topActiveIndex } = this.state
console.log('计算中级数量回调===', count, leftActiveIndex, defaultThridShow, coutFieName)
// 初始化 // 初始化
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0 topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0
topProcOptionList[topActiveIndex].leftOptionList[leftActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0 topProcOptionList[topActiveIndex].leftOptionList[leftActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0
topProcOptionList[topActiveIndex].leftOptionList[leftActiveIndex][LocalVariable.SELECTED_DATA_ARR] = [] topProcOptionList[topActiveIndex].leftOptionList[leftActiveIndex][LocalVariable.SELECTED_DATA_ARR] = []
let top_sel_sum = 0 let top_sel_sum = 0
topProcOptionList[topActiveIndex].leftOptionList.map(function (leItem, leIndex) { topProcOptionList[topActiveIndex].leftOptionList.map(function (leItem, leIndex) {
if (!leItem[LocalVariable.SELECTED_QUQNTITY]) { if (!leItem[LocalVariable.SELECTED_QUQNTITY]) {
...@@ -387,17 +330,13 @@ class ChooseProductPage extends Component { ...@@ -387,17 +330,13 @@ class ChooseProductPage extends Component {
top_sel_sum += leItem[LocalVariable.SELECTED_QUQNTITY] top_sel_sum += leItem[LocalVariable.SELECTED_QUQNTITY]
}) })
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = top_sel_sum topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = top_sel_sum
// console.log('计算中级之后---', leftOptionList)
console.log('计算中级之后---', topProcOptionList)
this.setState({ this.setState({
// leftOptionList,
topProcOptionList topProcOptionList
}) })
} }
// 共计已选弹窗 // 关闭已选弹窗
handleCloseSelectModal(show) { handleCloseSelectModal(show) {
console.log('修改共计已选', show)
this.setState({ this.setState({
selectShowPopup: show selectShowPopup: show
}) })
...@@ -405,7 +344,7 @@ class ChooseProductPage extends Component { ...@@ -405,7 +344,7 @@ class ChooseProductPage extends Component {
// 计算所有已选数量 // 计算所有已选数量
getAllCountQuantity(tipFlag) { getAllCountQuantity(tipFlag) {
let { topProcOptionList, topActiveIndex } = this.state let { topProcOptionList } = this.state
let allCountQuantity = 0 let allCountQuantity = 0
let allTip = '' let allTip = ''
if (!topProcOptionList.length) { if (!topProcOptionList.length) {
...@@ -424,14 +363,8 @@ class ChooseProductPage extends Component { ...@@ -424,14 +363,8 @@ class ChooseProductPage extends Component {
allTip += `${top_item.supplier_short_name}x${top_item[LocalVariable.SELECTED_QUQNTITY]} ` allTip += `${top_item.supplier_short_name}x${top_item[LocalVariable.SELECTED_QUQNTITY]} `
} }
}) })
// topProcOptionList[topActiveIndex].leftOptionList.map(leItem => {
// if (!leItem[LocalVariable.SELECTED_QUQNTITY]) {
// leItem[LocalVariable.SELECTED_QUQNTITY] = 0
// }
// allCountQuantity += leItem[LocalVariable.SELECTED_QUQNTITY]
// })
console.log('allCountQuantity---', allCountQuantity, allTip)
if (tipFlag) { if (tipFlag) {
// 返回提示信息
return allTip return allTip
} }
return allCountQuantity return allCountQuantity
...@@ -450,9 +383,8 @@ class ChooseProductPage extends Component { ...@@ -450,9 +383,8 @@ class ChooseProductPage extends Component {
return curCountQuantity return curCountQuantity
} }
// 点击共计已选 // 点击已选
handleSubSelected() { handleSubSelected() {
// console.log('show-----', show)
let { selectShowPopup } = this.state let { selectShowPopup } = this.state
if (this.getAllCountQuantity() !== 0 && this.getCurCountSum() !== 0) { if (this.getAllCountQuantity() !== 0 && this.getCurCountSum() !== 0) {
this.handleCloseSelectModal(!selectShowPopup) this.handleCloseSelectModal(!selectShowPopup)
...@@ -461,15 +393,12 @@ class ChooseProductPage extends Component { ...@@ -461,15 +393,12 @@ class ChooseProductPage extends Component {
// 点击选好了 // 点击选好了
handleSubmit() { handleSubmit() {
console.log('选好了')
this.handleCloseSelectModal(false) this.handleCloseSelectModal(false)
console.log('携带数据,返回到自助下单')
this.handleGoBack() this.handleGoBack()
} }
// 已选修改回调 // 已选修改回调
handleSelectCallBack(options) { handleSelectCallBack(options) {
// console.log('--已选修改回调--', options)
let { topProcOptionList, topActiveIndex } = this.state let { topProcOptionList, topActiveIndex } = this.state
topProcOptionList[topActiveIndex].leftOptionList = options topProcOptionList[topActiveIndex].leftOptionList = options
topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0 topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] = 0
...@@ -537,10 +466,9 @@ class ChooseProductPage extends Component { ...@@ -537,10 +466,9 @@ class ChooseProductPage extends Component {
) )
} }
// 返回顶部产品元素 // 返回顶部厂家
renderTopProItem() { renderTopProItem() {
let { topProcOptionList, topActiveIndex } = this.state let { topProcOptionList, topActiveIndex } = this.state
console.log('返回顶部产品元素---', topProcOptionList)
let cur_title = 'title', cur_icon = 'iconImg' let cur_title = 'title', cur_icon = 'iconImg'
cur_title = 'supplier_short_name' cur_title = 'supplier_short_name'
cur_icon = 'supplier_icon' cur_icon = 'supplier_icon'
...@@ -569,16 +497,13 @@ class ChooseProductPage extends Component { ...@@ -569,16 +497,13 @@ class ChooseProductPage extends Component {
) )
} }
// 返回底部左侧元素 // 返回左侧分类
renderContLeftItem() { renderContLeftItem() {
let { leftActiveIndex, leftOptionList, topProcOptionList, topActiveIndex } = this.state let { leftActiveIndex, topProcOptionList, topActiveIndex } = this.state
let curLeftOptions = [] let curLeftOptions = []
// curLeftOptions = leftOptionList
if (topProcOptionList.length > 0) { if (topProcOptionList.length > 0) {
curLeftOptions = topProcOptionList[topActiveIndex].leftOptionList curLeftOptions = topProcOptionList[topActiveIndex].leftOptionList
} }
console.log('返回左侧元素---', curLeftOptions)
let cur_title = 'title', cur_icon = 'iconImg' let cur_title = 'title', cur_icon = 'iconImg'
cur_title = 'category_name' cur_title = 'category_name'
cur_icon = 'cate_local_icon' cur_icon = 'cate_local_icon'
...@@ -607,19 +532,12 @@ class ChooseProductPage extends Component { ...@@ -607,19 +532,12 @@ class ChooseProductPage extends Component {
) )
} }
// 返回右侧二级元素 // 返回右侧二级数据
renderContItem() { renderContItem() {
let { leftOptionList, leftActiveIndex, defaultThridShow, topProcOptionList, topActiveIndex } = this.state let { leftActiveIndex, defaultThridShow, topProcOptionList, topActiveIndex } = this.state
let curRigSecoOption = [] let curRigSecoOption = []
let curSuperLeftOption = [] let curSuperLeftOption = []
// if(leftOptionList[leftActiveIndex]){
// curRigSecoOption = leftOptionList[leftActiveIndex][LocalVariable.LOCAL_SECOND_DATA] // 本地数据
// curSuperLeftOption = leftOptionList[leftActiveIndex]
// }
let topItem = topProcOptionList[topActiveIndex] let topItem = topProcOptionList[topActiveIndex]
if (topItem && topItem.leftOptionList) { if (topItem && topItem.leftOptionList) {
let leftItem = topItem.leftOptionList[leftActiveIndex] let leftItem = topItem.leftOptionList[leftActiveIndex]
if (leftItem && leftItem[LocalVariable.LOCAL_SECOND_DATA]) { if (leftItem && leftItem[LocalVariable.LOCAL_SECOND_DATA]) {
...@@ -628,8 +546,6 @@ class ChooseProductPage extends Component { ...@@ -628,8 +546,6 @@ class ChooseProductPage extends Component {
} }
} }
// console.log('-返回右侧二级元素--curRigSecoOption', curRigSecoOption)
return ( return (
<View style={styles.cont_bom_box}> <View style={styles.cont_bom_box}>
{ this.renderContLeftItem()} { this.renderContLeftItem()}
...@@ -641,8 +557,6 @@ class ChooseProductPage extends Component { ...@@ -641,8 +557,6 @@ class ChooseProductPage extends Component {
superStencilData={curRigSecoOption} superStencilData={curRigSecoOption}
superCallBack={(count, coutFieName) => this.handleChangeCount(count, coutFieName)} superCallBack={(count, coutFieName) => this.handleChangeCount(count, coutFieName)}
superReduceBack={() => this.handleSubSelected()} superReduceBack={() => this.handleSubSelected()}
// thirdCallBack={(childData, superIndex) => this.handleChangeThird(childData, superIndex)}
// superLeftData={leftOptionList[leftActiveIndex]}
superLeftData={curSuperLeftOption} superLeftData={curSuperLeftOption}
/> />
</View> </View>
...@@ -654,24 +568,10 @@ class ChooseProductPage extends Component { ...@@ -654,24 +568,10 @@ class ChooseProductPage extends Component {
let { selectShowPopup, topProcOptionList, topActiveIndex } = this.state let { selectShowPopup, topProcOptionList, topActiveIndex } = this.state
let allCountQuantity = this.getAllCountQuantity() let allCountQuantity = this.getAllCountQuantity()
let cur_sel_options = [] let cur_sel_options = []
let sel_tip = '' let sel_tip = this.getAllCountQuantity(true)
if (topProcOptionList.length > 0) { if (topProcOptionList.length > 0) {
// topProcOptionList.forEach(top_item => {
// if(top_item[LocalVariable.SELECTED_QUQNTITY] > 0){
// cur_sel_options.push(...top_item.leftOptionList)
// }
// })
cur_sel_options = topProcOptionList[topActiveIndex].leftOptionList cur_sel_options = topProcOptionList[topActiveIndex].leftOptionList
// cur_sel_options.forEach(cur_item => {
// if (cur_item[LocalVariable.SELECTED_QUQNTITY] > 0) {
// sel_tip += `${cur_item.category_name}x${cur_item[LocalVariable.SELECTED_QUQNTITY]} `
// }
// })
} }
console.log('返回底部按钮😂----', cur_sel_options, sel_tip)
sel_tip = this.getAllCountQuantity(true)
return ( return (
<View style={list_common_item.sub_box}> <View style={list_common_item.sub_box}>
...@@ -697,7 +597,6 @@ class ChooseProductPage extends Component { ...@@ -697,7 +597,6 @@ class ChooseProductPage extends Component {
<Text style={list_common_item.rig_tip}>{'选好了'}</Text> <Text style={list_common_item.rig_tip}>{'选好了'}</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<ProductModel <ProductModel
show={selectShowPopup} show={selectShowPopup}
closeModal={(show) => this.handleCloseSelectModal(show)} closeModal={(show) => this.handleCloseSelectModal(show)}
...@@ -706,13 +605,12 @@ class ChooseProductPage extends Component { ...@@ -706,13 +605,12 @@ class ChooseProductPage extends Component {
modelCallBack={(options) => this.handleSelectCallBack(options)} modelCallBack={(options) => this.handleSelectCallBack(options)}
clearRubbish={() => this.handleClearRubbish()} clearRubbish={() => this.handleClearRubbish()}
/> />
{ this.renderLodingItem()} { this.renderLodingItem()}
</View> </View>
) )
} }
// 返回正在加载中 // 返回加载中
renderLodingItem() { renderLodingItem() {
return ( return (
<LoadingModel ref="LoadingModel" /> <LoadingModel ref="LoadingModel" />
......
...@@ -2,10 +2,8 @@ import React, { Component } from 'react'; ...@@ -2,10 +2,8 @@ import React, { Component } from 'react';
import { View, StyleSheet, SafeAreaView, ScrollView, FlatList, Text } from 'react-native'; import { View, StyleSheet, SafeAreaView, ScrollView, FlatList, Text } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import HeadBackItem from '../../common/HeadBackItem'; import HeadBackItem from '../../common/HeadBackItem';
import { home_background_color, foundation_color, promary_color, third_text_color, first_text_color, second_text_size, Width, pxSize, safe_view, font_family_semibold, font_family_light, second_text_color, placehold_text_color, promary_shadow_color } from '../../../base/BaseStyle'; import { home_background_color, foundation_color, promary_color, third_text_color, first_text_color, second_text_size, Width, pxSize, safe_view, font_family_semibold, font_family_light } from '../../../base/BaseStyle';
import { import { FooterBtnStyle, PicListNoData } from '../../common/CellTextStyle';
FooterBtnStyle, PicListNoData
} from '../../common/CellTextStyle';
import StatusBarView from '../../common/StatusBarView'; import StatusBarView from '../../common/StatusBarView';
import ChooseCardList from '../../common/listDataComponent/ChooseCardList'; import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu'; import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
...@@ -13,14 +11,8 @@ import PictureZoom from '../../common/listDataComponent/PictureZoom'; ...@@ -13,14 +11,8 @@ import PictureZoom from '../../common/listDataComponent/PictureZoom';
import { cloneObject, show } from '../../../utils/Utils'; import { cloneObject, show } from '../../../utils/Utils';
import { reqSurTempLineSearch, reqNailBoxLineSearch, reqEquipPackageLineSearch } from '../../../action/SelfAction'; import { reqSurTempLineSearch, reqNailBoxLineSearch, reqEquipPackageLineSearch } from '../../../action/SelfAction';
import LoadingModel from '../../common/listDataComponent/LoadingModel'; import LoadingModel from '../../common/listDataComponent/LoadingModel';
import localMockData from './mock/sen_mock';
import LocalVariable from '../../common/LocalVariable'; import LocalVariable from '../../common/LocalVariable';
// const SELECTED_QUQNTITY = 'selectedQuantity' // 三级数量
// const SELECTED_DATA_ARR = 'selectedDataArr' // 三级已选元素
// const LOCAL_THRID_CONT_DATA = 'localThridContData' // 三级原本元素
// const QUANTITY_FIELD = 'quantity' // 计算的字段
class EditThirdLevelPage extends Component { class EditThirdLevelPage extends Component {
constructor(props) { constructor(props) {
...@@ -31,18 +23,18 @@ class EditThirdLevelPage extends Component { ...@@ -31,18 +23,18 @@ class EditThirdLevelPage extends Component {
onlyShow: false, // 只展示 onlyShow: false, // 只展示
onlySignSelect: false, // 单选 onlySignSelect: false, // 单选
defalutTopItem: [{ // 手术模板显示 defalutTopItem: [{ // 手术模板显示
"category_code": "sign_consu", "category_code": LocalVariable.SIGN_SELECT_CONSUMABLES,
"category_name": "单选耗材" "category_name": "单选耗材"
}, { }, {
"category_code": "screw_box", "category_code": LocalVariable.NAIL_BOX,
"category_name": "钉盒", "category_name": "钉盒",
"cate_local_icon": require('../../../images/screw_box.png') "cate_local_icon": require('../../../images/screw_box.png')
}, { }, {
"category_code": "equip_bag", "category_code": LocalVariable.EQUIPMENT_BAG,
"category_name": "器械包", "category_name": "器械包",
"cate_local_icon": require('../../../images/equip_bag.png') "cate_local_icon": require('../../../images/equip_bag.png')
}, { }, {
"category_code": "auxili_tool", "category_code": LocalVariable.SCATTERED_EQUIPMENT,
"category_name": "零散器械", "category_name": "零散器械",
"cate_local_icon": require('../../../images/auxili_tool.png') "cate_local_icon": require('../../../images/auxili_tool.png')
}], }],
...@@ -51,35 +43,6 @@ class EditThirdLevelPage extends Component { ...@@ -51,35 +43,6 @@ class EditThirdLevelPage extends Component {
} }
componentDidMount() { componentDidMount() {
// let {params} = this.props.navigation.state
// let that = this
// console.log('本地测试数据====localMockData===', localMockData)
// console.log('父组件传递的值==', params)
// // 赋值测试数据
// let curOptions = []
// if(params.superData.leftIndex === 1){
// // 钉盒
// curOptions = cloneObject(localMockData.localThridOption_dh)
// this.setState({
// onlyShow: params.superData.thirdShow,
// topProcOptionList: curOptions
// })
// }else if(params.superData.leftIndex === 2) {
// // 器械包
// curOptions = cloneObject(localMockData.localThridOption_qxb)
// this.setState({
// onlyShow: params.superData.thirdShow,
// topProcOptionList: curOptions
// })
// }else {
// curOptions = cloneObject(localMockData.localThridOption)
// this.setState({
// topProcOptionList: curOptions
// }, () => {
// that.setAllSelectData()
// })
// }
this.initGetData() this.initGetData()
} }
...@@ -89,9 +52,7 @@ class EditThirdLevelPage extends Component { ...@@ -89,9 +52,7 @@ class EditThirdLevelPage extends Component {
let { superData } = that.props.navigation.state.params let { superData } = that.props.navigation.state.params
let { token, global_domain_config } = that.props let { token, global_domain_config } = that.props
let { defalutTopItem, topProcOptionList } = that.state let { defalutTopItem, topProcOptionList } = that.state
let { leftIndex, superIndex, superItem, thirdShow } = superData let { leftIndex, superItem } = superData
console.log('父组件传递的值==', leftIndex, superIndex, superItem, thirdShow)
that.refs.LoadingModel.show() that.refs.LoadingModel.show()
that.setState({ that.setState({
superData: cloneObject(superData) superData: cloneObject(superData)
...@@ -192,29 +153,10 @@ class EditThirdLevelPage extends Component { ...@@ -192,29 +153,10 @@ class EditThirdLevelPage extends Component {
} }
// 修改列表计算后数据 // 计算后的回调
handleCalCallBack(item, index, dataName) { handleCalCallBack(item, index, dataName) {
let { topProcOptionList, topActiveIndex } = this.state let { topProcOptionList, topActiveIndex } = this.state
let { params } = this.props.navigation.state
let that = this let that = this
// console.log('修改列表计算后数据', item, index, dataName)
// console.log('修改列表计算后数据', topActiveIndex, topProcOptionList)
// console.log('父组件传递的值==', params.superData.leftIndex)
// if(params.superData.leftIndex === 2){
// topProcOptionList.map(function(topItem, topInd) {
// if(topInd === index){
// topItem = item
// }else {
// topItem.select = false // 初始化
// }
// })
// that.setState({
// topProcOptionList
// })
// console.log('设置当前所有已选值---', topProcOptionList)
// }else
if (dataName && topProcOptionList[topActiveIndex][dataName]) { if (dataName && topProcOptionList[topActiveIndex][dataName]) {
topProcOptionList.map(function (listItem, listIndex) { topProcOptionList.map(function (listItem, listIndex) {
if (listIndex === topActiveIndex) { if (listIndex === topActiveIndex) {
...@@ -244,16 +186,13 @@ class EditThirdLevelPage extends Component { ...@@ -244,16 +186,13 @@ class EditThirdLevelPage extends Component {
}) })
} }
}) })
// console.log('设置当前所有已选值---', topProcOptionList)
this.setState({ this.setState({
topProcOptionList topProcOptionList
}) })
} }
// 点击顶部菜单 // 点击顶部菜单
handleTopNav(item, index) { handleTopNav(item, index) {
// console.log('item, index----', item, index)
this.setState({ this.setState({
topActiveIndex: index topActiveIndex: index
}) })
...@@ -263,8 +202,6 @@ class EditThirdLevelPage extends Component { ...@@ -263,8 +202,6 @@ class EditThirdLevelPage extends Component {
handleSubmit() { handleSubmit() {
let { topProcOptionList, superData } = this.state let { topProcOptionList, superData } = this.state
let { params } = this.props.navigation.state let { params } = this.props.navigation.state
// console.log('编辑完成====>', topProcOptionList, params.superData)
// console.log(topProcOptionList[0][LocalVariable.LOCAL_THRID_CONT_DATA][0])
params.childrenPageCallBack(topProcOptionList, superData.superIndex) params.childrenPageCallBack(topProcOptionList, superData.superIndex)
this.props.navigation.goBack() this.props.navigation.goBack()
} }
...@@ -285,13 +222,12 @@ class EditThirdLevelPage extends Component { ...@@ -285,13 +222,12 @@ class EditThirdLevelPage extends Component {
renderTopProItem() { renderTopProItem() {
let { topProcOptionList, topActiveIndex, superData } = this.state let { topProcOptionList, topActiveIndex, superData } = this.state
let { leftIndex } = superData let { leftIndex } = superData
console.log('顶部编辑选项===', topProcOptionList)
let curTit = '', curTopList = topProcOptionList let curTit = '', curTopList = topProcOptionList
if (leftIndex === 0) { if (leftIndex === 0) {
curTit = 'category_name' curTit = 'category_name'
} else if (leftIndex === 1) { } else if (leftIndex === 1) {
curTit = 'segment_name' curTit = 'segment_name'
if(curTopList.length > 0 && curTopList[0].segment_code === 'ALL'){ if (curTopList.length > 0 && curTopList[0].segment_code === 'ALL') {
curTopList = [] curTopList = []
} }
} else if (leftIndex === 2) { } else if (leftIndex === 2) {
...@@ -322,37 +258,7 @@ class EditThirdLevelPage extends Component { ...@@ -322,37 +258,7 @@ class EditThirdLevelPage extends Component {
// 返回底部主要元素 // 返回底部主要元素
renderContItem() { renderContItem() {
let { topProcOptionList, topActiveIndex, superData, onlyShow } = this.state let { topProcOptionList, topActiveIndex } = this.state
let { leftIndex } = superData
// let { params } = this.props.navigation.state
// let curData = []
// // 本地测试数据
// let localThridContData = []
// let imgIconArr = ''
// if (params.superData.leftIndex === 1) {
// curData = topProcOptionList
// } else if (params.superData.leftIndex === 2) {
// // localThridContData = topProcOptionList
// } else {
// curData = topProcOptionList[topActiveIndex]
// }
// if (curData && curData[LocalVariable.LOCAL_THRID_CONT_DATA]) {
// localThridContData = curData[LocalVariable.LOCAL_THRID_CONT_DATA]
// }
// if (curData && curData.imgIconArr) {
// imgIconArr = curData.imgIconArr
// }
// if (params.superData.leftIndex === 2) {
// // 器械包
// localThridContData = topProcOptionList['package_components']
// }
let localThridContData = [] let localThridContData = []
let imgIconArr = '' let imgIconArr = ''
let topItem = topProcOptionList[topActiveIndex] let topItem = topProcOptionList[topActiveIndex]
...@@ -360,8 +266,6 @@ class EditThirdLevelPage extends Component { ...@@ -360,8 +266,6 @@ class EditThirdLevelPage extends Component {
localThridContData = topItem[LocalVariable.LOCAL_THRID_CONT_DATA] localThridContData = topItem[LocalVariable.LOCAL_THRID_CONT_DATA]
} }
console.log('底部数据==', topItem, localThridContData)
return ( return (
<View style={styles.edit_cont}> <View style={styles.edit_cont}>
{ imgIconArr ? <PictureZoom { imgIconArr ? <PictureZoom
...@@ -374,7 +278,7 @@ class EditThirdLevelPage extends Component { ...@@ -374,7 +278,7 @@ class EditThirdLevelPage extends Component {
style={styles.edit_scroll_cont} style={styles.edit_scroll_cont}
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={false}
> >
{ localThridContData.length > 0 ? {localThridContData.length > 0 ?
<FlatList <FlatList
style={styles.edit_list} style={styles.edit_list}
keyExtractor={item => item.id} keyExtractor={item => item.id}
...@@ -385,7 +289,7 @@ class EditThirdLevelPage extends Component { ...@@ -385,7 +289,7 @@ class EditThirdLevelPage extends Component {
} }
</ScrollView> </ScrollView>
{ this.renderLodingItem() } { this.renderLodingItem()}
</View> </View>
) )
...@@ -393,12 +297,9 @@ class EditThirdLevelPage extends Component { ...@@ -393,12 +297,9 @@ class EditThirdLevelPage extends Component {
// 返回每一列元素 // 返回每一列元素
renderContColumnItem(item, index) { renderContColumnItem(item, index) {
let { topProcOptionList, topActiveIndex, superData, onlyShow, onlySignSelect } = this.state let { onlyShow, onlySignSelect } = this.state
let { leftIndex } = superData
let curTit = '', curTipStr = '', curTipOne = '', curTipTwo = '', curCalField = '', curImgIcon = '' let curTit = '', curTipStr = '', curTipOne = '', curTipTwo = '', curCalField = '', curImgIcon = ''
let curTipStrTit = '', curTipOneTit = '', curTipTwoTit = '' let curTipStrTit = '', curTipOneTit = '', curTipTwoTit = ''
curTit = 'item_name' curTit = 'item_name'
curTipStr = 'item_code' curTipStr = 'item_code'
curTipOne = 'specification' curTipOne = 'specification'
...@@ -410,7 +311,7 @@ class EditThirdLevelPage extends Component { ...@@ -410,7 +311,7 @@ class EditThirdLevelPage extends Component {
curImgIcon = 'photos' curImgIcon = 'photos'
return ( return (
<SafeAreaView style={styles.column_container} key={'item_code'+index}> <SafeAreaView style={styles.column_container} key={'item_code' + index}>
<PicTitDetaiCalcu <PicTitDetaiCalcu
listItem={item} listItem={item}
listIndex={index} listIndex={index}
...@@ -435,24 +336,16 @@ class EditThirdLevelPage extends Component { ...@@ -435,24 +336,16 @@ class EditThirdLevelPage extends Component {
// 返回正在加载中 // 返回正在加载中
renderLodingItem() { renderLodingItem() {
return( return (
<LoadingModel ref="LoadingModel"/> <LoadingModel ref="LoadingModel" />
) )
} }
render() { render() {
let { navigation } = this.props let { navigation } = this.props
let { title } = navigation.state.params let { title } = navigation.state.params
let { onlyShow, onlySignSelect } = this.state let { onlyShow } = this.state
console.log('onlyShow==', onlyShow)
let curShowTop = true
if (onlyShow) {
curShowTop = !onlyShow
}
if (onlySignSelect) {
curShowTop = !onlySignSelect
}
return ( return (
<View style={styles.edit_container}> <View style={styles.edit_container}>
<StatusBarView <StatusBarView
...@@ -463,7 +356,6 @@ class EditThirdLevelPage extends Component { ...@@ -463,7 +356,6 @@ class EditThirdLevelPage extends Component {
<SafeAreaView style={safe_view}> <SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} /> <HeadBackItem title={title} navigation={navigation} />
<View style={styles.edit_main}> <View style={styles.edit_main}>
{/* {curShowTop ? this.renderTopProItem() : null} */}
{this.renderTopProItem()} {this.renderTopProItem()}
{this.renderContItem()} {this.renderContItem()}
</View> </View>
......
...@@ -2,29 +2,18 @@ import React, { Component } from 'react'; ...@@ -2,29 +2,18 @@ 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 { 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 PictureZoom from '../../common/listDataComponent/PictureZoom';
import { cloneObject } from '../../../utils/Utils'; import { cloneObject } from '../../../utils/Utils';
import { PicListNoData } from '../../common/CellTextStyle'; import { PicListNoData } from '../../common/CellTextStyle';
import _ from "lodash"; import _ from "lodash";
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import localMockData from './mock/sen_mock';
import LocalVariable from '../../common/LocalVariable'; import LocalVariable from '../../common/LocalVariable';
const PropTypes = require('prop-types'); const PropTypes = require('prop-types');
// const QUANTITY_FIELD = 'quantity' // 计算的字段
// const CHILDREN_LINE_NAME = 'childrenLineData' // 显示的子类数组名称
// const ONLY_TWO_LEVELS = 'onlyTwoLevels' // 只有两级的耗材
// const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
// const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
// const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
class ProductRightStyle extends Component { class ProductRightStyle extends Component {
static propTypres = { static propTypres = {
superCallBack: PropTypes.func, // 回调计算函数 superCallBack: PropTypes.func, // 回调计算函数
superReduceBack: PropTypes.func, // 减法回调 superReduceBack: PropTypes.func, // 减法回调
// thirdCallBack: PropTypes.func, // 三级小类的回调函数
superLeftData: PropTypes.object, // 三级大类数据 superLeftData: PropTypes.object, // 三级大类数据
superStencilData: PropTypes.array, // 当前右侧二级数据 superStencilData: PropTypes.array, // 当前右侧二级数据
leftIndex: PropTypes.numberm, // 左侧index leftIndex: PropTypes.numberm, // 左侧index
...@@ -33,25 +22,18 @@ class ProductRightStyle extends Component { ...@@ -33,25 +22,18 @@ class ProductRightStyle extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
rightSecondData: this.props.superStencilData, // 右侧分类数据-模块、螺钉盒、器械包、赋值工具 rightSecondData: this.props.superStencilData, // 右侧数据-手术模板、螺钉盒、器械包、零散器械
selectItem: [], // 当前选中模板 -- 之前版本 rowSingleData: [], // 耗材-小类
rowSingleData: [], // 人工髋关节假体等数据 -- 小类
thridIsVisible: false, // 小类展示 thridIsVisible: false, // 小类展示
curThridObj: { curThridObj: {
title: '测试标题__', superItem: '',
superIndex: '',
title: '',
image: '' image: ''
} }
} }
} }
componentDidMount() {
// console.log('本地测试数据====localMockData===', localMockData)
// // 赋值测试数据
// this.setState({
// // rowSingleData: cloneObject(localMockData.localSingleRowData)
// })
}
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (this.state.thridIsVisible != nextProps.defaultThridShow) { if (this.state.thridIsVisible != nextProps.defaultThridShow) {
this.setState({ thridIsVisible: nextProps.defaultThridShow }); this.setState({ thridIsVisible: nextProps.defaultThridShow });
...@@ -61,12 +43,11 @@ class ProductRightStyle extends Component { ...@@ -61,12 +43,11 @@ class ProductRightStyle extends Component {
} }
} }
// 所有二级数据标题点击事件 // 右侧 二级数据标题 点击
TitleClickEvent(item, index) { TitleClickEvent(item, index) {
let { leftIndex } = this.props let { leftIndex } = this.props
console.log('右侧标题点击事件 ', leftIndex, index, item)
if (leftIndex >= 0 && leftIndex < 3) { if (leftIndex >= 0 && leftIndex < 3) {
let curThirdShow = false, curThirdSign = false, curTit = '编辑模板' let curThirdShow = false, curTit = '编辑模板'
if (leftIndex === 1) { if (leftIndex === 1) {
curThirdShow = true curThirdShow = true
curTit = '钉盒明细' curTit = '钉盒明细'
...@@ -84,42 +65,14 @@ class ProductRightStyle extends Component { ...@@ -84,42 +65,14 @@ class ProductRightStyle extends Component {
}, },
childrenPageCallBack: this.childrenPageCallBack.bind(this) // 传递函数,编辑完成时调用 childrenPageCallBack: this.childrenPageCallBack.bind(this) // 传递函数,编辑完成时调用
}) })
} else if (leftIndex === 3) { } else if (leftIndex > 3) {
// 零散器械 // 单选耗材 中级标题点击
this.canPlusOrdReduceOne(item, index)
} else {
// 单选耗材 中级标题点击之后
this.changeThrShow(true, item, index) this.changeThrShow(true, item, index)
} }
} }
// 零散器械标题点击 // 大类加减时,小类所有加1/减1
canPlusOrdReduceOne(item, index) {
let { leftIndex } = this.props
let { rightSecondData } = this.state
// console.log('零散器械标题点击/减1:',rightSecondData)
// console.log('零散器械标题点击/减1:',leftIndex)
// console.log('零散器械标题点击/减1:',item)
// console.log('零散器械标题点击/减1:',index)
}
// 大类加减,小类所有加1/减1
handleAllPlusReduce(curData, curIndex, isPlus) { handleAllPlusReduce(curData, curIndex, isPlus) {
let { rightSecondData } = this.state
let { superLeftData } = this.props
console.log('大类加减,整理加一/减一', curData, curIndex, isPlus)
// console.log('右侧数据', rightSecondData, curData[LocalVariable.CHILDREN_LINE_NAME])
// let rowData = [] // 本地测试,需要获取接口数据(无数据时,加法)
// rowData = cloneObject(localMockData.localSingleRowData) // 初始化数据
// let rowData = []
// rowData = curData.details
// console.log('本地测试,获取接口数据--', curData)
// console.log('本地测试,获取接口数据--', rightSecondData)
// console.log('本地测试,获取接口数据--', superLeftData)
if (curData.details && curData.details.length > 0) { if (curData.details && curData.details.length > 0) {
let sumCount = 0 let sumCount = 0
curData[LocalVariable.QUANTITY_FIELD] = 0 // 初始化 curData[LocalVariable.QUANTITY_FIELD] = 0 // 初始化
...@@ -135,19 +88,14 @@ class ProductRightStyle extends Component { ...@@ -135,19 +88,14 @@ class ProductRightStyle extends Component {
sumCount += line_val[LocalVariable.QUANTITY_FIELD] sumCount += line_val[LocalVariable.QUANTITY_FIELD]
}) })
curData[LocalVariable.QUANTITY_FIELD] = sumCount curData[LocalVariable.QUANTITY_FIELD] = sumCount
this.handleCalCallBack(curData, curIndex, 'rightSecondData', LocalVariable.QUANTITY_FIELD) this.handleCalCallBack(curData, curIndex, 'rightSecondData', LocalVariable.QUANTITY_FIELD)
} }
console.log('修改后的数据', curData, curIndex)
} }
// 手术模板-编辑页面回调 // 手术模板-编辑页面回调
childrenPageCallBack(childData, index) { childrenPageCallBack(childData, index) {
let { rightSecondData } = this.state let { rightSecondData } = this.state
let { leftIndex } = this.props let { leftIndex } = this.props
console.log('编辑页面的回调----', childData, index, leftIndex)
let that = this let that = this
if (rightSecondData.length > 0) { if (rightSecondData.length > 0) {
rightSecondData.forEach(function (rsdItem, rsdIndex) { rightSecondData.forEach(function (rsdItem, rsdIndex) {
...@@ -176,7 +124,6 @@ class ProductRightStyle extends Component { ...@@ -176,7 +124,6 @@ class ProductRightStyle extends Component {
lineOptions: childData, lineOptions: childData,
[LocalVariable.QUANTITY_FIELD]: 1 [LocalVariable.QUANTITY_FIELD]: 1
} }
if (rsdItem[LocalVariable.CHILDREN_LINE_NAME].length !== 0) { if (rsdItem[LocalVariable.CHILDREN_LINE_NAME].length !== 0) {
curObj.version = rsdItem[LocalVariable.CHILDREN_LINE_NAME].length curObj.version = rsdItem[LocalVariable.CHILDREN_LINE_NAME].length
} }
...@@ -186,18 +133,14 @@ class ProductRightStyle extends Component { ...@@ -186,18 +133,14 @@ class ProductRightStyle extends Component {
return lineItem return lineItem
} }
}) })
// 本地测试
if (filEquArr.length === 0) { if (filEquArr.length === 0) {
rsdItem[LocalVariable.CHILDREN_LINE_NAME].push(curObj) rsdItem[LocalVariable.CHILDREN_LINE_NAME].push(curObj)
} }
rsdItem[LocalVariable.QUANTITY_FIELD] = Number(rsdItem[LocalVariable.QUANTITY_FIELD]) + 1 rsdItem[LocalVariable.QUANTITY_FIELD] = Number(rsdItem[LocalVariable.QUANTITY_FIELD]) + 1
// console.log('回调后的rsdItem====', rsdItem)
that.handleCalCallBack(rsdItem, rsdIndex, 'rightSecondData', LocalVariable.QUANTITY_FIELD) that.handleCalCallBack(rsdItem, rsdIndex, 'rightSecondData', LocalVariable.QUANTITY_FIELD)
} }
}) })
} }
// console.log('回调后的数组====', rightSecondData)
this.setState({ this.setState({
rightSecondData rightSecondData
}) })
...@@ -206,20 +149,13 @@ class ProductRightStyle extends Component { ...@@ -206,20 +149,13 @@ class ProductRightStyle extends Component {
// 修改当前小类是否展示 // 修改当前小类是否展示
changeThrShow(show, superItem, superIndex) { changeThrShow(show, superItem, superIndex) {
let { curThridObj, rowSingleData } = this.state let { curThridObj, rowSingleData } = this.state
let { leftIndex } = this.props
let that = this let that = this
// console.log('修改当前小类是否展示----', show, superItem, superIndex)
// console.log('修改当前小类是否展示----', rowSingleData)
// console.log('修改当前小类是否展示----', curThridObj)
// console.log('修改当前小类是否展示----', leftIndex)
if (show && superItem) { if (show && superItem) {
// 大类点击标题 // 大类点击标题
let curRowData = cloneObject(superItem['details']) let curRowData = cloneObject(superItem['details'])
curThridObj = { curThridObj = {
superItem: superItem, superItem: superItem,
superIndex: superIndex, superIndex: superIndex,
// image: localTestImageUrls,
title: superItem.category_name title: superItem.category_name
} }
that.setState({ that.setState({
...@@ -227,7 +163,6 @@ class ProductRightStyle extends Component { ...@@ -227,7 +163,6 @@ class ProductRightStyle extends Component {
curThridObj: curThridObj, curThridObj: curThridObj,
rowSingleData: curRowData rowSingleData: curRowData
}) })
} else { } else {
// 小类点击标题 // 小类点击标题
if (curThridObj.superItem) { if (curThridObj.superItem) {
...@@ -240,27 +175,17 @@ class ProductRightStyle extends Component { ...@@ -240,27 +175,17 @@ class ProductRightStyle extends Component {
curDa[LocalVariable.QUANTITY_FIELD] += itVal[LocalVariable.QUANTITY_FIELD] curDa[LocalVariable.QUANTITY_FIELD] += itVal[LocalVariable.QUANTITY_FIELD]
} }
}) })
that.handleCalCallBack(curDa, curInd, 'rightSecondData', LocalVariable.QUANTITY_FIELD) that.handleCalCallBack(curDa, curInd, 'rightSecondData', LocalVariable.QUANTITY_FIELD)
that.setState({ that.setState({
thridIsVisible: show thridIsVisible: show
}) })
} }
// this.setState({
// thridIsVisible: show
// })
// 小类点击标题时,回调函数修改左侧数据
// this.props.thirdCallBack(rowSingleData, curThridObj.superIndex)
} }
} }
// 修改列表计算后数据 - 头/行 // 计算后的回调 - 头/行
handleCalCallBack(item, index, dataName, coutFieName) { handleCalCallBack(item, index, dataName, coutFieName) {
// console.log('修改列表计算后数据==', item, index, dataName, coutFieName) // 除了单选耗材小类的回调
if (dataName && this.state[dataName]) { if (dataName && this.state[dataName]) {
let curDataName = this.state[dataName] let curDataName = this.state[dataName]
curDataName[index] = item curDataName[index] = item
...@@ -268,8 +193,6 @@ class ProductRightStyle extends Component { ...@@ -268,8 +193,6 @@ class ProductRightStyle extends Component {
[dataName]: curDataName [dataName]: curDataName
}) })
if (coutFieName) { if (coutFieName) {
// 除了单选耗材小类的回调
// console.log('除了单选耗材的回调==',item, index, dataName, coutFieName)
// 计算==头 // 计算==头
let sumCount = 0 let sumCount = 0
curDataName.map(item => { curDataName.map(item => {
...@@ -277,7 +200,6 @@ class ProductRightStyle extends Component { ...@@ -277,7 +200,6 @@ class ProductRightStyle extends Component {
sumCount += Number(item[coutFieName]) sumCount += Number(item[coutFieName])
} }
}) })
// console.log('计算==数量汇总=字段=', sumCount, coutFieName)
this.props.superCallBack(sumCount, coutFieName) this.props.superCallBack(sumCount, coutFieName)
} }
} }
...@@ -303,13 +225,6 @@ class ProductRightStyle extends Component { ...@@ -303,13 +225,6 @@ class ProductRightStyle extends Component {
curTipStrTit = '物料代码' curTipStrTit = '物料代码'
curTipOneTit = '规格型号' curTipOneTit = '规格型号'
curIcon = 'photos' curIcon = 'photos'
} else {
// curTit = 'title'
// curTipOne = 'tip1'
// curTipTwo = 'tip2'
// curTipOneTit='提示1'
// curTipTwoTit='提示2'
// curIcon='imgIconArr'
} }
if (leftIndex === 1) { if (leftIndex === 1) {
// 钉盒 // 钉盒
...@@ -322,13 +237,6 @@ class ProductRightStyle extends Component { ...@@ -322,13 +237,6 @@ class ProductRightStyle extends Component {
curPlusCallBack = '' curPlusCallBack = ''
curReduceCallBack = '' curReduceCallBack = ''
curListMaxNum = 1 curListMaxNum = 1
// if(item['childQuantity'] > 0) {
// 有数量时,需要点击进入选择
// curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
// curPlusCallBack = ((item, index) => this.TitleClickEvent(item,index))
// curReduceCallBack = (() => this.props.superReduceBack())
// }
} else if (leftIndex === 3) { } else if (leftIndex === 3) {
// 零散器械 // 零散器械
curTitCallBack = '' curTitCallBack = ''
...@@ -369,16 +277,14 @@ class ProductRightStyle extends Component { ...@@ -369,16 +277,14 @@ class ProductRightStyle extends Component {
let { rightSecondData } = this.state let { rightSecondData } = this.state
return ( return (
<View style={styles.stencil_cont}> <View style={styles.stencil_cont}>
{ { rightSecondData.length > 0 ?
rightSecondData.length > 0 ? <FlatList
<FlatList style={styles.cont_right_list}
style={styles.cont_right_list} keyExtractor={item => item.id}
keyExtractor={item => item.id} data={rightSecondData}
data={rightSecondData} extraData={this.state}
extraData={this.state} renderItem={({ item, index }) => this.renderSecondtem(item, index)}
renderItem={({ item, index }) => this.renderSecondtem(item, index)} /> : <PicListNoData />}
/> : <PicListNoData />
}
</View> </View>
) )
...@@ -423,26 +329,23 @@ class ProductRightStyle extends Component { ...@@ -423,26 +329,23 @@ class ProductRightStyle extends Component {
// 单选耗材 -- 大类每一列 // 单选耗材 -- 大类每一列
renderOtherListItem(item, index) { renderOtherListItem(item, index) {
let curTit = '', curTipOne = '', curTipTwo = '', curTipOneTit = '', curTipTwoTit = '', curIcon = '' let curTit = '', curTipOne = '', curTipTwo = '', curTipOneTit = '', curTipTwoTit = '', curIcon = ''
let curSubCalCallBack = '', curTitCallBack = '', curPlusCallBack = '', curReduceCallBack = '' let curTitCallBack = '', curPlusCallBack = '', curReduceCallBack = ''
if (item[LocalVariable.ONLY_TWO_LEVELS]) { if (item[LocalVariable.ONLY_TWO_LEVELS]) {
// 两级 // 两级数据
curTit = 'item_name' curTit = 'item_name'
curTipOne = 'item_code' curTipOne = 'item_code'
curTipOneTit = '物料代码' curTipOneTit = '物料代码'
curIcon = 'photos' curIcon = 'photos'
} else { } else {
// 三级 // 三级数据
curTit = 'category_name' curTit = 'category_name'
curTipOne = 'category_code' curTipOne = 'category_code'
curTipOneTit = '分类编码' curTipOneTit = '分类编码'
// curSubCalCallBack= ''
curTitCallBack = (item, index) => this.TitleClickEvent(item, index) curTitCallBack = (item, index) => this.TitleClickEvent(item, index)
curPlusCallBack = (item, index) => this.handleAllPlusReduce(item, index, true) curPlusCallBack = (item, index) => this.handleAllPlusReduce(item, index, true)
curReduceCallBack = (item, index) => this.handleAllPlusReduce(item, index) curReduceCallBack = (item, index) => this.handleAllPlusReduce(item, index)
} }
// console.log('大类===', item)
return ( return (
<SafeAreaView style={styles.oth_container} key={'item_code' + index}> <SafeAreaView style={styles.oth_container} key={'item_code' + index}>
<PicTitDetaiCalcu <PicTitDetaiCalcu
...@@ -455,7 +358,9 @@ class ProductRightStyle extends Component { ...@@ -455,7 +358,9 @@ class ProductRightStyle extends Component {
titCallBack={curTitCallBack} titCallBack={curTitCallBack}
titText={curTit} titText={curTit}
tipTextOne={curTipOne} tipTextOne={curTipOne}
tipTextTwo={curTipTwo}
tipTextOneTit={curTipOneTit} tipTextOneTit={curTipOneTit}
tipTextTwoTit={curTipTwoTit}
plusCallBack={curPlusCallBack} plusCallBack={curPlusCallBack}
reduceCallBack={curReduceCallBack} reduceCallBack={curReduceCallBack}
/> />
...@@ -482,7 +387,7 @@ class ProductRightStyle extends Component { ...@@ -482,7 +387,7 @@ class ProductRightStyle extends Component {
) )
} }
// 返回右侧元素 // 右侧元素
renderRightCurrentStyle() { renderRightCurrentStyle() {
let { leftIndex } = this.props let { leftIndex } = this.props
let { thridIsVisible } = this.state let { thridIsVisible } = this.state
...@@ -497,7 +402,7 @@ class ProductRightStyle extends Component { ...@@ -497,7 +402,7 @@ class ProductRightStyle extends Component {
} }
} }
// 返回右侧单选耗材 -- 三级顶部标题和图片 // 单选耗材 -- 三级顶部标题
renderThrHeadStyle() { renderThrHeadStyle() {
let { thridIsVisible, curThridObj } = this.state let { thridIsVisible, curThridObj } = this.state
if (thridIsVisible) { if (thridIsVisible) {
...@@ -555,7 +460,6 @@ const styles = StyleSheet.create({ ...@@ -555,7 +460,6 @@ const styles = StyleSheet.create({
cont_right_list: {}, cont_right_list: {},
ri_container: {}, ri_container: {},
model_cont: {}, model_cont: {},
// other right
cont_other_cont: {}, cont_other_cont: {},
cont_other_list: {}, cont_other_list: {},
oth_container: {}, oth_container: {},
......
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image,
ScrollView
} from 'react-native';
import {
first_text_color,
third_text_size,
second_text_color,
pxSize,
foundation_color,
promary_color
} from '../../../../base/BaseStyle';
class TopTabBar extends Component {
constructor(props) {
super(props);
this.state = {
}
}
// 返回自定义 bar 元素
renderTabOption(barItem, index) {
// ScrollableTabView默认传递的属性值,即跳转方法
// console.warn('top_tab_----', this.props)
// console.warn('barItem, index----', barItem, index)
let {activeTab, tabNames, goToPage, imgTabArr, textStyle, activeTextColor} = this.props
console.warn(activeTab, index, 'hh')
return (
<TouchableOpacity
activeOpacity={.8}
key={barItem}
onPress={() => goToPage(index)}
style={[styles.bar_box, activeTab == index ? styles.bar_box_act : '']}
>
<View style={styles.img_box}>
<Image source={imgTabArr[index]} style={styles.img_inner}/>
</View>
<Text style={[textStyle, activeTab == index ? activeTextColor : '']}>{barItem}</Text>
</TouchableOpacity>
)
}
render() {
let {style, tabs} = this.props
console.warn('hhhhh', tabs)
console.warn(this.props)
return (
<View style={[styles.bar_cont, style]}>
<ScrollView
style={styles.top_scroll_cont}
horizontal={true}
showsHorizontalScrollIndicator={false}
>
{
this.props.tabs.map((tab, index) => this.renderTabOption(tab, index))
}
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
bar_cont: {
backgroundColor: foundation_color,
borderBottomColor: '#F4F4F4',
borderBottomWidth: 1,
flexDirection: 'row',
height: 76,
paddingHorizontal: 20
},
top_scroll_cont: {
},
tab: {
},
bar_box: {
flex: 1,
alignItems: 'center',
justifyContent: 'flex-start',
// paddingBottom: 10,
borderBottomWidth: 2,
borderBottomColor: foundation_color,
width: 58,
marginRight: 8
},
bar_box_act: {
borderBottomWidth: 2,
borderBottomColor: promary_color
},
img_box: {
width: pxSize(30),
height: pxSize(30)
},
img_inner: {
width: '100%',
height: '100%'
},
tit_text: {
paddingTop: 10,
paddingBottom: 16,
color: second_text_color,
fontSize: third_text_size
},
tit_text_act: {
color: first_text_color,
fontWeight: 'bold'
}
})
export default TopTabBar;
\ No newline at end of file
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image,
ScrollView
} from 'react-native';
import {
first_text_color,
third_text_size,
second_text_color,
pxSize,
foundation_color,
promary_color
} from '../../../../base/BaseStyle';
class TopTabBar extends Component {
constructor(props) {
super(props);
this.state = {
}
}
// 返回自定义 bar 元素
renderTabOption(barItem, index) {
// ScrollableTabView默认传递的属性值,即跳转方法
// console.warn('top_tab_----', this.props)
// console.warn('barItem, index----', barItem, index)
let {activeTab, tabNames, goToPage, imgTabArr, textStyle, activeTextColor} = this.props
// console.warn(activeTab, index, 'hh')
return (
<TouchableOpacity
activeOpacity={.8}
key={barItem}
onPress={() => goToPage(index)}
style={[styles.bar_box, activeTab == index ? styles.bar_box_act : '']}
>
<View style={styles.img_box}>
<Image source={imgTabArr[index]} style={styles.img_inner}/>
</View>
<Text style={[textStyle, activeTab == index ? activeTextColor : '']}>{barItem}</Text>
</TouchableOpacity>
)
}
render() {
let {style, tabs} = this.props
// console.warn('hhhhh', tabs)
// console.warn(this.props)
return (
<View style={[styles.bar_cont, style]}>
<ScrollView
style={styles.top_scroll_cont}
horizontal={true}
showsHorizontalScrollIndicator={false}
>
{
this.props.tabs.map((tab, index) => this.renderTabOption(tab, index))
}
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
bar_cont: {
backgroundColor: foundation_color,
borderBottomColor: '#F4F4F4',
borderBottomWidth: 1,
flexDirection: 'row',
height: 76,
paddingHorizontal: 20
},
top_scroll_cont: {
},
tab: {
},
bar_box: {
flex: 1,
alignItems: 'center',
justifyContent: 'flex-start',
// paddingBottom: 10,
borderBottomWidth: 2,
borderBottomColor: foundation_color,
width: 58,
marginRight: 8
},
bar_box_act: {
borderBottomWidth: 2,
borderBottomColor: promary_color
},
img_box: {
width: pxSize(30),
height: pxSize(30)
},
img_inner: {
width: '100%',
height: '100%'
},
tit_text: {
paddingTop: 10,
paddingBottom: 16,
color: second_text_color,
fontSize: third_text_size
},
tit_text_act: {
color: first_text_color,
fontWeight: 'bold'
}
})
export default TopTabBar;
\ No newline at end of file
/**
* 本地接口测试数据
*/
const local_photos = ['files/20200731/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20200731113857_1596166761793_1596184849964.jpg', const local_photos = ['files/20200731/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20200731113857_1596166761793_1596184849964.jpg',
'files/20200921/5_1599645385381_1600672374371.jpg', 'files/20200921/5_1599645385381_1600672374371.jpg',
'files/20200921/4_1599645381425_1600672375091.jpg', 'files/20200921/4_1599645381425_1600672375091.jpg',
......
export default [
{
isRequest: true,
title: '销售员',
value: '易凯源',
isPicker: false,
isEditText: true
},
{
isRequest: true,
title: '组织',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '客户名称',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '收单地点',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '收货地点',
value: '请选择',
isPicker: true
},
{
isRequest: false,
title: '主治医生',
value: '请选择',
isPicker: true,
showInput: true
},
{
isRequest: false,
title: '手术名称',
value: '请输入',
isPicker: false
},
{
isRequest: false,
title: '手术时间',
value: '请选择',
isPicker: true,
showDatePicker: true
},
{
isRequest: true,
title: '手术类型',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '订单类型',
value: '请选择',
isPicker: true
},
{
isRequest: true,
title: '选择产品',
value: '请选择',
isPicker: true,
showItemPage: true
}
]
\ No newline at end of file
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