|
@@ -1,11 +1,13 @@
|
|
|
import React, { Component } from "react";
|
|
|
import Taro, { getCurrentInstance } from "@tarojs/taro";
|
|
|
-import { Text, View } from "@tarojs/components";
|
|
|
+import { Text, View, Picker } from "@tarojs/components";
|
|
|
import ImagePicker from "../../components/common/imagePicker";
|
|
|
+import InquiryModal from "../../components/common/inquiryModal";
|
|
|
import {
|
|
|
getPridDetail,
|
|
|
getAccountList,
|
|
|
selectList,
|
|
|
+ AccountExamine,
|
|
|
} from "../../utils/servers/servers";
|
|
|
import {
|
|
|
getAccountName,
|
|
@@ -13,6 +15,7 @@ import {
|
|
|
getVehicleName,
|
|
|
commonAdd,
|
|
|
} from "../../utils/tools";
|
|
|
+import { AtTextarea, AtButton } from "taro-ui";
|
|
|
import { resourceAddress } from "../../utils/config";
|
|
|
import "taro-ui/dist/style/components/form.scss";
|
|
|
import "taro-ui/dist/style/components/button.scss";
|
|
@@ -34,6 +37,7 @@ class Drafts extends Component {
|
|
|
list: [],
|
|
|
total: 0,
|
|
|
bankData: {},
|
|
|
+ reason: "",
|
|
|
};
|
|
|
}
|
|
|
|
|
@@ -91,7 +95,7 @@ class Drafts extends Component {
|
|
|
totalDuration: v.data.duration,
|
|
|
attachmentUrl: list,
|
|
|
})
|
|
|
- v.data.aid && this.getMyList(v.data.aid)
|
|
|
+ // v.data.aid && this.getMyList(v.data.aid)
|
|
|
} else {
|
|
|
Taro.showToast({ title: v.error[0].message, icon: 'none' })
|
|
|
}
|
|
@@ -130,52 +134,87 @@ class Drafts extends Component {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ // 审批
|
|
|
+ examine(val) {
|
|
|
+ AccountExamine({
|
|
|
+ id: this.state.data.id,
|
|
|
+ reason: this.state.reason,
|
|
|
+ status: val,
|
|
|
+ })
|
|
|
+ .then((v) => {
|
|
|
+ Taro.hideLoading();
|
|
|
+ if (v.error.length === 0) {
|
|
|
+ Taro.showToast({
|
|
|
+ title: "操作成功",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ this.getDetail()
|
|
|
+ } else {
|
|
|
+ Taro.showToast({ title: v.error[0].message, icon: "none" });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
|
|
|
+ // console.log(err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
render() {
|
|
|
const { data, list, total, bankData, attachmentUrl } = this.state
|
|
|
return (
|
|
|
<View className="subform">
|
|
|
- <View className="title">{[data.typeOther, "差旅费报销", "餐费报销", "第三方付款", "申请预借支","申请抵扣"][data.type]}</View>
|
|
|
- <View className="formItem">
|
|
|
- <View className="formName" style={{ width: "86px" }}>公出企业:</View>
|
|
|
- <View className="formValues">{data.userNames}</View>
|
|
|
- </View>
|
|
|
- <View className="formItem">
|
|
|
- <View className="formName" style={{ width: "86px" }}>公出地点:</View>
|
|
|
- <View className="formValues">{data.districtName}</View>
|
|
|
- </View>
|
|
|
- <View className="formItem">
|
|
|
- <View className="formName">公出时间:</View>
|
|
|
- <View className="formValue">
|
|
|
- <View
|
|
|
- className="time"
|
|
|
- onClick={() => {
|
|
|
- this.setState({
|
|
|
- isPickerRender: true,
|
|
|
- });
|
|
|
- }}
|
|
|
- >
|
|
|
- <View className="timeContent">
|
|
|
- <View style={{ textAlign: "center" }}>{this.state.rangeStartMinuteVal}</View>
|
|
|
- 至
|
|
|
- <View style={{ textAlign: "center" }}>{this.state.rangeEndMinuteVal}</View>
|
|
|
+ <View className="title">{getAccountName(data.type, data.typeOther)}</View>
|
|
|
+ {data.type == 1 &&
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName" style={{ width: "86px" }}>公出企业:</View>
|
|
|
+ <View className="formValues">{data.userNames}</View>
|
|
|
+ </View>}
|
|
|
+ {data.type == 1 &&
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName" style={{ width: "86px" }}>公出地点:</View>
|
|
|
+ <View className="formValues">{data.districtName}</View>
|
|
|
+ </View>}
|
|
|
+ {data.type == 1 &&
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">公出时间:</View>
|
|
|
+ <View className="formValue">
|
|
|
+ <View
|
|
|
+ className="time"
|
|
|
+ onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ isPickerRender: true,
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <View className="timeContent">
|
|
|
+ <View style={{ textAlign: "center" }}>{this.state.rangeStartMinuteVal}</View>
|
|
|
+ 至
|
|
|
+ <View style={{ textAlign: "center" }}>{this.state.rangeEndMinuteVal}</View>
|
|
|
+ </View>
|
|
|
</View>
|
|
|
- </View>
|
|
|
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- <View className="formItem">
|
|
|
- <View className="formName">公出时长:</View>
|
|
|
- <View className="formValue">{this.state.totalDuration}小时</View>
|
|
|
- </View>
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
+ {data.type == 1 &&
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">公出时长:</View>
|
|
|
+ <View className="formValue">{this.state.totalDuration}小时</View>
|
|
|
+ </View>}
|
|
|
<View className="formItem">
|
|
|
<View className="formName">申请类型:</View>
|
|
|
<View className="formValue">{getAccountName(data.type, data.typeOther)}</View>
|
|
|
</View>
|
|
|
- {/* <View className="formItem">
|
|
|
- <View className="formName">报销至订单:</View>
|
|
|
- <View className="formValue"></View>
|
|
|
- </View> */}
|
|
|
+ {data.type != 4 && data.type != 5 &&
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">报销至订单:</View>
|
|
|
+ <View className="formValue">
|
|
|
+ <View>
|
|
|
+ <View>{data.buyerName}</View>
|
|
|
+ <View>{data.contractNo}</View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
<View className="formTitle">
|
|
|
报销详细
|
|
|
</View>
|
|
@@ -183,53 +222,135 @@ class Drafts extends Component {
|
|
|
<View className="formName">申请人:</View>
|
|
|
<View className="formValue">{data.aname}</View>
|
|
|
</View>
|
|
|
- <View className="formItem">
|
|
|
- <View className="formName">报销公司:</View>
|
|
|
- <View className="formValue">{data.appDepName}</View>
|
|
|
- </View>
|
|
|
+ {
|
|
|
+ data.type != 4 && data.type != 5 &&
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">报销公司:</View>
|
|
|
+ <View className="formValue">{data.appDepName}</View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
<View className="formItem">
|
|
|
<View className="formName">支付公司:</View>
|
|
|
<View className="formValue">{data.payDepName}</View>
|
|
|
</View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">报销事由:</View>
|
|
|
+ <View className="formValue">{data.remarks}</View>
|
|
|
+ </View>
|
|
|
<View className="formTitle">
|
|
|
报销费用详细
|
|
|
</View>
|
|
|
- {list?.map(item =>
|
|
|
- item.type == 1
|
|
|
- ? <View className="unItem" key={item.id}>
|
|
|
+ {/* 差旅费显示 */}
|
|
|
+ {data.type == 1 &&
|
|
|
+ list?.map(item =>
|
|
|
+ item.type == 1
|
|
|
+ ? <View className="unItem" key={item.id}>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">交通工具:</View>
|
|
|
+ <View className="formValue">{getVehicleName(item.vehicle, item.vehicleOther)}</View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">时间:</View>
|
|
|
+ <View className="formValue">
|
|
|
+ <View className="ftxt">{item.startTimeStr}</View>
|
|
|
+ 至
|
|
|
+ <View className="ftxt">{item.endTimeStr}</View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">地点:</View>
|
|
|
+ <View className="formValue">
|
|
|
+ <View className="ftxt">{item.startDistrict}</View>
|
|
|
+ 至
|
|
|
+ <View className="ftxt">{item.endDistrict}</View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">金额(元):</View>
|
|
|
+ <View className="formValue">{item.amount}(元)</View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ : <View className="formItem" key={item.id}>
|
|
|
+ <View className="formName" style={{ width: "86px" }}>{getTypeName(item.type) + ":"}</View>
|
|
|
+ <View className="formValues">{item.amount}(元)</View>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ {/* 通用 */}
|
|
|
+ {(data.type == 0 || data.type == 2 || data.type == 4 || data.type == 5) &&
|
|
|
+ list?.map(item =>
|
|
|
+ <View className="unItem" key={item.id}>
|
|
|
<View className="formItem">
|
|
|
- <View className="formName">交通工具:</View>
|
|
|
- <View className="formValue">{getVehicleName(item.vehicle, item.vehicleOther)}</View>
|
|
|
+ <View className="formName">需付款时间:</View>
|
|
|
+ <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
|
|
|
</View>
|
|
|
<View className="formItem">
|
|
|
- <View className="formName">时间:</View>
|
|
|
- <View className="formValue">
|
|
|
- <View className="ftxt">{item.startTimeStr}</View>
|
|
|
- 至
|
|
|
- <View className="ftxt">{item.endTimeStr}</View>
|
|
|
- </View>
|
|
|
+ <View className="formName">金额(元):</View>
|
|
|
+ <View className="formValue">{item.amount}(元)</View>
|
|
|
</View>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ {/* 第三方付款 */}
|
|
|
+ {data.type == 3 &&
|
|
|
+ list?.map(item =>
|
|
|
+ <View className="unItem" key={item.id}>
|
|
|
<View className="formItem">
|
|
|
- <View className="formName">地点:</View>
|
|
|
- <View className="formValue">
|
|
|
- <View className="ftxt">{item.startDistrict}</View>
|
|
|
- 至
|
|
|
- <View className="ftxt">{item.endDistrict}</View>
|
|
|
- </View>
|
|
|
+ <View className="formName">需付款时间:</View>
|
|
|
+ <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
|
|
|
</View>
|
|
|
<View className="formItem">
|
|
|
- <View className="formName">金额:</View>
|
|
|
- <View className="formValue">{item.amount}(元)</View>
|
|
|
+ <View className="formName">付款方式:</View>
|
|
|
+ <View className="formValue">{["公对公转账"][item.payType]}</View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">发票类型:</View>
|
|
|
+ <View className="formValue">{["普票", "专票"][item.invoiceType]}</View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">发票号:</View>
|
|
|
+ <View className="formValue">{item.invoiceNo}</View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">付款单位:</View>
|
|
|
+ <View className="formValue">{item.payerName}</View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">开户银行:</View>
|
|
|
+ <View className="formValue">{item.openBank}</View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">银行账户:</View>
|
|
|
+ <View className="formValue">{item.bankAccounts}</View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">开户行地址:</View>
|
|
|
+ <View className="formValue">{item.openBankAddress}</View>
|
|
|
+ </View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">金额(元):</View>
|
|
|
+ <View className="formValue">{item.amount}</View>
|
|
|
</View>
|
|
|
</View>
|
|
|
- : <View className="formItem" key={item.id}>
|
|
|
- <View className="formName" style={{ width: "86px" }}>{getTypeName(item.type) + ":"}</View>
|
|
|
- <View className="formValues">{item.amount}(元)</View>
|
|
|
- </View>)}
|
|
|
- <View className="formItem" style={{ paddingTop: "10px" }}>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ {
|
|
|
+ data.type != 4 && data.type != 5 && data.debitTotalAmount &&
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">预借支:</View>
|
|
|
+ <View className="formValue"><Text style={{ color: "red" }}>{data.debitTotalAmount}</Text>(元)</View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+ <View className="formItem">
|
|
|
<View className="formName">总金额:</View>
|
|
|
<View className="formValue"><Text style={{ color: "red" }}>{total}</Text>(元)</View>
|
|
|
</View>
|
|
|
+ <View className="formItem">
|
|
|
+ <View className="formName">实报金额:</View>
|
|
|
+ <View className="formValue"><Text style={{ color: "red" }}>
|
|
|
+ {(total > data.debitTotalAmount) ? commonAdd(total, data.debitTotalAmount) : 0}
|
|
|
+ </Text>(元)</View>
|
|
|
+ </View>
|
|
|
<View className="formItem" style={{ display: "block", paddingBottom: 0 }}>
|
|
|
<View className="formName">附件:</View>
|
|
|
<View
|
|
@@ -238,28 +359,118 @@ class Drafts extends Component {
|
|
|
>
|
|
|
{attachmentUrl && attachmentUrl.length > 0 &&
|
|
|
<ImagePicker
|
|
|
- files={attachmentUrl}
|
|
|
+ files={attachmentUrl || []}
|
|
|
showAddBtn={false}
|
|
|
/>}
|
|
|
</View>
|
|
|
</View>
|
|
|
- <View className="formTitle" style={{ marginTop: "20px" }}>
|
|
|
- 报销收款账户
|
|
|
- </View>
|
|
|
- {data.type != 2 &&
|
|
|
+ {data.type != 3 &&
|
|
|
+ <View className="formTitle" style={{ marginTop: "20px" }}>
|
|
|
+ 报销至收款账户
|
|
|
+ </View>}
|
|
|
+ {data.type != 3 &&
|
|
|
<View className="unobstructedList">
|
|
|
{<View className="unItem" >
|
|
|
<View className="formItem">
|
|
|
- <View className="formName">收款人:{bankData.name}</View>
|
|
|
+ <View className="formName">收款人:{data.name}</View>
|
|
|
</View>
|
|
|
<View className="formItem">
|
|
|
- <View className="formName">收款银行:{bankData.bank}</View>
|
|
|
+ <View className="formName">收款银行:{data.bank}</View>
|
|
|
</View>
|
|
|
<View className="formItem">
|
|
|
- <View className="formName">收款账户:{bankData.accounts}</View>
|
|
|
+ <View className="formName">收款账户:{data.accounts}</View>
|
|
|
</View>
|
|
|
</View>}
|
|
|
</View>}
|
|
|
+
|
|
|
+ {
|
|
|
+ data.examine == 1 &&
|
|
|
+ <View>
|
|
|
+ <View className="formTitle" style={{ marginTop: "20px" }}>
|
|
|
+ 填写审批意见
|
|
|
+ </View>
|
|
|
+ <AtTextarea
|
|
|
+ value={this.state.reason}
|
|
|
+ onChange={(value) => {
|
|
|
+ this.setState({
|
|
|
+ reason: value,
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ maxLength={30}
|
|
|
+ placeholder="请填写审批意见"
|
|
|
+ />
|
|
|
+ <View className="operation">
|
|
|
+ <AtButton
|
|
|
+ type="secondary"
|
|
|
+ circle
|
|
|
+ loading={this.state.loading}
|
|
|
+ onClick={() => {
|
|
|
+ if (!this.state.reason) {
|
|
|
+ Taro.showToast({ title: "请先填写审批意见", icon: "none" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ isInquiryOpened: true,
|
|
|
+ inquiryTitle: "提醒",
|
|
|
+ inquiryContent: "您确定要驳回此申请吗?",
|
|
|
+ inquiryFn: () => {
|
|
|
+ this.examine(3);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 驳回
|
|
|
+ </AtButton>
|
|
|
+ <AtButton
|
|
|
+ type="primary"
|
|
|
+ loading={this.state.loading}
|
|
|
+ circle
|
|
|
+ onClick={() => {
|
|
|
+ if (!this.state.reason) {
|
|
|
+ Taro.showToast({ title: "请先填写审批意见", icon: "none" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ isInquiryOpened: true,
|
|
|
+ inquiryTitle: "提醒",
|
|
|
+ inquiryContent: "您确定要同意此申请吗?",
|
|
|
+ inquiryFn: () => {
|
|
|
+ this.examine(1);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 同意
|
|
|
+ </AtButton>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+
|
|
|
+ {/* 二级确认弹窗 */}
|
|
|
+ <InquiryModal
|
|
|
+ isOpened={this.state.isInquiryOpened}
|
|
|
+ title={this.state.inquiryTitle}
|
|
|
+ content={this.state.inquiryContent}
|
|
|
+ onClose={() => {
|
|
|
+ this.setState({
|
|
|
+ isInquiryOpened: false,
|
|
|
+ inquiryTitle: "",
|
|
|
+ inquiryContent: "",
|
|
|
+ isNo: true,
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ onDetermine={() => {
|
|
|
+ this.state.inquiryFn();
|
|
|
+ this.setState({
|
|
|
+ isInquiryOpened: false,
|
|
|
+ inquiryTitle: "",
|
|
|
+ inquiryContent: "",
|
|
|
+ isNo: true,
|
|
|
+ inquiryFn: () => { },
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+
|
|
|
</View>
|
|
|
);
|
|
|
}
|