油批
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.

501 lines
15 KiB

2 years ago
<template>
<div class="order">
<div class="frame">
2 years ago
<el-input class="mr20" v-model="parameter.params.id" placeholder="订单编号" clearable></el-input>
2 years ago
<!-- 公司名称 -->
<autocomplete
class="mr20"
:params="parameter.params"
:config="configAutocomplete"
/>
<!-- <el-select style="margin-right: 20px;" v-model="parameter.params.id" placeholder="用户名称" clearable>
2 years ago
<el-option
v-for="item in refineryList"
:key="item.id"
:label="item.refineryName"
:value="item.id"
>
</el-option>
2 years ago
</el-select> -->
<!-- 炼厂名称 -->
<autocomplete
class="mr20"
:params="parameter.params"
:config="configAutocompleteLc"
/>
<!-- 产品名称 -->
2 years ago
<!-- <autocomplete
class="mr20"
:params="parameter.params"
:config="configAutocompleteCp"
2 years ago
/> -->
<!-- <el-select v-model="parameter.params.id" placeholder="产品名称" clearable>
2 years ago
<el-option
v-for="item in refineryList"
:key="item.id"
:label="item.refineryName"
:value="item.id"
>
</el-option>
</el-select> -->
2 years ago
<div class="buttons">
<el-button icon="el-icon-search" @click="handleCurrentChange(1)"
>查询</el-button
>
<el-button icon="el-icon-refresh" @click="reset">重置</el-button>
</div>
</div>
<div class="table">
<div class="operation">
<!-- <el-button icon="el-icon-upload2" @click="addition">炼厂入驻</el-button> -->
</div>
<el-table
v-if="tableHeight"
ref="multipleTable"
:height="tableHeight"
:data="tableData"
style="width: 100%"
>
2 years ago
<el-table-column
prop="id"
label="订单ID"
2 years ago
show-overflow-tooltip
2 years ago
minWidth="250"
2 years ago
>
2 years ago
</el-table-column>
<el-table-column label="购方客户信息" minWidth="250">
<template slot-scope="{ row }">
<p class="gray">
<span>{{ row.customerName }}</span>
</p>
<p class="gray">
<span>{{ row.customerId || "暂无" }}</span>
</p>
</template>
2 years ago
</el-table-column>
2 years ago
<el-table-column label="炼厂&产品" minWidth="250">
2 years ago
<template slot-scope="{ row }">
2 years ago
<p class="gray">
炼厂名称 <span>{{ row.refineryName }}</span>
</p>
<p class="gray">
产品名称 <span>{{ row.productName }}</span>
</p>
2 years ago
</template>
</el-table-column>
2 years ago
<el-table-column
prop="salePrice" label="价格" minWidth="90">
2 years ago
</el-table-column>
2 years ago
<el-table-column prop="payStatus" label="支付状态" minWidth="120" show-overflow-tooltip>
<template slot-scope="{ row }">
<el-tag :effect="payTagType(row.payStatus).effect" :type="payTagType(row.payStatus).type">{{ payTagType(row.payStatus).label }}</el-tag>
</template>
2 years ago
</el-table-column>
2 years ago
<el-table-column prop="orderStatus" label="订单状态" minWidth="120">
2 years ago
<template slot-scope="{ row }">
2 years ago
<el-tag :effect="orderTagType(row.orderStatus).effect" :type="orderTagType(row.orderStatus).type">{{ orderTagType(row.orderStatus).label }}</el-tag>
2 years ago
</template>
</el-table-column>
2 years ago
2 years ago
<el-table-column
prop="orderSerialNumber"
2 years ago
label="订单提货量(实际/预约)"
minWidth="180"
2 years ago
>
2 years ago
<template slot-scope="{ row }">
2 years ago
<span>{{ row.actQuantity|toNumberFixed }} / {{ row.preQuantity|toNumberFixed }} {{row.productMeasurement}}</span>
2 years ago
</template>
2 years ago
</el-table-column>
2 years ago
2 years ago
<el-table-column
prop="orderSerialNumber"
2 years ago
label="订单金额(实际/预约)"
minWidth="180"
2 years ago
>
2 years ago
<template slot-scope="{ row }">
2 years ago
<span>{{ row.actAmount|toNumberFixed}} / {{ row.preAmount|toNumberFixed }} </span>
2 years ago
</template>
2 years ago
</el-table-column>
2 years ago
<el-table-column label="时间" minWidth="235">
2 years ago
<template slot-scope="{ row }">
<p class="gray">
创建时间 <span>{{ row.createTime }}</span>
</p>
<p class="gray">
2 years ago
更新时间 <span>{{ row.updateTime || "暂无" }}</span>
2 years ago
</p>
</template>
</el-table-column>
2 years ago
<el-table-column prop="orderSerialNumber" fixed="right" label="操作" width="250">
2 years ago
<template slot-scope="{ row }">
<el-link type="primary" :underline="false" @click="detail(row)"
>详情</el-link
>
2 years ago
<el-link v-show="row.orderStatus!=='SUBMITED'&&row.orderStatus!=='ORDER_LOCKED'" type="primary" :underline="false" @click="billOfLading(row)"
2 years ago
>提货单</el-link
>
<el-popconfirm
2 years ago
:title="row.orderStatus=='SUBMITED'?'是否确认订单锁定?':'是否确认下单?'"
2 years ago
icon-color="red"
2 years ago
@confirm="Locked(row)"
2 years ago
>
2 years ago
<el-link v-show="row.orderStatus=='SUBMITED'||row.orderStatus=='ORDER_LOCKED'" slot="reference" type="primary" :underline="false"
>{{row.orderStatus=='SUBMITED'?'订单锁定':'下单确认'}}</el-link
>
</el-popconfirm>
<el-popconfirm
:title="row.orderStatus=='SUBMITED'||row.orderStatus=='ORDER_LOCKED'?'是否确认取消订单?':'是否确认退款?'"
icon-color="red"
@confirm="orderCencle(row)"
>
2 years ago
<el-link v-show="row.orderStatus!=='CANCELED'&&row.payStatus!=='REFUNDED'" slot="reference" type="primary" :underline="false"
2 years ago
>{{row.orderStatus=='SUBMITED'||row.orderStatus=='ORDER_LOCKED'?'订单取消':'订单退款'}}</el-link
2 years ago
>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="parameter.currentPage"
:page-size="parameter.pageSize"
:popper-append-to-body="false"
:page-sizes="[10, 20, 30, 50]"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</div>
<el-drawer
title="详情"
direction="ltr"
size="60%"
:withHeader="false"
:visible="controlWindows.detail"
>
<general-details
title="详情"
:isHeader="true"
v-if="controlWindows.detail"
:sourceData="oilCompanyMatch"
:mappingData="mappingData"
@close="controlWindows.detail = false"
>
</general-details>
</el-drawer>
2 years ago
<!-- 提货单 -->
<billOfLading :billData="billData" :controlWindows="controlWindows" @closeWindow="handleCurrentChange" />
2 years ago
</div>
</template>
2 years ago
<script>
2 years ago
import serve from "api/refineryInfo.js";
2 years ago
import commonServe from "api/common.js";
2 years ago
import productApi from "api/product.js";
2 years ago
import order from "api/order.js";
2 years ago
import generalDetails from "components/generalDetails/index.vue";
2 years ago
import autocomplete from "components/autocomplete/index.vue";
2 years ago
import billOfLading from "./components/billOfLading.vue";
2 years ago
export default {
2 years ago
filters:{
toNumberFixed(val){
if(val){
return Number(val).toFixed(2)
}else{return '--'}
}
},
2 years ago
data() {
return {
controlWindows: {
add: false,
addInfo: {
2 years ago
2 years ago
},
detail: false,
2 years ago
bill: false,
2 years ago
},
2 years ago
configAutocomplete: {
serveTarget: commonServe.getRefineryCompanyList,
autocompleteKey: "name",
labelKey: "name",
valueKey: "id",
placeholder: "企业名称",
querykey: "customerId",
},
configAutocompleteLc: {
serveTarget: serve.findByEntity,
autocompleteKey: "name",
labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称",
querykey: "refineryId",
},
configAutocompleteCp: {
2 years ago
serveTarget: productApi.getRefineryProductList,
autocompleteKey: "name",
labelKey: "refineryName",
valueKey: "id",
placeholder: "产品名称",
2 years ago
querykey: "productId",
},
2 years ago
refineryTypeEnum: [
{
label: "普通炼厂",
value: "COMMON",
},
],
refineryList: [],
tableHeight: 0,
tableData: [],
total: 0,
parameter: {
currentPage: 1,
pageSize: 10,
2 years ago
total: 0,
2 years ago
params: {},
},
oilCompanyMatch: {},
2 years ago
billData:[],
2 years ago
mappingData: [
{
carTitle: "",
carItems: [
2 years ago
{ label: "订单ID", value: "id" },
{ label: "炼厂ID", value: "refineryId" },
{ label: "支付状态", value: "payStatus" },
{ label: "订单状态", value: "orderStatus" },
{ label: "提货单数量", value: "deliveryCount" },
// { label: "创建用户ID", value: "createUser" },
// { label: "创建时间", value: "createTime" },
// { label: "修改用户ID", value: "updateUser" },
// { label: "修改时间", value: "updateTime" },
2 years ago
],
},
],
};
},
components: {
generalDetails,
2 years ago
billOfLading,
2 years ago
autocomplete,
productApi
2 years ago
},
mounted() {
this.$nextTick(() => {
this.heightHandle();
});
window.addEventListener(
"resize",
this.$utils.debounce(this.heightHandle, 500)
);
},
created() {
this.findByEntity();
this.getByPage();
},
methods: {
2 years ago
payTagType(val){
switch(val){
case 'PREPAID': return {label:'预支付',type:'info'}
case 'PAYING': return {label:'支付中',type:'warning'}
case 'SUCCESS': return {label:'支付成功',type:'success',effect:'dark'}
case 'FAILURE': return {label:'支付失败',type:'danger',effect:'dark'}
case 'CANCELED': return {label:'支付取消',type:'info'}
case 'REFUNDED': return {label:'退款成功',type:'danger',effect:'dark'}
case 'REFUNDING': return{label:'退款中',type:'warning'}
case 'REFUNDFAIL': return{label:'退款失败',type:'info',effect:'dark'}
}
return {label:val?val:'暂无数据',type:'info',effect:'plain'}
},
orderTagType(val){
switch(val){
case 'SUBMITED': return {label:'订单提交 ',type:'info'}
2 years ago
case 'ORDER_LOCKED': return {label:'订单锁定',type:'warning'}
2 years ago
case 'ORDER_SUCCESS': return {label:'下单成功',type:'success',effect:'dark'}
case 'DELIVERING': return {label:'提货中', type: ''}
case 'COMPLETE': return {label:'订单完成',type:'success',effect:'dark'}
case 'CANCELED': return {label:'订单取消',type:'info'}
}
return {label:val?val:'暂无数据',type:'info'}
},
2 years ago
// currentPage change
handleCurrentChange(page) {
this.parameter.currentPage = page;
this.getByPage();
},
// pageSize change
handleSizeChange(size) {
this.parameter.currentPage = 1;
this.parameter.pageSize = size;
this.getByPage();
},
//table list
getByPage() {
2 years ago
order.getByPage(this.parameter).then((res) => {
2 years ago
this.tableData = res.data.list;
2 years ago
this.total = res.data.totalCount;
2 years ago
});
},
//炼厂list
findByEntity() {
serve.findByEntity().then((res) => {
this.refineryList = res.data;
});
},
2 years ago
//下单取消
orderCencle(row){
if(row.orderStatus=='SUBMITED'||row.orderStatus=='ORDER_LOCKED'){
order.orderUpdate({id:row.id,orderStatus:'CANCELED'}).then((res) => {
2 years ago
if(res.code==20000){
this.getByPage()
}
});
}else{
order.orderRefund({id:row.id}).then((res) => {
if(res.code==20000){
this.getByPage()
}
});
2 years ago
}
},
2 years ago
//新增
addition() {
this.controlWindows.addInfo.title = "炼厂入驻";
this.controlWindows.add = true;
},
//提货单
2 years ago
async billOfLading(row){
this.controlWindows.addInfo.title = "";
await order.findDeliveryByOrderId(row.id).then((res) => {
this.billData.list = res.data
});
await order.findByOrderId(row.id).then((res) => {
this.billData.orderInfo = res.data
});
this.controlWindows.addInfo = row
this.controlWindows.bill = true
2 years ago
},
//详情
detail(row) {
2 years ago
this.oilCompanyMatch = [row];
2 years ago
this.controlWindows.detail = true;
},
2 years ago
//订单锁定
Locked(row) {
if(row.orderStatus=='SUBMITED'){
order.orderLock({id:row.id}).then((res) => {
if(res.code == 20000){
this.getByPage()
}
});
}else{
order.orderSuccess({id:row.id}).then((res) => {
if(res.code == 20000){
this.getByPage()
}
});
}
2 years ago
},
//启用禁用
switchTrigger(val, row) {
row.enableMark = row.enableMark;
serve
.update({
id: row.id,
enableMark: val,
})
.then((res) => {
if (res.code === 20000) {
this.getByPage();
} else this.$message.error(res.msg);
});
},
//重置
reset() {
this.parameter = {
currentPage: 1,
pageSize: 10,
2 years ago
total: 0,
2 years ago
params: {},
};
},
// table height
heightHandle() {
let bodyHeight = document.body.clientHeight;
let frameHeight = this.obtainElement(".frame").clientHeight;
let operationHeight = this.obtainElement(".operation").clientHeight;
let paginationHeight = this.obtainElement(".el-pagination").clientHeight;
this.tableHeight =
bodyHeight - frameHeight - operationHeight - paginationHeight - 145;
},
obtainElement(className) {
return document.documentElement.querySelector(className);
},
},
};
2 years ago
</script>
2 years ago
<style lang="scss" scoped>
.order {
.frame {
margin: 20px;
padding: 20px;
// width: 100%;
border-radius: 6px;
border: 1px solid #e3e3e5;
background: #fff;
.el-input,
.el-select {
width: 183px;
height: 40px;
}
.el-input + .el-input,
.el-input + .el-select,
.el-select + .el-select,
.el-select + .el-input {
margin-right: 20px;
margin-bottom: 15px;
}
.mr20 {
margin-right: 20px;
}
.buttons {
text-align: right;
}
}
.table {
overflow: hidden;
margin: 0 20px;
padding-bottom: 20px;
background: #fff;
border-radius: 6px;
border: 1px solid #e3e3e5;
> .operation {
box-sizing: content-box;
// padding: 15px;
}
.gray {
color: #999;
span {
color: #333;
}
}
.el-table {
margin-bottom: 20px;
border-radius: 10px 10px 0px 0px;
}
.el-link {
margin-right: 10px;
}
}
}
</style>