hbsmUniapp/src/pagesShop/pages/shopRefund/list.vue
2025-08-28 14:47:28 +08:00

294 lines
5.8 KiB
Vue

<script setup lang="ts">
import { onLoad, onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
import useZPaging from '@/uni_modules/z-paging/components/z-paging/js/hooks/useZPaging.js'
import { nextTick, ref } from 'vue'
import type { TabItem } from '@/types/global'
import { getOrderRefundListApi } from '@/api/order'
import { fullUrl } from '@/utils/common'
import type { orderRefundListResult } from '@/types/order'
import { pageUrl } from '@/utils/constants'
const paging = ref()
useZPaging(paging)
const props = defineProps<{
status: string
}>()
const tabList = ref<TabItem[]>([
{ name: '全部', value: '' },
{ name: '待处理', value: 1 },
])
const dataList = ref<orderRefundListResult[]>([])
const queryList = (page: number, page_size: number) => {
const params = {
page,
page_size,
status: tabList.value[tabIndex.value].value,
}
getOrderRefundListApi(params).then((res) => {
paging.value.complete(res.result.data)
})
}
const tabIndex = ref(Number(props.status) || 0)
const tabsChange = (index: number) => {
tabIndex.value = index
paging.value.refresh()
}
onShow(() => {
nextTick(() => {
paging.value.refresh()
})
})
</script>
<template>
<view class="list">
<z-paging
ref="paging"
v-model="dataList"
use-page-scroll
@query="queryList"
:safe-area-inset-bottom="true"
:auto-show-back-to-top="true"
:auto="false"
>
<template #top>
<z-tabs
:list="tabList"
@change="tabsChange"
:current="tabIndex"
:badge-style="{ 'background-color': '#c3c3c3' }"
/>
</template>
<view class="order">
<view class="card" v-for="(item, index) in dataList" :key="index">
<view class="status">
<text class="date">{{ item.create_time }}</text>
<text class="text">{{ item.status_text }}</text>
</view>
<navigator
class="goods"
hover-class="none"
:url="`${pageUrl['order-refund-detail']}?id=${item.id}&data=${JSON.stringify(item)}`"
>
<image class="cover" :src="fullUrl(item.detail.image)"></image>
<view class="meta">
<view class="name ellipsis">{{ item.detail.goods_name }}</view>
<view class="meta-spec">{{ item.detail.spec }}</view>
<view class="meta-quantity">x{{ item.refund_num }}</view>
</view>
</navigator>
</view>
<!-- 占位符 -->
<view style="padding-bottom: 10rpx"></view>
</view>
</z-paging>
</view>
</template>
<style lang="scss">
.list {
background-color: #f6f6f6;
}
.order {
height: 100%;
display: flex;
flex-direction: column;
background-color: #f6f6f6;
.card {
min-height: 100rpx;
padding: 20rpx;
margin: 20rpx 20rpx 0;
border-radius: 10rpx;
background-color: #fff;
&:last-child {
padding-bottom: 40rpx;
}
}
.status {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
color: #999;
margin-bottom: 15rpx;
.date {
color: #666;
flex: 1;
}
.text {
color: red;
}
.primary {
color: #ff9240;
}
.icon-delete {
line-height: 1;
margin-left: 10rpx;
padding-left: 10rpx;
border-left: 1rpx solid #e3e3e3;
}
}
.goods {
display: flex;
margin-bottom: 20rpx;
.cover {
width: 170rpx;
height: 170rpx;
margin-right: 20rpx;
border-radius: 10rpx;
overflow: hidden;
position: relative;
}
.quantity {
position: absolute;
bottom: 0;
right: 0;
line-height: 1;
padding: 6rpx 4rpx 6rpx 8rpx;
font-size: 24rpx;
color: #fff;
border-radius: 10rpx 0 0 0;
background-color: rgba(0, 0, 0, 0.6);
}
.meta {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
&-spec {
font-size: 24rpx;
color: #999;
margin-top: 10rpx;
max-width: 90%;
}
&-quantity {
position: absolute;
right: 20px;
font-size: 24rpx;
color: #9e9c9c;
}
}
.name {
font-size: 26rpx;
color: #444;
max-width: 90%;
}
.type {
line-height: 1.8;
padding: 0 15rpx;
margin-top: 10rpx;
font-size: 24rpx;
align-self: flex-start;
border-radius: 4rpx;
color: #888;
background-color: #f7f7f8;
}
.more {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
font-size: 22rpx;
color: #333;
}
}
.payment {
display: flex;
// justify-content: flex-end;
align-items: center;
line-height: 1;
padding: 20rpx 0;
text-align: right;
color: #999;
font-size: 28rpx;
.quantity {
font-size: 24rpx;
margin-right: 16rpx;
}
.amount {
color: #444;
margin-left: 6rpx;
}
.symbol {
font-size: 20rpx;
}
}
.action {
display: flex;
justify-content: flex-end;
align-items: center;
padding-top: 20rpx;
.pay-time {
font-size: 24rpx;
color: #999;
margin-right: 20rpx;
}
.countdown {
font-size: 24rpx;
color: #999;
margin-left: auto;
display: flex;
}
.button {
width: 130rpx;
height: 60rpx;
display: flex;
justify-content: center;
align-items: center;
margin-left: 20rpx;
border-radius: 60rpx;
font-size: 26rpx;
color: #444;
}
.secondary {
color: #ff5f3c;
border-color: #ff5f3c;
}
.primary {
color: #fff;
background-color: #ff5f3c;
}
}
.loading-text {
text-align: center;
font-size: 28rpx;
color: #666;
padding: 20rpx 0;
}
}
</style>