YNUtdPlatform/pages/HealthExaminationApp/myAppointment/healthExamDetails.vue

124 lines
2.9 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>
<u-line dashed style="margin-bottom: 10px;"></u-line>
</div>
<div class="title" style="color: red">体检总价{{ totalPrice }} </div>
</div>
</view>
</template>
<script>
import config from '@/config'
export default {
data() {
return {
token: '',
cancelId: '',
// 套餐名称
combName: '',
// 体检项目
combItem: '项目1、项目2、项目3',
// 体检内容
combContent: [
{
mealName: '项目1',
mealContent:
'项目1内容项目1内容项目1内容项目1内容项目1内容项目1内容项目1内容项目1内容项目1内容项目1内容项目1内容项目1内容',
mealPrice: '100'
},
{
mealName: '项目2',
mealContent: '项目2内容',
mealPrice: '200'
},
{
mealName: '项目3',
mealContent: '项目3内容',
mealPrice: '300'
}
],
// 体检总价
totalPrice: 0
}
},
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() {
// this.getDetail()
},
methods: {
// 获取详情
getDetail() {
const params = {
token: this.token,
cancelId: this.cancelId
}
console.log('🚀 ~ getDetail ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getcontentByid',
method: 'post',
data: params,
header: {
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('、')
this.totalPrice = res.obj.reduce((total, item) => total + Number(item.mealPrice), 0)
}
}
})
}
}
}
</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>