Commit 82014a56 by peii

开票申请各种修改

parent 06fbb2a7
......@@ -10,7 +10,8 @@ import {
SET_VERSION_APK,
SET_DOMAIN_FROM_ORIGIN,
SET_SYSPROFILE,
SET_NAVIGATION
SET_NAVIGATION,
SET_ORGANIZATION
} from '../base/ActionTypes';
import { GetRequest, PostRequest } from '../network/RequestUtils';
import { getUrlParams, show, showWarnErrorMessage, showErrorMessage, isNotBlank } from '../utils/Utils';
......@@ -213,4 +214,28 @@ export function setNavigation(navigation) {
type: SET_NAVIGATION,
navigation
}
}
/**
* @description: 请求授权组织
* @param {*}
* @return {*}
*/
export function getOrganizationData() {
return (dispatch, getState) => {
let {global_domain_config, token } = getState().login
const params = {access_token:token}
GetRequest(global_domain_config, getUrlParams('/authorized_inventory/search', params)).then(res => {
dispatch(setOrganization(R.pathOr([], ['data', 'organizations'])(res)))
})
}
}
export function setOrganization(organizations) {
return {
type: SET_ORGANIZATION,
organizations
}
}
\ No newline at end of file
......@@ -2,8 +2,8 @@
* @FilePath: /BoneHouse_Business_APP/app/base/ActionTypes.js
* @Author: peii
* @Date: 2022-01-04 10:18:02
* @LastEditTime: 2022-01-07 16:42:55
* @LastEditors: peii
* @LastEditTime: 2022-01-11 21:06:24
* @LastEditors: PEII
* @Vision: 1.0
* @Description:
*/
......@@ -21,6 +21,7 @@ export const SET_VERSION_APK="SET_VERSION_APK"
export const GET_SYSPROFILE = "GET_SYSPROFILE"
export const SET_SYSPROFILE = "SET_SYSPROFILE"
export const SET_NAVIGATION = "SET_NAVIGATION"
export const SET_ORGANIZATION = "SET_ORGANIZATION"
//-----------self order---------------------
export const SELF_ORDER_LIST_NO = "SELF_ORDER_LIST_NO"
export const SELF_ORDER_LIST_DOING = "SELF_ORDER_LIST_DOING"
......
......@@ -13,7 +13,7 @@ import {
safe_view,
font_family_regular,
} from '../../base/BaseStyle'
import { exitLoginStatus, requestSysProfile, setNavigation } from '../../action/LoginAction'
import { exitLoginStatus, requestSysProfile, setNavigation, getOrganizationData } from '../../action/LoginAction'
import { getLendOrderCodeValues } from '../../action/SelfAction'
import { getSettlementStatus, getInvoiceStatus, getArInvoiceStatus } from '../../action/SettlementAction'
import HeadBackItem from '../common/HeadBackItem'
......@@ -125,6 +125,7 @@ class HomePage extends Component {
componentDidMount() {
this.getMenuRuleInfo()
this.getSysConfigValue()
this.props.getOrganizationData()
this.props.setNavigation(this.props.navigation)
this.getSettlementStatus()
this.getLendOrderCodeValues()
......@@ -389,6 +390,9 @@ const mapDispatchToProps = dispatch => ({
getLendOrderCodeValues: () => {
dispatch(getLendOrderCodeValues())
},
getOrganizationData: () => {
dispatch(getOrganizationData())
}
})
export default connect(mapStateToProps, mapDispatchToProps)(HomePage)
......@@ -10,7 +10,8 @@ import {
SET_VERSION_APK,
SET_DOMAIN_FROM_ORIGIN,
SET_SYSPROFILE,
SET_NAVIGATION
SET_NAVIGATION,
SET_ORGANIZATION
} from '../../base/ActionTypes';
// 登录状态
......@@ -29,7 +30,8 @@ const defaultState = {
SUR_MOBILE_HISTORY_SALE_PRICE_SHOW_FLAG: 'Y',
SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG: 0,
OBS_MOBILE_APP_TITLE: '骨科智慧仓'
}
},
organizations: []
}
// 默认sysProfile,放state里时,会被持久化影响后面更新不了
......@@ -98,6 +100,12 @@ export default login = (state = defaultState, action) => {
return Object.assign({}, state, {
navigation: action.navigation
})
case SET_ORGANIZATION:
return Object.assign({}, state, {
organizations: action.organizations
})
default: // need this for default case
return state
}
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/components/modals/filter/filter.tsx
* @Author: peii
* @Date: 2021-12-19 10:49:42
* @LastEditTime: 2022-01-11 09:03:17
* @LastEditTime: 2022-01-11 21:37:26
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 过滤弹窗
......@@ -74,6 +74,8 @@ export default class FilterModal extends React.Component<IProps, IState> {
onChange={this.props.setData}
itemStyle={g(styles, 'filter-item__bd')}
modalCallback={this.modalCallback.bind(this)}
key={item.field}
fields={filterItems}
/>
</View>
)
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/collections.tsx
* @Author: peii
* @Date: 2021-12-27 09:59:21
* @LastEditTime: 2022-01-10 19:03:39
* @LastEditTime: 2022-01-11 22:01:26
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 基于消耗单的直销开票查询汇总
......@@ -124,6 +124,8 @@ class Direction extends Component<IProps, IState> {
const params = R.filter(isNotBlank)({
...args,
...pagination,
limit_from: pagination.start_index,
limit_to: pagination.limit,
})
if (!isRefresh && !isNext) {
this.setState({ loading: true })
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/components/filter.tsx
* @Author: peii
* @Date: 2021-12-19 10:49:42
* @LastEditTime: 2022-01-11 09:30:03
* @LastEditTime: 2022-01-11 21:49:26
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 过滤弹窗
......@@ -129,28 +129,41 @@ class Filter extends React.Component<IProps, IState> {
*/
setFieldItems() {
let { filterItems, data } = this.state
const { userInfo, sysProfiles, otherFilterItems = [] } = this.props
const { sysProfiles, otherFilterItems = [], organizations = [] } = this.props
const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N'
data.org_code = userInfo.department_code && R.take(3, userInfo.department_code)
let options = R.map(
R.applySpec({
value: R.prop('org_code'),
label: R.prop('org_name'),
}),
)(organizations)
if (R.length(organizations) === 1) {
data.org_code = R.path([0, 'value'])(options)
}
filterItems = R.concat(filterItems)(otherFilterItems)
this.setState({ filterItems, data })
// if (!showOrg) return
if (!showOrg) {
if (isBlank(data.org_code)) {
show('请先选择组织')
}
return
}
const item = {
field: 'org_code',
label: '组织',
type: FieldType.SELECT,
options: [],
options,
display: showOrg,
rules: [{ required: true, message: '请选择组织' }],
callback: () => {
data.customer_code = ''
this.getCustomers()
}
},
}
filterItems = R.prepend(item, filterItems)
this.getOrganizations(showOrg)
this.setState({ filterItems, data })
}
......@@ -158,6 +171,7 @@ class Filter extends React.Component<IProps, IState> {
* @description: 请求组织信息
* @param {*}
* @return {*}
* @deprecated
*/
async getOrganizations(showOrg) {
const res = await api.getOrganizations()
......@@ -174,9 +188,6 @@ class Filter extends React.Component<IProps, IState> {
),
R.pathOr([], ['data', 'organizations']),
)(res)
if (!showOrg && R.length(item.options) !== 1) {
show('请先选组织')
}
this.setState({ filterItems })
}
......@@ -187,6 +198,8 @@ class Filter extends React.Component<IProps, IState> {
*/
async getCustomers() {
const { data, filterItems } = this.state
if (isBlank(data.org_code)) return
const params = {
org_code: data.org_code,
seller_code: this.props.userInfo.user_name,
......@@ -215,12 +228,16 @@ class Filter extends React.Component<IProps, IState> {
* @return {*}
*/
resetHandler() {
const { userInfo } = this.props
const { organizations = [] } = this.props
if (organizations.length !== 1) {
return show('请先选择组织')
}
this.setState(
{
data: {
// seller_code: userInfo.user_name,
org_code: R.take(3, userInfo.department_code),
org_code: R.pathOr('', [0, 'org_code'])(organizations)
},
},
() => {},
......@@ -239,7 +256,7 @@ class Filter extends React.Component<IProps, IState> {
for (const item of items) {
if (isBlank(data[item.field])) {
return show(`请选择${item.label}`)
return show(`请选择${item.label}`)
}
}
......@@ -269,6 +286,7 @@ class Filter extends React.Component<IProps, IState> {
const mapStateToProps = state => ({
userInfo: state.login.userInfo,
sysProfiles: state.login.sysProfiles,
organizations: state.login.organizations,
})
const mapDispatchToProps = dispatch => ({})
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/index.tsx
* @Author: peii
* @Date: 2021-12-27 09:59:21
* @LastEditTime: 2022-01-11 02:18:03
* @LastEditTime: 2022-01-11 22:01:13
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 基于消耗单的直销开票申请
......@@ -108,6 +108,8 @@ class Direction extends Component<IProps, IState> {
const params = R.filter(isNotBlank)({
...args,
...pagination,
limit_from: pagination.start_index,
limit_to: pagination.limit,
})
if (!isRefresh && !isNext) {
this.setState({ loading: true })
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/collection_detail.tsx
* @Author: peii
* @Date: 2021-12-29 11:26:53
* @LastEditTime: 2022-01-11 08:38:02
* @LastEditTime: 2022-01-11 23:48:04
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 开票申请详情
......@@ -123,8 +123,8 @@ class InvoiceApplyDetail extends Component<IProps> {
<Text style={g(styles, 'item-info__text')}>物料名称: {item.customer_item_name}</Text>
<Text style={g(styles, 'item-info__text')}>通用名称: {item.customer_general_name}</Text>
<Text style={g(styles, 'item-info__text')}>规格型号: {item.customer_specification}</Text>
<Text style={g(styles, 'item-info__text')}>存储条件: {item.storage_condition_name}</Text>
<Text style={g(styles, 'item-info__text')}>注册证号: {item.reg_number}</Text>
{/* <Text style={g(styles, 'item-info__text')}>存储条件: {item.storage_condition_name}</Text>
<Text style={g(styles, 'item-info__text')}>注册证号: {item.reg_number}</Text> */}
<Text style={g(styles, 'item-info__text', 'item-info-line__text')}>数量: {item.quantity}</Text>
<Text style={g(styles, 'item-info__text', 'item-info-line__text')}>金额: {item.invoice_amount}</Text>
</View>
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/components/filter.tsx
* @Author: peii
* @Date: 2021-12-19 10:49:42
* @LastEditTime: 2022-01-11 09:22:40
* @LastEditTime: 2022-01-11 21:46:15
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 过滤弹窗
......@@ -101,20 +101,33 @@ class Filter extends React.Component<IProps, IState> {
*/
setFieldItems() {
let { filterItems, data } = this.state
const { userInfo, sysProfiles, otherFilterItems = [], prefixFilterItems = [] } = this.props
const { userInfo, sysProfiles, otherFilterItems = [], prefixFilterItems = [], organizations = [] } = this.props
const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N'
data.org_code = userInfo.department_code && R.take(3, userInfo.department_code)
let options = R.map(
R.applySpec({
value: R.prop('org_code'),
label: R.prop('org_name'),
}),
)(organizations)
if (R.length(organizations) === 1) {
data.org_code = R.path([0, 'value'])(options)
}
filterItems = [...prefixFilterItems, ...filterItems, ...otherFilterItems]
this.setState({ filterItems, data })
// if (!showOrg) return
if (!showOrg) {
if (isBlank(data.org_code)) {
show('请先选择组织')
}
return
}
const item = {
field: 'org_code',
label: '组织',
type: FieldType.SELECT,
options: [],
options,
display: showOrg,
rules: [{ required: true, message: '请选择组织' }],
callback: () => {
......@@ -123,7 +136,6 @@ class Filter extends React.Component<IProps, IState> {
},
}
filterItems = R.insert(0, item, filterItems)
this.getOrganizations(showOrg)
this.setState({ filterItems, data })
}
......@@ -131,6 +143,7 @@ class Filter extends React.Component<IProps, IState> {
* @description: 请求组织信息
* @param {*}
* @return {*}
* @deprecated
*/
async getOrganizations(showOrg) {
const res = await api.getOrganizations()
......@@ -147,9 +160,6 @@ class Filter extends React.Component<IProps, IState> {
),
R.pathOr([], ['data', 'organizations']),
)(res)
if (!showOrg && R.length(item.options) !== 1) {
show('请先选组织')
}
this.setState({ filterItems })
}
......@@ -160,6 +170,8 @@ class Filter extends React.Component<IProps, IState> {
*/
async getCustomers() {
const { data, filterItems } = this.state
if (isBlank(data.org_code)) return
const params = {
org_code: data.org_code,
seller_code: data.seller_code,
......@@ -188,12 +200,16 @@ class Filter extends React.Component<IProps, IState> {
* @return {*}
*/
resetHandler() {
const { userInfo } = this.props
const { userInfo, organizations = [] } = this.props
if (organizations.length !== 1) {
return show('请先选择组织')
}
this.setState(
{
data: {
seller_code: userInfo.user_name,
org_code: R.take(3, userInfo.department_code),
org_code: R.pathOr('', [0, 'org_code'])(organizations),
},
},
() => {},
......@@ -211,7 +227,7 @@ class Filter extends React.Component<IProps, IState> {
for (const item of items) {
if (isBlank(data[item.field])) {
return show(`请选择${item.label}`)
return show(`请选择${item.label}`)
}
}
......@@ -241,6 +257,7 @@ class Filter extends React.Component<IProps, IState> {
const mapStateToProps = state => ({
userInfo: state.login.userInfo,
sysProfiles: state.login.sysProfiles,
organizations: state.login.organizations,
})
const mapDispatchToProps = dispatch => ({})
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/index.tsx
* @Author: peii
* @Date: 2021-12-27 09:59:21
* @LastEditTime: 2022-01-11 09:20:24
* @LastEditTime: 2022-01-12 00:39:24
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 分销开票申请
......@@ -125,7 +125,7 @@ class Distribution extends Component<IProps, IState> {
R.propOr([], 'status'),
)(this.props)
args.invoice_flag = 'Y'
args.invoice_flag = 'N'
args.header_status = status
const params = R.filter(isNotBlank)({
...args,
......@@ -160,7 +160,7 @@ class Distribution extends Component<IProps, IState> {
async getLineData(order, loading = false) {
const params = {
settlement_number: order.settlement_number,
invoice_flag: 'Y',
invoice_flag: 'N',
}
this.setState({ loading })
const res = await api.getSettlementLines(params)
......@@ -259,47 +259,49 @@ class Distribution extends Component<IProps, IState> {
async submitHandler() {
const { data, filterData } = this.state
const list = R.filter(R.anyPass([R.propEq('_checked', true), R.propEq('_indeterminate', true)]))(data)
const len = R.compose(
R.length,
R.keys,
R.groupBy(it => it.org_code + it.customer_code + it.bill_to_site_code),
)(list)
if (len === 0) {
return show('请选择要开票的物料')
}
if (len > 1) {
return show('存在不同的开票')
}
const lines = R.compose(
R.unnest,
R.map(item => {
return R.compose(
// const len = R.compose(
// R.length,
// R.keys,
// R.groupBy(it => it.org_code + it.customer_code + it.bill_to_site_code),
// )(list)
// if (len === 0) {
// return show('请选择要开票的物料')
// }
// if (len > 1) {
// return show('存在不同的开票')
// }
const submitData = R.map(
R.applySpec({
settlement_number: R.prop('settlement_number'),
lines: R.compose(
R.map(
R.applySpec({
settlement_number: R.always(item.settlement_number),
line_number: R.prop('line_number'),
invoice_quantity: R.prop('quantity'),
quantity: R.prop('quantity'),
}),
),
R.filter(R.propEq('_checked', true)),
R.propOr([], 'lines'),
)(item)
),
}),
)(list)
const bill_to_site = this.getBillToSite(filterData.customer_code)
const bill_to_site_code = bill_to_site && bill_to_site.bill_to_site_code
// const bill_to_site = this.getBillToSite(filterData.customer_code)
// const bill_to_site_code = bill_to_site && bill_to_site.bill_to_site_code
const params = {
org_code: filterData.org_code,
customer_code: filterData.customer_code,
bill_to_site_code,
lines,
// org_code: filterData.org_code,
// customer_code: filterData.customer_code,
// bill_to_site_code,
// lines,
process_code: 'APPLY_INVOICE',
data: submitData,
}
this.setState({ submitting: true })
const res = await api.postArInvoiceCreate(params)
const res = await api.postSettlementUpdate(params)
this.setState({ submitting: false })
if (res.error_code) return
show('申请提交成功')
this.props.navigation.pop()
}
......
......@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/settlement/components/filter.tsx
* @Author: peii
* @Date: 2021-12-19 10:49:42
* @LastEditTime: 2022-01-11 09:29:12
* @LastEditTime: 2022-01-11 21:52:18
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 过滤弹窗
......@@ -113,28 +113,42 @@ class Filter extends React.Component<IProps, IState> {
*/
setFieldItems() {
let { filterItems, data } = this.state
const { userInfo, sysProfiles, otherFilterItems = [] } = this.props
const { sysProfiles, otherFilterItems = [], organizations = [] } = this.props
const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N'
data.org_code = userInfo.department_code && R.take(3, userInfo.department_code)
let options = R.map(
R.applySpec({
value: R.prop('org_code'),
label: R.prop('org_name'),
}),
)(organizations)
if (R.length(organizations) === 1) {
data.org_code = R.path([0, 'value'])(options)
}
filterItems = R.concat(filterItems)(otherFilterItems)
this.setState({ filterItems, data })
// if (!showOrg) return
if (!showOrg) {
if (isBlank(data.org_code)) {
show('请先选择组织')
}
return
}
const item = {
field: 'org_code',
label: '组织',
type: FieldType.SELECT,
options: [],
options,
display: showOrg,
rules: [{ required: true, message: '请选择组织' }],
callback: () => {
data.customer_code = ''
this.getCustomers()
}
},
}
filterItems = R.insert(1, item, filterItems)
this.getOrganizations(showOrg)
this.setState({ filterItems, data })
}
......@@ -142,6 +156,7 @@ class Filter extends React.Component<IProps, IState> {
* @description: 请求组织信息
* @param {*}
* @return {*}
* @deprecated
*/
async getOrganizations(showOrg) {
const res = await api.getOrganizations()
......@@ -158,9 +173,6 @@ class Filter extends React.Component<IProps, IState> {
),
R.pathOr([], ['data', 'organizations']),
)(res)
if (!showOrg && R.length(item.options) !== 1) {
show('请先选组织')
}
this.setState({ filterItems })
}
......@@ -171,6 +183,8 @@ class Filter extends React.Component<IProps, IState> {
*/
async getCustomers() {
const { data, filterItems } = this.state
if (isBlank(data.org_code)) return
const params = {
org_code: data.org_code,
seller_code: data.seller_code,
......@@ -198,12 +212,15 @@ class Filter extends React.Component<IProps, IState> {
* @return {*}
*/
resetHandler() {
const { userInfo } = this.props
const { userInfo, organizations = [] } = this.props
if (organizations.length !== 1) {
return show('请先选择组织')
}
this.setState(
{
data: {
seller_code: userInfo.user_name,
org_code: R.take(3, userInfo.department_code),
org_code: R.pathOr('', [0, 'org_code'])(organizations),
},
},
() => {},
......@@ -221,7 +238,7 @@ class Filter extends React.Component<IProps, IState> {
for (const item of items) {
if (isBlank(data[item.field])) {
return show(`请选择${item.label}`)
return show(`请选择${item.label}`)
}
}
this.props.searchHandler && this.props.searchHandler(data)
......@@ -250,6 +267,7 @@ class Filter extends React.Component<IProps, IState> {
const mapStateToProps = state => ({
userInfo: state.login.userInfo,
sysProfiles: state.login.sysProfiles,
organizations: state.login.organizations,
})
const mapDispatchToProps = dispatch => ({})
......
......@@ -2,8 +2,8 @@
* @FilePath: /BoneHouse_Business_APP/src/services/api.ts
* @Author: peii
* @Date: 2021-12-19 16:06:26
* @LastEditTime: 2022-01-07 11:03:44
* @LastEditors: peii
* @LastEditTime: 2022-01-11 18:20:31
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 未重构完全暂用的所有请求
*/
......@@ -94,6 +94,18 @@ export default {
},
/**
* @description: 分销开票申请
* @param {*}
* @return {*}
*/
postSettlementUpdate(data: {
process_code: string
data: { settlement_number: string; lines: { line_number: string; quantity: number }[] }[]
}) {
return request({ url: `${v}/sale/sal_settlement/update`, data, method: 'post' })
},
/**
* @description: 请求应收发票汇总
* @param {*}
* @return {*}
......
......@@ -124,7 +124,7 @@ export const request = (args: Partial<RequestConfig>) => {
}
failHandler(e, pid)
if (!e.error_code) {
e.error_code = e.status
e.error_code = e.status
}
reject(e)
})
......
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