订单倒计时
This commit is contained in:
@@ -35,6 +35,10 @@
|
||||
|
||||
<view class="orderList">
|
||||
<view class="orderItem">
|
||||
<!-- <view class="guoqi flexbox" v-if="orderContet.orderStatus==0 && orderContet.overTime > 0">
|
||||
<text>剩余支付时间:</text>
|
||||
<uni-countdown background-color="#ff5500" color="#ffffff" :font-size="14" :show-day="false" :hour="0" :minute="0" :second="orderContet.overTime" @timeup="countDown"></uni-countdown>
|
||||
</view> -->
|
||||
<view class="orderContent" v-for="(item,index) in orderContet.products" :key="index"
|
||||
@click="goDetail(item.productId)" v-if="orderContet.products!=''">
|
||||
<image :src="item.image" mode=""></image>
|
||||
@@ -106,7 +110,7 @@
|
||||
<view v-if="orderContet.orderStatus==2" class="opCan" @click="OverOrder" >确认收货</view>
|
||||
|
||||
<view v-if="orderContet.orderStatus==0" class="opFix" @click="canceOrder">取消订单</view>
|
||||
<view v-if="orderContet.orderStatus==0" class="opCan" @click="goPay">去支付</view>
|
||||
<view v-if="orderContet.orderStatus==0" class="opCan" @click="goPay(orderContet)">去支付</view>
|
||||
|
||||
|
||||
<view class="opCan" @click="kefu">联系客服</view>
|
||||
@@ -174,7 +178,7 @@
|
||||
import $http from '@/config/requestConfig.js';
|
||||
import {
|
||||
setPay,
|
||||
setPayAssign
|
||||
setPayAssign,setWXPay
|
||||
} from '@/config/utils';
|
||||
import {
|
||||
mapState
|
||||
@@ -245,7 +249,12 @@
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
|
||||
methods: {
|
||||
methods: {
|
||||
// 倒计时回调
|
||||
countDown(){
|
||||
console.log('重新刷新订单')
|
||||
this.getOrderList()
|
||||
},
|
||||
// 获得输入的表情数组
|
||||
handleEmj(i) {
|
||||
console.log(i,'i---------');
|
||||
@@ -523,7 +532,11 @@
|
||||
.post(`book/buyorder/appGetOrderInfo/${this.orderType}?orderId=${this.orderID}`)
|
||||
.then(res => {
|
||||
console.log('res+++',res)
|
||||
this.orderContet = res.buyOrder
|
||||
var seconds = res.buyOrder.timestamp + 30 * 60 + 2 // 过期时间
|
||||
var nowSeconds = Math.floor(new Date().getTime() / 1000);
|
||||
res.buyOrder.overTime = seconds - nowSeconds
|
||||
|
||||
this.orderContet = res.buyOrder
|
||||
this.userRecordid = res.userRecordid
|
||||
this.productIDs = res.buyOrder.products.map(item => {
|
||||
return item.productId
|
||||
@@ -538,9 +551,8 @@
|
||||
} else if (this.orderContet.orderStatus == 3) {
|
||||
this.titleStat = '已完成'
|
||||
}
|
||||
// if (this.orderType == 2) {
|
||||
// this.getdeliverDetails()
|
||||
// }
|
||||
|
||||
console.log(this.orderContet,'订单详情')
|
||||
})
|
||||
},
|
||||
// 获取物流
|
||||
@@ -592,28 +604,84 @@
|
||||
|
||||
|
||||
// 支付
|
||||
goPay() {
|
||||
setPay({
|
||||
typePay: 'alipay',
|
||||
subject: 'order',
|
||||
totalAmount: this.orderContet.realMoney,
|
||||
type: 2,
|
||||
relevanceoid: this.orderContet.orderSn,
|
||||
customerId: this.userInfo.id,
|
||||
}, res => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
goPay(payItem) {
|
||||
console.log(payItem,'订单数据')
|
||||
if(payItem.paymentMethod == 2){
|
||||
console.log('阿里支付')
|
||||
setPay({
|
||||
typePay: 'alipay',
|
||||
subject: 'order',
|
||||
totalAmount: payItem.realMoney,
|
||||
type: 2,
|
||||
relevanceoid: payItem.orderSn,
|
||||
customerId: this.userInfo.id,
|
||||
}, res => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}
|
||||
this.getOrderList()
|
||||
})
|
||||
} else if(payItem.paymentMethod == 1){
|
||||
console.log('微信支付')
|
||||
// console.log(this.isAndorid)
|
||||
if(this.isAndorid == false){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '很抱歉,苹果系统暂不支持微信支付',
|
||||
showCancel:false
|
||||
})
|
||||
return false
|
||||
}else{
|
||||
let data1={
|
||||
orderSn:payItem.orderSn,
|
||||
buyOrderId: null,
|
||||
totalAmount: payItem.realMoney
|
||||
}
|
||||
console.log(data1,'data1')
|
||||
setWXPay(data1,res => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
console.log(res)
|
||||
if(res.data.errMsg.indexOf('User canceled') != -1){
|
||||
uni.showToast({
|
||||
title: "用户取消支付",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
this.getOrderList()
|
||||
})
|
||||
}else if(payItem.paymentMethod == 3){
|
||||
// 苹果充值
|
||||
console.log('苹果二次支付')
|
||||
if(this.isAndorid){
|
||||
uni.showModal({
|
||||
title:'提示',
|
||||
showCancel:false,
|
||||
content:'很抱歉,当前订单属于苹果系统内购订单,安卓系统无法完成支付操作,您可切换到苹果系统进行支付,也可以取消该订单,并重新下单'
|
||||
})
|
||||
}else{
|
||||
this.iphonepay(payItem)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 商品内容跳转
|
||||
@@ -627,6 +695,7 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.guoqi{ font-size: 28rpx; align-items: center; color: red; float: right; line-height: 40rpx;}
|
||||
.star{display: inline-block; width: 20px; height: 20px; margin-right: 10rpx;}
|
||||
.starGray{ background : url(../../static/icon/star_greey.png) no-repeat; background-size: contain; }
|
||||
.starLight{ background : url(../../static/icon/star_light.png) no-repeat; background-size: contain;}
|
||||
|
||||
Reference in New Issue
Block a user