订单详情页面总技保持两位小数

This commit is contained in:
2024-10-11 17:52:46 +08:00
parent 0cfc3aebc7
commit f439dca343
2 changed files with 41 additions and 7 deletions

View File

@@ -106,7 +106,7 @@
<view></view> <view></view>
<view> <view>
<text>总计</text> <text>总计</text>
<text class="font-bold u-font-32">{{allPrice*1+seatFeePrice*1}}</text> <text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1) }}</text>
</view> </view>
</view> </view>
<view class="u-m-t-30"> <view class="u-m-t-30">
@@ -123,6 +123,13 @@
import color from '@/commons/color.js' import color from '@/commons/color.js'
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder']) const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function to2(n){
if(!n){
return 0
}
return n.toFixed(2)
}
function tuicai(item, index) { function tuicai(item, index) {
emits('tuicai', item, index) emits('tuicai', item, index)
} }

View File

@@ -125,11 +125,13 @@
let option = {isNowPay:false} let option = {isNowPay:false}
let payFinish=ref(false) let payFinish=ref(false)
onBackPress(() => { onBackPress(() => {
if (option.isNowPay&&!payFinish.value) { console.log('onBackPress');
infoBox.showToast('先付费模式,请先结算订单') uni.$emit('update:createOrderIndex')
return true // if (option.isNowPay&&!payFinish.value) {
} // infoBox.showToast('先付费模式,请先结算订单')
return false // return true
// }
// return false
}) })
let payStatus = ref(null) //loading success let payStatus = ref(null) //loading success
@@ -159,6 +161,31 @@
} }
}) })
function chooseUser() {
go.to('PAGES_CHOOSE_USER')
}
//更新选择用户
function setUser(par) {
console.log(option);
const submitPar = {
masterId: option.masterId,
tableId: table.value.tableId,
vipUserId: user.value.id ? user.value.id : '',
type: user.value.id ? 0 : 1 //0 设置 1 取消
}
Object.assign(submitPar, par)
return Api.$setUser(submitPar)
}
function watchChooseuser() {
uni.$off('choose-user')
uni.$on('choose-user', (data) => {
console.log(data);
user.value = data
setUser()
})
}
watch(() => pays.selIndex, (newval) => { watch(() => pays.selIndex, (newval) => {
clearInterval(timer) clearInterval(timer)
if (newval) { if (newval) {