下单模块

This commit is contained in:
duan 2024-05-13 16:35:37 +08:00
parent 1d00f35bc9
commit 740c83bb4a
3 changed files with 146 additions and 11 deletions

View File

@ -12,6 +12,10 @@ export default {
getproductorderConfirm(data) {
return uni.api.get("/product/orderConfirm", data);
},
// 下单
creatGroupOrder(data) {
return uni.api.post("/groupOrderInfo/creatGroupOrder", data);
},
cartadd(data) { //添加到购物车
return uni.api.post("/cart/add", data);
},

View File

@ -21,7 +21,7 @@
<view>
<text></text> <text></text> <text></text> <text>:</text>
</view>
<text>{{info.payTime}}</text>
<text>{{info.payTime==null?'':info.payTime}}</text>
</view>
<view class="content">
<view>

View File

@ -13,8 +13,8 @@
</view>
<view class="placetopmoney">
<view>
<text>12</text>
<text>13</text>
<text>{{info.originPrice}}</text>
<text>{{info.salePrice}}</text>
</view>
<u-number-box v-model="Quantity">
<view slot="minus" class="minus">
@ -28,15 +28,36 @@
</view>
</view>
<view class="redMoney">
<view class="">
<view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png"
style="width: 30rpx;height: 30.24rpx;;" mode=""></image>
红包/低佣券
</view>
<view class="">
有20张优惠券可选择
<view>
{{info.couponDetail.name}}
</view>
</view>
<view style="background-color: #F6F6F6;height: 2rpx;width: 100%;margin-top: 8rpx;"></view>
<view class="jiesuanmoney">
<text>
优惠<text style="color: #FF4C11;font-weight: 500;">{{info.save * Quantity}}</text>
</text>
<text>
小计<text style="color: #FF4C11;font-weight: 500;">{{info.salePrice * Quantity}}</text>
</text>
</view>
</view>
<view class="placeBottom">
<view class="">
<text style="font-size: 24rpx;font-weight: bold;"> 合计 </text><text
style="font-size: 32rpx;font-weight: bold;color:#FF4C11"> {{info.salePrice * Quantity}} </text>
<text style="font-size: 24rpx;font-weight: 400;color: # 999;">含优惠卷包0</text>
</view>
<view class="">
{{Quantity}} 已优惠{{info.save * Quantity}}
</view>
<button class="btnStyle" @click="sumbitFrom">提交订单</button>
</view>
</view>
</template>
@ -52,8 +73,53 @@
}
},
methods: {
valChange(e) {
console.log('当前值为: ' + e.value)
async sumbitFrom() {
let payMoney = this.info.salePrice * this.Quantity
let res = await this.api.creatGroupOrder({
num: this.Quantity,
proId: this.info.proId,
shopId: this.info.shopId,
payAmount: payMoney,
orderAmount: payMoney
})
if (res.code == 0) {
//
this.payEvent(res.data.id)
}
},
async payEvent(id) {
let res = await this.api.payOrderPay({
payType:'wechatPay',
orderId:id,
})
if (res) {
return
uni.requestPayment({
provider: 'wxpay', //-
partnerid: res.data.payAppId, //
timeStamp: res.data.payTimeStamp, //
nonceStr: res.data.paynonceStr, //
package: res.data.payPackage, //
signType: res.data.paySignType, //
paySign: res.data.paySign, //
success: (res) => {
uni.showToast({
title: "支付成功"
})
uni.navigateBack()
},
fail: (err) => {
setTimeout(res => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
uni.hideLoading()
}, 2000)
}
});
}
},
async getInfo(id) {
let res = await this.api.getproductorderConfirm({
@ -61,7 +127,6 @@
})
if (res.code == 0) {
this.info = res.data
console.log(this.info, 'tiaoshi1')
}
}
}
@ -126,8 +191,74 @@
.m(30rpx);
>view:first-child {
.df
.df;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
background: #FFE9E9;
border-radius: 16rpx 16rpx 16rpx 16rpx;
font-weight: 400;
font-size: 28rpx;
color: #FF3333;
text-align: center;
padding: 9rpx 13rpx;
}
}
.jiesuanmoney {
height: 112rpx;
line-height: 112rpx;
text-align: right;
>text:first-child {
font-size: 24rpx;
}
>text:last-child {
font-size: 32rpx;
margin-left: 20rpx;
}
}
}
.placeBottom {
position: fixed;
bottom: 0%;
left: 0;
width: 100%;
height: 148rpx;
background-color: #fff;
padding: 16rpx 34rpx;
>view:last-child {
margin-top: 16rpx;
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
.btnStyle {
width: 302rpx;
height: 72rpx;
line-height: 72rpx;
text-align: center;
background: linear-gradient(110deg, #F1A666 0%, #FF4C11 100%);
border-radius: 48rpx 48rpx 48rpx 48rpx;
font-weight: bold;
font-size: 36rpx;
color: #FFFFFF;
position: absolute;
right: 58rpx;
top: 30rpx;
}
}
}