<template> <div class="index"> <div class="appointment"> <div class="type"><span class="point"></span> 待预约的服务</div> <div v-if="packageList.length == 0" class="point_none">暂无可预约体检</div> <div class="item-container" v-else> <Item v-for="(item, index) in packageList" :item="item" :key="index" listType='1' :id="id"/> </div> </div> <div class="appointmented"> <div class="type"><span class="point"></span>已预约的服务</div> <div v-if="appointmentList.length == 0" class="point_none">暂无已预约体检</div> <div class="item-container" v-else> <Item v-for="(item, index) in appointmentList" :item="item" :key="index" listType='2' :id="id"/> </div> </div> <!-- 新卡-初始对话框 --> <a-modal v-model="visible" title="个人基本信息填写" @ok="handleHideModal" :footer="null" > <Form @hideModal="handleHideModal" /> </a-modal> </div> </template> <script> import Item from './components/item.vue' import Form from './components/form.vue' import api from '@/api/customer' export default { components: { Item, Form }, data() { return { id: '',//客户id visible: false, //是否显示"个人基本信息填写"弹窗 items: [ { name: '体检套餐名称-某某单位-某某套餐', detailUrl: 'http://baidu.com', type: 1, date: '2021-11-18', }, { name: '体检套餐名称-某某单位-某某套餐', detailUrl: 'http://baidu.com', type: 1, date: '2021-11-18', }, { name: '体检套餐名称-某某单位-某某套餐', detailUrl: 'http://baidu.com', type: 1, date: '2021-11-18', }, { name: '体检套餐名称-某某单位-某某套餐', detailUrl: 'http://baidu.com', type: 1, date: '2021-11-18', }, ], itemb: [ { name: '体检套餐名称-某某单位-某某套餐', detailUrl: 'http://baidu.com', type: 2, date: '2021-11-18', }, { name: '体检套餐名称-某某单位-某某套餐', detailUrl: 'http://baidu.com', type: 2, date: '2021-11-18', }, { name: '体检套餐名称-某某单位-某某套餐', detailUrl: 'http://baidu.com', type: 2, date: '2021-11-18', }, { name: '体检套餐名称-某某单位-某某套餐', detailUrl: 'http://baidu.com', type: 2, date: '2021-11-18', }, ], packageList:[],//待预约列表 appointmentList:[]//已预约列表 } }, created() { const { id } = this.$route.query this.id = id this.getCustomerDetail()//客户信息 this.getPackageList() //待预约列表 this.getAppointmentList() //已预约列表 }, methods: { showModal() { this.visible = true }, handleHideModal(e) { console.log(e) this.visible = false }, // 获取客户详情 getCustomerDetail() { api.getCustomerDetail({ id: parseInt(this.id) }).then((res) => { if (res.returnCode == '0000') { // 根据information是否显示'个人基本信息填写'弹窗(01:完善 02:不完善) res.content.information == '02' ? (this.visible = true) : (this.visible = false) } else { this.$message.error(res.returnMsg) } }) }, // 获取待预约列表 getPackageList() { api.getPackageList({ id: parseInt(this.id) }).then((res) => { if (res.returnCode == '0000') { console.log('获取待预约==', res.content) this.packageList = res.content } // else { // this.$message.error(res.returnMsg) // } }) }, // 获取已预约列表 getAppointmentList() { api.getAppointmentList({ id: parseInt(this.id) }).then((res) => { if (res.returnCode == '0000') { console.log('获取已预约列表==', res.content) this.appointmentList = res.content } // else { // this.$message.error(res.returnMsg) // } }) }, }, } </script> <style lang="less" scoped> .index { padding-bottom: 48px; padding-top: 20px; background-color: #fafafa; ::v-deep .ant-modal { background-color: saddlebrown; } ::v-deep .ant-modal-footer { display: none; } .appointment, .appointmented { padding: 19.5px 14.5px 33.5px 14.5px; background-color: white; width: 900px; margin: 0 auto; .point { display: inline-block; border-radius: 5px; width: 6px; height: 6px; background-color: #3f7ffb; margin-right: 6px; position: relative; top: -1px; } border-radius: 8px; .type { font-size: 14px; font-weight: bold; } .item-container { margin-top: 8.5px; } } .appointmented { margin-top: 20px; .point { background-color: #ffcc00; } } } .point_none{ padding: 26px; } </style>