hookehuyr

fix 数据操作优化

...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
27 </nut-col> 27 </nut-col>
28 </nut-row> 28 </nut-row>
29 </view> 29 </view>
30 - <view :class="['calendar-select-page', props.data.status === 'enable' || props.data.status === 'cancel' ? 'bg-gray' : '']"> 30 + <view :class="['calendar-select-page', calcBgColor ? 'bg-gray' : '']">
31 <nut-row gutter="10"> 31 <nut-row gutter="10">
32 <nut-col span="9"> 32 <nut-col span="9">
33 <view class="check-in-text">入住日期</view> 33 <view class="check-in-text">入住日期</view>
...@@ -52,16 +52,21 @@ ...@@ -52,16 +52,21 @@
52 </view> 52 </view>
53 </nut-col> 53 </nut-col>
54 <!-- 待支付状态下,剩余时间归零 操作隐藏 --> 54 <!-- 待支付状态下,剩余时间归零 操作隐藏 -->
55 - <nut-col span="18" v-if="no_pay_show"> 55 + <nut-col span="18">
56 - <view v-if="props.data.status === 'no-pay' || props.data.status === 'apply'" class="order-control"> 56 + <view v-if="showBtn" class="order-control">
57 - <nut-button @tap="cancelOrder('id')" plain color="#6A4925" size="small">取消订单</nut-button>&nbsp; 57 + <nut-button v-if="pay_show || props.data.status === 'apply'" @tap="cancelOrder('id')" plain color="#6A4925" size="small">取消订单</nut-button>&nbsp;
58 - <nut-button v-if="props.data.status !== 'apply'" @tap="payOrder('id')" color="#6A4925" size="small">立即支付</nut-button> 58 + <nut-button v-if="pay_show" @tap="payOrder('id')" color="#6A4925" size="small">立即支付</nut-button>
59 + <view v-if="delay_pay_show">
60 + <text style="font-size: 23rpx; color: red;">
61 + 支付超时,请重新下单!
62 + </text>
63 + </view>
59 </view> 64 </view>
60 </nut-col> 65 </nut-col>
61 </nut-row> 66 </nut-row>
62 </view> 67 </view>
63 <!-- 待支付状态下,剩余时间归零 显示隐藏 --> 68 <!-- 待支付状态下,剩余时间归零 显示隐藏 -->
64 - <view v-if="no_pay_show" class="order-remain-time"> 69 + <view v-if="pay_show" class="order-remain-time">
65 <text>支付剩余时间</text>&nbsp; 70 <text>支付剩余时间</text>&nbsp;
66 <text style="font-size: 23rpx; color: red;"> 71 <text style="font-size: 23rpx; color: red;">
67 {{ formatTime(remain_time) }} 72 {{ formatTime(remain_time) }}
...@@ -124,7 +129,7 @@ ...@@ -124,7 +129,7 @@
124 </template> 129 </template>
125 130
126 <script setup> 131 <script setup>
127 -import { ref, reactive, onMounted, onUnmounted, computed } from 'vue' 132 +import { ref, reactive, onMounted, onUnmounted, computed, } from 'vue'
128 import Taro from '@tarojs/taro' 133 import Taro from '@tarojs/taro'
129 import { IconFont } from '@nutui/icons-vue-taro'; 134 import { IconFont } from '@nutui/icons-vue-taro';
130 135
...@@ -142,6 +147,16 @@ const STATUS_TEXT = { ...@@ -142,6 +147,16 @@ const STATUS_TEXT = {
142 'no-pay': '待支付', 147 'no-pay': '待支付',
143 } 148 }
144 149
150 +// 日历背景色灰色的条件判断
151 +const calcBgColor = computed(() => {
152 + return props.data.status === 'enable' || props.data.status === 'cancel';
153 +});
154 +
155 +// 显示操作按钮的条件判断
156 +const showBtn = computed(() => {
157 + return props.data.status === 'apply' || props.data.status === 'no-pay';
158 +});
159 +
145 /** 160 /**
146 * 格式化时间 161 * 格式化时间
147 * @param {*} seconds 162 * @param {*} seconds
...@@ -182,7 +197,7 @@ const showOrderInfo = (id) => { ...@@ -182,7 +197,7 @@ const showOrderInfo = (id) => {
182 } 197 }
183 198
184 // 控制待支付状态下的显示 199 // 控制待支付状态下的显示
185 -const no_pay_show = computed(() => { 200 +const pay_show = computed(() => {
186 let flag = false; 201 let flag = false;
187 if (props.data.status === 'no-pay' && remain_time.value) { // 倒计时进行时 202 if (props.data.status === 'no-pay' && remain_time.value) { // 倒计时进行时
188 flag = true; 203 flag = true;
...@@ -192,6 +207,11 @@ const no_pay_show = computed(() => { ...@@ -192,6 +207,11 @@ const no_pay_show = computed(() => {
192 return flag; 207 return flag;
193 }); 208 });
194 209
210 +// 支付超时显示
211 +const delay_pay_show = computed(() => {
212 + return props.data.status === 'no-pay' && !remain_time.value;
213 +})
214 +
195 const cancelOrder = (id) => { 215 const cancelOrder = (id) => {
196 Taro.showModal({ 216 Taro.showModal({
197 title: '温馨提示', 217 title: '温馨提示',
...@@ -199,6 +219,15 @@ const cancelOrder = (id) => { ...@@ -199,6 +219,15 @@ const cancelOrder = (id) => {
199 success: function (res) { 219 success: function (res) {
200 if (res.confirm) { 220 if (res.confirm) {
201 console.log('用户点击确定') 221 console.log('用户点击确定')
222 + // TODO:取消订单
223 + if (id) {
224 + Taro.showToast({
225 + title: '取消成功',
226 + icon:'success',
227 + duration: 2000
228 + });
229 + // TODO:刷新当前列表接口
230 + }
202 } else if (res.cancel) { 231 } else if (res.cancel) {
203 console.log('用户点击取消') 232 console.log('用户点击取消')
204 } 233 }
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-12-26 17:21:40 4 + * @LastEditTime: 2023-12-27 10:55:11
5 * @FilePath: /meihuaApp/src/pages/confirm/index.vue 5 * @FilePath: /meihuaApp/src/pages/confirm/index.vue
6 * @Description: 确认订单页面 6 * @Description: 确认订单页面
7 --> 7 -->
...@@ -271,6 +271,7 @@ const goPay = () => { ...@@ -271,6 +271,7 @@ const goPay = () => {
271 show_pay.value = true; 271 show_pay.value = true;
272 payData.value.id = '订单ID'; 272 payData.value.id = '订单ID';
273 payData.value.price = room_price_info.value.discount * book_count.value * booking_info.value.days; 273 payData.value.price = room_price_info.value.discount * book_count.value * booking_info.value.days;
274 + // TODO: 数据从哪里过去?
274 payData.value.remain_time = '1000'; // 支付失效秒数 275 payData.value.remain_time = '1000'; // 支付失效秒数
275 }, 1000); 276 }, 1000);
276 } 277 }
......
1 <!-- 1 <!--
2 * @Date: 2023-12-13 11:13:13 2 * @Date: 2023-12-13 11:13:13
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-12-22 12:17:30 4 + * @LastEditTime: 2023-12-27 10:55:44
5 * @FilePath: /meihuaApp/src/pages/my/index.vue 5 * @FilePath: /meihuaApp/src/pages/my/index.vue
6 * @Description: 我的页面 6 * @Description: 我的页面
7 --> 7 -->
...@@ -71,7 +71,7 @@ const orderList = ref([ ...@@ -71,7 +71,7 @@ const orderList = ref([
71 name: '阿忆妞妞1', 71 name: '阿忆妞妞1',
72 phone: '138****8888', 72 phone: '138****8888',
73 price: 1200, 73 price: 1200,
74 - remain_time: 10, 74 + remain_time: 1000,
75 status: 'no-pay', 75 status: 'no-pay',
76 }, 76 },
77 { 77 {
......