下单模块
This commit is contained in:
parent
1d00f35bc9
commit
740c83bb4a
|
|
@ -12,6 +12,10 @@ export default {
|
||||||
getproductorderConfirm(data) {
|
getproductorderConfirm(data) {
|
||||||
return uni.api.get("/product/orderConfirm", data);
|
return uni.api.get("/product/orderConfirm", data);
|
||||||
},
|
},
|
||||||
|
// 下单
|
||||||
|
creatGroupOrder(data) {
|
||||||
|
return uni.api.post("/groupOrderInfo/creatGroupOrder", data);
|
||||||
|
},
|
||||||
cartadd(data) { //添加到购物车
|
cartadd(data) { //添加到购物车
|
||||||
return uni.api.post("/cart/add", data);
|
return uni.api.post("/cart/add", data);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<view>
|
<view>
|
||||||
<text>付</text> <text>款</text> <text>时</text> <text>间:</text>
|
<text>付</text> <text>款</text> <text>时</text> <text>间:</text>
|
||||||
</view>
|
</view>
|
||||||
<text>{{info.payTime}}</text>
|
<text>{{info.payTime==null?'':info.payTime}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view>
|
<view>
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="placetopmoney">
|
<view class="placetopmoney">
|
||||||
<view>
|
<view>
|
||||||
<text>¥12</text>
|
<text>¥{{info.originPrice}}</text>
|
||||||
<text>¥13</text>
|
<text>¥{{info.salePrice}}</text>
|
||||||
</view>
|
</view>
|
||||||
<u-number-box v-model="Quantity">
|
<u-number-box v-model="Quantity">
|
||||||
<view slot="minus" class="minus">
|
<view slot="minus" class="minus">
|
||||||
|
|
@ -28,15 +28,36 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="redMoney">
|
<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>
|
||||||
|
<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="">
|
<view class="">
|
||||||
有20张优惠券可选择
|
<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>
|
||||||
|
<view class="">
|
||||||
|
共{{Quantity}}件 已优惠¥{{info.save * Quantity}}
|
||||||
</view>
|
</view>
|
||||||
|
<button class="btnStyle" @click="sumbitFrom">提交订单</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -52,8 +73,53 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
valChange(e) {
|
async sumbitFrom() {
|
||||||
console.log('当前值为: ' + e.value)
|
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) {
|
async getInfo(id) {
|
||||||
let res = await this.api.getproductorderConfirm({
|
let res = await this.api.getproductorderConfirm({
|
||||||
|
|
@ -61,7 +127,6 @@
|
||||||
})
|
})
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.info = res.data
|
this.info = res.data
|
||||||
console.log(this.info, 'tiaoshi1')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -126,8 +191,74 @@
|
||||||
.m(30rpx);
|
.m(30rpx);
|
||||||
|
|
||||||
>view:first-child {
|
>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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue