套餐详情

parent f0b594aa
...@@ -7,3 +7,11 @@ export function getProdDetail(data) { ...@@ -7,3 +7,11 @@ export function getProdDetail(data) {
method: 'GET', method: 'GET',
}); });
} }
// 套餐详情
export function getCollect(data) {
return request({
url: `/sgyrdd/shop/collect?shopId=${data}`,
method: 'GET',
});
}
@font-face { @font-face {
font-family: "iconfont"; /* Project id 4633414 */ font-family: "iconfont"; /* Project id 4633414 */
src: url('//at.alicdn.com/t/c/font_4633414_3k0ybwfc2l1.woff2?t=1722483682262') format('woff2'), src: url('//at.alicdn.com/t/c/font_4633414_jxzjjul419.woff2?t=1722502888587') format('woff2'),
url('//at.alicdn.com/t/c/font_4633414_3k0ybwfc2l1.woff?t=1722483682262') format('woff'), url('//at.alicdn.com/t/c/font_4633414_jxzjjul419.woff?t=1722502888587') format('woff'),
url('//at.alicdn.com/t/c/font_4633414_3k0ybwfc2l1.ttf?t=1722483682262') format('truetype'); url('//at.alicdn.com/t/c/font_4633414_jxzjjul419.ttf?t=1722502888587') format('truetype');
} }
.iconfont { .iconfont {
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-shuangxiajiantou:before {
content: "\e660";
}
.icon-dianzan:before { .icon-dianzan:before {
content: "\e602"; content: "\e602";
} }
......
...@@ -63,14 +63,33 @@ ...@@ -63,14 +63,33 @@
<!-- card-end --> <!-- card-end -->
<view class="rich-text-card"> <view class="rich-text-card">
<text class="title">商品详情</text> <text class="title">商品详情</text>
<rich-text :nodes="'nodes'"></rich-text> <rich-text :nodes="prodInfo.content"></rich-text>
</view> </view>
<view class="rich-text-card"> <view class="rich-text-card">
<text class="title">购买须知</text> <text class="title">购买须知</text>
<rich-text :nodes="'nodes'"></rich-text> <!-- <rich-text :nodes="'nodes'"></rich-text> -->
<view class="rich-more-btn"> <view class="purchase-information" v-if="showRlue">
收起 <view class="purchase-box">
<image src="@/static/shop/more.png"></image> <text class="title">开始时间</text>
<text class="content">{{ prodRlue.createTime }}</text>
</view>
<view class="purchase-box">
<text class="title">结束时间</text>
<text class="content">{{ prodRlue.endTime }}</text>
</view>
<view class="purchase-box">
<text class="title">标签</text>
<text class="content">{{ prodRlue.labelNames }}</text>
</view>
<view class="purchase-box">
<text class="title">规则</text>
<text class="content">{{ prodRlue.rule }}</text>
</view>
</view>
<view class="rich-more-btn" @click="showRlueFn">
{{ showRlue ? '收起' : '展开' }}
<i v-if="showRlue" class="iconfont icon-shuangshangjiantou-"></i>
<i v-else class="iconfont xia icon-shuangxiajiantou"></i>
</view> </view>
</view> </view>
<!-- 使用方法-start --> <!-- 使用方法-start -->
...@@ -102,21 +121,21 @@ ...@@ -102,21 +121,21 @@
<!-- 适用门店 --> <!-- 适用门店 -->
<view class="applicable-stores-card"> <view class="applicable-stores-card">
<text class="title">适用门店</text> <text class="title">适用门店</text>
<text class="goods-name">川心美蛙鱼头火锅(中环广场店)</text> <text class="goods-name">{{ shopInfo.shopName }}</text>
<view class="goods-pf-rs"> <view class="goods-pf-rs">
<text class="goods-fs">4.3</text> <text class="goods-fs">{{ shopInfo.grade }}</text>
<text class="goods-type">火锅</text> <text class="goods-type">火锅</text>
<text class="goods-rs">36/人</text> <!-- <text class="goods-rs">36/人</text> -->
</view> </view>
<text class="distance">距你129m</text> <text class="distance">距你{{ distance }}</text>
<text class="address">后巢乡花果园中环广场3号(M区4栋)3层114号</text> <text class="address">{{ shopInfo.shopAddress }}</text>
</view> </view>
<!-- 适用门店-end --> <!-- 适用门店-end -->
<!-- 底部 --> <!-- 底部 -->
<view class="bottom-operation-bar"> <view class="bottom-operation-bar">
<view class="start"> <view class="start" @click="collectionFn">
<image src="@/static/shop/start.png"></image> <image src="@/static/shop/start.png"></image>
241 {{ shopInfo.privateIntFcount }}
</view> </view>
<view class="start"> <view class="start">
<image src="@/static/shop/share.png"></image> <image src="@/static/shop/share.png"></image>
...@@ -129,45 +148,88 @@ ...@@ -129,45 +148,88 @@
</template> </template>
<script setup> <script setup>
import { getProdDetail } from '@/api/packageDetail'; import { getProdDetail, getCollect } from '@/api/packageDetail';
const swiperList = ref([ import { getStoreInformation } from '@/api/shop';
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg',
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/capybara.jpg',
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg',
]);
const prodInfo = ref({}); const prodInfo = ref({});
const prodRlue = ref({});
const myProdId = ref(''); const myProdId = ref('');
const current = ref(0); const current = ref(0);
const showRlue = ref(true);
const imgUrl = import.meta.env.VITE_APP_IMG_URL; const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const shopInfo = ref({});
const currentLatitudeAndLongitude = ref({});
const shopId = ref('');
onLoad((options) => { onLoad((options) => {
const { prodId } = options; const { prodId } = options;
myProdId.value = prodId; myProdId.value = prodId;
getProdDetailFn(prodId); getProdDetailFn(prodId).then((shopId) => {
getStoreInformationFn(shopId);
});
});
onShow(() => {
// 获取位置
getLocationFn();
}); });
/** /**
* 获取套餐详情 * 获取套餐详情
* @param {String} prodId * @param {String} prodId
*/ */
function getProdDetailFn(prodId) { function getProdDetailFn(prodId) {
getProdDetail(prodId).then((res) => { return new Promise((resolve, reject) => {
getProdDetail(prodId).then((res) => {
if (res.code === 0) {
res.data.data.prod.imgs = res.data.data.prod.imgs.split(',');
res.data.data.prod.imgs.push(res.data.data.prod.pic);
res.data.data.prod.imgs = res.data.data.prod.imgs
.map((item) => {
if (item !== '') {
item = imgUrl + item;
}
return item;
})
.filter((item) => {
return item !== '';
});
prodInfo.value = res.data.data.prod;
prodRlue.value = res.data.data.groupPurchasePackageRule;
shopId.value = res.data.data.prod.shopId;
resolve(res.data.data.prod.shopId);
}
});
});
}
/**
* 获取收藏
*/
function getCollectFn(shopId) {
getCollect(shopId).then((res) => {
if (res.code === 0) { if (res.code === 0) {
console.log('res', res);
res.data.data.prod.imgs = res.data.data.prod.imgs.split(',');
res.data.data.prod.imgs.push(res.data.data.prod.pic);
res.data.data.prod.imgs = res.data.data.prod.imgs
.map((item) => {
if (item !== '') {
item = imgUrl + item;
}
return item;
})
.filter((item) => {
return item !== '';
});
prodInfo.value = res.data.data.prod;
} }
}); });
} }
function collectionFn() {
console.log('shopInfo.value', shopId.value);
getCollectFn(shopId.value);
}
function getLocationFn() {
xma.getLocation({
type: 'wgs84',
success: function (res) {
const myLatitude = currentLatitudeAndLongitude.value.latitude;
const myLongitude = currentLatitudeAndLongitude.value.longitude;
const distance = getDistance(res.latitude, res.longitude, myLatitude, myLongitude, 1);
shopInfo.value.distance = distance;
},
fail: function (err) {
return err;
},
});
}
const showRlueFn = () => {
showRlue.value = !showRlue.value;
};
const handleClick = (e) => { const handleClick = (e) => {
const { index } = e; const { index } = e;
const imgSrc = prodInfo.value.imgs[index]; const imgSrc = prodInfo.value.imgs[index];
...@@ -183,6 +245,20 @@ function previewImage(imgSrc) { ...@@ -183,6 +245,20 @@ function previewImage(imgSrc) {
urls: [imgSrc], // 需要预览的图片链接列表 urls: [imgSrc], // 需要预览的图片链接列表
}); });
} }
// 获取店铺信息
const getStoreInformationFn = (id) => {
return new Promise((resolve, reject) => {
getStoreInformation(id).then((res) => {
if (res.code === 0) {
shopInfo.value = res.data.shop;
shopInfo.value.tagList = res.data.shop.labels.split(',');
currentLatitudeAndLongitude.value.latitude = res.data.shop.location.lat;
currentLatitudeAndLongitude.value.longitude = res.data.shop.location.lon;
resolve();
}
});
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -332,11 +408,37 @@ page { ...@@ -332,11 +408,37 @@ page {
margin-top: 10rpx; margin-top: 10rpx;
border-radius: 8 * 2rpx; border-radius: 8 * 2rpx;
box-shadow: 0 -8rpx 22 * 2rpx 0 rgba(255, 255, 255, 0.6); box-shadow: 0 -8rpx 22 * 2rpx 0 rgba(255, 255, 255, 0.6);
.purchase-information {
display: flex;
flex-direction: column;
align-content: flex-start;
.purchase-box {
display: flex;
flex-wrap: wrap;
margin-top: 20rpx;
.title {
font-size: 11 * 2rpx;
color: #767676;
}
.content {
font-size: 11 * 2rpx;
margin-left: 32rpx;
color: #3d3d3d;
}
}
}
.title { .title {
font-size: 13 * 2rpx; font-size: 13 * 2rpx;
color: #151515; color: #151515;
font-weight: 500; font-weight: 500;
} }
img {
width: 100%;
height: auto;
}
p {
font-size: 22rpx;
}
.rich-more-btn { .rich-more-btn {
width: 315 * 2rpx; width: 315 * 2rpx;
display: flex; display: flex;
...@@ -348,6 +450,10 @@ page { ...@@ -348,6 +450,10 @@ page {
box-sizing: border-box; box-sizing: border-box;
padding: 20rpx 0 0 0; padding: 20rpx 0 0 0;
margin-top: 20rpx; margin-top: 20rpx;
.xia {
font-size: 20rpx;
margin-left: 10rpx;
}
image { image {
width: 18rpx; width: 18rpx;
height: 18rpx; height: 18rpx;
...@@ -415,7 +521,7 @@ page { ...@@ -415,7 +521,7 @@ page {
} }
} }
.bottom-operation-bar { .bottom-operation-bar {
width: 100%; width: 750rpx;
background: #fff; background: #fff;
border-radius: 16rpx 16rpx 0 0; border-radius: 16rpx 16rpx 0 0;
display: flex; display: flex;
......
...@@ -247,8 +247,8 @@ ...@@ -247,8 +247,8 @@
<!-- <text class="goods-rs">36/人</text> --> <!-- <text class="goods-rs">36/人</text> -->
</view> </view>
<view class="tag-list"> <view class="tag-list">
<view class="tag" v-for="item in tagList2" :key="item.id"> <view class="tag" v-for="(el, i) in item.labels" :key="i">
{{ item.name }} {{ el }}
</view> </view>
</view> </view>
</view> </view>
...@@ -302,12 +302,6 @@ const isLoadReachBottom = ref(null); ...@@ -302,12 +302,6 @@ const isLoadReachBottom = ref(null);
const commentList = ref([]); const commentList = ref([]);
// 评论总数 // 评论总数
const commentTotal = ref(0); const commentTotal = ref(0);
const tagList = ref([
{ name: '美食', id: 1 },
{ name: '休闲娱乐', id: 2 },
{ name: '景点', id: 3 },
{ name: '生活服务', id: 4 },
]);
// 周边推荐类型列表 // 周边推荐类型列表
const recommendedTypesOfPeripherals = ref([]); const recommendedTypesOfPeripherals = ref([]);
// 商户id // 商户id
...@@ -366,8 +360,17 @@ function sgyrddShopPageFn(categoryIds) { ...@@ -366,8 +360,17 @@ function sgyrddShopPageFn(categoryIds) {
}; };
sgyrddShopPage(params).then((res) => { sgyrddShopPage(params).then((res) => {
if (res.code === 0) { if (res.code === 0) {
res.data.content = res.data.content
.map((el) => {
if (el.labels && el.labels !== '') {
el.labels = el.labels.split(',');
}
return el;
})
.filter((item) => {
return item !== '';
});
recommendedListOfPeripherals.value = res.data.content; recommendedListOfPeripherals.value = res.data.content;
console.log('res', res);
} }
}); });
} }
...@@ -377,7 +380,7 @@ function getLocationFn() { ...@@ -377,7 +380,7 @@ function getLocationFn() {
success: function (res) { success: function (res) {
const myLatitude = currentLatitudeAndLongitude.value.latitude; const myLatitude = currentLatitudeAndLongitude.value.latitude;
const myLongitude = currentLatitudeAndLongitude.value.longitude; const myLongitude = currentLatitudeAndLongitude.value.longitude;
const distance = getDistance(res.latitude, res.longitude, myLatitude, myLongitude); const distance = getDistance(res.latitude, res.longitude, myLatitude, myLongitude, 1);
shopInfo.value.distance = distance; shopInfo.value.distance = distance;
}, },
fail: function (err) { fail: function (err) {
...@@ -1223,7 +1226,7 @@ page { ...@@ -1223,7 +1226,7 @@ page {
box-sizing: border-box; box-sizing: border-box;
padding: 6rpx; padding: 6rpx;
font-size: 8 * 2rpx; font-size: 8 * 2rpx;
margin-right: 20rpx; margin-right: 10rpx;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment