2024-01-13 11:08:55 +00:00
|
|
|
|
<!-- 我的拼团订单列表 -->
|
2022-11-22 07:45:36 +00:00
|
|
|
|
<template>
|
|
|
|
|
<s-layout title="我的拼团">
|
|
|
|
|
<su-sticky bgColor="#fff">
|
|
|
|
|
<su-tabs
|
|
|
|
|
:list="tabMaps"
|
|
|
|
|
:scrollable="false"
|
|
|
|
|
@change="onTabsChange"
|
|
|
|
|
:current="state.currentTab"
|
|
|
|
|
></su-tabs>
|
|
|
|
|
</su-sticky>
|
2024-01-13 11:08:55 +00:00
|
|
|
|
<s-empty v-if="state.pagination.total === 0" icon="/static/goods-empty.png" />
|
2022-11-22 07:45:36 +00:00
|
|
|
|
<view v-if="state.pagination.total > 0">
|
|
|
|
|
<view
|
|
|
|
|
class="order-list-card-box bg-white ss-r-10 ss-m-t-14 ss-m-20"
|
2024-01-13 11:08:55 +00:00
|
|
|
|
v-for="record in state.pagination.list"
|
|
|
|
|
:key="record.id"
|
2022-11-22 07:45:36 +00:00
|
|
|
|
>
|
2023-02-07 07:48:22 +00:00
|
|
|
|
<view class="order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20">
|
2024-01-13 11:08:55 +00:00
|
|
|
|
<view class="order-no">拼团编号:{{ record.id }}</view>
|
|
|
|
|
<view class="ss-font-26" :class="formatOrderColor(record)">
|
|
|
|
|
{{ tabMaps.find((item) => item.value === record.status).name }}
|
2024-01-10 15:12:11 +00:00
|
|
|
|
</view>
|
2023-02-07 07:48:22 +00:00
|
|
|
|
</view>
|
2024-01-13 11:08:55 +00:00
|
|
|
|
<view class="border-bottom">
|
2022-11-22 07:45:36 +00:00
|
|
|
|
<s-goods-item
|
2024-01-13 11:08:55 +00:00
|
|
|
|
:img="record.picUrl"
|
|
|
|
|
:title="record.spuName"
|
|
|
|
|
:price="record.combinationPrice"
|
2022-11-22 07:45:36 +00:00
|
|
|
|
>
|
|
|
|
|
<template #groupon>
|
|
|
|
|
<view class="ss-flex">
|
2024-01-13 11:08:55 +00:00
|
|
|
|
<view class="sales-title"> {{ record.userSize }} 人团 </view>
|
2022-11-22 07:45:36 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
</s-goods-item>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="order-card-footer ss-flex ss-row-right ss-p-x-20">
|
|
|
|
|
<button
|
|
|
|
|
class="detail-btn ss-reset-button"
|
2024-01-17 11:45:39 +00:00
|
|
|
|
@tap="sheep.$router.go('/pages/order/detail', { id: record.orderId })"
|
2022-11-22 07:45:36 +00:00
|
|
|
|
>
|
|
|
|
|
订单详情
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
2023-02-07 07:48:22 +00:00
|
|
|
|
class="tool-btn ss-reset-button"
|
2024-01-13 11:08:55 +00:00
|
|
|
|
:class="{ 'ui-BG-Main-Gradient': record.status === 0 }"
|
|
|
|
|
@tap="sheep.$router.go('/pages/activity/groupon/detail', { id: record.id })"
|
2022-11-22 07:45:36 +00:00
|
|
|
|
>
|
2024-01-13 11:08:55 +00:00
|
|
|
|
{{ record.status === 0 ? '邀请拼团' : '拼团详情' }}
|
2022-11-22 07:45:36 +00:00
|
|
|
|
</button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<uni-load-more
|
|
|
|
|
v-if="state.pagination.total > 0"
|
|
|
|
|
:status="state.loadStatus"
|
|
|
|
|
:content-text="{
|
|
|
|
|
contentdown: '上拉加载更多',
|
|
|
|
|
}"
|
2024-01-10 15:12:11 +00:00
|
|
|
|
@tap="loadMore"
|
2022-11-22 07:45:36 +00:00
|
|
|
|
/>
|
|
|
|
|
</s-layout>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-01-13 11:08:55 +00:00
|
|
|
|
import { reactive } from 'vue';
|
2022-11-22 07:45:36 +00:00
|
|
|
|
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
|
|
|
|
|
import sheep from '@/sheep';
|
|
|
|
|
import _ from 'lodash';
|
2024-01-13 11:08:55 +00:00
|
|
|
|
import {formatOrderColor} from "@/sheep/hooks/useGoods";
|
|
|
|
|
import { resetPagination } from '@/sheep/util';
|
|
|
|
|
import CombinationApi from '@/sheep/api/promotion/combination';
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
|
|
|
|
// 数据
|
|
|
|
|
const state = reactive({
|
|
|
|
|
currentTab: 0,
|
|
|
|
|
pagination: {
|
2024-01-10 15:12:11 +00:00
|
|
|
|
list: [],
|
2024-01-13 11:08:55 +00:00
|
|
|
|
total: 0,
|
2024-01-10 15:12:11 +00:00
|
|
|
|
pageNo: 1,
|
2024-01-13 11:08:55 +00:00
|
|
|
|
pageSize: 5,
|
2022-11-22 07:45:36 +00:00
|
|
|
|
},
|
|
|
|
|
loadStatus: '',
|
|
|
|
|
deleteOrderId: 0,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const tabMaps = [
|
|
|
|
|
{
|
|
|
|
|
name: '全部',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '进行中',
|
2024-01-10 15:12:11 +00:00
|
|
|
|
value: 0,
|
2022-11-22 07:45:36 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '拼团成功',
|
2024-01-10 15:12:11 +00:00
|
|
|
|
value: 1,
|
2022-11-22 07:45:36 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '拼团失败',
|
2024-01-10 15:12:11 +00:00
|
|
|
|
value: 2,
|
2022-11-22 07:45:36 +00:00
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// 切换选项卡
|
|
|
|
|
function onTabsChange(e) {
|
2024-01-13 11:08:55 +00:00
|
|
|
|
resetPagination(state.pagination);
|
2022-11-22 07:45:36 +00:00
|
|
|
|
state.currentTab = e.index;
|
|
|
|
|
getGrouponList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取订单列表
|
2024-01-10 15:12:11 +00:00
|
|
|
|
async function getGrouponList() {
|
2022-11-22 07:45:36 +00:00
|
|
|
|
state.loadStatus = 'loading';
|
2024-01-13 11:08:55 +00:00
|
|
|
|
const { code, data } = await CombinationApi.getCombinationRecordPage({
|
2024-01-10 15:12:11 +00:00
|
|
|
|
pageNo: state.pagination.pageNo,
|
|
|
|
|
pageSize: state.pagination.pageSize,
|
|
|
|
|
status: tabMaps[state.currentTab].value,
|
2022-11-22 07:45:36 +00:00
|
|
|
|
});
|
2024-01-10 15:12:11 +00:00
|
|
|
|
if (code !== 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
state.pagination.list = _.concat(state.pagination.list, data.list)
|
|
|
|
|
state.pagination.total = data.total;
|
2024-01-13 11:08:55 +00:00
|
|
|
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
2022-11-22 07:45:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onLoad((options) => {
|
|
|
|
|
if (options.type) {
|
|
|
|
|
state.currentTab = options.type;
|
|
|
|
|
}
|
|
|
|
|
getGrouponList();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 加载更多
|
2024-01-10 15:12:11 +00:00
|
|
|
|
function loadMore() {
|
2024-01-13 11:08:55 +00:00
|
|
|
|
if (state.loadStatus === 'noMore') {
|
|
|
|
|
return;
|
2022-11-22 07:45:36 +00:00
|
|
|
|
}
|
2024-01-13 11:08:55 +00:00
|
|
|
|
state.pagination.pageNo++;
|
|
|
|
|
getGrouponList();
|
2022-11-22 07:45:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 上拉加载更多
|
|
|
|
|
onReachBottom(() => {
|
2024-01-10 15:12:11 +00:00
|
|
|
|
loadMore();
|
2022-11-22 07:45:36 +00:00
|
|
|
|
});
|
2024-01-13 11:08:55 +00:00
|
|
|
|
|
2022-11-22 07:45:36 +00:00
|
|
|
|
//下拉刷新
|
|
|
|
|
onPullDownRefresh(() => {
|
|
|
|
|
getGrouponList();
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
uni.stopPullDownRefresh();
|
|
|
|
|
}, 800);
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.swiper-box {
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
.swiper-item {
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.order-list-card-box {
|
|
|
|
|
.order-card-header {
|
|
|
|
|
height: 80rpx;
|
|
|
|
|
|
|
|
|
|
.order-no {
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.order-card-footer {
|
|
|
|
|
height: 100rpx;
|
|
|
|
|
|
|
|
|
|
.detail-btn {
|
|
|
|
|
width: 210rpx;
|
|
|
|
|
height: 66rpx;
|
|
|
|
|
border: 2rpx solid #dfdfdf;
|
|
|
|
|
border-radius: 33rpx;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
color: #999999;
|
|
|
|
|
margin-right: 20rpx;
|
|
|
|
|
}
|
2023-02-07 07:48:22 +00:00
|
|
|
|
.tool-btn {
|
|
|
|
|
width: 210rpx;
|
|
|
|
|
height: 66rpx;
|
|
|
|
|
border-radius: 33rpx;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
margin-right: 20rpx;
|
|
|
|
|
background: #f6f6f6;
|
|
|
|
|
}
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
|
|
|
|
.invite-btn {
|
|
|
|
|
width: 210rpx;
|
|
|
|
|
height: 66rpx;
|
|
|
|
|
background: linear-gradient(90deg, #fe832a, #ff6600);
|
|
|
|
|
box-shadow: 0px 8rpx 6rpx 0px rgba(255, 104, 4, 0.22);
|
|
|
|
|
border-radius: 33rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.sales-title {
|
|
|
|
|
height: 32rpx;
|
|
|
|
|
background: rgba(#ffe0e2, 0.29);
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
padding: 6rpx 20rpx;
|
|
|
|
|
color: #f7979c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.num-title {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
color: #999999;
|
|
|
|
|
}
|
2023-02-07 07:48:22 +00:00
|
|
|
|
.warning-color {
|
|
|
|
|
color: #faad14;
|
|
|
|
|
}
|
|
|
|
|
.danger-color {
|
|
|
|
|
color: #ff3000;
|
|
|
|
|
}
|
|
|
|
|
.success-color {
|
|
|
|
|
color: #52c41a;
|
|
|
|
|
}
|
2022-11-22 07:45:36 +00:00
|
|
|
|
</style>
|