You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong_qianduan/pages/invoice/detail.vue

296 lines
6.4 KiB

5 months ago
<template>
<view class="invoice">
<view class="invoice-hd" v-if="invoiceDetails">
<view class="a">
<view class="l">开票状态</view>
<view class="r">{{invoiceDetails.status==0?'开票中':'已开票'}}</view>
</view>
<view class="a">
<view class="l">预计开票时间</view>
<view class="r">{{invoiceDetails.created_at}}</view>
</view>
<view class="a">
<view class="l">订单编号</view>
<view class="r">{{invoiceDetails.order.order_no}} <text
@click="handleCopy(invoiceDetails.order.order_no)">复制</text></view>
</view>
</view>
<view class="invoice-info" v-if="invoiceDetails">
<view class="a">
发票明细<text @click="toDetail(invoiceDetails.invoice)">修改发票信息</text>
</view>
<view class="b">
<view class="item">
<view class="l">发票类型</view>
<view class="r">{{invoiceDetails.invoice.type==1?'普通增值税发票':'普通发票'}}</view>
</view>
<view class="item">
<view class="l">抬头类型</view>
<view class="r">{{invoiceDetails.invoice.source==1?'个人':'单位'}}</view>
</view>
<view class="item">
<view class="l">抬头名称</view>
<view class="r">{{invoiceDetails.invoice.header}}</view>
</view>
<view class="item">
<view class="l">申请时间</view>
<view class="r">{{invoiceDetails.invoice.duty_no}}</view>
</view>
</view>
</view>
<view class="invoice-fd">
<button open-type="contact">联系商家</button>
</view>
<addShuiyin />
</view>
</template>
<script>
import * as InvoiceApi from '@/api/invoice'
export default {
data() {
return {
invoiceDetails: ''
};
},
onLoad(op) {
this.invoiceId = op.id
},
onShow() {
this.getInvoicingDitails()
},
methods: {
// 复制指定内容
handleCopy(value) {
const app = this
uni.setClipboardData({
data: value,
success: () => app.$toast('复制成功'),
fail: ({
errMsg
}) => app.$toast('复制失败 ' + errMsg)
})
},
toDetail(item) {
uni.navigateTo({
url: "/pages/invoice/edit?detail=" + JSON.stringify(item) + '&source=' + 1
})
},
timestampToYds(timestamp) {
//时间戳为10位需*1000,为13位不需乘1000
let times = timestamp.length == 10 ? times * 1000 : timestamp;
var date = new Date(times);
let Y = date.getFullYear(),
M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1),
D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()),
h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()),
m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()),
s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
return Y + '-' + M + '-' + D + ' ' + h + ':' + m + ':' + s
},
getInvoicingDitails(canReset = false) {
let app = this;
InvoiceApi.invoicingDetail({
id: app.invoiceId
})
.then(result => {
result.data.data.created_at = app.timestampToYds(result.data.data.created_at)
app.invoiceDetails = result.data.data
})
// 相应全局事件订阅: 刷新上级页面数据
canReset && uni.$emit('syncRefresh', true, true)
},
}
}
</script>
<style lang="scss" scoped>
.invoice {
&-hd {
padding: 0 20rpx 0 40rpx;
overflow: hidden;
background-color: #fff;
.a {
padding: 20rpx 0;
display: block;
border-top: 1px solid #F3F3F3;
overflow: hidden;
display: flex;
align-items: center;
font-size: 32rpx;
font-weight: 400;
color: #262626;
&:first-child {
border-top-cplor: #fff;
}
.l {
width: 230rpx;
font-size: 32rpx;
font-weight: 400;
color: #656565;
}
}
}
&-goods {
padding: 0 20rpx 0 40rpx;
overflow: hidden;
background-color: #fff;
margin-top: 20rpx;
padding: 30rpx;
box-sizing: border-box;
display: flex;
align-items: center;
.a {
width: 145rpx;
height: 135rpx;
margin-right: 20rpx;
image {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
}
.b {
flex: 1;
overflow: hidden;
.l {
white-space: nowrap;
text-overflow: ellipsis;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #262626;
overflow: hidden;
}
.r {
font-size: 30rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #838383;
display: flex;
align-items: center;
justify-content: space-between;
text {
display: block;
width: 104rpx;
line-height: 60rpx;
background: #FFFFFF;
border-radius: 4rpx;
text-align: center;
border: 1px solid #CACACA;
font-size: 28rpx;
color: #555;
}
}
}
}
&-info {
margin-top: 20rpx;
background-color: #fff;
overflow: hidden;
.a {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 30rpx 20rpx 60rpx;
box-sizing: border-box;
border-bottom: 1px solid #F3F3F3;
font-size: 32rpx;
font-weight: 500;
color: #262626;
text {
color: #006AFF;
padding-right: 40rpx;
position: relative;
&::after {
content: "";
width: 16rpx;
height: 16rpx;
border-top: 1px solid #006AFF;
border-left: 1px solid #006AFF;
position: absolute;
right: 0;
top: 14rpx;
z-index: 1;
transform: rotate(135deg);
}
}
}
.b {
box-sizing: border-box;
overflow: hidden;
.item {
padding: 30rpx 60rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
border-top: 1px solid #F3F3F3;
font-size: 32rpx;
font-weight: 500;
color: #262626;
overflow: hidden;
&:first-child {
border-top-color: #fff;
}
.l {
width: 200rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #656565;
}
.r {
flex: 1;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #262626;
}
}
}
}
&-fd {
text-align: center;
overflow: hidden;
margin-top: 40rpx;
button {
background-color: transparent;
border: 0;
font-size: 32rpx;
font-weight: 400;
color: #006AFF;
&::after {
content: "";
border: 0;
}
}
}
}
</style>