Showing
5 changed files
with
120 additions
and
64 deletions
| 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-23 10:34:08 | 4 | + * @LastEditTime: 2024-01-24 10:26:55 |
| 5 | * @FilePath: /xysBooking/src/views/booking.vue | 5 | * @FilePath: /xysBooking/src/views/booking.vue |
| 6 | * @Description: 预约页面 | 6 | * @Description: 预约页面 |
| 7 | --> | 7 | --> |
| ... | @@ -19,19 +19,22 @@ | ... | @@ -19,19 +19,22 @@ |
| 19 | <div v-for="(week, index) in weeks" :key="week" class="weeks"> | 19 | <div v-for="(week, index) in weeks" :key="week" class="weeks"> |
| 20 | <div v-for="date in week" :key="date" | 20 | <div v-for="date in week" :key="date" |
| 21 | @click="chooseDay(date)" | 21 | @click="chooseDay(date)" |
| 22 | - :class="['item', checked_day === findDatesInfo(date).date ? 'checked' : '', findDatesInfo(date).reserve_full === 0 || findDatesInfo(date).reserve_full === 'overdue' ? 'disabled' : '']" | 22 | + :class="[ 'item', |
| 23 | + checked_day === findDatesInfo(date).date ? 'checked' : '', | ||
| 24 | + findDatesInfo(date).reserve_full === ReserveStatus.FULL || findDatesInfo(date).reserve_full === ReserveStatus.OVERDUE ? 'disabled' : '' | ||
| 25 | + ]" | ||
| 23 | > | 26 | > |
| 24 | <div v-if="findDatesInfo(date).date"> | 27 | <div v-if="findDatesInfo(date).date"> |
| 25 | <p class="day-text">{{ findDatesInfo(date).text }}</p> | 28 | <p class="day-text">{{ findDatesInfo(date).text }}</p> |
| 26 | - <p v-if="findDatesInfo(date).reserve_full === 1" class="day-price">¥{{ findDatesInfo(date).price }}</p> | 29 | + <p v-if="findDatesInfo(date).reserve_full === ReserveStatus.AVAILABLE" class="day-price">¥{{ findDatesInfo(date).price }}</p> |
| 27 | - <p v-else-if="findDatesInfo(date).reserve_full === -1 || findDatesInfo(date).reserve_full === 'overdue'" class="day-price"></p> | 30 | + <p v-else-if="findDatesInfo(date).reserve_full === ReserveStatus.INFINITY || findDatesInfo(date).reserve_full === ReserveStatus.OVERDUE" class="day-price"></p> |
| 28 | - <p v-else-if="findDatesInfo(date).reserve_full === 0" class="day-no-booking">约满</p> | 31 | + <p v-else-if="findDatesInfo(date).reserve_full === ReserveStatus.FULL" class="day-no-booking">约满</p> |
| 29 | <!-- <p v-else class="day-no-booking">¥{{ findDatesInfo(date).price }}</p> --> | 32 | <!-- <p v-else class="day-no-booking">¥{{ findDatesInfo(date).price }}</p> --> |
| 30 | </div> | 33 | </div> |
| 31 | </div> | 34 | </div> |
| 32 | </div> | 35 | </div> |
| 33 | </div> | 36 | </div> |
| 34 | - <div v-if="checked_day && checked_day_reserve_full === 1" class="choose-time"> | 37 | + <div v-if="checked_day && checked_day_reserve_full === ReserveStatus.AVAILABLE" class="choose-time"> |
| 35 | <div class="title"> | 38 | <div class="title"> |
| 36 | <div class="text">选择参访时间段</div> | 39 | <div class="text">选择参访时间段</div> |
| 37 | </div> | 40 | </div> |
| ... | @@ -40,7 +43,7 @@ | ... | @@ -40,7 +43,7 @@ |
| 40 | @click="chooseTime(item, index)" | 43 | @click="chooseTime(item, index)" |
| 41 | v-for="(item, index) in timePeriod" | 44 | v-for="(item, index) in timePeriod" |
| 42 | :key="index" | 45 | :key="index" |
| 43 | - :class="['time', item.rest_qty === 0 ? 'disabled' : '']" | 46 | + :class="['time', item.rest_qty === QtyStatus.FULL ? 'disabled' : '']" |
| 44 | > | 47 | > |
| 45 | <div class="left"> | 48 | <div class="left"> |
| 46 | <van-icon v-if="checked_time !== index" :name="icon_select1" /> | 49 | <van-icon v-if="checked_time !== index" :name="icon_select1" /> |
| ... | @@ -48,14 +51,14 @@ | ... | @@ -48,14 +51,14 @@ |
| 48 | {{ item.begin_time }}-{{ item.end_time }} | 51 | {{ item.begin_time }}-{{ item.end_time }} |
| 49 | </div> | 52 | </div> |
| 50 | <div class="right"> | 53 | <div class="right"> |
| 51 | - <span v-if="item.rest_qty > 0">余量:{{ item.rest_qty }}</span> | 54 | + <span v-if="item.rest_qty">余量:{{ item.rest_qty }}</span> |
| 52 | - <span v-else-if="item.rest_qty === -1">可约</span> | 55 | + <span v-else-if="item.rest_qty === QtyStatus.INFINITY">可约</span> |
| 53 | <span v-else>已约满</span> | 56 | <span v-else>已约满</span> |
| 54 | </div> | 57 | </div> |
| 55 | </div> | 58 | </div> |
| 56 | </div> | 59 | </div> |
| 57 | </div> | 60 | </div> |
| 58 | - <div v-if="checked_day_reserve_full === -1" class="choose-time"> | 61 | + <div v-if="checked_day_reserve_full === ReserveStatus.INFINITY" class="choose-time"> |
| 59 | <div class="title"> | 62 | <div class="title"> |
| 60 | <div class="text">选择参访时间段</div> | 63 | <div class="text">选择参访时间段</div> |
| 61 | </div> | 64 | </div> |
| ... | @@ -65,7 +68,7 @@ | ... | @@ -65,7 +68,7 @@ |
| 65 | </div> | 68 | </div> |
| 66 | </div> | 69 | </div> |
| 67 | <div style="height: 5rem;"></div> | 70 | <div style="height: 5rem;"></div> |
| 68 | - <div v-if="checked_day && checked_day_reserve_full === 1" class="next"> | 71 | + <div v-if="checked_day && checked_day_reserve_full === ReserveStatus.AVAILABLE" class="next"> |
| 69 | <div @click="nextBtn" class="button" style="background-color: #A67939;">下一步</div> | 72 | <div @click="nextBtn" class="button" style="background-color: #A67939;">下一步</div> |
| 70 | </div> | 73 | </div> |
| 71 | 74 | ||
| ... | @@ -81,7 +84,7 @@ | ... | @@ -81,7 +84,7 @@ |
| 81 | /> | 84 | /> |
| 82 | </van-popup> | 85 | </van-popup> |
| 83 | 86 | ||
| 84 | - <van-toast v-model:show="show_error" style=""> | 87 | + <van-toast v-model:show="show_error"> |
| 85 | <template #message> | 88 | <template #message> |
| 86 | {{ error_message }} | 89 | {{ error_message }} |
| 87 | </template> | 90 | </template> |
| ... | @@ -122,7 +125,7 @@ onMounted(async () => { | ... | @@ -122,7 +125,7 @@ onMounted(async () => { |
| 122 | // 今日之前都不可约 | 125 | // 今日之前都不可约 |
| 123 | dates_list.value.forEach((date) => { | 126 | dates_list.value.forEach((date) => { |
| 124 | if (dayjs(date.month_date).isBefore(dayjs())) { | 127 | if (dayjs(date.month_date).isBefore(dayjs())) { |
| 125 | - date.reserve_full = 'overdue'; | 128 | + date.reserve_full = ReserveStatus.OVERDUE; |
| 126 | } | 129 | } |
| 127 | }); | 130 | }); |
| 128 | dates.value = dates_list.value.map(item => item.month_date); | 131 | dates.value = dates_list.value.map(item => item.month_date); |
| ... | @@ -145,6 +148,17 @@ const findDatesInfo = (date) => { | ... | @@ -145,6 +148,17 @@ const findDatesInfo = (date) => { |
| 145 | }; | 148 | }; |
| 146 | }; | 149 | }; |
| 147 | 150 | ||
| 151 | +/** | ||
| 152 | + * @description: 预约状态 | ||
| 153 | + * @return {object} {INFINITY: -1, FULL: 0, AVAILABLE: 1, OVERDUE: 'overdue' } | ||
| 154 | + */ | ||
| 155 | +const ReserveStatus = { | ||
| 156 | + INFINITY: -1, // 无需预约 | ||
| 157 | + FULL: 0, // 约满 | ||
| 158 | + AVAILABLE: 1, // 可约 | ||
| 159 | + OVERDUE: 'overdue', // 过期日期 | ||
| 160 | +} | ||
| 161 | + | ||
| 148 | const daysOfWeek = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]; | 162 | const daysOfWeek = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]; |
| 149 | 163 | ||
| 150 | /** | 164 | /** |
| ... | @@ -194,17 +208,26 @@ const checked_time = ref(-1); | ... | @@ -194,17 +208,26 @@ const checked_time = ref(-1); |
| 194 | const timePeriod = ref([]); // 当前时间段信息 | 208 | const timePeriod = ref([]); // 当前时间段信息 |
| 195 | 209 | ||
| 196 | const chooseTime = (item, index) => { // 选择时间段回调 | 210 | const chooseTime = (item, index) => { // 选择时间段回调 |
| 197 | - if (item.rest_qty > 0 || item.rest_qty === -1) { // 余量等于-1为不限制数量 | 211 | + if (item.rest_qty || item.rest_qty === QtyStatus.INFINITY) { // 余量等于-1为不限制数量 |
| 198 | checked_time.value = index; | 212 | checked_time.value = index; |
| 199 | } | 213 | } |
| 200 | }; | 214 | }; |
| 201 | 215 | ||
| 216 | +/** | ||
| 217 | + * @description: 数量状态 | ||
| 218 | + * @return {object} {FULL: 0, INFINITY: -1 } | ||
| 219 | + */ | ||
| 220 | +const QtyStatus = { | ||
| 221 | + FULL: 0, // 无余量 | ||
| 222 | + INFINITY: -1, // 无限制 | ||
| 223 | +} | ||
| 224 | + | ||
| 202 | const chooseDay = async (date) => { // 点击日期回调 | 225 | const chooseDay = async (date) => { // 点击日期回调 |
| 203 | - if (findDatesInfo(date).reserve_full === 1 || findDatesInfo(date).reserve_full === -1) { // 状态 1可约 || -1不限制 | 226 | + if (findDatesInfo(date).reserve_full === ReserveStatus.AVAILABLE || findDatesInfo(date).reserve_full === ReserveStatus.INFINITY) { // 状态 1可约 || -1不限制 |
| 204 | checked_day.value = date; // 当前日期 | 227 | checked_day.value = date; // 当前日期 |
| 205 | checked_day_price.value = findDatesInfo(date).price; // 当前价格 | 228 | checked_day_price.value = findDatesInfo(date).price; // 当前价格 |
| 206 | checked_day_reserve_full.value = findDatesInfo(date).reserve_full; // 当前状态 | 229 | checked_day_reserve_full.value = findDatesInfo(date).reserve_full; // 当前状态 |
| 207 | - if (findDatesInfo(date).reserve_full === 1) { | 230 | + if (findDatesInfo(date).reserve_full === ReserveStatus.AVAILABLE) { |
| 208 | // 选择日期后,查询时间段信息 | 231 | // 选择日期后,查询时间段信息 |
| 209 | const { code, data } = await canReserveTimeListAPI({ month_date: checked_day.value}); | 232 | const { code, data } = await canReserveTimeListAPI({ month_date: checked_day.value}); |
| 210 | if (code) { | 233 | if (code) { |
| ... | @@ -243,7 +266,7 @@ const onConfirm = async ({ selectedValues, selectedOptions }) => { // | ... | @@ -243,7 +266,7 @@ const onConfirm = async ({ selectedValues, selectedOptions }) => { // |
| 243 | // 今日之前都不可约 | 266 | // 今日之前都不可约 |
| 244 | dates_list.value.forEach((date) => { | 267 | dates_list.value.forEach((date) => { |
| 245 | if (dayjs(date.month_date).isBefore(dayjs())) { | 268 | if (dayjs(date.month_date).isBefore(dayjs())) { |
| 246 | - date.reserve_full = 'overdue'; | 269 | + date.reserve_full = ReserveStatus.OVERDUE; |
| 247 | } | 270 | } |
| 248 | }); | 271 | }); |
| 249 | dates.value = dates_list.value.map(item => item.month_date); | 272 | dates.value = dates_list.value.map(item => item.month_date); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-16 13:19:23 | 2 | * @Date: 2024-01-16 13:19:23 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-19 21:53:06 | 4 | + * @LastEditTime: 2024-01-24 10:45:32 |
| 5 | * @FilePath: /xysBooking/src/views/bookingDetail.vue | 5 | * @FilePath: /xysBooking/src/views/bookingDetail.vue |
| 6 | - * @Description: 文件描述 | 6 | + * @Description: 预约记录详情 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div class="booking-detail-page"> | 9 | <div class="booking-detail-page"> |
| ... | @@ -31,7 +31,7 @@ | ... | @@ -31,7 +31,7 @@ |
| 31 | </div> | 31 | </div> |
| 32 | </div> | 32 | </div> |
| 33 | <div style="height: 5rem;"></div> | 33 | <div style="height: 5rem;"></div> |
| 34 | - <div v-if="billInfo.status === '3'" class="cancel-wrapper"> | 34 | + <div v-if="billInfo.status === CodeStatus.SUCCESS" class="cancel-wrapper"> |
| 35 | <div @click="cancelBooking" class="cancel-btn ">取消预约</div> | 35 | <div @click="cancelBooking" class="cancel-btn ">取消预约</div> |
| 36 | </div> | 36 | </div> |
| 37 | </div> | 37 | </div> |
| ... | @@ -54,8 +54,8 @@ const $router = useRouter(); | ... | @@ -54,8 +54,8 @@ const $router = useRouter(); |
| 54 | useTitle($route.meta.title); | 54 | useTitle($route.meta.title); |
| 55 | 55 | ||
| 56 | const go = useGo(); | 56 | const go = useGo(); |
| 57 | + | ||
| 57 | const pay_id = $route.query.pay_id; | 58 | const pay_id = $route.query.pay_id; |
| 58 | -const status = ref('预约成功'); | ||
| 59 | const qrCodeStatus = ref(''); | 59 | const qrCodeStatus = ref(''); |
| 60 | 60 | ||
| 61 | const cancelBooking = (item) => { | 61 | const cancelBooking = (item) => { |
| ... | @@ -66,12 +66,12 @@ const cancelBooking = (item) => { | ... | @@ -66,12 +66,12 @@ const cancelBooking = (item) => { |
| 66 | width: '80vw' | 66 | width: '80vw' |
| 67 | }) | 67 | }) |
| 68 | .then(async () => { | 68 | .then(async () => { |
| 69 | - // on confirm | 69 | + // on confirm |
| 70 | - const { code, data } = await cancelPrepareAPI({ bill_id: billInfo.value.bill_id }); | 70 | + const { code, data } = await cancelPrepareAPI({ bill_id: billInfo.value.bill_id }); |
| 71 | - if (code) { | 71 | + if (code) { |
| 72 | - showSuccessToast('取消成功'); | 72 | + showSuccessToast('取消成功'); |
| 73 | - $router.go(-1); | 73 | + $router.go(-1); |
| 74 | - } | 74 | + } |
| 75 | }) | 75 | }) |
| 76 | .catch(() => { | 76 | .catch(() => { |
| 77 | // on cancel | 77 | // on cancel |
| ... | @@ -89,26 +89,42 @@ const billInfo = ref({}); | ... | @@ -89,26 +89,42 @@ const billInfo = ref({}); |
| 89 | * 9=已使用(明细里有一个码被使用), | 89 | * 9=已使用(明细里有一个码被使用), |
| 90 | * 11=退款中(取消预约时先把状态打成11) | 90 | * 11=退款中(取消预约时先把状态打成11) |
| 91 | */ | 91 | */ |
| 92 | +const CodeStatus = { | ||
| 93 | + APPLY: 1, | ||
| 94 | + PAYING: 2, | ||
| 95 | + SUCCESS: 3, | ||
| 96 | + CANCEL: 5, | ||
| 97 | + CANCELED: 7, | ||
| 98 | + USED: 9, | ||
| 99 | + REFUNDING: 11 | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +const formatDatetime = (data) => { // 格式化日期 | ||
| 103 | + let begin_time = data.begin_time.slice(0, -3); | ||
| 104 | + let end_time = data.end_time.slice(0, -3); | ||
| 105 | + let str = begin_time + ' ' + end_time; | ||
| 106 | + return `${str.split(' ')[0]} ${str.split(' ')[1]}-${str.split(' ')[3]}`; | ||
| 107 | +} | ||
| 92 | 108 | ||
| 93 | onMounted(async () => { | 109 | onMounted(async () => { |
| 94 | const { code, data } = await billInfoAPI({ pay_id }); | 110 | const { code, data } = await billInfoAPI({ pay_id }); |
| 95 | if (code) { | 111 | if (code) { |
| 96 | - let begin_time = data.begin_time.slice(0, -3); | ||
| 97 | - let end_time = data.end_time.slice(0, -3); | ||
| 98 | - let str = begin_time + ' ' + end_time; | ||
| 99 | // | 112 | // |
| 100 | - data.datetime = `${str.split(' ')[0]} ${str.split(' ')[1]}-${str.split(' ')[3]}`; | 113 | + data.datetime = data && formatDatetime(data); |
| 101 | data.order_time = data.created_time.slice(0, -3); | 114 | data.order_time = data.created_time.slice(0, -3); |
| 115 | + // | ||
| 102 | billInfo.value = data; | 116 | billInfo.value = data; |
| 103 | // 显示二维码状态 | 117 | // 显示二维码状态 |
| 104 | - if (billInfo.value.status === '3') { | 118 | + switch (billInfo.value.status) { |
| 105 | - qrCodeStatus.value = 'success'; | 119 | + case CodeStatus.SUCCESS: |
| 106 | - } | 120 | + qrCodeStatus.value = 'success'; |
| 107 | - if (billInfo.value.status === '7') { | 121 | + break; |
| 108 | - qrCodeStatus.value = 'cancel'; | 122 | + case CodeStatus.CANCELED: |
| 109 | - } | 123 | + qrCodeStatus.value = 'cancel'; |
| 110 | - if (billInfo.value.status === '9') { | 124 | + break; |
| 111 | - qrCodeStatus.value = 'used'; | 125 | + case CodeStatus.USED: |
| 126 | + qrCodeStatus.value = 'used'; | ||
| 127 | + break; | ||
| 112 | } | 128 | } |
| 113 | } | 129 | } |
| 114 | }) | 130 | }) | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-16 11:37:10 | 2 | * @Date: 2024-01-16 11:37:10 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-22 17:45:57 | 4 | + * @LastEditTime: 2024-01-24 10:44:23 |
| 5 | * @FilePath: /xysBooking/src/views/bookingList.vue | 5 | * @FilePath: /xysBooking/src/views/bookingList.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -59,40 +59,49 @@ const go = useGo(); | ... | @@ -59,40 +59,49 @@ const go = useGo(); |
| 59 | * 9=已使用(明细里有一个码被使用), | 59 | * 9=已使用(明细里有一个码被使用), |
| 60 | * 11=退款中(取消预约时先把状态打成11) | 60 | * 11=退款中(取消预约时先把状态打成11) |
| 61 | */ | 61 | */ |
| 62 | +const CodeStatus = { | ||
| 63 | + APPLY: '1', | ||
| 64 | + PAYING: '2', | ||
| 65 | + SUCCESS: '3', | ||
| 66 | + CANCEL: '5', | ||
| 67 | + CANCELED: '7', | ||
| 68 | + USED: '9', | ||
| 69 | + REFUNDING: '11' | ||
| 70 | +} | ||
| 62 | 71 | ||
| 63 | const formatStatus = (status) => { | 72 | const formatStatus = (status) => { |
| 64 | switch (status) { | 73 | switch (status) { |
| 65 | - case '1': | 74 | + case CodeStatus.APPLY: |
| 66 | return { | 75 | return { |
| 67 | key: 'cancel', | 76 | key: 'cancel', |
| 68 | value: '待支付' | 77 | value: '待支付' |
| 69 | } | 78 | } |
| 70 | - case '2': | 79 | + case CodeStatus.PAYING: |
| 71 | return { | 80 | return { |
| 72 | key: 'success', | 81 | key: 'success', |
| 73 | value: '支付中' | 82 | value: '支付中' |
| 74 | } | 83 | } |
| 75 | - case '3': | 84 | + case CodeStatus.SUCCESS: |
| 76 | return { | 85 | return { |
| 77 | key: 'success', | 86 | key: 'success', |
| 78 | value: '预约成功' | 87 | value: '预约成功' |
| 79 | } | 88 | } |
| 80 | - case '5': | 89 | + case CodeStatus.CANCEL: |
| 81 | return { | 90 | return { |
| 82 | key: 'cancel', | 91 | key: 'cancel', |
| 83 | value: '已取消' | 92 | value: '已取消' |
| 84 | } | 93 | } |
| 85 | - case '7': | 94 | + case CodeStatus.CANCELED: |
| 86 | return { | 95 | return { |
| 87 | key: 'cancel', | 96 | key: 'cancel', |
| 88 | value: '已取消' | 97 | value: '已取消' |
| 89 | } | 98 | } |
| 90 | - case '9': | 99 | + case CodeStatus.USED: |
| 91 | return { | 100 | return { |
| 92 | key: 'used', | 101 | key: 'used', |
| 93 | value: '已使用' | 102 | value: '已使用' |
| 94 | } | 103 | } |
| 95 | - case '11': | 104 | + case CodeStatus.REFUNDING: |
| 96 | return { | 105 | return { |
| 97 | key: 'cancel', | 106 | key: 'cancel', |
| 98 | value: '退款中' | 107 | value: '退款中' |
| ... | @@ -100,22 +109,26 @@ const formatStatus = (status) => { | ... | @@ -100,22 +109,26 @@ const formatStatus = (status) => { |
| 100 | } | 109 | } |
| 101 | } | 110 | } |
| 102 | 111 | ||
| 103 | -const page = ref(1); | 112 | +const page = ref(1); // 页码默认为1 |
| 104 | -const limit = ref(5); | 113 | +const limit = ref(5); // 每页默认显示5条 |
| 105 | const bookingList = ref([]); | 114 | const bookingList = ref([]); |
| 106 | const loading = ref(false); | 115 | const loading = ref(false); |
| 107 | const finished = ref(false); | 116 | const finished = ref(false); |
| 108 | const finishedTextStatus = ref(false); | 117 | const finishedTextStatus = ref(false); |
| 109 | 118 | ||
| 119 | +const formatDatetime = (data) => { // 格式化日期 | ||
| 120 | + let begin_time = data.begin_time.slice(0, -3); | ||
| 121 | + let end_time = data.end_time.slice(0, -3); | ||
| 122 | + let str = begin_time + ' ' + end_time; | ||
| 123 | + return `${str.split(' ')[0]} ${str.split(' ')[1]}-${str.split(' ')[3]}`; | ||
| 124 | +} | ||
| 125 | + | ||
| 110 | onMounted(async () => { | 126 | onMounted(async () => { |
| 111 | const { code, data } = await billListAPI({ page: page.value, row_num: limit.value }); | 127 | const { code, data } = await billListAPI({ page: page.value, row_num: limit.value }); |
| 112 | if (code) { | 128 | if (code) { |
| 113 | // | 129 | // |
| 114 | data.forEach(item => { | 130 | data.forEach(item => { |
| 115 | - let begin_time = item.begin_time?.slice(0, -3); | 131 | + item.booking_time = item && formatDatetime(item); |
| 116 | - let end_time = item.end_time?.slice(0, -3); | ||
| 117 | - let str = begin_time + ' ' + end_time; | ||
| 118 | - item.booking_time = `${str.split(' ')[0]} ${str.split(' ')[1]}-${str.split(' ')[3]}`; | ||
| 119 | item.order_time = item.created_time.slice(0, -3); | 132 | item.order_time = item.created_time.slice(0, -3); |
| 120 | }); | 133 | }); |
| 121 | bookingList.value = data; | 134 | bookingList.value = data; |
| ... | @@ -127,10 +140,7 @@ const onLoad = async () => { | ... | @@ -127,10 +140,7 @@ const onLoad = async () => { |
| 127 | const { code, data } = await billListAPI({ page: page.value, row_num: limit.value }); | 140 | const { code, data } = await billListAPI({ page: page.value, row_num: limit.value }); |
| 128 | if (code) { | 141 | if (code) { |
| 129 | data.forEach(item => { | 142 | data.forEach(item => { |
| 130 | - let begin_time = item.begin_time?.slice(0, -3); | 143 | + item.booking_time = item && formatDatetime(item); |
| 131 | - let end_time = item.end_time?.slice(0, -3); | ||
| 132 | - let str = begin_time + ' ' + end_time; | ||
| 133 | - item.booking_time = `${str.split(' ')[0]} ${str.split(' ')[1]}-${str.split(' ')[3]}`; | ||
| 134 | item.order_time = item.created_time.slice(0, -3); | 144 | item.order_time = item.created_time.slice(0, -3); |
| 135 | }); | 145 | }); |
| 136 | bookingList.value = bookingList.value.concat(data); | 146 | bookingList.value = bookingList.value.concat(data); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-15 16:25:51 | 2 | * @Date: 2024-01-15 16:25:51 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-19 18:57:26 | 4 | + * @LastEditTime: 2024-01-22 18:21:18 |
| 5 | * @FilePath: /xysBooking/src/views/submit.vue | 5 | * @FilePath: /xysBooking/src/views/submit.vue |
| 6 | * @Description: 预约人员信息 | 6 | * @Description: 预约人员信息 |
| 7 | --> | 7 | --> |
| ... | @@ -124,7 +124,9 @@ const submitBtn = async () => { | ... | @@ -124,7 +124,9 @@ const submitBtn = async () => { |
| 124 | if (prepare_code) { | 124 | if (prepare_code) { |
| 125 | const { code: callback_code, data: callback_data } = await payCallbackAPI({ pay_id: prepare_data.pay_id, pay_status: 1 }); | 125 | const { code: callback_code, data: callback_data } = await payCallbackAPI({ pay_id: prepare_data.pay_id, pay_status: 1 }); |
| 126 | if (callback_code) { | 126 | if (callback_code) { |
| 127 | + // TODO:看需求,把跳转页换成等待页面 | ||
| 127 | go('/success', { pay_id: prepare_data.pay_id }); | 128 | go('/success', { pay_id: prepare_data.pay_id }); |
| 129 | + // go('/waiting', { pay_id: prepare_data.pay_id }); | ||
| 128 | } | 130 | } |
| 129 | } | 131 | } |
| 130 | } | 132 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-15 18:28:25 | 2 | * @Date: 2024-01-15 18:28:25 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-19 17:27:20 | 4 | + * @LastEditTime: 2024-01-24 10:45:51 |
| 5 | * @FilePath: /xysBooking/src/views/success.vue | 5 | * @FilePath: /xysBooking/src/views/success.vue |
| 6 | * @Description: 预约成功提示页面 | 6 | * @Description: 预约成功提示页面 |
| 7 | --> | 7 | --> |
| ... | @@ -55,17 +55,22 @@ const goToDetail = () => { | ... | @@ -55,17 +55,22 @@ const goToDetail = () => { |
| 55 | 55 | ||
| 56 | const billInfo = ref({}); | 56 | const billInfo = ref({}); |
| 57 | 57 | ||
| 58 | +const formatDatetime = (data) => { // 格式化日期 | ||
| 59 | + let begin_time = data.begin_time.slice(0, -3); | ||
| 60 | + let end_time = data.end_time.slice(0, -3); | ||
| 61 | + let str = begin_time + ' ' + end_time; | ||
| 62 | + return `${str.split(' ')[0]} ${str.split(' ')[1]}-${str.split(' ')[3]}`; | ||
| 63 | +} | ||
| 64 | + | ||
| 58 | onMounted(async () => { | 65 | onMounted(async () => { |
| 66 | + // 获取订单详情 | ||
| 59 | const { code, data } = await billInfoAPI({ pay_id: $route.query.pay_id }); | 67 | const { code, data } = await billInfoAPI({ pay_id: $route.query.pay_id }); |
| 60 | if (code) { | 68 | if (code) { |
| 61 | - let begin_time = data.begin_time.slice(0, -3); | ||
| 62 | - let end_time = data.end_time.slice(0, -3); | ||
| 63 | - let str = begin_time + ' ' + end_time; | ||
| 64 | // | 69 | // |
| 65 | - data.datetime = `${str.split(' ')[0]} ${str.split(' ')[1]}-${str.split(' ')[3]}` | 70 | + data.datetime = data && formatDatetime(data); |
| 66 | billInfo.value = data; | 71 | billInfo.value = data; |
| 67 | // TAG:支付翻状态 | 72 | // TAG:支付翻状态 |
| 68 | - const { code: prepare_code, data: prepare_data } = await payPrepareAPI({ pay_id: $route.query.pay_id }); | 73 | + // const { code: prepare_code, data: prepare_data } = await payPrepareAPI({ pay_id: $route.query.pay_id }); |
| 69 | } | 74 | } |
| 70 | }) | 75 | }) |
| 71 | </script> | 76 | </script> | ... | ... |
-
Please register or login to post a comment