支付接口调用

This commit is contained in:
duan
2024-05-21 16:59:31 +08:00
parent 07a6425ec4
commit 75ac4e967c
20 changed files with 512 additions and 245 deletions

View File

@@ -472,6 +472,7 @@
z-index: 999;
.fixedview_letr {
margin-left: 14rpx;
.fixedview_letr_item:nth-child(1) {
margin: 0;
}
@@ -580,7 +581,7 @@
.onetowcontent_oneo {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
font-size: 24rpx;
color: #FFFFFF;
}
@@ -604,7 +605,7 @@
}
.onetowcontent_onefour {
margin-left: 4rpx;
margin-left: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
@@ -801,8 +802,7 @@
.fourcontent_th_tow {
.fourcontent_th_towo {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
font-size: 24rpx;
color: #999999;
}

View File

@@ -18,7 +18,7 @@
</view>
<u-number-box v-model="Quantity">
<view slot="minus" class="minus">
<u-icon name="minus" color="#CCCCCC" bold size="40"></u-icon>
<u-icon name="minus" color="#CCCCCC" bold size="30"></u-icon>
</view>
<text slot="input" style="width: 20px;text-align: center;">{{Quantity}}</text>
<view slot="plus" class="plus">
@@ -37,7 +37,7 @@
{{info.couponDetail.name}}
</view>
</view>
<view style="background-color: #F6F6F6;height: 2rpx;width: 100%;margin-top: 8rpx;"></view>
<view style="background-color: #F6F6F6;height: 2rpx;width: 100%;margin: 16rpx 0;"></view>
<view class="jiesuanmoney">
<text>
优惠<text style="color: #FF4C11;font-weight: 500;">{{info.save * Quantity}}</text>
@@ -46,6 +46,42 @@
小计<text style="color: #FF4C11;font-weight: 500;">{{info.salePrice * Quantity}}</text>
</text>
</view>
</view>
<!-- 支付方式 -->
<view class="payType" v-if="false">
<view class="">
支付方式
</view>
<view class="">
<u-radio-group v-model="radiovalue1" iconPlacement="right" :size="28" placement="column">
<u-radio activeColor="#ffd158" name="1">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/balance.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
微信支付
</text>
</view>
</u-radio>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;">
</view>
<u-radio activeColor="#ffd158" name="2">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
会员卡支付</text>
</view>
</u-radio>
</u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;">
会员卡余额${{ amount}} <text style="font-weight: 500;font-size: 28rpx;color: #FF4C11;"
@click="goRecharge">去充值</text>
</view>
</view>
</view>
<view class="placeBottom">
<view class="">
@@ -65,42 +101,63 @@
export default {
onLoad(e) {
this.getInfo(e.id)
this.orderIds= e.id
this.amount = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id
},
data() {
return {
info: null,
Quantity: 1
Quantity: 1,
radiovalue1: '1',
amount: 0,
orderIds:null,
vipId:null
}
},
methods: {
goRecharge() {
// uni.pro.to
},
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)
// radiovalue1:为1的时候微信支付,为2是会员卡,需要输入支付密码
if (this.radiovalue1 == 1) {
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)
}
}else{
let res = await this.api.accountPay({
orderId: this.orderIds,
memberId:this.vipId
})
if (res.code == 0) {
}
}
},
async payEvent(id) {
let res = await this.api.payOrderPay({
payType:'wechatPay',
orderId:id,
orderType:'group'
payType: 'wechatPay',
orderId: id,
orderType: 'group'
})
if (res) {
console.log(res, '调试1')
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.payAppId, // 微信支付商户号
timeStamp: res.data.payTimeStamp, // 时间戳(单位:秒)
nonceStr: res.data.paynonceStr, // 随机字符串
package: res.data.payPackage, // 固定值
signType: res.data.paySignType, //固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
uni.showToast({
@@ -119,7 +176,7 @@
}
});
}
},
async getInfo(id) {
let res = await this.api.getproductorderConfirm({
@@ -164,7 +221,6 @@
}
.placetopmoney {
>view:first-child {
margin-bottom: 20rpx;
@@ -209,10 +265,9 @@
}
.jiesuanmoney {
height: 50rpx;
line-height: 50rpx;
// height: 50rpx;
// line-height: 50rpx;
text-align: right;
margin-top: 8rpx;
>text:first-child {
font-size: 24rpx;
@@ -224,6 +279,23 @@
}
}
}
.payType {
padding: 32rpx 34rpx;
margin-top: 48rpx;
background-color: #fff;
>view:first-child {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
margin-top: 32rpx;
}
}
.placeBottom {
@@ -231,7 +303,7 @@
bottom: 0%;
left: 0;
width: 100%;
height: 148rpx;
height: 180rpx;
background-color: #fff;
padding: 16rpx 34rpx;
@@ -260,6 +332,11 @@
}
}
.dfs {
display: flex;
align-items: center;
}
.m(@top, @right: 0, @bottom: 0, @left: 0) {
margin: @top, @right, @bottom, @left
}