hookehuyr

新增农历日历显示

...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
13 }, 13 },
14 "dependencies": { 14 "dependencies": {
15 "@code-ts/cin": "^0.0.2", 15 "@code-ts/cin": "^0.0.2",
16 + "@tenado/lunarjs": "^1.0.9",
16 "@vant/area-data": "^1.3.1", 17 "@vant/area-data": "^1.3.1",
17 "@vant/touch-emulator": "^1.4.0", 18 "@vant/touch-emulator": "^1.4.0",
18 "@vant/use": "^1.6.0", 19 "@vant/use": "^1.6.0",
...@@ -28,6 +29,7 @@ ...@@ -28,6 +29,7 @@
28 "js-cookie": "^3.0.1", 29 "js-cookie": "^3.0.1",
29 "js-sha1": "^0.6.0", 30 "js-sha1": "^0.6.0",
30 "lodash": "^4.17.21", 31 "lodash": "^4.17.21",
32 + "lunar-lite": "^0.1.1",
31 "moment": "^2.29.3", 33 "moment": "^2.29.3",
32 "mui-player": "^1.7.0", 34 "mui-player": "^1.7.0",
33 "sha1": "^1.1.1", 35 "sha1": "^1.1.1",
...@@ -40,7 +42,8 @@ ...@@ -40,7 +42,8 @@
40 "vue": "^3.2.36", 42 "vue": "^3.2.36",
41 "weixin-js-sdk": "^1.6.0", 43 "weixin-js-sdk": "^1.6.0",
42 "xctc-check": "^0.0.2", 44 "xctc-check": "^0.0.2",
43 - "xijs": "^1.2.6" 45 + "xijs": "^1.2.6",
46 + "xst-solar2lunar": "^2.1.0"
44 }, 47 },
45 "devDependencies": { 48 "devDependencies": {
46 "@types/jquery": "^3.5.14", 49 "@types/jquery": "^3.5.14",
......
1 <!-- 1 <!--
2 * @Date: 2024-01-15 13:35:51 2 * @Date: 2024-01-15 13:35:51
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-24 13:05:17 4 + * @LastEditTime: 2024-01-24 18:45:17
5 * @FilePath: /xysBooking/src/views/booking.vue 5 * @FilePath: /xysBooking/src/views/booking.vue
6 * @Description: 预约页面 6 * @Description: 预约页面
7 --> 7 -->
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
25 ]" 25 ]"
26 > 26 >
27 <div v-if="findDatesInfo(date).date"> 27 <div v-if="findDatesInfo(date).date">
28 + <p class="day-lunar">{{ findDatesInfo(date).lunar_date.IDayCn }}</p>
28 <p class="day-text">{{ findDatesInfo(date).text }}</p> 29 <p class="day-text">{{ findDatesInfo(date).text }}</p>
29 <p v-if="findDatesInfo(date).reserve_full === ReserveStatus.AVAILABLE" class="day-price">¥{{ findDatesInfo(date).price }}</p> 30 <p v-if="findDatesInfo(date).reserve_full === ReserveStatus.AVAILABLE" class="day-price">¥{{ findDatesInfo(date).price }}</p>
30 <p v-else-if="findDatesInfo(date).reserve_full === ReserveStatus.INFINITY || findDatesInfo(date).reserve_full === ReserveStatus.OVERDUE" class="day-price"></p> 31 <p v-else-if="findDatesInfo(date).reserve_full === ReserveStatus.INFINITY || findDatesInfo(date).reserve_full === ReserveStatus.OVERDUE" class="day-price"></p>
...@@ -105,7 +106,7 @@ import { useGo } from '@/hooks/useGo' ...@@ -105,7 +106,7 @@ import { useGo } from '@/hooks/useGo'
105 import icon_select1 from '@/assets/images/单选01@2x.png' 106 import icon_select1 from '@/assets/images/单选01@2x.png'
106 import icon_select2 from '@/assets/images/单选02@2x.png' 107 import icon_select2 from '@/assets/images/单选02@2x.png'
107 import { canReserveDateListAPI, canReserveTimeListAPI } from '@/api/index' 108 import { canReserveDateListAPI, canReserveTimeListAPI } from '@/api/index'
108 - 109 +import calendar from 'xst-solar2lunar'
109 110
110 const $route = useRoute(); 111 const $route = useRoute();
111 const $router = useRouter(); 112 const $router = useRouter();
...@@ -140,11 +141,13 @@ onMounted(async () => { ...@@ -140,11 +141,13 @@ onMounted(async () => {
140 const findDatesInfo = (date) => { 141 const findDatesInfo = (date) => {
141 const result = dates_list.value.find((item) => item.month_date === date); 142 const result = dates_list.value.find((item) => item.month_date === date);
142 const currentDate = new Date(date); 143 const currentDate = new Date(date);
144 + const lunarDate = calendar.solar2lunar(dayjs(date).format('YYYY-MM-DD'));
143 return { 145 return {
144 text: currentDate.getDate().toString().padStart(2, '0'), 146 text: currentDate.getDate().toString().padStart(2, '0'),
145 date: result?.month_date, 147 date: result?.month_date,
146 price: result?.price, 148 price: result?.price,
147 reserve_full: result?.reserve_full, 149 reserve_full: result?.reserve_full,
150 + lunar_date: lunarDate
148 }; 151 };
149 }; 152 };
150 153
...@@ -335,6 +338,11 @@ const nextBtn = () => { ...@@ -335,6 +338,11 @@ const nextBtn = () => {
335 text-align: center; 338 text-align: center;
336 margin: 0 0.3rem; 339 margin: 0 0.3rem;
337 padding: 0.5rem 0; 340 padding: 0.5rem 0;
341 + .day-lunar {
342 + color: #1E1E1E;
343 + font-size: 0.85rem;
344 + margin-bottom: 5px;
345 + }
338 .day-text { 346 .day-text {
339 color: #1E1E1E; 347 color: #1E1E1E;
340 font-weight: bold; 348 font-weight: bold;
...@@ -350,6 +358,10 @@ const nextBtn = () => { ...@@ -350,6 +358,10 @@ const nextBtn = () => {
350 background-color: #FFFBF3; 358 background-color: #FFFBF3;
351 } 359 }
352 &.disabled { 360 &.disabled {
361 + .day-lunar {
362 + color: #C7C7C7;
363 + margin-bottom: 5px;
364 + }
353 .day-text { 365 .day-text {
354 color: #C7C7C7; 366 color: #C7C7C7;
355 } 367 }
......
...@@ -375,6 +375,11 @@ ...@@ -375,6 +375,11 @@
375 estree-walker "^2.0.2" 375 estree-walker "^2.0.2"
376 picomatch "^2.3.1" 376 picomatch "^2.3.1"
377 377
378 +"@tenado/lunarjs@^1.0.9":
379 + version "1.0.9"
380 + resolved "https://mirrors.cloud.tencent.com/npm/@tenado/lunarjs/-/lunarjs-1.0.9.tgz#fda97379b0d8778347bca28d3311392f3d551aec"
381 + integrity sha512-39V25O4qL5E++m36YXPNVS0bP8ifej8ym0jAawDWrD8tWs39AJMQaPBjbL0aTSoeBn5BafJyKnhy62rEp+b+8w==
382 +
378 "@types/estree@^1.0.0": 383 "@types/estree@^1.0.0":
379 version "1.0.1" 384 version "1.0.1"
380 resolved "https://mirrors.cloud.tencent.com/npm/@types/estree/-/estree-1.0.1.tgz" 385 resolved "https://mirrors.cloud.tencent.com/npm/@types/estree/-/estree-1.0.1.tgz"
...@@ -1263,6 +1268,11 @@ dayjs@^1.10.4, dayjs@^1.11.3: ...@@ -1263,6 +1268,11 @@ dayjs@^1.10.4, dayjs@^1.11.3:
1263 resolved "https://mirrors.cloud.tencent.com/npm/dayjs/-/dayjs-1.11.8.tgz" 1268 resolved "https://mirrors.cloud.tencent.com/npm/dayjs/-/dayjs-1.11.8.tgz"
1264 integrity sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ== 1269 integrity sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ==
1265 1270
1271 +dayjs@^1.9.3:
1272 + version "1.11.10"
1273 + resolved "https://mirrors.cloud.tencent.com/npm/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0"
1274 + integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==
1275 +
1266 debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: 1276 debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4:
1267 version "4.3.4" 1277 version "4.3.4"
1268 resolved "https://mirrors.cloud.tencent.com/npm/debug/-/debug-4.3.4.tgz" 1278 resolved "https://mirrors.cloud.tencent.com/npm/debug/-/debug-4.3.4.tgz"
...@@ -2343,6 +2353,18 @@ lru-cache@^6.0.0: ...@@ -2343,6 +2353,18 @@ lru-cache@^6.0.0:
2343 dependencies: 2353 dependencies:
2344 yallist "^4.0.0" 2354 yallist "^4.0.0"
2345 2355
2356 +lunar-lite@^0.1.1:
2357 + version "0.1.1"
2358 + resolved "https://mirrors.cloud.tencent.com/npm/lunar-lite/-/lunar-lite-0.1.1.tgz#c2c114b95eae24b84ebc0702f616ed573772c244"
2359 + integrity sha512-ttdkDY4uZg6LtE8r4m/Vt+z48ReT8StYXPY2eXqJ6tOG3C4I11g/f/gAJXplJIRTZd+F1xOFa52tUiP2UIkqzQ==
2360 + dependencies:
2361 + lunar-typescript "^1.6.13"
2362 +
2363 +lunar-typescript@^1.6.13:
2364 + version "1.7.0"
2365 + resolved "https://mirrors.cloud.tencent.com/npm/lunar-typescript/-/lunar-typescript-1.7.0.tgz#1385963c2bd0dac76fdee127f3af8c6be8173ab1"
2366 + integrity sha512-qBGcagYd0171ANwGSMdGfdFk+5wkL8OJWprjuGB/xFG4Cm+WXs/sSbIF4tw2I7Rgpf/5UrlIHGX0+eoe2HIo4Q==
2367 +
2346 magic-string@^0.25.7: 2368 magic-string@^0.25.7:
2347 version "0.25.9" 2369 version "0.25.9"
2348 resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz" 2370 resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz"
...@@ -3761,6 +3783,13 @@ xml-name-validator@^4.0.0: ...@@ -3761,6 +3783,13 @@ xml-name-validator@^4.0.0:
3761 resolved "https://mirrors.cloud.tencent.com/npm/xml-name-validator/-/xml-name-validator-4.0.0.tgz" 3783 resolved "https://mirrors.cloud.tencent.com/npm/xml-name-validator/-/xml-name-validator-4.0.0.tgz"
3762 integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== 3784 integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==
3763 3785
3786 +xst-solar2lunar@^2.1.0:
3787 + version "2.1.0"
3788 + resolved "https://mirrors.cloud.tencent.com/npm/xst-solar2lunar/-/xst-solar2lunar-2.1.0.tgz#f9d913f0a46f6debaeedae1cb85ab05cb1091a67"
3789 + integrity sha512-1X2Enk2LK1l6ZQWjSFQsLspmm6h32p8a+UGYi+HkJLEQmKiy5KSlTs2xEiyyAAG+7jTo6EOxPWS2lk3yLk/ivg==
3790 + dependencies:
3791 + dayjs "^1.9.3"
3792 +
3764 y18n@^5.0.5: 3793 y18n@^5.0.5:
3765 version "5.0.8" 3794 version "5.0.8"
3766 resolved "https://mirrors.cloud.tencent.com/npm/y18n/-/y18n-5.0.8.tgz" 3795 resolved "https://mirrors.cloud.tencent.com/npm/y18n/-/y18n-5.0.8.tgz"
......