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.
 
 
 
 
 
zhishifufei_uniapp/pages/special/order.vue

699 lines
19 KiB

<template>
<BaseContainer class="order-detail">
<NavBar title="订单详情" />
<template v-if="orderInfo.id">
<!-- 退款 -->
<view class="section return" v-if="orderInfo.refund_reason && orderInfo.refund_status === 0">
<view>卖家拒绝退款</view>
<view class="time">拒绝退款原因:{{ orderInfo.refund_reason }}</view>
<view class="time">处理时间:{{ orderInfo.refund_reason_time }}</view>
</view>
<!-- 退货 -->
<view class="section return" v-if="orderInfo.refund_status === 1">
<view>退款中</view>
<view class="time">申请时间:{{ orderInfo.refund_application_time }}</view>
</view>
<view class="section return" v-else-if="orderInfo.refund_status === 2">
<view>已退款</view>
<view class="time">{{ orderInfo._status._msg }}</view>
</view>
<view class="section status" v-if="orderInfo.refund_status === 0 && !orderInfo.refund_reason">
<view class="image">
<image :src="orderInfo.status_pic" />
</view>
<view class="text">
<view>{{ orderInfo._status._title }}</view>
<view class="time">{{ orderInfo._status._msg }}</view>
</view>
</view>
<view class="section contact">
<view>
<text>{{ orderInfo.real_name }}</text>
<text>{{ orderInfo.user_phone }}</text>
</view>
<view class="address">{{ orderInfo.user_address }}</view>
</view>
<view class="section goods">
<view class="goods-bd" v-for="cart of orderInfo.cartInfo" :key="cart.unique">
<view class="image">
<image :src="cart.productInfo.image" />
</view>
<view class="text">
<view class="name">{{ cart.productInfo.store_name }}</view>
<view class="money">
<view class="price">
<text>{{ cart.truePrice }}</text>
</view>
</view>
</view>
<view v-if="orderInfo._status._type === 3">
<view class="num">x{{ cart.cart_num }}</view>
<navigator :url="`/pages/my/order_reply?unique=${cart.unique}`">
评价
</navigator>
</view>
</view>
<view class="goods-ft">
共{{ orderInfo.total_num }}件商品,总金额
<text>¥{{ orderInfo.pay_price }}</text>
</view>
</view>
<!-- 待收货 -->
<view class="section express" v-if="orderInfo.status >= 1">
<view class="image">
<image :src="getImgPath('/wap/first/zsff/images/express.png')" />
</view>
<view class="text">
<view>
物流公司:<text>{{ orderInfo.delivery_name }}</text>
</view>
<view>
快递单号:<text id="account">{{ orderInfo.delivery_id }}</text>
</view>
</view>
<button type="button" @click="copyNo" id="copy">复制单号</button>
</view>
<view class="section list">
<view class="li-item flex">
<view>订单编号:</view>
<view>{{ orderInfo.order_id }}</view>
</view>
<view class="li-item flex">
<view>下单时间:</view>
<view>{{ orderInfo.add_time }}</view>
</view>
<view class="li-item flex">
<view>商品金额:</view>
<view>¥{{ orderInfo.total_price }}</view>
</view>
<view class="li-item flex">
<view>支付方式:</view>
<view>{{ orderInfo._status._payType }}</view>
</view>
<view v-if="orderInfo.total_postage > 0" class="li-item flex">
<view>运费:</view>
<view>¥{{ orderInfo.total_postage }}</view>
</view>
<view v-if="orderInfo.use_gold > 0" class="li-item flex">
<view>使用{{ gold_name }}:</view>
<view>{{ orderInfo.use_gold }}</view>
</view>
<view v-if="orderInfo.back_gold > 0" class="li-item flex">
<view>退还{{ gold_name }}:</view>
<view>¥{{ orderInfo.back_gold }}</view>
</view>
<view class="li-item flex">
<view>实付款:</view>
<view>¥{{ orderInfo.pay_price }}</view>
</view>
<view class="li-item flex">
<view>买家留言:</view>
<view class="msg">{{ orderInfo.mark }}</view>
</view>
</view>
<view class="footer">
<template v-if="orderInfo._status._type === 0">
<view class="blue footer-btn" @click="submit">立即付款</view>
<view class="footer-btn" @click="removeOrder('取消')">取消订单</view>
</template>
<template v-else-if="
orderInfo._status._type === 1 &&
!orderInfo.refund_reason &&
orderInfo.refund_status === 0 &&
orderInfo.pay_price > 0
">
<view class="footer-btn" @click="applyRefundOrder">申请退款</view>
</template>
<template v-else-if="orderInfo._status._type === 2">
<view class="blue footer-btn" @click="userTake">确认收货</view>
</template>
<template v-else-if="
orderInfo._status._type === 3 &&
!orderInfo.refund_reason &&
orderInfo.refund_status === 0 &&
orderInfo.pay_price > 0
">
<view class="footer-btn" @click="applyRefundOrder">申请退款</view>
<view class="footer-btn" @click="removeOrder('删除')">删除订单</view>
</template>
<template v-else-if="
orderInfo._status._type === 4 &&
!orderInfo.refund_reason &&
orderInfo.refund_status === 0 &&
orderInfo.pay_price > 0
">
<view class="footer-btn" @click="applyRefundOrder">申请退款</view>
<view class="footer-btn" @click="removeOrder('删除')">删除订单</view>
</template>
<template v-else-if="
!orderInfo.refund_reason &&
orderInfo.refund_status === 0 &&
orderInfo._status._type === 3 &&
orderInfo.pay_price > 0
">
<view class="blue footer-btn" @click="applyRefundOrder()"> 再次申请 </view>
<view class="footer-btn" @click="removeOrder('删除')">删除订单</view>
</template>
<view @click="removeOrder('删除')" class="footer-btn" v-else-if="
orderInfo.refund_status === 2 ||
(orderInfo._status._type === 3 && orderInfo.pay_price === 0)
">删除订单</view>
<view class="footer-btn" @click="services">联系客服</view>
<view class="footer-btn" v-if="orderInfo.status >= 1" @click="express">查看物流</view>
</view>
<!-- 支付弹窗 -->
<PayDialog :open.sync="payDialogOpen" :money="money" :now_money="now_money" :special_id="id"
:pay_type_num="pay_type_num" :is-wechat="isWechat" :is-alipay="is_alipay" :is-balance="is_yue"
:template-id="templateId" :wxpay-h5="wxpayH5" @change="changeVal" />
</template>
</BaseContainer>
</template>
<script>
import PayDialog from "@/components/PayDialog/index.vue";
import { getOrderDetail, getSpecialTemplateIds, aliPayApp, aliPayWap } from "@/api/special";
import { userRemoveOrder, userTakeOrder } from "@/api/auth";
import { CUSTOMER_DETAIL_TYPE, CUSTOMER_SUPPORT_TYPE } from "@/constants/customer-type";
export default {
components: {
PayDialog,
},
data() {
return {
isWechat: false,
id: 0,
orderInfo: {},
orderId: 0,
payDialogOpen: false, // 是否显示支付弹窗
money: 0,
pay_type_num: 50,
is_alipay: false, //支付宝是否开启
now_money: 0, //余额
is_yue: 0, //余额是否开启
templateId: "",
wxpayH5: 0,
site_name: "",
gold_name: "",
isOpenWeixing: false
};
},
computed: {
url() {
return this.isWechat ? "/pages/index/login" : "/pages/login/phone_check";
},
},
onLoad({ uni }) {
this.orderId = uni;
this.getOrderDetail().then(() => {
this.subscribeTemplate();
});
},
onShow() {
if (this.isOpenWeixing && this.orderId) {
this.$util.wxh5PayIsSuccess(this.orderId, 1, this)
this.isOpenWeixing = false
}
},
methods: {
getOrderDetail() {
return getOrderDetail(this.orderId).then(({ data }) => {
const {
gold_name,
order,
site_name,
is_alipay,
is_yue,
wxpayH5,
now_money,
} = data;
Object.assign(this, {
gold_name,
now_money: Number(now_money),
orderInfo: order,
id: order.id,
money: Number(order.pay_price),
site_name,
is_alipay: !!is_alipay,
is_yue: !!is_yue,
wxpayH5: !!wxpayH5,
});
});
},
subscribeTemplate() {
getSpecialTemplateIds(this.pay_type_num, this.id).then(({ msg }) => {
this.templateId = msg;
});
},
submit() {
this.payDialogOpen = true;
},
copyNo() {
uni.setClipboardData({
data: this.orderInfo.delivery_id,
success: () => {
this.$util.showMsg("复制成功");
},
fail: (err) => {
this.$util.showMsg("复制失败");
},
});
},
async userTake() {
const { confirm } = await this.$util.wrapFn(uni.showModal, {
title: "提示",
content: "确定立即收货?",
});
if (!confirm) return;
uni.showLoading({ mask: true });
try {
await userTakeOrder(this.orderId);
uni.hideLoading();
this.$util.showMsg("收货成功!");
this.getOrderDetail();
} catch (err) {
this.$util.showMsg(err.msg);
uni.hideLoading();
}
},
async removeOrder(title) {
const { confirm } = await this.$util.wrapFn(uni.showModal, {
title: "提示",
content: "确认" + title + "该订单?",
});
if (!confirm) return;
uni.showLoading({ mask: true });
try {
await userRemoveOrder(this.orderId);
uni.hideLoading();
this.$util.showMsg(title + "成功!");
} catch (err) {
uni.hideLoading();
this.$util.showMsg(err.msg);
}
},
// 联系客服
services() {
this.$util.goSupport(CUSTOMER_DETAIL_TYPE.ORDER, CUSTOMER_SUPPORT_TYPE.STORE_GOOD_ORDER, this.orderInfo.id);
},
applyRefundOrder() {
uni.navigateTo({
url: "/pages/my/refund_apply?order_id=" + this.orderId,
});
},
pay_order(data) {
this.orderId = data.data.result.orderId || "";
switch (data.data.status) {
case "PAY_ERROR":
case "ORDER_EXIST":
case "ORDER_ERROR":
this.extendOrder(data.msg);
break;
case "WECHAT_PAY":
this.wechatPay(data.data.result.jsConfig);
break;
case "WECHAT_ROUTINE_PAY":
this.$util.wechatRoutinePay(data.data.result.jsConfig, this);
break;
case "WECHAT_H5_PAY":
this.payDialogOpen = false;
this.$util.wechatH5Pay(data.data.result.jsConfig, this);
break;
case "SUCCESS":
this.successOrder(data.msg);
break;
case "ZHIFUBAO_PAY":
this.aliPay(data.data.result, "goods")
break;
case 'TOUTIAO_PAY':
this.$util.toutiaoPay(data.data.result.jsConfig, this);
break;
case 'KUAISHOU_PAY':
this.$util.kuaishouPay(data.data.result.jsConfig, this);
break
}
},
aliPay(msn, type) {
this.$util.aliPay(msn, type, this)
},
wechatPay(config) {
this.$util.weixinpay(config, this)
},
successOrder(msg) {
this.$util.showMsg(msg || "支付成功");
this.getOrderDetail();
},
extendOrder: function (msg) {
if (typeof msg === "object") {
if (msg.errMsg === "chooseWXPay:cancel") {
msg = "微信支付取消";
} else {
msg = "支付失败";
}
} else {
msg = "支付失败";
}
this.$util.showMsg(msg);
this.getOrderDetail();
},
//所有插件回调处理事件
changeVal(opt) {
if (typeof opt != "object") opt = {};
var action = opt.action || "";
var value = opt.value || "";
this[action] && this[action](value);
},
express() {
uni.navigateTo({
url: "/pages/my/express?uni=" + this.orderId,
});
},
},
};
</script>
<style scoped lang="scss">
.order-detail .section {
background-color: #ffffff;
}
.order-detail .section~.section {
margin-top: 12rpx;
}
.order-detail .section.return {
padding: 40rpx 30rpx;
background-color: #666;
font-size: 30rpx;
color: #ffffff;
}
.order-detail .section.return .time {
margin-top: 15rpx;
font-size: 24rpx;
}
.order-detail .section.reason {
padding: 40rpx 30rpx;
font-size: 30rpx;
color: #333;
}
.order-detail .section.reason .info {
margin-top: 15rpx;
font-size: 24rpx;
color: #999999;
}
.order-detail .section.status {
display: flex;
align-items: center;
padding: 32rpx 30rpx;
background-color: #2c8eff;
font-size: 30rpx;
color: #ffffff;
}
.order-detail .section.status .image {
width: 110rpx;
height: 110rpx;
margin-right: 30rpx;
}
.order-detail .section.status image {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
pointer-events: none;
}
.order-detail .section.status .text {
flex: 1;
}
.order-detail .section.status view:first-child {
font-weight: bold;
}
.order-detail .section.status .time {
margin-top: 10rpx;
font-size: 24rpx;
opacity: 0.8;
}
.order-detail .section.contact {
padding: 40rpx 30rpx;
background: #ffffff url(@/static/images/address-line.jpg) left bottom/749rpx 3rpx repeat-x;
font-size: 30rpx;
color: #282828;
}
.order-detail .section.contact text text {
margin-left: 30rpx;
}
.order-detail .section.contact .address {
margin-top: 15rpx;
font-size: 26rpx;
color: #868686;
}
.order-detail .section.goods .goods-bd {
display: flex;
padding: 26rpx 30rpx;
}
.order-detail .section.goods .image {
width: 230rpx;
height: 128rpx;
border-radius: 10rpx;
overflow: hidden;
margin-right: 20rpx;
}
.order-detail .section.goods image {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
pointer-events: none;
}
.order-detail .section.goods .text {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.order-detail .section.goods .name {
-webkit-line-clamp: 2;
overflow: hidden;
font-size: 28rpx;
line-height: 40rpx;
color: #343434;
}
.order-detail .section.goods .price,
.order-detail .section.goods .vip-price {
display: inline-block;
}
.order-detail .section.goods .price {
font-size: 26rpx;
color: #9a9a9a;
}
.order-detail .section.goods .price text {
font-size: 26rpx;
}
.order-detail .section.goods .vip-price {
font-size: 24rpx;
}
.order-detail .section.goods .vip-price image {
display: inline-block;
width: 46rpx;
height: 21rpx;
pointer-events: none;
-webkit-touch-callout: none;
}
.order-detail .section.goods .goods-bd>view:last-child {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.order-detail .section.goods .num {
margin-left: 20rpx;
font-size: 26rpx;
line-height: 30rpx;
color: #9a9a9a;
}
.order-detail .section.goods .goods-bd>view:last-child navigator {
padding: 0.15em 0.4em;
border: 1px solid #2c8eff;
border-radius: 4px;
font-size: 20rpx;
line-height: 1.2;
color: #2c8eff;
}
.order-detail .section.goods .goods-ft {
display: flex;
justify-content: flex-end;
align-items: center;
height: 93rpx;
padding-right: 30rpx;
padding-left: 30rpx;
border-top: 1px solid #f0f0f0;
font-size: 26rpx;
color: #282828;
}
.order-detail .section.goods .goods-ft text {
font-weight: bold;
font-size: 28rpx;
color: #ff6b00;
}
.order-detail .section.express {
display: flex;
align-items: center;
padding: 30rpx;
}
.order-detail .section.express .image {
width: 50rpx;
height: 50rpx;
margin-right: 20rpx;
}
.order-detail .section.express image {
display: block;
width: 100%;
height: 100%;
padding: 10rpx;
box-sizing: border-box;
background-color: #ff9600;
object-fit: cover;
pointer-events: none;
}
.order-detail .section.express .text {
flex: 1;
font-size: 26rpx;
color: #999999;
}
.order-detail .section.express .text view view {
margin-top: 10rpx;
}
.order-detail .section.express .text text {
color: #333;
}
.order-detail .section.express button {
padding: 0.15em 0.4em;
border: 1px solid #999999;
border-radius: 4px;
font-family: inherit;
font-weight: normal;
font-size: 20rpx;
line-height: 1.2;
color: #666;
}
.order-detail .section.list {
padding: 30rpx;
font-size: 28rpx;
color: #282828;
}
.order-detail .section.list .li-item {
&+.li-item {
margin-top: 30rpx;
}
view:nth-child(2) {
flex: 1;
text-align: right;
color: #868686;
}
}
// .order-detail .section.list view:nth-child(2) {
// flex: 1;
// text-align: right;
// color: #868686;
// }
.order-detail .section.list view.msg {
text-align: left;
word-break: break-all;
}
.order-detail .footer {
position: fixed;
bottom: 0;
left: 0;
z-index: 9;
width: 100%;
padding: 20rpx 30rpx;
padding-bottom: calc(20rpx + var(--safe-bottom));
background-color: #ffffff;
overflow: hidden;
white-space: nowrap;
text-align: right;
}
.order-detail .footer {
.footer-btn {
display: inline-block;
width: 150rpx;
height: 60rpx;
border: 1px solid #dedede;
border-radius: 30rpx;
vertical-align: middle;
font-size: 27rpx;
line-height: 60rpx;
text-align: center;
color: #aaa;
&.blue {
border-color: #2c8eff;
background-color: #2c8eff;
color: #ffffff;
}
}
}
.footer-btn+.footer-btn {
margin-left: 15rpx;
}
</style>