Commit dc87fb35 by lhc

feat: 添加customer_code

parent a311bae1
import React, { Component } from 'react';
import { View, Text, SafeAreaView, StyleSheet, TouchableOpacity, Image, ScrollView, TextInput, Alert, Linking, NativeModules, Platform } from 'react-native';
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 { ImageTextStyle, CellTextStyle, FooterBtnStyle } from '../common/CellTextStyle';
import { show, formatStrForDate, cloneObject, dedupQuoteArray, isBlank, isNotBlank, decodeDisplayProfiles, getCodeValue } from '../../utils/Utils';
import HeadBackItem from '../common/HeadBackItem';
import StatusBarView from '../common/StatusBarView';
import DialogModel from '../common/DialogModel';
import LodingModel from '../common/LodingModel';
import DateModel from '../common/DateModel';
import { AudioRecorder, AudioUtils } from 'react-native-audio';
import Sound from 'react-native-sound';
import { requestSelfOrganizations, requestSelfSurgeryHospital, requestSelfOrderType, requestSelfTemplateCollect, requestSelfAudio, requestSelfSumbit, setSelfInitData, reqSelfSurgeryHospital, requestListDataSuccess, requestSelfSurgeryType, setSelectProductOpts, reqSelfOrganizations, reqOrgDepartments, requestQuickSurColSetting, requestSurgeryType} from '../../action/SelfAction';
import { exitLoginStatus, requestSysProfile } 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 PageListArrow from '../common/listDataComponent/PageListArrow';
import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect';
import LocalVariable from '../common/LocalVariable';
import LoadingModel from '../common/listDataComponent/LoadingModel';
import NotEnoughModel from '../common/NotEnoughModel';
import ImagePicker from 'react-native-image-picker';
import ZoomPictureModel from '../common/ZoomPictureModel';
import { uploadTransImg } from '../../action/TransAction';
import moment from 'moment';
import * as R from "ramda";
import React, { Component } from 'react'
import {
View,
Text,
SafeAreaView,
StyleSheet,
TouchableOpacity,
Image,
ScrollView,
TextInput,
Alert,
Linking,
NativeModules,
Platform,
} from 'react-native'
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 { ImageTextStyle, CellTextStyle, FooterBtnStyle } from '../common/CellTextStyle'
import {
show,
formatStrForDate,
cloneObject,
dedupQuoteArray,
isBlank,
isNotBlank,
decodeDisplayProfiles,
getCodeValue,
} from '../../utils/Utils'
import HeadBackItem from '../common/HeadBackItem'
import StatusBarView from '../common/StatusBarView'
import DialogModel from '../common/DialogModel'
import LodingModel from '../common/LodingModel'
import DateModel from '../common/DateModel'
import { AudioRecorder, AudioUtils } from 'react-native-audio'
import Sound from 'react-native-sound'
import {
requestSelfOrganizations,
requestSelfSurgeryHospital,
requestSelfOrderType,
requestSelfTemplateCollect,
requestSelfAudio,
requestSelfSumbit,
setSelfInitData,
reqSelfSurgeryHospital,
requestListDataSuccess,
requestSelfSurgeryType,
setSelectProductOpts,
reqSelfOrganizations,
reqOrgDepartments,
requestQuickSurColSetting,
requestSurgeryType,
} from '../../action/SelfAction'
import { exitLoginStatus, requestSysProfile } 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 PageListArrow from '../common/listDataComponent/PageListArrow'
import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect'
import LocalVariable from '../common/LocalVariable'
import LoadingModel from '../common/listDataComponent/LoadingModel'
import NotEnoughModel from '../common/NotEnoughModel'
import ImagePicker from 'react-native-image-picker'
import ZoomPictureModel from '../common/ZoomPictureModel'
import { uploadTransImg } from '../../action/TransAction'
import moment from 'moment'
import * as R from 'ramda'
class SelfOrderPage extends Component {
constructor(props) {
super(props);
super(props)
this.state = {
canSubFlag: false, // 提交按钮样式
listOptionData: [
{
"id": "0",
id: '0',
title: '销售员',
name: '',
value: ''
value: '',
},
{
"id": "1",
id: '1',
title: '组织',
name: '请选择',
value: ''
value: '',
},
{
"id": "2",
id: '2',
title: '客户名称',
name: '请选择',
value: ''
value: '',
},
{
"id": "3",
id: '3',
title: '收单地点',
name: '请选择',
value: ''
value: '',
},
{
"id": "4",
id: '4',
title: '收货地点',
name: '请选择',
value: ''
value: '',
},
{
"id": "5",
id: '5',
title: '主治医生',
name: '请选择',
value: '',
showInput: false,
inputValue: ''
inputValue: '',
},
{
"id": "6",
id: '6',
title: '手术时间',
name: (() => {
let date = moment(new Date()).add(1, 'd')
......@@ -90,121 +143,121 @@ class SelfOrderPage extends Component {
date.set('minute', 0)
return date.toDate()
})(),
showDatePicker: true
showDatePicker: true,
},
{
"id": "7",
id: '7',
title: '订单类型',
name: '请选择',
value: ''
value: '',
},
{
"id": "8",
id: '8',
title: '选择产品',
name: '请选择',
value: '',
lines: [],
sub_lines: [],
replace_item_flag: 'N', // 器械包
take_cert_flag: 'N' // 合格证
take_cert_flag: 'N', // 合格证
},
{
"id": "9",
id: '9',
title: '需要携带合格证',
value: '',
isRedio: '' // 单选
isRedio: '', // 单选
},
{
"id": "10",
id: '10',
title: '同意替换器械包', // 同意替换同品不同器械包
value: 'N',
isRedio: 'N' // 单选
isRedio: 'N', // 单选
},
{
"id": "11",
id: '11',
title: '备注',
value: '',
isRemark: true // 备注
isRemark: true, // 备注
},
{
"id": "12",
id: '12',
title: '还有什么要安排的,可录音备注哟!',
value: '',
isRecode: true // 录音
isRecode: true, // 录音
},
{
"id": "13",
id: '13',
title: '添加图片',
value: '',
isAddImage: true, // 添加图片
uploadImgArr: [] // 上传后的路径
uploadImgArr: [], // 上传后的路径
},
{
"id": "14",
id: '14',
title: '部门',
name: '请选择',
value: '',
},
{
"id": "15",
id: '15',
title: '业务经理',
name: '请选择',
value: '',
},
{
"id": "16",
id: '16',
title: '跟台员',
name: '请选择',
value: '',
},
{
"id": "17",
id: '17',
title: '送货员',
name: '请选择',
value: '',
},
{
"id": "18",
id: '18',
title: '借货仓库',
name: '请选择',
value: '',
},
{
"id": "19",
id: '19',
title: '手术类型',
name: '请选择',
value: '',
},
{
"id": "20",
id: '20',
title: '患者姓名',
value: ''
value: '',
},
{
"id": "21",
id: '21',
title: '性别', // 选择
name: '请选择',
value: ''
value: '',
},
{
"id": "22",
id: '22',
title: '年龄', // 输入
value: ''
value: '',
},
{
"id": "23",
id: '23',
title: '床位',
value: ''
value: '',
},
{
"id": "24",
id: '24',
title: '病历号',
value: ''
value: '',
},
],
subInitListOption: [], // 存储最初数据
submitOption: { // 提交的信息
submitOption: {
// 提交的信息
seller_code: '', // 用户名username
org_code: '', // 组织
customer_code: '', // 客户名称
......@@ -221,24 +274,27 @@ class SelfOrderPage extends Component {
Caller: 'dingding', // Caller: 'APP',
force_balance_check_flag: 'Y', // 检查缺失物料
replace_item_flag: 'N', // 器械包
take_cert_flag: 'N' // 合格证
take_cert_flag: 'N', // 合格证
},
currentItem: {
name: '请选择',
value: '-1'
value: '-1',
},
localOtherObj: { // 恢复原状态
localOtherObj: {
// 恢复原状态
name: '请选择',
value: ''
value: '',
},
sexTypeOption: [ // 性别
sexTypeOption: [
// 性别
{
name:'男',
value:'男'
},{
name:'女',
value:'女'
}
name: '男',
value: '男',
},
{
name: '女',
value: '女',
},
],
currentTitle: '组织', // 当前点击项
showTypePop: false, // 选择器弹窗
......@@ -265,12 +321,12 @@ class SelfOrderPage extends Component {
OBS_MOBILE_BOR_WARE_REQUIRED: 0,
},
departments: [],
surgery_types: []
surgery_types: [],
}
}
componentDidMount() {
const {sysProfiles} = this.props
const { sysProfiles } = this.props
this.getSysProfileValue()
this.props.setSelectProductOpts([])
this.getSellerName()
......@@ -301,14 +357,14 @@ class SelfOrderPage extends Component {
let { state, props } = this
let { listOptionData } = this.state
this.setState({
subInitListOption: cloneObject(listOptionData) // 存储初始化数据,提交成功后赋此值
subInitListOption: cloneObject(listOptionData), // 存储初始化数据,提交成功后赋此值
})
if (state.listOptionData[0].name !== props.userInfo.person_name) {
listOptionData[0].name = props.userInfo.person_name
listOptionData[0].value = props.userInfo.user_name
this.setState({
listOptionData,
subInitListOption: cloneObject(listOptionData)
subInitListOption: cloneObject(listOptionData),
})
}
}
......@@ -318,18 +374,18 @@ class SelfOrderPage extends Component {
*/
async getSysProfileValue() {
let { global_domain_config, token } = this.props
const {sysValues} = this.state
const { sysValues } = this.state
const getSysValue = async (key) => {
const getSysValue = async key => {
const params = {
access_token: token,
profile_code: key
profile_code: key,
}
const res = await requestSysProfile(global_domain_config, params)
if (res.error_code || res.status) return
sysValues[key] = isNaN(res.data.profile_value) ? res.data.profile_value : parseInt(res.data.profile_value)
this.setState({
sysValues
sysValues,
})
}
......@@ -338,39 +394,40 @@ class SelfOrderPage extends Component {
// 请求授权
getAudioAuthorize() {
AudioRecorder.requestAuthorization()
.then(isAuthor => {
AudioRecorder.requestAuthorization().then(isAuthor => {
console.log('是否授权: ' + isAuthor)
if (!isAuthor) {
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [
{
text: '设置',
onPress: () => {
if (Platform.OS == 'ios') {
Linking.openURL('app-settings:')
.catch(err => console.log('error', err))
Linking.openURL('app-settings:').catch(err => console.log('error', err))
} else if (Platform.OS == 'android') {
NativeModules.OpenSettings.openNetworkSettings(data => {
console.log('call back data', data)
}).catch(err => console.log('android---', err))
}
}
}, {
},
},
{
text: '取消',
}])
},
])
}
this.setState({ hasPermission: isAuthor })
this.prepareRecordingPath(this.state.audioPath);
this.prepareRecordingPath(this.state.audioPath)
// 录音进展
AudioRecorder.onProgress = (data) => {
AudioRecorder.onProgress = data => {
this.setState({
currentTime: Math.ceil(data.currentTime)
});
};
currentTime: Math.ceil(data.currentTime),
})
}
// 完成录音
AudioRecorder.onFinished = (data) => {
AudioRecorder.onFinished = data => {
// data 录音数据
console.log(this.state.currentTime)
};
}
})
}
......@@ -380,7 +437,7 @@ class SelfOrderPage extends Component {
* path 路径
* option 参数
*/
prepareRecordingPath = (path) => {
prepareRecordingPath = path => {
const option = {
SampleRate: 44100.0, //采样率
Channels: 2, //通道
......@@ -399,21 +456,23 @@ class SelfOrderPage extends Component {
// 开始录音
_record = async () => {
if (!this.state.hasPermission) {
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [
{
text: '设置',
onPress: () => {
if (Platform.OS == 'ios') {
Linking.openURL('app-settings:')
.catch(err => console.log('error', err))
Linking.openURL('app-settings:').catch(err => console.log('error', err))
} else if (Platform.OS == 'android') {
NativeModules.OpenSettings.openNetworkSettings(data => {
console.log('call back data', data)
}).catch(err => console.log('android---', err))
}
}
}, {
},
},
{
text: '取消',
}])
},
])
}
show('录音开始')
if (this.state.stop) {
......@@ -434,10 +493,10 @@ class SelfOrderPage extends Component {
}
show('录音结束')
try {
await AudioRecorder.stopRecording();
this.setState({ stop: true });
await AudioRecorder.stopRecording()
this.setState({ stop: true })
} catch (error) {
console.log('stop record--error->', error);
console.log('stop record--error->', error)
}
}
......@@ -445,7 +504,7 @@ class SelfOrderPage extends Component {
_play = async () => {
let that = this
show('正在播放')
that.whoosh = new Sound(this.state.audioPath, '', (err) => {
that.whoosh = new Sound(this.state.audioPath, '', err => {
if (err) {
show('加载音频失败')
return console.log('加载音频失败-->', err)
......@@ -470,7 +529,7 @@ class SelfOrderPage extends Component {
this.setState({
currentTime: 0,
stop: false,
listOptionData
listOptionData,
})
}
......@@ -482,34 +541,37 @@ class SelfOrderPage extends Component {
case SELF_ORDER_LIST_DOING:
// that.refs.LoadingModel.show()
that.changeSubLoding(true)
break;
break
case SELF_ORDER_LIST_SUCCESS:
// that.refs.LoadingModel.hide()
// setTimeout(() => {
// that.changeCurrentOption()
// }, 500) // IOS问题
that.setState({
that.setState(
{
isSubLoding: false,
lodingTitle: '加载中'
}, () => {
lodingTitle: '加载中',
},
() => {
that.changeCurrentOption()
})
break;
},
)
break
case SELF_ORDER_LIST_FAILURE:
// that.refs.LoadingModel.hide()
that.changeSubLoding(false)
break;
break
default:
break;
break
}
}
if (loginState != nextProps.loginState) {
switch (nextProps.loginState) {
case LOGIN_NO:
navigation.navigate('LoginPage')
break;
break
default:
break;
break
}
}
if (submit_self_order_status != nextProps.submit_self_order_status) {
......@@ -517,27 +579,30 @@ class SelfOrderPage extends Component {
case SELF_SUBMIT_DOING:
// that.refs.LoadingModel.show('提交中')
that.changeSubLoding(true, '提交中')
break;
break
case SELF_SUBMIT_SUCCESS:
// setTimeout(() => {
// that.refs.LoadingModel.hide()
// that.processReturnData()
// }, 500) // IOS问题
setTimeout(() => {
that.setState({
that.setState(
{
isSubLoding: false,
lodingTitle: '提交中'
}, () => {
lodingTitle: '提交中',
},
() => {
that.processReturnData()
})
},
)
}, 500)
break;
break
case SELF_SUBMIT_FAILURE:
// that.refs.LoadingModel.hide()
that.changeSubLoding(false, '提交中')
break;
break
default:
break;
break
}
}
}
......@@ -546,7 +611,7 @@ class SelfOrderPage extends Component {
changeSubLoding(loading, loadTit) {
this.setState({
isSubLoding: loading || false,
lodingTitle: loadTit || '加载中'
lodingTitle: loadTit || '加载中',
})
}
......@@ -569,23 +634,22 @@ class SelfOrderPage extends Component {
that.customerGetShip()
}
if (item.title == '主治医生') {
item.showInput = false,
item.inputValue = ''
;(item.showInput = false), (item.inputValue = '')
}
}
return item
})
}),
})
}
// 判断是否都有值,修改提交按钮的颜色
changeCanSub(isSubCheck) {
let { listOptionData, sysValues} = this.state
let { listOptionData, sysValues } = this.state
let { sysProfiles, navigation } = this.props
let tempStatus = false
let tempTit = ''
let curTip = '未选择'
const {isLendOrder} = navigation.getParam('params')
const { isLendOrder } = navigation.getParam('params')
const doctorNameProfile = this.decodeDisplayLendProfile('DOCTOR_DISPLAY')
const patientNameProfile = this.decodeDisplayLendProfile('PATIENT_NAME_DISPLAY')
const patientGenderProfile = this.decodeDisplayLendProfile('PATIENT_GENDER_DISPLAY')
......@@ -594,9 +658,13 @@ class SelfOrderPage extends Component {
const patientIdProfile = this.decodeDisplayLendProfile('PATIENT_ID_DISPLAY')
for (let chIndex in listOptionData) {
if (chIndex > 0 && chIndex < 10 && chIndex != 5
&& !listOptionData[chIndex].value
&& listOptionData[chIndex].name !== '其他') {
if (
chIndex > 0 &&
chIndex < 10 &&
chIndex != 5 &&
!listOptionData[chIndex].value &&
listOptionData[chIndex].name !== '其他'
) {
// 不是主治医生
tempTit = listOptionData[chIndex].title
tempStatus = true
......@@ -605,33 +673,37 @@ class SelfOrderPage extends Component {
}
break
}
if (((chIndex == 14 && sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2)
|| (chIndex == 15 && sysValues.OBS_MOBILE_BM_DISPLAY > 2)
|| (chIndex == 16 && sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2)
|| (chIndex == 17 && sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2)
|| (chIndex == 18 && sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 2)
|| (chIndex == 19 && sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 2))
&& !listOptionData[chIndex].value) {
if (
((chIndex == 14 && sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2) ||
(chIndex == 15 && sysValues.OBS_MOBILE_BM_DISPLAY > 2) ||
(chIndex == 16 && sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2) ||
(chIndex == 17 && sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2) ||
(chIndex == 18 && sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 2) ||
(chIndex == 19 && sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 2)) &&
!listOptionData[chIndex].value
) {
tempTit = listOptionData[chIndex].title
tempStatus = true
break
}
if (isLendOrder &&
(chIndex == 20 && patientNameProfile.required ||
chIndex == 21 && patientGenderProfile.required ||
chIndex == 22 && patientAgeProfile.required ||
chIndex == 23 && hospitalizationNumberProfile.required ||
chIndex == 24 && patientIdProfile.required
) &&
if (
isLendOrder &&
((chIndex == 20 && patientNameProfile.required) ||
(chIndex == 21 && patientGenderProfile.required) ||
(chIndex == 22 && patientAgeProfile.required) ||
(chIndex == 23 && hospitalizationNumberProfile.required) ||
(chIndex == 24 && patientIdProfile.required)) &&
!listOptionData[chIndex].value
) {
tempTit = listOptionData[chIndex].title
tempStatus = true
break
}
if (isLendOrder && chIndex == 5 && doctorNameProfile.required && (
listOptionData[chIndex].value != '-1' ||
!listOptionData[chIndex].inputValue)
if (
isLendOrder &&
chIndex == 5 &&
doctorNameProfile.required &&
(listOptionData[chIndex].value != '-1' || !listOptionData[chIndex].inputValue)
) {
tempTit = listOptionData[chIndex].title
tempStatus = true
......@@ -639,7 +711,7 @@ class SelfOrderPage extends Component {
}
}
this.setState({
canSubFlag: !tempStatus
canSubFlag: !tempStatus,
})
if (isSubCheck && tempStatus) {
show(`${tempTit}${curTip},不能提交`)
......@@ -683,18 +755,21 @@ class SelfOrderPage extends Component {
// }
}
})
this.setState({
this.setState(
{
currentItem: item,
listOptionData: listOptionData
}, () => {
listOptionData: listOptionData,
},
() => {
that.changeCanSub()
})
},
)
}
// 关闭弹窗
handleCloseModal(show) {
this.setState({
showTypePop: show
showTypePop: show,
})
}
......@@ -704,7 +779,7 @@ class SelfOrderPage extends Component {
let { selfOrderOption } = this.props
let tempOption = []
let that = this
const {isLendOrder} = this.props.navigation.getParam('params')
const { isLendOrder } = this.props.navigation.getParam('params')
if (selfOrderOption.length === 0) {
show(`当前${currentTitle}为空`)
return
......@@ -716,22 +791,26 @@ class SelfOrderPage extends Component {
// 兼容旧接口 customers结构有可能是扁平的, 要改成层级的
if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) {
customers = R.map(cus => ({
bill_to_sites: [{
bill_to_sites: [
{
bill_to_site_code: cus.bill_to_site_code,
bill_to_site_name: cus.bill_to_site_name,
ship_to_sites: [{
ship_to_sites: [
{
ship_to_site_code: cus.ship_to_site_code,
ship_to_site_name: cus.ship_to_site_name,
customer_doctor: cus.customer_doctor
}]
}],
customer_doctor: cus.customer_doctor,
},
],
},
],
customer_code: cus.customer_code,
customer_name: cus.customer_name,
}))(customers)
}
that.setState({
localCustomersOption: customers
localCustomersOption: customers,
})
// 去重医院数据
......@@ -781,9 +860,11 @@ class SelfOrderPage extends Component {
}
tempOption = this.changeNameAndValue(filterOpt, 'source_inv_name', 'source_inv_code')
}
that.setState({
listCurrentOption: [...tempOption]
}, () => {
that.setState(
{
listCurrentOption: [...tempOption],
},
() => {
if (tempOption && tempOption.length === 0) {
show('当前数据为空!')
return
......@@ -792,7 +873,8 @@ class SelfOrderPage extends Component {
setTimeout(() => {
that.handleCloseModal(true)
}, 500)
})
},
)
}
// 修改选择器为属性 name 和 value
......@@ -801,8 +883,7 @@ class SelfOrderPage extends Component {
if (data && data.length > 0) {
data.forEach(item => {
let obj = {}
obj.name = item[nameType],
obj.value = item[valueType]
;(obj.name = item[nameType]), (obj.value = item[valueType])
result.push(obj)
})
}
......@@ -812,18 +893,21 @@ class SelfOrderPage extends Component {
// 组织 点击
handleOrganizationCheck(curData) {
let { props } = this
this.setState({
this.setState(
{
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
}
}, () => {
value: curData.value,
},
},
() => {
let params = {
access_token: props.token
access_token: props.token,
}
props.requestSelfOrganizations(params)
})
},
)
}
/**
......@@ -831,12 +915,12 @@ class SelfOrderPage extends Component {
* @param {*} org_code
*/
async getDepartmentsByOrg(org_code) {
const {token, global_domain_config, userInfo} = this.props
const { token, global_domain_config, userInfo } = this.props
const params = {
access_token: token,
org_code,
seller_code: userInfo.user_name,
scope_flag: 'Y'
scope_flag: 'Y',
}
try {
const res = await reqOrgDepartments(global_domain_config, params)
......@@ -845,13 +929,15 @@ class SelfOrderPage extends Component {
let departments = res.data.relationships
this.setState({ departments })
const {listOptionData, sysValues} = this.state
const { listOptionData, sysValues } = this.state
const noop = () => {}
// 部门只有一个时直接设置
R.cond([
[R.equals(0), () => setTimeout(() =>show('当前组织没有部门信息'), 4000)],
[R.equals(1), () => {
[R.equals(0), () => setTimeout(() => show('当前组织没有部门信息'), 4000)],
[
R.equals(1),
() => {
const dep = R.head(departments)
listOptionData[14].name = dep.department_name
listOptionData[14].value = dep.department_code
......@@ -859,13 +945,13 @@ class SelfOrderPage extends Component {
// 只有一个部门时可以自动设置
this.autoSetBMAndSFAndDMWhildSelectDepartment(dep)
}],
[R.T, noop]
},
],
[R.T, noop],
])(R.length(departments))
} catch (error) {
console.log(error)
}
}
/**
......@@ -878,30 +964,41 @@ class SelfOrderPage extends Component {
// 业务经理只有一个时,直接设置业务经理
R.cond([
[R.equals(0), () => show('当前部门没有业务经理')],
[R.equals(1), () => {
[
R.equals(1),
() => {
const bm = R.pathOr([], ['business_manager_list', 0])(department)
listOptionData[15].name = bm.business_manager_name
listOptionData[15].value = bm.business_manager_code
this.setState({ listOptionData })
}],
[R.T, noop]
},
],
[R.T, noop],
])(R.length(department.business_manager_list))
// 跟台员只有一个
R.ifElse(R.equals(1), () => {
R.ifElse(
R.equals(1),
() => {
const sf = R.pathOr([], ['surgery_follower_list', 0])(department)
listOptionData[16].name = sf.surgery_follower_name
listOptionData[16].value = sf.surgery_follower_code
this.setState({ listOptionData })
}, noop)(R.length(department.surgery_follower_list))
},
noop,
)(R.length(department.surgery_follower_list))
// 送货员只有一个
R.ifElse(R.equals(1), () => {
R.ifElse(
R.equals(1),
() => {
const dm = R.pathOr([], ['deliveryman_list', 0])(department)
listOptionData[17].name = dm.deliveryman_name
listOptionData[17].value = dm.deliveryman_code
this.setState({ listOptionData })
}, noop)(R.length(department.deliveryman_list))
},
noop,
)(R.length(department.deliveryman_list))
}
/**
......@@ -910,13 +1007,15 @@ class SelfOrderPage extends Component {
async getOrganizationData() {
let { state, props } = this
let params = {
access_token: props.token
access_token: props.token,
}
let that = this
let { global_domain_config } = props
let orgResult = await reqSelfOrganizations(global_domain_config, params);
let orgResult = await reqSelfOrganizations(global_domain_config, params)
if (orgResult.error_code == 0) {
let { data: { organizations } } = orgResult
let {
data: { organizations },
} = orgResult
let { listOptionData, sysValues } = state
// props.requestListDataSuccess(organizations)
let filterOpt = dedupQuoteArray(organizations, 'org_code')
......@@ -927,16 +1026,19 @@ class SelfOrderPage extends Component {
if (filterOpt.length === 1) {
listOptionData[1].name = filterOpt[0].org_name
listOptionData[1].value = filterOpt[0].org_code
that.setState({
listOptionData
}, () => {
that.setState(
{
listOptionData,
},
() => {
that.organizationGetCustomerData()
setTimeout(() => {
if (sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 0) {
that.getDepartmentsByOrg(listOptionData[1].value)
}
}, 1000);
})
}, 1000)
},
)
}
// 贵州需要不显示组织, 所以只能每个用户只能授权1个组织
......@@ -945,11 +1047,11 @@ class SelfOrderPage extends Component {
show(`请先选择组织`)
}
} else if (orgResult.error_code == 41006) {
show('登录过期,请重新登录');
props.exitLoginStatus();
show('登录过期,请重新登录')
props.exitLoginStatus()
} else {
let error_msg = orgResult.error_msg || orgResult.message
show(error_msg);
show(error_msg)
}
}
......@@ -962,7 +1064,7 @@ class SelfOrderPage extends Component {
// objName有值直接是部门
if (!!objName && !this.judgeDepartmentIsNull()) return
const {departments, listOptionData} = this.state
const { departments, listOptionData } = this.state
let options = departments
// 非部门
......@@ -972,19 +1074,21 @@ class SelfOrderPage extends Component {
options = R.propOr([], objName, dep)
}
const listOptions = R.map(R.applySpec({
const listOptions = R.map(
R.applySpec({
name: R.prop(itemName),
value: R.prop(itemVal)
}))(options)
value: R.prop(itemVal),
}),
)(options)
this.setState({
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
value: curData.value,
},
showTypePop: true,
listCurrentOption: listOptions
listCurrentOption: listOptions,
})
}
......@@ -992,15 +1096,18 @@ class SelfOrderPage extends Component {
handleCustomerCheck(curData) {
let that = this
if (this.judgeOrgIsNull()) {
that.setState({
that.setState(
{
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
}
}, () => {
value: curData.value,
},
},
() => {
that.getCustomerData()
})
},
)
}
}
// 获取客户名称
......@@ -1023,23 +1130,29 @@ class SelfOrderPage extends Component {
}
let that = this
let { global_domain_config } = props
let cusResult = await reqSelfSurgeryHospital(global_domain_config, params);
let cusResult = await reqSelfSurgeryHospital(global_domain_config, params)
console.log(cusResult)
if (cusResult.error_code == 0) {
let { data: { customers } } = cusResult
let {
data: { customers },
} = cusResult
// customers结构有可能是扁平的, 要改成层级的,新版的
if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) {
customers = R.map(cus => ({
bill_to_sites: [{
bill_to_sites: [
{
bill_to_site_code: cus.bill_to_site_code,
bill_to_site_name: cus.bill_to_site_name,
ship_to_sites: [{
ship_to_sites: [
{
ship_to_site_code: cus.ship_to_site_code,
ship_to_site_name: cus.ship_to_site_name,
customer_doctor: cus.customer_doctor
}]
}],
customer_doctor: cus.customer_doctor,
},
],
},
],
customer_code: cus.customer_code,
customer_name: cus.customer_name,
}))(customers)
......@@ -1055,20 +1168,23 @@ class SelfOrderPage extends Component {
if (filterOpt.length === 1) {
listOptionData[2].name = filterOpt[0].customer_name
listOptionData[2].value = filterOpt[0].customer_code
that.setState({
that.setState(
{
listOptionData,
localCustomersOption: customers
}, () => {
localCustomersOption: customers,
},
() => {
that.customerGetBill()
that.customerGetShip()
})
},
)
}
} else if (cusResult.error_code == 41006) {
show('登录过期,请重新登录');
props.exitLoginStatus();
show('登录过期,请重新登录')
props.exitLoginStatus()
} else {
let error_msg = cusResult.error_msg || cusResult.message
show(error_msg);
show(error_msg)
}
}
......@@ -1079,30 +1195,35 @@ class SelfOrderPage extends Component {
let { localCustomersOption, listOptionData } = this.state
let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
that.setState({
that.setState(
{
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
}
}, () => {
value: curData.value,
},
},
() => {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
let options = []
if (isNotBlank(customer.bill_to_sites)) {
options = R.compose(
R.curry(dedupQuoteArray)(R.__, 'name'),
R.map(R.applySpec({
R.map(
R.applySpec({
value: R.prop('bill_to_site_code'),
name: R.prop('bill_to_site_name'),
})),
R.prop('bill_to_sites')
}),
),
R.prop('bill_to_sites'),
)(customer)
}
that.setState({
showTypePop: true,
listCurrentOption: options
})
listCurrentOption: options,
})
},
)
}
}
......@@ -1123,7 +1244,7 @@ class SelfOrderPage extends Component {
listOptionData[3].name = R.pathOr('', [0, 'bill_to_site_name'], sites)
listOptionData[3].value = R.pathOr('', [0, 'bill_to_site_code'], sites)
that.setState({
listOptionData
listOptionData,
})
}
}
......@@ -1133,13 +1254,15 @@ class SelfOrderPage extends Component {
let { localCustomersOption, listOptionData } = this.state
let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull() && this.judgeBillIsNull()) {
that.setState({
that.setState(
{
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
}
}, () => {
value: curData.value,
},
},
() => {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
let options = []
......@@ -1148,19 +1271,22 @@ class SelfOrderPage extends Component {
if (isNotBlank(billSite) && isNotBlank(billSite.ship_to_sites)) {
options = R.compose(
R.curry(dedupQuoteArray)(R.__, 'name'),
R.map(R.applySpec({
R.map(
R.applySpec({
value: R.prop('ship_to_site_code'),
name: R.prop('ship_to_site_name'),
})),
R.prop('ship_to_sites')
}),
),
R.prop('ship_to_sites'),
)(billSite)
}
}
that.setState({
showTypePop: true,
listCurrentOption: options
})
listCurrentOption: options,
})
},
)
}
}
......@@ -1173,7 +1299,7 @@ class SelfOrderPage extends Component {
let that = this
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
if (R.any(isBlank, [customer, customer.bill_to_sites]) ) {
if (R.any(isBlank, [customer, customer.bill_to_sites])) {
return show(`当前${listOptionData[4].title}为空`)
}
......@@ -1197,7 +1323,7 @@ class SelfOrderPage extends Component {
listOptionData[4].name = shipSites[0].ship_to_site_name
listOptionData[4].value = shipSites[0].ship_to_site_code
that.setState({
listOptionData
listOptionData,
})
}
}
......@@ -1209,14 +1335,16 @@ class SelfOrderPage extends Component {
let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
// 点击
that.setState({
that.setState(
{
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
}
}, () => {
let tempOption = [{name: '其他', value: '-1'}]
value: curData.value,
},
},
() => {
let tempOption = [{ name: '其他', value: '-1' }]
if (isNotBlank(localCustomersOption) && listOptionData[2].value) {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value))(localCustomersOption)
......@@ -1230,11 +1358,13 @@ class SelfOrderPage extends Component {
if (isNotBlank(ship)) {
tempOption = R.compose(
R.concat(R.__, tempOption),
R.map(R.applySpec({
R.map(
R.applySpec({
value: R.prop('customer_doctor'),
name: R.prop('customer_doctor')
})),
R.filter(R.compose(isNotBlank, R.prop('customer_doctor')))
name: R.prop('customer_doctor'),
}),
),
R.filter(R.compose(isNotBlank, R.prop('customer_doctor'))),
)(ship)
}
}
......@@ -1244,9 +1374,10 @@ class SelfOrderPage extends Component {
tempOption = dedupQuoteArray(tempOption, 'name')
that.setState({
showTypePop: true,
listCurrentOption: [...tempOption]
})
listCurrentOption: [...tempOption],
})
},
)
}
}
// 主治医生 输入
......@@ -1257,11 +1388,14 @@ class SelfOrderPage extends Component {
item.inputValue = text
}
})
this.setState({
listOptionData: listOptionData
}, () => {
this.setState(
{
listOptionData: listOptionData,
},
() => {
this.changeCanSub()
})
},
)
}
// 手术名称 输入
......@@ -1291,7 +1425,7 @@ class SelfOrderPage extends Component {
}
})
this.setState({
listOptionData: listOptionData
listOptionData: listOptionData,
})
}
this.closeDateModal(true)
......@@ -1300,7 +1434,7 @@ class SelfOrderPage extends Component {
// 关闭日期选择器
closeDateModal(show) {
this.setState({
dateModelPop: show
dateModelPop: show,
})
}
......@@ -1315,11 +1449,14 @@ class SelfOrderPage extends Component {
item.dateValue = formatStrForDate(date)
}
})
that.setState({
listOptionData: listOptionData
}, () => {
that.setState(
{
listOptionData: listOptionData,
},
() => {
that.changeCanSub()
})
},
)
}
/**
......@@ -1331,43 +1468,52 @@ class SelfOrderPage extends Component {
let { token, global_domain_config } = this.props
let params = {
access_token: token,
category_set: 'PRODUCT_LINE_CATEGORY'
category_set: 'PRODUCT_LINE_CATEGORY',
}
const res = await requestSurgeryType(global_domain_config, params).catch(err => {return {}})
const res = await requestSurgeryType(global_domain_config, params).catch(err => {
return {}
})
if (res.error_code !== 0) return
let surgery_types = R.compose(
R.map(R.applySpec({
R.map(
R.applySpec({
name: R.prop('category_name'),
value: R.prop('category_code'),
})),
R.propOr([], 'data')
}),
),
R.propOr([], 'data'),
)(res)
this.setState({ surgery_types })
}
// 手术类型 点击
async handleSurTypeCheck(curData) {
let {surgery_types} = this.state
let { surgery_types } = this.state
if (!this.judgeOrgIsNull() || !this.judgeCustomerIsNull()) {
return
}
if (isBlank(surgery_types)) { return show('手术类型为空') }
if (isBlank(surgery_types)) {
return show('手术类型为空')
}
this.setState({
this.setState(
{
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
value: curData.value,
},
listCurrentOption: surgery_types,
surgery_types
}, () => {
surgery_types,
},
() => {
setTimeout(() => {
this.handleCloseModal(true)
}, 100)
})
},
)
}
// 订单类型 点击
......@@ -1375,21 +1521,24 @@ class SelfOrderPage extends Component {
let { props } = this
const { listOptionData } = this.state
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({
this.setState(
{
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
}
}, () => {
value: curData.value,
},
},
() => {
let params = {
access_token: props.token,
value_set_code: 'SUR_ORDER_TYPE',
org_code: listOptionData[1].value,
order_type: 'SUR_ORDER_TYPE'
order_type: 'SUR_ORDER_TYPE',
}
props.requestSelfOrderType(params)
})
},
)
}
}
......@@ -1403,11 +1552,14 @@ class SelfOrderPage extends Component {
item.value = certFlag
}
})
that.setState({
listOptionData: listOptionData
}, () => {
that.setState(
{
listOptionData: listOptionData,
},
() => {
that.changeCanSub()
})
},
)
}
// // 自动更换同品不同器械包 点击
......@@ -1418,7 +1570,7 @@ class SelfOrderPage extends Component {
// 选择产品 点击跳转
handleProductCheck() {
const { localCustomersOption, listOptionData } = this.state
console.log(localCustomersOption);
console.log(localCustomersOption)
if (isBlank(listOptionData[2].value) || isBlank(listOptionData[3].value) || isBlank(listOptionData[4].value)) {
return show('请先选择客户相关信息')
......@@ -1440,14 +1592,14 @@ class SelfOrderPage extends Component {
product_line_category_list: R.compose(
R.uniqBy(R.prop('product_line_category_code')),
R.unnest,
R.pluck('product_line_category_list')
R.pluck('product_line_category_list'),
)(values),
supplier_code: R.pathOr('', [0, 'supplier_code'])(values),
supplier_name: R.pathOr('', [0, 'supplier_name'])(values),
}
}),
R.keys,
R.clone
R.clone,
)(suppliers)
}
......@@ -1458,11 +1610,15 @@ class SelfOrderPage extends Component {
title: `选择产品`,
selfData: {
org_code: listOptionData[1].value,
doctor_name: (listOptionData[5].name == '其他' || listOptionData[5].name == '请选择') ? listOptionData[5].inputValue : listOptionData[5].name,
doctor_name:
listOptionData[5].name == '其他' || listOptionData[5].name == '请选择'
? listOptionData[5].inputValue
: listOptionData[5].name,
authorizations,
productAuthorization
productAuthorization,
customer_code: listOptionData[2].value,
},
productCallBack: that.productCallBack.bind(that)
productCallBack: that.productCallBack.bind(that),
})
}
}
......@@ -1487,11 +1643,14 @@ class SelfOrderPage extends Component {
}
}
listOptionData[8] = local_prod
this.setState({
listOptionData: listOptionData
}, () => {
this.setState(
{
listOptionData: listOptionData,
},
() => {
this.changeCanSub()
})
},
)
}
// 备注 输入
......@@ -1503,21 +1662,23 @@ class SelfOrderPage extends Component {
}
})
this.setState({
listOptionData: listOptionData
listOptionData: listOptionData,
})
}
// 借货仓库 点击
handleWareCheck(curData){
handleWareCheck(curData) {
let { state, props } = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState(
{
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
}
}, () => {
value: curData.value,
},
},
() => {
// 在此修改接口
let params = {
access_token: props.token,
......@@ -1525,10 +1686,11 @@ class SelfOrderPage extends Component {
customer_code: state.listOptionData[2].value,
bill_to_site_code: state.listOptionData[3].value,
ship_to_site_code: state.listOptionData[4].value,
process_code: 'COLLECT'
process_code: 'COLLECT',
}
props.requestQuickSurColSetting(params)
})
},
)
}
}
......@@ -1556,87 +1718,88 @@ class SelfOrderPage extends Component {
noData: false,
storageOptions: {
skipBackup: true,
path: 'WisdomTrans' // 存储本地地址
path: 'WisdomTrans', // 存储本地地址
},
}
};
ImagePicker.showImagePicker(options, async (res) => {
ImagePicker.showImagePicker(options, async res => {
if (res.didCancel) {
console.log('User cancelled photo picker');
}
else if (res.error) {
console.log('ImagePicker Error: ', res.error);
console.log('User cancelled photo picker')
} else if (res.error) {
console.log('ImagePicker Error: ', res.error)
if (res.error.indexOf('Camera permissions not granted') > -1) {
Alert.alert(('提示信息', 'APP需要使用相机,请打开相机权限允许APP使用'), [{
Alert.alert(('提示信息', 'APP需要使用相机,请打开相机权限允许APP使用'), [
{
text: '设置',
onPress: () => {
Linking.openURL('app-settings:')
.catch(err => console.log('error', err))
}
}, {
text: '取消'
}])
Linking.openURL('app-settings:').catch(err => console.log('error', err))
},
},
{
text: '取消',
},
])
}
if (res.error.indexOf('Photo library permissions not granted') > -1) {
Alert.alert('提示信息', 'APP需要使用相册,请打开相册权限允许APP使用', [{
Alert.alert('提示信息', 'APP需要使用相册,请打开相册权限允许APP使用', [
{
text: '设置',
onPress: () => {
Linking.openURL('app-settings:')
.catch(err => console.log('error', err))
}
}, {
text: '取消'
}]);
}
Linking.openURL('app-settings:').catch(err => console.log('error', err))
},
},
{
text: '取消',
},
])
}
else if (res.customButton) {
console.log('User tapped custom button: ', res.customButton);
} else if (res.customButton) {
console.log('User tapped custom button: ', res.customButton)
} else {
that.changeSubLoding(true, '上传中')
let source; //保存选中的图片
let source //保存选中的图片
if (Platform.OS === 'android') {
source = res.uri;
source = res.uri
} else {
source = res.uri.replace('file://', '');
source = res.uri.replace('file://', '')
if (!res.fileName) {
res.fileName = new Date().getTime() + '.HEIC'
}
}
const formData = new FormData();
let file = { uri: source, type: 'multipart/form-data', name: res.fileName };
formData.append('file', file);
const formData = new FormData()
let file = { uri: source, type: 'multipart/form-data', name: res.fileName }
formData.append('file', file)
let params = {
access_token: props.token,
formData
formData,
}
let { global_domain_config } = props
//上传图片接口
let imgResult = await uploadTransImg(global_domain_config, params);
let imgResult = await uploadTransImg(global_domain_config, params)
console.log('res=', imgResult)
if (imgResult.error_code == 0) {
that.changeSubLoding(false)
// 提交订单
show('上传成功');
show('上传成功')
let { url } = imgResult.data
localPhoOption.push(source); // 本地图片地址
localPhoOption.push(source) // 本地图片地址
listOptionData[13].uploadImgArr.push(url) // 服务器图片地址
that.setState({
localPhoOption,
listOptionData
});
listOptionData,
})
} else if (imgResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
show('登录过期,请重新登录')
props.exitLoginStatus()
} else {
that.changeSubLoding(false)
let error_msg = imgResult.error_msg || imgResult.message
show(error_msg);
show(error_msg)
}
}
})
}
// 删除单个照片 点击
......@@ -1644,12 +1807,15 @@ class SelfOrderPage extends Component {
let { listOptionData, localPhoOption } = this.state
localPhoOption.splice(index, 1) // 删除本地地址
listOptionData[7].uploadImgArr.splice(index, 1) // 删除服务器地址
this.setState({
this.setState(
{
listOptionData,
localPhoOption
}, () => {
localPhoOption,
},
() => {
show('删除成功')
})
},
)
}
// 生成订单 点击
......@@ -1663,35 +1829,37 @@ class SelfOrderPage extends Component {
if (state.stop) {
let params = {
access_token: props.token,
path: state.audioPath
path: state.audioPath,
}
let { global_domain_config } = props
console.log('params==', params)
let audioResult = await requestSelfAudio(global_domain_config, params);
let audioResult = await requestSelfAudio(global_domain_config, params)
console.log('res==', audioResult)
that.changeSubLoding(true, '上传中')
if (audioResult.error_code == 0) {
// 提交订单
that.setState({
that.setState(
{
listOptionData: state.listOptionData.map((item, index) => {
if (index == 12) {
item.value = audioResult.data.url
}
return item
})
}, () => {
}),
},
() => {
that.changeSubLoding(false)
that.getSumLinesOps()
})
},
)
} else if (audioResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
show('登录过期,请重新登录')
props.exitLoginStatus()
} else {
that.changeSubLoding(false)
let error_msg = audioResult.error_msg || audioResult.message
show(error_msg);
show(error_msg)
that.getSumLinesOps()
}
} else {
......@@ -1703,7 +1871,7 @@ class SelfOrderPage extends Component {
// 提交订单
submitSelfOrder() {
let { state, props } = this
const {isLendOrder} = this.props.navigation.getParam('params')
const { isLendOrder } = this.props.navigation.getParam('params')
let tempSubOption = state.submitOption
tempSubOption.seller_code = state.listOptionData[0].value
......@@ -1733,13 +1901,13 @@ class SelfOrderPage extends Component {
tempSubOption.collect_src_inv_code = state.listOptionData[18].value
// 有部门显示的提交
const {sysValues} = state
const { sysValues } = state
sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 0 && (tempSubOption.department_code = state.listOptionData[14].value)
sysValues.OBS_MOBILE_BM_DISPLAY > 0 && (tempSubOption.business_manager_code = state.listOptionData[15].value)
sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 0 && (tempSubOption.surgery_follower_code = state.listOptionData[16].value)
sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 0 &&
(tempSubOption.surgery_follower_code = state.listOptionData[16].value)
sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 0 && (tempSubOption.deliveryman_code = state.listOptionData[17].value)
const patientNameProfile = this.decodeDisplayLendProfile('PATIENT_NAME_DISPLAY')
const patientGenderProfile = this.decodeDisplayLendProfile('PATIENT_GENDER_DISPLAY')
const patientAgeProfile = this.decodeDisplayLendProfile('PATIENT_AGE_DISPLAY')
......@@ -1748,7 +1916,9 @@ class SelfOrderPage extends Component {
isLendOrder && patientNameProfile.show && (tempSubOption.patient_name = state.listOptionData[20].value)
isLendOrder && patientGenderProfile.show && (tempSubOption.patient_gender = state.listOptionData[21].value)
isLendOrder && patientAgeProfile.show && (tempSubOption.patient_age = state.listOptionData[22].value)
isLendOrder && hospitalizationNumberProfile.show && (tempSubOption.hospitalization_number = state.listOptionData[23].value)
isLendOrder &&
hospitalizationNumberProfile.show &&
(tempSubOption.hospitalization_number = state.listOptionData[23].value)
isLendOrder && patientIdProfile.show && (tempSubOption.patient_id = state.listOptionData[24].value)
// tempSubOption.replace_item_flag = state.listOptionData[10].replace_item_flag
......@@ -1756,7 +1926,7 @@ class SelfOrderPage extends Component {
let params = {
access_token: props.token,
data: { ...tempSubOption }
data: { ...tempSubOption },
}
console.log('params=', params)
props.requestSelfSumbit(params)
......@@ -1771,7 +1941,11 @@ class SelfOrderPage extends Component {
let res_lines = []
let showPackageTip = false
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 => {
// let select_arr = lef_item[LocalVariable.SELECTED_DATA_ARR]
let select_arr = lef_item.selectedArr || []
......@@ -1780,11 +1954,17 @@ class SelfOrderPage extends Component {
// 手术套包
select_arr.forEach(sel_item => {
let template_number = sel_item.template_number
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 => {
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) {
if (
lin_item[LocalVariable.SELECTED_DATA_ARR] &&
lin_item[LocalVariable.SELECTED_DATA_ARR].length > 0
) {
lin_item[LocalVariable.SELECTED_DATA_ARR].forEach(sel_item => {
if (sel_item[LocalVariable.QUANTITY_FIELD] > 0) {
// sel_item['template_number'] = template_number // 暂时不用
......@@ -1798,7 +1978,10 @@ 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) {
showPackageTip = true
......@@ -1811,17 +1994,15 @@ class SelfOrderPage extends Component {
res_lines.push(sel_item)
}
})
}
else if (lef_item.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
} else if (lef_item.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
// 零散器械
select_arr.forEach(sel_item => {
if(sel_item[LocalVariable.QUANTITY_FIELD] > 0){
if (sel_item[LocalVariable.QUANTITY_FIELD] > 0) {
sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item)
}
})
}
else {
} else {
// 耗材
if (select_arr[0].details && select_arr[0].details.length > 0) {
// 大-中-小类
......@@ -1836,7 +2017,7 @@ class SelfOrderPage extends Component {
} else {
// 大类-小类
select_arr.forEach(sel_item => {
if(sel_item[LocalVariable.QUANTITY_FIELD] > 0){
if (sel_item[LocalVariable.QUANTITY_FIELD] > 0) {
sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item)
}
......@@ -1874,19 +2055,20 @@ class SelfOrderPage extends Component {
listOptionData[8].sub_lines = end_lines
that.setState({
listOptionData: listOptionData
}, () => {
that.setState(
{
listOptionData: listOptionData,
},
() => {
that.submitSelfOrder()
})
},
)
// if (showPackageTip) {
// this.refs.PackageModel.show()
// } else {
// this.refs.CertModel.show('需要携带合格证?')
// }
}
// 判断组织是否为空
......@@ -1906,10 +2088,15 @@ class SelfOrderPage extends Component {
* @returns
*/
judgeDepartmentIsNull() {
let {listOptionData } = this.state
return R.ifElse(R.isEmpty, () => {show('请先选择部门'); return R.F()}, R.T)(
R.path(['listOptionData', 14, 'value'], this.state)
)
let { listOptionData } = this.state
return R.ifElse(
R.isEmpty,
() => {
show('请先选择部门')
return R.F()
},
R.T,
)(R.path(['listOptionData', 14, 'value'], this.state))
}
// 判断客户名称是否为空
......@@ -1929,10 +2116,15 @@ class SelfOrderPage extends Component {
* @returns
*/
judgeBillIsNull() {
let {listOptionData } = this.state
return R.ifElse(R.isEmpty, () => {show('请先选择收单地点'); return R.F()}, R.T)(
R.path(['listOptionData', 3, 'value'], this.state)
)
let { listOptionData } = this.state
return R.ifElse(
R.isEmpty,
() => {
show('请先选择收单地点')
return R.F()
},
R.T,
)(R.path(['listOptionData', 3, 'value'], this.state))
}
// 处理提交后返回的数据
......@@ -1942,23 +2134,30 @@ class SelfOrderPage extends Component {
if (selfOrderOption) {
if (selfOrderOption.create_success == 'N') {
// 打开库存不足弹窗
this.setState({
not_enough_items_list: selfOrderOption.not_enough_items_list
}, () => {
this.setState(
{
not_enough_items_list: selfOrderOption.not_enough_items_list,
},
() => {
// 解决 IOS 弹窗显示问题
setTimeout(() => {
that.setState({
showNotEnogPop: true
showNotEnogPop: true,
})
}, 500)
})
},
)
} else if (selfOrderOption.create_success == 'Y') {
// 打开下单成功页面
that.clearAllData()
let { state: { params: { title } } } = that.props.navigation
let {
state: {
params: { title },
},
} = that.props.navigation
that.props.navigation.navigate('SubSuccPage', {
title: `${title} - 下单成功`,
orderNumber: selfOrderOption.survey_collect_number
orderNumber: selfOrderOption.survey_collect_number,
// orderNumber: selfOrderOption.order_number
})
}
......@@ -1974,7 +2173,7 @@ class SelfOrderPage extends Component {
listOptionData,
currentTime: 0,
stop: false,
localPhoOption: []
localPhoOption: [],
})
}
......@@ -1984,7 +2183,7 @@ class SelfOrderPage extends Component {
* @return {*}
*/
patientInfoInputHandler(text, item) {
const {listOptionData} = this.state
const { listOptionData } = this.state
item.value = text
this.setState({ listOptionData }, () => {
this.changeCanSub()
......@@ -1994,19 +2193,22 @@ class SelfOrderPage extends Component {
handleGenderCheck(curData) {
let { sexTypeOption } = this.state
let that = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
that.setState({
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
that.setState(
{
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
}
}, () => {
value: curData.value,
},
},
() => {
that.setState({
showTypePop: true,
listCurrentOption: [...sexTypeOption]
})
listCurrentOption: [...sexTypeOption],
})
},
)
}
}
......@@ -2028,20 +2230,23 @@ class SelfOrderPage extends Component {
handleNotEnoughCallBack() {
let { submitOption } = this.state
let that = this
this.setState({
this.setState(
{
submitOption: {
...submitOption,
force_balance_check_flag: 'N'
}
}, () => {
force_balance_check_flag: 'N',
},
},
() => {
// that.handleSubmit()
that.submitSelfOrder()
})
},
)
}
// 库存不足弹窗关闭
handleNotEnoughCloseModal(show) {
this.setState({
showNotEnogPop: show
showNotEnogPop: show,
})
}
......@@ -2049,14 +2254,14 @@ class SelfOrderPage extends Component {
handleZoomPicture(flag, index) {
this.setState({
isShowImage: flag,
currShowImgIndex: index || 0
currShowImgIndex: index || 0,
})
}
// 返回备注以上的元素
renderListItem() {
let { listOptionData, dateModelPop, sysValues } = this.state
const {sysProfiles, navigation} = this.props
const { sysProfiles, navigation } = this.props
const isShowOrg = R.compose(R.equals('Y'), R.prop('OBS_SHOW_ORG_FLAG'))(sysProfiles)
const { isLendOrder } = navigation.getParam('params')
......@@ -2077,10 +2282,9 @@ class SelfOrderPage extends Component {
listDefaValue={'name'}
listTitle={'title'}
/>
{
isShowOrg && (
{isShowOrg && (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={true}
listItem={listOptionData[1]}
listName={'name'}
......@@ -2088,62 +2292,73 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleOrganizationCheck(listOptionData[1])}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 1 && (
)}
{sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2}
listItem={listOptionData[14]}
listName={'name'}
listTitle={'title'}
listCallBack={() => this.handleDepartmentCheck(listOptionData[14], null, 'department_name', 'department_code')}
listCallBack={() =>
this.handleDepartmentCheck(listOptionData[14], null, 'department_name', 'department_code')
}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_BM_DISPLAY > 1 && (
)}
{sysValues.OBS_MOBILE_BM_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_BM_DISPLAY > 2}
listItem={listOptionData[15]}
listName={'name'}
listTitle={'title'}
listCallBack={this.handleDepartmentCheck.bind(this, listOptionData[15], 'business_manager_list', 'business_manager_name', 'business_manager_code')}
listCallBack={this.handleDepartmentCheck.bind(
this,
listOptionData[15],
'business_manager_list',
'business_manager_name',
'business_manager_code',
)}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 1 && (
)}
{sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2}
listItem={listOptionData[16]}
listName={'name'}
listTitle={'title'}
listCallBack={this.handleDepartmentCheck.bind(this, listOptionData[16], 'surgery_follower_list', 'surgery_follower_name', 'surgery_follower_code')}
listCallBack={this.handleDepartmentCheck.bind(
this,
listOptionData[16],
'surgery_follower_list',
'surgery_follower_name',
'surgery_follower_code',
)}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 1 && (
)}
{sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2}
listItem={listOptionData[17]}
listName={'name'}
listTitle={'title'}
listCallBack={this.handleDepartmentCheck.bind(this, listOptionData[17], 'deliveryman_list', 'deliveryman_name', 'deliveryman_code')}
listCallBack={this.handleDepartmentCheck.bind(
this,
listOptionData[17],
'deliveryman_list',
'deliveryman_name',
'deliveryman_code',
)}
listHasArrow={true}
/>
)
}
)}
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={true}
listItem={listOptionData[2]}
listName={'name'}
......@@ -2152,7 +2367,7 @@ class SelfOrderPage extends Component {
listHasArrow={true}
/>
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={true}
listItem={listOptionData[3]}
listName={'name'}
......@@ -2161,7 +2376,7 @@ class SelfOrderPage extends Component {
listHasArrow={true}
/>
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={true}
listItem={listOptionData[4]}
listName={'name'}
......@@ -2169,10 +2384,10 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleShipCheck(listOptionData[4])}
listHasArrow={true}
/>
{
isLendOrder ? (doctorNameProfile.show &&
{isLendOrder ? (
doctorNameProfile.show && (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={doctorNameProfile.required}
listItem={listOptionData[5]}
listName={'name'}
......@@ -2181,10 +2396,12 @@ class SelfOrderPage extends Component {
listHasArrow={true}
listOtherInput={'请输入主治医生'}
otherInput={'showInput'}
otherInputCallBack={(text) => this.handleDoctorInput(text, listOptionData[5])}
/>) : (
otherInputCallBack={text => this.handleDoctorInput(text, listOptionData[5])}
/>
)
) : (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
// listHasAster={true}
listItem={listOptionData[5]}
listName={'name'}
......@@ -2193,10 +2410,9 @@ class SelfOrderPage extends Component {
listHasArrow={true}
listOtherInput={'请输入主治医生'}
otherInput={'showInput'}
otherInputCallBack={(text) => this.handleDoctorInput(text, listOptionData[5])}
otherInputCallBack={text => this.handleDoctorInput(text, listOptionData[5])}
/>
)
}
)}
{/* <PageListArrow
listActOpa={.8}
listHasAster={true}
......@@ -2208,7 +2424,7 @@ class SelfOrderPage extends Component {
isTitInputStyle={true}
/> */}
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={true}
listItem={listOptionData[6]}
listName={'name'}
......@@ -2216,10 +2432,9 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleSurDateCheck(listOptionData[6])}
listHasArrow={true}
/>
{
sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 1 &&
{sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 1 && (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listItem={listOptionData[19]}
listHasAster={sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 2}
listName={'name'}
......@@ -2227,9 +2442,8 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleSurTypeCheck(listOptionData[19])}
listHasArrow={true}
/>
}
{
isLendOrder && patientNameProfile.show &&
)}
{isLendOrder && patientNameProfile.show && (
<PageListArrow
listHasAster={true}
listItem={listOptionData[20]}
......@@ -2237,15 +2451,14 @@ class SelfOrderPage extends Component {
listHasAster={patientNameProfile.required}
listTitle={'title'}
listInputPlace={`请输入${listOptionData[20].title}`}
inputCallBack={(text) => this.patientInfoInputHandler(text, listOptionData[20])}
inputCallBack={text => this.patientInfoInputHandler(text, listOptionData[20])}
isTitInputStyle={true}
listCellStyle={styles.list_cell_box}
/>
}
{
isLendOrder && patientGenderProfile.show &&
)}
{isLendOrder && patientGenderProfile.show && (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={patientGenderProfile.required}
listItem={listOptionData[21]}
listName={'name'}
......@@ -2253,9 +2466,8 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleGenderCheck(listOptionData[21])}
listHasArrow={true}
/>
}
{
isLendOrder && patientAgeProfile.show &&
)}
{isLendOrder && patientAgeProfile.show && (
<PageListArrow
listHasAster={true}
listItem={listOptionData[22]}
......@@ -2263,13 +2475,12 @@ class SelfOrderPage extends Component {
listHasAster={patientAgeProfile.required}
listTitle={'title'}
listInputPlace={`请输入${listOptionData[22].title}`}
inputCallBack={(text) => this.patientInfoInputHandler(text, listOptionData[22])}
inputCallBack={text => this.patientInfoInputHandler(text, listOptionData[22])}
isTitInputStyle={true}
listCellStyle={styles.list_cell_box}
/>
}
{
isLendOrder && hospitalizationNumberProfile.show &&
)}
{isLendOrder && hospitalizationNumberProfile.show && (
<PageListArrow
listHasAster={true}
listItem={listOptionData[23]}
......@@ -2277,13 +2488,12 @@ class SelfOrderPage extends Component {
listHasAster={hospitalizationNumberProfile.required}
listTitle={'title'}
listInputPlace={`请输入${listOptionData[23].title}`}
inputCallBack={(text) => this.patientInfoInputHandler(text, listOptionData[23])}
inputCallBack={text => this.patientInfoInputHandler(text, listOptionData[23])}
isTitInputStyle={true}
listCellStyle={styles.list_cell_box}
/>
}
{
isLendOrder && patientIdProfile.show &&
)}
{isLendOrder && patientIdProfile.show && (
<PageListArrow
listHasAster={true}
listItem={listOptionData[24]}
......@@ -2291,13 +2501,13 @@ class SelfOrderPage extends Component {
listHasAster={patientIdProfile.required}
listTitle={'title'}
listInputPlace={`请输入${listOptionData[24].title}`}
inputCallBack={(text) => this.patientInfoInputHandler(text, listOptionData[24])}
inputCallBack={text => this.patientInfoInputHandler(text, listOptionData[24])}
isTitInputStyle={true}
listCellStyle={styles.list_cell_box}
/>
}
)}
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={true}
listItem={listOptionData[7]}
listName={'name'}
......@@ -2306,7 +2516,7 @@ class SelfOrderPage extends Component {
listHasArrow={true}
/>
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={true}
listItem={listOptionData[8]}
listName={'name'}
......@@ -2316,29 +2526,28 @@ class SelfOrderPage extends Component {
listMaxLines={1}
/>
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={true}
listItem={listOptionData[9]}
// listName={'name'}
listTitle={'title'}
listValue={'value'}
listCallBack={(radioFlag) => this.handleCertAndItemCheck(listOptionData[9], radioFlag)}
listCallBack={radioFlag => this.handleCertAndItemCheck(listOptionData[9], radioFlag)}
listIsAudio={true}
/>
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listItem={listOptionData[10]}
// listName={'name'}
listTitle={'title'}
listValue={'value'}
listCallBack={(radioFlag) => this.handleCertAndItemCheck(listOptionData[10], radioFlag)}
listCallBack={radioFlag => this.handleCertAndItemCheck(listOptionData[10], radioFlag)}
listIsAudio={true}
/>
{
sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 1 ?
{sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 1 ? (
<PageListArrow
listActOpa={.8}
listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 2}
listItem={listOptionData[18]}
listName={'name'}
......@@ -2346,17 +2555,18 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleWareCheck(listOptionData[18])}
listHasArrow={true}
/>
: <Text></Text>
}
) : (
<Text></Text>
)}
<DateModel
date={listOptionData[6].dateValue}
closeModal={(show) => this.closeDateModal(show)}
closeModal={show => this.closeDateModal(show)}
show={dateModelPop}
callback={(date) => this.dateModalCallback(date, listOptionData[6])}
callback={date => this.dateModalCallback(date, listOptionData[6])}
minuteInterval={30}
/>
{ this.renderPickerModel()}
{this.renderPickerModel()}
{/* { this.renderTipModelPackage()}
{ this.renderTipModelCert()} */}
</View>
......@@ -2383,7 +2593,7 @@ class SelfOrderPage extends Component {
show={showTypePop}
itemValue={currentItem.value}
itemTitle={currentTitle}
closeModal={(show) => this.handleCloseModal(show)}
closeModal={show => this.handleCloseModal(show)}
/>
</SafeAreaView>
)
......@@ -2396,18 +2606,22 @@ class SelfOrderPage extends Component {
<CellTextStyle style={list_common_item.remark_item}>
<View style={list_common_item.rema_box}>
<Text style={list_common_item.rema_tit}>备注</Text>
<View style={list_common_item.rema_Input_outer} >
<TouchableOpacity activeOpacity={1} style={list_common_item.rema_Input_inner} onPress={() => this.TextInput.focus()} >
<View style={list_common_item.rema_Input_outer}>
<TouchableOpacity
activeOpacity={1}
style={list_common_item.rema_Input_inner}
onPress={() => this.TextInput.focus()}
>
<TextInput
placeholder={'请输入备注信息'}
placeholderTextColor={placehold_text_color}
underlineColorAndroid={'transparent'}
multiline={true}
ref={textInput => this.TextInput = textInput}
ref={textInput => (this.TextInput = textInput)}
numberOfLines={8}
style={list_common_item.rema_Input}
maxLength={140}
onChangeText={(text) => this.handleRemarkInput(text, listOptionData[11])}
onChangeText={text => this.handleRemarkInput(text, listOptionData[11])}
defaultValue={listOptionData[11].value}
/>
</TouchableOpacity>
......@@ -2424,11 +2638,10 @@ class SelfOrderPage extends Component {
<CellTextStyle style={[list_common_item.reco_item, !stop ? '' : list_common_item.reco_play_height]}>
<View style={list_common_item.reco_btn_cont}>
{!stop ? <Text style={list_common_item.reco_btn_tit}>还有什么要安排的,可录音备注哟!</Text> : null}
{
!stop ?
{!stop ? (
<View style={list_common_item.reco_btn_inner}>
<TouchableOpacity
activeOpacity={.8}
activeOpacity={0.8}
style={list_common_item.reco_btn_box}
onLongPress={this._record}
onPressOut={this._stop}
......@@ -2439,26 +2652,29 @@ class SelfOrderPage extends Component {
<Text style={list_common_item.reco_btn_text}>长按录音</Text>
</TouchableOpacity>
</View>
: <View style={list_common_item.reco_play_box}>
) : (
<View style={list_common_item.reco_play_box}>
<View style={list_common_item.play_btn}>
<TouchableOpacity
activeOpacity={.8}
activeOpacity={0.8}
style={[list_common_item.reco_list_box, list_common_item.reco_del_btn]}
onPress={this._del}
>
<Text style={[list_common_item.reco_text, list_common_item.reco_del_tit]}> 删除 </Text>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
activeOpacity={0.8}
style={[list_common_item.reco_list_box, list_common_item.reco_play_btn]}
onPress={this._play}
>
<Text style={[list_common_item.reco_text, list_common_item.reco_play_tit]}> 点击播放({currentTime}'') </Text>
<Text style={[list_common_item.reco_text, list_common_item.reco_play_tit]}>
{' '}
点击播放({currentTime}''){' '}
</Text>
</TouchableOpacity>
</View>
</View>
}
)}
</View>
</CellTextStyle>
)
......@@ -2472,13 +2688,11 @@ class SelfOrderPage extends Component {
<View style={list_common_item.addpic_inner}>
<Text style={list_common_item.addpic_tit}>添加图片</Text>
<View style={list_common_item.addpic_cont}>
{
state.localPhoOption.length
{state.localPhoOption.length
? state.localPhoOption.map((item, index) => this.renderPicItem(item, index))
: null
}
: null}
<TouchableOpacity
activeOpacity={.8}
activeOpacity={0.8}
style={list_common_item.addpic_img_btn}
onPress={() => this.handleAddPicCheck()}
>
......@@ -2496,14 +2710,14 @@ class SelfOrderPage extends Component {
return (
<View style={list_common_item.addnew_pic_btn} key={index}>
<TouchableOpacity
activeOpacity={.8}
activeOpacity={0.8}
style={list_common_item.show_pic_btn}
onPress={() => this.handleZoomPicture(true, index)}
>
<Image style={icon_style} source={{ uri: item }} />
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
activeOpacity={0.8}
style={list_common_item.del_img_box}
onPress={(item, index) => this.handleDelPickCheck(item, index)}
>
......@@ -2532,7 +2746,7 @@ class SelfOrderPage extends Component {
let zoomImages = []
listOptionData[13].uploadImgArr.forEach(item => {
zoomImages.push({
url: `${global_domain_config}/${item}`
url: `${global_domain_config}/${item}`,
})
})
return (
......@@ -2540,38 +2754,41 @@ class SelfOrderPage extends Component {
isShowImage={isShowImage}
currShowImgIndex={currShowImgIndex}
zoomImages={zoomImages}
callBack={(flag) => this.handleZoomPicture(flag)}
callBack={flag => this.handleZoomPicture(flag)}
></ZoomPictureModel>
)
}
// 返回正在加载中
renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state
return (
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
)
return <LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
}
// 返回加载中
renderLodingItemNew() {
return (
<LoadingModel ref="LoadingModel" />
)
return <LoadingModel ref="LoadingModel" />
}
// 返回提交器械包提示
renderTipModelPackage() {
return (
<TipInfoNeedSelect ref="PackageModel" closeCallBack={() => this.modelPackageCertCB('replace_item_flag', 'N')} submitCallBack={() => this.modelPackageCertCB('replace_item_flag', 'Y')} />
<TipInfoNeedSelect
ref="PackageModel"
closeCallBack={() => this.modelPackageCertCB('replace_item_flag', 'N')}
submitCallBack={() => this.modelPackageCertCB('replace_item_flag', 'Y')}
/>
)
}
// 返回提交合格证提示
renderTipModelCert() {
return (
<TipInfoNeedSelect ref="CertModel" closeCallBack={() => this.modelPackageCertCB('take_cert_flag', 'N')} submitCallBack={() => this.modelPackageCertCB('take_cert_flag', 'Y')} />
<TipInfoNeedSelect
ref="CertModel"
closeCallBack={() => this.modelPackageCertCB('take_cert_flag', 'N')}
submitCallBack={() => this.modelPackageCertCB('take_cert_flag', 'Y')}
/>
)
}
......@@ -2584,7 +2801,7 @@ class SelfOrderPage extends Component {
not_enough_items_list={not_enough_items_list}
callback={() => this.handleNotEnoughCallBack()}
show={showNotEnogPop}
closeModal={(show) => this.handleNotEnoughCloseModal(show)}
closeModal={show => this.handleNotEnoughCloseModal(show)}
/>
</SafeAreaView>
)
......@@ -2596,17 +2813,10 @@ class SelfOrderPage extends Component {
let { title } = navigation.state.params
return (
<View style={styles.self_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle='light-content'
/>
<StatusBarView isReactStackNavigator={true} backgroundColor={promary_color} barStyle="light-content" />
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<ScrollView
style={styles.self_main}
showsVerticalScrollIndicator={false}
>
<ScrollView style={styles.self_main} showsVerticalScrollIndicator={false}>
{this.renderListItem()}
{this.renderRemarksItem()}
{this.renderRecordingItem()}
......@@ -2614,54 +2824,52 @@ class SelfOrderPage extends Component {
{this.renderZoomPicture()}
<FooterBtnStyle
style={canSubFlag ? styles.sub_btn_pro : ''}
activeOpacity={canSubFlag ? .8 : 1}
activeOpacity={canSubFlag ? 0.8 : 1}
title={'生成订单'}
textStyle={styles.sub_btn}
onPress={() => this.handleSubmit()}
/>
</ScrollView>
{this.renderLodingItem()}
{this.renderLodingItemNew()}
{this.renderNotEnoughModel()}
</SafeAreaView>
</View>
);
)
}
}
const styles = StyleSheet.create({
self_container: {
flex: 1,
backgroundColor: home_background_color
backgroundColor: home_background_color,
},
self_main: {
padding: 14
padding: 14,
},
sub_btn_pro: {
backgroundColor: promary_color
backgroundColor: promary_color,
},
sub_btn: {},
list_cont: {
flex: 1
flex: 1,
},
item_container: {
flex: 1
flex: 1,
},
cell_title: {
width: 120
width: 120,
},
cell_input: {
textAlign: 'left'
textAlign: 'left',
},
loding_back: {
backgroundColor: 'rgba(0, 0, 0, 0)'
}
backgroundColor: 'rgba(0, 0, 0, 0)',
},
})
const mapStateToProps = (state) => {
const mapStateToProps = state => {
return {
userInfo: state.login.userInfo,
token: state.login.token,
......@@ -2672,25 +2880,25 @@ const mapStateToProps = (state) => {
global_domain_config: state.login.global_domain_config,
local_sele_pro_options: state.selfOrder.local_sele_pro_options,
sysProfiles: state.login.sysProfiles,
lend_order_value_profiles: state.selfOrder.lend_order_value_profiles
lend_order_value_profiles: state.selfOrder.lend_order_value_profiles,
}
}
const mapDispatchToProps = (dispatch) => {
const mapDispatchToProps = dispatch => {
return {
requestSelfOrganizations: (params) => {
requestSelfOrganizations: params => {
dispatch(requestSelfOrganizations(params))
},
requestSelfSurgeryHospital: (params) => {
requestSelfSurgeryHospital: params => {
dispatch(requestSelfSurgeryHospital(params))
},
requestSelfOrderType: (params) => {
requestSelfOrderType: params => {
dispatch(requestSelfOrderType(params))
},
requestSelfTemplateCollect: (params) => {
requestSelfTemplateCollect: params => {
dispatch(requestSelfTemplateCollect(params))
},
requestSelfSumbit: (params) => {
requestSelfSumbit: params => {
dispatch(requestSelfSumbit(params))
},
exitLoginStatus: () => {
......@@ -2699,19 +2907,19 @@ const mapDispatchToProps = (dispatch) => {
setSelfInitData: () => {
dispatch(setSelfInitData())
},
requestListDataSuccess: (data) => {
requestListDataSuccess: data => {
dispatch(requestListDataSuccess(data))
},
requestSelfSurgeryType: (params) => {
requestSelfSurgeryType: params => {
dispatch(requestSelfSurgeryType(params))
},
setSelectProductOpts: (data) => {
setSelectProductOpts: data => {
dispatch(setSelectProductOpts(data))
},
requestQuickSurColSetting: (params) => {
requestQuickSurColSetting: params => {
dispatch(requestQuickSurColSetting(params))
}
},
}
}
export default connect(mapStateToProps, mapDispatchToProps)(SelfOrderPage);
export default connect(mapStateToProps, mapDispatchToProps)(SelfOrderPage)
......@@ -300,6 +300,7 @@ class ChooseProductPage extends Component {
if (navigation.state.params.selfData) {
cur_org_code = navigation.state.params.selfData.org_code
cur_doctor_name = navigation.state.params.selfData.doctor_name
customer_code = navigation.state.params.selfData.customer_code
}
let topItem = topProcOptionList[topActiveIndex]
if (leftIndex === 0) {
......@@ -307,6 +308,7 @@ class ChooseProductPage extends Component {
access_token: token,
org_code: cur_org_code,
manufacturer_code: topItem.supplier_code,
customer_code,
// doctor_name: cur_doctor_name
}
console.log('params=', params)
......@@ -343,6 +345,7 @@ class ChooseProductPage extends Component {
access_token: token,
manufacturer_code: topItem.supplier_code,
category_code: cur_category_code,
customer_code,
}
console.log('params=', params)
let nail_equip_head_search = await reqNailEquipHeadSearch(global_domain_config, params)
......@@ -372,6 +375,7 @@ class ChooseProductPage extends Component {
let params = {
access_token: token,
manufacturer_code: topItem.supplier_code,
customer_code,
}
console.log('params=', params)
let scat_head_search = await reqScatEquipmentSearch(global_domain_config, params)
......@@ -404,6 +408,7 @@ class ChooseProductPage extends Component {
manufacturer_code: topItem.supplier_code,
org_code: cur_org_code,
leftIndex: leftIndex, // 测试
customer_code,
}
console.log('params=', params)
let single_all_search = await reqSingleConsumSearch(global_domain_config, params)
......@@ -898,6 +903,7 @@ class ChooseProductPage extends Component {
selfData: {
org_code: cur_org_code,
authorizations,
customer_code: navigation.state.params.selfData.customer_code,
},
})
}}
......
import React, { Component } from 'react';
import { View, StyleSheet, SafeAreaView, ScrollView, FlatList, Text } from 'react-native';
import { connect } from 'react-redux';
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 } from '../../../base/BaseStyle';
import { FooterBtnStyle, PicListNoData } from '../../common/CellTextStyle';
import StatusBarView from '../../common/StatusBarView';
import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
import PictureZoom from '../../common/listDataComponent/PictureZoom';
import { cloneObject, show } from '../../../utils/Utils';
import { reqSurTempLineSearch, reqNailBoxLineSearch, reqEquipPackageLineSearch, reqNailAndEquipSearch } from '../../../action/SelfAction';
import LoadingModel from '../../common/listDataComponent/LoadingModel';
import LocalVariable from '../../common/LocalVariable';
import { exitLoginStatus } from '../../../action/LoginAction';
import React, { Component } from 'react'
import { View, StyleSheet, SafeAreaView, ScrollView, FlatList, Text } from 'react-native'
import { connect } from 'react-redux'
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,
} from '../../../base/BaseStyle'
import { FooterBtnStyle, PicListNoData } from '../../common/CellTextStyle'
import StatusBarView from '../../common/StatusBarView'
import ChooseCardList from '../../common/listDataComponent/ChooseCardList'
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu'
import PictureZoom from '../../common/listDataComponent/PictureZoom'
import { cloneObject, show } from '../../../utils/Utils'
import {
reqSurTempLineSearch,
reqNailBoxLineSearch,
reqEquipPackageLineSearch,
reqNailAndEquipSearch,
} from '../../../action/SelfAction'
import LoadingModel from '../../common/listDataComponent/LoadingModel'
import LocalVariable from '../../common/LocalVariable'
import { exitLoginStatus } from '../../../action/LoginAction'
class EditThirdLevelPage extends Component {
constructor(props) {
super(props);
super(props)
this.state = {
topProcOptionList: [],
topActiveIndex: 0,
onlyShow: false, // 只展示
onlySignSelect: false, // 单选
defalutTopItem: [{ // 手术套包显示
"category_code": LocalVariable.SIGN_SELECT_CONSUMABLES,
"category_name": "耗材"
}, {
"category_code": LocalVariable.NAIL_BOX,
"category_name": "钉盒",
"cate_local_icon": require('../../../images/screw_box.png')
}, {
"category_code": LocalVariable.EQUIPMENT_BAG,
"category_name": "器械包",
"cate_local_icon": require('../../../images/equip_bag.png')
}, {
"category_code": LocalVariable.SCATTERED_EQUIPMENT,
"category_name": "零散器械",
"cate_local_icon": require('../../../images/auxili_tool.png')
}],
superData: {}
defalutTopItem: [
{
// 手术套包显示
category_code: LocalVariable.SIGN_SELECT_CONSUMABLES,
category_name: '耗材',
},
{
category_code: LocalVariable.NAIL_BOX,
category_name: '钉盒',
cate_local_icon: require('../../../images/screw_box.png'),
},
{
category_code: LocalVariable.EQUIPMENT_BAG,
category_name: '器械包',
cate_local_icon: require('../../../images/equip_bag.png'),
},
{
category_code: LocalVariable.SCATTERED_EQUIPMENT,
category_name: '零散器械',
cate_local_icon: require('../../../images/auxili_tool.png'),
},
],
superData: {},
}
}
......@@ -50,19 +72,20 @@ class EditThirdLevelPage extends Component {
// 初始化获取数据
async initGetData() {
let that = this
let { superData } = that.props.navigation.state.params
let { superData, customer_code } = that.props.navigation.state.params
let { token, global_domain_config } = that.props
let { defalutTopItem, topProcOptionList } = that.state
let { leftIndex, superItem } = superData
that.refs.LoadingModel.show()
that.setState({
superData: cloneObject(superData)
superData: cloneObject(superData),
})
if (leftIndex === 0) {
let params = {
access_token: token,
template_number: superItem.template_number
template_number: superItem.template_number,
customer_code,
}
let sur_line_search = await reqSurTempLineSearch(global_domain_config, params)
console.log('res_line_1 : ', sur_line_search)
......@@ -86,12 +109,15 @@ class EditThirdLevelPage extends Component {
if (data.tool) {
topProcOptionList[3].localThridContData = data.tool
}
that.setState({
topProcOptionList: topProcOptionList
}, () => {
that.setState(
{
topProcOptionList: topProcOptionList,
},
() => {
that.refs.LoadingModel.hide()
that.setAllSelectData()
})
},
)
} else {
that.showRrrorTip(sur_line_search)
}
......@@ -109,7 +135,7 @@ class EditThirdLevelPage extends Component {
item_code: superItem.item_code,
serial_number: superItem.serial_number,
inv_code: superItem.inv_code,
nail_box_flag: 'N'
nail_box_flag: 'N',
}
let nail_line_search = await reqNailAndEquipSearch(global_domain_config, params)
console.log('res_line_1 : ', nail_line_search)
......@@ -117,8 +143,8 @@ class EditThirdLevelPage extends Component {
let { data } = nail_line_search
if (data.segemt && data.segemt.length > 0) {
data.segemt.forEach(function (seg_it) {
if (seg_it.segment_code == "0") {
seg_it.segment_name = "默认区域"
if (seg_it.segment_code == '0') {
seg_it.segment_name = '默认区域'
}
})
}
......@@ -128,13 +154,16 @@ class EditThirdLevelPage extends Component {
topIt[LocalVariable.SELECTED_DATA_ARR] = []
topIt[LocalVariable.SELECTED_QUQNTITY] = 0
})
that.setState({
that.setState(
{
topProcOptionList: topProcOptionList,
onlyShow: true
}, () => {
onlyShow: true,
},
() => {
that.refs.LoadingModel.hide()
that.setAllSelectData()
})
},
)
} else {
that.showRrrorTip(nail_line_search)
}
......@@ -154,7 +183,7 @@ class EditThirdLevelPage extends Component {
item_code: superItem.item_code,
serial_number: superItem.serial_number,
inv_code: superItem.inv_code,
nail_box_flag: 'N'
nail_box_flag: 'N',
}
let equip_line_search = await reqNailAndEquipSearch(global_domain_config, params)
console.log('res_line_1 : ', equip_line_search)
......@@ -168,8 +197,8 @@ class EditThirdLevelPage extends Component {
if (data.segemt && data.segemt.length > 0) {
data.segemt.forEach(function (seg_it) {
if (seg_it.segment_code == "0") {
seg_it.segment_name = "未分层器械"
if (seg_it.segment_code == '0') {
seg_it.segment_name = '未分层器械'
} else {
seg_it.segment_name = `第 ${seg_it.segment_code} 层器械`
}
......@@ -181,19 +210,20 @@ class EditThirdLevelPage extends Component {
topIt[LocalVariable.SELECTED_DATA_ARR] = []
topIt[LocalVariable.SELECTED_QUQNTITY] = 0
})
that.setState({
that.setState(
{
topProcOptionList: topProcOptionList,
onlyShow: true
}, () => {
onlyShow: true,
},
() => {
that.refs.LoadingModel.hide()
that.setAllSelectData()
})
},
)
} else {
that.showRrrorTip(equip_line_search)
}
}
}
// 计算后的回调
......@@ -206,11 +236,14 @@ class EditThirdLevelPage extends Component {
listItem[dataName][index] = item
}
})
that.setState({
topProcOptionList
}, () => {
that.setState(
{
topProcOptionList,
},
() => {
that.setAllSelectData()
})
},
)
}
}
......@@ -230,14 +263,14 @@ class EditThirdLevelPage extends Component {
}
})
this.setState({
topProcOptionList
topProcOptionList,
})
}
// 点击顶部菜单
handleTopNav(item, index) {
this.setState({
topActiveIndex: index
topActiveIndex: index,
})
}
......@@ -253,11 +286,11 @@ class EditThirdLevelPage extends Component {
showRrrorTip(result) {
this.refs.LoadingModel.hide()
if (result.error_code == 41006) {
show('登录过期,请重新登录');
this.props.exitLoginStatus();
show('登录过期,请重新登录')
this.props.exitLoginStatus()
} else {
let error_msg = result.error_msg || result.message
show(error_msg);
show(error_msg)
}
}
......@@ -265,7 +298,8 @@ class EditThirdLevelPage extends Component {
renderTopProItem() {
let { topProcOptionList, topActiveIndex, superData } = this.state
let { leftIndex } = superData
let curTit = '', curTopList = topProcOptionList
let curTit = '',
curTopList = topProcOptionList
if (leftIndex === 0) {
curTit = 'category_name'
} else if (leftIndex === 1 || leftIndex === 2) {
......@@ -304,29 +338,29 @@ class EditThirdLevelPage extends Component {
return (
<View style={styles.edit_cont}>
{ imgIconArr ? <PictureZoom
{imgIconArr ? (
<PictureZoom
listImageIndex={0}
listImageUrls={imgIconArr}
listStyleImage={styles.thr_head_tit_img}
listPicType={'RECTANGLE'}
/> : null}
<ScrollView
style={styles.edit_scroll_cont}
showsVerticalScrollIndicator={false}
>
{localThridContData.length > 0 ?
/>
) : null}
<ScrollView style={styles.edit_scroll_cont} showsVerticalScrollIndicator={false}>
{localThridContData.length > 0 ? (
<FlatList
style={styles.edit_list}
keyExtractor={item => item.id}
data={localThridContData}
extraData={this.state}
renderItem={({ item, index }) => this.renderContColumnItem(item, index)}
/> : <PicListNoData />
}
/>
) : (
<PicListNoData />
)}
</ScrollView>
{ this.renderLodingItem()}
{this.renderLodingItem()}
</View>
)
}
......@@ -335,9 +369,17 @@ class EditThirdLevelPage extends Component {
renderContColumnItem(item, index) {
let { onlyShow, onlySignSelect, topActiveIndex, superData } = this.state
let { leftIndex } = superData
let curTit = '', curTipStr = '', curTipOne = '', curTipTwo = '', curCalField = '', curImgIcon = ''
let curTxtTit = '', curTipStrTit = '', curTipOneTit = '', curTipTwoTit = ''
if(leftIndex === 0){
let curTit = '',
curTipStr = '',
curTipOne = '',
curTipTwo = '',
curCalField = '',
curImgIcon = ''
let curTxtTit = '',
curTipStrTit = '',
curTipOneTit = '',
curTipTwoTit = ''
if (leftIndex === 0) {
if (topActiveIndex === 0 || topActiveIndex === 3) {
curTit = 'manufacturer_product_code'
curTipStr = 'item_name'
......@@ -360,7 +402,7 @@ class EditThirdLevelPage extends Component {
curTxtTit = '物料名称'
curTipStrTit = '通用名称'
}
}else if(leftIndex === 1 || leftIndex === 2){
} else if (leftIndex === 1 || leftIndex === 2) {
curTit = 'manufacturer_product_code'
curTipStr = 'item_name'
curTipOne = 'general_name'
......@@ -406,9 +448,7 @@ class EditThirdLevelPage extends Component {
// 返回正在加载中
renderLodingItem() {
return (
<LoadingModel ref="LoadingModel" />
)
return <LoadingModel ref="LoadingModel" />
}
render() {
......@@ -418,29 +458,27 @@ class EditThirdLevelPage extends Component {
return (
<View style={styles.edit_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle='light-content'
/>
<StatusBarView isReactStackNavigator={true} backgroundColor={promary_color} barStyle="light-content" />
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.edit_main}>
{this.renderTopProItem()}
{this.renderContItem()}
</View>
{!onlyShow ? <View style={styles.btom_btn_box}>
{!onlyShow ? (
<View style={styles.btom_btn_box}>
<FooterBtnStyle
style={styles.sub_btn_pro}
activeOpacity={.8}
activeOpacity={0.8}
title={'编辑完成'}
textStyle={styles.sub_btn_txt}
onPress={() => this.handleSubmit()}
/>
</View> : null}
</View>
) : null}
</SafeAreaView>
</View>
);
)
}
}
......@@ -449,44 +487,44 @@ const styles = StyleSheet.create({
flex: 1,
backgroundColor: home_background_color,
padding: 0,
margin: 0
margin: 0,
},
edit_main: {
flex: 1
flex: 1,
},
top_box: {
width: Width(),
paddingHorizontal: 20,
paddingTop: 12
paddingTop: 12,
},
top_scroll_cont: {},
top_touch_cont: {},
top_inner: {},
se_thr_width: {
minWidth: 42
minWidth: 42,
},
four_width: {
minWidth: 28
minWidth: 28,
},
top_inner_act: {},
top_tit: {
fontSize: 14
fontSize: 14,
},
top_tit_act: {
color: first_text_color,
fontWeight: 'bold'
fontWeight: 'bold',
},
edit_cont: {
marginTop: 14,
flex: 1,
paddingHorizontal: 20
paddingHorizontal: 20,
},
edit_list: {},
column_container: {
marginBottom: 10,
paddingHorizontal: 10,
paddingVertical: 6,
backgroundColor: foundation_color
backgroundColor: foundation_color,
},
ri_inner: {},
oth_img_box: {
......@@ -496,46 +534,46 @@ const styles = StyleSheet.create({
width: pxSize(50),
height: pxSize(50),
justifyContent: 'center',
alignItems: 'center'
alignItems: 'center',
},
oth_img: {
width: '90%',
height: '90%'
height: '90%',
},
ri_text_box: {},
ri_te_tit: {
fontSize: second_text_size,
color: first_text_color,
fontFamily: font_family_semibold
fontFamily: font_family_semibold,
},
thr_ot: {},
ri_te_ot: {
fontSize: 14,
color: third_text_color,
fontFamily: font_family_light
fontFamily: font_family_light,
},
ri_num_box: {
flexDirection: 'row',
alignItems: 'center'
alignItems: 'center',
},
thr_num_btn: {
width: pxSize(24),
height: pxSize(24)
height: pxSize(24),
},
thr_btn_left: {
marginRight: 4
marginRight: 4,
},
thr_btn_right: {
marginLeft: 4
marginLeft: 4,
},
thr_num_icon: {
width: '100%',
height: '100%'
height: '100%',
},
btn_inner: {},
thr_num: {
minWidth: pxSize(20),
textAlign: 'center'
textAlign: 'center',
},
btom_btn_box: {
backgroundColor: foundation_color,
......@@ -543,37 +581,37 @@ const styles = StyleSheet.create({
shadowColor: 'rgba(0, 0, 0, 0.12)',
shadowOffset: {
width: 1,
height: 2
height: 2,
},
shadowOpacity: 1,
elevation: 2,
borderWidth: 0
borderWidth: 0,
},
sub_btn_pro: {
backgroundColor: promary_color,
marginBottom: 14
marginBottom: 14,
},
thr_head_tit_img: {
borderWidth: .5,
borderWidth: 0.5,
borderColor: 'rgba(0, 0, 0, 0.12)',
marginBottom: 10
marginBottom: 10,
},
list_style_box: {
borderBottomWidth: 0
borderBottomWidth: 0,
},
sub_btn_txt: {}
sub_btn_txt: {},
})
const mapStateToProps = (state) => {
const mapStateToProps = state => {
return {
userInfo: state.login.userInfo,
token: state.login.token,
loginState: state.login.loginState,
global_domain_config: state.login.global_domain_config
global_domain_config: state.login.global_domain_config,
}
}
const mapDispatchToProps = (dispatch) => {
const mapDispatchToProps = dispatch => {
return {
exitLoginStatus: () => {
dispatch(exitLoginStatus())
......@@ -581,4 +619,4 @@ const mapDispatchToProps = (dispatch) => {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(EditThirdLevelPage);
export default connect(mapStateToProps, mapDispatchToProps)(EditThirdLevelPage)
import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableOpacity, Image, ScrollView, FlatList, SafeAreaView } from 'react-native';
import * as R from "ramda";
import { third_text_color, foundation_color, second_text_size, Width, pxSize, font_family_regular, icon_style } from '../../../base/BaseStyle';
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
import { cloneObject, isBlank, isNotBlank} from '../../../utils/Utils';
import { PicListNoData } from '../../common/CellTextStyle';
import _ from "lodash";
import { connect } from 'react-redux';
import LocalVariable from '../../common/LocalVariable';
const PropTypes = require('prop-types');
import React, { Component } from 'react'
import { View, Text, StyleSheet, TouchableOpacity, Image, ScrollView, FlatList, SafeAreaView } from 'react-native'
import * as R from 'ramda'
import {
third_text_color,
foundation_color,
second_text_size,
Width,
pxSize,
font_family_regular,
icon_style,
} from '../../../base/BaseStyle'
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu'
import { cloneObject, isBlank, isNotBlank } from '../../../utils/Utils'
import { PicListNoData } from '../../common/CellTextStyle'
import _ from 'lodash'
import { connect } from 'react-redux'
import LocalVariable from '../../common/LocalVariable'
const PropTypes = require('prop-types')
class ProductRightStyle extends Component {
static propTypres = {
superCallBack: PropTypes.func, // 回调计算函数
superReduceBack: PropTypes.func, // 减法回调
......@@ -30,25 +37,27 @@ class ProductRightStyle extends Component {
superItem: '',
superIndex: '',
title: '',
image: ''
}
image: '',
},
}
}
componentWillReceiveProps(nextProps) {
if (this.state.thridIsVisible != nextProps.defaultThridShow) {
this.setState({ thridIsVisible: nextProps.defaultThridShow });
this.setState({ thridIsVisible: nextProps.defaultThridShow })
}
if (nextProps.superStencilData) {
this.setState({ rightSecondData: nextProps.superStencilData });
this.setState({ rightSecondData: nextProps.superStencilData })
}
}
// 右侧 二级数据标题 点击
TitleClickEvent(item, index) {
let { navigation } = this.props
let { leftIndex } = this.props
if (leftIndex >= 0 && leftIndex < 3) {
let curThirdShow = false, curTit = '编辑模板'
let curThirdShow = false,
curTit = '编辑模板'
if (leftIndex === 1) {
curThirdShow = true
curTit = '钉盒明细'
......@@ -62,9 +71,10 @@ class ProductRightStyle extends Component {
superItem: item,
superIndex: index,
leftIndex: leftIndex,
thirdShow: curThirdShow
thirdShow: curThirdShow,
customer_code: navigation.state.params.selfData.customer_code,
},
childrenPageCallBack: this.childrenPageCallBack.bind(this) // 传递函数,编辑完成时调用
childrenPageCallBack: this.childrenPageCallBack.bind(this), // 传递函数,编辑完成时调用
})
} else if (leftIndex > 3) {
// 耗材 中级标题点击
......@@ -114,10 +124,10 @@ class ProductRightStyle extends Component {
// if (chInd === childData.length - 1) {
// splitStr = ''
// }
if(!superTip){
if (!superTip) {
splitStr = ''
}
if(chDa[LocalVariable.SELECTED_QUQNTITY] > 0){
if (chDa[LocalVariable.SELECTED_QUQNTITY] > 0) {
superTip += `${splitStr}${chDa.category_name}x${chDa[LocalVariable.SELECTED_QUQNTITY]}`
}
// superTip += `${chDa.category_name}x${chDa[LocalVariable.SELECTED_QUQNTITY]}${splitStr}`
......@@ -132,7 +142,7 @@ class ProductRightStyle extends Component {
superTip: superTip,
version: 0,
lineOptions: childData,
[LocalVariable.QUANTITY_FIELD]: 1
[LocalVariable.QUANTITY_FIELD]: 1,
}
if (rsdItem[LocalVariable.CHILDREN_LINE_NAME].length !== 0) {
curObj.version = rsdItem[LocalVariable.CHILDREN_LINE_NAME].length
......@@ -152,7 +162,7 @@ class ProductRightStyle extends Component {
})
}
this.setState({
rightSecondData
rightSecondData,
})
}
......@@ -165,12 +175,12 @@ class ProductRightStyle extends Component {
curThridObj = {
superItem: superItem,
superIndex: superIndex,
title: superItem.category_name
title: superItem.category_name,
}
that.setState({
thridIsVisible: show,
curThridObj: curThridObj,
rowSingleData: R.clone(superItem['details'])
rowSingleData: R.clone(superItem['details']),
})
this.props.changeThrShow(show)
} else {
......@@ -188,7 +198,7 @@ class ProductRightStyle extends Component {
that.handleCalCallBack(curDa, curInd, 'rightSecondData', LocalVariable.QUANTITY_FIELD)
that.setState({
thridIsVisible: show,
lastInputText: ''
lastInputText: '',
})
this.props.changeThrShow(show)
}
......@@ -203,13 +213,13 @@ class ProductRightStyle extends Component {
let curDataName = this.state[dataName]
curDataName[index] = item
this.setState({
[dataName]: curDataName
[dataName]: curDataName,
})
if(dataName === 'rowSingleData'){
if (dataName === 'rowSingleData') {
// 小类
that.changeThrShow(true)
}
if(coutFieName) {
if (coutFieName) {
// 计算==头
let sumCount = 0
curDataName.map(item => {
......@@ -225,8 +235,20 @@ class ProductRightStyle extends Component {
// 返回右侧二级每一列(耗材以上)
renderSecondtem(item, index) {
let { leftIndex } = this.props
let curTitCallBack = '', curPlusCallBack = '', curReduceCallBack = ''
let curTit = '', curTipStr = '', curTipOne = '', curTipTwo = '', curTipThr = '', curTxtTit = '', curTipStrTit = '', curTipOneTit = '', curTipTwoTit = '', curTipThrTit = '', curIcon = ''
let curTitCallBack = '',
curPlusCallBack = '',
curReduceCallBack = ''
let curTit = '',
curTipStr = '',
curTipOne = '',
curTipTwo = '',
curTipThr = '',
curTxtTit = '',
curTipStrTit = '',
curTipOneTit = '',
curTipTwoTit = '',
curTipThrTit = '',
curIcon = ''
let curListMaxNum = ''
if (leftIndex === 0) {
curTit = 'template_name'
......@@ -268,12 +290,12 @@ class ProductRightStyle extends Component {
curIcon = 'photos'
if (leftIndex === 1) {
// 钉盒
curTitCallBack = ((item, index) => this.TitleClickEvent(item, index))
curTitCallBack = (item, index) => this.TitleClickEvent(item, index)
curPlusCallBack = ''
curReduceCallBack = ''
} else if (leftIndex === 2) {
// 器械包
curTitCallBack = ((item, index) => this.TitleClickEvent(item, index))
curTitCallBack = (item, index) => this.TitleClickEvent(item, index)
curPlusCallBack = ''
curReduceCallBack = ''
curListMaxNum = 1
......@@ -283,9 +305,9 @@ class ProductRightStyle extends Component {
curPlusCallBack = ''
curReduceCallBack = ''
} else {
curTitCallBack = ((item, index) => this.TitleClickEvent(item, index))
curPlusCallBack = ((item, index) => this.TitleClickEvent(item, index))
curReduceCallBack = (() => this.props.superReduceBack())
curTitCallBack = (item, index) => this.TitleClickEvent(item, index)
curPlusCallBack = (item, index) => this.TitleClickEvent(item, index)
curReduceCallBack = () => this.props.superReduceBack()
}
return (
<SafeAreaView style={styles.ri_container} key={'template_name' + index}>
......@@ -293,7 +315,9 @@ class ProductRightStyle extends Component {
listItem={item}
listIndex={index}
calField={LocalVariable.QUANTITY_FIELD}
subCalCallBack={(item, index) => this.handleCalCallBack(item, index, 'rightSecondData', LocalVariable.QUANTITY_FIELD)}
subCalCallBack={(item, index) =>
this.handleCalCallBack(item, index, 'rightSecondData', LocalVariable.QUANTITY_FIELD)
}
titCallBack={curTitCallBack}
titText={curTit}
tipTextStr={curTipStr}
......@@ -321,15 +345,17 @@ class ProductRightStyle extends Component {
let { rightSecondData } = this.state
return (
<View style={styles.stencil_cont}>
{ rightSecondData.length > 0 ?
{rightSecondData.length > 0 ? (
<FlatList
style={styles.cont_right_list}
keyExtractor={item => item.id}
data={rightSecondData}
extraData={this.state}
renderItem={({ item, index }) => this.renderSecondtem(item, index)}
/> : <PicListNoData />}
/>
) : (
<PicListNoData />
)}
</View>
)
}
......@@ -380,8 +406,18 @@ class ProductRightStyle extends Component {
// 耗材 -- 大类每一列
renderOtherListItem(item, index) {
let curTit = '', curTipStr = '', curTipOne = '', curTipTwo = '', curTxtTit = '', curTipStrTit = '', curTipOneTit = '', curTipTwoTit = '', curIcon = ''
let curTitCallBack = '', curPlusCallBack = '', curReduceCallBack = ''
let curTit = '',
curTipStr = '',
curTipOne = '',
curTipTwo = '',
curTxtTit = '',
curTipStrTit = '',
curTipOneTit = '',
curTipTwoTit = '',
curIcon = ''
let curTitCallBack = '',
curPlusCallBack = '',
curReduceCallBack = ''
if (item[LocalVariable.ONLY_TWO_LEVELS]) {
// 两级数据
curTit = 'manufacturer_product_code'
......@@ -411,7 +447,9 @@ class ProductRightStyle extends Component {
calField={LocalVariable.QUANTITY_FIELD}
listImgIcon={curIcon}
listPicType={'ROUND'}
subCalCallBack={(item, index) => this.handleCalCallBack(item, index, 'rightSecondData', LocalVariable.QUANTITY_FIELD)}
subCalCallBack={(item, index) =>
this.handleCalCallBack(item, index, 'rightSecondData', LocalVariable.QUANTITY_FIELD)
}
titCallBack={curTitCallBack}
titText={curTit}
tipTextStr={curTipStr}
......@@ -433,16 +471,17 @@ class ProductRightStyle extends Component {
let { rightSecondData } = this.state
return (
<View style={styles.cont_other_cont}>
{
rightSecondData.length > 0 ? <FlatList
{rightSecondData.length > 0 ? (
<FlatList
style={styles.cont_other_list}
keyExtractor={item => item.id}
data={this.state.rightSecondData}
extraData={this.state}
renderItem={({ item, index }) => this.renderOtherListItem(item, index)}
/> : <PicListNoData />
}
/>
) : (
<PicListNoData />
)}
</View>
)
}
......@@ -468,11 +507,7 @@ class ProductRightStyle extends Component {
if (thridIsVisible) {
return (
<View>
<TouchableOpacity
activeOpacity={.8}
style={styles.thr_head_inner}
onPress={() => this.changeThrShow(false)}
>
<TouchableOpacity activeOpacity={0.8} style={styles.thr_head_inner} onPress={() => this.changeThrShow(false)}>
<View style={styles.thr_head_back}>
<View style={styles.thr_icon_box}>
<Image source={require('../../../images/arr_left.png')} style={icon_style}></Image>
......@@ -494,11 +529,8 @@ class ProductRightStyle extends Component {
render() {
return (
<View style={styles.cont_right_box}>
{ this.renderThrHeadStyle()}
<ScrollView
style={styles.cont_right_scroll_cont}
showsVerticalScrollIndicator={false}
>
{this.renderThrHeadStyle()}
<ScrollView style={styles.cont_right_scroll_cont} showsVerticalScrollIndicator={false}>
{this.renderRightCurrentStyle()}
</ScrollView>
</View>
......@@ -515,7 +547,7 @@ const styles = StyleSheet.create({
backgroundColor: foundation_color,
height: '100%',
paddingHorizontal: 20,
paddingLeft: 10
paddingLeft: 10,
},
cont_right_scroll_cont: {},
cont_right_list: {},
......@@ -529,41 +561,41 @@ const styles = StyleSheet.create({
thr_head_back: {
flexDirection: 'row',
paddingVertical: 12,
alignItems: 'center'
alignItems: 'center',
},
thr_icon_box: {
width: pxSize(14),
height: pxSize(18)
height: pxSize(18),
},
thr_head_tit: {
color: third_text_color,
paddingLeft: 6,
fontSize: second_text_size,
fontFamily: font_family_regular
fontFamily: font_family_regular,
},
thr_head_tit_img: {
borderWidth: .5,
borderWidth: 0.5,
borderColor: 'rgba(0, 0, 0, 0.12)',
marginBottom: 10
marginBottom: 10,
},
cont_thr_list: {},
thr_container: {},
rig_icon: {
width: pxSize(68),
height: pxSize(68)
}
height: pxSize(68),
},
})
const mapStateToProps = (state) => {
const mapStateToProps = state => {
return {
userInfo: state.login.userInfo,
token: state.login.token,
loginState: state.login.loginState,
global_domain_config: state.login.global_domain_config
global_domain_config: state.login.global_domain_config,
}
}
const mapDispatchToProps = (dispatch) => {
const mapDispatchToProps = dispatch => {
return {
exitLoginStatus: () => {
dispatch(exitLoginStatus())
......@@ -571,4 +603,4 @@ const mapDispatchToProps = (dispatch) => {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(ProductRightStyle);
export default connect(mapStateToProps, mapDispatchToProps)(ProductRightStyle)
......@@ -110,7 +110,7 @@ class SearchPage extends Component {
const { navigation, global_domain_config, token } = this.props
const { topActiveIndex, searchValue, page, data } = this.state
const { selfData, topProcOptionList } = navigation.state.params
const { authorizations } = selfData
const { authorizations, customer_code } = selfData
const productLineCategory = authorizations?.product_line_category_list
?.map(item => item.product_line_category_code)
......@@ -121,6 +121,7 @@ class SearchPage extends Component {
orgCode: selfData.org_code,
manufacturerCode: topProcOptionList[topActiveIndex].supplier_code,
productLineCategory,
customer_code,
keyword: encodeURIComponent(searchValue),
page,
}
......@@ -140,11 +141,13 @@ class SearchPage extends Component {
// 获取搜索到的类目
async getLeftOptionList(item) {
const { navigation, global_domain_config, token } = this.props
const { topProcOptionList } = navigation.state.params
const { topProcOptionList, selfData } = navigation.state.params
const { defalutLeftItem, topActiveIndex } = this.state
const { customer_code } = selfData
const params = {
access_token: token,
manufacturer_code: topProcOptionList[topActiveIndex].supplier_code,
customer_code,
}
console.log('params=', params)
this.refs.LoadingModel.show()
......@@ -180,11 +183,13 @@ class SearchPage extends Component {
const { navigation, global_domain_config, token } = this.props
const { topActiveIndex } = this.state
const { topProcOptionList, selfData } = navigation.state.params
const { customer_code } = selfData
let params = {
access_token: token,
category_code: item.big_category.category_code,
manufacturer_code: topProcOptionList[topActiveIndex].supplier_code,
org_code: selfData.org_code,
customer_code,
// leftIndex: leftIndex, // 测试
}
console.log('params=', params)
......
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