diff --git a/src/App.vue b/src/App.vue index 7a71c7d..bb73eb2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -51,11 +51,11 @@ export default { else { //生产环境 if(import.meta.env.VITE_APP_BASE_API.includes('api.lakeapp')) { - // setCompanyId('1150930317231112193'); - // setRegisterStoreId('1150930317436633090'); + setCompanyId('1150930317231112193'); + setRegisterStoreId('1150930317436633090'); - setCompanyId('1471673498334113794'); - setRegisterStoreId('1471673498413805570'); + // setCompanyId('1471673498334113794'); + // setRegisterStoreId('1471673498413805570'); } //测试 else { diff --git a/src/api/goods/index.ts b/src/api/goods/index.ts index af49927..7d23d9d 100644 --- a/src/api/goods/index.ts +++ b/src/api/goods/index.ts @@ -1,16 +1,14 @@ -import { get, post } from '@/utils'; +import { get } from '@/utils'; import { CategoryBean, GoodsBean } from '@/api/goods/types'; enum URL { categoryList = '/ext/goods/category_list', goodsList = '/ext/goods/query', - goodsDetail = '/ext/goods/info', - shareGoodsDetail = '/wechat/coupons/group/qrcode' + goodsDetail = '/ext/goods/info' } + export const getCategoryList = () => get({ url: URL.categoryList }); export const getGoodsList = (params: any) => get({ url: URL.goodsList, data: params }); export const getGoodsDetail = (goodsId: string) => get({ url: URL.goodsDetail + `?goodsId=${goodsId}` }); - -export const getShareGoodsDetail = (shareId: string) => post({ url: URL.shareGoodsDetail + `/${shareId}` }); diff --git a/src/api/groupbuy/index.ts b/src/api/groupbuy/index.ts index f391a24..373ac18 100644 --- a/src/api/groupbuy/index.ts +++ b/src/api/groupbuy/index.ts @@ -13,11 +13,17 @@ export const getGroupBuyList = (data: { export const getGroupBuyDetail = ( id: string) => get({ url: `wechat/coupons/group/get/${id}` }); +export const getShareGoodsDetail = (shareId: string) => post({ url: '/wechat/coupons/group/qrcode/' + `${shareId}` }); + +export const getShareGoodsCouponDetail = (couponId: string) => get({ url: 'wechat/coupons/get/' + `${couponId}` }); + 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_v2', data }); +export const preOrder = (data: any) => post({ url: 'wechat/coupons/pre', data }); + +export const preOrderV2 = (data: any) => post({ url: 'wechat/coupons/group/pre_v2', data }); export const progress = (data: any) => post({ url: 'wechat/coupons/group/pay/progress', data }); diff --git a/src/pages.json b/src/pages.json index 23cee42..f1d6029 100644 --- a/src/pages.json +++ b/src/pages.json @@ -91,6 +91,15 @@ } } }, + { + "path": "groupbuy/order-coupon-confirm", + "style": { + "navigationBarTitleText": "确认订单", + "usingComponents": { + "sqb-pay": "plugin://sqb-pay/sqb-pay" + } + } + }, { "path": "webview/index", "navigationBarTitleText": "网页" diff --git a/src/pages/common/groupbuy/detail.vue b/src/pages/common/groupbuy/detail.vue index 7422f1d..8813680 100644 --- a/src/pages/common/groupbuy/detail.vue +++ b/src/pages/common/groupbuy/detail.vue @@ -51,7 +51,7 @@ - + 选择 规格 颜色/尺码 @@ -77,13 +77,16 @@ 商品详情 - + + {{ groupBuyBean?.content }} + + - + @@ -101,7 +104,7 @@ - + 赠送优惠券 @@ -109,7 +112,7 @@ - + 跟团记录 @@ -143,8 +146,14 @@ import { formatTimeWithZeroPad, goPath, isLogin } from '@/utils'; import SkuDialog from '@/components/sku-dialog.vue'; import CouponItem from './components/coupon-item.vue'; -import { getGroupBuyDetail, getGroupBuyRecordList, preOrder } from '@/api/groupbuy'; -import { getGoodsList, getShareGoodsDetail } from '@/api/goods'; +import { + getGroupBuyDetail, + getGroupBuyRecordList, + getShareGoodsCouponDetail, + getShareGoodsDetail, + preOrderV2 +} from '@/api/groupbuy'; +import { getGoodsList } from '@/api/goods'; import { GoodsBean } from '@/api/goods/types'; import { useUserStore } from '@/store'; import { GroupBuyBean, RecordBean } from '@/api/groupbuy/types'; @@ -155,6 +164,7 @@ const { userInfo } = storeToRefs(userStore); const skuDialogRef = ref(); const groupBuyBean = ref(); const recommendList = ref(); +const isCouponGoodsDetail = ref(false); const bannerList = ref([]); const swiperIndex = ref(0); @@ -180,14 +190,22 @@ onLoad(async (e: any) => { const { group, share } = await getShareGoodsDetail(e.shareId); groupBuyBean.value = group; } + if(e.couponId != undefined) { + isCouponGoodsDetail.value = true; + groupBuyBean.value = await getShareGoodsCouponDetail(e.couponId); + groupBuyBean.value.price = groupBuyBean.value?.offsetPrice; + bannerList.value = groupBuyBean.value?.image?.split(','); + } // setCompanyId('1512403904150138881'); // groupBuyBean.value = await getGroupBuyDetail('1740922051118063618'); if(groupBuyBean.value) { - groupBuyBean.value.goods.price = groupBuyBean.value.price; - bannerList.value = JSON.parse(groupBuyBean.value.content).filter((item: any) => item.type === 2).map((item: any) => item.images); countdown(); - await fetchRecommendList(); - await fetchBuyRecordList(); + if(e.couponId === undefined) { + groupBuyBean.value.goods.price = groupBuyBean.value?.price || 0; + bannerList.value = JSON.parse(groupBuyBean.value?.content).filter((item: any) => item.type === 2).map((item: any) => item.images); + await fetchRecommendList(); + await fetchBuyRecordList(); + } } uni.hideLoading(); } else { @@ -282,7 +300,8 @@ const showSkuDialog = (fn: Function) => { const placeOrder = async () => { - async function create(bean: GoodsBean) { + async function createGoodsOrder(bean: GoodsBean) { + await uni.showLoading(); const params = { 'colorId': bean.checkedStock.colorId, 'sizeId': bean.checkedStock.sizeId, @@ -292,13 +311,18 @@ const placeOrder = async () => { 'shareId': '123456' }; - const result = await preOrder(params); + const result = await preOrderV2(params); + uni.hideLoading(); goPath(`/pages/common/groupbuy/order-confirm?orderBean=${encodeURIComponent(JSON.stringify(result))}`); } - showSkuDialog((e: GoodsBean) => { - create(e); - }); + if(isCouponGoodsDetail.value) { + goPath(`/pages/common/groupbuy/order-coupon-confirm?bean=${encodeURIComponent(JSON.stringify(groupBuyBean.value))}`); + } else { + showSkuDialog((e: GoodsBean) => { + createGoodsOrder(e); + }); + } }; @@ -679,18 +703,19 @@ const placeOrder = async () => { margin: 0 15rpx; text:nth-of-type(1) { - font-size: 20rpx; + font-size: 25rpx; color: #333333; } text:nth-of-type(2) { - font-size: 15rpx; + font-size: 25rpx; color: #666666; margin-top: 10rpx; } } text:nth-of-type(1) { + font-size: 30rpx; color: #F32B2B; } } diff --git a/src/pages/common/groupbuy/order-confirm.vue b/src/pages/common/groupbuy/order-confirm.vue index 4fbe737..9fa07b5 100644 --- a/src/pages/common/groupbuy/order-confirm.vue +++ b/src/pages/common/groupbuy/order-confirm.vue @@ -1,6 +1,5 @@