Commit b3b0497c authored by liuzeheng's avatar liuzeheng

报价、复制价格

parent f143f192
......@@ -1056,3 +1056,11 @@ export function getOrderWarehouseDeleted(orderId,orderItem){
})
}
//获得目的国、目的城市、目的仓
export function getWarehouseTreeRegionList(tradeType){
return request({
url:'/ecw/warehouse/getWarehouseTreeRegionList?tradeType=1',
method: 'get'
})
}
......@@ -159,3 +159,13 @@ export function batchAddPriceAir(data) {
data
})
}
//从商品列表中某一商品进入复制价格
export function copyPriceByProductIds(data){
return request({
url:'/ecw/product-price/copyPriceByProductIds',
method:'post',
data:data
})
}
......@@ -176,6 +176,8 @@
<el-button :disabled="scope.row.isInOpenSea" v-has-permi="[selectAuthorityFn('ecw:customer:postpone')]" size="mini" type="text" icon="el-icon-user" @click="delay(scope.row)">{{$t('延期')}}</el-button>
<el-button v-has-permi="['ecw:customer:treat-recovery']" v-if="scope.row.customerService !== null && scope.row.customerServiceAssignedTime !== null && !scope.row.isCustomerServiceConfirmed && !scope.row.isInOpenSea && path === '/customer/customer'" size="mini" type="text" @click="recovery(scope.row)" > {{$t('回收客户')}} </el-button>
<el-button v-has-permi="['ecw:customer:performanceType']" v-if="path === '/customer/customer'" size="mini" type="text" @click="dialogVisible = true; customData = scope.row;currentisNew = scope.row.isNew" > {{$t('业绩类型')}} </el-button>
<el-button v-has-permi="[selectAuthorityFn('ecw:customer:treat-quoted-price')]" size="mini" type="text" icon="el-icon-user" @click="quote(scope.row)">{{$t('报价')}}</el-button>
</template>
</el-table-column>
</el-table>
......@@ -786,6 +788,16 @@ export default {
this.$refs.CustomerFollowList.customerFollow.dialogVisible = true;
})
},
//报价
quote(row){
//this.$router.push({path:'/offer/create',query:{id:row.id}})
this.$router.push({path:'/offer/create' , query:{customer:row,type:1}}).then({
//this.$refs.push({path:'/customer-contacts/select',query:{pageNo:1,pageSize:10,searchKey:row.defaultContactPhone}})
})
},
/** 查询列表 */
getList() {
this.loading = true;
......
......@@ -5,9 +5,10 @@
<el-card>
<div slot="header" class="card-title">{{$route.path.indexOf('create') > -1 ? $t('新建报价单') : $t('编辑报价单')}}</div>
<el-form-item :label="$t('所属人')" prop="relation">
<el-radio-group v-model="form.relation">
<el-radio :label="1">{{$t('发件人')}}</el-radio>
<el-radio :label="2">{{$t('收件人')}}</el-radio>
<!-- <el-radio-group v-model="form.relation" > -->
<el-radio-group v-model="form.relation" id="relation">
<el-radio :label="1" >{{$t('发件人')}}</el-radio>
<el-radio :label="2" >{{$t('收件人')}}</el-radio>
</el-radio-group>
</el-form-item>
<br/>
......@@ -19,41 +20,62 @@
</el-form-item>
<div class="form-section">
<el-form-item :label="$t('发货人')" prop="consignorId" >
<el-form-item :label="$t('发货人')" prop="consignorId">
<div class="contact">
<el-input v-model="form.consignorName" :placeholder="$t('选择或新建')" disabled style="width:120px"/>
<el-input v-model="form.consignorName" id="defaultContactName" :placeholder="$t('选择或新建')" disabled style="width:120px"/>
<img src="@/assets/svg/contacts.svg" class="phonebook" @click="contactChooseType='consignor'" />
<img src="@/assets/svg/contact_create.svg" class="phonebook" @click="quickCreateType='0'" />
</div>
</el-form-item>
<el-form-item :label="$t('发货人电话')" prop="consignorPhone">
<!-- <area-code-selector v-model="form.consignorCountryCode" class="w-200 mr-10" disabled /> -->
<el-input :value="`${form.consignorCountryCode ? '+' + form.consignorCountryCode : ''} ${form.consignorPhone || ''}`" class="w-200" disabled/>
<el-input id="defaultContactPhone" :value="`${form.consignorCountryCode ? '+' + form.consignorCountryCode : ''} ${form.consignorPhone || ''}`" class="w-200" disabled/>
<!-- <el-input v-if="$route.query.type==1 && form.relation==1" v-model="$route.query.customer.defaultContactPhone" class="w-200" disabled/>
<el-input v-else :value="`${form.consignorCountryCode ? '+' + form.consignorCountryCode : ''} ${form.consignorPhone || ''}`" class="w-200" disabled/> -->
</el-form-item>
<el-form-item :label="$t('发货人公司')" prop="consignorCompany">
<el-input v-model="form.consignorCompany" disabled class="w-200"/>
<!-- 修改从客户列表按钮进来的 -->
<el-input v-model="form.consignorCompany" id="company" disabled class="w-200"/>
<!-- <el-input v-if="$route.query.type==1 && form.relation==1" v-model="$route.query.customer.company" disabled class="w-200"/>
<el-input v-else v-model="form.consignorCompany" disabled class="w-200"/> -->
</el-form-item>
<el-form-item label="Email" prop="consignorEmail">
<el-input v-model="form.consignorEmail" disabled class="w-200"/>
<el-input v-model="form.consignorEmail" id="defaultEmail" disabled class="w-200"/>
<!-- <el-input v-if="$route.query.type==1 && form.relation==1" v-model="$route.query.customer.defaultEmail" disabled class="w-200"/>
<el-input v-else v-model="form.consigneeEmail" disabled class="w-200"/> -->
</el-form-item>
</div>
<div class="form-section">
<el-form-item :label="$t('收货人')" prop="consigneeId">
<div class="contact">
<el-input v-model="form.consigneeName" :placeholder="$t('请选择或新建')" :disabled="true" style="width:120px"/>
<!-- <el-input v-model="form.consigneeName" :placeholder="$t('请选择或新建')" :disabled="true" style="width:120px"/> -->
<el-input v-model="form.consigneeName" id="defaultContactName2" :placeholder="$t('请选择或新建')" :disabled="true" style="width:120px"/>
<img src="@/assets/svg/contacts.svg" class="phonebook" @click="contactChooseType='consignee'" />
<img src="@/assets/svg/contact_create.svg" class="phonebook" @click="quickCreateType='1'" />
</div>
</el-form-item>
<el-form-item :label="$t('收货人电话')" prop="consigneePhone">
<!-- <area-code-selector v-model="form.consigneeCountryCode" class="w-200 mr-10" disabled/> -->
<el-input :value="`${form.consigneeCountryCode ? '+' + form.consigneeCountryCode : ''} ${form.consigneePhone || ''}`" disabled class="w-200"/>
<el-input id="defaultContactPhone2" :value="`${form.consigneeCountryCode ? '+' + form.consigneeCountryCode : ''} ${form.consigneePhone || ''}`" disabled class="w-200"/>
</el-form-item>
<el-form-item :label="$t('收货人公司')" prop="consigneeCompany">
<el-input v-model="form.consigneeCompany" :disabled="true" class="w-200"/>
<el-input id="company2" v-model="form.consigneeCompany" :disabled="true" class="w-200"/>
<!-- <el-input v-if="$route.query.type==1 && form.relation==2" v-model="$route.query.customer.company" disabled class="w-200"/>
<el-input v-else v-model="form.consignorCompany" disabled class="w-200"/> -->
</el-form-item>
<el-form-item label="Email" prop="consigneeEmail">
<el-input v-model="form.consigneeEmail" :disabled="true" class="w-200"/>
<el-input id="defaultEmail2" v-model="form.consigneeEmail" :disabled="true" class="w-200"/>
<!-- <el-input v-if="$route.query.type==1 && form.relation==2" v-model="$route.query.customer.defaultEmail" disabled class="w-200"/>
<el-input v-else v-model="form.consigneeEmail" disabled class="w-200"/> -->
</el-form-item>
</div>
......@@ -519,6 +541,7 @@ import ChooseContactDialog from '@/components/ChooseContactDialog'
import QuickCreateCustomer from '@/components/QuickCreateCustomer'
import {getCustomerContactsSelect} from '@/api/ecw/customerContacts'
import Decimal from 'decimal.js'
import getQuote from '@/views/ecw/customer/index.vue'
window.Decimal= Decimal
const createDefaultForm = () => {
return {
......@@ -538,6 +561,13 @@ export default {
data() {
return {
// 遮罩层
form: {
relation: 1, // CustomerLevel 的初始值
},
type: this.$route.query.type,
contacts:null,
contactsList:[],
loading: true,
// productList:[], // 商品信息
productAttrList:[], // 商品属性
......@@ -562,9 +592,82 @@ export default {
contactChooseType: null, // 联系人选择对象consignor(发货人) 或者 consignee(收货人)
quickCreateType: null, // 快速新建客户类型,1发货人,2收货人
getOpenedRouterListHandler: undefined
};
},
computed:{
computedStandard() {
if(this.$route.query.type==1){
// 使用计算属性动态设置 'Standard' 的值
switch (this.form.relation) {
case 1:
if(this.$route.query.customer.defaultContactName !=null){
// document.getElementById("defaultContactName2").value="";
// document.getElementById("defaultContactName").value=this.$route.query.customer.defaultContactName
//this.form.consignorName = this.$route.query.customer.defaultContactName
this.form.consignorName = this.$route.query.customer.defaultContactName
this.form.consigneeName = ""
this.form.consignorId = this.$route.query.customer.defaultContactId
}
if(this.$route.query.customer.company !=null){
// document.getElementById("company").value =this.$route.query.customer.company;
// document.getElementById("company2").value="";
this.form.consignorCompany = this.$route.query.customer.company
this.form.consigneeCompany = ""
}
if(this.$route.query.customer.defaultContactPhone!=null){
this.form.consignorPhone = this.$route.query.customer.defaultContactPhone
this.form.consigneePhone = ""
this.form.consigeeCountryCode =""
// document.getElementById("defaultContactPhone").value =this.$route.query.customer.defaultContactPhone;
// document.getElementById("defaultContactPhone2").value="";
}
if(this.$route.query.customer.defaultEmail!=null){
this.form.consignorEmail = this.$route.query.customer.defaultEmail;
this.form.consigneeEmail = ""
// document.getElementById("defaultEmail2").value="";
// document.getElementById("defaultEmail").value =this.$route.query.customer.defaultEmail;
}
return;
case 2:
if(this.$route.query.customer.defaultContactName !=null){
//document.getElementById("defaultContactName").value="";
// document.getElementById("defaultContactName2").value =this.$route.query.customer.defaultContactName;
this.form.consignorName = ""
this.form.consigneeName = this.$route.query.customer.defaultContactName
this.form.consigneeId = this.$route.query.customer.defaultContactId
}
if(this.$route.query.customer.company !=null){
// document.getElementById("company").value="";
// document.getElementById("company2").value =this.$route.query.customer.company;
this.form.consignorCompany = ""
this.form.consigneeCompany = this.$route.query.customer.company
}
if(this.$route.query.customer.defaultContactPhone!=null){
this.form.consignorPhone = ""
this.form.consignorCountryCode =""
this.form.consigneePhone = this.$route.query.customer.defaultContactPhone
// document.getElementById("defaultContactPhone").value="";
// document.getElementById("defaultContactPhone2").value =this.$route.query.customer.defaultContactPhone;
}
if(this.$route.query.customer.defaultEmail!=null){
this.form.consignorEmail = ""
this.form.consigneeEmail = this.$route.query.customer.defaultEmail;
// document.getElementById("defaultEmail").value="";
// document.getElementById("defaultEmail2").value =this.$route.query.customer.defaultEmail;
}
return ;
default:
return "";
}
}
},
rules(){
let rules = {
marks: [
......@@ -593,8 +696,23 @@ export default {
{ type: 'number', min: 1, message: this.$t("请选择重要程度")}
]
}
if(this.form.relation == 1){
if(this.form.relation == 1 ){
rules.consignorId = [{ required: true, message: this.$t("发货人不能为空")}]
// if(this.$route.query.type ==1){
// if(this.$route.query.customer.defaultContactName==null){
// rules.consignorId = [{ required: true, message: this.$t("发货人不能为空")}]
// }else{
// // rules.consignorId = [{ required: true, message: ''}]
// }
// }else {
// rules.consignorId = [{ required: true, message: this.$t("发货人不能为空")}]
// }
// else if(this.$route.query.type !=='1'){
// rules.consignorId = [{ required: true, message: this.$t("发货人不能为空")}]
// }
}
if(this.form.relation == 2){
rules.consigneeId = [{ required: true, message: this.$t("收货人不能为空")}]
......@@ -614,7 +732,7 @@ export default {
getRouterNameById(){
return routerId => {
let router = this.routerList.find(item => item.id == routerId)
console.log({router})
if(router){
return router.startTitleZh + ' > ' + router.destTitleZh
}
......@@ -692,6 +810,7 @@ export default {
feeDtoList(){
return this.fee.feeDtoList || []
},
// 清关费
clearanceFeeList(){
return this.feeDtoList.filter(item => item.feeType == 2)
......@@ -790,6 +909,9 @@ export default {
}
},
watch:{
"form.relation": function(newVal) {
this.form.standard = this.computedStandard;
},
// 始发地
'form.departureId'(){
this.getOpenedRouterList()
......@@ -840,6 +962,7 @@ export default {
'form.transportVO.packageTypeArr'(val){
this.$set(this.form.transportVO, 'packageType', (val || []).join(','))
},
// 选择的路线变化后,需要判断是否开通了对应的服务,如果没开通需要取消对应的服务选择
selectedRouter(val){
if(!val) return
......@@ -854,6 +977,7 @@ export default {
if(this.form.offerId != this.$route.query.id){
this.getOffer()
}
},
async created() {
await this.getChannelList()
......@@ -865,9 +989,14 @@ export default {
if(this.$route.query.id){
this.getOffer()
}else this.addProduct()
}else {
// alert(this.$route.query.customer.defaultContactPhone)
this.addProduct()
}
},
methods: {
async getChannelList(){
let query = {
cityId: this.form.objectiveId,
......@@ -883,6 +1012,10 @@ export default {
this.tradeCityList = (await getTradeCityList(query)).data || []
},
getOffer(){
//加了是否从全部客户列表中报价按钮进来的判断
if(this.$route.query !==1){
getOffer(this.$route.query.id).then(res => {
let formData = res.data
formData.type = formData.type ? formData.type.split(',').filter(item => item != '') : []
......@@ -913,20 +1046,26 @@ export default {
this.$set(this, 'form', formData)
// 接口只返回了发货人和收货人ID,还需要调用接口获取详细信息回显
getCustomerContactsSelect({ids: [res.data.consigneeId, res.data.consignorId].join(',')}).then(({data}) => {
this.contactChooseType = 'consignee'
this.onContactChoose(data.list.find(item => item.customerContactsId == res.data.consigneeId))
this.contactChooseType = 'consignor'
this.onContactChoose(data.list.find(item => item.customerContactsId == res.data.consignorId))
})
})
}
},
onContactChoose(contact){
if(!contact) return
if(!this.contactChooseType && !this.quickCreateType) return
if(!this.contactChooseType && this.quickCreateType){
this.contactChooseType = this.quickCreateType == 0 ? 'consignor' : 'consignee'
}
this.$set(this.form, this.contactChooseType + 'Company', contact.company)
this.$set(this.form, this.contactChooseType + 'Id', contact.customerContactsId)
this.$set(this.form, this.contactChooseType + 'CountryCode', contact.areaCode)
......@@ -938,7 +1077,7 @@ export default {
this.quickCreateType = null
},
onProductChange(row, product){
console.log(product)
// row.goodsType = product ? product.typeId : null
row.prodAttrArr = !product ? [] : product.attrId.split(',').filter(item => item !== '').map(item => +item)
if(product){
......@@ -1041,13 +1180,29 @@ export default {
});
return;
}
let data = Object.assign({}, this.form, {
let data =null ;
if(this.$route.query.type ==1){
console.log(JSON.stringify(this.contactsList))
data = Object.assign({}, this.form, {
prodCreateReqVOList: this.getProductListWithDefaultValue(),
consignorId: this.$route.query.customer.defaultContactId,
status
})
// data.consignorId = contacts.customerContactsId
}else{
data = Object.assign({}, this.form, {
prodCreateReqVOList: this.getProductListWithDefaultValue(),
status
})
}
// 添加的提交
createOffer(data).then(response => {
// 重置表单内容
this.$set(this, 'form', {...createDefaultForm()})
this.routerList = []
this.$nextTick(() => {
......@@ -1062,13 +1217,13 @@ export default {
},
setLink(row){
this.$prompt(this.$t('请输入商品链接'), {inputValue: row.link}).then(({value}) => {
console.log('value', value)
this.$set(row, 'link', value)
})
},
// 计算商品运费
calculationPrice(tag){
console.log('calculationPrice@', tag)
let calcable = true
if(!this.form.prodCreateReqVOList.length) return
this.form.prodCreateReqVOList.forEach(item => {
......
......@@ -4,7 +4,7 @@
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item :label="$t('编号')" prop="orderNo">
<el-input v-model="noParam.value" :placeholder="$t('请输入订单号、唛头、提单号')" clearable @keyup.enter.native="handleQuery">
<el-input v-model="noParam.value" :placeholder="$t('请输入订单号、唛头、提单号')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')">
<template slot="prepend">
<dict-selector :type="DICT_TYPE.ORDER_QUERY_NO_FIELD" defaultable v-model="noParam.key" class="w-50" />
</template>
......@@ -15,10 +15,10 @@
</el-form-item> -->
<el-form-item :label="$t('发货人')" prop="consignorKey">
<el-input v-model="queryParams.consignorKey" :placeholder="$t('发货人')" clearable @keyup.enter.native="handleQuery" />
<el-input v-model="queryParams.consignorKey" :placeholder="$t('发货人')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"/>
</el-form-item>
<el-form-item :label="$t('收货人')" prop="consigneeKey">
<el-input v-model="queryParams.consigneeKey" :placeholder="$t('收货人')" clearable @keyup.enter.native="handleQuery" />
<el-input v-model="queryParams.consigneeKey" :placeholder="$t('收货人')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"/>
</el-form-item>
<el-form-item label="">
<dict-selector :type="DICT_TYPE.ECW_BEGINTIME_TYPE_ENDTIME" :filter="(item) => item.value != 'PickTime'" v-model="dateFilterType" defaultable style="width: 150px; margin-right: 5px" />
......@@ -35,11 +35,27 @@
<el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
<div>
<el-form-item :label="$t('目的国')" prop="destCountryId">
<el-select v-model="queryParams.destCountryId" :placeholder="$t('请选择目的国')" clearable @change="handleQuery">
<el-option v-for="item in importCountryList" :key="item.guojia" :label="item.guojiaName" :value="item.id" /></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的城市')" prop="objectiveId">
<el-select v-model="queryParams.objectiveId" :placeholder="$t('请选择目的城市')" clearable @change="handleQuery">
<el-option v-for="item in importCityList" :key="item.shi" :value="item.shi" :label="item.shiName" ></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的仓')" prop="destWarehouseId">
<el-select v-model="queryParams.destWarehouseId" :placeholder="$t('请选择目的仓')" clearable @change="handleQuery">
<el-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
</div>
<el-form-item :label="$t('运输方式')" prop="transportId" v-if="!transportId">
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model.number="queryParams.transportId" clearable @change="handleQuery"/>
......@@ -58,7 +74,7 @@
</el-form-item> -->
<el-form-item :label="$t('商品')" prop="tidanNo">
<el-input v-model="prodParam.value" :placeholder="$t('请输入商品类型、品名或品牌')" clearable @keyup.enter.native="handleQuery">
<el-input v-model="prodParam.value" :placeholder="$t('请输入商品类型、品名或品牌')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')">
<template slot="prepend">
<dict-selector :type="DICT_TYPE.ORDER_QUERY_PROD_FIELD" defaultable v-model="prodParam.key" class="w-50" />
</template>
......@@ -97,7 +113,7 @@
<dict-selector :type="DICT_TYPE.PRODUCT_RECORD_ATTRIBUTE" v-model="queryParams.productRecord" clearable @change="handleQuery" />
</el-form-item>
<el-form-item :label="$t('快递单号')" prop="number">
<el-input v-model="queryParams.number" :placeholder="$t('快递单号')" clearable @keyup.enter.native="handleQuery" />
<el-input v-model="queryParams.number" :placeholder="$t('快递单号')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"/>
</el-form-item>
<el-form-item :label="$t('外部仓')" prop="number">
<el-select v-model="queryParams.isExternalWarehouse" :placeholder="$t('请选择')" clearable @change="handleQuery">
......@@ -568,7 +584,9 @@ import {
exportShippingDatas,
exportShipFee,
exportUnload, splitCancelApply, orderSplitRevoke, setCanShipment, setCanNotShipment
,getParentOrder
,getParentOrder,
getWarehouseTreeRegionList
} from "@/api/ecw/order";
/* import { getDictDatas, DICT_TYPE } from '@/utils/dict'; */
import PrintTag from './components/PrintTag'
......@@ -607,6 +625,12 @@ export default {
return {
// 选中数组
ids: [],
//目的国
countryList:[],
//目的城市
cityList:[],
//目的仓
destWarehouseList:[],
// 非单个禁用
single: true,
// 非多个禁用
......@@ -632,7 +656,7 @@ export default {
packageTypeArr: []
},
warehouseList:[],
// tradeCityList: [],
//tradeCityList: [],
productAttrList: [], // 商品属性
molecule: '', //重货比分子
denominator: '', //重货比分母
......@@ -703,8 +727,19 @@ export default {
/* tradeType 1 进口,2出口,3进出口 */
return this.warehouseList.filter(item => item.tradeType == 2 || item.tradeType == 3)
},
// importWarehouseList(){
// return this.warehouseList.filter(item => item.tradeType == 1 || item.tradeType == 3)
// },
importCountryList(){
return this.countryList.filter(item => item.id !== null)
//return this.countryList.filter(item => item.tradeType == 2 || item.tradeType == 3)
},
importCityList(){
return this.cityList.filter(item => item.id !== null)
},
importWarehouseList(){
return this.warehouseList.filter(item => item.tradeType == 1 || item.tradeType == 3)
return this.destWarehouseList.filter(item => item.id !== null)
},
/* exportCityList() {
return this.tradeCityList.filter(item => item.type == 2)
......@@ -751,18 +786,47 @@ export default {
this.getTransportFromRoute()
this.getList();
getProductAttrList().then(res => this.productAttrList = res.data)
// getTradeCityList().then(res => this.tradeCityList = res.data)
getWarehouseList().then(res => this.warehouseList = res.data)
//getTradeCityList().then(res => this.tradeCityList = res.data)
getWarehouseList().then(res =>{
this.tradeCityList = res.data
this.warehouseList = res.data
})
getCurrencyPage(this.params).then(res => this.currencyList = res.data.list)
// 如果是空运(专线空运和海空联运)则获取渠道
if(this.transportId == 3 || this.transportId == 4){
getChannelList().then(res => this.channelList = res.data)
}
getWarehouseTreeRegionList().then(res => {
this.countryList = res.data
let cityArray =[]
let shi =[]
let Warehouse =[]
res.data.map( item=>{
item.children.map(c=>{
Warehouse.push(c)
shi.push(c)
})
})
let distinitCity = shi.filter((value, index, self) => {
return self.indexOf(value) === index;
});
this.cityList= distinitCity
this.destWarehouseList = Warehouse
})
},
methods: {
getDictDatas,
// 取消拆单申请
splitRevoke(row){
this.splitRevokeOrderId = row.orderId
......@@ -824,7 +888,7 @@ export default {
exportExcel(func, params, fileName = null){
this.exportLoading = true;
func(params).then(res => {
console.log({res})
if(!fileName){
fileName = this.$t('订单')
}
......@@ -871,7 +935,7 @@ export default {
/** 查询列表 */
getList() {
this.loading = true;
console.log('this.combinedQueryParams', this.combinedQueryParams)
const query = {...this.combinedQueryParams}
if(query.packageTypeArr && query.packageTypeArr.length){
query.packageType = query.packageTypeArr.join(',')
......@@ -899,6 +963,7 @@ export default {
});
this.getStatistics()
},
// 获得统计数据
getStatistics(){
......@@ -1005,7 +1070,7 @@ export default {
},
// 过滤订单状态筛选字典内容
statusDictFilter(item){
console.log('statusDictFilter', item)
if(this.transportId == 3 && item.cssClass && item.cssClass != 'air'){
return false
}
......@@ -1033,6 +1098,8 @@ export default {
}
}
};
</script>
<style lang="scss" scoped>
::v-deep .actions{
......
<template>
<div class="app-container">
<div align="center" style="font-size: 20px;">商品名称:{{this.$route.query.titleZh}}</div>
<div class="page-title">复制价格</div>
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="$t('商品名称')" prop="titleZh" v-if="!$route.query.product_id">
<el-input v-model="queryParams.titleZh" :placeholder="$t('请输入中英文名称、商品编码、海关编码')" clearable @keyup.enter.native="handleQuery">
<template #prepend>
<el-select v-model="queryParams.searchType" style="width: 100px">
<el-option :value="1" :label="$t('包含')"></el-option>
<el-option :value="2" :label="$t('不包含')"></el-option>
<el-option :value="3" :label="$t('等于')"></el-option>
</el-select>
</template>
</el-input>
</el-form-item>
<el-form-item :label="$t('商品类型')" prop="typeId" v-if="!$route.query.product_id">
<el-select v-model="queryParams.typeId" :placeholder="$t('选择商品类型')" clearable>
<el-option v-for="type in typeList" :key="type.id" :label="$l(type, 'titleZh')" :value="type.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('商品属性')" prop="typeId" v-if="!$route.query.product_id">
<el-select v-model="queryParams.attrId" :placeholder="$t('选择商品类型')" clearable>
<el-option v-for="attr in attrList" :key="attr.id" :label="$l(attr, 'attrName')" :value="attr.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('运输方式')" prop="transportType" v-if="!transportType">
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number" clearable />
</el-form-item>
<!--海运不显示渠道-->
<el-form-item :label="$t('出货渠道')" prop="shippingChannelId" v-if="type !== 'sea'">
<el-select v-model="queryParams.shippingChannelId" clearable>
<el-option v-for="item in channelList" :key="item.id" :label="$l(item, 'name')" :value="item.channelId" />
</el-select>
</el-form-item>
<el-form-item :label="$t('始发地')" prop="startCityId">
<el-select v-model="queryParams.startCityId" clearable>
<el-option v-for="city in startCityList" :key="city.id" :label="$l(city, 'title')" :value="city.id" />
</el-select>
</el-form-item>
<el-form-item :label="$t('目的地')" prop="destCityId">
<el-select v-model="queryParams.destCityId" clearable>
<el-option v-for="city in destCityList" :key="city.id" :label="$l(city, 'title')" :value="city.id" />
</el-select>
</el-form-item>
<el-form-item :label="$t('是否预付')" prop="needPay">
<el-select v-model="queryParams.needPay" :placeholder="$t('请选择')" clearable>
<el-option :label="$t('是')" value="1"></el-option>
<el-option :label="$t('否')" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('上架状态')" prop="auditStatus">
<dict-selector :type="DICT_TYPE.ECW_PRICE_AUDIT_STATUS" v-model="queryParams.auditStatus" clearable/>
</el-form-item>
<el-form-item :label="$t('状态')" prop="combStatus">
<el-select v-model="queryParams.combStatus" :placeholder="$t('请选择状态')" clearable>
<el-option :label="$t('未设置价格')" value="setPrice_1"></el-option>
<el-option :label="$t('未过期')" value="setPrice_2"></el-option>
<el-option :label="$t('黑名单')" value="blacklist_1"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('是否单询')" prop="needOrderInquiry">
<el-select v-model="queryParams.needOrderInquiry" :placeholder="$t('请选择')" clearable>
<el-option :label="$t('是')" value="1"></el-option>
<el-option :label="$t('否')" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('单价模式')" prop="priceType">
<el-select v-model="queryParams.priceType" :placeholder="$t('请选择')" clearable>
<el-option :label="$t('运费+清关费')" value="0"></el-option>
<el-option :label="$t('全包价')" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<!--全部路线吗没有新增入口,指定商品的路线价格才有添加路线-->
<el-col :span="1.5" v-if="$route.query.product_id">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd('air')" v-hasPermi="['ecw:product-price:create']">{{$t('新建空运价格')}}</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd('sea')" v-hasPermi="['ecw:product-price:create']">{{$t('新建海运价格')}}</el-button>
</el-col>
<el-col :span="1.5">
<!--未指定商品-->
<template>
<!--<el-button type="primary" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit">{{$t('批量设置价格')}}</el-button>-->
<!-- <el-button type="primary" v-hasPermi="['ecw:product-price:bartch_black']" size="mini" @click="batchBlock" :disabled="multiple">{{$t('批量加入黑名单')}}</el-button>
<el-button type="primary" v-hasPermi="['ecw:product-price:batch_down']" size="mini" @click="batchOff" :disabled="multiple">{{$t('批量下架')}}</el-button>
<el-button type="warning" v-hasPermi="['ecw:product-price:export']" size="mini" @click="handleExport" :loading="exportLoading" >{{$t('导出')}}</el-button>
<el-button type="primary" v-if="type != 'air'" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="handleBatchEdit('sea')">{{$t('批量设置海运价格')}}</el-button> -->
<el-button type="primary" v-if="type != 'sea'" v-hasPermi="['ecw:product-price:batch_update']" size="mini" @click="copyPrice">{{$t('批量复制价格')}}</el-button>
</template>
<!--指定商品-->
<!-- <template v-else>
<el-button type="primary" size="mini" v-hasPermi="['ecw:product-price:single_product']" @click="batchSetSingleProductPrice('sea')">{{$t('批量设置商品海运路线')}}</el-button>
<el-button type="primary" size="mini" v-hasPermi="['ecw:product-price:single_product']" @click="batchSetSingleProductPrice('air')">{{$t('批量设置商品空运路线')}}</el-button>
</template> -->
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column :label="$t('序号')" prop="id" width="50" />
<el-table-column :label="$t('商品编码')" align="center" prop="productCode" >
<template slot-scope="{row}">
<el-link type="primary" @click.native="handleUpdate(row)">
{{ row.productDO ? row.productDO.productCode : $t('无productDO字段') }}
</el-link>
</template>
</el-table-column>
<el-table-column :label="$t('海关编码')" align="center" prop="customsCode">
<template slot-scope="{row}">
<div>
{{ row.productDO ? row.productDO.customsCode : $t('无productDO字段') }}
</div>
</template>
</el-table-column>
<el-table-column :label="$t('商品类型')" align="center" prop="typeId">
<template slot-scope="{row}">
<span>{{ row.productDO ? getTypeName(row.productDO.typeId) : $t('无productDO字段') }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('商品名称')" align="center" prop="productName">
<template slot-scope="{row}">
<el-link type="primary" @click.native="handleUpdate(row)">
{{ row.productDO ? row.productDO.titleZh + '/' + row.productDO.titleEn : $t('无productDO字段') }}
</el-link>
</template>
</el-table-column>
<el-table-column prop="tansportType" :label="$t('运输方式')" align="center" width="100">
<template slot-scope="scope">
<div>
{{ transportName(scope.row.warehouseLineDO.transportType) }}
</div>
</template>
</el-table-column>
<el-table-column prop="tansportType" :label="$t('出货渠道')" align="center" width="100">
<template slot-scope="{row}">
<div>
{{ channelName(row.shippingChannelId) }}
</div>
</template>
</el-table-column>
<el-table-column prop="startDestTitle" :label="$t('始发地') + '/' + $t('目的地')" align="center">
<template slot-scope="scope">
<div>
{{ scope.row.warehouseLineDO.startTitleZh }}
<br />
{{ scope.row.warehouseLineDO.destTitleZh }}
</div>
</template>
</el-table-column>
<el-table-column prop="price" :label="$t('价格')" align="center">
<template slot-scope="scope">
<template v-if="scope.row.stepPrice == 1">
<!--全包价-->
<div v-if="scope.row.priceType">
<div v-if="!scope.row.fullPriceStepList || !scope.row.fullPriceStepList.length">{{$t('未设置全包价阶梯价')}}</div>
<div v-else>
{{$t("第{no}阶梯({start}~{end}{weightUnit}", {
no: 1,
start: scope.row.fullPriceStepList[0].startNum,
end: scope.row.fullPriceStepList[0].endNum,
weightUnit: getUnitTitle(scope.row.fullPriceStepList[0].weightUnit),
})}}<br/>
{{$t('全包价')}}:{{ getCurrencySymbol(scope.row.fullPriceStepList[0].allPriceUnit) + scope.row.fullPriceStepList[0].allPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.fullPriceStepList[0].allPriceUnit) + '/' + getUnitTitle(scope.row.fullPriceStepList[0].allVolumeUnit)}}
</div>
</div>
<template v-else>
<div v-if="!scope.row.freightPriceStepList || !scope.row.freightPriceStepList.length">{{$t('未设置运费阶梯价')}}</div>
<div v-else>
{{$t("第{no}阶梯({start}~{end}{weightUnit}", {
no: 1,
start: scope.row.freightPriceStepList[0].startNum,
end: scope.row.freightPriceStepList[0].endNum,
weightUnit: getUnitTitle(scope.row.freightPriceStepList[0].weightUnit),
})}}<br/>
<div>
{{$t('运费')}}:{{ getCurrencySymbol(scope.row.freightPriceStepList[0].transportPriceUnit) + scope.row.freightPriceStepList[0].transportPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.freightPriceStepList[0].transportPriceUnit) + '/' + getUnitTitle(scope.row.freightPriceStepList[0].transportVolumeUnit)}}
</div>
</div>
</template>
<el-button type="text" @click="showMoreStepPriceItem=scope.row">{{$t('查看更多')}}</el-button>
</template>
<template v-else>
<div v-if="scope.row.priceType == 0">
{{$t('运费')}}:{{ getCurrencySymbol(scope.row.transportPriceUnit) + scope.row.transportPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.transportPriceUnit) + '/' + getUnitTitle(scope.row.transportVolumeUnit)}}
<br />
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.clearancePriceUnit) + scope.row.clearancePrice}}&nbsp;
{{ getCurrencyTitle(scope.row.clearancePriceUnit) + '/' + getUnitTitle(scope.row.clearanceVolumeUnit)}}
</div>
<div v-if="scope.row.priceType == 1">
{{$t('全包价')}}:{{ getCurrencySymbol(scope.row.allPriceUnit) + scope.row.allPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.allPriceUnit) + '/' + getUnitTitle(scope.row.allVolumeUnit)}}
</div>
</template>
</template>
</el-table-column>
<el-table-column prop="auditStatus" align="center" :label="$t('状态')" width="120">
<template slot-scope="scope">
<div>
{{ statusName(scope.row) }}
<span style="color:red" v-if="(scope.row.validateStartDate && scope.row.validateStartDate > Date.now()) || (scope.row.validateEndDate && scope.row.validateEndDate < Date.now())">(已过期)</span>
</div>
</template>
</el-table-column>
<el-table-column prop="advanceStatus" :label="$t('单询')" align="center" width="80">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.NEED_ORDER_INQUIRY" :value="scope.row.needOrderInquiry"></dict-tag>
</template>
</el-table-column>
<el-table-column prop="advanceStatus" :label="$t('预付')" align="center" width="80">
<template slot-scope="scope">
<div>
<!-- {{ getAdvanceStatuTitle(scope.row.advanceStatus) }} -->
<dict-tag :type="DICT_TYPE.ECW_PAY_ADVANCE" :value="scope.row.needPay"></dict-tag>
</div>
</template>
</el-table-column>
<el-table-column :label="$t('最后修改时间')">
<template slot-scope="{row}">
<div>
{{ row.updateTime|parseTime }}
</div>
</template>
</el-table-column>
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width" width="140">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row, true)"
v-hasPermi="['ecw:product-price:show']">{{$t('查看')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['ecw:product-price:update']">{{$t('编辑')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="updateStatus(scope.row, 'blacklist')"
v-hasPermi="['ecw:product-price:black']">{{ scope.row.blacklist == 0 ? $t('加入黑名单') : $t('移除黑名单') }}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="updateStatus(scope.row, 'auditStatus')"
v-hasPermi="['ecw:product-price:down']">{{scope.row.auditStatus == AuditStatusEnum.PASS ? $t('下架') : $t('上架')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['ecw:product-price:delete']">{{$t('删除')}}</el-button>
<el-button @click="copyTemplate(scope.row)" size="mini" type="text">{{$t('复制模板')}}</el-button>
<el-button @click="setOrderInquiry(scope.row, 0)" v-if="scope.row.needOrderInquiry" size="mini" type="text">{{$t('取消单询')}}</el-button>
<el-button @click="setOrderInquiry(scope.row, 1)" v-else size="mini" type="text">{{$t('单询异常')}}</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<el-dialog :visible="!!showMoreStepPriceItem" :before-close="closeMoreStepPrice" :title="$t('查看阶梯价')">
<el-row :gutter="20" v-if="showMoreStepPriceItem">
<el-col :span="12">
<!--全包价-->
<template v-if="showMoreStepPriceItem.priceType">
<div v-for="(item, index) in showMoreStepPriceItem.fullPriceStepList">
<show-step-price-item
:value="item"
:unit-map="unitMap"
:currency-map="currencyMap"
:index="index"
field-prefix="all"
:price-name="$t('全包价')"></show-step-price-item>
</div>
</template>
<template v-else>
<template v-if="showMoreStepPriceItem.freightPriceStepList">
<div v-for="(item, index) in showMoreStepPriceItem.freightPriceStepList">
<show-step-price-item
:value="item"
:unit-map="unitMap"
:currency-map="currencyMap"
:index="index"
field-prefix="transport"
:price-name="$t('运费')"></show-step-price-item>
</div>
</template>
<template v-if="showMoreStepPriceItem.clearancePriceStepList">
<div v-for="(item, index) in showMoreStepPriceItem.clearancePriceStepList">
<show-step-price-item
:value="item"
:unit-map="unitMap"
:currency-map="currencyMap"
:index="index"
field-prefix="clearance"
:price-name="$t('清关费')"></show-step-price-item>
</div>
</template>
</template>
</el-col>
<!--空运的清关费单独显示-->
<!--
甲方要求不显示清关费 https://zentao.test.jdshangmen.com/bug-view-5298.html
-->
<!-- <el-col :span="12" v-if="[3,4].indexOf(+showMoreStepPriceItem.warehouseLineDO.transportType) > -1">
<template v-if="showMoreStepPriceItem.clearPriceStepList.length">
<div v-for="(item, index) in showMoreStepPriceItem.clearPriceStepList">
<div class="page-title">
{{$t("第{no}阶梯({start}~{end}{weightUnit}", {
no: index + 1,
start: item.startNum,
end: item.endNum,
weightUnit: getUnitTitle(item.weightUnit),
})}}
</div>
{{$t('清关费')}}:{{ getCurrencySymbol(item.clearancePriceUnit) + item.clearancePrice}}&nbsp;
{{ getCurrencyTitle(item.clearancePriceUnit) + '/' + getUnitTitle(item.clearanceVolumeUnit)}}
</div>
</template>
<template v-else>{{$t('暂无清关费设置')}}</template>
</el-col>-->
</el-row>
</el-dialog>
</div>
</template>
<script>
import {
createProductPrice,
updateProductPrice,
deleteProductPrice,
getProductPrice,
getProductPricePage,
updateOrderInquiry,
copyPriceByProductIds
} from "@/api/ecw/productPrice";
import { openedRouterList } from "@/api/ecw/warehouse";
import { getTradeCityList } from "@/api/ecw/region";
import { getProductTypeList } from "@/api/ecw/productType";
import { getProductAttrList } from "@/api/ecw/productAttr";
import { getDictDatas, DICT_TYPE } from '@/utils/dict'
import { getCurrencyList } from '@/api/ecw/currency';
import { getUnitList } from '@/api/ecw/unit';
import { AuditStatusEnum} from '@/utils/constants'
import { getAllChannelList, getChannelList } from '@/api/ecw/channel'
import DictTag from '@/components/DictTag'
import {arrryToKeyedObjectBy} from '@/utils/index'
import { getProduct} from '@/api/ecw/product';
import {parseTime} from '@/utils/ruoyi'
import Template from "@/views/cms/template";
import {getStatusName} from "@/views/ecw/productPrice/util";
import ShowStepPriceItem from "@/views/ecw/productPrice/components/ShowStepPriceItem.vue";
export default {
name: "EcwProductpriceIndex",
filters: {parseTime},
components: {
ShowStepPriceItem,
Template,
DictTag
},
data() {
return {
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
//特性列表
attrList:[],
typeList: [],
product: null,
cityList: [],
/* startCityList: [], //始发地城市
destCityList: [], //目的地城市 */
routedList: [], //已开头路线列表
currencyList: [], //货币列表
unitList: [], //单位列表
channelList:[] , // 渠道
routeParams:{}, //路线搜索条件
isUpdate: false, //更新操作
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品价格列表
list: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
dateRangeCreateTime: [],
// 查询参数
queryParams: {
searchType: 1,
pageNo: 1,
pageSize: 10,
productId: null,
warehouseLineId: null,
transportType: null,
transportPrice: null,
transportPriceUnit: null,
transportVolumeUnit: null,
clearancePrice: null,
clearancePriceUnit: null,
clearanceVolumeUnit: null,
shippingChannelId: null,
status: null,
},
// 表单参数
form: {
typeId: null,
titleZh: null
},
// 表单校验
rules: {
typeId: [{ required: true, message: this.$t("产品类型不能为空"), trigger: "blur" }],
titleZh: [{ required: true, message: this.$t("产品名称不能为空"), trigger: "blur" }],
titleEn: [{ required: true, message: this.$t("英文名称不能为空"), trigger: "blur" }],
transportPrice: [{ required: true, message: this.$t("海运费不能为空"), trigger: "blur" }],
clearancePrice: [{ required: true, message: this.$t("清关费不能为空"), trigger: "blur" }],
advanceStatus: [{ required: true, message: this.$t("是否预付不能为空"), trigger: "blur" }],
containerLocation:[{ required: true, message: this.$t("货柜位置不能为空"), trigger: "blur" }],
square:[{ required: true, message: this.$t("方数不能为空"), trigger: "blur" }],
needBook:[{ required: true, message: this.$t("预约入仓不能为空"), trigger: "blur" }],
},
lineList: [],
transportDatas: getDictDatas(DICT_TYPE.ECW_TRANSPORT_TYPE),
/* advanceStatusDictDatas: getDictDatas(DICT_TYPE.ADVANCE_STATUS), */
AuditStatusEnum: AuditStatusEnum,
locationList: getDictDatas(DICT_TYPE.ECW_CONTAINER_LOCATION),
// 查看更多阶梯价
showMoreStepPriceItem: null,
entryPath: null
};
},
computed: {
// 路径中的运输方式参数
transportType() {
// product-price-1_2的格式,如果没有三段则最后一段不是运输方式
return this.$route.path.split('-')[2] || '';
},
// 路由中的标题
routeName(){
return this.$route.name
},
// 类型,transportType是1和2(1_2用一个表示)表示海运,3和4表示空运
type(){
// 如果没有则表示商品路线价格
if(!this.transportType){
return null
}
return ['3','4'].indexOf(this.transportType) > -1 ? 'air' : 'sea'
},
// 商品名称
productTitle(){
if(!this.product){
return ''
}
return this.product.titleZh
},
// 渠道用id做键值
keyedChannel(){
return arrryToKeyedObjectBy(this.channelList, 'channelId')
},
// 根据渠道id获取渠道名
channelName(){
return id => {
return this.keyedChannel[id] ? this.keyedChannel[id].nameZh : null
}
},
// 根据类型获取类型名称
getTypeName() {
return typeId => {
for(let index in this.typeList) {
let typeItem = this.typeList[index];
if(typeItem.id == typeId) {
return this.$l(typeItem, 'title');
}
}
}
},
// 根据状态获取状态名称 ,这个应该可以改成字典,目前接口缺少相关数据,待定
statusName() {
return getStatusName
},
// 根据运输方式获取名称
transportName() {
return transportType => {
return this.getDictDataLabel(this.DICT_TYPE.ECW_TRANSPORT_TYPE, transportType)
}
},
// 显示币种符号
getCurrencySymbol() {
return currencyId => {
for(let index in this.currencyList) {
let currecyItem = this.currencyList[index];
if(currecyItem.id == currencyId) {
return currecyItem.fuhao;
}
}
}
},
// 显示币种名称
getCurrencyTitle() {
return currencyId => {
for(let index in this.currencyList) {
let currecyItem = this.currencyList[index];
if(currecyItem.id == currencyId) {
return this.$l(currecyItem, 'title');
}
}
}
},
getUnitTitle() {
return unitId => {
for(let index in this.unitList) {
let unitItem = this.unitList[index];
if(unitItem.id == unitId) {
return this.$l(unitItem, 'title');
}
}
}
},
startCityList(){
return this.cityList.filter(item => item.type == 2 || item.type == 3)
},
destCityList(){
return this.cityList.filter(item => item.type == 1 || item.type == 3)
},
currencyMap(){
let map = {}
this.currencyList.forEach(item => {
map[item.id] = this.$l(item, 'title')
})
return map
},
unitMap(){
let map = {}
this.unitList.forEach(item => {
map[item.id] = this.$l(item, 'title')
})
return map
},
},
activated() {
// console.log('activated', Object.assign({}, this.$route.query))
/* this.$set(this.queryParams, 'typeId', +this.$route.query.product_type || null)
let productId = this.product?.id
console.log(this.$route.query.product_id, productId, this.$route.query.product_id != productId)
if(this.$route.query.product_id != productId){
this.queryParams = {
pageNo: 1,
pageSize: 10
}
}
this.handleQuery()
*/
if(this.$route.query.product_type){
this.$set(this.queryParams, 'typeId', +this.$route.query.product_type);
}
if(this.$route.query.transportType){
this.$set(this.queryParams, 'transportType', +this.$route.query.transportType);
}
// 指定产品获取产品信息
if(this.$route.query.product_id){
this.$set(this.queryParams, 'productId', +this.$route.query.product_id);
getProduct(this.$route.query.product_id).then(res => {
this.product = res.data
})
}else {
if (this.transportType) {
// 如果指定了单个的运输方式则赋值
if (this.transportType.split('_').length == 1) {
this.$set(this.queryParams, 'transportType', +this.transportType)
}
}
}
},
watch:{
'$route.query.product_id'(){
// if(!this.$route.query.product_id){
// return this.product = null
// }
// 价格列表 跟 商品的价格列表,有时候商品价格列表的路由变动会导致价格列表也执行此处代码,所以做一个判断排除
// https://zentao.test.jdshangmen.com/bug-view-4928.html
if(this.$route.path != this.entryPath) return
let productId = this.product?.id
if(this.$route.name === 'ProductPrice'){
if(this.$route.query.product_id != productId){
this.queryParams = {
pageNo: 1,
pageSize: 10,
productId: this.$route.query.product_id,
typeId: this.$route.query.product_type,
transportType:this.$route.query.transportType
}
}
getProduct(this.$route.query.product_id).then(res => {
this.product = res.data
})
this.getList();
}
}
},
created() {
this.entryPath = this.$route.path
if(this.$route.query.product_type){
this.$set(this.queryParams, 'typeId', +this.$route.query.product_type);
}
if(this.$route.query.transportType){
this.$set(this.queryParams, 'transportType', +this.$route.query.transportType);
}
// 指定产品获取产品信息
if(this.$route.query.product_id){
this.$set(this.queryParams, 'productId', +this.$route.query.product_id);
getProduct(this.$route.query.product_id).then(res => {
this.product = res.data
})
}else{
if(this.transportType) {
// 如果指定了单个的运输方式则赋值
if (this.transportType.split('_').length == 1) {
this.$set(this.queryParams, 'transportType', +this.transportType)
}
}
this.getAttrList();
}
//获取城市列表
this.getAllCityList()
this.getChannelList()
this.getTypeList()
this.getAttrList();
//获取货币列表
this.requestCurrencyList();
//获取单位列表
this.requestUnitList();
this.$nextTick(() => {
this.getList();
})
},
methods: {
getChannelList(){
getAllChannelList().then(res => this.channelList = res.data)
},
/** 获取产品属性列表 */
getAttrList() {
getProductAttrList().then(response => {
this.attrList = response.data;
})
},
/** 获取产品类型列表 */
getTypeList() {
getProductTypeList().then(response => {
this.typeList = response.data;
})
},
/**获取所有城市列表 */
getAllCityList() {
getTradeCityList({}).then(response => {
this.cityList = response.data;
})
},
/**获取已开通路线列表 */
getOpenedRouterList() {
openedRouterList(this.routeParams).then(response => {
this.routedList = response.data;
this.setDefaultSelect();
})
},
//复制价格
copyPrice(){
if(this.ids.length==0){
console.log(this.ids)
return this.$message(this.$t('请至少选中一项复制价格'))
}
this.$confirm(this.$t('请再次确认是否将勾选的线路价格复制到手机充电器'), '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
let productPriceIds = this.ids.join(',')
alert(this.$route.query.id)
let productId = this.$route.query.id
let data = {productPriceIds:productPriceIds,productId:productId}
copyPriceByProductIds(data).then(res => {
this.$modal.msgSuccess(this.$t("复制价格成功"));
})
})
.catch(() => console.info("操作取消"));
},
/**获取所有货币列表 */
requestCurrencyList() {
getCurrencyList().then(response => {
this.currencyList = response.data;
})
},
/**获取所有单位列表 */
requestUnitList() {
getUnitList().then(response => {
this.unitList = response.data;
})
},
/*handleSelectionChange(val) {
this.lineList = val;
},*/
/**运输线路改变 */
transportTypeChange(newVal) {
this.routeParams.transportType = this.form.transportType;
this.getOpenedRouterList();
},
/**始发地改变 */
startCityChange(newVal) {
this.routeParams.startCityId = this.form.startCityId;
this.getOpenedRouterList();
},
/**目的地改变 */
destCityChange(newVal) {
this.routeParams.destCityId = this.form.destCityId;
this.getOpenedRouterList();
},
handleStatusChange(row) {
updateProductPrice(row).then(() => {
this.$modal.msgSuccess(this.$t("修改成功"));
}).catch(function() {
row.auditStatus = row.auditStatus === AuditStatusEnum.PASS ? AuditStatusEnum.NOT_PASS : AuditStatusEnum.PASS;
});
},
/** 查询列表 */
getList() {
this.loading = true;
console.log(this.queryParams,'this.queryParams')
// 处理查询参数
let params = {...this.queryParams};
if(this.type == 'sea'){
params.transportType = 1
}
if(this.type == 'air'){
params.transportType = 3
}
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
// 执行查询
console.log(params,'params')
getProductPricePage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
productId: undefined,
warehouseLineId: undefined,
transportPrice: undefined,
transportPriceUnit: undefined,
transportVolumeUnit: undefined,
clearancePrice: undefined,
clearancePriceUnit: undefined,
clearanceVolumeUnit: undefined,
status: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.queryParams.setPrice = undefined
this.queryParams.blacklist = undefined
if(this.queryParams.combStatus){
let tmp = this.queryParams.combStatus.split('_')
this.queryParams[tmp[0]] = tmp[1]
}
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(type) {
return this.$router.push(`../../lineProject/product-price/edit-${type}?` + (new URLSearchParams(this.$route.query)).toString())
},
// 批量修改单个商品的价格(一条或者多条,后者全部路线)
batchSetSingleProductPrice(type){
this.$router.push(`../../lineProject/product-price/edit-${type}?action=batchUpdate&type=${type}&product_id=${this.$route.query.product_id}&ids=${this.ids}`)
},
// 批量设置路线
handleBatchEdit(type) {
this.$router.push('../../lineProject/batch-edit-' + type)
},
/** 修改按钮操作 */
handleUpdate(row, readonly) {
let transportType = row.warehouseLineDO.transportType
let type = transportType == 3 || transportType == 4 ? 'air' : 'sea'
let url = `../../lineProject/product-price/edit-${type}?action=update&id=${row.id}`
if(readonly)url += '&readonly=1'
return this.$router.push(url)
},
updateStatus(row, type) {
if(type == 'blacklist') {
row.blacklist=row.blacklist == 0 ? 1 : 0;
} else if(type == 'auditStatus') {
row.auditStatus=row.auditStatus === AuditStatusEnum.PASS ? AuditStatusEnum.NOT_PASS : AuditStatusEnum.PASS;
}
updateProductPrice(row).then(() => {
this.$modal.msgSuccess(this.$t("修改成功"));
}).catch(function() {
if(statusType == 'blacklist') {
row.blacklist = row.blacklist === 1 ? 0 : 1;
} else {
row.auditStatus = row.auditStatus === AuditStatusEnum.PASS ? AuditStatusEnum.NOT_PASS : AuditStatusEnum.PASS;
}
});
},
checkSelectable() {
return !this.isUpdate;
},
setDefaultSelect() {
let vm = this;
setTimeout(() => {
// 修改线路价格,选中已经选择的
if(vm.isUpdate && vm.routedList && vm.routedList.length) {
vm.$refs.routeTable.toggleRowSelection(vm.routedList[0]);
}
}, 300);
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm(this.$t('是否确认删除产品价格编号为{id}的数据项?', {id})).then(function() {
return deleteProductPrice(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess(this.$t("删除成功"));
}).catch(() => {});
},
// 表格多选
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
// 设置,取消単询
setOrderInquiry(row, needOrderInquiry){
row.needOrderInquiry = needOrderInquiry
updateOrderInquiry(row).then(res => {
this.$message.success(res.msg || this.$t('操作成功'))
this.getList()
})
},
// 复制模板
copyTemplate(row){
// 跳转到批量设置页面,并填充数据
let transportType = row.warehouseLineDO.transportType
this.$router.push(`../../lineProject/batch-edit-${transportType == 3 || transportType == 4 ? 'air' : 'sea'}?templateId=${row.id}`)
},
// 关闭更多阶梯价格窗口
closeMoreStepPrice(){
this.showMoreStepPriceItem=null
}
}
};
</script>
<style lang="scss" scoped>
</style>
......@@ -117,13 +117,33 @@
</el-table-column> -->
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="toPriceManager(scope.row)" v-hasPermi="['ecw:product-price:query']">{{$t('路线价格')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['ecw:product:update']">{{$t('修改')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['ecw:product:delete']">{{$t('删除')}}</el-button>
<el-button v-if="scope.row.auditStatus===2" size="mini" type="text" icon="el-icon-edit" @click="copyPrice(scope.row)" v-hasPermi="['ecw:product:copyPrice']">{{$t('复制价格')}}</el-button>
<!-- <div v-else>
<el-button size="mini" type="text" @click="toPriceManager(scope.row)" v-hasPermi="['ecw:product-price:query']">{{$t('路线价格')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['ecw:product:update']">{{$t('修改')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['ecw:product:delete']">{{$t('删除')}}</el-button>
</div> -->
<!-- <el-button v-else size="mini" type="text" icon="el-icon-edit" @click="copyPrice(scope.row)" v-hasPermi="['ecw:product:copyPrice']">{{$t('复制价格')}}</el-button> -->
</template>
<!-- <template v-else>
<el-button size="mini" type="text" @click="toPriceManager(scope.row)" v-hasPermi="['ecw:product-price:query']">{{$t('路线价格')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['ecw:product:update']">{{$t('修改')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['ecw:product:delete']">{{$t('删除')}}</el-button>
</template>
</template> -->
</el-table-column>
</el-table>
<!-- 分页组件 -->
......@@ -521,6 +541,10 @@ export default {
});
},
//复制价格
copyPrice(row){
this.$router.push({path:'/product/copyPrice',query:{titleZh:row.titleZh,id:row.id}})
},
/** 查询列表 */
getList() {
......
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