This commit is contained in:
2024-03-30 00:05:07 +08:00
parent 51c708f9fa
commit 52b63a757f
7 changed files with 176 additions and 64 deletions

View File

@@ -11,5 +11,9 @@ export const getGroupBuyList = (data: {
export const getGroupBuyDetail = (
id: string) => get({ url: `wechat/coupons/group/get/${id}` });
export const getGroupBuyRecordList = (groupId: string, pageNum: number, pageSize: number) => post({
url: `wechat/coupons/group/order/list?groupId=${groupId}&pageNum=${pageNum}&pageSize=${pageSize}`
});
export const preOrder = (data: any) => post({ url: 'wechat/coupons/group/pre', data });

View File

@@ -5,7 +5,7 @@
<image class='goods-image' :src='bean?.images' />
<view class='c-flex-column' style='flex: 1'>
<text class='goods-name'>{{ bean?.name }}</text>
<text class='goods-price'>{{ bean?.price }}</text>
<text class='goods-price'>{{ bean?.price||0 }}</text>
</view>
<image class='close-image' :src='assetsUrl("ic_close.png")' @click.stop='close' />
</view>

View File

@@ -64,6 +64,12 @@
"navigationBarTitleText": "商品团购券"
}
},
{
"path": "groupbuy/order",
"style": {
"navigationBarTitleText": "确认订单"
}
},
{
"path": "webview/index",
"navigationBarTitleText": "网页"

View File

@@ -20,12 +20,12 @@
<text>{{ detailBean?.goodsPrice || 0 }}</text>
</view>
<view class='countdown-time c-flex-column'>
<view class='c-flex-row'>180
<text class='time'>23</text>
<view class='c-flex-row'>{{ countdownTime?.days }}
<text class='time'>{{ countdownTime?.hours }}</text>
:
<text class='time'>23</text>
<text class='time'>{{ countdownTime?.minutes }}</text>
:
<text class='time'>23</text>
<text class='time'>{{ countdownTime?.seconds }}</text>
</view>
<text>距离活动结束仅剩</text>
</view>
@@ -34,11 +34,11 @@
<view class='goods-info-view c-flex-column'>
<view class='c-flex-row'>
<text class='goods-price accent-text-color'>39.89</text>
<text>销量{{ detailBean.totalNum }}</text>
<text>销量{{ detailBean?.totalNum }}</text>
</view>
<view class='c-flex-row'>
<text style='flex: 1'>{{ detailBean.name }}</text>
<text style='flex: 1'>{{ detailBean?.name }}</text>
<view class='share-button c-flex-column'>
<image :src='assetsUrl("ic_share.png")'></image>
<button class='btn' plain open-type='share'>分享</button>
@@ -58,12 +58,12 @@
<view class='recommend-view c-flex-column'>
<text>浏览此商品的客户还浏览了</text>
<scroll-view scroll-x>
<view style='display: inline-block' v-for='(item, index) in [1, 2, 3, 4]'
<view style='display: inline-block' v-for='(item, index) in recommendList'
:key='index'>
<view class='recommend-item c-flex-column'>
<image :src='assetsUrl("test_bg.png")' />
<text>女童夏装套装</text>
<text class='goods-price'>22</text>
<image :src='item.images' />
<text>{{ item.goodsName }}</text>
<text class='goods-price'>{{ item.price }}</text>
</view>
</view>
</scroll-view>
@@ -71,76 +71,134 @@
<view class='goods-detail c-flex-column'>
<text>商品详情</text>
<image
v-for='(item,index) in JSON.parse(detailBean.content).filter((a: any) => a.type === 2).map((b: any) => b.images)'
v-for='(item,index) in JSON.parse(detailBean?.content).filter((a: any) => a.type === 2).map((b: any) => b.images)'
:src='item' mode='aspectFill' :key='index' />
</view>
<view class='bottom-view c-flex-row'>
<view class='small-button-view' @click.stop='goBack'>
<view class='small-button-item'>
<image :src='assetsUrl("ic_goods_store.png")' />
<text>商家</text>
</view>
<view class='small-button-item' @click.stop='goPath("/pages/mine/subs/order/index")'>
<image :src='assetsUrl("ic_goods_order.png")' />
<text>订单</text>
</view>
<view class='small-button-item'>
<view class='shoppingcart-count' @click.stop='goPath("/pages/mall/subs/shoppingcart/index")'>
<image :src='assetsUrl("ic_goods_shoppingcart.png")' />
<text>12</text>
<view class='goods-detail record-view c-flex-column'>
<text class='record-view-title'>跟团记录</text>
<scroll-view>
<view class='c-flex-column' v-for='(item,index) in recordList' :key='index'>
<view class='item-view c-flex-row'>
<image :src='item.memberImage' />
<view class='c-flex-column' style='flex: 1'>
<text>{{ item.goodsCode }}</text>
<text>{{ item.createTime }}</text>
</view>
<text>+{{ item.goodsNum }}</text>
</view>
<text>购物车</text>
</view>
</view>
</view>
</scroll-view>
</view>
<view class='bottom-view c-flex-row'>
<view class='primary-button-view c-flex-row'>
<view class='add-shoppingcart-button' @click.stop='addShoppingCart'>加入购物车</view>
<view class='place-order-button' @click.stop='placeOrder'>立即下单</view>
<view class='place-order-button' @click.stop='placeOrder'>跟团购买</view>
</view>
</view>
</view>
<sku-dialog ref='skuDialogRef' />
<sku-dialog ref='skuDialogRef' :bean='detailBean?.goods' @confirm='confirmGoodsSku' />
</template>
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import { goPath } from '@/utils';
import SkuDialog from '@/components/sku-dialog.vue';
import { getGroupBuyDetail } from '@/api/groupbuy';
import { getGroupBuyDetail, getGroupBuyRecordList } from '@/api/groupbuy';
import dayjs from 'dayjs';
import { getGoodsList } from '@/api/goods';
import { GoodsBean } from '@/api/goods/types';
const skuDialogRef = ref();
const detailBean = ref();
const recommendList = ref<GoodsBean[]>();
const skuBean = ref();
const bannerList = ref([]);
const swiperIndex = ref(0);
onLoad(async (e) => {
let interval: number;
const countdownTime = ref<{
days: number,
hours: number,
minutes: number,
seconds: number
}>();
const recordList = ref([]);
onLoad(async (e: any) => {
detailBean.value = await getGroupBuyDetail(e.id);
bannerList.value = JSON.parse(detailBean.value.content).filter((item: any) => item.type === 2).map((item: any) => item.images);
countdown();
await fetchRecommendList();
await fetchBuyRecordList();
});
onUnload(() => {
if(interval) {
clearInterval(interval);
}
});
const fetchRecommendList = async () => {
const { rows } = await getGoodsList({
page: {
page: 1,
pageSize: 20,
bean: {
keyword: '',
typeIds: ['1724629185362591745']
}
}
});
recommendList.value = rows;
};
const fetchBuyRecordList = async () => {
const { list } = await getGroupBuyRecordList(detailBean.value.id, 1, 10);
recordList.value = list;
};
const swiperChange = (e: any) => {
swiperIndex.value = e.detail.current;
};
const goBack = () => {
uni.navigateBack();
const getRemainingDays = computed(() => {
let now = new Date();
let end = dayjs(detailBean.value?.endDate).toDate().getTime();
return Math.floor((end - now.getTime()) / 1000 / 60 / 60 / 24);
});
const countdown = () => {
interval = setInterval(() => {
if(detailBean.value?.endDate) {
let now = new Date();
let end = dayjs(detailBean.value?.endDate).toDate().getTime();
let remaining = Math.floor((end - now.getTime()) / 1000);
if(remaining > 0) {
countdownTime.value = {
days: Math.floor(remaining / 60 / 60 / 24),
hours: Math.floor(remaining / 60 / 60 % 24),
minutes: Math.floor(remaining / 60 % 60),
seconds: Math.floor(remaining % 60)
};
} else {
clearInterval(interval);
}
}
}, 1000);
};
const showSkuDialog = () => {
skuDialogRef.value.show();
};
const addShoppingCart = () => {
uni.showToast({
title: '加入购物车成功',
icon: 'none'
});
const confirmGoodsSku = (e: any) => {
skuBean.value = e;
};
const placeOrder = () => {
@@ -332,7 +390,7 @@ const placeOrder = () => {
view:nth-of-type(n+1) {
position: relative;
align-items: center;
height: 105rpx;
height: 80rpx;
text:nth-of-type(1) {
width: 100rpx;
@@ -358,7 +416,7 @@ const placeOrder = () => {
font-size: 24rpx;
color: #999999;
position: absolute;
top: 80rpx;
top: 40rpx;
left: 100rpx;
}
}
@@ -474,6 +532,7 @@ const placeOrder = () => {
.primary-button-view {
font-weight: bold;
width: 100%;
font-size: 30rpx;
.add-shoppingcart-button {
@@ -489,13 +548,14 @@ const placeOrder = () => {
.place-order-button {
display: flex;
width: 198rpx;
//width: 198rpx;
flex: 1;
height: 80rpx;
align-items: center;
justify-content: center;
background: #F32B2B;
color: #FFFFFF;
border-radius: 0 40rpx 40rpx 0;
border-radius: 40rpx;
}
}
}
@@ -515,4 +575,46 @@ const placeOrder = () => {
width: 100%;
}
}
.record-view {
.record-view-title {
margin: 20rpx 30rpx;
font-weight: bold;
font-size: 30rpx;
color: #333333;
}
text {
margin: 0;
}
.item-view {
margin: 10rpx 20rpx;
image {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
}
.c-flex-column {
margin: 0 15rpx;
text:nth-of-type(1) {
font-size: 20rpx;
color: #333333;
}
text:nth-of-type(2) {
font-size: 15rpx;
color: #666666;
margin-top: 10rpx;
}
}
text:nth-of-type(1) {
color: #F32B2B;
}
}
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<view class='card-view'>
<text class='category-title'>2023-02-12</text>
<!-- <text class='category-title'>2023-02-12</text>-->
<view class='item c-flex-column' v-for='(item,index) in 3' :key='index'>
<view class='c-flex-row'>
<text class='primary-text-color' style='flex: 1'>消费</text>
@@ -10,14 +10,16 @@
<text class='secondary-text-color' style='flex: 1'>2023-06-27 15:02:11</text>
<text style='color: #999999'>会员余额30.00</text>
</view>
<view class='divider' style='margin-top: 20rpx'/>
<view class='divider' style='margin-top: 20rpx' />
</view>
</view>
</template>
<script lang='ts' setup>
import { PropType } from 'vue';
defineProps({
item: Object
item: Object as PropType<any>
});
</script>

View File

@@ -59,7 +59,6 @@ const codeRefreshInterval = ref(30);
onLoad(() => {
generateCode();
console.log('------->>>',userInfo.value)
setInterval(() => {
codeRefreshInterval.value -= 1;