hookehuyr

订单相关API调整

...@@ -27,7 +27,6 @@ declare module '@vue/runtime-core' { ...@@ -27,7 +27,6 @@ declare module '@vue/runtime-core' {
27 NutRadio: typeof import('@nutui/nutui-taro')['Radio'] 27 NutRadio: typeof import('@nutui/nutui-taro')['Radio']
28 NutRadioGroup: typeof import('@nutui/nutui-taro')['RadioGroup'] 28 NutRadioGroup: typeof import('@nutui/nutui-taro')['RadioGroup']
29 NutRow: typeof import('@nutui/nutui-taro')['Row'] 29 NutRow: typeof import('@nutui/nutui-taro')['Row']
30 - NutSkeleton: typeof import('@nutui/nutui-taro')['Skeleton']
31 NutSwiper: typeof import('@nutui/nutui-taro')['Swiper'] 30 NutSwiper: typeof import('@nutui/nutui-taro')['Swiper']
32 NutSwiperItem: typeof import('@nutui/nutui-taro')['SwiperItem'] 31 NutSwiperItem: typeof import('@nutui/nutui-taro')['SwiperItem']
33 NutTabPane: typeof import('@nutui/nutui-taro')['TabPane'] 32 NutTabPane: typeof import('@nutui/nutui-taro')['TabPane']
......
1 /* 1 /*
2 * @Date: 2023-12-22 10:29:37 2 * @Date: 2023-12-22 10:29:37
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-12-27 17:27:31 4 + * @LastEditTime: 2023-12-27 18:09:49
5 * @FilePath: /meihuaApp/src/api/index.js 5 * @FilePath: /meihuaApp/src/api/index.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -16,6 +16,7 @@ const Api = { ...@@ -16,6 +16,7 @@ const Api = {
16 GET_LIST: '/srv/?a=room_data&t=get_list', 16 GET_LIST: '/srv/?a=room_data&t=get_list',
17 GET_ROOM: '/srv/?a=room_data&t=get_room', 17 GET_ROOM: '/srv/?a=room_data&t=get_room',
18 ADD_ORDER: '/srv/?a=room_data&t=add_order', 18 ADD_ORDER: '/srv/?a=room_data&t=add_order',
19 + MY_ORDER: '/srv/?a=room_data&t=my_order',
19 PAY: '/srv/?a=pay', 20 PAY: '/srv/?a=pay',
20 PAY_CHECK: '/srv/?a=pay_check', 21 PAY_CHECK: '/srv/?a=pay_check',
21 } 22 }
...@@ -100,3 +101,12 @@ export const payAPI = (params) => fn(fetch.post(Api.PAY, params)); ...@@ -100,3 +101,12 @@ export const payAPI = (params) => fn(fetch.post(Api.PAY, params));
100 * @returns 101 * @returns
101 */ 102 */
102 export const payCheckAPI = (params) => fn(fetch.post(Api.PAY_CHECK, params)); 103 export const payCheckAPI = (params) => fn(fetch.post(Api.PAY_CHECK, params));
104 +
105 +/**
106 + * @description: 获取我的订单列表
107 + * @param pay_type
108 + * @param page
109 + * @param limit
110 + * @returns
111 + */
112 +export const myOrderAPI = (params) => fn(fetch.get(Api.MY_ORDER, params));
......
This diff is collapsed. Click to expand it.
1 <!-- 1 <!--
2 * @Date: 2023-12-20 14:11:11 2 * @Date: 2023-12-20 14:11:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-12-27 17:37:35 4 + * @LastEditTime: 2023-12-27 18:21:06
5 * @FilePath: /meihuaApp/src/components/payCard.vue 5 * @FilePath: /meihuaApp/src/components/payCard.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -113,7 +113,7 @@ const goToPay = async () => { ...@@ -113,7 +113,7 @@ const goToPay = async () => {
113 if (current_page === 'pages/my/index') { // 我的页面打开 113 if (current_page === 'pages/my/index') { // 我的页面打开
114 // 刷新当前页面 114 // 刷新当前页面
115 Taro.reLaunch({ 115 Taro.reLaunch({
116 - url: '/pages/my/index?tab_index=1' 116 + url: '/pages/my/index?tab_index=5'
117 }); 117 });
118 } 118 }
119 if (current_page === 'pages/detail/index') { // 订房确认页打开 119 if (current_page === 'pages/detail/index') { // 订房确认页打开
......
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-27 14:37:22 4 + * @LastEditTime: 2023-12-27 19:30:49
5 * @FilePath: /meihuaApp/src/pages/my/index.vue 5 * @FilePath: /meihuaApp/src/pages/my/index.vue
6 * @Description: 我的页面 6 * @Description: 我的页面
7 --> 7 -->
...@@ -25,17 +25,13 @@ ...@@ -25,17 +25,13 @@
25 <nut-tab-pane v-for="item in tabList" :title="item.title" :pane-key="item.key" /> 25 <nut-tab-pane v-for="item in tabList" :title="item.title" :pane-key="item.key" />
26 </nut-tabs> 26 </nut-tabs>
27 <view v-if="showContent" class="book-list"> 27 <view v-if="showContent" class="book-list">
28 - <scroll-view ref="refScrollView" :style="scrollStyle" :scroll-y="true" :scroll-with-animation="true" @scrolltolower="onScrollToLower"> 28 + <scroll-view v-if="order_list.length" ref="refScrollView" :style="scrollStyle" :scroll-y="true" :scroll-with-animation="true" @scrolltolower="onScrollToLower">
29 - <view v-for="(item, index) in orderList" :key="index"> 29 + <view v-for="(item, index) in order_list" :key="index">
30 - <order-card :key="index" :data="item" @onPay="onPay"></order-card> 30 + <order-card :key="index" :data="item" :sys="sys_data" @onPay="onPay"></order-card>
31 - <view v-if="index === orderList.length-1" style="height: 2rem;"></view> 31 + <view v-if="index === order_list.length-1" style="height: 2rem;"></view>
32 </view> 32 </view>
33 </scroll-view> 33 </scroll-view>
34 - <nut-empty 34 + <nut-empty v-else image="https://static-ftcms.jd.com/p/files/61a9e3313985005b3958672e.png" description="暂无数据" ></nut-empty>
35 - v-if="orderList.length === 0"
36 - image="https://static-ftcms.jd.com/p/files/61a9e3313985005b3958672e.png"
37 - description="暂无数据"
38 - ></nut-empty>
39 </view> 35 </view>
40 </view> 36 </view>
41 <nav-bar activated="my" /> 37 <nav-bar activated="my" />
...@@ -51,65 +47,11 @@ import navBar from '@/components/navBar.vue' ...@@ -51,65 +47,11 @@ import navBar from '@/components/navBar.vue'
51 import orderCard from '@/components/orderCard.vue' 47 import orderCard from '@/components/orderCard.vue'
52 import payCard from '@/components/payCard.vue' 48 import payCard from '@/components/payCard.vue'
53 import avatar from '@/assets/images/avatar.png' 49 import avatar from '@/assets/images/avatar.png'
54 -import { showMyInfoAPI } from '@/api/index' 50 +import { showMyInfoAPI, myOrderAPI, sysParamAPI } from '@/api/index'
55 import { getCurrentPageParam } from "@/utils/weapp"; 51 import { getCurrentPageParam } from "@/utils/weapp";
56 52
57 const refScrollView = ref(null); 53 const refScrollView = ref(null);
58 54
59 -const tab_index = ref('0');
60 -const tabList = ref([{
61 - title: '全部订单',
62 - key: '0',
63 - value: 'all'
64 -}, {
65 - title: '待入住',
66 - key: '1',
67 - value: 'a'
68 -}, {
69 - title: '待支付',
70 - key: '2',
71 - value: 'b'
72 -}, {
73 - title: '已取消',
74 - key: '3',
75 - value: 'c'
76 -}]);
77 -
78 -const orderList = ref([
79 - {
80 - id: 1,
81 - name: '阿忆妞妞1',
82 - phone: '138****8888',
83 - price: 1200,
84 - remain_time: 1000,
85 - status: 'no-pay',
86 - },
87 - {
88 - id: 2,
89 - name: '阿忆妞妞2',
90 - phone: '138****8888',
91 - price: 1200,
92 - remain_time: 100,
93 - status: 'apply',
94 - },
95 - {
96 - id: 3,
97 - name: '阿忆妞妞3',
98 - phone: '138****8888',
99 - price: 1200,
100 - remain_time: 100,
101 - status: 'enable',
102 - },
103 - {
104 - id: 4,
105 - name: '阿忆妞妞4',
106 - phone: '138****8888',
107 - price: 1200,
108 - remain_time: 100,
109 - status: 'cancel',
110 - },
111 -])
112 -
113 const show_pay = ref(false); 55 const show_pay = ref(false);
114 const payData = ref({}); 56 const payData = ref({});
115 const userInfo = ref({ 57 const userInfo = ref({
...@@ -118,19 +60,6 @@ const userInfo = ref({ ...@@ -118,19 +60,6 @@ const userInfo = ref({
118 phone: '' 60 phone: ''
119 }); 61 });
120 62
121 -const tab_status = computed(() => {
122 - switch (tab_index.value) {
123 - case '0':
124 - return 'all'
125 - case '1':
126 - return 'in';
127 - case '2':
128 - return 'pp';
129 - case '3':
130 - return 'ca';
131 - }
132 -});
133 -
134 onMounted(async () => { 63 onMounted(async () => {
135 // 获取用户信息 64 // 获取用户信息
136 const { code, data } = await showMyInfoAPI(); 65 const { code, data } = await showMyInfoAPI();
...@@ -141,13 +70,6 @@ onMounted(async () => { ...@@ -141,13 +70,6 @@ onMounted(async () => {
141 phone: data.wxapp_user_phone 70 phone: data.wxapp_user_phone
142 } 71 }
143 } 72 }
144 - // 默认勾选栏目
145 - let params = getCurrentPageParam();
146 - if (params.tab_index) {
147 - tab_index.value = params.tab_index;
148 - }
149 - //
150 - console.warn('tab_status', tab_status.value);
151 }); 73 });
152 74
153 const onPay = ({ id, remain_time }) => { 75 const onPay = ({ id, remain_time }) => {
...@@ -178,13 +100,6 @@ const goToEdit = async () => { ...@@ -178,13 +100,6 @@ const goToEdit = async () => {
178 }); 100 });
179 } 101 }
180 } 102 }
181 -
182 -const onTabClick = ({ title, paneKey, disabled }) => {
183 - tab_index.value = paneKey;
184 - // console.warn(title, paneKey, tabList.value[paneKey]);
185 - // console.warn(tab_index.value);
186 - console.warn(tab_status.value);
187 -}
188 </script> 103 </script>
189 104
190 <script> 105 <script>
...@@ -199,18 +114,29 @@ export default { ...@@ -199,18 +114,29 @@ export default {
199 scrollStyle() { 114 scrollStyle() {
200 return { 115 return {
201 height: this.indexCoverHeight + 'px', 116 height: this.indexCoverHeight + 'px',
202 - // paddingBottom: 50 + 'px',
203 }; 117 };
204 }, 118 },
205 }, 119 },
120 + async onShow () {
121 + Taro.showLoading({ mask: true, title: "加载中..." })
122 + // 获取活动和轮播信息
123 + const { code, data } = await myOrderAPI({ page: this.page, limit: this.limit, pay_type: this.tab_index });
124 + if (code) {
125 + this.order_list = data;
126 + this.page = this.page + 1;
127 + Taro.hideLoading()
128 + }
129 + // 获取系统参数
130 + const sysData = await sysParamAPI();
131 + if (sysData.code) {
132 + this.sys_data = sysData.data;
133 + }
134 + },
206 onHide () { // 离开当前页面 135 onHide () { // 离开当前页面
207 - this.page = 0; 136 + this.page = 1;
208 this.flag = true; 137 this.flag = true;
209 }, 138 },
210 mounted () { 139 mounted () {
211 - Taro.showLoading({
212 - title: '加载中',
213 - });
214 // 设置首页封面高度 140 // 设置首页封面高度
215 const windowHeight = wx.getSystemInfoSync().windowHeight; 141 const windowHeight = wx.getSystemInfoSync().windowHeight;
216 // 处理切换显示白屏问题 142 // 处理切换显示白屏问题
...@@ -233,42 +159,68 @@ export default { ...@@ -233,42 +159,68 @@ export default {
233 console.warn('加载完成'); 159 console.warn('加载完成');
234 } 160 }
235 }); 161 });
162 + // 默认勾选栏目
163 + let params = getCurrentPageParam();
164 + if (params.tab_index) {
165 + this.tab_index = params.tab_index;
166 + }
236 }, 167 },
237 data() { 168 data() {
238 return { 169 return {
239 showContent: false, 170 showContent: false,
240 indexCoverHeight: 0, 171 indexCoverHeight: 0,
172 + order_list: [],
173 + sys_data: {},
241 flag: true, 174 flag: true,
242 - page: 0, 175 + page: 1,
243 limit: 10, 176 limit: 10,
177 + tab_index: 'all',
178 + // 房间状态(9=已入住,2=已取消,3=未支付,5=已支付)
179 + tabList: ([{
180 + title: '全部订单',
181 + key: 'all',
182 + }, {
183 + title: '待入住',
184 + key: '5',
185 + }, {
186 + title: '待支付',
187 + key: '3',
188 + }, {
189 + title: '已取消',
190 + key: '2',
191 + }])
244 }; 192 };
245 }, 193 },
246 methods: { 194 methods: {
195 + onTabClick ({ title, paneKey, disabled }) {
196 + this.tab_index = paneKey;
197 + this.order_list = [];
198 + this.page = 1;
199 + this.flag = true;
200 + this.getList();
201 + },
247 onScrollToLower () { 202 onScrollToLower () {
248 - // if(!this.flag){ 203 + if(!this.flag){
249 - // return 204 + return
250 - // } 205 + }
251 - // this.flag = false; 206 + this.flag = false;
252 - // this.getList(); 207 + this.getList();
253 - console.warn('onScrollToLower');
254 }, 208 },
255 async getList () { 209 async getList () {
256 - // // 获取推荐活动列表 210 + // 获取列表
257 - // const { code, data } = await activityHomeAPI({ page: this.page, limit: this.limit }); 211 + const { code, data } = await myOrderAPI({ page: this.page, limit: this.limit, pay_type: this.tab_index });
258 - // if (code) { 212 + if (code) {
259 - // if (data.activity_list.length) { 213 + if (data.length) {
260 - // // 绑定服务器时间,判断状态 214 + this.order_list = this.order_list.concat(data);
261 - // data.activity_list.forEach(item => { 215 + this.page = this.page + 1;
262 - // item.server_time = data.server_time; 216 + this.flag = true;
263 - // }); 217 + } else {
264 - // this.activity_list = this.activity_list.concat(data.activity_list); 218 + Taro.showToast({
265 - // this.page = this.page + 1; 219 + title: '没有更多了',
266 - // this.flag = true; 220 + icon: 'none'
267 - // } else { 221 + });
268 - // Toast('没有数据') 222 + }
269 - // } 223 + }
270 - // }
271 - // }
272 }, 224 },
273 } 225 }
274 }; 226 };
......