Commit 1398b7f4 by 前端

Merge branch 'v3.4.0' into 'master'

V3.4.0

See merge request !1
2 parents 508bbb6f 17f58197
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
"env": { "env": {
"node": true "node": true
}, },
"globals": {
"AMap": true
},
"extends": ["plugin:vue/essential", "@vue/prettier"], "extends": ["plugin:vue/essential", "@vue/prettier"],
"rules": { "rules": {
"no-console": "off", "no-console": "off",
......
...@@ -1130,7 +1130,6 @@ ...@@ -1130,7 +1130,6 @@
"version": "7.20.7", "version": "7.20.7",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz",
"integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==",
"dev": true,
"requires": { "requires": {
"regenerator-runtime": "^0.13.11" "regenerator-runtime": "^0.13.11"
}, },
...@@ -1138,8 +1137,23 @@ ...@@ -1138,8 +1137,23 @@
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.13.11", "version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
"dev": true }
}
},
"@babel/runtime-corejs3": {
"version": "7.20.7",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.20.7.tgz",
"integrity": "sha512-jr9lCZ4RbRQmCR28Q8U8Fu49zvFqLxTY9AMOUz+iyMohMoAgpEcVxY+wJNay99oXOpOcCTODkk70NDN2aaJEeg==",
"requires": {
"core-js-pure": "^3.25.1",
"regenerator-runtime": "^0.13.11"
},
"dependencies": {
"regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
} }
} }
}, },
...@@ -4031,6 +4045,11 @@ ...@@ -4031,6 +4045,11 @@
"browserslist": "^4.21.4" "browserslist": "^4.21.4"
} }
}, },
"core-js-pure": {
"version": "3.27.1",
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.27.1.tgz",
"integrity": "sha512-BS2NHgwwUppfeoqOXqi08mUqS5FiZpuRuJJpKsaME7kJz0xxuk0xkhDdfMIlP/zLa80krBqss1LtD7f889heAw=="
},
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
...@@ -13344,6 +13363,23 @@ ...@@ -13344,6 +13363,23 @@
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz", "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",
"integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==" "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw=="
}, },
"wangeditor": {
"version": "4.7.15",
"resolved": "https://registry.npmjs.org/wangeditor/-/wangeditor-4.7.15.tgz",
"integrity": "sha512-aPTdREd8BxXVyJ5MI+LU83FQ7u1EPd341iXIorRNYSOvoimNoZ4nPg+yn3FGbB93/owEa6buLw8wdhYnMCJQLg==",
"requires": {
"@babel/runtime": "^7.11.2",
"@babel/runtime-corejs3": "^7.11.2",
"tslib": "^2.1.0"
},
"dependencies": {
"tslib": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
"integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA=="
}
}
},
"watchpack": { "watchpack": {
"version": "1.7.5", "version": "1.7.5",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
......
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
"el-tree-transfer": "^2.2.6", "el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5", "element-ui": "^2.4.5",
"glsx-common": "^1.4.6", "glsx-common": "^1.4.6",
"glsx-components": "^1.2.5", "glsx-components": "^1.5.4",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuex": "^3.1.2" "vuex": "^3.1.2",
"wangeditor": "^4.7.15"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0", "@vue/cli-plugin-babel": "^4.1.0",
......
<template> <template>
<div id="app"> <div id="app">
<!-- <h2>
报表子应用
<span class="right"></span>
</h2>
<div id="nav">
<span>切换路由:</span>
<el-button-group class="right">
<el-button type="primary" size="medium" @click="routerChange('/')">报表</el-button>
<el-button type="primary" size="medium" @click="routerChange('/about')">穿梭框</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-1')">表格</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-2')">日历</el-button>
<el-button type="primary" size="medium" @click="toAppReport('3-1')">aaaa</el-button>
</el-button-group>
</div>
<div class="parent-child-communication">
<h3>父子应用通信:</h3>
<div style="margin-bottom: 20px;">
<span>rxjs通信方案:</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('rxjs')">通知父应用变天了</el-button>
</div>
<div>
<span>官方通信方案:</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('default')">通知父应用收到</el-button>
</div>
<img src="./assets/logo.png" alt="" srcset="" />
</div>-->
<router-view /> <router-view />
</div> </div>
</template> </template>
......
import { http } from '@/main'
const url = 'rop-scrm-shopmall/router'
// 分页查询频道列表
const getChannelListApi = params => {
params.method = `scrm.api.shopmall.discover.channel.page`
return http({
url,
method: 'post',
data: params,
sign: true
})
}
// 频道详情
const getChannelDetail = params => {
params.method = `scrm.api.shopmall.discover.channel.detail`
return http({
url,
method: 'post',
data: params,
sign: true,
returnAll: true
})
}
// 新增或编辑频道
const updateChannel = params => {
params.method = `scrm.api.shopmall.discover.channel.add.or.update`
return http({
url,
method: 'post',
data: params,
sign: true,
returnAll: true
})
}
// 门店频道详情
const getMerchantChannelDetail = params => {
params.method = `scrm.api.shopmall.discover.channel.merchant.detail`
return http({
url,
method: 'post',
data: params,
sign: true,
returnAll: true
})
}
// 新增或编辑门店频道
const updateMerchantChannel = params => {
params.method = `scrm.api.shopmall.discover.channel.merchant.add.or.update`
return http({
url,
method: 'post',
data: params,
sign: true,
returnAll: true
})
}
// 开通订阅
const openSubscribe = params => {
params.method = `entmicro.api.system.subscribe.open`
return http({
url,
method: 'post',
data: params,
sign: true,
returnAll: true
})
}
//查询商户配置
const selStoreConfig = params => {
params.method = `scrm.api.equity.service.merchant.pagination.list.get`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
returnAll: true
})
}
// 关联活动
const correlateActivity = params => {
params.method = `entmicro.api.system.subscribe.activity.correlate`
return http({
url,
method: 'POST',
data: params,
returnAll: true
})
}
const getActivityList = params => {
params.method = `scrm.api.shopmall.select.bulge.activity.page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
returnAll: true
})
}
// 更改商户开通状态
const updateState = params => {
params.method = `entmicro.api.system.subscribe.state.update`
return http({
url,
method: 'POST',
data: params,
returnAll: true
})
}
// 生成救援贴
const generateRescueCode = params => {
params.method = `entmicro.api.system.subscribe.rescue.generate`
return http({
url,
method: 'POST',
data: params,
returnAll: true
})
}
// 订阅开通商户分页查询
const subscribeMerchant = params => {
params.method = `entmicro.api.system.subscribe.merchant.page`
return http({
url,
method: 'POST',
data: params,
returnAll: true
})
}
export default { updateMerchantChannel,getMerchantChannelDetail,subscribeMerchant, generateRescueCode, updateState, getActivityList, getChannelListApi, openSubscribe, selStoreConfig, getChannelDetail, updateChannel, correlateActivity }
import { http, http_common, http2, http_merchant } from '@/main'
const defaultPath = 'scrm.api.carlife.'
const uploadImgApi = params => {
params.method = `${defaultPath}common.uploadImg`
return http({
url: 'rop-scrm-carlife/router',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
const uploadVideoApi = params => {
params.method = `${defaultPath}common.uploadVideo`
return http({
url: 'rop-scrm-carlife/router',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
const pictureUpload = params => {
params.method = 'glsx.accounts.biz.common.pictureUpload'
return http_common({
url: '/router?method=glsx.accounts.biz.common.pictureUpload',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
const getMerchantList = params => {
params.method = `${defaultPath}merchant.listWithPageByCurMerchant`
return http({
url: 'rop-scrm-carlife/router',
method: 'POST',
data: params,
sign: true
})
}
// const pictureUpload = params => {
// params.method = 'glsx.accounts.biz.common.pictureUpload'
// return http_common({
// url: '/router?method=glsx.accounts.biz.common.pictureUpload',
// method: 'POST',
// data: params,
// sign: true,
// noSignAttr: ['file']
// })
// }
export default { uploadImgApi, uploadVideoApi,getMerchantList,pictureUpload }
import { http } from '@/main'
const url = 'rop-scrm-shopmall/router'
// 门店频道-门店列表
const getMerchantListApi = params => {
params.method = `scrm.api.shopmall.discover.channel.merchant.list`
return http({
url,
method: 'post',
data: params,
sign: true
})
}
// 门店频道分享
const getMerchantShare = params => {
params.method = `scrm.api.shopmall.discover.channel.merchant.shared`
return http({
url,
method: 'post',
data: params,
sign: true
})
}
// 新增或编辑门店频道
const configMerchant = params => {
params.method = `scrm.api.shopmall.discover.channel.merchant.config`
return http({
url,
method: 'post',
data: params,
sign: true,
returnAll: true
})
}
// 开通订阅
const openSubscribe = params => {
params.method = `entmicro.api.system.subscribe.open`
return http({
url,
method: 'post',
data: params,
sign: true,
returnAll: true
})
}
//查询商户配置
const selStoreConfig = params => {
params.method = `scrm.api.equity.service.merchant.pagination.list.get`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
returnAll: true
})
}
// 获取门店频道配置
const getconfigMerchant = params => {
params.method = `scrm.api.shopmall.discover.channel.merchant.getconfig`
return http({
url,
method: 'POST',
data: params
})
}
// 分页查询频道主题(内容)列表
const getChannelTopicList = params => {
params.method = `scrm.api.shopmall.discover.channel.topic.page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
returnAll: true
})
}
// 频道主题详情
const getTopicDetail = params => {
params.method = `scrm.api.shopmall.discover.channel.topic.detail`
return http({
url,
method: 'POST',
data: params,
returnAll: true
})
}
// 新增或编辑频道主题
const addChannelTopic = params => {
params.method = `scrm.api.shopmall.discover.channel.topic.add.or.update`
return http({
url,
method: 'POST',
data: params,
returnAll: true
})
}
// 媒体文件列表
const getTencentcloudmedialist = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.list`
return http({
url,
method: 'POST',
data: params,
returnAll: true
})
}
//膨胀金活动
const bulgeActivity = params => {
params.method = 'scrm.api.shopmall.bulge.activity.page'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//众筹活动
const crowdfundingActivity = params => {
params.method = 'scrm.api.shopmall.all.crowdfunding.activity.page'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//商品
const goodsActivity = params => {
params.method = 'scrm.api.shopmall.goods.page.allMerchant'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
// 频道主题(内容)-置顶
const topshelvesChannel = params => {
params.method = 'scrm.api.shopmall.discover.channel.topic.topshelves'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 频道主题(内容)-上下架
const updownshelvesChannel = params => {
params.method = 'scrm.api.shopmall.discover.channel.topic.updownshelves'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 删除频道主题(内容)
const deleteChannel = params => {
params.method = 'scrm.api.shopmall.discover.channel.topic.delete'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 膜类专区-配置券
const configCoupons = params => {
params.method = 'scrm.api.shopmall.discover.channel.topic.configcoupons'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 编辑-选择定向礼包列表
const getDirectionalGiftListApi = params => {
params.method = 'scrm.api.coupon.gh.group.equity.coupon.list'
// params.method = 'scrm.api.coupon.gh.group.equity.coupon.list'
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
// 获取膜类专区-配置券
const getCouponconfig = params => {
params.method = 'scrm.api.shopmall.discover.channel.topic.getcouponconfig'
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true,
returnAll: true
})
}
export default { getCouponconfig, configCoupons, getDirectionalGiftListApi, deleteChannel, updownshelvesChannel, topshelvesChannel, goodsActivity, crowdfundingActivity, bulgeActivity, getTencentcloudmedialist, addChannelTopic, getTopicDetail, getChannelTopicList, getMerchantListApi, openSubscribe, selStoreConfig, getMerchantShare, configMerchant, getconfigMerchant }
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.'
const getZoneListApi = 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: 'POST',
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: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getZoneListApi, deleteZoneApi, getZoneInfoApi, insertZoneApi }
...@@ -5,19 +5,137 @@ html { ...@@ -5,19 +5,137 @@ html {
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
background-color: #F4F5FA; background-color: #f4f5fa;
} }
.marketing .container { .container {
background: #ffffff; background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px; padding: 20px;
} }
.marketing .m-b-20 { .m-b-20 {
margin-bottom: 20px; margin-bottom: 20px;
} }
.marketing.p-t-20 { .p-t-20 {
padding-top: 20px; padding-top: 20px;
}
\ No newline at end of file \ No newline at end of file
}
.container {
background: #ffffff;
padding: 20px;
}
.word-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.flex {
display: flex;
align-items: center;
}
.mgt15 {
margin-top: 15px;
}
.mgt16 {
margin-top: 16px;
}
.mrt5 {
margin-top: 5px;
}
.text-tip {
font-weight: 400;
font-size: 14px;
color: #999999;
margin-left: 154px;
margin-bottom: 10px;
}
.text-tip-line {
font-weight: 400;
font-size: 14px;
color: #999999;
}
.img-36 {
width: 36px;
height: 36px;
}
.pointer {
cursor: pointer;
}
.activity-box {
width: 248px;
height: auto;
background: #f5f5f5;
border-radius: 2px;
padding: 10px 12px;
box-sizing: border-box;
margin-top: 10px;
position: relative;
.activity-box-title {
font-weight: 600;
font-size: 14px;
color: #333333;
margin-bottom: 10px;
line-height: 20px;
}
.time {
font-weight: 400;
font-size: 12px;
color: #999999;
margin-bottom: 4px;
line-height: 17px;
}
.gift {
position: absolute;
bottom: 0;
width: 24px;
height: 24px;
right: 0;
img {
width: 100%;
}
}
}
.goodss-box {
width: 248px !important;
padding: 16px;
box-sizing: border-box;
background: #f9f9f9;
border-radius: 4px;
display: flex;
align-items: center;
margin-top: 10px;
}
.theme-color {
color: #5850ff;
}
.flex-default {
display: flex;
}
.goods-img {
width: 60px;
height: 60px;
border-radius: 2px;
margin-right: 8px;
img {
width: 100%;
height: 100%;
}
}
.goods-title {
font-size: 14px;
color: #333333;
line-height: 21px;
}
.goods-price {
color: #999999;
font-size: 12px;
font-weight: 400;
line-height: 17px;
margin-top: 4px;
}
.table-popover-img {
width: 120px;
}
.mrb20{
margin-bottom :20px !important;;
}
<template>
<div class="square-main">
<GLDialog bigTitle="选择活动" :append-to-body="true" :hasFooter="true" :visible.sync="dialogVisible" width="1098px" mode="big">
<div class="model-panel" v-loading="loading">
<div class="model-panel-tab">
<el-tabs v-model="activeName" @tab-click="handleClick">
<template v-for="(item, index) in activityList">
<el-tab-pane :label="item.itemName" :name="item.itemValue" :key="index"></el-tab-pane>
</template>
</el-tabs>
</div>
<div class="model-item-panel" v-if="modelList.length > 0">
<div class="model-item" :class="{ checked: selectItem == item, 'goods-box': selectType == 'goods' }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<div class="item-icon" v-if="selectItem == item"><i class="el-icon-check"></i></div>
<div class="item-icon-b" v-else>
<img src="@/assets/channel/gift.png" alt="" v-if="selectType !== 'goods'" />
<!-- <img src="@/assets/channel/gift.png" alt="" v-else /> -->
</div>
<template v-if="selectType == 'card'">
<div class="model-item-title" :title="item.equityName">{{ item.equityName }}</div>
<div class="model-item-content">领取方式:免费领用</div>
<div class="model-item-content"></div>
<div class="model-item-content model-item-contents">
试用天数:
<span>{{ item.freeDay }}天</span>
</div>
</template>
<template v-else-if="selectType == 'package'">
<div class="model-item-title" :title="item.packageName">{{ item.packageName }}</div>
<div class="model-item-content">领取方式:付费购买</div>
<div class="model-item-content"></div>
<div class="model-item-content model-item-contents">
销售价格:
<span>{{ item.packagePrice }}元</span>
</div>
</template>
<template v-else-if="selectType == 'coupon'">
<div class="model-item-title" :title="item.couponName">{{ item.couponName }}</div>
<div class="model-item-content" v-if="item.effectiveType == 3">有效期:无限制</div>
<div class="model-item-content" v-if="item.effectiveType == 6">有效期:{{ item.effectiveDays }}天</div>
<div class="model-item-content" v-if="item.effectiveType == 2">有效期:{{ item.effectiveStartTime ? item.effectiveStartTime.split(' ')[0] : '' }}~{{ item.effectiveEndTime ? item.effectiveEndTime.split(' ')[0] : '' }}</div>
<div class="model-item-content">
使用途径:
{{ item.useChannel == 1 ? '线上商品' : '到店核销' }}
</div>
<div class="model-item-content model-item-contents">
数量:
<span>{{ item.residueAmount }}</span>
</div>
</template>
<template v-else-if="selectType == 'activity'">
<div class="model-item-title" :title="item.activityName">{{ item.activityName }}</div>
<div class="model-item-content"></div>
<div class="model-item-content">
开始时间:
{{ item.startTime }}
</div>
<div class="model-item-content">
结束时间:
{{ item.endTime }}
</div>
</template>
<template v-else-if="selectType == 'crowdfunding' || selectType == 'bulge'">
<div class="model-item-title" :title="item.activityName">{{ item.activityName }}</div>
<div class="model-item-content"></div>
<div class="model-item-content">开始时间:{{ item.startTime }}</div>
<div class="model-item-content">结束时间:{{ item.endTime }}</div>
</template>
<template v-else-if="selectType == 'goods'">
<div class="goods-img">
<img :src="item.goodsImage" />
</div>
<div>
<div class="goods-title">{{ item.goodsName }}</div>
<div class="goods-price">
价格/元:
<span class="theme-color">{{Number(item.originalPrice)/100}}</span>
</div>
</div>
</template>
<template v-else>
<div class="model-item-title" :title="item.couponName">{{ item.equityName }}</div>
<div class="model-item-content">获取方式:需先购买无忧服务套餐</div>
<div class="model-item-content">获取限制:每个服务套餐限领一次</div>
<div class="model-item-content model-item-weight">
赠送天数:
<span>{{ item.effectiveType == 2 ? item.effectivedDay + '天' : '永久有效' }}</span>
</div>
</template>
</div>
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="@/assets/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination v-if="selectType != 'card' && selectType != 'merchant'" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[12, 24, 36, 48]" :page-size="pageSize" :total="tableTotal" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelect" v-show="modelList.length">确 定</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && selectType == 'coupon' && memberMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && selectType == 'package' && couponMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && selectType == 'activity' && activityMenu">立即添加</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
import { mapState } from 'vuex'
const openUrl = function (url) {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
link.rel = 'opener'
link.click()
}
export default {
name: 'ActivityModel',
data() {
return {
dialogVisible: false,
couponMenu: false,
loading: false,
activeName: 1,
modelList: [],
pageNum: 1,
pageSize: 12,
tableTotal: 0,
openFlag: 0,
selectItem: {
id: ''
}
}
},
props: {
activityList: {
type: Array,
default: () => []
}
},
computed: {
...mapState({
merchantId: state => state.channel.merchantId
}),
selectType() {
return this.activityList.length ? this.activityList.find(act => act.itemValue == this.activeName).itemType : ''
}
},
methods: {
handleSelectItem(item) {
// console.log(item, 'item')
this.selectItem = item
if (item.equityClassId) {
this.selectItem.id = item.equityClassId
}
// console.log(this.selectItem)
},
handleSelect() {
if (!this.selectItem.id) {
this.$message({
type: 'error',
message: '请选择活动'
})
return
}
this.dialogVisible = false
const marketingId = this.selectItem.id ? this.selectItem.id : this.selectItem.equityClassId
const marketingName = this.selectType == 'card' ? this.selectItem.equityName : this.selectType == 'package' ? this.selectItem.packageName : this.selectType == 'activity' || this.selectType == 'crowdfunding' ? this.selectItem.activityName : this.selectType == 'coupon' ? this.selectItem.couponName : this.selectItem.equityName
const { activityPrice, goodsImage, crowdFundingPrice, originalPrice, goodsName, retailPrice, equityName, packageName, couponName, activityName, effectivedDay, effectiveType, endTime, startTime, residueAmount, packagePrice, freeDay } = this.selectItem
const otherContent = { goodsImage, crowdFundingPrice, originalPrice, retailPrice, goodsName, equityName, packageName, couponName, activityName, effectivedDay, effectiveType, endTime, startTime, residueAmount, packagePrice, freeDay }
const marketingContent = { ...otherContent, selectType: this.selectType }
const params = {}
if (this.selectType == 'crowdfunding') {
params.url = this.selectItem.url
params.desc = this.selectItem.promotion
params.title = this.selectItem.forwardTitle
params.picurl = this.selectItem.activityImg
}
this.$emit('selectActivity', { activeName:this.activeName,marketingId, activityPrice, marketingType: this.activeName, marketingName, marketingContent, ...params })
},
handleSizeChange(val) {
this.pageSize = val
this.getModelList()
},
handleCurrentChange(val) {
this.pageNum = val
this.getModelList()
},
handleOpen() {
let url
switch (this.selectType) {
case 'coupon':
url = '/marketing/couponManage/index'
break
case 'package':
url = '/marketing/memberCenter/setmealAddUpdate?%24title=%25E5%2588%259B%25E5%25BB%25BA%25E5%25A5%2597%25E9%25A4%2590'
break
case 'activity':
url = '/marketing/seckillActivity/editActivity/1'
break
}
openUrl(location.origin + url)
this.dialogVisible = false
},
getModelList() {
this.modelList = []
this.loading = true
let params = {
pageSize: this.pageSize,
pageNum: this.pageNum,
merchantId:this.merchantId
}
const activityChecked = this.activityList.find(act => act.itemValue == this.activeName)
if (activityChecked && activityChecked.params && activityChecked.params.currentPage) {
// console.log(activityChecked.params.currentPage)
activityChecked.params.currentPage = this.pageNum
}
Object.assign(params, activityChecked.params)
activityChecked
.getInterfaceApi(params)
.then(res => {
this.modelList = res.list ? res.list : res.data ? res.data : res
this.tableTotal = res.total ? res.total : 0
this.loading = false
})
.catch(() => {
this.loading = false
})
},
merchantOpen() {
let channel = null
if (location.host == 'scrm.cgacar.com') {
channel = 2
}
const activityMerchant = this.activityList.find(act => act.itemType == 'merchant')
let params = { channel, ...activityMerchant.merchantOpen.params }
activityMerchant.merchantOpen.merchantOpenApi(params).then(res => {
this.openFlag = res.openFlag
})
},
init() {
this.dialogVisible = true
this.getModelList()
this.selectItem = {}
},
handleClick() {
this.getModelList()
}
}
}
</script>
<style lang="scss" scoped>
.square-main {
/deep/ {
.el-dialog__footer {
text-align: center;
}
.el-dialog__body {
padding: 14px 30px 20px;
}
}
}
.model-panel {
.model-panel-tab {
margin-bottom: 18px;
label {
// font-size: 16px;
// font-weight: 400;
// color: #000000;
// line-height: 24px;
}
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
.el-tabs__nav {
// border: 0;
}
.el-tabs__header {
// border: 0;
// background-color: #f4f6fc;
// margin: 0px;
}
.el-tabs__item {
// border: none;
// width: 180px;
// height: 32px;
// line-height: 32px;
// margin: 2px;
// text-align: center;
}
.el-tabs__item.is-active {
font-weight: 600;
padding: 0 20px;
border-bottom: 2px solid #5850ff;
}
}
}
.model-item-empty {
> img {
display: block;
margin: 50px auto 0px;
width: 60px;
height: auto;
}
.empty-item {
text-align: center;
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
margin-bottom: 30px;
}
}
.model-item-panel {
// display: grid;
// grid-template-columns: repeat(4, 25%);
// grid-row-gap: 10px;
max-height: 38vh;
overflow: auto;
display: flex;
flex-wrap: wrap;
align-items: stretch;
flex-direction: row;
.model-item {
width: 248px;
margin-right: 16px;
margin-bottom: 16px;
position: relative;
height: 128px;
background: #f9f9f9;
border-radius: 4px;
padding: 14px 16px;
box-sizing: border-box;
.item-icon {
position: absolute;
right: 0px;
bottom: 0px;
width: 16px;
height: 16px;
background: #5850ff;
border-radius: 4px 0px 0px 0px;
display: flex;
justify-content: center;
align-items: center;
i {
color: #fff;
}
}
.item-icon-b {
position: absolute;
right: -1px;
bottom: -1px;
img {
width: 30px;
height: 30px;
}
}
&:nth-child(4n) {
margin-right: 0px;
}
&.checked {
border: 2px solid #5850ff;
}
&-qrcode {
position: absolute;
right: 10px;
bottom: 10px;
width: 60px;
height: 60px;
border: 1px solid #979797;
}
&-title {
font-size: 16px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-bottom: 5px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
&-content {
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 16px;
height: 16px;
margin-top: 6px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
&.model-item-weight {
line-height: 20px;
height: 20px;
}
span {
color: #5850ff;
font-size: 20px;
}
}
&-contents {
line-height: 22px;
height: 22px;
}
}
}
}
.goods-box {
width: 248px !important;
padding: 16px;
box-sizing: border-box;
background: #f9f9f9;
border-radius: 4px;
display: flex;
align-items: center;
}
</style>
<template> <template>
<div class="report-home"> <div class="view-panel">
HOME <img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<GLButton type="danger" @click="test()" class="test555" id="1-1-1-1" mode="link">权限按钮测试</GLButton> <video width="100%" autoplay controls :src="dialogSrc" v-else></video>
<GLButton type="success" size="small" @click="test()" id="1-1-1-1" class="test">权限按钮测试2</GLButton>
<el-button class="test" @click="test()">东方网分</el-button>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'home', name: 'view',
data() {
return {
dialogVisibleImg: true
}
},
props: {
dialogType: String,
dialogSrc: String
},
methods: { methods: {
test() { test() {
console.log('点击了按钮') console.log('点击了按钮')
...@@ -17,4 +23,4 @@ export default { ...@@ -17,4 +23,4 @@ export default {
} }
} }
} }
</script> </script>
\ No newline at end of file \ No newline at end of file
/**
* 时间控件-限制月份
*/
export const beforeRangePickerOptions = {
disabledDate(date) {
if (date > new Date()) {
return true
}
return false
}
}
export const afterRangePickerOptions = {
disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
if (date < yesterday) {
return true
}
return false
}
}
<!-- 搜索 -->
<template>
<div :class="['glsx-combi-form', isEdit ? 'gl-form-page' : '']">
<el-form :ref="formRef" :inline="true" :model="formObj" :rules="formRules" size="small" class="glsx-combi-form-block">
<template v-for="(item, index) in formData">
<el-form-item v-if="!item.isHide" :key="index" :id="item.name" :labelWidth="isEdit ? '154px' : labelWidth" :class="[{ 'no-label': !item.label, isBlock: isBlock }, { textBox: item.type == 'textBox' }]" :style="{ 'margin-bottom': isEdit ? '24px' : '', 'margin-right': isEdit ? '0px' : '30px', ...item.style }" :label="item.label" :prop="item.name">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
<span class="tips-label">{{ item.label }}</span>
<el-popover placement="top" width="200" trigger="hover" :content="item.tips">
<img slot="reference" class="tips-icon" src="./images/icon-tip.png" />
</el-popover>
:
</span>
<span v-else-if="!item.isHide && item.label && !item.tips" slot="label">
<span class="combi-form-label" :style="{ width: item.labelWidth || labelWidth }">{{ item.label }}:</span>
</span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<span v-else-if="item.type === 'showTxt'">{{ formObj[item.name] }}</span>
<div v-else-if="item.type === 'input'">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :prefix-icon="item.prefixIcon" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || defaultWidth }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)">
<span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span>
<span v-if="item.append" slot="suffix">{{ item.append }}</span>
</el-input>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<!-- 选择框 -->
<div v-else-if="item.type === 'select'">
<el-select :style="{ width: item.width || defaultWidth }" v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :clearable="item.isClear || false" :placeholder="item.placeholder || '请选择' + item.label" :filterable="!item.noFilter" :disabled="item.isDisabled" :no-data-text="item.noDataText || '无数据'" :multiple="item.multiple || false" :collapse-tags="item.collapseTags || true" @change="selectAddAttr($event, item)">
<el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]" :disabled="subItem.isDisabled || false"></el-option>
</el-select>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<!-- radio -->
<div v-else-if="item.type === 'radio'">
<el-radio-group v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :disabled="item.isDisabled" @change="item.handleRadioChange">
<el-radio v-for="subItem in item.optionList" :key="subItem[item.optionId]" :disabled="subItem.isDisabled" :label="subItem[item.optionId]">
{{ subItem[item.optionLabel] }}
<slot :name="subItem.suffixSonSlot" :scope="subItem"></slot>
</el-radio>
</el-radio-group>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<el-date-picker v-else-if="item.type === 'datePicker'" v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :type="item.dateType || 'daterange'" :disabled="item.isDisabled" :value-format="item.valueFormat" :style="{ width: item.width || defaultWidth }" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="item.customPickerOptions || pickerOption[item.pickerOptions]"></el-date-picker>
<template v-else-if="item.type === 'upload'">
<p class="photo-top-tips">{{ item.topTips }}</p>
<slot :name="item.prefixSlot" :scope="item"></slot>
<div v-if="!item.isDisabled" :style="{ width: item.width || defaultWidth }">
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<div class="add" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('addStyle') ? item.uploadStyle.addStyle : ''">+</div>
<!-- <span v-if="item.maxPhotoNum > 1" class="number">{{ formObj[item.name].length }}/{{ item.maxPhotoNum }}</span> -->
<span class="number" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('fontSize') ? item.uploadStyle.fontSize : ''">上传{{ item.uploadType == 'video' ? '视频' : '图片' }}</span>
<input v-if="item.uploadType == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" accept="video/mp4" @change="e => handleUploadChange(e, item)" />
<input v-else type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleUploadChange(e, item)" />
</div>
</div>
<template>
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length : formObj[item.name]">
<span v-if="Array.isArray(formObj[item.name])">
<span v-for="(subItem, subIndex) in formObj[item.name]" :key="subIndex" class="muti-imgs img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<video v-if="item.uploadType == 'video'" class="img-w-h activity-img" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="typeof subItem == 'object' ? subItem.content : subItem"></video>
<img v-else class="img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="typeof subItem == 'object' ? subItem.content : subItem" />
<span class="img-btns" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<span class="btn-item">
<i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item, subIndex)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(typeof subItem == 'object' ? subItem.content : subItem, item)"></i>
</span>
</span>
</span>
</span>
<span v-else class="muti-imgs">
<video v-if="item.uploadType == 'video'" class="img-w-h activity-img" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="formObj[item.name]"></video>
<img v-else class="img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="formObj[item.name]" />
<span class="img-btns" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<span class="btn-item">
<i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(formObj[item.name], item)"></i>
</span>
</span>
</span>
</div>
</template>
<slot :name="item.suffixSlot" :scope="item"></slot>
</template>
<!-- 图文编辑器 -->
<textBox v-else-if="item.type === 'textBox'" :ref="item.name + 'TextBox'" :excludeMenus="item.excludeMenus || ['code']" @change="e => handleTextBoxChange(e, item)" @focus="handleTextBoxFocus(item)" :boxHeight="item.boxHeight"></textBox>
<!-- 地图 -->
<div v-else-if="item.type === 'map'" class="flex">
<Province ref="provinceForm" :subdistrict="subdistrict" :isDisabled="item.isDisabled" @selectProvince="e => handleSelectProvince(e, item)" @selectCity="e => handleSelectCity(e, item)" :provinceView="item.provinceView"></Province>
<el-input style="flex: 1;" v-model="formObj[item.name]" placeholder="请选择商户地址" :readonly="item.isReadonly"></el-input>
<el-button class="m-l-10" v-show="!item.isDisabled" @click="handleSelectMap(item)" type="primary">选择地址</el-button>
</div>
</el-form-item>
</template>
<slot name="footer"></slot>
</el-form>
<GLDialog v-if="isImgVisible" bigTitle="查看" mode="big" :visible.sync="isImgVisible" :close-on-click-modal="false" @onOk="isImgVisible = false" @onCancel="isImgVisible = false">
<div class="dialog-look">
<video v-if="dialogObj.uploadType == 'video'" class="dialog-video" controls>
<source :src="dialogObj.url" type="video/mp4" />
</video>
<img v-else class="dialog-img" width="100%" :src="dialogObj.url" alt="" />
</div>
</GLDialog>
<GLDialog bigTitle="选择地址" mode="big" :visible.sync="dialogMapVisible" @onOk="getAddress" @onCancel="dialogMapVisible = false">
<map-view v-if="dialogMapVisible" ref="mapForm"></map-view>
<!-- <span slot="footer" class="dialog-footer">
<el-button @click="">取 消</el-button>
<el-button type="primary" @click="getAddress">确 定</el-button>
</span> -->
</GLDialog>
</div>
</template>
<script>
import textBox from '../textBox/index.vue'
import Province from './provinceCity.vue'
// import mapView from './mapView.vue'
import { beforeRangePickerOptions, afterRangePickerOptions } from './common'
export default {
name: 'glsx-combi-form',
data() {
return {
pickerOption: {
beforeRangePickerOptions: beforeRangePickerOptions,
afterRangePickerOptions: afterRangePickerOptions
},
subdistrict: 2,
dialogMapVisible: false,
targetItem: {},
isImgVisible: false,
dialogObj: {
url: '',
uploadType: 'img'
}
}
},
props: {
isBlock: {
type: Boolean,
default: false
},
defaultWidth: {
type: String,
default: '432px'
},
formRef: {
type: String,
default: 'formRef'
},
isEdit: {
type: Boolean,
default: false
},
labelWidth: {
type: String,
// 默认是四个字符长度
default: '154px'
},
formData: {
type: Array,
default: () => []
},
formObj: {
type: Object,
default: () => {}
},
hasTitle: {
type: Boolean,
default: true
},
formRules: {
type: Object,
default: () => {}
},
// 搜索+输入框/搜索组合组件,搜索栏绑值
searchSelectObj: {
type: Object,
default: () => {}
}
},
components: {
textBox,
Province,
// mapView
},
mounted() {},
methods: {
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
targetItem.changeAttr && targetItem.changeAttr(value, targetItem)
},
handleInputDown(e, item) {
if (e.keyCode === 13 && item.hasOwnProperty('keyFn')) {
item.keyFn()
}
},
handleInputBlur(e, item) {
item.inputBlur && item.inputBlur(e, item)
},
// 图片
handleUploadChange(e, targetItem) {
var reader = new FileReader()
var file = e.srcElement.files[0]
var uploadType = targetItem.uploadType || 'img',
IMGTYPE = ['image/jpeg', 'image/png', 'image/jpg']
if (targetItem.supportGif) IMGTYPE.push('image/gif')
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
const isType = uploadType == 'img' ? IMGTYPE.includes(file.type) : ['video/mp4'].includes(file.type)
const maxPhotoNum = targetItem.maxPhotoNum || 1
const wdithLt = targetItem.wdithLt || 300
const heightLt = targetItem.heightLt || 300
if (Array.isArray(this.formObj[targetItem.name]) && maxPhotoNum == this.formObj[targetItem.name].length) {
this.$message.error('只能上传' + maxPhotoNum + (uploadType == 'img' ? '张图片' : '个视频'))
document.getElementById(targetItem.name + 'file').value = ''
return true
}
if (!isType) {
this.$message.error(uploadType == 'img' ? '上传图片不是jpg、jpeg或png的格式!' : '上传视频不是MP4的格式!')
document.getElementById(targetItem.name + 'file').value = ''
return true
}
if (!isLt) {
this.$message.error('上传' + (uploadType == 'img' ? '图片' : '视频') + '大小不能超过' + limitSize + 'MB!')
document.getElementById(targetItem.name + 'file').value = ''
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
if (uploadType == 'img') {
var image = new Image()
image.src = e.target.result
image.onload = () => {
var imgWidth = image.width
var imgHeight = image.height
if (targetItem.hasPixel && (imgWidth > wdithLt || imgHeight > heightLt)) {
this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素')
} else {
targetItem.handleUpload(e, file, targetItem, this.formObj)
}
}
} else {
targetItem.handleUpload(e, file, targetItem, this.formObj)
}
}
document.getElementById(targetItem.name + 'file').value = ''
},
// 图片删除
handleImgDelete(targetItem, subIndex = -1) {
Array.isArray(this.formObj[targetItem.name]) ? this.formObj[targetItem.name].splice(subIndex, 1) : (this.formObj[targetItem.name] = '')
targetItem.handleDelete && targetItem.handleDelete(subIndex)
// this.$emit('handleImgDelete', targetItem)
},
// 图片查看
handleImgLook(src, targetItem) {
this.isImgVisible = true
this.dialogObj = {
url: src,
uploadType: targetItem.uploadType || 'img'
}
},
// 获取富文本框内容
handleTextBoxChange(val, targetItem) {
this.formObj[targetItem.name] = val
},
handleTextBoxFocus(targetItem) {
this.$refs[targetItem.name + 'TextBox'][0].setEdit(this.formObj[targetItem.name])
},
// 禁用富文本
forbidEdit() {
this.$refs.textBox.forbidEdit()
},
// 地图
handleSelectMap(targetItem) {
this.targetItem = targetItem
this.dialogMapVisible = true
this.$nextTick(() => {
if (this.formObj[targetItem.attrObj.fullAddress] && !this.$refs.mapForm.address) {
this.$refs.mapForm.address = this.formObj[targetItem.attrObj.fullAddress]
this.$refs.mapForm.lnglat = this.formObj[targetItem.attrObj.lng] ? [this.formObj[targetItem.attrObj.lng], this.formObj[targetItem.attrObj.lat]] : []
// this.$refs.mapForm.addMarker([this.formObj[targetItem.attrObj.lng], this.formObj[targetItem.attrObj.lat]])
}
})
},
getAddress() {
let mapInfo = this.$refs.mapForm
if (!mapInfo.address) {
this.$message({
message: '请选择地址',
type: 'error',
customClass: 'message-Z-zinde'
})
return
}
this.formObj[this.targetItem.attrObj.fullAddress] = mapInfo.address
this.formObj[this.targetItem.attrObj.lat] = mapInfo.lnglat[1]
this.formObj[this.targetItem.attrObj.lng] = mapInfo.lnglat[0]
// var fullAddress = mapInfo.geocoderAddress.addressComponent || this.formObj[this.targetItem.attrObj.fullAddress]
var fullAddress = mapInfo.geocoderAddress.addressComponent
// if (!fullAddress) {
// this.dialogMapVisible = false
// return
// }
var provincecode = mapInfo.geocoderAddress.adcode || this.formObj[this.targetItem.attrObj.provinceCode]
this.formObj[this.targetItem.attrObj.provinceCode] = provincecode
// 获取省市
var province = ''
var city = ''
province = fullAddress.province
city = fullAddress.city ? fullAddress.city : fullAddress.district
const municipalities = ['北京市', '天津市', '上海市', '重庆市']
var municipality = municipalities.find(item => item == province)
if (municipality) {
city = city.slice(0, 2) + '城区'
if (municipality === '重庆市') {
provincecode = provincecode.slice(0, 4)
provincecode == 5001 ? (city = city.slice(0, 2) + '城区') : (city = city.slice(0, 2) + '郊县')
}
}
// 判断省市是否匹配
if (this.formObj[this.targetItem.attrObj.provinceName]) {
if (this.formObj[this.targetItem.attrObj.provinceName] !== province && this.formObj[this.targetItem.attrObj.cityName] !== city) {
this.$message({
message: '您选择的地址错误,请重新选择',
type: 'error',
customClass: 'message-Z-zinde'
})
this.formObj[this.formObj[this.targetItem.attrObj.fullAddress]] = ''
return
}
}
this.dialogMapVisible = false
this.formObj[this.targetItem.attrObj.provinceName] = province
this.formObj[this.targetItem.attrObj.cityName] = city
// 当直接点击选择地址时,获取省市ID
this.$refs.provinceForm[0].init(province, city)
},
// 获取省
handleSelectProvince(val, targetItem) {
this.formObj[targetItem.attrObj.fullAddress] = ''
this.formObj[targetItem.attrObj.cityName] = ''
this.formObj[targetItem.attrObj.provinceName] = val.provinceName
this.formObj[targetItem.attrObj.provinceCode] = val.provinceCode
},
// 获取市
handleSelectCity(val, targetItem) {
if (val.cityName) {
this.formObj[targetItem.attrObj.cityName] = val.cityName
this.formObj[targetItem.attrObj.cityCode] = val.cityCode
} else {
this.formObj[targetItem.attrObj.cityName] = ''
this.formObj[targetItem.attrObj.cityCode] = ''
}
this.formObj[targetItem.attrObj.fullAddress] = ''
}
}
}
</script>
<style>
/* .glsx-combi-form {
min-width: 922px;
} */
/* .glsx-combi-form .glsx-combi-form-block {
padding: 16px 40px 0;
} */
.glsx-combi-form .isBlock {
display: block !important;
}
/* .glsx-combi-form .el-form-item {
width: 65%;
} */
.glsx-combi-form .no-label.el-form-item--small .el-form-item__content {
width: 100%;
}
.glsx-combi-form .el-form-item--small.el-form-item {
margin: 0 30px 20px 0;
}
.glsx-combi-form .el-form-item--small .el-form-item__label {
padding: 0;
}
/* .glsx-combi-form .el-form-item--small .el-form-item__content {
width: calc(100% - 85px);
} */
.glsx-combi-form .el-col {
margin-bottom: 10px;
}
.glsx-combi-form .el-select {
width: 100%;
}
.glsx-combi-form .item-height {
height: 37px;
}
.glsx-combi-form input::-webkit-outer-spin-button,
.glsx-combi-form input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
.glsx-combi-form input[type='number'] {
-moz-appearance: textfield !important;
}
.glsx-combi-form .input-with-select .el-input-group__prepend {
background-color: #fff;
}
/* 提示图标 */
/* .glsx-combi-form .tips-block {
position: relative;
} */
.glsx-combi-form .tips-label {
margin-right: 2px;
}
.glsx-combi-form .tips-icon {
display: inline-block;
width: 14px;
height: 14px;
margin-right: 0px !important;
vertical-align: middle;
cursor: pointer;
}
.glsx-combi-form .combi-form-label {
/* display: inline-block; */
box-sizing: border-box;
}
/* 图片上传 */
.glsx-combi-form .photo-top-tips {
/* height: 36px; */
margin: 0 0;
color: #999999;
}
.glsx-combi-form .img-w-h {
width: 80px;
height: 80px;
}
.glsx-combi-form .activity-img {
position: relative;
color: #999999;
background-color: #f7f7f7;
border: 1px dotted #d9d9d9;
cursor: pointer;
margin-top: 10px;
}
.glsx-combi-form .activity-Input {
position: absolute;
top: 0;
left: 0;
}
.glsx-combi-form .muti-imgs {
display: inline-block;
position: relative;
margin: 10px 8px 0 0;
}
.activity-img .add {
position: absolute;
top: 40%;
font-size: 40px;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.activity-img .number {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
font-size: 14px;
width: 100%;
text-align: center;
}
.muti-imgs .img-btns {
display: none;
height: 100%;
position: absolute;
width: 80px;
height: 80px;
left: 0;
top: 0;
z-index: 2;
color: #fff;
background: rgba(0, 0, 0, 0.5);
}
.glsx-combi-form .el-icon-delete,
.glsx-combi-form .el-icon-zoom-in {
cursor: pointer;
}
.muti-imgs .img-btns .btn-item {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.muti-imgs .img-btns .btn-item {
display: flex;
width: 70%;
justify-content: space-around;
}
.muti-imgs:hover .img-btns {
display: block;
}
.glsx-combi-form .dialog-img {
width: 100%;
height: 100%;
}
.glsx-combi-form .dialog-look {
text-align: center;
}
.glsx-combi-form .dialog-video {
width: 50%;
height: 50%;
}
/* 图片上传 */
.glsx-combi-form .el-tag.el-tag--info .el-tag__close {
color: #e8e8ea;
background-color: #5850ff !important;
}
.glsx-combi-form .el-tag.el-tag--info {
border-color: #5850ff;
}
.glsx-combi-form .el-tag--plain.el-tag--info .el-tag__close:hover {
background-color: #e8e8ea;
}
.glsx-combi-form .el-tag.el-tag--info .el-tag__close:hover {
background-color: #e8e8ea;
}
.textBox .el-form-item__content {
width: 62%;
/* background: #096; */
}
</style>
<template>
<div class="map-box" :style="{ height: mapHeight + 'px', width: mapWidth + 'xp' }">
<div id="container">
<el-select v-model="input" class="map-input" filterable remote reserve-keyword placeholder="请输入" :remote-method="remoteMethod" @change="handleChangeAdr" :loading="loading">
<el-option v-for="item in adrList" :key="item.id" :label="item.address" :value="item.id"></el-option>
</el-select>
</div>
<div class="map-address">
<img class="icon-map" src="./images/icon-map.png" />
{{ address }}
</div>
</div>
</template>
<script>
let map, marker, placeSearch
export default {
name: 'map',
props: {
mapHeight: {
type: Number,
default: 460
},
mapWidth: {
type: Number,
default: 740
}
},
data() {
return {
input: [],
address: '',
adrList: [],
lnglat: [],
geocoderAddress: {}
}
},
mounted() {
this.mapInit()
},
methods: {
// initMap() {
// console.log(document.getElementsByTagName('head'))
// var script = document.createElement('script')
// script.type = 'text/javascript'
// script.src = 'https://webapi.amap.com/loader.js'
// document.getElementsByTagName('head')[0].appendChild(script)
// },
mapInit() {
/* eslint-disable */
AMapLoader.load({
/* eslint-enable */
key: '44cc16e43ad7ed3358df507bd0618181', // 申请好的Web端开发者Key,首次调用 load 时必填
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
// 需要使用的的插件列表
plugins: ['AMap.ToolBar', 'AMap.Scale', 'AMap.Geocoder'],
AMapUI: {
// 是否加载 AMapUI,缺省不加载
version: '1.1', // AMapUI 版本
plugins: ['overlay/SimpleMarker'] // 需要加载的 AMapUI ui插件
},
Loca: {
// 是否加载 Loca, 缺省不加载
version: '2.0' // Loca 版本
}
})
.then(AMap => {
map = new AMap.Map('container', {
zoom: 20,
autoFitView: true,
resizeEnable: true,
cursor: 'move'
})
if (this.lnglat.length) {
this.addMarker(this.lnglat)
}
map.addControl(new AMap.Scale())
map.addControl(new AMap.ToolBar())
this.geocoder = new AMap.Geocoder()
map.setDefaultCursor('pointer')
AMap.plugin(['AMap.PlaceSearch'], function() {
//构造地点查询类
placeSearch = new AMap.PlaceSearch({
pageSize: 8, // 单页显示结果条数
pageIndex: 1, // 页码
citylimit: false, //是否强制限制在设置的城市内搜索
// panel: "panel", // 结果列表将在此容器中进行展示。
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
renderStyle: 'default'
})
})
map.on('click', this.getAddress)
})
.catch(e => {
console.error(e) //加载错误提示
})
},
remoteMethod(query) {
if (query == '') {
return true
}
let _this = this
placeSearch.search(query, function(status, result) {
if (status === 'complete' && result.poiList.pois.length) {
_this.adrList = result.poiList.pois
}
})
},
addMarker(lnglat) {
let position
if (lnglat.lng) {
position = [lnglat.lng, lnglat.lat]
} else {
position = lnglat
}
this.lnglat = position
marker = new AMap.Marker({
map: map,
icon: new AMap.Icon({
image: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
size: new AMap.Size(27, 34), //图标大小
imageSize: new AMap.Size(27, 34)
}),
// draggable: true,
position: position,
offset: new AMap.Pixel(-10, -10)
})
map.setCenter(position)
map.add(marker)
marker.setMap(map)
// this.map.setFitView()
},
getAddress(e) {
let self = this
let position
if (e.type == 'click') {
position = e.lnglat
} else {
let { lng, lat } = e
position = [lng, lat]
}
if (marker) {
map.remove(marker)
marker.setMap(null)
marker = null
}
self.addMarker(position)
AMap.plugin('AMap.Geocoder', () => {
const geocoder = new AMap.Geocoder()
geocoder.getAddress(position, (status, result) => {
self.address = result.regeocode.formattedAddress
geocoder.getLocation(self.address, (status, result) => {
if (status === 'complete' && result.info === 'OK') {
self.geocoderAddress = result.geocodes[0]
}
})
})
})
},
handleChangeAdr(val) {
if (val) {
var location = this.adrList.find(item => item.id == val)
this.getAddress(location.location)
this.input = ''
this.adrList = []
}
}
}
}
</script>
<style scoped lang="scss">
.map-box {
display: flex;
#container {
position: relative;
width: calc(100% - 284px - 16px);
height: 100%;
}
.map-input {
position: absolute;
top: 32px;
width: 60%;
left: 25%;
z-index: 2;
}
}
#panel {
position: absolute;
max-height: 90%;
overflow-y: auto;
top: 80px;
right: 10px;
width: 280px;
}
.map-address {
display: flex;
box-sizing: border-box;
width: 284px;
height: 100%;
background-color: #f9f9f9;
padding: 20px;
margin-left: 16px;
line-height: 20px;
.icon-map {
width: 16px;
height: 16px;
margin-right: 6px;
}
}
</style>
<template>
<div v-if="provinceView">
<el-form ref="provinceForm" :model="provinceForm" inline="true" class="province" style="padding-left: 0;">
<el-select size="small" v-model="provinceForm.provinceName" clearable :disabled="isDisabled" placeholder="选择省份" :style="{ width: defaultWidth }" @change="selectProvince" class="select-padding">
<el-option v-for="item in AllData" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option>
</el-select>
<el-select size="small" v-model="provinceForm.cityName" clearable :disabled="isDisabled" placeholder="选择市" :style="{ width: defaultWidth }" @change="selectCity" class="select-padding">
<el-option v-for="item in cityList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option>
</el-select>
<el-select v-if="subdistrict == 3" size="small" v-model="provinceForm.townName" clearable :disabled="isDisabled" placeholder="选择区" :style="{ width: defaultWidth }" @change="selectTown" class="select-padding">
<el-option v-for="item in townList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectTown(item)"></el-option>
</el-select>
</el-form>
</div>
</template>
<script>
export default {
name: 'GLProvince',
props: {
// 省市级别,2--只显示省市,3--显示省市区,默认只显示省市
subdistrict: {
type: Number,
default: 2
},
// 省市下拉组件宽度
defaultWidth: {
type: String,
default: '150px'
},
// 组件是否展示,默认展示
provinceView: {
type: Boolean,
default: true
},
isDisabled: {
type: Boolean,
default: false
}
},
data() {
return {
// 所有数据
AllData: [],
// 城市列表
cityList: [],
// 地区列表
townList: [],
provinceForm: {
// 省份名称
provinceName: '',
// 城市名称
cityName: '',
// 地区名称
townName: '',
// 省份代码
provinceCode: '',
// 城市代码
cityCode: '',
// 地区代码
townCode: ''
}
}
},
mounted() {
this.provinceList()
},
methods: {
/*
* @params:传入的为一个key-value的对象
1、keywords --查询关键字,只支持单个关键词语搜索关键词支持:行政区名称、citycode、adcode
列如:this.provinceList({keywords: '山东省'}),这样就可以筛选出山东省下的市、区信息
2、subdistrict --设置显示下级行政区级数,0:不返回下级行政区;1:返回下一级行政区;2:返回下两级行政区;3:返回下三级行政区;
不传的话默认为2,可以在组件中穿,也可以在调用方法的时候传,如果需要展示省市组件,传值最小为2
3、page --最外层的districts最多会返回20个数据,若超过限制,请用page请求下一页数据。
例如page=2;page=3。默认page=1
4、extensions --控制行政区信息中返回行政区边界坐标点; 可选值:base、all;
base:不返回行政区边界坐标点;(默认)
all:只返回当前查询district的边界值,不返回子节点的边界值;目前不能返回乡镇/街道级别的边界值
5、filter -- 按照指定行政区划进行过滤,填入后则只返回该省/直辖市信息,需填入adcode,为了保证数据的正确,强烈建议填入此参数
6、callback -- callback值是用户定义的函数名称,此参数只在output=JSON时有效
7、output --返回数据格式类型,可选值:JSON,XML(默认JSON)
* @return:返回的是一个promise对象,如果不需要展示组件,只需要获取值,可以直接调用方法,异步获取返回值
列如:
const p = this.$refs.provinceForm.provinceList({xxxx(可传值,传值可参考上文params描述) })
p.then(r => {
// r 为返回结果
console.log(r)
})
**/
// 获取省市信息
provinceList(params = {}) {
params ? (params.subdistrict ? '' : (params.subdistrict = this.subdistrict)) : (params.subdistrict = this.subdistrict)
let data = ''
for (let key in params) {
data += '&' + key + '=' + params[key]
}
let path = `https://restapi.amap.com/v3/config/district?key=d22348363c34c266f772ae9b635eef2a`
path = path + data
const pro = fetch(path).then(res => {
return res.json()
})
if (this.provinceView) {
pro.then(r => {
this.AllData = r.districts[0].districts
})
}
return pro
},
// 省市回显
init(province, city, town) {
this.provinceForm = {
provinceName: province,
cityName: city,
townName: town
}
if (province) {
this.AllData.map(item => {
if (item.name.indexOf(province) != -1) {
this.provinceForm.provinceName = item.name
this.cityList = item.districts
this.provinceForm.provinceCode = item.adcode
if (city) {
this.cityList.map(itm => {
if (itm.name.indexOf(city) != -1) {
this.provinceForm.cityCode = itm.adcode
this.provinceForm.cityName = itm.name
this.townList = itm.districts
if (town) {
this.townList.map(itmx => {
if (itmx.name.indexOf(town) != -1) {
this.provinceForm.townCode = itmx.adcode
this.provinceForm.townName = itmx.name
}
})
}
}
})
}
}
})
}
},
// 选择省
selectProvince(val) {
this.provinceForm.cityName = ''
this.provinceForm.townName = ''
this.cityList = val.districts
this.$emit('selectProvince', { provinceName: val.name, provinceCode: val.adcode })
},
// 选择市
selectCity(val) {
this.provinceForm.townName = ''
this.townList = val.districts
this.$emit('selectCity', { cityName: val.name, cityCode: val.adcode })
},
// 选择区
selectTown(val) {
this.$emit('selectTown', { townName: val.name, townCode: val.adcode })
}
}
}
</script>
<style lang="scss">
.province {
display: inline-flex;
.el-select .el-input {
width: auto !important;
}
}
.select-padding {
margin-right: 10px;
}
</style>
...@@ -9,5 +9,13 @@ ...@@ -9,5 +9,13 @@
*/ */
import Vue from 'vue' import Vue from 'vue'
import glsxDialog from '@/components/glsx-dialog/index.vue' import glsxDialog from '@/components/glsx-dialog/index.vue'
import glsxPreview from '@/components/preview/index.vue'
import glsxCombiForm from '@/components/glsx-combi-form/index.vue'
import bigView from '@/components/big-view/index.vue'
import activityModel from '@/components/activity-model/index.vue'
Vue.component('glsx-dialog', glsxDialog)
\ No newline at end of file \ No newline at end of file
Vue.component('glsx-combi-form', glsxCombiForm)
Vue.component('glsx-dialog', glsxDialog)
Vue.component('glsx-preview', glsxPreview)
Vue.component('big-view', bigView)
Vue.component('activity-model', activityModel)
\ No newline at end of file \ No newline at end of file
<template>
<div class="activity-img-box">
<template v-if="imageUrlArr && imageUrlArr.length > 0">
<div v-for="(item, index) in imageUrlArr" :key="index">
<div class="pic-box" :style="{ width: picOptions.width, height: picOptions.height }">
<img class="photo-activity" :src="item" alt="" />
<div class="mask" :style="{ width: picOptions.width, height: picOptions.height }">
<div class="pic-pane-close" @click="handleEnlarge(item)">
<img src="../../assets/channel/view.png" alt="" />
</div>
<template v-if="picOptions.isClose">
<div class="pic-pane-close" @click="close('img', index)">
<img src="../../assets/channel/dele.png" alt="" />
</div>
</template>
</div>
</div>
</div>
</template>
<template v-if="(imageUrlArr && imageUrlArr.length < 9 && limit > 1) || (imageUrlArr&&imageUrlArr.length == 0 && limit == 1)">
<div class="upload-img">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传照片</div>
<input type="file" ref="uploadImg" class="upload-img" style="opacity: 0" accept=".jpg, .jpeg, .png" @change="e => handleImgChange(e)" />
</div>
</template>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="50%">
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<!-- <video width="100%" autoplay controls :src="dialogSrc" v-else></video> -->
</el-dialog>
</div>
</template>
<script>
export default {
props: {
picOptions: {
type: Object,
default: () => {
return {
width: '104px',
height: '104px',
isClose: true
}
}
},
imageUrlArr: {
type: Array,
default: () => []
},
limit: {
type: String,
default: '1'
},
index: {
type: Number,
default: -1
}
},
data() {
return {
dialogVisibleImg: false
}
},
methods: {
// 上传图片
handleImgChange(e) {
this.$notify({
title: '提示',
message: '图片上传中,请稍后'
})
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
if (this.imageUrlArr.length > 9) {
this.$message.error('最多上传9张图片')
return
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const arrBase64 = imgFile.split(',')
const splitStr = file.name.split('.')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
this.$apis.common.pictureUpload({ file: fileUrl, compress: this.picOptions.compress || 0 }).then(res => {
if (res) {
this.$notify({
title: '提示',
message: '图片上传成功',
type: 'success'
})
this.imageUrlArr.push(res)
this.$emit('change', { arr: this.imageUrlArr, key: this.picOptions.key, index: this.index })
}
e.target.value = ''
this.$refs.uploadImg.value = ''
})
}
},
// 预览图文
handleEnlarge(src, type) {
this.dialogVisibleImg = true
this.dialogSrc = src
this.dialogType = type ? type : 'img'
},
// 删除图片/视频
close(type, index) {
switch (type) {
case 'radio':
this.videoUrl = ''
this.videoImage = ''
break
case 'img':
this.imageUrlArr.splice(index, 1)
this.$emit('change', { arr: this.imageUrlArr, key: this.picOptions.key, id: 1, index: this.index })
break
default:
this.videoUrl = ''
}
}
}
}
</script>
<style scoped lang="scss">
.activity-img-box {
display: flex;
flex-wrap: wrap;
max-width: 600px;
.pic-box {
position: relative;
width: 104px;
height: 104px;
border-radius: 4px;
margin-right: 8px;
margin-bottom: 5px;
&:hover .mask {
opacity: 1;
}
.pic {
position: absolute;
object-fit: fill;
}
.photo-activity {
position: absolute;
width: 100%;
height: 100%;
}
.mask {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
background: rgba(0, 0, 0, 0.5);
color: #ffffff;
opacity: 0;
top: 0;
right: 0;
width: 104px;
height: 104px;
z-index: 999;
.pic-pane-close {
width: 14px;
height: 14px;
cursor: pointer;
margin-right: 8px;
img{
width:100%;
display: block;
}
}
}
}
.upload-img {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 104px;
height: 104px;
background: rgba(0, 0, 0, 0.04);
border: 1px dashed rgba(0, 0, 0, 0.15);
border-radius: 4px;
input {
position: absolute;
// top: 0;
// left: 0;
width: 104px;
height: 104px;
}
}
.avatar-uploader-desc-word {
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
.image-dialog {
/deep/ {
.el-dialog__header {
border-bottom: 0px;
padding: 0px;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div>
<div id="div-demo"></div>
</div>
</template>
<script>
import E from 'wangeditor'
export default {
name: 'textBox',
data() {
return {
editor: '',
content: '',
editorOption: {}
}
},
props: {
excludeMenus: {
type: Array,
default: () => ['code']
},
boxHeight: {
type: Number,
default: 240
}
},
mounted() {
this.getEdit()
},
methods: {
getEdit() {
const _this = this
this.editor = new E('#div-demo')
this.editor.config.uploadImgShowBase64 = true
this.editor.config.showMenuTooltips = true
this.editor.config.menuTooltipPosition = 'down'
this.editor.config.height = this.boxHeight
this.editor.config.width = 500
this.editor.config.excludeMenus = this.excludeMenus
this.editor.config.onchange = html => {
// console.log(html);
this.content = html // 绑定当前逐渐地值
this.$emit('change', this.content) // 将内容同步到父组件中
}
this.editor.config.onfocus = () => {
this.$emit('focus')
}
// 上传图片
this.editor.config.customUploadImg = function(resultFiles, insertImgFn) {
var file = resultFiles[0]
var reader = new FileReader()
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
_this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
_this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
// console.log(res)
insertImgFn(res)
}
})
// resultFiles 是 input 中选中的文件列表
// insertImgFn 是获取图片 url 后,插入到编辑器的方法
// 上传图片,返回结果,将图片插入到编辑器中
}
}
// 上传视频
this.editor.config.customUploadVideo = function(resultFiles, insertVideoFn) {
var file = resultFiles[0]
var reader = new FileReader()
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
_this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const videoFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + videoFile.split(',')[1]
_this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
// console.log(res)
insertVideoFn(res)
}
})
// resultFiles 是 input 中选中的文件列表
// insertImgFn 是获取图片 url 后,插入到编辑器的方法
// 上传图片,返回结果,将图片插入到编辑器中
}
}
this.editor.config.onchangeTimeout = 5000
this.editor.create()
},
setEdit(html) {
this.$nextTick(() => {
this.editor.txt.html(html)
})
},
forbidEdit() {
// this.editor.$textElem.attr('contenteditable', false)
this.editor.disable()
}
}
}
</script>
<style lang="scss" scoped>
#div-demo {
// margin: 16px 300px 0 0;
}
.el-form .editor {
margin-top: 20px;
}
.myQuillEditor {
background-color: #fff;
height: 200px;
}
</style>
<style>
.w-e-text-container {
z-index: 1 !important;
}
.w-e-toolbar {
z-index: 2 !important;
}
</style>
...@@ -12,15 +12,14 @@ let cfg = require('./conf.js') ...@@ -12,15 +12,14 @@ let cfg = require('./conf.js')
import { Http } from 'glsx-common' import { Http } from 'glsx-common'
let timeout = 30000 //超时时间 let timeout = 30000 //超时时间
export const fetchConfig = function (isEnv = true) { export const fetchConfig = function (isEnv = true) {
// console.log(1111111)
// if (isEnv) { // if (isEnv) {
// let { request } = cfg // let { request } = cfg
// Object.assign(request, { timeout }) // Object.assign(request, { timeout })
// return Promise.resolve(cfg) // return Promise.resolve(cfg)
// } // }
//return window.fetch('https://', {}).then(res => res.json()) // return new Http().get('https://oss-config.dev.glsx.com.cn/mock/63b39b3e606e962c5e174afb/discover/config')
// request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' }) return new Http().get('https://oss-config.glsx.com.cn/mock/63c12a6b28a427953783403e/discover/config')
return new Http().get('https://oss-config.dev.glsx.com.cn/mock/63b39b3e606e962c5e174afb/discover')
} }
export const config = { export const config = {
install(vue, cfg) { install(vue, cfg) {
......
...@@ -4,9 +4,9 @@ const staticRoutes = Object.freeze([{ ...@@ -4,9 +4,9 @@ const staticRoutes = Object.freeze([{
redirect: { name: 'zoneList' } redirect: { name: 'zoneList' }
}, },
{ {
name: 'zoneList', name: 'channel',
path: '/zoneList/index', path: '/channel/index',
component: resolve => require([`@/views/zoneList/index.vue`], resolve), component: resolve => require([`@/views/channel/index.vue`], resolve),
meta: {} meta: {}
} }
]) ])
......
import apis from '@/api'
export default {
namespaced: true,
state: {
videoList: [],
topicDetail: {},
merchantId: '',
channelStyle: 1,
channelType: ''
},
mutations: {
// 设置视频
['SET_VIDEO_LIST'](state, payload) {
state.videoList = payload.videoList
},
// 设置频道主题详情
['SET_TOPIC_DETAIL'](state, payload) {
state.topicDetail = payload.topicDetail
},
// 设置门店id
['SET_MERCHANT_ID'](state, payload) {
state.merchantId = payload.id
},
// 设置频道主题
['SET_CHANNEL_STYLE'](state, payload) {
state.channelStyle = payload.channelStyle
},
['SET_CHANNEL_TYPE'](state, payload) {
state.channelType = payload.channelType
}
},
actions: {
// 获取视频列表
getTencentcloudmedialist(conText, payload) {
apis.store.getTencentcloudmedialist({}).then(res => {
if (res.code == 0) {
conText.commit('SET_VIDEO_LIST', { videoList: res.data })
// if (payload.success) {
// payload.success()
// }
}
})
},
//频道主题详情
getTopicDetail(conText, payload) {
apis.store.getTopicDetail(payload).then(res => {
if (res.code == 0) {
conText.commit('SET_TOPIC_DETAIL', { topicDetail: res.data })
}
})
},
//新增或编辑频道主题
addChannelTopic(conText, payload) {
apis.store.addChannelTopic(payload).then(res => {
if (res) {
if (payload.success) {
payload.success(res)
}
}
})
}
}
}
<template>
<div class="report-about">
<h4>穿梭框1</h4>
<h4 class="align-center">
<label>请打开f12查看移动数据</label>
<el-button size="medium" type="info" @click="changeMode">当前模式:</el-button>
<el-button size="medium" @click="clearChecked()">清除选中</el-button>
<el-button size="medium" @click="toHidden()">去=隐藏的路由</el-button>
</h4>
<div class="box">
<!-- lazy -->
<!-- :lazyFn="lazyFn" -->
<tree-transfer ref="wl-tree-transfer" filter high-light default-transfer :mode="mode" :title="title" :to_data="toData" :from_data="fromData" :filterNode="filterNode" :defaultProps="defaultProps" :defaultCheckedKeys="defaultCheckedKeys" :defaultExpandedKeys="[2, 3]" @right-check-change="rightCheckChange" @left-check-change="leftCheckChange" @removeBtn="remove" @addBtn="add" height="540px" node_key="id">
<span slot="title-right" class="my-title-right" @click="handleTitleRight">自定义内容</span>
</tree-transfer>
</div>
</div>
</template>
<script>
import treeTransfer from 'el-tree-transfer'
export default {
name: 'App',
components: { treeTransfer },
data() {
return {
mode: 'transfer', // transfer addressList
defaultProps: { label: 'name', children: 'children' },
fromData: [
{
id: 1,
pid: 0,
name: '测试左侧',
children: [
{
id: 2,
pid: 1,
name: '水电费是打发斯蒂芬斯蒂芬gas噶水电费噶地方死光光',
disabled: true,
children: []
},
{
id: 3,
pid: 1,
name: '11-3',
children: []
},
{
id: 4,
pid: 1,
name: '11-4',
children: [
{
id: 5,
pid: 4,
name: '11-5',
children: [
{
id: 111,
pid: 5,
name: '11-111'
}
]
},
{
id: 6,
pid: 4,
name: '11-6',
children: []
}
]
}
]
},
{
id: 7127,
pid: 0,
name: 'debug',
children: [
{
id: 71272,
pid: 7127,
name: 'debug22',
// disabled: true,
children: []
},
{
id: 71273,
pid: 7127,
name: 'debug11',
children: []
}
]
}
], // 穿梭框 - 源数据 - 树形
toData: [],
fromArray: [
{
id: '1',
name: '1',
pid: '0'
},
{
id: '2',
name: '2',
pid: '0'
},
{
id: '1-1',
name: '1-1',
pid: '1'
},
{
id: '1-2',
name: '1-2',
pid: '1'
},
{
id: '1-1-1',
name: '1-1-1',
pid: '1-1'
},
{
id: '1-1-1-1',
name: '1-1-1-1',
pid: '1-1-1'
},
{
id: '2-1',
name: '2-1',
pid: '2'
},
{
id: '2-2',
name: '2-2',
pid: '2'
}
],
toArray: [],
defaultCheckedKeys: [] // 左侧默认选中数据
}
},
created() {},
mounted() {
this.$apis.demo.GETLISTDEVICEFILEUNSTOCK({ k: 2, kdj: 5 }).then(res => {})
// 测试延迟默认选中
setTimeout(() => {
this.defaultCheckedKeys = [1]
}, 1000)
},
methods: {
toHidden() {
this.$router.push('/about/hidden')
},
// 清除选中
clearChecked() {
this.$refs['wl-tree-transfer'].clearChecked()
},
// 自定义筛选函数
filterNode(value, data, where) {
console.log(value, data, where)
if (!value) return true
return data[this.defaultProps.label].indexOf(value) !== -1
},
// 懒加载回调
lazyFn(node, resolve) {
setTimeout(() => {
resolve([
{
id: 71272,
pid: 7127,
name: 'debug22',
// disabled: true,
children: []
},
{
id: 71273,
pid: 7127,
name: 'debug11',
children: []
}
])
}, 500)
},
// 切换模式 现有树形穿梭框模式transfer 和通讯录模式addressList
changeMode() {
if (this.mode == 'transfer') {
this.mode = 'addressList'
} else {
this.mode = 'transfer'
}
},
// 添加按钮
add(fromData, toData, obj) {
// 树形穿梭框模式transfer时,返回参数为左侧树移动后数据、右侧树移动后数据、移动的{keys,nodes,halfKeys,halfNodes}对象
// 通讯录模式addressList时,返回参数为右侧收件人列表、右侧抄送人列表、右侧密送人列表
console.log('fromData:', fromData)
console.log('toData:', toData)
console.log('obj:', obj)
},
// 移除按钮
remove(fromData, toData, obj) {
// 树形穿梭框模式transfer时,返回参数为左侧树移动后数据、右侧树移动后数据、移动的{keys,nodes,halfKeys,halfNodes}对象
// 通讯录模式addressList时,返回参数为右侧收件人列表、右侧抄送人列表、右侧密送人列表
console.log('fromData:', fromData)
console.log('toData:', toData)
console.log('obj:', obj)
},
// 左侧源数据选中事件
leftCheckChange(nodeObj, treeObj, checkAll) {
console.log(nodeObj)
console.log(treeObj)
console.log(checkAll)
},
// 右侧目标数据选中事件
rightCheckChange(nodeObj, treeObj, checkAll) {
console.log(nodeObj)
console.log(treeObj)
console.log(checkAll)
},
// 自定义节点 仅树形结构支持
renderContent(h, { node, data }) {
return (
<span class="custom-tree-node">
<span>{node.label}</span>
<span>
<el-button size="mini" type="text" on-click={() => this.append(data)}>
Append
</el-button>
<el-button size="mini" type="text" on-click={() => this.remove(node, data)}>
Delete
</el-button>
</span>
</span>
)
},
// 标题自定义区点击事件
handleTitleRight() {
alert('标题自定义区点击事件')
}
},
computed: {
title() {
if (this.mode == 'transfer') {
return ['源列表', '目标列表']
} else {
return ['通讯录', '收件人', '抄送人', '密送人']
}
}
}
}
</script>
<style>
.align-center {
text-align: center;
}
.box {
width: 600px;
margin: 0 auto;
text-align: left;
}
.btn {
border: 1px solid #ebeef5;
padding: 5px 10px;
background-color: #f5f7fa;
outline: none;
}
.my-title-right {
float: right;
font-size: 12px;
cursor: pointer;
}
</style>
<template>
<div class="add-wrap" v-loading="loading">
<div class="add-container">
<div class="title">{{ this.channelForm.channelName }}编辑</div>
<div class="channel-content gl-form-page">
<el-form ref="ruleForm" :model="channelForm" label-width="154px" size="small" :rules="rules">
<el-form-item label="频道名称:" prop="channelName">
<el-input v-model="channelForm.channelName" :disabled="isDisabled" maxlength="4"></el-input>
</el-form-item>
<span v-if="channelForm.channelType == 1">
<el-form-item label="频道主题:" prop="channelStyle">
<el-col :span="11" class="theme"></el-col>
<el-col :span="11" class="theme dark"></el-col>
</el-form-item>
<el-form-item label="" prop="channelStyle">
<el-radio-group v-model="channelForm.channelStyle" @input="changeChannelStyle">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
<div class="theme-label">
<span>风格1</span>
<span>风格2</span>
</div>
</el-form-item>
</span>
<el-form-item label="频道banner:" prop="channelImg" style="margin-top:15px;">
<glsx-preview :picOptions="picOptions" :imageUrlArr="channelForm.channelImgArr" @change="changeChannelImg"></glsx-preview>
<div class="el-form-item__error" v-if="channelImgFlag">请上传频道banner</div>
</el-form-item>
<div class="text-tip">建议尺寸:750*750</div>
</el-form>
</div>
</div>
<div class="add-container">
<div class="title">{{ this.channelForm.channelName }}分享配置</div>
<div class="channel-content gl-form-page">
<el-form ref="ruleForm" :model="channelForm" label-width="154px" :rules="rules">
<el-form-item label="频道分享预览图:" prop="publicityImg">
<glsx-preview :picOptions="shareOptions" :imageUrlArr="channelForm.publicityImgArr" @change="changeChannelImg"></glsx-preview>
</el-form-item>
<div class="text-tip">建议尺寸:520*416</div>
<el-form-item label="频道分享文案:" prop="promotion">
<el-input type="textarea" v-model="channelForm.promotion" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="频道海报:">
<glsx-preview :picOptions="posterOptions" :imageUrlArr="channelForm.posterImgArr" @change="changeChannelImg"></glsx-preview>
</el-form-item>
<div class="text-tip">建议尺寸:640*1008</div>
</el-form>
</div>
</div>
<GLFooter>
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleSave">确定</el-button>
</GLFooter>
</div>
</template>
<script>
export default {
data() {
return {
loading: false,
isDisabled: false,
id: this.$route.query.id ? this.$route.query.id : '',
merchantChannelId: this.$route.query.merchantChannelId ? this.$route.query.merchantChannelId : '',
channelForm: {
posterImgArr: [],
publicityImgArr: [],
publicityImg: '',
channelImg: '',
channelImgArr: []
},
channelImgbgArr: ['banner1', 'banner2'],
channelOtherImgbgArr: ['membrane', 'crowd', 'activity'],
channelImgFlag: false,
picOptions: {
width: '104px',
height: '104px',
key: 'channelImg',
isClose: true
},
shareOptions: {
width: '120px',
height: '90px',
key: 'publicityImg',
isClose: true
},
posterOptions: {
width: '104px',
height: '104px',
key: 'posterImg',
isClose: true
},
rules: {
channelName: [{ required: true, message: '请输入频道名称', trigger: 'blur' }],
channelStyle: [{ required: true, message: '请选择频道主题', trigger: 'change' }],
publicityImg: [{ required: true, message: '请上传频道分享预览图', trigger: 'change' }],
channelImg: [{ required: true, message: '请上传频道banner', trigger: 'change' }],
promotion: [{ required: true, message: '请输入频道分享文案', trigger: 'blur' }]
}
}
},
created() {
if (this.id || this.merchantChannelId) this.getChannelDetail()
this.isDisabled = this.id ? true : this.merchantChannelId ? false : true
},
methods: {
changeChannelStyle() {
this.diffChannelStyle()
},
commonImg(name) {
return `https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/${name}.png`
},
diffChannelStyle() {
if (this.channelForm.channelType == 1) {
this.channelForm.channelImgArr = [this.commonImg(this.channelImgbgArr[this.channelForm.channelStyle - 1])]
this.channelForm.channelImg = this.commonImg(this.channelImgbgArr[this.channelForm.channelStyle - 1])
} else {
this.channelForm.channelImgArr = [this.commonImg(this.channelOtherImgbgArr[this.channelForm.channelType - 2])]
this.channelForm.channelImg = this.commonImg(this.channelOtherImgbgArr[this.channelForm.channelType - 2])
}
},
getChannelDetail() {
let apis = this.id ? 'getChannelDetail' : this.merchantChannelId ? 'getMerchantChannelDetail' : ''
let params = {}
this.id ? (params.id = this.id) : this.merchantChannelId ? (params.merchantChannelId = this.merchantChannelId) : ''
this.$apis.channel[apis](params).then(res => {
if (res.code == 0) {
this.channelForm = { ...res.data, posterImgArr: [], publicityImgArr: [], channelImgArr: [] }
this.channelForm.posterImgArr.push(res.data.posterImg) //海报
this.channelForm.publicityImgArr.push(res.data.publicityImg) //频道分享预览图
this.channelForm.channelImgArr.push(res.data.channelImg) //频道banner
if(!res.data.channelImg) this.diffChannelStyle()
}
})
},
handleCancel() {
this.$router.go(-1)
},
changeChannelImg(val) {
this[val.key + 'Flag'] = false
this.channelForm[val.key] = val.arr[0]
this.$refs.ruleForm.clearValidate(val.key)
},
handleSave() {
this.$refs.ruleForm.validate(valid => {
if (!this.channelForm.channelImg) {
this.channelImgFlag = true
return
}
// if (!this.channelForm.publicityImg) {
// this.publicityImgFlag = true
// return
// }
if (valid) {
let params = {
channelName: this.channelForm.channelName,
channelType: this.channelForm.channelType,
channelStyle: this.channelForm.channelStyle,
channelImg: this.channelForm.channelImg,
promotion: this.channelForm.promotion,
publicityImg: this.channelForm.publicityImg,
posterImg: this.channelForm.posterImg
}
if (this.channelForm.channelType == 1) params.channelStyle = this.channelForm.channelStyle
let apis = this.id ? 'updateChannel' : this.merchantChannelId ? 'updateMerchantChannel' : ''
this.id ? (params.id = this.id) : this.merchantChannelId ? (params.merchantChannelId = this.merchantChannelId) : ''
this.loading = true
this.$apis.channel[apis](params).then(res => {
if (res.code == 0) {
this.loading = false
this.$router.go(-1)
}
this.$message({
message: res.code == '0' ? '编辑成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
})
}
})
}
}
}
</script>
<style scoped lang="scss">
.add-wrap {
.add-container {
background: #ffffff;
margin-bottom: 16px;
.title {
height: 56px;
line-height: 56px;
border-bottom: 1px solid #e5e5e5;
padding-left: 20px;
box-sizing: border-box;
font-size: 16px;
color: #333333;
font-weight: 600;
}
.channel-content {
padding: 32px 0;
}
}
.channel-content /deep/ {
.el-textarea__inner {
min-height: 79px !important;
}
.theme {
width: 48px;
height: 48px;
border-radius: 4px;
background-color: #f24702;
margin-right: 44px;
margin-top: 12px;
}
.dark {
background: #0a0e19;
}
.el-form-item__error {
// margin-top: 25px;
// margin-bottom: 10px;
}
.el-radio__input {
margin-top: -160px;
margin-left: 33px;
color: #fff;
}
.el-radio__label {
color: #fff;
}
}
.theme-label {
font-weight: 400;
font-size: 14px;
color: #333333;
line-height: 20px;
display: flex;
justify-content: space-between;
width: 136px;
margin-top: -50px;
span {
width: 48px;
text-align: center;
display: inline-block;
}
}
.text-tip {
font-weight: 400;
font-size: 14px;
color: #999999;
margin-left: 154px;
margin-bottom: 35px;
margin-top: 15px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="channel-wrap">
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<GLTable ref="channelRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
<div slot="publicityImg" 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" />
</el-popover>
</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">
<el-button type="text" @click="handleEdit(scope.scope)">编辑</el-button>
</div>
</GLTable>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import * as dayjs from 'dayjs'
export default {
name: 'App',
data() {
return {
tableSearchForm: {
channelName: '',
createDate: []
},
searchForm: {},
url: url,
searchFormData: [
{
label: '频道名称',
name: 'channelName',
type: 'input'
},
{
label: '创建时间',
name: 'createDate',
type: 'datePicker',
isClear: true,
customPickerOptions: {
disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate()))
if (date > yesterday) {
return true
}
return false
}
}
}
],
getListApi: this.$apis.channel.getChannelListApi,
tableParams: {
listName: 'list',
// tableOption: true,
tableColumns: [
{
label: '频道名称',
prop: 'channelName',
formatter: cellValue => {
return cellValue.channelName || '--'
}
},
{
label: '频道宣传语',
prop: 'promotion',
width: 300,
line: 1,
formatter: cellValue => {
return cellValue.promotion || '--'
}
},
{
label: '宣传图',
prop: 'publicityImg',
addHtml: 'publicityImg'
},
{
label: '关联门店',
prop: 'linkMerchantCnt',
formatter: cellValue => {
return cellValue.linkMerchantCnt || '--'
}
},
{
label: '创建日期',
prop: 'createdDate',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '操作',
addHtml: 'auth-button',
fixed: 'right',
width: 300
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
}
},
created() {},
mounted() {},
methods: {
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() {
return new Promise(resolve => {
this.searchForm = this.getParams()
delete this.searchForm.createDate
resolve()
})
},
handleSearch() {
this.$refs.channelRef.refreshTable()
},
handleReset() {
this.tableSearchForm = {
channelName: '',
createDate: []
}
this.searchForm = {}
this.handleSearch()
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.channelRef.data.length ? (this.$refs.channelRef.tableHeightValues = '') : this.$refs.channelRef.setTableHeightFun()
},
handleEdit(val) {
this.$router.push({
path: `/channel/add?id=${val.id}&channelType=${val.channelType}`
})
}
}
}
</script>
<style scoped lang="scss">
.channel-wrap {
}
</style>
<template>
<div class="add-wrap">
<div class="container edit-container" style="min-height: 520px !important">
<p class="edit-title" id="basic">新增门店</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="merchantHtml">
<el-button type="default" class="el-icon-plus" v-if="!isDisabled" @click="handleRelateStoreClose">选择门店</el-button>
<div class="merchantNameLabel" v-if="editForm.merchantName">
<p>所属门店</p>
<div class="merchantName ellipsis-1">{{ editForm.merchantName }}</div>
</div>
<div class="el-form-item__error mrt5" v-if="merchantFlag">请选择门店</div>
</div>
<div slot="channelHtml">
<el-checkbox-group v-model="editForm.channelIds" @change="handleCheckedChannelChange">
<el-checkbox v-for="channel in channelList" :label="channel.id" :key="channel.id">{{ channel.name }}</el-checkbox>
</el-checkbox-group>
</div>
</glsx-combi-form>
</div>
<select-store v-if="relateStoreVisible" ref="relateStore" :dialogVisible="relateStoreVisible" :storeSelected="selectedList" :merchantInfo="editForm.merchantId" @handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose"></select-store>
<GLFooter>
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleSave">确定</el-button>
</GLFooter>
</div>
</template>
<script>
import selectStore from './components/selectStore'
export default {
components: {
selectStore
},
data() {
return {
size: 'small',
editChildRef: 'editChildRef',
editForm: {
channelIds: []
},
merchantFlag: false,
editFormData: [
{
label: '选择门店',
name: 'merchantId',
addHtml: 'merchantHtml'
},
{
label: '频道名称',
name: 'channel',
addHtml: 'channelHtml'
}
],
selectedList: [],
channelList: [
{ name: '新车专区', id: 1 },
{ name: '膜类专区', id: 2 },
{ name: '限时众筹', id: 3 },
{ name: '定保专区', id: 4 }
],
relateStoreVisible: false, // 选择门店
editRule: {
channelIds: [{ required: true, message: '请选择频道名称', trigger: 'change' }]
}
}
},
created() {
},
methods: {
handleCancel() {
this.$router.go(-1)
},
handleSave() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (!this.editForm.merchantName) {
this.merchantFlag = true
return
}
if (valid) {
let params = {
merchantId: this.editForm.merchantId,
merchantName: this.editForm.merchantName,
channelIds: this.editForm.channelIds
}
this.loading = true
this.$apis.store.configMerchant(params).then(res => {
if (res.code == 0) {
this.loading = false
this.$router.go(-1)
}
this.$message({
message: res.code == '0' ? '编辑成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
})
}
})
},
handleCheckedChannelChange(val) {
// console.log(this.editForm.channelIds)
},
// 选择门店
handleRelateStoreClose() {
this.relateStoreVisible = !this.relateStoreVisible
},
handleRelateStoreConfirm(selectedData) {
this.$refs.editFormRef.$refs[this.editChildRef].clearValidate('merchantId')
selectedData.merchantId && (this.editForm.merchantId = selectedData.merchantId)
selectedData.merchantName && ((this.editForm.merchantName = selectedData.merchantName), (this.merchantFlag = false))
this.handleRelateStoreClose()
}
}
}
</script>
<style scoped lang='scss'>
.add-wrap {
.container {
min-height: 680px;
padding: 0px 0px 20px;
margin-bottom: 16px;
}
.edit-title {
font-size: 16px;
font-weight: 600;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
padding: 0 0 0 20px;
}
.edit-form-container {
margin-top: 20px;
}
.assignLabel {
color: #5850ff;
}
.merchantNameLabel {
width: 510px;
color: #1d1d1d;
// margin-left: 50px;
padding: 16px;
margin-top: 8px;
border: 1px solid #e6e6e6;
border-radius: 8rpx;
background: #f9f9f9;
.merchantName {
box-sizing: border-box;
width: 284px;
height: 32px;
background: #ffffff;
border: 1px solid #e6e6e6;
border-radius: 4px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 14px;
color: #999999;
line-height: 32px;
padding: 0 8px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="activity-content gl-form-page">
<el-form ref="ruleForm" :model="activityForm" label-width="154px" size="small" :rules="rules">
<el-form-item label="频道卡片主标题:" prop="topicTitle">
<el-input v-model="activityForm.topicTitle" maxlength="4"></el-input>
</el-form-item>
<template v-if="channelType == 3">
<el-form-item label="卡片背景图:" prop="backgroundImg">
<el-radio-group v-model="activityForm.backgroundType" @input="changeBackgroundType">
<el-radio :label="1">单个</el-radio>
<el-radio :label="2">套餐</el-radio>
</el-radio-group>
<glsx-preview :picOptions="bgOptions" limit="1" :imageUrlArr="activityForm.backgroundImgArr" @change="changeChannelImg"></glsx-preview>
</el-form-item>
</template>
<template v-if="channelType == 4">
<el-form-item label="卡片背景图:" prop="backgroundImg">
<glsx-preview :picOptions="bgOptions" limit="1" :imageUrlArr="activityForm.backgroundImgArr" @change="changeChannelImg"></glsx-preview>
</el-form-item>
</template>
<div class="text-tip">建议尺寸:722*466</div>
<el-form-item label="产品主图:" prop="mediaUrl">
<glsx-preview :picOptions="productOptions" :limit="activityForm.backgroundType == 1 ? '1' : 9" :imageUrlArr="activityForm.mediaUrlArr" @change="changeChannelImg"></glsx-preview>
<!-- <div class="el-form-item__error">请上传产品主图</div> -->
</el-form-item>
<div class="text-tip">建议尺寸:184*230</div>
<el-form-item label="页面路径:" prop="pagePathContent">
<el-button type="default" class="el-icon-plus" @click="handlePath">选择路径</el-button>
<template v-if="activityForm.activityDetails && activityForm.pagePathType == 1">
<div class="activity-box">
<div class="activity-box-title">{{ activityForm.activityDetails.contentName }}</div>
<div class="time">开始时间:{{ activityForm.activityDetails.startTime }}</div>
<div class="time">结束时间:{{ activityForm.activityDetails.endTime }}</div>
<div class="gift">
<img src="@/assets/channel/gift.png" />
</div>
</div>
</template>
<template v-if="activityForm.activityDetails && activityForm.pagePathType == 2">
<div class="goodss-box" v-if="activityForm.activityDetails">
<div class="goods-img">
<img :src="activityForm.activityDetails.contentImage" />
</div>
<div>
<div class="goods-title">{{ activityForm.activityDetails.contentName }}</div>
<div class="goods-price">
价格/元:
<span class="theme-color">{{ activityForm.activityDetails.contentPrice }}</span>
</div>
</div>
</div>
</template>
</el-form-item>
<el-form-item label="产品价值/元:">
<el-input v-model="activityForm.productPrice" disabled></el-input>
</el-form-item>
<el-form-item label="活动价/元:" prop="goodsStock">
<el-input v-model="activityForm.activityPrice" disabled></el-input>
</el-form-item>
</el-form>
<activity-model :activityList="activityList" ref="activityModel" @selectActivity="selectActivity"></activity-model>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
data() {
return {
activityForm: {
pagePathContent: '',
pagePathType: '',
mediaUrl: '',
activityDetails: '',
backgroundImgArr: '',
mediaUrlArr: [],
backgroundType: 1,
backgroundImg: '',
activityPrice: '',
productPrice: ''
},
bgOptions: {
width: '233px',
height: '138px',
isClose: true,
key: 'backgroundImg',
compress: 1 //不压缩
},
productOptions: {
width: ' 104px',
height: '104px',
key: 'mediaUrl',
isClose: true
},
bgArr: ['single', 'meal', 'swell'],
rules: {
topicTitle: [
{ required: true, message: '请输入频道卡片主标题', trigger: 'blur' },
{ max: 6, message: '长度在 6 个字符', trigger: 'blur' }
],
backgroundImg: [{ required: true, message: '请选择卡片背景图', trigger: 'change' }],
pagePathContent: [{ required: true, message: '请选择页面路径', trigger: 'change' }],
mediaUrl: [{ required: true, message: '请上传产品主图', trigger: 'change' }]
},
activityList: [
{
itemName: '众筹活动',
itemValue: 1,
itemType: 'crowdfunding',
getInterfaceApi: this.$apis.store.crowdfundingActivity,
params: {
currentPage: 1
}
},
{
itemName: '定保活动',
itemValue: 1,
itemType: 'crowdfunding',
getInterfaceApi: this.$apis.store.bulgeActivity,
params: {
currentPage: 1,
subscribe: 2
}
}
]
}
},
mounted() {
this.diffChannelStyle()
this.diffActivityList()
},
computed: {
...mapState({
topicDetail: state => state.channel.topicDetail,
merchantId: state => state.channel.merchantId
})
},
props: {
merchantChannelId: {
type: String,
default: ''
},
topicId: {
type: String,
default: ''
},
channelType: {
type: String,
default: ''
}
},
watch: {
topicDetail: {
handler(data) {
if (data) {
this.activityForm = {
...data,
...data.contentList[0],
...data.contentList[0].mediaList[0],
backgroundImgArr: [],
mediaUrlArr: [],
activityDetails: data.contentList[0].pageContentItem
}
this.activityForm.backgroundImgArr.push(this.activityForm.backgroundImg)
data.contentList[0].mediaList.forEach(item => {
this.activityForm.mediaUrlArr.push(item.mediaUrl)
})
this.activityForm.activityPrice = Number(this.activityForm.activityDetails.activityPrice) / 100
this.activityForm.productPrice = Number(this.activityForm.activityDetails.contentPrice) / 100
}
},
// immediate: true,
deep: true
}
},
methods: {
...mapActions({
addChannelTopic: 'channel/addChannelTopic'
}),
diffActivityList() {
this.activityList.splice(4 - this.channelType, 1)
},
commonImg(name) {
return `https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/${name}.png`
},
diffChannelStyle() {
if (this.channelType == 4) {
this.activityForm.backgroundType = 3
}
this.activityForm.backgroundImgArr = [this.commonImg(this.bgArr[this.activityForm.backgroundType - 1])]
this.activityForm.backgroundImg = this.commonImg(this.bgArr[this.activityForm.backgroundType - 1])
},
changeBackgroundType(val) {
this.diffChannelStyle()
this.activityForm.mediaUrlArr = []
this.activityForm.mediaUrl = ''
this.activityForm.activityDetails = ''
this.activityForm.pagePathContent = ''
this.activityForm.productPrice = ''
this.activityForm.activityPrice = ''
},
selectActivity(data) {
this.activityForm.activityDetails = {
...data,
...data.marketingContent,
contentName: data.marketingName
}
this.activityForm.pagePathContent = data.marketingId
if (this.channelType == 3) {
//众筹活动
this.activityForm.productPrice = Number(this.activityForm.activityDetails.originalPrice) / 100
this.activityForm.activityPrice = Number(this.activityForm.activityDetails.crowdFundingPrice) / 100
} else {
//定保
this.activityForm.productPrice = Number(this.activityForm.activityDetails.crowdFundingPrice) / 100
this.activityForm.activityPrice = Number(this.activityForm.activityDetails.activityPrice) / 100
}
this.activityForm.pagePathType = 1
this.activityForm.activityDetails.contentName = this.activityForm.activityDetails.activityName
this.$refs.ruleForm.clearValidate('pagePathContent')
},
//生成路径
handlePath() {
this.$refs.activityModel.init()
},
handleCancel() {
this.$router.go(-1)
},
changeChannelImg(val) {
this.activityForm[val.key] = val.arr[0]
this.$refs.ruleForm.clearValidate(val.key)
},
handleSave() {
this.$refs.ruleForm.validate(valid => {
let mediaList = []
if (this.activityForm.backgroundType == 1) {
mediaList = [
{
mediaType: 2,
mediaUrl: this.activityForm.mediaUrl
}
]
} else {
this.activityForm.mediaUrlArr.forEach(item => {
mediaList.push({
mediaType: 2,
mediaUrl: item
})
})
}
let contentList = [
{
pagePathType: this.activityForm.pagePathType,
pagePathContent: this.activityForm.pagePathContent,
promotion: this.activityForm.promotion,
mediaList
}
]
if (valid) {
let params = {
merchantChannelId: this.merchantChannelId,
topicTitle: this.activityForm.topicTitle,
contentList,
backgroundImg: this.activityForm.backgroundImg,
backgroundType: this.activityForm.backgroundType
}
if (this.topicId) params.id = this.topicId
this.loading = true
this.addChannelTopic({
...params,
success: res => {
if (res.code == 0) {
this.loading = false
this.$router.go(-1)
}
this.$message({
message: res.code == '0' ? (this.topicId ? '编辑成功' : '新建成功') : res.message,
type: res.code == '0' ? 'success' : 'error'
})
}
})
}
})
}
}
}
</script>
<style scoped lang="scss">
.activity-content /deep/ {
.el-textarea__inner {
min-height: 79px !important;
}
.el-form-item__error {
// margin-top: 25px;
// margin-bottom: 10px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="rules">
<!-- 频道卡片样式 -->
<div slot="topicStyle">
<el-radio-group v-model="editForm.topicStyle" @input="changeTopicStyle">
<el-radio :label="item.optionId" :key="index" v-for="(item, index) in topicStyleList">{{ item.optionLabel }}</el-radio>
</el-radio-group>
<div>
<glsx-preview :picOptions="topicStyleOptions" limit="1" :imageUrlArr="editForm.styleArr"></glsx-preview>
</div>
</div>
<!-- 卡片背景图 -->
<div slot="bgImage">
<glsx-preview :picOptions="bgOptions" limit="1" :imageUrlArr="editForm.backgroundImgArr" @change="changeChannelImg"></glsx-preview>
<!-- <div class="el-form-item__error">请上传卡片背景图</div> -->
<div class="text-tip-line">建议尺寸:722*450</div>
</div>
<!-- 产品主图 -->
<div slot="product">
<glsx-preview :picOptions="productOptions" limit="9" :imageUrlArr="editForm.mediaUrlArr" @change="changeChannelImg"></glsx-preview>
<!-- <div class="el-form-item__error">请上传频道banner</div> -->
</div>
<!-- 具体内容 -->
<div slot="concreteContent" class="concrete-content">
<div class="gl-form-page">
<el-form ref="ruleForm" :model="editForm" size="small" :rules="rules">
<span v-for="(item, index) in editForm.contentList" :key="index" class="line-item">
<div class="delect-box" @click="delectContent(index)">
<img class="icon-dele" src="@/assets/channel/dele.png" />
</div>
<el-form-item label="选择视频:" :prop="'contentList.' + index + '.mediaUrl'" :rules="rules.mediaUrl">
<el-select v-model="item.mediaUrl" placeholder="请选择视频" @change="changeVideo(index)">
<el-option :label="video.fileName" :value="video.mediaUrl" v-for="video in videoList" :key="video.id"></el-option>
</el-select>
<div class="preview" @click="handleView(index)">预览</div>
</el-form-item>
<el-form-item label="视频封面图:" :prop="'contentList.' + index + '.mediaCover'" :rules="rules.mediaCover">
<glsx-preview :picOptions="mediaCoverOptions" :imageUrlArr="item.mediaCoverArr" :index="index" @change="changeChannelImg"></glsx-preview>
<!-- <div class="el-form-item__error">请上传频道banner</div> -->
</el-form-item>
<div class="text-tip">建议尺寸:184*230</div>
<el-form-item label="宣传文案:" :prop="'contentList.' + index + '.promotion'" :rules="rules.promotion">
<el-input type="textarea" v-model="item.promotion" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="页面路径:" :prop="'contentList.' + index + '.pagePathContent'" :rules="rules.pagePathContent">
<el-button type="default" class="el-icon-plus" @click="handlePath(index)">选择路径</el-button>
<template v-if="item.pagePathType == 1">
<div class="activity-box" v-if="item.activityDetails">
<div class="activity-box-title">{{ item.activityDetails.contentName }}</div>
<div class="time">开始时间:{{ item.activityDetails.startTime }}</div>
<div class="time">结束时间:{{ item.activityDetails.endTime }}</div>
<div class="gift">
<img src="@/assets/channel/gift.png" />
</div>
</div>
</template>
<template v-else>
<div class="goodss-box" v-if="item.activityDetails">
<div class="goods-img">
<img :src="item.activityDetails.contentImage" />
</div>
<div>
<div class="goods-title">{{ item.activityDetails.contentName }}</div>
<div class="goods-price">
价格/元:
<span class="theme-color">{{ item.activityDetails.contentPrice }}</span>
</div>
</div>
</div>
</template>
</el-form-item>
<br />
<div :class="index < editForm.contentList.length ? 'line' : ''"></div>
</span>
</el-form>
</div>
<div class="add-box">
<div class="btn-basic" @click.stop="handleAddItem">
<img class="icon-add" src="@/assets/channel/icon-add.png" />
<div>新增一项</div>
</div>
</div>
</div>
<!-- 上传类型 -->
<div slot="mediaType">
<el-radio-group v-model="editForm.mediaType" @input="changeMediaType">
<el-radio :label="1">上传视频</el-radio>
<el-radio :label="2">上传图片</el-radio>
</el-radio-group>
<div class="gl-form-page mediaType-content">
<el-form ref="ruleForm" :model="editForm" size="small" :rules="rules">
<span v-if="editForm.mediaType == 1">
<el-form-item label="选择视频:" :prop="'contentList.' + 0 + '.mediaUrl'" :rules="rules.mediaCover">
<el-select v-model="editForm.contentList[0].mediaUrl" placeholder="请选择视频" @change="changeVideo(0)">
<el-option :label="video.fileName" :value="video.mediaUrl" v-for="video in videoList" :key="video.id"></el-option>
</el-select>
<div class="preview" @click="handleView(0)">预览</div>
</el-form-item>
<el-form-item label="视频封面图:" :prop="'contentList.' + 0 + '.mediaCover'" :rules="rules.mediaUrl">
<div class=""></div>
<glsx-preview :picOptions="mediaCoverOptions" :imageUrlArr="editForm.contentList[0].mediaCoverArr" :index="0" @change="changeChannelImg"></glsx-preview>
<!-- <div class="el-form-item__error">请上传频道banner</div> -->
</el-form-item>
<div class="text-tip">建议尺寸:184*230</div>
</span>
<span v-if="editForm.mediaType == 2">
<el-form-item label="图片:" :prop="'contentList.' + 0 + '.picUrl'" :rules="rules.picUrl" class="mrb20">
<div class="pic-wrap">
<glsx-preview :picOptions="picOptions" :imageUrlArr="editForm.contentList[0].mediaUrlArr" limit="9" :index="0" @change="changeChannelImg"></glsx-preview>
</div>
<!-- <div class="el-form-item__error">请上传频道banner</div> -->
</el-form-item>
</span>
<span style="position: relative">
<el-form-item label="口碑文案:" :key="index" :class="index != 0 ? 'publicPraise-box' : 'publicPraise-wrap'" v-for="(text, index) in editForm.contentList[0].publicPraise">
<span class="txt-red">*</span>
<el-input type="text" v-model="text.value" maxlength="15"></el-input>
<div class="dele-publicPraise" @click="handleDelePraise(index)">
<img class="icon-dele" src="@/assets/channel/dele.png" />
</div>
</el-form-item>
<div class="el-form-item-public" v-if="publicPraiseFlag">请输入口碑文案</div>
</span>
<div class="btn-basic" style="margin-left: 154px; margin-bottom: 10px" @click.stop="handleAddPraise">
<img class="icon-add" src="@/assets/channel/icon-add.png" />
<div>新增一条文案</div>
</div>
<el-form-item label="宣传文案:" :prop="'contentList.' + 0 + '.promotion'" :rules="rules.promotion">
<el-input type="textarea" v-model="editForm.contentList[0].promotion" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="按钮报名:" :prop="'contentList.' + 0 + '.buttonRegistration'" :rules="rules.buttonRegistration">
<el-input type="text" maxlength="6" v-model="editForm.contentList[0].buttonRegistration"></el-input>
</el-form-item>
<el-form-item label="页面路径:" :prop="'contentList.' + 0 + '.pagePathContent'" :rules="rules.pagePathContent">
<el-button type="default" class="el-icon-plus" @click="handlePath(0)">选择路径</el-button>
<template v-if="editForm.contentList[0].pagePathType == 1">
<div class="activity-box" v-if="editForm.contentList[0].activityDetails">
<div class="activity-box-title">{{ editForm.contentList[0].activityDetails.contentName }}</div>
<div class="time">开始时间:{{ editForm.contentList[0].activityDetails.startTime }}</div>
<div class="time">结束时间:{{ editForm.contentList[0].activityDetails.endTime }}</div>
<div class="gift">
<img src="@/assets/channel/gift.png" />
</div>
</div>
</template>
<template v-else>
<div class="goodss-box" v-if="editForm.contentList[0].activityDetails">
<div class="goods-img">
<img :src="editForm.contentList[0].activityDetails.contentImage" />
</div>
<div>
<div class="goods-title">{{ editForm.contentList[0].activityDetails.contentName }}</div>
<div class="goods-price">
价格/元:
<span class="theme-color">{{ editForm.contentList[0].activityDetails.contentPrice }}</span>
</div>
</div>
</div>
</template>
</el-form-item>
</el-form>
</div>
</div>
<!-- 页面路径 -->
<div slot="pagePathContent">
<el-button type="default" class="el-icon-plus" @click="handlePath(-1)">选择路径</el-button>
<template v-if="editForm.activityDetails && editForm.pagePathType == 1">
<div class="activity-box">
<div class="activity-box-title">{{ editForm.activityDetails.contentName }}</div>
<div class="time">开始时间:{{ editForm.activityDetails.startTime }}</div>
<div class="time">结束时间:{{ editForm.activityDetails.endTime }}</div>
<div class="gift">
<img src="@/assets/channel/gift.png" />
</div>
</div>
</template>
<template v-if="editForm.activityDetails && editForm.pagePathType == 2">
<div class="goodss-box" v-if="editForm.activityDetails">
<div class="goods-img">
<img :src="editForm.activityDetails.contentImage" />
</div>
<div>
<div class="goods-title">{{ editForm.activityDetails.contentName }}</div>
<div class="goods-price">
价格/元:
<span class="theme-color">{{ editForm.activityDetails.contentPrice }}</span>
</div>
</div>
</div>
</template>
</div>
</glsx-combi-form>
<activity-model :activityList="activityList" ref="activityModel" @selectActivity="selectActivity"></activity-model>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="30%">
<big-view ref="viewForm" v-if="dialogVisibleImg" :dialogSrc="dialogSrc" :dialogType="dialogType"></big-view>
</el-dialog>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
const url = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/'
export default {
data() {
return {
isFlag: false,
dialogVisibleImg: false,
publicPraiseFlag: false,
dialogType: '',
dialogSrc: '',
editChildRef: 'editChildRef',
currentPath: 0,
editForm: {
productUrl: '',
styleArr: [],
productPrice: '',
activityPrice: '',
activityDetails: '',
topicStyle: 1,
topicTitle: '',
backgroundImgArr: ['https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/item_bg_icon_3.png'],
backgroundImg: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/item_bg_icon_3.png',
mediaType: 1,
mediaUrlArr: [],
mediaUrl: '',
pagePathType: '',
pagePathContent: '',
contentList: [
{
mediaType: '',
mediaUrl: '',
mediaCover: '',
pagePathContent: '',
pagePathType: '1',
promotion: '',
activityDetails: '',
mediaCoverArr: [],
mediaUrlArr: [],
buttonRegistration: '立即参加', //报名按钮
publicPraise: [{ value: '' }],
contentName: '',
contentPrice: '',
contentImage: ''
}
]
},
bgArr: ['video-bg', 'praise-bg', 'theme-bg'],
topicStyleArr: ['video-style', 'praise-style', 'theme-style'],
topicStyleOptions: {
width: '188px',
height: ' 134px',
isClose: false
},
productOptions: {
width: ' 104px',
height: '104px',
key: 'productUrl',
isClose: true
},
bgOptions: {
width: '233px',
height: '138px',
isClose: true,
key: 'backgroundImg',
compress: 1 //不压缩
},
mediaCoverOptions: {
width: '92px',
height: '116.26px',
key: 'mediaCover',
isClose: true
},
picOptions: {
width: '104px',
height: '104px',
key: 'picUrl',
isClose: true
},
rules: {
topicStyle: [{ required: true, message: '请选择频道卡片样式', trigger: 'change' }],
mediaType: [{ required: true, message: '请选择上传类型', trigger: 'change' }],
topicSubtitle: [
{ required: true, message: '请输入频道卡片副标题', trigger: 'blur' },
{ max: 10, message: '长度在 10个字符', trigger: 'blur' }
],
topicTitle: [
{ required: true, message: '请输入频道卡片主标题', trigger: 'blur' },
{ max: 6, message: '长度在 6 个字符', trigger: 'blur' }
],
publicPraise: [{ required: true, message: '请输入口碑文案', trigger: 'blur' }],
backgroundImg: [{ required: true, message: '请选择卡片背景图', trigger: 'change' }],
channelImg: [{ required: true, message: '请上传频道banner', trigger: 'change' }],
promotion: [{ required: true, message: '请输入宣传文案', trigger: 'blur' }],
buttonRegistration: [{ required: true, message: '请输入报名按钮', trigger: 'blur' }],
mediaUrl: [{ required: true, message: '请选择视频', trigger: 'change' }],
productUrl: [{ required: true, message: '请上传产品主图', trigger: 'change' }],
picUrl: [{ required: true, message: '请上传图片', trigger: 'change' }],
mediaCover: [{ required: true, message: '请输入视频封面图', trigger: 'change' }],
pagePathContent: [{ required: true, message: '请选择页面路径', trigger: 'change' }]
},
editFormData: [],
formData: [
{
label: '频道卡片样式',
name: 'topicStyle',
type: 'radio',
addHtml: 'topicStyle',
filter: '1,2,3'
},
{
label: '频道卡片主标题',
name: 'topicTitle',
type: 'input',
maxlength: 4,
filter: '1,2,3'
},
{
label: '频道卡片副标题',
name: 'topicSubtitle',
type: 'input',
maxlength: 10,
filter: '1,2,3'
},
{
label: '卡片背景图',
name: 'backgroundImg',
addHtml: 'bgImage',
filter: '1,2,3'
},
{
label: '产品主图',
name: 'productUrl',
addHtml: 'product',
filter: '3'
},
{
label: '页面路径',
name: 'pagePathContent',
addHtml: 'pagePathContent',
filter: '3'
},
{
label: '产品价值/元',
name: 'productPrice',
type: 'input',
isDisabled: true,
filter: '3'
},
{
label: '活动价/元',
name: 'activityPrice',
type: 'input',
isDisabled: true,
filter: '3'
},
{
label: '具体内容',
name: 'merchantId',
addHtml: 'concreteContent',
filter: '1'
},
{
label: '上传类型',
name: 'mediaType',
addHtml: 'mediaType',
filter: '2'
}
],
topicStyleList: [
{
optionId: 1,
optionLabel: '视频推荐'
},
{
optionId: 2,
optionLabel: '口碑推荐'
},
{
optionId: 3,
optionLabel: '主题推荐'
}
],
activityList: [
{
itemName: '众筹活动',
itemValue: 1,
itemType: 'crowdfunding',
getInterfaceApi: this.$apis.store.crowdfundingActivity,
params: {
currentPage: 1
}
},
{
itemName: '膨胀金活动',
itemValue: 2,
itemType: 'crowdfunding',
getInterfaceApi: this.$apis.store.bulgeActivity,
params: {
currentPage: 1
}
},
{
itemName: '定保活动',
itemValue: 3,
itemType: 'crowdfunding',
getInterfaceApi: this.$apis.store.bulgeActivity,
params: {
currentPage: 1,
subscribe: 2
}
},
{
itemName: '商品',
itemValue: 5,
itemType: 'goods',
getInterfaceApi: this.$apis.store.goodsActivity,
params: {
currentPage: 1
}
}
]
}
},
props: {
merchantChannelId: {
type: String,
default: ''
},
topicId: {
type: String,
default: ''
}
},
created() {
// this.getChannelDetail()
this.initParams()
},
mounted() {
this.diffChannelStyle()
},
watch: {
topicDetail: {
handler(data) {
// 编辑数据回显
let data1 = this.$common.utils.deepClone(data)
let contentList = []
let publicPraiseArr = []
let mediaUrlArr = []
if (data1) {
data1.contentList &&
data1.contentList.forEach(item => {
item.publicPraise &&
item.publicPraise.split('|').forEach(text => {
publicPraiseArr.push({
value: text
})
})
contentList.push({
activityDetails: item.pageContentItem,
...item,
...item.mediaList[0],
mediaCoverArr: item.mediaList[0].mediaCover && [item.mediaList[0].mediaCover],
publicPraise: publicPraiseArr
})
})
if (contentList[0].mediaType == 2) {
contentList[0].mediaList.forEach(item => {
mediaUrlArr.push(item.mediaUrl)
})
}
contentList[0].mediaUrlArr = mediaUrlArr
contentList[0].picUrl = mediaUrlArr[0]
this.editForm = {
...data1,
...data1.contentList[0],
mediaType: contentList[0].mediaType,
backgroundImgArr: [],
mediaUrlArr: [],
contentList,
activityDetails: data1.contentList[0].pageContentItem
}
this.editForm.backgroundImgArr.push(this.editForm.backgroundImg)
data1.contentList[0].mediaList.forEach(item => {
this.editForm.mediaUrlArr.push(item.mediaUrl)
this.editForm.productUrl = item.mediaUrl
})
this.editForm.activityDetails.contentPrice = Number(this.editForm.activityDetails.contentPrice) / 100
this.editForm.activityDetails.activityPrice = Number(this.editForm.activityDetails.activityPrice) / 100
this.editForm.productPrice = this.editForm.activityDetails.contentPrice
this.editForm.activityPrice = this.editForm.activityDetails.activityPrice
this.isFlag = true
this.initParams()
this.diffChannelStyle()
}
},
// immediate: true,
deep: true
}
},
computed: {
...mapState({
topicDetail: state => state.channel.topicDetail,
merchantId: state => state.channel.merchantId,
videoList: state => state.channel.videoList,
channelStyle: state => state.channel.channelStyle
})
},
methods: {
...mapActions({
addChannelTopic: 'channel/addChannelTopic'
}),
diffChannelStyle() {
this.editForm.backgroundImgArr = [this.commonImg(this.bgArr[this.editForm.topicStyle - 1])]
this.editForm.backgroundImg = this.commonImg(this.bgArr[this.editForm.topicStyle - 1])
this.editForm.styleArr = [this.commonImg(this.topicStyleArr[this.editForm.topicStyle - 1])]
},
commonImg(name) {
return `https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/${name}${this.channelStyle}.png`
},
handleDelePraise(index) {
if (this.editForm.contentList[0].publicPraise.length == 1) {
return
}
this.editForm.contentList[0].publicPraise.splice(index, 1)
},
delectContent(index) {
if (this.editForm.contentList.length == 1) {
return
}
this.editForm.contentList.splice(index, 1)
},
//上传类型
changeMediaType(val) {
this.editForm.contentList = [
{
mediaType: '',
mediaUrl: '',
mediaCover: '',
pagePathContent: '',
pagePathType: '1',
promotion: '',
activityDetails: '',
mediaCoverArr: [],
mediaUrlArr: [],
buttonRegistration: '立即参加', //报名按钮
publicPraise: [{ value: '' }],
contentName: '',
contentPrice: '',
contentImage: ''
}
]
},
handleSave() {
let form1 = ''
let form2 = ''
form1 = new Promise((resolve, reject) => {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
resolve(true)
}
})
})
if (this.editForm.topicStyle != 3) {
// this.$refs.ruleForm.clearValidate()
form2 = new Promise((resolve, reject) => {
this.$refs.ruleForm.validate(valid => {
if (valid) {
resolve(true)
}
})
})
}
//判断口碑文案是否未空
if (this.editForm.topicStyle == 2) {
this.publicPraiseFlag = false
if (!this.editForm.contentList[0].publicPraise.some(item => item.value != '')) {
this.publicPraiseFlag = true
return
}
}
let promiseArr
if (this.editForm.topicStyle == 3) {
promiseArr = [form1]
} else {
promiseArr = [form1, form2]
}
Promise.all(promiseArr).then(() => {
// 表单验证通过
let contentList = []
let publicPraiseArr = []
let mediaList = []
if (this.editForm.topicStyle == 3) {
this.editForm.mediaUrlArr.forEach(item => {
mediaList.push({
mediaType: 2,
mediaUrl: item
})
})
contentList = [
{
pagePathType: this.editForm.pagePathType,
pagePathContent: this.editForm.pagePathContent,
mediaList
}
]
} else {
publicPraiseArr = this.editForm.contentList[0].publicPraise.map(item => {
return item.value
})
this.editForm.contentList.forEach(item => {
//上传类型为图片
if (this.editForm.mediaType == 2) {
item.mediaUrlArr.forEach(pic => {
mediaList.push({
mediaType: 2,
mediaUrl: pic
})
})
} else {
mediaList = []
//视频
mediaList.push({ mediaType: this.editForm.mediaType, mediaName: item.mediaName, mediaUrl: item.mediaUrl, mediaCover: item.mediaCover })
}
contentList.push({
pagePathContent: item.pagePathContent,
promotion: item.promotion,
publicPraise: publicPraiseArr.join('|'),
buttonRegistration: item.buttonRegistration,
pagePathType: item.pagePathType,
mediaList: mediaList
})
})
}
let params = {
merchantChannelId: this.merchantChannelId,
topicStyle: this.editForm.topicStyle,
topicTitle: this.editForm.topicTitle,
topicSubtitle: this.editForm.topicSubtitle,
backgroundImg: this.editForm.backgroundImg,
backgroundType: 1,
contentList
}
if (this.topicId) params.id = this.topicId
this.loading = true
this.addChannelTopic({
...params,
success: res => {
if (res.code == 0) {
this.loading = false
this.$router.go(-1)
}
this.$message({
message: res.code == '0' ? (this.topicId ? '编辑成功' : '新建成功') : res.message,
type: res.code == '0' ? 'success' : 'error'
})
}
})
})
},
//页面路径活动选择
selectActivity(data) {
if (this.currentPath == -1) {
this.editForm.activityDetails = {
...data,
...data.marketingContent,
contentName: data.marketingName,
pagePathType: data.marketingContent.selectType == 'goods' ? 2 : 1
}
this.editForm.pagePathContent = data.marketingId
if (this.editForm.activityDetails.selectType == 'goods') {
this.editForm.pagePathType = 2
this.editForm.productPrice = Number(this.editForm.activityDetails.originalPrice) / 100
this.editForm.activityPrice = Number(this.editForm.activityDetails.retailPrice) / 100
this.editForm.activityDetails.pagePathType = 2
this.editForm.activityDetails.contentName = this.editForm.activityDetails.goodsName
this.editForm.activityDetails.contentImage = this.editForm.activityDetails.goodsImage
this.editForm.activityDetails.contentPrice = Number(this.editForm.activityDetails.originalPrice) / 100
} else {
this.editForm.pagePathType = 1
if (this.editForm.activityDetails.activeName == 1) {
//众筹活动
this.editForm.productPrice = Number(this.editForm.activityDetails.originalPrice) / 100
this.editForm.activityPrice = Number(this.editForm.activityDetails.crowdFundingPrice) / 100
} else {
this.editForm.productPrice = Number(this.editForm.activityDetails.crowdFundingPrice) / 100
this.editForm.activityPrice = Number(this.editForm.activityDetails.activityPrice) / 100
}
this.editForm.activityDetails.pagePathType = 1
this.editForm.activityDetails.contentName = this.editForm.activityDetails.activityName
}
} else {
let contentList = this.editForm.contentList[this.currentPath]
contentList.activityDetails = {
data,
...data.marketingContent,
contentName: data.marketingName
}
contentList.pagePathType = contentList.activityDetails.selectType == 'goods' ? 2 : 1
contentList.activityDetails.contentName = contentList.pagePathType == 2 ? contentList.activityDetails.goodsName : contentList.activityDetails.activityName
contentList.activityDetails.contentImage = contentList.activityDetails.goodsImage
contentList.activityDetails.contentPrice = Number(contentList.activityDetails.originalPrice) / 100
contentList.pagePathContent = data.marketingId
}
if (this.editForm.topicStyle == 3) {
this.$refs.editFormRef.$refs[this.editChildRef].clearValidate('pagePathContent')
} else {
this.$refs.ruleForm.clearValidate(`contentList.${this.currentPath}.pagePathContent`)
}
},
//选择视频
changeVideo(index) {
const conTentTtem = this.editForm.contentList[index]
let data = this.videoList.filter(item => item.mediaUrl == conTentTtem.mediaUrl)
conTentTtem.mediaCoverArr = []
conTentTtem.mediaName = data[0].fileName
conTentTtem.mediaCover = data[0].coverUrl
conTentTtem.mediaUrl = data[0].mediaUrl
conTentTtem.mediaCoverArr.push(data[0].coverUrl)
conTentTtem.promotion = data[0].introduction
this.$refs.ruleForm.clearValidate(`contentList.${index}.mediaCover`)
this.$refs.ruleForm.clearValidate(`contentList.${index}.promotion`)
},
//视频预览
handleView(index) {
if (!this.editForm.contentList[index].mediaCover) {
return
}
this.dialogType = 'video'
this.dialogVisibleImg = true
this.dialogSrc = this.editForm.contentList[index].mediaUrl
},
//生成路径
handlePath(index) {
if (index == -1) {
this.currentPath = -1
this.$refs.activityModel.init()
} else {
this.currentPath = index
this.$refs.activityModel.init()
}
},
changeTopicStyle() {
this.diffChannelStyle()
this.editForm.contentList = [
{
mediaType: '',
mediaUrl: '',
mediaCover: '',
pagePathContent: '',
pagePathType: '1',
promotion: '',
activityDetails: '',
mediaCoverArr: [],
mediaUrlArr: [],
buttonRegistration: '立即参加', //报名按钮
publicPraise: [{ value: '' }]
}
]
if (this.editForm.topicStyle != 3) {
this.editForm.mediaType = 1
} else {
this.editForm.mediaUrl = ''
this.editForm.mediaType = 2
}
this.editForm.productUrl = ''
this.editForm.mediaUrlArr = []
this.editForm.mediaName = ''
this.editForm.mediaCover = ''
this.editForm.mediaUrl = ''
this.editForm.promotion = ''
this.editForm.activityDetails = ''
this.editForm.activityPrice = ''
this.editForm.productPrice = ''
this.editForm.pagePathContent = ''
this.initParams()
},
initParams() {
const formData = this.$common.utils.deepClone(this.formData)
this.$nextTick(() => {
this.editFormData = formData.filter(item => {
return !item.filter || item.filter.indexOf(this.editForm.topicStyle) != -1
})
})
},
changeChannelImg(val) {
if (val.index != -1) {
this.editForm.contentList[val.index][val.key] = val.arr[0]
} else {
this.editForm[val.key] = val.arr[0]
}
if (this.editForm.topicStyle == 3 || val.index == -1) {
this.$refs.editFormRef.$refs[this.editChildRef].clearValidate(val.key)
} else {
this.$refs.ruleForm.clearValidate(`contentList.${val.index}.${val.key}`)
}
},
handleAddItem() {
if (this.editForm.contentList.length == 6) {
this.$message({
message: '最多新增6个视频',
type: 'error'
})
return
}
this.editForm.contentList.push({
mediaType: '',
mediaUrl: '',
mediaCover: '',
pagePathContent: '',
pagePathType: '1',
promotion: '',
activityDetails: '',
mediaCoverArr: []
})
},
handleAddPraise() {
if (this.editForm.contentList[0].publicPraise.length == 10) {
this.$message({
message: '最多新增10条口碑文案',
type: 'error'
})
return
}
this.editForm.contentList[0].publicPraise.push({
value: ''
})
}
}
}
</script>
<style lang="scss" scoped>
.concrete-content {
width: 866px;
height: auto;
background: #f9f9f9;
box-sizing: border-box;
/deep/.el-form-item__content {
margin-left: 0 !important;
}
.promotion {
width: 44px;
height: 44px;
margin-right: 8px;
}
.promotion-info {
font-weight: 400;
font-size: 14px;
color: #333333;
}
.add-box {
width: 866px;
padding: 10px 20px;
box-sizing: border-box;
}
.delect-box {
width: 40px;
height: 100%;
background: #f1f1f1;
position: absolute;
top: 0;
left: 805px;
.icon-dele {
width: 20px;
height: 20px;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
.line {
width: 862px;
border: 1px dashed rgba(0, 0, 0, 0.15);
position: relative;
left: -20px;
z-index: 999;
}
.line-item {
position: relative;
height: 100%;
display: block;
padding-top: 20px;
// box-sizing: border-box;
// margin-top: 1px;
}
}
.mediaType-content {
width: 866px;
height: auto;
background: #f9f9f9;
padding: 20px 0 20px 20px;
box-sizing: border-box;
/deep/.el-form-item-public {
color: #f56c6c;
font-size: 12px;
line-height: 1;
padding-top: 4px;
position: absolute;
bottom: -26px;
left: 154px;
}
}
.preview {
font-weight: 400;
font-size: 14px;
color: #5850ff;
position: absolute;
top: 0;
left: 447px;
white-space: nowrap;
cursor: pointer;
}
.btn-basic {
display: flex;
align-items: center;
color: #5850ff;
cursor: pointer;
padding: 0;
font-size: 12px;
width: 105px;
}
.icon-add {
width: 20px;
height: 20px;
margin-right: 6px;
}
.publicPraise-box {
margin-top: -7px;
/deep/ .el-form-item__label {
color: #f1f1f1;
}
}
.dele-publicPraise {
position: absolute;
top: 0;
left: 447px;
width: 13px;
height: 13.03px;
img {
width: 100%;
}
}
.publicPraise-wrap {
position: relative;
/deep/ .el-form-item__content {
.txt-red {
// content: '*';
color: #f56c6c;
left: -80px;
position: absolute;
}
}
}
.publicPraise-box {
.txt-red {
// content: '*';
color: #fff;
left: -80px;
position: absolute;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="certificate-wrap" v-loading="loading">
<div class="gl-form-page">
<el-form ref="configForm" label-width="154px" :model="addForm" :rules="addRules">
<div class="config-form-item el-form-item">
<label class="is-require">选择券:</label>
<el-button size="small" icon="el-icon-plus" @click="handleAdd">选择券</el-button>
</div>
</el-form>
</div>
<template v-if="tableData.length > 0">
<div class="merchant-wrap">
<el-table :data="tableData" border style="width: 100%" :height="tableData.length > 15 ? 600 : auto">
<el-table-column type="index" width="50"></el-table-column>
<el-table-column prop="couponName" label="券名称" width="200"></el-table-column>
<el-table-column prop="discountType" label="券类型" width="100">
<template slot-scope="scope">
<span>{{ numToCouponText[scope.row.discountType] }}</span>
</template>
</el-table-column>
<el-table-column prop="couponAnticipatedCost" label="预估成本/元"></el-table-column>
<el-table-column prop="effectiveType" label="有效期" width="100">
<template slot-scope="scope">
<span>{{ toLabelText(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column prop="residueAmount" label="剩余库存" width="100"></el-table-column>
</el-table>
</div>
</template>
<select-gift-dialog v-if="isSelectGiftVisible" :isSelectGiftVisible="isSelectGiftVisible" :selectedGiftList="selectedGiftList" @handleGiftConfirm="handleGiftConfirm" @handleGiftClose="handleGiftClose"></select-gift-dialog>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import selectGiftDialog from './selectGiftDialog.vue'
export default {
data() {
return {
url: url,
isSelectGiftVisible: false,
selectedGiftList: [],
loading: false,
searchForm: {
subMerchantId: '',
subMerchantName: '',
select: '1',
selectInput: ''
},
openSubscribeList: [],
tableData: [],
selectedList: [],
orderShow: ['service', 'cash', 'discount', 'exchange'],
numToCoupon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
numToCouponText: {
2: '折扣券',
3: '代金券',
4: '兑换券',
7: '门店服务'
},
editForm: {
couponList: []
},
couponObj: {
// 折扣券
discount: {
label: '折扣券',
discountType: 2,
list: []
},
// 代金券
cash: {
label: '代金券',
discountType: 3,
list: []
},
// 兑换券
exchange: {
label: '兑换券',
discountType: 4,
list: []
},
// 会员服务
service: {
label: '会员服务',
discountType: 7,
list: []
}
}
}
},
components: {
selectGiftDialog
},
props: {
channelId: {
type: String,
default: ''
},
topicId: {
type: String,
default: ''
}
},
// components: {
// relateStoreDialog
// },
created() {
this.getCouponconfig()
},
methods: {
toLabelText(row) {
switch (row.effectiveType) {
case 3:
return '永久有效'
case 2:
return row.effectiveStartTime ? row.effectiveStartTime.split(' ')[0] + '-' + row.effectiveEndTime.split(' ')[0] : ''
case 1:
return row.effectiveDays + '天'
}
},
getCouponconfig() {
this.$apis.store.getCouponconfig({ topicId: this.topicId }).then(res => {
if (res.code == 0) {
res.data.coupons.forEach(item => {
item.couponAnticipatedCost = (item.couponAnticipatedCost / 100).toFixed(2)
})
this.tableData = res.data.coupons
}
})
},
handleAdd() {
// console.log(this.couponObj, '')
this.selectedGiftList = JSON.parse(JSON.stringify(this.couponObj))
this.handleGiftClose()
},
handleGiftClose() {
this.isSelectGiftVisible = !this.isSelectGiftVisible
},
handleGiftConfirm(selectedData, type) {
// console.log(selectedData, 'selectedData')
if (type != 'group') {
this.handleGiftClose()
}
this.couponObj = selectedData
this.recoveryTotalPrice()
this.recoveryGiftList()
this.getData()
},
getData() {
this.orderShow.forEach(item => {
if (this.couponObj[item].list&&this.couponObj[item].list.length) {
this.tableData = this.couponObj[item].list
}
})
},
// 计算预估成本
recoveryTotalPrice() {
this.totalEstimatedCost = 0
this.orderShow.forEach(item => {
this.couponObj[item].list.forEach(subItem => {
// 失效券不加入预估成本
if (subItem.status != '3') {
this.totalEstimatedCost = this.totalEstimatedCost + parseInt(subItem.couponAnticipatedCost || 0) * parseInt(subItem.couponAmount)
}
})
})
this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
},
// 礼包
recoveryGiftList() {
this.editForm.couponList = []
this.orderShow.forEach(item => {
this.couponObj[item].list.forEach(k => {
this.editForm.couponList.push(k)
})
})
// this.hasCouponBlock()
},
// hasCouponBlock(isValidate = true) {
// var idx = this.editFormData.findIndex(item => item.name == 'couponListBlock')
// this.editFormData[idx].isHide = !this.editForm.couponList.length
// isValidate && this.$refs.editFormRef.$refs[this.editChildRef].validateField('couponList')
// },
handleSave() {
if (this.tableData.length == 0) {
this.$message({
message: '请选择商户',
type: 'error'
})
return
}
let couponIds = []
this.tableData.forEach(item => {
couponIds.push(item.id)
})
let params = {
topicId: this.topicId,
couponIds,
couponNames: this.tableData[0].couponName
}
this.$apis.store.configCoupons(params).then(res => {
if (res.code == 0) {
this.$router.go(-1)
}
this.$message({
message: res.code == '0' ? '配置成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
})
},
handleCancel() {
this.$router.go(-1)
}
}
}
</script>
<style lang="scss" scoped>
.container {
.gl-form-page {
flex: 1;
padding: 20px;
.config-form-item {
display: flex;
margin-top: 20px;
/deep/.el-form-item__content {
width: 460px;
}
/deep/.el-input--prefix .el-input__inner {
line-height: 32px;
height: 32px;
}
}
/deep/.el-input__prefix {
line-height: 32px;
.el-input__icon {
line-height: 32px;
}
}
label {
font-size: 14px;
text-align: right;
color: #666;
width: 154px;
// margin-right: 12px;
height: 36px;
line-height: 36px;
img {
width: 14px;
height: 14px;
vertical-align: middle;
margin-left: 5px;
}
&.is-require {
&::before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
}
}
}
.merchant-wrap {
width: 700px;
margin-left: 194px;
margin-top: 10px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="membrane-content gl-form-page">
<el-form ref="ruleForm" :model="membraneForm" label-width="154px" size="small" :rules="rules">
<el-form-item label="上传类型:" prop="mediaType">
<el-radio-group v-model="membraneForm.mediaType" @input="changeMediaType">
<el-radio :label="1">视频</el-radio>
<el-radio :label="2">图片</el-radio>
</el-radio-group>
</el-form-item>
<template v-if="membraneForm.mediaType == 1">
<el-form-item label="选择视频:" prop="mediaUrl">
<el-select v-model="membraneForm.mediaUrl" placeholder="请选择视频" @change="changeVideo">
<el-option :label="video.fileName" :value="video.mediaUrl" v-for="video in videoList" :key="video.id"></el-option>
</el-select>
<div class="preview" @click="handleView">预览</div>
</el-form-item>
<el-form-item label="视频封面图:" prop="mediaCover">
<glsx-preview :picOptions="mediaCoverOptions" :imageUrlArr="membraneForm.mediaCoverArr" @change="changeChannelImg"></glsx-preview>
<!-- <div class="el-form-item__error">请上传频道banner</div> -->
</el-form-item>
<div class="text-tip">建议尺寸:184*230</div>
</template>
<template v-if="membraneForm.mediaType == 2">
<el-form-item label="图片:" prop="picUrl">
<glsx-preview limit="9" :picOptions="picOptions" :imageUrlArr="membraneForm.mediaUrlArr" @change="changeChannelImg"></glsx-preview>
</el-form-item>
</template>
<el-form-item label="宣传文案:" prop="promotion">
<el-input type="textarea" v-model="membraneForm.promotion" maxlength="100" show-word-limit></el-input>
</el-form-item>
</el-form>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="30%">
<big-view ref="viewForm" v-if="dialogVisibleImg" :dialogSrc="dialogSrc" :dialogType="dialogType"></big-view>
</el-dialog>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
data() {
return {
dialogVisibleImg: false,
dialogType: '',
membraneForm: {
mediaType: 1,
mediaCoverArr: [],
mediaUrlArr: [],
mediaUrl: '',
mediaCover: '',
promotion: '',
picUrl: ''
},
mediaCoverOptions: {
width: '92px',
height: '116.26px',
key: 'mediaCover',
isClose: true
},
picOptions: {
width: '104px',
height: '104px',
key: 'picUrl',
isClose: true
},
rules: {
mediaType: [{ required: true, message: '请选择上传类型', trigger: 'change' }],
mediaUrl: [{ required: true, message: '请选择选择视频', trigger: 'change' }],
mediaCover: [{ required: true, message: '请上传视频封面图', trigger: 'change' }],
picUrl: [{ required: true, message: '请上传图片', trigger: 'change' }],
promotion: { required: true, message: '请输入宣传文案', trigger: 'blur' }
}
}
},
computed: {
...mapState({
videoList: state => state.channel.videoList,
topicDetail: state => state.channel.topicDetail
})
},
watch: {
topicDetail: {
handler(data) {
if (data) {
this.membraneForm = {
...data.contentList[0].mediaList[0],
mediaCoverArr: [],
mediaUrlArr: [],
promotion: data.contentList[0].promotion
}
this.membraneForm.mediaCoverArr.push(this.membraneForm.mediaCover)
data.contentList[0].mediaList.forEach(item => {
this.membraneForm.mediaUrlArr.push(item.mediaUrl)
})
this.membraneForm.picUrl = this.membraneForm.mediaUrlArr[0]
}
},
// immediate: true,
deep: true
}
},
props: {
merchantChannelId: {
type: String,
default: ''
},
topicId: {
type: String,
default: ''
}
},
methods: {
...mapActions({
addChannelTopic: 'channel/addChannelTopic'
}),
handleView(row) {
if (!this.membraneForm.mediaUrl) {
return
}
this.dialogType = 'video'
this.dialogVisibleImg = true
this.dialogSrc = this.membraneForm.mediaUrl
},
changeChannelImg(val) {
this.membraneForm[val.key] = val.arr[0]
this.$refs.ruleForm.clearValidate(val.key)
},
changeMediaType(val) {
if (val == 2) {
this.membraneForm.mediaUrlArr = []
this.membraneForm.mediaName = ''
this.membraneForm.mediaCover = ''
this.membraneForm.mediaUrl = ''
this.membraneForm.promotion = ''
} else {
this.membraneForm.mediaCover = ''
this.membraneForm.mediaCoverArr = []
this.membraneForm.promotion = ''
this.membraneForm.mediaUrlArr = []
this.membraneForm.mediaUrl = ''
}
},
changeVideo(value) {
let data = this.videoList.filter(item => item.mediaUrl == value)
this.membraneForm.mediaCoverArr = []
this.membraneForm.mediaName = data[0].fileName
this.membraneForm.mediaCover = data[0].coverUrl
this.membraneForm.mediaUrl = data[0].mediaUrl
this.membraneForm.mediaCoverArr.push(data[0].coverUrl)
this.membraneForm.promotion = data[0].introduction
this.$refs.ruleForm.clearValidate('mediaCover')
this.$refs.ruleForm.clearValidate('promotion')
},
handleCancel() {
this.$router.go(-1)
},
handleSave() {
this.$refs.ruleForm.validate(valid => {
let mediaList = []
if (this.membraneForm.mediaType == 1) {
mediaList = [
{
mediaType: this.membraneForm.mediaType,
mediaName: this.membraneForm.mediaName,
mediaUrl: this.membraneForm.mediaUrl,
mediaCover: this.membraneForm.mediaCover
}
]
} else {
this.membraneForm.mediaUrlArr.forEach(item => {
mediaList.push({
mediaType: this.membraneForm.mediaType,
mediaUrl: item
})
})
}
let contentList = [
{
promotion: this.membraneForm.promotion,
mediaList
}
]
if (valid) {
let params = {
merchantChannelId: this.merchantChannelId,
topicTitle: '热门专区',
contentType: 2,
contentList,
backgroundType: 1
}
if (this.topicId) params.id = this.topicId
this.loading = true
this.addChannelTopic({
...params,
success: res => {
if (res.code == 0) {
this.loading = false
this.$router.go(-1)
}
this.$message({
message: res.code == '0' ? (this.topicId ? '编辑成功' : '新建成功') : res.message,
type: res.code == '0' ? 'success' : 'error'
})
}
})
}
})
}
}
}
</script>
<style scoped lang="scss">
.membrane-content /deep/ {
.el-textarea__inner {
min-height: 79px !important;
}
.el-form-item__error {
// margin-top: 25px;
margin-bottom: 10px;
}
.preview {
font-weight: 400;
font-size: 14px;
color: #5850ff;
position: absolute;
top: 0;
left: 447px;
white-space: nowrap;
cursor: pointer;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<!-- 选择礼包弹窗 -->
<template>
<GLDialog class="muti-gift" bigTitle="选择券" mode="big" :visible.sync="isSelectGiftVisible" :before-close="handleGiftClose" @onOk="handleGiftConfirm" @onCancel="handleGiftClose" v-loading="loading">
<div class="flex-default">
<div class="gift-table">
<el-tabs class="gift-tabs" v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="门店服务" name="service"></el-tab-pane>
<el-tab-pane label="代金券" name="cash"></el-tab-pane>
<el-tab-pane label="折扣券" name="discount"></el-tab-pane>
<el-tab-pane label="兑换券" name="exchange"></el-tab-pane>
</el-tabs>
<div>
<glsx-combi-form class="p-16" style="padding-bottom: 0px" ref="showSearch" :formObj="searchForm" :formData="searchFormData">
<span slot="footer">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
</span>
</glsx-combi-form>
<GLTable v-loading="loading" v-show="activeName == 'service'" ref="serviceRef" :tableData="giftList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList">
<div slot="radio" slot-scope="scope">
<el-radio v-model="giftId" :label="scope.scope.id" @change="handleChangeRadio">{{ '' }}</el-radio>
</div>
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="useType" slot-scope="scope">
<span>{{ toRestrictLabelText(scope.scope) }}</span>
</span>
</GLTable>
<GLTable v-loading="loading" v-show="activeName == 'cash'" ref="cashRef" :tableData="giftList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList">
<div slot="radio" slot-scope="scope">
<el-radio v-model="giftId" :label="scope.scope.id" @change="handleChangeRadio">{{ '' }}</el-radio>
</div>
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="useType" slot-scope="scope">
<span>{{ toCashRestrictLabelText(scope.scope) }}</span>
</span>
</GLTable>
<GLTable v-loading="loading" v-show="activeName == 'discount'" ref="discountRef" :tableData="giftList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList">
<div slot="radio" slot-scope="scope">
<el-radio v-model="giftId" :label="scope.scope.id" @change="handleChangeRadio">{{ '' }}</el-radio>
</div>
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="useType">
<span>-</span>
</span>
</GLTable>
<GLTable v-loading="loading" v-show="activeName == 'exchange'" ref="exchangeRef" :tableData="giftList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList">
<div slot="radio" slot-scope="scope">
<el-radio v-model="giftId" :label="scope.scope.id" @change="handleChangeRadio">{{ '' }}</el-radio>
</div>
<span slot="effectiveType" slot-scope="scope">
<span>{{ toLabelText(scope.scope) }}</span>
</span>
<span slot="useType">
<span>-</span>
</span>
</GLTable>
</div>
</div>
<!-- <div class="selected-list">
<p class="list-title p-16">已选({{ selectedSum }})</p>
<div class="list-gifts">
<div v-for="(item, index) in orderShow" :key="index">
<div class="gift-box" v-show="selectedGiftList[item].list.length">
<div class="gift-label">{{ selectedGiftList[item].label }}</div>
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in selectedGiftList[item].list" :key="subIndex">
<img class="muti-icon" v-show="subItem.status != '3'" src="@/assets/muti-selected.png" @click="handleGiftDelete(item, subIndex)" />
<img class="muti-icon" v-show="subItem.status == '3'" src="@/assets/muti-no-select.png" @click="handleGiftDelete(item, subIndex)" />
<el-tooltip effect="dark" placement="top" :disabled="subItem.couponName.length <= 8">
<p :class="['gift-coupon-name', 'ellipsis-1', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName.length > 8 ? subItem.couponName.slice(0, 8) + '...' : subItem.couponName }}</p>
<div slot="content">{{ subItem.couponName }}</div>
</el-tooltip>
<div class="gift-sum">
<el-input-number :disabled="subItem.status == '3'" class="sum-input" v-model="subItem.couponAmount" @change="handleChange" :min="1" :max="999999" size="mini" label="描述文字"></el-input-number>
</div>
</div>
</div>
</div>
</div>
</div>
</div> -->
</div>
</GLDialog>
</template>
<script>
import url from '@/assets/empty.png'
import { mapState } from 'vuex'
export default {
name: 'selectGiftDialog',
data() {
return {
// 表格组件
activeName: 'service',
userInfo: {},
giftList: [],
fnCallBack: false,
url: url,
loading: true,
selectedSum: 0,
orderShow: ['service', 'cash', 'discount', 'exchange'],
numToCoupon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
giftId: '',
// 搜索
searchForm: {
couponName: ''
},
searchFormData: [
{
label: '优惠券名称',
name: 'couponName',
type: 'input',
maxlength: 30,
width: '415px',
placeholder: '请输入券/服务名称进行搜索',
isClear: true
}
],
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
// mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '',
name: '',
addHtml: 'radio',
width: 50
},
{
label: '名称',
prop: 'couponName',
width: 180
},
{
label: '预估成本/元',
prop: 'anticipatedCost',
formatter: cellValue => {
return (cellValue.anticipatedCost / 100).toFixed(2)
}
},
{
label: '有效期',
prop: 'effectiveType',
addHtml: 'effectiveType'
},
{
label: '使用限制',
prop: 'useType',
addHtml: 'useType'
},
{
label: '剩余库存',
prop: 'residueAmount'
}
]
}
}
},
props: {
isSelectGiftVisible: {
type: Boolean,
default: false
},
selectedGiftList: {
type: Object,
default: () => {
return {
// 折扣券
discount: {
label: '折扣券',
discountType: 2,
list: []
},
// 代金券
cash: {
label: '代金券',
discountType: 3,
list: []
},
// 兑换券
exchange: {
label: '兑换券',
discountType: 4,
list: []
},
// 会员服务
service: {
label: '会员服务',
discountType: 7,
list: []
}
}
}
}
},
mounted() {
this.userInfo = this.$globalState.session
this.getList({}, true, true)
},
computed: {
...mapState({
merchantId: state => state.channel.merchantId
})
},
methods: {
getList(page, isResetPage = false, isMount = false) {
var params = {
...this.searchForm,
merchantId: this.merchantId,
discountType: this.selectedGiftList[this.activeName].discountType,
pageNum: isResetPage ? 1 : this.$refs[this.activeName + 'Ref'].page.pageNum,
pageSize: isResetPage ? 10 : this.$refs[this.activeName + 'Ref'].page.pageSize
}
this.loading = true
this.$apis.store
.getDirectionalGiftListApi(params)
.then(res => {
// 重置分页组件
if (this.$refs[this.activeName + 'Ref'] && isResetPage) {
this.$refs[this.activeName + 'Ref'].page.pageNum = 1
this.$refs[this.activeName + 'Ref'].page.pageSize = 10
}
this.giftList = res.list
this.giftList.forEach(item => {
item.couponAnticipatedCost = (item.anticipatedCost / 100).toFixed(2)
})
// this.fnCallBack = true
this.$refs[this.activeName + 'Ref'].tableTotal = res.total
// this.recoverySelected()
// this.recoveryTotal()
this.$refs[this.activeName + 'Ref'].tableHeightValues = '42vh'
})
.finally(() => {
this.loading = false
})
},
resetRecovery() {
var keyList = Object.keys(this.selectedGiftList)
keyList.forEach(item => {
this.selectedGiftList[item].list = []
})
},
handleChangeRadio(e) {
this.resetRecovery()
var targetItem = JSON.parse(JSON.stringify(this.giftList.find(item => item.id == e)))
targetItem.couponAmount = '1'
this.selectedGiftList[this.activeName].list = [targetItem]
},
handleTabClick() {
this.getList({}, true)
// this.recoverySelected()
},
handleSearch() {
this.getList({}, true)
// this.recoverySelected()
},
toLabelText(row) {
switch (row.effectiveType) {
case 3:
return '永久有效'
case 2:
return row.effectiveStartTime ? row.effectiveStartTime.split(' ')[0] + '-' + row.effectiveEndTime.split(' ')[0] : ''
case 1:
return row.effectiveDays + '天'
}
},
toRestrictLabelText(row) {
switch (row.useType) {
case 0:
return '无限制'
case 1:
return '有效期内可使用' + row.useAmount + '次'
case 2:
return '每' + row.useLimitDays + '天可以使用' + row.useAmount + '次'
}
},
toCashRestrictLabelText(row) {
switch (row.useChannel) {
case 1:
return '线上商品'
case 2:
return '到店核销'
}
},
// 恢复选择
// addSelected() {
// this.$nextTick(() => {
// var list = JSON.parse(JSON.stringify(this.selectedGiftList[this.activeName].list))
// if (list && list.length) {
// list.forEach(row => {
// var idx = this.giftList.findIndex(k => k.id == row.id)
// if (idx != -1 && row.status != '3') {
// this.$refs[this.activeName + 'Ref'].$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.giftList[idx], true)
// }
// })
// }
// })
// },
// recoverySelected() {
// // 翻页,去掉已选项
// var selectedData = this.$refs[this.activeName + 'Ref'].mutiSelectArr.list
// var deleteList = []
// this.addSelected()
// if (selectedData) {
// selectedData.forEach(item => {
// if (this.selectedGiftList[this.activeName].list.findIndex(subItem => subItem.id == item.id) == -1) {
// deleteList.push(item)
// }
// })
// this.deleteSelected(deleteList)
// }
// },
// 删除选中
// deleteSelected(deleteList) {
// this.$nextTick(() => {
// deleteList.forEach(row => {
// var idx = this.giftList.findIndex(k => k.id == row.id)
// if (idx != -1 && row.status != '3') {
// this.$refs[this.activeName + 'Ref'].$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.giftList[idx], false)
// }
// })
// })
// },
// handleGiftDelete(attr, idx) {
// var deleteList = this.selectedGiftList[attr].list.splice(idx, 1)
// this.deleteSelected(deleteList)
// this.recoveryTotal()
// },
// 计算已选张数
// recoveryTotal() {
// this.selectedSum = 0
// this.orderShow.forEach(itme => {
// this.selectedGiftList[itme].list.forEach(subItem => {
// this.selectedSum = this.selectedSum + 1
// })
// })
// },
// 选择/取消
// handleSelectionTable(val) {
// var list = JSON.parse(JSON.stringify(this.selectedGiftList[this.activeName].list))
// var count = 0
// var currentIdList = this.giftList.map(item => item.id)
// val
// .map(item => item.id)
// .forEach(k => {
// if (currentIdList.indexOf(k) != -1) {
// count = count + 1
// }
// })
// if (count <= this.giftList.length || count == 0 || !val.length) {
// this.selectedGiftList[this.activeName].list = []
// }
// val.forEach(item => {
// let isSelected = list.find(k => k.id == item.id)
// if (this.selectedGiftList[this.activeName].list.findIndex(k => k.id == item.id) == '-1') {
// this.selectedGiftList[this.activeName].list.push({
// id: item.id,
// discountType: item.discountType,
// couponName: item.couponName,
// couponAmount: isSelected ? list.find(k => k.id == item.id).couponAmount : '1',
// couponAnticipatedCost: item.couponAnticipatedCost,
// effectiveType: item.effectiveType,
// effectiveStartTime: item.effectiveStartTime,
// effectiveEndTime: item.effectiveEndTime,
// effectiveDays: item.effectiveDays,
// residueAmount: item.residueAmount,
// status: '2'
// })
// }
// })
// list.forEach(item => {
// if (item.status == '3') {
// this.selectedGiftList[this.activeName].list.push(item)
// } else if (this.giftList.findIndex(k => k.id == item.id) == '-1' && this.selectedGiftList[this.activeName].list.findIndex(k => k.id == item.id) == '-1') {
// // 没有库存的券
// this.selectedGiftList[this.activeName].list.push(item)
// }
// })
// this.recoveryTotal()
// },
handleGiftConfirm() {
var selectedData = JSON.parse(JSON.stringify(this.selectedGiftList))
this.$emit('handleGiftConfirm', selectedData)
},
handleGiftClose() {
this.$emit('handleGiftClose')
}
}
}
</script>
<style lang="scss">
.muti-gift .el-tabs__active-bar {
display: block;
}
.muti-gift .el-tabs__nav-scroll {
display: block;
border-bottom: 1px solid #eeeeee;
}
.muti-gift .el-tabs__item {
font-weight: 400;
font-size: 16px;
color: #717171;
height: 36px !important;
line-height: 36px !important;
}
.muti-gift .el-tabs__item:hover,
.muti-gift .el-tabs__item.is-active {
color: #5f5efb;
background: #fff !important;
border-width: 0px !important;
}
.muti-gift .m-t-10 {
margin-top: 10px;
}
.muti-gift .gift-table {
width: 100%;
// width: calc(100% - 280px);
border: 1px solid #eeeeee;
margin-right: 10px;
}
.muti-gift .p-16 {
padding: 16px;
}
.muti-gift .selected-list {
width: 280px;
border-radius: 2px;
border: 1px solid #eeeeee;
.list-title {
font-size: 16px;
border-bottom: 1px solid #f1f1f1;
}
.list-gifts {
height: 52vh;
overflow-y: scroll;
}
.gift-box {
padding: 16px;
.gift-label {
color: #999999;
margin-bottom: 14px;
}
.gift-content {
border-bottom: 1px solid #e5e5e5;
.gift-item {
margin-bottom: 20px;
display: inline-flex;
align-items: center;
.muti-icon {
cursor: pointer;
}
.gift-coupon-name {
display: inline-block;
width: 109px;
margin: 0 5px 0 7px;
}
.gift-sum {
display: inline-block;
width: 82px;
text-align: right;
.el-input-number--mini .el-input__inner {
padding: 0 10px;
}
.sum-input {
display: inline-block;
width: 82px;
}
.el-input--mini .el-input__inner {
border: 0px;
}
.el-input-number--mini .el-input-number__decrease,
.el-input-number--mini .el-input-number__increase {
width: 20px !important;
border: 0px;
background-color: #fff;
}
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
.gift-item:last-child {
margin-bottom: 0;
}
}
.gift-content:last-child {
border-bottom: 0px;
}
}
}
</style>
<template>
<div class="select-store">
<!-- width="600px" -->
<GLDialog bigTitle="选择门店"
mode="big"
:visible.sync="dialogVisible"
:before-close="handleClose"
:close-on-click-modal="false"
@onOk="handleConfirm"
@onCancel="handleClose">
<glsx-combi-form ref="showSearch"
labelWidth="105px"
:formObj="searchForm"
:formData="searchFormData">
<span slot="footer">
<el-button :size="size"
type="primary"
@click="resetTable">查询</el-button>
</span>
</glsx-combi-form>
<!-- : :hasPage="false"
:getListApi="getListApi"
:tableData="storeList" -->
<GLTable ref="storeRef"
:noDataImg="url"
:tableTotal="total"
:searchForm="searchForm"
:tableParams="tableParams"
:pageConf="pageConf"
@refreshTable="getList"
:tableData="storeList"
:hasNum="false"
:setTableFinishFun="setTableFinishFun">
<div slot="radioHtml"
class="store-table"
slot-scope="scope">
<el-radio v-model="merchantId"
:label="scope.scope.merchantNo"
@click.native="handleClick(scope.scope)"></el-radio>
</div>
</GLTable>
<!-- <span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleClose">取 消</el-button>
<el-button size="small" type="primary" @click="handleConfirm">确 定</el-button>
</span> -->
</GLDialog>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
name: 'selectStore',
data() {
return {
url: url,
searchForm: {
merchantId: '',
merchantName: ''
},
// getListApi: this.$apis.common.getMerchantList,
total: 0,
storeList: [],
heightBox: 200,
merchantId: '',
merchantName: '',
// 搜索
searchFormData: [
{
label: '商户名称',
name: 'merchantName',
type: 'input',
placeholder: '请输入商户名称',
width: '300px',
labelWidth: '10px'
},
{
label: '商户ID',
name: 'merchantId',
type: 'input',
inputType: 'number',
placeholder: '请输入商户ID',
width: '300px',
labelWidth: '10px'
}
],
pageConfig: {
pageSize: 10,
currentPage: 1
},
tableParams: {
listName: 'list',
// tableOption: true,
// 行数据的key
// mutiSelectUniqueKey: 'staffId',
// checkSelectKey: 'staffId',
// checkSelectVal: [],
// 多选ref的名称
// mutiSelectName: 'list',
tableColumns: [
{
label: '',
prop: '',
width: 80,
addHtml: 'radioHtml'
},
{
label: '序号',
prop: 'idx',
width: 80
},
{
label: '商户名称',
prop: 'merchantName',
formatter: cellValue => {
return cellValue.merchantName || '-'
}
},
{
label: '商户id',
prop: 'merchantNo',
formatter: cellValue => {
return cellValue.merchantNo || '-'
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
baseData: {}
}
},
props: {
dialogVisible: {
type: Boolean,
default: false
},
storeSearchForm: {
type: Object
},
merchantInfo: {
required: true
}
// merchantId: {
// type: String,
//
// }
// orderCode: {
// type: String,
// required: true
// }
},
mounted() {
// this.userInfo = this.$globalState.session
let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 0.15 * clientHeight - 425
this.merchantId = this.merchantInfo
this.getList()
},
methods: {
getList(pageCon) {
pageCon && (this.pageConfig = pageCon)
var params = {
merchantId: this.merchantId,
...this.searchForm,
...this.pageConfig
// merchantId: '44209390',
}
this.$apis.common.getMerchantList(params).then(res => {
this.storeList = res.list
this.total = res.total
// // this.storeList = res.staffUnitList
// // var page = this.$refs.staffRef.page
// // // 添加序号
// pageConfig
let nowIndex = this.pageConfig.pageSize * (this.pageConfig.currentPage - 1)
this.storeList.forEach((item, index) => {
item.idx = index + 1 + nowIndex
})
// this.$refs.staffRef.tableHeightValues = '460px'
// })
})
},
resetTable() {
this.$refs.storeRef.page.currentPage = 1
this.getList()
},
setTableFinishFun() {
// console.log(this.$refs.staffRef.data)
// this.storeList = this.$refs.staffRef.data
//接收到的数据为空
this.$refs.staffRef.tableHeightValues = '460px'
},
handleClick(val) {
// let { merchantId, merchantName } =val
this.merchantId = val.merchantNo
this.merchantName = val.merchantName
// let temp = JSON.parse(JSON.stringify(val))
// delete temp.idx
// this.staffUuid = val.uuid
// this.store = val
},
handleClose() {
this.$emit('handleRelateStoreClose')
},
handleConfirm() {
// if (!this.staffUuid)
// return this.$message({
// message: '请先选择员工',
// type: 'error'
// })
// let parmas = {
// subOrderCode: this.orderCode,
// staffUuid: this.staffUuid
// }
// this.$apis.orderManage.signerOrder(parmas).then(res => {
// console.log(res)
// })
// this.staffUuid
this.$emit('handleRelateStoreConfirm', {
merchantId: this.merchantId,
merchantName: this.merchantName
})
}
}
}
</script>
<style lang="scss">
.select-store {
.storeDailog {
width: 500px;
}
.title {
margin-bottom: 12px;
}
.customer-tag-box {
display: flex;
margin: 20px 16px;
.tag-label {
display: inline-block;
height: 30px;
line-height: 30px;
}
.input-tag-wrapper {
max-height: 75px;
overflow: auto;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 648px;
display: flex;
align-items: center;
cursor: pointer;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
}
// .customer-list {
// width: calc(100% - 280px);
// margin-right: 10px;
// }
.p-16 {
padding: 16px;
}
.store-table .el-radio__label {
display: none;
}
}
</style>
<template>
<div class="content-wrap">
<div class="container edit-container" style="min-height: 520px !important">
<p class="edit-title" id="basic">{{ contentTitle }}</p>
<component :is="currentComponent" ref="componentRef" :merchantChannelId="merchantChannelId" :topicId="topicId" :channelType="channelType"></component>
</div>
<GLFooter>
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleSave">确定</el-button>
</GLFooter>
</div>
</template>
<script>
import { mapActions, mapMutations } from 'vuex'
import carChannel from './components/carChannel.vue'
import membrane from './components/membrane.vue'
import activity from './components/activity.vue'
import certificate from './components/certificate.vue'
export default {
name: 'content',
components: {
carChannel,
membrane,
activity,
certificate
},
data() {
return {
contentTitle: '',
merchantChannelId: this.$route.query.merchantChannelId ? this.$route.query.merchantChannelId : '', //门店频道id
topicId: this.$route.query.topicId ? this.$route.query.topicId : '', //频道主题ID
channelType: this.$route.query.channelType ? this.$route.query.channelType : '', //频道类型
currentComponent: 'carChannel',
relateStoreVisible: false // 选择门店
}
},
created() {
let { $title } = this.$route.query
this.contentTitle = $title ? $title : '新增内容'
//判断显示模块
this.judgeModule()
//获取视频
this.getTencentcloudmedialist()
//编辑获取详情
if (this.topicId) {
this.getTopicDetail({ topicId: this.topicId })
} else {
this.SET_TOPIC_DETAIL({ topicDetail: '' })
}
},
methods: {
...mapActions({
getTencentcloudmedialist: 'channel/getTencentcloudmedialist',
getTopicDetail: 'channel/getTopicDetail'
}),
...mapMutations({
SET_TOPIC_DETAIL: 'channel/SET_TOPIC_DETAIL'
}),
judgeModule() {
let arr = {
'-1': 'certificate',
1: 'carChannel',
2: 'membrane',
3: 'activity',
4: 'activity'
}
this.currentComponent = arr[this.channelType]
},
handleCancel() {
this.$router.go(-1)
},
handleSave() {
this.$refs.componentRef.handleSave()
}
}
}
</script>
<style scoped lang='scss'>
.content-wrap {
.container {
min-height: 680px;
padding: 0px 0px 20px;
margin-bottom: 16px;
}
.edit-title {
font-size: 16px;
font-weight: 600;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0 32px 0;
padding: 0 0 0 20px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="edit-wrap" v-if="isFlag">
<GLTabs v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs>
<div class="container mgt16">
<GLCombiForm ref="showSearch" v-if="searchFormData.length" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset">
<div slot="createdDate">
<el-date-picker v-model="tableSearchForm.createdDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" :picker-options="pickerOptions"></el-date-picker>
</div>
</GLCombiForm>
<div class="store-head">
<div class="info">{{ tabPaneText }}列表</div>
<div>
<el-button type="primary" size="small" @click="handleAdd">编辑频道</el-button>
<el-button type="primary" plain size="small" @click="handleAddContent()">新增内容</el-button>
</div>
</div>
<GLTable ref="editRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
<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">
<el-button type="text" v-if="scope.scope.contentType == 1" @click="handleConfig(scope.scope)">{{ scope.scope.status == 0 ? '待配置' : '编辑' }}</el-button>
<template v-else>
<el-button type="text" v-if="scope.scope.status == 1 && scope.scope.topStatus == 0" @click="handleTop(scope.scope)">置顶</el-button>
<el-button type="text" @click="handleAddContent(scope.scope)">编辑</el-button>
<el-button type="text" v-if="scope.scope.status == 1" @click="handleOut(scope.scope, '下架')">下架</el-button>
<el-button type="text" v-if="scope.scope.status == 2" @click="handleOut(scope.scope, '上架')">上架</el-button>
<el-button type="text" v-if="scope.scope.status == 2" @click="handleDelect(scope.scope)">删除</el-button>
</template>
</div>
</GLTable>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import * as dayjs from 'dayjs'
import { mapState, mapMutations } from 'vuex'
export default {
name: 'App',
data() {
return {
isFlag: false,
merchantId: this.$route.query.merchantId ? this.$route.query.merchantId : '',
activeName: '',
merchantChannelId: '',
tabPaneText: '',
tableSearchForm: {
merchantName: '',
createDate: []
},
searchForm: {},
url: url,
mode: 'mid',
tabPaneList: [],
searchFormData: [],
formData: [
{
label: '频道卡片主标题',
name: 'topicTitle',
type: 'input',
filter: '1'
},
{
label: '内容类型',
name: 'contentType',
type: 'select',
placeholder: '请选择',
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'contentTypeList',
filter: '2'
},
{
label: '活动名称',
name: 'activityName',
type: 'input',
filter: '3,4'
},
{
label: '创建日期',
name: 'createdDate',
type: 'date',
addHtml: 'createdDate',
isClear: true,
filter: '1,2,3,4'
}
],
getListApi: this.$apis.store.getChannelTopicList,
tableParams: {
listName: 'data.list',
// tableOption: true,
tableColumns: []
},
tableColumns: [
{
label: '频道卡片主标题',
prop: 'topicTitle',
filter: '1',
line: 1
},
{
label: '卡片样式',
prop: 'topicStyle',
filter: '1',
formatter: cellValue => {
const data = this.baseData.styleList.filter(item => item.confId == cellValue.topicStyle)
return data.length > 0 ? data[0].confName : '--'
}
},
{
label: '宣传文案',
prop: 'promotion',
line: 1,
width: 200,
formatter: cellValue => {
return cellValue.contentList[0].promotion
},
filter: '2'
},
{
label: '内容类型',
prop: 'contentType',
width: 150,
filter: '2',
formatter: cellValue => {
let data = this.baseData.contentTypeList.filter(item => item.confId == cellValue.contentType)
return data.length && data[0].confName
}
},
{
label: '活动名称',
prop: 'activityName',
width: 150,
line: 1,
filter: '3,4',
formatter: cellValue => {
return cellValue.contentList[0].activityName
}
},
{
label: '活动时间',
prop: 'startTime',
width: 320,
filter: '3,4',
formatter: cellValue => {
return cellValue.contentList[0].startTime + '-' + cellValue.contentList[0].endTime
}
},
{
label: '活动状态',
prop: 'activityStatus',
width: 150,
formatter: cellValue => {
return cellValue.contentList[0].activityStatus == 1 ? '未开始' : cellValue.contentList[0].activityStatus == 2 ? '进行中' : '已结束'
},
filter: '3,4'
},
{
label: '状态',
prop: 'status',
formatter: cellValue => {
return cellValue.status == 1 ? '上架' : cellValue.status == 2 ? '下架' : '--'
},
filter: '1,2,3,4'
},
{
label: '创建日期',
prop: 'createdDate',
filter: '1,2,3,4',
minWidth: 180
},
{
label: '更新日期',
prop: 'updatedDate',
minWidth: 180,
filter: '1,2,3,4'
},
{
label: '操作人',
prop: 'updatedBy',
filter: '1,2,3,4'
},
{
label: '操作',
addHtml: 'auth-button',
width: 220,
fixed: 'right'
}
],
baseData: {
contentTypeList: [
{ confId: '1', confName: '优惠券' },
{ confId: '2', confName: '热门专区' }
],
styleList: [
{ confId: '1', confName: '视频推荐' },
{ confId: '2', confName: '口碑推荐' },
{ confId: '3', confName: '主题推荐' }
]
},
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now()
}
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'data.total' }
}
},
created() {
this.getconfigMerchant()
},
mounted() {},
computed: {
...mapState({
channelType: state => state.channel.channelType
})
},
methods: {
...mapMutations({
SET_MERCHANT_ID: 'channel/SET_MERCHANT_ID',
SET_CHANNEL_STYLE: 'channel/SET_CHANNEL_STYLE',
SET_CHANNEL_TYPE: 'channel/SET_CHANNEL_TYPE'
}),
getParams() {
var params = JSON.parse(JSON.stringify(this.tableSearchForm))
// if (this.tableSearchForm.createDate.length) {
// params.beginDate = new Date(this.tableSearchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
// params.endDate = new Date(this.tableSearchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
// }
params.merchantChannelId = this.merchantChannelId
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = this.getParams()
// delete this.searchForm.createDate
resolve()
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
//获取频道配置
getconfigMerchant() {
this.$apis.store.getconfigMerchant({ merchantId: this.merchantId }).then(res => {
res.forEach(item => {
this.tabPaneList.push({
label: item.channelName,
name: item.channelType + '',
merchantChannelId: item.id
})
})
this.SET_MERCHANT_ID({ id: this.merchantId })
this.SET_CHANNEL_STYLE({ channelStyle: res[0].channelStyle })
!this.channelType && this.SET_CHANNEL_TYPE({ channelType: res[0].channelType })
this.activeName = res[0].channelType + ''
this.merchantChannelId = res[0].id
this.tabPaneText = res[0].channelName
this.isFlag = true
if (this.channelType) {
this.activeName = this.channelType + ''
this.handleClick()
}
})
},
//新增编辑内容
handleAddContent(val) {
if (val) {
this.$router.push(`/store/content?merchantChannelId=${this.merchantChannelId}&topicId=${val.topicId}&channelType=${this.activeName}&$title=编辑内容`)
} else {
this.$router.push(`/store/content?merchantChannelId=${this.merchantChannelId}&channelType=${this.activeName}&$title=新增内容`)
}
},
//膜类待配置
handleConfig(val) {
this.$router.push(`/store/content?topicId=${val.topicId}&channelType=-1&$title=新增配置`)
},
handleClick() {
this.SET_CHANNEL_TYPE({ channelType: this.activeName })
this.tabPaneList.forEach(item => {
item.name == this.activeName ? ((this.merchantChannelId = item.merchantChannelId), (this.tabPaneText = item.label)) : ''
})
this.initParams()
this.$nextTick(() => {
this.handleSearch()
})
},
handleAdd(scope) {
this.$router.push(`/channel/add?merchantChannelId=${this.merchantChannelId}`)
},
handleOut(row, text) {
this.secondConfirm(text, `确定${text}此频道主题内容?`, 'store', 'updownshelvesChannel', { topicId: row.topicId })
},
handleTop(row) {
this.secondConfirm('置顶', '确定置顶此频道主题内容?', 'store', 'topshelvesChannel', { topicId: row.topicId })
},
handleDelect(row) {
this.secondConfirm('删除', '确定删除此频道主题内容?', 'store', 'deleteChannel', { topicId: row.topicId })
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
handleSearch() {
this.$refs.editRef.refreshTable()
},
handleReset() {
this.tableSearchForm = {
merchantName: '',
createDate: []
}
this.searchForm = {}
this.handleSearch()
},
setTableFinishFun() {
this.$refs.editRef.data.length ? (this.$refs.editRef.tableHeightValues = '') : this.$refs.editRef.setTableHeightFun()
},
handleEdit(val) {
this.$router.push({
path: '/store/edit'
})
},
initParams() {
this.tableParams.tableColumns = []
this.searchFormData = []
this.tableParams.tableColumns = this.tableColumns.filter(item => {
return !item.filter || item.filter.indexOf(this.activeName) != -1
})
const formData = this.$common.utils.deepClone(this.formData)
this.$nextTick(() => {
this.searchFormData = formData.filter(item => {
return !item.filter || item.filter.indexOf(this.activeName) != -1
})
this.getOptionsList('searchFormData')
})
}
}
}
</script>
<style scoped lang="scss">
.edit-wrap {
.store-head {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 0 18px 0;
.info {
font-weight: 600;
font-size: 16px;
color: #333333;
}
}
}
</style>
<template>
<div class="store-wrap">
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="store-head">
<div class="info">门店管理列表</div>
<el-button type="primary" plain size="small" @click="handleAdd">新建</el-button>
</div>
<GLTable ref="storeRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
<div slot="activityImg" 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.activityImg" />
</el-popover>
</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">
<!-- <el-button type="text" @click="handlePreview(scope.scope)">预览</el-button> -->
<el-button type="text" @click="handleEdit(scope.scope)">编辑</el-button>
<el-button type="text" @click="handleShare(scope.scope)">分享</el-button>
</div>
</GLTable>
<div v-show="false">
<div class="nodata-panel">
暂无数据,
<a @click="handleAdd()">立即创建</a>
</div>
</div>
</div>
<!-- 预览 -->
<GLDialog :mode="mode" title="预览" :visible.sync="previewVisible" :hasFooter="hasFooter">
<div class="preview-wrap">
<div class="content">
<div class="title">XX频道-频道显示</div>
<div class="content-left-img">
<img src="https://scrm.test.glsx.com.cn/group1/M00/03/89/wKgD3mOpdwGAYz3oAADubdbqeKs402.png" />
</div>
<div class="contet-bottom-info">
<div class="info-title word-hide">广汇凯威行年中直播购物节广汇凯威行年中直播购物节</div>
<div class="flex mgt15">
<img class="profile" src="https://scrm.test.glsx.com.cn/group1/M00/03/89/wKgD3mOpdwGAYz3oAADubdbqeKs402.png" />
<div class="anchor">主播:小艺、小明</div>
</div>
<div class="qr-code">
<img src="http://qcimg01.glsx.com.cn:7060/group1/M00/03/8B/wKgD3mOql2KAFOSKAAFR2Yt613E480.png" />
</div>
</div>
</div>
<div class="content">
<div class="title">XX频道-频道显示</div>
<div style="display: flex">
<img class="head" src="https://scrm.test.glsx.com.cn/group1/M00/03/89/wKgD3mOpdwGAYz3oAADubdbqeKs402.png" />
<div class="content-right-info">
<div class="advertise-title">新车频道推广</div>
<img class="advertise-pic" src="https://scrm.test.glsx.com.cn/group1/M00/03/89/wKgD3mOpdwGAYz3oAADubdbqeKs402.png" />
<div class="line"></div>
<div class="flex">
<img class="procedure-logo" src="@/assets/channel/procedure-logo.png" />
<div class="procedure">小程序</div>
</div>
</div>
</div>
</div>
</div>
</GLDialog>
<!-- 分享 -->
<GLDialog :mode="mode" title="分享" :visible.sync="shareVisible" :hasFooter="hasFooter">
<div class="preview-wrap">
<div class="share-content">
<div>
<div class="share-title">频道分享海报</div>
<el-button type="primary" @click="handleSaveImg(shareData.posterUrl)">保存图片</el-button>
</div>
<div class="poster">
<img :src="shareData.posterUrl" />
</div>
</div>
<div class="share-content">
<div>
<div class="share-title">小程序码</div>
<el-button type="primary" @click="handleSaveImg(shareData.qrCodeUrl, '小程序码')">保存图片</el-button>
</div>
<div class="qr-code">
<img :src="shareData.qrCodeUrl" />
</div>
</div>
</div>
<div class="share-footer">
<div class="share-title">小程序页面路径</div>
<div class="share-path">{{ shareData.urlLink }}</div>
<el-button class="share-btn" type="primary" @click="handleSaveTxt(shareData.urlLink)">复制链接</el-button>
</div>
</GLDialog>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import * as dayjs from 'dayjs'
import { mapMutations } from 'vuex'
export default {
name: 'App',
data() {
return {
tableSearchForm: {
merchantName: '',
createDate: []
},
searchForm: {},
url: url,
mode: 'mid',
hasFooter: false,
previewVisible: false, //预览
shareVisible: false, //分享
shareData: {},
searchFormData: [
{
label: '门店名称',
name: 'merchantName',
type: 'input'
},
{
label: '创建日期',
name: 'createDate',
type: 'datePicker',
isClear: true,
customPickerOptions: {
disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate()))
if (date > yesterday) {
return true
}
return false
}
}
}
],
getListApi: this.$apis.store.getMerchantListApi,
tableParams: {
listName: 'list',
// tableOption: true,
tableColumns: [
{
label: '门店名称',
prop: 'merchantName',
width: '250',
line:1
},
{
label: '频道个数',
prop: 'channelCount ',
// width: '120',
formatter: cellValue => {
return cellValue.channelCount || '-'
}
},
{
label: '创建日期',
prop: 'createdDate',
// width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '更新日期',
prop: 'updatedDate',
// width: '180',
formatter: cellValue => {
return dayjs(cellValue.updatedDate).format('YYYY-MM-DD HH:mm:ss')
}
},
{
label: '操作人',
prop: 'updatedBy'
},
{
label: '操作',
addHtml: 'auth-button',
fixed: 'right',
width: 300
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
}
},
created() {},
mounted() {},
methods: {
...mapMutations({
SET_CHANNEL_TYPE: 'channel/SET_CHANNEL_TYPE'
}),
getParams() {
var params = JSON.parse(JSON.stringify(this.tableSearchForm))
if (this.tableSearchForm.createDate.length) {
params.beginDate = new Date(this.tableSearchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endDate = new Date(this.tableSearchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = this.getParams()
delete this.searchForm.createDate
resolve()
})
},
//保存图片
handleSaveImg(url, downloadTxt = '海报') {
var alink = document.createElement('a')
alink.href = url
alink.setAttribute('target', '_blank')
alink.download = downloadTxt
alink.click()
alink.remove()
},
//分享
handleShare(val) {
this.$apis.store.getMerchantShare({ merchantId: val.merchantId }).then(res => {
this.shareData = res
})
this.shareVisible = true
},
//预览
handlePreview() {
this.previewVisible = true
},
//复制
handleSaveTxt(txt) {
this.$message({
message: '复制成功',
type: 'success',
customClass: 'message-Z-zinde'
})
const input = document.createElement('input')
document.body.appendChild(input)
input.setAttribute('value', txt)
input.select()
document.execCommand('Copy')
document.body.removeChild(input)
},
handleAdd(scope) {
this.$router.push('/store/add')
},
handleSearch() {
this.$refs.storeRef.refreshTable()
},
handleReset() {
this.tableSearchForm = {
merchantName: '',
createDate: []
}
this.searchForm = {}
this.handleSearch()
},
setTableFinishFun() {
if (this.$refs.storeRef.data.length) {
this.$refs.storeRef.tableHeightValues = ''
} else {
const tableSearchArr = Object.values(this.searchForm).find(item => item)
let cloneNode,
nodata = document.querySelector('.nodata-panel')
this.$nextTick(() => {
if (tableSearchArr) {
nodata.setAttribute('style', 'display:none')
cloneNode = '暂无数据'
document.querySelector('.noDataText').innerHTML = ''
document.querySelector('.noDataText').append(nodata)
} else {
nodata.setAttribute('style', 'display:block')
document.querySelector('.noDataText').innerHTML = ''
cloneNode = nodata
}
document.querySelector('.noDataText').append(cloneNode)
this.$refs.storeRef.setTableHeightFun()
})
}
},
handleEdit(val) {
this.SET_CHANNEL_TYPE({ channelType: '' })
this.$router.push({
path: `/store/edit?merchantId=${val.merchantId}`
})
}
}
}
</script>
<style scoped lang="scss">
.store-wrap {
.store-head {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 0 18px 0;
.info {
font-weight: 600;
font-size: 16px;
color: #333333;
}
}
.nodata-panel {
a {
cursor: pointer;
color: #5850ff;
}
}
.preview-wrap {
display: flex;
justify-content: space-between;
.content {
width: 335px;
height: 388px;
background: #f8f8f8;
border-radius: 2px;
padding: 20px;
box-sizing: border-box;
.title {
font-weight: 600;
font-size: 14px;
color: #333333;
margin-bottom: 10px;
}
.content-left-img {
width: 200px;
height: 200px;
img {
width: 100%;
height: 100%;
}
}
.contet-bottom-info {
width: 200px;
height: 118.42px;
background: #ffffff;
padding: 7.89px;
box-sizing: border-box;
.info-title {
font-weight: 600;
font-size: 13.16px;
color: #333333;
width: 180px;
}
.profile {
width: 19.74px;
height: 19.74px;
border-radius: 50%;
margin-right: 7.9px;
}
.anchor {
font-weight: 500;
font-size: 11.84px;
color: #999999;
}
.qr-code {
width: 51.32px;
height: 51.32px;
margin-left: 130px;
img {
width: 100%;
height: 100%;
}
}
}
.head {
width: 26px;
height: 26px;
border-radius: 2px;
margin-right: 3px;
}
.content-right-info {
width: 176px;
height: 184px;
background: #ffffff;
padding: 6px 6px 5px 10px;
.advertise-title {
font-weight: 400;
font-size: 12px;
color: #333333;
margin-left: 3px;
margin-bottom: 6px;
}
.advertise-pic {
width: 160px;
height: 127px;
}
.line {
width: 160px;
height: 0.5px;
background: #ededed;
margin: 8px auto 4.5px auto;
}
.procedure {
font-weight: 400;
font-size: 8px;
color: #666666;
}
.procedure-logo {
width: 10px;
height: 10px;
}
}
}
}
.share-content {
width: 335px;
height: 328px;
background: #f8f8f8;
border-radius: 2px;
display: flex;
justify-content: space-between;
padding: 20px;
box-sizing: border-box;
.share-title {
font-weight: 600;
font-size: 14px;
color: #333333;
margin-bottom: 50px;
}
.qr-code {
width: 120px;
height: 120px;
img {
width: 100%;
height: 100%;
}
}
.poster {
width: 152px;
height: 242px;
img {
width: 100%;
height: 100%;
}
}
}
.share-footer {
width: 680px;
height: 90px;
background: #f8f8f8;
border-radius: 2px;
margin-top: 10px;
padding: 10px 20px;
box-sizing: border-box;
.share-path {
font-weight: 600;
font-size: 14px;
color: #999999;
}
.share-title {
font-weight: 600;
font-size: 14px;
color: #333333;
margin-bottom: 10px;
}
.share-btn{
position: absolute;
right:40px;
bottom: 30px;
}
}
}
</style>
<!-- 专区管理 -->
<template>
<div class="marketing p-t-20">
<div class="m-b-20">
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">新建</el-button>
</div>
<div class="container">
<el-form :inline="true">
<el-form-item label="专区名称">
<el-input style="width: 215px;" :size="size" v-model="searchForm.zoneName"></el-input>
</el-form-item>
<el-form-item class="search-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="default" @click="handleReset">查询</el-button>
</el-form-item>
</el-form>
<!-- 表格区域 开始 -->
<GLTable
ref="zoneRef"
:getListApi="getListApi"
:noDataImg="url"
:searchForm="tableSearchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
@setTableFinishFun="setTableFinishFun"
>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleEdit(2, scope.scope)">编辑</el-button>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
export default {
name: 'zoneList',
data() {
return {
size: 'small',
url: url,
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.getZoneListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '专区名称',
prop: 'zoneName'
},
{
label: '创建日期',
prop: 'createdDate',
width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
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) {
this.$message({
type: 'success',
message: addOrEdit == '1' ? '新增' : '编辑'
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.zoneRef.data.length ? (this.$refs.zoneRef.tableHeightValues = '') : this.$refs.zoneRef.setTableHeightFun()
},
handleSearch() {
this.$refs.zoneRef.refreshTable()
},
handleReset() {
this.searchForm = {
zoneName: ''
}
this.handleSearch()
}
}
}
</script>
<style scoped>
.marketing .search-btns {
float: right;
margin-right: 0;
}
</style>
...@@ -6,7 +6,7 @@ const resolve = dir => path.join(__dirname, dir) ...@@ -6,7 +6,7 @@ const resolve = dir => path.join(__dirname, dir)
const CDN_DOMAIN = 'https://cdn.bootcdn.net/' const CDN_DOMAIN = 'https://cdn.bootcdn.net/'
const cdn = { const cdn = {
css: [`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`], css: [`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`],
js: [`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`] js: [`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`,'https://webapi.amap.com/loader.js']
} }
module.exports = { module.exports = {
outputDir: `dist`, outputDir: `dist`,
...@@ -33,7 +33,8 @@ module.exports = { ...@@ -33,7 +33,8 @@ module.exports = {
'vue-router': 'VueRouter', 'vue-router': 'VueRouter',
vuex: 'Vuex', vuex: 'Vuex',
axios: 'axios', axios: 'axios',
echarts: 'echarts' echarts: 'echarts',
AMap: 'AMap'
} }
}, },
devServer: { devServer: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!