Commit d7704f9d by wong.peiyi

快速下单

parent c45a3cef
...@@ -25,7 +25,6 @@ import { ActivityIndicator } from '@ant-design/react-native' ...@@ -25,7 +25,6 @@ import { ActivityIndicator } from '@ant-design/react-native'
type IProps = { type IProps = {
fields: IFromField[] fields: IFromField[]
data: { [key: string]: any } data: { [key: string]: any }
modalCallback: Function
} }
const formComponents = { const formComponents = {
...@@ -46,7 +45,6 @@ export default class Form extends Component<IProps> { ...@@ -46,7 +45,6 @@ export default class Form extends Component<IProps> {
componentDidMount() { componentDidMount() {
this.onChange = this.onChange.bind(this) this.onChange = this.onChange.bind(this)
this.modalCallback = this.modalCallback.bind(this)
this.checkCanSubmit = debounce(this.checkCanSubmit.bind(this)) this.checkCanSubmit = debounce(this.checkCanSubmit.bind(this))
this.submitHandler = debounce(this.submitHandler.bind(this), 500) this.submitHandler = debounce(this.submitHandler.bind(this), 500)
} }
...@@ -126,7 +124,7 @@ export default class Form extends Component<IProps> { ...@@ -126,7 +124,7 @@ export default class Form extends Component<IProps> {
data={data} data={data}
fields={fields} fields={fields}
onChange={this.onChange} onChange={this.onChange}
modalCallback={this.modalCallback} modalCallback={this.modalCallback.bind(this)}
/> />
) )
})} })}
......
...@@ -50,10 +50,6 @@ export default class Select extends Component<IProps> { ...@@ -50,10 +50,6 @@ export default class Select extends Component<IProps> {
this.onChange = this.onChange.bind(this) this.onChange = this.onChange.bind(this)
} }
shouldComponentUpdate(nextProps: IProps) {
return true
}
componentWillReceiveProps(nextProps, nextState) { componentWillReceiveProps(nextProps, nextState) {
const { item, value } = nextProps const { item, value } = nextProps
const { visible, loading } = this.state const { visible, loading } = this.state
......
...@@ -23,5 +23,6 @@ export enum FieldType { ...@@ -23,5 +23,6 @@ export enum FieldType {
CHECKBOX, CHECKBOX,
RADIO, RADIO,
IMAGE, IMAGE,
CUSTOM VOICE,
CUSTOM,
} }
...@@ -72,8 +72,8 @@ class Index extends Component<IProps> { ...@@ -72,8 +72,8 @@ class Index extends Component<IProps> {
*/ */
navigateToBizPage(fun: IFunction) { navigateToBizPage(fun: IFunction) {
const pages = { const pages = {
MOBILE_BORROW_ORDER: '', MOBILE_BORROW_ORDER: 'QuickOrder',
MOBILE_SELF_HELP_ORDER: 'Success', MOBILE_SELF_HELP_ORDER: '',
MOBILE_CONSUMP_CONFIRMA: 'Consume', MOBILE_CONSUMP_CONFIRMA: 'Consume',
MOBILE_DEVICE_INFORMATION: '', MOBILE_DEVICE_INFORMATION: '',
MOBILE_TRANSFER_APPLICATION: '', MOBILE_TRANSFER_APPLICATION: '',
......
@import '../../assets/styles/base.styl'
@import '../../assets/styles/variable.styl'
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/order/quick.tsx
* @Author: peii
* @Date: 2021-05-30 14:38:19
* @Vision: 1.0
* @Description: 快速下单页面
*
* @Revision:
*
*/
import React, { Component } from 'react'
import { View, Text, ScrollView } from 'react-native'
import { inject, observer } from 'mobx-react'
import { toJS } from 'mobx'
import { IOrganization, ISurgeryCollectHeader, IFee } from 'bonehouse'
import * as R from 'ramda'
import Form from '../../components/form'
import { FieldType } from '../../enums'
import Header from '../../components/header/header'
import { g, getFormItem, isBlank, isNotBlank, show } from '../../utils/utils'
import styles from './quick.styl'
type IProps = {
sysStore: {
sysProfiles: {
// APP下单是否显示部门权限
OBS_MOBILE_DEPARTMENT_DISPLAY: string
// APP下单是否显示业务经理权限
OBS_MOBILE_BM_DISPLAY: string
// APP下单是否显示跟台员权限
OBS_MOBILE_SUR_FOLLOWER_DISPLAY: string
// APP下单是否显示送货员权限
OBS_MOBILE_DELIVERYMAN_DISPLAY: string
}
}
userStore: {
userName: string
personName: string
}
orgStore: {
organizations: IOrganization[]
orgs: Function
getCustomers: Function
customers: Function
getDepartmentsBySellerAndOrg: Function
departments: Function
followers: Function
}
}
class QuickOrder extends Component<IProps> {
constructor(props) {
super(props)
this.setData = this.setData.bind(this)
this.submitHandler = this.submitHandler.bind(this)
}
state = {
data: {
sellerCode: this.props.userStore.userName,
},
formItems: [
{
field: 'sellerCode',
label: '销售员',
type: FieldType.SELECT,
options: [
{
label: this.props.userStore.personName,
value: this.props.userStore.userName,
},
],
placeholder: '请选择',
rules: [{ required: true, message: '请选择销售员' }],
disabled: true,
},
{
field: 'orgCode',
label: '组织',
type: FieldType.SELECT,
options: this.props.orgStore.orgs(),
placeholder: '请选择',
rules: [{ required: true, message: '请选择组织' }],
callback: this.setOrgCallback.bind(this),
},
{
field: 'customerCode',
label: '客户',
type: FieldType.SELECT,
options: [],
placeholder: '请选择',
rules: [{ required: true, message: '请选择客户' }],
refrence: ['orgCode'],
callback: this.setCustomerCallback.bind(this),
},
{
field: 'billToSiteCode',
label: '收单地点',
type: FieldType.SELECT,
options: [],
placeholder: '请选择',
rules: [{ required: true, message: '请选择收单地点' }],
refrence: ['orgCode', 'customerCode'],
callback: this.setCustomerCallback.bind(this),
},
{
field: 'shipToSiteCode',
label: '收货地点',
type: FieldType.SELECT,
options: [],
placeholder: '请选择',
rules: [{ required: true, message: '请选择收货地点' }],
refrence: ['orgCode', 'customerCode'],
// callback: this.setCustomerCallback.bind(this),
},
{
field: 'doctorName',
label: '主治医生',
type: FieldType.SELECT,
options: [],
placeholder: '请选择',
rules: [{ required: true, message: '请选择主治医生' }],
refrence: ['orgCode', 'customerCode'],
// callback: this.setCustomerCallback.bind(this),
},
{
field: 'surgeryTypeName',
label: '手术类型',
type: FieldType.SELECT,
options: [],
placeholder: '请选择',
rules: [],
refrence: ['orgCode', 'customerCode'],
// callback: this.setCustomerCallback.bind(this),
},
{
field: 'templateCollectNumber',
label: '手术模板',
type: FieldType.SELECT,
options: [],
placeholder: '请选择',
rules: [{ required: true, message: '请选择手术模板' }],
refrence: ['orgCode', 'customerCode'],
},
{
field: 'surgeryDate',
label: '手术时间',
type: FieldType.DATE,
dateMode: 'datetime',
placeholder: '请选择',
rules: [{ required: true, message: '请选择手术时间' }],
refrence: ['orgCode'],
},
{
field: 'orderTypeCode',
label: '订单类型',
type: FieldType.SELECT,
placeholder: '请选择',
rules: [{ required: true, message: '请选择订单类型' }],
refrence: ['orgCode'],
},
{
field: 'surgeryDesc',
label: '备注',
type: FieldType.TEXT,
placeholder: '请输入备注',
multiline: true,
rules: [],
},
{
field: 'voiceUrl',
label: '录音',
type: FieldType.VOICE,
placeholder: '还有什么要安排的,可录音备注哟!',
},
],
}
componentDidMount() {
this.setOptionsFormItems()
}
/**
* @description: 设置配置性的表单字段
*/
setOptionsFormItems() {
const { sysProfiles } = this.props.sysStore
}
/**
* @description: 设置修改值
* @param {*} key
* @param {*} vlaue
* @return {*}
*/
setData(key: string, value: any) {
return new Promise<any>((resolve, reject) => {
const { data, formItems } = this.state
data[key] = value
this.setState({ data }, () => {
const item = getFormItem(formItems, key)
item && item.callback && item.callback()
resolve()
})
})
}
setOrgCallback() {}
setCustomerCallback() {}
submitHandler() {}
render() {
const { formItems, data } = this.state
const { navigation } = this.props
const title = navigation.getParam('title', '骨科智慧仓')
return (
<View style={g(styles, 'container', 'bg-gray')}>
<Header
title={title}
backCallback={() => {
navigation.goBack()
}}
/>
{/* form表单 */}
<Form
fields={formItems}
data={data}
onChange={this.setData}
ref={ref => (this.formRef = ref)}
submitHandler={this.submitHandler}
/>
</View>
)
}
}
export default inject('sysStore', 'userStore', 'orgStore')(observer(QuickOrder))
...@@ -14,6 +14,7 @@ import Signin from './pages/signin/signin' ...@@ -14,6 +14,7 @@ import Signin from './pages/signin/signin'
import Consume from './pages/consume/consume' import Consume from './pages/consume/consume'
import Consumables from './pages/consume/consumables' import Consumables from './pages/consume/consumables'
import ConsumeFee from './pages/consume/fee' import ConsumeFee from './pages/consume/fee'
import QuickOrder from './pages/order/quick'
import Success from './pages/success/success' import Success from './pages/success/success'
function createNavigator() { function createNavigator() {
...@@ -89,6 +90,7 @@ function createNavigator() { ...@@ -89,6 +90,7 @@ function createNavigator() {
Consume: { screen: Consume }, Consume: { screen: Consume },
Consumables: { screen: Consumables }, Consumables: { screen: Consumables },
ConsumeFee: { screen: ConsumeFee }, ConsumeFee: { screen: ConsumeFee },
QuickOrder: { screen: QuickOrder },
Success: { screen: Success }, Success: { screen: Success },
}, },
{ initialRouteName: 'Main', ...options }, { initialRouteName: 'Main', ...options },
......
...@@ -108,7 +108,10 @@ export default class Organization { ...@@ -108,7 +108,10 @@ export default class Organization {
*/ */
getOrganizations = flow(function* (this: Organization) { getOrganizations = flow(function* (this: Organization) {
const res = yield this.service.getOrganizations() const res = yield this.service.getOrganizations()
this.organizations = res.data.organizations this.organizations = R.compose(
R.uniqBy(R.prop('orgCode')),
R.pathOr([], ['data', 'organizations']),
)(res)
this.inventories = res.data.inventories this.inventories = res.data.inventories
}) })
......
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