xiaozy_0517
xiaozhiyong 2 years ago
parent 2a419dde26
commit dfc176c11c
  1. 89
      src/api/order.js
  2. 238
      src/views/order/components/confirmSubmit.vue
  3. 53
      src/views/order/index.vue

@ -1,56 +1,60 @@
import request from "utils/axios.js";
import request from 'utils/axios.js'
// table
const getByPage = (params) => {
return request.postJson("/oil-refinery/xoilRefineryOrder/getByPage", params);
};
const getByPage = params => {
return request.postJson('/oil-refinery/xoilRefineryOrder/getByPage', params)
}
//查看提货单信息
const findDeliveryByOrderId = (id) => {
return request.get(`/oil-refinery/xoilRefineryDelivery/findDeliveryByOrderId/${id}`);
};
const findDeliveryByOrderId = id => {
return request.get(`/oil-refinery/xoilRefineryDelivery/findDeliveryByOrderId/${id}`)
}
//创建提货单
const billSave = (params) => {
return request.postJson("/oil-refinery/xoilRefineryDelivery/save", params);
};
const billSave = params => {
return request.postJson('/oil-refinery/xoilRefineryDelivery/save', params)
}
//修改提货单
const update = (params) => {
return request.postPut("/oil-refinery/xoilRefineryDelivery/update", params);
};
const update = params => {
return request.postPut('/oil-refinery/xoilRefineryDelivery/update', params)
}
//修改提货单
const orderUpdate = (params) => {
return request.postPut("/oil-refinery/xoilRefineryOrder/update", params);
};
const orderUpdate = params => {
return request.postPut('/oil-refinery/xoilRefineryOrder/update', params)
}
//查看订单信息
const findByOrderId = (id) => {
return request.get(`/oil-refinery/xoilRefineryDelivery/findByOrderId/${id}`);
};
const findByOrderId = id => {
return request.get(`/oil-refinery/xoilRefineryDelivery/findByOrderId/${id}`)
}
//修改提货单
const deleteBill = (params) => {
return request.postPut("/oil-refinery/xoilRefineryDelivery/delete", params);
};
const deleteBill = params => {
return request.postPut('/oil-refinery/xoilRefineryDelivery/delete', params)
}
//下单
const orderSuccess = (params) => {
return request.postJson("/oil-refinery/xoilRefineryOrder/orderSuccess", params);
};
const orderSuccess = params => {
return request.postJson('/oil-refinery/xoilRefineryOrder/orderSuccess', params)
}
//订单锁定
const orderLock = (params) => {
return request.postJson("/oil-refinery/xoilRefineryOrder/orderLock", params);
};
const orderLock = params => {
return request.postJson('/oil-refinery/xoilRefineryOrder/orderLock', params)
}
//确认下单
const orderComplete = (params) => {
return request.postJson("/oil-refinery/xoilRefineryOrder/orderComplete", params);
};
const orderComplete = params => {
return request.postJson('/oil-refinery/xoilRefineryOrder/orderComplete', params)
}
//订单退款
const orderRefund = (params) => {
return request.postJson("/oil-refinery/xoilRefineryOrder/orderRefund", params);
};
const orderRefund = params => {
return request.postJson('/oil-refinery/xoilRefineryOrder/orderRefund', params)
}
//油批中心信息
const getlnfoByld = (params) => {
return request.postJson("/oil-refinery/xoilRefineryCenterAccount/getInfoById", params);
};
const getlnfoByld = params => {
return request.postJson('/oil-refinery/xoilRefineryCenterAccount/getInfoById', params)
}
//油批中心列表
const getRecordsByActld = (params) => {
return request.postJson("/oil-refinery/xoilRefineryCenterAccount/getRecordsByActId", params);
};
const getRecordsByActld = params => {
return request.postJson('/oil-refinery/xoilRefineryCenterAccount/getRecordsByActId', params)
}
// 炼厂产品详情接口 用于查询产品单价是否发生变更
const getRefineryProduct = id => {
return request.get(`oil-refinery/oilRefineryProduct/get/${id}`)
}
export default {
getByPage,
@ -65,5 +69,6 @@ export default {
orderRefund,
orderUpdate,
getlnfoByld,
getRecordsByActld
};
getRecordsByActld,
getRefineryProduct
}

