123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- import React, { Component } from 'react';
- import Taro from '@tarojs/taro';
- import { View, Picker, ScrollView, } from '@tarojs/components'
- import { getRecordList, getAudit } from '../../utils/servers/servers';
- import dayjs from 'dayjs';
- import { AtIcon, } from 'taro-ui';
- import { getAccountName } 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 = {
- starts: {},
- list: [],
- visible: false,
- }
- }
- componentDidShow() {
- 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,
- status: isNaN(parseInt(this.state.starts.id)) ? undefined : String(this.state.starts.id),
- }
- for (let i in data) {
- if (!data[i]) {
- delete data[i]
- }
- }
- let msg = await getRecordList(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
- })
- }
- }
- selAudit(id, e) {
- e.stopPropagation();
- getAudit({
- eaid: id,
- }).then((v) => {
- if (v.error.length === 0) {
- } else {
- Taro.showToast({ title: v.error[0].message, icon: "none" });
- }
- }).catch((err) => {
- Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
- });
- }
- render() {
- const { list } = this.state
- return (
- <View className='indexPage' >
- <View className='searchContent'>
- <ScrollView className={this.state.openSearch ? 'searchBottomLOL' : ''} scrollX style={{ width: '100%' }}>
- <View className='searchBottom'>
- <View className='searchItem' style={{ paddingLeft: '5px' }}>
- <Picker
- value={this.state.starts.id}
- range={accountLtate} rangeKey='title' mode='selector'
- onChange={(e) => {
- this.setState({
- starts: accountLtate[e.detail.value],
- }, () => {
- this.getPublicReleaseList();
- })
- }}>
- {
- !this.state.starts.title ?
- <View className='shortValuecontent'>
- <View className='selectTitle'>状态</View>
- <View className='iconContent'><AtIcon value='chevron-down' size='10' color='#FFFFFF' /></View>
- </View> :
- <View className='shortValuecontent'>
- <View className='selectValue'>
- {this.state.starts.title}
- </View>
- <View className='iconContent' />
- </View>
- }
- </Picker>
- {
- this.state.starts.title &&
- <View className='searchSelectContent'>
- <View className='selectIcon'
- onClick={(e) => {
- e.stopPropagation();
- this.setState({
- starts: {}
- }, () => {
- this.getPublicReleaseList();
- })
- }}>
- <AtIcon value='close-circle' size='10' color='#FFFFFF' />
- </View>
- </View>
- }
- </View>
- <View className='searchItem' onClick={() => {
- this.setState({
- isPickerRender: true
- })
- }}>
- <View>
- {
- !this.state.rangeStartMinuteVal ?
- <View className='valuecontent'>
- <View className='selectTitle'>开始及结束时间</View>
- <View className='iconContent' ><AtIcon value='chevron-down' size='10' color='#FFFFFF' /></View>
- </View> :
- <View className='valuecontent'>
- <View className='selectValue' >
- {this.state.rangeStartMinuteVal + "~" + this.state.rangeEndMinuteVal}
- </View>
- <View className='iconContent' />
- </View>
- }
- </View>
- {
- this.state.rangeStartMinuteVal &&
- <View className='searchSelectContent'>
- <View className='selectIcon'
- onClick={(e) => {
- e.stopPropagation();
- this.setState({
- rangeStartMinuteVal: '',
- rangeEndMinuteVal: '',
- }, () => {
- this.getPublicReleaseList();
- })
- }}>
- <AtIcon value='close-circle' size='10' color='#FFFFFF' />
- </View>
- </View>
- }
- </View>
- </View>
- </ScrollView>
- </View>
- <View className='list'>
- {
- list?.map((item) =>
- <View className='item' key={item.id}
- onClick={() => {
- Taro.navigateTo({
- url: '/pages/drafts/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'>报销金额:{item.totalAmount}元</View>
- <View className='line'>报销时间:{item.createTimeStr}</View>
- <View className='line'>报销类型:{getAccountName(item.type, item.typeOther)}</View>
- <View className='lines'
- style={{ color: accountLtate[item.status].color }}
- >{accountLtate[item.status].title}</View>
- </View>
- )
- }
- <ListBottomStart
- state={this.state.listState}
- reload={() => {
- this.getPublicReleaseList(true)
- }}
- />
- </View>
- <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
|