234 lines
8.7 KiB
Vue
234 lines
8.7 KiB
Vue
<template>
|
||
<view>
|
||
<!-- 状态栏 -->
|
||
<status-nav :titleVal="'订单详情'" :statusTitle="true"></status-nav>
|
||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30" style="padding-bottom: 150rpx;">
|
||
<!-- 订单类型 -->
|
||
<view class="bacf radius20 mar-s20 fon28" style="padding: 27rpx 20rpx;">
|
||
<view class="disjbac">
|
||
<view class="bold">{{['商城订单','积分商城订单'][orderInfo.is_score]}}</view>
|
||
<view v-if="orderInfo.status=='waiting'" class="colf8 bold">待付款</view>
|
||
<view v-if="orderInfo.status=='paid' && orderInfo.has_virtual!=1" class="colf8 bold">待发货</view>
|
||
<view v-if="orderInfo.status=='shipped'" class="colf8 bold">待收货</view>
|
||
<view v-if="orderInfo.status=='completed'" class="col9 bold">已完成</view>
|
||
<view v-if="orderInfo.virtual_check==0 && orderInfo.has_virtual==1" class="colf8 bold">待核验</view>
|
||
<view v-if="orderInfo.virtual_check==1 && orderInfo.has_virtual==1" class="col9 bold">已核验</view>
|
||
<view v-if="orderInfo.status=='closed'" class="col9 bold">订单已取消</view>
|
||
</view>
|
||
<view class="bold col3 mar-s40 mar-x20">订单号:{{orderInfo.coding}}</view>
|
||
<view class="fon24 col9">{{orderInfo.created_at}}</view>
|
||
</view>
|
||
<!-- 物流信息 -->
|
||
<view class="bacf radius20 mar-s20 fon28" style="padding: 27rpx 20rpx;">
|
||
<view class="bold">物流信息</view>
|
||
<view class="bold col3 mar-s40 fon26 disjbac">
|
||
<view>{{orderInfo.express_name}}:{{orderInfo.express_number||'暂无快递单号'}}</view>
|
||
<view @tap="copyCont">复制</view>
|
||
</view>
|
||
</view>
|
||
<!-- 地址信息 -->
|
||
<view v-if="orderInfo.address!='自提'" class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||
<view class="bold">收件人信息</view>
|
||
<view class="fon26 col3">
|
||
<view class="fon28 col3 bold" style="margin: 52rpx 0 20rpx 0;">{{addressInfo.userName}}<span class="mar-z10">{{addressInfo.userPhone}}</span></view>
|
||
<view class="fon24 col9">{{addressInfo.userAddress}}</view>
|
||
</view>
|
||
</view>
|
||
<view v-else class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||
<view class="bold">商家地址信息</view>
|
||
<view class="fon26 col3 disjbac mar-s30">
|
||
<view>
|
||
<view class="fon28 col3 bold mar-x20">恒美植发</view>
|
||
<view class="fon24 col9">{{goAddress}}</view>
|
||
</view>
|
||
<!-- 立即导航 -->
|
||
<image @tap="goThere(goAddress)" src="/static/public/daoh.png" class="there" mode="aspectFill"></image>
|
||
</view>
|
||
</view>
|
||
<!-- 订单信息 -->
|
||
<view class="bacf radius20 mar-s20 orderDetail-box">
|
||
<view v-for="(item,index) in orderInfo.skus" :key="index" class="fon26 col3 disjbac pad-sx50 disjbac bbot">
|
||
<image :src="item.spu_cover" class="flexs" mode="aspectFill"></image>
|
||
<view class="width100">
|
||
<view class="fon28 col3 bold clips2">{{item.spu_name}}</view>
|
||
<view class="orderDetail-sku">{{item.sku_name}}</view>
|
||
<view class="disjbac mar-s10">
|
||
<view class="colf8 fon32 bold"><span v-if="orderInfo.is_score==0">¥{{item.price/100}}</span><span v-else>积分:{{item.score}}</span></view>
|
||
<view class="fon28 col6">x{{item.num}}</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="fon28 disjbac mar-s40 mar-x20">
|
||
<view class="col6">共{{allNum}}件</view>
|
||
<view class="colf8 bold">共计:{{allPrice}}</view>
|
||
</view>
|
||
</view>
|
||
<!-- 快递费用 -->
|
||
<view v-if="isExpress" class="bacf radius20 mar-s20 disjbac pad-sx27-zy20">
|
||
<view class="bold">快递费用</view>
|
||
<view class="fon28 colf8 bold">¥{{orderInfo.freight}}.00</view>
|
||
</view>
|
||
<!-- 消费 -->
|
||
<view class="fon28 col3 consumption-box">消费:<span class="fon36 bold colf8"><span v-if="orderInfo.is_score==0">¥{{orderInfo.price/100}}</span><span v-else>{{orderInfo.score}}积分</span> <span v-if="orderInfo.coin!=0">+{{orderInfo.coin}}孔雀币</span></span></view>
|
||
<view class="disjbac posixzy bacf orderDetail-bottom-box">
|
||
<view class="posir">
|
||
<image src="/static/public/weix.png" mode=""></image>
|
||
<view class="fon28 col3">分享</view>
|
||
<button open-type="share" class="posia-op"></button>
|
||
</view>
|
||
<!-- 待付款 -->
|
||
<view class="disac paid-btn-box" v-if="orderInfo.status=='waiting'">
|
||
<view @tap="cancleEv">取消订单</view>
|
||
<view @tap="paymentEv">立即支付</view>
|
||
</view>
|
||
<!-- 待发货 -->
|
||
<view class="disac paid-btn-box" v-if="orderInfo.status=='paid'">
|
||
<view @tap="cancleEv">取消订单</view>
|
||
</view>
|
||
<!-- 确认收货 -->
|
||
<view class="orderInfo-btn" v-if="orderInfo.status=='shipped'">确认收货</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
statusHNH:uni.getStorageSync('statusHNH'),
|
||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||
isExpress:true,
|
||
switchQuan:true,
|
||
showQuan:false,
|
||
express:'韵达快递:2983625984729',
|
||
orderInfo:'',//订单信息
|
||
addressInfo:'',//地址信息
|
||
allPrice:0,//共计
|
||
allNum:0,//共
|
||
times:0,//点击次数
|
||
goAddress:'四川省成都市青羊区青羊大道213号',
|
||
}
|
||
},
|
||
onShow() {
|
||
this.$toolAll.tools.isLogin();
|
||
},
|
||
onLoad(options) {
|
||
this.checkInfo(options.id);
|
||
},
|
||
methods: {
|
||
cancleEv(){//取消订单
|
||
this.times++;
|
||
if(this.times==2){
|
||
this.$requst.post('order/cancel',{order_coding:this.orderInfo.coding}).then(res=>{
|
||
if(res.code==0){
|
||
this.$toolAll.tools.showToast('取消订单成功');
|
||
this.checkInfo(this.orderInfo.id);
|
||
this.times = 0;
|
||
}
|
||
})
|
||
} else {
|
||
setTimeout(()=>{
|
||
this.times = 0;
|
||
},1500)
|
||
this.$toolAll.tools.showToast('双击即可取消订单');
|
||
}
|
||
},
|
||
paymentEv(){//立即支付
|
||
if(this.times==0){
|
||
this.$toolAll.tools.showToast('正在调起支付','loading',1500)
|
||
this.times++;
|
||
this.$requst.post('order/pay',{order_coding:this.orderInfo.coding}).then(res=>{
|
||
if(res.code==0){
|
||
uni.requestPayment({
|
||
provider: 'wxpay',
|
||
appId:res.data.payment_params.appId,//appId
|
||
timeStamp: res.data.payment_params.timeStamp,//时间戳
|
||
nonceStr: res.data.payment_params.nonceStr,//随机字符串
|
||
package: res.data.payment_params.package,//package
|
||
signType: res.data.payment_params.signType,//MD5
|
||
paySign: res.data.payment_params.sign,//签名
|
||
success:(res)=> {
|
||
this.$requst.post('order/paid',{order_coding:this.orderInfo.coding}).then(res=>{
|
||
if(res.code==0){
|
||
this.times = 0;
|
||
this.$toolAll.tools.showToast('支付成功');
|
||
this.checkInfo(this.orderInfo.id);
|
||
} else this.$toolAll.tools.showToast(res.msg);
|
||
|
||
})
|
||
}
|
||
});
|
||
}
|
||
})
|
||
}
|
||
},
|
||
checkInfo(id){//查询订单信息
|
||
this.$requst.post('user/order-detail',{id:id}).then(res=>{
|
||
if(res.code==0){
|
||
this.allPrice = 0;
|
||
this.allNum = 0;
|
||
let narr = res.data;
|
||
narr.skus.forEach(item=>{
|
||
item.spu_cover = this.$http + item.spu_cover;
|
||
// 共多少件,总计
|
||
if(narr.is_score==0){
|
||
this.allPrice += item.price*item.num;
|
||
} else {
|
||
this.allPrice += item.score*item.num;
|
||
}
|
||
this.allNum += item.num;
|
||
})
|
||
if(narr.is_score==0){//商城订单的总计
|
||
this.allPrice = this.allPrice/100;
|
||
} else {//积分订单的总计
|
||
this.allPrice = this.allPrice;
|
||
}
|
||
this.orderInfo = narr;
|
||
let naddress = this.orderInfo.address.split(',');
|
||
if(naddress[0]!='自提'){
|
||
let nphone = this.$toolAll.tools.hideMPhone(naddress[1].trim())
|
||
this.addressInfo = {
|
||
userName:naddress[0].trim(),
|
||
userPhone:nphone,
|
||
userAddress:naddress[2].trim()
|
||
}
|
||
}
|
||
}
|
||
})
|
||
},
|
||
copyCont(){//复制快递单号
|
||
if(this.times==0){
|
||
this.times++;
|
||
if(this.orderInfo.express_number!=null){
|
||
this.$toolAll.tools.clickCopy(this.orderInfo.express_number);
|
||
this.$toolAll.tools.showToast('复制快递单号成功');
|
||
} else this.$toolAll.tools.showToast('暂无可查询的快递信息');
|
||
setTimeout(()=>{
|
||
this.times = 0;
|
||
},2000)
|
||
}
|
||
},
|
||
goThere(val){//去这里
|
||
wx.getLocation({//获取当前经纬度
|
||
type: 'wgs84', //返回可以用于wx.openLocation的经纬度,官方提示bug: iOS 6.3.30 type 参数不生效,只会返回 wgs84 类型的坐标信息
|
||
success: function (res) {
|
||
wx.openLocation({//使用微信内置地图查看位置。
|
||
latitude: 30.67554,//要去的纬度-地址
|
||
longitude: 104.010642,//要去的经度-地址
|
||
name: val,
|
||
address: val
|
||
})
|
||
}
|
||
})
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
page {
|
||
background-color: #F5F5F5;
|
||
}
|
||
</style>
|