@ -0,0 +1,238 @@
<template>
<el-drawer
title="确认下单"
direction="ltr"
size="60%"
:visible.sync="controlWindows.confirmSubmit"
:before-close="closeWindow"
@opened="openDrawer"
>
<el-divider></el-divider>
<div class="confirm-submit">
<h4 class="title">当前订单信息</h4>
<el-divider></el-divider>
<ul>
<li>
<p>购方客户信息</p>
<p>{{ controlWindows.addInfo.customerName }}</p>
</li>
<li>
<p>炼厂</p>
<p>{{ controlWindows.addInfo.refineryName }}</p>
</li>
<li>
<p>产品</p>
<p>{{ controlWindows.addInfo.productName }}</p>
</li>
<li>
<p>创建时间</p>
<p>{{ controlWindows.addInfo.createTime }}</p>
</li>
</ul>
<el-descriptions style="width: 50%; margin: 0 auto" direction="vertical" :column="3" border>
<el-descriptions-item label="价格">{{ controlWindows.addInfo.salePrice }}</el-descriptions-item>
<el-descriptions-item label="订单提货量">
{{ controlWindows.addInfo.preQuantity | toNumberFixed }}
{{ controlWindows.addInfo.productMeasurement }}
</el-descriptions-item>
<el-descriptions-item label="订单金额">
{{ controlWindows.addInfo.preAmount | toNumberFixed }}
</el-descriptions-item>
</el-descriptions>
<template v-if="undergoChanges">
<h4 class="title">订单变更信息</h4>
<el-divider></el-divider>
<p class="tip">因炼厂单价发生变化请重新选择策略</p>
<el-table :data="tableData" border style="width: 70%">
<el-table-column prop="date" label="" width="70px">
<template slot-scope="{ $index, row }">
<el-checkbox v-model="row.isChecked" @change="val => selectPolicy($index, val)"></el-checkbox>
</template>
</el-table-column>
<el-table-column prop="type" label="策略类型"> </el-table-column>
<el-table-column label="价格">
<template slot-scope="{ row }"> {{ row.salePrice }} </template>
</el-table-column>
<el-table-column label="订单提货量">
<template slot-scope="{ row }"> {{ row.preQuantity | toNumberFixed }}{{ controlWindows.addInfo.productMeasurement }} </template>
</el-table-column>
<el-table-column label="订单金额">
<template slot-scope="{ row }"> {{ row.preAmount | toNumberFixed }} </template>
</el-table-column>
</el-table>
</template>
</div>
<div class="footer-buttons">
<el-button @click="closeWindow">关闭 </el-button>
<el-button @click="submit">审核 </el-button>
</div>
</el-drawer>
</template>
<script>
import serve from '@/api/order.js'
export default {
props: {
controlWindows: Object
},
data() {
return {
newSalePrice: '',
undergoChanges: false,
tableData: [
{
isChecked: false,
type: '原策略',
salePrice: 100,
preQuantity: 100,
preAmount: 10000
},
{
isChecked: false,
type: '以提货量为准',
salePrice: 100,
preQuantity: 100,
preAmount: 10000
},
{
isChecked: false,
type: '以订单金额为准',
salePrice: 100,
preQuantity: 100,
preAmount: 10000
}
]
}
},
filters: {
toNumberFixed(val) {
if (val) {
return Number(val).toFixed(2)
} else {
return '--'
}
}
},
methods: {
openDrawer() {
let { productId, salePrice } = this.controlWindows.addInfo
if (productId) {
serve.getRefineryProduct(productId).then(res => {
let { salePrice2company } = res.data
if (salePrice2company != salePrice) {
console.log('价格发生变化了捏')
//
this.newSalePrice = salePrice2company
this.policyPopulation()
} else console.log('芜湖 没变')
})
}
},
selectPolicy(index, val) {
if (val) {
this.tableData.map(item => (item.isChecked = false))
this.tableData[index].isChecked = true
}
},
policyPopulation() {
let { salePrice, preQuantity, preAmount } = this.controlWindows.addInfo
console.log(salePrice, preQuantity, preAmount)
if ((salePrice, preQuantity, preAmount)) {
//
Object.assign(this.tableData[0], { salePrice, preQuantity, preAmount })
//
Object.assign(this.tableData[1], { salePrice: this.newSalePrice, preQuantity, preAmount: +this.newSalePrice * +preQuantity })
//
Object.assign(this.tableData[2], { salePrice: this.newSalePrice, preQuantity: +preAmount / +this.newSalePrice, preAmount })
this.undergoChanges = true
}
},
submit() {
if (this.undergoChanges) {
let targetPolicy = this.tableData.filter(item => item.isChecked)
if (!targetPolicy.length) {
this.$message.warning('炼厂单价发生变化,请选择变更策略')
return
}
serve.orderSuccess({ id: this.controlWindows.addInfo.id, ...targetPolicy[0] }).then(res => {
if (res.code == 20000) {
this.getByPage()
}
})
return
}
serve.orderSuccess({ id: this.controlWindows.addInfo.id }).then(res => {
if (res.code == 20000) {
this.getByPage()
}
})
},
closeWindow() {
console.log(1)
this.$emit('closeWindow')
this.undergoChanges = false
this.controlWindows.addInfo = {}
this.controlWindows.confirmSubmit = false
}
}
}
</script>
<style lang="scss" scoped>
::v-deep {
.el-drawer__header {
margin-bottom: 0;
}
}
.confirm-submit {
padding: 0 30px;
.title {
}
> ul {
display: flex;
margin: 0 auto 30px;
width: 80%;
li {
flex: 1;
// text-align: center;
p {
&:nth-of-type(1) {
color: #999;
}
&:nth-of-type(2) {
margin-top: 15px;
font-size: 14px;
}
}
}
}
.tip {
// margin-top: 11px;
margin-bottom: 24px;
font-size: 14px;
color: #3cb371;
text-align: center;
}
.el-table {
margin: 0 auto;
}
}
.footer-buttons {
position: absolute;
left: 0;
bottom: 0;
padding-right: 40px;
width: 100%;
height: 80px;
line-height: 80px;
text-align: right;
border-top: 1px solid #dcdfe6;
.el-button {
text-align: right;
font-size: 14px;
border-radius: 5px;
}
}
</style>

