Commit 4e96620a by wong.peiyi

自助下单、快速下单添加显示部门、业务经理、跟台员、送货员

parent e2e7bd48
......@@ -155,6 +155,10 @@ export const reqQuickTemplateCollect = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/surgery/template_header/search', params))
}
export const reqOrgDepartments = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/sale/sale_relationship/search', params))
}
// 获取手术类型 params={access_token:'', value_set_code:'ORTHOPEDICS_PRODUCT_CLASS'}
export function requestQuickSurgeryType(params) {
return (dispatch, getState) => {
......@@ -211,7 +215,7 @@ function requestListDataFail() {
}
}
// 上传语音
// 上传语音
export const requestQuickAudio = async (global_domain_config, params) => {
let { access_token, path } = params
let formData = new FormData()
......@@ -363,4 +367,4 @@ export const reqQuickSurColSetting = async (global_domain_config, params) => {
// }else {
// dispatch(requestListDataFail());
// }
// }
\ No newline at end of file
// }
......@@ -48,6 +48,10 @@ export const reqSelfOrganizations = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/authorized_inventory/search', params))
}
export const reqOrgDepartments = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/sale/sale_relationship/search', params))
}
// 获取客户名称 params={access_token:'', org_code:'', seller_code:''}
export function requestSelfSurgeryHospital(params) {
......@@ -205,7 +209,7 @@ function requestListDataFail() {
}
// 上传语音
// 上传语音
export const requestSelfAudio = async (global_domain_config, params) => {
let { access_token, path } = params
let formData = new FormData()
......@@ -356,4 +360,4 @@ export function setSelectProductOpts(data) {
type: SET_SELECT_PRODUCT_OPTS,
rawData: data
}
}
\ No newline at end of file
}
......@@ -25,14 +25,14 @@ import { connect } from 'react-redux';
class DialogModel extends Component {
constructor(props) {
super(props);
this.state = {
this.state = {
isVisible: false,
entityList: this.props.entityList,
isShowImage: false,
zoomImages: []
}
}
componentWillReceiveProps(nextProps) {
if (this.state.isVisible != nextProps.show) {
this.setState({
......@@ -43,7 +43,7 @@ class DialogModel extends Component {
this.setState({
entityList: nextProps.entityList
})
}
}
}
closeModal() {
......@@ -52,7 +52,7 @@ class DialogModel extends Component {
});
this.props.closeModal(false);
}
handleChooseItem(item) {
let { itemTitle } = this.props
if (this.state.isVisible) {
......@@ -113,7 +113,7 @@ class DialogModel extends Component {
<View style={styles.opt_area}>
<View style={styles.modal_style}>
<View style={styles.scro_box}>
<ScrollView
<ScrollView
style={styles.item_scroll}
// showsVerticalScrollIndicator={false}
>
......@@ -151,7 +151,7 @@ class DialogModel extends Component {
)
}
render() {
render() {
return (
<View style={styles.dia_container}>
<Modal
......@@ -165,7 +165,7 @@ class DialogModel extends Component {
style={styles.container} activeOpacity={1}
onPress={() => this.closeModal()}
>
{this.renderZoomPicture()}
{this.renderZoomPicture()}
{this.renderDialog()}
</TouchableOpacity>
</SafeAreaView>
......@@ -218,7 +218,9 @@ const styles = StyleSheet.create({
},
list_item_text: {
fontSize: 16,
color: third_text_color
color: third_text_color,
width: '100%',
textAlign: 'center',
},
curr_item: {
color: first_text_color,
......@@ -244,7 +246,10 @@ const styles = StyleSheet.create({
height: 'auto'
},
list_txt_box: {
flex: 1
flex: 1,
width: '100%',
alignItems: 'center',
justifyContent: 'center',
},
list_img_box: {
width: pxSize(60),
......@@ -266,5 +271,5 @@ const mapStateToProps = (state) => {
global_domain_config: state.login.global_domain_config
}
}
export default connect(mapStateToProps, null)(DialogModel);
\ No newline at end of file
export default connect(mapStateToProps, null)(DialogModel);
......@@ -487,7 +487,7 @@ class LineOrderPage extends Component {
subColumns.map(col => {
const obj = this.state[col.obj] || orderSupOptions
if(!!col.ifShow && !col.ifShow()) return null
console.log(Object.prototype.toString.call(col.prop))
return (
<View key={col.name} style={styles.fo_cell_box}>
<View style={{minWidth: pxSize(70), }}>
......
/**
* 快速下单
*/
import React, { Component } from 'react';
import {
View,
......@@ -33,7 +36,7 @@ import {
FooterBtnStyle
} from '../common/CellTextStyle';
import { connect } from 'react-redux';
import { show, dedupQuoteArray, formatStrForDate, cloneObject } from '../../utils/Utils';
import { show, dedupQuoteArray, formatStrForDate, cloneObject, isBlank, isNotBlank } from '../../utils/Utils';
import { AudioRecorder, AudioUtils } from 'react-native-audio';
import Sound from 'react-native-sound';
import DateModel from '../common/DateModel';
......@@ -53,7 +56,8 @@ import {
requestQuickSurgeryType,
reqQuickOrganizations,
requestQuickSurColSetting,
reqQuickTemplateCollect
reqQuickTemplateCollect,
reqOrgDepartments
} from '../../action/QuickAction';
import { exitLoginStatus, requestSysProfile } from '../../action/LoginAction';
import {
......@@ -67,6 +71,7 @@ import {
} from '../../base/ActionTypes';
import moment from 'moment';
import PageListArrow from '../common/listDataComponent/PageListArrow';
import * as R from 'ramda';
class EquipConsuPage extends Component {
constructor(props) {
......@@ -155,6 +160,35 @@ class EquipConsuPage extends Component {
title: '还有什么要安排的,可录音备注哟!',
value: '',
isRecode: true // 录音
},
{
"id": '13', // 以后如果有需要添加字段可以在这里加,下面的部门4个序号与自助下单一样
title: '占位',
name: '占位'
},
{
"id": "14",
title: '部门',
name: '请选择',
value: '',
},
{
"id": "15",
title: '业务经理',
name: '请选择',
value: '',
},
{
"id": "16",
title: '跟台员',
name: '请选择',
value: '',
},
{
"id": "17",
title: '送货员',
name: '请选择',
value: '',
}
],
subInitListOption: [], // 提交成功后,初始化当前数据
......@@ -215,7 +249,14 @@ class EquipConsuPage extends Component {
// ],
showNotEnogPop: false, // 库存不足弹窗
not_enough_items_list:[], // 库存不足数据
bor_ware_required: 0, // APP借货仓库必填权限
sysValues: {
OBS_MOBILE_BOR_WARE_REQUIRED: 0, // 多仓借还,借货仓库必填 [0, 1, 2, 3]
OBS_MOBILE_DEPARTMENT_DISPLAY: 0,
OBS_MOBILE_BM_DISPLAY: 0,
OBS_MOBILE_SUR_FOLLOWER_DISPLAY: 0,
OBS_MOBILE_DELIVERYMAN_DISPLAY: 0,
},
departments: []
}
}
......@@ -223,7 +264,7 @@ class EquipConsuPage extends Component {
this.getSellerName()
this.getAudioAuthorize()
this.getOrganizationData()
this.getSysConfigValue()
this.getSysProfileValue()
}
// 赋值销售员 初始化数据
......@@ -523,12 +564,12 @@ class EquipConsuPage extends Component {
}
// 清空当前项以下的值
clearInitNameAndValue(curIndex) {
clearInitNameAndValue(startIndex, endIndex = 12) {
let { listOptionData, localOtherObj } = this.state
let that = this
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(index > curIndex && index < 12 ) {
if(index > startIndex && index < endIndex ) {
item.name = localOtherObj.name
item.value = localOtherObj.value
if(listOptionData[1].value && item.title == '客户名称') {
......@@ -555,11 +596,11 @@ class EquipConsuPage extends Component {
// 判断是否都有值,修改提交按钮的颜色
changeCanSub(isSubCheck) {
let { listOptionData, bor_ware_required } = this.state
let { listOptionData, sysValues } = this.state
let tempStatus = false
let tempTit = ''
let maxIndex = 10
if(bor_ware_required === 3){
if(sysValues.OBS_MOBILE_BOR_WARE_REQUIRED === 3){
maxIndex = 11
}
for(let chIndex in listOptionData) {
......@@ -572,6 +613,15 @@ class EquipConsuPage extends Component {
tempStatus = true
break
}
if ((chIndex === 14 && sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2)
|| (chIndex === 15 && sysValues.OBS_MOBILE_BM_DISPLAY > 2)
|| (chIndex === 16 && sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2)
|| (chIndex === 17 && sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2)
&& !listOptionData[chIndex].value) {
tempTit = listOptionData[chIndex].title
tempStatus = true
break
}
}
this.setState({
canSubFlag: !tempStatus
......@@ -583,7 +633,7 @@ class EquipConsuPage extends Component {
// 选择器弹窗回调函数
handleCallBack(item, itemTitle) {
let { listOptionData} = this.state
let { listOptionData, sysValues, departments } = this.state
let that = this
listOptionData.map(function(chItem, index){
if(chItem.title === itemTitle) {
......@@ -591,6 +641,16 @@ class EquipConsuPage extends Component {
chItem.value = item.value
if(itemTitle === '组织') {
that.clearInitNameAndValue(1)
// 选择完组织后获取部门
if (sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 0) {
that.clearInitNameAndValue(13, 18)
that.getDepartmentsByOrg(item.value)
}
}
if (itemTitle === '部门') {
that.clearInitNameAndValue(14, 18)
const dep = R.find(R.propEq('department_code', item.value))(departments)
that.autoSetBMAndSFAndDMWhildSelectDepartment(dep)
}
if(itemTitle === '客户名称') {
that.clearInitNameAndValue(2)
......@@ -641,9 +701,29 @@ class EquipConsuPage extends Component {
if (currentTitle === '组织') {
tempOption = this.changeNameAndValue(quickOrderOption, 'org_name', 'org_code')
} else if (currentTitle === '客户名称') {
this.setState({
localCustomersOption: quickOrderOption
let customers = quickOrderOption
// 兼容旧接口 customers结构有可能是扁平的, 要改成层级的
if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) {
customers = R.map(cus => ({
bill_to_sites: [{
bill_to_site_code: cus.bill_to_site_code,
bill_to_site_name: cus.bill_to_site_name,
ship_to_sites: [{
ship_to_site_code: cus.ship_to_site_code,
ship_to_site_name: cus.ship_to_site_name,
customer_doctor: cus.customer_doctor
}]
}],
customer_code: cus.customer_code,
customer_name: cus.customer_name,
}))(customers)
}
that.setState({
localCustomersOption: customers
})
// 去重医院数据
let filterOpt = dedupQuoteArray(quickOrderOption, 'customer_code')
let currentArr = []
......@@ -725,6 +805,88 @@ class EquipConsuPage extends Component {
props.requestQuickOrganizations(params)
})
}
/**
* 根据组织获取部门等信息, 其他信息在部门下面
* @param {*} org_code
*/
async getDepartmentsByOrg(org_code) {
const {token, global_domain_config, userInfo} = this.props
const params = {
access_token: token,
org_code,
seller_code: userInfo.user_name,
scope_flag: 'Y'
}
try {
const res = await reqOrgDepartments(global_domain_config, params)
console.log('departments: ', res)
let departments = res.data.relationships
this.setState({ departments })
const {listOptionData, sysValues} = this.state
const noop = () => {}
// 部门只有一个时直接设置
R.cond([
[R.equals(0), () => setTimeout(() => show('当前组织没有部门信息'), 4000)],
[R.equals(1), () => {
const dep = R.head(departments)
listOptionData[14].name = dep.department_name
listOptionData[14].value = dep.department_code
this.setState({ listOptionData })
// 只有一个部门时可以自动设置
this.autoSetBMAndSFAndDMWhildSelectDepartment(dep)
}],
[R.T, noop]
])(R.length(departments))
} catch (error) {
console.log(error)
}
}
/**
* 当选择部门后,判断业务经理、跟台员、送货员是否只有一个,如果只有一个自动填上
*/
autoSetBMAndSFAndDMWhildSelectDepartment(department) {
const { listOptionData } = this.state
const noop = () => {}
// 业务经理只有一个时,直接设置业务经理
R.cond([
[R.equals(0), () => show('当前部门没有业务经理')],
[R.equals(1), () => {
const bm = R.pathOr([], ['business_manager_list', 0])(department)
listOptionData[15].name = bm.business_manager_name
listOptionData[15].value = bm.business_manager_code
this.setState({ listOptionData })
}],
[R.T, noop]
])(R.length(department.business_manager_list))
// 跟台员只有一个
R.ifElse(R.equals(1), () => {
const sf = R.pathOr([], ['surgery_follower_list', 0])(department)
listOptionData[16].name = sf.surgery_follower_name
listOptionData[16].value = sf.surgery_follower_code
this.setState({ listOptionData })
}, noop)(R.length(department.surgery_follower_list))
// 送货员只有一个
R.ifElse(R.equals(1), () => {
const dm = R.pathOr([], ['deliveryman_list', 0])(department)
listOptionData[17].name = dm.deliveryman_name
listOptionData[17].value = dm.deliveryman_code
this.setState({ listOptionData })
}, noop)(R.length(department.deliveryman_list))
}
/**
* 获取组织
*/
async getOrganizationData() {
let { state, props } = this
let params = {
......@@ -754,14 +916,43 @@ class EquipConsuPage extends Component {
}else {
this.showWarnError(orgResult)
}
// else if (orgResult.error_code == 41006) {
// show('登录过期,请重新登录');
// props.exitLoginStatus();
// } else {
// let error_msg = orgResult.error_msg || orgResult.message
// show(error_msg);
// }
}
/**
* 点击部门,业务经理,跟台员,送货员等
*/
handleDepartmentCheck(curData, objName, itemName, itemVal) {
if (!this.judgeOrgIsNull()) return
// objName有值直接是部门
if (!!objName && !this.judgeDepartmentIsNull()) return
const {departments, listOptionData} = this.state
let options = departments
// 非部门
if (!!objName) {
const code = listOptionData[14].value
const dep = R.find(R.propEq('department_code', code))(departments)
options = R.propOr([], objName, dep)
}
const listOptions = R.map(R.applySpec({
name: R.prop(itemName),
value: R.prop(itemVal)
}))(options)
this.setState({
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
},
showTypePop: true,
listCurrentOption: listOptions
})
}
// 客户名称 点击
handleCustomerCheck(curData) {
let that = this
......@@ -801,6 +992,24 @@ class EquipConsuPage extends Component {
let cusResult = await reqQuickSurgeryHospital(global_domain_config, params);
if(cusResult.error_code == 0) {
let { data: { customers } } = cusResult
// customers结构有可能是扁平的, 要改成层级的,新版的
if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) {
customers = R.map(cus => ({
bill_to_sites: [{
bill_to_site_code: cus.bill_to_site_code,
bill_to_site_name: cus.bill_to_site_name,
ship_to_sites: [{
ship_to_site_code: cus.ship_to_site_code,
ship_to_site_name: cus.ship_to_site_name,
customer_doctor: cus.customer_doctor
}]
}],
customer_code: cus.customer_code,
customer_name: cus.customer_name,
}))(customers)
}
let { listOptionData } = state
// props.requestListDataSuccess(customers)
let filterOpt = dedupQuoteArray(customers, 'customer_code')
......@@ -830,7 +1039,10 @@ class EquipConsuPage extends Component {
// show(error_msg);
// }
}
// 收单地点 点击
/**
* 收单地点 点击
*/
handleBillCheck(curData) {
let { localCustomersOption, listOptionData } = this.state
let that = this
......@@ -842,38 +1054,45 @@ class EquipConsuPage extends Component {
value: curData.value
}
}, () => {
let tempOption = []
if( localCustomersOption.length ) {
localCustomersOption.forEach((item) => {
if(item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的地点
let obj = {}
obj.value = item.bill_to_site_code
obj.name = item.bill_to_site_name
tempOption.push(obj)
}
})
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
let options = []
if (isNotBlank(customer.bill_to_sites)) {
options = R.compose(
R.curry(dedupQuoteArray)(R.__, 'name'),
R.map(R.applySpec({
value: R.prop('bill_to_site_code'),
name: R.prop('bill_to_site_name'),
})),
R.prop('bill_to_sites')
)(customer)
}
tempOption = dedupQuoteArray(tempOption, 'name')
that.setState({
showTypePop: true,
listCurrentOption: [...tempOption]
listCurrentOption: options
})
})
}
}
/**
* 自动填充收单地点
* @returns
*/
customerGetBill() {
let { localCustomersOption, listOptionData } = this.state
let that = this
let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value)
tempLocalOption = dedupQuoteArray(tempLocalOption, 'bill_to_site_code')
if(tempLocalOption.length === 0) {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
if (!customer || isBlank(customer.bill_to_sites)) {
show(`当前${listOptionData[3].title}为空`)
return
}
if(tempLocalOption.length === 1) {
listOptionData[3].name = tempLocalOption[0].bill_to_site_name
listOptionData[3].value = tempLocalOption[0].bill_to_site_code
const sites = customer.bill_to_sites
if(sites.length === 1) {
listOptionData[3].name = R.pathOr('', [0, 'bill_to_site_name'], sites)
listOptionData[3].value = R.pathOr('', [0, 'bill_to_site_code'], sites)
that.setState({
listOptionData
})
......@@ -891,41 +1110,66 @@ class EquipConsuPage extends Component {
value: curData.value
}
}, () => {
let tempOption = []
if( localCustomersOption.length ) {
localCustomersOption.forEach((item, index) => {
if(item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的地点
let obj = {}
obj.value = item.ship_to_site_code
obj.name = item.ship_to_site_name
tempOption.push(obj)
}
})
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
let options = []
if (isNotBlank(customer)) {
const billSite = R.find(R.propEq('bill_to_site_code', listOptionData[3].value), customer.bill_to_sites)
if (isNotBlank(billSite) && isNotBlank(billSite.ship_to_sites)) {
options = R.compose(
R.curry(dedupQuoteArray)(R.__, 'name'),
R.map(R.applySpec({
value: R.prop('ship_to_site_code'),
name: R.prop('ship_to_site_name'),
})),
R.prop('ship_to_sites')
)(billSite)
}
}
tempOption = dedupQuoteArray(tempOption, 'name')
that.setState({
showTypePop: true,
listCurrentOption: [...tempOption]
listCurrentOption: options
})
})
}
}
/**
* 收货地点自动填充
* @returns
*/
customerGetShip() {
let { localCustomersOption, listOptionData } = this.state
let that = this
let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value)
tempLocalOption = dedupQuoteArray(tempLocalOption, 'ship_to_site_code')
if(tempLocalOption.length === 0) {
show(`当前${listOptionData[4].title}为空`)
return
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
if (R.any(isBlank, [customer, customer.bill_to_sites]) ) {
return show(`当前${listOptionData[4].title}为空`)
}
if(tempLocalOption.length === 1) {
listOptionData[4].name = tempLocalOption[0].ship_to_site_name
listOptionData[4].value = tempLocalOption[0].ship_to_site_code
that.setState({
listOptionData
})
// 收单地点为单或已选
if (customer.bill_to_sites.length === 1 || listOptionData[3].value) {
let billSite = R.find(R.propEq('bill_to_site_code', listOptionData[3].value), customer.bill_to_sites)
if (isBlank(billSite) && customer.bill_to_sites.length === 1) {
billSite = R.head(customer.bill_to_sites)
}
if (isBlank(billSite)) return
// 收货地点
let shipSites = billSite.ship_to_sites
shipSites = dedupQuoteArray(shipSites, 'ship_to_site_code')
if (shipSites.length === 0) {
show(`当前${listOptionData[4].title}为空`)
return
}
if (shipSites.length === 1) {
listOptionData[4].name = shipSites[0].ship_to_site_name
listOptionData[4].value = shipSites[0].ship_to_site_code
that.setState({
listOptionData
})
}
}
}
// 主治医生 点击
......@@ -941,23 +1185,26 @@ class EquipConsuPage extends Component {
value: curData.value
}
}, () => {
let tempOption = []
if( localCustomersOption.length ) {
localCustomersOption.forEach((item) => {
if(item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的医生
let obj = {}
obj.value = item.customer_doctor
obj.name = item.customer_doctor
tempOption.push(obj)
let tempOption = [{name: '其他', value: '-1'}]
if (isNotBlank(localCustomersOption) && listOptionData[2].value) {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value))(localCustomersOption)
if (isNotBlank(customer) && isNotBlank(customer.bill_to_sites) && listOptionData[3].value) {
const billSite = R.find(R.propEq('bill_to_site_code', listOptionData[3].value))(customer.bill_to_sites)
if (isNotBlank(billSite) && isNotBlank(billSite.ship_to_sites) && listOptionData[4].value) {
const ship = R.find(R.propEq('ship_to_site_code', listOptionData[4].value))(billSite.ship_to_sites)
if (isNotBlank(ship)) {
tempOption = R.prepend({
value: ship.customer_doctor,
name: ship.customer_doctor
}, tempOption)
}
}
})
}
let othObj = {
name: '其他',
value: '-1'
}
}
tempOption.push(othObj)
tempOption = dedupQuoteArray(tempOption, 'name')
that.setState({
showTypePop: true,
......@@ -1226,6 +1473,13 @@ class EquipConsuPage extends Component {
tempSubOption.collect_src_inv_code = state.listOptionData[10].value
tempSubOption.surgery_desc = state.listOptionData[11].value
tempSubOption.voice_url = state.listOptionData[12].value
// 有部门显示的提交
const {sysValues} = state
sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 0 && (tempSubOption.department_code = state.listOptionData[14].value)
sysValues.OBS_MOBILE_BM_DISPLAY > 0 && (tempSubOption.business_manager_code = state.listOptionData[15].value)
sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 0 && (tempSubOption.surgery_follower_code = state.listOptionData[16].value)
sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 0 && (tempSubOption.deliveryman_code = state.listOptionData[17].value)
let params = {
access_token: props.token,
data: { ...tempSubOption }
......@@ -1244,6 +1498,18 @@ class EquipConsuPage extends Component {
return true
}
}
/**
* 部门是否为空
* @returns
*/
judgeDepartmentIsNull() {
let {listOptionData } = this.state
return R.ifElse(R.isEmpty, () => {show('请先选择部门'); return R.F()}, R.T)(
R.path(['listOptionData', 14, 'value'], this.state)
)
}
// 判断客户名称是否为空
judgeCustomerIsNull() {
let { listOptionData } = this.state
......@@ -1255,6 +1521,17 @@ class EquipConsuPage extends Component {
return true
}
}
/**
* 收单地点为空
* @returns
*/
judgeBillIsNull() {
let {listOptionData } = this.state
return R.ifElse(R.isEmpty, () => {show('请先选择收单地点'); return R.F()}, R.T)(
R.path(['listOptionData', 3, 'value'], this.state)
)
}
// 处理提交后返回的数据
processReturnData() {
let { quickOrderOption } = this.props
......@@ -1314,23 +1591,34 @@ class EquipConsuPage extends Component {
showNotEnogPop: show
})
}
// 获取配置值
async getSysConfigValue() {
let { global_domain_config, token } = this.props
const params = {
access_token: token,
profile_code: 'OBS_MOBILE_BOR_WARE_REQUIRED'
}
let sysRes = await requestSysProfile(global_domain_config, params)
console.log('sysRes:==', sysRes)
if(sysRes.error_code === 0){
this.setState({
bor_ware_required: Number(sysRes.data.profile_value) || 0
})
// }else {
// this.showWarnError(sysRes)
/**
* 获取配置
*/
getSysProfileValue() {
let { global_domain_config, token} = this.props
const {sysValues} = this.state
const getSysProfile = async (code) => {
const params = {
access_token: token,
profile_code: code
}
let res = await requestSysProfile(global_domain_config, params)
console.log('sysRes:==', res)
if(res && res.error_code === 0){
const value = res.data.profile_value
sysValues[code] = isNaN(value) ? value : Number(value)
this.setState({ sysValues }, () => {
console.log(sysValues)
})
}
}
R.compose(R.map(getSysProfile), R.keys)(sysValues)
}
showWarnError(res){
if(res.error_code == 41006) {
show('登录过期,请重新登录');
......@@ -1343,7 +1631,7 @@ class EquipConsuPage extends Component {
// 返回备注以上的元素
renderListItem() {
let { listOptionData, dateModelPop, bor_ware_required } = this.state
let { listOptionData, dateModelPop, sysValues } = this.state
return(
<View style={styles.list_cont}>
<PageListArrow
......@@ -1363,6 +1651,60 @@ class EquipConsuPage extends Component {
listCallBack={() => this.handleOrganizationCheck(listOptionData[1])}
listHasArrow={true}
/>
{
sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listHasAster={sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2}
listItem={listOptionData[14]}
listName={'name'}
listTitle={'title'}
listCallBack={() => this.handleDepartmentCheck(listOptionData[14], null, 'department_name', 'department_code')}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_BM_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listHasAster={sysValues.OBS_MOBILE_BM_DISPLAY > 2}
listItem={listOptionData[15]}
listName={'name'}
listTitle={'title'}
listCallBack={this.handleDepartmentCheck.bind(this, listOptionData[15], 'business_manager_list', 'business_manager_name', 'business_manager_code')}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listHasAster={sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2}
listItem={listOptionData[16]}
listName={'name'}
listTitle={'title'}
listCallBack={this.handleDepartmentCheck.bind(this, listOptionData[16], 'surgery_follower_list', 'surgery_follower_name', 'surgery_follower_code')}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listHasAster={ sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2}
listItem={listOptionData[17]}
listName={'name'}
listTitle={'title'}
listCallBack={this.handleDepartmentCheck.bind(this, listOptionData[17], 'deliveryman_list', 'deliveryman_name', 'deliveryman_code')}
listHasArrow={true}
/>
)
}
<PageListArrow
listActOpa={.8}
listHasAster={true}
......@@ -1438,10 +1780,10 @@ class EquipConsuPage extends Component {
listHasArrow={true}
/>
{
bor_ware_required > 1 ?
sysValues.OBS_MOBILE_BOR_WARE_REQUIRED > 1 ?
<PageListArrow
listActOpa={.8}
listHasAster={bor_ware_required === 3}
listHasAster={sysValues.OBS_MOBILE_BOR_WARE_REQUIRED === 3}
listItem={listOptionData[10]}
listName={'name'}
listTitle={'title'}
......
......@@ -3,7 +3,7 @@ import { View, Text, SafeAreaView, StyleSheet, TouchableOpacity, Image, ScrollVi
import { connect } from 'react-redux';
import { home_background_color, placehold_text_color, promary_color, safe_view, icon_style, list_common_item } from '../../base/BaseStyle';
import { ImageTextStyle, CellTextStyle, FooterBtnStyle } from '../common/CellTextStyle';
import { show, formatStrForDate, cloneObject, dedupQuoteArray } from '../../utils/Utils';
import { show, formatStrForDate, cloneObject, dedupQuoteArray, isBlank, isNotBlank } from '../../utils/Utils';
import HeadBackItem from '../common/HeadBackItem';
import StatusBarView from '../common/StatusBarView';
import DialogModel from '../common/DialogModel';
......@@ -11,8 +11,8 @@ 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 } from '../../action/SelfAction';
import { exitLoginStatus } from '../../action/LoginAction';
import { requestSelfOrganizations, requestSelfSurgeryHospital, requestSelfOrderType, requestSelfTemplateCollect, requestSelfAudio, requestSelfSumbit, setSelfInitData, reqSelfSurgeryHospital, requestListDataSuccess, requestSelfSurgeryType, setSelectProductOpts, reqSelfOrganizations, reqOrgDepartments } 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';
......@@ -23,6 +23,7 @@ import ImagePicker from 'react-native-image-picker';
import ZoomPictureModel from '../common/ZoomPictureModel';
import { uploadTransImg } from '../../action/TransAction';
import moment from 'moment';
import * as R from "ramda";
class SelfOrderPage extends Component {
constructor(props) {
......@@ -68,11 +69,6 @@ class SelfOrderPage extends Component {
showInput: false,
inputValue: ''
},
// {
// "id": "6",
// title: '手术名称',
// value: ''
// },
{
"id": "6",
title: '需求时间',
......@@ -81,12 +77,6 @@ class SelfOrderPage extends Component {
dateValue: new Date(),
showDatePicker: true
},
// {
// "id": "8",
// title: '手术类型',
// name: '请选择',
// value: '',
// },
{
"id": "7",
title: '订单类型',
......@@ -106,14 +96,12 @@ class SelfOrderPage extends Component {
{
"id": "9",
title: '需要携带合格证',
// name: '',
value: '',
isRedio: '' // 单选
},
{
"id": "10",
title: '同意替换器械包', // 同意替换同品不同器械包
// name: '',
value: 'N',
isRedio: 'N' // 单选
},
......@@ -135,6 +123,30 @@ class SelfOrderPage extends Component {
value: '',
isAddImage: true, // 添加图片
uploadImgArr: [] // 上传后的路径
},
{
"id": "14",
title: '部门',
name: '请选择',
value: '',
},
{
"id": "15",
title: '业务经理',
name: '请选择',
value: '',
},
{
"id": "16",
title: '跟台员',
name: '请选择',
value: '',
},
{
"id": "17",
title: '送货员',
name: '请选择',
value: '',
}
],
subInitListOption: [], // 存储最初数据
......@@ -181,11 +193,19 @@ class SelfOrderPage extends Component {
not_enough_items_list: [], // 库存不足数据
localPhoOption: [], // 本地图片
isShowImage: false,
currShowImgIndex: 0
currShowImgIndex: 0,
sysValues: {
OBS_MOBILE_DEPARTMENT_DISPLAY: 'N',
OBS_MOBILE_BM_DISPLAY: 'N',
OBS_MOBILE_SUR_FOLLOWER_DISPLAY: 'N',
OBS_MOBILE_DELIVERYMAN_DISPLAY: 'N',
},
departments: []
}
}
componentDidMount() {
this.getSysProfileValue()
this.props.setSelectProductOpts([])
this.getSellerName()
this.getAudioAuthorize()
......@@ -209,6 +229,29 @@ class SelfOrderPage extends Component {
}
}
/**
* 从系统值集中获取是否显示部门、业务经理、跟台员、送货员等信息
*/
async getSysProfileValue() {
let { global_domain_config, token } = this.props
const {sysValues} = this.state
const getSysValue = async (key) => {
const params = {
access_token: token,
profile_code: key
}
const res = await requestSysProfile(global_domain_config, params)
if (res.error_code || res.status) return
sysValues[key] = res.data.profile_value
this.setState({
sysValues
})
}
R.compose(R.map(getSysValue), R.keys)(sysValues)
}
// 请求授权
getAudioAuthorize() {
AudioRecorder.requestAuthorization()
......@@ -424,12 +467,12 @@ class SelfOrderPage extends Component {
}
// 清空当前项以下的值
clearInitNameAndValue(curIndex) {
clearInitNameAndValue(startIndex, endIndex = 6) {
let { listOptionData, localOtherObj } = this.state
let that = this
this.setState({
listOptionData: listOptionData.map((item, index) => {
if (index > curIndex && index < 6) {
if (index > startIndex && index < endIndex) {
item.name = localOtherObj.name
item.value = localOtherObj.value
if (listOptionData[1].value && item.title == '客户名称') {
......@@ -453,7 +496,7 @@ class SelfOrderPage extends Component {
// 判断是否都有值,修改提交按钮的颜色
changeCanSub(isSubCheck) {
let { listOptionData } = this.state
let { listOptionData, sysValues} = this.state
let tempStatus = false
let tempTit = ''
let curTip = '未选择'
......@@ -469,6 +512,15 @@ class SelfOrderPage extends Component {
}
break
}
if ((chIndex === 14 && sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2)
|| (chIndex === 15 && sysValues.OBS_MOBILE_BM_DISPLAY > 2)
|| (chIndex === 16 && sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2)
|| (chIndex === 17 && sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2)
&& !listOptionData[chIndex].value) {
tempTit = listOptionData[chIndex].title
tempStatus = true
break
}
}
this.setState({
canSubFlag: !tempStatus
......@@ -480,7 +532,7 @@ class SelfOrderPage extends Component {
// 选择器弹窗回调函数
handleCallBack(item, itemTitle) {
let { listOptionData } = this.state
let { listOptionData, sysValues, departments } = this.state
let that = this
listOptionData.map(function (chItem, index) {
if (chItem.title === itemTitle) {
......@@ -488,6 +540,16 @@ class SelfOrderPage extends Component {
chItem.value = item.value
if (itemTitle === '组织') {
that.clearInitNameAndValue(1)
// 选择完组织后获取部门
if (sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 0) {
that.clearInitNameAndValue(13, 18)
that.getDepartmentsByOrg(item.value)
}
}
if (itemTitle === '部门') {
that.clearInitNameAndValue(14, 18)
const dep = R.find(R.propEq('department_code', item.value))(departments)
that.autoSetBMAndSFAndDMWhildSelectDepartment(dep)
}
if (itemTitle === '客户名称') {
that.clearInitNameAndValue(2)
......@@ -533,9 +595,28 @@ class SelfOrderPage extends Component {
if (currentTitle === '组织') {
tempOption = that.changeNameAndValue(selfOrderOption, 'org_name', 'org_code')
} else if (currentTitle === '客户名称') {
let customers = selfOrderOption
// 兼容旧接口 customers结构有可能是扁平的, 要改成层级的
if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) {
customers = R.map(cus => ({
bill_to_sites: [{
bill_to_site_code: cus.bill_to_site_code,
bill_to_site_name: cus.bill_to_site_name,
ship_to_sites: [{
ship_to_site_code: cus.ship_to_site_code,
ship_to_site_name: cus.ship_to_site_name,
customer_doctor: cus.customer_doctor
}]
}],
customer_code: cus.customer_code,
customer_name: cus.customer_name,
}))(customers)
}
that.setState({
localCustomersOption: selfOrderOption
localCustomersOption: customers
})
// 去重医院数据
let filterOpt = dedupQuoteArray(selfOrderOption, 'customer_code')
let currentArr = []
......@@ -606,6 +687,88 @@ class SelfOrderPage extends Component {
props.requestSelfOrganizations(params)
})
}
/**
* 根据组织获取部门等信息, 其他信息在部门下面
* @param {*} org_code
*/
async getDepartmentsByOrg(org_code) {
const {token, global_domain_config, userInfo} = this.props
const params = {
access_token: token,
org_code,
seller_code: userInfo.user_name,
scope_flag: 'Y'
}
try {
const res = await reqOrgDepartments(global_domain_config, params)
console.log('deparments: ', res)
let departments = res.data.relationships
this.setState({ departments })
const {listOptionData, sysValues} = this.state
const noop = () => {}
// 部门只有一个时直接设置
R.cond([
[R.equals(0), () => setTimeout(() =>show('当前组织没有部门信息'), 4000)],
[R.equals(1), () => {
const dep = R.head(departments)
listOptionData[14].name = dep.department_name
listOptionData[14].value = dep.department_code
this.setState({ listOptionData })
// 只有一个部门时可以自动设置
this.autoSetBMAndSFAndDMWhildSelectDepartment(dep)
}],
[R.T, noop]
])(R.length(departments))
} catch (error) {
console.log(error)
}
}
/**
* 当选择部门后,判断业务经理、跟台员、送货员是否只有一个,如果只有一个自动填上
*/
autoSetBMAndSFAndDMWhildSelectDepartment(department) {
const { listOptionData } = this.state
const noop = () => {}
// 业务经理只有一个时,直接设置业务经理
R.cond([
[R.equals(0), () => show('当前部门没有业务经理')],
[R.equals(1), () => {
const bm = R.pathOr([], ['business_manager_list', 0])(department)
listOptionData[15].name = bm.business_manager_name
listOptionData[15].value = bm.business_manager_code
this.setState({ listOptionData })
}],
[R.T, noop]
])(R.length(department.business_manager_list))
// 跟台员只有一个
R.ifElse(R.equals(1), () => {
const sf = R.pathOr([], ['surgery_follower_list', 0])(department)
listOptionData[16].name = sf.surgery_follower_name
listOptionData[16].value = sf.surgery_follower_code
this.setState({ listOptionData })
}, noop)(R.length(department.surgery_follower_list))
// 送货员只有一个
R.ifElse(R.equals(1), () => {
const dm = R.pathOr([], ['deliveryman_list', 0])(department)
listOptionData[17].name = dm.deliveryman_name
listOptionData[17].value = dm.deliveryman_code
this.setState({ listOptionData })
}, noop)(R.length(department.deliveryman_list))
}
/**
* 获取组织
*/
async getOrganizationData() {
let { state, props } = this
let params = {
......@@ -641,6 +804,41 @@ class SelfOrderPage extends Component {
}
}
/**
* 点击部门,业务经理,跟台员,送货员等
*/
handleDepartmentCheck(curData, objName, itemName, itemVal) {
if (!this.judgeOrgIsNull()) return
// objName有值直接是部门
if (!!objName && !this.judgeDepartmentIsNull()) return
const {departments, listOptionData} = this.state
let options = departments
// 非部门
if (!!objName) {
const code = listOptionData[14].value
const dep = R.find(R.propEq('department_code', code))(departments)
options = R.propOr([], objName, dep)
}
const listOptions = R.map(R.applySpec({
name: R.prop(itemName),
value: R.prop(itemVal)
}))(options)
this.setState({
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
},
showTypePop: true,
listCurrentOption: listOptions
})
}
// 客户名称 点击
handleCustomerCheck(curData) {
let that = this
......@@ -662,7 +860,7 @@ class SelfOrderPage extends Component {
let params = {
access_token: props.token,
org_code: state.listOptionData[1].value,
seller_code: props.userInfo.user_name
seller_code: props.userInfo.user_name,
}
props.requestSelfSurgeryHospital(params)
}
......@@ -672,13 +870,32 @@ class SelfOrderPage extends Component {
let params = {
access_token: props.token,
org_code: state.listOptionData[1].value,
seller_code: props.userInfo.user_name
seller_code: props.userInfo.user_name,
}
let that = this
let { global_domain_config } = props
let cusResult = await reqSelfSurgeryHospital(global_domain_config, params);
console.log(cusResult)
if (cusResult.error_code == 0) {
let { data: { customers } } = cusResult
// customers结构有可能是扁平的, 要改成层级的,新版的
if (customers.length && !!R.path([0, 'ship_to_site_code'], customers)) {
customers = R.map(cus => ({
bill_to_sites: [{
bill_to_site_code: cus.bill_to_site_code,
bill_to_site_name: cus.bill_to_site_name,
ship_to_sites: [{
ship_to_site_code: cus.ship_to_site_code,
ship_to_site_name: cus.ship_to_site_name,
customer_doctor: cus.customer_doctor
}]
}],
customer_code: cus.customer_code,
customer_name: cus.customer_name,
}))(customers)
}
let { listOptionData } = state
// props.requestListDataSuccess(customers)
let filterOpt = dedupQuoteArray(customers, 'customer_code')
......@@ -706,7 +923,9 @@ class SelfOrderPage extends Component {
}
}
// 收单地点 点击
/**
* 收单地点 点击
* */
handleBillCheck(curData) {
let { localCustomersOption, listOptionData } = this.state
let that = this
......@@ -718,38 +937,42 @@ class SelfOrderPage extends Component {
value: curData.value
}
}, () => {
let tempOption = []
if (localCustomersOption.length) {
localCustomersOption.forEach((item) => {
if (item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的地点
let obj = {}
obj.value = item.bill_to_site_code
obj.name = item.bill_to_site_name
tempOption.push(obj)
}
})
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
let options = []
if (isNotBlank(customer.bill_to_sites)) {
options = R.compose(
R.curry(dedupQuoteArray)(R.__, 'name'),
R.map(R.applySpec({
value: R.prop('bill_to_site_code'),
name: R.prop('bill_to_site_name'),
})),
R.prop('bill_to_sites')
)(customer)
}
tempOption = dedupQuoteArray(tempOption, 'name')
that.setState({
showTypePop: true,
listCurrentOption: [...tempOption]
listCurrentOption: options
})
})
}
}
/**
* 自动填充收单地点
*/
customerGetBill() {
let { localCustomersOption, listOptionData } = this.state
let that = this
let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value)
tempLocalOption = dedupQuoteArray(tempLocalOption, 'bill_to_site_code')
if (tempLocalOption.length === 0) {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
if (!customer || isBlank(customer.bill_to_sites)) {
show(`当前${listOptionData[3].title}为空`)
return
}
if (tempLocalOption.length === 1) {
listOptionData[3].name = tempLocalOption[0].bill_to_site_name
listOptionData[3].value = tempLocalOption[0].bill_to_site_code
const sites = customer.bill_to_sites
if (sites.length === 1) {
listOptionData[3].name = R.pathOr('', [0, 'bill_to_site_name'], sites)
listOptionData[3].value = R.pathOr('', [0, 'bill_to_site_code'], sites)
that.setState({
listOptionData
})
......@@ -760,7 +983,7 @@ class SelfOrderPage extends Component {
handleShipCheck(curData) {
let { localCustomersOption, listOptionData } = this.state
let that = this
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull()) {
if (this.judgeOrgIsNull() && this.judgeCustomerIsNull() && this.judgeBillIsNull()) {
that.setState({
currentTitle: curData.title,
currentItem: {
......@@ -768,41 +991,66 @@ class SelfOrderPage extends Component {
value: curData.value
}
}, () => {
let tempOption = []
if (localCustomersOption.length) {
localCustomersOption.forEach((item, index) => {
if (item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的地点
let obj = {}
obj.value = item.ship_to_site_code
obj.name = item.ship_to_site_name
tempOption.push(obj)
}
})
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
let options = []
if (isNotBlank(customer)) {
const billSite = R.find(R.propEq('bill_to_site_code', listOptionData[3].value), customer.bill_to_sites)
if (isNotBlank(billSite) && isNotBlank(billSite.ship_to_sites)) {
options = R.compose(
R.curry(dedupQuoteArray)(R.__, 'name'),
R.map(R.applySpec({
value: R.prop('ship_to_site_code'),
name: R.prop('ship_to_site_name'),
})),
R.prop('ship_to_sites')
)(billSite)
}
}
tempOption = dedupQuoteArray(tempOption, 'name')
that.setState({
showTypePop: true,
listCurrentOption: [...tempOption]
listCurrentOption: options
})
})
}
}
/**
* 自动填充收货地点
* @returns
*/
customerGetShip() {
let { localCustomersOption, listOptionData } = this.state
let that = this
let tempLocalOption = localCustomersOption.filter(item => item.customer_code === listOptionData[2].value)
tempLocalOption = dedupQuoteArray(tempLocalOption, 'ship_to_site_code')
if (tempLocalOption.length === 0) {
show(`当前${listOptionData[4].title}为空`)
return
const customer = R.find(R.propEq('customer_code', listOptionData[2].value), localCustomersOption)
if (R.any(isBlank, [customer, customer.bill_to_sites]) ) {
return show(`当前${listOptionData[4].title}为空`)
}
if (tempLocalOption.length === 1) {
listOptionData[4].name = tempLocalOption[0].ship_to_site_name
listOptionData[4].value = tempLocalOption[0].ship_to_site_code
that.setState({
listOptionData
})
// 收单地点为单或已选
if (customer.bill_to_sites.length === 1 || listOptionData[3].value) {
let billSite = R.find(R.propEq('bill_to_site_code', listOptionData[3].value), customer.bill_to_sites)
if (isBlank(billSite) && customer.bill_to_sites.length === 1) {
billSite = R.head(customer.bill_to_sites)
}
if (isBlank(billSite)) return
// 收货地点
let shipSites = billSite.ship_to_sites
shipSites = dedupQuoteArray(shipSites, 'ship_to_site_code')
if (shipSites.length === 0) {
show(`当前${listOptionData[4].title}为空`)
return
}
if (shipSites.length === 1) {
listOptionData[4].name = shipSites[0].ship_to_site_name
listOptionData[4].value = shipSites[0].ship_to_site_code
that.setState({
listOptionData
})
}
}
}
......@@ -819,23 +1067,27 @@ class SelfOrderPage extends Component {
value: curData.value
}
}, () => {
let tempOption = []
if (localCustomersOption.length) {
localCustomersOption.forEach((item) => {
if (item.customer_code === listOptionData[2].value) {
// 保证是当前客户名称下的医生
let obj = {}
obj.value = item.customer_doctor
obj.name = item.customer_doctor
tempOption.push(obj)
let tempOption = [{name: '其他', value: '-1'}]
if (isNotBlank(localCustomersOption) && listOptionData[2].value) {
const customer = R.find(R.propEq('customer_code', listOptionData[2].value))(localCustomersOption)
if (isNotBlank(customer) && isNotBlank(customer.bill_to_sites) && listOptionData[3].value) {
const billSite = R.find(R.propEq('bill_to_site_code', listOptionData[3].value))(customer.bill_to_sites)
if (isNotBlank(billSite) && isNotBlank(billSite.ship_to_sites) && listOptionData[4].value) {
const ship = R.find(R.propEq('ship_to_site_code', listOptionData[4].value))(billSite.ship_to_sites)
if (isNotBlank(ship)) {
tempOption = R.prepend({
value: ship.customer_doctor,
name: ship.customer_doctor
}, tempOption)
}
}
})
}
let othObj = {
name: '其他',
value: '-1'
}
}
tempOption.push(othObj)
tempOption = dedupQuoteArray(tempOption, 'name')
that.setState({
showTypePop: true,
......@@ -1228,6 +1480,14 @@ class SelfOrderPage extends Component {
tempSubOption.image_url = state.listOptionData[13].uploadImgArr.join(',')
// 有部门显示的提交
const {sysValues} = state
sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 0 && (tempSubOption.department_code = state.listOptionData[14].value)
sysValues.OBS_MOBILE_BM_DISPLAY > 0 && (tempSubOption.business_manager_code = state.listOptionData[15].value)
sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 0 && (tempSubOption.surgery_follower_code = state.listOptionData[16].value)
sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 0 && (tempSubOption.deliveryman_code = state.listOptionData[17].value)
// tempSubOption.replace_item_flag = state.listOptionData[10].replace_item_flag
// tempSubOption.take_cert_flag = state.listOptionData[10].take_cert_flag
......@@ -1376,6 +1636,18 @@ class SelfOrderPage extends Component {
return true
}
}
/**
* 部门是否为空
* @returns
*/
judgeDepartmentIsNull() {
let {listOptionData } = this.state
return R.ifElse(R.isEmpty, () => {show('请先选择部门'); return R.F()}, R.T)(
R.path(['listOptionData', 14, 'value'], this.state)
)
}
// 判断客户名称是否为空
judgeCustomerIsNull() {
let { listOptionData } = this.state
......@@ -1387,6 +1659,18 @@ class SelfOrderPage extends Component {
return true
}
}
/**
* 收单地点为空
* @returns
*/
judgeBillIsNull() {
let {listOptionData } = this.state
return R.ifElse(R.isEmpty, () => {show('请先选择收单地点'); return R.F()}, R.T)(
R.path(['listOptionData', 3, 'value'], this.state)
)
}
// 处理提交后返回的数据
processReturnData() {
let { selfOrderOption } = this.props
......@@ -1475,7 +1759,7 @@ class SelfOrderPage extends Component {
// 返回备注以上的元素
renderListItem() {
let { listOptionData, dateModelPop } = this.state
let { listOptionData, dateModelPop, sysValues } = this.state
return (
<View style={styles.list_cont}>
<PageListArrow
......@@ -1495,6 +1779,58 @@ class SelfOrderPage extends Component {
listCallBack={() => this.handleOrganizationCheck(listOptionData[1])}
listHasArrow={true}
/>
{
sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listHasAster={sysValues.OBS_MOBILE_DEPARTMENT_DISPLAY > 2}
listItem={listOptionData[14]}
listName={'name'}
listTitle={'title'}
listCallBack={() => this.handleDepartmentCheck(listOptionData[14], null, 'department_name', 'department_code')}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_BM_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listHasAster={sysValues.OBS_MOBILE_BM_DISPLAY > 2}
listItem={listOptionData[15]}
listName={'name'}
listTitle={'title'}
listCallBack={this.handleDepartmentCheck.bind(this, listOptionData[15], 'business_manager_list', 'business_manager_name', 'business_manager_code')}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listHasAster={sysValues.OBS_MOBILE_SUR_FOLLOWER_DISPLAY > 2}
listItem={listOptionData[16]}
listName={'name'}
listTitle={'title'}
listCallBack={this.handleDepartmentCheck.bind(this, listOptionData[16], 'surgery_follower_list', 'surgery_follower_name', 'surgery_follower_code')}
listHasArrow={true}
/>
)
}
{
sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 1 && (
<PageListArrow
listActOpa={.8}
listHasAster={sysValues.OBS_MOBILE_DELIVERYMAN_DISPLAY > 2}
listItem={listOptionData[17]}
listName={'name'}
listTitle={'title'}
listCallBack={this.handleDepartmentCheck.bind(this, listOptionData[17], 'deliveryman_list', 'deliveryman_name', 'deliveryman_code')}
listHasArrow={true}
/>
)
}
<PageListArrow
listActOpa={.8}
listHasAster={true}
......@@ -1778,7 +2114,7 @@ class SelfOrderPage extends Component {
// url: 'https://obs.uat.sfrx.guke.tech/upload/dingding/image/QDw05sTo.jpg',
// },{
// url: 'https://obs.uat.sfrx.guke.tech/jeecg-boot/sys/common/view/upload/dingding/image/8V4599aH.jpg'
// }]
// }]
// 正式
let zoomImages = []
listOptionData[13].uploadImgArr.forEach(item => {
......@@ -1960,4 +2296,4 @@ const mapDispatchToProps = (dispatch) => {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(SelfOrderPage);
\ No newline at end of file
export default connect(mapStateToProps, mapDispatchToProps)(SelfOrderPage);
import Toast from 'react-native-root-toast';
import { Dimensions, Platform, NativeModules, PixelRatio, Text } from "react-native";
import * as R from 'ramda';
/**
* 提示框
......@@ -319,3 +320,10 @@ export const showErrorMessage = (dispatch, err, errorCallback, logTit) => {
show(error_msg);
dispatch(errorCallback());
}
/**
* 空值或空判断
*/
export const isBlank = R.anyPass([R.isNil, R.isEmpty])
export const isNotBlank = R.complement(isBlank)
......@@ -8,7 +8,9 @@
"test": "jest"
},
"dependencies": {
"@types/ramda": "^0.27.39",
"moment": "2.29.1",
"ramda": "^0.27.1",
"react": "16.8.3",
"react-native": "0.59.9",
"react-native-audio": "4.3.0",
......
......@@ -937,6 +937,13 @@
"@types/istanbul-lib-coverage" "*"
"@types/istanbul-lib-report" "*"
"@types/ramda@^0.27.39":
version "0.27.39"
resolved "https://registry.npm.taobao.org/@types/ramda/download/@types/ramda-0.27.39.tgz?cache=0&sync_timestamp=1615893039310&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Framda%2Fdownload%2F%40types%2Framda-0.27.39.tgz#7541d9d745a2003c8f635897dff8c65c12be9327"
integrity sha1-dUHZ10WiADyPY1iX3/jGXBK+kyc=
dependencies:
ts-toolbelt "^6.15.1"
"@types/stack-utils@^1.0.1":
version "1.0.1"
resolved "https://registry.npm.taobao.org/@types/stack-utils/download/@types/stack-utils-1.0.1.tgz?cache=0&sync_timestamp=1605057309059&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fstack-utils%2Fdownload%2F%40types%2Fstack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
......@@ -5155,6 +5162,11 @@ querystringify@^2.1.1:
resolved "https://registry.npm.taobao.org/querystringify/download/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
integrity sha1-M0WUG0FTy50ILY7uTNogFqmu9/Y=
ramda@^0.27.1:
version "0.27.1"
resolved "https://registry.npm.taobao.org/ramda/download/ramda-0.27.1.tgz#66fc2df3ef873874ffc2da6aa8984658abacf5c9"
integrity sha1-Zvwt8++HOHT/wtpqqJhGWKus9ck=
randomatic@^3.0.0:
version "3.1.1"
resolved "https://registry.npm.taobao.org/randomatic/download/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed"
......@@ -6519,6 +6531,11 @@ tr46@^1.0.1:
dependencies:
punycode "^2.1.0"
ts-toolbelt@^6.15.1:
version "6.15.5"
resolved "https://registry.npm.taobao.org/ts-toolbelt/download/ts-toolbelt-6.15.5.tgz#cb3b43ed725cb63644782c64fbcad7d8f28c0a83"
integrity sha1-yztD7XJctjZEeCxk+8rX2PKMCoM=
tslib@^1.9.0:
version "1.14.1"
resolved "https://registry.npm.taobao.org/tslib/download/tslib-1.14.1.tgz?cache=0&sync_timestamp=1609887539329&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftslib%2Fdownload%2Ftslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
......
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