Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
meihua-island-book
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2023-12-27 19:34:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cc28a6cc536d112d630e9322907b4122e93d5e0c
cc28a6cc
1 parent
5c09c8c7
订单相关API调整
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
124 deletions
components.d.ts
src/api/index.js
src/components/orderCard.vue
src/components/payCard.vue
src/pages/my/index.vue
components.d.ts
View file @
cc28a6c
...
...
@@ -27,7 +27,6 @@ declare module '@vue/runtime-core' {
NutRadio
:
typeof
import
(
'@nutui/nutui-taro'
)[
'Radio'
]
NutRadioGroup
:
typeof
import
(
'@nutui/nutui-taro'
)[
'RadioGroup'
]
NutRow
:
typeof
import
(
'@nutui/nutui-taro'
)[
'Row'
]
NutSkeleton
:
typeof
import
(
'@nutui/nutui-taro'
)[
'Skeleton'
]
NutSwiper
:
typeof
import
(
'@nutui/nutui-taro'
)[
'Swiper'
]
NutSwiperItem
:
typeof
import
(
'@nutui/nutui-taro'
)[
'SwiperItem'
]
NutTabPane
:
typeof
import
(
'@nutui/nutui-taro'
)[
'TabPane'
]
...
...
src/api/index.js
View file @
cc28a6c
/*
* @Date: 2023-12-22 10:29:37
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-27 1
7:27:31
* @LastEditTime: 2023-12-27 1
8:09:49
* @FilePath: /meihuaApp/src/api/index.js
* @Description: 文件描述
*/
...
...
@@ -16,6 +16,7 @@ const Api = {
GET_LIST
:
'/srv/?a=room_data&t=get_list'
,
GET_ROOM
:
'/srv/?a=room_data&t=get_room'
,
ADD_ORDER
:
'/srv/?a=room_data&t=add_order'
,
MY_ORDER
:
'/srv/?a=room_data&t=my_order'
,
PAY
:
'/srv/?a=pay'
,
PAY_CHECK
:
'/srv/?a=pay_check'
,
}
...
...
@@ -100,3 +101,12 @@ export const payAPI = (params) => fn(fetch.post(Api.PAY, params));
* @returns
*/
export
const
payCheckAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
PAY_CHECK
,
params
));
/**
* @description: 获取我的订单列表
* @param pay_type
* @param page
* @param limit
* @returns
*/
export
const
myOrderAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
MY_ORDER
,
params
));
...
...
src/components/orderCard.vue
View file @
cc28a6c
This diff is collapsed. Click to expand it.
src/components/payCard.vue
View file @
cc28a6c
<!--
* @Date: 2023-12-20 14:11:11
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-27 1
7:37:35
* @LastEditTime: 2023-12-27 1
8:21:06
* @FilePath: /meihuaApp/src/components/payCard.vue
* @Description: 文件描述
-->
...
...
@@ -113,7 +113,7 @@ const goToPay = async () => {
if (current_page === 'pages/my/index') { // 我的页面打开
// 刷新当前页面
Taro.reLaunch({
url: '/pages/my/index?tab_index=
1
'
url: '/pages/my/index?tab_index=
5
'
});
}
if (current_page === 'pages/detail/index') { // 订房确认页打开
...
...
src/pages/my/index.vue
View file @
cc28a6c
<!--
* @Date: 2023-12-13 11:13:13
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-27 1
4:37:22
* @LastEditTime: 2023-12-27 1
9:30:49
* @FilePath: /meihuaApp/src/pages/my/index.vue
* @Description: 我的页面
-->
...
...
@@ -25,17 +25,13 @@
<nut-tab-pane v-for="item in tabList" :title="item.title" :pane-key="item.key" />
</nut-tabs>
<view v-if="showContent" class="book-list">
<scroll-view ref="refScrollView" :style="scrollStyle" :scroll-y="true" :scroll-with-animation="true" @scrolltolower="onScrollToLower">
<view v-for="(item, index) in order
L
ist" :key="index">
<order-card :key="index" :data="item" @onPay="onPay"></order-card>
<view v-if="index === order
L
ist.length-1" style="height: 2rem;"></view>
<scroll-view
v-if="order_list.length"
ref="refScrollView" :style="scrollStyle" :scroll-y="true" :scroll-with-animation="true" @scrolltolower="onScrollToLower">
<view v-for="(item, index) in order
_l
ist" :key="index">
<order-card :key="index" :data="item"
:sys="sys_data"
@onPay="onPay"></order-card>
<view v-if="index === order
_l
ist.length-1" style="height: 2rem;"></view>
</view>
</scroll-view>
<nut-empty
v-if="orderList.length === 0"
image="https://static-ftcms.jd.com/p/files/61a9e3313985005b3958672e.png"
description="暂无数据"
></nut-empty>
<nut-empty v-else image="https://static-ftcms.jd.com/p/files/61a9e3313985005b3958672e.png" description="暂无数据" ></nut-empty>
</view>
</view>
<nav-bar activated="my" />
...
...
@@ -51,65 +47,11 @@ import navBar from '@/components/navBar.vue'
import orderCard from '@/components/orderCard.vue'
import payCard from '@/components/payCard.vue'
import avatar from '@/assets/images/avatar.png'
import { showMyInfoAPI } from '@/api/index'
import { showMyInfoAPI
, myOrderAPI, sysParamAPI
} from '@/api/index'
import { getCurrentPageParam } from "@/utils/weapp";
const refScrollView = ref(null);
const tab_index = ref('0');
const tabList = ref([{
title: '全部订单',
key: '0',
value: 'all'
}, {
title: '待入住',
key: '1',
value: 'a'
}, {
title: '待支付',
key: '2',
value: 'b'
}, {
title: '已取消',
key: '3',
value: 'c'
}]);
const orderList = ref([
{
id: 1,
name: '阿忆妞妞1',
phone: '138****8888',
price: 1200,
remain_time: 1000,
status: 'no-pay',
},
{
id: 2,
name: '阿忆妞妞2',
phone: '138****8888',
price: 1200,
remain_time: 100,
status: 'apply',
},
{
id: 3,
name: '阿忆妞妞3',
phone: '138****8888',
price: 1200,
remain_time: 100,
status: 'enable',
},
{
id: 4,
name: '阿忆妞妞4',
phone: '138****8888',
price: 1200,
remain_time: 100,
status: 'cancel',
},
])
const show_pay = ref(false);
const payData = ref({});
const userInfo = ref({
...
...
@@ -118,19 +60,6 @@ const userInfo = ref({
phone: ''
});
const tab_status = computed(() => {
switch (tab_index.value) {
case '0':
return 'all'
case '1':
return 'in';
case '2':
return 'pp';
case '3':
return 'ca';
}
});
onMounted(async () => {
// 获取用户信息
const { code, data } = await showMyInfoAPI();
...
...
@@ -141,13 +70,6 @@ onMounted(async () => {
phone: data.wxapp_user_phone
}
}
// 默认勾选栏目
let params = getCurrentPageParam();
if (params.tab_index) {
tab_index.value = params.tab_index;
}
//
console.warn('tab_status', tab_status.value);
});
const onPay = ({ id, remain_time }) => {
...
...
@@ -178,13 +100,6 @@ const goToEdit = async () => {
});
}
}
const onTabClick = ({ title, paneKey, disabled }) => {
tab_index.value = paneKey;
// console.warn(title, paneKey, tabList.value[paneKey]);
// console.warn(tab_index.value);
console.warn(tab_status.value);
}
</script>
<script>
...
...
@@ -199,18 +114,29 @@ export default {
scrollStyle() {
return {
height: this.indexCoverHeight + 'px',
// paddingBottom: 50 + 'px',
};
},
},
async onShow () {
Taro.showLoading({ mask: true, title: "加载中..." })
// 获取活动和轮播信息
const { code, data } = await myOrderAPI({ page: this.page, limit: this.limit, pay_type: this.tab_index });
if (code) {
this.order_list = data;
this.page = this.page + 1;
Taro.hideLoading()
}
// 获取系统参数
const sysData = await sysParamAPI();
if (sysData.code) {
this.sys_data = sysData.data;
}
},
onHide () { // 离开当前页面
this.page =
0
;
this.page =
1
;
this.flag = true;
},
mounted () {
Taro.showLoading({
title: '加载中',
});
// 设置首页封面高度
const windowHeight = wx.getSystemInfoSync().windowHeight;
// 处理切换显示白屏问题
...
...
@@ -233,42 +159,68 @@ export default {
console.warn('加载完成');
}
});
// 默认勾选栏目
let params = getCurrentPageParam();
if (params.tab_index) {
this.tab_index = params.tab_index;
}
},
data() {
return {
showContent: false,
indexCoverHeight: 0,
order_list: [],
sys_data: {},
flag: true,
page:
0
,
page:
1
,
limit: 10,
tab_index: 'all',
// 房间状态(9=已入住,2=已取消,3=未支付,5=已支付)
tabList: ([{
title: '全部订单',
key: 'all',
}, {
title: '待入住',
key: '5',
}, {
title: '待支付',
key: '3',
}, {
title: '已取消',
key: '2',
}])
};
},
methods: {
onTabClick ({ title, paneKey, disabled }) {
this.tab_index = paneKey;
this.order_list = [];
this.page = 1;
this.flag = true;
this.getList();
},
onScrollToLower () {
// if(!this.flag){
// return
// }
// this.flag = false;
// this.getList();
console.warn('onScrollToLower');
if(!this.flag){
return
}
this.flag = false;
this.getList();
},
async getList () {
// // 获取推荐活动列表
// const { code, data } = await activityHomeAPI({ page: this.page, limit: this.limit });
// if (code) {
// if (data.activity_list.length) {
// // 绑定服务器时间,判断状态
// data.activity_list.forEach(item => {
// item.server_time = data.server_time;
// });
// this.activity_list = this.activity_list.concat(data.activity_list);
// this.page = this.page + 1;
// this.flag = true;
// } else {
// Toast('没有数据')
// }
// }
// }
// 获取列表
const { code, data } = await myOrderAPI({ page: this.page, limit: this.limit, pay_type: this.tab_index });
if (code) {
if (data.length) {
this.order_list = this.order_list.concat(data);
this.page = this.page + 1;
this.flag = true;
} else {
Taro.showToast({
title: '没有更多了',
icon: 'none'
});
}
}
},
}
};
...
...
Please
register
or
login
to post a comment