新增拼团/套餐分享功能

This commit is contained in:
gyq
2025-12-25 15:38:00 +08:00
parent 448effd296
commit fbe170b254
18 changed files with 3789 additions and 1532 deletions

View File

@@ -42,6 +42,9 @@
</view>
</view>
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
<view class="btn">
<button class="wx-btn" type="primary" open-type="share" @click="setShareOptions(item)">分享</button>
</view>
<template v-if="!item.onlineStatus">
<view class="btn">
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
@@ -77,6 +80,13 @@
<script setup>
import { onMounted, reactive, ref } from 'vue';
import { getGbWarePage, editOnlineStatus, deleteGbWare } from '@/http/api/ware.js';
const emits = defineEmits(['share']);
function setShareOptions(item) {
item.wareImgs = item.wareImgs.split(',');
emits('share', item);
}
const shopInfo = ref('');
const props = defineProps({
@@ -281,6 +291,13 @@ onMounted(() => {
gap: 28upx;
.btn {
width: 140upx;
.wx-btn {
border-radius: 100px;
height: 40px;
line-height: 40px;
font-size: 28upx;
background-color: #318afe;
}
}
}
}

View File

@@ -18,7 +18,7 @@
</view>
</view>
<view class="content">
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" />
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" @share="shareCallback" />
<orderList ref="orderListRef" name="orderList" key="orderList" :top="headHeight + 54" v-if="tabsActive == 1" />
</view>
<my-footer-btn confirmText="添加" v-if="tabsActive == 0" @confirm="toAdd"></my-footer-btn>
@@ -27,13 +27,33 @@
<script setup>
import { ref, watch } from 'vue';
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import { onLoad, onShow, onReachBottom, onPullDownRefresh, onShareAppMessage } from '@dcloudio/uni-app';
import goodsList from './components/goodsList.vue';
import orderList from './components/orderList.vue';
import { upShopConfig } from '@/http/api/ware.js';
import { getShopInfo } from '@/http/api/shop.js';
import { isMainShop } from '@/store/account.js';
const path = '/pageMarket/groupGoods/share';
const shareOptions = ref({
title: '',
path: '',
imageUrl: ''
});
onShareAppMessage(() => {
console.log(shareOptions.value);
return shareOptions.value;
});
function shareCallback(item) {
console.log('shareCallback', item);
shareOptions.value.title = item.wareName;
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
shareOptions.value.imageUrl = item.wareImgs[0];
}
const goodsListRef = ref(null);
const orderListRef = ref(null);

View File

@@ -0,0 +1,531 @@
<!-- 套餐分享页 -->
<template>
<view class="color-333 u-font-28 min-page bg-f7" v-if="item.id">
<view class="relative">
<up-swiper height="428rpx" :list="item.wareImgs.split(',')" @click="prveImg"></up-swiper>
<view class="share-box">
分享
<button class="share" open-type="share" @click="shareCallback">分享</button>
</view>
</view>
<view class="sku">
<view class="u-flex u-col-center">
<text class="price">¥{{ item.groupPrice }}</text>
<text class="old-price">¥{{ item.originalPrice }}</text>
</view>
<view>
<view class="u-m-t-16 text" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}</view>
<view class="text u-m-t-10">已售{{ item.saleNum || 0 }}</view>
</view>
</view>
<view class="goods">
<view class="goods-name">{{ item.wareName }}</view>
<!-- <view class="u-m-t-20 color-666">
{{ item.description }}
</view> -->
</view>
<view class="bg-f7" style="height: 32rpx"></view>
<view class="desc">
<view class="u-flex">
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店</view>
<view class="">{{ item.shopName }}</view>
</view>
<view class="u-flex u-m-t-16 u-col-baseline">
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址</view>
<view class="">{{ item.shopAddress }}</view>
</view>
</view>
<!-- <template v-if="flase">
<view class="bg-f7" style="height: 32rpx"></view>
<view class="groups">
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
<view class="item u-flex" v-for="(item, index) in item.gbOrderList" :key="index">
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
<view>
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</view>
<view class="main-color u-m-t-2">{{ returnNeedPerpole(item) }}人拼成</view>
</view>
<view class="u-m-t-22">
<text class="color-666">剩余</text>
<text class="main-color">{{ getRemainingHMS(item) }}</text>
</view>
<view class="btn" @click="fastBuy(item)">快速拼成</view>
</view>
</view>
</view>
</template> -->
<!-- <view class="bg-f7" style="height: 24rpx"></view>
<view class="goods-group">
<view class="u-flex u-row-between">
<view class="name">套餐商品</view>
<view class="u-flex color-666" @click="showGroup = !showGroup" style="align-items: baseline">
<text class="u-m-r-18">{{ showGroup ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showGroup }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
</view>
<view class="" v-if="showGroup">
<view class="u-m-t-48" v-for="(item, index) in item.packageContent" :key="index">
<view class="font-bold">
<text class="">{{ item.name }}</text>
<text class="u-m-l-30">{{ item.packageProducts.length }}{{ item.num }}</text>
</view>
<view class="">
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods, goodsIndex) in item.packageProducts" :key="goodsIndex">
<text>{{ goods.name }}</text>
<view class="u-flex text-right">
<text class="color-666 u-m-r-42">x{{ goods.num }}</text>
<view style="min-width: 110rpx">¥{{ goods.price }}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="desc" v-if="item.tieredDiscount && item.tieredDiscount.length > 0">
<view class="u-flex u-row-between">
<view class="name">分享说明</view>
<view class="u-flex color-666" @click="showDesc = !showDesc" style="align-items: baseline">
<text class="u-m-r-18">{{ showDesc ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showDesc }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
</view>
<template v-if="showDesc">
<view class="u-m-t-26 text-center table">
<view class="u-flex header color-666">
<view class="u-flex-1 u-p-t-32 u-p-b-32">分享人数</view>
<view class="u-flex-1 u-p-t-32 u-p-b-32">购买价格</view>
</view>
<view class="u-flex row" v-for="(step, index) in item.tieredDiscount" :key="index">
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{ step.peopleNum }}</view>
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{ step.price }}</view>
</view>
</view>
<view class="u-m-t-26">
<view>分享期限小时{{ item.expireHours }}</view>
<view class="u-m-t-10">规定期限内的助力才会被计入</view>
<view class="u-m-t-40">如何才是分享成功被分享人只需要点击助力提示助力成功后即可</view>
</view>
</template>
</view>
<view class="desc">
<view class="u-flex u-row-between">
<view class="name">使用说明</view>
<view class="u-flex color-666" @click="useDescShow = !useDescShow" style="align-items: baseline">
<text class="u-m-r-18">{{ useDescShow ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !useDescShow }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
</view>
<template v-if="useDescShow">
<view class="u-m-t-16 color-666">
<view>1可用时间段{{ canuseTime }}</view>
<view v-if="item.otherDesc">2其他使用说明{{ item.otherDesc }}</view>
</view>
</template>
</view> -->
<view class="goods-detail">
<view class="u-flex u-row-center">
<view class="title">商品详情</view>
</view>
<view class="u-m-t-32">
<image class="w-full" v-for="(item, index) in item.wareCommentImgs.split(',')" :key="index" mode="widthFix" :src="item"></image>
</view>
</view>
<my-footer-btn confirmColor="#E3AD7F" confirmText="立即参加" @confirm="toMiniApp"></my-footer-btn>
</view>
</template>
<script setup>
import { ref, computed, reactive } from 'vue';
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app';
import { wareDetail } from '@/http/api/ware.js';
const showGroup = ref(true);
const showDesc = ref(true);
const useDescShow = ref(true);
const canuseTime = computed(() => {
return item.useWeeks.join('、') + ' ' + item.useTimes;
});
function prveImg(index) {
uni.previewImage({
urls: coverImgs.value,
current: index
});
}
const query = reactive({
shopId: '',
id: ''
});
const coverImgs = ref([]);
const item = reactive({
goodsDescription: []
});
function getDetail() {
wareDetail({
shopId: query.shopId,
wareId: query.id
}).then((res) => {
Object.assign(item, res);
coverImgs.value = res.images;
});
}
onLoad((options) => {
if (options.id) {
query.id = options.id;
query.shopId = options.shopId;
getDetail();
}
});
const path = '/pageMarket/packagePopularize/share';
const shareOptions = ref({
title: '',
path: '',
imageUrl: ''
});
function shareCallback() {
shareOptions.value.title = item.packageName;
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
shareOptions.value.imageUrl = item.images[0];
}
onShareAppMessage(() => {
console.log('onShareAppMessage', shareOptions.value);
return shareOptions.value;
});
// 跳转到用户小程序
function toMiniApp() {
uni.navigateToMiniProgram({
appId: 'wxd88fffa983758a30',
path: `/groupBuying/goodsDetail/goodsDetail?wareId=${query.id}&shopId=${query.shopId}`,
envVersion: 'release', // 环境版本release(正式版)、trial(体验版)、develop(开发版)
success: () => {},
fail: () => {}
});
}
</script>
<style lang="scss" scoped>
$topHeight: 350rpx;
.top-img {
width: 750rpx;
height: $topHeight;
}
.top {
margin: 14rpx 18rpx;
background-size: cover;
height: $topHeight;
box-sizing: border-box;
padding-left: 70rpx;
padding-top: 95rpx;
.name {
color: #000000;
font-size: 36rpx;
font-weight: 700;
}
.info {
color: #333333;
font-size: 48rpx;
font-weight: 700;
margin-top: 62rpx;
}
}
.sku {
display: flex;
justify-content: space-between;
padding: 20rpx 36rpx;
align-items: center;
background: linear-gradient(90deg, #ff4a63 0%, #fd1f48 100%);
.price {
color: #fff;
font-weight: 700;
font-size: 40rpx;
}
.old-price {
margin-left: 16rpx;
color: #e7e7e7;
opacity: 0.85;
font-weight: 700;
text-decoration: line-through;
}
.text {
color: #fff;
font-size: 28rpx;
}
}
.goods {
padding: 20rpx 28rpx;
background: #fff;
.goods-name {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
}
.desc {
padding: 32rpx 28rpx;
background-color: #fff;
}
.goods-detail {
padding: 32rpx;
.title {
position: relative;
padding: 0 22rpx;
&::before {
content: '';
display: block;
position: absolute;
right: 100%;
width: 70rpx;
height: 2rpx;
top: 50%;
transform: translateY(-50%);
background: linear-gradient(90deg, #f7f8f9 0%, #c9cbcc 100%);
}
&::after {
left: 100%;
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
display: block;
width: 70rpx;
height: 2rpx;
background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%);
}
}
}
.fixed-bottom {
position: fixed;
left: 98rpx;
right: 98rpx;
padding-bottom: 30px;
padding-top: 32rpx;
bottom: 0;
z-index: 10;
.btn {
padding: 22rpx;
border-radius: 200rpx;
font-size: 32rpx;
color: #fff;
width: 556rpx;
text-align: center;
background-color: #e8ad7b;
border: 1px solid transparent;
&.gray {
background: #fff;
color: #e8ad7b;
border-color: #e8ad7b;
}
}
}
.waring {
background-color: rgba(255, 204, 0, 0.09);
padding: 32rpx 24rpx;
color: #ff8d28;
}
.popup-content {
font-size: 28rpx;
min-height: 300px;
.popup-content-top {
padding: 32rpx 28rpx;
border-bottom: 1px solid #ededed;
}
.goods-info {
padding: 32rpx 28rpx;
border-bottom: 1px solid #ededed;
.cover {
width: 184rpx;
height: 184rpx;
border-radius: 16rpx;
background: #d9d9d9;
&.bg-fff {
background-color: #fff;
}
}
.price {
font-size: 32rpx;
font-weight: 700;
color: #ed5a2e;
line-height: 46rpx;
}
.old-price {
font-size: 32rpx;
color: #999;
text-decoration-line: line-through;
line-height: 48rpx;
}
.limitBuyNum {
color: #666;
line-height: 42rpx;
}
}
.bottom {
padding: 20rpx;
border-bottom: 1px solid #ededed;
.price {
color: #ed5a2e;
font-size: 32rpx;
font-weight: 700;
}
}
.btn {
display: flex;
padding: 22rpx 214rpx;
align-items: flex-start;
gap: 20rpx;
border-radius: 66rpx;
background: #e8ad7b;
font-size: 32rpx;
color: #fff;
font-size: 700;
}
}
.w-full {
width: 100%;
}
.groups {
padding: 28rpx 22rpx;
background-color: #fff;
.item {
padding: 28rpx 0;
border-bottom: 2rpx solid #ededed;
&:last-child {
border-bottom: none;
}
.main-color {
color: #ed5a2e;
}
.btn {
padding: 8rpx 26rpx;
border-radius: 36rpx;
background: #e8ad7b;
font-weight: 700;
color: #fff;
}
}
}
.share-box {
top: 0;
position: absolute;
right: 0;
padding: 4rpx 30rpx;
border-radius: 0 0 0 24rpx;
color: #ed5a2e;
font-weight: 700;
background: #fff;
overflow: hidden;
.share {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
opacity: 0;
}
}
.goods-group {
padding: 32rpx 46rpx;
background-color: #fff;
.name {
font-weight: 700;
font-size: 32rpx;
}
.rotate {
transform: rotate(-90deg);
}
}
.desc {
padding: 32rpx 46rpx;
background-color: #fff;
margin-top: 32rpx;
.name {
font-weight: 700;
font-size: 32rpx;
}
.table {
border: 2rpx solid #ededed;
border-radius: 8rpx;
margin: 0 52rpx;
.header {
background: #f8f8f88f;
}
.row {
border-top: 2rpx solid #ededed;
&:first-child {
border-top: none;
}
}
}
.rotate {
transform: rotate(-90deg);
}
}
.guodu {
transition: all 0.3s;
}
</style>

View File

@@ -45,6 +45,9 @@
</view>
</view>
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
<view class="btn">
<button class="wx-btn" type="primary" open-type="share" @click="setShareOptions(item)">分享</button>
</view>
<template v-if="!item.onlineStatus">
<view class="btn">
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
@@ -80,6 +83,12 @@
<script setup>
import { onMounted, reactive, ref } from 'vue';
import { packageGet, packageOnline, packageDel } from '@/http/api/ware.js';
const emits = defineEmits(['share']);
function setShareOptions(item) {
emits('share', item);
}
const shopInfo = ref('');
const props = defineProps({
@@ -290,6 +299,13 @@ onMounted(() => {
gap: 28upx;
.btn {
width: 140upx;
.wx-btn {
border-radius: 100px;
height: 40px;
line-height: 40px;
font-size: 28upx;
background-color: #318afe;
}
}
}
}

View File

@@ -19,7 +19,7 @@
</view>
</view>
<view class="content">
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" />
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" @share="shareCallback" />
<orderList ref="orderListRef" name="orderList" key="orderList" :top="headHeight + 54" v-if="tabsActive == 1" />
</view>
<my-footer-btn confirmText="添加" v-if="tabsActive == 0" @confirm="toAdd"></my-footer-btn>
@@ -28,11 +28,29 @@
<script setup>
import { ref, watch } from 'vue';
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import { onLoad, onShow, onReachBottom, onPullDownRefresh, onShareAppMessage } from '@dcloudio/uni-app';
import goodsList from './components/goodsList.vue';
import orderList from './components/orderList.vue';
import { packageSwitchGet, packageSwitchPut } from '@/http/api/ware.js';
const path = '/pageMarket/packagePopularize/share';
const shareOptions = ref({
title: '',
path: '',
imageUrl: ''
});
onShareAppMessage(() => {
console.log(shareOptions.value);
return shareOptions.value;
});
function shareCallback(item) {
shareOptions.value.title = item.packageName;
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
shareOptions.value.imageUrl = item.images[0];
}
const goodsListRef = ref(null);
const orderListRef = ref(null);

View File

@@ -21,6 +21,7 @@ const list = ref([]);
// 选择商品
function selectGoods(item) {
uni.setStorageSync('packageSelectGoods', {
id: item.id,
coverImg: item.coverImg,
name: item.name,
price: returnPrice(item.skuList)

View File

@@ -0,0 +1,528 @@
<!-- 套餐分享页 -->
<template>
<view class="color-333 u-font-28 min-page bg-f7" v-if="item.id">
<view class="relative">
<up-swiper height="428rpx" :list="item.images" @click="prveImg"></up-swiper>
<view class="share-box">
分享
<button class="share" open-type="share" @click="shareCallback">分享</button>
</view>
</view>
<view class="sku">
<view class="u-flex u-col-center">
<text class="price">¥{{ item.price }}</text>
<text class="old-price">¥{{ item.originPrice }}</text>
</view>
<view>
<view class="u-m-t-16 text" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}</view>
<view class="text u-m-t-10">已售{{ item.saleNum || 0 }}</view>
</view>
</view>
<view class="goods">
<view class="goods-name">{{ item.packageName }}</view>
<view class="u-m-t-20 color-666">
{{ item.description }}
</view>
</view>
<view class="bg-f7" style="height: 32rpx"></view>
<view class="desc">
<view class="u-flex">
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店</view>
<view class="">{{ item.shopName }}</view>
</view>
<view class="u-flex u-m-t-16 u-col-baseline">
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址</view>
<view class="">{{ item.shopAddress }}</view>
</view>
</view>
<!-- <template v-if="flase">
<view class="bg-f7" style="height: 32rpx"></view>
<view class="groups">
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
<view class="item u-flex" v-for="(item, index) in item.gbOrderList" :key="index">
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
<view>
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</view>
<view class="main-color u-m-t-2">{{ returnNeedPerpole(item) }}人拼成</view>
</view>
<view class="u-m-t-22">
<text class="color-666">剩余</text>
<text class="main-color">{{ getRemainingHMS(item) }}</text>
</view>
<view class="btn" @click="fastBuy(item)">快速拼成</view>
</view>
</view>
</view>
</template> -->
<view class="bg-f7" style="height: 24rpx"></view>
<view class="goods-group">
<view class="u-flex u-row-between">
<view class="name">套餐商品</view>
<view class="u-flex color-666" @click="showGroup = !showGroup" style="align-items: baseline">
<text class="u-m-r-18">{{ showGroup ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showGroup }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
</view>
<view class="" v-if="showGroup">
<view class="u-m-t-48" v-for="(item, index) in item.packageContent" :key="index">
<view class="font-bold">
<text class="">{{ item.name }}</text>
<text class="u-m-l-30">{{ item.packageProducts.length }}{{ item.num }}</text>
</view>
<view class="">
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods, goodsIndex) in item.packageProducts" :key="goodsIndex">
<text>{{ goods.name }}</text>
<view class="u-flex text-right">
<text class="color-666 u-m-r-42">x{{ goods.num }}</text>
<view style="min-width: 110rpx">¥{{ goods.price }}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="desc" v-if="item.tieredDiscount && item.tieredDiscount.length > 0">
<view class="u-flex u-row-between">
<view class="name">分享说明</view>
<view class="u-flex color-666" @click="showDesc = !showDesc" style="align-items: baseline">
<text class="u-m-r-18">{{ showDesc ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showDesc }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
</view>
<template v-if="showDesc">
<view class="u-m-t-26 text-center table">
<view class="u-flex header color-666">
<view class="u-flex-1 u-p-t-32 u-p-b-32">分享人数</view>
<view class="u-flex-1 u-p-t-32 u-p-b-32">购买价格</view>
</view>
<view class="u-flex row" v-for="(step, index) in item.tieredDiscount" :key="index">
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{ step.peopleNum }}</view>
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{ step.price }}</view>
</view>
</view>
<view class="u-m-t-26">
<view>分享期限小时{{ item.expireHours }}</view>
<view class="u-m-t-10">规定期限内的助力才会被计入</view>
<view class="u-m-t-40">如何才是分享成功被分享人只需要点击助力提示助力成功后即可</view>
</view>
</template>
</view>
<view class="desc">
<view class="u-flex u-row-between">
<view class="name">使用说明</view>
<view class="u-flex color-666" @click="useDescShow = !useDescShow" style="align-items: baseline">
<text class="u-m-r-18">{{ useDescShow ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !useDescShow }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
</view>
<template v-if="useDescShow">
<view class="u-m-t-16 color-666">
<view>1可用时间段{{ canuseTime }}</view>
<view v-if="item.otherDesc">2其他使用说明{{ item.otherDesc }}</view>
</view>
</template>
</view>
<view class="goods-detail" v-if="item.goodsCategory != '优惠券'">
<view class="u-flex u-row-center">
<view class="title">商品详情</view>
</view>
<view class="u-m-t-32">
<image class="w-full" v-for="(item, index) in item.detailImages" :key="index" mode="widthFix" :src="item"></image>
</view>
</view>
<my-footer-btn confirmColor="#E3AD7F" confirmText="立即参加" @confirm="toMiniApp"></my-footer-btn>
</view>
</template>
<script setup>
import { ref, computed, reactive } from 'vue';
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app';
import { packageDetail } from '@/http/api/ware.js';
const showGroup = ref(true);
const showDesc = ref(true);
const useDescShow = ref(true);
const canuseTime = computed(() => {
return item.useWeeks.join('、') + ' ' + item.useTimes;
});
function prveImg(index) {
uni.previewImage({
urls: coverImgs.value,
current: index
});
}
const query = reactive({
shopId: '',
id: ''
});
const coverImgs = ref([]);
const item = reactive({
goodsDescription: []
});
function getDetail() {
packageDetail(query).then((res) => {
Object.assign(item, res);
coverImgs.value = res.images;
});
}
onLoad((options) => {
if (options.id) {
query.id = options.id;
query.shopId = options.shopId;
getDetail();
}
});
const path = '/pageMarket/packagePopularize/share';
const shareOptions = ref({
title: '',
path: '',
imageUrl: ''
});
function shareCallback() {
shareOptions.value.title = item.packageName;
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
shareOptions.value.imageUrl = item.images[0];
}
onShareAppMessage(() => {
console.log('onShareAppMessage', shareOptions.value);
return shareOptions.value;
});
// 跳转到用户小程序
function toMiniApp() {
uni.navigateToMiniProgram({
appId: 'wxd88fffa983758a30',
path: `/userPackage/goodsDetail/goodsDetail?id=${query.id}&shopId=${query.shopId}`,
envVersion: 'release', // 环境版本release(正式版)、trial(体验版)、develop(开发版)
success: () => {},
fail: () => {}
});
}
</script>
<style lang="scss" scoped>
$topHeight: 350rpx;
.top-img {
width: 750rpx;
height: $topHeight;
}
.top {
margin: 14rpx 18rpx;
background-size: cover;
height: $topHeight;
box-sizing: border-box;
padding-left: 70rpx;
padding-top: 95rpx;
.name {
color: #000000;
font-size: 36rpx;
font-weight: 700;
}
.info {
color: #333333;
font-size: 48rpx;
font-weight: 700;
margin-top: 62rpx;
}
}
.sku {
display: flex;
justify-content: space-between;
padding: 20rpx 36rpx;
align-items: center;
background: linear-gradient(90deg, #ff4a63 0%, #fd1f48 100%);
.price {
color: #fff;
font-weight: 700;
font-size: 40rpx;
}
.old-price {
margin-left: 16rpx;
color: #e7e7e7;
opacity: 0.85;
font-weight: 700;
text-decoration: line-through;
}
.text {
color: #fff;
font-size: 28rpx;
}
}
.goods {
padding: 20rpx 28rpx;
background: #fff;
.goods-name {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
}
.desc {
padding: 32rpx 28rpx;
background-color: #fff;
}
.goods-detail {
padding: 32rpx;
.title {
position: relative;
padding: 0 22rpx;
&::before {
content: '';
display: block;
position: absolute;
right: 100%;
width: 70rpx;
height: 2rpx;
top: 50%;
transform: translateY(-50%);
background: linear-gradient(90deg, #f7f8f9 0%, #c9cbcc 100%);
}
&::after {
left: 100%;
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
display: block;
width: 70rpx;
height: 2rpx;
background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%);
}
}
}
.fixed-bottom {
position: fixed;
left: 98rpx;
right: 98rpx;
padding-bottom: 30px;
padding-top: 32rpx;
bottom: 0;
z-index: 10;
.btn {
padding: 22rpx;
border-radius: 200rpx;
font-size: 32rpx;
color: #fff;
width: 556rpx;
text-align: center;
background-color: #e8ad7b;
border: 1px solid transparent;
&.gray {
background: #fff;
color: #e8ad7b;
border-color: #e8ad7b;
}
}
}
.waring {
background-color: rgba(255, 204, 0, 0.09);
padding: 32rpx 24rpx;
color: #ff8d28;
}
.popup-content {
font-size: 28rpx;
min-height: 300px;
.popup-content-top {
padding: 32rpx 28rpx;
border-bottom: 1px solid #ededed;
}
.goods-info {
padding: 32rpx 28rpx;
border-bottom: 1px solid #ededed;
.cover {
width: 184rpx;
height: 184rpx;
border-radius: 16rpx;
background: #d9d9d9;
&.bg-fff {
background-color: #fff;
}
}
.price {
font-size: 32rpx;
font-weight: 700;
color: #ed5a2e;
line-height: 46rpx;
}
.old-price {
font-size: 32rpx;
color: #999;
text-decoration-line: line-through;
line-height: 48rpx;
}
.limitBuyNum {
color: #666;
line-height: 42rpx;
}
}
.bottom {
padding: 20rpx;
border-bottom: 1px solid #ededed;
.price {
color: #ed5a2e;
font-size: 32rpx;
font-weight: 700;
}
}
.btn {
display: flex;
padding: 22rpx 214rpx;
align-items: flex-start;
gap: 20rpx;
border-radius: 66rpx;
background: #e8ad7b;
font-size: 32rpx;
color: #fff;
font-size: 700;
}
}
.w-full {
width: 100%;
}
.groups {
padding: 28rpx 22rpx;
background-color: #fff;
.item {
padding: 28rpx 0;
border-bottom: 2rpx solid #ededed;
&:last-child {
border-bottom: none;
}
.main-color {
color: #ed5a2e;
}
.btn {
padding: 8rpx 26rpx;
border-radius: 36rpx;
background: #e8ad7b;
font-weight: 700;
color: #fff;
}
}
}
.share-box {
top: 0;
position: absolute;
right: 0;
padding: 4rpx 30rpx;
border-radius: 0 0 0 24rpx;
color: #ed5a2e;
font-weight: 700;
background: #fff;
overflow: hidden;
.share {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
opacity: 0;
}
}
.goods-group {
padding: 32rpx 46rpx;
background-color: #fff;
.name {
font-weight: 700;
font-size: 32rpx;
}
.rotate {
transform: rotate(-90deg);
}
}
.desc {
padding: 32rpx 46rpx;
background-color: #fff;
margin-top: 32rpx;
.name {
font-weight: 700;
font-size: 32rpx;
}
.table {
border: 2rpx solid #ededed;
border-radius: 8rpx;
margin: 0 52rpx;
.header {
background: #f8f8f88f;
}
.row {
border-top: 2rpx solid #ededed;
&:first-child {
border-top: none;
}
}
}
.rotate {
transform: rotate(-90deg);
}
}
.guodu {
transition: all 0.3s;
}
</style>