Commit 0a9ddf39 authored by dragondean@qq.com's avatar dragondean@qq.com

优化报价单

parent e4061001
<template>
<div>
<div style="height:350px; overflow:hidden;">
<my-process-viewer
ref="processViewer"
:value="bpmnXML"
......@@ -7,8 +8,9 @@
:activityData="activityData"
:processInstanceData="processInstanceData"
:taskData="taskData"
style="height:500px; margin-bottom:10px"
style="height:500px; margin-top: -80px"
/>
</div>
<el-form label-position="left" label-width="100px">
<el-form-item label="抄送">
<el-select v-model="valueSync" multiple placeholder="请选择抄送人" style="width:100%">
......
......@@ -66,7 +66,7 @@
<el-descriptions :column="2" border>
<el-descriptions-item label="*运输方式">
<el-form-item label="" label-width="0" style="margin-bottom: 0" prop="transportId" required error="请选择运输方式">
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="form.transportId" />
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="form.transportId" @input="calculationPrice" />
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="出货渠道">
......@@ -77,6 +77,7 @@
:options="channelList"
value-field="channelId"
label-field="nameZh"
@input="calculationPrice"
></selector>
</el-form-item>
</el-descriptions-item>
......@@ -101,7 +102,7 @@
<el-input :value="getRouterNameById(form.lineId)" readonly placeholder="请在右侧选择线路"></el-input>
</el-col>
<el-col :span="12">
<select size="5" v-model="form.lineId" style="min-width: 300px">
<select size="5" v-model="form.lineId" style="min-width: 300px" @change="calculationPrice">
<template v-for="item in routerList">
<option :value="item.id" :key="item.id">{{item.startTitleZh}} >> {{item.destTitleZh}}</option>
</template>
......@@ -114,7 +115,7 @@
<el-card class="mt-10">
<div slot="header" class="card-title">
<div class="card-name">商品信息</div>
<el-button type="primary" size="mini" icon="el-icon-plus" @click="addProduct"></el-button>
<el-button type="primary" size="mini" icon="el-icon-plus" @click="addProduct()" :disabled="!form.lineId"></el-button>
</div>
<el-table :data="productList" border>
<el-table-column label="序号" width="60px" fixed>
......@@ -124,48 +125,53 @@
</el-table-column>
<el-table-column label="中文名" width="160px">
<template slot-scope="{row}">
<product-selector v-model="row.prodId" @change="row.goodsType = $event.typeId" />
<product-selector v-model="row.prodId" @change="row.goodsType = $event.typeId;calculationPrice()" />
</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" />
<product-selector v-model="row.prodId" @change="row.goodsType = $event.typeId;calculationPrice()" />
</template>
</el-table-column>
<el-table-column label="商品类型" width="160px">
<template slot-scope="{row}">
<selector disabled v-model="row.goodsType" :options="productAttrList" label-field="attrName" value-field="id"></selector>
<selector disabled v-model="row.goodsType" :options="productAttrList" label-field="attrName" value-field="id" @input="calculationPrice"></selector>
</template>
</el-table-column>
<el-table-column label="品牌" width="100px">
<template slot-scope="{row}">
<dict-selector v-model="row.brand" :type="DICT_TYPE.ECW_IS_BRAND" formatter="bool" defaultable @input="getProductFee(row)" />
<dict-selector v-model="row.brand" :type="DICT_TYPE.ECW_IS_BRAND" defaultable @input="calculationPrice" />
</template>
</el-table-column>
<el-table-column label="件数" width="90px">
<template slot-scope="{row}">
<el-input v-model.number="row.num" />
<el-input v-model.number="row.num" @input="calculationPrice" />
</template>
</el-table-column>
<el-table-column label="包装单位">
<template slot-scope="{row}">
<dict-selector v-model="row.unit" :type="DICT_TYPE.ECW_PACKAGE_TYPE" defaultable />
<dict-selector v-model="row.unit" :type="DICT_TYPE.ECW_PACKAGE_TYPE" defaultable @input="calculationPrice" />
</template>
</el-table-column>
<el-table-column label="数量">
<template slot-scope="{row}">
<el-input v-model.number="row.quantity" @input="calculationPrice" />
</template>
</el-table-column>
<el-table-column label="箱规(m)" width="120px">
<template slot-scope="{row}">
<el-input v-model="row.boxGauge" @input="calcVolume(row)" />
<el-input v-model="row.boxGauge" @input="calcVolume(row);calculationPrice()" />
</template>
</el-table-column>
<el-table-column label="总体积(m³)" width="100px">
<template slot-scope="{row}">
<el-input v-model="row.volume" />
<el-input v-model="row.volume" @input="calculationPrice"/>
</template>
</el-table-column>
<el-table-column label="总重量(kg)" width="100px">
<template slot-scope="{row}">
<el-input v-model="row.weight" />
<el-input v-model="row.weight" @input="calculationPrice" />
</template>
</el-table-column>
<el-table-column label="货值(RMB)" width="100px">
......@@ -220,6 +226,19 @@
</template>
</template>
</el-table-column>
<el-table-column label="是否预付">
<template slot-scope="{row}">
<dict-tag v-if="row.fee" :type="DICT_TYPE.ECW_PAY_ADVANCE" :value="row.fee.isPayAdvance" />
</template>
</el-table-column>
<el-table-column label="商品链接" width="200px" align="center">
<template slot-scope="{row}">
<el-link type="primary" :href="row.link" target="_blank" style="display:block">{{row.link}}</el-link>
<el-button type="primary" size="mini" @click="setLink(row)">
{{row.link ? '编辑商品链接' : '添加商品链接'}}
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="180px" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="danger" @click="delProduct(scope.$index)">删除</el-button>
......@@ -265,51 +284,7 @@
</el-descriptions-item> -->
</el-descriptions>
</el-card>
<template v-for="(item, index) in transportList" >
<el-card class="mt-10" :key="index" v-if="item._enabled" :data-enabled="item._enabled">
<div class="card-title" slot="header">{{item.label}}</div>
<el-form-item v-for="(router, routerIndex) in item.routers" :key="routerIndex" :label="item.label.substr(0, 2) + '线路' + (routerIndex + 1)">
<el-col :span="12">
{{getRouterNameById(router.lineId)}}
</el-col>
<el-col :span="12" v-if="router.channelId">
出货渠道{{routerIndex + 1}}: {{getChannelNameById(router.channelId)}}
</el-col>
</el-form-item>
<el-form-item label="是否双清" v-if="[2,3,4].indexOf(+item.transportId) > -1">
<dict-selector v-model="item.doubleClear" form-type="radio" :type="DICT_TYPE.ECW_DOUBLE_CLEAR" />
</el-form-item>
<el-form-item label="航空公司" v-if="[3,4].indexOf(+item.transportId) > -1">
<el-select placeholder="" v-model="item.airlineCompany">
</el-select>
</el-form-item>
<el-form-item label="船公司" v-if="[2].indexOf(+item.transportId) > -1">
<el-select placeholder="" v-model="item.airlineCompany">
</el-select>
</el-form-item>
<el-form-item label="清关证书" v-if="[2,3,4].indexOf(+item.transportId) > -1">
<dict-selector v-model="item.customsClearCert" form-type="radio" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool" />
</el-form-item>
<el-form-item label="清关证书备注" v-if="[2,3,4].indexOf(+item.transportId) > -1">
<el-input v-model="item.remarks" ></el-input>
</el-form-item>
<el-form-item label="是否拆包" v-if="[3,4].indexOf(+item.transportId) > -1">
<dict-selector v-model="item.isUnpack" form-type="radio" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool" />
</el-form-item>
<el-form-item label="单票立刻转运" v-if="[3,4].indexOf(+item.transportId) > -1">
<dict-selector v-model="item.isSingleTicketTransport" form-type="radio" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool" />
<span style="margin-left:10px">注:若只有一件,货到仓库立即发,选“是”,多件需仓库集运待发,选“否”</span>
</el-form-item>
<el-form-item label="包装类型" v-if="[3,4].indexOf(+item.transportId) > -1">
<dict-selector v-model="item.packageType" form-type="checkbox" :type="DICT_TYPE.ECW_PACKAGE_TYPE" multiple />
</el-form-item>
<el-form-item label="包装要求备注" v-if="[3,4].indexOf(+item.transportId) > -1">
<el-input v-model="item.packageRemarks" ></el-input>
</el-form-item>
</el-card>
</template>
<el-card class="mt-10">
<div class="card-title" slot="header">通用</div>
......@@ -363,6 +338,48 @@
</el-descriptions>
</el-card>
<el-card class="mt-10" v-if="transport">
<div class="card-title" slot="header">{{transport.label}}</div>
<el-form-item label="快递单号">
<el-input v-model="form.number" placeholder="请输入购买商品的快递单号"></el-input>
</el-form-item>
<el-form-item label="是否双清" v-if="[2,3,4].indexOf(+form.transportId) > -1">
<dict-selector v-model="form.doubleClear" form-type="radio" :type="DICT_TYPE.ECW_DOUBLE_CLEAR" />
</el-form-item>
<el-form-item label="航空公司" v-if="[3,4].indexOf(+form.transportId) > -1">
<!--待查询备选数据-->
<el-select placeholder="" v-model="form.airlineCompany">
</el-select>
</el-form-item>
<el-form-item label="船公司" v-if="[2].indexOf(+form.transportId) > -1">
<el-select placeholder="" v-model="form.shippingCompany">
</el-select>
</el-form-item>
<el-form-item label="清关证书" v-if="[2,3,4].indexOf(+form.transportId) > -1">
<dict-selector v-model="form.customsClearCert" form-type="radio" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool" />
</el-form-item>
<el-form-item label="清关证书备注" v-if="[2,3,4].indexOf(+form.transportId) > -1">
<el-input v-model="form.remarks" ></el-input>
</el-form-item>
<el-form-item label="是否拆包" v-if="[3,4].indexOf(+form.transportId) > -1">
<dict-selector v-model="form.isUnpack" form-type="radio" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool" />
</el-form-item>
<el-form-item label="单票立刻转运" v-if="[3,4].indexOf(+form.transportId) > -1">
<dict-selector v-model="form.isSingleTicketTransport" form-type="radio" :type="DICT_TYPE.INFRA_BOOLEAN_STRING" fomatter="bool" />
<span style="margin-left:10px">注:若只有一件,货到仓库立即发,选“是”,多件需仓库集运待发,选“否”</span>
</el-form-item>
<el-form-item label="特殊要求" >
<dict-selector v-model="form.packageType" form-type="checkbox" :type="DICT_TYPE.ORDER_SPECIAL_NEEDS" multiple />
</el-form-item>
<el-form-item label="特殊要求备注">
<el-input v-model="form.packageRemarks" ></el-input>
</el-form-item>
</el-card>
<el-form-item label="">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="$router.back()">取 消</el-button>
......@@ -383,6 +400,7 @@ import {getTradeCityList} from '@/api/ecw/region'
import {getDictData} from '@/utils/dict'
import {getCurrencyList} from '@/api/ecw/currency'
import {getUnitList} from '@/api/ecw/unit'
import {calculationPrice} from '@/api/ecw/product'
export default {
name: "OfferEdit",
components: {
......@@ -448,6 +466,10 @@ export default {
return this.channelList.find(item => item.channelId == channelId) ?. nameZh
}
},
// 当前运输方式
transport(){
return this.transportList.find(item => item.value == this.form.transportId)
},
currentMap(){
let map = {}
this.currencyList.forEach(item => {
......@@ -536,33 +558,30 @@ export default {
console.log(item.transportId, transport)
Object.assign(transport, item, {_enabled: true})
})
this.$nextTick(() => {
/* this.$nextTick(() => {
this.updateEnabledTransports()
}) */
})
})
}else this.addProduct()
}//else this.addProduct()
},
methods: {
onTransportChange(row, val){
/* onTransportChange(row, val){
this.getProductFee(row)
if(this.getDictData(this.DICT_TYPE.ECW_TRANSPORT_TYPE, val).cssClass != 'channel') row.channelId = null
this.updateEnabledTransports()
},
}, */
onLineChange(row){
this.getProductFee(row)
this.updateEnabledTransports()
this.calculationPrice()
// this.updateEnabledTransports()
},
onChannelChange(row){
this.getProductFee(row)
this.calculationPrice()
},
onProductAttrChange(row, attr){
console.log(attr)
this.getProductFee(row)
/* // 需要强制刷新,否则勾选框不更新
this.$forceUpdate() */
this.calculationPrice()
},
// 更新运输方式
updateEnabledTransports(){
/* updateEnabledTransports(){
let enabled = {}
this.productList.forEach(prod => {
......@@ -597,8 +616,11 @@ export default {
Object.assign(transport, enabled[transport.transportId])
}
})
},
}, */
addProduct(data){
if(!data && !this.form.lineId){
return this.$message.error('请先选择路线')
}
this.productList.push(data || {prodAttrArr:[]})
},
// 计算商品运费
......@@ -620,6 +642,12 @@ export default {
if(this.form.objectiveId){
params.destCityId = this.form.objectiveId
}
if(this.form.transportId){
params.transportType = this.form.transportId
}
if(this.form.channelId){
params.channelId = this.form.channelId
}
getOpenedRouterList(params).then(res => this.routerList = res.data)
},
// 计算体积
......@@ -651,6 +679,10 @@ export default {
this.productList.map(item => {
item.prodAttrIds = item.prodAttrArr.join(',')
item.lineId = this.form.lineId
item.channelId = this.form.channelId
item.transportId = this.form.transportId
item.brandType = item.brand ? 1 : 0
})
this.transportList.map(item => {
if(item._enabled){
......@@ -681,7 +713,41 @@ export default {
});
});
},
setLink(row){
this.$prompt('请输入商品链接', {inputValue: row.link}).then(({value}) => {
console.log('value', value)
this.$set(row, 'link', value)
})
},
// 计算商品运费
calculationPrice(){
let calcable = true
if(!this.productList.length) return
this.productList.forEach(item => {
if(!item.weight || !item.prodId){
console.log('重量和产品为选择', item)
calcable = false
}
})
if(this.calculating || !calcable) return false
this.calculating = true
console.log('calculationPrice')
calculationPrice({
lineId: this.form.lineId,
transportId: this.form.transportId,
channelId: this.form.channelId,
prodConditionParamList: this.productList
}).then(res => {
this.$set(this, 'fee', res.data.costDto)
this.productList.map((item, index) => {
this.$set(item, 'fee', res.data.prodCostDtoList[index])
})
}).finally(() => {
this.calculating = false
})
},
}
};
</script>
......
......@@ -232,7 +232,6 @@
<div>{{fee.clearanceUSD || 0}}美元</div>
</el-descriptions-item>
<el-descriptions-item label="其他费用">
<!--TODO 缺少其他费用字段-->
<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-descriptions-item>
......@@ -250,12 +249,15 @@
<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 in couponList">
<el-option v-if="coupon.type == +item.value" :key="coupon.couponId" :label="coupon.titleZh" :value="coupon.couponId"></el-option>
<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>
</template>
</el-select>
</el-col>
<el-col :span="2" v-if="getCoupon(selectedCoupons[item.value])"> -{{getCoupon(selectedCoupons[item.value]).reduceAmount}} 美元</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>
......
......@@ -133,7 +133,7 @@
<el-table-column label="体积/重量" align="center" prop="sumWeight">
<template slot-scope="{row}">{{row.totalVolume}}m³ /{{row.totalWeight}}Kg</template>
</el-table-column>
<el-table-column label="始发仓" align="center" prop="departureName" />
<el-table-column label="运输方式/目的地" align="center" prop="transportId">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="row.transportId" /> / {{row.objectiveName}}
......
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