Commit f329c8f6 by peii

直营开票申请

parent e1710fdc
...@@ -37,6 +37,10 @@ import SettlementReject from '../src/pages/settlement/reject'; ...@@ -37,6 +37,10 @@ import SettlementReject from '../src/pages/settlement/reject';
import DistributeInvoice from '../src/pages/invoice/distribution'; import DistributeInvoice from '../src/pages/invoice/distribution';
import DistributeInvoiceApplyDetail from '../src/pages/invoice/distribution/detail'; import DistributeInvoiceApplyDetail from '../src/pages/invoice/distribution/detail';
// 直销开票
import DirectionInvoice from '../src/pages/invoice/direct';
import DirectionInvoiceApplyDetail from '../src/pages/invoice/direct/detail';
const Router = createAppContainer(createStackNavigator({ const Router = createAppContainer(createStackNavigator({
LoginPage: { screen: LoginPage }, LoginPage: { screen: LoginPage },
...@@ -67,6 +71,8 @@ const Router = createAppContainer(createStackNavigator({ ...@@ -67,6 +71,8 @@ const Router = createAppContainer(createStackNavigator({
SettlementSaleDetail: {screen: SettlementSaleDetail}, SettlementSaleDetail: {screen: SettlementSaleDetail},
DistributeInvoice: {screen: DistributeInvoice}, DistributeInvoice: {screen: DistributeInvoice},
DistributeInvoiceApplyDetail: {screen: DistributeInvoiceApplyDetail}, DistributeInvoiceApplyDetail: {screen: DistributeInvoiceApplyDetail},
DirectionInvoice: {screen: DirectionInvoice},
DirectionInvoiceApplyDetail: {screen: DirectionInvoiceApplyDetail},
}, { }, {
navigationOptions: { navigationOptions: {
gesturesEnabled: true gesturesEnabled: true
......
...@@ -81,7 +81,7 @@ class HomePage extends Component { ...@@ -81,7 +81,7 @@ class HomePage extends Component {
MOBILE_DIRECT_INVOICE_APPLICATION: { MOBILE_DIRECT_INVOICE_APPLICATION: {
icon: require('../../images/quick_order.png'), icon: require('../../images/quick_order.png'),
title: '直销-开票申请', title: '直销-开票申请',
page: '', page: 'DirectionInvoice',
}, },
MOBILE_DIRECT_INVOICE_GATHER: { MOBILE_DIRECT_INVOICE_GATHER: {
icon: require('../../images/quick_order.png'), icon: require('../../images/quick_order.png'),
......
...@@ -37,3 +37,8 @@ export enum SettlementProcessCode { ...@@ -37,3 +37,8 @@ export enum SettlementProcessCode {
USER_REJECT = 'USER_REJECT', USER_REJECT = 'USER_REJECT',
REQUIRE_RECONFIRM = 'REQUIRE_RECONFIRM', REQUIRE_RECONFIRM = 'REQUIRE_RECONFIRM',
} }
export enum ConsumeProcessCode {
UPDATE = 'UPDATE',
APPLY_INVOICE = 'APPLY_INVOICE',
}
@import '../../../../assets/styles/base.styl'
@import '../../../../assets/styles/variable.styl'
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/components/filter.tsx
* @Author: peii
* @Date: 2021-12-19 10:49:42
* @LastEditTime: 2022-01-04 17:39:29
* @LastEditors: peii
* @Vision: 1.0
* @Description: 过滤弹窗
*/
// @ts-nocheck
import React from 'react'
import { View, Text, TouchableOpacity, FlatList, Image, ScrollView } from 'react-native'
import { connect } from 'react-redux'
import * as R from 'ramda'
import { IFormField } from 'bonehouse'
import api from '../../../../services/api'
import { isNotBlank, g, getFormItem, isBlank, show } from '../../../../utils/utils'
import { FieldType } from '../../../../enums'
import FilterModal from '../../../../components/modals/filter/filter'
import styles from './filter.styl'
type IProps = {
onClose?: Function
userInfo: any
sysProfiles: {
OBS_SHOW_ORG_FLAG: string
}
otherFilterItems: IFromField[]
}
type IState = {
action: number
data: { [key: string]: string }
formItems: IFormField[]
}
class Filter extends React.Component<IProps, IState> {
constructor(props) {
super(props)
this.onClose = this.onClose.bind(this)
this.setData = this.setData.bind(this)
this.resetHandler = this.resetHandler.bind(this)
this.filterHandler = this.filterHandler.bind(this)
}
state = {
isAutoOpen: true,
data: {
// seller_code: this.props.userInfo.user_name,
},
filterItems: [
// {
// field: 'seller_code',
// label: '销售员',
// disabled: true,
// type: FieldType.SELECT,
// options: [
// {
// value: this.props.userInfo.user_name,
// label: this.props.userInfo.person_name,
// },
// ],
// rules: [{ required: true, message: '请选择客户' }],
// },
{
field: 'customer_code',
label: '客户',
type: FieldType.SELECT,
rules: [{ required: true, message: '请选择客户' }],
},
{
field: 'consume_order_number',
label: '消耗单号',
type: FieldType.TEXT,
},
{
field: 'doctor_name',
label: '医生',
type: FieldType.TEXT,
},
{
field: 'patient_name',
label: '患者',
type: FieldType.TEXT,
},
],
}
componentDidMount() {
this.setFieldItems()
setTimeout(() => {
this.getCustomers()
}, 0)
}
onClose() {
this.props.onClose && this.props.onClose()
}
/**
* @description: 输入
* @param {*} key 输入项
* @param {*} value 输入值
* @return {*}
*/
setData(key: string, value: any) {
const { data, isAutoOpen } = this.state
data[key] = value
this.setState({ data }, () => {
if (!isAutoOpen) return
const isAllParamSet = R.compose(
R.all(isNotBlank),
R.map(k => data[k]),
)(['org_code', 'customer_code'])
if (!isAllParamSet) return
this.setState({ isAutoOpen: false })
this.filterHandler()
})
}
/**
* @description: 设置动态搜索项
* @param {*}
* @return {*}
*/
setFieldItems() {
let { filterItems, data } = this.state
const { userInfo, sysProfiles, otherFilterItems = [] } = this.props
const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N'
data.org_code = userInfo.department_code && R.take(3, userInfo.department_code)
filterItems = R.concat(filterItems)(otherFilterItems)
this.setState({ filterItems, data })
if (!showOrg) return
const item = {
field: 'org_code',
label: '组织',
type: FieldType.SELECT,
options: [],
rules: [{ required: true, message: '请选择组织' }],
}
filterItems = R.prepend(item, filterItems)
this.getOrganizations()
this.setState({ filterItems, data })
}
/**
* @description: 请求组织信息
* @param {*}
* @return {*}
*/
async getOrganizations() {
const res = await api.getOrganizations()
if (res.error_code) return
const { filterItems } = this.state
const item = getFormItem(filterItems, 'org_code')
item.options = R.compose(
R.map(
R.applySpec({
value: R.compose(R.take(3), R.prop('org_code')),
label: R.prop('org_name'),
}),
),
R.pathOr([], ['data', 'organizations']),
)(res)
this.setState({ filterItems })
}
/**
* @description: 请求客户信息
* @param {*}
* @return {*}
*/
async getCustomers() {
const { data, filterItems } = this.state
const params = {
org_code: data.org_code,
seller_code: this.props.userInfo.user_name,
}
const res = await api.getCustomers(params)
if (res.error_code) return
const item = getFormItem(filterItems, 'customer_code')
item.options = R.compose(
R.map(
R.applySpec({
value: R.prop('customer_code'),
label: R.prop('customer_name'),
bill_to_sites: R.prop('bill_to_sites'),
}),
),
R.pathOr([], ['data', 'customers']),
)(res)
this.setState({ filterItems, customers: item.options })
}
/**
* @description: 重置搜索项
* @param {*}
* @return {*}
*/
resetHandler() {
const { userInfo } = this.props
this.setState(
{
data: {
// seller_code: userInfo.user_name,
org_code: R.take(3, userInfo.department_code),
},
},
() => {},
)
}
/**
* @description: 搜索操作
* @param {*}
* @return {*}
*/
filterHandler() {
const { data, filterItems } = this.state
const items = R.filter(R.pathEq(['rules', 0, 'required'], true))(filterItems)
for (const item of items) {
if (isBlank(data[item.field])) {
return show(`请选择${item.label}`)
}
}
this.props.searchHandler && this.props.searchHandler(data)
this.onClose()
}
render() {
const { filterItems, data } = this.state
const { visible } = this.props
return (
<FilterModal
style={g(styles, 'filter-modal')}
visible={visible}
data={data}
filterItems={filterItems}
onClose={this.onClose}
setData={this.setData}
resetHandler={this.resetHandler}
filterHandler={this.filterHandler}
/>
)
}
}
const mapStateToProps = state => ({
userInfo: state.login.userInfo,
sysProfiles: state.login.sysProfiles,
})
const mapDispatchToProps = dispatch => ({})
export default connect(mapStateToProps, mapDispatchToProps)(Filter)
@import '../../../../assets/styles/base.styl'
@import '../../../../assets/styles/variable.styl'
.list
flex 1
width 100%
padding-top 20px
&-inner
min-height 100%
.item
background-color #fff
margin-left 20px
margin-right 20px
padding 15px
margin-bottom 15px
&-line
@extend .row
justify-content space-between
align-items center
&-text
font-size 16px
line-height 22px
margin-bottom 6px
&-full
flex 1
&__status
font-size 16px
font-weight bold
color #000
&-left
width 70%
&-select-box
justify-content flex-end
width 80px
height @width
.text
&-red
color #f00
&-black
color #000
&-blue
color primary_color
&-gray
color #999
\ No newline at end of file
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/components/list.tsx
* @Author: peii
* @Date: 2021-12-19 10:44:15
* @LastEditTime: 2022-01-04 11:49:24
* @LastEditors: peii
* @Vision: 1.0
* @Description: 汇总列表
*/
// @ts-nocheck
import React, { Component } from 'react'
import { View, Text, TouchableOpacity, FlatList, RefreshControl } from 'react-native'
import * as R from 'ramda'
import { connect } from 'react-redux'
import { INavigation } from 'navigation'
import debounce from 'debounce'
import dayjs from 'dayjs'
import Empty from '../../../../components/empty'
import { Checkbox } from '../../../../components/checkbox/checkbox'
import { isNotBlank, isBlank, g } from '../../../../utils/utils'
import styles from './list.styl'
type IProps = {
data: any[]
navigation: INavigation
getData: Function
itemClickHandler: Function
checkedHandler: Function
isCollection: boolean
}
class DistributeInvoiceList extends Component<IProps> {
constructor(props) {
super(props)
this.renderItem = this.renderItem.bind(this)
this.itemPressHandler = this.itemPressHandler.bind(this)
this.onRefreshHandler = debounce(this.onRefreshHandler.bind(this), 200)
this.onEndReachedHandler = debounce(this.onEndReachedHandler.bind(this), 500)
}
state = {
refreshing: false,
checked: true,
}
refreshing = false
/**
* @description:
* @param {*} item
* @return {*}
*/
itemPressHandler(item) {
this.props.itemClickHandler && this.props.itemClickHandler(item)
}
/**
* @description: 映射状态
* @param {*} statusCode
* @return {*}
*/
mapStatus(statusCode) {
const { status = [] } = this.props
return R.compose(R.propOr('未知状态', 'value_name'), R.find(R.propEq('value_code', statusCode)))(status)
}
/**
* @description: 状态显示类
* @param {*}
* @return {*}
*/
mapStatusClass = R.cond([
[R.includes(R.__, ['ENTERED']), R.always('text-black')],
[R.includes(R.__, ['USER_REJECTED']), R.always('text-red')],
[R.includes(R.__, ['USER_CONFIRMED']), R.always('text-blue')],
[R.T, R.always('text-gray')],
])
/**
* @description: 下拉刷新
* @param {*}
* @return {*}
*/
async onRefreshHandler() {
if (this.state.refreshing) return
this.refreshing = true
this.setState({ refreshing: true })
await this.props.getData(null, true)
this.refreshing = false
this.setState({ refreshing: false })
}
async onEndReachedHandler() {
if (this.refreshing || isBlank(this.props.data)) return
this.refreshing = true
await this.props.getData(null, false, true)
this.refreshing = false
}
/**
* @description: 选择操作
* @param {*} checked
* @param {*} item
* @return {*}
*/
async checkedHandler(checked, order) {
order._checked = checked
this.props.checkedHandler && (await this.props.checkedHandler(checked, order))
this.setState({ checked })
}
countAndSum(order) {
const list = R.compose(R.filter(R.propEq('_checked', true)), R.propOr([], 'lines'))(order)
const count = R.compose(R.sum, R.pluck('quantity'))(list)
// const sum = R.compose(R.sum, R.map(R.converge(R.multiply, [R.prop('quantity'), R.prop('settlement_price')])))(list)
const sum = R.compose(R.sum, R.pluck('settlement_amount'))(list)
return { count, sum: sum.toFixed(2) }
}
/**
* @description: 结算单单项
* @param {*} param1
* @return {*}
*/
renderItem({ item, index }) {
const { isCollection } = this.props
// 开票汇总
if (isCollection) {
return this.renderCollectionItem.call(this, item, index)
}
// 分销开票申请单项
return (
<TouchableOpacity style={g(styles, 'item')} activeOpacity={0.8} onPress={() => this.itemPressHandler(item)}>
{/* <View style={g(styles, 'item-line')}>
<Text style={g(styles, 'item-text')}>{item.settlement_number}</Text>
<Text style={g(styles, ['item-text__rigth', 'item-text__status', this.mapStatusClass(item.header_status)])}>
{this.mapStatus(item.header_status)}
</Text>
</View> */}
<View style={g(styles, 'item-line')}>
<View style={g(styles, 'item-left')}>
<Text style={g(styles, 'item-text')}>
消耗日期: {item.consume_date && dayjs(item.consume_date).format('YYYY-MM-DD')}
</Text>
<Text style={g(styles, 'item-text')}>消耗订单: {item.consume_order_number}</Text>
<Text style={g(styles, 'item-text')}>客户: {item.customer_name}</Text>
<Text style={g(styles, 'item-text')}>医生: {item.doctor_name || '——'}</Text>
<Text style={g(styles, 'item-text')}>患者: {item.patient_name || '——'}</Text>
<Text style={g(styles, 'item-text', 'item-left-text')}>数量: {item.total_consumed_quantity}</Text>
<Text style={g(styles, 'item-text', 'item-left-text')}>
金额: {item.total_amount && item.total_amount.toFixed(2)}
</Text>
</View>
<View style={g(styles, 'item-select')}>
<Checkbox
style={g(styles, 'item-select-box')}
checked={item._checked}
indeterminate={item._indeterminate}
onChange={checked => this.checkedHandler(checked, item)}
/>
</View>
</View>
{/* <View style={g(styles, 'item-line')}>
<Text style={g(styles, 'item-text', 'item-text-full')}>选择开票总数量: {item._quantity || 0}</Text>
</View>
<View style={g(styles, 'item-line')}>
<Text style={g(styles, 'item-text', 'item-text-full')}>选择开票总金额: {item._amount || '0.00'}</Text>
</View>
*/}
<View style={g(styles, 'item-line')}>
<Text style={g(styles, 'item-text', 'item-text-full')}>备注: {item.remark || '——'}</Text>
</View>
</TouchableOpacity>
)
}
/**
* @description: 开票汇总单项渲染
* @param {*} item
* @param {*} index
* @return {*}
*/
renderCollectionItem(item, index) {
return <View style={g(styles, 'item')}></View>
}
render() {
const { data = [] } = this.props
const { refreshing, checked } = this.state
return (
<View style={g(styles, 'list')}>
<FlatList
data={data}
renderItem={this.renderItem}
ListEmptyComponent={Empty}
style={g(styles, 'list-inner')}
keyExtractor={it => it.consume_order_number}
refreshControl={<RefreshControl onRefresh={this.onRefreshHandler} refreshing={refreshing} />}
onEndReached={this.onEndReachedHandler}
extraData={checked}
></FlatList>
</View>
)
}
}
const mapStateToProps = state => ({
status: state.settlement.headerStatus,
})
export default connect(mapStateToProps)(DistributeInvoiceList)
@import '../../../assets/styles/base.styl'
@import '../../../assets/styles/variable.styl'
.body
background-color home_background_color
flex 1
.title-select__text
color title_text_color
font-size first_text_size
font-family font_family_regular
text-align right
.card-info
padding 15px
background-color #fff
&-line
@extend .row
@extend .center
&__half
@extend .row
flex 1
&__text
font-size 16px
font-family font_family_regular
line-height 24px
&__key
// width 90px
// text-align right
padding-right 15px
.list
padding 15px
margin-bottom 30px
.item
@extend .row
padding 15px
background-color #fff
margin-bottom 15px
&-info
flex 1
&-line
@extend .row
justify-content space-between
&__text
width 50%
flex-wrap nowrap
&__text
font-size 14px
line-height 22px
&-select
&-box
width 80px
flex 1
justify-content flex-end
align-items center
.mb5
margin-bottom 10px
\ No newline at end of file
@import '../../../assets/styles/base.styl'
@import '../../../assets/styles/variable.styl'
.filter
width 100%
align-items flex-end
&-icon
width 30px
height @width
margin-top 5px
.body
flex 1
background-color home_background_color
&-ft
padding-top 10px
padding-left 20px
padding-right 20px
justify-content flex-start
height 100px
background-color #fff
&-statistic
@extend .row
margin-bottom 8px
justify-content space-between
&__text
font-size 16px
font-family font_family_regular
&-btn
align-items center
.btn
@extend .center
@extend .middle
height 40px
border-radius 4px
&-submit
width 100%
background-color primary_color
&__text
color #fff
font-size 18px
font-family font_family_regular
&-select
width 30%
background-color #fff
border-width 1px
border-color #ccc
&__text
color #444
&-disabled
@extend .row
background-color #ddd
width 100%
&__text
color #999
font-size 18px
font-family font_family_regular
margin-left 8px
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/index.tsx
* @Author: peii
* @Date: 2021-12-27 09:59:21
* @LastEditTime: 2022-01-04 17:48:31
* @LastEditors: peii
* @Vision: 1.0
* @Description: 基于消耗单的直销开票申请
*/
// @ts-nocheck
import React, { Component } from 'react'
import { View, Text, TouchableOpacity, Image, ActivityIndicator } from 'react-native'
import { connect } from 'react-redux'
import * as R from 'ramda'
import { INavigation } from 'navigation'
import debounce from 'debounce'
import Loading from '../../../../app/containers/common/LodingModel'
import Header from '../../../components/header/header'
import Resolution from '../../../components/common/Resolution'
import FilterModal from './components/filter'
import InvoiceList from './components/list'
import { isBlank, g, isNotBlank, show } from '../../../utils/utils'
import { ConsumeProcessCode } from '../../../enums'
import api from '../../../services/api'
import styles from './index.styl'
type IProps = {
navigation: INavigation
status: any[]
}
type IState = {
visible: boolean
}
class Direction extends Component<IProps, IState> {
constructor(props) {
super(props)
this.toggleModalVisible = this.toggleModalVisible.bind(this)
this.getData = this.getData.bind(this)
this.getLineData = this.getLineData.bind(this)
this.selectAllHandler = this.selectAllHandler.bind(this)
this.submitHandler = debounce(this.submitHandler.bind(this), 200)
this.itemClickHandler = this.itemClickHandler.bind(this)
this.checkedHandler = this.checkedHandler.bind(this)
this.countAndSum = this.countAndSum.bind(this)
}
state = {
visible: false,
loading: false,
data: [],
pagination: {
start_index: 0,
limit: 10,
},
filterData: {},
isEnd: false,
fresh: 0,
statistic: {
count: 0,
sum: 0,
},
customers: [],
submitting: false,
}
componentDidMount() {
this.toggleModalVisible()
}
toggleModalVisible() {
const { visible } = this.state
this.setState({ visible: !visible })
}
/**
* @description: 请求分销结算数据
* @param {object} args 过滤参数
* @param {boolean} isRefresh 是否刷新类型
* @param {boolean} isNext 是否下一页
* @return {*}
*/
async getData(args, isRefresh = false, isNext = false) {
// 确认页面只过滤出已输入的那些
let { pagination, filterData, data, isEnd } = this.state
if (isRefresh || isNotBlank(args)) {
pagination.start_index = 0
}
if (isNext) {
pagination.start_index += pagination.limit
if (isEnd) return
}
if (isBlank(args)) {
args = filterData
} else {
this.setState({ filterData: args })
}
args.header_status = 'APPROVED'
args.invoice_header_status = 'ENTERED'
const params = {
...args,
...pagination,
}
if (!isRefresh && !isNext) {
this.setState({ loading: true })
}
const res = await api.getConsumeHeaders(params)
this.setState({ loading: false })
if (res.error_code !== 0) return
const newData = R.pathOr([], ['data', 'sur_consume_headers'])(res)
if (isBlank(newData) || newData.length < pagination.limit) {
isEnd = true
} else {
isEnd = false
}
if (isNext) {
data = R.concat(data, newData)
} else {
data = newData
}
this.setState({ data, isEnd })
}
/**
* @description: 开票行
* @param {*}
* @return {*}
*/
async getLineData(order, loading = false) {
const params = {
consume_order_number: order.consume_order_number,
}
this.setState({ loading })
const res = await api.getConsumeLines(params)
this.setState({ loading: false })
if (res.error_code) return
order.lines = R.compose(R.sort(R.ascend(R.prop('line_number'))), R.pathOr([], ['data', 'sur_consume_lines']))(res)
}
/**
* @description: 单项点击
* @param {*} order
* @return {*}
*/
async itemClickHandler(order) {
if (isBlank(order.lines)) {
await this.getLineData(order, true)
}
const title = this.props.navigation.getParam('title')
this.props.navigation.navigate('DirectionInvoiceApplyDetail', {
title,
order,
refreshHandler: () => {
this.setState({ fresh: this.state.fresh + 1 })
this.countAndSum(order)
},
})
}
/**
* @description: 全选操作
* @param {*}
* @return {*}
*/
selectAllHandler() {}
/**
* @description: 单项选择
* @param {*}
* @return {*}
*/
async checkedHandler(checked, order) {
if (isBlank(order.lines)) {
await this.getLineData(order)
}
// order._indeterminate = false
// if (isNotBlank(order.lines)) {
// R.map(item => {
// item._checked = checked
// })(order.lines)
// }
this.countAndSum(order)
}
/**
* @description: 计算总数
* @param {*}
* @return {*}
*/
countAndSum(order) {
const { data } = this.state
const list = R.filter(R.propEq('_checked', true))(data)
const count = R.compose(R.sum, R.filter(isNotBlank), R.pluck('total_consumed_quantity'))(list)
const sum = R.compose(R.sum, R.filter(isNotBlank), R.pluck('total_amount'))(list).toFixed(2)
this.setState({ data, statistic: { count, sum } })
}
/**
* @description: 获取当前客户的收货地址
* @param {string} customer_code
* @return {*}
*/
getBillToSite(customer_code: string) {
const { customers = [] } = this.state
const customer = R.find(R.propEq('value', customer_code))(customers)
return R.pathOr(null, ['bill_to_sites', 0])(customer)
}
/**
* @description: 提交
* @param {*}
* @return {*}
*/
async submitHandler() {
const { data } = this.state
const list = R.compose(R.map(R.pick(['consume_order_number'])), R.filter(R.propEq('_checked', true)))(data)
if (isBlank(list)) {
return show('请选择要开票的物料')
}
const params = {
process_code: ConsumeProcessCode.APPLY_INVOICE,
data: list,
}
this.setState({ submitting: true })
const res = await api.postProcessConsumes(params)
this.setState({ submitting: false })
if (res.error_code) return
show('申请提交成功')
this.props.navigation.pop()
}
render() {
const title = this.props.navigation.getParam('title')
const { visible, loading, data, fresh, statistic, submitting } = this.state
return (
<View style={g(styles, 'container')}>
<Resolution.FixWidthView>
<Header
title={title}
backCallback={() => {
this.props.navigation.goBack()
}}
>
<TouchableOpacity style={g(styles, 'filter')} activeOpacity={0.8} onPress={this.toggleModalVisible}>
<Image source={require('../../../assets/images/filter_icon.png')} style={g(styles, 'filter-icon')} />
</TouchableOpacity>
</Header>
<View style={g(styles, 'body')}>
{/* 过滤弹窗 */}
<FilterModal
visible={visible}
onClose={this.toggleModalVisible}
searchHandler={(filterData, customers) => {
this.setState({ customers })
this.getData(filterData)
}}
/>
{/* 显示列表 */}
{loading ? (
<Loading show={loading} />
) : (
<InvoiceList
data={data}
{...this.props}
fresh={fresh}
getData={this.getData}
itemClickHandler={this.itemClickHandler}
checkedHandler={this.checkedHandler}
isCollection={false}
/>
)}
{isNotBlank(data) && !loading && (
<View style={g(styles, 'body-ft')}>
<View style={g(styles, 'body-ft-statistic')}>
<Text style={g(styles, 'body-ft-statistic__text')}>申请开票总数量: {statistic.count}</Text>
<Text style={g(styles, 'body-ft-statistic__text')}>申请开票总金额: {statistic.sum}</Text>
</View>
<View style={g(styles, 'body-ft-btn')}>
{!submitting ? (
<TouchableOpacity
style={g(styles, 'btn', 'btn-submit')}
activeOpacity={0.8}
onPress={this.submitHandler}
>
<Text style={g(styles, 'btn__text', 'btn-submit__text')}>申请开票</Text>
</TouchableOpacity>
) : (
<TouchableOpacity style={g(styles, 'btn', 'btn-disabled')} activeOpacity={1}>
<ActivityIndicator style={g(styles, 'btn-indicator')}></ActivityIndicator>
<Text style={g(styles, 'btn__text', 'btn-disabled__text')}>申请开票</Text>
</TouchableOpacity>
)}
</View>
</View>
)}
</View>
</Resolution.FixWidthView>
</View>
)
}
}
const mapStateToProps = state => ({
status: state.settlement.headerStatus,
})
const mapDispatchToProps = dispatch => ({})
export default connect(mapStateToProps, mapDispatchToProps)(Direction)
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/index.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/index.tsx
* @Author: peii * @Author: peii
* @Date: 2021-12-27 09:59:21 * @Date: 2021-12-27 09:59:21
* @LastEditTime: 2022-01-04 10:53:48 * @LastEditTime: 2022-01-04 17:47:54
* @LastEditors: peii * @LastEditors: peii
* @Vision: 1.0 * @Vision: 1.0
* @Description: 分销开票申请 * @Description: 分销开票申请
...@@ -98,6 +98,8 @@ class Distribution extends Component<IProps, IState> { ...@@ -98,6 +98,8 @@ class Distribution extends Component<IProps, IState> {
if (isBlank(args)) { if (isBlank(args)) {
args = filterData args = filterData
} else {
this.setState({ filterData: args })
} }
const status = R.compose( const status = R.compose(
...@@ -130,7 +132,7 @@ class Distribution extends Component<IProps, IState> { ...@@ -130,7 +132,7 @@ class Distribution extends Component<IProps, IState> {
} else { } else {
data = newData data = newData
} }
this.setState({ data, filterData: args, isEnd }) this.setState({ data, isEnd })
} }
/** /**
......
/*
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/utils.ts
* @Author: peii
* @Date: 2021-12-30 10:55:50
* @LastEditTime: 2021-12-30 10:55:51
* @LastEditors: peii
* @Vision: 1.0
* @Description: 模块工具函数
*/
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
* @FilePath: /BoneHouse_Business_APP/src/services/api.ts * @FilePath: /BoneHouse_Business_APP/src/services/api.ts
* @Author: peii * @Author: peii
* @Date: 2021-12-19 16:06:26 * @Date: 2021-12-19 16:06:26
* @LastEditTime: 2021-12-31 11:47:52 * @LastEditTime: 2022-01-04 17:21:58
* @LastEditors: peii * @LastEditors: peii
* @Vision: 1.0 * @Vision: 1.0
* @Description: 未重构完全暂用的所有请求 * @Description: 未重构完全暂用的所有请求
*/ */
import { request } from './baseApi' import { request } from './baseApi'
import { download } from '../utils/download'
import { stringify } from 'querystring' import { stringify } from 'querystring'
import { download } from '../utils/download'
import { ConsumeProcessCode } from '../enums'
const v = '/api/latest' const v = '/api/latest'
...@@ -89,6 +90,46 @@ export default { ...@@ -89,6 +90,46 @@ export default {
* @return {*} * @return {*}
*/ */
postArInvoiceCreate(data: { org_code: string; customer_code: string; bill_to_site_code: string; lines: any[] }) { postArInvoiceCreate(data: { org_code: string; customer_code: string; bill_to_site_code: string; lines: any[] }) {
return request({ url: `${v}/ar_invoice/create`, data: { data } }) return request({ url: `${v}/ar_invoice/create`, data: { data }, method: 'post' })
},
/**
* @description: 请求已确认消耗单头
* @param {*}
* @return {*}
*/
getConsumeHeaders(data: {
org_code: string
customer_code: string
header_status: string
invoice_header_status: string
consume_date_form?: string
consume_date_to?: string
consume_order_number?: string
doctor_name?: string
patient_name?: string
}) {
return request({ url: `${v}/surgery/consume_header/search`, data })
},
/**
* @description: 请求已确认消耗单行
* @param {object} data
* @return {*}
*/
getConsumeLines(data: { consume_order_number: string }) {
return request({ url: `${v}/surgery/consume_line/search`, data })
},
/**
* @description: 更新消耗单状态(直营申请开票)
* @param {*}
* @return {*}
*/
postProcessConsumes(data: {
process_code: ConsumeProcessCode
data: { consume_order_number: string; sur_consume_line_if?: { line_number: string; process_code: string }[] }
}) {
return request({ url: `${v}/consume/update`, data, method: `POST` })
}, },
} }
...@@ -150,7 +150,7 @@ const failHandler = async (err: any, pid) => { ...@@ -150,7 +150,7 @@ const failHandler = async (err: any, pid) => {
R.ifElse( R.ifElse(
isBlank, isBlank,
() => { () => {
show(`${err.status || ''} ${err.error}`) show(`${err.status || ''} ${err.error || '服务器错误,请联系管理员!'}`)
}, },
() => { () => {
show(err.error_msg) show(err.error_msg)
......
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