YNUtdPlatform/pages/HealthExaminationApp/myAppointment/healthExamDetails.vue

106 lines
2.5 KiB
Vue
Raw Normal View History

2024-09-04 18:29:27 +08:00
<template>
<view>
<div class="content">
<h2 style="text-align: center">体检单据</h2>
<div class="title">套餐名称:</div>
<div>{{ combName }}</div>
<div class="title">体检项目:</div>
<div>{{ combItem }}</div>
<div class="title">体检内容:</div>
<div v-for="(item, index) in combContent" :key="index">
<div class="item-content">
<div style="width: 240px">{{ item.mealName }}{{ item.mealContent }}</div>
<div style="color: red; margin-left: 15px">{{ item.mealPrice }} </div>
</div>
2024-09-05 15:05:17 +08:00
<u-line dashed style="margin-bottom: 10px"></u-line>
2024-09-04 18:29:27 +08:00
</div>
<div class="title" style="color: red">体检总价{{ totalPrice }} </div>
</div>
</view>
</template>
<script>
import config from '@/config'
export default {
data() {
return {
token: '',
cancelId: '',
// 套餐名称
combName: '',
// 体检项目
2024-09-05 15:05:17 +08:00
combItem: '',
2024-09-04 18:29:27 +08:00
// 体检内容
2024-09-05 15:05:17 +08:00
combContent: [],
// 体检总价
totalPrice: 0
2024-09-04 18:29:27 +08:00
}
},
onLoad(opt) {
opt = JSON.parse(opt.params)
this.combName = opt.combName
this.cancelId = opt.id
console.log('🚀 ~ onLoad ~ onLoad', opt)
this.token = uni.getStorageSync('tjToken')
},
mounted() {
2024-09-05 15:05:17 +08:00
this.getDetail()
2024-09-04 18:29:27 +08:00
},
methods: {
// 获取详情
getDetail() {
const params = {
2024-09-05 15:05:17 +08:00
cancelId: String(this.cancelId),
token: this.token
2024-09-04 18:29:27 +08:00
}
console.log('🚀 ~ getDetail ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getcontentByid',
method: 'post',
data: params,
header: {
2024-09-05 15:05:17 +08:00
'Content-Type': 'application/x-www-form-urlencoded',
2024-09-04 18:29:27 +08:00
token: this.token
},
success: res => {
res = res.data
console.log('🚀 ~ getDetail ~ res:', res)
if (res.res == 1) {
this.combContent = res.obj
this.combItem = res.obj.map(item => item.mealName).join('、')
2024-09-05 15:05:17 +08:00
this.totalPrice = res.obj.reduce((total, item) => total + Number(item.mealPrice), 0)
2024-09-04 18:29:27 +08:00
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
.content {
margin: 10px;
padding: 10px;
background: #fff;
border-radius: 5px;
.title {
font-size: 16px;
font-weight: bold;
color: #333;
line-height: 2.5;
}
.item-content {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
word-break: break-all;
}
}
</style>