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

订单优化

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