@ -112,15 +112,12 @@
@click="billOfLading(row)"
>提货单</el-link
>
<el-popconfirm :title="row.orderStatus == 'SUBMITED' ? '是否确认订单锁定?' : '是否确认下单?'" icon-color="red" @confirm="Locked(row)">
<el-link
v-show="row.orderStatus == 'SUBMITED' || row.orderStatus == 'ORDER_LOCKED'"
slot="reference"
type="primary"
:underline="false"
>{{ row.orderStatus == 'SUBMITED' ? '订单锁定' : '下单确认' }}</el-link
>
<el-popconfirm v-if="row.orderStatus == 'SUBMITED'" title="是否确认订单锁定?" icon-color="red" @confirm="Locked(row)">
<el-link slot="reference" type="primary" :underline="false">订单锁定</el-link>
</el-popconfirm>
<el-link v-else type="primary" :underline="false" @click="confirmSubmit(row)">下单确认</el-link>
<el-popconfirm
:title="row.orderStatus == 'SUBMITED' || row.orderStatus == 'ORDER_LOCKED' ? '是否确认取消订单?' : '是否确认退款?'"
icon-color="red"
@ -160,19 +157,28 @@
</el-drawer>
<!-- 提货单 -->
<billOfLading :billData="billData" :controlWindows="controlWindows" @closeWindow="handleCurrentChange" />
<confirmSubmit :controlWindows="controlWindows" @closeWindow="() => {}" />
</div>
</template>
<script>
import serve from 'api/refineryInfo.js'
import commonServe from 'api/common.js'
import commonServe from '@/api/common.js'
import productApi from 'api/product.js'
import order from 'api/order.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 confirmSubmit from './components/confirmSubmit.vue'
export default {
components: {
generalDetails,
autocomplete,
billOfLading,
confirmSubmit
},
filters: {
toNumberFixed(val) {
if (val) {
@ -188,7 +194,8 @@ export default {
add: false,
addInfo: {},
detail: false,
bill: false
bill: false,
confirmSubmit: false
},
configAutocomplete: {
serveTarget: commonServe.getRefineryCompanyList,
@ -250,12 +257,7 @@ export default {
]
}
},
components: {
generalDetails,
billOfLading,
autocomplete,
productApi
},
mounted() {
this.$nextTick(() => {
this.heightHandle()
@ -305,6 +307,7 @@ export default {
}
return { label: val ? val : '暂无数据', type: 'info' }
},
// currentPage change
handleCurrentChange(page) {
this.parameter.currentPage = page
@ -369,12 +372,13 @@ export default {
},
//
Locked(row) {
order.orderLock({ id: row.id }).then(res => {
if (res.code == 20000) {
this.getByPage()
}
})
return
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) {
@ -383,6 +387,11 @@ export default {
})
}
},
//
confirmSubmit(row) {
this.controlWindows.addInfo = row
this.controlWindows.confirmSubmit = true
},
//
switchTrigger(val, row) {
row.enableMark = row.enableMark

Loading…
Cancel
Save