Commit 4a599ed7 by peii

自助下单

parent e6f90090
......@@ -35,7 +35,7 @@
&-label
@extend .text
color primary_text_color
width 100px
width 120px
&-input
flex-direction row
......@@ -70,6 +70,32 @@
flex 1
width 100%
&-radio
flex 1
@extend .row
justify-content flex-end
&__item
@extend .row
align-items center
padding-left 20px
&-box
margin-right 8px
width 20px
height @width
border-color #ccc
border-width 1px
border-radius 10px
&-image
width 18px
height @width
&-text
@extend .text
color second_text_color
.red
color #f00
......
......@@ -19,7 +19,8 @@ import Input from './input'
import DatePicker from './date'
import ImageForm from './image'
import Audio from './audio'
import { g, isBlank, show, debounce } from '../../utils/utils'
import Radio from './radio'
import { g, isBlank, debounce } from '../../utils/utils'
import styles from './index.styl'
import { ActivityIndicator } from '@ant-design/react-native'
......@@ -34,6 +35,7 @@ const formComponents = {
[FieldType.DATE]: DatePicker,
[FieldType.IMAGE]: ImageForm,
[FieldType.VOICE]: Audio,
[FieldType.RADIO]: Radio
}
export default class Form extends Component<IProps> {
......
/*
* @FilePath: /BoneHouse_Business_APP/src/components/form/radio.tsx
* @Author: peii
* @Date: 2021-06-06 16:24:05
* @Vision: 1.0
* @Description: Radio组件
*
*/
// @ts-nocheck
import React, { Component } from 'react'
import { View, Text, Image, TouchableOpacity } from 'react-native'
import { IFormField, IOption } from 'bonehouse'
import { g } from '../../utils/utils'
import { Title } from './common'
import styles from './index.styl'
type IProps = {
item: IFormField
data: any
value: any
}
export default class RadioButton extends Component<IProps> {
shouldComponentUpdate(nextProps: IProps): boolean {
if (nextProps.value !== this.props.value) {
return true
}
return false
}
render() {
const { item, value, onChange } = this.props
return (
<View style={g(styles, 'form-item')}>
<Title item={item} />
<View style={g(styles, 'form-radio')}>
{item.options &&
item.options.map(option => {
return (
<TouchableOpacity
style={g(styles, 'form-radio__item')}
key={option.value}
activeOpacity={0.8}
onPress={() => {
if (value === option.value) return
onChange(item.field, option.value)
}}
>
<View style={g(styles, 'form-radio__item-box')}>
{value === option.value && (
<Image
style={g(styles, 'form-radio__item-image')}
source={require('../../assets/images/ic_checked_blue.png')}
></Image>
)}
</View>
<Text style={g(styles, 'form-radio__item-text')}>{option.label}</Text>
</TouchableOpacity>
)
})}
</View>
</View>
)
}
}
......@@ -5,15 +5,14 @@
* @Vision: 1.0
* @Description: 选择器组件
*
* @Revision:
*
*/
// @ts-nocheck
import React, { Component } from 'react'
import { View, Text, Image, TouchableOpacity } from 'react-native'
import { IFormField, IOption } from 'bonehouse'
import * as R from 'ramda'
import { isBlank, show, isRequired, isNotBlank, g } from '../../utils/utils'
import { FieldType } from '../../enums'
import { SelectMode } from '../../enums'
import { Title } from './common'
import { SelectModal } from './select-modal'
import styles from './index.styl'
......@@ -105,6 +104,11 @@ export default class Select extends Component<IProps> {
}
}
}
// 跳转到其他页面的选择
if (item.selectMode === SelectMode.PAGE) {
return item.customHandler && item.customHandler(item.field)
}
if (!item.loading && isBlank(item.options)) return show(`没有可选择的${item.label}`)
this.setState({ visible: true }, () => {
......@@ -156,9 +160,7 @@ export default class Select extends Component<IProps> {
<View style={g(styles, 'form-input')}>
{/* 值 */}
{isBlank(value) ? (
<Text style={g(styles, 'form-input__placeholder')}>
{item.placeholder || '请选择'}
</Text>
<Text style={g(styles, 'form-input__placeholder')}>{item.placeholder || '请选择'}</Text>
) : (
<Text numberOfLines={2} style={g(styles, 'form-input__text')}>
{val && val.label}
......@@ -167,10 +169,7 @@ export default class Select extends Component<IProps> {
{/* 箭头 */}
{item.arrow !== false && (
<Image
source={require('../../assets/images/arr_rig.png')}
style={g(styles, 'form-input__arrow')}
/>
<Image source={require('../../assets/images/arr_rig.png')} style={g(styles, 'form-input__arrow')} />
)}
</View>
</TouchableOpacity>
......
......@@ -26,3 +26,8 @@ export enum FieldType {
VOICE,
CUSTOM,
}
export enum SelectMode {
PAGE,
MODAL,
}
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/order/productions/index.tsx
* @Author: peii
* @Date: 2021-07-14 17:54:04
* @LastEditTime: 2021-07-14 18:01:56
* @LastEditors: peii
* @Vision: 1.0
* @Description:
*/
// @ts-nocheck
import React, { Component } from 'react'
import { View, Text, ScrollView } from 'react-native'
import { inject, observer } from 'mobx-react'
import { IOrganization, IFormField } from 'bonehouse'
import * as R from 'ramda'
import Form from '../../../components/form'
import { FieldType, SelectMode } from '../../../enums'
import Header from '../../../components/header/header'
import { g, getFormItem, isBlank, isNotBlank, show, translateSysprofile } from '../../../utils/utils'
import styles from './index.styl'
type IProps = {}
type IState = {}
class Productions extends Component<IProps, IState> {
render() {
const { navigation } = this.props
return (
<View style={g(styles, 'container')}>
<Header title="选择产品" backCallback={() => navigation.goBack()} />
</View>
)
}
}
export default inject('orgStore')(observer(Productions))
......@@ -161,7 +161,7 @@ class QuickOrder extends Component<IProps> {
options: [],
placeholder: '请选择',
rules: [{ required: true, message: '请选择手术模板' }],
refrence: ['sellerCode', 'orgCode', 'customerCode', 'surgeryType'],
refrence: ['sellerCode', 'orgCode', 'customerCode'],
},
{
field: 'surgeryDate',
......@@ -416,6 +416,10 @@ class QuickOrder extends Component<IProps> {
const item = getFormItem(formItems, 'billToSiteCode')
item.options = billToSites
this.setState({ formItems })
if (isNotBlank(customerCode)) {
this.getSurgeryTemplates()
}
}
/**
......
@import '../../assets/styles/base.styl'
@import '../../assets/styles/variable.styl'
\ No newline at end of file
......@@ -18,6 +18,7 @@ import Consumables from './pages/consume/consumables'
import ConsumeFee from './pages/consume/fee'
import QuickOrder from './pages/order/quick'
import SelfOrder from './pages/order/self'
import Productions from './pages/order/productions/index'
import Success from './pages/success/success'
function createNavigator() {
......@@ -112,6 +113,7 @@ function createNavigator() {
ConsumeFee: { screen: ConsumeFee },
QuickOrder: { screen: QuickOrder },
SelfOrder: { screen: SelfOrder },
Productions: { screen: Productions },
Success: { screen: Success },
},
{ initialRouteName: 'Main', ...options },
......
......@@ -47,6 +47,7 @@ declare module 'bonehouse' {
field: string
label: string
type: EnumType
selectMode?: EnumType
dateMode: 'date' | 'datetime'
options?: IOption[]
loading?: boolean
......
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