Merge branch 'dev' into 'master'

uniapp【修复】: 拼团订单分享按钮后续逻辑不通 / 分享页面,文章详情页跳转链接

See merge request jianweie/coreshoppro!83
This commit is contained in:
花城
2024-11-13 11:08:08 +00:00
8 changed files with 1128 additions and 954 deletions

View File

@@ -26,7 +26,7 @@
</view>
<!-- 积分兑换价格 -->
<Point :flex="true" :data="props.goodsDetailData?.product" fontSize="24rpx"></Point>
<Point v-if="!props.isActivityGoods" :flex="true" :data="props.goodsDetailData?.product" fontSize="24rpx"></Point>
<view class="name-box" v-if="props.goodsDetailData?.name || props.goodsDetailData?.brief">
<view class="name">{{ props.goodsDetailData?.name }}</view>

View File

@@ -78,10 +78,10 @@
handleRouteSwitchTab();
}
break;
/** 文章页面 */
/** 文章详情页面 */
case ShareEnum.article:
if (shareData.data?.params?.articleId) {
handleRouteRedirectTo(`/pages/subpackage/article/category/category?id=${shareData.data?.params?.articleId}&idType=${shareData.data?.params?.articleType}`)
handleRouteRedirectTo(`/pages/subpackage/article/detail/detail?id=${shareData.data?.params?.articleId}`)
} else {
handleRouteSwitchTab();
}

View File

