Commit f9e8801b by zhangquan

处理车系弹框

1 parent 3ca7f0e1
import { http } from '@/main'
const url = 'rop-scrm-shopmall/router'
const getGoodsListApi = params => {
params.method = 'scrm.api.shopmall.goods.configuration.page'
return http({
url,
method: 'post',
data: params,
sign: true
})
}
export default {
getGoodsListApi
}
\ No newline at end of file
......@@ -20,14 +20,14 @@
width="400"
trigger="hover">
<span>
{{scope.scope.brandList.join('、')}}
{{filterBrand(scope.scope).join('、')}}
</span>
<span class="more-brand" slot="reference">...[{{ scope.scope.brandList.length }}]</span>
</el-popover>
</template>
<template v-else>
<span v-if="!scope.scope.brandList || !scope.scope.brandList.length">--</span>
<span>{{ filterBrand(scope.scope).join('、') }}</span>
<span v-else>{{ filterBrand(scope.scope).join('、') }}</span>
</template>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
......@@ -228,6 +228,7 @@
background-color: #fff;
padding: 20px;
.more-brand{
white-space: nowrap;
color: #5850FF;
cursor: pointer;
}
......
......@@ -10,23 +10,32 @@
<GLTable ref="channelRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
<div slot="imageSlot" class="table-image" slot-scope="scope">
<el-popover placement="top" width="160" trigger="hover" popper-class="table-popover-block">
<img class="table-popover-img" :src="scope.scope.publicityImg" />
<img class="img-36 pointer" slot="reference" :src="scope.scope.publicityImg" />
<img class="table-popover-img" :src="scope.scope.goodsImage" />
<img class="img-36 pointer" slot="reference" :src="scope.scope.goodsImage" />
</el-popover>
</div>
<div slot="statusSlot" slot-scope="scope">
<span :class="['status', scope.scope.channelType==3 ? 'success-status': 'error-status']"></span>
<span>{{scope.scope.channelType==3 ? '上架' : '下架' }}</span>
<span :class="['status', scope.scope.goodsStatus==1 ? 'success-status': 'error-status']"></span>
<span>{{scope.scope.goodsStatus==1 ? '上架' : '下架' }}</span>
</div>
<div slot="merchantPriceSlot" slot-scope="scope">
<template v-if="scope.scope.merchantList && scope.scope.merchantList.length > 1">
<span>{{ filterData(scope.scope).slice(0, 1).join('、') }}</span>
<el-popover
placement="top"
width="400"
trigger="hover">
<div v-for="(item,index) in filterData(scope.scope)" :key="index">
{{item}}
</div>
<span class="more-info" slot="reference">...[{{ scope.scope.merchantList.length }}]</span>
</el-popover>
</template>
<template v-else>
<span v-if="!scope.scope.merchantList || !scope.scope.merchantList.length">--</span>
<span v-else>{{ filterData(scope.scope).join('、') }}</span>
</template>
</div>
<template slot="activityLink" slot-scope="scope">
<span class="relink">{{ scope.scope.activityName }}</span>
</template>
<template slot="moveCarCodeCount" slot-scope="scope">
<span class="moveCarCodeCount" @click="opneMoveMessage(scope.scope)">{{ scope.scope.moveCarCodeCount }}</span>
</template>
<template slot="switch" slot-scope="scope">
<el-switch v-model="scope.scope.isOpen" @change="updateState(scope.scope)"></el-switch>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
......@@ -65,7 +74,7 @@
searchFormData: [
{
label: '商品名称',
name: 'channelName',
name: 'goodsName',
type: 'input'
},
{
......@@ -85,7 +94,7 @@
},
{
label: '商户名称',
name: 'channelName',
name: 'merchantName',
type: 'input'
},
{
......@@ -94,7 +103,7 @@
type: 'select'
},
],
getListApi: this.$apis.channel.getChannelListApi,
getListApi: this.$apis.goods.getGoodsListApi,
tableParams: {
listName: 'list',
tableOption: {
......@@ -103,7 +112,7 @@
tableColumns: [
{
label: '商品名称',
prop: 'channelName'
prop: 'goodsName'
},
{
label: '缩略图',
......@@ -112,20 +121,25 @@
{
label: '收款方式',
formatter: cellValue => {
return cellValue.channelName || '--'
return cellValue.paymentType==1 ? '全款' : '定金+尾款'
}
},
{
label: '定金(元)',
prop: 'channelName'
formatter: cellValue => {
return cellValue.depositPrice ? Number((Number(cellValue.depositPrice)/100).toFixed(2)) : '--'
}
},
{
label: '门店活动价(元)',
prop: 'channelName'
width: 200,
addHtml: 'merchantPriceSlot'
},
{
label: '分类',
prop: 'channelName'
formatter: cellValue => {
return `${cellValue.associationClassifyFirstName||''}-${cellValue.associationClassifySecondName||''}`
}
},
{
label: '状态',
......@@ -134,20 +148,16 @@
{
label: '创建日期',
prop: 'createdDate',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
width: 220
},
{
label: '更新时间',
prop: 'createdDate',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
prop: 'updatedDate',
width: 220
},
{
label: '操作人',
prop: 'channelName'
prop: 'operator',
},
]
},
......@@ -157,13 +167,18 @@
created() {},
mounted() {},
methods: {
filterData({merchantList: list}){
return list?.map(item => {
let activityPrice = item.activityPrice ? Number((Number(item.activityPrice)/100).toFixed(2)) : 0
return `${item.merchantName || '--'}:${activityPrice || '0'}`
}) || []
},
getParams() {
var params = JSON.parse(JSON.stringify(this.tableSearchForm))
if (this.tableSearchForm.createDate.length) {
params.createdDateStrat = new Date(this.tableSearchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.createdDateEnd = new Date(this.tableSearchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
return params
},
beforeSearchFn() {
......@@ -217,6 +232,11 @@
.error-status{
background-color: #999999;
}
.more-info{
white-space: nowrap;
color: #5850FF;
cursor: pointer;
}
}
}
</style>
......
......@@ -14,18 +14,17 @@
</div>
</div>
<div class="wrap">
<div class="item flex-center" v-for="(item, index) in sonBrandList" :key="item.id">
<el-checkbox :indeterminate="isIndeterminate(item)" v-model="item.checked" @change="selectCarSeries(index, item)">
<span class="flex-center">
{{ item.name }}
<i class="el-icon-arrow-right"></i>
</span>
</el-checkbox>
<div class="item son-brand-wrap" v-for="(item, index) in sonBrandList" :key="item.id">
<el-checkbox :indeterminate="isIndeterminate(item)" :value="isChecked(item.id, 'son')" @change="selectSonBrand($event, item, index)"></el-checkbox>
<span class="son-brand-label" @click="showCarSeries(item)">
{{ item.name }}{{ isIndeterminate(item) }}
<i class="el-icon-arrow-right"></i>
</span>
</div>
</div>
<div class="wrap">
<el-checkbox-group v-model="selectdData" @change="handleCheckedCitiesChange">
<el-checkbox class="item" v-for="item in carSeriesList" :label="item.name" :key="item.id">{{item.name}}</el-checkbox>
<el-checkbox-group v-model="selectdData" @change="selectCarSeries()">
<el-checkbox class="item" v-for="item in carSeriesList" :label="item.id" :key="item.id">{{item.name}}</el-checkbox>
</el-checkbox-group>
</div>
</div>
......@@ -40,15 +39,14 @@
return {
carSeriesData: [],
sonBrandList: [],
curSonBrandIdx: -1,
carSeriesList: [],
curSonBrandId: '',
selectdData: [],
isIndeterminate: true
checkedList: [],
checked: true,
}
},
computed:{
carSeriesList() {
return this.curSonBrandIdx == -1 ? [] : this.sonBrandList[this.curSonBrandIdx]?.childs?.forEach(item => item.checked = false)
}
},
props: {
dialogVisible:{
......@@ -62,8 +60,21 @@
},
methods:{
isChecked(id, type){
const _target = this.checkedList.find(ele => ele == id)
if(type=='son'){
return !!_target
}else{
return !!_target?.child?.includes(id)
}
},
isIndeterminate(item){
const _existItem = item?.childs?.find(row => !this.selectdData.includes(row.id))
const _notExistItem= item?.childs?.find(row => this.selectdData.includes(row.id))
return !!_existItem && !!_notExistItem
},
getCarSeriesData() {
this.$apis.store.getCarSeriesApi({needCarSeries:true}).then(res => {
this.$apis.case.getCarSeriesApi({needCarSeries:true}).then(res => {
console.log(res)
if(res?.length){
this.carSeriesData = res
......@@ -71,12 +82,37 @@
})
},
selectBrand(item) {
this.curSonBrandIdx = -1
this.sonBrandList = item.childs
this.sonBrandList = item?.childs || []
console.log(item, this.sonBrandList)
},
selectCarSeries(idx, item){
if(this.curSonBrandIdx != idx) this.curSonBrandIdx = idx
selectSonBrand(e, item , index){
console.log(e, item , index)
const { id } = item
const _targetIdx = this.checkedList.findIndex(ele => ele == id)
if(_targetIdx>-1){
this.checkedList.splice(_targetIdx, 1)
}else{
this.checkedList.push(id)
}
console.log(this.checkedList)
},
selectCarSeries(){
const unChecked = this.carSeriesList.find(item => !this.selectdData.includes(item.id))
const checked = this.carSeriesList.find(item => this.selectdData.includes(item.id))
if(!unChecked) {
this.checkedList.push(this.curSonBrandId)
}
if(!checked){
const _targetIdx = this.checkedList.findIndex(ele => ele == this.curSonBrandId)
this.checkedList.splice(_targetIdx, 1)
}
},
showCarSeries(item){
this.curSonBrandId = item.id
this.carSeriesList = item?.childs
},
handleConfirm(){
console.log(this.selectdData,155)
}
}
}
......@@ -108,12 +144,31 @@
justify-content: space-between;
align-items: center;
}
.son-item{
display: inline-flex;
justify-content: space-between;
.son-brand-wrap{
width: 100%;
display: flex;
align-items: center;
width: calc(100% - 14px);
.son-brand-label{
margin-left: 4px;
line-height: 29px;
flex: 1;
display: flex;
justify-content: space-between;
align-items: center;
}
}
// .son-brand-checkbox{
// &, .el-checkbox__label{
// width: 100%;
// }
// &, .son-brand-label{
// display: flex;
// align-items: center;
// }
// .son-brand-label{
// justify-content: space-between;
// }
// }
}
}
</style>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!