Files
dianxiaorui-uniapp/pageMake/invoice/makeInvoice.vue
PC-202306242200\Administrator 4d06351f6a no message
2026-03-28 23:00:29 +08:00

297 lines
9.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="invoice">
<view class="invoice_tip">
<view style="display: flex; align-items: center">
<up-icon name="error-circle-fill" color="#3c9cff"></up-icon>
发票须知
</view>
<view>1.开票金额为用户实际支付金额(不含返利返佣)</view>
<view>2.未寄出的纸质发票会在开票确认后的20个工作日内寄出</view>
<view>3.单笔订单只支持开具一种发票类型</view>
<view>4.云快充仅为平台方实际开票主体以申请开票时展示的开票运营商公司为准</view>
<view>5.发票由各家电站运营商提供一起申请可能会生成多张发票</view>
<view>6.若超过20个工作日仍未收到发票您可以通过(区号)+12366向开票公司所在区域的主管税务机关进行反馈处理</view>
</view>
<view style="height: 30rpx"></view>
<view style="padding: 30rpx; font-size: 28rpx; background-color: #fff">
<view class="flex-acsb" style="height: 80rpx">
<view>
发票主体
<text style="color: #f56c6c">*</text>
</view>
<view class="flex-acsb" @click="show2 = true">
<text :style="{ color: !dataFrom.subjectType ? '#808080' : '' }">
{{ !dataFrom.subjectType ? '请选择' : columns2[0].find((val) => val.id == dataFrom.subjectType).label }}
</text>
<up-icon name="arrow-down"></up-icon>
</view>
</view>
<view class="flex-acsb" style="height: 80rpx">
<view>
发票类型
<text style="color: #f56c6c">*</text>
</view>
<view class="flex-acsb" @click="show1True">
<text :style="{ color: !dataFrom.invoiceType ? '#808080' : '' }">
{{ !dataFrom.invoiceType ? '请选择' : columns1[0].find((val) => val.id == dataFrom.invoiceType).label }}
</text>
<up-icon name="arrow-down"></up-icon>
</view>
</view>
<view class="flex-acsb" style="height: 80rpx">
<view>
发票抬头
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.invoiceTitle" placeholder="请输入发票抬头" style="text-align: right" type="text" />
</view>
</view>
<view class="flex-acsb" style="height: 80rpx" v-if="dataFrom.subjectType == 1">
<view>
发票税号
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.taxNumber" placeholder="请输入发票税号" style="text-align: right" type="text" />
</view>
</view>
<view class="flex-acsb" style="height: 80rpx" v-if="dataFrom.invoiceType == 2">
<view>
公司地址
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.registrationAddress" placeholder="请输入公司地址" style="text-align: right" type="text" />
</view>
</view>
<view class="flex-acsb" style="height: 80rpx" v-if="dataFrom.invoiceType == 2">
<view>
公司电话
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.registrationPhone" placeholder="请输入公司电话" style="text-align: right" type="text" />
</view>
</view>
<view class="flex-acsb" style="height: 80rpx" v-if="dataFrom.invoiceType == 2">
<view>
开户行名称
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.bankName" placeholder="请输入开户行名称" style="text-align: right" type="text" />
</view>
</view>
<view class="flex-acsb" style="height: 80rpx" v-if="dataFrom.invoiceType == 2">
<view>
开户行账号
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.bankAccount" placeholder="请输入开户行账号" style="text-align: right" type="text" />
</view>
</view>
</view>
<view style="height: 30rpx"></view>
<view style="padding: 30rpx; font-size: 28rpx; background-color: #fff">
<view class="flex-acsb" style="height: 80rpx">
<view>
收票人姓名
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.name" placeholder="请输入收票人姓名" style="text-align: right" type="text" />
</view>
</view>
<view class="flex-acsb" style="height: 80rpx">
<view>
收票人手机
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.phone" type="number" placeholder="请输入收票人手机" style="text-align: right" />
</view>
</view>
<view class="flex-acsb" style="height: 80rpx">
<view>
收票人地址
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.address" placeholder="请输入收票人地址" style="text-align: right" type="text" />
</view>
</view>
<view class="flex-acsb" style="height: 80rpx">
<view>
收票人邮箱
<text style="color: #f56c6c">*</text>
</view>
<view>
<input v-model="dataFrom.email" placeholder="请输入收票人邮箱" style="text-align: right" type="text" />
</view>
</view>
</view>
<view style="height: 30rpx"></view>
<view class="p30">
<view style="font-weight: bold; font-size: 30rpx">发票备注改内容会打印在发票上</view>
<up-textarea v-model="dataFrom.invoiceRemark" placeholder="请输入内容"></up-textarea>
</view>
<view style="height: 150rpx"></view>
<view
style="
position: fixed;
bottom: 0;
left: 0;
width: 750rpx;
padding: 20rpx 50rpx;
background-color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
"
>
<view style="display: flex; align-items: center; font-size: 28rpx">
<text>合计</text>
<text style="font-size: 36rpx; font-weight: bold; margin: 0 15rpx">14.05</text>
<text></text>
</view>
<view style="width: 230rpx">
<up-button @click="applyCon" :customStyle="{ height: '80rpx', width: '230rpx' }" color="#4879e6" text="确认开票" shape="circle"></up-button>
</view>
</view>
<up-picker @confirm="aaa1" keyName="label" :show="show1" @cancel="show1 = false" :columns="columns1"></up-picker>
<up-picker @confirm="aaa2" keyName="label" :show="show2" @cancel="show2 = false" :columns="columns2"></up-picker>
</view>
</template>
<script setup>
import { ref, reactive } from 'vue';
import { apply } from '@/api/api.js';
import { onLoad } from '@dcloudio/uni-app';
let checkboxValue1 = ref([]);
let dataFrom = ref({
invoiceType: null,
subjectType: null,
ordersIds: []
});
let show1 = ref(false);
let show2 = ref(false);
onLoad(async (options) => {
console.log(options);
console.log(JSON.parse(decodeURIComponent(options.list)));
dataFrom.value.ordersIds = JSON.parse(decodeURIComponent(options.list));
});
const applyCon = async () => {
if (!dataFrom.value.subjectType) return uni.showToast({ title: '请选择发票主体', icon: 'none' });
if (!dataFrom.value.invoiceType) return uni.showToast({ title: '请选择发票类型', icon: 'none' });
if (!dataFrom.value.invoiceType == 1 && !dataFrom.value.taxNumber) return uni.showToast({ title: '请输入发票税号', icon: 'none' });
if (!dataFrom.value.subjectType == 1 && !dataFrom.value.registrationPhone) return uni.showToast({ title: '请输入发票税号', icon: 'none' });
if (!dataFrom.value.subjectType == 1 && !dataFrom.value.invoiceType == 2 && !dataFrom.value.taxNumber) return uni.showToast({ title: '请输入发票税号', icon: 'none' });
if (!dataFrom.value.subjectType == 1 && !dataFrom.value.invoiceType == 2 && !dataFrom.value.registrationAddress)
return uni.showToast({ title: '请输入公司地址', icon: 'none' });
if (!dataFrom.value.subjectType == 1 && !dataFrom.value.invoiceType == 2 && !dataFrom.value.registrationPhone) return uni.showToast({ title: '请输入公司电话', icon: 'none' });
if (!dataFrom.value.subjectType == 1 && !dataFrom.value.invoiceType == 2 && !dataFrom.value.bankName) return uni.showToast({ title: '请输入开户行名称', icon: 'none' });
if (!dataFrom.value.subjectType == 1 && !dataFrom.value.invoiceType == 2 && !dataFrom.value.bankAccount) return uni.showToast({ title: '请输入开户行账户', icon: 'none' });
if (!dataFrom.value.name) return uni.showToast({ title: '请输入收票人姓名', icon: 'none' });
if (!dataFrom.value.address) return uni.showToast({ title: '请输入收票人地址', icon: 'none' });
if (!dataFrom.value.phone) return uni.showToast({ title: '请输入收票人电话', icon: 'none' });
if (!dataFrom.value.email) return uni.showToast({ title: '请输入收票人邮箱', icon: 'none' });
let _res = await apply(dataFrom.value);
uni.navigateBack({
delta: 3
});
};
const aaa1 = (ee) => {
dataFrom.value.invoiceType = ee.value[0].id;
show1.value = false;
console.log(dataFrom.value.invoiceType);
};
const aaa2 = (ee) => {
dataFrom.value.subjectType = ee.value[0].id;
show2.value = false;
if (ee.value[0].id == 2) {
dataFrom.value.invoiceType = 1;
}
};
const show1True = () => {
if (dataFrom.value.subjectType == 2) {
return;
}
show1.value = true;
};
const columns1 = reactive([
[
{
label: '增值税普通发票',
id: 1
},
{
label: '增值税专用发票',
id: 2
}
]
]);
const columns2 = reactive([
[
{
label: '企业',
id: 1
},
{
label: '个人',
id: 2
}
]
]);
const checkboxChange = (e) => {
console.log(e);
};
</script>
<style>
page {
background-color: #f5f5f5;
}
</style>
<style scoped lang="scss">
.invoice {
&_tip {
padding: 20rpx;
font-size: 24rpx;
color: #3c9cff;
background-color: rgba(60, 156, 255, 0.2);
view {
line-height: 40rpx;
}
}
&_list {
padding: 15rpx 30rpx;
background-color: #fff;
&_view {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
margin-bottom: 25rpx;
&_left {
color: #646368;
}
&_right {
color: #262626;
}
}
}
}
</style>