Commit 122eb611 authored by dragondean@qq.com's avatar dragondean@qq.com

完善优惠券

parent 1c95a56a
......@@ -5,7 +5,7 @@
<div slot="header" class="header">
<el-input v-model="queryParams.searchKey" placeholder="用户名/手机/邮箱" style="width:200px" />
<dict-selector :type="DICT_TYPE.USER_TYPE" v-model="queryParams.customerType" style="width:100px" />
<el-button type="primary" @click="reLoad">搜1</el-button>
<el-button type="primary" @click="reLoad"></el-button>
</div>
<div class="list">
<div class="item" v-for="item in list" :key="item.id">
......
......@@ -2,7 +2,7 @@
<div>
<div class="filters mb-10">
运输方式
<dict-selector :type='DICT_TYPE.ECW_TRANSPORT_TYPE' v-model="transportType" placeholder="请选择运输方式" />
<dict-selector :type='DICT_TYPE.ECW_TRANSPORT_TYPE' v-model="transportType" placeholder="请选择运输方式" style="width:150px" />
始发地:
<el-select placeholder="请选择始发地" v-model="exportCity" clearable>
......@@ -13,6 +13,17 @@
<el-select placeholder="请选择目的地" v-model="importCity" clearable>
<el-option v-for="item in importCityList" :key="item.id" :label="item.titleZh" :value="item.id" />
</el-select>
出货渠道:
<el-select placeholder="请选择目渠道" v-model="channelId" clearable>
<el-option v-for="item in channelList" :key="item.channelId" :label="item.nameZh" :value="item.channelId" />
</el-select>
</div>
<div class="mb-10">
<el-radio-group v-model="checkAll">
<el-radio :label="true">全选</el-radio>
<el-radio :label="false">全不选</el-radio>
</el-radio-group>
</div>
<el-row class="" :gutter="10">
<template v-for="item in filteredRouterList">
......@@ -22,17 +33,18 @@
{{item.label}}
<el-link type="primary" @click.native="toggleHide(item.value)" style="float:right">{{item._hide ? '展开' : '折叠'}}</el-link>
</div>
<el-table v-if="!hideMap[item.value]" :data="item.routerList" :span-method="SpanMethod" border>
<!--table需要给一个key,否则全选的时候不会自动更新渲染-->
<el-table v-if="!hideMap[item.value]" :data="item.routerList" :span-method="SpanMethod" border :key="selectedRoutes.length + item.value">
<el-table-column label="始发地" prop="startTitleZh" />
<el-table-column label="目的地" prop="destTitleZh" />
<el-table-column label="渠道" prop="startTitleZh">
<template slot-scope="{row}">
{{row.channel.nameZh}}11
{{row.channel.nameZh}}
</template>
</el-table-column>
<el-table-column label="操作" prop="">
<template slot-scope="{row}">
<el-checkbox :checked="getSelectedIndex(row) !== null" @change="toggleChecker(row, $event)"></el-checkbox>
<el-checkbox :checked="getSelectedIndex(row) > -1" @change="toggleChecker(row, $event)"></el-checkbox>
</template>
</el-table-column>
</el-table>
......@@ -56,47 +68,55 @@ export default {
transportType: null, // 运输方式
importCity: null, // 目的地(进口城市)
exportCity: null, // 始发地(出口城市)
channelId: null,
selectedRoutes: [], // 勾选的路线渠道
hideMap: {}, // 折叠状态
checkAll: null,
}
},
computed:{
importCityList(){
return this.tradeCityList.filter(item => item.type == 1)
},
exportCityList(){
return this.tradeCityList.filter(item => item.type == 2)
},
availChannelList(){
return this.channelList.filter(item => !this.channelId || this.channelId == item.channelId)
},
filteredRouterList(){
let transportTypeList = []
this.transportTypeDicts.forEach(item => {
if(this.transportType === null || this.transportType == '' || this.transportType == item.value){
let routerList = []
this.openedRouterList.forEach(router => {
if(router.transportType == item.value){
routerList.push(Object.assign({
_merge: item.cssClass == 'channel' ? this.channelList.length || 1 : 1,
channel: item.cssClass == 'channel' ? this.channelList[0] || {} : {},
}, router))
// 字典的cssClass =channel则表示渠道相关(空运,海空联运)
if(item.cssClass == 'channel'){
this.channelList.slice(1).forEach(channel => {
routerList.push(Object.assign({channel, _merge: 0}, router))
})
this.transportTypeDicts
.filter(transport => !this.channelId || transport.cssClass == 'channel')
.forEach(item => {
if(this.transportType === null || this.transportType == '' || this.transportType == item.value){
let routerList = []
this.openedRouterList.forEach(router => {
if(router.transportType == item.value){
routerList.push(Object.assign({
_merge: item.cssClass == 'channel' ? this.availChannelList.length || 1 : 1,
channel: item.cssClass == 'channel' ? this.availChannelList[0] || {} : {},
}, router)
)
// 字典的cssClass =channel则表示渠道相关(空运,海空联运)
if(item.cssClass == 'channel'){
this.availChannelList.slice(1).forEach(channel => {
routerList.push(Object.assign({channel, _merge: 0}, router))
})
}
}
}
})
})
let child = {
label: item.label,
value: item.value,
_hide: false, // 是否折叠
routerList: routerList
let child = {
label: item.label,
value: item.value,
_hide: false, // 是否折叠
routerList: routerList
}
transportTypeList.push(child)
}
transportTypeList.push(child)
}
})
})
return transportTypeList
}
},
......@@ -109,9 +129,27 @@ export default {
},
selectedRoutes(val){
this.$emit('input', val)
// 如果选择发生变化
let total = 0
this.filteredRouterList.forEach(item => {
total += item.routerList.length
})
if(total != val.length && val.length){
this.checkAll = null
}
},
value(val){
this.selectedRoutes = val || []
},
checkAll(val){
if(val === true || val === false){
console.log('选中全部')
this.filteredRouterList.forEach(item => {
item.routerList.forEach(router => {
if(this.getSelectedIndex(router) > -1 != val )this.toggleChecker(router, val)
})
})
}
}
},
created(){
......@@ -139,7 +177,7 @@ export default {
},
// 切换路线选择
toggleChecker(router, selected){
this.getSelectedIndex(router)
// this.getSelectedIndex(router)
/* this.selectedRoutes.forEach((item, i)=>{
if(item.lineId == router.id && item.shippingChannelId == item.channel.id){
index = i
......@@ -153,21 +191,25 @@ export default {
})
}else{
let index = this.getSelectedIndex(router)
if(index !== null){
if(index > -1){
this.selectedRoutes.splice(index, 1)
}
}
},
getSelectedIndex(router){
let index = null
return this.selectedRoutes.findIndex(item => {
return item.lineId == router.id && item.shippingChannelId == router.channel.channelId
})
/* let index = null
this.selectedRoutes.forEach((item, i)=>{
if(item.lineId == router.id && item.shippingChannelId == router.channel.channelId){
index = i
// break
}
})
return index
return index */
},
SpanMethod({ row, column, rowIndex, columnIndex }){
if (columnIndex < 2 ) {
......
......@@ -138,7 +138,7 @@ import {
exportChannelExcel,
} from "@/api/ecw/channel";
import {getWarehouseList} from '@/api/ecw/warehouse'
import {getExpressList} from '@/api/ecw/express'
import {getExpressPage} from '@/api/ecw/express'
export default {
data() {
return {
......@@ -166,8 +166,8 @@ export default {
await getWarehouseList().then(res => {
this.warehouseList = res.data
})
await getExpressList().then(res => {
this.expressList = res.data
await getExpressPage({pageSize: 1000}).then(res => {
this.expressList = res.data.list
})
if (this.$route.query.id) {
......
This diff is collapsed.
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