完成团购立即秒杀功能
This commit is contained in:
parent
e596011106
commit
36b69c31b1
@ -434,10 +434,9 @@ image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.GoodsMsg {
|
.GoodsMsg {
|
||||||
/* font-size: 30rpx; */
|
font-size: 30rpx;
|
||||||
color: #222222;
|
color: #222222;
|
||||||
margin: 0 20rpx;
|
margin: 20rpx;
|
||||||
margin-top: 55rpx;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,8 +542,9 @@ image {
|
|||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.car_right_box{
|
.car_right_box {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.car_right {
|
.car_right {
|
||||||
@ -553,7 +553,6 @@ image {
|
|||||||
/* background: linear-gradient(91deg, #FF7658 0%, #FF370B 100%); */
|
/* background: linear-gradient(91deg, #FF7658 0%, #FF370B 100%); */
|
||||||
background: #ff712c;
|
background: #ff712c;
|
||||||
border-radius: 20rpx 0 0 20rpx;
|
border-radius: 20rpx 0 0 20rpx;
|
||||||
font-size: 36rpx;
|
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -566,7 +565,6 @@ image {
|
|||||||
height: 70rpx;
|
height: 70rpx;
|
||||||
background: #ff3b31;
|
background: #ff3b31;
|
||||||
border-radius: 0 20rpx 20rpx 0;
|
border-radius: 0 20rpx 20rpx 0;
|
||||||
font-size: 36rpx;
|
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -931,12 +929,12 @@ image {
|
|||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
border: 1rpx solid red;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemSize_top {
|
.itemSize_top {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: 30rpx;
|
margin-left: 30rpx;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemSize_info {
|
.itemSize_info {
|
||||||
@ -1108,3 +1106,346 @@ image {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 立即秒杀 */
|
||||||
|
.address-section {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-info {
|
||||||
|
padding: 20rpx 30rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: 1rpx solid #eee;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-main {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-name-phone {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-detail {
|
||||||
|
color: #666;
|
||||||
|
line-height: 40rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address-arrow {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity-control {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10rpx;
|
||||||
|
right: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.decrease-btn {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border: 1rpx solid #ccc;
|
||||||
|
border-radius: 50%;
|
||||||
|
line-height: 33rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.increase-btn {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
background-color: #ff502a;
|
||||||
|
border-radius: 50%;
|
||||||
|
line-height: 33rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quantity {
|
||||||
|
margin: 0 15rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 支付方式区域 */
|
||||||
|
.payment-section {
|
||||||
|
background-color: #fff;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
margin-top: 15rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-item {
|
||||||
|
padding: 30rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: 1rpx solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-icon {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-icon image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-name {
|
||||||
|
font-size: 28rpx;
|
||||||
|
margin-bottom: 5rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-desc {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-select {
|
||||||
|
color: #FF7658;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 立即支付按钮 */
|
||||||
|
.pay-button {
|
||||||
|
width: 50%;
|
||||||
|
height: 70rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
line-height: 70rpx;
|
||||||
|
text-align: center;
|
||||||
|
background: linear-gradient(91deg, #FF7658 0%, #FF370B 100%);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹窗 - 支付成功 */
|
||||||
|
.pay-success-shadow {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.4);
|
||||||
|
z-index: 9999;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-success-container {
|
||||||
|
width: 85%;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 15px;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-success-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-success-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-icon {
|
||||||
|
width: 50rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.verify-code-section {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #666666;
|
||||||
|
margin: 20rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 下单福利样式 */
|
||||||
|
.welfare-container {
|
||||||
|
width: 95%;
|
||||||
|
padding: 20rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-title image {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-action {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-box {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 15rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||||
|
flex: 1;
|
||||||
|
margin: 0 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-item-top {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-item-top image {
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-item-top view {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-item>view:nth-child(2) {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ff6b6b;
|
||||||
|
margin: 10rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welfare-item-bottom {
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #999999;
|
||||||
|
margin-top: 5rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 底部邀请区域样式 */
|
||||||
|
.bottom2 {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
padding: 0 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-section {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-text {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-line1,
|
||||||
|
.invite-line2 {
|
||||||
|
flex: 1;
|
||||||
|
height: 1rpx;
|
||||||
|
background-color: #e5e5e5;
|
||||||
|
margin: 0 15rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-buttons {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 15rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-item image {
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-item view {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-btn-wechat {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
opacity: 0;
|
||||||
|
position: absolute;
|
||||||
|
left: 160rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-btn-miniprogram {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
opacity: 0;
|
||||||
|
position: absolute;
|
||||||
|
right: 180rpx;
|
||||||
|
}
|
||||||
@ -200,7 +200,8 @@
|
|||||||
加入购物车
|
加入购物车
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="seckill">
|
<view class="seckill" v-if="info.commodity_goods_info_list[currentGGIndex].total_stock != 0"
|
||||||
|
@click="showSeckillPopup">
|
||||||
立即秒杀
|
立即秒杀
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -331,6 +332,182 @@
|
|||||||
{{ item.goods_name }} {{ item.goods_spec }} / {{ item.goods_unit }}
|
{{ item.goods_name }} {{ item.goods_spec }} / {{ item.goods_unit }}
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
|
||||||
|
<!-- 立即秒杀 -->
|
||||||
|
<u-popup :show="showSeckill" round="20rpx" mode="bottom" @close="closeSeckill">
|
||||||
|
<view class="popup-header">
|
||||||
|
<h3 class="popup-header-h3">立即秒杀</h3>
|
||||||
|
<view class="popup-header-view" @click="closeSeckill">取消</view>
|
||||||
|
</view>
|
||||||
|
<view class="address-section">
|
||||||
|
<view @click="editAddress()">
|
||||||
|
<view v-if="defZTAddress.length > 0">
|
||||||
|
<view v-for="(adItem, adIndex) in defZTAddress" :key="adIndex">
|
||||||
|
<view class="address-info" v-if="adItem.id == supplierId">
|
||||||
|
<view class="address-main">
|
||||||
|
<view class="address-name-phone">
|
||||||
|
<text class="name">{{ adItem.name }}</text>
|
||||||
|
<text class="phone">{{ adItem.phone }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="address-detail">
|
||||||
|
{{ adItem.address }}
|
||||||
|
<view class="copy-icon" @click.stop="copyZTAddress" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="address-info" v-if="!defZTAddress.some(adItem => adItem.id == supplierId)">
|
||||||
|
<view class="address-main">
|
||||||
|
<view class="address-name-phone">
|
||||||
|
<text class="name">请选择自提点</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="address-info" v-else>
|
||||||
|
<view class="address-main">
|
||||||
|
<view class="address-name-phone">
|
||||||
|
<text class="name">请选择自提点</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="itemSize_top">
|
||||||
|
<image :src="changeImg" class="itemSize-img"></image>
|
||||||
|
<view class="itemSize_info">
|
||||||
|
<view class="itemSize_name">{{ changeName }}</view>
|
||||||
|
<view class="itemSize_price">¥{{ changePrice }}/袋</view>
|
||||||
|
</view>
|
||||||
|
<view class="quantity-control">
|
||||||
|
<view class="decrease-btn" @tap.stop="decreaseQuantity()">-</view>
|
||||||
|
<view class="quantity">{{ changeCount }}</view>
|
||||||
|
<view class="increase-btn" @tap.stop="increaseQuantity()">+</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="itemSize" v-for="(item, index) in info.commodity_goods_info_list" :key="item.id"
|
||||||
|
@click="changeGG(item, index)" :class="index == currentGGIndex ? 'itemSize_active' : ''">
|
||||||
|
{{ item.goods_name }} {{ item.goods_spec }} / {{ item.goods_unit }}
|
||||||
|
</view>
|
||||||
|
<view class="fenge"></view>
|
||||||
|
<!-- 支付方式 -->
|
||||||
|
<view class="payment-section">
|
||||||
|
<view class="payment-item" @click="selectPayment('wechat')">
|
||||||
|
<view class="payment-icon">
|
||||||
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png"
|
||||||
|
mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
<view class="payment-content">
|
||||||
|
<view class="payment-name">微信支付</view>
|
||||||
|
</view>
|
||||||
|
<view class="payment-select" v-if="selectedPayment === 'wechat'">
|
||||||
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"
|
||||||
|
mode="aspectFit" style="width: 30rpx; height: 30rpx;"></image>
|
||||||
|
</view>
|
||||||
|
<view class="payment-select" v-else>
|
||||||
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"
|
||||||
|
mode="aspectFit" style="width: 30rpx; height: 30rpx;"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="pay-button" @click="submitPayment">立即支付</view>
|
||||||
|
</u-popup>
|
||||||
|
|
||||||
|
<!-- 弹窗 - 支付成功 -->
|
||||||
|
<view class="pay-success-shadow" @click="changeShadow2" v-if="boxshadow5">
|
||||||
|
<view class="pay-success-container">
|
||||||
|
<view class="pay-success-content">
|
||||||
|
<view class="pay-success-title">
|
||||||
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/af_√.png" class="success-icon">
|
||||||
|
</image>
|
||||||
|
已支付成功
|
||||||
|
</view>
|
||||||
|
<view class="verify-code-section">
|
||||||
|
<view v-if="verifyCode">核销码:{{ verifyCode }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="welfare-container">
|
||||||
|
<view class="welfare-header">
|
||||||
|
<view class="welfare-title">
|
||||||
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/groupPurchase/welfare.png"></image>
|
||||||
|
下单福利
|
||||||
|
</view>
|
||||||
|
<view class="welfare-action">已获得</view>
|
||||||
|
</view>
|
||||||
|
<view class="welfare-box">
|
||||||
|
<view class="welfare-item welfare-item-points">
|
||||||
|
<view class="welfare-item-top">
|
||||||
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_fen.png" mode="aspectFit">
|
||||||
|
</image>
|
||||||
|
<view>石榴分</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
{{ slFen }}
|
||||||
|
</view>
|
||||||
|
<view class="welfare-item-bottom">
|
||||||
|
可抵扣 ¥{{ slFen }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="welfare-item welfare-item-coupon">
|
||||||
|
<view class="welfare-item-top">
|
||||||
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_zi.png" mode="aspectFit">
|
||||||
|
</image>
|
||||||
|
<view>石榴籽</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
{{ slZi }}
|
||||||
|
</view>
|
||||||
|
<view class="welfare-item-bottom">
|
||||||
|
可抵扣 ¥{{ slZi }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="welfare-item welfare-item-beans">
|
||||||
|
<view class="welfare-item-top">
|
||||||
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/activity_jin.png" mode="aspectFit"/>
|
||||||
|
<view>石榴金</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
{{ slJin }}
|
||||||
|
</view>
|
||||||
|
<view class="welfare-item-bottom">
|
||||||
|
可抵扣 ¥{{ slJin }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="bottom2">
|
||||||
|
<view class="invite-section">
|
||||||
|
<view class="invite-text">
|
||||||
|
<view class="invite-line1"></view>
|
||||||
|
赶快邀请好友来下单吧
|
||||||
|
<view class="invite-line2"></view>
|
||||||
|
</view>
|
||||||
|
<view @click.stop="changeShadow2">
|
||||||
|
<view class="share-buttons">
|
||||||
|
<button class="share-btn-wechat" open-type="share" bindtap="onShareButtonClick" />
|
||||||
|
<view class="share-item">
|
||||||
|
<image
|
||||||
|
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_WX.png"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
微信好友
|
||||||
|
</view>
|
||||||
|
<button class="share-btn-miniprogram" open-type="share" bindtap="onShareButtonClick" />
|
||||||
|
<view class="share-item" @click="shareFriend">
|
||||||
|
<image
|
||||||
|
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_WX.png"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
小程序链接
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -352,6 +529,11 @@ export default {
|
|||||||
type: "error",
|
type: "error",
|
||||||
boxshadow1: false,
|
boxshadow1: false,
|
||||||
boxshadow2: false,
|
boxshadow2: false,
|
||||||
|
boxshadow5: false,
|
||||||
|
verifyCode: '',
|
||||||
|
slFen: 0,
|
||||||
|
slZi: 0,
|
||||||
|
slJin: 0,
|
||||||
id: "",
|
id: "",
|
||||||
groupById: "",
|
groupById: "",
|
||||||
info: "",
|
info: "",
|
||||||
@ -367,6 +549,7 @@ export default {
|
|||||||
|
|
||||||
show: false,
|
show: false,
|
||||||
showSize: false,
|
showSize: false,
|
||||||
|
showSeckill: false,
|
||||||
showPurchase: false,
|
showPurchase: false,
|
||||||
purchaseRecords: [],
|
purchaseRecords: [],
|
||||||
totalCount: 0,
|
totalCount: 0,
|
||||||
@ -380,9 +563,183 @@ export default {
|
|||||||
endTheCountdownMinute: '',
|
endTheCountdownMinute: '',
|
||||||
endTheCountdownSecond: '',
|
endTheCountdownSecond: '',
|
||||||
timer: null, // 定时器ID
|
timer: null, // 定时器ID
|
||||||
|
defZTAddress: [],
|
||||||
|
selectedPayment: 'wechat', // 默认选择微信支付
|
||||||
|
changeCount: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//获取自提点
|
||||||
|
getZTAddress() {
|
||||||
|
setTimeout(() => {
|
||||||
|
let changeAddress = uni.getStorageSync('changeZTAddress')
|
||||||
|
if (changeAddress) {
|
||||||
|
this.defZTAddress = changeAddress
|
||||||
|
}
|
||||||
|
}, 100)
|
||||||
|
},
|
||||||
|
selectPayment(payment) {
|
||||||
|
this.selectedPayment = payment;
|
||||||
|
},
|
||||||
|
// 增加数量
|
||||||
|
increaseQuantity() {
|
||||||
|
this.changeCount++;
|
||||||
|
},
|
||||||
|
// 减少数量
|
||||||
|
decreaseQuantity() {
|
||||||
|
if (this.changeCount > 0) {
|
||||||
|
this.changeCount--;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 提交支付
|
||||||
|
submitPayment() {
|
||||||
|
// 检查是否选择了自提点
|
||||||
|
if (this.defZTAddress.length == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请选择自提点',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查商品数量
|
||||||
|
if (this.changeCount <= 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请选择购买数量',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前时间和活动时间,检查是否在团购活动时间内
|
||||||
|
const currentTime = new Date().getTime();
|
||||||
|
const activityInfo = this.currentGG.group_buy_activity_info;
|
||||||
|
let isGroupBuyValid = false;
|
||||||
|
|
||||||
|
if (activityInfo) {
|
||||||
|
const startTime = new Date(activityInfo.start_time).getTime();
|
||||||
|
const endTime = new Date(activityInfo.end_time).getTime();
|
||||||
|
isGroupBuyValid = currentTime >= startTime && currentTime <= endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据平台设置不同的trans_type值
|
||||||
|
// 小程序: 71, App: 51
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
let trans_type = 51; // 默认App环境
|
||||||
|
|
||||||
|
// 运行时判断是否为小程序环境
|
||||||
|
if (systemInfo.platform === 'devtools' || systemInfo.platform === 'unknown') {
|
||||||
|
trans_type = 71; // 开发工具或未知环境默认为小程序
|
||||||
|
}
|
||||||
|
|
||||||
|
// 条件编译:针对不同平台设置不同值
|
||||||
|
// #ifdef MP
|
||||||
|
trans_type = 71; // 所有小程序平台
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
trans_type = 51; // App平台
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 创建订单参数
|
||||||
|
const params = {
|
||||||
|
user_id: uni.getStorageSync('userId'),
|
||||||
|
order_cate: isGroupBuyValid ? 2 : 1, // 2表示团购订单
|
||||||
|
goods_list: [{
|
||||||
|
supplier_id: this.info.supplier_id,
|
||||||
|
supplier_name: this.info.merchant_info.merchant_name || '',
|
||||||
|
is_same_day: this.currentGG.is_same_day || false,
|
||||||
|
receiving_name: this.defZTAddress[0].name || '',
|
||||||
|
receiving_phone: this.defZTAddress[0].phone || '',
|
||||||
|
receiving_address: this.defZTAddress[0].address || '',
|
||||||
|
merchant_id: this.defZTAddress[0].address_id,
|
||||||
|
group_buy_activity_id: this.currentGG.group_buy_activity_id,
|
||||||
|
goods_and_count: [{
|
||||||
|
goods_id: this.currentGG.id,
|
||||||
|
count: this.changeCount,
|
||||||
|
price: isGroupBuyValid ? this.currentGG.group_buy_price : this.currentGG.sales_price
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用创建订单接口
|
||||||
|
request(apiArr.createOrder, "POST", params).then(resVal => {
|
||||||
|
// 调用预下单接口
|
||||||
|
const preOrderParam = {
|
||||||
|
order_id: resVal.order_id,
|
||||||
|
user_id: uni.getStorageSync('userId'),
|
||||||
|
trans_type: trans_type
|
||||||
|
}
|
||||||
|
|
||||||
|
request(apiArr.mergePreorder, "POST", preOrderParam).then(res => {
|
||||||
|
// 处理预下单响应
|
||||||
|
this.handleMergePreorderResponse(res, resVal.order_id);
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('创建订单失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '创建订单失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理mergePreorder接口的响应
|
||||||
|
handleMergePreorderResponse(res, orderId) {
|
||||||
|
if (res && res.timeStamp && res.nonceStr && res.package && res.signType && res.paySign) {
|
||||||
|
// 调用微信支付
|
||||||
|
uni.requestPayment({
|
||||||
|
timeStamp: res.timeStamp,
|
||||||
|
nonceStr: res.nonceStr,
|
||||||
|
package: res.package,
|
||||||
|
signType: res.signType,
|
||||||
|
paySign: res.paySign,
|
||||||
|
success: (payRes) => {
|
||||||
|
// 支付成功后查询订单
|
||||||
|
const params = {
|
||||||
|
order_id: orderId,
|
||||||
|
from: 2, // 2表示团购订单
|
||||||
|
group_buy_activity_id: this.currentGG.group_buy_activity_id,
|
||||||
|
adver_id: ''
|
||||||
|
}
|
||||||
|
request(apiArr.queryOrder, "POST", params).then(res => {
|
||||||
|
// 设置核销码和福利数据
|
||||||
|
this.verifyCode = res.verification_code;
|
||||||
|
this.slFen = res.shiliu_fen || 0;
|
||||||
|
this.slZi = res.shiliu_zi || 0;
|
||||||
|
this.slJin = res.shiliu_money || 0;
|
||||||
|
|
||||||
|
// 显示支付成功弹窗
|
||||||
|
this.boxshadow5 = true;
|
||||||
|
|
||||||
|
// 关闭支付弹窗
|
||||||
|
this.closeSeckill();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (payErr) => {
|
||||||
|
uni.showToast({
|
||||||
|
title: payErr.errMsg == 'requestPayment:fail cancel' ? '已取消支付' : '支付失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
const params = {
|
||||||
|
order_ids: orderId,
|
||||||
|
}
|
||||||
|
request(apiArr.cancelPay, "POST", params).then(res => {
|
||||||
|
// 取消支付后的处理
|
||||||
|
})
|
||||||
|
},
|
||||||
|
complete: () => {
|
||||||
|
// 支付完成后的回调,无论成功失败都会执行
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.error("获取支付参数失败,缺少必要参数")
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取支付信息失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
// 显示团购记录
|
// 显示团购记录
|
||||||
showPurchaseRecords() {
|
showPurchaseRecords() {
|
||||||
if (this.purchaseRecords.length > 0) {
|
if (this.purchaseRecords.length > 0) {
|
||||||
@ -401,6 +758,39 @@ export default {
|
|||||||
this.showPurchase = false;
|
this.showPurchase = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 关闭支付成功弹窗
|
||||||
|
changeShadow2() {
|
||||||
|
this.boxshadow5 = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 分享给微信好友
|
||||||
|
shareFriend() {
|
||||||
|
this.boxshadow5 = false; // 关闭分享弹窗
|
||||||
|
|
||||||
|
// 调用分享API
|
||||||
|
if (typeof uni.share !== 'undefined') {
|
||||||
|
uni.share({
|
||||||
|
provider: 'weixin',
|
||||||
|
scene: 'WXSceneSession',
|
||||||
|
type: 0,
|
||||||
|
title: this.currentGG.goods_name || '商品分享',
|
||||||
|
summary: this.currentGG.commodity_brief || '快来看看这款商品吧',
|
||||||
|
href: `${window.location.origin}/pages/goodsDetail/index?id=${this.id}`,
|
||||||
|
imageUrl: this.picUrl + (this.currentGG.goods_carousel && this.currentGG.goods_carousel[0] || ''),
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '分享成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('分享失败', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
//去下单
|
//去下单
|
||||||
goSubmit() {
|
goSubmit() {
|
||||||
NavgateTo('/packages/shop/groupPurchaseSubmit/index')
|
NavgateTo('/packages/shop/groupPurchaseSubmit/index')
|
||||||
@ -792,11 +1182,31 @@ export default {
|
|||||||
this.showSize = false;
|
this.showSize = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 立即秒杀
|
||||||
|
showSeckillPopup() {
|
||||||
|
this.showSeckill = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
closeSeckill() {
|
||||||
|
this.showSeckill = false;
|
||||||
|
uni.removeStorageSync('changeZTAddress')
|
||||||
|
this.defZTAddress = {}
|
||||||
|
},
|
||||||
|
|
||||||
|
editAddress() {
|
||||||
|
const item = {
|
||||||
|
goods_id: this.info.commodity_goods_info_list[this.currentGGIndex].id,
|
||||||
|
supplier_id: this.itemObj.supplier_id,
|
||||||
|
}
|
||||||
|
NavgateTo('../ztLocation/index?item=' + JSON.stringify(item));
|
||||||
|
},
|
||||||
|
|
||||||
// 购买记录
|
// 购买记录
|
||||||
getBuyRecord() {
|
getBuyRecord() {
|
||||||
const params = {
|
const params = {
|
||||||
activity_id: this.groupById,
|
activity_id: this.groupById,
|
||||||
goods_id: this.itemObj.id,
|
goods_id: this.itemObj.id,
|
||||||
|
adver_id: this.itemObj.adver_id,
|
||||||
}
|
}
|
||||||
request(apiArr2.groupBuyRecord, 'POST', params).then(res => {
|
request(apiArr2.groupBuyRecord, 'POST', params).then(res => {
|
||||||
const record = res.group_buy_record.map(item => {
|
const record = res.group_buy_record.map(item => {
|
||||||
@ -870,6 +1280,7 @@ export default {
|
|||||||
this.getGoodsInfo();
|
this.getGoodsInfo();
|
||||||
});
|
});
|
||||||
this.getShopCar();
|
this.getShopCar();
|
||||||
|
this.getZTAddress()
|
||||||
},
|
},
|
||||||
|
|
||||||
//离开页面的时候直接更新购物车数量(目前接口是 传入商品id 数量。如果有当前商品就更新数量。如果没有就增加商品。如果删除某个商品 count 为0 就删除)
|
//离开页面的时候直接更新购物车数量(目前接口是 传入商品id 数量。如果有当前商品就更新数量。如果没有就增加商品。如果删除某个商品 count 为0 就删除)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user