|
@@ -117,6 +117,10 @@
|
|
|
<view class="label">创建时间</view>
|
|
<view class="label">创建时间</view>
|
|
|
<view class="value">{{ data.addTime ? data.addTime.substr(0,13) : ''}}</view>
|
|
<view class="value">{{ data.addTime ? data.addTime.substr(0,13) : ''}}</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <view class="msg-list">
|
|
|
|
|
+ <view class="label">支付渠道</view>
|
|
|
|
|
+ <view class="value">{{ payChannelInfo }}</view>
|
|
|
|
|
+ </view>
|
|
|
<view class="msg-list">
|
|
<view class="msg-list">
|
|
|
<view class="label">支付方式</view>
|
|
<view class="label">支付方式</view>
|
|
|
<view class="value">{{ payWayInfo }}</view>
|
|
<view class="value">{{ payWayInfo }}</view>
|
|
@@ -136,11 +140,11 @@
|
|
|
<template v-if="data.status == 1">
|
|
<template v-if="data.status == 1">
|
|
|
<button class="button-com green big" @click="payFn">立即支付</button>
|
|
<button class="button-com green big" @click="payFn">立即支付</button>
|
|
|
</template>
|
|
</template>
|
|
|
- <!-- 待审核不可再申请,但仍展示「查看申请」;可申请时保留「申请售后」 -->
|
|
|
|
|
|
|
+ <!-- 非待支付:申请记录 + 申请售后始终同时展示;有待审时进申请页只能看进度不能再提交 -->
|
|
|
<template v-else>
|
|
<template v-else>
|
|
|
- <view v-if="showViewRefundBtn || showRefundBtn" class="refund-actions" :class="{ 'is-double': showBothRefundBtns }">
|
|
|
|
|
- <button v-if="showViewRefundBtn" class="button-com default big refund-btn" @click="goViewRefund">查看申请</button>
|
|
|
|
|
- <button v-if="showRefundBtn" class="button-com default big refund-btn" @click="goRefund">申请售后</button>
|
|
|
|
|
|
|
+ <view class="refund-actions">
|
|
|
|
|
+ <button class="button-com default big refund-btn" @click="goViewRefund">申请记录</button>
|
|
|
|
|
+ <button class="button-com default big refund-btn" @click="goRefund">申请售后</button>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
</view>
|
|
</view>
|
|
@@ -149,14 +153,13 @@
|
|
|
<script>
|
|
<script>
|
|
|
/**
|
|
/**
|
|
|
* 商城订单详情
|
|
* 商城订单详情
|
|
|
- * 底部「申请售后」看 canApplyRefund(现金为 0 时需红包未退回且红包金额大于实付);待审核/已有申请用 get-refund-data 的 apply 展示「查看申请」
|
|
|
|
|
|
|
+ * 底栏「申请记录」进本单售后列表;「申请售后」进申请页(有待审核时只展示进度,不可再提交)
|
|
|
*/
|
|
*/
|
|
|
import { mapGetters } from "vuex";
|
|
import { mapGetters } from "vuex";
|
|
|
import orderItem from "@/components/module/app-order-item";
|
|
import orderItem from "@/components/module/app-order-item";
|
|
|
import ListModule from "@/components/module/app-order-list";
|
|
import ListModule from "@/components/module/app-order-list";
|
|
|
import AppCouponSel from "@/components/app-coupon-sel";
|
|
import AppCouponSel from "@/components/app-coupon-sel";
|
|
|
import { getDetail } from "@/api/order";
|
|
import { getDetail } from "@/api/order";
|
|
|
-import { getRefundData } from "@/api/refund";
|
|
|
|
|
import { getShopUser } from "@/utils/auth";
|
|
import { getShopUser } from "@/utils/auth";
|
|
|
export default {
|
|
export default {
|
|
|
name: "detail",
|
|
name: "detail",
|
|
@@ -167,64 +170,15 @@ export default {
|
|
|
data: {},
|
|
data: {},
|
|
|
discountArr: false,
|
|
discountArr: false,
|
|
|
payWayInfo: "微信支付",
|
|
payWayInfo: "微信支付",
|
|
|
|
|
+ /** 支付渠道:onlinePay 2=线上 1=线下 */
|
|
|
|
|
+ payChannelInfo: "线下",
|
|
|
reachPeriodInfo: "上午",
|
|
reachPeriodInfo: "上午",
|
|
|
/** 首次 init 完成后再在 onShow 里重拉,避免进页连打两次 */
|
|
/** 首次 init 完成后再在 onShow 里重拉,避免进页连打两次 */
|
|
|
- detailInited: false,
|
|
|
|
|
- /** get-refund-data 的最新申请;待审核 status=0 也要能进查看 */
|
|
|
|
|
- refundApply: null
|
|
|
|
|
|
|
+ detailInited: false
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
...mapGetters({ shopUser: "getShopUser" }),
|
|
...mapGetters({ shopUser: "getShopUser" }),
|
|
|
- /**
|
|
|
|
|
- * 是否展示申请售后:优先用详情 canApplyRefund,与后端 RefundController 一致
|
|
|
|
|
- * 现金为 0 时:红包仍挂单且红包金额大于订单实付才展示
|
|
|
|
|
- */
|
|
|
|
|
- showRefundBtn() {
|
|
|
|
|
- const d = this.data || {};
|
|
|
|
|
- if (d.canApplyRefund !== undefined && d.canApplyRefund !== null && d.canApplyRefund !== "") {
|
|
|
|
|
- return Number(d.canApplyRefund) === 1;
|
|
|
|
|
- }
|
|
|
|
|
- // 接口未返回时的兜底(含分销已结算)
|
|
|
|
|
- if (Number(d.payStatus) !== 1) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- if (Number(d.forward) === 1) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- if ([1, 5, 6].indexOf(Number(d.status)) !== -1) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- if (Number(d.distOrderSettled) === 1) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- const could = Number(d.orderPrice || 0) - Number(d.tkPrice || 0);
|
|
|
|
|
- if (could <= 0) {
|
|
|
|
|
- const payAmount = Number(d.mainPay != null ? d.mainPay : d.orderPrice) || 0;
|
|
|
|
|
- return Number(d.hbId || 0) > 0 && Number(d.hbAmount || 0) > payAmount;
|
|
|
|
|
- }
|
|
|
|
|
- return true;
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 最新顾客申请 id:详情 refundApplyId 或补拉的 apply;待审核 status=0 仍有效
|
|
|
|
|
- */
|
|
|
|
|
- currentRefundApplyId() {
|
|
|
|
|
- const fromDetail = Number((this.data && this.data.refundApplyId) || 0);
|
|
|
|
|
- if (fromDetail) {
|
|
|
|
|
- return fromDetail;
|
|
|
|
|
- }
|
|
|
|
|
- return Number((this.refundApply && this.refundApply.id) || 0);
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 是否展示查看申请:有申请记录就展示,含待审核
|
|
|
|
|
- */
|
|
|
|
|
- showViewRefundBtn() {
|
|
|
|
|
- return !!this.currentRefundApplyId;
|
|
|
|
|
- },
|
|
|
|
|
- /** 同时有查看与申请时收窄按钮,避免底栏挤出 */
|
|
|
|
|
- showBothRefundBtns() {
|
|
|
|
|
- return this.showViewRefundBtn && this.showRefundBtn;
|
|
|
|
|
- },
|
|
|
|
|
statusImg() {
|
|
statusImg() {
|
|
|
let img = "";
|
|
let img = "";
|
|
|
if (this.data.status == 0) {
|
|
if (this.data.status == 0) {
|
|
@@ -240,7 +194,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
- * 从申请页返回后重拉详情,才能把「申请售后」换成「查看申请」
|
|
|
|
|
|
|
+ * 从申请页返回后重拉详情,刷新金额与状态
|
|
|
*/
|
|
*/
|
|
|
onShow() {
|
|
onShow() {
|
|
|
if (!this.detailInited) {
|
|
if (!this.detailInited) {
|
|
@@ -253,21 +207,20 @@ export default {
|
|
|
this.$util.pageTo({url:'/pages/order/detail?id='+info.shOrderId})
|
|
this.$util.pageTo({url:'/pages/order/detail?id='+info.shOrderId})
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
- * 查看本单最新售后申请(含待审核);有申请 id 进详情,否则进申请进度页
|
|
|
|
|
|
|
+ * 本单售后申请记录:进售后列表(orderId 只看本单),列表再点进详情
|
|
|
*/
|
|
*/
|
|
|
goViewRefund() {
|
|
goViewRefund() {
|
|
|
- const applyId = this.currentRefundApplyId;
|
|
|
|
|
- const account = (this.option && this.option.account) || "";
|
|
|
|
|
- if (applyId) {
|
|
|
|
|
- this.$util.pageTo({ url: "/pages/order/refund-detail?account=" + account + "&id=" + applyId });
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
if (!this.data || !this.data.id) {
|
|
if (!this.data || !this.data.id) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- this.$util.pageTo({ url: "/pages/order/refund?account=" + account + "&id=" + this.data.id });
|
|
|
|
|
|
|
+ const account = (this.option && this.option.account) || "";
|
|
|
|
|
+ this.$util.pageTo({
|
|
|
|
|
+ url: "/pages/order/refund-list?account=" + account + "&orderId=" + this.data.id
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
- /** 跳转申请售后;分销已结算时兜底提示 */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 进申请售后页;有待审核时申请页锁进度不可再提交(后端也会拦)
|
|
|
|
|
+ */
|
|
|
goRefund() {
|
|
goRefund() {
|
|
|
if (!this.data.id) {
|
|
if (!this.data.id) {
|
|
|
return;
|
|
return;
|
|
@@ -313,6 +266,8 @@ export default {
|
|
|
} else {
|
|
} else {
|
|
|
this.payWayInfo = "其它";
|
|
this.payWayInfo = "其它";
|
|
|
}
|
|
}
|
|
|
|
|
+ // onlinePay:字典 yes=2 线上,not=1 线下
|
|
|
|
|
+ this.payChannelInfo = Number(res.data.onlinePay) === 2 ? "线上" : "线下";
|
|
|
|
|
|
|
|
if (res.data.reachPeriod == 0) {
|
|
if (res.data.reachPeriod == 0) {
|
|
|
this.reachPeriodInfo = "上午";
|
|
this.reachPeriodInfo = "上午";
|
|
@@ -323,28 +278,6 @@ export default {
|
|
|
} else {
|
|
} else {
|
|
|
this.reachPeriodInfo = "上午";
|
|
this.reachPeriodInfo = "上午";
|
|
|
}
|
|
}
|
|
|
- // 待审核申请详情接口可能还不带 id,补拉 get-refund-data 才能露出查看入口
|
|
|
|
|
- return this.syncRefundApply();
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 补拉本单最新售后申请;待审核 status=0 也必须留下记录
|
|
|
|
|
- */
|
|
|
|
|
- syncRefundApply() {
|
|
|
|
|
- const orderId = (this.data && this.data.id) || (this.option && this.option.id);
|
|
|
|
|
- if (!orderId) {
|
|
|
|
|
- this.refundApply = null;
|
|
|
|
|
- return Promise.resolve();
|
|
|
|
|
- }
|
|
|
|
|
- return getRefundData({ id: orderId }).then(res => {
|
|
|
|
|
- if (!res || res.code != 1) {
|
|
|
|
|
- this.refundApply = null;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- const apply = res.data ? res.data.apply : null;
|
|
|
|
|
- this.refundApply = apply && apply.id ? apply : null;
|
|
|
|
|
- }).catch(() => {
|
|
|
|
|
- this.refundApply = null;
|
|
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
payFn() {
|
|
payFn() {
|
|
@@ -458,7 +391,7 @@ export default {
|
|
|
.default {
|
|
.default {
|
|
|
width: 300upx;
|
|
width: 300upx;
|
|
|
}
|
|
}
|
|
|
- /* 申请售后 / 查看申请:描边主色,与「立即支付」实心区分 */
|
|
|
|
|
|
|
+ /* 申请记录 / 申请售后:描边主色,与「立即支付」实心区分;两钮并排收窄 */
|
|
|
.refund-btn {
|
|
.refund-btn {
|
|
|
color: $mainColor !important;
|
|
color: $mainColor !important;
|
|
|
border: 1upx solid $mainColor !important;
|
|
border: 1upx solid $mainColor !important;
|
|
@@ -471,12 +404,9 @@ export default {
|
|
|
}
|
|
}
|
|
|
.refund-actions .refund-btn {
|
|
.refund-actions .refund-btn {
|
|
|
margin-left: 0;
|
|
margin-left: 0;
|
|
|
- }
|
|
|
|
|
- /* 两个按钮同时出现时收窄,避免和金额抢宽度 */
|
|
|
|
|
- .refund-actions.is-double .refund-btn {
|
|
|
|
|
width: 200upx;
|
|
width: 200upx;
|
|
|
}
|
|
}
|
|
|
- .refund-actions.is-double .refund-btn + .refund-btn {
|
|
|
|
|
|
|
+ .refund-actions .refund-btn + .refund-btn {
|
|
|
margin-left: 16upx;
|
|
margin-left: 16upx;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|