支付联调
This commit is contained in:
parent
75ac4e967c
commit
925e2027e2
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue