Commit a124115d by peii

快速下单及自助下单

parent 843e1828
......@@ -5,6 +5,7 @@
* @format
* @flow
*/
// @ts-nocheck
import React, { Component } from 'react'
import { Text, TextInput, View } from 'react-native'
import CodePush from 'react-native-code-push'
......
......@@ -5,16 +5,13 @@
* @Vision: 1.0
* @Description: 首页
*
* @Revision:
*
*/
// @ts-nocheck
import React, { Component } from 'react'
import { View, Text, TouchableOpacity, Image, ScrollView, RefreshControl } from 'react-native'
import slashScreen from 'react-native-splash-screen'
import { observer, inject } from 'mobx-react'
import { IFunction } from 'bonehouse'
import Resolution from '../../components/common/Resolution'
import Header from '../../components/header/header'
import { g } from '../../utils/utils'
import styles from './index.styl'
......@@ -75,7 +72,7 @@ class Index extends Component<IProps> {
navigateToBizPage(fun: IFunction) {
const pages = {
MOBILE_BORROW_ORDER: 'QuickOrder',
MOBILE_SELF_HELP_ORDER: '',
MOBILE_SELF_HELP_ORDER: 'SelfOrder',
MOBILE_CONSUMP_CONFIRMA: 'Consume',
MOBILE_DEVICE_INFORMATION: '',
MOBILE_TRANSFER_APPLICATION: '',
......@@ -105,10 +102,7 @@ class Index extends Component<IProps> {
activeOpacity={0.6}
onPress={() => this.navigateToBizPage(fun)}
>
<Image
style={g(styles, 'biz-icon')}
source={store.functionIcons[fun.functionCode]}
/>
<Image style={g(styles, 'biz-icon')} source={store.functionIcons[fun.functionCode]} />
<Text style={g(styles, 'biz-name')}>{fun.functionName}</Text>
</TouchableOpacity>
)
......
......@@ -5,8 +5,6 @@
* @Vision: 1.0
* @Description: 快速下单页面
*
* @Revision:
*
*/
// @ts-nocheck
import React, { Component } from 'react'
......@@ -35,8 +33,10 @@ type IProps = {
}
sysValueSets: {
ORTHOPEDICS_PRODUCT_CLASS: []
SUR_ORDER_TYPE: []
}
}
userStore: {
userName: string
personName: string
......@@ -152,6 +152,7 @@ class QuickOrder extends Component<IProps> {
placeholder: '请选择',
rules: [],
callback: this.getSurgeryTemplates.bind(this),
refrence: ['orgCode', 'customerCode'],
},
{
field: 'templateCollectNumber',
......@@ -169,7 +170,6 @@ class QuickOrder extends Component<IProps> {
dateMode: 'datetime',
placeholder: '请选择',
rules: [{ required: true, message: '请选择手术时间' }],
refrence: ['orgCode'],
},
{
field: 'orderTypeCode',
......@@ -177,7 +177,23 @@ class QuickOrder extends Component<IProps> {
type: FieldType.SELECT,
placeholder: '请选择',
rules: [{ required: true, message: '请选择订单类型' }],
refrence: ['orgCode'],
options: R.compose(
R.map(
R.applySpec({
label: R.prop('valueName'),
value: R.prop('valueCode'),
}),
),
R.pathOr([], ['sysStore', 'sysValueSets', 'SUR_ORDER_TYPE']),
)(this.props),
},
{
field: 'collectSrcInvCode',
label: '借货仓库',
type: FieldType.SELECT,
placeholder: '请选择',
options: [],
refrence: ['orgCode', 'sellerCode', 'customerCode', 'billToSiteCode', 'shipToSiteCode'],
},
{
field: 'surgeryDesc',
......@@ -185,7 +201,6 @@ class QuickOrder extends Component<IProps> {
type: FieldType.TEXT,
placeholder: '请输入备注',
multiline: true,
rules: [],
},
{
field: 'voiceUrl',
......
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/order/self.tsx
* @Author: peii
* @Date: 2021-07-13 22:40:12
* @LastEditTime: 2021-07-14 00:06:26
* @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, 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, translateSysprofile } from '../../utils/utils'
import styles from './self.styl'
type IProps = {}
type IState = {}
class SelfOrder extends Component<IProps, IState> {
state = {
data: {},
formItems: [],
}
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()
}}
/>
</View>
)
}
}
export default inject('store')(observer(SelfOrder))
import React, { Component } from 'react'
// @ts-nocheck
import React from 'react'
import { Image, Easing, Animated } from 'react-native'
import {
createAppContainer,
......@@ -16,6 +17,7 @@ import Consume from './pages/consume/consume'
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 Success from './pages/success/success'
function createNavigator() {
......@@ -57,11 +59,7 @@ function createNavigator() {
tabBarLabel: '业务',
tabBarIcon: ({ focused }) => (
<Image
source={
focused
? require('../app/images/tab_mod_sel.png')
: require('../app/images/tab_mod_def.png')
}
source={focused ? require('../app/images/tab_mod_sel.png') : require('../app/images/tab_mod_def.png')}
/>
),
},
......@@ -74,9 +72,7 @@ function createNavigator() {
<Image
style={{ width: 20, height: 20 }}
source={
focused
? require('./assets/images/tab_mine_sel.png')
: require('./assets/images/tab_mine_def.png')
focused ? require('./assets/images/tab_mine_sel.png') : require('./assets/images/tab_mine_def.png')
}
/>
),
......@@ -100,7 +96,7 @@ function createNavigator() {
backgroundColor: 'transparent',
},
},
}
},
)
const SwitchNavigator = createSwitchNavigator({
......@@ -115,9 +111,10 @@ function createNavigator() {
Consumables: { screen: Consumables },
ConsumeFee: { screen: ConsumeFee },
QuickOrder: { screen: QuickOrder },
SelfOrder: { screen: SelfOrder },
Success: { screen: Success },
},
{ initialRouteName: 'Main', ...options }
{ initialRouteName: 'Main', ...options },
)
return createAppContainer(stackNavigator)
......
......@@ -25,6 +25,7 @@ interface RequestConfig {
timeout: number
urlToken: boolean
needToken: boolean
noTip: boolean
}
let requestQueue = []
......@@ -60,20 +61,13 @@ export const request = (args: Partial<RequestConfig>) => {
options.data.accessToken = store.token
if (options.method.toUpperCase() === 'POST') {
const token = 'access_token=' + store.token
options.url += R.ifElse(
R.includes('?'),
R.always('&' + token),
R.always('?' + token),
)(options.url)
options.url += R.ifElse(R.includes('?'), R.always('&' + token), R.always('?' + token))(options.url)
}
}
args.data = transformObject(options.data, 'toLine')
options = R.cond([
[
R.propEq('method', 'get'),
() => R.assoc('url', args.url + '?' + stringify(args.data), options),
],
[R.propEq('method', 'get'), () => R.assoc('url', args.url + '?' + stringify(args.data), options)],
[R.T, () => R.assoc('body', JSON.stringify(args.data), options)],
])(options)
......@@ -88,7 +82,13 @@ export const request = (args: Partial<RequestConfig>) => {
requestTimes += 1
console.log('请求URL:', store.host + options.url)
fetch(store.host + options.url, options)
.then(res => res.json())
.then(res => {
if (res.status === 200) {
return res.json()
} else {
throw new Error('请求失败')
}
})
.then(res => {
if (isCancel) return
console.log('返回结果:', res)
......@@ -119,8 +119,8 @@ export const request = (args: Partial<RequestConfig>) => {
if (requestTimes < options.reTries) {
return doRequest()
}
failHandler(e, store, pid)
return reject(transformObject(e.error_code ? e : {error_code: 1, error_msg: '请求失败'}, 'toHump'))
args.noTip ? removeRequestByPid(pid) : failHandler(e, store, pid)
return reject(transformObject(e.error_code ? e : { error_code: 1, error_msg: '请求失败' }, 'toHump'))
})
}
......@@ -137,10 +137,7 @@ export const request = (args: Partial<RequestConfig>) => {
const fetchSuccess = R.propEq('error_code', 0)
const removeRequestByPid = pid => {
requestQueue = R.compose(
R.remove(R.__, 1, requestQueue),
R.findIndex(R.propEq('pid', pid)),
)(requestQueue)
requestQueue = R.compose(R.remove(R.__, 1, requestQueue), R.findIndex(R.propEq('pid', pid)))(requestQueue)
}
const failHandler = async (err: any, store: Store, pid) => {
......
......@@ -17,7 +17,7 @@ export default class Service {
* 获取系统配置
*/
getSysProfile(data: any) {
return request({ url: `${ctx}/system/sys_profile/search`, data })
return request({ url: `${ctx}/system/sys_profile/search`, data, noTip: true})
}
/**
......@@ -26,7 +26,7 @@ export default class Service {
* @return {*}
*/
getSysValueSet(data: { valueSetCode: string }) {
return request({ url: `${ctx}/system/value_set/search`, data })
return request({ url: `${ctx}/system/value_set/search`, data, noTip: true })
}
/**
......
......@@ -260,7 +260,29 @@ export default class Organization {
const res = yield this.service.getCustomers({ orgCode, sellerCode })
if (res.errorCode) return
this._customers[`${sellerCode}_${orgCode}`] = res.data.customers
let customers = res.data.customers
// customers结构有可能是扁平的, 要改成层级的,新版的
if (customers.length && !!R.path([0, 'shipToSiteCode'], customers)) {
customers = R.map(cus => ({
billToSites: [
{
billToSiteCode: cus.billToSiteCode,
billToSiteName: cus.billToSiteName,
shipToSites: [
{
shipToSiteCode: cus.shipToSiteCode,
shipToSiteName: cus.shipToSiteName,
customerDoctor: cus.customerDoctor,
},
],
},
],
customerCode: cus.customerCode,
customerName: cus.customerName,
}))(customers)
}
this._customers[`${sellerCode}_${orgCode}`] = customers
})
/**
......
......@@ -24,7 +24,8 @@ export default class System {
@inject(TYPES.Service)
private service!: Service
@persist('map') @observable sysProfiles = {
// 默认值
initSysProfiles = {
// APP借货仓库显隐及是否必填
OBS_MOBILE_BOR_WARE_REQUIRED: '00',
// APP消耗是否显示部门权限
......@@ -45,14 +46,21 @@ export default class System {
OBS_MOBILE_EQU_CON_DISPLAY_PRICE: 'N',
}
@persist('map') @observable sysValueSets = {
initSysValueSets = {
// 消耗明细费用类型
SUR_FEE_TYPE: [],
// 手术类型
ORTHOPEDICS_PRODUCT_CLASS: []
ORTHOPEDICS_PRODUCT_CLASS: [],
// 自助/快速下单订单类型
SUR_ORDER_TYPE: [],
}
@persist('map') @observable sysProfiles = {}
@persist('map') @observable sysValueSets = {}
@action
setHeaderHeight(height: number) {
this.headerHeight = height
......@@ -66,9 +74,13 @@ export default class System {
getSysProfile = flow(function* (this: System) {
const getProfiles = async (key: any) => {
const res = (await this.service.getSysProfile({ profileCode: key })) as any
if (res.errorCode) return
runInAction(() => {
// 出错了使用默认值
if (res.errorCode) {
// @ts-ignore
this.sysProfiles[key] = this.initSysProfiles[key]
return
}
// @ts-ignore
this.sysProfiles[key] = isNaN(res.data.profileValue)
? res.data.profileValue
......@@ -76,7 +88,7 @@ export default class System {
})
}
R.compose(R.map(getProfiles), R.keys)(this.sysProfiles)
R.compose(R.map(getProfiles), R.keys)(this.initSysProfiles)
})
/**
......@@ -87,14 +99,18 @@ export default class System {
getSysValueSet = flow(function* (this: System) {
const getValueSets = async (key: any) => {
const res = (await this.service.getSysValueSet({ valueSetCode: key })) as any
if (res.errorCode) return
runInAction(() => {
if (res.errorCode) {
// @ts-ignore
this.sysValueSets[key] = this.initSysValueSets[key]
return
}
// @ts-ignore
this.sysValueSets[key] = res.data.sysValues
})
}
R.compose(R.map(getValueSets), R.tap(x => console.log(x)), R.keys)(this.sysValueSets)
R.compose(R.map(getValueSets), R.keys)(this.initSysValueSets)
})
}
......@@ -4996,20 +4996,20 @@ mobx-persist@^0.4.1:
mobx-react-lite@1.4.0:
version "1.4.0"
resolved "https://registry.npm.taobao.org/mobx-react-lite/download/mobx-react-lite-1.4.0.tgz?cache=0&sync_timestamp=1611747960710&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmobx-react-lite%2Fdownload%2Fmobx-react-lite-1.4.0.tgz#193beb5fdddf17ae61542f65ff951d84db402351"
integrity sha1-GTvrX93fF65hVC9l/5UdhNtAI1E=
resolved "https://registry.yarnpkg.com/mobx-react-lite/-/mobx-react-lite-1.4.0.tgz#193beb5fdddf17ae61542f65ff951d84db402351"
integrity sha512-5xCuus+QITQpzKOjAOIQ/YxNhOl/En+PlNJF+5QU4Qxn9gnNMJBbweAdEW3HnuVQbfqDYEUnkGs5hmkIIStehg==
mobx-react@~6.0.0:
version "6.0.4"
resolved "https://registry.npm.taobao.org/mobx-react/download/mobx-react-6.0.4.tgz#829697c7a4098567047555e1285cc619f4aa9be7"
integrity sha1-gpaXx6QJhWcEdVXhKFzGGfSqm+c=
resolved "https://registry.yarnpkg.com/mobx-react/-/mobx-react-6.0.4.tgz#829697c7a4098567047555e1285cc619f4aa9be7"
integrity sha512-sLAMFNkkNp7p8CHOy6jXcFlvGcJeiAq9vusMdsITwwejDjz/1dOGQgWtTijQTWBWOcmZp7xbIRZi61jAlpGY4w==
dependencies:
mobx-react-lite "1.4.0"
mobx@^5.7.0:
version "5.15.7"
resolved "https://registry.nlark.com/mobx/download/mobx-5.15.7.tgz?cache=0&sync_timestamp=1619170964364&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fmobx%2Fdownload%2Fmobx-5.15.7.tgz#b9a5f2b6251f5d96980d13c78e9b5d8d4ce22665"
integrity sha1-uaXytiUfXZaYDRPHjptdjUziJmU=
resolved "https://registry.yarnpkg.com/mobx/-/mobx-5.15.7.tgz#b9a5f2b6251f5d96980d13c78e9b5d8d4ce22665"
integrity sha512-wyM3FghTkhmC+hQjyPGGFdpehrcX1KOXsDuERhfK2YbJemkUhEB+6wzEN639T21onxlfYBmriA1PFnvxTUhcKw==
moment@2.29.1, moment@^2.22.1:
version "2.29.1"
......
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