Commit 81dc9689 by cwq0219

新增/编辑直播间

1 parent 62d1b189
......@@ -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'
const defaultPath = 'scrm.api.live.'
const getLiveRoomListApi = params => {
params.method = 'scrm.api.live.live.room.list'
params.method = `${defaultPath}live.room.list`
return http({
url: 'rop-scrm-live/router',
method: 'GET',
......@@ -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) {
function getRoutes(routesData) {
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
}, [])
}
......
......@@ -42,7 +42,7 @@ const staticRoutes = Object.freeze([
},
{
name: 'editLiveRoom',
path: '/liveRoom/editLiveRoom',
path: '/liveRoom/editLiveRoom/:addOrEdit/:id',
// component: () => import('@/views/liveRoom/editLiveRoom.vue'),
component: resolve => require([`@/views/liveRoom/editLiveRoom.vue`], resolve),
meta: {}
......
......@@ -174,8 +174,14 @@ export default {
this.isMutiSelectVisible = !this.isMutiSelectVisible
},
handleProDelete(obj) {
var idx = this.editForm.shopMallGoodsInfoList.findIndex(item => item.id == obj.id)
this.editForm.shopMallGoodsInfoList.splice(idx, 1)
this.$messageBox.alert('是否删除该商品?', '删除', {
confirmButtonText: '确定',
type: 'error',
callback: action => {
var idx = this.editForm.shopMallGoodsInfoList.findIndex(item => item.id == obj.id)
this.editForm.shopMallGoodsInfoList.splice(idx, 1)
}
})
},
handleMutiSelectConfirm(selectedProInfo) {
console.log(selectedProInfo)
......
......@@ -4,16 +4,19 @@
<div class="container edit-container">
<p class="edit-title">{{ title }}</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">
<div slot="wechatAccount" slot-scope="item">
<el-button type="text" @click="handlSelectWechat(item)">从成员中选择</el-button>
</div>
<div slot="liveRoomCof">
<glsx-combi-form ref="editFormRef" labelWidth="160px" :isBlock="isBlock" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="merchantList">
<el-button type="primary" size="mini" class="el-icon-plus" @click="handleRelateStoreClose">直播间配置</el-button>
</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-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="storeSelected" @handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose">
<relate-store-dialog v-if="relateStoreVisible" ref="relateStore" :relateStoreVisible="relateStoreVisible" :storeApi="storeApi" :storeSearchForm="storeSearchForm" :storeSelected="storeSelectedList" @handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose">
<!-- <el-row>
<el-form
:model="storeSearchForm"
......@@ -56,147 +59,219 @@
<script>
// import '@/assets/css/public.scss'
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 glsxDialog from '@/components/glsx-dialog'
// import glsxDialog from '@/components/glsx-dialog'
import relateStoreDialog from './relateStoreDialog'
export default {
name: 'editLiveRoom',
data() {
return {
title: '新建直播间',
// 1-新增;2-编辑
addOrEdit: 1,
titleObj: {
1: '新建直播间',
2: '编辑直播间',
3: '查看直播间'
},
editChildRef: 'editChildRef',
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
editForm: {
title: '',
time: '',
wechatConfigImg: [],
officalStyle: [],
backWall: []
name: '',
openTime: '',
anchorName: '',
anchorWechat: '',
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,
editFormData: [
{
label: '直播间标题',
name: 'title',
name: 'name',
width: '480px',
type: 'input',
maxlength: 20
},
{
label: '开播时间',
name: 'time',
name: 'openTime',
type: 'datePicker',
dateType: 'datetimerange',
isClear: true,
pickerOptions: 'afterRangePickerOptions'
},
{
label: '主播昵称',
name: 'title',
name: 'anchorName',
width: '480px',
type: 'input',
maxlength: 10
maxlength: 30
},
{
label: '主播微信账号',
name: '',
addHtml: 'wechatAccount'
name: 'anchorWechat',
width: '480px',
type: 'input',
maxlength: 64
},
{
label: '主播副号',
name: '',
name: 'subAnchorWechat',
width: '480px',
type: 'input',
maxlength: 20
maxlength: 64
},
{
label: '分享卡片样式配置',
name: 'wechatConfigImg',
name: 'shareImgUrl',
type: 'upload',
handleUpload: (file, fileList, targetItem) => {
this.editForm[targetItem.name] = fileList
// this.editForm[targetItem.name].pop()
maxPhotoNum: 1,
wdithLt: 800,
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: '官方收录样式',
name: 'officalStyle',
name: 'feedsImgUrl',
type: 'upload',
handleUpload: (file, fileList, targetItem) => {
this.editForm[targetItem.name] = fileList
// this.editForm[targetItem.name].pop()
limitSize: 0.09,
maxPhotoNum: 1,
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: '主播间背景墙',
name: 'backWall',
name: 'coverImgUrl',
type: 'upload',
handleUpload: (file, fileList, targetItem) => {
this.editForm[targetItem.name] = fileList
// this.editForm[targetItem.name].pop()
limitSize: 2,
maxPhotoNum: 1,
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: '关联发现频道',
name: 'channelId',
name: 'zoneId',
type: 'select',
// isDisabled: false,
width: '480px',
optionList: [],
optionId: 'dictValue',
optionLabel: 'dictLabel',
optionsName: 'channnelList'
// changeAttr: (value, targetItem) => {
// this.editForm.menuId = ''
// this.editForm.menuName = ''
// this.getMenuTree(value)
// }
optionId: 'id',
optionLabel: 'zoneName',
optionsName: 'zoneList'
},
{
label: '',
name: '',
addHtml: 'merchantList'
},
{
label: '',
name: '',
addHtml: 'liveRoomCof'
addHtml: 'storeTable'
}
],
// 选择成员
isWechatVisible: false,
// 表格
hasPage: false,
tableParams: {
tableOption: true,
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
}
]
},
// 直播配置
relateStoreVisible: false,
storeApi: '',
storeApi: getMerchantList,
storeSearchForm: {},
storeSelected: [],
storeSelectedList: [],
baseData: {
channnelList: [
{
dictValue: 1,
dictLabel: '商户'
},
{
dictValue: 2,
dictLabel: '门店'
}
]
zoneList: []
}
}
},
components: {
glsxCombiForm,
glsxDialog,
// glsxDialog,
relateStoreDialog
},
mounted() {
this.addOrEdit = this.$route.params.addOrEdit
if (this.$route.params.addOrEdit == 2) {
this.editForm = this.$route.params.row
this.title = '编辑直播间'
}
this.getOptionsList('editFormData', false)
this.getZoneList()
this.routeInfo = this.$route.params
this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
// this.eventBus.$on('editRoom', val => {
// 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: {
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) {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
......@@ -211,21 +286,21 @@ export default {
})
},
relateCloseReset() {
this.storeSelected = []
// this.storeSelectedList = []
},
handleRelateStoreClose() {
this.relateStoreVisible = !this.relateStoreVisible
this.relateCloseReset()
},
handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true
})
return true
}
// if (!selectedData.length) {
// this.$message({
// message: '请选择关联门店',
// type: 'warning',
// showClose: true
// })
// return true
// }
// this.couponsForm.merchantCouponDTOList = selectedData
// this.couponsNumList = new Array(selectedData.length).fill(999)
// this.couponsForm.merchantCouponDTOList.forEach((item, idx) => {
......@@ -235,27 +310,65 @@ export default {
// this.couponsNumList[idx] = item.amount
// }
// })
this.storeSelectedList = selectedData
this.handleRelateStoreClose()
// this.$refs.couponAddForm.clearValidate('merchantCouponDTOList')
},
handleWechatClose() {
this.isWechatVisible = !this.isWechatVisible
},
handleWechatConfirm() {
this.handleWechatClose()
handleProDelete(obj) {
this.$messageBox.alert('是否删除该门店?', '删除', {
confirmButtonText: '确定',
type: 'error',
callback: action => {
var idx = this.storeSelectedList.findIndex(item => item.merchantNo == obj.scope.merchantNo)
this.storeSelectedList.splice(idx, 1)
}
})
},
handlSelectWechat(obj) {
this.handleWechatClose()
dateFormate(date) {
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() {
this.handleCancel()
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()
}
})
}
})
},
handleCancel() {
this.$router.push({
name: 'liveRoom'
path: '/liveRoom/liveRoomList'
})
}
}
}
</script>
<style scoped></style>
<style scoped>
.live-room .select-store {
/* width: calc(98% - 140px); */
width: 98%;
}
</style>
<!-- 控制台 -->
<template>
<div class="live-control">
<div class="box">
<p class="edit-title">直播控制台</p>
<div class="head-box flex">
<img class="head-img" src="https://img2.baidu.com/it/u=4276914015,335466661&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" />
<div>
<p>{{ liveRoomData.title }}</p>
<p>开播时间:{{ liveRoomData.time }}</p>
<p>房间号:{{ liveRoomData.roomNum }}</p>
<p>主播:{{ liveRoomData.anchor }}</p>
<p>微信号:{{ liveRoomData.wechat }}</p>
<p v-if="countDown">开播倒计时:{{ countDown }}</p>
<div class="container edit-container">
<div class="box">
<p class="edit-title">直播控制台</p>
<div class="head-box flex">
<img class="head-img" src="https://img2.baidu.com/it/u=4276914015,335466661&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" />
<div>
<p>{{ liveRoomData.title }}</p>
<p>开播时间:{{ liveRoomData.time }}</p>
<p>房间号:{{ liveRoomData.roomNum }}</p>
<p>主播:{{ liveRoomData.anchor }}</p>
<p>微信号:{{ liveRoomData.wechat }}</p>
<p v-if="countDown">开播倒计时:{{ countDown }}</p>
</div>
</div>
</div>
<div class="content">
<p class="edit-sub-title">直播数据</p>
</div>
<div class="content">
<p class="edit-sub-title">商品数据</p>
<p>累计推送次数</p>
<p>商品点击人数</p>
<p>商品点击次数</p>
</div>
<div class="content">
<div class="flex" style="justify-content: space-between;">
<p class="edit-sub-title">商品配置</p>
<el-button size="mini" @click="handleImportPro">导入商品</el-button>
<div class="content">
<p class="edit-sub-title">直播数据</p>
</div>
<div class="content">
<p class="edit-sub-title">商品数据</p>
<p>累计推送次数</p>
<p>商品点击人数</p>
<p>商品点击次数</p>
</div>
<div class="content">
<div class="flex" style="justify-content: space-between;">
<p class="edit-sub-title">商品配置</p>
<el-button size="mini" @click="handleImportPro">导入商品</el-button>
</div>
<GLTable ref="liveRoomRef" :searchForm="searchConfigForm" :tableParams="tableParams" :tableData="tableData" :pageConf="pageConf" :beforeSearchFn="beforeConfigSearchFn">
<span slot="showImg" slot-scope="scope">
<img style="width: 100px; height: 100px;" :src="scope.scope.img" />
</span>
<span slot="auth-button" slot-scope="scope" :data="scope.scope">
<el-button type="text" @click="handlePush(scope.scope.id)">{{ targetId === scope.scope.id ? '已推送' + pushCountDown + 's' : '推送' }}</el-button>
<el-button type="text" @click="handleUpOrDown(scope.scope)">{{ scope.scope.status == '1' ? '下架' : '上架' }}</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</span>
</GLTable>
</div>
<div class="content">
<p class="edit-sub-title">直播设置</p>
</div>
<GLTable ref="liveRoomRef" :searchForm="searchConfigForm" :tableParams="tableParams" :tableData="tableData" :pageConf="pageConf" :beforeSearchFn="beforeConfigSearchFn">
<span slot="showImg" slot-scope="scope">
<img style="width: 100px; height: 100px;" :src="scope.scope.img" />
</span>
<span slot="auth-button" slot-scope="scope" :data="scope.scope">
<el-button type="text" @click="handlePush(scope.scope.id)">{{ targetId === scope.scope.id ? '已推送' + pushCountDown + 's' : '推送' }}</el-button>
<el-button type="text" @click="handleUpOrDown(scope.scope)">{{ scope.scope.status == '1' ? '下架' : '上架' }}</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</span>
</GLTable>
</div>
<div class="content">
<p class="edit-sub-title">直播设置</p>
</div>
<select-muti-pro-dialog :isMutiSelectVisible="isMutiSelectVisible" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-muti-pro-dialog>
</div>
<select-muti-pro-dialog :isMutiSelectVisible="isMutiSelectVisible" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-muti-pro-dialog>
</div>
</template>
......
......@@ -148,7 +148,11 @@ export default {
},
handleDetail(row) {
this.$router.push({
name: 'liveControl'
// name: 'liveControl',
path: '/liveroom/liveControl',
query: {
id: row ? row.id : ''
}
})
},
handleDelete(row) {
......@@ -165,14 +169,20 @@ export default {
},
// 1-新增;2-编辑
handleEdit(addOrEdit, row) {
// console.log(row)
// this.$history.push('services/liveRoom/editLiveRoom', { addOrEdit: addOrEdit, row: row || {} })
// this.eventBus.$emit('editRoom', {
// addOrEdit: addOrEdit,
// id: row ? row.id : ''
// })
this.$router.push({
// name: 'editLiveRoom',
path: '/liveRoom/editLiveRoom',
name: 'ServicesLiveRoomEditLiveRoom',
params: {
addOrEdit: addOrEdit,
row: row || {}
id: row ? row.id : '-1'
}
// name: 'editLiveRoom',
// path: '/liveRoom/editLiveRoom'
})
},
handleSearch() {
......
......@@ -6,29 +6,29 @@
<el-col :span="12">
<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 v-if="sourcePage != 'serviceStore'" prop="yqMerchantName" label="园区店名称" align="center">
<template slot-scope="scope">
<el-table-column prop="merchantName" label="商户名称" align="center">
<!-- <template slot-scope="scope">
<span :class="{ red: !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage) }">{{ scope.row.yqMerchantName }}</span>
</template>
</template> -->
</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">
<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">
<span v-if="!scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)" class="tip-icon">?</span>
</el-tooltip>
</template>
</el-table-column>
</el-table-column> -->
</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 :span="12">
<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="4S店名称" align="center"></el-table-column>
<el-table-column label="删除" align="center" width="50px">
<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 label="删除" align="center" width="50">
<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>
</el-table-column>
</el-table>
......@@ -45,10 +45,10 @@ export default {
return {
selectedData: [],
selectingData: [],
needTip: ['editProduct'],
// needTip: ['editProduct'],
// 分页
total: 0,
currentPage: 1,
pageNum: 1,
pageSize: 20
}
},
......@@ -59,10 +59,10 @@ export default {
default: false
},
// 页面来源
sourcePage: {
type: String,
default: ''
},
// sourcePage: {
// type: String,
// default: ''
// },
storeApi: {
type: Function,
default: () => {}
......@@ -94,21 +94,23 @@ export default {
methods: {
selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
if (this.sourcePage === 'editProduct') {
isSelect = row.isSetUpgradeSettleRule
}
// if (this.sourcePage === 'editProduct') {
// isSelect = row.isSetUpgradeSettleRule
// }
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId)
var exitIds = this.selectedData.map(item => item.merchantNo + '')
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() {
this.storeApi({
...this.storeSearchForm,
currentPage: this.currentPage,
pageNum: this.pageNum,
pageSize: this.pageSize
}).then(res => {
this.selectingData = res.list
......@@ -119,12 +121,12 @@ export default {
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => item.merchantId === row.merchantId)
addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(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.merchantNo !== row.merchantNo))
},
handleAll(selection) {
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
if (selection.length && isExit === -1 && !isServed) {
this.selectedData.push(item)
......@@ -134,14 +136,22 @@ export default {
})
},
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)
},
handleCurrentChange(val) {
this.currentPage = val
this.pageNum = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
if (!this.selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true
})
return true
}
this.$emit('handleRelateStoreConfirm', this.selectedData)
},
handleRelateStoreClose() {
......@@ -155,10 +165,10 @@ export default {
margin: 0 auto 20px !important;
width: 98%;
}
.service-store .relateStore .el-table .cell,
/* .service-store .relateStore .el-table .cell,
.d2-form .relateStore .el-table .cell {
line-height: 26px !important;
}
} */
.service-store .relateStore .el-table--medium td,
.d2-form .relateStore .el-table--medium td {
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!