2025-01-21 03:43:27 +00:00
|
|
|
|
<script setup>
|
2025-03-06 09:03:31 +00:00
|
|
|
|
import {ref} from 'vue'
|
|
|
|
|
import {goodStore} from "@/stores/goods"
|
2025-01-22 08:56:44 +00:00
|
|
|
|
import DetailPopup from '../DetailPopup/index.vue'
|
2025-02-14 07:01:20 +00:00
|
|
|
|
import WaterfallFlow from '@/components/waterfallFlow/index.vue'
|
2025-03-06 09:03:31 +00:00
|
|
|
|
|
2025-01-22 02:44:43 +00:00
|
|
|
|
const {
|
|
|
|
|
itemList,
|
|
|
|
|
pageRef,
|
|
|
|
|
currentItem,
|
|
|
|
|
loading: storeLoading,
|
|
|
|
|
getArtworkList,
|
|
|
|
|
} = goodStore()
|
|
|
|
|
|
|
|
|
|
const localState = ref({
|
|
|
|
|
finished: false,
|
|
|
|
|
refreshing: false,
|
|
|
|
|
showDetail: false,
|
|
|
|
|
showHeight: ''
|
|
|
|
|
})
|
|
|
|
|
// 加载更多
|
|
|
|
|
const loadMore = async () => {
|
|
|
|
|
pageRef.value.page++
|
2025-03-06 09:03:31 +00:00
|
|
|
|
const {finished} = await getArtworkList()
|
2025-01-22 02:44:43 +00:00
|
|
|
|
localState.value.finished = finished
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 刷新
|
|
|
|
|
const onRefresh = async () => {
|
2025-01-22 01:44:44 +00:00
|
|
|
|
try {
|
2025-01-22 02:44:43 +00:00
|
|
|
|
localState.value.refreshing = true
|
|
|
|
|
localState.value.finished = false
|
2025-03-06 09:03:31 +00:00
|
|
|
|
const {finished} = await getArtworkList(true)
|
2025-01-22 02:44:43 +00:00
|
|
|
|
localState.value.finished = finished
|
2025-01-22 01:44:44 +00:00
|
|
|
|
} finally {
|
2025-01-22 02:44:43 +00:00
|
|
|
|
localState.value.refreshing = false
|
2025-01-20 08:17:49 +00:00
|
|
|
|
}
|
2025-01-22 02:44:43 +00:00
|
|
|
|
}
|
|
|
|
|
// 打开详情
|
|
|
|
|
const openShow = async (item) => {
|
2025-01-23 03:08:54 +00:00
|
|
|
|
localState.value.showDetail = true
|
2025-01-22 02:44:43 +00:00
|
|
|
|
currentItem.value = item
|
|
|
|
|
}
|
2025-03-06 09:03:31 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将数字格式化为"250XX"格式,其中XX是两位数
|
|
|
|
|
* @param {number} num - 要格式化的数字
|
|
|
|
|
* @return {string} - 格式化后的字符串
|
|
|
|
|
*/
|
|
|
|
|
function formatNumber(num) {
|
|
|
|
|
// 确保输入是有效数字
|
|
|
|
|
if (typeof num !== 'number' && isNaN(Number(num))) {
|
|
|
|
|
throw new Error('输入必须是有效数字');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 转换为数字类型(以防输入是字符串数字)
|
|
|
|
|
const number = Number(num);
|
|
|
|
|
|
|
|
|
|
// 数字部分格式化为两位数,不足补0
|
|
|
|
|
const formattedNum = number.toString().padStart(2, '0');
|
|
|
|
|
|
|
|
|
|
// 添加前缀"250"并返回结果
|
|
|
|
|
return `250${formattedNum}`;
|
|
|
|
|
}
|
2025-01-20 05:59:50 +00:00
|
|
|
|
</script>
|
2025-01-22 01:44:44 +00:00
|
|
|
|
|
2025-01-20 05:59:50 +00:00
|
|
|
|
<template>
|
2025-01-20 08:17:49 +00:00
|
|
|
|
<div class="px-[16px] pt-[16px]">
|
2025-01-22 01:44:44 +00:00
|
|
|
|
<van-pull-refresh
|
2025-01-22 02:44:43 +00:00
|
|
|
|
v-model="localState.refreshing"
|
2025-01-23 04:05:13 +00:00
|
|
|
|
:success-duration="700"
|
2025-01-22 02:44:43 +00:00
|
|
|
|
@refresh="onRefresh"
|
2025-01-22 01:44:44 +00:00
|
|
|
|
>
|
2025-01-23 04:05:13 +00:00
|
|
|
|
<template #success>
|
2025-03-06 09:03:31 +00:00
|
|
|
|
<van-icon name="success"/>
|
|
|
|
|
<span>{{ $t('home.refresh_show') }}</span>
|
2025-01-23 04:05:13 +00:00
|
|
|
|
</template>
|
2025-01-22 01:44:44 +00:00
|
|
|
|
<van-list
|
2025-01-22 02:44:43 +00:00
|
|
|
|
v-model:loading="storeLoading"
|
|
|
|
|
:finished="localState.finished"
|
2025-02-12 06:34:05 +00:00
|
|
|
|
:finished-text="$t('home.finished_text')"
|
2025-01-22 02:44:43 +00:00
|
|
|
|
@load="loadMore"
|
2025-01-22 01:44:44 +00:00
|
|
|
|
>
|
2025-02-06 08:29:17 +00:00
|
|
|
|
<div class="w-full flex gap-[16px]">
|
2025-03-06 09:03:31 +00:00
|
|
|
|
<WaterfallFlow :items="itemList" :column-count="2">
|
|
|
|
|
<template #default="{ item, index }">
|
2025-02-14 02:45:06 +00:00
|
|
|
|
<div
|
|
|
|
|
@click="openShow(item)"
|
|
|
|
|
class="w-full"
|
|
|
|
|
>
|
|
|
|
|
<div class="relative w-full">
|
2025-03-06 09:03:31 +00:00
|
|
|
|
<img
|
|
|
|
|
:src="item.artwork?.hdPic"
|
|
|
|
|
class="w-full object-cover rounded-4px"
|
|
|
|
|
/>
|
2025-03-07 01:23:18 +00:00
|
|
|
|
<div
|
2025-03-06 09:04:44 +00:00
|
|
|
|
class="absolute rounded-2px overflow-hidden line-height-12px left-[8px] top-[8px] h-[17px] w-[60px] flex items-center justify-center bg-[#2b53ac] text-[12px] text-[#fff]"
|
2025-02-14 02:45:06 +00:00
|
|
|
|
>
|
2025-03-06 09:03:31 +00:00
|
|
|
|
Lot{{ formatNumber(item.index) }}
|
2025-02-14 02:45:06 +00:00
|
|
|
|
</div>
|
2025-01-23 03:08:54 +00:00
|
|
|
|
</div>
|
2025-03-06 09:03:31 +00:00
|
|
|
|
<div class="pt-[8px]">
|
2025-02-14 02:45:06 +00:00
|
|
|
|
<div class="text-[14px] text-[#000000] leading-[20px]">
|
2025-03-06 09:03:31 +00:00
|
|
|
|
{{ item?.artwork?.name }} | {{ item?.artwork?.artistName }}
|
2025-02-14 02:45:06 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="mt-[4px] text-[12px] text-[#575757]">
|
2025-03-06 09:03:31 +00:00
|
|
|
|
{{ $t('home.start_price') }}:{{ item?.startPrice ?? 0 }}
|
2025-02-14 02:45:06 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
v-if="item.soldPrice"
|
|
|
|
|
class="mt-[4px] text-[12px] text-[#b58047]"
|
|
|
|
|
>
|
2025-03-06 09:03:31 +00:00
|
|
|
|
{{ $t('home.close_price') }}:{{ item?.soldPrice ?? 0 }}
|
2025-02-14 02:45:06 +00:00
|
|
|
|
</div>
|
2025-01-23 03:08:54 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2025-02-14 02:45:06 +00:00
|
|
|
|
</WaterfallFlow>
|
2025-01-20 08:17:49 +00:00
|
|
|
|
</div>
|
|
|
|
|
</van-list>
|
|
|
|
|
</van-pull-refresh>
|
2025-02-13 03:53:24 +00:00
|
|
|
|
<DetailPopup v-model:show="localState.showDetail" :detailInfo="currentItem"></DetailPopup>
|
2025-01-20 08:17:49 +00:00
|
|
|
|
</div>
|
2025-01-22 02:44:43 +00:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.content {
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
|
}
|
|
|
|
|
</style>
|