diff --git a/src/api/goods/index.ts b/src/api/goods/index.ts index bfe9876..42466ab 100644 --- a/src/api/goods/index.ts +++ b/src/api/goods/index.ts @@ -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({ url: URL.categoryList }); +export const getCategoryList = () => get({ url: URL.categoryList }); -export const getGoodsList = (params: any) => get({ url: URL.goodsList, data: params }); +export const getGoodsList = (params: any) => get({ url: URL.goodsList, data: params }); export const getGoodsDetail = (goodsId: string) => get({ 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 }); diff --git a/src/api/groupbuy/index.ts b/src/api/groupbuy/index.ts index e3de418..55f09c9 100644 --- a/src/api/groupbuy/index.ts +++ b/src/api/groupbuy/index.ts @@ -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 }); + diff --git a/src/pages/common/groupbuy/detail.vue b/src/pages/common/groupbuy/detail.vue index 4338142..07f19e9 100644 --- a/src/pages/common/groupbuy/detail.vue +++ b/src/pages/common/groupbuy/detail.vue @@ -3,7 +3,7 @@ - + @@ -16,8 +16,8 @@ 超级\n秒杀 - 52 - ¥65 + {{ detailBean?.payPrice }} + ¥{{ detailBean?.goodsPrice || 0 }} 180天 @@ -34,11 +34,11 @@ 39.89 - 销量2653 + 销量{{ detailBean.totalNum }} - 女童夏装套装洋气装短袖阔腿裤子夏装夏装套装 + {{ detailBean.name }} - - - 参数 - 品牌 风格 季节 款号 - - @@ -77,9 +71,10 @@ 商品详情 - - - + + @@ -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'); }; @@ -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; } } diff --git a/src/pages/common/groupbuy/index.vue b/src/pages/common/groupbuy/index.vue index c54d91a..bef9633 100644 --- a/src/pages/common/groupbuy/index.vue +++ b/src/pages/common/groupbuy/index.vue @@ -7,20 +7,20 @@ - + {{ item.name }} - 原价:¥{{ item.payPrice }} - + 原价:¥{{ item.goodsPrice }} + - 直降¥{{ item.offsetPrice }} + 直降¥{{ (item.goodsPrice - item.payPrice).toFixed(2) }} 即将恢复 - 41 + {{ item.payPrice }} 团购 @@ -165,7 +165,7 @@ const fetchData = async () => { font-weight: bold; font-size: 40rpx; color: #FFFFFF; - margin-left: 40rpx; + margin-left: 30rpx; margin-bottom: 5rpx; } diff --git a/src/pages/common/groupbuy/order.vue b/src/pages/common/groupbuy/order.vue new file mode 100644 index 0000000..f45039f --- /dev/null +++ b/src/pages/common/groupbuy/order.vue @@ -0,0 +1,11 @@ + + + + + diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue index af45156..e44340a 100644 --- a/src/pages/home/index.vue +++ b/src/pages/home/index.vue @@ -24,7 +24,7 @@ {{ userInfo?.balance }} - 余额(元) + 余额(元) diff --git a/src/pages/mall/index.vue b/src/pages/mall/index.vue index dfb8ae5..630549f 100644 --- a/src/pages/mall/index.vue +++ b/src/pages/mall/index.vue @@ -20,7 +20,7 @@ - + {{ item.goodsName }} ¥{{ item.price }} @@ -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 { diff --git a/src/pages/mall/subs/order/order-confirm.vue b/src/pages/mall/subs/order/order-confirm.vue index 331820f..9cc98a5 100644 --- a/src/pages/mall/subs/order/order-confirm.vue +++ b/src/pages/mall/subs/order/order-confirm.vue @@ -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); }; diff --git a/src/pages/mine/subs/order/index.vue b/src/pages/mine/subs/order/index.vue index 7f98b21..05aac24 100644 --- a/src/pages/mine/subs/order/index.vue +++ b/src/pages/mine/subs/order/index.vue @@ -5,9 +5,18 @@