Browse Source

修改优惠券显示长度

付晓文。 4 tuần trước cách đây
mục cha
commit
e535eabf49
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      pages/topUp/recordDetail.vue

+ 5 - 1
pages/topUp/recordDetail.vue

@@ -110,7 +110,7 @@
 							<image class="coupon-bg" src="/static/topUp/coupon.png" mode="scaleToFill"></image>
 							<view class="coupon-body">
 								<view class="coupon-top">
-									<text class="c-name">{{ c.name }}</text>
+									<text class="c-name">{{ formatCouponName(c.name) }}</text>
 									<text class="c-value">{{ c.display }}</text>
 								</view>
 								<view class="coupon-bottom">
@@ -170,6 +170,10 @@
 				const n = Number(val) || 0;
 				return Number.isInteger(n) ? String(n) : n.toFixed(2);
 			},
+			formatCouponName(name) {
+				const s = String(name || '');
+				return s.length > 6 ? `${s.slice(0, 6)}...` : s;
+			},
 			loadDetail() {
 				if (!this.recordId) {
 					uni.showToast({ title: '缺少明细ID', icon: 'none' });