Commit 81dc9689 by cwq0219

新增/编辑直播间

1 parent 62d1b189
...@@ -23,4 +23,24 @@ const uploadImg = params => { ...@@ -23,4 +23,24 @@ const uploadImg = params => {
}) })
} }
export { getGoodsList, uploadImg } const getMerchantList = params => {
params.method = `${defaultPath}get.merchant.list`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true
})
}
const getZoneList = params => {
params.method = `${defaultPath}get.zone.list`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true
})
}
export { getGoodsList, uploadImg, getMerchantList, getZoneList }
import { http } from '@/main' import { http } from '@/main'
const defaultPath = 'scrm.api.live.'
const getLiveRoomListApi = params => { const getLiveRoomListApi = params => {
params.method = 'scrm.api.live.live.room.list' params.method = `${defaultPath}live.room.list`
return http({ return http({
url: 'rop-scrm-live/router', url: 'rop-scrm-live/router',
method: 'GET', method: 'GET',
...@@ -10,4 +12,25 @@ const getLiveRoomListApi = params => { ...@@ -10,4 +12,25 @@ const getLiveRoomListApi = params => {
}) })
} }
export { getLiveRoomListApi } const insertLiveRoomApi = params => {
params.method = `${defaultPath}insert.live.room`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const getLiveRoomInfoApi = params => {
params.method = `${defaultPath}get.live.room.by.id`
return http({
url: 'rop-scrm-live/router',
method: 'POST',
data: params,
sign: true
})
}
export { getLiveRoomListApi, insertLiveRoomApi, getLiveRoomInfoApi }
...@@ -10,7 +10,7 @@ VueRouter.prototype.push = function push(location) { ...@@ -10,7 +10,7 @@ VueRouter.prototype.push = function push(location) {
function getRoutes(routesData) { function getRoutes(routesData) {
return routesData.reduce((routes, route) => { return routesData.reduce((routes, route) => {
routes.push({ ...route, component: () => import('@/views' + route.path + '.vue') }) routes.push({ ...route, component: () => import('@/views' + route.compath + '.vue') })
return routes return routes
}, []) }, [])
} }
......
...@@ -42,7 +42,7 @@ const staticRoutes = Object.freeze([ ...@@ -42,7 +42,7 @@ const staticRoutes = Object.freeze([
}, },
{ {
name: 'editLiveRoom', name: 'editLiveRoom',
path: '/liveRoom/editLiveRoom', path: '/liveRoom/editLiveRoom/:addOrEdit/:id',
// component: () => import('@/views/liveRoom/editLiveRoom.vue'), // component: () => import('@/views/liveRoom/editLiveRoom.vue'),
component: resolve => require([`@/views/liveRoom/editLiveRoom.vue`], resolve), component: resolve => require([`@/views/liveRoom/editLiveRoom.vue`], resolve),
meta: {} meta: {}
......
...@@ -174,8 +174,14 @@ export default { ...@@ -174,8 +174,14 @@ export default {
this.isMutiSelectVisible = !this.isMutiSelectVisible this.isMutiSelectVisible = !this.isMutiSelectVisible
}, },
handleProDelete(obj) { handleProDelete(obj) {
this.$messageBox.alert('是否删除该商品?', '删除', {
confirmButtonText: '确定',
type: 'error',
callback: action => {
var idx = this.editForm.shopMallGoodsInfoList.findIndex(item => item.id == obj.id) var idx = this.editForm.shopMallGoodsInfoList.findIndex(item => item.id == obj.id)
this.editForm.shopMallGoodsInfoList.splice(idx, 1) this.editForm.shopMallGoodsInfoList.splice(idx, 1)
}
})
}, },
handleMutiSelectConfirm(selectedProInfo) { handleMutiSelectConfirm(selectedProInfo) {
console.log(selectedProInfo) console.log(selectedProInfo)
......
...@@ -4,16 +4,19 @@ ...@@ -4,16 +4,19 @@
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<!-- <p class="edit-sub-title" style="margin-top: 10px;">关联门店信息</p> --> <!-- <p class="edit-sub-title" style="margin-top: 10px;">关联门店信息</p> -->
<glsx-combi-form ref="editFormRef" labelWidth="140px" :isBlock="isBlock" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"> <glsx-combi-form ref="editFormRef" labelWidth="160px" :isBlock="isBlock" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="wechatAccount" slot-scope="item"> <div slot="merchantList">
<el-button type="text" @click="handlSelectWechat(item)">从成员中选择</el-button>
</div>
<div slot="liveRoomCof">
<el-button type="primary" size="mini" class="el-icon-plus" @click="handleRelateStoreClose">直播间配置</el-button> <el-button type="primary" size="mini" class="el-icon-plus" @click="handleRelateStoreClose">直播间配置</el-button>
</div> </div>
<div slot="storeTable" class="select-store">
<GLTable v-show="storeSelectedList.length" ref="warehousListRef" :hasPage="hasPage" :tableParams="tableParams" :tableData="storeSelectedList">
<span slot="auth-button" slot-scope="item">
<el-button type="text" @click="handleProDelete(item)">删除</el-button>
</span>
</GLTable>
</div>
</glsx-combi-form> </glsx-combi-form>
<glsx-dialog title="选择成员" width="620px" :isVisible="isWechatVisible" @closeDialog="handleWechatClose" @confirmDialog="handleWechatConfirm"></glsx-dialog> <relate-store-dialog v-if="relateStoreVisible" ref="relateStore" :relateStoreVisible="relateStoreVisible" :storeApi="storeApi" :storeSearchForm="storeSearchForm" :storeSelected="storeSelectedList" @handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose">
<relate-store-dialog v-if="relateStoreVisible" ref="relateStore" :relateStoreVisible="relateStoreVisible" :storeApi="storeApi" :storeSearchForm="storeSearchForm" :storeSelected="storeSelected" @handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose">
<!-- <el-row> <!-- <el-row>
<el-form <el-form
:model="storeSearchForm" :model="storeSearchForm"
...@@ -56,147 +59,219 @@ ...@@ -56,147 +59,219 @@
<script> <script>
// import '@/assets/css/public.scss' // import '@/assets/css/public.scss'
import _ from 'lodash' import _ from 'lodash'
import { uploadImg, getMerchantList, getZoneList } from '@/api/modules/common'
import { insertLiveRoomApi, getLiveRoomInfoApi } from '@/api/modules/liveRoom'
import glsxCombiForm from '@/components/glsx-combi-form' import glsxCombiForm from '@/components/glsx-combi-form'
import glsxDialog from '@/components/glsx-dialog' // import glsxDialog from '@/components/glsx-dialog'
import relateStoreDialog from './relateStoreDialog' import relateStoreDialog from './relateStoreDialog'
export default { export default {
name: 'editLiveRoom', name: 'editLiveRoom',
data() { data() {
return { return {
title: '新建直播间', title: '新建直播间',
// 1-新增;2-编辑 titleObj: {
addOrEdit: 1, 1: '新建直播间',
2: '编辑直播间',
3: '查看直播间'
},
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
editForm: { editForm: {
title: '', name: '',
time: '', openTime: '',
wechatConfigImg: [], anchorName: '',
officalStyle: [], anchorWechat: '',
backWall: [] subAnchorWechat: '',
shareImgUrl: '',
feedsImgUrl: '',
coverImgUrl: ''
},
editRule: {
name: [{ required: true, message: '请输入直播间标题', trigger: 'change' }],
openTime: [{ required: true, message: '请选择开播时间', trigger: 'blur' }],
anchorName: [{ required: true, message: '请输入主播昵称', trigger: 'change' }],
anchorWechat: [{ required: true, message: '请输入主播微信账号', trigger: 'change' }],
shareImgUrl: [{ required: true, message: '请上传分享卡片样式配置', trigger: 'change' }],
feedsImgUrl: [{ required: true, message: '请上传官方收录样式', trigger: 'change' }],
coverImgUrl: [{ required: true, message: '请上传主播间背景墙', trigger: 'change' }],
zoneId: [{ required: true, message: '请选择发现频道', trigger: 'blur' }]
}, },
editRule: {},
isBlock: true, isBlock: true,
editFormData: [ editFormData: [
{ {
label: '直播间标题', label: '直播间标题',
name: 'title', name: 'name',
width: '480px', width: '480px',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20
}, },
{ {
label: '开播时间', label: '开播时间',
name: 'time', name: 'openTime',
type: 'datePicker', type: 'datePicker',
dateType: 'datetimerange',
isClear: true, isClear: true,
pickerOptions: 'afterRangePickerOptions' pickerOptions: 'afterRangePickerOptions'
}, },
{ {
label: '主播昵称', label: '主播昵称',
name: 'title', name: 'anchorName',
width: '480px', width: '480px',
type: 'input', type: 'input',
maxlength: 10 maxlength: 30
}, },
{ {
label: '主播微信账号', label: '主播微信账号',
name: '', name: 'anchorWechat',
addHtml: 'wechatAccount' width: '480px',
type: 'input',
maxlength: 64
}, },
{ {
label: '主播副号', label: '主播副号',
name: '', name: 'subAnchorWechat',
width: '480px', width: '480px',
type: 'input', type: 'input',
maxlength: 20 maxlength: 64
}, },
{ {
label: '分享卡片样式配置', label: '分享卡片样式配置',
name: 'wechatConfigImg', name: 'shareImgUrl',
type: 'upload', type: 'upload',
handleUpload: (file, fileList, targetItem) => { maxPhotoNum: 1,
this.editForm[targetItem.name] = fileList wdithLt: 800,
// this.editForm[targetItem.name].pop() heightLt: 640,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
uploadImg({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
} }
}, },
{ {
label: '官方收录样式', label: '官方收录样式',
name: 'officalStyle', name: 'feedsImgUrl',
type: 'upload', type: 'upload',
handleUpload: (file, fileList, targetItem) => { limitSize: 0.09,
this.editForm[targetItem.name] = fileList maxPhotoNum: 1,
// this.editForm[targetItem.name].pop() wdithLt: 800,
heightLt: 800,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
uploadImg({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
} }
}, },
{ {
label: '主播间背景墙', label: '主播间背景墙',
name: 'backWall', name: 'coverImgUrl',
type: 'upload', type: 'upload',
handleUpload: (file, fileList, targetItem) => { limitSize: 2,
this.editForm[targetItem.name] = fileList maxPhotoNum: 1,
// this.editForm[targetItem.name].pop() wdithLt: 1080,
heightLt: 1920,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
uploadImg({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
} }
}, },
{ {
label: '关联发现频道', label: '关联发现频道',
name: 'channelId', name: 'zoneId',
type: 'select', type: 'select',
// isDisabled: false, // isDisabled: false,
width: '480px', width: '480px',
optionList: [], optionList: [],
optionId: 'dictValue', optionId: 'id',
optionLabel: 'dictLabel', optionLabel: 'zoneName',
optionsName: 'channnelList' optionsName: 'zoneList'
// changeAttr: (value, targetItem) => {
// this.editForm.menuId = ''
// this.editForm.menuName = ''
// this.getMenuTree(value)
// }
}, },
{ {
label: '', label: '',
name: '', name: '',
addHtml: 'liveRoomCof' addHtml: 'merchantList'
},
{
label: '',
name: '',
addHtml: 'storeTable'
} }
], ],
// 选择成员 // 表格
isWechatVisible: false, hasPage: false,
tableParams: {
tableOption: true,
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
}
]
},
// 直播配置 // 直播配置
relateStoreVisible: false, relateStoreVisible: false,
storeApi: '', storeApi: getMerchantList,
storeSearchForm: {}, storeSearchForm: {},
storeSelected: [], storeSelectedList: [],
baseData: { baseData: {
channnelList: [ zoneList: []
{
dictValue: 1,
dictLabel: '商户'
},
{
dictValue: 2,
dictLabel: '门店'
}
]
} }
} }
}, },
components: { components: {
glsxCombiForm, glsxCombiForm,
glsxDialog, // glsxDialog,
relateStoreDialog relateStoreDialog
}, },
mounted() { mounted() {
this.addOrEdit = this.$route.params.addOrEdit this.getZoneList()
if (this.$route.params.addOrEdit == 2) { this.routeInfo = this.$route.params
this.editForm = this.$route.params.row this.title = this.titleObj[this.routeInfo.addOrEdit]
this.title = '编辑直播间' this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
} // this.eventBus.$on('editRoom', val => {
this.getOptionsList('editFormData', false) // this.routeInfo = val
// this.title = this.titleObj[this.routeInfo.addOrEdit]
// this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
// this.eventBus.$off('editRoom')
// })
// this.getOptionsList('editFormData', false)
}, },
methods: { methods: {
getInfo() {
getLiveRoomInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = res
this.editForm.openTime = [new Date(this.editForm.startTime), new Date(this.editForm.endTime)]
this.editForm.merchantInfoDTOList.forEach(item => {
this.storeSelectedList.push({
merchantNo: item.merchantId,
merchantName: item.merchantName,
merchantAccountLevel: item.merchantAccountLevel
})
})
})
},
getZoneList() {
getZoneList({}).then(res => {
this.baseData.zoneList = res.list
this.getOptionsList('editFormData', false)
})
},
getOptionsList(formName, hasAll = true) { getOptionsList(formName, hasAll = true) {
this[formName].forEach((item, index) => { this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) { if (item.type === 'select' && this.baseData[item.optionsName].length) {
...@@ -211,21 +286,21 @@ export default { ...@@ -211,21 +286,21 @@ export default {
}) })
}, },
relateCloseReset() { relateCloseReset() {
this.storeSelected = [] // this.storeSelectedList = []
}, },
handleRelateStoreClose() { handleRelateStoreClose() {
this.relateStoreVisible = !this.relateStoreVisible this.relateStoreVisible = !this.relateStoreVisible
this.relateCloseReset() this.relateCloseReset()
}, },
handleRelateStoreConfirm(selectedData) { handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) { // if (!selectedData.length) {
this.$message({ // this.$message({
message: '请选择关联门店', // message: '请选择关联门店',
type: 'warning', // type: 'warning',
showClose: true // showClose: true
}) // })
return true // return true
} // }
// this.couponsForm.merchantCouponDTOList = selectedData // this.couponsForm.merchantCouponDTOList = selectedData
// this.couponsNumList = new Array(selectedData.length).fill(999) // this.couponsNumList = new Array(selectedData.length).fill(999)
// this.couponsForm.merchantCouponDTOList.forEach((item, idx) => { // this.couponsForm.merchantCouponDTOList.forEach((item, idx) => {
...@@ -235,27 +310,65 @@ export default { ...@@ -235,27 +310,65 @@ export default {
// this.couponsNumList[idx] = item.amount // this.couponsNumList[idx] = item.amount
// } // }
// }) // })
this.storeSelectedList = selectedData
this.handleRelateStoreClose() this.handleRelateStoreClose()
// this.$refs.couponAddForm.clearValidate('merchantCouponDTOList') // this.$refs.couponAddForm.clearValidate('merchantCouponDTOList')
}, },
handleWechatClose() { handleProDelete(obj) {
this.isWechatVisible = !this.isWechatVisible this.$messageBox.alert('是否删除该门店?', '删除', {
}, confirmButtonText: '确定',
handleWechatConfirm() { type: 'error',
this.handleWechatClose() callback: action => {
var idx = this.storeSelectedList.findIndex(item => item.merchantNo == obj.scope.merchantNo)
this.storeSelectedList.splice(idx, 1)
}
})
}, },
handlSelectWechat(obj) { dateFormate(date) {
this.handleWechatClose() var hours = date.getHours() <= 9 ? '0' + date.getHours() : date.getHours()
var minutes = date.getMinutes() <= 9 ? '0' + date.getMinutes() : date.getMinutes()
var seconds = date.getSeconds() <= 9 ? '0' + date.getSeconds() : date.getSeconds()
return date.toLocaleDateString().replace(/\//g, '-') + ' ' + hours + ':' + minutes + ':' + seconds
}, },
handleConfirm() { handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
// console.log(this.editForm)
var params = JSON.parse(JSON.stringify(this.editForm))
params.startTime = this.dateFormate(new Date(this.editForm.openTime[0]))
params.endTime = this.dateFormate(new Date(this.editForm.openTime[1]))
delete params.openTime
params.merchantList = []
this.storeSelectedList.forEach(item => {
params.merchantList.push({
merchantId: item.merchantNo,
merchantName: item.merchantName,
merchantAccountLevel: item.merchantAccountLevel
})
})
insertLiveRoomApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancel() this.handleCancel()
}
})
}
})
}, },
handleCancel() { handleCancel() {
this.$router.push({ this.$router.push({
name: 'liveRoom' path: '/liveRoom/liveRoomList'
}) })
} }
} }
} }
</script> </script>
<style scoped></style> <style scoped>
.live-room .select-store {
/* width: calc(98% - 140px); */
width: 98%;
}
</style>
<!-- 控制台 --> <!-- 控制台 -->
<template> <template>
<div class="live-control"> <div class="live-control">
<div class="container edit-container">
<div class="box"> <div class="box">
<p class="edit-title">直播控制台</p> <p class="edit-title">直播控制台</p>
<div class="head-box flex"> <div class="head-box flex">
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
</div> </div>
<select-muti-pro-dialog :isMutiSelectVisible="isMutiSelectVisible" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-muti-pro-dialog> <select-muti-pro-dialog :isMutiSelectVisible="isMutiSelectVisible" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-muti-pro-dialog>
</div> </div>
</div>
</template> </template>
<script> <script>
......
...@@ -148,7 +148,11 @@ export default { ...@@ -148,7 +148,11 @@ export default {
}, },
handleDetail(row) { handleDetail(row) {
this.$router.push({ this.$router.push({
name: 'liveControl' // name: 'liveControl',
path: '/liveroom/liveControl',
query: {
id: row ? row.id : ''
}
}) })
}, },
handleDelete(row) { handleDelete(row) {
...@@ -165,14 +169,20 @@ export default { ...@@ -165,14 +169,20 @@ export default {
}, },
// 1-新增;2-编辑 // 1-新增;2-编辑
handleEdit(addOrEdit, row) { handleEdit(addOrEdit, row) {
// console.log(row)
// this.$history.push('services/liveRoom/editLiveRoom', { addOrEdit: addOrEdit, row: row || {} }) // this.$history.push('services/liveRoom/editLiveRoom', { addOrEdit: addOrEdit, row: row || {} })
// this.eventBus.$emit('editRoom', {
// addOrEdit: addOrEdit,
// id: row ? row.id : ''
// })
this.$router.push({ this.$router.push({
// name: 'editLiveRoom', name: 'ServicesLiveRoomEditLiveRoom',
path: '/liveRoom/editLiveRoom',
params: { params: {
addOrEdit: addOrEdit, addOrEdit: addOrEdit,
row: row || {} id: row ? row.id : '-1'
} }
// name: 'editLiveRoom',
// path: '/liveRoom/editLiveRoom'
}) })
}, },
handleSearch() { handleSearch() {
......
...@@ -6,29 +6,29 @@ ...@@ -6,29 +6,29 @@
<el-col :span="12"> <el-col :span="12">
<el-table ref="seletingTable" :data="selectingData" height="464px" class="table" border @select="handleChange" @select-all="handleAll"> <el-table ref="seletingTable" :data="selectingData" height="464px" class="table" border @select="handleChange" @select-all="handleAll">
<el-table-column type="selection" width="55" align="center" :selectable="selectable"></el-table-column> <el-table-column type="selection" width="55" align="center" :selectable="selectable"></el-table-column>
<el-table-column v-if="sourcePage != 'serviceStore'" prop="yqMerchantName" label="园区店名称" align="center"> <el-table-column prop="merchantName" label="商户名称" align="center">
<template slot-scope="scope"> <!-- <template slot-scope="scope">
<span :class="{ red: !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage) }">{{ scope.row.yqMerchantName }}</span> <span :class="{ red: !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage) }">{{ scope.row.yqMerchantName }}</span>
</template> </template> -->
</el-table-column> </el-table-column>
<el-table-column prop="merchantName" label="4S店名称" align="center"> <!-- <el-table-column prop="merchantName" label="4S店名称" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span :class="{ red: !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage) }">{{ scope.row.merchantName }}</span> <span :class="{ red: !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage) }">{{ scope.row.merchantName }}</span>
<el-tooltip v-if="!scope.row.isSetUpgradeSettleRule" popper-class="tooltip-class" effect="dark" content="该门店无配置财务分润规则,无法关联!" placement="top"> <el-tooltip v-if="!scope.row.isSetUpgradeSettleRule" popper-class="tooltip-class" effect="dark" content="该门店无配置财务分润规则,无法关联!" placement="top">
<span v-if="!scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)" class="tip-icon">?</span> <span v-if="!scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)" class="tip-icon">?</span>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column> -->
</el-table> </el-table>
<el-pagination small background @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pageSize" layout="total, prev, pager, next" :total="total"></el-pagination> <el-pagination small background @current-change="handleCurrentChange" :current-page.sync="pageNum" :page-size="pageSize" layout="total, prev, pager, next" :total="total"></el-pagination>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-table :data="selectedData" class="table" border height="464px"> <el-table :data="selectedData" class="table" border height="464px">
<el-table-column v-if="sourcePage != 'serviceStore'" prop="yqMerchantName" label="园区店名称" align="center"></el-table-column> <el-table-column prop="merchantName" label="商户名称" align="center"></el-table-column>
<el-table-column prop="merchantName" label="4S店名称" align="center"></el-table-column> <!-- <el-table-column prop="merchantName" label="4S店名称" align="center"></el-table-column> -->
<el-table-column label="删除" align="center" width="50px"> <el-table-column label="删除" align="center" width="50">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button class="el-icon-delete" @click="handleDelete(scope.row)" type="text"></el-button> <el-button style="padding: 0;" class="el-icon-delete" @click="handleDelete(scope.row)" type="text"></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -45,10 +45,10 @@ export default { ...@@ -45,10 +45,10 @@ export default {
return { return {
selectedData: [], selectedData: [],
selectingData: [], selectingData: [],
needTip: ['editProduct'], // needTip: ['editProduct'],
// 分页 // 分页
total: 0, total: 0,
currentPage: 1, pageNum: 1,
pageSize: 20 pageSize: 20
} }
}, },
...@@ -59,10 +59,10 @@ export default { ...@@ -59,10 +59,10 @@ export default {
default: false default: false
}, },
// 页面来源 // 页面来源
sourcePage: { // sourcePage: {
type: String, // type: String,
default: '' // default: ''
}, // },
storeApi: { storeApi: {
type: Function, type: Function,
default: () => {} default: () => {}
...@@ -94,21 +94,23 @@ export default { ...@@ -94,21 +94,23 @@ export default {
methods: { methods: {
selectable(row, index) { selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
if (this.sourcePage === 'editProduct') { // if (this.sourcePage === 'editProduct') {
isSelect = row.isSetUpgradeSettleRule // isSelect = row.isSetUpgradeSettleRule
} // }
return isSelect return isSelect
}, },
recoverySelection() { recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId) var exitIds = this.selectedData.map(item => item.merchantNo + '')
this.selectingData.forEach(item => { this.selectingData.forEach(item => {
exitIds.includes(item.merchantId) && this.$refs.seletingTable.toggleRowSelection(item, true) if (exitIds.includes(item.merchantNo)) {
this.$refs.seletingTable.toggleRowSelection(item, true)
}
}) })
}, },
getSelectingList() { getSelectingList() {
this.storeApi({ this.storeApi({
...this.storeSearchForm, ...this.storeSearchForm,
currentPage: this.currentPage, pageNum: this.pageNum,
pageSize: this.pageSize pageSize: this.pageSize
}).then(res => { }).then(res => {
this.selectingData = res.list this.selectingData = res.list
...@@ -119,12 +121,12 @@ export default { ...@@ -119,12 +121,12 @@ export default {
}) })
}, },
handleChange(selection, row) { handleChange(selection, row) {
var addOrDelete = !!selection.find(item => item.merchantId === row.merchantId) var addOrDelete = !!selection.find(item => item.merchantNo === row.merchantNo)
addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId)) addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.merchantNo !== row.merchantNo))
}, },
handleAll(selection) { handleAll(selection) {
this.selectingData.forEach(item => { this.selectingData.forEach(item => {
var isExit = this.selectedData.findIndex(subItem => subItem.merchantId === item.merchantId) var isExit = this.selectedData.findIndex(subItem => subItem.merchantNo === item.merchantNo)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && isExit === -1 && !isServed) { if (selection.length && isExit === -1 && !isServed) {
this.selectedData.push(item) this.selectedData.push(item)
...@@ -134,14 +136,22 @@ export default { ...@@ -134,14 +136,22 @@ export default {
}) })
}, },
handleDelete(row) { handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId) this.selectedData = this.selectedData.filter(item => item.merchantNo !== row.merchantNo)
this.$refs.seletingTable.toggleRowSelection(row) this.$refs.seletingTable.toggleRowSelection(row)
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.currentPage = val this.pageNum = val
this.getSelectingList() this.getSelectingList()
}, },
handleRelateStoreConfirm() { handleRelateStoreConfirm() {
if (!this.selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true
})
return true
}
this.$emit('handleRelateStoreConfirm', this.selectedData) this.$emit('handleRelateStoreConfirm', this.selectedData)
}, },
handleRelateStoreClose() { handleRelateStoreClose() {
...@@ -155,10 +165,10 @@ export default { ...@@ -155,10 +165,10 @@ export default {
margin: 0 auto 20px !important; margin: 0 auto 20px !important;
width: 98%; width: 98%;
} }
.service-store .relateStore .el-table .cell, /* .service-store .relateStore .el-table .cell,
.d2-form .relateStore .el-table .cell { .d2-form .relateStore .el-table .cell {
line-height: 26px !important; line-height: 26px !important;
} } */
.service-store .relateStore .el-table--medium td, .service-store .relateStore .el-table--medium td,
.d2-form .relateStore .el-table--medium td { .d2-form .relateStore .el-table--medium td {
padding: 6px 8px !important; padding: 6px 8px !important;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!