Commit b5aa9c18 authored by dragondean@qq.com's avatar dragondean@qq.com

订单优化

parent 08730cf0
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<el-option <el-option
v-for="(item, index) in list" v-for="(item, index) in list"
:key="item.id" :key="item.id"
:label="`${item.contactsName}(${item.customerName})`" :label="`${item.contactsName}`"
:value="index"> :value="index">
</el-option> </el-option>
</el-select> </el-select>
...@@ -50,7 +50,15 @@ export default { ...@@ -50,7 +50,15 @@ export default {
let index = this.list.findIndex(item => item.customerContactsId == this.value) let index = this.list.findIndex(item => item.customerContactsId == this.value)
if(index < 0){ if(index < 0){
getCustomerContacts(this.value).then(res => { getCustomerContacts(this.value).then(res => {
this.list.unshift(res.data) this.list.unshift({
contactsName: res.data.name,
customerName: res.data.customerName,
customerContactsId: res.data.id,
customerId: res.data.customerId,
phoneNew: res.data.phoneNew,
email: res.data.email
})
this.index = 0 this.index = 0
}) })
} }
......
...@@ -229,7 +229,8 @@ ...@@ -229,7 +229,8 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="submitForm">确 定</el-button> <el-button type="primary" @click="submitForm(0)">保 存</el-button>
<el-button type="primary" @click="submitForm(1)">发 布</el-button>
<el-button @click="$router.back()">返 回</el-button> <el-button @click="$router.back()">返 回</el-button>
<el-button type="default" @click="reset">重 置</el-button> <el-button type="default" @click="reset">重 置</el-button>
</el-form-item> </el-form-item>
...@@ -419,7 +420,7 @@ export default { ...@@ -419,7 +420,7 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm(status = 0) {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (!valid) { if (!valid) {
return; return;
...@@ -431,7 +432,7 @@ export default { ...@@ -431,7 +432,7 @@ export default {
// 开始时间必填 // 开始时间必填
if(!data.startTime)data.startTime = '2022-01-01 00:00:00' if(!data.startTime)data.startTime = '2022-01-01 00:00:00'
// status必填 // status必填
data.status = 0 data.status = status
data.couponIds = this.couponIds.join(',') data.couponIds = this.couponIds.join(',')
// 费用类型 1 运输费 2 清关费 3 总费用(优惠卷专用) // 费用类型 1 运输费 2 清关费 3 总费用(优惠卷专用)
......
<template> <template>
<div class="app-container"> <div class="app-container" v-if="order">
<el-card class="card"> <el-card class="card">
<div slot="header" class="card-title"> <div slot="header" class="card-title">
订单编号:{{order.orderNo}} 订单编号:{{order.orderNo}}
<template v-if="order.containerNumber">- {{order.containerNumber}}</template> <template v-if="order.containerNumber">- {{order.containerNumber}}</template>
</div> </div>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12" v-if="order.consignorVO">
<el-descriptions class="margin-top" border title="发货人" :column="1" labelStyle="width:150px"> <el-descriptions class="margin-top" border title="发货人" :column="1" :labelStyle="{width:'150px'}">
<el-descriptions-item label="发货人">{{order.consignorVO.name}}</el-descriptions-item> <el-descriptions-item label="发货人">{{order.consignorVO.name}}</el-descriptions-item>
<el-descriptions-item label="发货人电话">{{order.consignorVO.phone}}</el-descriptions-item> <el-descriptions-item label="发货人电话">{{order.consignorVO.phone}}</el-descriptions-item>
<el-descriptions-item label="发货人邮箱">{{order.consignorVO.email}}</el-descriptions-item> <el-descriptions-item label="发货人邮箱">{{order.consignorVO.email}}</el-descriptions-item>
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12" v-if="order.consigneeVO">
<el-descriptions class="margin-top" border title="收货人" :column="1" labelStyle="width:150px"> <el-descriptions class="margin-top" border title="收货人" :column="1" :labelStyle="{width:'150px'}">
<el-descriptions-item label="收货人">{{order.consigneeVO.name}}</el-descriptions-item> <el-descriptions-item label="收货人">{{order.consigneeVO.name}}</el-descriptions-item>
<el-descriptions-item label="收货人电话">{{order.consigneeVO.phone}}</el-descriptions-item> <el-descriptions-item label="收货人电话">{{order.consigneeVO.phone}}</el-descriptions-item>
<el-descriptions-item label="收货人邮箱">{{order.consigneeVO.email}}</el-descriptions-item> <el-descriptions-item label="收货人邮箱">{{order.consigneeVO.email}}</el-descriptions-item>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="订单动态" name="second"> <el-tab-pane label="订单动态" name="second">
<el-timeline v-if="order.orderTimeVOList && order.orderTimeVOList.length" :reverse="true"> <el-timeline v-if="order.orderTimeVOList && order.orderTimeVOList.length" :reverse="true">
<el-timeline-item v-for="(activity, index) in orderTimeVOList.orderTimeVOList" :key="index" :timestamp="activity.timestamp"> <el-timeline-item v-for="(activity, index) in order.orderTimeVOList" :key="index" :timestamp="activity.timestamp">
{{ activity.titleZh }} {{ activity.titleZh }}
</el-timeline-item> </el-timeline-item>
</el-timeline> </el-timeline>
...@@ -141,7 +141,7 @@ export default { ...@@ -141,7 +141,7 @@ export default {
return { return {
// 遮罩层 // 遮罩层
loading: false, loading: false,
order: {}, order: null,
activeName: 'first', activeName: 'first',
orderId: 17, orderId: 17,
tableData: [], tableData: [],
......
...@@ -246,21 +246,24 @@ ...@@ -246,21 +246,24 @@
</el-descriptions> </el-descriptions>
<div class="card-title" style="padding:20px 0;">优惠信息</div> <div class="card-title" style="padding:20px 0;">优惠信息</div>
<el-row v-for="(item, index) in getDictDatas(DICT_TYPE.ECW_COUPON_TYPE)" :key="item.value"> <el-row v-for="(item, index) in couponTypeList" :key="item.value">
<el-col :span="2">{{index+1}}.{{item.label}}</el-col> <el-col :span="2">{{index+1}}.{{item.label}}</el-col>
<el-col :span="4"> <el-col :span="4">
<!-- <el-select placeholder=""> <el-select placeholder="请选择优惠" v-model="selectedCoupons[item.value]" :data-type="item.value" clearable>
</el-select> --> <template v-for="coupon in couponList">
<el-option v-if="coupon.type == +item.value" :key="coupon.couponId" :label="coupon.titleZh" :value="coupon.couponId"></el-option>
</template>
</el-select>
</el-col> </el-col>
<el-col :span="2">-10美元</el-col> <el-col :span="2" v-if="getCoupon(selectedCoupons[item.value])"> -// TODO 美元</el-col>
<el-col :span="5">有效期:永久有效</el-col> <el-col :span="5" v-if="getCoupon(selectedCoupons[item.value])">有效期:{{getCoupon(selectedCoupons[item.value]).endTime || '永久有效'}}</el-col>
</el-row> </el-row>
<el-descriptions :column="1" border> <el-descriptions :column="1" border>
<el-descriptions-item label="优惠合计"> <el-descriptions-item label="优惠合计">
1233.1美元 {{discount}}美元
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="预计费用"> <el-descriptions-item label="预计费用">
// TODO
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
...@@ -372,7 +375,7 @@ ...@@ -372,7 +375,7 @@
</el-card> </el-card>
<el-form-item label=""> <el-form-item label="" style="margin: 30px 0">
<el-button type="primary" @click="submitForm(0)">保 存</el-button> <!--草稿--> <el-button type="primary" @click="submitForm(0)">保 存</el-button> <!--草稿-->
<el-button type="primary" @click="submitForm(2)">新建</el-button> <!--待入仓--> <el-button type="primary" @click="submitForm(2)">新建</el-button> <!--待入仓-->
<el-button @click="$router.back()">返回</el-button> <el-button @click="$router.back()">返回</el-button>
...@@ -382,7 +385,7 @@ ...@@ -382,7 +385,7 @@
</template> </template>
<script> <script>
import { createOrder, updateOrder, getOrder, getProductFeeList } from "@/api/ecw/order"; import { createOrder, updateOrder, getOrder, getProductFeeList, getOrderDetail } from "@/api/ecw/order";
import ProductSelector from '@/components/ProductSelector' import ProductSelector from '@/components/ProductSelector'
import {getProductAttrList} from '@/api/ecw/productAttr' import {getProductAttrList} from '@/api/ecw/productAttr'
import {getChannelList} from '@/api/ecw/channel' import {getChannelList} from '@/api/ecw/channel'
...@@ -421,12 +424,14 @@ export default { ...@@ -421,12 +424,14 @@ export default {
treeList: [], treeList: [],
consignorContact: {}, // 发货联系人 consignorContact: {}, // 发货联系人
consigneeContact:{}, // 收货联系人 consigneeContact:{}, // 收货联系人
consignee: null, /* consignee: null,
consignor: null, consignor: null, */
transportList: [], transportList: [],
currencyList:[], currencyList:[],
unitList:[], unitList:[],
couponList: [], couponList: [],
couponTypeList: [],
selectedCoupons: {},
fee: {}, // 费用 fee: {}, // 费用
// 表单参数 // 表单参数
form: { form: {
...@@ -472,6 +477,13 @@ export default { ...@@ -472,6 +477,13 @@ export default {
transport(){ transport(){
return this.transportList.find(item => item.value == this.form.transportId) return this.transportList.find(item => item.value == this.form.transportId)
}, },
// 根据id获取优惠券
getCoupon(){
return couponId => {
if(!couponId) return null
return this.couponList.find(item => item.couponId == couponId)
}
},
currentcyMap(){ currentcyMap(){
let map = {} let map = {}
this.currencyList.forEach(item => { this.currencyList.forEach(item => {
...@@ -501,6 +513,10 @@ export default { ...@@ -501,6 +513,10 @@ export default {
}) })
return sum return sum
},
// 总优惠金额
discount(){
return 0
} }
}, },
watch:{ watch:{
...@@ -515,14 +531,14 @@ export default { ...@@ -515,14 +531,14 @@ export default {
'form.transportId'(){ 'form.transportId'(){
this.getOpenedRouterList this.getOpenedRouterList
}, },
// 发货联系人发生变化获取发货客户 /* // 发货联系人发生变化获取发货客户
consignorContact(){ consignorContact(){
this.getConsignor() this.getConsignor()
}, },
// 收货联系人发生变化获取收货客户 // 收货联系人发生变化获取收货客户
consigneeContact(){ consigneeContact(){
this.getConsignee() this.getConsignee()
}, }, */
productList:{ productList:{
deep: true, deep: true,
handler(){ handler(){
...@@ -537,12 +553,20 @@ export default { ...@@ -537,12 +553,20 @@ export default {
} }
}, },
created() { created() {
this.couponTypeList = this.getDictDatas(this.DICT_TYPE.ECW_COUPON_TYPE)
this.couponTypeList.forEach(item => {
this.$set(this.selectedCoupons, item.value, null)
})
if(this.$route.query.id){ if(this.$route.query.id){
getOrder(this.$route.query.id).then(res => { getOrderDetail(this.$route.query.id).then(res => {
this.form = res.data this.form = res.data
this.form.consignorContactsId = res.data.consignorVO.customerContactsId /* this.form.consignorContactsId = res.data.consignorVO.customerContactsId
this.form.consigneeContactsId = res.data.consigneeVO.customerContactsId this.form.consigneeContactsId = res.data.consigneeVO.customerContactsId */
this.form.deliveryDate = res.data.consigneeVO.deliveryDate
this.form.orderItemVOList.forEach(item => {
item.prodAttrArr = item.prodAttrIds.split(',').filter(item => item != '')
this.addProduct(Object.assign({}, item))
})
}) })
}else this.addProduct() }else this.addProduct()
...@@ -562,7 +586,7 @@ export default { ...@@ -562,7 +586,7 @@ export default {
onAreaChange(type, val){ onAreaChange(type, val){
this.$set(this.form, type, val) this.$set(this.form, type, val)
}, },
// 获取发货人 /* // 获取发货人
getConsignor(){ getConsignor(){
if(!this.consignorContact){ if(!this.consignorContact){
this.consignor = null this.consignor = null
...@@ -579,7 +603,7 @@ export default { ...@@ -579,7 +603,7 @@ export default {
getCustomer(this.consigneeContact.customerId).then(res => { getCustomer(this.consigneeContact.customerId).then(res => {
this.consignee = res.data this.consignee = res.data
}) })
}, }, */
onProductAttrChange(row, attr){ onProductAttrChange(row, attr){
console.log(attr) console.log(attr)
this.calculationPrice(row) this.calculationPrice(row)
...@@ -680,12 +704,14 @@ export default { ...@@ -680,12 +704,14 @@ export default {
item.channelIds = Array.from(item.channelIdSet).join(',') item.channelIds = Array.from(item.channelIdSet).join(',')
} }
}) })
let coupons = Object.values(this.selectedCoupons).filter(item => !!item)
// 修改的提交 // 修改的提交
if (this.form.orderNo != null) { if (this.form.orderNo != null) {
let data = Object.assign({}, this.form, { let data = Object.assign({}, this.form, {
customDraweeVOList: this.customDraweeVOList, customDraweeVOList: this.customDraweeVOList,
// transportUpdateReqVOList: this.transportList.filter(item => item._enabled), // transportUpdateReqVOList: this.transportList.filter(item => item._enabled),
orderItemVOList: this.productList orderItemVOList: this.productList,
couponIds: coupons.join(",")
}) })
updateOrder(data).then(response => { updateOrder(data).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
...@@ -694,9 +720,10 @@ export default { ...@@ -694,9 +720,10 @@ export default {
return; return;
} }
let data = Object.assign({ let data = Object.assign({
consigneeId: this.consignee.id, consigneeId: this.consigneeContact.customerId,
consignorId: this.consignor.id, consignorId: this.consignorContact.customerId,
customerId: this.consignor.id, customerId : this.consignorContact.customerId,
couponIds: coupons.join(","),
status: type status: type
}, this.form, { }, this.form, {
customDraweeVOList: this.customDraweeVOList, customDraweeVOList: this.customDraweeVOList,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment