import React, { Component } from "react"; import Taro, { getCurrentInstance } from "@tarojs/taro"; import { Text, View, Image } from "@tarojs/components"; import ImagePicker from "../../components/common/imagePicker"; import InquiryModal from "../../components/common/inquiryModal"; import AuditModal from "../../components/common/auditModal"; import { getPridDetail, getAccountList, selectList, AccountExamine, } from "../../utils/servers/servers"; import { getAccountName, getTypeName, getVehicleName, commonAdd, copyText, } from "../../utils/tools"; import { AtTextarea, AtButton, AtIcon } from "taro-ui"; import { resourceAddress } from "../../utils/config"; import Right from '../../image/right.png' import "taro-ui/dist/style/components/form.scss"; import "taro-ui/dist/style/components/button.scss"; import "taro-ui/dist/style/components/loading.scss"; import "taro-ui/dist/style/components/icon.scss"; import "taro-ui/dist/style/components/textarea.scss"; import "taro-ui/dist/style/components/input.scss"; import "./index.less"; class Drafts extends Component { $instance = getCurrentInstance(); constructor(props) { super(props); this.state = { data: {}, list: [], total: 0, bankData: {}, reason: "", visible: false, }; } componentDidMount() { this.$instance.router.params && this.$instance.router.params.id && ( this.getDetail(), this.getAccountList() ) } // 报销单详情 getDetail() { getPridDetail({ id: this.$instance.router.params.id, }).then(v => { if (v.error.length === 0) { let list = []; for (let i of (v.data.attachmentUrl || '').split(',')) { if (i) { list.push({ 'url': resourceAddress + i }) } } this.setState({ data: v.data, rangeStartMinuteVal: v.data.releaseStartStr, rangeEndMinuteVal: v.data.releaseEndStr, totalDuration: v.data.duration, attachmentUrl: list, }) } else { Taro.showToast({ title: v.error[0].message, icon: 'none' }) } }).catch(() => { Taro.showToast({ title: '系统错误,请稍后再试', icon: 'none' }) }) } // 报销详情金额列表 getAccountList() { getAccountList({ eaid: this.$instance.router.params.id, }).then(v => { if (v.error.length === 0) { let sum = 0 for (var i = 0; i < v.data.length; i++) { // sum += v.data[i].amount sum = commonAdd(sum, v.data[i].amount) } this.setState({ list: v.data, total: sum, }) } else { Taro.showToast({ title: v.error[0].message, icon: 'none' }) } }).catch(() => { Taro.showToast({ title: '系统错误,请稍后再试', icon: 'none' }) }) } render() { const { data, list, total, bankData, attachmentUrl } = this.state const icon = { width: '50px', height: '10px', margin: '0 10px', } return ( {getAccountName(data.type, data.typeOther)} {/* {(data.status == 1 || data.status == 2) && 编号: {data.checkNo} { e.stopPropagation(); copyText(data.checkNo) }} >复制编号打印 } */} {data.type == 1 && 公出企业: {data.userNames} } {data.type == 1 && 公出地点: {data.districtName} } {data.type == 1 && 公出时间: {this.state.rangeStartMinuteVal.slice(0, 16)} 至 {this.state.rangeEndMinuteVal.slice(0, 16)} } {data.type == 1 && 公出时长: {this.state.totalDuration}小时 } 申请类型: {getAccountName(data.type, data.typeOther)} {data.type != 4 && data.type != 5 && 报销至订单: {data.buyerName} {data.contractNo} } {data.type != 4 && data.type != 5 && "报销"}费用详细 {/* 差旅费显示 */} {data.type == 1 && list?.map(item => item.type == 1 ? 交通工具: {getVehicleName(item.vehicle, item.vehicleOther)}  时间: {item.startTimeStr.slice(0, 16)} 至 {item.endTimeStr.slice(0, 16)} 地点: {item.startDistrict} {item.endDistrict} 金额: {item.amount}(元) : {getTypeName(item.type) + ":"} {item.amount}(元) ) } {/* 通用 */} {(data.type == 0 || data.type == 2 || data.type == 4 || data.type == 5) && list?.map(item => {!!item.agreeTimeStr && {data.type == 5 ? "支付时间:" : "需付款时间:"} {item.agreeTimeStr.slice(0, 10)} } {data.type == 4 ? "预借支金额:" : data.type == 5 ? "抵扣金额:" : "金额:"} {item.amount}(元) ) } {/* 第三方付款 */} {data.type == 3 && list?.map(item => {!!item.agreeTimeStr && 需付款时间: {item.agreeTimeStr.slice(0, 10)} } 付款方式: {["公对公转账"][item.payType]} 发票类型: {["普票", "专票"][item.invoiceType]} 发票号: {item.invoiceNo} 付款单位: {item.payerName} 开户银行: {item.openBank} 银行账户: {item.bankAccounts} 开户行地址: {item.openBankAddress} 金额: {item.amount}(元) ) } { data.type != 4 && data.debitTotalAmount && 预借支: {data.debitTotalAmount}(元) } { data.type != 4 && data.type != 5 && 总金额: {total}(元) } { data.type != 4 && data.type != 5 && 实报金额: {(total > data.debitTotalAmount) ? commonAdd(total, -data.debitTotalAmount) : 0} (元) } 附件: {attachmentUrl && attachmentUrl.length > 0 && } ); } } export default Drafts;