Commit c3b8571d by Denglingling

调整APP-选择产品通过模拟接口数据实现

parent e62546a8
......@@ -8,7 +8,8 @@ import {
SELF_SUBMIT_DOING,
SELF_SUBMIT_SUCCESS,
SELF_SUBMIT_FAILURE,
SELF_INIT_DATA
SELF_INIT_DATA,
SET_SELECT_PRODUCT_OPTS
} from '../base/ActionTypes';
import local_inter_mock from '../containers/selfOrder/module/mock/inter_mock'
......@@ -278,7 +279,11 @@ export const reqScatEquipmentSearch = async (global_domain_config, params) => {
// 选择产品-单点耗材查询接口
export const reqSingleConsumSearch = async (global_domain_config, params) => {
if(params.leftIndex && params.leftIndex%2 === 0){
return local_inter_mock.inter_9
}else {
return local_inter_mock.inter_99
}
return await GetRequest(global_domain_config, getUrlParams('/order/item_detail/search', params))
}
......@@ -307,3 +312,11 @@ export function setSelfInitData() {
type: SELF_INIT_DATA
}
}
// 存储选择产品数据
export function setSelectProductOpts(data) {
return {
type: SET_SELECT_PRODUCT_OPTS,
rawData: data
}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ export const SELF_SUBMIT_DOING = "SELF_SUBMIT_DOING"
export const SELF_SUBMIT_SUCCESS = "SELF_SUBMIT_SUCCESS"
export const SELF_SUBMIT_FAILURE = "SELF_SUBMIT_FAILURE"
export const SELF_INIT_DATA = "SELF_INIT_DATA"
export const SET_SELECT_PRODUCT_OPTS = "SET_SELECT_PRODUCT_OPTS"
//-----------quick order---------------------
export const QUICK_ORDER_LIST_NO = "QUICK_ORDER_LIST_NO"
export const QUICK_ORDER_LIST_DOING = "QUICK_ORDER_LIST_DOING"
......
......@@ -371,6 +371,9 @@ export const list_common_item = {
fontSize: 16,
fontFamily: font_family_regular
},
lef_tip_num:{
fontSize: 20
},
rig_btn: {
backgroundColor: promary_color,
width: '35%',
......
/**
* 存储监听事件类型
*/
export default class EmitterEvents {
/**
* 选择产品回到自助下单
*/
static BACK_TO_SELF_PAGE = 'BACK_TO_SELF_PAGE'
}
\ No newline at end of file
......@@ -36,7 +36,7 @@ class LodingModel extends Component {
<View style={styles.container}>
<Modal
transparent={true}
visible={this.state.isVisible}
visible={!!this.state.isVisible}
animationType={'fade'}
// onRequestClose={() => this.closeModal()}>
>
......
import React, { Component } from 'react';
import {
ActivityIndicator,
SafeAreaView,
View,
Text,
StyleSheet,
Modal
} from 'react-native';
import {
safe_view,
promary_color
} from '../../../base/BaseStyle';
/** 加载中 */
class LoadingModel extends Component {
constructor(props) {
super(props);
this.state = {
title: '加载中',
isVisible: false
}
}
show(newTitle){
let {title} = this.state
if(newTitle){
title = newTitle
}
this.setState({ isVisible: true, title: title })
}
hide(){
let {title} = this.state
this.setState({ isVisible: false, title: title})
}
render() {
let { title, size, color, style_back } = this.props
// console.log('==aaa=LoadingModel===', this.state.isVisible)
return (
<View style={styles.container}>
<Modal
transparent={true}
visible={!!this.state.isVisible}
animationType={'fade'}
>
<SafeAreaView style={safe_view}>
<View style={[styles.loding_cont, style_back]}>
<View style={styles.loding_title}>
<ActivityIndicator size={size ? size : "small"} color={color ? color : promary_color} />
<Text style={styles.tit_inner}>{title ? title : this.state.title}</Text>
</View>
</View>
</SafeAreaView>
</Modal>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1
},
loding_cont: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.1)',
paddingTop: '55%',
alignItems: 'center'
},
loding_title: {
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row'
},
tit_inner: {
fontSize: 16,
paddingLeft: 10,
color: promary_color
}
})
export default LoadingModel;
\ No newline at end of file
......@@ -37,6 +37,7 @@ class PicTitDetaiCalcu extends Component {
clearCallBack: PropTypes.func, // 清空图标回调函数
onlyShowNum: PropTypes.bool, // 只展示数字
onlyShowSelect: PropTypes.bool, // 只能单选
listMaxNum: PropTypes.number, // 数量限制最大值
}
constructor(props) {
......@@ -92,7 +93,7 @@ class PicTitDetaiCalcu extends Component {
render() {
let { listItem, listIndex, calField, listStyleBox, listStyleTit, listStyleTip, listStyleCalBtn, listPicType, titCallBack,
titText, tipTextStr, tipTextOne, tipTextTwo, listImgIcon, listStyleImg, showClearIcon, showClearIndex, listCardActIndex,
listStyleClearBtn, clearCallBack, onlyShowNum, onlyShowSelect, tipTextStrTit, tipTextOneTit, tipTextTwoTit, global_domain_config } = this.props
listStyleClearBtn, clearCallBack, onlyShowNum, onlyShowSelect, tipTextStrTit, tipTextOneTit, tipTextTwoTit, global_domain_config,listMaxNum } = this.props
let { listPicTypeArr, picStyleArr } = this.state
let picOthStyle = ''
if (listPicTypeArr.indexOf(listPicType) > -1) {
......@@ -107,6 +108,10 @@ class PicTitDetaiCalcu extends Component {
if (onlyShowSelect && listItem.select) {
defSelIcon = require('../../../images/radio_yes.png')
}
let showPlusIcon = true
if(listMaxNum && listItem[calField] === listMaxNum){
showPlusIcon = false
}
let cur_photos = []
if(listItem[listImgIcon] instanceof Array){
......@@ -180,7 +185,7 @@ class PicTitDetaiCalcu extends Component {
</View>
</TouchableOpacity> : null}
{(listItem[calField] !== 0 && !onlyShowSelect) ? <Text style={[styles.thr_num, onlyShowNum ? styles.show_num : null]}>{listItem[calField]}</Text> : null}
{(!onlyShowNum && !onlyShowSelect) ? <TouchableOpacity
{(!onlyShowNum && !onlyShowSelect && showPlusIcon) ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex, true)}
......
import React, { Component } from 'react';
import { View, Text, SafeAreaView, StyleSheet, TouchableOpacity, Image, ScrollView, TextInput, Alert, Linking, NativeModules, Platform } from 'react-native';
import { View, Text, SafeAreaView, StyleSheet, TouchableOpacity, Image, ScrollView, TextInput, Alert, Linking, NativeModules, Platform, DeviceEventEmitter } from 'react-native';
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 {
......@@ -19,10 +19,11 @@ 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 } from '../../action/SelfAction';
import { requestSelfOrganizations, requestSelfSurgeryHospital, requestSelfOrderType, requestSelfTemplateCollect, requestSelfAudio, requestSelfSumbit, setSelfInitData, reqSelfSurgeryHospital, requestListDataSuccess, requestSelfSurgeryType, setSelectProductOpts } from '../../action/SelfAction';
import { exitLoginStatus } 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 EmitterEvents from '../common/EmitterEvents';
class SelfOrderPage extends Component {
constructor(props) {
......@@ -161,6 +162,14 @@ class SelfOrderPage extends Component {
componentDidMount() {
this.getSellerName()
this.getAudioAuthorize()
this.subscription = DeviceEventEmitter.addListener(EmitterEvents.BACK_TO_SELF_PAGE, (params) => {
console.log('选择产品返回==', params)
})
}
componentWillUnmount() {
this.props.setSelectProductOpts([])
this.subscription.remove()
}
// 赋值销售员 初始化数据
......@@ -1835,7 +1844,8 @@ const mapStateToProps = (state) => {
self_list_status: state.selfOrder.self_list_status,
submit_self_order_status: state.selfOrder.submit_self_order_status,
selfOrderOption: state.selfOrder.selfOrderOption,
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
}
}
......@@ -1867,6 +1877,9 @@ const mapDispatchToProps = (dispatch) => {
},
requestSelfSurgeryType: (params) => {
dispatch(requestSelfSurgeryType(params))
},
setSelectProductOpts: (data) => {
dispatch(setSelectProductOpts(data))
}
}
}
......
......@@ -12,6 +12,7 @@ import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
import PictureZoom from '../../common/listDataComponent/PictureZoom';
import { cloneObject, show } from '../../../utils/Utils';
import { reqSurTempLineSearch, reqNailBoxLineSearch, reqEquipPackageLineSearch } from '../../../action/SelfAction';
import LoadingModel from '../../common/listDataComponent/LoadingModel';
import localMockData from './mock/sen_mock';
const SELECTED_QUQNTITY = 'selectedQuantity' // 三级数量
......@@ -89,6 +90,8 @@ class EditThirdLevelPage extends Component {
let { defalutTopItem, topProcOptionList } = that.state
let { leftIndex, superIndex, superItem, thirdShow } = superData
console.log('父组件传递的值==', leftIndex, superIndex, superItem, thirdShow)
that.refs.LoadingModel.show()
that.setState({
superData: cloneObject(superData)
})
......@@ -123,6 +126,7 @@ class EditThirdLevelPage extends Component {
that.setState({
topProcOptionList: topProcOptionList
}, () => {
that.refs.LoadingModel.hide()
that.setAllSelectData()
})
} else {
......@@ -148,7 +152,7 @@ class EditThirdLevelPage extends Component {
topProcOptionList: topProcOptionList,
onlyShow: true
}, () => {
// that.setAllSelectData()
that.refs.LoadingModel.hide()
})
} else {
that.showRrrorTip(nail_line_search)
......@@ -171,7 +175,7 @@ class EditThirdLevelPage extends Component {
topProcOptionList: topProcOptionList,
onlyShow: true
}, () => {
// that.setAllSelectData()
that.refs.LoadingModel.hide()
})
} else {
that.showRrrorTip(equip_line_search)
......@@ -260,6 +264,7 @@ class EditThirdLevelPage extends Component {
// 接口错误提示
showRrrorTip(result) {
this.refs.LoadingModel.hide()
if (result.error_code == 41006) {
show('登录过期,请重新登录');
this.props.exitLoginStatus();
......@@ -367,6 +372,9 @@ class EditThirdLevelPage extends Component {
renderItem={({ item, index }) => this.renderContColumnItem(item, index)}
/>
</ScrollView>
{ this.renderLodingItem() }
</View>
)
}
......@@ -432,6 +440,13 @@ class EditThirdLevelPage extends Component {
)
}
// 返回正在加载中
renderLodingItem() {
return(
<LoadingModel ref="LoadingModel"/>
)
}
render() {
let { navigation } = this.props
let { title } = navigation.state.params
......
......@@ -7,14 +7,16 @@ import {
SELF_SUBMIT_DOING,
SELF_SUBMIT_SUCCESS,
SELF_SUBMIT_FAILURE,
SELF_INIT_DATA
SELF_INIT_DATA,
SET_SELECT_PRODUCT_OPTS
} from '../../base/ActionTypes';
// 自助下单状态
const defaultState = {
self_list_status: SELF_ORDER_LIST_NO, // 获取数据状态
submit_self_order_status: SELF_SUBMIT_NO, // 提交订单状态
selfOrderOption: {} // 当前临时存储数据
selfOrderOption: {}, // 当前临时存储数据
local_sele_pro_options: {}, // 选择产品临时存储
}
export default selfOrder = (state = defaultState, action) => {
......@@ -39,7 +41,8 @@ export default selfOrder = (state = defaultState, action) => {
case SELF_SUBMIT_SUCCESS:
return Object.assign({}, state, {
submit_self_order_status: SELF_SUBMIT_SUCCESS,
selfOrderOption: {} // 清空当前临时数据
selfOrderOption: {}, // 清空当前临时数据
local_sele_pro_options: {}
})
case SELF_SUBMIT_FAILURE:
return Object.assign({}, state, {
......@@ -50,7 +53,12 @@ export default selfOrder = (state = defaultState, action) => {
// 初始化数据
self_list_status: SELF_ORDER_LIST_NO,
submit_self_order_status: SELF_SUBMIT_NO,
selfOrderOption: {}
selfOrderOption: {},
local_sele_pro_options: {}
})
case SET_SELECT_PRODUCT_OPTS:
return Object.assign({}, state, {
local_sele_pro_options: action.rawData
})
default:
return state;
......
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