Merge branch 'master' into zyj
# Conflicts: # src/views/order/components/billOfLading.vue
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
"author": "Pan <panfree23@gmail.com>",
|
||||
"scripts": {
|
||||
"dev": "vue-cli-service serve",
|
||||
"build:prod": "vue-cli-service build"
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@amap/amap-jsapi-loader": "^1.0.1",
|
||||
|
||||
@@ -1,79 +1,79 @@
|
||||
import router from "./router";
|
||||
import store from "./store";
|
||||
import NProgress from "nprogress"; // progress bar
|
||||
import "nprogress/nprogress.css"; // progress bar style
|
||||
import getPageTitle from "@/utils/get-page-title";
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
import NProgress from 'nprogress' // progress bar
|
||||
import 'nprogress/nprogress.css' // progress bar style
|
||||
import getPageTitle from '@/utils/get-page-title'
|
||||
|
||||
import Layout from "@/layout";
|
||||
import Layout from '@/layout'
|
||||
|
||||
import serve from "api/login.js";
|
||||
import serve from 'api/login.js'
|
||||
|
||||
NProgress.configure({ showSpinner: false }); // NProgress Configuration
|
||||
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
||||
|
||||
const whiteList = ["/login"]; // no redirect whitelist
|
||||
const whiteList = ['/login'] // no redirect whitelist
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
NProgress.start();
|
||||
document.title = getPageTitle(to.meta.title);
|
||||
const hasToken = localStorage.getItem("businessToken");
|
||||
NProgress.start()
|
||||
document.title = getPageTitle(to.meta.title)
|
||||
const hasToken = localStorage.getItem('businessToken')
|
||||
if (hasToken) {
|
||||
if (to.path === "/login") {
|
||||
next({ path: "/" });
|
||||
NProgress.done();
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
NProgress.done()
|
||||
} else {
|
||||
const hasAuth = store.getters.auth && store.getters.auth.length;
|
||||
const hasAuth = store.getters.auth && store.getters.auth.length
|
||||
if (hasAuth) {
|
||||
next();
|
||||
next()
|
||||
} else {
|
||||
try {
|
||||
// let infoRes = await serve.getUserInfo();
|
||||
// infoRes.data.authList = [1];
|
||||
let infoRes = await serve.info();
|
||||
let infoRes = await serve.info()
|
||||
// infoRes.data.authList = infoRes.authList;
|
||||
|
||||
store.dispatch("user/info", infoRes.data);
|
||||
store.dispatch('user/info', infoRes.data)
|
||||
|
||||
let routerRes = await serve.getCustomerRouters();
|
||||
let realRouter = filterAsyncRouter(routerRes.data);
|
||||
store.dispatch("permission/generateRoutes", realRouter);
|
||||
router.addRoutes(realRouter);
|
||||
next({ ...to, replace: true });
|
||||
let routerRes = await serve.getCustomerRouters()
|
||||
let realRouter = filterAsyncRouter(routerRes.data)
|
||||
store.dispatch('permission/generateRoutes', realRouter)
|
||||
router.addRoutes(realRouter)
|
||||
next({ ...to, replace: true })
|
||||
} catch (err) {
|
||||
console.log("catch");
|
||||
next("/login");
|
||||
NProgress.done();
|
||||
console.log('catch')
|
||||
// next("/login");
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (whiteList.includes(to.path)) {
|
||||
next();
|
||||
next()
|
||||
} else {
|
||||
next("/login");
|
||||
NProgress.done();
|
||||
next('/login')
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
router.afterEach(() => {
|
||||
NProgress.done();
|
||||
});
|
||||
NProgress.done()
|
||||
})
|
||||
|
||||
function filterAsyncRouter(routers) {
|
||||
return routers.map((route) => {
|
||||
return routers.map(route => {
|
||||
if (route.component) {
|
||||
if (route.component === "Layout") {
|
||||
route.component = Layout;
|
||||
if (route.component === 'Layout') {
|
||||
route.component = Layout
|
||||
} else {
|
||||
route.component = lazyLoad(route.component);
|
||||
route.component = lazyLoad(route.component)
|
||||
}
|
||||
}
|
||||
if (route.children && route.children.length) {
|
||||
route.children = filterAsyncRouter(route.children);
|
||||
route.children = filterAsyncRouter(route.children)
|
||||
}
|
||||
return route;
|
||||
});
|
||||
return route
|
||||
})
|
||||
}
|
||||
function lazyLoad(path) {
|
||||
return (resolve) => require([`@/views/${path}`], resolve);
|
||||
return resolve => require([`@/views/${path}`], resolve)
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="订单状态">
|
||||
<el-tag effect="dark" :type="orderTagType(billData.orderInfo.orderStatus).orderType">
|
||||
{{ orderTagType(billData.orderInfo.orderStatus).orderLabel }}
|
||||
</el-tag>
|
||||
<el-tag effect="dark" :type="orderTagType(billData.orderInfo.orderStatus).orderType">{{
|
||||
orderTagType(billData.orderInfo.orderStatus).orderLabel
|
||||
}}</el-tag>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div>
|
||||
@@ -127,9 +127,8 @@
|
||||
:disabled="item.deliveryStatus !== 'PLATENUM_LOCKED' && item.deliveryStatus !== 'PLATENUM_SUCCESS'"
|
||||
@click="billSubmit(item, index)"
|
||||
:type="orderTagType(item.deliveryStatus).type1"
|
||||
>{{ orderTagType(item.deliveryStatus).info }}</el-button
|
||||
>
|
||||
{{ orderTagType(item.deliveryStatus).info }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -194,6 +193,7 @@
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogDelivery = false">取 消</el-button>
|
||||
|
||||
<el-button type="primary" @click="billdelivery()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
@@ -359,6 +359,20 @@ export default {
|
||||
created() {},
|
||||
methods: {
|
||||
billdelivery() {
|
||||
let percentage103 = (this.billAddData.preDeliveryQuantity * 10000 * 1.03) / 10000
|
||||
if (this.deliveryQuantity > percentage103) {
|
||||
this.$confirm('实际提货量超出预约提货量103%, 是否确认?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.realBilldelivery()
|
||||
})
|
||||
return
|
||||
}
|
||||
this.realBilldelivery()
|
||||
},
|
||||
realBilldelivery() {
|
||||
this.billAddData.deliveryStatus = 'COMPLETE'
|
||||
this.billAddData.accDeliveryQuantity = this.deliveryQuantity
|
||||
order.update(this.billAddData).then(res => {
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
</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.salePrice }} 元/{{ controlWindows.addInfo.productMeasurement }}</el-descriptions-item
|
||||
>
|
||||
<el-descriptions-item label="订单提货量">
|
||||
{{ controlWindows.addInfo.preQuantity | toNumberFixed }}
|
||||
{{ controlWindows.addInfo.productMeasurement }}
|
||||
@@ -44,27 +46,38 @@
|
||||
<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">
|
||||
<el-table :data="tableData" border style="width: 75%">
|
||||
<el-table-column prop="date" label="" width="55px">
|
||||
<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.preQuantity | toNumberFixed }}{{ controlWindows.addInfo.productMeasurement }} </template>
|
||||
<el-table-column label="订单提货量" width="145px">
|
||||
<template slot-scope="{ row }">
|
||||
<el-input
|
||||
v-checkNum
|
||||
v-if="row.type === '自定义提货量'"
|
||||
v-model="row.preQuantity"
|
||||
placeholder="提货数量"
|
||||
@change="val => changePreQuantity(row, val)"
|
||||
>
|
||||
<template slot="append">{{ controlWindows.addInfo.productMeasurement }}</template>
|
||||
</el-input>
|
||||
<p v-else>{{ row.preQuantity }}{{ controlWindows.addInfo.productMeasurement }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销售价格">
|
||||
<template slot-scope="{ row }"> {{ row.salePrice }}元 </template>
|
||||
<template slot-scope="{ row }"> {{ row.salePrice }} 元/{{ controlWindows.addInfo.productMeasurement }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销售总金额">
|
||||
<template slot-scope="{ row }"> {{ row.preAmount | toNumberFixed }}元 </template>
|
||||
<template slot-scope="{ row }"> {{ row.preAmount }} 元 </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成本价格">
|
||||
<template slot-scope="{ row }"> {{ row.floorPrice }}元 </template>
|
||||
<template slot-scope="{ row }"> {{ row.floorPrice }} 元/{{ controlWindows.addInfo.productMeasurement }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成本总金额">
|
||||
<template slot-scope="{ row }"> {{ row.floorPrice * row.preQuantity | toNumberFixed }}元 </template>
|
||||
<template slot-scope="{ row }"> {{ row.preCostAmount }} 元 </template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
@@ -84,30 +97,37 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
newCostPrice: '',
|
||||
newSalePrice: '',
|
||||
// newCostPrice: '',
|
||||
// newSalePrice: '',
|
||||
undergoChanges: false,
|
||||
tableData: [
|
||||
{
|
||||
isChecked: false,
|
||||
type: '原策略',
|
||||
salePrice: 100,
|
||||
preQuantity: 100,
|
||||
preAmount: 10000
|
||||
salePrice: '',
|
||||
preQuantity: '',
|
||||
preAmount: ''
|
||||
},
|
||||
{
|
||||
isChecked: false,
|
||||
type: '以提货量为准',
|
||||
salePrice: 100,
|
||||
preQuantity: 100,
|
||||
preAmount: 10000
|
||||
salePrice: '',
|
||||
preQuantity: '',
|
||||
preAmount: ''
|
||||
},
|
||||
// {
|
||||
// isChecked: false,
|
||||
// type: '以订单金额为准',
|
||||
// salePrice: '',
|
||||
// preQuantity: '',
|
||||
// preAmount: ''
|
||||
// },
|
||||
{
|
||||
isChecked: false,
|
||||
type: '以订单金额为准',
|
||||
salePrice: 100,
|
||||
preQuantity: 100,
|
||||
preAmount: 10000
|
||||
type: '自定义提货量',
|
||||
salePrice: '',
|
||||
preQuantity: '',
|
||||
preAmount: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -117,7 +137,7 @@ export default {
|
||||
if (val) {
|
||||
return Number(val).toFixed(2)
|
||||
} else {
|
||||
return '--'
|
||||
return '- -'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -126,17 +146,25 @@ export default {
|
||||
let { productId, salePrice, floorPrice } = this.controlWindows.addInfo
|
||||
if (productId) {
|
||||
serve.getRefineryProduct(productId).then(res => {
|
||||
let data = res.data;
|
||||
let data = res.data
|
||||
if (data.salePrice2company != salePrice || data.floorPrice != floorPrice) {
|
||||
console.log('价格发生变化了捏')
|
||||
// 新的价格
|
||||
this.newSalePrice = data.salePrice2company
|
||||
this.newCostPrice = data.floorPrice
|
||||
this.policyPopulation()
|
||||
} else console.log('芜湖 没变')
|
||||
this.policyPopulation(data.salePrice2company, data.floorPrice)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
changePreQuantity(row, val) {
|
||||
let segment = val.match(/.?\d{0,2}/g)
|
||||
let realPrice = parseFloat(segment[0] + segment[1])
|
||||
if (isNaN(realPrice)) {
|
||||
this.$message.error('数量输入错误,请重新输入')
|
||||
return
|
||||
}
|
||||
let { salePrice, floorPrice } = row
|
||||
row.preQuantity = realPrice
|
||||
row.preAmount = this.fixedHandle(salePrice * realPrice)
|
||||
row.preCostAmount = this.fixedHandle(floorPrice * realPrice)
|
||||
},
|
||||
selectPolicy(index, val) {
|
||||
if (val) {
|
||||
this.tableData.map(item => (item.isChecked = false))
|
||||
@@ -144,32 +172,78 @@ export default {
|
||||
}
|
||||
},
|
||||
// 策略选择
|
||||
policyPopulation() {
|
||||
policyPopulation(newSalePrice, newCostPrice) {
|
||||
let { salePrice, floorPrice, preQuantity, preAmount } = this.controlWindows.addInfo
|
||||
// console.log(salePrice, preQuantity, preAmount)
|
||||
if ((salePrice, preQuantity, preAmount)) {
|
||||
if (salePrice && floorPrice && preQuantity && preAmount) {
|
||||
let strategyArr = [
|
||||
// 原策略
|
||||
Object.assign(this.tableData[0], { salePrice: salePrice.toFixed(2),
|
||||
floorPrice: floorPrice.toFixed(2),
|
||||
preQuantity: preQuantity.toFixed(2),
|
||||
preAmount: preAmount.toFixed(2) })
|
||||
() => {
|
||||
return { salePrice, floorPrice, preQuantity, preAmount, preCostAmount: floorPrice * preQuantity }
|
||||
},
|
||||
// 以提货量为准
|
||||
Object.assign(this.tableData[1], {
|
||||
salePrice: (this.newSalePrice).toFixed(2),
|
||||
floorPrice: (this.newCostPrice).toFixed(2),
|
||||
preQuantity: preQuantity.toFixed(2),
|
||||
preAmount: (+this.newSalePrice * +preQuantity).toFixed(2)
|
||||
})
|
||||
// 以订单金额为准
|
||||
Object.assign(this.tableData[2], {
|
||||
salePrice: (this.newSalePrice).toFixed(2),
|
||||
floorPrice: (this.newCostPrice).toFixed(2),
|
||||
preQuantity: (+preAmount / +this.newSalePrice).toFixed(2),
|
||||
preAmount: preAmount.toFixed(2)
|
||||
() => {
|
||||
let _salePrice = newSalePrice
|
||||
let _floorPrice = newCostPrice
|
||||
return {
|
||||
salePrice: _salePrice,
|
||||
floorPrice: _floorPrice,
|
||||
preQuantity,
|
||||
preAmount: _salePrice * preQuantity,
|
||||
preCostAmount: _floorPrice * preQuantity
|
||||
}
|
||||
},
|
||||
// // 以订单金额为准
|
||||
// () => {
|
||||
// let _salePrice = newSalePrice
|
||||
// let _floorPrice = newCostPrice
|
||||
// return {
|
||||
// salePrice: _salePrice,
|
||||
// floorPrice: _floorPrice,
|
||||
// preQuantity: preAmount / _salePrice,
|
||||
// preAmount,
|
||||
// preCostAmount: _floorPrice * this.fixedHandle(preAmount / _salePrice)
|
||||
// }
|
||||
// },
|
||||
// 自定义数量
|
||||
() => {
|
||||
return {
|
||||
salePrice: newSalePrice,
|
||||
floorPrice: newCostPrice,
|
||||
preQuantity: '',
|
||||
preAmount: '',
|
||||
preCostAmount: ''
|
||||
}
|
||||
}
|
||||
]
|
||||
strategyArr.forEach((item, index) => {
|
||||
let originData = this.tableData[index]
|
||||
let data = item()
|
||||
if (originData.type === '自定义提货量') {
|
||||
Object.assign(originData, data)
|
||||
return
|
||||
}
|
||||
for (let key in data) {
|
||||
data[key] = this.fixedHandle(data[key])
|
||||
}
|
||||
Object.assign(originData, data)
|
||||
})
|
||||
this.undergoChanges = true
|
||||
}
|
||||
},
|
||||
fixedHandle(val) {
|
||||
val = parseFloat(val)
|
||||
if (!isNaN(val)) {
|
||||
let fixedLength4 = val.toFixed(4)
|
||||
let length = fixedLength4.length
|
||||
let fixedLength3 = fixedLength4.slice(0, length - 1)
|
||||
fixedLength3 *= 100
|
||||
fixedLength3 = Math.round(fixedLength3)
|
||||
fixedLength3 /= 100
|
||||
let fixedLength2 = fixedLength3.toFixed(2)
|
||||
return fixedLength2
|
||||
}
|
||||
return 0
|
||||
},
|
||||
submit() {
|
||||
if (this.undergoChanges) {
|
||||
let targetPolicy = this.tableData.filter(item => item.isChecked)
|
||||
@@ -177,6 +251,11 @@ export default {
|
||||
this.$message.warning('炼厂单价发生变化,请选择变更策略')
|
||||
return
|
||||
}
|
||||
let target = targetPolicy[0]
|
||||
if (target.type === '自定义提货量' && target.preQuantity <= 0) {
|
||||
this.$message.warning('请输入提货数量')
|
||||
return
|
||||
}
|
||||
serve.orderSuccess({ id: this.controlWindows.addInfo.id, ...targetPolicy[0] }).then(res => {
|
||||
if (res.code == 20000) {
|
||||
this.$message.success(res.msg)
|
||||
@@ -207,11 +286,12 @@ export default {
|
||||
.el-drawer__header {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.el-input-group__append {
|
||||
padding: 0 7px;
|
||||
}
|
||||
}
|
||||
.confirm-submit {
|
||||
padding: 0 30px;
|
||||
.title {
|
||||
}
|
||||
> ul {
|
||||
display: flex;
|
||||
margin: 0 auto 30px;
|
||||
|
||||
@@ -116,6 +116,9 @@
|
||||
<el-link slot="reference" type="primary" :underline="false">订单锁定</el-link>
|
||||
</el-popconfirm>
|
||||
|
||||
<!-- <el-popconfirm v-if="row.orderStatus == 'ORDER_LOCKED'" title="是否确认下单?" icon-color="red" @confirm="confirmSubmit(row)">
|
||||
</el-popconfirm> -->
|
||||
|
||||
<el-link v-if="row.orderStatus == 'ORDER_LOCKED'" type="primary" :underline="false" @click="confirmSubmit(row)">下单确认</el-link>
|
||||
|
||||
<el-popconfirm
|
||||
@@ -395,6 +398,14 @@ export default {
|
||||
confirmSubmit(row) {
|
||||
this.controlWindows.addInfo = row
|
||||
this.controlWindows.confirmSubmit = true
|
||||
|
||||
// order.orderSuccess({ id: row.id }).then(res => {
|
||||
// if (res.code == 20000) {
|
||||
// this.$message.success(res.msg)
|
||||
// // this.closeWindow()
|
||||
// this.getByPage()
|
||||
// }
|
||||
// })
|
||||
},
|
||||
//启用禁用
|
||||
switchTrigger(val, row) {
|
||||
|
||||
Reference in New Issue
Block a user