Commit 3f1a84e8 by Denglingling

完善自助下单提交接口需要的数据

(cherry picked from commit affd9956)
parent 24750fcd
...@@ -223,35 +223,35 @@ export function requestSelfSumbit({access_token, ...params}) { ...@@ -223,35 +223,35 @@ export function requestSelfSumbit({access_token, ...params}) {
// 选择产品-供应商信息查询接口 // 选择产品-供应商信息查询接口
export const reqPurSupplierSearch = async (global_domain_config, params) => { export const reqPurSupplierSearch = async (global_domain_config, params) => {
// return local_inter_mock.inter_1 return local_inter_mock.inter_1
return await GetRequest(global_domain_config, getUrlParams('/order/pur_supplier/search', params)) return await GetRequest(global_domain_config, getUrlParams('/order/pur_supplier/search', params))
} }
// 选择产品-产品信息分类查询接口 // 选择产品-产品信息分类查询接口
export const reqProCategorySearch = async (global_domain_config, params) => { export const reqProCategorySearch = async (global_domain_config, params) => {
// return local_inter_mock.inter_2 return local_inter_mock.inter_2
return await GetRequest(global_domain_config, getUrlParams('/order/item/search', params)) return await GetRequest(global_domain_config, getUrlParams('/order/item/search', params))
} }
// 选择产品-手术模板头查询接口 // 选择产品-手术模板头查询接口
export const reqSurTempHeadSearch = async (global_domain_config, params) => { export const reqSurTempHeadSearch = async (global_domain_config, params) => {
// return local_inter_mock.inter_3 return local_inter_mock.inter_3
return await GetRequest(global_domain_config, getUrlParams('/surgery/template_header/search', params)) return await GetRequest(global_domain_config, getUrlParams('/surgery/template_header/search', params))
} }
// 选择产品-手术模板行查询接口 // 选择产品-手术模板行查询接口
export const reqSurTempLineSearch = async (global_domain_config, params) => { export const reqSurTempLineSearch = async (global_domain_config, params) => {
// return local_inter_mock.inter_4 return local_inter_mock.inter_4
return await GetRequest(global_domain_config, getUrlParams('/surgery/template_line/search', params)) return await GetRequest(global_domain_config, getUrlParams('/surgery/template_line/search', params))
} }
// 选择产品-螺钉盒(器械包)头查询接口 // 选择产品-螺钉盒(器械包)头查询接口
export const reqNailEquipHeadSearch = async (global_domain_config, params) => { export const reqNailEquipHeadSearch = async (global_domain_config, params) => {
// if(params.category_code === '1301'){ if(params.category_code === '1301'){
// return local_inter_mock.inter_5 return local_inter_mock.inter_5
// }else { }else {
// return local_inter_mock.inter_55 return local_inter_mock.inter_55
// } }
return await GetRequest(global_domain_config, getUrlParams('/inventory/item_package_header/search', params)) return await GetRequest(global_domain_config, getUrlParams('/inventory/item_package_header/search', params))
} }
...@@ -272,7 +272,7 @@ export const reqEquipPackageLineSearch = async (global_domain_config, params) => ...@@ -272,7 +272,7 @@ export const reqEquipPackageLineSearch = async (global_domain_config, params) =>
// 选择产品-零散器械查询接口 // 选择产品-零散器械查询接口
export const reqScatEquipmentSearch = async (global_domain_config, params) => { export const reqScatEquipmentSearch = async (global_domain_config, params) => {
// return local_inter_mock.inter_8 return local_inter_mock.inter_8
return await GetRequest(global_domain_config, getUrlParams('/order/tool/search', params)) return await GetRequest(global_domain_config, getUrlParams('/order/tool/search', params))
} }
......
/**
* 自助下单-本地常用变量名
*/
export default class LocalVariable {
/**
* 计算数量的字段名
*/
static QUANTITY_FIELD = 'quantity'
/**
* 显示的子类数组名
*/
static CHILDREN_LINE_NAME = 'childrenLineData'
/**
* 外层已选数量字段名
*/
static SELECTED_QUQNTITY = 'selectedQuantity'
/**
* 外层已选数组名
*/
static SELECTED_DATA_ARR = 'selectedDataArr'
/**
* 中类原本元素
*/
static LOCAL_SECOND_DATA = 'localSecondData'
/**
* 只有两级的耗材
*/
static ONLY_TWO_LEVELS = 'onlyTwoLevels'
/**
* 三级原本元素
*/
static LOCAL_THRID_CONT_DATA = 'localThridContData'
/**
* 最终子类数组名
*/
static LINE_OPTIONS = 'lineOptions'
/**
* 已选展示父级标题名
*/
static SUPER_TITLE_NAME = 'super_title_name'
/**
* 已选展示父级提示名
*/
static SUPER_TITLE_TIP = 'super_title_tip'
/**
* 计划数量名
*/
static PLAN_QUANTITY = 'plan_quantity'
/**
* 手术模板名
*/
static SURGICAL_TEMPLATE = 'surg_temp'
/**
* 钉盒名
*/
static NAIL_BOX = 'screw_box'
/**
* 器械包名
*/
static EQUIPMENT_BAG = 'equip_bag'
/**
* 零散器械名
*/
static SCATTERED_EQUIPMENT = 'auxili_tool'
/**
* 单选耗材名
*/
static SIGN_SELECT_CONSUMABLES = 'sign_consu'
}
\ No newline at end of file
...@@ -40,6 +40,7 @@ class ChooseCardList extends Component { ...@@ -40,6 +40,7 @@ class ChooseCardList extends Component {
cardCouStyle: PropTypes.object, // 指定计数样式 cardCouStyle: PropTypes.object, // 指定计数样式
cardShowDefIcon: PropTypes.bool, // 是否显示默认无图 cardShowDefIcon: PropTypes.bool, // 是否显示默认无图
cardKeyName: PropTypes.string, // 关键key值
} }
...@@ -54,7 +55,7 @@ class ChooseCardList extends Component { ...@@ -54,7 +55,7 @@ class ChooseCardList extends Component {
render() { render() {
let {cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox, cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardImgName, let {cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox, cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardImgName,
cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardCountName, cardStyleType, cardCouStyle, cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardCountName, cardStyleType, cardCouStyle,
global_domain_config, cardShowDefIcon } = this.props global_domain_config, cardShowDefIcon, cardKeyName } = this.props
let {countStyleType} = this.state let {countStyleType} = this.state
...@@ -82,7 +83,7 @@ class ChooseCardList extends Component { ...@@ -82,7 +83,7 @@ class ChooseCardList extends Component {
item[cardItemIcon] = {uri: global_domain_config+'/jeecg-boot/sys/common/view/'+item[cardItemIcon][0]} // 正式 item[cardItemIcon] = {uri: global_domain_config+'/jeecg-boot/sys/common/view/'+item[cardItemIcon][0]} // 正式
} }
return <View style={styles.card_list_box}> return <View style={styles.card_list_box} key={'choose_card'+index}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={.8}
style={styles.list_touch_cont} style={styles.list_touch_cont}
......
...@@ -37,7 +37,7 @@ class TipInfoNeedSelect extends Component { ...@@ -37,7 +37,7 @@ class TipInfoNeedSelect extends Component {
super(props); super(props);
this.state = { this.state = {
isVisible: false, isVisible: false,
title: '愿意自动更换器械包?' title: '同意自动更换同品不同器械包?'
} }
} }
...@@ -86,14 +86,14 @@ class TipInfoNeedSelect extends Component { ...@@ -86,14 +86,14 @@ class TipInfoNeedSelect extends Component {
onPress={() => this.closeModal()} onPress={() => this.closeModal()}
style={[styles.foo_btn, styles.btn_cel]} style={[styles.foo_btn, styles.btn_cel]}
> >
<Text style={[styles.btn_tit, styles.tit_cel]}>取消</Text> <Text style={[styles.btn_tit, styles.tit_cel]}></Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={.8}
onPress={() => this.submitModal()} onPress={() => this.submitModal()}
style={[styles.foo_btn, styles.btn_sub]} style={[styles.foo_btn, styles.btn_sub]}
> >
<Text style={styles.btn_tit}>确定</Text> <Text style={styles.btn_tit}></Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</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, DeviceEventEmitter } 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 { import {
AsteriskTextStyle, AsteriskTextStyle,
...@@ -25,8 +25,11 @@ import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE ...@@ -25,8 +25,11 @@ import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE
import PageListArrow from '../common/listDataComponent/PageListArrow'; import PageListArrow from '../common/listDataComponent/PageListArrow';
import EmitterEvents from '../common/EmitterEvents'; import EmitterEvents from '../common/EmitterEvents';
import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect'; import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect';
import LocalVariable from '../common/LocalVariable';
const SELECTED_QUQNTITY = 'selectedQuantity' 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) {
...@@ -101,7 +104,11 @@ class SelfOrderPage extends Component { ...@@ -101,7 +104,11 @@ class SelfOrderPage extends Component {
"id": "10", "id": "10",
title: '选择产品', title: '选择产品',
name: '请选择', name: '请选择',
value: '' value: '',
lines: [],
sub_lines: [],
replace_item_flag: 'N', // 器械包
take_cert_flag: 'N' // 合格证
}, },
{ {
"id": "11", "id": "11",
...@@ -159,9 +166,9 @@ class SelfOrderPage extends Component { ...@@ -159,9 +166,9 @@ class SelfOrderPage extends Component {
stop: false, //录音是否停止 stop: false, //录音是否停止
currentTime: 0, //录音时长 currentTime: 0, //录音时长
localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生 localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生
local_tip:{ local_tip: {
will: 'N', // 器械包 replace_item_flag: 'N', // 器械包
take_cert: 'N' // 合格证 take_cert_flag: 'N' // 合格证
} }
} }
} }
...@@ -184,7 +191,7 @@ class SelfOrderPage extends Component { ...@@ -184,7 +191,7 @@ class SelfOrderPage extends Component {
this.setState({ this.setState({
subInitListOption: cloneObject(listOptionData) // 存储初始化数据,提交成功后赋此值 subInitListOption: cloneObject(listOptionData) // 存储初始化数据,提交成功后赋此值
}) })
if(state.listOptionData[0].name !== props.userInfo.person_name) { if (state.listOptionData[0].name !== props.userInfo.person_name) {
listOptionData[0].name = props.userInfo.person_name listOptionData[0].name = props.userInfo.person_name
listOptionData[0].value = props.userInfo.user_name listOptionData[0].value = props.userInfo.user_name
this.setState({ this.setState({
...@@ -199,15 +206,15 @@ class SelfOrderPage extends Component { ...@@ -199,15 +206,15 @@ class SelfOrderPage extends Component {
AudioRecorder.requestAuthorization() AudioRecorder.requestAuthorization()
.then(isAuthor => { .then(isAuthor => {
console.log('是否授权: ' + isAuthor) console.log('是否授权: ' + isAuthor)
if(!isAuthor) { if (!isAuthor) {
// return alert('APP需要使用录音,请打开录音权限允许APP使用') // return alert('APP需要使用录音,请打开录音权限允许APP使用')
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{ return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
text: '设置', text: '设置',
onPress: () => { onPress: () => {
if(Platform.OS == 'ios') { if (Platform.OS == 'ios') {
Linking.openURL('app-settings:') Linking.openURL('app-settings:')
.catch(err => console.log('error', err)) .catch(err => console.log('error', err))
} else if(Platform.OS == 'android') { } else if (Platform.OS == 'android') {
NativeModules.OpenSettings.openNetworkSettings(data => { NativeModules.OpenSettings.openNetworkSettings(data => {
console.log('call back data', data) console.log('call back data', data)
}).catch(err => console.log('android---', err)) }).catch(err => console.log('android---', err))
...@@ -217,7 +224,7 @@ class SelfOrderPage extends Component { ...@@ -217,7 +224,7 @@ class SelfOrderPage extends Component {
text: '取消', text: '取消',
}]) }])
} }
this.setState({hasPermission: isAuthor}) this.setState({ hasPermission: isAuthor })
this.prepareRecordingPath(this.state.audioPath); this.prepareRecordingPath(this.state.audioPath);
// 录音进展 // 录音进展
AudioRecorder.onProgress = (data) => { AudioRecorder.onProgress = (data) => {
...@@ -252,7 +259,7 @@ class SelfOrderPage extends Component { ...@@ -252,7 +259,7 @@ class SelfOrderPage extends Component {
IncludeBase64: true, //是否是base64格式 IncludeBase64: true, //是否是base64格式
AudioSource: 0, //音频源 AudioSource: 0, //音频源
} }
AudioRecorder.prepareRecordingAtPath(path,option) AudioRecorder.prepareRecordingAtPath(path, option)
} }
// 开始录音 // 开始录音
...@@ -278,14 +285,14 @@ class SelfOrderPage extends Component { ...@@ -278,14 +285,14 @@ class SelfOrderPage extends Component {
// console.log(err) // console.log(err)
// } // }
if(!this.state.hasPermission) { if (!this.state.hasPermission) {
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{ return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
text: '设置', text: '设置',
onPress: () => { onPress: () => {
if(Platform.OS == 'ios') { if (Platform.OS == 'ios') {
Linking.openURL('app-settings:') Linking.openURL('app-settings:')
.catch(err => console.log('error', err)) .catch(err => console.log('error', err))
} else if(Platform.OS == 'android') { } else if (Platform.OS == 'android') {
NativeModules.OpenSettings.openNetworkSettings(data => { NativeModules.OpenSettings.openNetworkSettings(data => {
console.log('call back data', data) console.log('call back data', data)
}).catch(err => console.log('android---', err)) }).catch(err => console.log('android---', err))
...@@ -297,7 +304,7 @@ class SelfOrderPage extends Component { ...@@ -297,7 +304,7 @@ class SelfOrderPage extends Component {
// return // return
} }
show('录音开始') show('录音开始')
if(this.state.stop) { if (this.state.stop) {
// 初始化录音 // 初始化录音
this.prepareRecordingPath(this.state.audioPath) this.prepareRecordingPath(this.state.audioPath)
} }
...@@ -311,7 +318,7 @@ class SelfOrderPage extends Component { ...@@ -311,7 +318,7 @@ class SelfOrderPage extends Component {
// 停止录音 // 停止录音
_stop = async () => { _stop = async () => {
console.log('----停止录音---', this.state.hasPermission) console.log('----停止录音---', this.state.hasPermission)
if(!this.state.hasPermission) { if (!this.state.hasPermission) {
return return
// return alert('没有授权') // return alert('没有授权')
} }
...@@ -338,14 +345,14 @@ class SelfOrderPage extends Component { ...@@ -338,14 +345,14 @@ class SelfOrderPage extends Component {
let self = this let self = this
show('正在播放') show('正在播放')
self.whoosh = new Sound(this.state.audioPath, '', (err) => { self.whoosh = new Sound(this.state.audioPath, '', (err) => {
if(err) { if (err) {
show('加载音频失败') show('加载音频失败')
return console.log('加载音频失败-->',err) return console.log('加载音频失败-->', err)
} }
self.whoosh.play(success => { self.whoosh.play(success => {
if(success) { if (success) {
show('播放完毕') show('播放完毕')
}else { } else {
show('播放失败') show('播放失败')
console.log('fail - 播放失败') console.log('fail - 播放失败')
} }
...@@ -381,7 +388,7 @@ class SelfOrderPage extends Component { ...@@ -381,7 +388,7 @@ class SelfOrderPage extends Component {
_del = async () => { _del = async () => {
// 初始化录音 // 初始化录音
this.prepareRecordingPath(this.state.audioPath) this.prepareRecordingPath(this.state.audioPath)
let {listOptionData} = this.state let { listOptionData } = this.state
listOptionData[12].value = '' listOptionData[12].value = ''
this.setState({ this.setState({
currentTime: 0, currentTime: 0,
...@@ -391,9 +398,9 @@ class SelfOrderPage extends Component { ...@@ -391,9 +398,9 @@ class SelfOrderPage extends Component {
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
let { self_list_status, loginState, navigation, submit_self_order_status} = this.props let { self_list_status, loginState, navigation, submit_self_order_status } = this.props
let self = this let self = 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) {
case SELF_ORDER_LIST_DOING: case SELF_ORDER_LIST_DOING:
this.changeSubLoding(true) this.changeSubLoding(true)
...@@ -402,7 +409,7 @@ class SelfOrderPage extends Component { ...@@ -402,7 +409,7 @@ class SelfOrderPage extends Component {
self.setState({ self.setState({
isSubLoding: false, isSubLoding: false,
lodingTitle: '加载中' lodingTitle: '加载中'
},() => { }, () => {
self.changeCurrentOption() self.changeCurrentOption()
}) })
break; break;
...@@ -413,8 +420,8 @@ class SelfOrderPage extends Component { ...@@ -413,8 +420,8 @@ class SelfOrderPage extends Component {
break; break;
} }
} }
if(loginState != nextProps.loginState) { if (loginState != nextProps.loginState) {
switch(nextProps.loginState) { switch (nextProps.loginState) {
case LOGIN_NO: case LOGIN_NO:
navigation.navigate('LoginPage') navigation.navigate('LoginPage')
break; break;
...@@ -422,7 +429,7 @@ class SelfOrderPage extends Component { ...@@ -422,7 +429,7 @@ class SelfOrderPage extends Component {
break; break;
} }
} }
if(submit_self_order_status != nextProps.submit_self_order_status) { if (submit_self_order_status != nextProps.submit_self_order_status) {
switch (nextProps.submit_self_order_status) { switch (nextProps.submit_self_order_status) {
case SELF_SUBMIT_DOING: case SELF_SUBMIT_DOING:
this.changeSubLoding(true, '提交中') this.changeSubLoding(true, '提交中')
...@@ -431,7 +438,7 @@ class SelfOrderPage extends Component { ...@@ -431,7 +438,7 @@ class SelfOrderPage extends Component {
self.setState({ self.setState({
isSubLoding: false, isSubLoding: false,
lodingTitle: '提交中' lodingTitle: '提交中'
},() => { }, () => {
self.processReturnData() self.processReturnData()
}) })
break; break;
...@@ -478,19 +485,19 @@ class SelfOrderPage extends Component { ...@@ -478,19 +485,19 @@ class SelfOrderPage extends Component {
let that = this let that = this
this.setState({ this.setState({
listOptionData: listOptionData.map((item, index) => { listOptionData: listOptionData.map((item, index) => {
if(index > curIndex && index < 12 ) { if (index > curIndex && index < 12) {
item.name = localOtherObj.name item.name = localOtherObj.name
item.value = localOtherObj.value item.value = localOtherObj.value
if(listOptionData[1].value && item.title == '客户名称') { if (listOptionData[1].value && item.title == '客户名称') {
that.organizationGetCustomerData() that.organizationGetCustomerData()
} }
if(listOptionData[2].value && item.title == '收单地点') { if (listOptionData[2].value && item.title == '收单地点') {
that.customerGetBill() that.customerGetBill()
} }
if(listOptionData[2].value && item.title == '收货地点') { if (listOptionData[2].value && item.title == '收货地点') {
that.customerGetShip() that.customerGetShip()
} }
if(item.title == '主治医生') { if (item.title == '主治医生') {
item.showInput = false, item.showInput = false,
item.inputValue = '' item.inputValue = ''
} }
...@@ -505,21 +512,21 @@ class SelfOrderPage extends Component { ...@@ -505,21 +512,21 @@ class SelfOrderPage extends Component {
let { listOptionData } = this.state let { listOptionData } = this.state
let tempStatus = false let tempStatus = false
let tempTit = '' let tempTit = ''
for(let chIndex in listOptionData) { for (let chIndex in listOptionData) {
// if(chIndex > 0 && chIndex < 10 if(chIndex > 0 && chIndex < 11
// && chIndex != 6 && chIndex != 8 && !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
// } }
} }
this.setState({ this.setState({
canSubFlag: !tempStatus canSubFlag: !tempStatus
}) })
if(isSubCheck && tempStatus) { if (isSubCheck && tempStatus) {
show(`${tempTit}未选择,不能提交`) show(`${tempTit}未选择,不能提交`)
} }
} }
...@@ -527,20 +534,20 @@ class SelfOrderPage extends Component { ...@@ -527,20 +534,20 @@ class SelfOrderPage extends Component {
// 选择器弹窗回调函数 // 选择器弹窗回调函数
handleCallBack(item, itemTitle) { handleCallBack(item, itemTitle) {
// console.log('选择器弹窗回调函数-----',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) {
if(chItem.title === itemTitle) { if (chItem.title === itemTitle) {
chItem.name = item.name chItem.name = item.name
chItem.value = item.value chItem.value = item.value
if(itemTitle === '组织') { if (itemTitle === '组织') {
self.clearInitNameAndValue(1) self.clearInitNameAndValue(1)
} }
if(itemTitle === '客户名称') { if (itemTitle === '客户名称') {
self.clearInitNameAndValue(2) self.clearInitNameAndValue(2)
} }
if (itemTitle === '主治医生') { if (itemTitle === '主治医生') {
if(item.name === '其他') { if (item.name === '其他') {
chItem.showInput = true chItem.showInput = true
} else { } else {
chItem.showInput = false chItem.showInput = false
...@@ -548,7 +555,7 @@ class SelfOrderPage extends Component { ...@@ -548,7 +555,7 @@ class SelfOrderPage extends Component {
} }
self.clearInitNameAndValue(5) self.clearInitNameAndValue(5)
} }
if(itemTitle === '手术类型') { if (itemTitle === '手术类型') {
self.clearInitNameAndValue(8) self.clearInitNameAndValue(8)
} }
} }
...@@ -556,7 +563,7 @@ class SelfOrderPage extends Component { ...@@ -556,7 +563,7 @@ class SelfOrderPage extends Component {
this.setState({ this.setState({
currentItem: item, currentItem: item,
listOptionData: listOptionData listOptionData: listOptionData
},() => { }, () => {
self.changeCanSub() self.changeCanSub()
}) })
} }
...@@ -574,7 +581,7 @@ class SelfOrderPage extends Component { ...@@ -574,7 +581,7 @@ class SelfOrderPage extends Component {
let { selfOrderOption } = this.props let { selfOrderOption } = this.props
let tempOption = [] let tempOption = []
let that = this let that = this
if(selfOrderOption.length === 0) { if (selfOrderOption.length === 0) {
show(`当前${currentTitle}为空`) show(`当前${currentTitle}为空`)
return return
} }
...@@ -587,7 +594,7 @@ class SelfOrderPage extends Component { ...@@ -587,7 +594,7 @@ class SelfOrderPage extends Component {
// 去重医院数据 // 去重医院数据
let filterOpt = dedupQuoteArray(selfOrderOption, 'customer_code') let filterOpt = dedupQuoteArray(selfOrderOption, 'customer_code')
let currentArr = [] let currentArr = []
if(filterOpt.length) { if (filterOpt.length) {
filterOpt.forEach(item => { filterOpt.forEach(item => {
let obj = {} let obj = {}
obj.customer_code = item.customer_code obj.customer_code = item.customer_code
...@@ -605,7 +612,7 @@ class SelfOrderPage extends Component { ...@@ -605,7 +612,7 @@ class SelfOrderPage extends Component {
resultArr.push(obj) resultArr.push(obj)
}) })
tempOption = [...resultArr] tempOption = [...resultArr]
}else if (currentTitle === '订单类型') { } else if (currentTitle === '订单类型') {
tempOption = this.changeNameAndValue(selfOrderOption, 'value_name', 'value_code') tempOption = this.changeNameAndValue(selfOrderOption, 'value_name', 'value_code')
} }
this.setState({ this.setState({
...@@ -780,7 +787,7 @@ class SelfOrderPage extends Component { ...@@ -780,7 +787,7 @@ class SelfOrderPage extends Component {
handleCustomerCheck(curData) { handleCustomerCheck(curData) {
// let { state, props } = this // let { state, props } = this
let self = this let self = this
if(this.judgeOrgIsNull()) { if (this.judgeOrgIsNull()) {
self.setState({ self.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
...@@ -829,15 +836,15 @@ class SelfOrderPage extends Component { ...@@ -829,15 +836,15 @@ class SelfOrderPage extends Component {
let that = this let that = this
let { global_domain_config } = props let { global_domain_config } = props
let cusResult = await reqSelfSurgeryHospital(global_domain_config, params); let cusResult = await reqSelfSurgeryHospital(global_domain_config, params);
if(cusResult.error_code == 0) { if (cusResult.error_code == 0) {
let { data: { customers } } = cusResult let { data: { customers } } = cusResult
props.requestListDataSuccess(customers) props.requestListDataSuccess(customers)
let filterOpt = dedupQuoteArray(customers, 'customer_code') let filterOpt = dedupQuoteArray(customers, 'customer_code')
if(filterOpt.length === 0) { if (filterOpt.length === 0) {
show(`当前客户名称为空`) show(`当前客户名称为空`)
return return
} }
if(filterOpt.length === 1) { if (filterOpt.length === 1) {
let { listOptionData } = state let { listOptionData } = state
listOptionData[2].name = filterOpt[0].customer_name listOptionData[2].name = filterOpt[0].customer_name
listOptionData[2].value = filterOpt[0].customer_code listOptionData[2].value = filterOpt[0].customer_code
...@@ -849,7 +856,7 @@ class SelfOrderPage extends Component { ...@@ -849,7 +856,7 @@ class SelfOrderPage extends Component {
that.customerGetShip() that.customerGetShip()
}) })
} }
} else if(cusResult.error_code == 41006) { } else if (cusResult.error_code == 41006) {
show('登录过期,请重新登录'); show('登录过期,请重新登录');
props.exitLoginStatus(); props.exitLoginStatus();
} else { } else {
...@@ -862,7 +869,7 @@ class SelfOrderPage extends Component { ...@@ -862,7 +869,7 @@ class SelfOrderPage extends Component {
handleBillCheck(curData) { handleBillCheck(curData) {
let { localCustomersOption, listOptionData } = this.state let { localCustomersOption, listOptionData } = this.state
let self = this let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({ self.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
...@@ -871,9 +878,9 @@ class SelfOrderPage extends Component { ...@@ -871,9 +878,9 @@ class SelfOrderPage extends Component {
} }
}, () => { }, () => {
let tempOption = [] let tempOption = []
if( localCustomersOption.length ) { if (localCustomersOption.length) {
localCustomersOption.forEach((item) => { localCustomersOption.forEach((item) => {
if(item.customer_code === listOptionData[2].value) { if (item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的地点 // 保证是当前客户名称下的地点
let obj = {} let obj = {}
obj.value = item.bill_to_site_code obj.value = item.bill_to_site_code
...@@ -909,11 +916,11 @@ class SelfOrderPage extends Component { ...@@ -909,11 +916,11 @@ class SelfOrderPage extends Component {
let that = this let that = this
let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value) let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value)
tempLocalOption = dedupQuoteArray(tempLocalOption, 'bill_to_site_code') tempLocalOption = dedupQuoteArray(tempLocalOption, 'bill_to_site_code')
if(tempLocalOption.length === 0) { if (tempLocalOption.length === 0) {
show(`当前收单地点为空`) show(`当前收单地点为空`)
return return
} }
if(tempLocalOption.length === 1) { if (tempLocalOption.length === 1) {
listOptionData[3].name = tempLocalOption[0].bill_to_site_name listOptionData[3].name = tempLocalOption[0].bill_to_site_name
listOptionData[3].value = tempLocalOption[0].bill_to_site_code listOptionData[3].value = tempLocalOption[0].bill_to_site_code
that.setState({ that.setState({
...@@ -926,7 +933,7 @@ class SelfOrderPage extends Component { ...@@ -926,7 +933,7 @@ class SelfOrderPage extends Component {
handleShipCheck(curData) { handleShipCheck(curData) {
let { localCustomersOption, listOptionData } = this.state let { localCustomersOption, listOptionData } = this.state
let self = this let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({ self.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
...@@ -935,9 +942,9 @@ class SelfOrderPage extends Component { ...@@ -935,9 +942,9 @@ class SelfOrderPage extends Component {
} }
}, () => { }, () => {
let tempOption = [] let tempOption = []
if( localCustomersOption.length ) { if (localCustomersOption.length) {
localCustomersOption.forEach((item, index) => { localCustomersOption.forEach((item, index) => {
if(item.customer_code === listOptionData[2].value) { if (item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的地点 // 保证是当前客户名称下的地点
let obj = {} let obj = {}
obj.value = item.ship_to_site_code obj.value = item.ship_to_site_code
...@@ -973,11 +980,11 @@ class SelfOrderPage extends Component { ...@@ -973,11 +980,11 @@ class SelfOrderPage extends Component {
let that = this let that = this
let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value) let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value)
tempLocalOption = dedupQuoteArray(tempLocalOption, 'ship_to_site_code') tempLocalOption = dedupQuoteArray(tempLocalOption, 'ship_to_site_code')
if(tempLocalOption.length === 0) { if (tempLocalOption.length === 0) {
show(`当前收货地点为空`) show(`当前收货地点为空`)
return return
} }
if(tempLocalOption.length === 1) { if (tempLocalOption.length === 1) {
listOptionData[4].name = tempLocalOption[0].ship_to_site_name listOptionData[4].name = tempLocalOption[0].ship_to_site_name
listOptionData[4].value = tempLocalOption[0].ship_to_site_code listOptionData[4].value = tempLocalOption[0].ship_to_site_code
that.setState({ that.setState({
...@@ -990,7 +997,7 @@ class SelfOrderPage extends Component { ...@@ -990,7 +997,7 @@ class SelfOrderPage extends Component {
handleDoctorCheck(curData) { handleDoctorCheck(curData) {
let { localCustomersOption, listOptionData } = this.state let { localCustomersOption, listOptionData } = this.state
let self = this let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
// 点击 // 点击
self.setState({ self.setState({
currentTitle: curData.title, currentTitle: curData.title,
...@@ -1000,9 +1007,9 @@ class SelfOrderPage extends Component { ...@@ -1000,9 +1007,9 @@ class SelfOrderPage extends Component {
} }
}, () => { }, () => {
let tempOption = [] let tempOption = []
if( localCustomersOption.length ) { if (localCustomersOption.length) {
localCustomersOption.forEach((item) => { localCustomersOption.forEach((item) => {
if(item.customer_code === listOptionData[2].value) { if (item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的医生 // 保证是当前客户名称下的医生
let obj = {} let obj = {}
obj.value = item.customer_doctor obj.value = item.customer_doctor
...@@ -1056,29 +1063,29 @@ class SelfOrderPage extends Component { ...@@ -1056,29 +1063,29 @@ class SelfOrderPage extends Component {
// 主治医生 输入 // 主治医生 输入
handleDoctorInput(text, curData) { handleDoctorInput(text, 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) {
item.inputValue = text item.inputValue = text
} }
}) })
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
}) })
console.log('手术名称---',text, curData,listOptionData[5]) console.log('手术名称---', text, curData, listOptionData[5])
} }
// 手术名称 输入 // 手术名称 输入
handleSurNameInput(text, curData) { handleSurNameInput(text, 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) {
item.value = text item.value = text
} }
}) })
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
}) })
console.log('手术名称---',text, curData,listOptionData[6]) console.log('手术名称---', text, curData, listOptionData[6])
} }
// 手术时间 点击 2020-04-23 17:41 // 手术时间 点击 2020-04-23 17:41
...@@ -1086,9 +1093,9 @@ class SelfOrderPage extends Component { ...@@ -1086,9 +1093,9 @@ class SelfOrderPage extends Component {
console.log('手术时间 点击 ===', curData) console.log('手术时间 点击 ===', curData)
let { listOptionData } = this.state let { listOptionData } = this.state
let date = curData.value let date = curData.value
if(date) { if (date) {
listOptionData.map(function(item) { listOptionData.map(function (item) {
if(item.title === curData.title) { if (item.title === curData.title) {
item.dateValue = formatStrForDate(date) item.dateValue = formatStrForDate(date)
} }
}) })
...@@ -1108,10 +1115,10 @@ class SelfOrderPage extends Component { ...@@ -1108,10 +1115,10 @@ class SelfOrderPage extends Component {
// 修改当前日期数据 // 修改当前日期数据
dateModalCallback(date, curData) { dateModalCallback(date, curData) {
console.log('修改当前日期数据:',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) {
item.name = date item.name = date
item.value = date item.value = date
item.dateValue = formatStrForDate(date) item.dateValue = formatStrForDate(date)
...@@ -1127,7 +1134,7 @@ class SelfOrderPage extends Component { ...@@ -1127,7 +1134,7 @@ class SelfOrderPage extends Component {
handleSurTypeCheck(curData) { handleSurTypeCheck(curData) {
let { props } = this let { props } = this
let self = this let self = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
self.setState({ self.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
...@@ -1161,7 +1168,7 @@ class SelfOrderPage extends Component { ...@@ -1161,7 +1168,7 @@ class SelfOrderPage extends Component {
// 订单类型 点击 // 订单类型 点击
handleOrderCheck(curData) { handleOrderCheck(curData) {
let { state, props } = this let { state, props } = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({ this.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
...@@ -1172,7 +1179,7 @@ class SelfOrderPage extends Component { ...@@ -1172,7 +1179,7 @@ class SelfOrderPage extends Component {
// 在此修改接口 // 在此修改接口
let params = { let params = {
access_token: props.token, access_token: props.token,
value_set_code:'SUR_ORDER_TYPE' value_set_code: 'SUR_ORDER_TYPE'
} }
props.requestSelfOrderType(params) props.requestSelfOrderType(params)
}) })
...@@ -1195,8 +1202,8 @@ class SelfOrderPage extends Component { ...@@ -1195,8 +1202,8 @@ class SelfOrderPage extends Component {
// 选择产品 点击跳转 // 选择产品 点击跳转
handleProductCheck() { handleProductCheck() {
if(this.judgeOrgIsNull()){ if (this.judgeOrgIsNull()) {
let {listOptionData} = this.state let { listOptionData } = this.state
this.props.navigation.navigate('ChooseProductPage', { this.props.navigation.navigate('ChooseProductPage', {
title: `选择产品`, title: `选择产品`,
selfData: { selfData: {
...@@ -1208,127 +1215,250 @@ class SelfOrderPage extends Component { ...@@ -1208,127 +1215,250 @@ class SelfOrderPage extends Component {
// 选择产品 回调 // 选择产品 回调
productCallBack(params) { productCallBack(params) {
let {listOptionData} = this.state let { listOptionData } = this.state
// console.log('选择产品返回=!!!!=', params) // console.log('选择产品返回=!!!!=', params)
// console.log('选择产品返回=!!!!=', this) // console.log('选择产品返回=!!!!=', this)
// console.log('选择产品返回=!!!!=', this.state) // console.log('选择产品返回=!!!!=', this.state)
listOptionData[10].value = '' listOptionData[10].value = '已选'
if(params && params.local_lines) { listOptionData[10].lines = []
if (params && params.local_lines) {
params.local_lines.forEach(loc_item => { params.local_lines.forEach(loc_item => {
if(loc_item[SELECTED_QUQNTITY] > 0){ if (loc_item[SELECTED_QUQNTITY] > 0) {
listOptionData[10].value += `${loc_item.supplier_short_name}x${loc_item[SELECTED_QUQNTITY]} ` listOptionData[10].value += `${loc_item.supplier_short_name}】物料 `
} }
}) })
listOptionData[10].name = listOptionData[10].value listOptionData[10].name = listOptionData[10].value
listOptionData[10].lines = cloneObject(params.local_lines)
} }
// console.log('选择产品返回=!!!=', listOptionData[10]) // console.log('选择产品返回=!!!=', listOptionData[10])
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
},() => {
this.changeCanSub()
}) })
} }
// 备注 输入 // 备注 输入
handleRemarkInput(text, curData) { handleRemarkInput(text, 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) {
item.value = text item.value = text
} }
}) })
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData
}) })
console.log('备注---',listOptionData[11]) console.log('备注---', listOptionData[11])
} }
// 生成订单 点击 // 生成订单 点击
handleSubmit() { async handleSubmit() {
console.log('生成订单', this.props.navigation) console.log('生成订单', this.props.navigation)
let { local_tip, listOptionData } = this.state
this.refs.PackageModel.show() // this.refs.PackageModel.show()
// this.refs.CertModel.show('需要携带合格证?') // this.refs.CertModel.show('需要携带注册证?')
// this.getSumLinesOps()
// this.changeCanSub(true)
// let { state, props } = this
// let that = this
// // 可提交 并且 不处于正在提交中
// if(state.canSubFlag && !state.isSubLoding) {
// // 先提交录音,再提交接口
// if(state.stop) {
// let params = {
// access_token: props.token,
// path: state.audioPath
// }
// let {global_domain_config} = props
// let audioResult = await requestSelfAudio(global_domain_config, params);
// that.changeSubLoding(true, '上传中')
// if(audioResult.error_code == 0) {
// // 提交订单
// that.setState({
// listOptionData: state.listOptionData.map((item, index) => {
// if(index == 11) {
// item.value = audioResult.data.url
// }
// return item
// })
// }, () => {
// that.changeSubLoding(false)
// that.submitSelfOrder()
// })
// } else if(audioResult.error_code == 41006) { this.changeCanSub(true)
// that.changeSubLoding(false) let { state, props } = this
// show('登录过期,请重新登录'); let that = this
// props.exitLoginStatus(); // 可提交 并且 不处于正在提交中
// } else { if(state.canSubFlag && !state.isSubLoding) {
// // that.changeSubLoding(false) // 先提交录音,再提交接口
// let error_msg = audioResult.error_msg || audioResult.message if(state.stop) {
// show(error_msg); let params = {
// that.submitSelfOrder() access_token: props.token,
// } path: state.audioPath
// } else { }
// that.submitSelfOrder() let {global_domain_config} = props
// } let audioResult = await requestSelfAudio(global_domain_config, params);
// } that.changeSubLoding(true, '上传中')
if(audioResult.error_code == 0) {
// 提交订单
that.setState({
listOptionData: state.listOptionData.map((item, index) => {
if(index == 11) {
item.value = audioResult.data.url
}
return item
})
}, () => {
that.changeSubLoding(false)
that.submitSelfOrder()
})
} else if(audioResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
that.changeSubLoding(false)
let error_msg = audioResult.error_msg || audioResult.message
show(error_msg);
that.submitSelfOrder()
}
} else {
that.submitSelfOrder()
}
}
// // let { navigation } = this.props // let { navigation } = this.props
// // let { state: { params: { title } } } = navigation // let { state: { params: { title } } } = navigation
// // navigation.navigate('SubSuccessPage', { title: `${title} - 下单成功` }) // navigation.navigate('SubSuccessPage', { title: `${title} - 下单成功` })
} }
// 提交订单 // 提交订单
submitSelfOrder() { submitSelfOrder() {
// let { state, props } = this let { state, props } = this
// let tempSubOption = state.submitOption let tempSubOption = state.submitOption
// tempSubOption.seller_code = state.listOptionData[0].value tempSubOption.seller_code = state.listOptionData[0].value
// tempSubOption.org_code = state.listOptionData[1].value tempSubOption.org_code = state.listOptionData[1].value
// tempSubOption.customer_code = state.listOptionData[2].value tempSubOption.customer_code = state.listOptionData[2].value
// tempSubOption.bill_to_site_code = state.listOptionData[3].value tempSubOption.bill_to_site_code = state.listOptionData[3].value
// tempSubOption.ship_to_site_code = state.listOptionData[4].value tempSubOption.ship_to_site_code = state.listOptionData[4].value
// if(state.listOptionData[5].name === '其他') { if(state.listOptionData[5].name === '其他') {
// tempSubOption.doctor_name = state.listOptionData[5].inputValue tempSubOption.doctor_name = state.listOptionData[5].inputValue
// } else { } else {
// tempSubOption.doctor_name = state.listOptionData[5].value tempSubOption.doctor_name = state.listOptionData[5].value
// } }
tempSubOption.surgery_name = state.listOptionData[6].value
// tempSubOption.template_collect_number = state.listOptionData[7].value // tempSubOption.template_collect_number = state.listOptionData[7].value
// tempSubOption.surgery_date = state.listOptionData[8].value tempSubOption.surgery_date = state.listOptionData[7].value
// tempSubOption.order_type_code = state.listOptionData[9].value tempSubOption.surgery_type_code = state.listOptionData[8].value
// tempSubOption.surgery_desc = state.listOptionData[10].value tempSubOption.order_type_code = state.listOptionData[9].value
// tempSubOption.voice_url = state.listOptionData[11].value tempSubOption.surgery_desc = state.listOptionData[11].value
// let params = { tempSubOption.voice_url = state.listOptionData[12].value
// access_token: props.token, tempSubOption.replace_item_flag = state.listOptionData[10].replace_item_flag
// data: { ...tempSubOption } tempSubOption.take_cert_flag = state.listOptionData[10].take_cert_flag
// } tempSubOption.Caller = 'APP'
tempSubOption.lines = state.listOptionData[10].sub_lines
let params = {
access_token: props.token,
data: { ...tempSubOption }
}
console.log('submitSelfOrder!!!!',params )
// props.requestSelfSumbit(params) // props.requestSelfSumbit(params)
} }
// 获取选择产品提交接口需要的数据
getSumLinesOps() {
let { local_tip, listOptionData } = this.state
// 修改提交的行数据
let local_lines = cloneObject(listOptionData[10].lines)
let res_lines = []
console.log('提交==', local_lines)
let showPackageTip = false
local_lines.forEach(sup_item => {
if (sup_item[SELECTED_QUQNTITY] > 0 && sup_item.leftOptionList && sup_item.leftOptionList.length > 0) {
sup_item.leftOptionList.map(lef_item => {
let select_arr = lef_item[SELECTED_DATA_ARR]
if (lef_item[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) {
// 手术模板
select_arr.forEach(sel_item => {
let template_number = sel_item.template_number
// sel_item.childrenLineData[0].lineOptions[0][SELECTED_DATA_ARR]
if (sel_item[LocalVariable.CHILDREN_LINE_NAME] && sel_item[LocalVariable.CHILDREN_LINE_NAME].length > 0) {
sel_item[LocalVariable.CHILDREN_LINE_NAME].forEach(chi_item => {
if (chi_item[LocalVariable.LINE_OPTIONS] && chi_item[LocalVariable.LINE_OPTIONS].length > 0) {
chi_item[LocalVariable.LINE_OPTIONS].forEach(lin_item => {
if (lin_item[LocalVariable.SELECTED_DATA_ARR] && lin_item[LocalVariable.SELECTED_DATA_ARR].length > 0) {
lin_item[LocalVariable.SELECTED_DATA_ARR].forEach(sel_item => {
sel_item['template_number'] = template_number
sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item)
})
}
})
}
})
}
})
} else if (lef_item.category_code === LocalVariable.NAIL_BOX || lef_item.category_code === LocalVariable.EQUIPMENT_BAG) {
// 钉盒/器械包
if (lef_item.category_code === LocalVariable.EQUIPMENT_BAG) {
showPackageTip = true
}
select_arr.forEach(sel_item => {
sel_item['prefer_serial_number'] = sel_item.serial_number
sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item)
})
}
else if (lef_item.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
// 零散器械
select_arr.forEach(sel_item => {
sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item)
})
}
else {
// 单选耗材
if (select_arr[0].details && select_arr[0].details.length > 0) {
// 大-中-小类
select_arr.forEach(sel_item => {
sel_item.details.forEach(end_item => {
if (end_item[QUANTITY_FIELD] > 0) {
end_item[LocalVariable.PLAN_QUANTITY] = end_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(end_item)
}
})
})
} else {
// 大类-小类
select_arr.forEach(sel_item => {
sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item)
})
}
}
}
})
}
})
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
if(showPackageTip){
this.refs.PackageModel.show()
}else {
this.refs.CertModel.show('需要携带注册证?')
}
}
// 判断组织是否为空 // 判断组织是否为空
judgeOrgIsNull() { judgeOrgIsNull() {
let { listOptionData } = this.state let { listOptionData } = this.state
let orgVal = listOptionData[1].value let orgVal = listOptionData[1].value
if(!orgVal) { if (!orgVal) {
show('请先选择组织') show('请先选择组织')
return false return false
} else { } else {
...@@ -1339,7 +1469,7 @@ class SelfOrderPage extends Component { ...@@ -1339,7 +1469,7 @@ class SelfOrderPage extends Component {
judgeCustomerIsNull() { judgeCustomerIsNull() {
let { listOptionData } = this.state let { listOptionData } = this.state
let orgVal = listOptionData[2].value let orgVal = listOptionData[2].value
if(!orgVal) { if (!orgVal) {
show('请先选择客户名称') show('请先选择客户名称')
return false return false
} else { } else {
...@@ -1350,8 +1480,8 @@ class SelfOrderPage extends Component { ...@@ -1350,8 +1480,8 @@ class SelfOrderPage extends Component {
processReturnData() { processReturnData() {
let { selfOrderOption } = this.props let { selfOrderOption } = this.props
let that = this let that = this
if(selfOrderOption.create_success) { if (selfOrderOption.create_success) {
if(selfOrderOption.create_success == 'N') { if (selfOrderOption.create_success == 'N') {
// // 打开库存不足弹窗 // // 打开库存不足弹窗
// this.setState({ // this.setState({
// not_enough_items_list: selfOrderOption.not_enough_items_list // not_enough_items_list: selfOrderOption.not_enough_items_list
...@@ -1363,7 +1493,7 @@ class SelfOrderPage extends Component { ...@@ -1363,7 +1493,7 @@ class SelfOrderPage extends Component {
// }) // })
// }, 500) // }, 500)
// }) // })
} else if(selfOrderOption.create_success == 'Y') { } else if (selfOrderOption.create_success == 'Y') {
// // 打开下单成功页面 // // 打开下单成功页面
// this.clearAllData() // this.clearAllData()
// let { state: { params: { title } } } = this.props.navigation // let { state: { params: { title } } } = this.props.navigation
...@@ -1376,8 +1506,8 @@ class SelfOrderPage extends Component { ...@@ -1376,8 +1506,8 @@ 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({
...@@ -1388,13 +1518,21 @@ class SelfOrderPage extends Component { ...@@ -1388,13 +1518,21 @@ class SelfOrderPage extends Component {
} }
// 提交的提示回调函数 // 提交的提示回调函数
modelPackageCertCB(typeName, nowVal){ modelPackageCertCB(typeName, nowVal) {
let {local_tip} = this.state let { local_tip, listOptionData } = this.state
local_tip[typeName] = nowVal listOptionData[10][typeName] = nowVal
// local_tip[typeName] = nowVal
this.setState({ this.setState({
local_tip: local_tip listOptionData: listOptionData
// local_tip: local_tip
}) })
console.log('local_tip---', local_tip) console.log('modelPackageCertCB---', listOptionData[10])
if (typeName === 'replace_item_flag') {
this.refs.CertModel.show('需要携带注册证?')
} else {
console.log('请求提交====')
this.handleSubmit()
}
} }
...@@ -1421,7 +1559,7 @@ class SelfOrderPage extends Component { ...@@ -1421,7 +1559,7 @@ class SelfOrderPage extends Component {
// 返回备注以上的元素 // 返回备注以上的元素
renderListItem() { renderListItem() {
let { listOptionData, dateModelPop } = this.state let { listOptionData, dateModelPop } = this.state
return( return (
<View style={styles.list_cont}> <View style={styles.list_cont}>
<PageListArrow <PageListArrow
listActOpa={1} listActOpa={1}
...@@ -1575,6 +1713,7 @@ class SelfOrderPage extends Component { ...@@ -1575,6 +1713,7 @@ class SelfOrderPage extends Component {
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={.8}
listHasAster={true}
listItem={listOptionData[6]} listItem={listOptionData[6]}
listInputPlace={'请输入'} listInputPlace={'请输入'}
listDefaValue={'value'} listDefaValue={'value'}
...@@ -1601,6 +1740,7 @@ class SelfOrderPage extends Component { ...@@ -1601,6 +1740,7 @@ class SelfOrderPage extends Component {
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={.8}
listHasAster={true}
listItem={listOptionData[7]} listItem={listOptionData[7]}
listName={'name'} listName={'name'}
listTitle={'title'} listTitle={'title'}
...@@ -1697,9 +1837,9 @@ class SelfOrderPage extends Component { ...@@ -1697,9 +1837,9 @@ class SelfOrderPage extends Component {
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>
) )
...@@ -1709,7 +1849,7 @@ class SelfOrderPage extends Component { ...@@ -1709,7 +1849,7 @@ class SelfOrderPage extends Component {
renderRightArrowItem() { renderRightArrowItem() {
return ( return (
<ImageTextStyle> <ImageTextStyle>
<Image source={require('../../images/arr_rig.png')} style={icon_style}/> <Image source={require('../../images/arr_rig.png')} style={icon_style} />
</ImageTextStyle> </ImageTextStyle>
) )
} }
...@@ -1739,15 +1879,15 @@ class SelfOrderPage extends Component { ...@@ -1739,15 +1879,15 @@ class SelfOrderPage extends Component {
<CellTextStyle style={list_common_item.remark_item}> <CellTextStyle style={list_common_item.remark_item}>
<View style={list_common_item.rema_box}> <View style={list_common_item.rema_box}>
<Text style={list_common_item.rema_tit}>备注</Text> <Text style={list_common_item.rema_tit}>备注</Text>
<View style = {list_common_item.rema_Input_outer} > <View style={list_common_item.rema_Input_outer} >
<TouchableOpacity activeOpacity = {1} style = {list_common_item.rema_Input_inner} onPress = {() => this.TextInput.focus()} > <TouchableOpacity activeOpacity={1} style={list_common_item.rema_Input_inner} onPress={() => this.TextInput.focus()} >
<TextInput <TextInput
placeholder = {'请输入备注信息'} placeholder={'请输入备注信息'}
placeholderTextColor = {placehold_text_color} placeholderTextColor={placehold_text_color}
underlineColorAndroid = {'transparent'} underlineColorAndroid={'transparent'}
multiline = {true} multiline={true}
ref = {textInput => this.TextInput = textInput} ref={textInput => this.TextInput = textInput}
numberOfLines = {8} numberOfLines={8}
style={list_common_item.rema_Input} style={list_common_item.rema_Input}
maxLength={140} maxLength={140}
onChangeText={(text) => this.handleRemarkInput(text, listOptionData[11])} onChangeText={(text) => this.handleRemarkInput(text, listOptionData[11])}
...@@ -1766,18 +1906,18 @@ class SelfOrderPage extends Component { ...@@ -1766,18 +1906,18 @@ class SelfOrderPage extends Component {
return ( return (
<CellTextStyle style={[list_common_item.reco_item, !stop ? '' : list_common_item.reco_play_height]}> <CellTextStyle style={[list_common_item.reco_item, !stop ? '' : list_common_item.reco_play_height]}>
<View style={list_common_item.reco_btn_cont}> <View style={list_common_item.reco_btn_cont}>
{ !stop ? <Text style={list_common_item.reco_btn_tit}>还有什么要安排的,可录音备注哟!</Text> : null } {!stop ? <Text style={list_common_item.reco_btn_tit}>还有什么要安排的,可录音备注哟!</Text> : null}
{ {
!stop ? !stop ?
<View style={list_common_item.reco_btn_inner}> <View style={list_common_item.reco_btn_inner}>
<TouchableOpacity <TouchableOpacity
activeOpacity = {.8} activeOpacity={.8}
style={list_common_item.reco_btn_box} style={list_common_item.reco_btn_box}
onLongPress={this._record} onLongPress={this._record}
onPressOut={this._stop} onPressOut={this._stop}
> >
<View style={list_common_item.reco_img_box}> <View style={list_common_item.reco_img_box}>
<Image source={require('../../images/record_icon.png')} style={icon_style}/> <Image source={require('../../images/record_icon.png')} style={icon_style} />
</View> </View>
<Text style={list_common_item.reco_btn_text}>长按录音</Text> <Text style={list_common_item.reco_btn_text}>长按录音</Text>
</TouchableOpacity> </TouchableOpacity>
...@@ -1785,14 +1925,14 @@ class SelfOrderPage extends Component { ...@@ -1785,14 +1925,14 @@ class SelfOrderPage extends Component {
: <View style={list_common_item.reco_play_box}> : <View style={list_common_item.reco_play_box}>
<View style={list_common_item.play_btn}> <View style={list_common_item.play_btn}>
<TouchableOpacity <TouchableOpacity
activeOpacity = {.8} activeOpacity={.8}
style={[list_common_item.reco_list_box, list_common_item.reco_del_btn]} style={[list_common_item.reco_list_box, list_common_item.reco_del_btn]}
onPress={this._del} onPress={this._del}
> >
<Text style={[list_common_item.reco_text, list_common_item.reco_del_tit]}> 删除 </Text> <Text style={[list_common_item.reco_text, list_common_item.reco_del_tit]}> 删除 </Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
activeOpacity = {.8} activeOpacity={.8}
style={[list_common_item.reco_list_box, list_common_item.reco_play_btn]} style={[list_common_item.reco_list_box, list_common_item.reco_play_btn]}
onPress={this._play} onPress={this._play}
> >
...@@ -1810,36 +1950,36 @@ class SelfOrderPage extends Component { ...@@ -1810,36 +1950,36 @@ class SelfOrderPage extends Component {
// 返回正在加载中 // 返回正在加载中
renderLodingItem() { renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state let { lodingTitle, isSubLoding } = this.state
return( return (
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} /> <LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
) )
} }
// 返回提交器械包提示 // 返回提交器械包提示
renderTipModelPackage(){ renderTipModelPackage() {
return ( return (
<TipInfoNeedSelect ref="PackageModel" closeCallBack={() => this.modelPackageCertCB('will','N')} submitCallBack={() => this.modelPackageCertCB('will','Y')}/> <TipInfoNeedSelect ref="PackageModel" closeCallBack={() => this.modelPackageCertCB('replace_item_flag', 'N')} submitCallBack={() => this.modelPackageCertCB('replace_item_flag', 'Y')} />
) )
} }
// 返回提交合格证提示 // 返回提交合格证提示
renderTipModelCert(){ renderTipModelCert() {
return ( return (
<TipInfoNeedSelect ref="CertModel" closeCallBack={() => this.modelPackageCertCB('take_cert','N')} submitCallBack={() => this.modelPackageCertCB('take_cert','Y')}/> <TipInfoNeedSelect ref="CertModel" closeCallBack={() => this.modelPackageCertCB('take_cert_flag', 'N')} submitCallBack={() => this.modelPackageCertCB('take_cert_flag', 'Y')} />
) )
} }
render() { render() {
let {canSubFlag} = this.state let { canSubFlag } = this.state
// console.log(this.props) // console.log(this.props)
let {navigation} = this.props let { navigation } = this.props
let {title} = navigation.state.params let { title } = navigation.state.params
return ( return (
<View style={styles.self_container}> <View style={styles.self_container}>
<StatusBarView <StatusBarView
isReactStackNavigator={true} isReactStackNavigator={true}
backgroundColor={promary_color} backgroundColor={promary_color}
barStyle = 'light-content' barStyle='light-content'
/> />
<SafeAreaView style={safe_view}> <SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} /> <HeadBackItem title={title} navigation={navigation} />
...@@ -1857,13 +1997,14 @@ class SelfOrderPage extends Component { ...@@ -1857,13 +1997,14 @@ class SelfOrderPage extends Component {
style={canSubFlag ? styles.sub_btn_pro : ''} style={canSubFlag ? styles.sub_btn_pro : ''}
activeOpacity={canSubFlag ? .8 : 1} activeOpacity={canSubFlag ? .8 : 1}
title={'生成订单'} title={'生成订单'}
textStyle= {styles.sub_btn} textStyle={styles.sub_btn}
onPress={() => this.handleSubmit()} onPress={() => this.getSumLinesOps()}
// onPress={() => this.handleSubmit()}
/> />
</ScrollView> </ScrollView>
{ this.renderLodingItem() } {this.renderLodingItem()}
</SafeAreaView> </SafeAreaView>
</View> </View>
...@@ -1872,11 +2013,11 @@ class SelfOrderPage extends Component { ...@@ -1872,11 +2013,11 @@ class SelfOrderPage extends Component {
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
self_container : { self_container: {
flex: 1, flex: 1,
backgroundColor: home_background_color backgroundColor: home_background_color
}, },
self_main : { self_main: {
padding: 14 padding: 14
}, },
sub_btn_pro: { sub_btn_pro: {
......
...@@ -328,18 +328,21 @@ class ChooseProductPage extends Component { ...@@ -328,18 +328,21 @@ class ChooseProductPage extends Component {
} else if (leftIndex > 3) { } else if (leftIndex > 3) {
let params = { let params = {
access_token: token, access_token: token,
category_code: leftItem.category_code,
manufacturer_code: topItem.supplier_code,
org_code: cur_org_code,
leftIndex: leftIndex, // 本地测试 leftIndex: leftIndex, // 本地测试
} }
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 instanceof Array) console.log('data : ', data, data.items)
if (data instanceof Array) { if (data && data.items) {
// if(leftItem[SELECTED_QUQNTITY] === 0){ // if(leftItem[SELECTED_QUQNTITY] === 0){
//大-中-小类 //大-中-小类
leftItem.localSecondData = cloneObject(data) leftItem.localSecondData = cloneObject(data.items)
leftItem['localSecondData'].forEach(function (righDa) { leftItem['localSecondData'].forEach(function (righDa) {
righDa[CHILDREN_LINE_NAME] = [] righDa[CHILDREN_LINE_NAME] = []
// if (!righDa['quantity']) { // if (!righDa['quantity']) {
......
...@@ -421,7 +421,7 @@ class EditThirdLevelPage extends Component { ...@@ -421,7 +421,7 @@ class EditThirdLevelPage extends Component {
curImgIcon = 'photos' curImgIcon = 'photos'
return ( return (
<SafeAreaView style={styles.column_container}> <SafeAreaView style={styles.column_container} key={'item_code'+index}>
<PicTitDetaiCalcu <PicTitDetaiCalcu
listItem={item} listItem={item}
listIndex={index} listIndex={index}
......
...@@ -4,10 +4,10 @@ import { third_text_color, foundation_color, second_text_size, Width, pxSize, fo ...@@ -4,10 +4,10 @@ import { third_text_color, foundation_color, second_text_size, Width, pxSize, fo
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu'; import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
import PictureZoom from '../../common/listDataComponent/PictureZoom'; import PictureZoom from '../../common/listDataComponent/PictureZoom';
import { cloneObject } from '../../../utils/Utils'; import { cloneObject } from '../../../utils/Utils';
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 localMockData from './mock/sen_mock';
import { PicListNoData } from '../../common/CellTextStyle';
const PropTypes = require('prop-types'); const PropTypes = require('prop-types');
const QUANTITY_FIELD = 'quantity' // 计算的字段 const QUANTITY_FIELD = 'quantity' // 计算的字段
...@@ -469,7 +469,7 @@ class ProductRightStyle extends Component { ...@@ -469,7 +469,7 @@ class ProductRightStyle extends Component {
curReduceCallBack = (() => this.props.superReduceBack()) curReduceCallBack = (() => this.props.superReduceBack())
} }
return ( return (
<SafeAreaView style={styles.ri_container}> <SafeAreaView style={styles.ri_container} key={'template_name'+index}>
<PicTitDetaiCalcu <PicTitDetaiCalcu
listItem={item} listItem={item}
listIndex={index} listIndex={index}
...@@ -516,7 +516,7 @@ class ProductRightStyle extends Component { ...@@ -516,7 +516,7 @@ class ProductRightStyle extends Component {
// 单选耗材 -- 小类每一列 // 单选耗材 -- 小类每一列
renderThridItem(item, index) { renderThridItem(item, index) {
return ( return (
<SafeAreaView style={styles.thr_container}> <SafeAreaView style={styles.thr_container} key={'item_code'+index}>
<PicTitDetaiCalcu <PicTitDetaiCalcu
listItem={item} listItem={item}
listIndex={index} listIndex={index}
...@@ -573,7 +573,7 @@ class ProductRightStyle extends Component { ...@@ -573,7 +573,7 @@ class ProductRightStyle extends Component {
// console.log('大类===', item) // console.log('大类===', item)
return ( return (
<SafeAreaView style={styles.oth_container}> <SafeAreaView style={styles.oth_container} key={'item_code'+index}>
<PicTitDetaiCalcu <PicTitDetaiCalcu
listItem={item} listItem={item}
listIndex={index} listIndex={index}
......
...@@ -508,8 +508,8 @@ const inter_9 = //大-中-小类 ...@@ -508,8 +508,8 @@ const inter_9 = //大-中-小类
{ {
"error_code": 0, "error_code": 0,
"error_msg": "成功", "error_msg": "成功",
"data": "data":{
[{ "items": [{
"category_code": "JSTH-01-01", "category_code": "JSTH-01-01",
"category_name": "股骨头", "category_name": "股骨头",
"details": [ "details": [
...@@ -550,9 +550,8 @@ const inter_9 = //大-中-小类 ...@@ -550,9 +550,8 @@ const inter_9 = //大-中-小类
"photos": local_photos "photos": local_photos
} }
] ]
}]
} }
]
} }
//大-小类 //大-小类
......
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