You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
high-mini/pages/user/order_details/order_details.vue

603 lines
13 KiB

<template>
<view>
<view class="width100 font18 fcorfff fotct height40 backcorf06" v-if="recinfo.orderStatus == 1">待支付</view>
<view class="width100 font18 fcorfff fotct height40 backcorf06" v-if="recinfo.orderStatus == 2">已支付</view>
<view class="width100 font18 fcorfff fotct height40 backcorf06" v-if="recinfo.orderStatus == 3">已完成</view>
<view class="width100 font18 fcorfff fotct height40 backcorf06" v-if="recinfo.orderStatus == 4">已退款</view>
<view class="width100 font18 fcorfff fotct height40 backcorf06" v-if="recinfo.orderStatus == 5">已取消</view>
<!-- 购买商品列表 -->
<view class="buy-list" v-for="rec in recinfo.highChildOrderList" :key="rec.id" @click="toGoods(rec.goodsId)">
<!-- v-for="(row,index) in buylist" :key="index" -->
<view class="row">
<view class="goods-info">
<view class="img">
<image :src="imageUrl+rec.goodsImg"></image>
</view>
<view class="info">
<view class="title">{{rec.goodsName}}</view>
<view class="spec">{{rec.goodsSpecName}}</view>
<view class="zspec" v-if="rec.giveawayType">赠品</view>
<view class="price-number">
<view class="price">¥{{rec.goodsPrice}}</view>
<view class="number">
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 提示-备注 -->
<view class="order">
<view class="row" v-if="recinfo.orderNo">
<view class="left">
订单流水号 :
</view>
<view class="right">
{{recinfo.orderNo}}
</view>
</view>
<view class="row" v-if="recinfo.paySerialNo">
<view class="left">
支付流水号 :
</view>
<view class="right">
{{recinfo.paySerialNo}}
</view>
</view>
<view class="row" v-if="recinfo.payModel">
<view class="left">
支付模式 :
</view>
<view class="right" v-if="recinfo.payModel == 1">
金币
</view>
<view class="right" v-if="recinfo.payModel == 2">
第三方平台
</view>
<view class="right" v-if="recinfo.payModel == 3">
混合
</view>
</view>
<view class="row" v-if="recinfo.payType">
<view class="left">
支付方式 :
</view>
<view class="right" v-if="recinfo.payType == 1">
支付宝
</view>
<view class="right" v-if="recinfo.payType == 2">
微信
</view>
<view class="right" v-if="recinfo.payType == 3">
金币
</view>
</view>
<view class="row" v-if="recinfo.payPrice">
<view class="left">
支付金额 :
</view>
<view class="right">
{{recinfo.payPrice}}
</view>
</view>
<view class="row">
<view class="left">
下单时间 :
</view>
<view class="right">
{{recinfo.createTime | formatDate('-')}}
</view>
</view>
<view class="row" v-if="recinfo.payTime">
<view class="left">
支付时间 :
</view>
<view class="right">
{{recinfo.payTime | formatDate('-')}}
</view>
</view>
<view class="row" v-if="recinfo.cancelTime">
<view class="left">
取消时间 :
</view>
<view class="right">
{{recinfo.cancelTime | formatDate('-')}}
</view>
</view>
<view class="row" v-if="recinfo.finishTime">
<view class="left">
完成时间 :
</view>
<view class="right">
{{recinfo.finishTime | formatDate('-')}}
</view>
</view>
</view>
<!-- 明细 -->
<!-- <view class="detail">
<view class="row">
<view class="nominal">
商品金额
</view>
<view class="content">
¥200 && 200个金币
</view>
</view>
<view class="row">
<view class="nominal">
运费
</view>
<view class="content">
¥+{{freight|toFixed}}
</view>
</view>
<view class="row">
<view class="nominal">
积分抵扣
</view>
<view class="content">
¥-{{deduction|toFixed}}
</view>
</view>
</view> -->
<view class="width100 height60"></view>
<view class="footer" v-if="recinfo.orderStatus == 1">
<view class="settlement">
<view class="sum">合计:<view class="money">¥{{recinfo.payPrice}}</view>
</view>
<view class="btn" @tap="cancelOrder">取消订单</view>
<view class="btn" @tap="toPay">提交订单</view>
</view>
</view>
</view>
</template>
<script>
import {
getOrderById,
cancelOrder
} from '../../../Utils/Api.js';
let app = getApp()
export default {
data() {
return {
buylist: [], //订单列表
goodsPrice: 0.0, //商品合计价格
sumPrice: 0.0, //用户付款价格
freight: 12.00, //运费
note: '', //备注
int: 1200, //抵扣积分
deduction: 0, //抵扣价格
recinfo: [],
orderId: '',
imageUrl: app.globalData.imgUrl
};
},
onShow() {
//页面显示时,加载订单信息
// uni.getStorage({
// key: 'buylist',
// success: (ret) => {
// this.buylist = ret.data;
// this.goodsPrice = 0;
// //合计
// let len = this.buylist.length;
// for (let i = 0; i < len; i++) {
// this.goodsPrice = this.goodsPrice + (this.buylist[i].number * this.buylist[i].price);
// }
// this.deduction = this.int / 100;
// this.sumPrice = this.goodsPrice - this.deduction + this.freight;
// }
// });
// uni.getStorage({
// key: 'selectAddress',
// success: (e) => {
// this.recinfo = e.data;
// uni.removeStorage({
// key: 'selectAddress'
// })
// }
// })
this.getOrderById();
},
onHide() {
},
onLoad(option) {
this.orderId = option.id
},
onBackPress() {
//页面后退时候,清除订单信息
this.clearOrder();
},
filters: {
toFixed: function(x) {
return parseFloat(x).toFixed(2);
},
//过滤器 用于格式化时间
formatDate: function(value, spe = '/') {
let data = new Date(value);
let year = data.getFullYear();
let month = data.getMonth() + 1;
let day = data.getDate();
let h = data.getHours();
let mm = data.getMinutes();
let s = data.getSeconds();
month = month > 10 ? month : "0" + month;
day = day > 10 ? day : "0" + day;
h = h > 10 ? h : "0" + h;
mm = mm > 10 ? mm : "0" + mm;
s = s > 10 ? s : "0" + s;
return `${year}${spe}${month}${spe}${day} ${h}:${mm}:${s}`;
}
},
methods: {
toGoods(e) {
uni.navigateTo({
url:'../../goods/goods?id='+e
});
},
getOrderById() {
uni.showLoading({
title: '加载中...'
})
let params = {
orderId: this.orderId,
}
getOrderById(params).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
this.recinfo = res.return_data;
} else {
uni.hideLoading()
}
})
},
cancelOrder() {
let that = this;
uni.showModal({
title: '取消订单',
content: '确定取消此订单?',
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: '加载中...'
})
let params = {
orderId: this.recinfo.id
}
cancelOrder(params).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
uni.showToast({
title: res.return_data,
icon: 'none',
duration: 2000
})
setTimeout(() => {
uni.navigateBack();
}, 2000)
} else {
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
uni.hideLoading()
}
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
clearOrder() {
uni.removeStorage({
key: 'buylist',
success: (res) => {
this.buylist = [];
console.log('remove buylist success');
}
});
},
toPay() {
let payTypes;
if (this.recinfo.payType == 1) {
payTypes = 3;
} else if (this.recinfo.payType == 2) {
payTypes = 1;
} else {
payTypes = 2;
}
uni.redirectTo({
url: "/pages/pay/payment/payment?amount=" + this.recinfo.payPrice +
'&paytype=' + payTypes + '&orderId=' + this.recinfo.id
})
//商品列表
// let paymentOrder = [];
// let goodsid = [];
// let len = this.buylist.length;
// for (let i = 0; i < len; i++) {
// paymentOrder.push(this.buylist[i]);
// goodsid.push(this.buylist[i].id);
// }
// if (paymentOrder.length == 0) {
// uni.showToast({
// title: '订单信息有误,请重新购买',
// icon: 'none'
// });
// return;
// }
// //本地模拟订单提交UI效果
// uni.showLoading({
// title: '正在提交订单...'
// })
// setTimeout(() => {
// uni.setStorage({
// key: 'paymentOrder',
// data: paymentOrder,
// success: () => {
// uni.hideLoading();
// uni.redirectTo({
// url: "../pay/payment/payment?amount=" + this.sumPrice
// })
// }
// })
// }, 1000)
},
//选择收货地址
selectAddress() {
uni.navigateTo({
url: '../user/address/address?type=select'
})
}
}
}
</script>
<style lang="scss">
.addr {
width: 86%;
padding: 20upx 3%;
margin: 30upx auto 20upx auto;
box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
border-radius: 20upx;
display: flex;
.icon {
width: 80upx;
height: 80upx;
display: flex;
align-items: center;
image {
width: 60upx;
height: 60upx;
}
}
.tel-name {
width: 100%;
display: flex;
font-size: 32upx;
.tel {
margin-left: 40upx;
}
}
.addres {
width: 100%;
font-size: 26upx;
color: #999;
}
}
.buy-list {
width: 86%;
padding: 10upx 3%;
margin: 30upx auto 20upx auto;
box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
border-radius: 20upx;
.row {
margin: 20rpx 0;
.goods-info {
width: 100%;
display: flex;
.img {
width: 22vw;
height: 22vw;
border-radius: 10upx;
overflow: hidden;
flex-shrink: 0;
margin-right: 10upx;
image {
width: 22vw;
height: 22vw;
}
}
.info {
width: 100%;
height: 22vw;
overflow: hidden;
display: flex;
flex-wrap: wrap;
position: relative;
.title {
width: 100%;
font-size: 32upx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
// text-align: justify;
overflow: hidden;
}
.spec {
font-size: 22upx;
background-color: #f3f3f3;
color: #a7a7a7;
height: 40upx;
display: flex;
align-items: center;
padding: 0 15upx;
border-radius: 20upx;
margin-bottom: 10px;
}
.zspec {
font-size: 22upx;
background-color: red;
color: #FFFFFF;
height: 40upx;
display: flex;
align-items: center;
padding: 0 15upx;
border-radius: 20upx;
margin-bottom: 10px;
margin-left: 10px;
}
.price-number {
position: absolute;
width: 100%;
bottom: 0upx;
display: flex;
justify-content: space-between;
align-items: flex-end;
font-size: 28upx;
height: 40upx;
.price {
color: #f06c7a;
}
.number {
display: flex;
justify-content: center;
align-items: center;
}
}
}
}
}
}
.order {
width: 86%;
padding: 10upx 3%;
margin: 30upx auto 20upx auto;
box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
border-radius: 20upx;
.row {
margin: 20upx 0;
height: 40upx;
display: flex;
.left {
font-size: 28upx;
}
.right {
margin-left: 40upx;
font-size: 26upx;
color: #999;
input {
font-size: 26upx;
color: #999;
}
}
}
}
.blck {
width: 100%;
height: 100upx;
}
.footer {
width: 92%;
padding: 0 4%;
background-color: #fbfbfb;
height: 100upx;
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 28upx;
position: fixed;
bottom: 0upx;
z-index: 5;
.settlement {
width: 80%;
display: flex;
justify-content: flex-end;
align-items: center;
.sum {
width: 50%;
font-size: 28upx;
margin-right: 10upx;
display: flex;
justify-content: flex-end;
.money {
font-weight: 600;
}
}
.btn {
padding: 0 20upx;
height: 60upx;
width: 100px;
margin-left: 10px;
background-color: #f06c7a;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
font-size: 30upx;
border-radius: 40upx;
}
}
}
.detail {
width: 86%;
padding: 10upx 3%;
margin: 30upx auto 20upx auto;
box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
border-radius: 20upx;
.row {
height: 60upx;
display: flex;
justify-content: space-between;
align-items: center;
.nominal {
font-size: 28upx;
}
.content {
font-size: 26upx;
color: #f06c7a;
}
}
}
</style>