This commit is contained in:
2024-03-29 14:55:40 +08:00
parent 91af869899
commit 51c708f9fa
10 changed files with 133 additions and 56 deletions

View File

@@ -5,11 +5,22 @@ enum URL {
categoryList = '/ext/goods/category_list',
goodsList = '/ext/goods/query',
goodsDetail = '/ext/goods/info',
order = '/user/logout',
orderCreate = '/sales/wx_order_create',
orderList = '/sales/wx_query',
}
export const getCategoryList = () => get<CategoryBean>({ url: URL.categoryList });
export const getCategoryList = () => get<CategoryBean[]>({ url: URL.categoryList });
export const getGoodsList = (params: any) => get<GoodsBean>({ url: URL.goodsList, data: params });
export const getGoodsList = (params: any) => get<GoodsBean[]>({ url: URL.goodsList, data: params });
export const getGoodsDetail = (goodsId: string) => get<GoodsBean>({ url: URL.goodsDetail + `?goodsId=${goodsId}` });
export const orderCreate = (data: any) => post({ url: URL.orderCreate, data });
export const getOrderList = (data: {
pageNum: number,
pageSize: number,
obj: {
payStatus: number
}
}) => post({ url: URL.orderList, data });

View File

@@ -1,4 +1,4 @@
import { post } from '@/utils/request';
import { get, post } from '@/utils/request';
export const getGroupBuyList = (data: {
pageNum: number,
@@ -8,3 +8,8 @@ export const getGroupBuyList = (data: {
}
}) => post({ url: '/group/coupons/wx_query', data });
export const getGroupBuyDetail = (
id: string) => get({ url: `wechat/coupons/group/get/${id}` });
export const preOrder = (data: any) => post({ url: 'wechat/coupons/group/pre', data });

View File

@@ -3,7 +3,7 @@
<view class='swiper-container'>
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
<swiper-item v-for='(item,index) in bannerList' :key='index'>
<image :src='assetsUrl("test_bg.png")' />
<image :src='item' />
</swiper-item>
</swiper>
<view class='indicator'>
@@ -16,8 +16,8 @@
超级\n秒杀
</view>
<view class='price c-flex-column' style='flex: 1'>
<text>52</text>
<text>65</text>
<text>{{ detailBean?.payPrice }}</text>
<text>{{ detailBean?.goodsPrice || 0 }}</text>
</view>
<view class='countdown-time c-flex-column'>
<view class='c-flex-row'>180
@@ -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>销量2653</text>
<text>销量{{ detailBean.totalNum }}</text>
</view>
<view class='c-flex-row'>
<text>女童夏装套装洋气装短袖阔腿裤子夏装夏装套装</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>
@@ -53,12 +53,6 @@
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
<text>共1种颜色可选</text>
</view>
<view class='divider' style='width:auto;height: 0.5rpx;margin-left: 100rpx' />
<view class='c-flex-row' @click.stop='showSkuDialog'>
<text>参数</text>
<text>品牌 风格 季节 款号</text>
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
</view>
</view>
<view class='recommend-view c-flex-column'>
@@ -77,9 +71,10 @@
<view class='goods-detail c-flex-column'>
<text>商品详情</text>
<image :src='assetsUrl("test_bg.png")' mode='aspectFill' />
<image :src='assetsUrl("test_bg.png")' mode='aspectFill' />
<image :src='assetsUrl("test_bg.png")' mode='aspectFill' />
<image
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'>
@@ -116,12 +111,19 @@
import { assetsUrl } from '@/utils/assets';
import { goPath } from '@/utils';
import SkuDialog from '@/components/sku-dialog.vue';
import { getGroupBuyDetail } from '@/api/groupbuy';
const skuDialogRef = ref();
const detailBean = ref();
const bannerList = ref([1, 2, 3, 4]);
const bannerList = ref([]);
const swiperIndex = ref(0);
onLoad(async (e) => {
detailBean.value = await getGroupBuyDetail(e.id);
bannerList.value = JSON.parse(detailBean.value.content).filter((item: any) => item.type === 2).map((item: any) => item.images);
});
const swiperChange = (e: any) => {
swiperIndex.value = e.detail.current;
};
@@ -142,7 +144,7 @@ const addShoppingCart = () => {
};
const placeOrder = () => {
goPath('/pages/mall/subs/order/order-confirm');
goPath('/pages/common/groupbuy/order');
};
</script>
@@ -192,7 +194,7 @@ const placeOrder = () => {
position: relative;
padding: 15rpx 30rpx;
background: #F32B2B;
background-image: url("../../../static/images/bg_groupbuy_countdown.png");
background-image: url('../../../static/images/bg_groupbuy_countdown.png');
background-size: 100% 100%;
.super-second-kill {
@@ -253,10 +255,11 @@ const placeOrder = () => {
color: #F32B2B;
}
.time:nth-of-type(1){
.time:nth-of-type(1) {
margin-left: 18rpx;
}
.time:nth-of-type(3){
.time:nth-of-type(3) {
margin-right: 0;
}
@@ -323,7 +326,7 @@ const placeOrder = () => {
.goods-sku-view {
background: #FFFFFF;
padding: 0 30rpx;
padding: 20rpx 30rpx;
margin-top: 20rpx;
view:nth-of-type(n+1) {
@@ -362,7 +365,7 @@ const placeOrder = () => {
view:nth-of-type(1) {
align-items: flex-start;
padding-top: 40rpx;
//padding-top: 20rpx;
}
}

View File

@@ -7,20 +7,20 @@
<scroll-view class='scroll-view'>
<view class='c-flex-column' v-for='(item, index) in groupbuyList' :key='index'>
<view class='item c-flex-row' @click.stop='goPath("/pages/common/groupbuy/detail")'>
<view class='item c-flex-row' @click.stop='goPath(`/pages/common/groupbuy/detail?id=${item.id}`)'>
<image class='goods-image' :src='JSON.parse(item.content)[0].images' />
<view class='c-flex-column' style='flex: 1'>
<view class='goods-name'>{{ item.name }}</view>
<view class='middle-view c-flex-row'>
<text>原价{{ item.payPrice }}</text>
<view class='decline c-flex-row'>
<text>原价{{ item.goodsPrice }}</text>
<view v-if='(item.goodsPrice - item.payPrice)>0' class='decline c-flex-row'>
<image :src='assetsUrl("ic_decline.png")' />
<text>直降{{ item.offsetPrice }}</text>
<text>直降¥{{ (item.goodsPrice - item.payPrice).toFixed(2) }}</text>
</view>
<text>即将恢复</text>
</view>
<view class='bottom-price c-flex-row' :class='{"bottom-price-disabled":tabIndex==1}'>
<text>41</text>
<text>{{ item.payPrice }}</text>
<text>团购</text>
</view>
</view>
@@ -165,7 +165,7 @@ const fetchData = async () => {
font-weight: bold;
font-size: 40rpx;
color: #FFFFFF;
margin-left: 40rpx;
margin-left: 30rpx;
margin-bottom: 5rpx;
}

View File

@@ -0,0 +1,11 @@
<template>
</template>
<script lang='ts' setup>
</script>
<style lang='scss' scoped>
</style>

View File

@@ -24,7 +24,7 @@
<view class='divider' style='height: 83rpx' />
<view class='balance-view' @click.stop='goPath("/pages/mine/subs/recharge/index")'>
<text class='accent-text-color'>{{ userInfo?.balance }}</text>
<text>余额</text>
<text>余额()</text>
</view>
</view>

View File

@@ -20,7 +20,7 @@
<grid-view type='masonry' :cross-axis-count='2'>
<view v-for='(item, index) in goodsList' :key='index' class='goods-item'
@click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'>
<image class='goods-image' :src='item.images' />
<image class='goods-image' :src='item.images' />
<text class='goods-name'>{{ item.goodsName }}</text>
<text class='goods-price'>¥{{ item.price }}</text>
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' @click.stop='addShoppingCart(item)' />
@@ -55,8 +55,7 @@ onLoad(() => {
});
const fetchCategoryList = async () => {
const list = await getCategoryList();
categoryList.value.push(list);
categoryList.value = await getCategoryList();
await changeCategory(0);
};
@@ -80,8 +79,17 @@ const fetchGoodsList = async () => {
};
const randomImageHeight = () => {
// return Math.random() * 100 + 'rpx';
return '300rpx';
const height = getRandomFloatInRange(1, 2) * 200 + 'rpx';
console.log('--------->>>', height);
return height;
};
const getRandomIntegerInRange = (a: number, b: number) => {
return Math.floor(Math.random() * (b - a + 1)) + a;
};
const getRandomFloatInRange = (a: number, b: number) => {
return Math.random() * (b - a) + a;
};
const addShoppingCart = (goodsBean: GoodsBean) => {
@@ -184,7 +192,7 @@ const addShoppingCart = (goodsBean: GoodsBean) => {
.goods-image {
border-radius: 10rpx;
width: 100%;
max-height: 200rpx;
max-height: 300rpx;
}
.goods-name {

View File

@@ -104,6 +104,7 @@ import { assetsUrl } from '@/utils/assets';
import PaymentDialog from '@/components/payment-dialog.vue';
import CouponDialog from '@/pages/mall/subs/components/coupon-dialog.vue';
import { goPath } from '@/utils';
import { orderCreate } from '@/api/goods';
const couponDialogRef = ref();
const paymentDialogRef = ref();
@@ -119,8 +120,36 @@ const showCouponDialog = () => {
couponDialogRef.value.show();
};
const payment = () => {
const payment = async () => {
const params = {
'discount': 0,
'freePrice': 0,
'reducePrice': 0,
'totalPrice': 0,
'integral': 0,
'allowIntegral': 0,
'produceIntegralNumber': 0,
'remark': 'string',
'orderGoods': [
{
'goodsId': 'string',
'goodsCode': 'string',
'goodsNum': 0,
'stockId': 'string',
'originPrice': 0,
'consumePrice': 0,
'discount': 0,
'discountOriginPrice': 0,
'produceIntegral': 0,
'priceModify': [
0
],
'offset': 0
}
]
};
const result = await orderCreate(params);
};
</script>

View File

@@ -5,9 +5,18 @@
<script lang='ts' setup>
import { getOrderList } from '@/api/goods';
import OrderItem from '@/pages/mine/subs/order/components/order-item.vue';
const orderList = ref([1, 2, 4, 5]);
onLoad((e) => {
fetchData();
});
const fetchData = async () => {
const { rows } = await getOrderList({ pageNum: 1, pageSize: 10, obj: { payStatus: 0 } });
orderList.value = rows;
};
</script>
<style lang='scss' scoped>

View File

@@ -46,7 +46,7 @@
<view class='c-flex-row'>
<text>生日</text>
<picker mode='date' @change='changeDate'>
<text>请选择生日</text>
<text>{{ userInfo.birthday || '请选择生日' }}</text>
</picker>
</view>
</view>
@@ -103,27 +103,28 @@ const changeGender = (index: number) => {
userInfo.value.gender = index;
};
const changeDate = (e: any) => {
userInfo.value.birthday = e.detail.value;
};
const save = async () => {
const registerForm = {
unionId: userInfo.value.unionId,
openId: userInfo.value.openId,
maOpenId: userInfo.value.maOpenId,
image: userInfo.value.image,
nickName: userInfo.value.nickName,
telephone: userInfo.value.telephone,
birthday: userInfo.value.birthday,
gender: userInfo.value.gender,
companyId: userInfo.value.companyId,
creatorId: userInfo.value.creatorId
};
console.log('--------_>>>userInfo.value ', userInfo.value);
const result = await store.userRegister(registerForm);
console.log('--------->>>', result);
// const registerForm = {
// unionId: userInfo.value.unionId,
// openId: userInfo.value.openId,
// maOpenId: userInfo.value.maOpenId,
// image: userInfo.value.image,
// nickName: userInfo.value.nickName,
// telephone: userInfo.value.telephone,
// birthday: userInfo.value.birthday,
// gender: userInfo.value.gender,
// companyId: userInfo.value.companyId,
// creatorId: userInfo.value.creatorId
// };
// console.log('--------_>>>userInfo.value ', userInfo.value);
// const result = await store.userRegister(registerForm);
// console.log('--------->>>', result);
store.setUserInfo(userInfo.value)
};
</script>