You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.6 KiB
77 lines
1.6 KiB
10 months ago
|
<template>
|
||
|
<su-swiper
|
||
|
:list="imgList"
|
||
|
:dotStyle="'tag'"
|
||
|
imageMode="widthFix"
|
||
|
dotCur="bg-mask-40"
|
||
|
:seizeHeight="300"
|
||
|
:autoplay="true"
|
||
|
:interval="3000"
|
||
|
/>
|
||
|
</template>
|
||
|
|
||
|
<-- <script setup>
|
||
|
import { computed } from 'vue';
|
||
|
import sheep from '@/sheep';
|
||
|
|
||
|
|
||
|
const imgList = computed(() =>
|
||
|
props.data.list.map((item) => ({
|
||
|
...item,
|
||
|
src: sheep.$url.cdn(item.src),
|
||
|
poster: sheep.$url.cdn(item.poster),
|
||
|
})),
|
||
|
);
|
||
|
</script> -->
|
||
|
|
||
|
<script setup>
|
||
|
import sheep from '@/sheep';
|
||
|
import { onLoad } from '@dcloudio/uni-app';
|
||
|
import { reactive } from 'vue';
|
||
|
|
||
|
const state = reactive({
|
||
|
imgList: [],
|
||
|
});
|
||
|
// 获取公告列表
|
||
|
async function getNoticeList() {
|
||
|
let { code, data: { data }, msg } = await sheep.$api.announcement.list();
|
||
|
if (code === 1) {
|
||
|
state.noticeData = data;
|
||
|
} else {
|
||
|
state.noticeData = [];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function onDetail(orderId) {
|
||
|
sheep.$router.go('/pages/announcement/detail', {
|
||
|
id: orderId,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
onLoad(async (options) => {
|
||
|
// 非法参数
|
||
|
if (!options.id) {
|
||
|
state.imgList = [];
|
||
|
return;
|
||
|
}
|
||
|
state.goodsId = options.id;
|
||
|
// 加载商品信息
|
||
|
sheep.$api.goods.detail(state.goodsId).then((res) => {
|
||
|
state.skeletonLoading = false;
|
||
|
if (res.code === 1) {
|
||
|
state.goodsInfo = res.data;
|
||
|
state.goodsSwiper = formatGoodsSwiper(state.goodsInfo.images);
|
||
|
} else {
|
||
|
// 未找到商品
|
||
|
state.goodsInfo = null;
|
||
|
}
|
||
|
});
|
||
|
const { code, data } = await sheep.$api.coupon.listByGoods(state.goodsId);
|
||
|
if (code === 1) {
|
||
|
state.couponInfo = data;
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
<style></style>
|