支付联调

This commit is contained in:
duan 2024-05-22 15:06:09 +08:00
parent 75ac4e967c
commit 925e2027e2
6 changed files with 178 additions and 81 deletions

View File

@ -67,6 +67,10 @@ export default {
paymodfiyOrderInfo(data) { //查询订单支付状态
return uni.api.post("/pay/modfiyOrderInfo", data);
},
// 获取余额
shopUserInfo(data) {
return uni.api.get("/user/shopUserInfo", data);
},
// 优惠加倍
yhqDouble(data) { //查询订单支付状态
return uni.api.post("/order/yhqDouble", data);

View File

@ -15,7 +15,7 @@
<image class="contenttowitemone_dingweiimage"
:src="item.image" mode="aspectFill"></image>
<view class="contenttowitemone_dingweinumer">
{{item.distances}}km
{{item.distances}}
</view>
</view>
<view class="contenttowitemone_text">

View File

@ -32,7 +32,12 @@
</view>
<view
:class="item.status == 0?'containertopboxitemright_four':'containertopboxitemright_fours'">
{{item.status == 0 ? '兑换积分':'已过期'}}
<text v-if="orderfood">
{{item.status == 0 ? '去使用':'无法使用'}}
</text>
<text v-else>
{{item.status == 0 ? '兑换积分':'已过期'}}
</text>
</view>
</view>
</view>
@ -141,7 +146,7 @@
uni.navigateBack()
} else {
uni.showToast({
title: '此优惠卷不能用于目前订单',
title: '优惠券面值大于支付金额',
icon: "none",
})
}
@ -156,7 +161,7 @@
uni.navigateBack()
} else {
uni.showToast({
title: '此优惠卷不能用于目前订单',
title: '优惠券面值大于支付金额',
icon: "none",
})
}

View File

@ -23,8 +23,8 @@
<view>
{{item.shopName}}
</view>
<view>
龙首.{{item.distances}}km
<view style="margin-top: 20rpx;">
{{item.distances}}
</view>
</view>
<view class="fivecontent_item_nav_lefttopstart flex-start">
@ -42,7 +42,7 @@
<image :src="item.image" mode=""></image>
<view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone flex-between">
<view>{{item.productName}}</view>
<view>{{item.productName.length>7?item.productName.substring(0,7)+'...':item.productName}}</view>
<text>已抢{{item.realSalesNumber}}</text>
</view>
<view class="flex-start flexstartboxfttow">
@ -77,7 +77,7 @@
:hour="item.end_times.h" :minute="item.end_times.m"
:second="item.end_times.s" :indexs='index' color="#FFFFFF"
border-color="#00B26A" splitorColor="#FFFFFF"
:font-size="7"></uni-countdown>
:font-size="10"></uni-countdown>
</view>
@ -426,10 +426,14 @@
.indexboxitemlefttheretext {
// width: 100%;
margin-top: 12rpx;
align-items: flex-end;
display: flex;
justify-content: center;
align-items: center;
.fivecontent_item_boxitemlefthere_one {
align-items: flex-end;
display: flex;
justify-content: center;
align-items: center;
.flex_startone {
font-family: Source Han Sans CN, Source Han Sans CN;

View File

@ -15,14 +15,14 @@
</view>
<view class="towcontent">
<view class="towcontentone">
{{orderinfo.couponsPrice}}
{{orderInfo.orderAmount}}
</view>
<view class="towcontentow flex-between">
<view class="towcontentow_O">
订单编号
</view>
<view class="towcontentow_T">
{{orderinfo.orderId}}
{{orderInfo.orderNo}}
</view>
</view>
<view class="towcontentow flex-between">
@ -30,7 +30,7 @@
下单时间
</view>
<view class="towcontentow_T">
{{orderinfo.createTime}}
{{orderInfo.createdAt|createdAtfiter}}
</view>
</view>
<view class="towcontentow flex-between">
@ -41,7 +41,7 @@
微信支付
</view>
</view>
<view class="towcontenthere flex-colum">
<view class="towcontenthere flex-colum" v-if="orderinfo">
<view class="towcontentherebox flex-center">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/yhj.png" mode=""></image>
<text>恭喜获得优惠券</text>
@ -81,10 +81,24 @@
components: {
navseat
},
filters: {
createdAtfiter(d) {
const timestamp = d; //
const date = new Date(timestamp); // Date
const year = date.getFullYear(); //
const month = date.getMonth() + 1; // 1
const day = date.getDate(); //
const hour = date.getHours(); //
const minute = date.getMinutes(); //
const second = date.getSeconds(); //
const formattedDate = `${year}-${month}-${day} ${hour}:${minute}:${second}`; //
return formattedDate
}
},
data() {
return {
titlename: '支付详情',
orderId:"",
orderId: "",
opacitys: false,
towcontentclickindex: 0,
windowHeight: '',
@ -102,7 +116,7 @@
name: '饮品小吃'
}
],
orderinfo:null,
orderinfo: null,
form: {
address: '', //
type: '', //
@ -112,6 +126,7 @@
size: 10, //
status: 'loadmore'
},
orderInfo: null
};
},
onPageScroll(e) {
@ -127,12 +142,15 @@
}
},
onLoad(e) {
console.log('调试',e)
this.orderId = e.orderId
setTimeout(() => {
this.GetTop()
}, 1000)
this.getinfo(e.orderId)
this.orderInfo = JSON.parse(e.orderInfo)
console.log('调试1', e)
console.log('调试2', JSON.parse(e.orderInfo))
console.log('调试3', this.orderInfo)
},
computed: {
HeighT() { //
@ -140,24 +158,27 @@
},
},
methods: {
async getinfo(id){
async getinfo(id) {
let res = await this.api.getYhqDouble({
orderId:id
// orderId: 420
orderId: id
})
console.log('调试1',res)
if(res.code==0){
this.orderinfo= res.data
if (res.code == 0) {
this.orderinfo = res.data
}
},
wantEvent(){
wantEvent() {
uni.redirectTo({
url: '/pages/index/index'
url: '/pages/order/order_detail?orderId=' + this.orderId
});
},
async DoublingEvent(){
async DoublingEvent() {
let res = await this.api.yhqDouble({
conponsId: this.listinfoid
conponsId: this.orderinfo.id
})
if (res.code == 0) {
this.wantEvent()
}
},
//G
loadMore(e) {

View File

@ -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;