123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import React, { Component } from "react";
- import Taro, { getCurrentInstance } from "@tarojs/taro";
- import { View, Text, Button, Image } from "@tarojs/components";
- import { getDrbitNote } from "../../utils/servers/servers";
- import { commonAdd } from "../../utils/tools"
- import "taro-ui/dist/style/components/search-bar.scss";
- import "taro-ui/dist/style/components/button.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 noData from '../../image/noData.png';
- import './index.less';
- class DebitNote extends Component {
- $instance = getCurrentInstance();
- constructor(props) {
- super(props);
- this.state = {
- list: [],
- listVisible: false,
- };
- this.getList = this.getList.bind(this);
- }
- componentDidMount() {
- this.getList()
- }
- getList() {
- getDrbitNote({
- depId: this.$instance.router.params.depId,
- }).then((msg) => {
- if (msg.error.length === 0) {
- this.setState({
- list: msg.data,
- });
- } else {
- Taro.showToast({ title: msg.error[0].message, icon: "none" });
- }
- }).catch(() => {
- });
- }
- render() {
- const { list } = this.state
- return (
- <View className="debitnote">
- {list.length == 0 ?
- <View className='noData'>
- <Image src={noData} className='noDataImg' />
- <View className='noDataTitle'>您暂时没有能使用的借支单</View>
- </View> :
- <View className="dlist">
- {
- list?.map((v, k) => (
- <View className="dlitem" key={k}>
- <View className="txt">
- <View className="num">{commonAdd(v.totalAmount, -v.settlementAmount)}元</View>
- <View className="info">
- 总金额:{v.totalAmount}元,
- 已使用:{v.settlementAmount}元
- </View>
- </View>
- <Button
- className="bt"
- type='primary'
- size="mini"
- disabled={v.liquidationStatus == 2 || v.liquidationStatus == 3}
- onClick={() => {
- let pages = Taro.getCurrentPages();
- let prevPage = pages[pages.length - 2];
- prevPage.setData({
- debitId: v.id,
- totalAmount: commonAdd(v.totalAmount, -v.settlementAmount),
- });
- Taro.navigateBack({
- delta: 1
- })
- }}
- >{(v.liquidationStatus == 2 || v.liquidationStatus == 3) ? "已抵消" : "选择"}</Button>
- </View>
- ))
- }
- </View>}
- </View>
- );
- }
- }
- export default DebitNote;
|