|
|
@@ -4,7 +4,7 @@
|
|
|
海报图直接展示在本页(不弹框),可长按转发或保存;其它 fundType 仅展示简单成功信息。
|
|
|
-->
|
|
|
<template>
|
|
|
- <appResult title="冲销成功">
|
|
|
+ <appResult :title="pageTitle">
|
|
|
<!-- 返余额:金额/单号/余额已在海报图内展示,页面上不再重复 -->
|
|
|
<view class="forward-info" v-if="Number(fundType) !== 2">
|
|
|
<text class="forward-info__amount">冲销成功 ¥{{ formatMoney(actPrice) }}</text>
|
|
|
@@ -39,12 +39,7 @@
|
|
|
class="admin-button-com big blue btn-item"
|
|
|
@click="generatePoster"
|
|
|
>重新生成凭证</button>
|
|
|
- <button
|
|
|
- v-if="orderId"
|
|
|
- class="admin-button-com big blue btn-item"
|
|
|
- @click="goOrder"
|
|
|
- >查看原单</button>
|
|
|
- <button class="admin-button-com big btn-item" @click="goHome">返回首页</button>
|
|
|
+ <button class="admin-button-com big btn-item" @click="goBack">{{ isRepost ? '返回' : '返回首页' }}</button>
|
|
|
</view>
|
|
|
|
|
|
<canvas
|
|
|
@@ -82,7 +77,9 @@ export default {
|
|
|
posterUrl: '',
|
|
|
drawing: false,
|
|
|
canvasW: 360,
|
|
|
- canvasH: 640
|
|
|
+ canvasH: 640,
|
|
|
+ // repost:从冲销列表/详情补发凭证,非首次冲销成功
|
|
|
+ mode: ''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -92,9 +89,16 @@ export default {
|
|
|
},
|
|
|
hasBalance() {
|
|
|
return this.customBalance !== null && this.customBalance !== '' && !isNaN(Number(this.customBalance))
|
|
|
+ },
|
|
|
+ isRepost() {
|
|
|
+ return this.mode === 'repost'
|
|
|
+ },
|
|
|
+ pageTitle() {
|
|
|
+ return this.isRepost ? '退款凭证' : '冲销成功'
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
+ this.mode = option.mode || ''
|
|
|
this.fundType = Number(option.fundType || 0)
|
|
|
this.actPrice = parseFloat(option.amount || option.actPrice || 0)
|
|
|
this.customId = Number(option.customId || 0)
|
|
|
@@ -127,6 +131,7 @@ export default {
|
|
|
}
|
|
|
return n.toFixed(2)
|
|
|
},
|
|
|
+ init(){},
|
|
|
/**
|
|
|
* 读取冲销成功跳转前写入的缓存,补全余额/单号等关键字段
|
|
|
*/
|
|
|
@@ -200,6 +205,10 @@ export default {
|
|
|
Promise.all([codeReq, detailReq]).then(([res, detRes]) => {
|
|
|
if (detRes && detRes.code == 1 && detRes.data) {
|
|
|
that.applyBalanceFromApi(detRes.data.balance)
|
|
|
+ // 补发场景列表可能没带客户名,用详情接口补全海报抬头
|
|
|
+ if (!that.customName && detRes.data.name) {
|
|
|
+ that.customName = detRes.data.name
|
|
|
+ }
|
|
|
}
|
|
|
if (res.code == 1 && res.data && res.data.imgUrl) {
|
|
|
that.applyBalanceFromApi(res.data.balance)
|
|
|
@@ -234,7 +243,8 @@ export default {
|
|
|
* 按可用宽度缩小单号字号,保证与「冲销单号」标签同一行且不重叠
|
|
|
*/
|
|
|
fitSnFontSize(ctx, sn, maxWidth) {
|
|
|
- let size = 16
|
|
|
+ // 与明细行字号对齐,起始略小于标签,便于长单号一行放下
|
|
|
+ let size = 14
|
|
|
while (size > 10) {
|
|
|
ctx.setFontSize(size)
|
|
|
const measured = ctx.measureText ? ctx.measureText(sn) : null
|
|
|
@@ -298,9 +308,12 @@ export default {
|
|
|
ctx.lineTo(width - padX, 258)
|
|
|
ctx.stroke()
|
|
|
|
|
|
+ // 明细三行字号整体小 4(相对原 24/20),避免信息区过抢眼
|
|
|
+ const rowLabelSize = 20
|
|
|
+ const rowValueSize = 16
|
|
|
// 最新余额(有值才画金额,无值画 --)
|
|
|
const balanceText = this.hasBalance ? ('¥' + this.formatMoney(this.customBalance)) : '--'
|
|
|
- ctx.setFontSize(24)
|
|
|
+ ctx.setFontSize(rowLabelSize)
|
|
|
ctx.setFillStyle('#333333')
|
|
|
ctx.setTextAlign('left')
|
|
|
ctx.fillText('最新余额', padX, 298)
|
|
|
@@ -311,12 +324,11 @@ export default {
|
|
|
// 冲销单号同一行:左侧标签,右侧按宽度缩小字号,保证不换行、不重叠
|
|
|
const snLabel = '冲销单号'
|
|
|
const snText = this.forwardSn || '--'
|
|
|
- const snLabelSize = 24
|
|
|
- ctx.setFontSize(snLabelSize)
|
|
|
+ ctx.setFontSize(rowLabelSize)
|
|
|
ctx.setFillStyle('#333333')
|
|
|
ctx.setTextAlign('left')
|
|
|
ctx.fillText(snLabel, padX, 333)
|
|
|
- const snLabelW = (ctx.measureText ? ctx.measureText(snLabel).width : snLabelSize * 4) || snLabelSize * 4
|
|
|
+ const snLabelW = (ctx.measureText ? ctx.measureText(snLabel).width : rowLabelSize * 4) || rowLabelSize * 4
|
|
|
const snMaxW = width - padX * 2 - snLabelW - 16
|
|
|
const snSize = this.fitSnFontSize(ctx, snText, snMaxW)
|
|
|
ctx.setTextAlign('right')
|
|
|
@@ -324,12 +336,12 @@ export default {
|
|
|
ctx.setFillStyle('#666666')
|
|
|
ctx.fillText(snText, width - padX, 333)
|
|
|
|
|
|
- ctx.setFontSize(24)
|
|
|
+ ctx.setFontSize(rowLabelSize)
|
|
|
ctx.setFillStyle('#333333')
|
|
|
ctx.setTextAlign('left')
|
|
|
ctx.fillText('日期', padX, 368)
|
|
|
ctx.setTextAlign('right')
|
|
|
- ctx.setFontSize(20)
|
|
|
+ ctx.setFontSize(rowValueSize)
|
|
|
ctx.setFillStyle('#666666')
|
|
|
ctx.fillText(dayjs().format('YYYY-MM-DD HH:mm'), width - padX, 368)
|
|
|
|
|
|
@@ -393,7 +405,14 @@ export default {
|
|
|
}
|
|
|
this.$util.pageTo({ url: '/pagesOrder/detail', type: 2, query: { id: this.orderId } })
|
|
|
},
|
|
|
- goHome() {
|
|
|
+ /**
|
|
|
+ * 首次成功回首页;列表/详情补发则返回上一页
|
|
|
+ */
|
|
|
+ goBack() {
|
|
|
+ if (this.isRepost) {
|
|
|
+ uni.navigateBack({ delta: 1 })
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$util.pageTo({ url: '/admin/home/workbench', type: 2 })
|
|
|
}
|
|
|
}
|