Commit a5c65353 by peii

Merge branch 'develop' into product

parents 9406d2da 28295252
import React, {Component} from 'react'; import React, { Component } from 'react'
import { import { Easing, Animated } from 'react-native'
Easing, import { createStackNavigator, createAppContainer } from 'react-navigation'
Animated import LoginPage from './containers/login/LoginPage'
} from 'react-native'; import HomePage from './containers/home/HomePage'
import { createStackNavigator, createAppContainer} from 'react-navigation'; import SelfOrderPage from './containers/selfOrder/SelfOrderPage'
import LoginPage from './containers/login/LoginPage'; import ChooseProductPage from './containers/selfOrder/module/ChooseProductPage'
import HomePage from './containers/home/HomePage'; import SearchPage from './containers/selfOrder/module/SearchPage'
import SelfOrderPage from './containers/selfOrder/SelfOrderPage'; import EditThirdLevelPage from './containers/selfOrder/module/EditThirdLevelPage'
import ChooseProductPage from './containers/selfOrder/module/ChooseProductPage'; import EquipConsuPage from './containers/equipConsu/EquipConsuPage'
import EditThirdLevelPage from './containers/selfOrder/module/EditThirdLevelPage'; import ConsumDetailsPage from './containers/equipConsu/module/ConsumDetailsPage'
import EquipConsuPage from './containers/equipConsu/EquipConsuPage'; import ChargeDetailsPage from './containers/equipConsu/module/ChargeDetailsPageRef'
import ConsumDetailsPage from './containers/equipConsu/module/ConsumDetailsPage'; import FillUnitPricePage from './containers/equipConsu/module/FillUnitPricePage'
import ChargeDetailsPage from './containers/equipConsu/module/ChargeDetailsPageRef'; import OrdersPage from './containers/equipConsu/module/OrdersPage'
import FillUnitPricePage from './containers/equipConsu/module/FillUnitPricePage'; import ShowDetailPage from './containers/equipConsu/module/ShowDetailPage'
import OrdersPage from './containers/equipConsu/module/OrdersPage'; import QuickOrderPage from './containers/quickOrder/QuickOrderPage'
import ShowDetailPage from './containers/equipConsu/module/ShowDetailPage'; import surgeryTemplatePage from './containers/quickOrder/module/surgeryTemplatePage'
import QuickOrderPage from './containers/quickOrder/QuickOrderPage'; import surgeryDetailsPage from './containers/quickOrder/module/surgeryDetailsPage'
import surgeryTemplatePage from './containers/quickOrder/module/surgeryTemplatePage'; import TransOrderPage from './containers/transOrder/TransOrderPage'
import surgeryDetailsPage from './containers/quickOrder/module/surgeryDetailsPage'; import DeviceInfoPage from './containers/deviceInfo/DeviceInfoPage'
import TransOrderPage from './containers/transOrder/TransOrderPage'; import TransSearchPage from './containers/transOrder/module/TransSearchPage'
import DeviceInfoPage from './containers/deviceInfo/DeviceInfoPage'; import HistoricalOrderPage from './containers/historicalOrder/HistoricalOrderPage'
import TransSearchPage from './containers/transOrder/module/TransSearchPage'; import LineOrderPage from './containers/historicalOrder/module/LineOrderPage'
import HistoricalOrderPage from './containers/historicalOrder/HistoricalOrderPage'; import SubSuccPage from './containers/common/SubSuccPage'
import LineOrderPage from './containers/historicalOrder/module/LineOrderPage'; import BarCodePage from './containers/common/BarCodePage'
import SubSuccPage from './containers/common/SubSuccPage';
import BarCodePage from './containers/common/BarCodePage';
// 结算 // 结算
import Settlement from '../src/pages/settlement/index'; import Settlement from '../src/pages/settlement/index'
import SettlementCollection from '../src/pages/settlement/collection'; import SettlementCollection from '../src/pages/settlement/collection'
import SettlementDetail from '../src/pages/settlement/detail'; import SettlementDetail from '../src/pages/settlement/detail'
import SettlementSaleDetail from '../src/pages/settlement/saleDetail'; import SettlementSaleDetail from '../src/pages/settlement/saleDetail'
import SettlementReject from '../src/pages/settlement/reject'; import SettlementReject from '../src/pages/settlement/reject'
// 分销开票 // 分销开票
import DistributeInvoice from '../src/pages/invoice/distribution'; import DistributeInvoice from '../src/pages/invoice/distribution'
import DistributeInvoiceApplyDetail from '../src/pages/invoice/distribution/detail'; import DistributeInvoiceApplyDetail from '../src/pages/invoice/distribution/detail'
import DistributeInvoiceCollections from '../src/pages/invoice/distribution/collection'; import DistributeInvoiceCollections from '../src/pages/invoice/distribution/collection'
import DistributeInvoiceCollectionDetail from '../src/pages/invoice/distribution/collection_detail'; import DistributeInvoiceCollectionDetail from '../src/pages/invoice/distribution/collection_detail'
// 直销开票 // 直销开票
import DirectionInvoice from '../src/pages/invoice/direct'; import DirectionInvoice from '../src/pages/invoice/direct'
import DirectionInvoiceCollections from '../src/pages/invoice/direct/collections'; import DirectionInvoiceCollections from '../src/pages/invoice/direct/collections'
import DirectionInvoiceApplyDetail from '../src/pages/invoice/direct/detail'; import DirectionInvoiceApplyDetail from '../src/pages/invoice/direct/detail'
const Router = createAppContainer(
const Router = createAppContainer(createStackNavigator({ createStackNavigator(
{
LoginPage: { screen: LoginPage }, LoginPage: { screen: LoginPage },
HomePage: {screen: HomePage}, HomePage: { screen: HomePage },
SelfOrderPage: {screen: SelfOrderPage}, SelfOrderPage: { screen: SelfOrderPage },
ChooseProductPage: {screen: ChooseProductPage}, ChooseProductPage: { screen: ChooseProductPage },
EditThirdLevelPage: {screen: EditThirdLevelPage}, SearchPage: { screen: SearchPage },
EquipConsuPage: {screen: EquipConsuPage}, EditThirdLevelPage: { screen: EditThirdLevelPage },
ConsumDetailsPage: {screen: ConsumDetailsPage}, EquipConsuPage: { screen: EquipConsuPage },
ChargeDetailsPage: {screen: ChargeDetailsPage}, ConsumDetailsPage: { screen: ConsumDetailsPage },
FillUnitPricePage: {screen: FillUnitPricePage}, ChargeDetailsPage: { screen: ChargeDetailsPage },
OrdersPage: {screen: OrdersPage}, FillUnitPricePage: { screen: FillUnitPricePage },
ShowDetailPage: {screen: ShowDetailPage}, OrdersPage: { screen: OrdersPage },
QuickOrderPage: {screen: QuickOrderPage}, ShowDetailPage: { screen: ShowDetailPage },
surgeryTemplatePage: {screen: surgeryTemplatePage}, QuickOrderPage: { screen: QuickOrderPage },
surgeryDetailsPage: {screen: surgeryDetailsPage}, surgeryTemplatePage: { screen: surgeryTemplatePage },
TransOrderPage: {screen: TransOrderPage}, surgeryDetailsPage: { screen: surgeryDetailsPage },
DeviceInfoPage: {screen: DeviceInfoPage}, TransOrderPage: { screen: TransOrderPage },
TransSearchPage: {screen: TransSearchPage}, DeviceInfoPage: { screen: DeviceInfoPage },
HistoricalOrderPage: {screen: HistoricalOrderPage}, TransSearchPage: { screen: TransSearchPage },
LineOrderPage: {screen: LineOrderPage}, HistoricalOrderPage: { screen: HistoricalOrderPage },
SubSuccPage: {screen: SubSuccPage}, LineOrderPage: { screen: LineOrderPage },
BarCodePage: {screen: BarCodePage}, SubSuccPage: { screen: SubSuccPage },
Settlement: {screen: Settlement}, BarCodePage: { screen: BarCodePage },
SettlementCollection: {screen: SettlementCollection}, Settlement: { screen: Settlement },
SettlementReject: {screen: SettlementReject}, SettlementCollection: { screen: SettlementCollection },
SettlementDetail: {screen: SettlementDetail}, SettlementReject: { screen: SettlementReject },
SettlementSaleDetail: {screen: SettlementSaleDetail}, SettlementDetail: { screen: SettlementDetail },
DistributeInvoice: {screen: DistributeInvoice}, SettlementSaleDetail: { screen: SettlementSaleDetail },
DistributeInvoiceApplyDetail: {screen: DistributeInvoiceApplyDetail}, DistributeInvoice: { screen: DistributeInvoice },
DistributeInvoiceCollections: {screen: DistributeInvoiceCollections}, DistributeInvoiceApplyDetail: { screen: DistributeInvoiceApplyDetail },
DistributeInvoiceCollectionDetail: {screen: DistributeInvoiceCollectionDetail}, DistributeInvoiceCollections: { screen: DistributeInvoiceCollections },
DirectionInvoice: {screen: DirectionInvoice}, DistributeInvoiceCollectionDetail: { screen: DistributeInvoiceCollectionDetail },
DirectionInvoiceCollections: {screen: DirectionInvoiceCollections}, DirectionInvoice: { screen: DirectionInvoice },
DirectionInvoiceApplyDetail: {screen: DirectionInvoiceApplyDetail}, DirectionInvoiceCollections: { screen: DirectionInvoiceCollections },
}, { DirectionInvoiceApplyDetail: { screen: DirectionInvoiceApplyDetail },
},
{
navigationOptions: { navigationOptions: {
gesturesEnabled: true gesturesEnabled: true,
}, },
headerMode: 'none', headerMode: 'none',
transitionConfig: () => ({ transitionConfig: () => ({
transitionSpec: { transitionSpec: {
duration: 300, duration: 300,
easing: Easing.out(Easing.poly(4)), easing: Easing.out(Easing.poly(4)),
timing: Animated.timing timing: Animated.timing,
}, },
screenInterpolator: sceneProps => { screenInterpolator: sceneProps => {
const {layout, position, scene} = sceneProps; const { layout, position, scene } = sceneProps
const {index} = scene; const { index } = scene
const Width = layout.initWidth; const Width = layout.initWidth
//沿X轴平移 //沿X轴平移
const translateX = position.interpolate({ const translateX = position.interpolate({
inputRange: [index - 1, index, index + 1], inputRange: [index - 1, index, index + 1],
outputRange: [Width, 0, -(Width - 10)], outputRange: [Width, 0, -(Width - 10)],
}); })
//透明度 //透明度
const opacity = position.interpolate({ const opacity = position.interpolate({
inputRange: [index - 1, index - 0.99, index], inputRange: [index - 1, index - 0.99, index],
outputRange: [0, 1, 1] outputRange: [0, 1, 1],
});
return {opacity, transform: [{translateX}]};
}
}) })
})) return { opacity, transform: [{ translateX }] }
},
}),
},
),
)
// const defaultGetStateForAction = Router.router.getStateForAction; // const defaultGetStateForAction = Router.router.getStateForAction;
// Router.router.getStateForAction = ((action, state) => { // Router.router.getStateForAction = ((action, state) => {
......
import { PostRequest, GetRequest, UploadRequest } from '../network/RequestUtils'; import { PostRequest, GetRequest, UploadRequest } from '../network/RequestUtils'
import { show, getUrlParams, showWarnErrorMessage, showErrorMessage, dedupQuoteArray } from '../utils/Utils'; import { show, getUrlParams, showWarnErrorMessage, showErrorMessage, dedupQuoteArray } from '../utils/Utils'
import { exitLoginStatus } from './LoginAction'; import { exitLoginStatus } from './LoginAction'
import { import {
SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_DOING,
SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_SUCCESS,
...@@ -10,23 +10,25 @@ import { ...@@ -10,23 +10,25 @@ import {
SELF_SUBMIT_FAILURE, SELF_SUBMIT_FAILURE,
SELF_INIT_DATA, SELF_INIT_DATA,
SET_SELECT_PRODUCT_OPTS, SET_SELECT_PRODUCT_OPTS,
SET_LEND_ORDER_VALUES SET_LEND_ORDER_VALUES,
} from '../base/ActionTypes'; } from '../base/ActionTypes'
import local_inter_mock from '../containers/selfOrder/module/mock/inter_mock' import local_inter_mock from '../containers/selfOrder/module/mock/inter_mock'
import * as R from 'ramda' import * as R from 'ramda'
// 获取组织 params={access_token:''} // 获取组织 params={access_token:''}
export function requestSelfOrganizations(params) { export function requestSelfOrganizations(params) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch(requestListDataing()); dispatch(requestListDataing())
let {global_domain_config} = getState().login let { global_domain_config } = getState().login
GetRequest(global_domain_config, getUrlParams('/authorized_inventory/search', params)) GetRequest(global_domain_config, getUrlParams('/authorized_inventory/search', params))
.then(res => { .then(res => {
console.log('获取组织 res=====', res); console.log('获取组织 res=====', res)
if(res.error_code == 0) { if (res.error_code == 0) {
let { data: { organizations } } = res let {
dispatch(requestListDataSuccess(organizations)); data: { organizations },
}else { } = res
dispatch(requestListDataSuccess(organizations))
} else {
showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail) showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail)
} }
// else if(res.error_code === 41006) { // else if(res.error_code === 41006) {
...@@ -49,17 +51,17 @@ export function requestSelfOrganizations(params) { ...@@ -49,17 +51,17 @@ export function requestSelfOrganizations(params) {
// 获取未定单据借货设置 params={access_token:'', org_code:'', customer_code: '', bill_to_site_code: '', ship_to_site_code: '', process_code: ''} // 获取未定单据借货设置 params={access_token:'', org_code:'', customer_code: '', bill_to_site_code: '', ship_to_site_code: '', process_code: ''}
export function requestQuickSurColSetting(params) { export function requestQuickSurColSetting(params) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch(requestListDataing()); dispatch(requestListDataing())
let {global_domain_config} = getState().login let { global_domain_config } = getState().login
GetRequest(global_domain_config, getUrlParams('/surgery/collect_setting/search', params)) GetRequest(global_domain_config, getUrlParams('/surgery/collect_setting/search', params))
.then(res => { .then(res => {
console.log('获取未定单据借货设置 res=====', res); console.log('获取未定单据借货设置 res=====', res)
if(res.error_code == 0) { if (res.error_code == 0) {
let { data } = res let { data } = res
let filterOpt = dedupQuoteArray(data, 'source_inv_code') let filterOpt = dedupQuoteArray(data, 'source_inv_code')
dispatch(requestListDataSuccess(filterOpt)); dispatch(requestListDataSuccess(filterOpt))
}else { } else {
showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail); showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail)
} }
// else if(res.error_code === 41006) { // else if(res.error_code === 41006) {
// show('登录过期,请重新登录'); // show('登录过期,请重新登录');
...@@ -77,7 +79,7 @@ export function requestQuickSurColSetting(params) { ...@@ -77,7 +79,7 @@ export function requestQuickSurColSetting(params) {
// console.log('------err-====获取未定单据借货设置----', Object.keys(err), err) // console.log('------err-====获取未定单据借货设置----', Object.keys(err), err)
// show(err.error); // show(err.error);
// dispatch(requestListDataFail()); // dispatch(requestListDataFail());
showErrorMessage(dispatch, err, requestListDataFail, '获取未定单据借货设置'); showErrorMessage(dispatch, err, requestListDataFail, '获取未定单据借货设置')
}) })
} }
} }
...@@ -90,19 +92,20 @@ export const reqOrgDepartments = async (global_domain_config, params) => { ...@@ -90,19 +92,20 @@ export const reqOrgDepartments = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/sale/sale_relationship/search', params)) return await GetRequest(global_domain_config, getUrlParams('/sale/sale_relationship/search', params))
} }
// 获取客户名称 params={access_token:'', org_code:'', seller_code:''} // 获取客户名称 params={access_token:'', org_code:'', seller_code:''}
export function requestSelfSurgeryHospital(params) { export function requestSelfSurgeryHospital(params) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch(requestListDataing()); dispatch(requestListDataing())
let {global_domain_config} = getState().login let { global_domain_config } = getState().login
GetRequest(global_domain_config, getUrlParams('/sale/seller_customer/search', params)) GetRequest(global_domain_config, getUrlParams('/sale/seller_customer/search', params))
.then(res => { .then(res => {
console.log('获取客户名称 res=====', res); console.log('获取客户名称 res=====', res)
if(res.error_code == 0) { if (res.error_code == 0) {
let { data: { customers } } = res let {
dispatch(requestListDataSuccess(customers)); data: { customers },
}else { } = res
dispatch(requestListDataSuccess(customers))
} else {
showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail) showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail)
} }
// else if(res.error_code === 41006) { // else if(res.error_code === 41006) {
...@@ -130,31 +133,33 @@ export const reqSelfSurgeryHospital = async (global_domain_config, params) => { ...@@ -130,31 +133,33 @@ export const reqSelfSurgeryHospital = async (global_domain_config, params) => {
// 获取订单类型 params={access_token:'', value_set_code:'SUR_ORDER_TYPE'} // 获取订单类型 params={access_token:'', value_set_code:'SUR_ORDER_TYPE'}
export function requestSelfOrderType(params, url) { export function requestSelfOrderType(params, url) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch(requestListDataing()); dispatch(requestListDataing())
let {global_domain_config} = getState().login let { global_domain_config } = getState().login
// GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params)) // GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params))
if (!url) { if (!url) {
url = '/system/order_type/search' url = '/system/order_type/search'
} }
GetRequest(global_domain_config, getUrlParams(url, params)) GetRequest(global_domain_config, getUrlParams(url, params))
.then(res => { .then(res => {
console.log('获取订单类型 res=====', res); console.log('获取订单类型 res=====', res)
// 兼容老的接口,有的环境没有实现获取订单类型接口 // 兼容老的接口,有的环境没有实现获取订单类型接口
if (res.status === 404) { if (res.status === 404) {
return dispatch(requestSelfOrderType(params, '/system/value_set/search')) return dispatch(requestSelfOrderType(params, '/system/value_set/search'))
} }
if(res.error_code == 0) { if (res.error_code == 0) {
let data = [] let data = []
if (R.includes('order_type', url)) { if (R.includes('order_type', url)) {
data = R.map(R.applySpec({ data = R.map(
R.applySpec({
value_name: R.prop('order_type_name'), value_name: R.prop('order_type_name'),
value_code: R.prop('order_type_code'), value_code: R.prop('order_type_code'),
}))(res.data) }),
)(res.data)
} else { } else {
data = res.data.sys_values data = res.data.sys_values
} }
dispatch(requestListDataSuccess(data)); dispatch(requestListDataSuccess(data))
}else { } else {
showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail) showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail)
} }
}) })
...@@ -171,15 +176,17 @@ export function requestSelfOrderType(params, url) { ...@@ -171,15 +176,17 @@ export function requestSelfOrderType(params, url) {
// 获取配台模板 params={access_token:'', org_code:'', seller_code: 'shi.ming', customer_code: '', surgery_type: '', doctor_name: ''} // 获取配台模板 params={access_token:'', org_code:'', seller_code: 'shi.ming', customer_code: '', surgery_type: '', doctor_name: ''}
export function requestSelfTemplateCollect(params) { export function requestSelfTemplateCollect(params) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch(requestListDataing()); dispatch(requestListDataing())
let {global_domain_config} = getState().login let { global_domain_config } = getState().login
GetRequest(global_domain_config, getUrlParams('/surgery/template_header/search', params)) GetRequest(global_domain_config, getUrlParams('/surgery/template_header/search', params))
.then(res => { .then(res => {
console.log('获取配台模板 res=====', res); console.log('获取配台模板 res=====', res)
if(res.error_code == 0) { if (res.error_code == 0) {
let { data: { surgery_template_headers } } = res let {
dispatch(requestListDataSuccess(surgery_template_headers)); data: { surgery_template_headers },
}else { } = res
dispatch(requestListDataSuccess(surgery_template_headers))
} else {
showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail) showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail)
} }
// else if(res.error_code === 41006) { // else if(res.error_code === 41006) {
...@@ -203,19 +210,21 @@ export function requestSelfTemplateCollect(params) { ...@@ -203,19 +210,21 @@ export function requestSelfTemplateCollect(params) {
// 获取手术类型 params={access_token:'', value_set_code:'ORTHOPEDICS_PRODUCT_CLASS'} // 获取手术类型 params={access_token:'', value_set_code:'ORTHOPEDICS_PRODUCT_CLASS'}
export function requestSelfSurgeryType(params) { export function requestSelfSurgeryType(params) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch(requestListDataing()); dispatch(requestListDataing())
let {global_domain_config} = getState().login let { global_domain_config } = getState().login
GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params)) GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params))
.then(res => { .then(res => {
console.log('获取手术类型 res=====', res); console.log('获取手术类型 res=====', res)
if(res.error_code == 0) { if (res.error_code == 0) {
let typeOption = [] let typeOption = []
let { data: { value_set_code, sys_values } } = res let {
if(value_set_code === 'ORTHOPEDICS_PRODUCT_CLASS' && sys_values && sys_values.length) { data: { value_set_code, sys_values },
} = res
if (value_set_code === 'ORTHOPEDICS_PRODUCT_CLASS' && sys_values && sys_values.length) {
typeOption = sys_values typeOption = sys_values
} }
dispatch(requestListDataSuccess(typeOption)); dispatch(requestListDataSuccess(typeOption))
}else { } else {
showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail) showWarnErrorMessage(dispatch, res, exitLoginStatus, requestListDataFail)
} }
// else if(res.error_code === 41006) { // else if(res.error_code === 41006) {
...@@ -238,48 +247,51 @@ export function requestSelfSurgeryType(params) { ...@@ -238,48 +247,51 @@ export function requestSelfSurgeryType(params) {
function requestListDataing() { function requestListDataing() {
return { return {
type: SELF_ORDER_LIST_DOING type: SELF_ORDER_LIST_DOING,
} }
} }
export function requestListDataSuccess(data) { export function requestListDataSuccess(data) {
return { return {
type: SELF_ORDER_LIST_SUCCESS, type: SELF_ORDER_LIST_SUCCESS,
rawData: data rawData: data,
} }
} }
function requestListDataFail() { function requestListDataFail() {
return { return {
type: SELF_ORDER_LIST_FAILURE type: SELF_ORDER_LIST_FAILURE,
} }
} }
// 上传语音 // 上传语音
export const requestSelfAudio = async (global_domain_config, params) => { export const requestSelfAudio = async (global_domain_config, params) => {
let { access_token, path } = params let { access_token, path } = params
let formData = new FormData() let formData = new FormData()
let soundPath = `file://${path}` let soundPath = `file://${path}`
let fileName = path.substring(path.lastIndexOf('/') + 1, path.length) let fileName = path.substring(path.lastIndexOf('/') + 1, path.length)
let file = { uri: soundPath, type: "multipart/form-data", name: fileName} let file = { uri: soundPath, type: 'multipart/form-data', name: fileName }
formData.append('file', file) formData.append('file', file)
return await UploadRequest(global_domain_config, getUrlParams('/dingding/upload_media', { access_token }), formData) return await UploadRequest(global_domain_config, getUrlParams('/dingding/upload_media', { access_token }), formData)
} }
// 提交数据 // 提交数据
export function requestSelfSumbit({access_token, ...params}) { export function requestSelfSumbit({ access_token, ...params }) {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch(requestSubmiting()); dispatch(requestSubmiting())
let {global_domain_config} = getState().login let { global_domain_config } = getState().login
PostRequest(global_domain_config, getUrlParams('/surgery/collect_order/via_data/create', {access_token: access_token}), params) PostRequest(
global_domain_config,
getUrlParams('/surgery/collect_order/via_data/create', { access_token: access_token }),
params,
)
// PostRequest(global_domain_config, getUrlParams('/order/sur_requirement/create', {access_token: access_token}), params) // PostRequest(global_domain_config, getUrlParams('/order/sur_requirement/create', {access_token: access_token}), params)
.then(res => { .then(res => {
console.log('提交数据 res=====', res); console.log('提交数据 res=====', res)
if(res.error_code == 0) { if (res.error_code == 0) {
let { data } = res let { data } = res
dispatch(requestSubmitSuccess(data)); dispatch(requestSubmitSuccess(data))
}else { } else {
showWarnErrorMessage(dispatch, res, exitLoginStatus, requestSubmitFail) showWarnErrorMessage(dispatch, res, exitLoginStatus, requestSubmitFail)
} }
// else if(res.error_code === 41006) { // else if(res.error_code === 41006) {
...@@ -334,14 +346,12 @@ export const reqNailEquipHeadSearch = async (global_domain_config, params) => { ...@@ -334,14 +346,12 @@ export const reqNailEquipHeadSearch = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/inventory/item_package_header/search', params)) return await GetRequest(global_domain_config, getUrlParams('/inventory/item_package_header/search', params))
} }
// 选择产品-螺钉盒明细查询接口 // 选择产品-螺钉盒明细查询接口
export const reqNailBoxLineSearch = async (global_domain_config, params) => { export const reqNailBoxLineSearch = async (global_domain_config, params) => {
// return local_inter_mock.inter_6 // return local_inter_mock.inter_6
return await GetRequest(global_domain_config, getUrlParams('/inventory/nail_box_template_detail/search', params)) return await GetRequest(global_domain_config, getUrlParams('/inventory/nail_box_template_detail/search', params))
} }
// 选择产品-器械包明细查询接口 // 选择产品-器械包明细查询接口
export const reqEquipPackageLineSearch = async (global_domain_config, params) => { export const reqEquipPackageLineSearch = async (global_domain_config, params) => {
// return local_inter_mock.inter_7 // return local_inter_mock.inter_7
...@@ -364,7 +374,6 @@ export const reqScatEquipmentSearch = async (global_domain_config, params) => { ...@@ -364,7 +374,6 @@ export const reqScatEquipmentSearch = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/order/tool/search', params)) return await GetRequest(global_domain_config, getUrlParams('/order/tool/search', params))
} }
// 选择产品-单点耗材查询接口 // 选择产品-单点耗材查询接口
export const reqSingleConsumSearch = async (global_domain_config, params) => { export const reqSingleConsumSearch = async (global_domain_config, params) => {
// if(params.leftIndex && params.leftIndex%2 === 0){ // if(params.leftIndex && params.leftIndex%2 === 0){
...@@ -375,29 +384,33 @@ export const reqSingleConsumSearch = async (global_domain_config, params) => { ...@@ -375,29 +384,33 @@ export const reqSingleConsumSearch = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/order/item_detail/search', params)) return await GetRequest(global_domain_config, getUrlParams('/order/item_detail/search', params))
} }
export const reqGlobalSearch = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/order/item/global_search', params))
}
function requestSubmiting() { function requestSubmiting() {
return { return {
type: SELF_SUBMIT_DOING type: SELF_SUBMIT_DOING,
} }
} }
function requestSubmitSuccess(data) { function requestSubmitSuccess(data) {
return { return {
type: SELF_SUBMIT_SUCCESS, type: SELF_SUBMIT_SUCCESS,
rawData: data rawData: data,
} }
} }
function requestSubmitFail() { function requestSubmitFail() {
return { return {
type: SELF_SUBMIT_FAILURE type: SELF_SUBMIT_FAILURE,
} }
} }
// 初始化数据 // 初始化数据
export function setSelfInitData() { export function setSelfInitData() {
return { return {
type: SELF_INIT_DATA type: SELF_INIT_DATA,
} }
} }
...@@ -405,7 +418,7 @@ export function setSelfInitData() { ...@@ -405,7 +418,7 @@ export function setSelfInitData() {
export function setSelectProductOpts(data) { export function setSelectProductOpts(data) {
return { return {
type: SET_SELECT_PRODUCT_OPTS, type: SET_SELECT_PRODUCT_OPTS,
rawData: data rawData: data,
} }
} }
...@@ -425,10 +438,10 @@ export async function requestSurgeryType(global_domain_config, params) { ...@@ -425,10 +438,10 @@ export async function requestSurgeryType(global_domain_config, params) {
*/ */
export function getLendOrderCodeValues() { export function getLendOrderCodeValues() {
return (dispatch, getState) => { return (dispatch, getState) => {
let {global_domain_config, token} = getState().login let { global_domain_config, token } = getState().login
const params = { const params = {
access_token: token, access_token: token,
value_set_code: 'OBS_MOBILE_LEND_ORDER' value_set_code: 'OBS_MOBILE_LEND_ORDER',
} }
GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params)).then(res => { GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params)).then(res => {
const values = R.pathOr([], ['data', 'sys_values'])(res) const values = R.pathOr([], ['data', 'sys_values'])(res)
...@@ -440,6 +453,6 @@ export function getLendOrderCodeValues() { ...@@ -440,6 +453,6 @@ export function getLendOrderCodeValues() {
export function setLendOrderCodeValues(values) { export function setLendOrderCodeValues(values) {
return { return {
type: SET_LEND_ORDER_VALUES, type: SET_LEND_ORDER_VALUES,
values values,
} }
} }
import { import { Dimensions } from 'react-native'
Dimensions
} from 'react-native'
const { width, height } = Dimensions.get('window'); const { width, height } = Dimensions.get('window')
export const Height = () => { export const Height = () => {
return height return height
}; }
export const Width = () => { export const Width = () => {
return width return width
}; }
// UI 默认图是414*896 // UI 默认图是414*896
const uiWidthPx = 414; const uiWidthPx = 414
const uiHeightPx = 896; const uiHeightPx = 896
export function pxSize(uiElementPx) { export function pxSize(uiElementPx) {
return uiElementPx * Width() / uiWidthPx; return (uiElementPx * Width()) / uiWidthPx
} }
export function pxHeight(uiElementPx) { export function pxHeight(uiElementPx) {
return uiElementPx * Height() / uiHeightPx; return (uiElementPx * Height()) / uiHeightPx
} }
// 背景色 // 背景色
export const promary_color = "#007EFF"; // 主色 export const promary_color = '#007EFF' // 主色
export const foundation_color = "#ffffff"; // 底色 export const foundation_color = '#ffffff' // 底色
export const promary_shadow_color = "#3CA2FF"; // 按钮阴影色 export const promary_shadow_color = '#3CA2FF' // 按钮阴影色
export const home_background_color = "#F7F7F7"; // 背景色 export const home_background_color = '#F7F7F7' // 背景色
export const btn_sub_color = "#0296F7"; // 按钮色 export const btn_sub_color = '#0296F7' // 按钮色
export const dis_sub_color = "#BBBBBB"; // 禁用按钮色 export const dis_sub_color = '#BBBBBB' // 禁用按钮色
// 字体色 // 字体色
export const promary_text_color = "#000000"; // 主字颜色 export const promary_text_color = '#000000' // 主字颜色
export const title_text_color = "#ffffff"; // 标题颜色 export const title_text_color = '#ffffff' // 标题颜色
export const placehold_text_color = "#919191"; // input placeholder颜色 export const placehold_text_color = '#919191' // input placeholder颜色
export const first_text_color = '#333333'; // 一级字体 export const first_text_color = '#333333' // 一级字体
export const second_text_color = "#666666"; // 次级字体 export const second_text_color = '#666666' // 次级字体
export const third_text_color = "#999999"; // 三级字体 export const third_text_color = '#999999' // 三级字体
export const point_color = "#ff0000"; // * 颜色 export const point_color = '#ff0000' // * 颜色
export const text_default_color = "#01B2B9"; // 默认颜色 export const text_default_color = '#01B2B9' // 默认颜色
export const text_audit_color = "#FF0000"; // 拒绝颜色 export const text_audit_color = '#FF0000' // 拒绝颜色
export const text_return_color = "#007EFF"; // 归还颜色 export const text_return_color = '#007EFF' // 归还颜色
export const text_other_color = "#F4B61B"; // 其他颜色 export const text_other_color = '#F4B61B' // 其他颜色
export const list_tit_color = 'rgba(0, 0, 0, 0.87)'; // 列表标题颜色 export const list_tit_color = 'rgba(0, 0, 0, 0.87)' // 列表标题颜色
export const list_str_color = "#0CB4E8"; // 列表加粗颜色 export const list_str_color = '#0CB4E8' // 列表加粗颜色
export const list_one_color = "#1B40B5"; // 列表一级颜色 export const list_one_color = '#1B40B5' // 列表一级颜色
export const list_thr_color = "#3B4C82"; // 列表其他颜色 export const list_thr_color = '#3B4C82' // 列表其他颜色
export const list_one_light_color = "#3c64e2"; // 列表一级较浅颜色 export const list_one_light_color = '#3c64e2' // 列表一级较浅颜色
// 字号 // 字号
export const first_text_size = 20; // 一级字号 export const first_text_size = 20 // 一级字号
export const second_text_size = 16; // 二级字号 export const second_text_size = 16 // 二级字号
export const third_text_size = 12; // 三级字号 export const third_text_size = 12 // 三级字号
// 字体样式 // 字体样式
export const font_family_semibold = "PingFangSC-Semibold"; export const font_family_semibold = 'PingFangSC-Semibold'
export const font_family_medium = "PingFangSC-Medium"; export const font_family_medium = 'PingFangSC-Medium'
export const font_family_regular = "PingFangSC-Regular"; export const font_family_regular = 'PingFangSC-Regular'
export const font_family_light = "PingFangSC-Light"; export const font_family_light = 'PingFangSC-Light'
export const header_height = 58 export const header_height = 58
export const icon_style = { export const icon_style = {
resizeMode: 'cover', resizeMode: 'cover',
width: '100%', width: '100%',
height: '100%' height: '100%',
} }
export const safe_view = { export const safe_view = {
flex: 1 flex: 1,
} }
export const list_common_item = { export const list_common_item = {
// 备注 // 备注
remark_item: { remark_item: {
minHeight: 80, minHeight: 80,
height: 'auto' height: 'auto',
}, },
rema_box: { rema_box: {
paddingVertical: 16 paddingVertical: 16,
}, },
rema_tit: { rema_tit: {
fontSize: second_text_size, fontSize: second_text_size,
color: first_text_color, color: first_text_color,
fontFamily: font_family_regular fontFamily: font_family_regular,
// fontWeight: 'bold' // fontWeight: 'bold'
}, },
rema_Input_outer: { rema_Input_outer: {
height: 120, height: 120,
alignItems: 'center', alignItems: 'center',
// paddingHorizontal: 15, // paddingHorizontal: 15,
paddingBottom: 0 paddingBottom: 0,
}, },
rema_Input_inner: { rema_Input_inner: {
paddingTop: 10, paddingTop: 10,
...@@ -105,12 +103,12 @@ export const list_common_item = { ...@@ -105,12 +103,12 @@ export const list_common_item = {
paddingVertical: 0, paddingVertical: 0,
maxHeight: 105, maxHeight: 105,
fontSize: second_text_size, fontSize: second_text_size,
textAlign:'left', textAlign: 'left',
textAlignVertical:'top', textAlignVertical: 'top',
alignSelf:'flex-start', alignSelf: 'flex-start',
justifyContent:'flex-start', justifyContent: 'flex-start',
alignItems:'flex-start', alignItems: 'flex-start',
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
// 录音 // 录音
reco_item: { reco_item: {
...@@ -119,21 +117,21 @@ export const list_common_item = { ...@@ -119,21 +117,21 @@ export const list_common_item = {
// marginBottom: 42 // marginBottom: 42
}, },
reco_play_height: { reco_play_height: {
height: 90 height: 90,
}, },
reco_btn_cont: { reco_btn_cont: {
flex: 1, flex: 1,
paddingVertical: 20 paddingVertical: 20,
}, },
reco_btn_tit: { reco_btn_tit: {
fontSize: second_text_size, fontSize: second_text_size,
color: first_text_color, color: first_text_color,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
reco_btn_inner: { reco_btn_inner: {
flex: 1, flex: 1,
alignItems: 'center', alignItems: 'center',
paddingTop: 30 paddingTop: 30,
}, },
reco_btn_box: { reco_btn_box: {
backgroundColor: '#EEECEC', backgroundColor: '#EEECEC',
...@@ -143,17 +141,17 @@ export const list_common_item = { ...@@ -143,17 +141,17 @@ export const list_common_item = {
justifyContent: 'center', justifyContent: 'center',
flexDirection: 'row', flexDirection: 'row',
height: pxSize(54), height: pxSize(54),
width: pxSize(162) width: pxSize(162),
}, },
reco_img_box: { reco_img_box: {
width: pxSize(20), width: pxSize(20),
height: pxSize(22) height: pxSize(22),
}, },
reco_btn_text: { reco_btn_text: {
fontSize: second_text_size, fontSize: second_text_size,
color: first_text_color, color: first_text_color,
marginLeft: 6, marginLeft: 6,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
reco_play_box: { reco_play_box: {
flex: 1, flex: 1,
...@@ -161,24 +159,24 @@ export const list_common_item = { ...@@ -161,24 +159,24 @@ export const list_common_item = {
// justifyContent: 'flex-end', // justifyContent: 'flex-end',
// alignItems: 'center' // alignItems: 'center'
}, },
play_tit:{ play_tit: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',
height: 60 height: 60,
}, },
play_text: { play_text: {
fontSize: second_text_size, fontSize: second_text_size,
color: first_text_color, color: first_text_color,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
play_btn:{ play_btn: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',
// height: 80 // height: 80
}, },
reco_list_box:{ reco_list_box: {
backgroundColor: '#EEECEC', backgroundColor: '#EEECEC',
borderRadius: 30, borderRadius: 30,
display: 'flex', display: 'flex',
...@@ -186,13 +184,13 @@ export const list_common_item = { ...@@ -186,13 +184,13 @@ export const list_common_item = {
justifyContent: 'center', justifyContent: 'center',
flexDirection: 'row', flexDirection: 'row',
height: 34, height: 34,
width: pxSize(100) width: pxSize(100),
}, },
reco_del_btn: { reco_del_btn: {
backgroundColor: promary_color, backgroundColor: promary_color,
height: 20, height: 20,
borderRadius: 5, borderRadius: 5,
width: pxSize(60) width: pxSize(60),
}, },
reco_play_btn: { reco_play_btn: {
width: pxSize(200), width: pxSize(200),
...@@ -200,21 +198,21 @@ export const list_common_item = { ...@@ -200,21 +198,21 @@ export const list_common_item = {
height: 34, height: 34,
borderColor: '#DFDFDF', borderColor: '#DFDFDF',
borderWidth: 1, borderWidth: 1,
backgroundColor: foundation_color backgroundColor: foundation_color,
}, },
reco_text: { reco_text: {
fontSize: second_text_size, fontSize: second_text_size,
color: first_text_color, color: first_text_color,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
reco_del_tit: { reco_del_tit: {
color: title_text_color, color: title_text_color,
fontSize: third_text_size fontSize: third_text_size,
}, },
reco_play_tit: { reco_play_tit: {
fontSize: second_text_size, fontSize: second_text_size,
fontFamily: font_family_regular, fontFamily: font_family_regular,
color: second_text_color color: second_text_color,
}, },
// 耗材明细 // 耗材明细
consu_detail: { consu_detail: {
...@@ -223,10 +221,10 @@ export const list_common_item = { ...@@ -223,10 +221,10 @@ export const list_common_item = {
paddingHorizontal: 0, paddingHorizontal: 0,
minHeight: 80, minHeight: 80,
height: 'auto', height: 'auto',
alignItems: 'flex-start' alignItems: 'flex-start',
}, },
detail_inner: { detail_inner: {
flex: 1 flex: 1,
}, },
detail_title_box: { detail_title_box: {
flexDirection: 'row', flexDirection: 'row',
...@@ -235,69 +233,69 @@ export const list_common_item = { ...@@ -235,69 +233,69 @@ export const list_common_item = {
detail_tit: { detail_tit: {
fontSize: second_text_size, fontSize: second_text_size,
color: '#A3A3A3', color: '#A3A3A3',
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
detail_sub_cont: { detail_sub_cont: {
backgroundColor: foundation_color, backgroundColor: foundation_color,
padding: 20, padding: 20,
marginTop: 10 marginTop: 10,
}, },
detail_footer: { detail_footer: {
paddingHorizontal: 16 paddingHorizontal: 16,
}, },
detail_sub_tit: { detail_sub_tit: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center' alignItems: 'center',
}, },
detail_tit_text: { detail_tit_text: {
color: '#000', color: '#000',
fontSize: 16, fontSize: 16,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
detail_icon: { detail_icon: {
width: pxSize(20), width: pxSize(20),
height: pxSize(20) height: pxSize(20),
}, },
detail_icon_rig: { detail_icon_rig: {
width: pxSize(18), width: pxSize(18),
height: pxSize(18) height: pxSize(18),
}, },
detail_top_icon: {}, detail_top_icon: {},
detail_sub_inner: { detail_sub_inner: {
marginTop: 10, marginTop: 10,
// maxHeight: pxSize(160), // maxHeight: pxSize(160),
// flex: 1 // flex: 1
height: 'auto' height: 'auto',
}, },
detail_scroll: { detail_scroll: {
// flex: 1 // flex: 1
// height: 100 // height: 100
}, },
con_de_sub: { con_de_sub: {
marginBottom: 10 marginBottom: 10,
}, },
de_sub_tit: { de_sub_tit: {
color: first_text_color, color: first_text_color,
fontSize: 14 fontSize: 14,
}, },
de_tip: { de_tip: {
color: second_text_color, color: second_text_color,
fontSize: 12, fontSize: 12,
lineHeight: 18 lineHeight: 18,
}, },
detail_btn_box: { detail_btn_box: {
backgroundColor: promary_color, backgroundColor: promary_color,
width: '100%', width: '100%',
height: pxSize(46), height: pxSize(46),
borderRadius: 5, borderRadius: 5,
marginTop: 10 marginTop: 10,
}, },
detail_btn: { detail_btn: {
color: title_text_color, color: title_text_color,
textAlign: 'center', textAlign: 'center',
fontSize: second_text_size, fontSize: second_text_size,
lineHeight: 40 lineHeight: 40,
}, },
// 添加图片 // 添加图片
consu_addpic: { consu_addpic: {
...@@ -306,15 +304,15 @@ export const list_common_item = { ...@@ -306,15 +304,15 @@ export const list_common_item = {
minHeight: pxHeight(320), minHeight: pxHeight(320),
height: 'auto', height: 'auto',
alignItems: 'flex-start', alignItems: 'flex-start',
marginBottom: 34 marginBottom: 34,
}, },
addpic_inner: { addpic_inner: {
flex: 1 flex: 1,
}, },
addpic_tit: { addpic_tit: {
fontSize: second_text_size, fontSize: second_text_size,
color: '#A3A3A3', color: '#A3A3A3',
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
addpic_cont: { addpic_cont: {
backgroundColor: foundation_color, backgroundColor: foundation_color,
...@@ -322,20 +320,20 @@ export const list_common_item = { ...@@ -322,20 +320,20 @@ export const list_common_item = {
marginTop: 10, marginTop: 10,
flexDirection: 'row', flexDirection: 'row',
flex: 1, flex: 1,
flexWrap: 'wrap' flexWrap: 'wrap',
}, },
addpic_img_btn: { addpic_img_btn: {
width: pxSize(64), width: pxSize(64),
height: pxSize(64), height: pxSize(64),
marginTop: -3, marginTop: -3,
marginLeft: -4, marginLeft: -4,
marginRight: 16 marginRight: 16,
}, },
addnew_pic_btn: { addnew_pic_btn: {
width: pxSize(64), width: pxSize(64),
height: pxSize(64), height: pxSize(64),
marginRight: 16, marginRight: 16,
marginBottom: 16 marginBottom: 16,
}, },
show_pic_btn: { show_pic_btn: {
width: pxSize(57), width: pxSize(57),
...@@ -343,14 +341,14 @@ export const list_common_item = { ...@@ -343,14 +341,14 @@ export const list_common_item = {
borderWidth: 1, borderWidth: 1,
borderColor: '#DDDDDD', borderColor: '#DDDDDD',
borderRadius: 6, borderRadius: 6,
padding: 1 padding: 1,
}, },
del_img_box: { del_img_box: {
position: 'absolute', position: 'absolute',
right: -4, right: -4,
top: -10, top: -10,
width: pxSize(20), width: pxSize(20),
height: pxSize(20) height: pxSize(20),
}, },
// 二级页面-两个提交按钮 // 二级页面-两个提交按钮
sub_box: { sub_box: {
...@@ -360,7 +358,7 @@ export const list_common_item = { ...@@ -360,7 +358,7 @@ export const list_common_item = {
shadowColor: '#E5E5E5', shadowColor: '#E5E5E5',
shadowOffset: { shadowOffset: {
width: 1, width: 1,
height: 2 height: 2,
}, },
shadowOpacity: 1, shadowOpacity: 1,
// elevation: 10, // elevation: 10,
...@@ -371,51 +369,51 @@ export const list_common_item = { ...@@ -371,51 +369,51 @@ export const list_common_item = {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
paddingHorizontal: 30, paddingHorizontal: 30,
paddingVertical: 14 paddingVertical: 14,
}, },
lef_btn: { lef_btn: {
backgroundColor: '#4F4F4F', backgroundColor: '#4F4F4F',
width: '65%', width: '65%',
borderTopLeftRadius: 10, borderTopLeftRadius: 10,
borderBottomLeftRadius: 10, borderBottomLeftRadius: 10,
height: 50 height: 50,
}, },
lef_tip: { lef_tip: {
color: title_text_color, color: title_text_color,
lineHeight: 48, lineHeight: 48,
paddingLeft: 20, paddingLeft: 20,
fontSize: 16, fontSize: 16,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
lef_tip_num:{ lef_tip_num: {
fontSize: 20 fontSize: 20,
}, },
rig_btn: { rig_btn: {
backgroundColor: promary_color, backgroundColor: promary_color,
width: '35%', width: '35%',
borderTopRightRadius: 10, borderTopRightRadius: 10,
borderBottomRightRadius: 10, borderBottomRightRadius: 10,
height: 50 height: 50,
}, },
rig_tip: { rig_tip: {
color: title_text_color, color: title_text_color,
lineHeight: 48, lineHeight: 48,
textAlign: 'center', textAlign: 'center',
fontSize: 16, fontSize: 16,
fontFamily: font_family_medium fontFamily: font_family_medium,
}, },
def_btn: { def_btn: {
backgroundColor: promary_color, backgroundColor: promary_color,
width: '100%', width: '100%',
borderRadius: 10, borderRadius: 10,
height: 50 height: 50,
}, },
def_tip: { def_tip: {
color: title_text_color, color: title_text_color,
lineHeight: 48, lineHeight: 48,
textAlign: 'center', textAlign: 'center',
fontSize: 16, fontSize: 16,
fontFamily: font_family_medium fontFamily: font_family_medium,
}, },
// 二级页面顶部搜索 // 二级页面顶部搜索
ser_cont: { ser_cont: {
...@@ -424,15 +422,16 @@ export const list_common_item = { ...@@ -424,15 +422,16 @@ export const list_common_item = {
position: 'relative', position: 'relative',
height: 60, height: 60,
justifyContent: 'center', justifyContent: 'center',
paddingHorizontal: 16 paddingHorizontal: 16,
}, },
ser_img_box: { ser_img_box: {
position: 'absolute', position: 'absolute',
left: 24, left: 24,
top: 20, top: 20,
width: pxSize(22), width: pxSize(22),
height: pxSize(22) height: pxSize(22),
}, },
ser_text_input: { ser_text_input: {
backgroundColor: '#F5F5F5', backgroundColor: '#F5F5F5',
height: 38, height: 38,
...@@ -440,6 +439,20 @@ export const list_common_item = { ...@@ -440,6 +439,20 @@ export const list_common_item = {
paddingLeft: 34, paddingLeft: 34,
borderRadius: 10, borderRadius: 10,
fontSize: 14, fontSize: 14,
fontFamily: font_family_regular fontFamily: font_family_regular,
},
ser_btn: {
position: 'absolute',
right: 20,
top: 15,
backgroundColor: promary_color,
color: '#fff',
width: 60,
height: 30,
},
ser_text_btn: {
color: '#fff',
lineHeight: 30,
textAlign: 'center',
}, },
} }
import React, { Component } from 'react'; import React, { Component } from 'react'
import { StyleSheet, Image, Text, TouchableOpacity, View } from 'react-native'; import { StyleSheet, Image, Text, TouchableOpacity, View } from 'react-native'
import { connect } from 'react-redux'; import { connect } from 'react-redux'
import { first_text_color, font_family_medium, font_family_regular, font_family_semibold, home_background_color, icon_style, pxSize, second_text_size, third_text_color, third_text_size, list_tit_color, list_str_color, list_one_color, list_thr_color, list_one_light_color } from '../../../base/BaseStyle'; import {
import PictureZoom from '../../common/listDataComponent/PictureZoom'; first_text_color,
import LocalVariable from '../LocalVariable'; font_family_medium,
const PropTypes = require('prop-types'); font_family_regular,
font_family_semibold,
home_background_color,
icon_style,
pxSize,
second_text_size,
third_text_color,
third_text_size,
list_tit_color,
list_str_color,
list_one_color,
list_thr_color,
list_one_light_color,
} from '../../../base/BaseStyle'
import PictureZoom from '../../common/listDataComponent/PictureZoom'
import LocalVariable from '../LocalVariable'
const PropTypes = require('prop-types')
/** /**
* 列表组件,图片-标题(提示)-计算/关闭 * 列表组件,图片-标题(提示)-计算/关闭
*/ */
class PicTitDetaiCalcu extends Component { class PicTitDetaiCalcu extends Component {
static propTypres = { static propTypres = {
listItem: PropTypes.object, listItem: PropTypes.object,
listIndex: PropTypes.number, listIndex: PropTypes.number,
...@@ -48,12 +63,12 @@ class PicTitDetaiCalcu extends Component { ...@@ -48,12 +63,12 @@ class PicTitDetaiCalcu extends Component {
} }
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
listPicTypeArr: ['ROUND', 'SQUARE', 'RECTANGLE'], listPicTypeArr: ['ROUND', 'SQUARE', 'RECTANGLE'],
picStyleArr: ['round_pic', 'square_pic', 'rectan_pic'], picStyleArr: ['round_pic', 'square_pic', 'rectan_pic'],
showOtherFlag: true, showOtherFlag: true,
showOtherTitle: '点击隐藏具体详情' showOtherTitle: '点击隐藏具体详情',
} }
} }
...@@ -92,20 +107,49 @@ class PicTitDetaiCalcu extends Component { ...@@ -92,20 +107,49 @@ class PicTitDetaiCalcu extends Component {
} }
// 具体详情 // 具体详情
showAllTip(){ showAllTip() {
let {showOtherFlag} = this.state let { showOtherFlag } = this.state
let curShowOtherTitle = showOtherFlag ? '点击查看具体详情' : '点击隐藏具体详情' let curShowOtherTitle = showOtherFlag ? '点击查看具体详情' : '点击隐藏具体详情'
this.setState({ this.setState({
showOtherFlag: !showOtherFlag, showOtherFlag: !showOtherFlag,
showOtherTitle: curShowOtherTitle showOtherTitle: curShowOtherTitle,
}) })
} }
render() { render() {
let { listItem, listIndex, calField, listStyleBox, listStyleTit, listStyleTip, listStyleCalBtn, listPicType, titCallBack, let {
titText, tipTextStr, tipTextOne, tipTextTwo, tipTextThr, listImgIcon, listStyleImg, showClearIcon, showClearIndex, listCardActIndex, listItem,
listStyleClearBtn, clearCallBack, onlyShowNum, onlyShowSelect, titTextTit, tipTextStrTit, tipTextOneTit, tipTextTwoTit, tipTextThrTit, listIndex,
global_domain_config, listMaxNum, listShowOthOptFlag } = this.props calField,
listStyleBox,
listStyleTit,
listStyleTip,
listStyleCalBtn,
listPicType,
titCallBack,
titText,
tipTextStr,
tipTextOne,
tipTextTwo,
tipTextThr,
listImgIcon,
listStyleImg,
showClearIcon,
showClearIndex,
listCardActIndex,
listStyleClearBtn,
clearCallBack,
onlyShowNum,
onlyShowSelect,
titTextTit,
tipTextStrTit,
tipTextOneTit,
tipTextTwoTit,
tipTextThrTit,
global_domain_config,
listMaxNum,
listShowOthOptFlag,
} = this.props
let { listPicTypeArr, picStyleArr, showOtherFlag, showOtherTitle } = this.state let { listPicTypeArr, picStyleArr, showOtherFlag, showOtherTitle } = this.state
let picOthStyle = '' let picOthStyle = ''
...@@ -127,71 +171,87 @@ class PicTitDetaiCalcu extends Component { ...@@ -127,71 +171,87 @@ class PicTitDetaiCalcu extends Component {
} }
let cur_photos = [] let cur_photos = []
if (listItem[listImgIcon] instanceof Array) { if (listItem[listImgIcon] instanceof Array) {
listItem[listImgIcon].map((iconIt) => { listItem[listImgIcon].map(iconIt => {
cur_photos.push({ url: global_domain_config + '/jeecg-boot/sys/common/view/' + iconIt }) cur_photos.push({ url: global_domain_config + '/jeecg-boot/sys/common/view/' + iconIt })
}) })
if(listItem[listImgIcon].length === 0){ if (listItem[listImgIcon].length === 0) {
cur_photos[0] = (require('../../../images/not_img.png')) cur_photos[0] = require('../../../images/not_img.png')
} }
}else if(typeof listItem[listImgIcon] === 'string'){ } else if (typeof listItem[listImgIcon] === 'string') {
cur_photos[0] = { url: global_domain_config + '/jeecg-boot/sys/common/view/' + listItem[listImgIcon] } cur_photos[0] = { url: global_domain_config + '/jeecg-boot/sys/common/view/' + listItem[listImgIcon] }
} }
return ( return (
<View style={[styles.ri_inner, listStyleBox]}> <View style={[styles.ri_inner, listStyleBox]}>
{(listImgIcon && cur_photos.length > 0) ? {listImgIcon && cur_photos.length > 0 ? (
<PictureZoom <PictureZoom
listImageIndex={0} listImageIndex={0}
listImageUrls={cur_photos} listImageUrls={cur_photos}
listStyleImage={[styles.oth_img_box, styles[picOthStyle], listStyleImg]} listStyleImage={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}
listPicType={listPicType} listPicType={listPicType}
/> />
: null} ) : null}
<View style={styles.ri_text_box}> <View style={styles.ri_text_box}>
<TouchableOpacity <TouchableOpacity
activeOpacity={titCallBack ? .8 : 1} activeOpacity={titCallBack ? 0.8 : 1}
onPress={() => { titCallBack ? titCallBack(listItem, listIndex) : {} }} onPress={() => {
titCallBack ? titCallBack(listItem, listIndex) : {}
}}
style={styles.oth_box} style={styles.oth_box}
> >
<Text numberOfLines={3} style={[styles.thr_ot, listStyleTit]}> <Text numberOfLines={3} style={[styles.thr_ot, listStyleTit]}>
{listItem[titText] ? `${listIndex+1}. ${listItem[titText]}` : '' } {listItem[titText] ? `${listIndex + 1}. ${listItem[titText]}` : ''}
{!listItem[titText] && titTextTit ? `${listIndex+1}. ${titTextTit}: 无` : ''} {!listItem[titText] && titTextTit ? `${listIndex + 1}. ${titTextTit}: 无` : ''}
</Text> </Text>
{tipTextStrTit ? <Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_str, listStyleTip]}> {tipTextStrTit ? (
<Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_str, listStyleTip]}>
{`${tipTextStrTit}:`} {listItem[tipTextStr] ? listItem[tipTextStr] : '无'} {`${tipTextStrTit}:`} {listItem[tipTextStr] ? listItem[tipTextStr] : '无'}
</Text> : null} </Text>
{tipTextOneTit ? <Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_one,listStyleTip]}> ) : null}
{tipTextOneTit ? (
<Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_one, listStyleTip]}>
{`${tipTextOneTit}:`} {listItem[tipTextOne] ? listItem[tipTextOne] : '无'} {`${tipTextOneTit}:`} {listItem[tipTextOne] ? listItem[tipTextOne] : '无'}
</Text> : null} </Text>
{tipTextTwoTit ? <Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_two,listStyleTip]}> ) : null}
{tipTextTwoTit ? (
<Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_two, listStyleTip]}>
{`${tipTextTwoTit}:`} {listItem[tipTextTwo] ? listItem[tipTextTwo] : '无'} {`${tipTextTwoTit}:`} {listItem[tipTextTwo] ? listItem[tipTextTwo] : '无'}
</Text> : null} </Text>
{tipTextThrTit ? <Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_thr,listStyleTip]}> ) : null}
{tipTextThrTit ? (
<Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_thr, listStyleTip]}>
{`${tipTextThrTit}:`} {listItem[tipTextThr] ? listItem[tipTextThr] : '无'} {`${tipTextThrTit}:`} {listItem[tipTextThr] ? listItem[tipTextThr] : '无'}
</Text> : null} </Text>
{listShowOthOptFlag && listItem[LocalVariable.SUPER_SEL_ALL_ARR] ? <View> ) : null}
<TouchableOpacity {listShowOthOptFlag && listItem[LocalVariable.SUPER_SEL_ALL_ARR] ? (
activeOpacity={.8} <View>
onPress={() => this.showAllTip()} <TouchableOpacity activeOpacity={0.8} onPress={() => this.showAllTip()}>
> <Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_thr, listStyleTip]}>
<Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_thr,listStyleTip]}>{showOtherTitle}</Text> {showOtherTitle}
</Text>
</TouchableOpacity> </TouchableOpacity>
{ {showOtherFlag
showOtherFlag ? listItem[LocalVariable.SUPER_SEL_ALL_ARR].map((item, item_index) => { ? listItem[LocalVariable.SUPER_SEL_ALL_ARR].map((item, item_index) => {
return <View> return (
<Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_one,listStyleTip]}> <View>
{item_index+1}. {item.item_name} - <Text style={[styles.ri_te_ot, styles.te_ot_main,listStyleTip]}>{item.manufacturer_product_code} - {item.specification}</Text> - {item.general_name} x {item[LocalVariable.QUANTITY_FIELD]} <Text numberOfLines={3} style={[styles.ri_te_ot, styles.te_ot_one, listStyleTip]}>
{item_index + 1}. {item.item_name} -{' '}
<Text style={[styles.ri_te_ot, styles.te_ot_main, listStyleTip]}>
{item.manufacturer_product_code} - {item.specification}
</Text>{' '}
- {item.general_name} x {item[LocalVariable.QUANTITY_FIELD]}
</Text> </Text>
</View> </View>
}) : null )
} })
</View> : null} : null}
</View>
) : null}
</TouchableOpacity> </TouchableOpacity>
</View> </View>
{ {showClearIcon && listCardActIndex === showClearIndex ? (
(showClearIcon && listCardActIndex === showClearIndex) ?
<View style={styles.btn_cle_box}> <View style={styles.btn_cle_box}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.9} activeOpacity={0.9}
style={[styles.btn_clear_inner, listStyleClearBtn]} style={[styles.btn_clear_inner, listStyleClearBtn]}
onPress={() => clearCallBack(listItem, listIndex)} onPress={() => clearCallBack(listItem, listIndex)}
> >
...@@ -199,47 +259,53 @@ class PicTitDetaiCalcu extends Component { ...@@ -199,47 +259,53 @@ class PicTitDetaiCalcu extends Component {
<Image source={require('../../../images/close_icon.png')} style={icon_style}></Image> <Image source={require('../../../images/close_icon.png')} style={icon_style}></Image>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> : </View>
) : (
<View style={[styles.ri_num_box, onlyShowNum ? styles.show_num_box : null]}> <View style={[styles.ri_num_box, onlyShowNum ? styles.show_num_box : null]}>
{(listItem[calField] !== 0 && !onlyShowNum && !onlyShowSelect) ? {listItem[calField] && !onlyShowNum && !onlyShowSelect ? (
<TouchableOpacity <TouchableOpacity
activeOpacity={.9} activeOpacity={0.9}
style={[styles.btn_inner, listStyleCalBtn]} style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex)} onPress={() => this.handelCalculation(listItem, listIndex)}
> >
<View style={[styles.thr_num_btn, styles.thr_btn_left]}> <View style={[styles.thr_num_btn, styles.thr_btn_left]}>
<Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image> <Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image>
</View> </View>
</TouchableOpacity> : null} </TouchableOpacity>
{(listItem[calField] !== 0 && !onlyShowSelect) ? <Text style={[styles.thr_num, onlyShowNum ? styles.show_num : null]}>{listItem[calField]}</Text> : null} ) : null}
{(!onlyShowNum && !onlyShowSelect && showPlusIcon) ? <TouchableOpacity {listItem[calField] && !onlyShowSelect ? (
activeOpacity={.9} <Text style={[styles.thr_num, onlyShowNum ? styles.show_num : null]}>{listItem[calField]}</Text>
) : null}
{!onlyShowNum && !onlyShowSelect && showPlusIcon ? (
<TouchableOpacity
activeOpacity={0.9}
style={[styles.btn_inner, listStyleCalBtn]} style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex, true)} onPress={() => this.handelCalculation(listItem, listIndex, true)}
> >
<View style={[styles.thr_num_btn, styles.thr_btn_right]}> <View style={[styles.thr_num_btn, styles.thr_btn_right]}>
<Image source={calIcon} style={icon_style}></Image> <Image source={calIcon} style={icon_style}></Image>
</View> </View>
</TouchableOpacity> : null} </TouchableOpacity>
) : null}
{onlyShowSelect ? <TouchableOpacity {onlyShowSelect ? (
activeOpacity={.9} <TouchableOpacity
activeOpacity={0.9}
style={[styles.btn_sel_inner]} style={[styles.btn_sel_inner]}
onPress={() => this.handelSelectCheck(listItem, listIndex)} onPress={() => this.handelSelectCheck(listItem, listIndex)}
> >
<View style={[styles.thr_sel_btn]}> <View style={[styles.thr_sel_btn]}>
<Image source={defSelIcon} style={icon_style}></Image> <Image source={defSelIcon} style={icon_style}></Image>
</View> </View>
</TouchableOpacity> : null </TouchableOpacity>
} ) : null}
</View> </View>
} )}
</View> </View>
); )
} }
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
ri_inner: { ri_inner: {
flexDirection: 'row', flexDirection: 'row',
...@@ -248,41 +314,41 @@ const styles = StyleSheet.create({ ...@@ -248,41 +314,41 @@ const styles = StyleSheet.create({
paddingTop: 16, paddingTop: 16,
paddingBottom: 12, paddingBottom: 12,
borderBottomWidth: 1, borderBottomWidth: 1,
borderColor: 'rgba(241, 241, 241, 0.87)' borderColor: 'rgba(241, 241, 241, 0.87)',
}, },
ri_text_box: { ri_text_box: {
flex: 1 flex: 1,
}, },
ri_te_ot: { ri_te_ot: {
fontSize: third_text_size, fontSize: third_text_size,
color: third_text_color, color: third_text_color,
fontFamily: font_family_regular, fontFamily: font_family_regular,
paddingBottom: 2 paddingBottom: 2,
}, },
oth_box: { oth_box: {
paddingBottom: 2 paddingBottom: 2,
}, },
thr_ot: { thr_ot: {
fontFamily: font_family_medium, fontFamily: font_family_medium,
fontSize: second_text_size, fontSize: second_text_size,
color: list_tit_color, color: list_tit_color,
paddingBottom: 4 paddingBottom: 4,
}, },
te_ot_str: { te_ot_str: {
fontFamily: font_family_semibold, fontFamily: font_family_semibold,
color: list_str_color color: list_str_color,
}, },
te_ot_one:{ te_ot_one: {
color: list_one_color color: list_one_color,
}, },
te_ot_two:{ te_ot_two: {
color: list_one_color color: list_one_color,
}, },
te_ot_thr:{ te_ot_thr: {
color: list_thr_color color: list_thr_color,
}, },
te_ot_main: { te_ot_main: {
color: list_one_light_color color: list_one_light_color,
}, },
oth_img_box: { oth_img_box: {
width: pxSize(58), width: pxSize(58),
...@@ -290,11 +356,11 @@ const styles = StyleSheet.create({ ...@@ -290,11 +356,11 @@ const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
marginRight: 3, marginRight: 3,
padding: 3 padding: 3,
}, },
round_pic: { round_pic: {
borderColor: 'rgba(0, 0, 0, 0.12)', borderColor: 'rgba(0, 0, 0, 0.12)',
borderWidth: .5, borderWidth: 0.5,
borderRadius: 50, borderRadius: 50,
}, },
square_pic: {}, square_pic: {},
...@@ -304,32 +370,32 @@ const styles = StyleSheet.create({ ...@@ -304,32 +370,32 @@ const styles = StyleSheet.create({
}, },
thr_num_btn: { thr_num_btn: {
width: pxSize(24), width: pxSize(24),
height: pxSize(30) height: pxSize(30),
}, },
thr_sel_btn: { thr_sel_btn: {
width: pxSize(22), width: pxSize(22),
height: pxSize(22) height: pxSize(22),
}, },
btn_inner: {}, btn_inner: {},
btn_sel_inner: {}, btn_sel_inner: {},
btn_cle_box: { btn_cle_box: {
marginRight: 3, marginRight: 3,
paddingHorizontal: 4, paddingHorizontal: 4,
paddingVertical: 4 paddingVertical: 4,
}, },
btn_clear_inner: {}, btn_clear_inner: {},
icon_cle_btn: { icon_cle_btn: {
width: pxSize(22), width: pxSize(22),
height: pxSize(22) height: pxSize(22),
}, },
ri_num_box: { ri_num_box: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
marginLeft: 3, marginLeft: 3,
backgroundColor: home_background_color backgroundColor: home_background_color,
}, },
show_num_box: { show_num_box: {
backgroundColor: null backgroundColor: null,
}, },
thr_btn_left: {}, thr_btn_left: {},
thr_btn_right: {}, thr_btn_right: {},
...@@ -338,20 +404,20 @@ const styles = StyleSheet.create({ ...@@ -338,20 +404,20 @@ const styles = StyleSheet.create({
textAlign: 'center', textAlign: 'center',
fontFamily: font_family_regular, fontFamily: font_family_regular,
fontSize: 14, fontSize: 14,
color: first_text_color color: first_text_color,
}, },
show_num: { show_num: {
fontSize: 18 fontSize: 18,
} },
}) })
const mapStateToProps = (state) => { const mapStateToProps = state => {
return { return {
global_domain_config: state.login.global_domain_config global_domain_config: state.login.global_domain_config,
} }
} }
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = dispatch => {
return { return {
// exitLoginStatus: () => { // exitLoginStatus: () => {
// dispatch(exitLoginStatus()) // dispatch(exitLoginStatus())
...@@ -359,4 +425,4 @@ const mapDispatchToProps = (dispatch) => { ...@@ -359,4 +425,4 @@ const mapDispatchToProps = (dispatch) => {
} }
} }
export default connect(mapStateToProps, mapDispatchToProps)(PicTitDetaiCalcu); export default connect(mapStateToProps, mapDispatchToProps)(PicTitDetaiCalcu)
import React, { Component } from 'react'; import React, { Component } from 'react'
import { View, Text, SafeAreaView, StyleSheet, TouchableOpacity, Image, ScrollView, TextInput, Alert, Linking, NativeModules, Platform } from 'react-native'; import {
import { connect } from 'react-redux'; View,
import { home_background_color, placehold_text_color, promary_color, safe_view, icon_style, list_common_item } from '../../base/BaseStyle'; Text,
import { ImageTextStyle, CellTextStyle, FooterBtnStyle } from '../common/CellTextStyle'; SafeAreaView,
import { show, formatStrForDate, cloneObject, dedupQuoteArray, isBlank, isNotBlank, decodeDisplayProfiles, getCodeValue } from '../../utils/Utils'; StyleSheet,
import HeadBackItem from '../common/HeadBackItem'; TouchableOpacity,
import StatusBarView from '../common/StatusBarView'; Image,
import DialogModel from '../common/DialogModel'; ScrollView,
import LodingModel from '../common/LodingModel'; TextInput,
import DateModel from '../common/DateModel'; Alert,
import { AudioRecorder, AudioUtils } from 'react-native-audio'; Linking,
import Sound from 'react-native-sound'; NativeModules,
import { requestSelfOrganizations, requestSelfSurgeryHospital, requestSelfOrderType, requestSelfTemplateCollect, requestSelfAudio, requestSelfSumbit, setSelfInitData, reqSelfSurgeryHospital, requestListDataSuccess, requestSelfSurgeryType, setSelectProductOpts, reqSelfOrganizations, reqOrgDepartments, requestQuickSurColSetting, requestSurgeryType} from '../../action/SelfAction'; Platform,
import { exitLoginStatus, requestSysProfile } from '../../action/LoginAction'; } from 'react-native'
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 { connect } from 'react-redux'
import PageListArrow from '../common/listDataComponent/PageListArrow'; import {
import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect'; home_background_color,
import LocalVariable from '../common/LocalVariable'; placehold_text_color,
import LoadingModel from '../common/listDataComponent/LoadingModel'; promary_color,
import NotEnoughModel from '../common/NotEnoughModel'; safe_view,
import ImagePicker from 'react-native-image-picker'; icon_style,
import ZoomPictureModel from '../common/ZoomPictureModel'; list_common_item,
import { uploadTransImg } from '../../action/TransAction'; } from '../../base/BaseStyle'
import moment from 'moment'; import { ImageTextStyle, CellTextStyle, FooterBtnStyle } from '../common/CellTextStyle'
import * as R from "ramda"; 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 { class SelfOrderPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
canSubFlag: false, // 提交按钮样式 canSubFlag: false, // 提交按钮样式
listOptionData: [ listOptionData: [
{ {
"id": "0", id: '0',
title: '销售员', title: '销售员',
name: '', name: '',
value: '' value: '',
}, },
{ {
"id": "1", id: '1',
title: '组织', title: '组织',
name: '请选择', name: '请选择',
value: '' value: '',
}, },
{ {
"id": "2", id: '2',
title: '客户名称', title: '客户名称',
name: '请选择', name: '请选择',
value: '' value: '',
}, },
{ {
"id": "3", id: '3',
title: '收单地点', title: '收单地点',
name: '请选择', name: '请选择',
value: '' value: '',
}, },
{ {
"id": "4", id: '4',
title: '收货地点', title: '收货地点',
name: '请选择', name: '请选择',
value: '' value: '',
}, },
{ {
"id": "5", id: '5',
title: '主治医生', title: '主治医生',
name: '请选择', name: '请选择',
value: '', value: '',
showInput: false, showInput: false,
inputValue: '' inputValue: '',
}, },
{ {
"id": "6", id: '6',
title: '手术时间', title: '手术时间',
name: (() => { name: (() => {
let date = moment(new Date()).add(1, 'd') let date = moment(new Date()).add(1, 'd')
...@@ -90,121 +143,121 @@ class SelfOrderPage extends Component { ...@@ -90,121 +143,121 @@ class SelfOrderPage extends Component {
date.set('minute', 0) date.set('minute', 0)
return date.toDate() return date.toDate()
})(), })(),
showDatePicker: true showDatePicker: true,
}, },
{ {
"id": "7", id: '7',
title: '订单类型', title: '订单类型',
name: '请选择', name: '请选择',
value: '' value: '',
}, },
{ {
"id": "8", id: '8',
title: '选择产品', title: '选择产品',
name: '请选择', name: '请选择',
value: '', value: '',
lines: [], lines: [],
sub_lines: [], sub_lines: [],
replace_item_flag: 'N', // 器械包 replace_item_flag: 'N', // 器械包
take_cert_flag: 'N' // 合格证 take_cert_flag: 'N', // 合格证
}, },
{ {
"id": "9", id: '9',
title: '需要携带合格证', title: '需要携带合格证',
value: '', value: '',
isRedio: '' // 单选 isRedio: '', // 单选
}, },
{ {
"id": "10", id: '10',
title: '同意替换器械包', // 同意替换同品不同器械包 title: '同意替换器械包', // 同意替换同品不同器械包
value: 'N', value: 'N',
isRedio: 'N' // 单选 isRedio: 'N', // 单选
}, },
{ {
"id": "11", id: '11',
title: '备注', title: '备注',
value: '', value: '',
isRemark: true // 备注 isRemark: true, // 备注
}, },
{ {
"id": "12", id: '12',
title: '还有什么要安排的,可录音备注哟!', title: '还有什么要安排的,可录音备注哟!',
value: '', value: '',
isRecode: true // 录音 isRecode: true, // 录音
}, },
{ {
"id": "13", id: '13',
title: '添加图片', title: '添加图片',
value: '', value: '',
isAddImage: true, // 添加图片 isAddImage: true, // 添加图片
uploadImgArr: [] // 上传后的路径 uploadImgArr: [], // 上传后的路径
}, },
{ {
"id": "14", id: '14',
title: '部门', title: '部门',
name: '请选择', name: '请选择',
value: '', value: '',
}, },
{ {
"id": "15", id: '15',
title: '业务经理', title: '业务经理',
name: '请选择', name: '请选择',
value: '', value: '',
}, },
{ {
"id": "16", id: '16',
title: '跟台员', title: '跟台员',
name: '请选择', name: '请选择',
value: '', value: '',
}, },
{ {
"id": "17", id: '17',
title: '送货员', title: '送货员',
name: '请选择', name: '请选择',
value: '', value: '',
}, },
{ {
"id": "18", id: '18',
title: '借货仓库', title: '借货仓库',
name: '请选择', name: '请选择',
value: '', value: '',
}, },
{ {
"id": "19", id: '19',
title: '手术类型', title: '手术类型',
name: '请选择', name: '请选择',
value: '', value: '',
}, },
{ {
"id": "20", id: '20',
title: '患者姓名', title: '患者姓名',
value: '' value: '',
}, },
{ {
"id": "21", id: '21',
title: '性别', // 选择 title: '性别', // 选择
name: '请选择', name: '请选择',
value: '' value: '',
}, },
{ {
"id": "22", id: '22',
title: '年龄', // 输入 title: '年龄', // 输入
value: '' value: '',
}, },
{ {
"id": "23", id: '23',
title: '床位', title: '床位',
value: '' value: '',
}, },
{ {
"id": "24", id: '24',
title: '病历号', title: '病历号',
value: '' value: '',
}, },
], ],
subInitListOption: [], // 存储最初数据 subInitListOption: [], // 存储最初数据
submitOption: { // 提交的信息 submitOption: {
// 提交的信息
seller_code: '', // 用户名username seller_code: '', // 用户名username
org_code: '', // 组织 org_code: '', // 组织
customer_code: '', // 客户名称 customer_code: '', // 客户名称
...@@ -221,24 +274,27 @@ class SelfOrderPage extends Component { ...@@ -221,24 +274,27 @@ class SelfOrderPage extends Component {
Caller: 'dingding', // Caller: 'APP', Caller: 'dingding', // Caller: 'APP',
force_balance_check_flag: 'Y', // 检查缺失物料 force_balance_check_flag: 'Y', // 检查缺失物料
replace_item_flag: 'N', // 器械包 replace_item_flag: 'N', // 器械包
take_cert_flag: 'N' // 合格证 take_cert_flag: 'N', // 合格证
}, },
currentItem: { currentItem: {
name: '请选择', name: '请选择',
value: '-1' value: '-1',
}, },
localOtherObj: { // 恢复原状态 localOtherObj: {
// 恢复原状态
name: '请选择', name: '请选择',
value: '' value: '',
}, },
sexTypeOption: [ // 性别 sexTypeOption: [
// 性别
{ {
name:'男', name: '男',
value:'男' value: '男',
},{ },
name:'女', {
value:'女' name: '女',
} value: '女',
},
], ],
currentTitle: '组织', // 当前点击项 currentTitle: '组织', // 当前点击项
showTypePop: false, // 选择器弹窗 showTypePop: false, // 选择器弹窗
...@@ -265,12 +321,12 @@ class SelfOrderPage extends Component { ...@@ -265,12 +321,12 @@ class SelfOrderPage extends Component {
OBS_MOBILE_BOR_WARE_REQUIRED: 0, OBS_MOBILE_BOR_WARE_REQUIRED: 0,
}, },
departments: [], departments: [],
surgery_types: [] surgery_types: [],
} }
} }
componentDidMount() { componentDidMount() {
const {sysProfiles} = this.props const { sysProfiles } = this.props
this.getSysProfileValue() this.getSysProfileValue()
this.props.setSelectProductOpts([]) this.props.setSelectProductOpts([])
this.getSellerName() this.getSellerName()
...@@ -301,14 +357,14 @@ class SelfOrderPage extends Component { ...@@ -301,14 +357,14 @@ class SelfOrderPage extends Component {
let { state, props } = this let { state, props } = this
let { listOptionData } = this.state let { listOptionData } = this.state
this.setState({ this.setState({
subInitListOption: cloneObject(listOptionData) // 存储初始化数据,提交成功后赋此值 subInitListOption: cloneObject(listOptionData), // 存储初始化数据,提交成功后赋此值
}) })
if (state.listOptionData[0].name !== props.userInfo.person_name) { if (state.listOptionData[0].name !== props.userInfo.person_name) {
listOptionData[0].name = props.userInfo.person_name listOptionData[0].name = props.userInfo.person_name
listOptionData[0].value = props.userInfo.user_name listOptionData[0].value = props.userInfo.user_name
this.setState({ this.setState({
listOptionData, listOptionData,
subInitListOption: cloneObject(listOptionData) subInitListOption: cloneObject(listOptionData),
}) })
} }
} }
...@@ -318,18 +374,18 @@ class SelfOrderPage extends Component { ...@@ -318,18 +374,18 @@ class SelfOrderPage extends Component {
*/ */
async getSysProfileValue() { async getSysProfileValue() {
let { global_domain_config, token } = this.props 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 = { const params = {
access_token: token, access_token: token,
profile_code: key profile_code: key,
} }
const res = await requestSysProfile(global_domain_config, params) const res = await requestSysProfile(global_domain_config, params)
if (res.error_code || res.status) return if (res.error_code || res.status) return
sysValues[key] = isNaN(res.data.profile_value) ? res.data.profile_value : parseInt(res.data.profile_value) sysValues[key] = isNaN(res.data.profile_value) ? res.data.profile_value : parseInt(res.data.profile_value)
this.setState({ this.setState({
sysValues sysValues,
}) })
} }
...@@ -338,39 +394,40 @@ class SelfOrderPage extends Component { ...@@ -338,39 +394,40 @@ class SelfOrderPage extends Component {
// 请求授权 // 请求授权
getAudioAuthorize() { getAudioAuthorize() {
AudioRecorder.requestAuthorization() AudioRecorder.requestAuthorization().then(isAuthor => {
.then(isAuthor => {
console.log('是否授权: ' + isAuthor) console.log('是否授权: ' + isAuthor)
if (!isAuthor) { if (!isAuthor) {
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{ return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [
{
text: '设置', text: '设置',
onPress: () => { onPress: () => {
if (Platform.OS == 'ios') { if (Platform.OS == 'ios') {
Linking.openURL('app-settings:') Linking.openURL('app-settings:').catch(err => console.log('error', err))
.catch(err => console.log('error', err))
} else if (Platform.OS == 'android') { } else if (Platform.OS == 'android') {
NativeModules.OpenSettings.openNetworkSettings(data => { NativeModules.OpenSettings.openNetworkSettings(data => {
console.log('call back data', data) console.log('call back data', data)
}).catch(err => console.log('android---', err)) }).catch(err => console.log('android---', err))
} }
} },
}, { },
{
text: '取消', text: '取消',
}]) },
])
} }
this.setState({ hasPermission: isAuthor }) this.setState({ hasPermission: isAuthor })
this.prepareRecordingPath(this.state.audioPath); this.prepareRecordingPath(this.state.audioPath)
// 录音进展 // 录音进展
AudioRecorder.onProgress = (data) => { AudioRecorder.onProgress = data => {
this.setState({ this.setState({
currentTime: Math.ceil(data.currentTime) currentTime: Math.ceil(data.currentTime),
}); })
}; }
// 完成录音 // 完成录音
AudioRecorder.onFinished = (data) => { AudioRecorder.onFinished = data => {
// data 录音数据 // data 录音数据
console.log(this.state.currentTime) console.log(this.state.currentTime)
}; }
}) })
} }
...@@ -380,7 +437,7 @@ class SelfOrderPage extends Component { ...@@ -380,7 +437,7 @@ class SelfOrderPage extends Component {
* path 路径 * path 路径
* option 参数 * option 参数
*/ */
prepareRecordingPath = (path) => { prepareRecordingPath = path => {
const option = { const option = {
SampleRate: 44100.0, //采样率 SampleRate: 44100.0, //采样率
Channels: 2, //通道 Channels: 2, //通道
...@@ -399,21 +456,23 @@ class SelfOrderPage extends Component { ...@@ -399,21 +456,23 @@ class SelfOrderPage extends Component {
// 开始录音 // 开始录音
_record = async () => { _record = async () => {
if (!this.state.hasPermission) { if (!this.state.hasPermission) {
return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [{ return Alert.alert('提示信息', 'APP需要使用录音,请打开录音权限允许APP使用', [
{
text: '设置', text: '设置',
onPress: () => { onPress: () => {
if (Platform.OS == 'ios') { if (Platform.OS == 'ios') {
Linking.openURL('app-settings:') Linking.openURL('app-settings:').catch(err => console.log('error', err))
.catch(err => console.log('error', err))
} else if (Platform.OS == 'android') { } else if (Platform.OS == 'android') {
NativeModules.OpenSettings.openNetworkSettings(data => { NativeModules.OpenSettings.openNetworkSettings(data => {
console.log('call back data', data) console.log('call back data', data)
}).catch(err => console.log('android---', err)) }).catch(err => console.log('android---', err))
} }
} },
}, { },
{
text: '取消', text: '取消',
}]) },
])
} }
show('录音开始') show('录音开始')
if (this.state.stop) { if (this.state.stop) {
...@@ -434,10 +493,10 @@ class SelfOrderPage extends Component { ...@@ -434,10 +493,10 @@ class SelfOrderPage extends Component {
} }
show('录音结束') show('录音结束')
try { try {
await AudioRecorder.stopRecording(); await AudioRecorder.stopRecording()
this.setState({ stop: true }); this.setState({ stop: true })
} catch (error) { } catch (error) {
console.log('stop record--error->', error); console.log('stop record--error->', error)
} }
} }
...@@ -445,7 +504,7 @@ class SelfOrderPage extends Component { ...@@ -445,7 +504,7 @@ class SelfOrderPage extends Component {
_play = async () => { _play = async () => {
let that = this let that = this
show('正在播放') show('正在播放')
that.whoosh = new Sound(this.state.audioPath, '', (err) => { that.whoosh = new Sound(this.state.audioPath, '', err => {
if (err) { if (err) {
show('加载音频失败') show('加载音频失败')
return console.log('加载音频失败-->', err) return console.log('加载音频失败-->', err)
...@@ -470,7 +529,7 @@ class SelfOrderPage extends Component { ...@@ -470,7 +529,7 @@ class SelfOrderPage extends Component {
this.setState({ this.setState({
currentTime: 0, currentTime: 0,
stop: false, stop: false,
listOptionData listOptionData,
}) })
} }
...@@ -482,34 +541,37 @@ class SelfOrderPage extends Component { ...@@ -482,34 +541,37 @@ class SelfOrderPage extends Component {
case SELF_ORDER_LIST_DOING: case SELF_ORDER_LIST_DOING:
// that.refs.LoadingModel.show() // that.refs.LoadingModel.show()
that.changeSubLoding(true) that.changeSubLoding(true)
break; break
case SELF_ORDER_LIST_SUCCESS: case SELF_ORDER_LIST_SUCCESS:
// that.refs.LoadingModel.hide() // that.refs.LoadingModel.hide()
// setTimeout(() => { // setTimeout(() => {
// that.changeCurrentOption() // that.changeCurrentOption()
// }, 500) // IOS问题 // }, 500) // IOS问题
that.setState({ that.setState(
{
isSubLoding: false, isSubLoding: false,
lodingTitle: '加载中' lodingTitle: '加载中',
}, () => { },
() => {
that.changeCurrentOption() that.changeCurrentOption()
}) },
break; )
break
case SELF_ORDER_LIST_FAILURE: case SELF_ORDER_LIST_FAILURE:
// that.refs.LoadingModel.hide() // that.refs.LoadingModel.hide()
that.changeSubLoding(false) that.changeSubLoding(false)
break; break
default: default:
break; break
} }
} }
if (loginState != nextProps.loginState) { if (loginState != nextProps.loginState) {
switch (nextProps.loginState) { switch (nextProps.loginState) {
case LOGIN_NO: case LOGIN_NO:
navigation.navigate('LoginPage') navigation.navigate('LoginPage')
break; break
default: default:
break; break
} }
} }
if (submit_self_order_status != nextProps.submit_self_order_status) { if (submit_self_order_status != nextProps.submit_self_order_status) {
...@@ -517,27 +579,30 @@ class SelfOrderPage extends Component { ...@@ -517,27 +579,30 @@ class SelfOrderPage extends Component {
case SELF_SUBMIT_DOING: case SELF_SUBMIT_DOING:
// that.refs.LoadingModel.show('提交中') // that.refs.LoadingModel.show('提交中')
that.changeSubLoding(true, '提交中') that.changeSubLoding(true, '提交中')
break; break
case SELF_SUBMIT_SUCCESS: case SELF_SUBMIT_SUCCESS:
// setTimeout(() => { // setTimeout(() => {
// that.refs.LoadingModel.hide() // that.refs.LoadingModel.hide()
// that.processReturnData() // that.processReturnData()
// }, 500) // IOS问题 // }, 500) // IOS问题
setTimeout(() => { setTimeout(() => {
that.setState({ that.setState(
{
isSubLoding: false, isSubLoding: false,
lodingTitle: '提交中' lodingTitle: '提交中',
}, () => { },
() => {
that.processReturnData() that.processReturnData()
}) },
)
}, 500) }, 500)
break; break
case SELF_SUBMIT_FAILURE: case SELF_SUBMIT_FAILURE:
// that.refs.LoadingModel.hide() // that.refs.LoadingModel.hide()
that.changeSubLoding(false, '提交中') that.changeSubLoding(false, '提交中')
break; break
default: default:
break; break
} }
} }
} }
...@@ -546,7 +611,7 @@ class SelfOrderPage extends Component { ...@@ -546,7 +611,7 @@ class SelfOrderPage extends Component {
changeSubLoding(loading, loadTit) { changeSubLoding(loading, loadTit) {
this.setState({ this.setState({
isSubLoding: loading || false, isSubLoding: loading || false,
lodingTitle: loadTit || '加载中' lodingTitle: loadTit || '加载中',
}) })
} }
...@@ -569,23 +634,22 @@ class SelfOrderPage extends Component { ...@@ -569,23 +634,22 @@ class SelfOrderPage extends Component {
that.customerGetShip() that.customerGetShip()
} }
if (item.title == '主治医生') { if (item.title == '主治医生') {
item.showInput = false, ;(item.showInput = false), (item.inputValue = '')
item.inputValue = ''
} }
} }
return item return item
}) }),
}) })
} }
// 判断是否都有值,修改提交按钮的颜色 // 判断是否都有值,修改提交按钮的颜色
changeCanSub(isSubCheck) { changeCanSub(isSubCheck) {
let { listOptionData, sysValues} = this.state let { listOptionData, sysValues } = this.state
let { sysProfiles, navigation } = this.props let { sysProfiles, navigation } = this.props
let tempStatus = false let tempStatus = false
let tempTit = '' let tempTit = ''
let curTip = '未选择' let curTip = '未选择'
const {isLendOrder} = navigation.getParam('params') const { isLendOrder } = navigation.getParam('params')
const doctorNameProfile = this.decodeDisplayLendProfile('DOCTOR_DISPLAY') const doctorNameProfile = this.decodeDisplayLendProfile('DOCTOR_DISPLAY')
const patientNameProfile = this.decodeDisplayLendProfile('PATIENT_NAME_DISPLAY') const patientNameProfile = this.decodeDisplayLendProfile('PATIENT_NAME_DISPLAY')
const patientGenderProfile = this.decodeDisplayLendProfile('PATIENT_GENDER_DISPLAY') const patientGenderProfile = this.decodeDisplayLendProfile('PATIENT_GENDER_DISPLAY')
...@@ -594,9 +658,13 @@ class SelfOrderPage extends Component { ...@@ -594,9 +658,13 @@ class SelfOrderPage extends Component {
const patientIdProfile = this.decodeDisplayLendProfile('PATIENT_ID_DISPLAY') const patientIdProfile = this.decodeDisplayLendProfile('PATIENT_ID_DISPLAY')
for (let chIndex in listOptionData) { for (let chIndex in listOptionData) {
if (chIndex > 0 && chIndex < 10 && chIndex != 5 if (
&& !listOptionData[chIndex].value chIndex > 0 &&
&& listOptionData[chIndex].name !== '其他') { chIndex < 10 &&
chIndex != 5 &&
!listOptionData[chIndex].value &&
listOptionData[chIndex].name !== '其他'
) {
// 不是主治医生 // 不是主治医生
tempTit = listOptionData[chIndex].title tempTit = listOptionData[chIndex].title
tempStatus = true tempStatus = true
...@@ -605,33 +673,37 @@ class SelfOrderPage extends Component { ...@@ -605,33 +673,37 @@ class SelfOrderPage extends Component {
} }
break break
} }
if (((chIndex == 14 && sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2) if (
|| (chIndex == 15 && sysValues.OBS_MOBILE_BM_DISPLAY > 2) ((chIndex == 14 && sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2) ||
|| (chIndex == 16 && sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2) (chIndex == 15 && sysValues.OBS_MOBILE_BM_DISPLAY > 2) ||
|| (chIndex == 17 && sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2) (chIndex == 16 && sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2) ||
|| (chIndex == 18 && sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 2) (chIndex == 17 && sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2) ||
|| (chIndex == 19 && sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 2)) (chIndex == 18 && sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 2) ||
&& !listOptionData[chIndex].value) { (chIndex == 19 && sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 2)) &&
!listOptionData[chIndex].value
) {
tempTit = listOptionData[chIndex].title tempTit = listOptionData[chIndex].title
tempStatus = true tempStatus = true
break break
} }
if (isLendOrder && if (
(chIndex == 20 && patientNameProfile.required || isLendOrder &&
chIndex == 21 && patientGenderProfile.required || ((chIndex == 20 && patientNameProfile.required) ||
chIndex == 22 && patientAgeProfile.required || (chIndex == 21 && patientGenderProfile.required) ||
chIndex == 23 && hospitalizationNumberProfile.required || (chIndex == 22 && patientAgeProfile.required) ||
chIndex == 24 && patientIdProfile.required (chIndex == 23 && hospitalizationNumberProfile.required) ||
) && (chIndex == 24 && patientIdProfile.required)) &&
!listOptionData[chIndex].value !listOptionData[chIndex].value
) { ) {
tempTit = listOptionData[chIndex].title tempTit = listOptionData[chIndex].title
tempStatus = true tempStatus = true
break break
} }
if (isLendOrder && chIndex == 5 && doctorNameProfile.required && ( if (
listOptionData[chIndex].value != '-1' || isLendOrder &&
!listOptionData[chIndex].inputValue) chIndex == 5 &&
doctorNameProfile.required &&
(listOptionData[chIndex].value != '-1' || !listOptionData[chIndex].inputValue)
) { ) {
tempTit = listOptionData[chIndex].title tempTit = listOptionData[chIndex].title
tempStatus = true tempStatus = true
...@@ -639,7 +711,7 @@ class SelfOrderPage extends Component { ...@@ -639,7 +711,7 @@ class SelfOrderPage extends Component {
} }
} }
this.setState({ this.setState({
canSubFlag: !tempStatus canSubFlag: !tempStatus,
}) })
if (isSubCheck && tempStatus) { if (isSubCheck && tempStatus) {
show(`${tempTit}${curTip},不能提交`) show(`${tempTit}${curTip},不能提交`)
...@@ -683,18 +755,21 @@ class SelfOrderPage extends Component { ...@@ -683,18 +755,21 @@ class SelfOrderPage extends Component {
// } // }
} }
}) })
this.setState({ this.setState(
{
currentItem: item, currentItem: item,
listOptionData: listOptionData listOptionData: listOptionData,
}, () => { },
() => {
that.changeCanSub() that.changeCanSub()
}) },
)
} }
// 关闭弹窗 // 关闭弹窗
handleCloseModal(show) { handleCloseModal(show) {
this.setState({ this.setState({
showTypePop: show showTypePop: show,
}) })
} }
...@@ -704,7 +779,7 @@ class SelfOrderPage extends Component { ...@@ -704,7 +779,7 @@ class SelfOrderPage extends Component {
let { selfOrderOption } = this.props let { selfOrderOption } = this.props
let tempOption = [] let tempOption = []
let that = this let that = this
const {isLendOrder} = this.props.navigation.getParam('params') const { isLendOrder } = this.props.navigation.getParam('params')
if (selfOrderOption.length === 0) { if (selfOrderOption.length === 0) {
show(`当前${currentTitle}为空`) show(`当前${currentTitle}为空`)
return return
...@@ -716,22 +791,26 @@ class SelfOrderPage extends Component { ...@@ -716,22 +791,26 @@ class SelfOrderPage extends Component {
// 兼容旧接口 customers结构有可能是扁平的, 要改成层级的 // 兼容旧接口 customers结构有可能是扁平的, 要改成层级的
if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) { if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) {
customers = R.map(cus => ({ customers = R.map(cus => ({
bill_to_sites: [{ bill_to_sites: [
{
bill_to_site_code: cus.bill_to_site_code, bill_to_site_code: cus.bill_to_site_code,
bill_to_site_name: cus.bill_to_site_name, 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_code: cus.ship_to_site_code,
ship_to_site_name: cus.ship_to_site_name, 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_code: cus.customer_code,
customer_name: cus.customer_name, customer_name: cus.customer_name,
}))(customers) }))(customers)
} }
that.setState({ that.setState({
localCustomersOption: customers localCustomersOption: customers,
}) })
// 去重医院数据 // 去重医院数据
...@@ -781,9 +860,11 @@ class SelfOrderPage extends Component { ...@@ -781,9 +860,11 @@ class SelfOrderPage extends Component {
} }
tempOption = this.changeNameAndValue(filterOpt, 'source_inv_name', 'source_inv_code') tempOption = this.changeNameAndValue(filterOpt, 'source_inv_name', 'source_inv_code')
} }
that.setState({ that.setState(
listCurrentOption: [...tempOption] {
}, () => { listCurrentOption: [...tempOption],
},
() => {
if (tempOption && tempOption.length === 0) { if (tempOption && tempOption.length === 0) {
show('当前数据为空!') show('当前数据为空!')
return return
...@@ -792,7 +873,8 @@ class SelfOrderPage extends Component { ...@@ -792,7 +873,8 @@ class SelfOrderPage extends Component {
setTimeout(() => { setTimeout(() => {
that.handleCloseModal(true) that.handleCloseModal(true)
}, 500) }, 500)
}) },
)
} }
// 修改选择器为属性 name 和 value // 修改选择器为属性 name 和 value
...@@ -801,8 +883,7 @@ class SelfOrderPage extends Component { ...@@ -801,8 +883,7 @@ class SelfOrderPage extends Component {
if (data && data.length > 0) { if (data && data.length > 0) {
data.forEach(item => { data.forEach(item => {
let obj = {} let obj = {}
obj.name = item[nameType], ;(obj.name = item[nameType]), (obj.value = item[valueType])
obj.value = item[valueType]
result.push(obj) result.push(obj)
}) })
} }
...@@ -812,18 +893,21 @@ class SelfOrderPage extends Component { ...@@ -812,18 +893,21 @@ class SelfOrderPage extends Component {
// 组织 点击 // 组织 点击
handleOrganizationCheck(curData) { handleOrganizationCheck(curData) {
let { props } = this let { props } = this
this.setState({ this.setState(
{
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
} },
}, () => { },
() => {
let params = { let params = {
access_token: props.token access_token: props.token,
} }
props.requestSelfOrganizations(params) props.requestSelfOrganizations(params)
}) },
)
} }
/** /**
...@@ -831,12 +915,12 @@ class SelfOrderPage extends Component { ...@@ -831,12 +915,12 @@ class SelfOrderPage extends Component {
* @param {*} org_code * @param {*} org_code
*/ */
async getDepartmentsByOrg(org_code) { async getDepartmentsByOrg(org_code) {
const {token, global_domain_config, userInfo} = this.props const { token, global_domain_config, userInfo } = this.props
const params = { const params = {
access_token: token, access_token: token,
org_code, org_code,
seller_code: userInfo.user_name, seller_code: userInfo.user_name,
scope_flag: 'Y' scope_flag: 'Y',
} }
try { try {
const res = await reqOrgDepartments(global_domain_config, params) const res = await reqOrgDepartments(global_domain_config, params)
...@@ -845,13 +929,15 @@ class SelfOrderPage extends Component { ...@@ -845,13 +929,15 @@ class SelfOrderPage extends Component {
let departments = res.data.relationships let departments = res.data.relationships
this.setState({ departments }) this.setState({ departments })
const {listOptionData, sysValues} = this.state const { listOptionData, sysValues } = this.state
const noop = () => {} const noop = () => {}
// 部门只有一个时直接设置 // 部门只有一个时直接设置
R.cond([ R.cond([
[R.equals(0), () => setTimeout(() =>show('当前组织没有部门信息'), 4000)], [R.equals(0), () => setTimeout(() => show('当前组织没有部门信息'), 4000)],
[R.equals(1), () => { [
R.equals(1),
() => {
const dep = R.head(departments) const dep = R.head(departments)
listOptionData[14].name = dep.department_name listOptionData[14].name = dep.department_name
listOptionData[14].value = dep.department_code listOptionData[14].value = dep.department_code
...@@ -859,13 +945,13 @@ class SelfOrderPage extends Component { ...@@ -859,13 +945,13 @@ class SelfOrderPage extends Component {
// 只有一个部门时可以自动设置 // 只有一个部门时可以自动设置
this.autoSetBMAndSFAndDMWhildSelectDepartment(dep) this.autoSetBMAndSFAndDMWhildSelectDepartment(dep)
}], },
[R.T, noop] ],
[R.T, noop],
])(R.length(departments)) ])(R.length(departments))
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
} }
/** /**
...@@ -878,30 +964,41 @@ class SelfOrderPage extends Component { ...@@ -878,30 +964,41 @@ class SelfOrderPage extends Component {
// 业务经理只有一个时,直接设置业务经理 // 业务经理只有一个时,直接设置业务经理
R.cond([ R.cond([
[R.equals(0), () => show('当前部门没有业务经理')], [R.equals(0), () => show('当前部门没有业务经理')],
[R.equals(1), () => { [
R.equals(1),
() => {
const bm = R.pathOr([], ['business_manager_list', 0])(department) const bm = R.pathOr([], ['business_manager_list', 0])(department)
listOptionData[15].name = bm.business_manager_name listOptionData[15].name = bm.business_manager_name
listOptionData[15].value = bm.business_manager_code listOptionData[15].value = bm.business_manager_code
this.setState({ listOptionData }) this.setState({ listOptionData })
}], },
[R.T, noop] ],
[R.T, noop],
])(R.length(department.business_manager_list)) ])(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) const sf = R.pathOr([], ['surgery_follower_list', 0])(department)
listOptionData[16].name = sf.surgery_follower_name listOptionData[16].name = sf.surgery_follower_name
listOptionData[16].value = sf.surgery_follower_code listOptionData[16].value = sf.surgery_follower_code
this.setState({ listOptionData }) 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) const dm = R.pathOr([], ['deliveryman_list', 0])(department)
listOptionData[17].name = dm.deliveryman_name listOptionData[17].name = dm.deliveryman_name
listOptionData[17].value = dm.deliveryman_code listOptionData[17].value = dm.deliveryman_code
this.setState({ listOptionData }) this.setState({ listOptionData })
}, noop)(R.length(department.deliveryman_list)) },
noop,
)(R.length(department.deliveryman_list))
} }
/** /**
...@@ -910,13 +1007,15 @@ class SelfOrderPage extends Component { ...@@ -910,13 +1007,15 @@ class SelfOrderPage extends Component {
async getOrganizationData() { async getOrganizationData() {
let { state, props } = this let { state, props } = this
let params = { let params = {
access_token: props.token access_token: props.token,
} }
let that = this let that = this
let { global_domain_config } = props 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) { if (orgResult.error_code == 0) {
let { data: { organizations } } = orgResult let {
data: { organizations },
} = orgResult
let { listOptionData, sysValues } = state let { listOptionData, sysValues } = state
// props.requestListDataSuccess(organizations) // props.requestListDataSuccess(organizations)
let filterOpt = dedupQuoteArray(organizations, 'org_code') let filterOpt = dedupQuoteArray(organizations, 'org_code')
...@@ -927,16 +1026,19 @@ class SelfOrderPage extends Component { ...@@ -927,16 +1026,19 @@ class SelfOrderPage extends Component {
if (filterOpt.length === 1) { if (filterOpt.length === 1) {
listOptionData[1].name = filterOpt[0].org_name listOptionData[1].name = filterOpt[0].org_name
listOptionData[1].value = filterOpt[0].org_code listOptionData[1].value = filterOpt[0].org_code
that.setState({ that.setState(
listOptionData {
}, () => { listOptionData,
},
() => {
that.organizationGetCustomerData() that.organizationGetCustomerData()
setTimeout(() => { setTimeout(() => {
if (sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 0) { if (sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 0) {
that.getDepartmentsByOrg(listOptionData[1].value) that.getDepartmentsByOrg(listOptionData[1].value)
} }
}, 1000); }, 1000)
}) },
)
} }
// 贵州需要不显示组织, 所以只能每个用户只能授权1个组织 // 贵州需要不显示组织, 所以只能每个用户只能授权1个组织
...@@ -945,11 +1047,11 @@ class SelfOrderPage extends Component { ...@@ -945,11 +1047,11 @@ class SelfOrderPage extends Component {
show(`请先选择组织`) show(`请先选择组织`)
} }
} else if (orgResult.error_code == 41006) { } else if (orgResult.error_code == 41006) {
show('登录过期,请重新登录'); show('登录过期,请重新登录')
props.exitLoginStatus(); props.exitLoginStatus()
} else { } else {
let error_msg = orgResult.error_msg || orgResult.message let error_msg = orgResult.error_msg || orgResult.message
show(error_msg); show(error_msg)
} }
} }
...@@ -962,7 +1064,7 @@ class SelfOrderPage extends Component { ...@@ -962,7 +1064,7 @@ class SelfOrderPage extends Component {
// objName有值直接是部门 // objName有值直接是部门
if (!!objName && !this.judgeDepartmentIsNull()) return if (!!objName && !this.judgeDepartmentIsNull()) return
const {departments, listOptionData} = this.state const { departments, listOptionData } = this.state
let options = departments let options = departments
// 非部门 // 非部门
...@@ -972,19 +1074,21 @@ class SelfOrderPage extends Component { ...@@ -972,19 +1074,21 @@ class SelfOrderPage extends Component {
options = R.propOr([], objName, dep) options = R.propOr([], objName, dep)
} }
const listOptions = R.map(R.applySpec({ const listOptions = R.map(
R.applySpec({
name: R.prop(itemName), name: R.prop(itemName),
value: R.prop(itemVal) value: R.prop(itemVal),
}))(options) }),
)(options)
this.setState({ this.setState({
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
}, },
showTypePop: true, showTypePop: true,
listCurrentOption: listOptions listCurrentOption: listOptions,
}) })
} }
...@@ -992,15 +1096,18 @@ class SelfOrderPage extends Component { ...@@ -992,15 +1096,18 @@ class SelfOrderPage extends Component {
handleCustomerCheck(curData) { handleCustomerCheck(curData) {
let that = this let that = this
if (this.judgeOrgIsNull()) { if (this.judgeOrgIsNull()) {
that.setState({ that.setState(
{
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
} },
}, () => { },
() => {
that.getCustomerData() that.getCustomerData()
}) },
)
} }
} }
// 获取客户名称 // 获取客户名称
...@@ -1023,23 +1130,29 @@ class SelfOrderPage extends Component { ...@@ -1023,23 +1130,29 @@ class SelfOrderPage extends Component {
} }
let that = this let that = this
let { global_domain_config } = props let { global_domain_config } = props
let cusResult = await reqSelfSurgeryHospital(global_domain_config, params); let cusResult = await reqSelfSurgeryHospital(global_domain_config, params)
console.log(cusResult) console.log(cusResult)
if (cusResult.error_code == 0) { if (cusResult.error_code == 0) {
let { data: { customers } } = cusResult let {
data: { customers },
} = cusResult
// customers结构有可能是扁平的, 要改成层级的,新版的 // customers结构有可能是扁平的, 要改成层级的,新版的
if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) { if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) {
customers = R.map(cus => ({ customers = R.map(cus => ({
bill_to_sites: [{ bill_to_sites: [
{
bill_to_site_code: cus.bill_to_site_code, bill_to_site_code: cus.bill_to_site_code,
bill_to_site_name: cus.bill_to_site_name, 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_code: cus.ship_to_site_code,
ship_to_site_name: cus.ship_to_site_name, 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_code: cus.customer_code,
customer_name: cus.customer_name, customer_name: cus.customer_name,
}))(customers) }))(customers)
...@@ -1055,20 +1168,23 @@ class SelfOrderPage extends Component { ...@@ -1055,20 +1168,23 @@ class SelfOrderPage extends Component {
if (filterOpt.length === 1) { if (filterOpt.length === 1) {
listOptionData[2].name = filterOpt[0].customer_name listOptionData[2].name = filterOpt[0].customer_name
listOptionData[2].value = filterOpt[0].customer_code listOptionData[2].value = filterOpt[0].customer_code
that.setState({ that.setState(
{
listOptionData, listOptionData,
localCustomersOption: customers localCustomersOption: customers,
}, () => { },
() => {
that.customerGetBill() that.customerGetBill()
that.customerGetShip() that.customerGetShip()
}) },
)
} }
} else if (cusResult.error_code == 41006) { } else if (cusResult.error_code == 41006) {
show('登录过期,请重新登录'); show('登录过期,请重新登录')
props.exitLoginStatus(); props.exitLoginStatus()
} else { } else {
let error_msg = cusResult.error_msg || cusResult.message let error_msg = cusResult.error_msg || cusResult.message
show(error_msg); show(error_msg)
} }
} }
...@@ -1079,30 +1195,35 @@ class SelfOrderPage extends Component { ...@@ -1079,30 +1195,35 @@ class SelfOrderPage extends Component {
let { localCustomersOption, listOptionData } = this.state let { localCustomersOption, listOptionData } = this.state
let that = this let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
that.setState({ that.setState(
{
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
} },
}, () => { },
() => {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption) const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
let options = [] let options = []
if (isNotBlank(customer.bill_to_sites)) { if (isNotBlank(customer.bill_to_sites)) {
options = R.compose( options = R.compose(
R.curry(dedupQuoteArray)(R.__, 'name'), R.curry(dedupQuoteArray)(R.__, 'name'),
R.map(R.applySpec({ R.map(
R.applySpec({
value: R.prop('bill_to_site_code'), value: R.prop('bill_to_site_code'),
name: R.prop('bill_to_site_name'), name: R.prop('bill_to_site_name'),
})), }),
R.prop('bill_to_sites') ),
R.prop('bill_to_sites'),
)(customer) )(customer)
} }
that.setState({ that.setState({
showTypePop: true, showTypePop: true,
listCurrentOption: options listCurrentOption: options,
})
}) })
},
)
} }
} }
...@@ -1123,7 +1244,7 @@ class SelfOrderPage extends Component { ...@@ -1123,7 +1244,7 @@ class SelfOrderPage extends Component {
listOptionData[3].name = R.pathOr('', [0, 'bill_to_site_name'], sites) listOptionData[3].name = R.pathOr('', [0, 'bill_to_site_name'], sites)
listOptionData[3].value = R.pathOr('', [0, 'bill_to_site_code'], sites) listOptionData[3].value = R.pathOr('', [0, 'bill_to_site_code'], sites)
that.setState({ that.setState({
listOptionData listOptionData,
}) })
} }
} }
...@@ -1133,13 +1254,15 @@ class SelfOrderPage extends Component { ...@@ -1133,13 +1254,15 @@ class SelfOrderPage extends Component {
let { localCustomersOption, listOptionData } = this.state let { localCustomersOption, listOptionData } = this.state
let that = this let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull() && this.judgeBillIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull() && this.judgeBillIsNull()) {
that.setState({ that.setState(
{
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
} },
}, () => { },
() => {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption) const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
let options = [] let options = []
...@@ -1148,19 +1271,22 @@ class SelfOrderPage extends Component { ...@@ -1148,19 +1271,22 @@ class SelfOrderPage extends Component {
if (isNotBlank(billSite) && isNotBlank(billSite.ship_to_sites)) { if (isNotBlank(billSite) && isNotBlank(billSite.ship_to_sites)) {
options = R.compose( options = R.compose(
R.curry(dedupQuoteArray)(R.__, 'name'), R.curry(dedupQuoteArray)(R.__, 'name'),
R.map(R.applySpec({ R.map(
R.applySpec({
value: R.prop('ship_to_site_code'), value: R.prop('ship_to_site_code'),
name: R.prop('ship_to_site_name'), name: R.prop('ship_to_site_name'),
})), }),
R.prop('ship_to_sites') ),
R.prop('ship_to_sites'),
)(billSite) )(billSite)
} }
} }
that.setState({ that.setState({
showTypePop: true, showTypePop: true,
listCurrentOption: options listCurrentOption: options,
})
}) })
},
)
} }
} }
...@@ -1173,7 +1299,7 @@ class SelfOrderPage extends Component { ...@@ -1173,7 +1299,7 @@ class SelfOrderPage extends Component {
let that = this let that = this
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption) 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}为空`) return show(`当前${listOptionData[4].title}为空`)
} }
...@@ -1197,7 +1323,7 @@ class SelfOrderPage extends Component { ...@@ -1197,7 +1323,7 @@ class SelfOrderPage extends Component {
listOptionData[4].name = shipSites[0].ship_to_site_name listOptionData[4].name = shipSites[0].ship_to_site_name
listOptionData[4].value = shipSites[0].ship_to_site_code listOptionData[4].value = shipSites[0].ship_to_site_code
that.setState({ that.setState({
listOptionData listOptionData,
}) })
} }
} }
...@@ -1209,14 +1335,16 @@ class SelfOrderPage extends Component { ...@@ -1209,14 +1335,16 @@ class SelfOrderPage extends Component {
let that = this let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
// 点击 // 点击
that.setState({ that.setState(
{
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
} },
}, () => { },
let tempOption = [{name: '其他', value: '-1'}] () => {
let tempOption = [{ name: '其他', value: '-1' }]
if (isNotBlank(localCustomersOption) && listOptionData[2].value) { if (isNotBlank(localCustomersOption) && listOptionData[2].value) {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value))(localCustomersOption) const customer = R.find(R.propEq('customer_code', listOptionData[2].value))(localCustomersOption)
...@@ -1230,11 +1358,13 @@ class SelfOrderPage extends Component { ...@@ -1230,11 +1358,13 @@ class SelfOrderPage extends Component {
if (isNotBlank(ship)) { if (isNotBlank(ship)) {
tempOption = R.compose( tempOption = R.compose(
R.concat(R.__, tempOption), R.concat(R.__, tempOption),
R.map(R.applySpec({ R.map(
R.applySpec({
value: R.prop('customer_doctor'), value: R.prop('customer_doctor'),
name: R.prop('customer_doctor') name: R.prop('customer_doctor'),
})), }),
R.filter(R.compose(isNotBlank, R.prop('customer_doctor'))) ),
R.filter(R.compose(isNotBlank, R.prop('customer_doctor'))),
)(ship) )(ship)
} }
} }
...@@ -1244,9 +1374,10 @@ class SelfOrderPage extends Component { ...@@ -1244,9 +1374,10 @@ class SelfOrderPage extends Component {
tempOption = dedupQuoteArray(tempOption, 'name') tempOption = dedupQuoteArray(tempOption, 'name')
that.setState({ that.setState({
showTypePop: true, showTypePop: true,
listCurrentOption: [...tempOption] listCurrentOption: [...tempOption],
})
}) })
},
)
} }
} }
// 主治医生 输入 // 主治医生 输入
...@@ -1257,11 +1388,14 @@ class SelfOrderPage extends Component { ...@@ -1257,11 +1388,14 @@ class SelfOrderPage extends Component {
item.inputValue = text item.inputValue = text
} }
}) })
this.setState({ this.setState(
listOptionData: listOptionData {
}, () => { listOptionData: listOptionData,
},
() => {
this.changeCanSub() this.changeCanSub()
}) },
)
} }
// 手术名称 输入 // 手术名称 输入
...@@ -1291,7 +1425,7 @@ class SelfOrderPage extends Component { ...@@ -1291,7 +1425,7 @@ class SelfOrderPage extends Component {
} }
}) })
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData,
}) })
} }
this.closeDateModal(true) this.closeDateModal(true)
...@@ -1300,7 +1434,7 @@ class SelfOrderPage extends Component { ...@@ -1300,7 +1434,7 @@ class SelfOrderPage extends Component {
// 关闭日期选择器 // 关闭日期选择器
closeDateModal(show) { closeDateModal(show) {
this.setState({ this.setState({
dateModelPop: show dateModelPop: show,
}) })
} }
...@@ -1315,11 +1449,14 @@ class SelfOrderPage extends Component { ...@@ -1315,11 +1449,14 @@ class SelfOrderPage extends Component {
item.dateValue = formatStrForDate(date) item.dateValue = formatStrForDate(date)
} }
}) })
that.setState({ that.setState(
listOptionData: listOptionData {
}, () => { listOptionData: listOptionData,
},
() => {
that.changeCanSub() that.changeCanSub()
}) },
)
} }
/** /**
...@@ -1331,43 +1468,52 @@ class SelfOrderPage extends Component { ...@@ -1331,43 +1468,52 @@ class SelfOrderPage extends Component {
let { token, global_domain_config } = this.props let { token, global_domain_config } = this.props
let params = { let params = {
access_token: token, 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 if (res.error_code !== 0) return
let surgery_types = R.compose( let surgery_types = R.compose(
R.map(R.applySpec({ R.map(
R.applySpec({
name: R.prop('category_name'), name: R.prop('category_name'),
value: R.prop('category_code'), value: R.prop('category_code'),
})), }),
R.propOr([], 'data') ),
R.propOr([], 'data'),
)(res) )(res)
this.setState({ surgery_types }) this.setState({ surgery_types })
} }
// 手术类型 点击 // 手术类型 点击
async handleSurTypeCheck(curData) { async handleSurTypeCheck(curData) {
let {surgery_types} = this.state let { surgery_types } = this.state
if (!this.judgeOrgIsNull() || !this.judgeCustomerIsNull()) { if (!this.judgeOrgIsNull() || !this.judgeCustomerIsNull()) {
return return
} }
if (isBlank(surgery_types)) { return show('手术类型为空') } if (isBlank(surgery_types)) {
return show('手术类型为空')
}
this.setState({ this.setState(
{
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
}, },
listCurrentOption: surgery_types, listCurrentOption: surgery_types,
surgery_types surgery_types,
}, () => { },
() => {
setTimeout(() => { setTimeout(() => {
this.handleCloseModal(true) this.handleCloseModal(true)
}, 100) }, 100)
}) },
)
} }
// 订单类型 点击 // 订单类型 点击
...@@ -1375,21 +1521,24 @@ class SelfOrderPage extends Component { ...@@ -1375,21 +1521,24 @@ class SelfOrderPage extends Component {
let { props } = this let { props } = this
const { listOptionData } = this.state const { listOptionData } = this.state
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({ this.setState(
{
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
} },
}, () => { },
() => {
let params = { let params = {
access_token: props.token, access_token: props.token,
value_set_code: 'SUR_ORDER_TYPE', value_set_code: 'SUR_ORDER_TYPE',
org_code: listOptionData[1].value, org_code: listOptionData[1].value,
order_type: 'SUR_ORDER_TYPE' order_type: 'SUR_ORDER_TYPE',
} }
props.requestSelfOrderType(params) props.requestSelfOrderType(params)
}) },
)
} }
} }
...@@ -1403,11 +1552,14 @@ class SelfOrderPage extends Component { ...@@ -1403,11 +1552,14 @@ class SelfOrderPage extends Component {
item.value = certFlag item.value = certFlag
} }
}) })
that.setState({ that.setState(
listOptionData: listOptionData {
}, () => { listOptionData: listOptionData,
},
() => {
that.changeCanSub() that.changeCanSub()
}) },
)
} }
// // 自动更换同品不同器械包 点击 // // 自动更换同品不同器械包 点击
...@@ -1418,7 +1570,7 @@ class SelfOrderPage extends Component { ...@@ -1418,7 +1570,7 @@ class SelfOrderPage extends Component {
// 选择产品 点击跳转 // 选择产品 点击跳转
handleProductCheck() { handleProductCheck() {
const { localCustomersOption, listOptionData } = this.state const { localCustomersOption, listOptionData } = this.state
console.log(localCustomersOption); console.log(localCustomersOption)
if (isBlank(listOptionData[2].value) || isBlank(listOptionData[3].value) || isBlank(listOptionData[4].value)) { if (isBlank(listOptionData[2].value) || isBlank(listOptionData[3].value) || isBlank(listOptionData[4].value)) {
return show('请先选择客户相关信息') return show('请先选择客户相关信息')
...@@ -1440,14 +1592,14 @@ class SelfOrderPage extends Component { ...@@ -1440,14 +1592,14 @@ class SelfOrderPage extends Component {
product_line_category_list: R.compose( product_line_category_list: R.compose(
R.uniqBy(R.prop('product_line_category_code')), R.uniqBy(R.prop('product_line_category_code')),
R.unnest, R.unnest,
R.pluck('product_line_category_list') R.pluck('product_line_category_list'),
)(values), )(values),
supplier_code: R.pathOr('', [0, 'supplier_code'])(values), supplier_code: R.pathOr('', [0, 'supplier_code'])(values),
supplier_name: R.pathOr('', [0, 'supplier_name'])(values), supplier_name: R.pathOr('', [0, 'supplier_name'])(values),
} }
}), }),
R.keys, R.keys,
R.clone R.clone,
)(suppliers) )(suppliers)
} }
...@@ -1458,11 +1610,14 @@ class SelfOrderPage extends Component { ...@@ -1458,11 +1610,14 @@ class SelfOrderPage extends Component {
title: `选择产品`, title: `选择产品`,
selfData: { selfData: {
org_code: listOptionData[1].value, 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, authorizations,
productAuthorization productAuthorization,
}, },
productCallBack: that.productCallBack.bind(that) productCallBack: that.productCallBack.bind(that),
}) })
} }
} }
...@@ -1487,11 +1642,14 @@ class SelfOrderPage extends Component { ...@@ -1487,11 +1642,14 @@ class SelfOrderPage extends Component {
} }
} }
listOptionData[8] = local_prod listOptionData[8] = local_prod
this.setState({ this.setState(
listOptionData: listOptionData {
}, () => { listOptionData: listOptionData,
},
() => {
this.changeCanSub() this.changeCanSub()
}) },
)
} }
// 备注 输入 // 备注 输入
...@@ -1503,21 +1661,23 @@ class SelfOrderPage extends Component { ...@@ -1503,21 +1661,23 @@ class SelfOrderPage extends Component {
} }
}) })
this.setState({ this.setState({
listOptionData: listOptionData listOptionData: listOptionData,
}) })
} }
// 借货仓库 点击 // 借货仓库 点击
handleWareCheck(curData){ handleWareCheck(curData) {
let { state, props } = this let { state, props } = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
this.setState({ this.setState(
{
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
} },
}, () => { },
() => {
// 在此修改接口 // 在此修改接口
let params = { let params = {
access_token: props.token, access_token: props.token,
...@@ -1525,10 +1685,11 @@ class SelfOrderPage extends Component { ...@@ -1525,10 +1685,11 @@ class SelfOrderPage extends Component {
customer_code: state.listOptionData[2].value, customer_code: state.listOptionData[2].value,
bill_to_site_code: state.listOptionData[3].value, bill_to_site_code: state.listOptionData[3].value,
ship_to_site_code: state.listOptionData[4].value, ship_to_site_code: state.listOptionData[4].value,
process_code: 'COLLECT' process_code: 'COLLECT',
} }
props.requestQuickSurColSetting(params) props.requestQuickSurColSetting(params)
}) },
)
} }
} }
...@@ -1556,87 +1717,88 @@ class SelfOrderPage extends Component { ...@@ -1556,87 +1717,88 @@ class SelfOrderPage extends Component {
noData: false, noData: false,
storageOptions: { storageOptions: {
skipBackup: true, skipBackup: true,
path: 'WisdomTrans' // 存储本地地址 path: 'WisdomTrans', // 存储本地地址
},
} }
};
ImagePicker.showImagePicker(options, async (res) => { ImagePicker.showImagePicker(options, async res => {
if (res.didCancel) { if (res.didCancel) {
console.log('User cancelled photo picker'); console.log('User cancelled photo picker')
} } else if (res.error) {
else if (res.error) { console.log('ImagePicker Error: ', res.error)
console.log('ImagePicker Error: ', res.error);
if (res.error.indexOf('Camera permissions not granted') > -1) { if (res.error.indexOf('Camera permissions not granted') > -1) {
Alert.alert(('提示信息', 'APP需要使用相机,请打开相机权限允许APP使用'), [{ Alert.alert(('提示信息', 'APP需要使用相机,请打开相机权限允许APP使用'), [
{
text: '设置', text: '设置',
onPress: () => { onPress: () => {
Linking.openURL('app-settings:') Linking.openURL('app-settings:').catch(err => console.log('error', err))
.catch(err => console.log('error', err)) },
} },
}, { {
text: '取消' text: '取消',
}]) },
])
} }
if (res.error.indexOf('Photo library permissions not granted') > -1) { if (res.error.indexOf('Photo library permissions not granted') > -1) {
Alert.alert('提示信息', 'APP需要使用相册,请打开相册权限允许APP使用', [{ Alert.alert('提示信息', 'APP需要使用相册,请打开相册权限允许APP使用', [
{
text: '设置', text: '设置',
onPress: () => { onPress: () => {
Linking.openURL('app-settings:') Linking.openURL('app-settings:').catch(err => console.log('error', err))
.catch(err => console.log('error', err)) },
} },
}, { {
text: '取消' text: '取消',
}]); },
} ])
} }
else if (res.customButton) { } else if (res.customButton) {
console.log('User tapped custom button: ', res.customButton); console.log('User tapped custom button: ', res.customButton)
} else { } else {
that.changeSubLoding(true, '上传中') that.changeSubLoding(true, '上传中')
let source; //保存选中的图片 let source //保存选中的图片
if (Platform.OS === 'android') { if (Platform.OS === 'android') {
source = res.uri; source = res.uri
} else { } else {
source = res.uri.replace('file://', ''); source = res.uri.replace('file://', '')
if (!res.fileName) { if (!res.fileName) {
res.fileName = new Date().getTime() + '.HEIC' res.fileName = new Date().getTime() + '.HEIC'
} }
} }
const formData = new FormData(); const formData = new FormData()
let file = { uri: source, type: 'multipart/form-data', name: res.fileName }; let file = { uri: source, type: 'multipart/form-data', name: res.fileName }
formData.append('file', file); formData.append('file', file)
let params = { let params = {
access_token: props.token, access_token: props.token,
formData formData,
} }
let { global_domain_config } = props 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) console.log('res=', imgResult)
if (imgResult.error_code == 0) { if (imgResult.error_code == 0) {
that.changeSubLoding(false) that.changeSubLoding(false)
// 提交订单 // 提交订单
show('上传成功'); show('上传成功')
let { url } = imgResult.data let { url } = imgResult.data
localPhoOption.push(source); // 本地图片地址 localPhoOption.push(source) // 本地图片地址
listOptionData[13].uploadImgArr.push(url) // 服务器图片地址 listOptionData[13].uploadImgArr.push(url) // 服务器图片地址
that.setState({ that.setState({
localPhoOption, localPhoOption,
listOptionData listOptionData,
}); })
} else if (imgResult.error_code == 41006) { } else if (imgResult.error_code == 41006) {
that.changeSubLoding(false) that.changeSubLoding(false)
show('登录过期,请重新登录'); show('登录过期,请重新登录')
props.exitLoginStatus(); props.exitLoginStatus()
} else { } else {
that.changeSubLoding(false) that.changeSubLoding(false)
let error_msg = imgResult.error_msg || imgResult.message let error_msg = imgResult.error_msg || imgResult.message
show(error_msg); show(error_msg)
} }
} }
}) })
} }
// 删除单个照片 点击 // 删除单个照片 点击
...@@ -1644,12 +1806,15 @@ class SelfOrderPage extends Component { ...@@ -1644,12 +1806,15 @@ class SelfOrderPage extends Component {
let { listOptionData, localPhoOption } = this.state let { listOptionData, localPhoOption } = this.state
localPhoOption.splice(index, 1) // 删除本地地址 localPhoOption.splice(index, 1) // 删除本地地址
listOptionData[7].uploadImgArr.splice(index, 1) // 删除服务器地址 listOptionData[7].uploadImgArr.splice(index, 1) // 删除服务器地址
this.setState({ this.setState(
{
listOptionData, listOptionData,
localPhoOption localPhoOption,
}, () => { },
() => {
show('删除成功') show('删除成功')
}) },
)
} }
// 生成订单 点击 // 生成订单 点击
...@@ -1663,35 +1828,37 @@ class SelfOrderPage extends Component { ...@@ -1663,35 +1828,37 @@ class SelfOrderPage extends Component {
if (state.stop) { if (state.stop) {
let params = { let params = {
access_token: props.token, access_token: props.token,
path: state.audioPath path: state.audioPath,
} }
let { global_domain_config } = props let { global_domain_config } = props
console.log('params==', params) console.log('params==', params)
let audioResult = await requestSelfAudio(global_domain_config, params); let audioResult = await requestSelfAudio(global_domain_config, params)
console.log('res==', audioResult) console.log('res==', audioResult)
that.changeSubLoding(true, '上传中') that.changeSubLoding(true, '上传中')
if (audioResult.error_code == 0) { if (audioResult.error_code == 0) {
// 提交订单 // 提交订单
that.setState({ that.setState(
{
listOptionData: state.listOptionData.map((item, index) => { listOptionData: state.listOptionData.map((item, index) => {
if (index == 12) { if (index == 12) {
item.value = audioResult.data.url item.value = audioResult.data.url
} }
return item return item
}) }),
}, () => { },
() => {
that.changeSubLoding(false) that.changeSubLoding(false)
that.getSumLinesOps() that.getSumLinesOps()
}) },
)
} else if (audioResult.error_code == 41006) { } else if (audioResult.error_code == 41006) {
that.changeSubLoding(false) that.changeSubLoding(false)
show('登录过期,请重新登录'); show('登录过期,请重新登录')
props.exitLoginStatus(); props.exitLoginStatus()
} else { } else {
that.changeSubLoding(false) that.changeSubLoding(false)
let error_msg = audioResult.error_msg || audioResult.message let error_msg = audioResult.error_msg || audioResult.message
show(error_msg); show(error_msg)
that.getSumLinesOps() that.getSumLinesOps()
} }
} else { } else {
...@@ -1703,7 +1870,7 @@ class SelfOrderPage extends Component { ...@@ -1703,7 +1870,7 @@ class SelfOrderPage extends Component {
// 提交订单 // 提交订单
submitSelfOrder() { submitSelfOrder() {
let { state, props } = this let { state, props } = this
const {isLendOrder} = this.props.navigation.getParam('params') const { isLendOrder } = this.props.navigation.getParam('params')
let tempSubOption = state.submitOption let tempSubOption = state.submitOption
tempSubOption.seller_code = state.listOptionData[0].value tempSubOption.seller_code = state.listOptionData[0].value
...@@ -1733,13 +1900,13 @@ class SelfOrderPage extends Component { ...@@ -1733,13 +1900,13 @@ class SelfOrderPage extends Component {
tempSubOption.collect_src_inv_code = state.listOptionData[18].value 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_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_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) sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 0 && (tempSubOption.deliveryman_code = state.listOptionData[17].value)
const patientNameProfile = this.decodeDisplayLendProfile('PATIENT_NAME_DISPLAY') const patientNameProfile = this.decodeDisplayLendProfile('PATIENT_NAME_DISPLAY')
const patientGenderProfile = this.decodeDisplayLendProfile('PATIENT_GENDER_DISPLAY') const patientGenderProfile = this.decodeDisplayLendProfile('PATIENT_GENDER_DISPLAY')
const patientAgeProfile = this.decodeDisplayLendProfile('PATIENT_AGE_DISPLAY') const patientAgeProfile = this.decodeDisplayLendProfile('PATIENT_AGE_DISPLAY')
...@@ -1748,7 +1915,9 @@ class SelfOrderPage extends Component { ...@@ -1748,7 +1915,9 @@ class SelfOrderPage extends Component {
isLendOrder && patientNameProfile.show && (tempSubOption.patient_name = state.listOptionData[20].value) isLendOrder && patientNameProfile.show && (tempSubOption.patient_name = state.listOptionData[20].value)
isLendOrder && patientGenderProfile.show && (tempSubOption.patient_gender = state.listOptionData[21].value) isLendOrder && patientGenderProfile.show && (tempSubOption.patient_gender = state.listOptionData[21].value)
isLendOrder && patientAgeProfile.show && (tempSubOption.patient_age = state.listOptionData[22].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) isLendOrder && patientIdProfile.show && (tempSubOption.patient_id = state.listOptionData[24].value)
// tempSubOption.replace_item_flag = state.listOptionData[10].replace_item_flag // tempSubOption.replace_item_flag = state.listOptionData[10].replace_item_flag
...@@ -1756,7 +1925,7 @@ class SelfOrderPage extends Component { ...@@ -1756,7 +1925,7 @@ class SelfOrderPage extends Component {
let params = { let params = {
access_token: props.token, access_token: props.token,
data: { ...tempSubOption } data: { ...tempSubOption },
} }
console.log('params=', params) console.log('params=', params)
props.requestSelfSumbit(params) props.requestSelfSumbit(params)
...@@ -1771,7 +1940,11 @@ class SelfOrderPage extends Component { ...@@ -1771,7 +1940,11 @@ class SelfOrderPage extends Component {
let res_lines = [] let res_lines = []
let showPackageTip = false let showPackageTip = false
local_lines.forEach(sup_item => { local_lines.forEach(sup_item => {
if (sup_item[LocalVariable.SELECTED_QUQNTITY] > 0 && sup_item.leftOptionList && sup_item.leftOptionList.length > 0) { if (
sup_item[LocalVariable.SELECTED_QUQNTITY] > 0 &&
sup_item.leftOptionList &&
sup_item.leftOptionList.length > 0
) {
sup_item.leftOptionList.map(lef_item => { sup_item.leftOptionList.map(lef_item => {
// let select_arr = lef_item[LocalVariable.SELECTED_DATA_ARR] // let select_arr = lef_item[LocalVariable.SELECTED_DATA_ARR]
let select_arr = lef_item.selectedArr || [] let select_arr = lef_item.selectedArr || []
...@@ -1780,11 +1953,17 @@ class SelfOrderPage extends Component { ...@@ -1780,11 +1953,17 @@ class SelfOrderPage extends Component {
// 手术套包 // 手术套包
select_arr.forEach(sel_item => { select_arr.forEach(sel_item => {
let template_number = sel_item.template_number 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 => { sel_item[LocalVariable.CHILDREN_LINE_NAME].forEach(chi_item => {
if (chi_item[LocalVariable.LINE_OPTIONS] && chi_item[LocalVariable.LINE_OPTIONS].length > 0) { if (chi_item[LocalVariable.LINE_OPTIONS] && chi_item[LocalVariable.LINE_OPTIONS].length > 0) {
chi_item[LocalVariable.LINE_OPTIONS].forEach(lin_item => { chi_item[LocalVariable.LINE_OPTIONS].forEach(lin_item => {
if (lin_item[LocalVariable.SELECTED_DATA_ARR] && lin_item[LocalVariable.SELECTED_DATA_ARR].length > 0) { if (
lin_item[LocalVariable.SELECTED_DATA_ARR] &&
lin_item[LocalVariable.SELECTED_DATA_ARR].length > 0
) {
lin_item[LocalVariable.SELECTED_DATA_ARR].forEach(sel_item => { lin_item[LocalVariable.SELECTED_DATA_ARR].forEach(sel_item => {
if (sel_item[LocalVariable.QUANTITY_FIELD] > 0) { if (sel_item[LocalVariable.QUANTITY_FIELD] > 0) {
// sel_item['template_number'] = template_number // 暂时不用 // sel_item['template_number'] = template_number // 暂时不用
...@@ -1798,7 +1977,10 @@ class SelfOrderPage extends Component { ...@@ -1798,7 +1977,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) { if (lef_item.category_code === LocalVariable.EQUIPMENT_BAG) {
showPackageTip = true showPackageTip = true
...@@ -1811,17 +1993,15 @@ class SelfOrderPage extends Component { ...@@ -1811,17 +1993,15 @@ class SelfOrderPage extends Component {
res_lines.push(sel_item) res_lines.push(sel_item)
} }
}) })
} } else if (lef_item.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
else if (lef_item.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
// 零散器械 // 零散器械
select_arr.forEach(sel_item => { 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] sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item) res_lines.push(sel_item)
} }
}) })
} } else {
else {
// 耗材 // 耗材
if (select_arr[0].details && select_arr[0].details.length > 0) { if (select_arr[0].details && select_arr[0].details.length > 0) {
// 大-中-小类 // 大-中-小类
...@@ -1836,7 +2016,7 @@ class SelfOrderPage extends Component { ...@@ -1836,7 +2016,7 @@ class SelfOrderPage extends Component {
} else { } else {
// 大类-小类 // 大类-小类
select_arr.forEach(sel_item => { 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] sel_item[LocalVariable.PLAN_QUANTITY] = sel_item[LocalVariable.QUANTITY_FIELD]
res_lines.push(sel_item) res_lines.push(sel_item)
} }
...@@ -1874,19 +2054,20 @@ class SelfOrderPage extends Component { ...@@ -1874,19 +2054,20 @@ class SelfOrderPage extends Component {
listOptionData[8].sub_lines = end_lines listOptionData[8].sub_lines = end_lines
that.setState({ that.setState(
listOptionData: listOptionData {
}, () => { listOptionData: listOptionData,
},
() => {
that.submitSelfOrder() that.submitSelfOrder()
}) },
)
// if (showPackageTip) { // if (showPackageTip) {
// this.refs.PackageModel.show() // this.refs.PackageModel.show()
// } else { // } else {
// this.refs.CertModel.show('需要携带合格证?') // this.refs.CertModel.show('需要携带合格证?')
// } // }
} }
// 判断组织是否为空 // 判断组织是否为空
...@@ -1906,10 +2087,15 @@ class SelfOrderPage extends Component { ...@@ -1906,10 +2087,15 @@ class SelfOrderPage extends Component {
* @returns * @returns
*/ */
judgeDepartmentIsNull() { judgeDepartmentIsNull() {
let {listOptionData } = this.state let { listOptionData } = this.state
return R.ifElse(R.isEmpty, () => {show('请先选择部门'); return R.F()}, R.T)( return R.ifElse(
R.path(['listOptionData', 14, 'value'], this.state) R.isEmpty,
) () => {
show('请先选择部门')
return R.F()
},
R.T,
)(R.path(['listOptionData', 14, 'value'], this.state))
} }
// 判断客户名称是否为空 // 判断客户名称是否为空
...@@ -1929,10 +2115,15 @@ class SelfOrderPage extends Component { ...@@ -1929,10 +2115,15 @@ class SelfOrderPage extends Component {
* @returns * @returns
*/ */
judgeBillIsNull() { judgeBillIsNull() {
let {listOptionData } = this.state let { listOptionData } = this.state
return R.ifElse(R.isEmpty, () => {show('请先选择收单地点'); return R.F()}, R.T)( return R.ifElse(
R.path(['listOptionData', 3, 'value'], this.state) R.isEmpty,
) () => {
show('请先选择收单地点')
return R.F()
},
R.T,
)(R.path(['listOptionData', 3, 'value'], this.state))
} }
// 处理提交后返回的数据 // 处理提交后返回的数据
...@@ -1942,23 +2133,30 @@ class SelfOrderPage extends Component { ...@@ -1942,23 +2133,30 @@ class SelfOrderPage extends Component {
if (selfOrderOption) { if (selfOrderOption) {
if (selfOrderOption.create_success == 'N') { if (selfOrderOption.create_success == 'N') {
// 打开库存不足弹窗 // 打开库存不足弹窗
this.setState({ this.setState(
not_enough_items_list: selfOrderOption.not_enough_items_list {
}, () => { not_enough_items_list: selfOrderOption.not_enough_items_list,
},
() => {
// 解决 IOS 弹窗显示问题 // 解决 IOS 弹窗显示问题
setTimeout(() => { setTimeout(() => {
that.setState({ that.setState({
showNotEnogPop: true showNotEnogPop: true,
}) })
}, 500) }, 500)
}) },
)
} else if (selfOrderOption.create_success == 'Y') { } else if (selfOrderOption.create_success == 'Y') {
// 打开下单成功页面 // 打开下单成功页面
that.clearAllData() that.clearAllData()
let { state: { params: { title } } } = that.props.navigation let {
state: {
params: { title },
},
} = that.props.navigation
that.props.navigation.navigate('SubSuccPage', { that.props.navigation.navigate('SubSuccPage', {
title: `${title} - 下单成功`, title: `${title} - 下单成功`,
orderNumber: selfOrderOption.survey_collect_number orderNumber: selfOrderOption.survey_collect_number,
// orderNumber: selfOrderOption.order_number // orderNumber: selfOrderOption.order_number
}) })
} }
...@@ -1974,7 +2172,7 @@ class SelfOrderPage extends Component { ...@@ -1974,7 +2172,7 @@ class SelfOrderPage extends Component {
listOptionData, listOptionData,
currentTime: 0, currentTime: 0,
stop: false, stop: false,
localPhoOption: [] localPhoOption: [],
}) })
} }
...@@ -1984,7 +2182,7 @@ class SelfOrderPage extends Component { ...@@ -1984,7 +2182,7 @@ class SelfOrderPage extends Component {
* @return {*} * @return {*}
*/ */
patientInfoInputHandler(text, item) { patientInfoInputHandler(text, item) {
const {listOptionData} = this.state const { listOptionData } = this.state
item.value = text item.value = text
this.setState({ listOptionData }, () => { this.setState({ listOptionData }, () => {
this.changeCanSub() this.changeCanSub()
...@@ -1994,19 +2192,22 @@ class SelfOrderPage extends Component { ...@@ -1994,19 +2192,22 @@ class SelfOrderPage extends Component {
handleGenderCheck(curData) { handleGenderCheck(curData) {
let { sexTypeOption } = this.state let { sexTypeOption } = this.state
let that = this let that = this
if(this.judgeOrgIsNull() && this.judgeCustomerIsNull()) { if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
that.setState({ that.setState(
{
currentTitle: curData.title, currentTitle: curData.title,
currentItem: { currentItem: {
name: curData.name, name: curData.name,
value: curData.value value: curData.value,
} },
}, () => { },
() => {
that.setState({ that.setState({
showTypePop: true, showTypePop: true,
listCurrentOption: [...sexTypeOption] listCurrentOption: [...sexTypeOption],
})
}) })
},
)
} }
} }
...@@ -2028,20 +2229,23 @@ class SelfOrderPage extends Component { ...@@ -2028,20 +2229,23 @@ class SelfOrderPage extends Component {
handleNotEnoughCallBack() { handleNotEnoughCallBack() {
let { submitOption } = this.state let { submitOption } = this.state
let that = this let that = this
this.setState({ this.setState(
{
submitOption: { submitOption: {
...submitOption, ...submitOption,
force_balance_check_flag: 'N' force_balance_check_flag: 'N',
} },
}, () => { },
() => {
// that.handleSubmit() // that.handleSubmit()
that.submitSelfOrder() that.submitSelfOrder()
}) },
)
} }
// 库存不足弹窗关闭 // 库存不足弹窗关闭
handleNotEnoughCloseModal(show) { handleNotEnoughCloseModal(show) {
this.setState({ this.setState({
showNotEnogPop: show showNotEnogPop: show,
}) })
} }
...@@ -2049,14 +2253,14 @@ class SelfOrderPage extends Component { ...@@ -2049,14 +2253,14 @@ class SelfOrderPage extends Component {
handleZoomPicture(flag, index) { handleZoomPicture(flag, index) {
this.setState({ this.setState({
isShowImage: flag, isShowImage: flag,
currShowImgIndex: index || 0 currShowImgIndex: index || 0,
}) })
} }
// 返回备注以上的元素 // 返回备注以上的元素
renderListItem() { renderListItem() {
let { listOptionData, dateModelPop, sysValues } = this.state 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 isShowOrg = R.compose(R.equals('Y'), R.prop('OBS_SHOW_ORG_FLAG'))(sysProfiles)
const { isLendOrder } = navigation.getParam('params') const { isLendOrder } = navigation.getParam('params')
...@@ -2077,10 +2281,9 @@ class SelfOrderPage extends Component { ...@@ -2077,10 +2281,9 @@ class SelfOrderPage extends Component {
listDefaValue={'name'} listDefaValue={'name'}
listTitle={'title'} listTitle={'title'}
/> />
{ {isShowOrg && (
isShowOrg && (
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={true} listHasAster={true}
listItem={listOptionData[1]} listItem={listOptionData[1]}
listName={'name'} listName={'name'}
...@@ -2088,62 +2291,73 @@ class SelfOrderPage extends Component { ...@@ -2088,62 +2291,73 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleOrganizationCheck(listOptionData[1])} listCallBack={() => this.handleOrganizationCheck(listOptionData[1])}
listHasArrow={true} listHasArrow={true}
/> />
) )}
} {sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 1 && (
{
sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 1 && (
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2} listHasAster={sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2}
listItem={listOptionData[14]} listItem={listOptionData[14]}
listName={'name'} listName={'name'}
listTitle={'title'} listTitle={'title'}
listCallBack={() => this.handleDepartmentCheck(listOptionData[14], null, 'department_name', 'department_code')} listCallBack={() =>
this.handleDepartmentCheck(listOptionData[14], null, 'department_name', 'department_code')
}
listHasArrow={true} listHasArrow={true}
/> />
) )}
} {sysValues.OBS_MOBILE_BM_DISPLAY > 1 && (
{
sysValues.OBS_MOBILE_BM_DISPLAY > 1 && (
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_BM_DISPLAY > 2} listHasAster={sysValues.OBS_MOBILE_BM_DISPLAY > 2}
listItem={listOptionData[15]} listItem={listOptionData[15]}
listName={'name'} listName={'name'}
listTitle={'title'} 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} listHasArrow={true}
/> />
) )}
} {sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 1 && (
{
sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 1 && (
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2} listHasAster={sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2}
listItem={listOptionData[16]} listItem={listOptionData[16]}
listName={'name'} listName={'name'}
listTitle={'title'} 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} listHasArrow={true}
/> />
) )}
} {sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 1 && (
{
sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 1 && (
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2} listHasAster={sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2}
listItem={listOptionData[17]} listItem={listOptionData[17]}
listName={'name'} listName={'name'}
listTitle={'title'} 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} listHasArrow={true}
/> />
) )}
}
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={true} listHasAster={true}
listItem={listOptionData[2]} listItem={listOptionData[2]}
listName={'name'} listName={'name'}
...@@ -2152,7 +2366,7 @@ class SelfOrderPage extends Component { ...@@ -2152,7 +2366,7 @@ class SelfOrderPage extends Component {
listHasArrow={true} listHasArrow={true}
/> />
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={true} listHasAster={true}
listItem={listOptionData[3]} listItem={listOptionData[3]}
listName={'name'} listName={'name'}
...@@ -2161,7 +2375,7 @@ class SelfOrderPage extends Component { ...@@ -2161,7 +2375,7 @@ class SelfOrderPage extends Component {
listHasArrow={true} listHasArrow={true}
/> />
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={true} listHasAster={true}
listItem={listOptionData[4]} listItem={listOptionData[4]}
listName={'name'} listName={'name'}
...@@ -2169,10 +2383,10 @@ class SelfOrderPage extends Component { ...@@ -2169,10 +2383,10 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleShipCheck(listOptionData[4])} listCallBack={() => this.handleShipCheck(listOptionData[4])}
listHasArrow={true} listHasArrow={true}
/> />
{ {isLendOrder ? (
isLendOrder ? (doctorNameProfile.show && doctorNameProfile.show && (
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={doctorNameProfile.required} listHasAster={doctorNameProfile.required}
listItem={listOptionData[5]} listItem={listOptionData[5]}
listName={'name'} listName={'name'}
...@@ -2181,10 +2395,12 @@ class SelfOrderPage extends Component { ...@@ -2181,10 +2395,12 @@ class SelfOrderPage extends Component {
listHasArrow={true} listHasArrow={true}
listOtherInput={'请输入主治医生'} listOtherInput={'请输入主治医生'}
otherInput={'showInput'} otherInput={'showInput'}
otherInputCallBack={(text) => this.handleDoctorInput(text, listOptionData[5])} otherInputCallBack={text => this.handleDoctorInput(text, listOptionData[5])}
/>) : ( />
)
) : (
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
// listHasAster={true} // listHasAster={true}
listItem={listOptionData[5]} listItem={listOptionData[5]}
listName={'name'} listName={'name'}
...@@ -2193,10 +2409,9 @@ class SelfOrderPage extends Component { ...@@ -2193,10 +2409,9 @@ class SelfOrderPage extends Component {
listHasArrow={true} listHasArrow={true}
listOtherInput={'请输入主治医生'} listOtherInput={'请输入主治医生'}
otherInput={'showInput'} otherInput={'showInput'}
otherInputCallBack={(text) => this.handleDoctorInput(text, listOptionData[5])} otherInputCallBack={text => this.handleDoctorInput(text, listOptionData[5])}
/> />
) )}
}
{/* <PageListArrow {/* <PageListArrow
listActOpa={.8} listActOpa={.8}
listHasAster={true} listHasAster={true}
...@@ -2208,7 +2423,7 @@ class SelfOrderPage extends Component { ...@@ -2208,7 +2423,7 @@ class SelfOrderPage extends Component {
isTitInputStyle={true} isTitInputStyle={true}
/> */} /> */}
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={true} listHasAster={true}
listItem={listOptionData[6]} listItem={listOptionData[6]}
listName={'name'} listName={'name'}
...@@ -2216,10 +2431,9 @@ class SelfOrderPage extends Component { ...@@ -2216,10 +2431,9 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleSurDateCheck(listOptionData[6])} listCallBack={() => this.handleSurDateCheck(listOptionData[6])}
listHasArrow={true} listHasArrow={true}
/> />
{ {sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 1 && (
sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 1 &&
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listItem={listOptionData[19]} listItem={listOptionData[19]}
listHasAster={sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 2} listHasAster={sysProfiles.SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG > 2}
listName={'name'} listName={'name'}
...@@ -2227,9 +2441,8 @@ class SelfOrderPage extends Component { ...@@ -2227,9 +2441,8 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleSurTypeCheck(listOptionData[19])} listCallBack={() => this.handleSurTypeCheck(listOptionData[19])}
listHasArrow={true} listHasArrow={true}
/> />
} )}
{ {isLendOrder && patientNameProfile.show && (
isLendOrder && patientNameProfile.show &&
<PageListArrow <PageListArrow
listHasAster={true} listHasAster={true}
listItem={listOptionData[20]} listItem={listOptionData[20]}
...@@ -2237,15 +2450,14 @@ class SelfOrderPage extends Component { ...@@ -2237,15 +2450,14 @@ class SelfOrderPage extends Component {
listHasAster={patientNameProfile.required} listHasAster={patientNameProfile.required}
listTitle={'title'} listTitle={'title'}
listInputPlace={`请输入${listOptionData[20].title}`} listInputPlace={`请输入${listOptionData[20].title}`}
inputCallBack={(text) => this.patientInfoInputHandler(text, listOptionData[20])} inputCallBack={text => this.patientInfoInputHandler(text, listOptionData[20])}
isTitInputStyle={true} isTitInputStyle={true}
listCellStyle={styles.list_cell_box} listCellStyle={styles.list_cell_box}
/> />
} )}
{ {isLendOrder && patientGenderProfile.show && (
isLendOrder && patientGenderProfile.show &&
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={patientGenderProfile.required} listHasAster={patientGenderProfile.required}
listItem={listOptionData[21]} listItem={listOptionData[21]}
listName={'name'} listName={'name'}
...@@ -2253,9 +2465,8 @@ class SelfOrderPage extends Component { ...@@ -2253,9 +2465,8 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleGenderCheck(listOptionData[21])} listCallBack={() => this.handleGenderCheck(listOptionData[21])}
listHasArrow={true} listHasArrow={true}
/> />
} )}
{ {isLendOrder && patientAgeProfile.show && (
isLendOrder && patientAgeProfile.show &&
<PageListArrow <PageListArrow
listHasAster={true} listHasAster={true}
listItem={listOptionData[22]} listItem={listOptionData[22]}
...@@ -2263,13 +2474,12 @@ class SelfOrderPage extends Component { ...@@ -2263,13 +2474,12 @@ class SelfOrderPage extends Component {
listHasAster={patientAgeProfile.required} listHasAster={patientAgeProfile.required}
listTitle={'title'} listTitle={'title'}
listInputPlace={`请输入${listOptionData[22].title}`} listInputPlace={`请输入${listOptionData[22].title}`}
inputCallBack={(text) => this.patientInfoInputHandler(text, listOptionData[22])} inputCallBack={text => this.patientInfoInputHandler(text, listOptionData[22])}
isTitInputStyle={true} isTitInputStyle={true}
listCellStyle={styles.list_cell_box} listCellStyle={styles.list_cell_box}
/> />
} )}
{ {isLendOrder && hospitalizationNumberProfile.show && (
isLendOrder && hospitalizationNumberProfile.show &&
<PageListArrow <PageListArrow
listHasAster={true} listHasAster={true}
listItem={listOptionData[23]} listItem={listOptionData[23]}
...@@ -2277,13 +2487,12 @@ class SelfOrderPage extends Component { ...@@ -2277,13 +2487,12 @@ class SelfOrderPage extends Component {
listHasAster={hospitalizationNumberProfile.required} listHasAster={hospitalizationNumberProfile.required}
listTitle={'title'} listTitle={'title'}
listInputPlace={`请输入${listOptionData[23].title}`} listInputPlace={`请输入${listOptionData[23].title}`}
inputCallBack={(text) => this.patientInfoInputHandler(text, listOptionData[23])} inputCallBack={text => this.patientInfoInputHandler(text, listOptionData[23])}
isTitInputStyle={true} isTitInputStyle={true}
listCellStyle={styles.list_cell_box} listCellStyle={styles.list_cell_box}
/> />
} )}
{ {isLendOrder && patientIdProfile.show && (
isLendOrder && patientIdProfile.show &&
<PageListArrow <PageListArrow
listHasAster={true} listHasAster={true}
listItem={listOptionData[24]} listItem={listOptionData[24]}
...@@ -2291,13 +2500,13 @@ class SelfOrderPage extends Component { ...@@ -2291,13 +2500,13 @@ class SelfOrderPage extends Component {
listHasAster={patientIdProfile.required} listHasAster={patientIdProfile.required}
listTitle={'title'} listTitle={'title'}
listInputPlace={`请输入${listOptionData[24].title}`} listInputPlace={`请输入${listOptionData[24].title}`}
inputCallBack={(text) => this.patientInfoInputHandler(text, listOptionData[24])} inputCallBack={text => this.patientInfoInputHandler(text, listOptionData[24])}
isTitInputStyle={true} isTitInputStyle={true}
listCellStyle={styles.list_cell_box} listCellStyle={styles.list_cell_box}
/> />
} )}
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={true} listHasAster={true}
listItem={listOptionData[7]} listItem={listOptionData[7]}
listName={'name'} listName={'name'}
...@@ -2306,7 +2515,7 @@ class SelfOrderPage extends Component { ...@@ -2306,7 +2515,7 @@ class SelfOrderPage extends Component {
listHasArrow={true} listHasArrow={true}
/> />
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={true} listHasAster={true}
listItem={listOptionData[8]} listItem={listOptionData[8]}
listName={'name'} listName={'name'}
...@@ -2316,29 +2525,28 @@ class SelfOrderPage extends Component { ...@@ -2316,29 +2525,28 @@ class SelfOrderPage extends Component {
listMaxLines={1} listMaxLines={1}
/> />
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={true} listHasAster={true}
listItem={listOptionData[9]} listItem={listOptionData[9]}
// listName={'name'} // listName={'name'}
listTitle={'title'} listTitle={'title'}
listValue={'value'} listValue={'value'}
listCallBack={(radioFlag) => this.handleCertAndItemCheck(listOptionData[9], radioFlag)} listCallBack={radioFlag => this.handleCertAndItemCheck(listOptionData[9], radioFlag)}
listIsAudio={true} listIsAudio={true}
/> />
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listItem={listOptionData[10]} listItem={listOptionData[10]}
// listName={'name'} // listName={'name'}
listTitle={'title'} listTitle={'title'}
listValue={'value'} listValue={'value'}
listCallBack={(radioFlag) => this.handleCertAndItemCheck(listOptionData[10], radioFlag)} listCallBack={radioFlag => this.handleCertAndItemCheck(listOptionData[10], radioFlag)}
listIsAudio={true} listIsAudio={true}
/> />
{ {sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 1 ? (
sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 1 ?
<PageListArrow <PageListArrow
listActOpa={.8} listActOpa={0.8}
listHasAster={sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 2} listHasAster={sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 2}
listItem={listOptionData[18]} listItem={listOptionData[18]}
listName={'name'} listName={'name'}
...@@ -2346,17 +2554,18 @@ class SelfOrderPage extends Component { ...@@ -2346,17 +2554,18 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleWareCheck(listOptionData[18])} listCallBack={() => this.handleWareCheck(listOptionData[18])}
listHasArrow={true} listHasArrow={true}
/> />
: <Text></Text> ) : (
} <Text></Text>
)}
<DateModel <DateModel
date={listOptionData[6].dateValue} date={listOptionData[6].dateValue}
closeModal={(show) => this.closeDateModal(show)} closeModal={show => this.closeDateModal(show)}
show={dateModelPop} show={dateModelPop}
callback={(date) => this.dateModalCallback(date, listOptionData[6])} callback={date => this.dateModalCallback(date, listOptionData[6])}
minuteInterval={30} minuteInterval={30}
/> />
{ this.renderPickerModel()} {this.renderPickerModel()}
{/* { this.renderTipModelPackage()} {/* { this.renderTipModelPackage()}
{ this.renderTipModelCert()} */} { this.renderTipModelCert()} */}
</View> </View>
...@@ -2383,7 +2592,7 @@ class SelfOrderPage extends Component { ...@@ -2383,7 +2592,7 @@ class SelfOrderPage extends Component {
show={showTypePop} show={showTypePop}
itemValue={currentItem.value} itemValue={currentItem.value}
itemTitle={currentTitle} itemTitle={currentTitle}
closeModal={(show) => this.handleCloseModal(show)} closeModal={show => this.handleCloseModal(show)}
/> />
</SafeAreaView> </SafeAreaView>
) )
...@@ -2396,18 +2605,22 @@ class SelfOrderPage extends Component { ...@@ -2396,18 +2605,22 @@ class SelfOrderPage extends Component {
<CellTextStyle style={list_common_item.remark_item}> <CellTextStyle style={list_common_item.remark_item}>
<View style={list_common_item.rema_box}> <View style={list_common_item.rema_box}>
<Text style={list_common_item.rema_tit}>备注</Text> <Text style={list_common_item.rema_tit}>备注</Text>
<View style={list_common_item.rema_Input_outer} > <View style={list_common_item.rema_Input_outer}>
<TouchableOpacity activeOpacity={1} style={list_common_item.rema_Input_inner} onPress={() => this.TextInput.focus()} > <TouchableOpacity
activeOpacity={1}
style={list_common_item.rema_Input_inner}
onPress={() => this.TextInput.focus()}
>
<TextInput <TextInput
placeholder={'请输入备注信息'} placeholder={'请输入备注信息'}
placeholderTextColor={placehold_text_color} placeholderTextColor={placehold_text_color}
underlineColorAndroid={'transparent'} underlineColorAndroid={'transparent'}
multiline={true} multiline={true}
ref={textInput => this.TextInput = textInput} ref={textInput => (this.TextInput = textInput)}
numberOfLines={8} numberOfLines={8}
style={list_common_item.rema_Input} style={list_common_item.rema_Input}
maxLength={140} maxLength={140}
onChangeText={(text) => this.handleRemarkInput(text, listOptionData[11])} onChangeText={text => this.handleRemarkInput(text, listOptionData[11])}
defaultValue={listOptionData[11].value} defaultValue={listOptionData[11].value}
/> />
</TouchableOpacity> </TouchableOpacity>
...@@ -2424,11 +2637,10 @@ class SelfOrderPage extends Component { ...@@ -2424,11 +2637,10 @@ class SelfOrderPage extends Component {
<CellTextStyle style={[list_common_item.reco_item, !stop ? '' : list_common_item.reco_play_height]}> <CellTextStyle style={[list_common_item.reco_item, !stop ? '' : list_common_item.reco_play_height]}>
<View style={list_common_item.reco_btn_cont}> <View style={list_common_item.reco_btn_cont}>
{!stop ? <Text style={list_common_item.reco_btn_tit}>还有什么要安排的,可录音备注哟!</Text> : null} {!stop ? <Text style={list_common_item.reco_btn_tit}>还有什么要安排的,可录音备注哟!</Text> : null}
{ {!stop ? (
!stop ?
<View style={list_common_item.reco_btn_inner}> <View style={list_common_item.reco_btn_inner}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={list_common_item.reco_btn_box} style={list_common_item.reco_btn_box}
onLongPress={this._record} onLongPress={this._record}
onPressOut={this._stop} onPressOut={this._stop}
...@@ -2439,26 +2651,29 @@ class SelfOrderPage extends Component { ...@@ -2439,26 +2651,29 @@ class SelfOrderPage extends Component {
<Text style={list_common_item.reco_btn_text}>长按录音</Text> <Text style={list_common_item.reco_btn_text}>长按录音</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
: <View style={list_common_item.reco_play_box}> ) : (
<View style={list_common_item.reco_play_box}>
<View style={list_common_item.play_btn}> <View style={list_common_item.play_btn}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={[list_common_item.reco_list_box, list_common_item.reco_del_btn]} style={[list_common_item.reco_list_box, list_common_item.reco_del_btn]}
onPress={this._del} onPress={this._del}
> >
<Text style={[list_common_item.reco_text, list_common_item.reco_del_tit]}> 删除 </Text> <Text style={[list_common_item.reco_text, list_common_item.reco_del_tit]}> 删除 </Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={[list_common_item.reco_list_box, list_common_item.reco_play_btn]} style={[list_common_item.reco_list_box, list_common_item.reco_play_btn]}
onPress={this._play} onPress={this._play}
> >
<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> </TouchableOpacity>
</View> </View>
</View> </View>
} )}
</View> </View>
</CellTextStyle> </CellTextStyle>
) )
...@@ -2472,13 +2687,11 @@ class SelfOrderPage extends Component { ...@@ -2472,13 +2687,11 @@ class SelfOrderPage extends Component {
<View style={list_common_item.addpic_inner}> <View style={list_common_item.addpic_inner}>
<Text style={list_common_item.addpic_tit}>添加图片</Text> <Text style={list_common_item.addpic_tit}>添加图片</Text>
<View style={list_common_item.addpic_cont}> <View style={list_common_item.addpic_cont}>
{ {state.localPhoOption.length
state.localPhoOption.length
? state.localPhoOption.map((item, index) => this.renderPicItem(item, index)) ? state.localPhoOption.map((item, index) => this.renderPicItem(item, index))
: null : null}
}
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={list_common_item.addpic_img_btn} style={list_common_item.addpic_img_btn}
onPress={() => this.handleAddPicCheck()} onPress={() => this.handleAddPicCheck()}
> >
...@@ -2496,14 +2709,14 @@ class SelfOrderPage extends Component { ...@@ -2496,14 +2709,14 @@ class SelfOrderPage extends Component {
return ( return (
<View style={list_common_item.addnew_pic_btn} key={index}> <View style={list_common_item.addnew_pic_btn} key={index}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={list_common_item.show_pic_btn} style={list_common_item.show_pic_btn}
onPress={() => this.handleZoomPicture(true, index)} onPress={() => this.handleZoomPicture(true, index)}
> >
<Image style={icon_style} source={{ uri: item }} /> <Image style={icon_style} source={{ uri: item }} />
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={list_common_item.del_img_box} style={list_common_item.del_img_box}
onPress={(item, index) => this.handleDelPickCheck(item, index)} onPress={(item, index) => this.handleDelPickCheck(item, index)}
> >
...@@ -2532,7 +2745,7 @@ class SelfOrderPage extends Component { ...@@ -2532,7 +2745,7 @@ class SelfOrderPage extends Component {
let zoomImages = [] let zoomImages = []
listOptionData[13].uploadImgArr.forEach(item => { listOptionData[13].uploadImgArr.forEach(item => {
zoomImages.push({ zoomImages.push({
url: `${global_domain_config}/${item}` url: `${global_domain_config}/${item}`,
}) })
}) })
return ( return (
...@@ -2540,38 +2753,41 @@ class SelfOrderPage extends Component { ...@@ -2540,38 +2753,41 @@ class SelfOrderPage extends Component {
isShowImage={isShowImage} isShowImage={isShowImage}
currShowImgIndex={currShowImgIndex} currShowImgIndex={currShowImgIndex}
zoomImages={zoomImages} zoomImages={zoomImages}
callBack={(flag) => this.handleZoomPicture(flag)} callBack={flag => this.handleZoomPicture(flag)}
></ZoomPictureModel> ></ZoomPictureModel>
) )
} }
// 返回正在加载中 // 返回正在加载中
renderLodingItem() { renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state let { lodingTitle, isSubLoding } = this.state
return ( return <LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
)
} }
// 返回加载中 // 返回加载中
renderLodingItemNew() { renderLodingItemNew() {
return ( return <LoadingModel ref="LoadingModel" />
<LoadingModel ref="LoadingModel" />
)
} }
// 返回提交器械包提示 // 返回提交器械包提示
renderTipModelPackage() { renderTipModelPackage() {
return ( 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() { renderTipModelCert() {
return ( 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 +2800,7 @@ class SelfOrderPage extends Component { ...@@ -2584,7 +2800,7 @@ class SelfOrderPage extends Component {
not_enough_items_list={not_enough_items_list} not_enough_items_list={not_enough_items_list}
callback={() => this.handleNotEnoughCallBack()} callback={() => this.handleNotEnoughCallBack()}
show={showNotEnogPop} show={showNotEnogPop}
closeModal={(show) => this.handleNotEnoughCloseModal(show)} closeModal={show => this.handleNotEnoughCloseModal(show)}
/> />
</SafeAreaView> </SafeAreaView>
) )
...@@ -2596,17 +2812,10 @@ class SelfOrderPage extends Component { ...@@ -2596,17 +2812,10 @@ class SelfOrderPage extends Component {
let { title } = navigation.state.params let { title } = navigation.state.params
return ( return (
<View style={styles.self_container}> <View style={styles.self_container}>
<StatusBarView <StatusBarView isReactStackNavigator={true} backgroundColor={promary_color} barStyle="light-content" />
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle='light-content'
/>
<SafeAreaView style={safe_view}> <SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} /> <HeadBackItem title={title} navigation={navigation} />
<ScrollView <ScrollView style={styles.self_main} showsVerticalScrollIndicator={false}>
style={styles.self_main}
showsVerticalScrollIndicator={false}
>
{this.renderListItem()} {this.renderListItem()}
{this.renderRemarksItem()} {this.renderRemarksItem()}
{this.renderRecordingItem()} {this.renderRecordingItem()}
...@@ -2614,54 +2823,52 @@ class SelfOrderPage extends Component { ...@@ -2614,54 +2823,52 @@ class SelfOrderPage extends Component {
{this.renderZoomPicture()} {this.renderZoomPicture()}
<FooterBtnStyle <FooterBtnStyle
style={canSubFlag ? styles.sub_btn_pro : ''} style={canSubFlag ? styles.sub_btn_pro : ''}
activeOpacity={canSubFlag ? .8 : 1} activeOpacity={canSubFlag ? 0.8 : 1}
title={'生成订单'} title={'生成订单'}
textStyle={styles.sub_btn} textStyle={styles.sub_btn}
onPress={() => this.handleSubmit()} onPress={() => this.handleSubmit()}
/> />
</ScrollView> </ScrollView>
{this.renderLodingItem()} {this.renderLodingItem()}
{this.renderLodingItemNew()} {this.renderLodingItemNew()}
{this.renderNotEnoughModel()} {this.renderNotEnoughModel()}
</SafeAreaView> </SafeAreaView>
</View> </View>
); )
} }
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
self_container: { self_container: {
flex: 1, flex: 1,
backgroundColor: home_background_color backgroundColor: home_background_color,
}, },
self_main: { self_main: {
padding: 14 padding: 14,
}, },
sub_btn_pro: { sub_btn_pro: {
backgroundColor: promary_color backgroundColor: promary_color,
}, },
sub_btn: {}, sub_btn: {},
list_cont: { list_cont: {
flex: 1 flex: 1,
}, },
item_container: { item_container: {
flex: 1 flex: 1,
}, },
cell_title: { cell_title: {
width: 120 width: 120,
}, },
cell_input: { cell_input: {
textAlign: 'left' textAlign: 'left',
}, },
loding_back: { loding_back: {
backgroundColor: 'rgba(0, 0, 0, 0)' backgroundColor: 'rgba(0, 0, 0, 0)',
} },
}) })
const mapStateToProps = (state) => { const mapStateToProps = state => {
return { return {
userInfo: state.login.userInfo, userInfo: state.login.userInfo,
token: state.login.token, token: state.login.token,
...@@ -2672,25 +2879,25 @@ const mapStateToProps = (state) => { ...@@ -2672,25 +2879,25 @@ const mapStateToProps = (state) => {
global_domain_config: state.login.global_domain_config, global_domain_config: state.login.global_domain_config,
local_sele_pro_options: state.selfOrder.local_sele_pro_options, local_sele_pro_options: state.selfOrder.local_sele_pro_options,
sysProfiles: state.login.sysProfiles, 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 { return {
requestSelfOrganizations: (params) => { requestSelfOrganizations: params => {
dispatch(requestSelfOrganizations(params)) dispatch(requestSelfOrganizations(params))
}, },
requestSelfSurgeryHospital: (params) => { requestSelfSurgeryHospital: params => {
dispatch(requestSelfSurgeryHospital(params)) dispatch(requestSelfSurgeryHospital(params))
}, },
requestSelfOrderType: (params) => { requestSelfOrderType: params => {
dispatch(requestSelfOrderType(params)) dispatch(requestSelfOrderType(params))
}, },
requestSelfTemplateCollect: (params) => { requestSelfTemplateCollect: params => {
dispatch(requestSelfTemplateCollect(params)) dispatch(requestSelfTemplateCollect(params))
}, },
requestSelfSumbit: (params) => { requestSelfSumbit: params => {
dispatch(requestSelfSumbit(params)) dispatch(requestSelfSumbit(params))
}, },
exitLoginStatus: () => { exitLoginStatus: () => {
...@@ -2699,19 +2906,19 @@ const mapDispatchToProps = (dispatch) => { ...@@ -2699,19 +2906,19 @@ const mapDispatchToProps = (dispatch) => {
setSelfInitData: () => { setSelfInitData: () => {
dispatch(setSelfInitData()) dispatch(setSelfInitData())
}, },
requestListDataSuccess: (data) => { requestListDataSuccess: data => {
dispatch(requestListDataSuccess(data)) dispatch(requestListDataSuccess(data))
}, },
requestSelfSurgeryType: (params) => { requestSelfSurgeryType: params => {
dispatch(requestSelfSurgeryType(params)) dispatch(requestSelfSurgeryType(params))
}, },
setSelectProductOpts: (data) => { setSelectProductOpts: data => {
dispatch(setSelectProductOpts(data)) dispatch(setSelectProductOpts(data))
}, },
requestQuickSurColSetting: (params) => { requestQuickSurColSetting: params => {
dispatch(requestQuickSurColSetting(params)) dispatch(requestQuickSurColSetting(params))
} },
} }
} }
export default connect(mapStateToProps, mapDispatchToProps)(SelfOrderPage); export default connect(mapStateToProps, mapDispatchToProps)(SelfOrderPage)
import React, { Component } from 'react'; import React, { Component } from 'react'
import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput, SafeAreaView } from 'react-native'; import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput, SafeAreaView } from 'react-native'
import { connect } from 'react-redux'; import { connect } from 'react-redux'
import debounce from 'debounce'; import debounce from 'debounce'
import { foundation_color, home_background_color, Width, third_text_size, pxSize, promary_color, safe_view, font_family_regular, icon_style, title_text_color, font_family_medium, list_common_item, point_color } from '../../../base/BaseStyle'; import {
import ChooseFilter from './ChooseFilter'; foundation_color,
import HeadBackItem from '../../common/HeadBackItem'; home_background_color,
import ProductRightStyle from './ProductRightStyle'; Width,
import ProductModel from '../../common/ProductModel'; third_text_size,
import StatusBarView from '../../common/StatusBarView'; pxSize,
import ChooseCardList from '../../common/listDataComponent/ChooseCardList'; promary_color,
import { cloneObject, show, isNotBlank, isBlank } from '../../../utils/Utils'; safe_view,
import { reqPurSupplierSearch, reqProCategorySearch, reqSurTempHeadSearch, reqNailEquipHeadSearch, reqScatEquipmentSearch, reqSingleConsumSearch, setSelectProductOpts } from '../../../action/SelfAction'; font_family_regular,
import LoadingModel from '../../common/listDataComponent/LoadingModel'; icon_style,
import LocalVariable from '../../common/LocalVariable'; title_text_color,
import { exitLoginStatus } from '../../../action/LoginAction'; font_family_medium,
import * as R from 'ramda'; list_common_item,
point_color,
} from '../../../base/BaseStyle'
import ChooseFilter from './ChooseFilter'
import HeadBackItem from '../../common/HeadBackItem'
import ProductRightStyle from './ProductRightStyle'
import ProductModel from '../../common/ProductModel'
import StatusBarView from '../../common/StatusBarView'
import ChooseCardList from '../../common/listDataComponent/ChooseCardList'
import { cloneObject, show, isNotBlank, isBlank } from '../../../utils/Utils'
import {
reqPurSupplierSearch,
reqProCategorySearch,
reqSurTempHeadSearch,
reqNailEquipHeadSearch,
reqScatEquipmentSearch,
reqSingleConsumSearch,
setSelectProductOpts,
} from '../../../action/SelfAction'
import LoadingModel from '../../common/listDataComponent/LoadingModel'
import LocalVariable from '../../common/LocalVariable'
import { exitLoginStatus } from '../../../action/LoginAction'
import * as R from 'ramda'
class ChooseProductPage extends Component { class ChooseProductPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
searchValue: '', searchValue: '',
topActiveIndex: 0, topActiveIndex: 0,
...@@ -26,68 +48,83 @@ class ChooseProductPage extends Component { ...@@ -26,68 +48,83 @@ class ChooseProductPage extends Component {
leftActiveIndex: 0, leftActiveIndex: 0,
defaultThridShow: false, // 默认耗材-小类不显示 defaultThridShow: false, // 默认耗材-小类不显示
selectShowPopup: false, // 共计已选弹窗 selectShowPopup: false, // 共计已选弹窗
defalutLeftItem: [{ defalutLeftItem: [
"category_code": LocalVariable.SURGICAL_TEMPLATE, {
"category_name": "手术套包", category_code: LocalVariable.SURGICAL_TEMPLATE,
"cate_local_icon": require('../../../images/surg_temp.png') category_name: '手术套包',
}, { cate_local_icon: require('../../../images/surg_temp.png'),
"category_code": LocalVariable.NAIL_BOX, },
"category_name": "钉盒", {
"cate_local_icon": require('../../../images/screw_box.png') category_code: LocalVariable.NAIL_BOX,
}, { category_name: '钉盒',
"category_code": LocalVariable.EQUIPMENT_BAG, cate_local_icon: require('../../../images/screw_box.png'),
"category_name": "器械包", },
"cate_local_icon": require('../../../images/equip_bag.png') {
}, { category_code: LocalVariable.EQUIPMENT_BAG,
"category_code": LocalVariable.SCATTERED_EQUIPMENT, category_name: '器械包',
"category_name": "零散器械", cate_local_icon: require('../../../images/equip_bag.png'),
"cate_local_icon": require('../../../images/auxili_tool.png') },
}], {
local_sel_options: [{ category_code: LocalVariable.SCATTERED_EQUIPMENT,
category_name: '零散器械',
cate_local_icon: require('../../../images/auxili_tool.png'),
},
],
local_sel_options: [
{
category_name: '手术套包', category_name: '手术套包',
category_code: LocalVariable.SURGICAL_TEMPLATE, category_code: LocalVariable.SURGICAL_TEMPLATE,
[LocalVariable.SELECTED_DATA_ARR]: [], [LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0 [LocalVariable.SELECTED_QUQNTITY]: 0,
}, { },
{
category_name: '钉盒', category_name: '钉盒',
category_code: LocalVariable.NAIL_BOX, category_code: LocalVariable.NAIL_BOX,
[LocalVariable.SELECTED_DATA_ARR]: [], [LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0 [LocalVariable.SELECTED_QUQNTITY]: 0,
}, { },
{
category_name: '器械包', category_name: '器械包',
category_code: LocalVariable.EQUIPMENT_BAG, category_code: LocalVariable.EQUIPMENT_BAG,
[LocalVariable.SELECTED_DATA_ARR]: [], [LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0 [LocalVariable.SELECTED_QUQNTITY]: 0,
}, { },
{
category_name: '零散器械', category_name: '零散器械',
category_code: LocalVariable.SCATTERED_EQUIPMENT, category_code: LocalVariable.SCATTERED_EQUIPMENT,
[LocalVariable.SELECTED_DATA_ARR]: [], [LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0 [LocalVariable.SELECTED_QUQNTITY]: 0,
}, { },
{
category_name: '耗材', category_name: '耗材',
category_code: LocalVariable.SIGN_SELECT_CONSUMABLES, category_code: LocalVariable.SIGN_SELECT_CONSUMABLES,
[LocalVariable.SELECTED_DATA_ARR]: [], [LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.SELECTED_QUQNTITY]: 0 [LocalVariable.SELECTED_QUQNTITY]: 0,
}], },
],
local_cur_options: [], local_cur_options: [],
cur_hc_opts: [], cur_hc_opts: [],
filterData: [{ filterData: [
{
field: 'surgery_type', field: 'surgery_type',
label: '手术类型', label: '手术类型',
options: [], options: [],
value: '', value: '',
type: 'select' type: 'select',
}], },
],
productAuthorization: 'N', productAuthorization: 'N',
authorizations: [] authorizations: [],
} }
this.inputSearchValue = debounce(this.inputSearchValue.bind(this), 500) this.inputSearchValue = debounce(this.inputSearchValue.bind(this), 500)
} }
componentDidMount() { componentDidMount() {
const {authorizations = [], productAuthorization = 'N'} = R.pathOr({}, ['state', 'params', 'selfData'])(this.props.navigation) const { authorizations = [], productAuthorization = 'N' } = R.pathOr({}, ['state', 'params', 'selfData'])(
this.setState({authorizations, productAuthorization}, () => { this.props.navigation,
)
this.setState({ authorizations, productAuthorization }, () => {
this.initGetData() this.initGetData()
}) })
} }
...@@ -97,6 +134,7 @@ class ChooseProductPage extends Component { ...@@ -97,6 +134,7 @@ class ChooseProductPage extends Component {
let { topProcOptionList, originManufacterList } = this.state let { topProcOptionList, originManufacterList } = this.state
let { setSelectProductOpts } = this.props let { setSelectProductOpts } = this.props
setSelectProductOpts(originManufacterList) setSelectProductOpts(originManufacterList)
console.log('originManufacterList', originManufacterList)
this.props.navigation.state.params.productCallBack(originManufacterList) this.props.navigation.state.params.productCallBack(originManufacterList)
this.props.navigation.goBack() this.props.navigation.goBack()
} }
...@@ -108,7 +146,6 @@ class ChooseProductPage extends Component { ...@@ -108,7 +146,6 @@ class ChooseProductPage extends Component {
let { productAuthorization, authorizations } = this.state let { productAuthorization, authorizations } = this.state
if (local_sele_pro_options && local_sele_pro_options.length > 0) { if (local_sele_pro_options && local_sele_pro_options.length > 0) {
let list = local_sele_pro_options let list = local_sele_pro_options
if (productAuthorization === 'Y') { if (productAuthorization === 'Y') {
const filterSuppliers = R.pluck('supplier_code', authorizations) const filterSuppliers = R.pluck('supplier_code', authorizations)
...@@ -120,14 +157,17 @@ class ChooseProductPage extends Component { ...@@ -120,14 +157,17 @@ class ChooseProductPage extends Component {
} }
// 之前选择过值 // 之前选择过值
that.setState({ that.setState(
{
topProcOptionList: list, topProcOptionList: list,
originManufacterList: local_sele_pro_options originManufacterList: local_sele_pro_options,
}, () => { },
() => {
if (isNotBlank(list)) { if (isNotBlank(list)) {
that.handleTopNav(list[0], 0) that.handleTopNav(list[0], 0)
} }
}) },
)
return return
} }
that.refs.LoadingModel.show() that.refs.LoadingModel.show()
...@@ -167,15 +207,18 @@ class ChooseProductPage extends Component { ...@@ -167,15 +207,18 @@ class ChooseProductPage extends Component {
} }
} }
that.setState({ that.setState(
{
topProcOptionList: list, topProcOptionList: list,
originManufacterList: topProcOptionList, originManufacterList: topProcOptionList,
}, () => { },
() => {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
if (isNotBlank(list)) { if (isNotBlank(list)) {
that.handleTopNav(list[0], 0) that.handleTopNav(list[0], 0)
} }
}) },
)
} else { } else {
this.refs.LoadingModel.hide() this.refs.LoadingModel.hide()
show('厂家数据为空,请联系管理员配置!') show('厂家数据为空,请联系管理员配置!')
...@@ -191,11 +234,14 @@ class ChooseProductPage extends Component { ...@@ -191,11 +234,14 @@ class ChooseProductPage extends Component {
let { token, global_domain_config } = that.props let { token, global_domain_config } = that.props
let { topProcOptionList, defalutLeftItem } = this.state let { topProcOptionList, defalutLeftItem } = this.state
if (topItem[LocalVariable.SELECTED_QUQNTITY] !== 0) { if (topItem[LocalVariable.SELECTED_QUQNTITY] !== 0) {
that.setState({ that.setState(
topActiveIndex: topIndex {
}, () => { topActiveIndex: topIndex,
},
() => {
that.handleLeftNav(topItem['leftOptionList'][0], 0) that.handleLeftNav(topItem['leftOptionList'][0], 0)
}) },
)
return return
} }
that.refs.LoadingModel.show() that.refs.LoadingModel.show()
...@@ -214,13 +260,16 @@ class ChooseProductPage extends Component { ...@@ -214,13 +260,16 @@ class ChooseProductPage extends Component {
leftObj[LocalVariable.LOCAL_SECOND_DATA] = [] leftObj[LocalVariable.LOCAL_SECOND_DATA] = []
}) })
topProcOptionList[topIndex] = topItem topProcOptionList[topIndex] = topItem
that.setState({ that.setState(
{
topActiveIndex: topIndex, topActiveIndex: topIndex,
topProcOptionList: topProcOptionList topProcOptionList: topProcOptionList,
}, () => { },
() => {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
that.handleLeftNav(topItem['leftOptionList'][0], 0) that.handleLeftNav(topItem['leftOptionList'][0], 0)
}) },
)
} else { } else {
that.showRrrorTip(pro_scate_search) that.showRrrorTip(pro_scate_search)
} }
...@@ -234,13 +283,15 @@ class ChooseProductPage extends Component { ...@@ -234,13 +283,15 @@ class ChooseProductPage extends Component {
that.handleChangeThrShow(false) that.handleChangeThrShow(false)
if (leftItem[LocalVariable.SELECTED_QUQNTITY] !== 0) { if (leftItem[LocalVariable.SELECTED_QUQNTITY] !== 0) {
that.setState(
that.setState({ {
leftActiveIndex: leftIndex leftActiveIndex: leftIndex,
}, () => { },
() => {
if (leftIndex) return if (leftIndex) return
this.setFilterData(topProcOptionList[topActiveIndex].leftOptionList[leftIndex].localSecondData) this.setFilterData(topProcOptionList[topActiveIndex].leftOptionList[leftIndex].localSecondData)
}) },
)
return return
} }
that.refs.LoadingModel.show() that.refs.LoadingModel.show()
...@@ -263,17 +314,23 @@ class ChooseProductPage extends Component { ...@@ -263,17 +314,23 @@ class ChooseProductPage extends Component {
console.log('res_3 : ', sur_head_search) console.log('res_3 : ', sur_head_search)
if (sur_head_search.error_code === 0) { if (sur_head_search.error_code === 0) {
if (sur_head_search.data && sur_head_search.data.surgery_template_headers) { if (sur_head_search.data && sur_head_search.data.surgery_template_headers) {
topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = that.getInitLocalSecondData(leftItem, sur_head_search.data.surgery_template_headers) topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = that.getInitLocalSecondData(
leftItem,
sur_head_search.data.surgery_template_headers,
)
this.setFilterData(topProcOptionList[topActiveIndex].leftOptionList[leftIndex].localSecondData) this.setFilterData(topProcOptionList[topActiveIndex].leftOptionList[leftIndex].localSecondData)
} else { } else {
topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = [] topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = []
} }
that.setState({ that.setState(
{
leftActiveIndex: leftIndex, leftActiveIndex: leftIndex,
topProcOptionList: topProcOptionList topProcOptionList: topProcOptionList,
}, () => { },
() => {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
}) },
)
} else { } else {
that.showRrrorTip(sur_head_search) that.showRrrorTip(sur_head_search)
} }
...@@ -292,39 +349,51 @@ class ChooseProductPage extends Component { ...@@ -292,39 +349,51 @@ class ChooseProductPage extends Component {
console.log('res_3 : ', nail_equip_head_search) console.log('res_3 : ', nail_equip_head_search)
if (nail_equip_head_search.error_code === 0) { if (nail_equip_head_search.error_code === 0) {
if (nail_equip_head_search.data && nail_equip_head_search.data.items) { if (nail_equip_head_search.data && nail_equip_head_search.data.items) {
topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = that.getInitLocalSecondData(leftItem, nail_equip_head_search.data.items) topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = that.getInitLocalSecondData(
leftItem,
nail_equip_head_search.data.items,
)
} else { } else {
topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = [] topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = []
} }
that.setState({ that.setState(
{
leftActiveIndex: leftIndex, leftActiveIndex: leftIndex,
topProcOptionList: topProcOptionList topProcOptionList: topProcOptionList,
}, () => { },
() => {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
}) },
)
} else { } else {
that.showRrrorTip(nail_equip_head_search) that.showRrrorTip(nail_equip_head_search)
} }
} else if (leftIndex === 3) { } else if (leftIndex === 3) {
let params = { let params = {
access_token: token, access_token: token,
manufacturer_code: topItem.supplier_code manufacturer_code: topItem.supplier_code,
} }
console.log('params=', params) console.log('params=', params)
let scat_head_search = await reqScatEquipmentSearch(global_domain_config, params) let scat_head_search = await reqScatEquipmentSearch(global_domain_config, params)
console.log('res_3 : ', scat_head_search) console.log('res_3 : ', scat_head_search)
if (scat_head_search.error_code === 0) { if (scat_head_search.error_code === 0) {
if (scat_head_search.data && scat_head_search.data.tools) { if (scat_head_search.data && scat_head_search.data.tools) {
topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = that.getInitLocalSecondData(leftItem, scat_head_search.data.tools) topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = that.getInitLocalSecondData(
leftItem,
scat_head_search.data.tools,
)
} else { } else {
topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = [] topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = []
} }
that.setState({ that.setState(
{
leftActiveIndex: leftIndex, leftActiveIndex: leftIndex,
topProcOptionList: topProcOptionList topProcOptionList: topProcOptionList,
}, () => { },
() => {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
}) },
)
} else { } else {
that.showRrrorTip(scat_head_search) that.showRrrorTip(scat_head_search)
} }
...@@ -334,7 +403,7 @@ class ChooseProductPage extends Component { ...@@ -334,7 +403,7 @@ class ChooseProductPage extends Component {
category_code: leftItem.category_code, category_code: leftItem.category_code,
manufacturer_code: topItem.supplier_code, manufacturer_code: topItem.supplier_code,
org_code: cur_org_code, org_code: cur_org_code,
leftIndex: leftIndex // 测试 leftIndex: leftIndex, // 测试
} }
console.log('params=', params) console.log('params=', params)
let single_all_search = await reqSingleConsumSearch(global_domain_config, params) let single_all_search = await reqSingleConsumSearch(global_domain_config, params)
...@@ -342,6 +411,7 @@ class ChooseProductPage extends Component { ...@@ -342,6 +411,7 @@ class ChooseProductPage extends Component {
if (single_all_search.error_code === 0) { if (single_all_search.error_code === 0) {
let { data } = single_all_search let { data } = single_all_search
if (data && data.items) { if (data && data.items) {
console.log('data.items', data.items)
//大-中-小类 //大-中-小类
data.items = data.items.filter(fi_item => fi_item.details && fi_item.details.length > 0) data.items = data.items.filter(fi_item => fi_item.details && fi_item.details.length > 0)
leftItem[LocalVariable.LOCAL_SECOND_DATA] = cloneObject(data.items) leftItem[LocalVariable.LOCAL_SECOND_DATA] = cloneObject(data.items)
...@@ -354,24 +424,30 @@ class ChooseProductPage extends Component { ...@@ -354,24 +424,30 @@ class ChooseProductPage extends Component {
}) })
} }
}) })
console.log('leftItem', leftItem)
} else if (data && data.details) { } else if (data && data.details) {
console.log('data.items', data.items)
//大-小类 //大-小类
leftItem[LocalVariable.LOCAL_SECOND_DATA] = cloneObject(data.details) leftItem[LocalVariable.LOCAL_SECOND_DATA] = cloneObject(data.details)
leftItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function (righDa) { leftItem[LocalVariable.LOCAL_SECOND_DATA].forEach(function (righDa) {
righDa[LocalVariable.ONLY_TWO_LEVELS] = true righDa[LocalVariable.ONLY_TWO_LEVELS] = true
righDa[LocalVariable.QUANTITY_FIELD] = 0 // 默认 righDa[LocalVariable.QUANTITY_FIELD] = 0 // 默认
}) })
console.log('leftItem', leftItem)
} else { } else {
// 空数据 // 空数据
leftItem.localSecondData = [] leftItem.localSecondData = []
} }
topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem) topProcOptionList[topActiveIndex].leftOptionList[leftIndex] = cloneObject(leftItem)
that.setState({ that.setState(
{
leftActiveIndex: leftIndex, leftActiveIndex: leftIndex,
topProcOptionList: topProcOptionList topProcOptionList: topProcOptionList,
}, () => { },
() => {
that.refs.LoadingModel.hide() that.refs.LoadingModel.hide()
}) },
)
} else { } else {
that.showRrrorTip(single_all_search) that.showRrrorTip(single_all_search)
} }
...@@ -393,7 +469,7 @@ class ChooseProductPage extends Component { ...@@ -393,7 +469,7 @@ class ChooseProductPage extends Component {
// 修改小类回调 // 修改小类回调
handleChangeThrShow(show) { handleChangeThrShow(show) {
this.setState({ this.setState({
defaultThridShow: show defaultThridShow: show,
}) })
} }
...@@ -416,6 +492,7 @@ class ChooseProductPage extends Component { ...@@ -416,6 +492,7 @@ class ChooseProductPage extends Component {
// 当前选择项 // 当前选择项
leItem[LocalVariable.SELECTED_QUQNTITY] = count leItem[LocalVariable.SELECTED_QUQNTITY] = count
const selectData = R.filter(R.compose(R.lt(0), R.prop(coutFieName)))(leItem[LocalVariable.LOCAL_SECOND_DATA]) const selectData = R.filter(R.compose(R.lt(0), R.prop(coutFieName)))(leItem[LocalVariable.LOCAL_SECOND_DATA])
console.log('selectData', selectData)
leItem.selectedArr = selectData leItem.selectedArr = selectData
// 原本是赋值给这个对象属性的,但不知道哪里这个对象属性会把第四个以后的所选耗材放到第四个上, // 原本是赋值给这个对象属性的,但不知道哪里这个对象属性会把第四个以后的所选耗材放到第四个上,
// 所以最后计算的时候使用属性 selectedArr // 所以最后计算的时候使用属性 selectedArr
...@@ -430,7 +507,7 @@ class ChooseProductPage extends Component { ...@@ -430,7 +507,7 @@ class ChooseProductPage extends Component {
// 关闭已选弹窗 // 关闭已选弹窗
handleCloseSelectModal(show) { handleCloseSelectModal(show) {
this.setState({ this.setState({
selectShowPopup: show selectShowPopup: show,
}) })
} }
...@@ -502,10 +579,14 @@ class ChooseProductPage extends Component { ...@@ -502,10 +579,14 @@ class ChooseProductPage extends Component {
top_item[LocalVariable.SELECTED_QUQNTITY] = 0 top_item[LocalVariable.SELECTED_QUQNTITY] = 0
if (top_item.leftOptionList && top_item.leftOptionList.length) { if (top_item.leftOptionList && top_item.leftOptionList.length) {
top_item.leftOptionList.forEach(function (left_item, left_index) { top_item.leftOptionList.forEach(function (left_item, left_index) {
left_item[LocalVariable.SELECTED_QUQNTITY] = 0 left_item[LocalVariable.SELECTED_QUQNTITY] = 0
if (left_item.category_code === LocalVariable.SURGICAL_TEMPLATE || left_item.category_code === LocalVariable.NAIL_BOX || left_item.category_code === LocalVariable.EQUIPMENT_BAG || left_item.category_code === LocalVariable.SCATTERED_EQUIPMENT) { if (
left_item.category_code === LocalVariable.SURGICAL_TEMPLATE ||
left_item.category_code === LocalVariable.NAIL_BOX ||
left_item.category_code === LocalVariable.EQUIPMENT_BAG ||
left_item.category_code === LocalVariable.SCATTERED_EQUIPMENT
) {
if (left_item[LocalVariable.SELECTED_DATA_ARR] && left_item[LocalVariable.SELECTED_DATA_ARR].length) { if (left_item[LocalVariable.SELECTED_DATA_ARR] && left_item[LocalVariable.SELECTED_DATA_ARR].length) {
// 加减 // 加减
left_item[LocalVariable.SELECTED_DATA_ARR].map(arr_obj => { left_item[LocalVariable.SELECTED_DATA_ARR].map(arr_obj => {
...@@ -523,7 +604,8 @@ class ChooseProductPage extends Component { ...@@ -523,7 +604,8 @@ class ChooseProductPage extends Component {
} }
}) })
// 清空 // 清空
if (cur_no_clear.length === 0 || if (
cur_no_clear.length === 0 ||
(left_item.category_code === LocalVariable.SURGICAL_TEMPLATE && localSurgicalOpts.length === 0) || (left_item.category_code === LocalVariable.SURGICAL_TEMPLATE && localSurgicalOpts.length === 0) ||
(left_item.category_code === LocalVariable.NAIL_BOX && localNailOpts.length === 0) || (left_item.category_code === LocalVariable.NAIL_BOX && localNailOpts.length === 0) ||
(left_item.category_code === LocalVariable.EQUIPMENT_BAG && localQuipmentOpts.length === 0) || (left_item.category_code === LocalVariable.EQUIPMENT_BAG && localQuipmentOpts.length === 0) ||
...@@ -545,30 +627,42 @@ class ChooseProductPage extends Component { ...@@ -545,30 +627,42 @@ class ChooseProductPage extends Component {
left_item[LocalVariable.SELECTED_DATA_ARR] = [] left_item[LocalVariable.SELECTED_DATA_ARR] = []
if (localSignOpts && localSignOpts.length) { if (localSignOpts && localSignOpts.length) {
localSignOpts.forEach((sign_obj, sign_index) => { localSignOpts.forEach((sign_obj, sign_index) => {
if (sign_obj.supplier_code === top_item.supplier_code && sign_obj[LocalVariable.CHILDREN_LINE_NAME] && sign_obj[LocalVariable.CHILDREN_LINE_NAME].length > 0) { if (
sign_obj.supplier_code === top_item.supplier_code &&
sign_obj[LocalVariable.CHILDREN_LINE_NAME] &&
sign_obj[LocalVariable.CHILDREN_LINE_NAME].length > 0
) {
sign_obj[LocalVariable.CHILDREN_LINE_NAME].forEach((si_line, si_ind) => { sign_obj[LocalVariable.CHILDREN_LINE_NAME].forEach((si_line, si_ind) => {
if (si_line.left_category_code === left_item.category_code) { if (si_line.left_category_code === left_item.category_code) {
left_item[LocalVariable.SELECTED_DATA_ARR].push(si_line) left_item[LocalVariable.SELECTED_DATA_ARR].push(si_line)
left_item[LocalVariable.SELECTED_QUQNTITY] += si_line[LocalVariable.QUANTITY_FIELD] left_item[LocalVariable.SELECTED_QUQNTITY] += si_line[LocalVariable.QUANTITY_FIELD]
} }
}) })
} }
}) })
} }
if (left_item[LocalVariable.LOCAL_SECOND_DATA] && left_item[LocalVariable.LOCAL_SECOND_DATA].length) { if (left_item[LocalVariable.LOCAL_SECOND_DATA] && left_item[LocalVariable.LOCAL_SECOND_DATA].length) {
left_item[LocalVariable.LOCAL_SECOND_DATA].forEach(function (loc_da, loc_ind) { left_item[LocalVariable.LOCAL_SECOND_DATA].forEach(function (loc_da, loc_ind) {
if (left_item[LocalVariable.SELECTED_DATA_ARR] && left_item[LocalVariable.SELECTED_DATA_ARR].length === 0) { if (
left_item[LocalVariable.SELECTED_DATA_ARR] &&
left_item[LocalVariable.SELECTED_DATA_ARR].length === 0
) {
loc_da[LocalVariable.QUANTITY_FIELD] = 0 loc_da[LocalVariable.QUANTITY_FIELD] = 0
if (loc_da.details && loc_da.details.length) { if (loc_da.details && loc_da.details.length) {
loc_da.details.forEach(function (det_item) { loc_da.details.forEach(function (det_item) {
det_item[LocalVariable.QUANTITY_FIELD] = 0 det_item[LocalVariable.QUANTITY_FIELD] = 0
}) })
} }
} else if (left_item[LocalVariable.SELECTED_DATA_ARR] && left_item[LocalVariable.SELECTED_DATA_ARR].length) { } else if (
left_item[LocalVariable.SELECTED_DATA_ARR] &&
left_item[LocalVariable.SELECTED_DATA_ARR].length
) {
let hasSignFlag = false let hasSignFlag = false
left_item[LocalVariable.SELECTED_DATA_ARR].map((se_sign) => { left_item[LocalVariable.SELECTED_DATA_ARR].map(se_sign => {
if ((loc_da.details && se_sign.details && loc_da.category_code === se_sign.category_code) || (!se_sign.details && loc_da.item_code === se_sign.item_code)) { if (
(loc_da.details && se_sign.details && loc_da.category_code === se_sign.category_code) ||
(!se_sign.details && loc_da.item_code === se_sign.item_code)
) {
loc_da = se_sign loc_da = se_sign
hasSignFlag = true hasSignFlag = true
} }
...@@ -591,9 +685,8 @@ class ChooseProductPage extends Component { ...@@ -591,9 +685,8 @@ class ChooseProductPage extends Component {
} }
}) })
this.setState({ this.setState({
topProcOptionList: topProcOptionList topProcOptionList: topProcOptionList,
}) })
} }
// 已选修改回调 // 已选修改回调
...@@ -607,7 +700,7 @@ class ChooseProductPage extends Component { ...@@ -607,7 +700,7 @@ class ChooseProductPage extends Component {
} }
}) })
this.setState({ this.setState({
topProcOptionList topProcOptionList,
}) })
} }
...@@ -633,7 +726,7 @@ class ChooseProductPage extends Component { ...@@ -633,7 +726,7 @@ class ChooseProductPage extends Component {
} }
}) })
this.setState({ this.setState({
topProcOptionList: topProcOptionList topProcOptionList: topProcOptionList,
}) })
} }
...@@ -641,41 +734,44 @@ class ChooseProductPage extends Component { ...@@ -641,41 +734,44 @@ class ChooseProductPage extends Component {
showRrrorTip(result) { showRrrorTip(result) {
this.refs.LoadingModel.hide() this.refs.LoadingModel.hide()
if (result.error_code == 41006) { if (result.error_code == 41006) {
show('登录过期,请重新登录'); show('登录过期,请重新登录')
this.props.exitLoginStatus(); this.props.exitLoginStatus()
} else { } else {
let error_msg = result.error_msg || result.message let error_msg = result.error_msg || result.message
show(error_msg); show(error_msg)
} }
} }
setFilterData(localSecondData) { setFilterData(localSecondData) {
let options = R.compose( let options = R.compose(
R.groupBy(R.prop('value')), R.groupBy(R.prop('value')),
R.map(R.applySpec({ R.map(
R.applySpec({
label: R.prop('surgery_type_name'), label: R.prop('surgery_type_name'),
value: R.prop('surgery_type') value: R.prop('surgery_type'),
}) }),
), R.clone)(localSecondData) ),
R.clone,
)(localSecondData)
options = R.compose( options = R.compose(
R.map( k => ({value: k, label: options[k][0].label})), R.map(k => ({ value: k, label: options[k][0].label })),
R.filter(R.allPass([isNotBlank, R.complement(R.equals)('undefined')])), R.filter(R.allPass([isNotBlank, R.complement(R.equals)('undefined')])),
R.keys R.keys,
)(options) )(options)
const {filterData} = this.state const { filterData } = this.state
filterData[0].value = '' filterData[0].value = ''
filterData[0].options = options filterData[0].options = options
this.setState({filterData}) this.setState({ filterData })
} }
inputSearchValue(text) { inputSearchValue(text) {
this.setState({searchValue: text}) this.setState({ searchValue: text })
} }
fillterCallback(key, value) { fillterCallback(key, value) {
const {filterData} = this.state const { filterData } = this.state
const filter = R.find(R.propEq('field', key))(filterData) const filter = R.find(R.propEq('field', key))(filterData)
if (!filter) return if (!filter) return
filter.value = value filter.value = value
...@@ -688,7 +784,7 @@ class ChooseProductPage extends Component { ...@@ -688,7 +784,7 @@ class ChooseProductPage extends Component {
* @return {*} * @return {*}
*/ */
rightFilter(list = []) { rightFilter(list = []) {
const {filterData, authorizations, productAuthorization, topActiveIndex, topProcOptionList} = this.state const { filterData, authorizations, productAuthorization, topActiveIndex, topProcOptionList } = this.state
if (productAuthorization === 'Y') { if (productAuthorization === 'Y') {
const curSupplier = topProcOptionList[topActiveIndex] const curSupplier = topProcOptionList[topActiveIndex]
...@@ -701,7 +797,8 @@ class ChooseProductPage extends Component { ...@@ -701,7 +797,8 @@ class ChooseProductPage extends Component {
} }
} }
R.compose(R.map(filter => { R.compose(
R.map(filter => {
const value = filter.value const value = filter.value
if (isNotBlank(value)) { if (isNotBlank(value)) {
const reg = new RegExp(value, 'g') const reg = new RegExp(value, 'g')
...@@ -709,7 +806,8 @@ class ChooseProductPage extends Component { ...@@ -709,7 +806,8 @@ class ChooseProductPage extends Component {
return R.test(reg, item[filter.field]) return R.test(reg, item[filter.field])
}, list) }, list)
} }
}))(filterData) }),
)(filterData)
return list return list
} }
...@@ -721,9 +819,9 @@ class ChooseProductPage extends Component { ...@@ -721,9 +819,9 @@ class ChooseProductPage extends Component {
* @return {*} * @return {*}
*/ */
rightNameFilter(list = [], isChildFilter = false, isOperation = false) { rightNameFilter(list = [], isChildFilter = false, isOperation = false) {
if(isBlank(list)) return [] if (isBlank(list)) return []
const {searchValue, authorizations, productAuthorization, topActiveIndex, topProcOptionList } = this.state const { searchValue, authorizations, productAuthorization, topActiveIndex, topProcOptionList } = this.state
if (productAuthorization === 'Y') { if (productAuthorization === 'Y') {
const curSupplier = topProcOptionList[topActiveIndex] const curSupplier = topProcOptionList[topActiveIndex]
const auth = R.find(R.propEq('supplier_code', curSupplier.supplier_code))(authorizations) const auth = R.find(R.propEq('supplier_code', curSupplier.supplier_code))(authorizations)
...@@ -742,18 +840,22 @@ class ChooseProductPage extends Component { ...@@ -742,18 +840,22 @@ class ChooseProductPage extends Component {
return list return list
} }
if (isOperation) {
return list
}
if (isBlank(searchValue)) return list if (isBlank(searchValue)) return list
const keys = ['general_name', 'item_name', 'specification', 'manufacturer_product_code', 'initials_pinyin', 'serial_number', 'category_name'] const keys = [
'general_name',
'item_name',
'specification',
'manufacturer_product_code',
'initials_pinyin',
'serial_number',
'category_name',
]
const includes = item => { const includes = item => {
const preds = R.compose( const preds = R.compose(
R.map(val => R.includes(R.__, val)), R.map(val => R.includes(R.__, val)),
R.filter(isNotBlank), R.filter(isNotBlank),
R.map(key => item[key]) R.map(key => item[key]),
)(keys) )(keys)
return R.anyPass(preds)(searchValue) return R.anyPass(preds)(searchValue)
} }
...@@ -763,30 +865,100 @@ class ChooseProductPage extends Component { ...@@ -763,30 +865,100 @@ class ChooseProductPage extends Component {
// 返回搜索元素 // 返回搜索元素
renderSearchItem() { renderSearchItem() {
const {leftActiveIndex, filterData} = this.state const { navigation } = this.props
if (leftActiveIndex) { const { authorizations, topProcOptionList, topActiveIndex } = this.state
let cur_org_code = ''
if (navigation.state.params.selfData) {
cur_org_code = navigation.state.params.selfData.org_code
}
// if (leftActiveIndex) {
return ( return (
<TouchableOpacity
onPress={() => {
navigation.navigate('SearchPage', {
title: `选择产品`,
topProcOptionList,
topActiveIndex,
title: '搜索',
setTopProcOptionListCallBack: setTopProcOptionList => {
console.log('click')
setTopProcOptionList.then(topProcOptionList => {
console.log('addSuccess')
this.setState(
{
topProcOptionList: [...topProcOptionList],
},
// () => {
// console.log('goback')
// this.props.navigation.goBack()
// },
)
})
},
selfData: {
org_code: cur_org_code,
authorizations,
},
})
}}
>
<View style={list_common_item.ser_cont}> <View style={list_common_item.ser_cont}>
<TextInput <View style={list_common_item.ser_text_input}></View>
placeholder={'请输入搜索关键词'}
style={list_common_item.ser_text_input}
defaultValue={this.state.searchValue}
onChangeText={(text) => this.inputSearchValue(text)}
/>
<View style={list_common_item.ser_img_box}> <View style={list_common_item.ser_img_box}>
<Image source={require('../../../images/search_icon.png')} style={icon_style} /> <Image source={require('../../../images/search_icon.png')} style={icon_style} />
</View> </View>
</View> </View>
</TouchableOpacity>
) )
} else { // } else {
return <ChooseFilter filterData={filterData} onCallback={this.fillterCallback.bind(this)}/> // return (
} // <View>
// <TouchableOpacity
// onPress={() => {
// navigation.navigate('SearchPage', {
// title: `选择产品`,
// topProcOptionList,
// title: '搜索',
// setTopProcOptionListCallBack: setTopProcOptionList => {
// console.log('click')
// setTopProcOptionList.then(topProcOptionList => {
// console.log('addSuccess')
// this.setState(
// {
// topProcOptionList: [...topProcOptionList],
// },
// // () => {
// // console.log('goback')
// // this.props.navigation.goBack()
// // },
// )
// })
// },
// selfData: {
// org_code: cur_org_code,
// authorizations,
// },
// })
// }}
// >
// <View style={list_common_item.ser_cont}>
// <View style={list_common_item.ser_text_input}></View>
// <View style={list_common_item.ser_img_box}>
// <Image source={require('../../../images/search_icon.png')} style={icon_style} />
// </View>
// </View>
// </TouchableOpacity>
// <ChooseFilter filterData={filterData} onCallback={this.fillterCallback.bind(this)} />
// </View>
// )
// }
} }
// 返回顶部厂家 // 返回顶部厂家
renderTopProItem() { renderTopProItem() {
let { topProcOptionList, topActiveIndex } = this.state let { topProcOptionList, topActiveIndex } = this.state
let cur_title = 'title', cur_icon = 'iconImg' let cur_title = 'title',
cur_icon = 'iconImg'
cur_title = 'supplier_short_name' cur_title = 'supplier_short_name'
cur_icon = 'supplier_icon' cur_icon = 'supplier_icon'
...@@ -821,7 +993,8 @@ class ChooseProductPage extends Component { ...@@ -821,7 +993,8 @@ class ChooseProductPage extends Component {
if (topProcOptionList.length > 0) { if (topProcOptionList.length > 0) {
curLeftOptions = topProcOptionList[topActiveIndex].leftOptionList curLeftOptions = topProcOptionList[topActiveIndex].leftOptionList
} }
let cur_title = 'title', cur_icon = 'iconImg' let cur_title = 'title',
cur_icon = 'iconImg'
cur_title = 'category_name' cur_title = 'category_name'
cur_icon = 'cate_local_icon' cur_icon = 'cate_local_icon'
...@@ -870,12 +1043,12 @@ class ChooseProductPage extends Component { ...@@ -870,12 +1043,12 @@ class ChooseProductPage extends Component {
return ( return (
<View style={styles.cont_bom_box}> <View style={styles.cont_bom_box}>
{ this.renderContLeftItem()} {this.renderContLeftItem()}
<ProductRightStyle <ProductRightStyle
navigation={this.props.navigation} navigation={this.props.navigation}
leftIndex={leftActiveIndex} leftIndex={leftActiveIndex}
defaultThridShow={defaultThridShow} defaultThridShow={defaultThridShow}
changeThrShow={(defaultThridShow) => this.handleChangeThrShow(defaultThridShow)} changeThrShow={defaultThridShow => this.handleChangeThrShow(defaultThridShow)}
superStencilData={curRigSecoOption} superStencilData={curRigSecoOption}
superCallBack={(count, coutFieName) => this.handleChangeCount(count, coutFieName)} superCallBack={(count, coutFieName) => this.handleChangeCount(count, coutFieName)}
superReduceBack={() => this.handleSubSelected()} superReduceBack={() => this.handleSubSelected()}
...@@ -888,7 +1061,16 @@ class ChooseProductPage extends Component { ...@@ -888,7 +1061,16 @@ class ChooseProductPage extends Component {
// 返回底部按钮 // 返回底部按钮
renderFooterBtnItem() { renderFooterBtnItem() {
let { selectShowPopup, topProcOptionList, topActiveIndex, leftActiveIndex, filterData, local_sel_options, local_cur_options, cur_hc_opts} = this.state let {
selectShowPopup,
topProcOptionList,
topActiveIndex,
leftActiveIndex,
filterData,
local_sel_options,
local_cur_options,
cur_hc_opts,
} = this.state
let allCountQuantity = this.getAllCountQuantity() let allCountQuantity = this.getAllCountQuantity()
let cur_sel_options = [] let cur_sel_options = []
let sel_tip = this.getAllCountQuantity(true) let sel_tip = this.getAllCountQuantity(true)
...@@ -901,12 +1083,13 @@ class ChooseProductPage extends Component { ...@@ -901,12 +1083,13 @@ class ChooseProductPage extends Component {
let leftOptionList = top_item.leftOptionList let leftOptionList = top_item.leftOptionList
leftOptionList.map(left_item => { leftOptionList.map(left_item => {
if (left_item[LocalVariable.SELECTED_QUQNTITY] > 0) { if (left_item[LocalVariable.SELECTED_QUQNTITY] > 0) {
console.log('left_item', left_item)
let cur_line_obj = { let cur_line_obj = {
supplier_code: top_item.supplier_code, supplier_code: top_item.supplier_code,
supplier_name: top_item.supplier_name, supplier_name: top_item.supplier_name,
supplier_short_name: top_item.supplier_short_name, supplier_short_name: top_item.supplier_short_name,
[LocalVariable.SELECTED_QUQNTITY]: left_item[LocalVariable.SELECTED_QUQNTITY], [LocalVariable.SELECTED_QUQNTITY]: left_item[LocalVariable.SELECTED_QUQNTITY],
[LocalVariable.CHILDREN_LINE_NAME]: left_item[LocalVariable.SELECTED_DATA_ARR] [LocalVariable.CHILDREN_LINE_NAME]: left_item[LocalVariable.SELECTED_DATA_ARR],
} }
let localNotSign = false let localNotSign = false
for (let selOpts of cur_sel_options) { for (let selOpts of cur_sel_options) {
...@@ -923,9 +1106,18 @@ class ChooseProductPage extends Component { ...@@ -923,9 +1106,18 @@ class ChooseProductPage extends Component {
// 耗材 // 耗材
cur_line_obj.category_code = cur_sel_options[cur_sel_options.length - 1].category_code cur_line_obj.category_code = cur_sel_options[cur_sel_options.length - 1].category_code
cur_line_obj.category_name = cur_sel_options[cur_sel_options.length - 1].category_name cur_line_obj.category_name = cur_sel_options[cur_sel_options.length - 1].category_name
cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_QUQNTITY] += cur_line_obj[LocalVariable.SELECTED_QUQNTITY] cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_QUQNTITY] +=
cur_line_obj[LocalVariable.SELECTED_QUQNTITY]
console.log(
'cur_line_obj[LocalVariable.CHILDREN_LINE_NAME]',
cur_line_obj[LocalVariable.CHILDREN_LINE_NAME],
)
if (cur_line_obj[LocalVariable.CHILDREN_LINE_NAME] && cur_line_obj[LocalVariable.CHILDREN_LINE_NAME].length > 0) { if (
cur_line_obj[LocalVariable.CHILDREN_LINE_NAME] &&
cur_line_obj[LocalVariable.CHILDREN_LINE_NAME].length > 0
) {
cur_line_obj[LocalVariable.CHILDREN_LINE_NAME].map(function (li_obj) { cur_line_obj[LocalVariable.CHILDREN_LINE_NAME].map(function (li_obj) {
li_obj.left_category_code = left_item.category_code li_obj.left_category_code = left_item.category_code
li_obj.left_category_name = left_item.category_name li_obj.left_category_name = left_item.category_name
...@@ -934,48 +1126,52 @@ class ChooseProductPage extends Component { ...@@ -934,48 +1126,52 @@ class ChooseProductPage extends Component {
cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].push(cur_line_obj) cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].push(cur_line_obj)
} }
} }
}) })
} }
}) })
let cur_hc_arr = [], cur_obj = {} let cur_hc_arr = [],
cur_obj = {}
cur_hc_arr = cloneObject(cur_hc_opts) cur_hc_arr = cloneObject(cur_hc_opts)
if(cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].length >0) { if (cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].length > 0) {
cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].forEach((hc_item, hc_ind) => { cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].forEach((hc_item, hc_ind) => {
let curHasSup = cur_hc_arr.filter(su_obj => su_obj.supplier_code === hc_item.supplier_code) let curHasSup = cur_hc_arr.filter(su_obj => su_obj.supplier_code === hc_item.supplier_code)
if(curHasSup.length === 0){ if (curHasSup.length === 0) {
cur_hc_arr.push(hc_item) cur_hc_arr.push(hc_item)
}else { } else {
console.log('curHasSup', curHasSup)
cur_hc_arr.map(function (end_item) { cur_hc_arr.map(function (end_item) {
if(end_item.supplier_code === hc_item.supplier_code){ if (end_item.supplier_code === hc_item.supplier_code) {
end_item[LocalVariable.SELECTED_QUQNTITY] += hc_item[LocalVariable.SELECTED_QUQNTITY] end_item[LocalVariable.SELECTED_QUQNTITY] += hc_item[LocalVariable.SELECTED_QUQNTITY]
for(let line_obj of hc_item[LocalVariable.CHILDREN_LINE_NAME]){ for (let line_obj of hc_item[LocalVariable.CHILDREN_LINE_NAME]) {
let cur_fil = end_item[LocalVariable.CHILDREN_LINE_NAME].filter(fi_obj => { let cur_fil = end_item[LocalVariable.CHILDREN_LINE_NAME].filter(fi_obj => {
if(fi_obj.details && fi_obj.details.length > 0){ if (fi_obj.details && fi_obj.details.length > 0) {
return fi_obj.category_code === line_obj.category_code return fi_obj.category_code === line_obj.category_code
}else { } else {
return fi_obj.item_code === line_obj.item_code return fi_obj.item_code === line_obj.item_code
} }
}) })
if(cur_fil.length === 0 && line_obj[LocalVariable.QUANTITY_FIELD] > 0){ if (cur_fil.length === 0 && line_obj[LocalVariable.QUANTITY_FIELD] > 0) {
end_item[LocalVariable.CHILDREN_LINE_NAME].push(line_obj) end_item[LocalVariable.CHILDREN_LINE_NAME].push(line_obj)
} }
} }
end_item[LocalVariable.CHILDREN_LINE_NAME] = end_item[LocalVariable.CHILDREN_LINE_NAME].filter(fil_ob => fil_ob[LocalVariable.QUANTITY_FIELD] > 0) end_item[LocalVariable.CHILDREN_LINE_NAME] = end_item[LocalVariable.CHILDREN_LINE_NAME].filter(
fil_ob => fil_ob[LocalVariable.QUANTITY_FIELD] > 0,
)
} }
}) })
} }
}) })
cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR] = cur_hc_arr cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR] = cur_hc_arr
} }
} }
console.log('cur_sel_options', cur_sel_options)
return ( return (
<View style={list_common_item.sub_box}> <View style={list_common_item.sub_box}>
<View style={list_common_item.sub_two_btn}> <View style={list_common_item.sub_two_btn}>
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={[list_common_item.lef_btn, styles.fo_btn_lef]} style={[list_common_item.lef_btn, styles.fo_btn_lef]}
onPress={() => this.handleSubSelected()} onPress={() => this.handleSubSelected()}
> >
...@@ -983,38 +1179,33 @@ class ChooseProductPage extends Component { ...@@ -983,38 +1179,33 @@ class ChooseProductPage extends Component {
{allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'已选: '}</Text>} {allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'已选: '}</Text>}
{allCountQuantity === 0 ? null : <Text style={styles.lef_tip_txt}>{sel_tip}</Text>} {allCountQuantity === 0 ? null : <Text style={styles.lef_tip_txt}>{sel_tip}</Text>}
</Text> </Text>
{allCountQuantity === 0 ? null : <View style={styles.lef_btn_num}> {allCountQuantity === 0 ? null : (
<View style={styles.lef_btn_num}>
<Text style={styles.lef_num_txt}>{allCountQuantity}</Text> <Text style={styles.lef_num_txt}>{allCountQuantity}</Text>
</View>} </View>
)}
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity activeOpacity={0.8} style={list_common_item.rig_btn} onPress={() => this.handleSubmit()}>
activeOpacity={.8}
style={list_common_item.rig_btn}
onPress={() => this.handleSubmit()}
>
<Text style={list_common_item.rig_tip}>{'选好了'}</Text> <Text style={list_common_item.rig_tip}>{'选好了'}</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<ProductModel <ProductModel
show={selectShowPopup} show={selectShowPopup}
closeModal={(show) => this.handleCloseSelectModal(show)} closeModal={show => this.handleCloseSelectModal(show)}
closeSubmit={() => this.handleSubmit()} closeSubmit={() => this.handleSubmit()}
modelOption={cur_sel_options} modelOption={cur_sel_options}
modelCallBack={(options) => this.handleSelectCallBack(options)} modelCallBack={options => this.handleSelectCallBack(options)}
clearRubbish={() => this.handleClearRubbish()} clearRubbish={() => this.handleClearRubbish()}
changeCallBack={(options, clearFlag) => this.handleChangeCallBack(options, clearFlag)} changeCallBack={(options, clearFlag) => this.handleChangeCallBack(options, clearFlag)}
/> />
{ this.renderLodingItem()} {this.renderLodingItem()}
</View> </View>
) )
} }
// 返回加载中 // 返回加载中
renderLodingItem() { renderLodingItem() {
return ( return <LoadingModel ref="LoadingModel" />
<LoadingModel ref="LoadingModel" />
)
} }
render() { render() {
...@@ -1023,31 +1214,29 @@ class ChooseProductPage extends Component { ...@@ -1023,31 +1214,29 @@ class ChooseProductPage extends Component {
let { topProcOptionList, leftActiveIndex, filterData } = this.state let { topProcOptionList, leftActiveIndex, filterData } = this.state
return ( return (
<View style={styles.choo_container}> <View style={styles.choo_container}>
<StatusBarView <StatusBarView isReactStackNavigator={true} backgroundColor={promary_color} barStyle="light-content" />
isReactStackNavigator={true} <View style={safe_view}>
backgroundColor={promary_color}
barStyle='light-content'
/>
<View style={safe_view} >
<HeadBackItem title={title} navigation={navigation} callback={() => this.handleGoBack()} /> <HeadBackItem title={title} navigation={navigation} callback={() => this.handleGoBack()} />
<View style={!leftActiveIndex ?[styles.choo_main, styles.choo_main_pd]: styles.choo_main} pointerEvents="auto"> <View
style={!leftActiveIndex ? [styles.choo_main, styles.choo_main_pd] : styles.choo_main}
pointerEvents="auto"
>
{this.renderSearchItem()} {this.renderSearchItem()}
{topProcOptionList && topProcOptionList.length > 0 ? this.renderTopProItem() : null} {topProcOptionList && topProcOptionList.length > 0 ? this.renderTopProItem() : null}
{topProcOptionList && topProcOptionList.length > 0 ? this.renderContItem() : null} {topProcOptionList && topProcOptionList.length > 0 ? this.renderContItem() : null}
</View> </View>
{this.renderFooterBtnItem()} {this.renderFooterBtnItem()}
{/* {!leftActiveIndex && <ChooseFilter filterData={filterData} onCallback={this.fillterCallback.bind(this)}/>} */} {/* {!leftActiveIndex && <ChooseFilter filterData={filterData} onCallback={this.fillterCallback.bind(this)}/>} */}
</View> </View>
</View> </View>
); )
} }
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
choo_container: { choo_container: {
flex: 1, flex: 1,
backgroundColor: home_background_color backgroundColor: home_background_color,
}, },
choo_main: { choo_main: {
flex: 1, flex: 1,
...@@ -1063,19 +1252,19 @@ const styles = StyleSheet.create({ ...@@ -1063,19 +1252,19 @@ const styles = StyleSheet.create({
paddingHorizontal: 20, paddingHorizontal: 20,
paddingTop: 12, paddingTop: 12,
borderBottomColor: '#F4F4F4', borderBottomColor: '#F4F4F4',
borderBottomWidth: 1 borderBottomWidth: 1,
}, },
top_scroll_cont: {}, top_scroll_cont: {},
top_inner: { top_inner: {
borderBottomColor: foundation_color, borderBottomColor: foundation_color,
minWidth: 60, minWidth: 60,
paddingBottom: 10 paddingBottom: 10,
}, },
top_inner_act: {}, top_inner_act: {},
top_tit: {}, top_tit: {},
top_tit_act: {}, top_tit_act: {},
top_cot_num: { top_cot_num: {
right: 8 right: 8,
}, },
cont_bom_box: { cont_bom_box: {
position: 'relative', position: 'relative',
...@@ -1086,10 +1275,10 @@ const styles = StyleSheet.create({ ...@@ -1086,10 +1275,10 @@ const styles = StyleSheet.create({
width: 80, width: 80,
height: '100%', height: '100%',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center' alignItems: 'center',
}, },
cont_left_scroll_cont: { cont_left_scroll_cont: {
width: '100%' width: '100%',
}, },
cont_left_inner: { cont_left_inner: {
flexDirection: 'row', flexDirection: 'row',
...@@ -1099,27 +1288,27 @@ const styles = StyleSheet.create({ ...@@ -1099,27 +1288,27 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
borderWidth: 0, borderWidth: 0,
width: '100%', width: '100%',
borderBottomWidth: 0 borderBottomWidth: 0,
}, },
cont_left_inner_act: { cont_left_inner_act: {
backgroundColor: foundation_color, backgroundColor: foundation_color,
borderBottomWidth: 0, borderBottomWidth: 0,
borderBottomColor: null borderBottomColor: null,
}, },
cont_left_img_box: { cont_left_img_box: {
width: pxSize(14), width: pxSize(14),
height: pxSize(14), height: pxSize(14),
marginRight: 4, marginRight: 4,
marginLeft: 6, marginLeft: 6,
marginBottom: 5 marginBottom: 5,
}, },
cont_left_tit: {}, cont_left_tit: {},
cont_left_noicon: { cont_left_noicon: {
textAlign: 'center', textAlign: 'center',
paddingHorizontal: 14 paddingHorizontal: 14,
}, },
cont_left_tit_act: { cont_left_tit_act: {
fontSize: third_text_size fontSize: third_text_size,
}, },
sub_box: { sub_box: {
width: Width(), width: Width(),
...@@ -1128,49 +1317,49 @@ const styles = StyleSheet.create({ ...@@ -1128,49 +1317,49 @@ const styles = StyleSheet.create({
shadowColor: '#E5E5E5', shadowColor: '#E5E5E5',
shadowOffset: { shadowOffset: {
width: 1, width: 1,
height: 2 height: 2,
}, },
shadowOpacity: 1, shadowOpacity: 1,
elevation: 10, elevation: 10,
height: 80 height: 80,
}, },
sub_two_btn: { sub_two_btn: {
width: Width(), width: Width(),
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
paddingHorizontal: 30, paddingHorizontal: 30,
paddingVertical: 14 paddingVertical: 14,
}, },
lef_btn: { lef_btn: {
backgroundColor: '#4F4F4F', backgroundColor: '#4F4F4F',
width: '66%', width: '66%',
borderTopLeftRadius: 10, borderTopLeftRadius: 10,
borderBottomLeftRadius: 10, borderBottomLeftRadius: 10,
height: 50 height: 50,
}, },
lef_tip: { lef_tip: {
color: title_text_color, color: title_text_color,
lineHeight: 48, lineHeight: 48,
paddingLeft: 20, paddingLeft: 20,
fontSize: 16, fontSize: 16,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
rig_btn: { rig_btn: {
backgroundColor: promary_color, backgroundColor: promary_color,
width: '34%', width: '34%',
borderTopRightRadius: 10, borderTopRightRadius: 10,
borderBottomRightRadius: 10, borderBottomRightRadius: 10,
height: 50 height: 50,
}, },
rig_tip: { rig_tip: {
color: title_text_color, color: title_text_color,
lineHeight: 48, lineHeight: 48,
textAlign: 'center', textAlign: 'center',
fontSize: 16, fontSize: 16,
fontFamily: font_family_medium fontFamily: font_family_medium,
}, },
fo_btn_lef: { fo_btn_lef: {
position: 'relative' position: 'relative',
}, },
lef_btn_num: { lef_btn_num: {
position: 'absolute', position: 'absolute',
...@@ -1183,32 +1372,32 @@ const styles = StyleSheet.create({ ...@@ -1183,32 +1372,32 @@ const styles = StyleSheet.create({
fontSize: 12, fontSize: 12,
color: title_text_color, color: title_text_color,
minWidth: 16, minWidth: 16,
textAlign: 'center' textAlign: 'center',
}, },
lef_tip_txt: { lef_tip_txt: {
fontSize: 12 fontSize: 12,
} },
}) })
const mapStateToProps = (state) => { const mapStateToProps = state => {
return { return {
userInfo: state.login.userInfo, userInfo: state.login.userInfo,
token: state.login.token, token: state.login.token,
loginState: state.login.loginState, loginState: state.login.loginState,
global_domain_config: state.login.global_domain_config, global_domain_config: state.login.global_domain_config,
local_sele_pro_options: state.selfOrder.local_sele_pro_options local_sele_pro_options: state.selfOrder.local_sele_pro_options,
} }
} }
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = dispatch => {
return { return {
exitLoginStatus: () => { exitLoginStatus: () => {
dispatch(exitLoginStatus()) dispatch(exitLoginStatus())
}, },
setSelectProductOpts: (data) => { setSelectProductOpts: data => {
dispatch(setSelectProductOpts(data)) dispatch(setSelectProductOpts(data))
} },
} }
} }
export default connect(mapStateToProps, mapDispatchToProps)(ChooseProductPage); export default connect(mapStateToProps, mapDispatchToProps)(ChooseProductPage)
import React, { Component } from 'react'
import { icon_style, list_common_item, safe_view, foundation_color } from '../../../base/BaseStyle'
import {
View,
StyleSheet,
Image,
TextInput,
SafeAreaView,
ScrollView,
FlatList,
Text,
TouchableOpacity,
} from 'react-native'
import HeadBackItem from '../../common/HeadBackItem'
import { PicListNoData } from '../../common/CellTextStyle'
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu'
import LocalVariable from '../../common/LocalVariable'
import { reqGlobalSearch, reqSingleConsumSearch, reqProCategorySearch } from '../../../action/SelfAction'
import ChooseCardList from '../../common/listDataComponent/ChooseCardList'
import { connect } from 'react-redux'
// import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import LoadingModel from '../../common/listDataComponent/LoadingModel'
import { Width } from '../../../base/BaseStyle'
import { show } from '../../../utils/Utils'
import * as R from 'ramda'
class SearchPage extends Component {
constructor(props) {
super(props)
this.state = {
defalutLeftItem: [
{
category_code: LocalVariable.SURGICAL_TEMPLATE,
category_name: '手术套包',
cate_local_icon: require('../../../images/surg_temp.png'),
},
{
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'),
},
],
searchValue: '',
data: {
item: [],
total: 0,
},
page: 1,
}
// this.inputSearchValue = debounce(this.inputSearchValue.bind(this), 1000)
}
componentDidMount() {
const { navigation } = this.props
console.log('navigation', navigation)
const { topActiveIndex } = navigation.state.params
this.setState({
topActiveIndex,
})
// this.getSearchData()
}
initData() {
this.setState(
{
data: {
item: [],
total: 0,
},
page: 1,
},
() => {
this.getSearchData()
},
)
}
// 上拉刷新
onMomentumScrollEnd = event => {
const offSetY = event.nativeEvent.contentOffset.y // 获取滑动的距离
const contentSizeHeight = event.nativeEvent.contentSize.height // scrollView contentSize 高度
const oriageScrollHeight = event.nativeEvent.layoutMeasurement.height // scrollView高度
const { page, data } = this.state
if (offSetY + oriageScrollHeight >= contentSizeHeight - 400) {
if (data.item.length < data.total) {
this.setState(
{
page: page + 1,
},
() => {
this.getSearchData()
},
)
}
}
}
// 获取搜索数据
async getSearchData() {
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 productLineCategory = authorizations?.product_line_category_list
?.map(item => item.product_line_category_code)
?.join(',')
console.log('topProcOptionList', topProcOptionList[topActiveIndex])
const params = {
accessToken: token,
orgCode: selfData.org_code,
manufacturerCode: topProcOptionList[topActiveIndex].supplier_code,
productLineCategory,
keyword: encodeURIComponent(searchValue),
page,
}
this.refs.LoadingModel.show()
const single_all_search = await reqGlobalSearch(global_domain_config, JSON.parse(JSON.stringify(params)))
this.refs.LoadingModel.hide()
console.log('single_all_search', single_all_search)
const oldData = data.item
this.setState({
data: {
...single_all_search?.data,
item: [...oldData, ...single_all_search?.data.item],
},
})
}
// 获取搜索到的类目
async getLeftOptionList(item) {
const { navigation, global_domain_config, token } = this.props
const { topProcOptionList } = navigation.state.params
const { defalutLeftItem, topActiveIndex } = this.state
const params = {
access_token: token,
manufacturer_code: topProcOptionList[topActiveIndex].supplier_code,
}
console.log('params=', params)
this.refs.LoadingModel.show()
const pro_scate_search = await reqProCategorySearch(global_domain_config, params)
this.refs.LoadingModel.hide()
console.log('res_2 : ', pro_scate_search)
if (pro_scate_search.error_code === 0) {
const { data } = pro_scate_search
let newData = defalutLeftItem.concat(data.item)
// 记录找到的菜单的index
let index = -1
newData = newData.map((ele, i) => {
let selectedQuantity = ele[LocalVariable.SELECTED_QUQNTITY] || 0
if (ele.category_code === item.big_category.category_code) {
index = i
selectedQuantity += 1
}
return {
...ele,
[LocalVariable.SELECTED_QUQNTITY]: selectedQuantity,
[LocalVariable.LOCAL_SECOND_DATA]: [],
}
})
return Promise.resolve({ newData, index })
}
return Promise.resolve([])
}
// 获取搜索到的类目商品数据
async getLocalSecondData(item) {
const that = this
const { navigation, global_domain_config, token } = this.props
const { topActiveIndex } = this.state
const { topProcOptionList, selfData } = navigation.state.params
let params = {
access_token: token,
category_code: item.big_category.category_code,
manufacturer_code: topProcOptionList[topActiveIndex].supplier_code,
org_code: selfData.org_code,
// leftIndex: leftIndex, // 测试
}
console.log('params=', params)
this.refs.LoadingModel.show()
const single_all_search = await reqSingleConsumSearch(global_domain_config, params)
this.refs.LoadingModel.hide()
console.log('res_3 : ', single_all_search)
if (single_all_search.error_code === 0) {
const { data } = single_all_search
const { details, items } = data
if (details) {
const newData = details.map(ele => {
let quantity = ele[LocalVariable.QUANTITY_FIELD] || 0
if (ele.item_code === item.item_code) {
quantity += 1
}
return {
...ele,
[LocalVariable.ONLY_TWO_LEVELS]: true,
[LocalVariable.QUANTITY_FIELD]: quantity,
}
})
console.log('res_3:newData', newData)
return Promise.resolve(newData)
} else if (items) {
// 如果是四层结构
const newData = items.map(ele => {
let quantity = ele[LocalVariable.QUANTITY_FIELD] || 0
if (ele.category_code === item.middle_category.category_code) {
quantity += 1
console.log('ele.length', ele.details.length)
}
return {
...ele,
[LocalVariable.QUANTITY_FIELD]: quantity,
details: ele.details.map(ele1 => {
let quantity1 = ele1[LocalVariable.QUANTITY_FIELD] || 0
if (ele1.item_code === item.item_code) {
quantity1 += 1
console.log('item.item_code', item.item_code)
console.log('ele1', ele1)
}
return {
...ele1,
[LocalVariable.ONLY_TWO_LEVELS]: true,
[LocalVariable.QUANTITY_FIELD]: quantity1,
}
}),
}
})
return Promise.resolve(newData)
}
}
return Promise.resolve([])
}
// 把后台给的数据转成商品列表的格式,并添加数量
async formatToTopProcOptionList(item) {
const { navigation } = this.props
let { topProcOptionList } = navigation.state.params
const { topActiveIndex } = this.state
// 大类列表
let { leftOptionList } = topProcOptionList[topActiveIndex]
// 找搜索出来商品对应的大类
let leftOptionListItem = leftOptionList.find(ele => ele.category_code === item.big_category?.category_code)
console.log('leftOptionListItem', leftOptionListItem)
if (leftOptionListItem) {
console.log('已存在')
// 如果大类已存在
leftOptionListItem['selectedQuantity'] += 1
// 找耗材
let localSecondDataItem = leftOptionListItem.localSecondData?.find(ele => {
if (ele.item_code === item.item_code) {
return true
}
// 找中类
if (ele.details && item.middle_category) {
if (ele.category_code === item.middle_category.category_code) {
console.log('ele.category_code', ele.category_code)
return true
}
return false
}
return false
})
// 如果找到
if (localSecondDataItem) {
// 查找对应的产品 并添加数量、
const { details } = localSecondDataItem
if (details) {
// 如果是4层
const detail = details.find(ele => ele.item_code === item.item_code)
detail[LocalVariable.QUANTITY_FIELD] += 1
}
// 一般情况
localSecondDataItem[LocalVariable.QUANTITY_FIELD] += 1
} else {
// 如果找不到对应的产品
const localSecondData = await this.getLocalSecondData(item)
leftOptionListItem.localSecondData = localSecondData
console.log('localSecondDataItem', localSecondDataItem)
}
} else {
// 如果找不到当前商品大类,代表大类列表未加载
// 搜索出所有大类,并加入
leftOptionList = await this.createLeftOptionList(item)
console.log('leftOptionList', leftOptionList)
}
topProcOptionList[topActiveIndex] = {
...topProcOptionList[topActiveIndex],
[LocalVariable.SELECTED_QUQNTITY]: topProcOptionList[topActiveIndex][LocalVariable.SELECTED_QUQNTITY] + 1,
leftOptionList: leftOptionList.map(ele => {
const childrenLineData = this.getChildrenLineData(ele.localSecondData)
if (!ele[LocalVariable.SELECTED_DATA_ARR]) {
ele[LocalVariable.SELECTED_DATA_ARR] = []
}
const selectData = R.filter(R.compose(R.lt(0), R.prop(LocalVariable.QUANTITY_FIELD)))(
ele[LocalVariable.LOCAL_SECOND_DATA],
)
ele.selectedArr = selectData
console.log('selectedDataArr', childrenLineData)
return {
...ele,
[LocalVariable.SELECTED_DATA_ARR]: childrenLineData,
}
}),
}
// this.props.navigation.goBack()
this.setState(
{
topProcOptionList,
},
() => {
show('添加成功')
},
)
return Promise.resolve(topProcOptionList)
}
// 创建大类
async createLeftOptionList(item) {
// 获取该厂家下所有大类
let { newData: newLeftOptionList, index } = await this.getLeftOptionList(item)
console.log('newLeftOptionList', newLeftOptionList)
const localSecondData = await this.getLocalSecondData(item)
newLeftOptionList[index] = {
...newLeftOptionList[index],
localSecondData,
}
console.log('newLeftOptionList_index', newLeftOptionList[index])
return Promise.resolve(newLeftOptionList)
}
// 统计后塞入购物车
getChildrenLineData = data => {
console.log('getChildrenLineData', data)
return data.filter(item => item.quantity > 0)
}
// 返回每一列元素
renderContColumnItem(item, index) {
const { navigation } = this.props
const { setTopProcOptionListCallBack } = navigation.state.params
return (
<SafeAreaView style={styles.column_container} key={'item_code' + index}>
<PicTitDetaiCalcu
listItem={item}
listIndex={index}
calField={LocalVariable.QUANTITY_FIELD}
subCalCallBack={(item, idx) => {}}
titText={'manufacturer_product_code'}
tipTextStr={'item_name'}
tipTextOne={'general_name'}
tipTextTwo={'specification'}
titTextTit={'厂家产品代码'}
tipTextStrTit={'物料名称'}
tipTextOneTit={'通用名称'}
tipTextTwoTit={'规格型号'}
listImgIcon={'photos'}
plusCallBack={item => {
console.log('plusCallBack')
setTopProcOptionListCallBack(this.formatToTopProcOptionList(item))
}}
// reduceCallBack={() => this.props.handleAllPlusReduce(item, index)}
/>
</SafeAreaView>
)
}
handleTopNav(topItem, topActiveIndex) {
this.setState(
{
topActiveIndex,
},
() => {
this.initData()
},
)
}
inputSearchValue(text) {
this.setState({ searchValue: text })
}
render() {
const { navigation } = this.props
const { title, topProcOptionList } = navigation.state.params
const { data, topActiveIndex } = this.state
const cur_icon = 'supplier_icon'
console.log('dataList', data.item)
return (
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={list_common_item.ser_cont}>
<TextInput
placeholder={'请输入搜索关键词'}
style={list_common_item.ser_text_input}
onChangeText={text => this.inputSearchValue(text)}
/>
<View style={list_common_item.ser_btn}>
<TouchableOpacity
onPress={() => {
this.initData()
}}
>
<Text style={list_common_item.ser_text_btn}>搜索</Text>
</TouchableOpacity>
</View>
<View style={list_common_item.ser_img_box}>
<Image source={require('../../../images/search_icon.png')} style={icon_style} />
</View>
</View>
<ChooseCardList
cardStyleBox={styles.chooseCardList_box}
cardScrollEnabled={true}
cardHorizontal={true}
cardShowsHorizontalScrollIndicator={false}
cardStyleListItem={styles.top_inner}
cardListOptions={topProcOptionList}
// cardItemTitle={cur_title}
cardItemIcon={cur_icon}
curActIndex={topActiveIndex}
cardCallBack={(item, index) => this.handleTopNav(item, index)}
cardCountName={LocalVariable.SELECTED_QUQNTITY}
cardStyleType={'GRAPHICS'}
cardCouStyle={styles.top_cot_num}
cardShowDefIcon={true}
/>
<ScrollView showsVerticalScrollIndicator={false} onScrollEndDrag={this.onMomentumScrollEnd}>
{data.item.length > 0 && (
<FlatList
keyExtractor={item => item.id}
data={data.item}
extraData={this.state}
renderItem={({ item, index }) => this.renderContColumnItem(item, index)}
/>
)}
{data.item.length === data.total && data?.item?.length > 0 && (
<View>
<Text style={{ textAlign: 'center', lineHeight: 40 }}>没有更多数据了</Text>
</View>
)}
{!data?.item?.length && <PicListNoData />}
</ScrollView>
<LoadingModel ref="LoadingModel" />
</SafeAreaView>
)
}
}
const styles = StyleSheet.create({
top_box: {
width: Width(),
paddingHorizontal: 20,
paddingTop: 12,
},
chooseCardList_box: {
width: Width(),
height: 58,
backgroundColor: foundation_color,
paddingHorizontal: 20,
paddingTop: 12,
borderBottomColor: '#F4F4F4',
borderBottomWidth: 1,
},
top_inner: {
borderBottomColor: foundation_color,
minWidth: 60,
paddingBottom: 10,
},
top_cot_num: {
right: 8,
},
column_container: {
marginBottom: 10,
paddingHorizontal: 10,
paddingVertical: 6,
backgroundColor: foundation_color,
},
})
// export default SearchPage
const mapStateToProps = state => {
return {
userInfo: state.login.userInfo,
token: state.login.token,
loginState: state.login.loginState,
global_domain_config: state.login.global_domain_config,
local_sele_pro_options: state.selfOrder.local_sele_pro_options,
}
}
export default connect(mapStateToProps)(SearchPage)
{ {
"name": "BoneHouse_Business_APP", "name": "BoneHouse_Business_APP",
"version": "1.2.7", "version": "1.2.8",
"private": true, "private": true,
"scripts": { "scripts": {
"postinstall": "npx jetify", "postinstall": "npx jetify",
......
...@@ -83,7 +83,7 @@ class Settlement extends React.Component<IProps, IState> { ...@@ -83,7 +83,7 @@ class Settlement extends React.Component<IProps, IState> {
args = filterData args = filterData
} }
args.header_status = 'ENTERED' args.header_status = 'SETTLING'
const params = R.filter(isNotBlank)({ const params = R.filter(isNotBlank)({
...args, ...args,
...pagination, ...pagination,
......
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