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

831 lines
22 KiB

10 months ago
<template>
<BaseContainer class="order-detail">
<NavBar title="订单详情" :class="{ 'showNavBg': scrollTop > 20 }"/>
10 months ago
<view v-if="orderInfo.id" class="detail-box" @click="showOperateBox = false;">
10 months ago
<!-- 退款 -->
<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">
10 months ago
<!-- <view class="image">
10 months ago
<image :src="orderInfo.status_pic" />
10 months ago
</view> -->
10 months ago
<view class="text">
<view>{{ orderInfo._status._title }}</view>
<view class="time">{{ orderInfo._status._msg }}</view>
</view>
</view>
<view class="section contact">
9 months ago
<view v-if="orderInfo._status._type > 1" class="express-delivery-info flex">
10 months ago
<image src="@/static/images/special/car.png" mode="aspectFill"></image>
<view class="info-box" @click="express">
10 months ago
<view class="info-title flex">您的快递已发车 <text class="more"></text> </view>
<view class="info-time"></view>
10 months ago
</view>
</view>
<view class="address-info flex">
<image src="@/static/images/special/location.png" mode="aspectFill"></image>
<view class="info-box">
<view class="info-title flex">{{ orderInfo.real_name }} <text>{{ orderInfo.user_phone }}</text> </view>
<view class="info-time">{{ orderInfo.user_address }}</view>
</view>
</view>
10 months ago
</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>
10 months ago
<view class="money flex flex-center-x">
<view class="price"><text>{{ cart.truePrice }}</text></view>
<view class="num">x{{ cart.cart_num }}</view>
</view>
10 months ago
</view>
10 months ago
<!-- <view v-if="orderInfo._status._type === 3">
10 months ago
<view class="num">x{{ cart.cart_num }}</view>
<navigator :url="`/pages/my/order_reply?unique=${cart.unique}`">
评价
</navigator>
10 months ago
</view> -->
10 months ago
</view>
10 months ago
<view class="goods-ft flex flex-center-x">
<view class="li"> <text> {{ orderInfo.total_num }} </text> 件商品</view>
<view class="sum-money">合计<text><text style="color: #F8473E;font-size: 32rpx;">{{ orderInfo.pay_price }}</text></text></view>
10 months ago
</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>
10 months ago
<button type="button" @click="copyNo(orderInfo.delivery_id)" id="copy">复制单号</button>
10 months ago
</view>
<view class="section list">
<view class="li-item flex">
<view>订单编号</view>
10 months ago
<view class="flex flex-center-x">{{ orderInfo.order_id }} <text @click="copyNo(orderInfo.order_id)">复制</text> </view>
10 months ago
</view>
<view class="li-item flex">
10 months ago
<view>创建时间</view>
<view>{{ orderInfo.add_time }}</view>
</view>
<view v-if="orderInfo._status._type > 0" class="li-item flex">
<view>付款时间</view>
10 months ago
<view>{{ orderInfo.add_time }}</view>
</view>
10 months ago
<view v-if="orderInfo._status._type > 0" class="li-item flex">
<view>发货时间</view>
<view>{{ orderInfo.add_time }}</view>
</view>
</view>
<view class="section list">
<view v-if="orderInfo._status._type > 0" class="li-item flex">
<view>支付方式</view>
<view>{{ orderInfo._status._payType }}</view>
</view>
10 months ago
<view class="li-item flex">
<view>商品金额</view>
<view>{{ orderInfo.total_price }}</view>
</view>
10 months ago
<view class="li-item flex">
<view>优惠金额</view>
<view style="color: #FF3A37;">{{ orderInfo.total_price - money }}</view>
</view>
<!-- <view v-if="orderInfo.use_gold > 0" class="li-item flex">
10 months ago
<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>
10 months ago
</view> -->
<view class="li-item flex">
<view>配送费</view>
<view>{{ orderInfo.total_postage }}</view>
</view>
10 months ago
<view class="li-item flex">
10 months ago
<view>实际支付</view>
<view>{{ money }}</view>
10 months ago
</view>
10 months ago
<!-- <view class="li-item flex">
10 months ago
<view>买家留言</view>
<view class="msg">{{ orderInfo.mark }}</view>
10 months ago
</view> -->
10 months ago
</view>
10 months ago
<view v-if="showOperateBox" class="operate-box">
<view class="apply-invoicing" @click.stop="applyInvoicing">申请开票</view>
<view class="delete-order" @click.stop="removeOrder('删除')">删除订单</view>
</view>
<view class="footer flex flex-center-x">
<view class="more-operate" @click.stop="showOperateBox = !showOperateBox;">更多</view>
10 months ago
<template v-if="orderInfo._status._type === 0">
<view class="footer-btn" @click="removeOrder('取消')">取消订单</view>
10 months ago
<view class="red footer-btn" @click="submit">付款</view>
10 months ago
</template>
10 months ago
<!-- <template v-else-if="
10 months ago
orderInfo._status._type === 1 &&
!orderInfo.refund_reason &&
orderInfo.refund_status === 0 &&
orderInfo.pay_price > 0
">
<view class="footer-btn" @click="applyRefundOrder">申请退款</view>
10 months ago
</template> -->
<!-- <template v-else-if="
10 months ago
orderInfo._status._type === 3 &&
!orderInfo.refund_reason &&
orderInfo.refund_status === 0 &&
orderInfo.pay_price > 0
">
<view class="footer-btn" @click="removeOrder('删除')">删除订单</view>
10 months ago
<view class="footer-btn" @click="applyRefundOrder">申请退款</view>
</template> -->
<!-- <template v-else-if="
10 months ago
orderInfo._status._type === 4 &&
!orderInfo.refund_reason &&
orderInfo.refund_status === 0 &&
orderInfo.pay_price > 0
">
<view class="footer-btn" @click="removeOrder('删除')">删除订单</view>
10 months ago
<view class="footer-btn" @click="applyRefundOrder">申请退款</view>
</template> -->
<!-- <template v-else-if="
10 months ago
!orderInfo.refund_reason &&
orderInfo.refund_status === 0 &&
orderInfo._status._type === 3 &&
orderInfo.pay_price > 0
">
<view class="footer-btn" @click="removeOrder('删除')">删除订单</view>
10 months ago
<view class="red footer-btn" @click="applyRefundOrder()"> 再次申请 </view>
</template> -->
10 months ago
<view @click="removeOrder('删除')" class="footer-btn" v-else-if="
orderInfo.refund_status === 2 ||
(orderInfo._status._type === 3 && orderInfo.pay_price === 0)
">删除订单</view>
10 months ago
<!-- <view class="footer-btn" @click="services">联系客服</view> -->
<!-- <view class="footer-btn" v-if="orderInfo.status >= 1" @click="express">查看物流</view> -->
10 months ago
<template v-else-if="orderInfo._status._type === 2">
<view class="red footer-btn" @click="userTake">确认收货</view>
</template>
10 months ago
</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" />
10 months ago
</view>
10 months ago
</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: "",
10 months ago
isOpenWeixing: false,
showOperateBox: false,
scrollTop: 0,
10 months ago
};
},
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
}
},
onPageScroll(e) {
console.log(e.scrollTop);
this.scrollTop = e.scrollTop;
},
10 months ago
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,
});
10 months ago
console.log('money', this);
10 months ago
});
},
subscribeTemplate() {
getSpecialTemplateIds(this.pay_type_num, this.id).then(({ msg }) => {
this.templateId = msg;
});
},
submit() {
this.payDialogOpen = true;
},
10 months ago
copyNo(num) {
10 months ago
uni.setClipboardData({
10 months ago
data: num,
10 months ago
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 + "成功!");
uni.navigateBack();
10 months ago
} 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,
});
},
10 months ago
applyInvoicing() {
uni.navigateTo({
url: `/pages/store/applyInvoicing?orderNum=${this.orderInfo.order_id}&money=${this.money}`,
});
this.showOperateBox = false;
},
10 months ago
},
};
</script>
<style scoped lang="scss">
10 months ago
.order-detail {
background: linear-gradient(to top, #f6f6f6 0%, #f6f6f6 60%, #F6F8FA 70%, #A1BFFD 100%);
display: flex;
flex-direction: column;
min-height: 100vh;
10 months ago
padding-bottom: 130rpx;
::v-deep {
.nav-box {
background: transparent!important;
}
.showNavBg {
background: #fff!important;
}
// #ifdef MP-WEIXIN
.base-container {
background: transparent!important;
padding-bottom: calc(0rpx + var(--safe-top))!important;
}
.showNavBg {
.nav-box {
background: #fff!important;
}
}
// #endif
10 months ago
}
.detail-box {
flex: 1;
overflow-y: auto;
}
}
10 months ago
.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;
10 months ago
background-color: transparent;
10 months ago
font-size: 30rpx;
10 months ago
color: #333;
10 months ago
}
.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;
10 months ago
font-size: 42rpx;
10 months ago
}
.order-detail .section.status .time {
10 months ago
margin-top: 22rpx;
10 months ago
font-size: 24rpx;
10 months ago
line-height: 24rpx;
10 months ago
opacity: 0.8;
}
.order-detail .section.contact {
10 months ago
padding: 40rpx 16rpx;
font-size: 32rpx;
line-height: 32rpx;
color: #333;
width: 690rpx;
margin: 0 auto;
background: #fff;
border-radius: 10rpx;
9 months ago
.express-delivery-info {
10 months ago
margin-bottom: 60rpx;
9 months ago
}
.express-delivery-info, .address-info {
10 months ago
image {
width: 44rpx;
height: 44rpx;
margin-right: 16rpx;
}
.info-box {
flex: 1;
.info-title {
align-items: center;
padding-right: 20rpx;
text {
margin-left: auto;
}
}
.info-time {
margin-top: 24rpx;
color: #999;
font-size: 24rpx;
}
}
}
.address-info .info-box .info-title text {
margin-left: 40rpx!important;
}
10 months ago
}
.order-detail .section.contact text text {
margin-left: 30rpx;
}
.order-detail .section.contact .address {
margin-top: 15rpx;
font-size: 26rpx;
color: #868686;
}
10 months ago
.order-detail .section.goods {
width: 690rpx;
margin: 20rpx auto 0;
padding: 40rpx 30rpx 0;
}
10 months ago
.order-detail .section.goods .goods-bd {
display: flex;
10 months ago
border-bottom: 1rpx solid rgba(187, 187, 187, 0.32);
padding-bottom: 33rpx;
.image {
width: 156rpx;
height: 184rpx;
margin-right: 52rpx;
image {
display: block;
width: 100%;
height: 100%;
}
}
.text {
flex: 1;
.name {
color: #333;
line-height: 35rpx;
height: 70rpx;
}
.money {
margin-top: auto;
.price {
font-size: 22rpx;
color: #F8473E;
text {
font-size: 32rpx;
}
}
.num {
margin-left: auto;
font-size: 24rpx;
color: #999;
}
}
}
10 months ago
}
.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 {
10 months ago
justify-content: space-between;
height: 92rpx;
.li {
font-size: 25rpx;
color: #999;
text {
color: #333;
margin: 0 5rpx;
}
}
.sum-money {
font-size: 25rpx;
color: #999;
>text {
color: #F8473E;
font-size: 22rpx;
}
}
10 months ago
}
.order-detail .section.express {
display: flex;
align-items: center;
padding: 30rpx;
10 months ago
width: 690rpx;
margin: 20rpx auto 0;
10 months ago
}
.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;
10 months ago
width: 690rpx;
margin: 20rpx auto 0;
10 months ago
}
.order-detail .section.list .li-item {
&+.li-item {
margin-top: 30rpx;
}
10 months ago
text {
width: 90rpx;
height: 42rpx;
background: #FFFFFF;
border-radius: 21rpx;
border: 2rpx solid #BBBBBB;
text-align: center;
line-height: 42rpx;
margin-left: auto;
font-size: 24rpx;
color: #bbb;
}
view:nth-child(1) {
width: 180rpx;
}
10 months ago
view:nth-child(2) {
flex: 1;
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;
}
10 months ago
.order-detail .operate-box {
position: fixed;
left: 60rpx;
bottom: 110rpx;
background: #fff;
box-shadow: 0rpx 8rpx 18rpx 0rpx rgba(49,49,49,0.16);
padding: 0 16rpx;
z-index: 100;
&:after {
content: '';
position: absolute;
left: 10rpx;
bottom: -35rpx;
width: 0;
height: 0;
border: 20rpx solid;
border-color: #fff transparent transparent transparent;
}
>view {
font-size: 28rpx;
color: #333;
height: 84rpx;
line-height: 84rpx;
&.apply-invoicing {
border-bottom: 1rpx solid #e5e5e5;
}
}
}
10 months ago
.order-detail .footer {
position: fixed;
bottom: 0;
left: 0;
z-index: 9;
width: 100%;
10 months ago
padding: 0 30rpx 0 60rpx;
height: 130rpx;
10 months ago
background-color: #ffffff;
overflow: hidden;
white-space: nowrap;
10 months ago
.more-operate {
margin-right: auto;
font-size: 28rpx;
color: #666;
}
10 months ago
}
.order-detail .footer {
.footer-btn {
10 months ago
width: 160rpx;
10 months ago
height: 60rpx;
10 months ago
border: 1px solid #CCCCCC;
10 months ago
border-radius: 30rpx;
vertical-align: middle;
10 months ago
font-size: 28rpx;
10 months ago
line-height: 60rpx;
text-align: center;
10 months ago
color: #666;
10 months ago
10 months ago
&.red {
border-color: #FF4B33;
background-color: #FF4B33;
10 months ago
color: #ffffff;
}
}
}
.footer-btn+.footer-btn {
10 months ago
margin-left: 8rpx;
10 months ago
}
</style>