123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- import React, { Component } from 'react';
- import Taro from '@tarojs/taro';
- import { View, Picker, ScrollView, } from '@tarojs/components'
- import { AtTabs, AtTabsPane, AtIcon, AtSearchBar } from 'taro-ui';
- import { getRecordList, getNewRecordList } from '../../utils/servers/servers';
- import dayjs from 'dayjs';
- import { getAccountName, getSecondaryAccountName, removeNull } from '../../utils/tools';
- import { accountLtate, } from '../../utils/tools/config'
- import ListBottomStart from "../../components/common/listBottomStart";
- import AuditModal from "../../components/common/auditModal";
- import './index.less';
- import 'taro-ui/dist/style/components/tabs.scss';
- import "taro-ui/dist/style/components/flex.scss";
- import "taro-ui/dist/style/components/action-sheet.scss";
- import "taro-ui/dist/style/components/icon.scss";
- import "taro-ui/dist/style/components/list.scss";
- import "taro-ui/dist/style/components/icon.scss";
- import "taro-ui/dist/style/components/modal.scss";
- class Examine extends Component {
- constructor(props) {
- super(props);
- this.state = {
- typeList: [
- { title: '未审核' },
- { title: '已审核' }],
- current: 0,
- starts: {},
- list: [],
- visible: false,
- searchType: { title: "按编号", id: 0 },
- search: [
- { title: "按编号", id: 0 },
- { title: "按企业名称", id: 1 },
- ]
- }
- }
- componentDidShow() {
- this.setState({
- visible: false,
- })
- this.getPublicReleaseList();
- }
- // async componentDidMount() {
- // await this.getPublicReleaseList();
- // }
- onPullDownRefresh() {
- this.getPublicReleaseList();
- }
- onReachBottom() {
- this.getPublicReleaseList(true);
- }
- onTabItemTap(obj) {
- if (obj.index === 1) {
- this.onTabTap();
- }
- }
- onPickerHide() {
- this.setState({
- isPickerRender: false,
- });
- }
- async onSetPickerTime(val) {
- let data = val.detail;
- await this.setState({
- rangeStartMinuteVal: dayjs(data.selectStartTime).format("YYYY-MM-DD"),
- rangeEndMinuteVal: dayjs(data.selectEndTime).format("YYYY-MM-DD")
- })
- await this.getMyList(1);
- }
- async onTabTap() {
- await this.getMyList(1);
- }
- async getPublicReleaseList(lv) {
- await this.getMyList(lv ? this.state.pageNo + 1 : 1);
- Taro.stopPullDownRefresh();
- }
- async getMyList(pageNo) {
- this.setState({
- listState: 'LOADING'
- })
- let data = {
- pageNo: pageNo,
- pageSize: 10,
- // startTime: this.state.rangeStartMinuteVal || undefined,
- // endTime: this.state.rangeEndMinuteVal || undefined,
- listStatus: this.state.current,
- processStatus: 1,
- // checkNo: this.state.searchValue,
- username: this.state.searchType.id == 1 ? this.state.searchValue : undefined,
- checkNo: this.state.searchType.id == 0 ? this.state.searchValue : undefined,
- }
- let msg = await getNewRecordList(removeNull(data));
- if (msg.error.length === 0) {
- if (msg.data.totalCount === 0) {
- this.setState({
- listState: 'NO_DATA'
- })
- } else if (msg.data.totalCount === this.state.list.length && pageNo !== 1) {
- Taro.showToast({ title: '没有更多数据了', icon: 'none' });
- this.setState({
- listState: 'NO_MORE_DATA'
- })
- } else {
- if (msg.data.totalCount === (pageNo === 1 ? msg.data.list : this.state.list.concat(msg.data.list)).length) {
- this.setState({
- listState: 'NO_MORE_DATA'
- })
- }
- }
- this.setState({
- list: pageNo === 1 ? msg.data.list : this.state.list.concat(msg.data.list),
- pageNo: msg.data.list.length === 0 ? this.state.pageNo : msg.data.pageNo
- })
- } else {
- Taro.showToast({ title: msg.error[0].message, icon: 'none' });
- this.setState({
- listState: msg.error[0].field === '403' ? 'NO_DATA' : 'RELOAD'
- })
- }
- Taro.stopPullDownRefresh();
- }
- onPageScroll(event) {
- let touchMove = event.scrollTop;
- if (touchMove >= 37) {
- this.setState({
- openSearch: true
- })
- } else {
- this.setState({
- openSearch: false
- })
- }
- }
- render() {
- const { list, searchType, search } = this.state
- return (
- <View className='indexPage' >
- <View className='searchContent'>
- <View className='searchTop'>
- <Picker
- value={searchType.id}
- range={search} rangeKey='title' mode='selector'
- onChange={(e) => {
- this.setState({
- searchType: search[e.detail.value],
- })
- }}>
- <View className='shortValuecontent'>
- <View className='selectTitle'>{searchType.title}</View>
- <View className='iconContent'><AtIcon value='chevron-down' size='10' color='#FFFFFF' /></View>
- </View>
- </Picker>
- <AtSearchBar
- showActionButton
- placeholder='请输入'
- value={this.state.searchValue}
- onActionClick={() => {
- this.getPublicReleaseList();
- }}
- onChange={(value) => {
- this.setState({
- searchValue: value
- })
- }}
- onClear={() => {
- this.setState({
- searchValue: ''
- })
- }}
- />
- </View>
- </View>
- <AtTabs
- swipeable={false}
- current={this.state.current || 0}
- tabList={this.state.typeList}
- onClick={(current) => {
- this.setState({
- list: [],
- pageNo: 1,
- current,
- }, () => {
- this.getPublicReleaseList();
- })
- }}>
- {
- this.state.typeList?.map((item, index) =>
- <AtTabsPane
- current={this.state.current}
- index={index}
- >
- <View className='list'>
- {
- list?.map((item) =>
- <View className='item' key={item.id}
- onClick={() => {
- Taro.navigateTo({
- url: '/pages/mergedetail/index?id=' + item.id
- })
- }}
- >
- {/* {item.status == 1 && <View className='lbt' onClick={e => { e.stopPropagation(); this.setState({ visible: true, id: item.id }) }}>查看审核详情</View>} */}
- <View className='line' style={{ color: "#6190E8" }}>报销编号:{item.checkNo}</View>
- <View className='line' style={{ color: "#6190E8" }}>总金额:{item.realAmount}元</View>
- <View className='line'>报销人:{item.aname}</View>
- <View className='line'>报销部门:{item.applyDepName}</View>
- <View className='line'>报销时间:{item.createTimeStr}</View>
- <View className='lis'></View>
- {
- item.sonList?.map((it) =>
- <View key={it.id} style={{ marginTop: 10 }}>
- <View className='line'>报销金额(元):{it.amount}</View>
- <View className='line'>报销类型:
- {getAccountName(it.type, it.typeOther)}
- {it.type == 2 && (" - " + getSecondaryAccountName(it.secondaryType, it.secondaryTypeOther))}
- </View>
- {it.type == 1 && <View className='line'>公出企业:{it.userNames}</View>}
- <View className='line'>{it.type == 1 ? "公出时间" : "费用时间"}:
- {!it.releaseStart ? "" : (it.releaseStart.slice(0, 10) + " 至 " + it.releaseEnd.slice(0, 10))}
- </View>
- </View>
- )
- }
- <View className='lines'
- style={{ color: accountLtate[item.status].color }}
- >{item.status == 1 && `[${item.examineName}]`}{accountLtate[item.status].title}</View>
- </View>
- )
- }
- <ListBottomStart
- state={this.state.listState}
- reload={() => {
- this.getPublicReleaseList(true)
- }}
- />
- </View>
- </AtTabsPane>
- )
- }
- </AtTabs>
- <timePicker
- config={{
- endDate: true,
- column: "day",
- dateLimit: false,
- limitStartTime: dayjs().subtract(3, 'year').format('YYYY-MM-DD '),
- limitEndTime: dayjs().add(3, 'year').format('YYYY-MM-DD ')
- }}
- isPartition
- pickerShow={this.state.isPickerRender}
- onconditionaljudgment={(v) => {
- }}
- onhidepicker={() => {
- this.onPickerHide()
- }}
- onsetpickertime={(v) => {
- this.onSetPickerTime(v)
- }}>
- </timePicker>
- {/* 审核详情 */}
- {this.state.visible &&
- <AuditModal
- id={this.state.id}
- isOpened={this.state.visible}
- onClose={() => {
- this.setState({
- visible: false
- })
- }}
- />}
- </View >
- )
- }
- }
- export default Examine
|