123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <template>
- <layout-page>
- <view style="position: relative;">
- <Calendar
- class="uni-calendar--hook"
- :selected="selected"
- :lunar="true"
- :range="false"
- :showMonth="true"
- @change="handleChange"
- />
- <view class="journal" v-if="journalData && Object.keys(journalData).length > 0">
- <view class="title">手账</view>
- <uni-card @click.stop="handleAddJournal(journalData.id, journalData.description)">
- <view class="d-flex align-center">
- <view class="line"></view>
- <view class="date">{{ journalData.date }}</view>
- </view>
- <view class="description ss-m-t-15">{{ journalData.description }}</view>
- </uni-card>
- </view>
- <view class="add-btn" @click.stop="handleAddJournal">
- <uni-icons type="plusempty" size="30" color="#fff"></uni-icons>
- </view>
- <uni-popup ref="popupRef" type="dialog">
- <view class="popupContent">
- <view class="content-box">
- <view class="text-center ss-p-y-30">
- <view class="yangli">{{ calendarInfo.yangli }}</view>
- <view class="yinli">{{ calendarInfo.yinli }}</view>
- <view class="d-flex align-center justify-center">
- <span style="color: #7f7f7f;">幸运色</span>
- <view class="luckyColor ss-m-l-20" :style="{ 'background-color': `${currentColor || '#2979ff'}` }"></view>
- </view>
- </view>
- <view class="center-box ss-p-y-30 ss-p-x-30">
- <view class="d-flex">
- <view class="yi d-flex align-center justify-center">宜</view>
- <view class="font-size-15" style="flex: 1; color: #c6b393;">{{ calendarInfo.yi }}</view>
- </view>
- <view class="d-flex ss-m-t-30">
- <view class="ji d-flex align-center justify-center">忌</view>
- <view class="font-size-15" style="flex: 1; color: #7f7f7f;">{{ calendarInfo.ji }}</view>
- </view>
- </view>
- <view class="bottom-box">
- <view class="bottom-box-item d-flex flex-column align-center justify-center">
- <view class="padding">
- <view class="label">五行</view>
- <view class="value">{{ calendarInfo.wuxing }}</view>
- </view>
- <view style="border-top: 1px solid #c2a08c; height: 1px; width: 100%;"></view>
- <view class="padding">
- <view class="label">吉神</view>
- <view class="value">{{ calendarInfo.jishen }}</view>
- </view>
- </view>
- <view class="bottom-box-item d-flex align-center justify-center">
- <view class="padding">
- <view class="label">彭祖</view>
- <view class="value">{{ calendarInfo.baiji }}</view>
- </view>
- </view>
- <view class="bottom-box-item d-flex flex-column align-center justify-center">
- <view class="padding">
- <view class="label">冲煞</view>
- <view class="value">{{ calendarInfo.chongsha }}</view>
- </view>
- <view style="border-top: 1px solid #c2a08c; height: 1px; width: 100%;"></view>
- <view class="padding">
- <view class="label">凶神</view>
- <view class="value">{{ calendarInfo.xiongshen }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="text-center ss-m-t-50">
- <uni-icons type="close" size="40" color="#fff" @click="handleClose"></uni-icons>
- </view>
- </uni-popup>
- </view>
- </layout-page>
- </template>
- <script setup>
- import { onLoad } from '@dcloudio/uni-app'
- import { ref } from 'vue'
- import Calendar from '@/components/uni-calendar/components/uni-calendar/uni-calendar.vue'
- import { getDrawLots } from '@/api/drawLots.js'
- import layoutPage from '@/layout'
- import { showAuthModal, closeAuthModal } from '@/hooks/useModal'
- const journalData = ref({
- id: 1,
- date: '2025-08-27',
- description: '南京金陵酒店管理有限公司隶属于金陵饭店集团酒店业务板块,成立于2004年,已成为品牌化、连锁化、规模化发展的酒店管理专业机构。着力打造多层级品牌体系,构建涵盖高中端精品商务酒店、休闲度假酒店、主题文化酒店、智能公寓酒店等多样化产品线。公司秉承金陵饭店“细意浓情”服务理念,融合国际标准、传承中国文化、深耕本土特色,依托总部强大的支撑体系,为在管运营酒店赋能,为业主提供超值服务。“金陵”相继摘取中国质量奖——“全国质量工作先进单位标兵”,荣膺中国质量领域政府性荣誉——首届“中国质量奖”提名奖,十度蝉联世界品牌实验室评定的全球服务业奖项——“五星钻石奖”,位列中国饭店集团前30强,保持全国国有高星级酒店集团前三甲。国家旅游局在《饭店星评标准访查示范》中,将金陵饭店的管理模式和服务标准作为五星级酒店示范样板并拍摄成教学片,向全国酒店业推广。'
- })
- function getDate(date, AddDayCount = 0) {
- if (!date) {
- date = new Date()
- }
- if (typeof date !== 'object') {
- date = date.replace(/-/g, '/')
- }
- const dd = new Date(date)
- dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
- const y = dd.getFullYear()
- const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
- const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
- return {
- fullDate: y + '-' + m + '-' + d,
- year: y,
- month: m,
- date: d,
- day: dd.getDay()
- }
- }
- const selected = ref([])
- const setSelectedDates = () => {
- selected.value = [
- {
- date: getDate(new Date(),-20).fullDate,
- color: '#d3e3fd',
- url: 'https://menduner.citupro.com:3443/dev/2dbc20a5db2122e399b491638889ba9f8aea4e1c7a44463ee0df40b25f85b8cc.png'
- },
- {
- date: getDate(new Date(),-16).fullDate,
- color: '#f8bbd0',
- url: 'https://menduner.citupro.com:3443/dev/2dbc20a5db2122e399b491638889ba9f8aea4e1c7a44463ee0df40b25f85b8cc.png'
- },
- {
- date: getDate(new Date(),-12).fullDate,
- color: '#3bb19b',
- url: 'https://menduner.citupro.com:3443/dev/2dbc20a5db2122e399b491638889ba9f8aea4e1c7a44463ee0df40b25f85b8cc.png'
- },
- {
- date: getDate(new Date(),-7).fullDate,
- color: '#facd89',
- url: 'https://menduner.citupro.com:3443/dev/2dbc20a5db2122e399b491638889ba9f8aea4e1c7a44463ee0df40b25f85b8cc.png'
- },
- {
- date: getDate(new Date(),-3).fullDate,
- color: '#d7ccc8',
- url: 'https://menduner.citupro.com:3443/dev/2dbc20a5db2122e399b491638889ba9f8aea4e1c7a44463ee0df40b25f85b8cc.png'
- },
- {
- date: getDate(new Date(),-2).fullDate,
- color: '#c5cae9',
- url: 'https://menduner.citupro.com:3443/dev/2dbc20a5db2122e399b491638889ba9f8aea4e1c7a44463ee0df40b25f85b8cc.png'
- }
- ]
- }
- onLoad(() => {
- // showAuthModal()
- closeAuthModal()
- // 设置选中项
- setTimeout(() => {
- setSelectedDates()
- }, 2000)
- })
- const popupRef = ref()
- const currentColor = ref(null)
- const calendarInfo = ref({})
- const handleChange = async (e) => {
- if (e.isBackToday) return // 点击左上角“今日”按钮不弹窗
- try {
- const { result } = await getDrawLots({ date: e.fulldate })
- if (!result) return uni.showToast({ title: '黄历信息获取失败', icon: 'none' })
- console.log(result, '成功信息')
- calendarInfo.value = result || {}
- popupRef.value.open()
- currentColor.value = result?.color || e.extraInfo?.color
- } catch (error) {
- console.log(error, '错误信息')
- }
- }
- const handleClose = () => {
- popupRef.value.close()
- currentColor.value = null
- calendarInfo.value = {}
- }
- // 添加手账
- const handleAddJournal = (id, text) => {
- let url = `/pages/drawLots/journal`
- if (id) url += `?id=${id}&text=${text}`
- uni.navigateTo({
- url
- })
- }
- </script>
- <style lang="scss" scoped>
- $commonColor: #c2a08c;
- $size: 25px;
- :deep {
- .uni-card {
- border-radius: 10px !important;
- }
- }
- .journal {
- margin-top: 30rpx;
- padding-bottom: 100px;
- .title {
- // color: #2979ff;
- color: #999;
- margin: 0 30px;
- }
- .date {
- font-size: 17px;
- font-weight: bold;
- }
- .line {
- width: 5px;
- height: 15px;
- border-radius: 4px;
- background-color: #2979ff;
- margin-right: 10px;
- }
- .description {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 6;
- overflow: hidden;
- }
- }
- .add-btn {
- position: fixed;
- right: 20px;
- bottom: 50px;
- width: 60px;
- height: 60px;
- border-radius: 50%;
- background-color: #2979ff;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .popupContent {
- position: relative;
- background-color: #fff;
- width: 70vw;
- padding: 30rpx;
- .content-box {
- height: 100%;
- border: 1px solid $commonColor;
- border-radius: 6px;
- }
- .yangli {
- font-weight: bold;
- color: $commonColor;
- font-size: 30px;
- }
- .yinli {
- color: #7f7f7f;
- margin: 10px 0;
- }
- .center-box {
- border-top: 1px solid $commonColor;
- border-bottom: 1px solid $commonColor;
- .yi {
- width: $size;
- height: $size;
- background-color: #c39c87;
- border-radius: 50%;
- color: #fff;
- margin-right: 10px;
- font-size: 14px;
- }
- .ji {
- width: $size;
- height: $size;
- background-color: #bfbfbf;
- border-radius: 50%;
- color: #fff;
- margin-right: 10px;
- font-size: 14px;
- }
- }
- .bottom-box {
- display: flex;
- &-item {
- width: 33.3%;
- text-align: center;
- border-right: 1px solid $commonColor;
- &:nth-child(3n) {
- border-right: none;
- }
- .label {
- font-size: 17px;
- }
- .value {
- color: #7f7f7f;
- font-size: 14px;
- margin-top: 10px;
- }
- .padding {
- padding: 10px;
- }
- }
- }
- .luckyColor {
- width: 50rpx;
- height: 50rpx;
- border-radius: 50%;
- }
- }
- </style>
|