万元计算

This commit is contained in:
BAKEYi 2026-06-03 17:54:37 +08:00
parent 1e56c78f12
commit d6d5f533cf
1 changed files with 26 additions and 2 deletions

View File

@ -146,8 +146,11 @@
</view>
<view class="grid-item">
<text class="label">成交金额</text>
<view class="val-box"><text class="val">{{ orderDetail.amount }}</text> <text class="unit"></text></view>
<text class="yesterday">昨日{{ orderDetail.yAmount }}</text>
<view class="val-box">
<text class="val">{{ formattedAmount.val }}</text>
<text class="unit">{{ formattedAmount.unit }}</text>
</view>
<text class="yesterday">昨日{{ formattedYAmount.val }}{{ formattedYAmount.unit }}</text>
</view>
</view>
</view>
@ -249,6 +252,14 @@ export default {
};
},
computed: {
//
formattedAmount() {
return this.formatMoney(this.orderDetail.amount);
},
//
formattedYAmount() {
return this.formatMoney(this.orderDetail.yAmount);
},
// id_type: -1
isUnderReview() {
if (!this.isLogin) return false;
@ -364,6 +375,19 @@ export default {
}
},
methods: {
//
formatMoney(amount) {
let num = parseFloat(amount);
if (isNaN(num)) return { val: '0', unit: '元' };
if (num >= 10000) {
// 10000parseFloat0
let val = parseFloat((num / 10000).toFixed(2));
return { val: val, unit: '万元' };
}
//
return { val: num, unit: '元' };
},
//
handleLoginRedirect() {
// isLogin false