@@ -41,7 +41,7 @@
<lpainterText :text="'截止:' + state.shareData.endTime"
css="color: #212121; background: #ffb400; padding:8rpx 20rpx;border-radius:12rpx" />
</lpainterView>
<lpainterView css="margin-top: 30rpx; font-size: 26rpx; color: #8c5400">
<lpainterView css="width: 570rpx;margin-top: 30rpx; font-size: 26rpx; color: #8c5400">
<lpainterText :text="state.shareData.brief"
css=" background: #fff4d9; padding:8rpx 20rpx; border-radius:12rpx" />
</lpainterView>
@@ -130,7 +130,7 @@
if (state.shareType == ShareEnum.goods) {
/** 获取商品详情 */
getGoodsDetail(query)
} else if (state.shareType == ShareEnum.pinTuan || state.shareType === ShareEnum.addPinTuan) {
} else if (state.shareType == ShareEnum.pinTuan || state.shareType == ShareEnum.addPinTuan) {
/** 获取活动拼团详情 */
getActivityPinTuan(query);
} else if (state.shareType == ShareEnum.serviceGoods) {
@@ -196,7 +196,7 @@
state.shareData.mktprice = goodsDetail.data?.mktprice;
state.shareData.showPinTuanArguments = true;
state.shareData.endTime = goodsDetail.data?.groupEndTime;
state.shareData.endTime = goodsDetail.data?.pinTuanRule?.endTime;
state.shareData.peopleNumber = goodsDetail.data?.pinTuanRule?.peopleNumber;
} else {
handleShowToast(goodsDetail.msg, 'none', () => {

View File

@@ -86,3 +86,80 @@
background-color: #d33123;
}
}
.pinTuan-popup-box{
padding: 40rpx;
.time-title{
font-size: 27rpx;
text-align: center;
margin-bottom: 5rpx;
}
.time{
text-align: center;
}
.teams-box{
margin-top: 40rpx;
display: flex;
flex-wrap: wrap;
justify-content: center;
.img-box{
position: relative;
width: 80rpx;
height: 80rpx;
border-radius: 50%;
margin-right: 30rpx;
margin-bottom: 20rpx;
.tit{
position: absolute;
top: -5rpx;
left: -10rpx;
display: inline-block;
background-color: #d33123;
color: #fff;
font-size: 22rpx;
z-index: 98;
padding: 0 10rpx;
border-radius: 10rpx;
-webkit-transform: scale(0.8);
transform: scale(0.8);
}
.img{
display: block;
width: 80rpx;
height: 80rpx;
border: 1px solid #d33123;
border-radius: 50%;
}
}
.need-peo{
width: 80rpx;
height: 80rpx;
border-radius: 50%;
display: flex;
border: 1px dashed #e1e1e1;
margin-right: 30rpx;
margin-bottom: 20rpx;
.tit{
margin: auto;
color: #d1d1d1;
font-size: 27rpx;
}
}
}
.peo-box{
margin-top: 20rpx;
text-align: center;
.peo{
color: #d33123;
}
}
.btn-box{
margin: 40rpx auto 0;
background-color: #d33123;
font-size: 27rpx;
padding: 20rpx 0;
justify-content: center;
width: 400rpx;
color: #fff;
border-radius: 20px;
}
}

View File

@@ -51,7 +51,7 @@
<view class="tit">单独购买</view>
</view>
</view>
<view class="btn buy" @click="handleMultipleBuy">
<view class="btn buy" @click="handleMultipleBuy()">
<view class="box">
<view class="num">{{ state.goodsDetailData.pinTuanPrice }}</view>
<view class="tit">发起拼团</view>
@@ -66,6 +66,31 @@
:isShowAddCartBtn="false" :buyNowNowloading="loading" @handleChangePopup="handleChangePopup"
@handleBuyNow="handleBuyNow" :btnBuyTitlt="state.btnBuyTitlt">
</GoodsDetailSkuPopup>
<!-- 分享进来的参与拼团弹框 -->
<uv-popup ref="pinTuanPopup" mode="bottom" :closeable="true">
<view class="pinTuan-popup-box">
<view class="time-title">剩余时间</view>
<view class="time">
<uv-count-down :time="state.teamInfo.lastTime * 1000" :autoStart="true" :millisecond="true" format="DD天HH时mm分ss秒"></uv-count-down>
</view>
<view class="teams-box">
<view class="img-box" v-for="item,index in state.teamInfo.teams" :key="index">
<text class="tit" v-if="item.recordId == item.teamId">拼主</text>
<image class="img" :src="item.userAvatar"></image>
</view>
<view class="need-peo" v-if="state.teamInfo?.teamNums" v-for="item in state.teamInfo?.teamNums" :key="item">
<text class="tit">?</text>
</view>
</view>
<view class="peo-box">
还差 <text class="peo">{{ state.teamInfo?.teamNums || '' }}</text> 赶快拼单吧
</view>
<view class="btn-box" @click="handleJoinGroupBuy">
参与拼团
</view>
</view>
</uv-popup>
</view>
</coreshop-page>
</template>
@@ -97,6 +122,9 @@
/** 获取购物车数据 */
const cartStore = useCartStore();
/** 分享进来的参与拼团弹框 */
const pinTuanPopup = ref();
const state = reactive<{
id : number;
goodsDetailData : any,
@@ -201,6 +229,7 @@
const teamInfo : Response<any> = await queryOrderPinTuanTeamInfo({ teamId, });
if (teamInfo.status) {
state.teamInfo = teamInfo?.data;
pinTuanPopup.value.open();
} else {
handleShowToast(teamInfo.msg)
}
@@ -222,21 +251,32 @@
});
}
/** 拼团购买 */
const handleMultipleBuy = () => {
/** 拼团购买统一调用 */
const handlePinTuan = (title?:string)=>{
_useLoginStore.checkLogin(() => {
state.teamId = 0;
state.showSku = true;
state.isSingleBuy = false;
state.btnBuyTitlt = '发起拼团';
state.btnBuyTitlt = title || '发起拼团';
state.goodsDetailData.skuList.sku_list = state.activitySkuList;
});
}
/** 去拼单 */
/** 弹框中的按钮参与拼团购买 */
const handleJoinGroupBuy = ()=>{
pinTuanPopup.value.close();
handlePinTuan('参与拼团');
}
/** 拼团购买 */
const handleMultipleBuy = () => {
state.teamId = 0;
handlePinTuan()
}
/** 去拼单购买 */
const handleSplicingOrders = (teamId : number) => {
state.teamId = teamId;
handleMultipleBuy();
handlePinTuan('去拼单');
}
/** 关闭sku弹框 */

View File

@@ -99,10 +99,10 @@
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline, onPullDownRefresh } from '@dcloudio/uni-app';
import { querySolitaireDetail, queryShare, queryAddCart, queryRemoveCart } from '@/core/api';
import { querySolitaireDetail, queryAddCart, queryRemoveCart } from '@/core/api';
import { ShareClientEnum, ShareModelEnum, ShareEnum, EmptyEnum, PaymentTypeEnum, AddCartEnum } from '@/core/enum';
import type { Response } from '@/core/models';
import { UserToken, shareUrl } from '@/core/consts'
import { shareUrl } from '@/core/consts'
import { useShopConfigStore, useLoginStore } from '@/core/store';
import { handleShowToast, handleRouteNavigateTo, getShareUrl } from '@/core/utils';
import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';

