522 lines
17 KiB
Vue
Raw Normal View History

2024-07-09 18:11:31 +08:00
<template>
2024-07-30 18:16:46 +08:00
<view style="background: #F1F2F8;min-height: 100vh;" v-cloak>
2024-07-09 18:11:31 +08:00
<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="true" backgroundColor="#FFFFFF">
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
<view style="padding-left: 15rpx;" @click="goBack()">
<text class="tn-icon-left" style="font-size: 40rpx;"></text>
</view>
2024-07-30 18:16:46 +08:00
<view style="width: 83%;font-weight: bold;">
<text>发票开取</text>
2024-07-09 18:11:31 +08:00
</view>
</view>
</tn-nav-bar>
<view class="tn-safe-area-inset-bottom" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
2024-07-30 18:16:46 +08:00
<view v-if="allList.length==0" style="text-align: center;padding-top: 200rpx;">
<image class="no-img" src="/static/_6@2x.png" style="width: 250rpx;" mode="widthFix"></image>
<view style="font-size: 34rpx;font-weight: bold;margin-top: 40rpx;">暂无发票数据</view>
<view style="font-size: 28rpx;color: #BABDC7;margin-top: 20rpx;">未查找到您的发票信息赶快去申请</view>
<view style="margin-top: 80rpx;">
2024-08-19 18:15:03 +08:00
<tn-button @click="addMod = true" width="450rpx" height="85rpx" backgroundColor="#3056D3"
shape="round" fontColor="#ffffff">去申请发票</tn-button>
2024-07-30 18:16:46 +08:00
</view>
</view>
<view style="padding: 30rpx;">
2024-08-19 18:15:03 +08:00
<view v-for="item in allList"
2024-07-30 18:16:46 +08:00
style="margin-bottom: 30rpx;background-color: #FFF;border-radius: 20rpx;padding: 30rpx;">
<view class="tn-flex tn-flex-center tn-flex-col-center tn-flex-row-between">
2024-08-19 18:15:03 +08:00
<view style="font-size: 32rpx;font-weight: bold;">{{item.unit}}</view>
<view v-if="item.if_ssue==3" style="color: #FF9847;">
2024-07-30 18:16:46 +08:00
<text>待审核</text>
<text class="tn-icon-right"></text>
</view>
2024-08-19 18:15:03 +08:00
<view v-if="item.if_ssue==2" style="color: #E83A30;">
<text>被拒绝</text>
<text class="tn-icon-right"></text>
</view>
<view v-if="item.if_ssue==1" style="color: #28B93D;">
<text>已开具</text>
<text class="tn-icon-right"></text>
</view>
2024-07-30 18:16:46 +08:00
</view>
<view class="view_text" style="color: #666666;">
<view>
2024-08-19 18:15:03 +08:00
<text>{{item.name}} / {{item.createtime}}</text>
2024-07-30 18:16:46 +08:00
</view>
<view>
<text>发票金额</text>
2024-08-19 18:15:03 +08:00
<text>¥{{item.money}}</text>
2024-07-30 18:16:46 +08:00
</view>
</view>
<view style="height: 1rpx;border-top: #BABDC7 1rpx dashed;margin: 30rpx 0rpx;"></view>
<view style="text-align: right;">
2024-08-19 18:15:03 +08:00
<tn-button @click="openInfoMod(item)" height="70rpx" width="200rpx" fontColor="#999999"
2024-07-30 18:16:46 +08:00
shape="round" backgroundColor="#999999" :plain="true">查看</tn-button>
</view>
</view>
<view @click="addMod = true"
style="position: fixed;bottom: 10%;right: 0;box-shadow: 0rpx 4rpx 25rpx 0rpx rgba(48,86,211,0.25);text-align: center;color: #FFF;;background-color: #3056D3;border-radius: 80rpx 0 0rpx 80rpx;width: 180rpx;;height: 70rpx;line-height: 70rpx;">
申请发票
</view>
</view>
<!-- <view style="padding:40rpx;">
2024-07-09 18:11:31 +08:00
<view class="tn-flex tn-flex-center tn-flex-row-between ">
<view>
已有发票 {{count}}
</view>
<view>
<tn-button @click="addMod = true" backgroundColor="#3D7EFF" size="sm"
fontColor="#ffffff">发票申请</tn-button>
</view>
</view>
</view>
<view style="padding:0rpx 40rpx;" v-for="item in allList">
<view @click="openInfo(item)"
class="tn-flex tn-flex-center tn-flex-row-between tn-flex-col-center bg-flex-shadow tn-shadow-blur">
<view>
<view style="font-size: 34rpx;font-weight: 600;">
<text>发票金额</text>
<text class="tn-icon-money-fill" style="color: #28B93D;"></text>
<text style="color: #28B93D;">{{item.money}}</text>
</view>
<view style="margin-top: 10rpx;font-size: 28rpx;color: #999999;">
<text>{{item.createtime}}</text>
</view>
</view>
<view>
<tn-tag v-if="item.if_ssue==1" backgroundColor="#31E749" fontColor="#ffffff"
shape="radius">已通过</tn-tag>
<tn-tag v-if="item.if_ssue==2" backgroundColor="#E83A30" fontColor="#ffffff"
shape="radius">被拒绝</tn-tag>
<tn-tag v-if="item.if_ssue==3" backgroundColor="#FF7043" fontColor="#ffffff"
shape="radius">审核中</tn-tag>
<text class="tn-icon-right-triangle" style="margin-left: 10rpx;"></text>
</view>
</view>
<view style="width: 100%;height: 1px;background-color: #F8F7F8;margin: 40rpx 0rpx;"></view>
2024-07-30 18:16:46 +08:00
</view> -->
2024-07-09 18:11:31 +08:00
</view>
<tn-popup v-model="addMod" mode="right" :safeAreaInsetBottom="true" width="100%">
2024-07-30 18:16:46 +08:00
<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="true" backgroundColor="#FFFFFF">
2024-07-09 18:11:31 +08:00
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
<view style="padding-left: 15rpx;" @click="addMod = false">
<text class="tn-icon-left" style="font-size: 40rpx;"></text>
</view>
2024-07-30 18:16:46 +08:00
<view style="width: 83%;font-weight: bold;">
<text>申请发票</text>
2024-07-09 18:11:31 +08:00
</view>
</view>
</tn-nav-bar>
2024-07-30 18:16:46 +08:00
<view :style="{paddingTop: vuex_custom_bar_height+'px'}"
style="background-color: #F1F2F8;min-height: 100vh;">
<view class="text" style="padding:30rpx;">
<view style="background-color: #FFF;border-radius: 20rpx;padding:10rpx 30rpx;">
<tn-form ref="form" :labelWidth="150">
<tn-form-item label="申请人" prop="name">
2024-08-19 18:15:03 +08:00
<tn-input placeholder="申请人" inputAlign="right" :clearable="false"
:customStyle="{width: '470rpx'}" v-model="addForm.name" />
2024-07-30 18:16:46 +08:00
</tn-form-item>
<tn-form-item label="公司名称" prop="unit">
2024-08-19 18:15:03 +08:00
<tn-input placeholder="公司名称" inputAlign="right" :clearable="false"
:customStyle="{width: '470rpx'}" v-model="addForm.unit" />
2024-07-30 18:16:46 +08:00
</tn-form-item>
<tn-form-item label="纳税人识别号" :labelWidth="200" prop="taxpayer_identification_number">
2024-08-19 18:15:03 +08:00
<tn-input placeholder="纳税人识别号" inputAlign="right" :clearable="false"
:customStyle="{width: '420rpx'}" v-model="addForm.taxpayer_identification_number" />
2024-07-30 18:16:46 +08:00
</tn-form-item>
<tn-form-item label="单位地址" prop="unit_address">
2024-08-19 18:15:03 +08:00
<tn-input placeholder="单位地址" inputAlign="right" :clearable="false"
:customStyle="{width: '470rpx'}" v-model="addForm.unit_address" />
2024-07-30 18:16:46 +08:00
</tn-form-item>
<tn-form-item label="单位电话" prop="telephone">
2024-08-19 18:15:03 +08:00
<tn-input placeholder="单位电话" inputAlign="right" :clearable="false"
:customStyle="{width: '470rpx'}" v-model="addForm.telephone" />
2024-07-30 18:16:46 +08:00
</tn-form-item>
<tn-form-item label="银行基本户账号" :labelWidth="220" prop="bank_basic_account_number">
2024-08-19 18:15:03 +08:00
<tn-input placeholder="银行基本户账号" :clearable="false" inputAlign="right"
:customStyle="{width: '410rpx'}" v-model="addForm.bank_basic_account_number" />
2024-07-30 18:16:46 +08:00
</tn-form-item>
<tn-form-item label="开户行" prop="bank">
2024-08-19 18:15:03 +08:00
<tn-input placeholder="开户行" :clearable="false" inputAlign="right"
:customStyle="{width: '470rpx'}" v-model="addForm.bank" />
</tn-form-item>
<tn-form-item label="发票金额" prop="bank" :borderBottom="true">
<tn-input placeholder="发票金额" inputAlign="right" :clearable="false"
:customStyle="{width: '470rpx'}" v-model="addForm.money" />
2024-07-30 18:16:46 +08:00
</tn-form-item>
2024-08-19 18:15:03 +08:00
<tn-form-item label="支付凭证" prop="bank" :borderBottom="false">
<view class="tn-flex tn-flex-center tn-flex-col-center tn-flex-row-right">
<view style="text-align: center;">
<image v-if="addForm.voucher!=''" :src="apiImgUrl+addForm.voucher"
style="width: 200rpx;height: 200rpx"></image>
</view>
<view style="margin-left: 20rpx;">
<tn-button @click="upload_img" backgroundColor="#3056D3" fontColor="#ffffff"
size="sm">上传凭证</tn-button>
</view>
</view>
2024-07-30 18:16:46 +08:00
</tn-form-item>
</tn-form>
2024-07-09 18:11:31 +08:00
</view>
</view>
2024-07-30 18:16:46 +08:00
<view
style="position: fixed;bottom:0px;width: 100%;background-color: #FFFFFF;box-shadow: 0rpx -2rpx 4rpx 0rpx rgba(186,189,199,0.2);padding:30rpx 30rpx 40rpx 30rpx;">
2024-08-19 18:15:03 +08:00
<view @click="kp_add_do"
2024-07-30 18:16:46 +08:00
style="margin: 0 auto;line-height: 80rpx;height: 80rpx;font-size: 32rpx;font-weight: bold;text-align: center;width: 80%;color: #ffffff;;background: #3056D3;border: 1rpx solid #3056D3;border-radius:90rpx;">
<text>申请发票</text>
2024-07-09 18:11:31 +08:00
</view>
</view>
</view>
</tn-popup>
<tn-popup v-model="infoMod" mode="right" :safeAreaInsetBottom="true" width="100%">
2024-07-30 18:16:46 +08:00
<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="true" backgroundColor="#FFFFFF">
2024-07-09 18:11:31 +08:00
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
2024-08-19 18:15:03 +08:00
<view style="padding-left: 15rpx;" @click="infoMod = false">
2024-07-09 18:11:31 +08:00
<text class="tn-icon-left" style="font-size: 40rpx;"></text>
</view>
2024-07-30 18:16:46 +08:00
<view style="width: 83%;font-weight: bold;">
2024-08-19 18:15:03 +08:00
<text>开票信息</text>
2024-07-09 18:11:31 +08:00
</view>
</view>
</tn-nav-bar>
2024-07-30 18:16:46 +08:00
<view :style="{paddingTop: vuex_custom_bar_height+'px'}"
style="background-color: #F1F2F8;min-height: 100vh;">
<view style="padding: 30rpx;">
<view style="background-color: #FFF;border-radius: 20rpx;padding: 30rpx;">
<view class="tn-flex tn-flex-center tn-flex-col-center tn-flex-row-between">
2024-08-19 18:15:03 +08:00
<view style="font-size: 32rpx;font-weight: bold;">{{info.unit}}</view>
<view v-if="info.if_ssue==3" style="color: #FF9847;">
<text>待审核</text>
</view>
<view v-if="info.if_ssue==2" style="color: #E83A30;">
<text>被拒绝</text>
</view>
<view v-if="info.if_ssue==1" style="color: #28B93D;">
<text>已开具</text>
</view>
2024-07-30 18:16:46 +08:00
</view>
<view class="view_text" style="font-size: 28rpx;color: #666666;margin-top: 30rpx;">
<view>
<text>申请人</text>
2024-08-19 18:15:03 +08:00
<text>{{info.name}}</text>
2024-07-30 18:16:46 +08:00
</view>
<view>
<text>申请时间</text>
2024-08-19 18:15:03 +08:00
<text>{{info.createtime}}</text>
2024-07-30 18:16:46 +08:00
</view>
<view>
<text>单位电话</text>
2024-08-19 18:15:03 +08:00
<text>{{info.telephone}}</text>
2024-07-30 18:16:46 +08:00
</view>
<view>
<text>单位地址</text>
2024-08-19 18:15:03 +08:00
<text>{{info.unit_address}}</text>
2024-07-30 18:16:46 +08:00
</view>
<view>
<text>银行基本户账号</text>
2024-08-19 18:15:03 +08:00
<text>{{info.bank_basic_account_number}}</text>
2024-07-30 18:16:46 +08:00
</view>
<view>
<text>纳税人识别号</text>
2024-08-19 18:15:03 +08:00
<text>{{info.taxpayer_identification_number}}</text>
2024-07-30 18:16:46 +08:00
</view>
<view>
<text>开户行</text>
2024-08-19 18:15:03 +08:00
<text>{{info.bank}}</text>
2024-07-30 18:16:46 +08:00
</view>
<view>
<text>发票金额</text>
2024-08-19 18:15:03 +08:00
<text>¥{{info.money}}</text>
2024-07-30 18:16:46 +08:00
</view>
2024-08-20 17:22:43 +08:00
<view>
<text>支付凭证</text>
<image @click="openImgT" :src="apiImgUrl+info.voucher"></image>
</view>
2024-07-30 18:16:46 +08:00
</view>
2024-07-09 18:11:31 +08:00
</view>
</view>
</view>
2024-08-19 18:15:03 +08:00
<view v-if="info.if_ssue==1"
2024-07-30 18:16:46 +08:00
style="position: fixed;bottom:0px;width: 100%;background-color: #FFFFFF;box-shadow: 0rpx -2rpx 4rpx 0rpx rgba(186,189,199,0.2);padding:30rpx 30rpx 40rpx 30rpx;">
2024-08-19 18:15:03 +08:00
<view @click="openImg"
2024-07-30 18:16:46 +08:00
style="margin: 0 auto;line-height: 80rpx;height: 80rpx;font-size: 32rpx;font-weight: bold;text-align: center;width: 80%;color: #ffffff;;background: #3056D3;border: 1rpx solid #3056D3;border-radius:90rpx;">
<text>下载发票</text>
</view>
</view>
2024-07-09 18:11:31 +08:00
</tn-popup>
2024-08-19 18:15:03 +08:00
2024-07-09 18:11:31 +08:00
</view>
</template>
<script>
import {
findMemberID,
addInvoiceHeader,
addInvoiceLog,
someMethod,
getInvoiceLogWithHeader
} from "@/util/api";
import store from "@/store";
export default {
data() {
return {
apiImgUrl: this.$store.state.imgUrl,
2024-08-19 18:15:03 +08:00
apiUpUrl: this.$store.state.apiUrl,
2024-07-09 18:11:31 +08:00
addMod: false,
infoMod: false,
2024-07-10 18:13:57 +08:00
tt_add_show_add: false,
2024-07-09 18:11:31 +08:00
addForm: {
name: '',
taxpayer_identification_number: '',
unit: '',
unit_address: '',
telephone: '',
bank_basic_account_number: '',
bank: '',
2024-08-19 18:15:03 +08:00
association_id: 1,
2024-07-30 18:16:46 +08:00
money: '',
2024-08-19 18:15:03 +08:00
voucher: '',
2024-07-09 18:11:31 +08:00
},
invoice_type_show: false,
actionSheetList: [{
text: '普票',
id: 1,
},
{
text: '专票',
id: 2
}
],
2024-07-10 18:13:57 +08:00
header_id: -1,
header_id_name: '',
2024-07-09 18:11:31 +08:00
invoice_type_name: '普票',
invoice_type: 1,
tt_add_show: false,
tt_show: false,
tt_list: [],
page: 1,
allList: [],
info: {},
count: 0
}
},
onLoad() {
var gid = uni.getStorageSync('Gid');
this.addForm.association_id = gid;
this.findMemberList();
this.getList();
},
onReachBottom() {
this.page += 1;
this.getList();
},
methods: {
2024-08-19 18:15:03 +08:00
openInfoMod(item) {
this.info = item;
this.infoMod = true;
},
2024-07-10 18:13:57 +08:00
radioGroupChange(d) {
const item = this.tt_list.find(item => item.id == d);
console.log(item);
this.header_id_name = item;
},
2024-07-09 18:11:31 +08:00
openImg() {
uni.previewImage({
current: 0,
urls: [this.apiImgUrl + this.info.invoice_image],
});
},
2024-08-20 17:22:43 +08:00
openImgT() {
uni.previewImage({
current: 0,
urls: [this.apiImgUrl + this.info.voucher],
});
},
2024-07-09 18:11:31 +08:00
openInfo(d) {
getInvoiceLogWithHeader({
id: d.id
})
.then(res => {
console.log(res);
this.info = res.data;
this.infoMod = true;
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
actionSheetCallback(index) {
this.invoice_type_name = this.actionSheetList[index].text;
this.invoice_type = this.actionSheetList[index].id;
},
tt_show_do() {
2024-07-10 18:13:57 +08:00
this.tt_add_show = true;
// if (this.tt_list.length == 0) {
// uni.showToast({
// title: '请先添加开票信息',
// icon: 'none',
// duration: 2000
// });
// this.tt_add_show = true;
// } else {
// this.tt_show = true;
// }
2024-07-09 18:11:31 +08:00
},
kp_add_do() {
if (this.money == '' || this.money <= 0) {
uni.showToast({
title: '请填写金额',
icon: 'none',
duration: 2000
});
return;
}
2024-08-19 18:15:03 +08:00
addInvoiceLog(this.addForm)
2024-07-09 18:11:31 +08:00
.then(res => {
console.log(res);
if (res.code == 1) {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
this.addMod = false;
2024-07-10 18:13:57 +08:00
this.allList = [];
this.page = 1;
this.getList();
2024-07-09 18:11:31 +08:00
} else {
uni.showModal({
title: '提示',
content: res.msg,
})
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
tt_confirm(d) {
console.log(d);
this.header_id_name = d[0].label;
this.header_id = d[0].value;
},
tt_add_do() {
addInvoiceHeader(this.addForm)
.then(res => {
console.log(res);
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
this.tt_add_show = false;
this.findMemberList();
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
findMemberList() {
findMemberID()
.then(res => {
console.log(res);
if (res.data == null) {
this.tt_list = [];
} else {
2024-07-10 18:13:57 +08:00
// var key = res.data;
// const transformedSelectList = key.map(item => ({
// value: item.id,
// label: item.unit
// }));
this.tt_list = res.data;
2024-07-09 18:11:31 +08:00
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
getList() {
someMethod({
page: this.page,
size: 10
})
.then(res => {
console.log(res);
this.allList.push(...res.data.data);
2024-07-10 18:13:57 +08:00
this.count = res.data.count;
2024-07-09 18:11:31 +08:00
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
2024-08-19 18:15:03 +08:00
upload_img() {
var user_info = uni.getStorageSync('userInfo');
var that = this;
uni.chooseMedia({
count: 1, //默认9
mediaType: ['image'],
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function(res) {
console.log(res);
var url = res.tempFiles[0].tempFilePath;
uni.uploadFile({
url: that.apiUpUrl + '/common/upload', //仅为示例,非真实的接口地址
filePath: url,
name: 'file',
formData: {
association_id: 1,
},
success: (uploadFileRes) => {
var data = JSON.parse(uploadFileRes.data);
console.log(data);
that.addForm.voucher = data.data.url;
}
});
}
});
},
2024-07-09 18:11:31 +08:00
goBack() {
if (getCurrentPages().length > 1) {
uni.navigateBack()
} else {
uni.redirectTo({
url: '/pages/index/index'
})
}
},
}
}
</script>
<style scoped>
.info_text view {
margin-bottom: 40rpx;
}
2024-07-30 18:16:46 +08:00
.view_text view {
margin-top: 20rpx;
}
2024-07-09 18:11:31 +08:00
</style>