Commit 0a992408 by Denglingling

完善【快速下单】模块:

1、如 [手术医院]、[主治医生] 选择器改变值之后,其他字段需要重新选择的逻辑;
2、调整 [生成订单] 按钮颜色、监听当前必填项,提示未填必选项,以及填完必填项显示可提交状态;
3、新增 [库存不足] 弹窗,以及点击取消和确定的逻辑
parent ce8571b3
...@@ -15,6 +15,7 @@ import SubSuccessPage from './containers/selfOrder/module/SubSuccessPage'; ...@@ -15,6 +15,7 @@ import SubSuccessPage from './containers/selfOrder/module/SubSuccessPage';
import EquipConsuPage from './containers/equipConsu/EquipConsuPage'; import EquipConsuPage from './containers/equipConsu/EquipConsuPage';
import QuickOrderPage from './containers/quickOrder/QuickOrderPage'; import QuickOrderPage from './containers/quickOrder/QuickOrderPage';
import TransOrderPage from './containers/transOrder/TransOrderPage'; import TransOrderPage from './containers/transOrder/TransOrderPage';
import SubSuccPage from './containers/common/SubSuccPage';
const Router = createAppContainer(createStackNavigator({ const Router = createAppContainer(createStackNavigator({
LoginPage: { screen: LoginPage }, LoginPage: { screen: LoginPage },
...@@ -25,7 +26,8 @@ const Router = createAppContainer(createStackNavigator({ ...@@ -25,7 +26,8 @@ const Router = createAppContainer(createStackNavigator({
SubSuccessPage: {screen: SubSuccessPage}, SubSuccessPage: {screen: SubSuccessPage},
EquipConsuPage: {screen: EquipConsuPage}, EquipConsuPage: {screen: EquipConsuPage},
QuickOrderPage: {screen: QuickOrderPage}, QuickOrderPage: {screen: QuickOrderPage},
TransOrderPage: {screen: TransOrderPage} TransOrderPage: {screen: TransOrderPage},
SubSuccPage: {screen: SubSuccPage}
}, { }, {
navigationOptions: { navigationOptions: {
gesturesEnabled: true gesturesEnabled: true
......
export const BaseUrl = "http://192.168.10.188:8200"; // https://obs.uat.sfrx.guke.tech https://sob-os.uat.sfrx.guke.tech // export const BaseUrl = "http://192.168.10.188:8200"; // https://obs.uat.sfrx.guke.tech https://sob-os.uat.sfrx.guke.tech
export const BaseUrlOther = "http://192.168.10.188:8200"; //http://192.168.10.188:8200/v1/dingding/upload_media // export const BaseUrlOther = "http://192.168.10.188:8200"; //http://192.168.10.188:8200/v1/dingding/upload_media
export const VERSION = '/v1'; // /api/latest // export const VERSION = '/v1'; // /api/latest
export const BaseUrl = "https://obs.uat.sfrx.guke.tech"; // https://obs.uat.sfrx.guke.tech https://sob-os.uat.sfrx.guke.tech
export const BaseUrlOther = "https://sob-os.uat.sfrx.guke.tech"; //http://192.168.10.188:8200/v1/dingding/upload_media
export const VERSION = '/api/latest'; //
export const ACCESS_TOKEN = '201904091445193616b5e3d3a777848dda1de1a8123d0fdf9xw7t566c1S92U88';//未获取到access_token时使用 export const ACCESS_TOKEN = '201904091445193616b5e3d3a777848dda1de1a8123d0fdf9xw7t566c1S92U88';//未获取到access_token时使用
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
Modal,
ScrollView,
TouchableOpacity,
Image
} from 'react-native';
import {
Width,
pxHeight,
third_text_color,
second_text_color,
first_text_color,
safe_view,
pxSize,
font_family_medium,
icon_style,
font_family_regular,
font_family_semibold,
title_text_color,
promary_color
} from '../../base/BaseStyle';
class NotEnoughModel extends Component {
constructor(props) {
super(props);
this.state = {
isVisible: this.props.show,
notEnoughList: this.props.notEnoughList,
title: '以下物品缺失,是否继续提交?',
not_enough_items_list: [
{
"item_code": "AR00000004",
"reg_number": "国械注进20173466362",
"plan_quantity": 10,
"specification": "2.2mm带线锚钉,蓝色缝线",
"item_name": "钛合金缝线锚钉",
"general_name": "钛合金锚钉",
"storage_quantity": 0
},
{
"item_code": "AR00000003",
"reg_number": "国械注进20173466362",
"plan_quantity": 10,
"specification": "3.5*12.1,蓝色缝线",
"item_name": "钛合金缝线锚钉",
"general_name": "钛合金锚钉",
"storage_quantity": 6
},
{
"item_code": "AR00000002",
"reg_number": "国械注进20173466362",
"plan_quantity": 10,
"specification": "5.0X15.5,蓝色缝线",
"item_name": "钛合金缝线锚钉",
"general_name": "钛合金锚钉",
"storage_quantity": 4
}
],
}
}
componentWillReceiveProps(nextProps) {
// console.warn('------show--------------',nextProps.show, this.state.isVisible )
if (this.state.isVisible != nextProps.show) {
this.setState({
isVisible: nextProps.show
});
}
if (this.state.notEnoughList != nextProps.notEnoughList) {
this.setState({
notEnoughList: nextProps.notEnoughList
})
}
}
// 取消
closeModal() {
this.setState({
isVisible: false
});
this.props.closeModal(false);
}
// 确定
submitModal() {
console.log('确定!!!')
this.props.callback();
this.closeModal()
}
renderNotEnItem(item, index) {
return (
<TouchableOpacity
activeOpacity={1}
style={styles.cont_list}>
<Text style={[styles.co_li, styles.co_str]}>{item.item_name}({item.item_code})</Text>
<Text style={styles.co_li}>{item.general_name}</Text>
<Text style={styles.co_li}>{item.specification}</Text>
<Text style={styles.co_li}>{item.reg_number}</Text>
<Text style={styles.co_li}>{item.item_name}</Text>
<Text style={styles.co_li}>
计划数量:
<Text style={styles.plan_num}>{item.plan_quantity}</Text>
</Text>
<Text style={styles.co_li}>
库存数量:
<Text style={styles.sto_num}>{item.storage_quantity}</Text>
</Text>
</TouchableOpacity>
)
}
renderDialog() {
let { notEnoughList, title, not_enough_items_list } = this.state
return (
<View style={styles.opt_area}>
<View style={styles.modal_style}>
<View style={styles.modal_head}>
<View style={styles.modal_tit}>
<Image style={styles.err_icon} source={require('../../images/err_tit.png')} />
<Text style={styles.inner_tit}>{title}</Text>
</View>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.closeModal()}
style={styles.head_tou_clo}
>
<Image style={icon_style} source={require('../../images/close_icon.png')}></Image>
</TouchableOpacity>
</View>
<View style={styles.scro_box}>
<ScrollView
style={styles.item_scroll}
// showsVerticalScrollIndicator={false}
>
{/* notEnoughList not_enough_items_list */}
{
notEnoughList.map((item, index) => this.renderNotEnItem(item, index))
}
</ScrollView>
</View>
<View style={styles.model_footer}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.closeModal()}
style={[styles.foo_btn, styles.btn_cel]}
>
<Text style={[styles.btn_tit, styles.tit_cel]}>取消</Text>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.submitModal()}
style={[styles.foo_btn, styles.btn_sub]}
>
<Text style={styles.btn_tit}>确定</Text>
</TouchableOpacity>
</View>
</View>
</View>
)
}
render() {
return (
<View style={styles.dia_container}>
<Modal
transparent={true}
visible={this.state.isVisible}
animationType={'fade'}
onRequestClose={() => this.closeModal()}>
<View style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1}
// onPress={() => this.closeModal()}
>
{this.renderDialog()}
</TouchableOpacity>
</View>
</Modal>
</View>
);
}
}
const styles = StyleSheet.create({
dia_container: {
flex: 1,
},
dis_cont: {
width: '80%',
maxHeight: '80%',
backgroundColor: '#FFF',
borderRadius: 10
},
container: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
},
opt_area: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
position: 'relative'
},
modal_style: {
position: "absolute",
left: 0,
top: '26%',
width: Width() - 40,
flex: 1,
flexDirection: "column",
backgroundColor: '#ffffff',
minHeight: pxHeight(380),
borderRadius: 20,
marginHorizontal: 20,
paddingHorizontal: 20,
paddingTop: 20,
paddingBottom: 30
},
item: {
width: Width(),
height: 40,
paddingLeft: 20,
paddingRight: 20,
alignItems: 'center'
},
itemText: {
fontSize: 16,
color: third_text_color
},
curr_item: {
color: first_text_color,
fontWeight: 'bold'
},
scro_box: {
marginTop: 14,
maxHeight: pxHeight(320),
minHeight: pxHeight(220),
borderWidth: 1,
borderColor: '#E0E0E0',
paddingLeft: 4
},
item_scroll: {},
modal_head: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'flex-end'
},
modal_tit: {
flexDirection: 'row',
alignItems: 'center'
},
err_icon: {
width: pxSize(18),
height: pxSize(18),
marginRight: 4
},
inner_tit: {
fontSize: 16,
fontFamily: font_family_medium
},
head_tou_clo: {
width: pxSize(28),
height: pxSize(28)
},
cont_list: {},
co_li: {
lineHeight: 20,
fontSize: 14,
fontFamily: font_family_regular,
color: second_text_color
},
co_str: {
fontFamily: font_family_semibold,
fontWeight: '500',
fontSize: 16,
paddingTop: 6,
paddingBottom: 2,
color: first_text_color
},
plan_num: {
fontSize: 16,
fontFamily: font_family_semibold
},
sto_num: {
fontSize: 16,
fontFamily: font_family_semibold,
color: 'red'
},
model_footer: {
flexDirection: 'row',
justifyContent: 'space-around'
},
foo_btn: {
width: pxSize(100),
height: pxSize(36),
borderRadius: 5,
marginTop: 20
},
btn_cel: {
backgroundColor: '#E0E0E0'
},
btn_sub: {
backgroundColor: promary_color
},
btn_tit: {
fontSize: 16,
color: title_text_color,
textAlign: 'center',
lineHeight: 32
},
tit_cel: {
color: first_text_color
},
})
export default NotEnoughModel;
\ No newline at end of file
import React, { Component } from 'react';
import {
SafeAreaView,
StyleSheet,
View,
Text,
Image,
TouchableOpacity,
Clipboard
} from 'react-native';
import { connect } from 'react-redux';
import HeadBackItem from './HeadBackItem';
import {
promary_color,
second_text_color,
first_text_color,
pxSize,
title_text_color,
safe_view,
font_family_medium,
font_family_regular
} from '../../base/BaseStyle';
import StatusBarView from './StatusBarView';
class SubSuccPage extends Component {
constructor(props) {
super(props);
this.state = {
orderVal: '20200318121230'
}
}
componentDidMount() {
let {orderNumber} = this.props.navigation.state.params
if(orderNumber) {
this.setState({
orderVal: orderNumber+''
})
}
}
async handleSubmit() {
console.warn('复制订单号并返回主页')
let { orderVal } = this.state
console.log('---orderNumber---', orderVal, typeof orderVal)
Clipboard.setString(orderVal)
// 获取复制的值
let str = await Clipboard.getString()
console.warn(str)
// 返回首页
let { navigation } = this.props
setTimeout(() => {
navigation.navigate('HomePage')
}, 500)
}
render() {
let {navigation} = this.props
let {title } = navigation.state.params
let { state } = this
return (
<View style={styles.succ_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.succ_inner}>
<View style={styles.img_box}>
<Image source={require('../../images/cor_green.png')} style={styles.img_icon}/>
</View>
<Text style={styles.succ_title}>{'提交成功'}</Text>
<Text style={styles.succ_text}>{'订单号:'} { state.orderVal }</Text>
<TouchableOpacity
activeOpacity={.9}
style={styles.succ_btn}
onPress={() => this.handleSubmit()}
>
<Text style={styles.btn_text}>{'复制订单号并返回主页'}</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
</View>
);
}
}
const styles = StyleSheet.create({
succ_container: {
flex: 1
},
succ_inner: {
justifyContent: 'center',
alignItems: 'center',
paddingTop: '26%'
},
img_box: {
width: pxSize(80),
height: pxSize(80)
},
img_icon: {
width: '100%',
height: '100%'
},
succ_title: {
fontSize: 17,
fontFamily: font_family_medium,
// fontWeight: 'bold',
color: first_text_color,
paddingTop: 8,
paddingBottom: 20
},
succ_text: {
fontSize: 14,
color: second_text_color,
paddingBottom: 30,
fontFamily: font_family_regular
},
succ_btn: {
backgroundColor: promary_color,
width: pxSize(330),
borderRadius: 30,
height: 48,
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
},
btn_text: {
color: title_text_color,
fontSize: 16,
fontFamily: font_family_regular
}
})
export default SubSuccPage;
\ No newline at end of file
...@@ -28,7 +28,6 @@ export const GetRequest = (url) => { ...@@ -28,7 +28,6 @@ export const GetRequest = (url) => {
const opts = { const opts = {
method: 'GET', method: 'GET',
headers: { headers: {
// 'Accept': 'application/json',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
timeout: 20000 //20s超时 timeout: 20000 //20s超时
...@@ -40,7 +39,7 @@ export const GetRequest = (url) => { ...@@ -40,7 +39,7 @@ export const GetRequest = (url) => {
} }
let allUrl = endBashUrl + VERSION + url let allUrl = endBashUrl + VERSION + url
console.warn('---allUrl--=================--', allUrl) // console.warn('---allUrl--=================--', allUrl)
// return fetch(BaseUrl + VERSION + url, opts) // return fetch(BaseUrl + VERSION + url, opts)
return fetch(allUrl, opts) return fetch(allUrl, opts)
.then(response => response.json()) .then(response => response.json())
......
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