master
parent
1d811f7eee
commit
71f8571f1a
@ -1,110 +1,109 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 商品列表 -->
|
<!-- 商品列表 -->
|
||||||
<view class="prod-item">
|
<view class="prod-item">
|
||||||
<block v-if="prodList.length">
|
<block v-if="prodList.length">
|
||||||
<block v-for="(prod, key) in prodList" :key="key">
|
<block v-for="(prod, key) in prodList" :key="key">
|
||||||
<view class="prod-items" :data-prodid="prod.prodId" @tap="toProdPage">
|
<view class="prod-items" :data-prodid="prod.prodId" @tap="toProdPage">
|
||||||
<view class="hot-imagecont">
|
<view class="hot-imagecont">
|
||||||
<image :src="prod.pic" class="hotsaleimg" />
|
<image :src="prod.pic" class="hotsaleimg"/>
|
||||||
|
</view>
|
||||||
|
<view class="hot-text">
|
||||||
|
<view class="hotprod-text">
|
||||||
|
{{ prod.prodName }}
|
||||||
</view>
|
</view>
|
||||||
<view class="hot-text">
|
<view class="prod-info">
|
||||||
<view class="hotprod-text">
|
{{ prod.brief }}
|
||||||
{{ prod.prodName }}
|
</view>
|
||||||
</view>
|
<view class="prod-text-info">
|
||||||
<view class="prod-info">
|
<view class="price">
|
||||||
{{ prod.brief }}
|
<text class="symbol">
|
||||||
</view>
|
¥
|
||||||
<view class="prod-text-info">
|
</text>
|
||||||
<view class="price">
|
<text class="big-num">
|
||||||
<text class="symbol">
|
{{ wxs.parsePrice(prod.price)[0] }}
|
||||||
¥
|
</text>
|
||||||
</text>
|
<text class="small-num">
|
||||||
<text class="big-num">
|
.{{ wxs.parsePrice(prod.price)[1] }}
|
||||||
{{ wxs.parsePrice(prod.price)[0] }}
|
</text>
|
||||||
</text>
|
|
||||||
<text class="small-num">
|
|
||||||
.{{ wxs.parsePrice(prod.price)[1] }}
|
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<view v-else class="empty-wrap">
|
</block>
|
||||||
暂无商品数据~
|
<view v-else class="empty-wrap">
|
||||||
</view>
|
暂无商品数据~
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
const wxs = number()
|
const wxs = number()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
getProdList()
|
getProdList()
|
||||||
})
|
})
|
||||||
|
|
||||||
const current = ref(1)
|
const current = ref(1)
|
||||||
const pages = ref(0)
|
const pages = ref(0)
|
||||||
/**
|
/**
|
||||||
* 页面上拉触底事件的处理函数
|
* 页面上拉触底事件的处理函数
|
||||||
*/
|
*/
|
||||||
onReachBottom(() => {
|
onReachBottom(() => {
|
||||||
if (current.value < pages.value) {
|
if (current.value < pages.value) {
|
||||||
current.value = current.value + 1
|
current.value = current.value + 1
|
||||||
getProdList()
|
getProdList()
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const intoView = ref('')
|
|
||||||
const subCategoryList = ref([])
|
|
||||||
|
|
||||||
const prodList = ref([])
|
|
||||||
const isLoaded = ref(false) // 列表是否加载完毕
|
|
||||||
/**
|
|
||||||
* 根据分类id获取商品列表数据
|
|
||||||
*/
|
|
||||||
const getProdList = () => {
|
|
||||||
isLoaded.value = false
|
|
||||||
|
|
||||||
http.request({
|
|
||||||
url: '/prod/prodListByMember',
|
|
||||||
method: 'GET',
|
|
||||||
data: {
|
|
||||||
current: current.value,
|
|
||||||
size: 10,
|
|
||||||
sort: 0,
|
|
||||||
isAllProdType: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(({
|
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
isLoaded.value = true
|
|
||||||
prodList.value = data.current == 1 ? data.records : prodList.value.concat(data.records)
|
|
||||||
current.value = data.current
|
|
||||||
pages.value = data.pages
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const intoView = ref('')
|
||||||
|
const subCategoryList = ref([])
|
||||||
|
|
||||||
/**
|
const prodList = ref([])
|
||||||
* 跳转商品下详情
|
const isLoaded = ref(false) // 列表是否加载完毕
|
||||||
*/
|
/**
|
||||||
const toProdPage = (e) => {
|
* 根据分类id获取商品列表数据
|
||||||
const prodid = e.currentTarget.dataset.prodid
|
*/
|
||||||
if (prodid) {
|
const getProdList = () => {
|
||||||
uni.navigateTo({
|
isLoaded.value = false
|
||||||
url: '/pages/prod/prod?prodid=' + prodid
|
|
||||||
})
|
http.request({
|
||||||
|
url: '/prod/prodListByMember',
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
current: current.value,
|
||||||
|
size: 10,
|
||||||
|
sort: 0,
|
||||||
|
isAllProdType: true
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.then(({
|
||||||
|
data
|
||||||
|
}) => {
|
||||||
|
isLoaded.value = true
|
||||||
|
prodList.value = data.current == 1 ? data.records : prodList.value.concat(data.records)
|
||||||
|
current.value = data.current
|
||||||
|
pages.value = data.pages
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转商品下详情
|
||||||
|
*/
|
||||||
|
const toProdPage = (e) => {
|
||||||
|
const prodid = e.currentTarget.dataset.prodid
|
||||||
|
if (prodid) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/prod/prod?prodid=' + prodid
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@use './member.scss';
|
@use './member.scss';
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
Reference in new issue