xiaozy_0517
xiaozhiyong 2 years ago
parent ad818c11c8
commit 2a419dde26
  1. 431
      src/views/order/index.vue

@ -1,18 +1,9 @@
<template>
<div class="order">
<div class="frame">
<el-input
class="mr20"
v-model="parameter.params.id"
placeholder="订单编号"
clearable
></el-input>
<el-input class="mr20" v-model="parameter.params.id" placeholder="订单编号" clearable></el-input>
<!-- 公司名称 -->
<autocomplete
class="mr20"
:params="parameter.params"
:config="configAutocomplete"
/>
<autocomplete class="mr20" :params="parameter.params" :config="configAutocomplete" />
<!-- <el-select style="margin-right: 20px;" v-model="parameter.params.id" placeholder="用户名称" clearable>
<el-option
v-for="item in refineryList"
@ -23,11 +14,7 @@
</el-option>
</el-select> -->
<!-- 炼厂名称 -->
<autocomplete
class="mr20"
:params="parameter.params"
:config="configAutocompleteLc"
/>
<autocomplete class="mr20" :params="parameter.params" :config="configAutocompleteLc" />
<!-- 产品名称 -->
<!-- <autocomplete
class="mr20"
@ -44,9 +31,7 @@
</el-option>
</el-select> -->
<div class="buttons">
<el-button icon="el-icon-search" @click="handleCurrentChange(1)"
>查询</el-button
>
<el-button icon="el-icon-search" @click="handleCurrentChange(1)">查询</el-button>
<el-button icon="el-icon-refresh" @click="reset">重置</el-button>
</div>
</div>
@ -54,27 +39,15 @@
<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%"
>
<el-table-column
prop="id"
label="订单ID"
show-overflow-tooltip
minWidth="250"
>
</el-table-column>
<el-table v-if="tableHeight" ref="multipleTable" :height="tableHeight" :data="tableData" style="width: 100%">
<el-table-column prop="id" label="订单ID" show-overflow-tooltip minWidth="250"> </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>
<span>{{ row.customerId || '暂无' }}</span>
</p>
</template>
</el-table-column>
@ -89,38 +62,22 @@
</template>
</el-table-column>
<el-table-column prop="salePrice" label="价格" minWidth="90">
</el-table-column>
<el-table-column prop="salePrice" label="价格" minWidth="90"> </el-table-column>
<el-table-column
prop="payStatus"
label="支付状态"
minWidth="120"
show-overflow-tooltip
>
<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
>
<el-tag :effect="payTagType(row.payStatus).effect" :type="payTagType(row.payStatus).type">{{ payTagType(row.payStatus).label }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="orderStatus" label="订单状态" minWidth="120">
<template slot-scope="{ row }">
<el-tag
:effect="orderTagType(row.orderStatus).effect"
:type="orderTagType(row.orderStatus).type"
>{{ orderTagType(row.orderStatus).label }}</el-tag
>
<el-tag :effect="orderTagType(row.orderStatus).effect" :type="orderTagType(row.orderStatus).type">{{
orderTagType(row.orderStatus).label
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="orderSerialNumber"
label="订单提货量(实际/预约)"
minWidth="180"
>
<el-table-column prop="orderSerialNumber" label="订单提货量(实际/预约)" minWidth="180">
<template slot-scope="{ row }">
<span
>{{ row.actQuantity | toNumberFixed }} /
@ -130,16 +87,9 @@
</template>
</el-table-column>
<el-table-column
prop="orderSerialNumber"
label="订单金额(实际/预约)"
minWidth="180"
>
<el-table-column prop="orderSerialNumber" label="订单金额(实际/预约)" minWidth="180">
<template slot-scope="{ row }">
<span
>{{ row.actAmount | toNumberFixed }} /
{{ row.preAmount | toNumberFixed }} </span
>
<span>{{ row.actAmount | toNumberFixed }} / {{ row.preAmount | toNumberFixed }} </span>
</template>
</el-table-column>
<el-table-column label="时间" minWidth="235">
@ -148,76 +98,37 @@
创建时间 <span>{{ row.createTime }}</span>
</p>
<p class="gray">
更新时间 <span>{{ row.updateTime || "暂无" }}</span>
更新时间 <span>{{ row.updateTime || '暂无' }}</span>
</p>
</template>
</el-table-column>
<el-table-column
prop="orderSerialNumber"
fixed="right"
label="操作"
width="250"
>
<el-table-column prop="orderSerialNumber" fixed="right" label="操作" width="250">
<template slot-scope="{ row }">
<el-link type="primary" :underline="false" @click="detail(row)"
>详情</el-link
>
<el-link type="primary" :underline="false" @click="detail(row)">详情</el-link>
<el-link
v-show="
row.orderStatus !== 'SUBMITED' &&
row.orderStatus !== 'ORDER_LOCKED'
"
v-show="row.orderStatus !== 'SUBMITED' && row.orderStatus !== 'ORDER_LOCKED'"
type="primary"
:underline="false"
@click="billOfLading(row)"
>提货单</el-link
>
<el-popconfirm
:title="
row.orderStatus == 'SUBMITED'
? '是否确认订单锁定?'
: '是否确认下单?'
"
icon-color="red"
@confirm="Locked(row)"
>
<el-popconfirm :title="row.orderStatus == 'SUBMITED' ? '是否确认订单锁定?' : '是否确认下单?'" icon-color="red" @confirm="Locked(row)">
<el-link
v-show="
row.orderStatus == 'SUBMITED' ||
row.orderStatus == 'ORDER_LOCKED'
"
v-show="row.orderStatus == 'SUBMITED' || row.orderStatus == 'ORDER_LOCKED'"
slot="reference"
type="primary"
:underline="false"
>{{
row.orderStatus == "SUBMITED" ? "订单锁定" : "下单确认"
}}</el-link
>{{ row.orderStatus == 'SUBMITED' ? '订单锁定' : '下单确认' }}</el-link
>
</el-popconfirm>
<el-popconfirm
:title="
row.orderStatus == 'SUBMITED' ||
row.orderStatus == 'ORDER_LOCKED'
? '是否确认取消订单?'
: '是否确认退款?'
"
:title="row.orderStatus == 'SUBMITED' || row.orderStatus == 'ORDER_LOCKED' ? '是否确认取消订单?' : '是否确认退款?'"
icon-color="red"
@confirm="orderCencle(row)"
>
<el-link
v-show="
row.orderStatus !== 'CANCELED' && row.payStatus !== 'REFUNDED'
"
slot="reference"
type="primary"
:underline="false"
>{{
row.orderStatus == "SUBMITED" ||
row.orderStatus == "ORDER_LOCKED"
? "订单取消"
: "订单退款"
}}</el-link
>
<el-link v-show="row.orderStatus !== 'CANCELED' && row.payStatus !== 'REFUNDED'" slot="reference" type="primary" :underline="false">{{
row.orderStatus == 'SUBMITED' || row.orderStatus == 'ORDER_LOCKED' ? '订单取消' : '订单退款'
}}</el-link>
</el-popconfirm>
</template>
</el-table-column>
@ -236,13 +147,7 @@
</el-pagination>
</div>
<el-drawer
title="详情"
direction="ltr"
size="60%"
:withHeader="false"
:visible="controlWindows.detail"
>
<el-drawer title="详情" direction="ltr" size="60%" :withHeader="false" :visible="controlWindows.detail">
<general-details
title="详情"
:isHeader="true"
@ -254,32 +159,28 @@
</general-details>
</el-drawer>
<!-- 提货单 -->
<billOfLading
:billData="billData"
:controlWindows="controlWindows"
@closeWindow="handleCurrentChange"
/>
<billOfLading :billData="billData" :controlWindows="controlWindows" @closeWindow="handleCurrentChange" />
</div>
</template>
<script>
import serve from "api/refineryInfo.js";
import commonServe from "api/common.js";
import productApi from "api/product.js";
import order from "api/order.js";
import generalDetails from "components/generalDetails/index.vue";
import autocomplete from "components/autocomplete/index.vue";
import billOfLading from "./components/billOfLading.vue";
import serve from 'api/refineryInfo.js'
import commonServe from 'api/common.js'
import productApi from 'api/product.js'
import order from 'api/order.js'
import generalDetails from 'components/generalDetails/index.vue'
import autocomplete from 'components/autocomplete/index.vue'
import billOfLading from './components/billOfLading.vue'
export default {
filters: {
toNumberFixed(val) {
if (val) {
return Number(val).toFixed(2);
return Number(val).toFixed(2)
} else {
return "--";
return '--'
}
},
}
},
data() {
return {
@ -287,37 +188,37 @@ export default {
add: false,
addInfo: {},
detail: false,
bill: false,
bill: false
},
configAutocomplete: {
serveTarget: commonServe.getRefineryCompanyList,
autocompleteKey: "name",
labelKey: "name",
valueKey: "id",
placeholder: "企业名称",
querykey: "customerId",
autocompleteKey: 'name',
labelKey: 'name',
valueKey: 'id',
placeholder: '企业名称',
querykey: 'customerId'
},
configAutocompleteLc: {
serveTarget: serve.findByEntity,
autocompleteKey: "refineryName",
labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称",
querykey: "refineryId",
autocompleteKey: 'refineryName',
labelKey: 'refineryName',
valueKey: 'id',
placeholder: '炼厂名称',
querykey: 'refineryId'
},
configAutocompleteCp: {
serveTarget: productApi.getRefineryProductList,
autocompleteKey: "name",
labelKey: "refineryName",
valueKey: "id",
placeholder: "产品名称",
querykey: "productId",
autocompleteKey: 'name',
labelKey: 'refineryName',
valueKey: 'id',
placeholder: '产品名称',
querykey: 'productId'
},
refineryTypeEnum: [
{
label: "普通炼厂",
value: "COMMON",
},
label: '普通炼厂',
value: 'COMMON'
}
],
refineryList: [],
tableHeight: 0,
@ -327,179 +228,174 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
params: {},
params: {}
},
oilCompanyMatch: {},
billData: [],
mappingData: [
{
carTitle: "",
carTitle: '',
carItems: [
{ label: "订单ID", value: "id" },
{ label: "炼厂ID", value: "refineryId" },
{ label: "支付状态", value: "payStatus" },
{ label: "订单状态", value: "orderStatus" },
{ label: "提货单数量", value: "deliveryCount" },
{ 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" },
],
},
],
};
]
}
]
}
},
components: {
generalDetails,
billOfLading,
autocomplete,
productApi,
productApi
},
mounted() {
this.$nextTick(() => {
this.heightHandle();
});
window.addEventListener(
"resize",
this.$utils.debounce(this.heightHandle, 500)
);
this.heightHandle()
})
window.addEventListener('resize', this.$utils.debounce(this.heightHandle, 500))
},
created() {
this.findByEntity();
this.getByPage();
this.findByEntity()
this.getByPage()
},
methods: {
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" };
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" };
return { label: val ? val : '暂无数据', type: 'info', effect: 'plain' }
},
orderTagType(val) {
switch (val) {
case "SUBMITED":
return { label: "订单提交 ", type: "info" };
case "ORDER_LOCKED":
return { label: "订单锁定", type: "warning" };
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" };
case 'SUBMITED':
return { label: '订单提交 ', type: 'info' }
case 'ORDER_LOCKED':
return { label: '订单锁定', type: 'warning' }
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" };
return { label: val ? val : '暂无数据', type: 'info' }
},
// currentPage change
handleCurrentChange(page) {
this.parameter.currentPage = page;
this.getByPage();
this.parameter.currentPage = page
this.getByPage()
},
// pageSize change
handleSizeChange(size) {
this.parameter.currentPage = 1;
this.parameter.pageSize = size;
this.getByPage();
this.parameter.currentPage = 1
this.parameter.pageSize = size
this.getByPage()
},
//table list
getByPage() {
order.getByPage(this.parameter).then((res) => {
this.tableData = res.data.list;
this.total = res.data.totalCount;
});
order.getByPage(this.parameter).then(res => {
this.tableData = res.data.list
this.total = res.data.totalCount
})
},
//list
findByEntity() {
serve.findByEntity().then((res) => {
this.refineryList = res.data;
});
serve.findByEntity().then(res => {
this.refineryList = res.data
})
},
//
orderCencle(row) {
if (row.orderStatus == "SUBMITED" || row.orderStatus == "ORDER_LOCKED") {
order
.orderUpdate({ id: row.id, orderStatus: "CANCELED" })
.then((res) => {
if (res.code == 20000) {
this.getByPage();
}
});
if (row.orderStatus == 'SUBMITED' || row.orderStatus == 'ORDER_LOCKED') {
order.orderUpdate({ id: row.id, orderStatus: 'CANCELED' }).then(res => {
if (res.code == 20000) {
this.getByPage()
}
})
} else {
order.orderRefund({ id: row.id }).then((res) => {
order.orderRefund({ id: row.id }).then(res => {
if (res.code == 20000) {
this.getByPage();
this.getByPage()
}
});
})
}
},
//
addition() {
this.controlWindows.addInfo.title = "炼厂入驻";
this.controlWindows.add = true;
this.controlWindows.addInfo.title = '炼厂入驻'
this.controlWindows.add = true
},
//
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;
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
},
//
detail(row) {
this.oilCompanyMatch = [row];
this.controlWindows.detail = true;
this.oilCompanyMatch = [row]
this.controlWindows.detail = true
},
//
Locked(row) {
if (row.orderStatus == "SUBMITED") {
order.orderLock({ id: row.id }).then((res) => {
if (row.orderStatus == 'SUBMITED') {
order.orderLock({ id: row.id }).then(res => {
if (res.code == 20000) {
this.getByPage();
this.getByPage()
}
});
})
} else {
order.orderSuccess({ id: row.id }).then((res) => {
order.orderSuccess({ id: row.id }).then(res => {
if (res.code == 20000) {
this.getByPage();
this.getByPage()
}
});
})
}
},
//
switchTrigger(val, row) {
row.enableMark = row.enableMark;
row.enableMark = row.enableMark
serve
.update({
id: row.id,
enableMark: val,
enableMark: val
})
.then((res) => {
.then(res => {
if (res.code === 20000) {
this.getByPage();
} else this.$message.error(res.msg);
});
this.getByPage()
} else this.$message.error(res.msg)
})
},
//
reset() {
@ -507,23 +403,22 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
params: {},
};
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;
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);
},
},
};
return document.documentElement.querySelector(className)
}
}
}
</script>
<style lang="scss" scoped>

Loading…
Cancel
Save