327 lines
8.1 KiB
Vue
327 lines
8.1 KiB
Vue
<template>
|
|
<view class="page-content">
|
|
<nut-sticky>
|
|
<nut-tabs v-model="current_tab_idx" background="#fff">
|
|
<template #titles>
|
|
<div class="title-list">
|
|
<view v-for="(item,idx) in tabs_config" :key="idx" class="title-item"
|
|
:class="{ 'tabs-active': idx === current_tab_idx }" @click="onChangeTab(item,idx)">
|
|
<view class="nut-tabs__titles-item__text">
|
|
{{item.title}}
|
|
</view>
|
|
<view class="item__line" />
|
|
</view>
|
|
</div>
|
|
</template>
|
|
</nut-tabs>
|
|
</nut-sticky>
|
|
|
|
<z-paging ref="paging" :fixed="false" style="height: 88vh;" class="order-list" v-model="dataList"
|
|
@query="queryList">
|
|
<view class="order-inner" v-for="(order,index) in dataList" :key="index">
|
|
<view class="order-inner-header">
|
|
<nut-tag v-if="order.order_type == 1" plain type="primary">房间订单</nut-tag>
|
|
<nut-tag v-else="order.order_type == 2" plain type="warning">商品订单</nut-tag>
|
|
<nut-tag v-if="order.order_type == 1" custom-color="#ffc209">{{order?.rooms?.room_name}}</nut-tag>
|
|
<nut-tag plain type="danger" v-if="order?.status?.value == 1">{{order?.status?.text}}</nut-tag>
|
|
<nut-tag plain type="success"
|
|
v-else-if="order?.status?.value == 2">{{order?.status?.text}}</nut-tag>
|
|
</view>
|
|
<view class="goods-info-row" v-if="order.order_type == 1 && order?.fee_type?.value != 0">
|
|
<view class="left-text">
|
|
<view class="goods-name">
|
|
<nut-tag plain custom-color="#fa2400">{{order?.fee_type?.text}}</nut-tag>
|
|
<text style="margin-left: 10rpx;"
|
|
v-if="order?.fee_type?.value == 0 || order?.fee_type?.value == 3"></text>
|
|
<text style="margin-left: 10rpx;"
|
|
v-else-if="order?.fee_type?.value == 1 || order?.fee_type?.value == 2 ">{{order?.fee_combo_name}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="price" v-if="order?.fee_type?.value == 0 || order?.fee_type?.value == 3">
|
|
{{order?.fee_amount}}
|
|
</view>
|
|
<view class="price" v-else-if="order?.fee_type?.value == 1 || order?.fee_type?.value == 2 ">
|
|
{{order?.fee_combo_price}}
|
|
</view>
|
|
<view class="goods-pay-status">
|
|
{{order?.fee_pay_status?.text}}
|
|
</view>
|
|
</view>
|
|
|
|
<view class="goods-info-row" v-if="order.over_often>0">
|
|
<view class="left-text">
|
|
<view class="goods-name">
|
|
<nut-tag plain custom-color="#fa2400">超时</nut-tag>
|
|
<text style="margin-left: 10rpx;">{{order?.over_often}}小时</text>
|
|
</view>
|
|
</view>
|
|
<view class="price">
|
|
{{order?.over_amount}}
|
|
</view>
|
|
<view class="goods-pay-status">
|
|
{{order?.over_pay_status?.text}}
|
|
</view>
|
|
</view>
|
|
<view class="goods-info-row" v-for="(goods,iidx) in order.goods" :key="iidx">
|
|
<view class="left-text">
|
|
<view class="goods-name">
|
|
<nut-tag plain custom-color="#fa2400">{{goods.goods_type_name}}</nut-tag>
|
|
<text style="margin-left: 10rpx;">{{goods.goods_name}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="price">
|
|
{{goods?.goods_price}}
|
|
</view>
|
|
<view class="goods-pay-status">
|
|
{{goods?.goods_pay_status_txt}}
|
|
</view>
|
|
</view>
|
|
<view class="footer">
|
|
<view class="order-inner-price">
|
|
<view>优惠:<nut-price :price="order.discount_amount" size="normal" :need-symbol="true" /></view>
|
|
<view>总计:<nut-price :price="order.total_price" size="normal" :need-symbol="true" /></view>
|
|
</view>
|
|
<view v-if="order.remarks" style="padding-left:20rpx;font-size: 26rpx;">备注</view>
|
|
<view v-if="order.remarks" class="remarks">
|
|
{{order.remarks}}
|
|
</view>
|
|
<view class="order-inner-price">
|
|
<view style="color: rgba(0, 0, 0, .5);font-size: 24rpx;">订单时间:{{order.create_time}}</view>
|
|
<view style="color: rgba(0, 0, 0, .5);font-size: 24rpx;">员工:{{order?.user?.staff_name}}</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
</view>
|
|
</z-paging>
|
|
</view>
|
|
</template>
|
|
<script setup>
|
|
import {
|
|
onMounted,
|
|
reactive,
|
|
ref
|
|
} from 'vue';
|
|
import {
|
|
onLoad,
|
|
onShow
|
|
} from '@dcloudio/uni-app';
|
|
import {
|
|
navigateTo,
|
|
} from '@/utils/helper';
|
|
import {
|
|
fetchOrderList,
|
|
} from '@/api/index';
|
|
|
|
// 默认tab
|
|
const current_tab_idx = ref(0);
|
|
// 定义tab切换
|
|
const tabs_config = [
|
|
|
|
{
|
|
title: '今日',
|
|
status: 'today'
|
|
},
|
|
{
|
|
title: '昨日',
|
|
status: 'yesterday'
|
|
},
|
|
{
|
|
title: '当月',
|
|
status: 'month'
|
|
},
|
|
{
|
|
title: '全部',
|
|
status: 'all'
|
|
},
|
|
|
|
]
|
|
// 订单列表数据
|
|
const dataList = ref([]);
|
|
// zp
|
|
const paging = ref(null);
|
|
|
|
// tab切换
|
|
const onChangeTab = (item, idx) => {
|
|
current_tab_idx.value = idx
|
|
paging.value.reload();
|
|
}
|
|
|
|
// // 跳转详情页面
|
|
// const navigateToDetail = (id) => {
|
|
// console.log(id);
|
|
// if (!id) {
|
|
// console.warn('导航ID不能为空')
|
|
// return
|
|
// }
|
|
// uni.navigateTo({
|
|
// url: `/pages/config/shopOrder/detail?id=${encodeURIComponent(id)}`
|
|
// })
|
|
// }
|
|
|
|
// 获取订单列表
|
|
const queryList = (pageNo = 1, pageSize = 10) => {
|
|
console.log(tabs_config[current_tab_idx.value]['status']);
|
|
const params = {
|
|
page: pageNo,
|
|
pageSize: 10,
|
|
status: tabs_config[current_tab_idx.value]['status'],
|
|
}
|
|
fetchOrderList(params).then(res => {
|
|
console.log(res);
|
|
paging.value.complete(res.list);
|
|
}).catch(res => {
|
|
paging.value.complete(false);
|
|
})
|
|
}
|
|
|
|
onLoad((options) => {
|
|
current_tab_idx.value = parseInt(options.tab)
|
|
})
|
|
|
|
/**
|
|
* 页面显示生命周期钩子
|
|
* 每次页面显示时都会执行
|
|
*/
|
|
onShow(() => {
|
|
// 获取配置
|
|
// getConfig()
|
|
if (paging.value) {
|
|
// paging.value.pageNo = 1;
|
|
paging.value.refresh();
|
|
// paging.value.refreshToPage(1)
|
|
// paging.value.reload();
|
|
}
|
|
})
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
.page-content {
|
|
min-height: 100vh;
|
|
background-color: #f2f3f5;
|
|
}
|
|
|
|
.title-list {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
width: 100%;
|
|
|
|
.title-item {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
position: relative;
|
|
}
|
|
|
|
.tabs-active {
|
|
font-weight: bold;
|
|
color: $tabs-titles-item-active-color;
|
|
opacity: $tabs-titles-item-line-opacity;
|
|
transition: width 0.3s ease;
|
|
|
|
.item__line {
|
|
position: absolute;
|
|
bottom: -10%;
|
|
left: 50%;
|
|
overflow: hidden;
|
|
content: ' ';
|
|
border-radius: $tabs-titles-item-line-border-radius;
|
|
opacity: $tabs-titles-item-line-opacity;
|
|
transition: width 0.3s ease;
|
|
transform: translate(-50%, 0);
|
|
width: $tabs-horizontal-titles-item-active-line-width;
|
|
height: 3px;
|
|
content: ' ';
|
|
background: $tabs-horizontal-tab-line-color;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
.order-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.order-inner {
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: #fff;
|
|
border-radius: 15rpx;
|
|
overflow: hidden;
|
|
margin: 20rpx;
|
|
|
|
.order-inner-header {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
font-size: 24rpx;
|
|
justify-content: space-between;
|
|
line-height: 45rpx;
|
|
padding: 15rpx 20rpx;
|
|
border-bottom: 2rpx solid #f2f3f5;
|
|
}
|
|
|
|
|
|
/* 信息行布局 */
|
|
.goods-info-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 20rpx;
|
|
border-bottom: 2rpx solid #f2f3f5;
|
|
|
|
/* 左侧文字样式 */
|
|
.left-text {
|
|
flex: 1;
|
|
}
|
|
|
|
.goods-name {
|
|
font-size: 26rpx;
|
|
color: #000000;
|
|
display: block;
|
|
}
|
|
|
|
/* 右侧价格样式 */
|
|
.price {
|
|
font-size: 26rpx;
|
|
margin-left: 20rpx;
|
|
align-self: center;
|
|
color: #fa2c19;
|
|
/* 垂直居中在两行文字之间 */
|
|
}
|
|
|
|
.goods-pay-status {
|
|
font-size: 26rpx;
|
|
margin-left: 20rpx;
|
|
align-self: center;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
.footer {
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
.order-inner-price {
|
|
display: flex;
|
|
justify-content: space-evenly;
|
|
padding: 20rpx;
|
|
font-size: 24rpx;
|
|
align-items: center;
|
|
}
|
|
|
|
.remarks {
|
|
padding: 20rpx;
|
|
color: rgba(0, 0, 0, .5);
|
|
font-size: 24rpx;
|
|
}
|
|
}
|
|
}
|
|
</style> |