cyywl_server/yudao-ui-app/pages/order_details/index.vue

905 lines
19 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="container">
<u-navbar title="订单详情" bgColor="transparent">
<view class="u-nav-slot" slot="left">
<u-icon name="arrow-left"></u-icon>
</view>
</u-navbar>
<view class="bg">
<image src="@/static/images/shop/cart_bg.png"></image>
</view>
<view class="box">
<view class="top">
<view class="navigation"></view>
<view class="address">
<view class="name">收件人张三 {{orderInfo.userPhone}}</view>
<text class="detail">{{orderInfo.userAddress}}</text>
</view>
<view class="go"></view>
</view>
<view class="goodsDetail">
<view class="boxs"></view>
<view class="tops">
<view class="shopName">
{{orderInfo.orderId}}
</view>
</view>
<view class="content" v-for="(item,index) in orderInfo.orderInfoList" :key="item.productId">
<view class="image">
<u--image :showLoading="true" radius="10rpx" :src="item.image" width="111rpx" height="99rpx"
@click="click"></u--image>
</view>
<view class="text">
<view class="name">
{{item.productName}}
</view>
<view class="model">
{{item.sku}}
</view>
<view class="prices">
<u--text color="#E50202" mode="price" :text="item.price"></u--text>
</view>
</view>
<div class="sum">x{{item.payNum}}</div>
</view>
<view class="boxs"></view>
</view>
<view class="price">
<view style="height: 1rpx;"></view>
<view class="priceitems">
<text class="itemsleft">商品总价</text>
<view class="itemsright">
<u--text mode="price" :text="orderInfo.proTotalPrice"></u--text>
</view>
</view>
<view class="priceitems">
<text class="itemsleft">运费</text>
<view class="itemsright">
<u--text mode="price" :text="orderInfo.payPostage"></u--text>
</view>
</view>
<view class="priceitems">
<text class="itemsleft">待付金额</text>
<view class="itemsright">
<u--text mode="price" :text="orderInfo.totalPrice"></u--text>
</view>
</view>
</view>
<view class="detail">
<view style="height: 1rpx;"></view>
<view class="title">订单信息</view>
<view class="detailitems">
<text class="detailleft">订单备注:</text>
<text class="detailright">{{orderInfo.mark}}</text>
</view>
<view class="detailitems">
<text class="detailleft">订单编号:</text>
<text class="detailright">{{orderInfo.orderId}}</text>
</view>
<view class="detailitems">
<text class="detailleft">创建时间:</text>
<text class="detailright">{{orderInfo.createTime}}</text>
</view>
</view>
<!-- <view class="pay">
<view style="height: 1rpx;"></view>
<view class="title">支付方式</view>
<view class="payment" @click="isWx=!isWx">
<view class="mode">
<text class="wechat"></text>
<text style="width: 140rpx;">微信支付</text>
<view :class="[isWx?'radioNo':'radio']"></view>
</view>
</view>
<view class="payment" @click="isWx=!isWx">
<view class="mode">
<text class="zfb"></text>
<text style="width: 140rpx;">支付宝支付</text>
<view :class="[isWx?'radio':'radioNo']"></view>
</view>
</view>
</view> -->
</view>
<view class="zf">
<view class="zfNumber"> <text>待支付:</text>
<u--text class="text" size="35rpx" mode="price" :text="orderInfo.totalPrice"></u--text>
</view>
<view class="closeOrder" @tap="cancelOrder()">取消订单</view>
<view class="orderPay" @tap='pay_open(orderInfo.orderId)'>立即付款</view>
</view>
</view>
</template>
<script>
import {
getOrderDetail,
orderTake,
orderDel,
orderCancel,
qrcodeApi
} from '@/api/order.js';
import {
openOrderRefundSubscribe
} from '@/utils/SubscribeMessage.js';
import home from '@/components/home';
import payment from '@/components/payment';
import orderGoods from "@/components/orderGoods";
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
// #ifdef MP
import authorize from '@/components/Authorize';
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
// #endif
export default {
components: {
payment,
home,
orderGoods,
// #ifdef MP
authorize
// #endif
},
data() {
return {
codeImg: '',
qrcodeSize: 100,
order_id: '',
evaluate: 0,
cartInfo: [], //购物车产品
orderInfo: {
systemStore: {},
pstatus: {}
}, //订单详情
system_store: {},
isWx: true,
isGoodsReturn: false, //是否为退款订单
status: {}, //订单底部按钮状态
isClose: false,
ispay: '微信支付',
topay: [{
name: '微信支付',
value: 'wx'
},
{
name: '支付宝支付',
value: 'zfb'
}
],
payMode: [{
name: "微信支付",
icon: "icon-weixinzhifu",
value: 'weixin',
title: '微信快捷支付'
},
{
name: "余额支付",
icon: "icon-yuezhifu",
value: 'yue',
title: '可用余额:',
number: 0
},
],
pay_close: false,
pay_order_id: '',
totalPrice: '0',
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
id: 0, //订单id
uniId: '',
utils: this.$util,
type: 'normal'
};
},
computed: mapGetters(['isLogin', 'chatUrl', 'userInfo']),
onLoad: function(options) {
options.type == undefined || options.type == null ? this.type = 'normal' : this.type = options.type;
if (!options.order_id && !options.uniId) return this.$util.Tips({
title: '缺少参数'
}, {
tab: 3,
url: 1
});
this.$set(this, 'order_id', options.order_id);
},
onShow() {
this.getOrderInfo()
if (this.isLogin) {
this.getOrderInfo();
this.payMode[1].number = this.userInfo.nowMoney;
this.$set(this, 'payMode', this.payMode);
}
// else {
// toLogin();
// }
},
onHide: function() {
this.isClose = true;
},
onReady: function() {
// #ifdef H5
this.$nextTick(function() {
const clipboard = new ClipboardJS(".copy-data");
clipboard.on("success", () => {
this.$util.Tips({
title: '复制成功'
});
});
});
// #endif
},
methods: {
kefuClick() {
location.href = this.chatUrl;
},
goGoodCall() {
let self = this
uni.navigateTo({
url: `/pages/customer_list/index?orderId=${self.order_id}`
})
},
openSubcribe: function(e) {
let page = e;
uni.showLoading({
title: '正在加载',
})
openOrderRefundSubscribe().then(res => {
uni.hideLoading();
uni.navigateTo({
url: page,
});
}).catch(() => {
uni.hideLoading();
});
},
/**
* 事件回调
*
*/
onChangeFun: function(e) {
let opt = e;
let action = opt.action || null;
let value = opt.value != undefined ? opt.value : null;
(action && this[action]) && this[action](value);
},
/**
* 拨打电话
*/
makePhone: function() {
uni.makePhoneCall({
phoneNumber: this.system_store.phone
})
},
/**
* 打开地图
*
*/
showMaoLocation: function() {
if (!this.system_store.latitude || !this.system_store.longitude) return this.$util.Tips({
title: '缺少经纬度信息无法查看地图!'
});
uni.openLocation({
latitude: parseFloat(this.system_store.latitude),
longitude: parseFloat(this.system_store.longitude),
scale: 8,
name: this.system_store.name,
address: this.system_store.address + this.system_store.detailedAddress,
success: function() {
},
});
},
/**
* 关闭支付组件
*
*/
payClose: function() {
this.pay_close = false;
},
/**
* 打开支付组件
*
*/
pay_open: function(item) {
console.log(item,'0000000000')
uni.navigateTo({
url: '/pages/goods_cashier/index?order_id=' + item
})
},
/**
* 支付成功回调
*
*/
pay_complete: function() {
this.pay_close = false;
this.pay_order_id = '';
this.getOrderInfo();
},
/**
* 支付失败回调
*
*/
pay_fail: function() {
this.pay_close = false;
this.pay_order_id = '';
},
/**
* 登录授权回调
*
*/
onLoadFun: function() {
this.getOrderInfo();
},
/**
* 获取订单详细信息
*
*/
getOrderInfo: function() {
let that = this;
uni.showLoading({
title: "正在加载中"
});
getOrderDetail(that.order_id).then(res => {
uni.hideLoading();
that.$set(that, 'orderInfo', res.data);
console.log(that.orderInfo, 'orderInfo')
that.$set(that, 'evaluate', res.data.status == 2 ? 2 : 0);
that.$set(that, 'system_store', res.data.systemStore);
that.$set(that, 'id', res.data.id);
that.$set(that, 'cartInfo', res.data.orderInfoList);
if (res.data.refundStatus != 0) {
that.isGoodsReturn = true;
};
if (that.orderInfo.shippingType == 2 && that.orderInfo.paid) that.markCode(res.data
.verifyCode);
if (that.orderInfo.refundStatus > 0) {
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#666666'
})
}
}).catch(err => {
uni.hideLoading();
that.$util.Tips({
title: err
}, '/pages/users/order_list/index');
});
},
/**
*
* 生成二维码
*/
markCode(text) {
qrcodeApi({
height: '145',
text: text,
width: '145'
}).then(res => {
this.codeImg = res.data.code
});
},
/**
*
* 剪切订单号
*/
// #ifndef H5
copy: function() {
let that = this;
uni.setClipboardData({
data: this.orderInfo.orderId
});
},
// #endif
/**
* 打电话
*/
goTel: function() {
uni.makePhoneCall({
phoneNumber: this.orderInfo.deliveryId
})
},
/**
* 设置底部按钮
*
*/
getOrderStatus: function() {
let orderInfo = this.orderInfo || {},
_status = orderInfo.pstatus || {
type: 0
},
status = {};
let type = parseInt(_status.type),
delivery_type = orderInfo.deliveryType,
seckill_id = orderInfo.seckillId ? parseInt(orderInfo.seckillId) : 0,
bargain_id = orderInfo.bargainId ? parseInt(orderInfo.bargainId) : 0,
combination_id = orderInfo.combinationId ? parseInt(orderInfo.combinationId) : 0;
status = {
type: type == 9 ? -9 : type,
class_status: 0
};
if (type == 1 && combination_id > 0) status.class_status = 1; //查看拼团
if (type == 2 && delivery_type == 'express') status.class_status = 2; //查看物流
if (type == 2) status.class_status = 3; //确认收货
if (type == 4 || type == 0) status.class_status = 4; //删除订单
if (!seckill_id && !bargain_id && !combination_id && (type == 3 || type == 4)) status.class_status =
5; //再次购买
this.$set(this, 'status', status);
},
/**
* 去拼团详情
*
*/
goJoinPink: function() {
uni.navigateTo({
url: '/pages/activity/goods_combination_status/index?id=' + this.orderInfo.pinkId,
});
},
/**
* 再此购买
*
*/
goOrderConfirm: function() {
this.$Order.getPreOrder("again", [{
orderNo: this.order_id
}]);
},
confirmOrder: function() {
let that = this;
uni.showModal({
title: '确认收货',
content: '为保障权益,请收到货确认无误后,再确认收货',
success: function(res) {
if (res.confirm) {
orderTake(that.id).then(res => {
return that.$util.Tips({
title: '操作成功',
icon: 'success'
}, function() {
that.getOrderInfo();
});
}).catch(err => {
return that.$util.Tips({
title: err
});
})
}
}
})
},
/**
*
* 删除订单
*/
delOrder: function() {
let that = this;
orderDel(this.id).then(res => {
return that.$util.Tips({
title: '删除成功',
icon: 'success'
}, {
tab: 3,
url: 1
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
},
cancelOrder() {
let self = this
console.log(self)
uni.showModal({
title: '提示',
content: '确认取消该订单?',
success: function(res) {
if (res.confirm) {
orderCancel(self.orderInfo.id)
.then((data) => {
self.$util.Tips({
title: '取消成功'
}, {
tab: 3
})
})
.catch(() => {
self.$util.Tips({
title: err
})
self.getDetail();
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
}
}
</script>
<style lang="scss">
.container {
position: relative;
width: 100%;
height: 100%;
.bg {
width: 100%;
height: 100%;
z-index: 0;
image {
width: 100%;
height: 100%;
// overflow: hidden;
object-fit: cover;
}
}
.box {
position: absolute;
top: 110rpx;
width: 100%;
height: 1100rpx;
overflow: scroll;
padding-bottom: 100rpx;
.top {
margin-left: 42rpx;
width: 669rpx;
height: 137rpx;
display: flex;
align-items: center;
justify-content: space-around;
background: #fff;
border-radius: 20rpx;
.navigation {
width: 66rpx;
height: 66rpx;
background: url(@/static/images/shop/navigation.png);
background-size: 100% 100%;
}
.address {
width: 471rpx;
height: 70rpx;
.name {
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.detail {
margin: 0;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 400;
color: #8C8C8C;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.go {
width: 10rpx;
height: 16rpx;
background: url(@/static/images/shop/go.png);
background-size: 100% 100%;
}
}
.goodsDetail {
margin-top: 23rpx;
margin-left: 42rpx;
width: 669rpx;
background: #fff;
border-radius: 20rpx;
.boxs {
width: 100%;
height: 22rpx;
}
.tops {
margin-left: 26rpx;
display: flex;
justify-content: space-between;
.shopName {
width: 240rpx;
// overflow: hidden;
// white-space: nowrap;
// text-overflow: ellipsis;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.state {
margin-right: 31rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: #EF1E5F;
}
}
.content {
position: relative;
margin-top: 32rpx;
width: 100%;
height: 260rpx;
display: flex;
justify-content: space-between;
align-items: center;
height: 110rpx;
.image {
margin-left: 35rpx;
}
.text {
width: 420rpx;
height: 100%;
margin-right: 60rpx;
.name {
width: 440rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.model {
margin: 10rpx 0;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 400;
color: #B7B7B7;
}
.prices {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: #E94343;
}
}
.sum {
position: absolute;
right: 33rpx;
bottom: 0rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: #E94343;
}
}
}
.price {
margin-top: 23rpx;
margin-left: 42rpx;
width: 669rpx;
height: 204rpx;
background: #fff;
border-radius: 20rpx;
.priceitems {
margin-top: 27rpx;
display: flex;
justify-content: space-between;
.itemsleft {
margin-left: 30rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.itemsright {
margin-right: 30rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
}
}
.detail {
margin-top: 23rpx;
margin-left: 42rpx;
width: 669rpx;
height: 268rpx;
background: #fff;
border-radius: 20rpx;
.title {
margin-top: 24rpx;
margin-left: 29rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.detailitems {
margin-top: 27rpx;
display: flex;
justify-content: space-between;
.detailleft {
margin-left: 30rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.detailright {
margin-right: 30rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: #7F7F7F;
}
}
}
.pay {
margin-top: 23rpx;
margin-left: 42rpx;
width: 669rpx;
height: 228rpx;
background: #fff;
border-radius: 20rpx;
.title {
margin-top: 24rpx;
margin-left: 29rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.payment {
// display: flex;
.mode {
display: flex;
margin-left: 28rpx;
margin-top: 30rpx;
.wechat {
display: inline-block;
width: 40rpx;
height: 40rpx;
background: url(@/static/images/shop/wechat.png);
background-size: 100% 100%;
}
text {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.zfb {
display: inline-block;
width: 40rpx;
height: 40rpx;
background: url(@/static/images/shop/zfb.png);
background-size: 100% 100%;
}
.radio {
width: 34rpx;
height: 34rpx;
background: url(@/static/images/shop/nochecked.png);
background-size: 100% 100%;
margin-left: 400rpx;
}
.radioNo {
width: 34rpx;
height: 34rpx;
background: url(@/static/images/shop/checked.png);
background-size: 100% 100%;
margin-left: 400rpx;
}
}
}
}
}
.zf {
position: fixed;
bottom: 0;
display: flex;
justify-content: space-around;
align-items: center;
width: 100%;
height: 176rpx;
background: #fff;
.zfNumber {
// position: absolute;
// left: 52rpx;
// top: 58rpx;
font-size: 28rpx;
display: flex;
font-family: PingFang SC;
font-weight: 400;
color: #0C0C0C;
text {
font-size: 35rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
}
.closeOrder {
// position: absolute;
// top: 48rpx;
// right: 230rpx;
width: 179rpx;
height: 64rpx;
text-align: center;
line-height: 64rpx;
border: 1px solid #808080;
border-radius: 31rpx;
font-size: 29rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.orderPay {
// position: absolute;
// top: 48rpx;
// right: 34rpx;
width: 178rpx;
height: 63rpx;
line-height: 63rpx;
text-align: center;
background: linear-gradient(0deg, #FF7495 0%, #F22360 100%);
border-radius: 31rpx;
font-size: 29rpx;
font-family: PingFang SC;
font-weight: 400;
color: #FFFFFF;
}
}
}
</style>