处理京东物流超链接

feature/0423
fanfan 10 months ago
parent e0cab4d838
commit 07b84fffd4
  1. 239
      src/views/order/Detail.vue

@ -14,31 +14,27 @@
</li>
<li>
<span>付款</span>
<div
v-if="record.pay_status == PayStatusEnum.SUCCESS.value"
class="tip"
>付款于 {{ record.pay_time }}</div>
<div v-if="record.pay_status == PayStatusEnum.SUCCESS.value" class="tip">
付款于 {{ record.pay_time }}
</div>
</li>
<li>
<span>发货</span>
<div
v-if="record.delivery_status != DeliveryStatusEnum.NOT_DELIVERED.value"
class="tip"
>发货于 {{ record.delivery_time }}</div>
<div v-if="record.delivery_status != DeliveryStatusEnum.NOT_DELIVERED.value" class="tip">
发货于 {{ record.delivery_time }}
</div>
</li>
<li>
<span>收货</span>
<div
v-if="record.receipt_status == ReceiptStatusEnum.RECEIVED.value"
class="tip"
>收货于 {{ record.receipt_time }}</div>
<div v-if="record.receipt_status == ReceiptStatusEnum.RECEIVED.value" class="tip">
收货于 {{ record.receipt_time }}
</div>
</li>
<li>
<span>完成</span>
<div
v-if="record.order_status == OrderStatusEnum.COMPLETED.value"
class="tip"
>完成于 {{ record.receipt_time }}</div>
<div v-if="record.order_status == OrderStatusEnum.COMPLETED.value" class="tip">
完成于 {{ record.receipt_time }}
</div>
</li>
</ul>
</div>
@ -59,53 +55,49 @@
</div>
<!-- 操作栏 -->
<div class="actions clearfix mt-10">
<div
v-if="$module('order-updatePrice') &&$auth('/order/detail.updatePrice')"
class="action-item"
<div v-if="$module('order-updatePrice') && $auth('/order/detail.updatePrice')" class="action-item">
<a-button v-if="record.pay_status == PayStatusEnum.PENDING.value" @click="handleUpdatePrice"
>订单改价</a-button
>
<a-button
v-if="record.pay_status == PayStatusEnum.PENDING.value"
@click="handleUpdatePrice"
>订单改价</a-button>
</div>
<div class="action-item" v-if="$auth('/order/list/all.deliver')">
<a-button
v-if="(
record.pay_status == PayStatusEnum.SUCCESS.value
&& inArray(record.delivery_type, [ DeliveryTypeEnum.EXPRESS.value, DeliveryTypeEnum.NOTHING.value])
&& record.delivery_status != DeliveryStatusEnum.DELIVERED.value
&& !inArray(record.order_status, [OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
)"
v-if="
record.pay_status == PayStatusEnum.SUCCESS.value &&
inArray(record.delivery_type, [DeliveryTypeEnum.EXPRESS.value, DeliveryTypeEnum.NOTHING.value]) &&
record.delivery_status != DeliveryStatusEnum.DELIVERED.value &&
!inArray(record.order_status, [OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
"
type="primary"
@click="handleDelivery"
>发货</a-button>
>发货</a-button
>
</div>
<div class="action-item" v-if="$auth('/order/list/all.extract')">
<a-button
v-if="(
record.pay_status == PayStatusEnum.SUCCESS.value
&& record.delivery_type == DeliveryTypeEnum.EXTRACT.value
&& record.delivery_status != DeliveryStatusEnum.DELIVERED.value
&& !inArray(record.order_status, [OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
)"
v-if="
record.pay_status == PayStatusEnum.SUCCESS.value &&
record.delivery_type == DeliveryTypeEnum.EXTRACT.value &&
record.delivery_status != DeliveryStatusEnum.DELIVERED.value &&
!inArray(record.order_status, [OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
"
type="primary"
@click="handleExtract"
>自提核销</a-button>
>自提核销</a-button
>
</div>
<div class="action-item" v-if="$auth('/order/list/all.cancel')">
<a-button
v-if="record.order_status == OrderStatusEnum.APPLY_CANCEL.value"
type="primary"
@click="handleCancel"
>审核取消订单</a-button>
>审核取消订单</a-button
>
</div>
<div class="action-item" v-if="$auth('/order/detail.merchantRemark')">
<a-button @click="handleMerchantRemark">商家备注</a-button>
</div>
<div
v-if="$module('order-printer') && $auth('/order/detail.printer')"
class="action-item"
>
<div v-if="$module('order-printer') && $auth('/order/detail.printer')" class="action-item">
<a-button @click="handlePrinter">打印小票</a-button>
</div>
</div>
@ -116,10 +108,7 @@
<a-descriptions-item label="订单号">{{ record.order_no }}</a-descriptions-item>
<a-descriptions-item label="实付款金额">{{ record.pay_price }}</a-descriptions-item>
<a-descriptions-item label="支付方式">
<a-tag
color="green"
v-if="record.pay_method"
>{{ PaymentMethodEnum[record.pay_method].name }}</a-tag>
<a-tag color="green" v-if="record.pay_method">{{ PaymentMethodEnum[record.pay_method].name }}</a-tag>
<span v-else>--</span>
</a-descriptions-item>
<a-descriptions-item label="配送方式">
@ -127,9 +116,9 @@
</a-descriptions-item>
<a-descriptions-item label="运费金额">{{ record.express_price }}</a-descriptions-item>
<a-descriptions-item label="订单状态">
<a-tag
:color="renderOrderStatusColor(record.order_status)"
>{{ OrderStatusEnum[record.order_status].name }}</a-tag>
<a-tag :color="renderOrderStatusColor(record.order_status)">{{
OrderStatusEnum[record.order_status].name
}}</a-tag>
</a-descriptions-item>
<a-descriptions-item label="买家信息">
<a-tooltip>
@ -156,12 +145,7 @@
<a-card class="mt-20" :bordered="false">
<div class="ant-descriptions-title">订单商品</div>
<div class="goods-list">
<a-table
rowKey="order_goods_id"
:columns="goodsColumns"
:dataSource="record.goods"
:pagination="false"
>
<a-table rowKey="order_goods_id" :columns="goodsColumns" :dataSource="record.goods" :pagination="false">
<!-- 商品信息 -->
<template slot="goodsInfo" slot-scope="text, item">
<GoodsItem
@ -169,7 +153,7 @@
image: item.goods_image,
imageAlt: '商品图片',
title: item.goods_name,
goodsProps: item.goods_props
goodsProps: item.goods_props,
}"
/>
</template>
@ -232,22 +216,33 @@
<template v-if="record.order_type == OrderTypeEnum.PHYSICAL.value">
<!-- 物流配送信息 -->
<a-card
v-if="(
record.pay_status == PayStatusEnum.SUCCESS.value
&& record.delivery_status != DeliveryStatusEnum.NOT_DELIVERED.value
&& !inArray(record.order_status, [OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
)"
v-if="
record.pay_status == PayStatusEnum.SUCCESS.value &&
record.delivery_status != DeliveryStatusEnum.NOT_DELIVERED.value &&
!inArray(record.order_status, [OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
"
class="mt-20"
:bordered="false"
>
<!-- 此处仅用于兼容旧物流数据 -->
<a-descriptions v-if="!record.delivery.length && record.express" title="配送信息">
<a-descriptions-item label="物流公司">{{ record.express.express_name }}</a-descriptions-item>
<a-descriptions-item label="物流单号">{{ record.express_no }}</a-descriptions-item>
<a-descriptions-item label="物流单号">
<a
v-if="record.isLink"
:href="record.express_no"
style="white-space: pre-wrap; color: #00acff"
target="_blank"
>{{ record.express_no ? '京东物流' : '--' }}</a
>
<p v-else style="white-space: pre-wrap">
{{ record.express_no ? record.express_no : '--' }}
</p></a-descriptions-item
>
<a-descriptions-item label="发货状态">
<a-tag
:color="record.delivery_status == DeliveryStatusEnum.DELIVERED.value ? 'green' : ''"
>{{ DeliveryStatusEnum[record.delivery_status].name }}</a-tag>
<a-tag :color="record.delivery_status == DeliveryStatusEnum.DELIVERED.value ? 'green' : ''">{{
DeliveryStatusEnum[record.delivery_status].name
}}</a-tag>
</a-descriptions-item>
<a-descriptions-item label="发货时间">{{ record.delivery_time }}</a-descriptions-item>
</a-descriptions>
@ -255,16 +250,22 @@
<div v-if="record.delivery.length">
<a-descriptions title="发货信息"></a-descriptions>
<a-tabs :default-active-key="1" :class="{ 'hide-bar': record.delivery.length < 2 }">
<a-tab-pane
:tab="`包裹${index + 1}`"
v-for="(item, index) in record.delivery"
:key="index + 1"
>
<a-tab-pane :tab="`包裹${index + 1}`" v-for="(item, index) in record.delivery" :key="index + 1">
<a-descriptions>
<a-descriptions-item
label="物流公司"
>{{ item.delivery_method == 20 ? '无需物流' : item.express.express_name }}</a-descriptions-item>
<a-descriptions-item label="物流单号">{{ item.express_no ? item.express_no : '--' }}</a-descriptions-item>
<a-descriptions-item label="物流公司">{{
item.delivery_method == 20 ? '无需物流' : item.express.express_name
}}</a-descriptions-item>
<!-- isLink -->
<a-descriptions-item label="物流单号">
<a
v-if="item.isLink"
:href="item.express_no"
style="white-space: pre-wrap; color: #00acff"
target="_blank"
>{{ item.express_no ? '京东物流' : '--' }}</a
>
<p v-else style="white-space: pre-wrap">{{ item.express_no ? item.express_no : '--' }}</p>
</a-descriptions-item>
<a-descriptions-item label="发货状态">
<a-tag color="green">已发货</a-tag>
</a-descriptions-item>
@ -284,11 +285,7 @@
</a-card>
<!-- 买家收货信息 -->
<a-card
v-if="record.delivery_type == DeliveryTypeEnum.EXPRESS.value"
class="mt-20"
:bordered="false"
>
<a-card v-if="record.delivery_type == DeliveryTypeEnum.EXPRESS.value" class="mt-20" :bordered="false">
<!-- 收货信息 -->
<a-descriptions title="买家收货地址">
<a-descriptions-item label="收货人姓名">{{ record.address.name }}</a-descriptions-item>
@ -303,11 +300,7 @@
</a-card>
<!-- 上门自提 -->
<a-card
v-if="record.delivery_type == DeliveryTypeEnum.EXTRACT.value"
class="mt-20"
:bordered="false"
>
<a-card v-if="record.delivery_type == DeliveryTypeEnum.EXTRACT.value" class="mt-20" :bordered="false">
<!-- 自提信息 -->
<a-descriptions title="自提信息">
<a-descriptions-item label="姓名">
@ -336,11 +329,11 @@
</a-descriptions>
<!-- 核销信息 -->
<template
v-if="(
record.pay_status == PayStatusEnum.SUCCESS.value
&& record.delivery_status == DeliveryStatusEnum.DELIVERED.value
&& !inArray(record.order_status ,[OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
)"
v-if="
record.pay_status == PayStatusEnum.SUCCESS.value &&
record.delivery_status == DeliveryStatusEnum.DELIVERED.value &&
!inArray(record.order_status, [OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
"
>
<a-divider class="o-divider" />
<a-descriptions title="核销信息">
@ -357,9 +350,9 @@
</a-tooltip>
</a-descriptions-item>
<a-descriptions-item label="核销状态">
<a-tag
:color="record.delivery_status == DeliveryStatusEnum.DELIVERED.value ? 'green' : ''"
>已核销</a-tag>
<a-tag :color="record.delivery_status == DeliveryStatusEnum.DELIVERED.value ? 'green' : ''"
>已核销</a-tag
>
</a-descriptions-item>
<a-descriptions-item label="核销时间">{{ record.delivery_time }}</a-descriptions-item>
</a-descriptions>
@ -388,7 +381,7 @@ import {
OrderSourceEnum,
OrderStatusEnum,
PayStatusEnum,
ReceiptStatusEnum
ReceiptStatusEnum,
} from '@/common/enum/order'
import { PaymentMethodEnum } from '@/common/enum/payment'
@ -396,33 +389,33 @@ import { PaymentMethodEnum } from '@/common/enum/payment'
const goodsColumns = [
{
title: '商品信息',
scopedSlots: { customRender: 'goodsInfo' }
scopedSlots: { customRender: 'goodsInfo' },
},
{
title: '商品编码',
dataIndex: 'goods_no',
scopedSlots: { customRender: 'goods_no' }
scopedSlots: { customRender: 'goods_no' },
},
{
title: '重量(Kg)',
dataIndex: 'goods_weight',
scopedSlots: { customRender: 'goods_weight' }
scopedSlots: { customRender: 'goods_weight' },
},
{
title: '单价',
dataIndex: 'goods_price',
scopedSlots: { customRender: 'goods_price' }
scopedSlots: { customRender: 'goods_price' },
},
{
title: '购买数量',
dataIndex: 'total_num',
scopedSlots: { customRender: 'total_num' }
scopedSlots: { customRender: 'total_num' },
},
{
title: '商品总价',
dataIndex: 'total_price',
scopedSlots: { customRender: 'total_price' }
}
scopedSlots: { customRender: 'total_price' },
},
]
export default {
@ -435,7 +428,7 @@ export default {
CancelForm,
PrinterForm,
PriceForm,
RemarkForm
RemarkForm,
},
data() {
return {
@ -459,7 +452,7 @@ export default {
//
progress: 2,
//
goodsColumns
goodsColumns,
}
},
created() {
@ -469,25 +462,41 @@ export default {
this.handleRefresh()
},
methods: {
//
handleRefresh() {
//
this.getDetail()
},
containsLetterMix(str, mix) {
return new RegExp(mix.split('').join('\\w*')).test(str)
},
//
getDetail() {
const { orderId } = this
this.isLoading = true
Api.detail({ orderId })
.then(result => {
.then((result) => {
//
this.record = result.data.detail
if (this.record.delivery.length) {
this.record.delivery.forEach((item) => {
if (this.containsLetterMix(item.express_no, 'jd.com')) {
item.isLink = true
} else {
item.isLink = false
}
})
} else {
if (this.containsLetterMix(record.express_no, 'jd.com')) {
record.isLink = true
} else {
record.isLink = false
}
}
//
this.initData()
})
.finally(() => this.isLoading = false)
.finally(() => (this.isLoading = false))
},
//
@ -511,9 +520,11 @@ export default {
initDeliveryGoods() {
const { record } = this
if (record.delivery.length) {
record.delivery.forEach(deliveryItem => {
deliveryItem.goods.forEach(deliveryGoodsItem => {
deliveryGoodsItem.goods = record.goods.find(goods => goods.order_goods_id == deliveryGoodsItem.order_goods_id)
record.delivery.forEach((deliveryItem) => {
deliveryItem.goods.forEach((deliveryGoodsItem) => {
deliveryGoodsItem.goods = record.goods.find(
(goods) => goods.order_goods_id == deliveryGoodsItem.order_goods_id
)
})
})
}
@ -526,7 +537,7 @@ export default {
[OrderStatusEnum.NORMAL.value]: '',
[OrderStatusEnum.CANCELLED.value]: 'red',
[OrderStatusEnum.APPLY_CANCEL.value]: 'red',
[OrderStatusEnum.COMPLETED.value]: 'green'
[OrderStatusEnum.COMPLETED.value]: 'green',
}
return ColorEnum[orderStatus]
},
@ -566,8 +577,7 @@ export default {
const { record } = this
this.$refs.RemarkForm.show(record)
},
}
},
}
</script>
<style lang="less" scoped>
@ -737,7 +747,10 @@ export default {
/deep/.ant-tabs-bar {
margin-bottom: 20px;
}
/deep/.ant-descriptions-item-content {
white-space: pre-wrap;
word-break: break-all;
}
//
.deliver-goods-list {
.goods-item {

Loading…
Cancel
Save