Commit ad816bf0 by cwq0219

专区

1 parent c833efe6
......@@ -56,5 +56,16 @@ export default {
padding: 20px 0;
line-height: 36px;
}
#app {
background: #f4f5fa;
padding: 0px 20px 20px 40px;
position: absolute;
box-sizing: border-box;
width: 100%;
top: 0px;
left: 0px;
overflow-y: auto;
height: 100%;
}
</style>
>
import { http } from '@/main'
const defaultPath = 'scrm.api.live.'
const defaultPath = 'scrm.api.carlife.'
const getGoodsList = params => {
params.method = 'scrm.api.shopmall.goods.page.curMerchant'
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
// const getGoodsList = params => {
// params.method = 'scrm.api.shopmall.goods.page.curMerchant'
// return http({
// url: 'rop-scrm-shopmall/router',
// method: 'GET',
// data: params,
// sign: true
// })
// }
const uploadImg = params => {
params.method = `${defaultPath}wechat.upload.image`
const uploadImgApi = params => {
params.method = `${defaultPath}common.uploadImg`
return http({
url: 'rop-scrm-live/router',
url: 'rop-scrm-carlife/router',
method: 'POST',
data: params,
sign: true,
......@@ -24,23 +24,23 @@ const uploadImg = params => {
}
const getMerchantList = params => {
params.method = `${defaultPath}get.merchant.list`
params.method = `${defaultPath}merchant.listWithPageByCurMerchant`
return http({
url: 'rop-scrm-live/router',
url: 'rop-scrm-carlife/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
})
}
// 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 }
export default { uploadImgApi, getMerchantList }
import { http } from '@/main'
const defaultPath = 'scrm.api.live.'
const getMerberList = params => {
params.method = `${defaultPath}get.member.list`
const getHomeInfoListApi = params => {
params.method = 'scrm.api.shopmall.homeConfig.get'
return http({
url: 'rop-scrm-live/router',
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
export { getMerberList }
export default { getHomeInfoListApi }
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.'
const getZoneList = params => {
params.method = `${defaultPath}zoneInfo.page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
const deleteZoneApi = params => {
params.method = `${defaultPath}zoneInfo.delete`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true,
returnAll: true
})
}
const getZoneInfoApi = params => {
params.method = `${defaultPath}zoneInfo.getById`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
const insertZoneApi = params => {
params.method = `${defaultPath}zoneInfo.insertOrUpdate`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true,
returnAll: true
})
}
export default { getZoneList, deleteZoneApi, getZoneInfoApi, insertZoneApi }
.live-room .container {
background: #FFFFFF;
margin: 20px 40px;
padding: 15px 20px;
box-shadow: 0 1px 5px 0 rgba(38, 38, 38, 0.10);
.marketing .container {
padding: 0px 20px 20px 40px;
background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px;
}
.marketing .edit-container {
margin-bottom: 84px;
}
.marketing .edit-form-container {
margin-top: 20px;
}
.marketing .m-b-20 {
margin-bottom: 20px;
}
.marketing .footer-btns {
float: right;
}
.el-scrollbar__bar.is-horizontal{
......@@ -14,48 +30,45 @@
background-color: rgba(144, 147, 153, 0.5) !important;
}
.live-room .el-table .cell {
.marketing .el-table .cell {
line-height: 16px;
}
.live-room .table-btns .el-button {
.marketing .table-btns .el-button {
padding: 0 0 0 5px;
margin-left: 5px;
border-left: 1px solid #DCDFE6;
border-radius: 0;
}
.live-room .table-btns .el-button:first-child {
.marketing .table-btns .el-button:first-child {
padding: 0;
border: 0;
}
.live-room .img-60 {
.marketing .img-60 {
width: 60px;
height: 60px;
}
.live-room .edit-container {
margin: 20px 40px 84px;
}
.live-room .footer {
position: absolute;
.marketing .footer {
position: fixed;
bottom: 0;
width: 100%;
height: 64px;
/* left: 220px; */
text-align: center;
line-height: 64px;
background: #FFFFFF;
background: #ffffff;
z-index: 999;
}
.live-room .flex {
.marketing .flex {
display: flex;
justify-content: space-between;
}
.live-room .edit-title {
.marketing .edit-title {
font-size: 16px;
font-weight: bold;
height: 48px;
......@@ -66,7 +79,7 @@
margin: 0 0;
}
.live-room .edit-sub-title::before {
.marketing .edit-sub-title::before {
position: absolute;
display: inline-block;
content: '';
......@@ -77,39 +90,11 @@
background-color: #0947C6;
}
.live-room .edit-sub-title {
.marketing .edit-sub-title {
position: relative;
font-size: 16px;
font-weight: 700;
color: #333333;
margin: 0 0 30px 0;
padding-left: 8px;
}
// .live-room table {
// width: 98%;
// color: #666666;
// border: 1px solid #e5e6e7;
// border-width: 1px 0 0 1px;
// }
// .live-room table tr {
// height: 30px;
// // line-height: 30px;
// }
// .live-room table th,
// .live-room table td {
// font-size: 12px;
// font-weight: normal;
// padding: 0px 10px;
// border: 1px solid #e5e6e7;
// border-width: 0px 1px 1px 0px;
// border-spacing: 0;
// text-align: center;
// vertical-align: middle;
// }
// .live-room table td {
// min-width: 50px;
// }
\ No newline at end of file
}
\ No newline at end of file
......@@ -53,7 +53,7 @@
<el-date-picker v-else-if="item.type === 'datePicker'" v-model="formObj[item.name]" :type="item.dateType || 'daterange'" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOption[item.pickerOptions]"></el-date-picker>
<template v-else-if="item.type === 'upload'">
<p class="photo-top-tips">{{ item.topTips }}</p>
<div v-if="!item.isDisabled">
<div v-if="!item.isDisabled" :style="{ width: item.width || '100%' }">
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h">
<div class="add">+</div>
<span class="number">{{ formObj[item.name].length }} / {{ item.maxPhotoNum }}</span>
......@@ -189,7 +189,7 @@ export default {
image.onload = () => {
var imgWidth = image.width
var imgHeight = image.height
if (!targetItem.noPixel && ( imgWidth > wdithLt || imgHeight > heightLt)) {
if (targetItem.hasPixel && (imgWidth > wdithLt || imgHeight > heightLt)) {
this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素')
} else {
targetItem.handleUpload(e, file, targetItem)
......@@ -219,7 +219,7 @@ export default {
padding: 16px 40px 0;
} */
.glsx-combi-form .isBlock {
display: block;
display: block !important;
}
/* .glsx-combi-form .el-form-item {
width: 65%;
......
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-06 10:10:44
* @LastEditors: limin
* @LastEditTime: 2021-09-06 10:11:49
* @FilePath: \scrm\scrm-sub-blog\src\components\index.js
*/
import Vue from 'vue'
// 导入权限按钮
// import _button from '@/components/glsx-button/index'
import glsxCombiForm from '@/components/glsx-combi-form/index.vue'
// Vue.component('glsx-button', _button)
Vue.component('glsx-combi-form', glsxCombiForm)
\ No newline at end of file
<!-- 关联门店弹窗 -->
<template>
<glsx-dialog title="关联门店" :isVisible.sync="relateStoreVisible" width="70%" btnOkLabel="关联" @confirmDialog="handleRelateStoreConfirm" @closeDialog="handleRelateStoreClose" class="relateStore">
<slot></slot>
<el-row>
<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 prop="merchantName" label="商户名称" align="center">
<!-- <template slot-scope="scope">
<span :class="{ red: !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage) }">{{ scope.row.yqMerchantName }}</span>
</template> -->
</el-table-column>
<!-- <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>
<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 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 style="padding: 0;" class="el-icon-delete" @click="handleDelete(scope.row)" type="text"></el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</glsx-dialog>
</template>
<script>
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'relateStoreDialog',
data() {
return {
selectedData: [],
selectingData: [],
// needTip: ['editProduct'],
// 分页
total: 0,
pageNum: 1,
pageSize: 20
}
},
props: {
relateStoreVisible: {
type: Boolean,
default: false
},
// 页面来源
// sourcePage: {
// type: String,
// default: ''
// },
storeApi: {
type: Function,
default: () => {}
},
storeSelected: {
type: Array,
default: () => []
},
storeSearchForm: {
type: Object,
default: () => {}
}
// 去掉表格中某些字段
// noTableField: {
// type: Array,
// default: () => []
// }
},
components: {
glsxDialog
},
mounted() {
this.selectedData = this.storeSelected
this.getSelectingList()
},
methods: {
selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
// if (this.sourcePage === 'editProduct') {
// isSelect = row.isSetUpgradeSettleRule
// }
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantNo + '')
this.selectingData.forEach(item => {
if (exitIds.includes(item.merchantNo)) {
this.$refs.seletingTable.toggleRowSelection(item, true)
}
})
},
getSelectingList() {
this.storeApi({
...this.storeSearchForm,
pageNum: this.pageNum,
currentPage: this.pageNum,
pageSize: this.pageSize
}).then(res => {
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
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.merchantNo === item.merchantNo)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && isExit === -1 && !isServed) {
this.selectedData.push(item)
} else if (!selection.length && isExit !== -1) {
this.selectedData.splice(isExit, 1)
}
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.merchantNo !== row.merchantNo)
this.$refs.seletingTable.toggleRowSelection(row)
},
handleCurrentChange(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() {
this.$emit('handleRelateStoreClose')
}
}
}
</script>
<style>
.relateStore .table {
margin: 0 auto 20px !important;
width: 98%;
}
/* .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;
}
.relateStore .red {
color: red;
}
.relateStore .tip-icon {
position: absolute;
display: inline-block;
height: 10px;
width: 10px;
line-height: 10px;
color: #ffffff;
background-color: red;
border: 1px solid red;
border-radius: 50%;
cursor: pointer;
font-size: 6px;
margin-left: 2px;
}
</style>
......@@ -11,6 +11,7 @@ import Vue from 'vue'
import apis from './api'
import './public-path'
import '@/assets/css/public.scss'
import '@/components'
// import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup'
Vue.config.productionTip = false
......
......@@ -2,55 +2,24 @@ const staticRoutes = Object.freeze([
{
name: 'default',
path: '/',
redirect: { name: 'liveRoom' }
redirect: { name: 'zoneList' }
},
{
name: 'MemberList',
path: '/liveMember/memberList',
component: resolve => require([`@/views/liveMember/memberList.vue`], resolve),
name: 'zoneList',
path: '/zoneList/index',
component: resolve => require([`@/views/zoneList/index.vue`], resolve),
meta: {}
},
{
name: 'commodityList',
path: '/cmmodityLibrary/commodityList',
component: resolve => require([`@/views/cmmodityLibrary/commodityList.vue`], resolve),
name: 'editZone',
path: '/zoneList/editZone',
component: resolve => require([`@/views/zoneList/editZone.vue`], resolve),
meta: {}
},
// {
// name: 'WarehousingList',
// path: '/cmmodityLibrary/warehousingList',
// component: resolve => require([`@/views/cmmodityLibrary/warehousingList.vue`], resolve),
// meta: {}
// },
{
name: 'editProduct',
path: '/cmmodityLibrary/editProduct',
component: resolve => require([`@/views/cmmodityLibrary/editProduct.vue`], resolve),
meta: {}
},
{
name: 'editProductGroup',
path: '/cmmodityLibrary/editProductGroup',
component: resolve => require([`@/views/cmmodityLibrary/editProductGroup.vue`], resolve),
meta: {}
},
{
name: 'liveRoom',
path: '/liveRoom/liveRoomList',
component: resolve => require([`@/views/liveRoom/liveRoomList.vue`], resolve),
meta: {}
},
{
name: 'editLiveRoom',
path: '/liveRoom/editLiveRoom/:addOrEdit/:id',
// component: () => import('@/views/liveRoom/editLiveRoom.vue'),
component: resolve => require([`@/views/liveRoom/editLiveRoom.vue`], resolve),
meta: {}
},
{
name: 'liveControl',
path: '/liveRoom/liveControl/:id',
component: resolve => require([`@/views/liveRoom/liveControl.vue`], resolve),
name: 'homeSet',
path: '/homeSet/index',
component: resolve => require([`@/views/homeSet/index.vue`], resolve),
meta: {}
}
])
......
......@@ -213,7 +213,7 @@ export default {
goodsId: this.selectedProInfo.id,
// name: this.selectedProInfo.goodsName,
merchantId: this.selectedProInfo.merchantId,
merchantName: this.selectedProInfo.merchantName,
merchantName: this.selectedProInfo.merchantName
// selfGoodsImageUrl: this.selectedProInfo.goodsImage
}
insertGoodApi(params).then(res => {
......
<!-- 首页设置 -->
<template>
<div class="edit-zone marketing">
<div class="container edit-container">
<div class="wechat-container">
<div class="wechat-box">
<img class="w-100-per" src="./images/home-set-head.png"/>
<img class="w-100-per" src="./images/home-set-footer.png"/>
</div>
</div>
<div>
</div>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button>
</div>
</div>
</template>
<script>
export default {
name: 'homeSet',
data() {
return {
footerLeft: '0',
footerWidth: '0',
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.getInfo()
},
methods: {
getInfo() {
this.$apis.homeSet.getHomeInfoListApi({}).then(res => {
console.log(res)
})
},
handleConfirm() { }
}
}
</script>
<style scoped>
.wechat-container {
width: 375px;
/* height: 800px; */
margin: 30px 45px 0 60px;
background: #ffffff;
position: relative;
}
.wechat-container .w-100-per {
width: 100%;
}
.wechat-container .wechat-box {
border: 1px solid #cecece;
width: 100%;
border-radius: 2px;
}
</style>
<template>
<div class="live-room">
<div class="container">
<div class="flex">
<el-form :inline="true" :model="searchForm">
<el-form-item label="成员搜索:">
<el-input :size="size" v-model="searchForm.name" placeholder="请输入微信号或者昵称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="memberRef" :getListApi="getListApi" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf">
<span slot="headingImg" slot-scope="scope">
<img class="img-60" :src="scope.scope.headingImg" />
</span>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import { getMerberList } from '@/api/modules/liveMember'
export default {
name: 'memberList',
data() {
return {
size: 'small',
searchForm: {
name: ''
},
getListApi: getMerberList,
tableParams: {
listName: 'list',
tableColumns: [
{
label: '头像',
prop: 'headingImg',
addHtml: 'headingImg'
},
{
label: '昵称',
prop: 'nickName',
line: 2
},
{
label: '微信号',
prop: 'userName',
line: 2
},
{
label: '所属角色',
prop: 'roleList',
line: 2,
formatter: cellValue => {
var txt = ''
cellValue.roleList.forEach((item, index) => {
let tempTxt = this.baseDataList.roleList.find(k => k.confId == item).confName
txt = index ? (txt + ',' + tempTxt) : tempTxt
})
return txt
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseDataList: {
roleList: [{
confId: 0,
confName: '超级管理员'
}, {
confId: 1,
confName: '管理员'
}, {
confId: 2,
confName: '主播'
}, {
confId: 3,
confName: '运营者'
}]
}
}
},
created() {},
mounted: function() {},
methods: {
beforeSearchFn() {
return new Promise(resolve => {
resolve()
})
},
handleReset() {
this.searchForm = {
name: ''
}
this.handleSearch()
},
handleSearch() {
this.$refs.memberRef.refreshTable()
}
}
}
</script>
<style lang="scss">
.table_box {
margin: 20px 0;
}
</style>
<!-- 编辑专区 -->
<template>
<div class="edit-zone marketing">
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="selectMerchant" slot-scope="item" class="select-merchant">
<el-button type="primary" @click="handleRelateStoreClose(item)">{{ editForm.merchantList.length ? '更换' : '请选择' }}</el-button>
</div>
<div slot="merchantTable" class="select-merchant">
<GLTable v-show="editForm.merchantList.length" ref="warehousListRef" :hasPage="false" :tableParams="tableParams" :tableData="editForm.merchantList">
<span slot="auth-button" slot-scope="item">
<el-button type="text" @click="handleMerchantDelete(item)">删除</el-button>
</span>
</GLTable>
</div>
</glsx-combi-form>
<relate-store-dialog v-if="relateStoreVisible" ref="relateStore" :relateStoreVisible="relateStoreVisible" :storeApi="storeApi" :storeSearchForm="storeSearchForm" :storeSelected="selectedList" @handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose">
<el-row slot>
<el-form :model="storeSearchForm" ref="relate" :inline="true" label-width="90px">
<el-form-item label="商户ID:" prop="merchantId">
<el-input :size="size" v-model.trim="storeSearchForm.merchantId" placeholder="请输入商户ID" clearable></el-input>
</el-form-item>
<el-form-item label="门店名称:" prop="merchantName">
<el-input :size="size" v-model.trim="storeSearchForm.merchantName" placeholder="请输入门店名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleSearchStore">搜索</el-button>
</el-form-item>
</el-form>
</el-row>
</relate-store-dialog>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
</div>
</div>
</template>
<script>
import relateStoreDialog from '@/components/relate-store-dialog'
export default {
name: 'editZone',
data() {
return {
size: 'small',
title: '创建专区',
titleObj: {
1: '创建专区',
2: '编辑专区'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
routeInfo: {
// 1-新增;2-编辑;3-查看
addOrEdit: 1,
id: ''
},
editForm: {
// 专区类型(1发现频道,2商城专区)
zoneType: '2',
zoneName: '',
zoneImg: '',
merchantList: []
},
editRule: {
zoneName: [{ required: true, message: '请输入专区名称', trigger: 'change' }],
zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }],
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }]
},
editFormData: [
{
label: '专区名称',
name: 'zoneName',
width: '320px',
type: 'input',
maxlength: 20
},
{
label: '专区图片',
name: 'zoneImg',
type: 'upload',
width: '320px',
limitSize: 10,
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
console.log(res)
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
}
},
{
label: '门店',
name: 'merchantList',
addHtml: 'selectMerchant'
},
{
// label: '门店',
name: '',
addHtml: 'merchantTable'
}
],
// 选择门店
relateStoreVisible: false,
storeApi: this.$apis.common.getMerchantList,
storeSearchForm: {
merchantId: '',
merchantName: ''
},
selectedList: [],
// 门店表格
tableParams: {
tableOption: true,
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
}
]
},
}
},
components: {
relateStoreDialog
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params
this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
},
methods: {
getInfo() {
this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm.zoneName = res.zoneName
this.editForm.zoneImg = res.zoneImg
this.editForm.merchantList = res.merchantRefList
this.editForm.merchantList.forEach(item => {
item.merchantNo = item.merchantId
})
})
},
// 选择门店
handleRelateStoreClose() {
this.selectedList = this.$common.utils.deepClone(this.editForm.merchantList)
this.relateStoreVisible = !this.relateStoreVisible
},
handleRelateStoreConfirm(selectedData) {
this.editForm.merchantList = selectedData
this.selectedList = selectedData
this.handleRelateStoreClose()
this.$refs.editFormRef.$refs[this.editChildRef].validateField('merchantList')
},
handleSearchStore() {
this.$refs.relateStore.handleCurrentChange(1)
},
handleMerchantDelete(obj) {
this.$messageBox.confirm('是否删除该门店?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
callback: action => {
if (action == 'confirm') {
var idx = this.editForm.merchantList.findIndex(item => item.merchantNo == obj.scope.merchantNo)
this.editForm.merchantList.splice(idx, 1)
}
}
})
},
handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
if (this.routeInfo.addOrEdit == 2) {
params.id = this.routeInfo.id
}
params.merchantList = []
// 专区类型(1发现频道,2商城专区)
params.zoneType = '2'
this.editForm.merchantList.forEach(item => {
params.merchantList.push({
merchantId: item.merchantNo,
merchantName: item.merchantName,
merchantAccountLevel: item.merchantAccountLevel
})
})
this.$apis.zoneList.insertZoneApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancel()
}
})
}
})
},
handleCancel() {
this.$router.push({
path: '/zoneList/index'
})
}
}
}
</script>
<style scoped>
.marketing.edit-zone .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
</style>
<!-- 专区管理 -->
<template>
<div class="marketing">
<div class="m-b-20">
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">新建专区</el-button>
</div>
<div class="container">
<div>
<glsx-combi-form ref="showSearch" labelWidth="90px" :formObj="searchForm" :formData="searchFormData">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary" @click="handleReset">重置</el-button>
</span>
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="zoneRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleEdit(2, scope.scope)">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
<!-- <el-button type="text" @click="handleDelete(scope.scope)">隐藏</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">显示</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">置顶</el-button> -->
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
// import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'zoneList',
data() {
return {
size: 'small',
searchForm: {
zoneName: '',
createDate: []
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '专区名称',
name: 'zoneName',
type: 'input',
maxlength: 20
},
{
label: '创建日期',
name: 'createDate',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
}
],
// 表格
getListApi: this.$apis.zoneList.getZoneList,
tableParams: {
listName: 'list',
tableOption: true,
otherOptions: {
label: '启用开关'
},
tableColumns: [
{
label: '专区名称',
prop: 'zoneName'
},
{
label: '创建日期',
prop: 'createdDate',
formatter: cellValue => {
return new Date(cellValue.createdDate).toLocaleDateString().replace(/\//g, '-')
}
},
{
label: '专区来源',
prop: ''
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
// components: {
// glsxCombiForm
// },
mounted() {},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
params.zoneType = '2' //专区类型(1发现频道,2商城专区)
if (this.searchForm.createDate.length) {
params.startTime = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endTime = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createDate
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.createDate
resolve()
})
},
// 1-新增;2-编辑
handleEdit(addOrEdit, row) {
addOrEdit == 1 ? this.$router.push('/zoneList/editZone/' + addOrEdit) : this.$router.push('/zoneList/editZone/' + addOrEdit + '/' + row.id)
},
handleDelete(row) {
this.$confirm('是否确认删除该专区?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis.zoneList.deleteZoneApi({ id: row.id }).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
}
})
}
}
})
},
handleSearch() {
this.$refs.zoneRef.refreshTable()
},
handleReset() {
this.searchForm = {
zoneName: '',
createDate: []
}
this.handleSearch()
}
}
}
</script>
<style scoped></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!