View File

@@ -91,7 +91,7 @@
</view>
</view>
<view class="share-box">
<uv-button type="success" size="small">
<uv-button type="success" size="small" @click="handleInviteFriends">
<uv-icon name="share" color="#fff" labelColor="#fff" label="立即邀请好友拼单" labelSize="14px"
labelPos="right" size="18"></uv-icon>
</uv-button>
@@ -351,19 +351,26 @@
text="联系客服"></uv-button>
</view>
</view>
<!-- 分享弹框 -->
<CoreshopShare :show="state.showShare" :shareType="ShareEnum.addPinTuan"
:goodsDetailData="state.shareDetailData" @handleClosePopup="handleToggleShowShare"></CoreshopShare>
</view>
</coreshop-page>
</template>
<script setup lang="ts">
import { reactive, ref } from "vue";
import { onLoad } from '@dcloudio/uni-app';
import { onLoad ,onShareAppMessage,onShareTimeline} from '@dcloudio/uni-app';
import { queryOrderDetails, queryOrderPinTuanTeamInfo, queryCheckInvoice, queryOrderConfirm, queryOrderShippingList, queryCancelOrder } from '@/core/api';
import type { Response } from '@/core/models';
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
import { OrderStatusEnum, OrderPayStatusEnum, PayMethodCodeEnum, OrderShipStatusEnum, ShowInvoiceEnum, OrderConfirmStatusEnum, PinTuanStatusEnum, OrderAllStatusTypeEnum } from '@/core/enum';
import { handleShowToast, handleRouteNavigateTo, getShareUrl } from '@/core/utils';
import { OrderStatusEnum, OrderPayStatusEnum, ShareEnum, ShareClientEnum, ShareModelEnum, PayMethodCodeEnum, OrderShipStatusEnum, ShowInvoiceEnum, OrderConfirmStatusEnum, PinTuanStatusEnum, OrderAllStatusTypeEnum } from '@/core/enum';
import { useShopConfigStore } from '@/core/store';
import { shareUrl } from '@/core/consts';
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
import uQRCode from '@/core/utils/uqrcode.js';
import CoreshopShare from '@/components/coreshop-share/coreshop-share.vue';
interface QueryParams {
orderId : string;
@@ -384,6 +391,9 @@
deliveryInfo : any;
pickupCode : string;
codeSrc : string;
showShare : boolean;
shareUrl:string;
shareDetailData:any;
}>({
orderDetail: {},
orderId: '',
@@ -393,6 +403,9 @@
deliveryInfo: {},
pickupCode: "",
codeSrc: "",
showShare: false,
shareUrl:"",
shareDetailData:{},
})
onLoad((query : QueryParams) => {
@@ -481,6 +494,12 @@
const teamInfo : Response<any> = await queryOrderPinTuanTeamInfo({ orderId, });
if (teamInfo.status) {
state.teamInfo = teamInfo?.data;
state.shareDetailData = {
pinTuanRule:{id:teamInfo?.data?.ruleId},
id:state.orderDetail?.items[0]?.goodsId,
teamId:teamInfo?.data?.teamId,
groupId:teamInfo?.data?.ruleId
}
} else {
handleShowToast(teamInfo.msg)
}
@@ -663,6 +682,44 @@
handleShowToast(checkInvoice.msg)
}
}
/** 邀请好友拼单 */
const handleInviteFriends = async () => {
/** 获取分享url */
state.shareUrl = await getShareUrl({
client: ShareClientEnum.wxMiNiProgram,
url: shareUrl,
type: ShareModelEnum.url,
page: ShareEnum.addPinTuan,
params: {
goodsId: state.orderDetail?.items[0]?.goodsId,
teamId:state.teamInfo.teamId,
groupId:state.teamInfo.ruleId,
}
})
state.showShare = true;
}
/** 分享弹框显示与否 */
const handleToggleShowShare = () => {
state.showShare = !state.showShare;
}
/** 分享 */
onShareAppMessage(() => {
return {
title: state.orderDetail?.items[0]?.name,
imageUrl: state.orderDetail?.items[0]?.imageUrl,
path: state.shareUrl
}
});
onShareTimeline(() => {
return {
title: state.orderDetail?.items[0]?.name,
imageUrl: state.orderDetail?.items[0]?.imageUrl,
path: state.shareUrl
}
});
</script>
<style lang="scss" scoped>
@import './detail.scss';