支付联调
This commit is contained in:
@@ -70,13 +70,23 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sixcontent">
|
||||
<!-- <view class="sixcontent">
|
||||
<view class="sixcontentone flex-between" style="padding: 0 0;" @click="orderfoodindex">
|
||||
<view class="sixcontent_one" style="padding: 0 0;">
|
||||
优惠卷
|
||||
优惠券
|
||||
</view>
|
||||
<text style="color: red;">{{emitorderfoodform.couponsPrice}}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="redMoney">
|
||||
<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 @click="orderfoodindex">
|
||||
<!-- {{info.couponDetail.name}} -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 支付方式 -->
|
||||
<view class="payType">
|
||||
@@ -107,8 +117,8 @@
|
||||
</view>
|
||||
</u-radio>
|
||||
</u-radio-group>
|
||||
<view style="font-weight: 400;font-size: 24rpx;color: #333333;">
|
||||
会员卡余额{{ amountVIP}} <text style="font-weight: 500;font-size: 28rpx;color: #FF4C11;"
|
||||
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
|
||||
会员卡余额{{ amountVIP.amount}} <text style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
|
||||
@click="goRecharge">去充值</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -144,28 +154,28 @@
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view :style="{height:height}">
|
||||
<view :style="{height:height}">
|
||||
|
||||
</view>
|
||||
<view class="fixedview">
|
||||
<view class="flex-between">
|
||||
<view class="fixedview_one flex-start">
|
||||
<view class="fixedview_oneone">
|
||||
实付金额:
|
||||
</view>
|
||||
<view class="fixedview">
|
||||
<view class="flex-between">
|
||||
<view class="fixedview_one flex-start">
|
||||
<view class="fixedview_oneone">
|
||||
实付金额:
|
||||
</view>
|
||||
<view class="fixedview_onetow">
|
||||
<text>¥</text>{{listinfo.amount}}
|
||||
</view>
|
||||
<view class="fixedview_onethere" v-if="emitorderfoodform.couponsPrice">
|
||||
以优惠¥{{emitorderfoodform.couponsPrice}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="fixedview_onetow">
|
||||
<text>¥</text>{{listinfo.amount}}
|
||||
<view class="fixedview_tow" @click="showpopupclick">
|
||||
立即付款
|
||||
</view>
|
||||
<view class="fixedview_onethere" v-if="emitorderfoodform.couponsPrice">
|
||||
以优惠¥{{emitorderfoodform.couponsPrice}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="fixedview_tow" @click="showpopupclick">
|
||||
立即付款
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -184,10 +194,10 @@
|
||||
emitorderfoodform: {
|
||||
clickiconone: ''
|
||||
},
|
||||
amountVIP:0,
|
||||
amountVIP: null,
|
||||
radiovalue1: '1',
|
||||
vipId:null,
|
||||
|
||||
vipId: null,
|
||||
orderInfo: ''
|
||||
};
|
||||
},
|
||||
|
||||
@@ -202,9 +212,10 @@
|
||||
this.listinfo.amounts = e.amount //本来的价格
|
||||
this.handlemessage()
|
||||
uni.$on('message', this.getMessage)
|
||||
|
||||
|
||||
this.amountVIP = uni.cache.get('userInfo').amount
|
||||
|
||||
// 获取余额
|
||||
this.getAount()
|
||||
|
||||
this.vipId = uni.cache.get('userInfo').id
|
||||
},
|
||||
onShow() {
|
||||
@@ -225,6 +236,17 @@
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
async getAount(){
|
||||
let res = await this.api.shopUserInfo({
|
||||
// shopId:店铺ID
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
})
|
||||
if(res.code==0){
|
||||
|
||||
this.amountVIP = res.data
|
||||
}
|
||||
},
|
||||
getMessage(msg) {
|
||||
console.log('tiaoshi1', msg)
|
||||
if (msg.status != 'success') {
|
||||
@@ -240,6 +262,7 @@
|
||||
case 'createOrder': //去结算
|
||||
console.log('tiaoshi2', msg)
|
||||
this.listinfoid = msg.data.id //下单需要的id
|
||||
this.orderInfo = msg.data
|
||||
this.showpopupclickdd()
|
||||
// let item = JSON.stringify(msg.data)
|
||||
// uni.redirectTo({
|
||||
@@ -287,32 +310,41 @@
|
||||
},
|
||||
// 去结算
|
||||
showpopupclick() {
|
||||
|
||||
let data = { //定义socket数据传参
|
||||
"skuId": '',
|
||||
"num": '', //数量
|
||||
"type": "createOrder", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”,
|
||||
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
|
||||
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1: 使用, 0: 不使用),
|
||||
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1: 购买, 0: 不够买)
|
||||
"productId": '', //商品id
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
// tableId:uni.cache.get('tableCode')
|
||||
}
|
||||
console.log(data)
|
||||
uni.$u.debounce(this.socketSendMsg(data), 500)
|
||||
|
||||
|
||||
|
||||
let data = { //定义socket数据传参
|
||||
"skuId": '',
|
||||
"num": '', //数量
|
||||
"type": "createOrder", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”,
|
||||
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
|
||||
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1: 使用, 0: 不使用),
|
||||
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1: 购买, 0: 不够买)
|
||||
"productId": '', //商品id
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
// tableId:uni.cache.get('tableCode')
|
||||
}
|
||||
console.log(data)
|
||||
uni.$u.debounce(this.socketSendMsg(data), 500)
|
||||
|
||||
|
||||
},
|
||||
// 去充值
|
||||
goRecharge() {
|
||||
uni.pro.navigateTo('/pages/member/index')
|
||||
},
|
||||
// 余额支付
|
||||
async accountPayevent(id){
|
||||
async accountPayevent(id) {
|
||||
let res = await this.api.accountPay({
|
||||
orderId: id,
|
||||
memberId:this.vipId
|
||||
memberId: this.vipId
|
||||
})
|
||||
console.log(res,'调试12')
|
||||
if (res.code == 0) {
|
||||
console.log(res, '调试12')
|
||||
if (res) {
|
||||
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.goRecharge()
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
async showpopupclickdd(i) {
|
||||
@@ -325,7 +357,7 @@
|
||||
mask: true
|
||||
})
|
||||
// #ifdef MP-WEIXIN
|
||||
if(this.radiovalue1==1){
|
||||
if (this.radiovalue1 == 1) {
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay', //支付类型-固定值
|
||||
partnerid: res.data.appId, // 微信支付商户号
|
||||
@@ -338,20 +370,21 @@
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
this.paymodfiyOrderInfo()
|
||||
setTimeout(res => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/successful?orderId=' + this
|
||||
.listinfoid
|
||||
.listinfoid + '&orderInfo=' + JSON.stringify(
|
||||
this.orderInfo)
|
||||
});
|
||||
}, 1000)
|
||||
this.paymodfiyOrderInfo()
|
||||
// uni.redirectTo({
|
||||
// url: "/pages/mall/order/ordersuccess?id=" + datareslane.data
|
||||
// .order_id,
|
||||
// });
|
||||
},
|
||||
fail: (err) => {
|
||||
setTimeout(res => {
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '支付失败'
|
||||
@@ -361,12 +394,15 @@
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/order_detail?orderId=' + this.listinfoid
|
||||
});
|
||||
},
|
||||
complete: (data) => {
|
||||
console.log(data, '成功与否')
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.accountPayevent(this.listinfoid)
|
||||
}
|
||||
|
||||
} else {
|
||||
this.accountPayevent(this.listinfoid)
|
||||
}
|
||||
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
@@ -561,6 +597,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
.redMoney {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 30rpx;
|
||||
background-color: #fff;
|
||||
padding: 18rpx 14rpx;
|
||||
|
||||
>view:first-child {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
.payType {
|
||||
padding: 32rpx 34rpx;
|
||||
margin-top: 48rpx;
|
||||
|
||||
Reference in New Issue
Block a user