<template>
|
<div class="orderMgtInfo inner-bg-style">
|
<el-form size="mini" ref="form" inline label-width="140px">
|
<i :class="['el-icon-refresh', {'loading': featching}]" title="刷新" @click="refreshList"></i>
|
<div v-if="form.orderType&&form.orderType !== 'T04'">
|
<order-details-components :form="form" :newForm="newForm" :originalOrderAddressInfo="originalOrderAddressInfo">
|
</order-details-components>
|
<product-details-components :form="form"></product-details-components>
|
<customer-details-components v-if="form.isMarketOrder !== '1'" :form="form">
|
</customer-details-components>
|
</div>
|
<div v-if="form.orderType&&form.orderType === 'T04'">
|
<create-order-details :form="form" :newForm="newForm"
|
:originalOrderAddressInfo="originalOrderAddressInfo"
|
@handleAdddressInfo="handleAdddressInfo">
|
</create-order-details>
|
<create-order-details-prod :form="form"></create-order-details-prod>
|
</div>
|
<order-flowing-component :form="form"></order-flowing-component>
|
<store-delivery-component :form="form"
|
v-if="form.omsOrderDelivery && form.omsOrderDelivery.commonCarrier === '3'">
|
</store-delivery-component>
|
<div class="form-button">
|
<span class="operationBtn" v-if="form.isMarketOrder !== '1'">
|
<el-button size="mini" v-if="form.isCanRefund" type="warning"
|
@click="openReturnInfo(form)">生成退货单
|
</el-button>
|
<el-button :type="'primary'" size="mini"
|
v-if="form.isExitZeroOrder === '1' && (form.orderStatus === '04' || form.orderStatus === '05')"
|
@click="freeBuyProd(form)">0元购建单</el-button>
|
<el-button :type="'warning'" size="mini" @click="manualPush(form)" v-if="
|
form.orderStatus === '03' &&
|
form.pushAnjiType !== '1' &&
|
form.operationStatus === '1'
|
">手动推送</el-button>
|
<el-button :type="'primary'" size="mini" v-if="form.isCreateOrder === '1'"
|
@click="createIntegralOrder(form)">手动建单</el-button>
|
</span>
|
<el-button size="mini" @click="goBack">返回</el-button>
|
</div>
|
</el-form>
|
<return-info :show.sync="showReturnInfo" :orderRow='orderRow'></return-info>
|
</div>
|
</template>
|
<script>
|
import orderDetailsComponents from '@/views/orderMgt/components/orderDetailsComponents.vue'
|
import productDetailsComponents from '@/views/orderMgt/components/productDetailsComponents.vue'
|
import customerDetailsComponents from '@/views/orderMgt/components/customerDetailsComponents.vue'
|
import orderFlowingComponent from '@/views/orderMgt/components/orderFlowingComponent.vue'
|
import storeDeliveryComponent from '@/views/orderMgt/components/storeDeliveryComponent.vue'
|
import orderMgtApi from '@/api/orderMgt'
|
import returnInfo from '@/views/orderMgt/components/returnInfo.vue'
|
import createOrderDetails from '@/views/orderMgt/components/createOrderDetails.vue'
|
import createOrderDetailsProd from '@/views/orderMgt/components/createOrderDetailsProd.vue'
|
import uploadFileApi from '@/api/uploadFile'
|
|
export default {
|
props: ['orderId'],
|
components: {
|
orderDetailsComponents,
|
productDetailsComponents,
|
customerDetailsComponents,
|
orderFlowingComponent,
|
storeDeliveryComponent,
|
returnInfo,
|
createOrderDetails,
|
createOrderDetailsProd
|
},
|
data() {
|
return {
|
form: {
|
omsOrderDelivery: {}
|
},
|
orderDeliver: {
|
expressNoS: [],
|
companyName: null
|
},
|
showReturnInfo: false,
|
orderRow: null,
|
originalOrderAddressInfo: {},
|
featching: false
|
}
|
},
|
methods: {
|
// 刷新
|
refreshList() {
|
this.featching = true
|
setTimeout(() => {
|
this.featching = false;
|
this.getDetails();
|
}, 500);
|
},
|
/**
|
* 判断是否有菜单权限
|
*/
|
isMenuAuthority(routerName, row, menuName) {
|
const data = this.$store.state.userTree
|
let flag = false
|
data.forEach(item => {
|
if (item.children.length) {
|
for (const i of item.children) {
|
if (i.code === routerName) {
|
flag = true
|
return
|
}
|
}
|
}
|
})
|
if (flag) {
|
this.$router.push({
|
name: routerName,
|
query: {
|
orderId: row.orderId,
|
promotionStatus: row.promotionStatus
|
}
|
})
|
} else {
|
this.$message({
|
message: `当前暂无${menuName}权限`,
|
type: 'warning'
|
})
|
}
|
},
|
// 0元购订单
|
freeBuyProd(row) {
|
this.isMenuAuthority('createOrder', row, '手动建单')
|
},
|
// 手动推送
|
manualPush(row) {
|
this.$confirm('是否手动推送?', '手动推送', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(async() => {
|
try {
|
const res = await orderMgtApi.compensationPush({
|
orderId: row.orderId
|
})
|
if (res.code === '0') {
|
this.$message({
|
message: '推送成功',
|
type: 'success'
|
})
|
this.form.pushAnjiType = '1'
|
}
|
} catch (error) {
|
if (error.data.code && error.data.code === '500') {
|
let msgError = null
|
if (error.data.msg) {
|
const _msg = error.data.msg
|
msgError = _msg.replace('下单调用物流接口异常:', '')
|
}
|
this.tips(['推送到安吉失败!', `异常原因:${msgError}`], 'warning')
|
}
|
}
|
})
|
},
|
// 安吉推送提示
|
tips(confirmText, type) {
|
const newDatas = []
|
const h = this.$createElement
|
for (const i in confirmText) {
|
newDatas.push(h('p', null, confirmText[i]))
|
}
|
this.$confirm('提示', {
|
title: '提示',
|
message: h('div', null, newDatas),
|
cancelButtonText: '取消',
|
showConfirmButton: false,
|
type: type
|
})
|
},
|
// 跳转到积分手动建单
|
createIntegralOrder(row) {
|
this.isMenuAuthority('createIntegral', row, '创建积分订单')
|
},
|
// 打开退款订单
|
openReturnInfo(row) {
|
this.showReturnInfo = true
|
this.orderRow = row
|
},
|
goBack() {
|
// const name = this.$route.name === 'orderMgtInfo' ? 'orderMgtList' : 'distribution'
|
// this.$router.push({ name })
|
this.$router.go(-1)
|
},
|
/**
|
* 获取文件信息
|
*/
|
getFileInfo(businessId) {
|
this.$set(this.form, 'fileArr', [])
|
uploadFileApi.findFileInfoByBusinessId(businessId).then(res => {
|
if (res.code === '200') {
|
if (res.data) {
|
res.data.forEach(item => {
|
if (!item.isDelete) {
|
this.form.fileArr.push(item)
|
}
|
})
|
}
|
}
|
})
|
},
|
/**
|
* 获取详情
|
*/
|
getDetails() {
|
return new Promise(resolve => {
|
orderMgtApi.getOrderInfo({ orderId: this.$route.query.orderId }).then(res => {
|
if (res.data) {
|
if (res.data.omsOrderDelivery) {
|
const omsOrderDelivery = res.data.omsOrderDelivery
|
omsOrderDelivery.detail = omsOrderDelivery.fullAdd
|
this.originalOrderAddressInfo = JSON.parse(JSON.stringify(res.data.omsOrderDelivery))
|
}
|
this.form = JSON.parse(JSON.stringify(res.data))
|
if (this.form.omsOrderItems && this.form.omsOrderItems.length > 0) {
|
this.form.omsOrderItems.forEach((item) => {
|
this.getSpecificationCodeList(item)
|
const specificationCodeArr = []
|
const shipmentsCountArr = []
|
const logisticProdsArr = item.logisticProdsJson && item.logisticProdsJson !== '' ? JSON.parse(item.logisticProdsJson) : []
|
logisticProdsArr.forEach((v1) => {
|
specificationCodeArr.push(v1.skuId)
|
shipmentsCountArr.push({
|
shipmentsCount: v1.quantity,
|
skuId: v1.skuId
|
})
|
})
|
this.$set(item, 'specificationCode', specificationCodeArr)
|
this.$set(item, 'shipmentsCountList', shipmentsCountArr)
|
})
|
}
|
if (res.data.orderMerchantMemo) {
|
this.originalOrderAddressInfo.orderMerchantMemo = res.data.orderMerchantMemo
|
}
|
if (this.form.orderType === 'T04' && this.form.annexBizId) {
|
this.getFileInfo(this.form.annexBizId) // 手动建单附件信息
|
}
|
this.newForm = JSON.parse(JSON.stringify(this.form))
|
resolve(res.data)
|
}
|
})
|
})
|
},
|
/**
|
* 根据商品主编码获取所有的规格编码集合
|
*/
|
getSpecificationCodeList(row) {
|
orderMgtApi.getSpecificationCodeData({ prodNum: row.spuNum }).then((res) => {
|
let arr = []
|
if (res.code === '200' && res.data.length) {
|
arr = [...res.data]
|
}
|
this.$set(row, 'specificationCodeList', arr)
|
}).catch(() => {
|
this.$set(row, 'specificationCodeList', [])
|
})
|
},
|
/**
|
*获取订单物流信息
|
*/
|
getExpressByOrderId(p) {
|
if (!p.omsOrderDelivery.commonCarrier || p.omsOrderDelivery.commonCarrier === '3') {
|
return
|
}
|
if (p.orderSource === 'YDJS' && p.omsOrderDelivery.waybillId === '1') {
|
return
|
}
|
const expressByOrderBo = {}
|
expressByOrderBo.orderno = this.$route.query.orderId
|
expressByOrderBo.waybillno = p.omsOrderDelivery.waybillId
|
orderMgtApi.getExpressByOrderId(expressByOrderBo).then(res => {
|
if (res.data) {
|
this.orderDeliver.expressNoS = res.data
|
this.orderDeliver.companyName = p.omsOrderDelivery.modeOfDespatch
|
}
|
})
|
},
|
handleAdddressInfo(data) {
|
this.originalOrderAddressInfo = data
|
}
|
},
|
async created() {
|
await this.getDetails()
|
// await this.getExpressByOrderId(p)
|
}
|
}
|
</script>
|
<style lang="scss">
|
.orderMgtInfo {
|
padding: 10px;
|
.el-form-item__content {
|
color: #606266;
|
}
|
// 刷新旋转动画
|
@keyframes rotation{
|
from {transform: rotate(0deg);}
|
to {transform: rotate(360deg);}
|
}
|
.el-icon-refresh {
|
cursor: pointer;
|
float: right;
|
margin-top: 5px;
|
&:hover {
|
color: rgb(221, 46, 46);
|
font-weight: bolder;
|
}
|
&.loading {
|
animation: rotation 1s linear infinite;
|
}
|
}
|
}
|
.setButtonStyle {
|
position: relative;
|
.btnStyle {
|
position: absolute;
|
right: 50px;
|
}
|
}
|
.orderTitle {
|
font-size: 18px;
|
// font-weight: bold;
|
border-bottom: 1px solid #e5e5e5;
|
padding-bottom: 10px;
|
margin-bottom: 15px;
|
}
|
hr {
|
border: none;
|
height: 1px;
|
background-color: #e5e5e5;
|
}
|
.orderMgtInfoStyle {
|
.el-form-item__content {
|
color: #606266;
|
}
|
}
|
.form-button {
|
text-align: center;
|
padding: 15px 0;
|
.operationBtn {
|
margin-right: 10px;
|
}
|
}
|
.order_details_style {
|
.tipText {
|
text-align: center;
|
color: #d70012;
|
font-size: 12px;
|
margin-left: 20px;
|
font-weight: normal;
|
}
|
}
|
</style>
|