diff --git a/common/api/market/index.js b/common/api/market/index.js index 0f3ed65..4f69fdb 100644 --- a/common/api/market/index.js +++ b/common/api/market/index.js @@ -9,3 +9,10 @@ export const consumeDiscount = (data) => { data: data }) } +export const homeData = (data) => { + return request({ + url: prveUrl + '/user/home/data', + method: 'get', + data: data + }) +} diff --git a/common/api/order/pointGoods.js b/common/api/order/pointGoods.js index d480e46..f5d9a5e 100644 --- a/common/api/order/pointGoods.js +++ b/common/api/order/pointGoods.js @@ -55,4 +55,12 @@ export const recordPage = (data) => { method: 'get', data: data }) +} + +export const recordOne = (data) => { + return request({ + url: url + '/user/pointGoods/record/one', + method: 'get', + data: data + }) } \ No newline at end of file diff --git a/components/coupon/coupon-icon.vue b/components/coupon/coupon-icon.vue index d8f31bd..5a252e2 100644 --- a/components/coupon/coupon-icon.vue +++ b/components/coupon/coupon-icon.vue @@ -3,8 +3,8 @@ - - {{ props.item.discountAmount }} + + {{ props.item.discountAmount }} 满{{ props.item.fullAmount }}可用 @@ -12,8 +12,8 @@ - {{ props.item.discountNum }}件 - 商品兑换 + {{ props.item.discountNum }}件 + 商品兑换 满{{ props.item.fullAmount }}可用 @@ -21,7 +21,7 @@ - {{ props.item.discountRate/10 }}折 + {{ props.item.discountRate/10 }}折 满{{ props.item.fullAmount }}可用 @@ -29,100 +29,112 @@ - 第二件 - 半价券 + 第二件 + 半价券 - 买一送 - 一券 + 买一送 + 一券 + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index f0f3aea..379cecf 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -334,7 +334,7 @@ onShow(async () => { proxy.$isResolve(); const shopId = uni.cache.get('shopId'); if (shopId) { - indexsRef.value.getVipConfig(); + indexsRef.value.updateData(); } } catch (error) {} await proxy.$onLaunched; diff --git a/pages/index/indexs.vue b/pages/index/indexs.vue index 89998c0..6e790d1 100644 --- a/pages/index/indexs.vue +++ b/pages/index/indexs.vue @@ -1,385 +1,623 @@ + .contentboxitemright_item:nth-child(2) { + margin-top: 30rpx; + } + + .contentboxitemright_item { + image { + width: 96rpx; + height: 96rpx; + } + + .contentboxitemright_itembox { + width: 170rpx; + + text:nth-child(1) { + font-family: Source Han Sans CN, Source Han Sans CN; + font-weight: 400; + font-size: 32rpx; + color: #333333; + } + + text:nth-child(2) { + margin-top: 2rpx; + font-family: Source Han Sans CN, Source Han Sans CN; + font-weight: 400; + font-size: 24rpx; + color: #999999; + } + } + } + } + } + } + } + + .popup-content { + width: 90vw; + background-color: #fff; + border-radius: 8px; + + .header-wrap { + height: 64px; + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 1px solid #ececec; + padding: 0 28upx; + + .t { + font-size: 32upx; + color: #333; + } + + .close { + $size: 60upx; + width: $size; + height: $size; + display: flex; + align-items: center; + justify-content: center; + } + } + + .btn-content { + height: 86px; + display: flex; + align-items: center; + justify-content: center; + gap: 60upx; + + .btn { + width: 248upx; + } + } + } + + .menus { + display: flex; + padding: 32rpx 40rpx; + margin-top: 150rpx; + gap: 20rpx; + + .menu-item { + background-color: #fff; + border-radius: 16rpx; + text-align: center; + padding: 32rpx 28rpx; + box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16); + flex: 1; + } + } + + .userInfo { + display: flex; + padding: 22rpx 24rpx; + margin: 0 4rpx; + align-items: center; + align-self: stretch; + border-radius: 24rpx; + background: #FFF; + transform: translateY(-36rpx); + + .vip { + background: #FA720A; + font-size: 24rpx; + color: #ffffff; + padding: 6rpx 10rpx; + margin-left: 10rpx; + border-radius: 20rpx 20rpx 20rpx 0; + } + + .code { + width: 33px; + height: 33px; + } + } + + + + .new-menus-box { + margin: 0 16rpx 34rpx 16rpx; + + .new-menus { + display: flex; + background-color: #fff; + border-radius: 16rpx; + align-items: center; + + .icon { + width: 79px; + height: 79px; + } + + &.layout2 { + padding: 29px 0; + + .diner, + .takeout { + flex: 1; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + } + + .line { + width: 2rpx; + height: 156rpx; + background: #EDEDED; + } + + .takeout {} + } + + &.layout1 { + padding: 36rpx 40rpx; + justify-content: space-between; + display: flex; + align-items: center; + + .big_img { + width: 330rpx; + height: 330rpx; + } + + .title { + font-size: 48rpx; + } + + .desc { + margin-top: 20rpx; + font-size: 32rpx; + color: #999; + } + } + } + } + + .groupBuying { + padding: 16rpx 38rpx; + border-top: 2rpx solid #EDEDED; + background-color: #fff; + display: flex; + justify-content: space-between; + align-items: center; + + .img { + width: 40px; + height: 40px; + } + } + + .title { + color: #333333; + font-size: 36rpx; + font-weight: 700; + } + + .desc { + margin-top: 16rpx; + font-size: 28rpx; + color: #999; + } + + .points { + margin-top: 34rpx; + background-color: #fff; + padding: 16rpx 68rpx; + border-radius: 16rpx; + display: flex; + align-items: center; + justify-content: space-between; + + .img { + width: 98px; + height: 98px; + } + } + + .bottom_menus { + display: flex; + gap: 14rpx; + margin-top: 34rpx; + + .item { + flex: 1; + display: flex; + padding: 20rpx; + flex-direction: column; + align-items: center; + border-radius: 18rpx; + background: #FFF; + + .img { + width: 39px; + height: 39px; + } + + .title { + font-size: 32rpx; + } + + .desc { + margin-top: 8rpx; + color: #999; + font-size: 24rpx; + white-space: nowrap; + } + } + } + \ No newline at end of file diff --git a/pages/product/index.vue b/pages/product/index.vue index 708b376..6275b8e 100644 --- a/pages/product/index.vue +++ b/pages/product/index.vue @@ -2260,7 +2260,7 @@ async function getDiscountActivity() { const res = await discountActivityApi.config({ shopId: uni.cache.get('shopId') }); - if (res) { + if (res&&typeof res=='object') { fullAmountActivity.value = res; } } diff --git a/scoreShop/detail/index.vue b/scoreShop/detail/index.vue index 3d680a4..69fda93 100644 --- a/scoreShop/detail/index.vue +++ b/scoreShop/detail/index.vue @@ -7,8 +7,9 @@ @@ -46,14 +47,17 @@ 商品详情 - + - 立即兑换 + + {{returnBtmText}} + @@ -72,31 +76,36 @@ 领取方式 - 需前往店铺自行兑换领取 + 系统发放 + 店内自取 - + + + + + - 这里是商品名称 - 8000积分+9.99元 + {{item.goodsName}} + {{item.requiredPoints}}积分+{{item.extraPrice}}元 X1 - + 优惠券为虚拟发放,一旦兑换不支持退款,请悉知 - 合计 8000积分 + ¥9.99 + 合计 {{item.requiredPoints}}积分 + ¥{{item.extraPrice}} - 确认兑换 + 确认兑换 @@ -113,18 +122,32 @@ } from '@/utils/uniapp.js' import modal from "@/scoreShop/components/modal.vue"; import * as pointGoodsApi from "@/common/api/order/pointGoods.js"; + import couponIcon from "@/components/coupon-icon/index"; + import { + pay + } from '@/utils/pay.js' const imgs = { bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png", }; const modalData = reactive({ show: false, }); + + function prveImg(url){ + uni.previewImage({ + urls:[url] + }) + } const popupData = reactive({ show: false, }); function exchangeClick() { + if (item.extraPrice > 0) { + popupData.show = true + return + } modalData.show = true; } @@ -132,7 +155,45 @@ // modalData.show = false; exchange() } + async function payExchange() { + uni.showLoading({ + title: '兑换中……' + }) + const openId = await getOpenId() + uni.hideLoading() + if (openId) { + pointGoodsApi.exchange({ + pointsGoodsId: item.id, + shopId: item.shopId, + number: 1, + price: item.extraPrice, + openId + }).then(orderRes => { + popupData.show = false; + pay(orderRes.payInfo).then(res => { + console.log(res) + if (res) { + uni.setStorageSync('exchange_goods_success', orderRes.goodsRecord) + uni.redirectTo({ + url: '/scoreShop/success/index' + }) + } else { + uni.showToast({ + title: '兑换失败', + icon: 'none' + }) + } + }) + + }) + } else { + uni.showToast({ + title: '鉴权失败,兑换失败', + icon: 'none' + }) + } + } async function exchange() { uni.showLoading({ title: '兑换中……' @@ -148,12 +209,12 @@ openId }).then(res => { modalData.show = false; - if(res){ - uni.setStorageSync('exchange_goods_success',res) + if (res) { + uni.setStorageSync('exchange_goods_success', res) uni.redirectTo({ - url:'/scoreShop/success/index' + url: '/scoreShop/success/index' }) - }else{ + } else { uni.showToast({ title: '兑换失败', icon: 'none' @@ -190,13 +251,13 @@ } const type = item.couponInfo.couponType if (type == 1) { - return item.couponInfo.discountAmount + '元代金券' + ' ' + `(满${item.fullAmount}可用)` + return item.couponInfo.discountAmount + '元代金券' + ' ' + `(满${item.couponInfo.fullAmount}可用)` } if (type == 2) { - return item.couponInfo.discountNum + '件商品兑换' + ' ' + `(满${item.fullAmount}可用)` + return item.couponInfo.discountNum + '件商品兑换' + ' ' + `(满${item.couponInfo.fullAmount}可用)` } if (type == 3) { - return item.couponInfo.discountRate / 10 + '折' + ' ' + `(满${item.fullAmount}可用)` + return item.couponInfo.discountRate / 10 + '折' + ' ' + `(满${item.couponInfo.fullAmount}可用)` } if (type == 4) { return '第二件半价券' @@ -219,11 +280,27 @@ if (item.quantity <= 0) { return false } - if(item.limitQuota&&item.boughtCount>=item.limitQuota){ + if (item.limitQuota && item.boughtCount >= item.limitQuota) { return false } return true }) + + const returnBtmText = computed(() => { + if (isCanExchange.value) { + return '立即兑换' + } + if (pointsUser.pointBalance < item.requiredPoints) { + const num = item.requiredPoints - pointsUser.pointBalance + return `积分不足,还差${num}积分` + } + if (item.quantity <= 0) { + return `库存不足` + } + if (item.limitQuota && item.boughtCount >= item.limitQuota) { + return `单人兑换已达上限` + } + }) onLoad((opt) => { const exchange_goods = uni.getStorageSync('exchange_goods') if (exchange_goods.goodsDescription) { @@ -342,7 +419,7 @@ background-color: #fff; bottom: 0; z-index: 10; - + .btn { padding: 16rpx 62rpx; @@ -383,7 +460,11 @@ height: 184rpx; border-radius: 16rpx; background: #d9d9d9; + &.bg-fff{ + background-color: #fff; + } } + } .bottom { @@ -403,4 +484,7 @@ font-size: 700; } } + .w-full{ + width: 100%; + } \ No newline at end of file diff --git a/scoreShop/index/components/goods-list.vue b/scoreShop/index/components/goods-list.vue index d85b8c7..b1445fa 100644 --- a/scoreShop/index/components/goods-list.vue +++ b/scoreShop/index/components/goods-list.vue @@ -3,10 +3,10 @@