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

修复快速新建联系人,完善报价单

parent baadbbc5
......@@ -18,13 +18,13 @@
</el-select>
<el-button v-if="quickable" type="text" @click="showQuickCreate=true" class="ml-10">快速新建</el-button>
<quick-create v-if="showQuickCreate" @success="onQuickCreateSuccess" @close="showQuickCreate=false"></quick-create>
<!-- <quick-create v-if="showQuickCreate" @success="onQuickCreateSuccess" @close="showQuickCreate=false" :default="{type}"></quick-create> -->
</div>
</template>
<script>
import {getCustomerContactsSelect, getCustomerContactsListByCustomer} from '@/api/ecw/customerContacts'
import QuickCreate from '@/views/ecw/customer/components/quickCreate'
import Vue from 'vue'
export default {
components:{QuickCreate},
props:{
......@@ -32,7 +32,8 @@ export default {
quickable: {
type: Boolean,
default: true
}
},
type: [String, Number], // 客户类别,新建时指定默认类别,也可以根据需要筛选联系人所属的客户类别
},
data(){
return {
......@@ -50,6 +51,49 @@ export default {
},
value(val){
this.init()
},
showQuickCreate(){
if(!this.showQuickCreate)return
const QuickCreateComp = Vue.extend(QuickCreate)
const dialog = new QuickCreateComp({
propsData:{
default: {type: this.type}
},
})
/* dialog.$on = () => {
return {
success: this.onQuickCreateSuccess,
close: () => {
console.log('关闭拉')
this.showQuickCreate = false
}
}
} */
dialog.$on('close', () => {
console.log('关闭拉')
this.showQuickCreate = false
document.body.removeChild(dialog.$el)
dialog.$destroy()
})
dialog.$on('success', (id) => {
this.onQuickCreateSuccess(id)
dialog.$emit('close')
})
dialog.$mount()
console.log({
dialog,
parent: this
})
window.dialogComp = dialog
document.body.append(dialog.$el)
/* dialog.remove = () => {
console.log('关闭拉11')
document.body.removeChild(dialog.$el)
} */
}
},
created(){
......
<template>
<el-dialog :visible.sync="show" title="快速新建客户" :close-on-click-modal="false" class="quick-create-customer">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px" :validate-on-rule-change="false">
<el-form-item label="客户类别" prop="type">
<dict-selector :type="DICT_TYPE.CUSTOMER_TYPE" form-type="checkbox" multiple v-model="form.type"></dict-selector>
</el-form-item>
......@@ -59,19 +59,9 @@ import { getCountryListAll } from '@/api/ecw/country'
export default {
name: "quickCreateCustomer",
props:{
default: Object
},
created() {
if(this.default){
this.$set(this, 'form', Object.assign({}, this.default, this.form))
}
listServiceUser().then(r => {
this.serviceUserList = r.data
})
getCountryListAll().then(r => {
this.countryList = r.data
})
default: Object,
},
data(){
return {
show: true,
......@@ -89,7 +79,7 @@ export default {
source: [{ required: true, message: "客户来源不能为空", trigger: "blur" }],
customerService: [{ required: true, message: "跟进客服不能为空", trigger: "blur" }],
status: [{ required: true, message: "客户状态不能为空", trigger: "blur" }],
founder: [{ required: true, message: "创建人不能为空", trigger: "blur" }],
founder: [{ required: true, message: "创建人不能为空", trigger: "blur" }],
},
serviceUserList: [],
countryList: [],
......@@ -102,6 +92,17 @@ export default {
}
}
},
created() {
if(this.default){
this.$set(this, 'form', Object.assign({}, this.default, this.form))
}
listServiceUser().then(r => {
this.serviceUserList = r.data
})
getCountryListAll().then(r => {
this.countryList = r.data
})
},
methods: {
open(){
this.show = true
......@@ -127,7 +128,7 @@ export default {
}
}
</script>
<style scoped lang="scss">
<style lang="scss">
.quick-create-customer .el-form-item{
margin-bottom: 22px;
}
......
......@@ -23,16 +23,16 @@
<customer-contact-selector v-model="form.consignorId" @change="consignor = $event" />
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="发货人" :labelStyle="labelStyle">
<!-- <el-descriptions-item label="发货人" :labelStyle="labelStyle">
{{consignor.contactsName || ''}}
</el-descriptions-item>
</el-descriptions-item> -->
<el-descriptions-item label="手机号" :labelStyle="labelStyle">
{{consignor.areaCode}} {{consignor.phoneNew || ''}}
</el-descriptions-item>
<el-descriptions-item label="发货人公司名称" :labelStyle="labelStyle">
{{consignor.company || ''}}
</el-descriptions-item>
<el-descriptions-item label="客户来源" :labelStyle="labelStyle">
<el-descriptions-item label="Email" :labelStyle="labelStyle">
{{consignor.email || ''}}
</el-descriptions-item><!--
<el-descriptions-item label="社交软件">
......@@ -49,9 +49,9 @@
<customer-contact-selector v-model="form.consigneeId" @change="consignee = $event" />
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="收货人" :labelStyle="labelStyle">
<!-- <el-descriptions-item label="收货人" :labelStyle="labelStyle">
{{consignee.contactsName || ''}}
</el-descriptions-item>
</el-descriptions-item> -->
<el-descriptions-item label="手机号" :labelStyle="labelStyle">
{{consignee.areaCode}} {{consignee.phoneNew}}
</el-descriptions-item>
......@@ -132,12 +132,12 @@
</el-table-column>
<el-table-column label="中文名" width="160px">
<template slot-scope="{row}">
<product-selector v-model="row.prodId" @change="row.goodsType = $event.typeId;calculationPrice()" />
<product-selector v-model="row.prodId" @change="onProductChange(row, $event)" />
</template>
</el-table-column>
<el-table-column label="英文名" width="160px">
<template slot-scope="{row}">
<product-selector v-model="row.prodId" @change="row.goodsType = $event.typeId;calculationPrice()" />
<product-selector v-model="row.prodId" @change="onProductChange(row, $event)" />
</template>
</el-table-column>
<el-table-column label="商品类型" width="160px">
......@@ -318,8 +318,8 @@
<div>{{fee.clearanceUSD || 0}}美元</div>
</el-descriptions-item>
<el-descriptions-item label="其他费用">
<el-input v-model="form.otherFee" placeholder="" style="width:100px"></el-input>
<selector v-model="form.otherFeeCurrencyId" :options="currencyList" label-field="titleZh" value-field="id" defaultable style="width:100px" />
<el-input v-model="form.otherFee" placeholder="" class="w-100 mr-10"></el-input>
<selector v-model="form.otherFeeCurrencyId" :options="currencyList" label-field="titleZh" value-field="id" defaultable class="w-100" />
</el-descriptions-item>
<el-descriptions-item label="原价" :span="2">
......@@ -331,24 +331,35 @@
</el-descriptions>
<div class="card-title" style="padding:20px 0;">优惠信息</div>
<!-- <el-row v-for="(item, index) in couponList" :key="item.value" :gutter="10">
<el-col :span="2">{{index+1}}.{{item.label}}</el-col>
<el-col :span="4">
<el-select placeholder="请选择优惠" v-model="selectedCoupons[item.value]" :data-type="item.value" clearable>
<template v-for="(coupon, index) in couponList">
<el-option v-if="coupon.type == +item.value" :key="coupon.couponId + '_' + index" :label="coupon.titleZh" :value="coupon.couponId"></el-option>
<div v-for="(item, index) in couponList" :key="index" style="display:flex;align-items:center">
<div class="w-150">
{{index+1}}.
{{productNames[item.prodId] || '未知'}}
</div>
<div class="w-100">
<dict-tag :type="DICT_TYPE.ECW_COUPON_TYPE" :value="item.type" />
</div>
<div style="display:flex; align-items:center">
<el-select placeholder="请选择优惠" v-model="item.selectedIndex" :data-type="item.value" clearable class="w-300">
<template v-for="(coupon, couponIndex) in item.options">
<el-option :key="coupon.couponId" :label="coupon.titleZh" :value="couponIndex"></el-option>
</template>
</el-select>
</el-col>
<el-col :span="2" v-if="getCoupon(selectedCoupons[item.value])">
-{{getCoupon(selectedCoupons[item.value]).reduceAmount}}
{{currentcyMap[getCoupon(selectedCoupons[item.value]).reduceCurrencyId]}}
</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>
<template v-if="item.selectedIndex !== null">
<div class="w-100 ml-20">
-{{item.options[item.selectedIndex].reduceAmount}}
{{currentcyMap[item.options[item.selectedIndex].reduceCurrencyId]}}
</div>
<div class="ml-20">有效期:{{item.options[item.selectedIndex].endTime || '永久有效'}}</div>
</template>
</div>
</div>
<el-descriptions :column="1" class="mt-20">
<el-descriptions-item label="优惠合计">
{{discount}}美元
<div v-for="(discount, discountIndex) in discountArr" :key="discountIndex">
{{discount.reduceAmount}} {{currentcyMap[discount.reduceCurrencyId]}}
</div>
</el-descriptions-item>
<el-descriptions-item label="预计费用">
// TODO
......@@ -473,6 +484,7 @@ import {getCurrencyList} from '@/api/ecw/currency'
import {getUnitList} from '@/api/ecw/unit'
import {calculationPrice} from '@/api/ecw/product'
import {getCustomerAvailableCouponList} from '@/api/ecw/coupon'
import {arrryToKeyedObjectBy} from '@/utils/index'
export default {
name: "OfferEdit",
......@@ -498,14 +510,13 @@ export default {
transportList: [],
currencyList:[],
unitList:[],
couponList: [],
couponList: [{"selectedIndex":null,"options":[{"couponId":74,"titleZh":"2-1,5-2","titleEn":"2-1,5-2","type":2,"cashCondition":0,"reduceAmount":3,"reduceCurrencyId":1,"startTime":"2022-01-01 00:00:00","afterReceiveDays":0,"costType":2,"discountDetailed":"[{\"type\": 1, \"fullAmount\": 2, \"reduceAmount\": 1, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}, {\"type\": 1, \"fullAmount\": 5, \"reduceAmount\": 2, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}, {\"type\": 2, \"fullAmount\": 2, \"reduceAmount\": 1, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}, {\"type\": 2, \"fullAmount\": 6, \"reduceAmount\": 3, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}]","discountDetailedVOList":[{"type":1,"fullAmount":2,"fullCurrencyId":1,"reduceAmount":1,"reduceCurrencyId":1},{"type":1,"fullAmount":5,"fullCurrencyId":1,"reduceAmount":2,"reduceCurrencyId":1},{"type":2,"fullAmount":2,"fullCurrencyId":1,"reduceAmount":1,"reduceCurrencyId":1},{"type":2,"fullAmount":6,"fullCurrencyId":1,"reduceAmount":3,"reduceCurrencyId":1}],"isSimilarSuperposition":false,"couponIds":"","suitableUserType":0,"suitableLineType":0,"suitableProdType":0,"limitNum":1,"overdueStatus":true,"putonStatus":1,"getWay":1,"orderAttr":"1,2,3","isSiteContent":false,"brand":"0,1","isCargoControl":"1,0","documentDeclaration":"1,2,3","status":1,"prodList":[],"isDefault":false},{"couponId":73,"titleZh":"3-2,2-1","titleEn":"3-2,2-1","type":2,"cashCondition":0,"reduceAmount":2,"reduceCurrencyId":1,"startTime":"2022-01-01 00:00:00","afterReceiveDays":0,"costType":1,"discountDetailed":"[{\"type\": 1, \"fullAmount\": 2, \"reduceAmount\": 1, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}, {\"type\": 1, \"fullAmount\": 3, \"reduceAmount\": 2, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}, {\"type\": 2, \"fullAmount\": 2, \"reduceAmount\": 1, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}, {\"type\": 2, \"fullAmount\": 3, \"reduceAmount\": 2, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}]","discountDetailedVOList":[{"type":1,"fullAmount":2,"fullCurrencyId":1,"reduceAmount":1,"reduceCurrencyId":1},{"type":1,"fullAmount":3,"fullCurrencyId":1,"reduceAmount":2,"reduceCurrencyId":1},{"type":2,"fullAmount":2,"fullCurrencyId":1,"reduceAmount":1,"reduceCurrencyId":1},{"type":2,"fullAmount":3,"fullCurrencyId":1,"reduceAmount":2,"reduceCurrencyId":1}],"isSimilarSuperposition":false,"couponIds":"","suitableUserType":0,"suitableLineType":0,"suitableProdType":0,"limitNum":1,"overdueStatus":true,"putonStatus":1,"getWay":1,"orderAttr":"1,2,3","isSiteContent":false,"brand":"0,1","isCargoControl":"0,1","documentDeclaration":"1,2,3","status":1,"prodList":[],"isDefault":false},{"couponId":71,"titleZh":"金额满2减1","titleEn":"金额满2减1","type":2,"cashCondition":0,"reduceAmount":5,"reduceCurrencyId":1,"startTime":"2022-01-01 00:00:00","afterReceiveDays":0,"costType":1,"discountDetailed":"[{\"type\": 1, \"fullAmount\": 2, \"reduceAmount\": 1, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}, {\"type\": 1, \"fullAmount\": 10, \"reduceAmount\": 5, \"fullCurrencyId\": 1, \"reduceCurrencyId\": 1}]","discountDetailedVOList":[{"type":1,"fullAmount":2,"fullCurrencyId":1,"reduceAmount":1,"reduceCurrencyId":1},{"type":1,"fullAmount":10,"fullCurrencyId":1,"reduceAmount":5,"reduceCurrencyId":1}],"isSimilarSuperposition":true,"couponIds":"","suitableUserType":0,"suitableLineType":0,"suitableProdType":0,"limitNum":1,"overdueStatus":true,"putonStatus":1,"getWay":1,"orderAttr":"1,2,3","isSiteContent":false,"brand":"0,1","isCargoControl":"1,0","documentDeclaration":"1,2,3","status":1,"prodList":[],"isDefault":false}],"prodId":22,"type":2}],
fee: {}, // 费用
// 表单参数
form: {
sendstatus:0,
type: [],
isCargoControl: false,
customsType: 0
},
// 表单校验
rules: {
......@@ -515,6 +526,7 @@ export default {
sendstatus: [{ required: true, message: "站内信状态,0未发送,1已发送不能为空", trigger: "blur" }], */
},
labelStyle: 'width:120px',
productNames: {} // 品名id和名称对应关系
};
},
computed:{
......@@ -585,8 +597,31 @@ export default {
},
// 总有优惠金额
discount(){
return 0
let discount = {
// curreny: amount
}
this.couponList.forEach(item => {
if(item.selectedIndex !== null){
let selected = item.options[item.selectedIndex]
if(!discount[selected.reduceCurrencyId]) discount[selected.reduceCurrencyId] = 0
discount[selected.reduceCurrencyId] += selected.reduceAmount
}
})
return discount
},
discountArr(){
let discount = []
for(let currency in this.discount){
discount.push({
reduceAmount: this.discount[currency],
reduceCurrencyId: currency
})
}
return discount
}
/* productKeyd(){
return arrryToKeyedObjectBy(this.productList, 'prodId')
} */
},
watch:{
// 始发地
......@@ -661,6 +696,12 @@ export default {
if(this.getDictData(this.DICT_TYPE.ECW_TRANSPORT_TYPE, val).cssClass != 'channel') row.channelId = null
this.updateEnabledTransports()
}, */
onProductChange(row, product){
row.goodsType = product.typeId;
// 保存商品id和品名,用于优惠信息显示
this.$set(this.productNames, product.id, product.titleZh)
this.calculationPrice()
},
onLineChange(row){
this.calculationPrice()
// this.updateEnabledTransports()
......@@ -767,7 +808,23 @@ export default {
})
getCustomerAvailableCouponList(data)
.then(res => {
this.couponList = res.data
// 对优惠信息按照商品 + 类型 分组展示
let list = {}
res.data.couponAvailableGroupDtoList.forEach(item => {
item.couponAvailableDtoList.forEach(coupon => {
let key = item.prodId + '_' + coupon.type
if(!list[key]){
list[key] = {
selectedIndex: null,
options: [],
prodId: item.prodId,
type: coupon.type
}
}
list[key].options.push(coupon)
})
})
this.couponList = Object.values(list)
})
},
// 显示更多报价
......
......@@ -154,7 +154,7 @@ export default {
return false
}
console.log('submit')
createPick(this.formData).then(res => {
createPick(Object.assign({orderId: this.orderId}, this.formData)).then(res => {
this.$message.success(res.msg || '操作成功')
this.closeDialog()
})
......
<!--拆单审核中的申请信息部分-->
<template>
<div>
<el-descriptions :column="4">
<el-descriptions-item label="订单号">kooriookami</el-descriptions-item>
<el-descriptions-item label="运输方式">18100000000</el-descriptions-item>
<el-descriptions-item label="出货方式">苏州市</el-descriptions-item>
<div v-if="detail">
<el-descriptions :column="4" v-if="order">
<el-descriptions-item label="订单号">{{order.orderNo}}</el-descriptions-item>
<el-descriptions-item label="运输方式">
<dict-tag class="mr-10" :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="order.transportId" />
</el-descriptions-item>
<el-descriptions-item label="出货方式">
{{channel ? channel.nameZh : ''}}
</el-descriptions-item>
<el-descriptions-item label="订单状态">
<el-tag size="small">学校</el-tag>
<el-tag size="small">
<dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="order.status" />
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="唛头">{{order.marks}}</el-descriptions-item>
<el-descriptions-item label="始发仓">
{{order.logisticsInfoDto.startTitleZh}}
</el-descriptions-item>
<el-descriptions-item label="目的仓">
{{order.logisticsInfoDto.destAddressZh}}
</el-descriptions-item>
<el-descriptions-item label="出货方式">苏州市</el-descriptions-item>
<el-descriptions-item label="唛头">苏州市</el-descriptions-item>
<el-descriptions-item label="目的仓">苏州市</el-descriptions-item>
</el-descriptions>
<template v-for="item in detail.orderSplitBackVOList">
<div class="title" :key="item.orderNo">
{{item.orderNo}}
<dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="item.transportId" />
</div>
<el-table :data="item.orderSplitItemBackVOList" :key="'items-' + item.orderNo">
<el-table-column label="序号">
<template slot-scope="scope">{{scope.$index+1}}</template>
</el-table-column>
<el-table-column label="中文品名">
<template slot-scope="{row}">{{row.prodTitleZh}}</template>
</el-table-column>
<el-table-column label="英文品名">
<template slot-scope="{row}">{{row.prodTitleEn}}</template>
</el-table-column>
<el-table-column label="品牌">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_IS_BRAND" :value="row.brandType" />
</template>
</el-table-column>
<el-table-column label="体积">
<template slot-scope="{row}">{{row.volume}}</template>
</el-table-column>
<el-table-column label="重量">
<template slot-scope="{row}">{{row.weight}}kg</template>
</el-table-column>
<el-table-column label="箱数">
<template slot-scope="{row}">{{row.num}}</template></el-table-column>
</el-table>
<div class="title mt-20" :key="item.orderNo">
<span class="mr-10">{{item.orderNo}}</span>
<dict-tag class="mr-10" :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="item.transportId" />
<span class="mr-10" v-if="item.channelName">{{item.channelName}}</span>
<span>发往{{item.dstWarehouseName}}</span>
</div>
<el-table :data="item.orderSplitItemBackVOList" :key="'items-' + item.orderNo">
<el-table-column label="序号">
<template slot-scope="scope">{{scope.$index+1}}</template>
</el-table-column>
<el-table-column label="中文品名">
<template slot-scope="{row}">{{row.prodTitleZh}}</template>
</el-table-column>
<el-table-column label="英文品名">
<template slot-scope="{row}">{{row.prodTitleEn}}</template>
</el-table-column>
<el-table-column label="品牌">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_IS_BRAND" :value="row.brandType" />
</template>
</el-table-column>
<el-table-column label="体积">
<template slot-scope="{row}">{{row.volume}}</template>
</el-table-column>
<el-table-column label="重量">
<template slot-scope="{row}">{{row.weight}}kg</template>
</el-table-column>
<el-table-column label="箱数">
<template slot-scope="{row}">{{row.num}}</template></el-table-column>
</el-table>
</template>
</div>
</template>
<script>
import {getApproval} from '@/api/ecw/order'
import {getApproval, getOrder} from '@/api/ecw/order'
import {getChannel} from '@/api/ecw/channel'
export default {
props:{
id: [String, Number]
},
data(){
return {
detail: null
detail: null,
order: null,
channel: null
}
},
watch:{
id(){
this.getData()
},
detail(){
this.getOrder()
},
order(){
if(this.order.channelId){
this.getChannel()
}
}
},
created(){
......@@ -72,7 +94,26 @@ export default {
getApproval(this.id).then(res => {
this.detail = JSON.parse(res.data.details)
})
},
getOrder(){
getOrder(this.detail.orderId).then(res => {
this.order = res.data
})
},
getChannel(){
getChannel(this.order.channelId).then(res => {
this.channel = res.data
})
}
}
}
</script>
\ No newline at end of file
</script>
<style scoped lang="scss">
.title{
padding: 10px 0;
span{
font-size: 14px;
font-weight: bold;
}
}
</style>
\ No newline at end of file
......@@ -15,7 +15,7 @@
<el-descriptions-item label="*发货人" :labelStyle="labelStyle">
<el-form-item label="" label-width="0" style="margin-bottom: 0" prop="consignorContactsId" required error="发货人不能为空">
<customer-contact-selector v-model="form.consignorContactsId" @change="consignorContact = $event" />
<customer-contact-selector v-model="form.consignorContactsId" @change="consignorContact = $event" type="1" />
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="电话" :labelStyle="labelStyle">
......@@ -31,7 +31,7 @@
<el-descriptions :column="3" border>
<el-descriptions-item label="*收货人" :labelStyle="labelStyle" >
<el-form-item label="" label-width="0" style="margin-bottom: 0" prop="consigneeContactsId" required error="收货人不能为空">
<customer-contact-selector v-model="form.consigneeContactsId" @change="consigneeContact = $event" />
<customer-contact-selector v-model="form.consigneeContactsId" @change="consigneeContact = $event" type="2" />
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="电话" :labelStyle="labelStyle">
......
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