hookehuyr

订单组件优化

...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
52 </view> 52 </view>
53 </nut-col> 53 </nut-col>
54 <!-- 待支付状态下,剩余时间归零 操作隐藏 --> 54 <!-- 待支付状态下,剩余时间归零 操作隐藏 -->
55 - <nut-col span="18" v-if="props.data.status === 'no-pay' && remain_time"> 55 + <nut-col span="18" v-if="no_pay_show">
56 <view v-if="props.data.status === 'no-pay' || props.data.status === 'apply'" class="order-control"> 56 <view v-if="props.data.status === 'no-pay' || props.data.status === 'apply'" class="order-control">
57 <nut-button @tap="cancelOrder('id')" plain color="#6A4925" size="small">取消订单</nut-button>&nbsp; 57 <nut-button @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="props.data.status !== 'apply'" @tap="payOrder('id')" color="#6A4925" size="small">立即支付</nut-button>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
61 </nut-row> 61 </nut-row>
62 </view> 62 </view>
63 <!-- 待支付状态下,剩余时间归零 显示隐藏 --> 63 <!-- 待支付状态下,剩余时间归零 显示隐藏 -->
64 - <view v-if="props.data.status === 'no-pay' && remain_time" class="order-remain-time"> 64 + <view v-if="no_pay_show" class="order-remain-time">
65 <text>支付剩余时间</text>&nbsp; 65 <text>支付剩余时间</text>&nbsp;
66 <text style="font-size: 23rpx; color: red;"> 66 <text style="font-size: 23rpx; color: red;">
67 {{ formatTime(remain_time) }} 67 {{ formatTime(remain_time) }}
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
124 </template> 124 </template>
125 125
126 <script setup> 126 <script setup>
127 -import { ref, onMounted, onUnmounted } from 'vue' 127 +import { ref, onMounted, onUnmounted, computed } from 'vue'
128 import Taro from '@tarojs/taro' 128 import Taro from '@tarojs/taro'
129 import { IconFont } from '@nutui/icons-vue-taro'; 129 import { IconFont } from '@nutui/icons-vue-taro';
130 130
...@@ -181,6 +181,17 @@ const showOrderInfo = (id) => { ...@@ -181,6 +181,17 @@ const showOrderInfo = (id) => {
181 show_info.value = !show_info.value; 181 show_info.value = !show_info.value;
182 } 182 }
183 183
184 +// 控制待支付状态下的显示
185 +const no_pay_show = computed(() => {
186 + let flag = false;
187 + if (props.data.status === 'no-pay' && remain_time.value) { // 倒计时进行时
188 + flag = true;
189 + } else if (props.data.status === 'no-pay' && !remain_time.value) { // 倒计时结束
190 + flag = false;
191 + }
192 + return flag;
193 +});
194 +
184 const cancelOrder = (id) => { 195 const cancelOrder = (id) => {
185 Taro.showModal({ 196 Taro.showModal({
186 title: '温馨提示', 197 title: '温馨提示',
...@@ -209,7 +220,7 @@ const payOrder = (id) => { ...@@ -209,7 +220,7 @@ const payOrder = (id) => {
209 let timeId = null; 220 let timeId = null;
210 221
211 onMounted(() => { 222 onMounted(() => {
212 - console.warn(props.data) 223 + console.warn(props.data.status)
213 remain_time.value = props.data.remain_time; 224 remain_time.value = props.data.remain_time;
214 // 进入页面后,开始倒计时 225 // 进入页面后,开始倒计时
215 timeId = setInterval(() => { 226 timeId = setInterval(() => {
......
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-20 10:44:15 4 + * @LastEditTime: 2023-12-21 10:10:57
5 * @FilePath: /meihuaApp/src/pages/index/index.vue 5 * @FilePath: /meihuaApp/src/pages/index/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -99,8 +99,26 @@ export default { ...@@ -99,8 +99,26 @@ export default {
99 }); 99 });
100 }, 100 },
101 async onShow () { 101 async onShow () {
102 + // Taro.showLoading({ mask: true, title: "加载中..." })
103 + // // 获取活动和轮播信息
104 + // const { code, data } = await activityHomeAPI({ page: this.page, limit: this.limit });
105 + // if (code) {
106 + // // 绑定服务器时间,判断状态
107 + // data.activity_list.forEach(item => {
108 + // item.server_time = data.server_time;
109 + // });
110 + // this.activity_list = data.activity_list;
111 + // this.carousel = data.carousel;
112 + // this.page = this.page + 1;
113 + // // 缺省页判断
114 + // this.no_activity = this.activity_list.length ? false : true;
115 + // this.no_carousel = this.carousel.length ? false : true;
116 + // Taro.hideLoading()
117 + // }
102 }, 118 },
103 onHide () { // 离开当前页面 119 onHide () { // 离开当前页面
120 + this.page = 0;
121 + this.flag = true;
104 }, 122 },
105 computed: { 123 computed: {
106 scrollStyle() { 124 scrollStyle() {
...@@ -127,6 +145,9 @@ export default { ...@@ -127,6 +145,9 @@ export default {
127 return { 145 return {
128 indexCoverHeight: 0, 146 indexCoverHeight: 0,
129 scrollTop: 0, 147 scrollTop: 0,
148 + flag: true,
149 + page: 0,
150 + limit: 10,
130 }; 151 };
131 }, 152 },
132 methods: { 153 methods: {
...@@ -136,7 +157,29 @@ export default { ...@@ -136,7 +157,29 @@ export default {
136 this.scrollTop = 0; // 重置scrollTop,让按钮能再往下滚动 157 this.scrollTop = 0; // 重置scrollTop,让按钮能再往下滚动
137 }, 158 },
138 onScrollToLower () { 159 onScrollToLower () {
139 - console.warn('onScrollToLower'); 160 + if(!this.flag){
161 + return
162 + }
163 + this.flag = false;
164 + // this.getList();
165 + },
166 + async getList () {
167 + // // 获取推荐活动列表
168 + // const { code, data } = await activityHomeAPI({ page: this.page, limit: this.limit });
169 + // if (code) {
170 + // if (data.activity_list.length) {
171 + // // 绑定服务器时间,判断状态
172 + // data.activity_list.forEach(item => {
173 + // item.server_time = data.server_time;
174 + // });
175 + // this.activity_list = this.activity_list.concat(data.activity_list);
176 + // this.page = this.page + 1;
177 + // this.flag = true;
178 + // } else {
179 + // Toast('没有数据')
180 + // }
181 + // }
182 + // }
140 }, 183 },
141 async onArrowDown () { 184 async onArrowDown () {
142 Taro.pageScrollTo({ 185 Taro.pageScrollTo({
......
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-20 18:22:40 4 + * @LastEditTime: 2023-12-21 09:08:58
5 * @FilePath: /meihuaApp/src/pages/my/index.vue 5 * @FilePath: /meihuaApp/src/pages/my/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
22 <view> 22 <view>
23 <view id="title" style="padding-left: 1.5rem; font-size: 35rpx; font-weight: bold;">我的订单</view> 23 <view id="title" style="padding-left: 1.5rem; font-size: 35rpx; font-weight: bold;">我的订单</view>
24 <view> 24 <view>
25 - <nut-tabs v-model="value" title-scroll title-gutter="0" name="tabName" background="#FFF" color="#6A4925" animated-time="0"> 25 + <nut-tabs v-model="value" @click="onTabClick" title-scroll title-gutter="0" name="tabName" background="#FFF" color="#6A4925" animated-time="0">
26 <nut-tab-pane v-for="item in tabList" :title="item.title" :pane-key="item.key"> 26 <nut-tab-pane v-for="item in tabList" :title="item.title" :pane-key="item.key">
27 </nut-tab-pane> 27 </nut-tab-pane>
28 </nut-tabs> 28 </nut-tabs>
...@@ -135,6 +135,10 @@ const goToEdit = () => { ...@@ -135,6 +135,10 @@ const goToEdit = () => {
135 url: '/pages/myInfo/index', 135 url: '/pages/myInfo/index',
136 }); 136 });
137 } 137 }
138 +
139 +const onTabClick = ({ title, paneKey, disabled }) => {
140 + console.warn(title, paneKey);
141 +}
138 </script> 142 </script>
139 143
140 <script> 144 <script>
......