Commit 603b7991 by 前端

Merge branch 'v3.24.0' of http://192.168.3.233:8090/saas/outbound into v3.24.0

2 parents f31dd4e2 3af1f79a
...@@ -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",
......
...@@ -1129,11 +1129,26 @@ ...@@ -1129,11 +1129,26 @@
"version": "7.18.9", "version": "7.18.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.9.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.9.tgz",
"integrity": "sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw==", "integrity": "sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw==",
"dev": true,
"requires": { "requires": {
"regenerator-runtime": "^0.13.4" "regenerator-runtime": "^0.13.4"
} }
}, },
"@babel/runtime-corejs3": {
"version": "7.23.7",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.23.7.tgz",
"integrity": "sha512-ER55qzLREVA5YxeyQ3Qu48tgsF2ZrFjFjUS6V6wF0cikSw+goBJgB9PBRM1T6+Ah4iiM+sxmfS/Sy/jdzFfhiQ==",
"requires": {
"core-js-pure": "^3.30.2",
"regenerator-runtime": "^0.14.0"
},
"dependencies": {
"regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
}
}
},
"@babel/template": { "@babel/template": {
"version": "7.18.10", "version": "7.18.10",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz",
...@@ -4078,6 +4093,11 @@ ...@@ -4078,6 +4093,11 @@
} }
} }
}, },
"core-js-pure": {
"version": "3.35.0",
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.35.0.tgz",
"integrity": "sha512-f+eRYmkou59uh7BPcyJ8MC76DiGhspj1KMxVIcF24tzP8NA9HVa1uC7BTW2tgx7E1QVCzDzsgp7kArrzhlz8Ew=="
},
"core-util-is": { "core-util-is": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
...@@ -10166,8 +10186,7 @@ ...@@ -10166,8 +10186,7 @@
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.13.9", "version": "0.13.9",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
"dev": true
}, },
"regenerator-transform": { "regenerator-transform": {
"version": "0.15.0", "version": "0.15.0",
...@@ -12820,6 +12839,23 @@ ...@@ -12820,6 +12839,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.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
}
}
},
"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",
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuedraggable": "^2.24.3", "vuedraggable": "^2.24.3",
"vuex": "^3.1.2", "vuex": "^3.1.2",
"wangeditor": "^4.7.15",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
getRedEnvelopeMerchantList (params) { getRedEnvelopeMerchantList (params) {
params.method = 'scrm.api.carlife.merchant.listWithPageByCurMerchant' params.method = 'scrm.api.carlife.merchant.listWithPageByCurMerchant'
params.pageSize = 50 params.pageSize = params.pageSize || 50
return http({ return http({
url: '/rop-scrm-carlife/router', url: '/rop-scrm-carlife/router',
data: params data: params
......
<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>
\ No newline at end of file \ No newline at end of file
<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>
<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>
...@@ -8,18 +8,25 @@ ...@@ -8,18 +8,25 @@
*/ */
// 本地环境配置 // 本地环境配置
module.exports = { module.exports = {
title: 'scrm-sub-marketing',
response: { response: {
data_key: 'data', data_key: 'data',
message_key: 'message', message_key: 'message',
code_key: 'code', code_key: ['code', 'returnCode'],
code_success_value: '0', code_success_value: '0',
errId_logout_value: '21', errId_logout_value: '21',
code_message_map: {} code_message_map: {}
}, },
request: { request: {
// baseURL: 'http://scrm.test.glsx.com.cn/', baseURL: "https://scrm.dev.glsx.com.cn",
baseURL: 'http://192.168.2.42:8064/', // 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
request_common: {
baseURL: "//didicb.glsx.com.cn",
// 设置超时时间 // 设置超时时间
timeout: 180000, timeout: 180000,
// 携带凭证 // 携带凭证
...@@ -31,9 +38,13 @@ module.exports = { ...@@ -31,9 +38,13 @@ module.exports = {
appKey: '48e5e13229b82c1b4e6e8c96151f0637', appKey: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0', v: '1.0.0',
format: 'json', format: 'json',
source: '' source: 'scrm-home'
},
sign_common: {
app_key: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
source: 'glsx'
}, },
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b', secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
cdn: 'https://www.xxx.cn/static'
} }
<template>
<div class="box">
<div class="content">
<div class="title">{{title}}</div>
<el-scrollbar class="form-box">
<glsx-combi-form
class="from"
ref="formRef"
:isEdit="true"
:isBlock="true"
:formObj="configForm"
:formData="formData"
:formRules="rule"
>
<div
slot="cardCover"
class="edit-tips"
>图片大小10M</div>
<template #endTimeType>
<div
v-if="configForm.endTimeType == 1"
class="item-box"
>
<el-date-picker
v-model="configForm.endTime"
type="datetime"
placeholder="选择日期时间"
:picker-options="afterRangePickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
class="end-time"
>
</el-date-picker>
</div>
</template>
<template #winningTime>
<el-date-picker
v-model="configForm.winningTime"
type="datetime"
placeholder="选择日期时间"
:picker-options="afterRangePickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
class="end-time"
>
</el-date-picker>
</template>
<template #groupType>
<div
v-if="configForm.groupType == 1"
class="item-box"
>
<div class="label">群聊列表:</div>
<el-select
v-model="configForm.groupList"
multiple
placeholder="请选择"
filterable
multiple-limit="10"
class="options"
collapse-tags
>
<el-option
v-for="item in groupList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
</template>
<template #prizeId>
<prize-box
:form="configForm"
@choose="choose"
ref="prizeRef"
/>
</template>
</glsx-combi-form>
</el-scrollbar>
</div>
<GLFooter>
<el-button
@click="$router.go(-1)"
size="medium"
>取消</el-button>
<el-button
type="primary"
@click="handleConfirm"
size="medium"
>确定</el-button>
</GLFooter>
</div>
</template>
<script type='text/ecmascript-6'>
import { formData, rule, afterRangePickerOptions } from './addJS/add.js'
import PrizeBox from './components/PrizeBox.vue'
export default {
components: { PrizeBox },
name: '',
data () {
return {
afterRangePickerOptions,
title: this.$route.query.$title,
configForm: {
type: 1,
description: '',
merchantId: '',
// 44212575
cardTitle: '',
cardCover: '',
maxNumber: 9,
winningNumber: 0,
endTimeType: 0,
endTime: '',
winningTime: '',
groupType: 0,
groupList: [],
prizeId: '',
prizeType: ''
},
rule: rule(this),
formData: formData(this),
groupList: [],
}
},
watch: {
'configForm.merchantId' (n) {
this.$refs.prizeRef.reset()
this.configForm.groupList = []
this.choose({
prizeId: '',
prizeType: ''
})
},
'configForm.maxNumber' (n) {
this.configForm.winningNumber = 0
this.formData.find(e => e.name == 'winningNumber').optionList.map(i => {
i.isDisabled = i.optionId > n
})
},
'configForm.groupType' (n) {
if (n == 1 && !this.configForm.merchantId) {
this.configForm.groupType = 0
this.showError()
}
}
},
computed: {
formRef () {
return this.$refs.formRef.$refs.formRef
}
},
mounted () {
},
methods: {
showError (message) {
this.$message.error(message || '请先选择所属渠道!')
},
async getMerchantList (merchantName = '') {
this.$loading()
try {
const { list } = await this.$apis.redenvelope.getRedEnvelopeMerchantList({
currentPage: 1,
merchantName,
pageSize: 100
}),
data = []
list && list.map(e => {
data.push({
confId: e.merchantNo,
confName: e.merchantName,
})
})
this.formData.find(e => e.name == 'merchantId').optionList = data
this.$loading().close()
} catch (error) {
console.log(error)
this.$loading().close()
}
},
choose ({ prizeId, prizeType }) {
this.configForm.prizeId = prizeId
this.configForm.prizeType = prizeType
this.formRef.clearValidate('prizeId')
},
handleConfirm () {
this.formRef.validate(valid => {
console.log(valid)
})
},
}
}
</script>
<style scoped lang='scss'>
.box {
position: absolute;
width: 100%;
height: calc(100vh - 48px);
top: 0;
left: 0;
.content {
height: calc(100% - 88px);
background-color: #fff;
border-radius: 0 4px 4px 4px;
margin: 16px;
.form-box {
width: 100%;
height: calc(100% - 59px);
box-sizing: border-box;
.from {
margin-top: 30px;
/deep/.activity-img {
width: 104px;
height: 104px;
}
/deep/.muti-imgs {
.img-w-h,
.img-btns {
width: 106px;
height: 106px;
}
}
}
/deep/.el-scrollbar__wrap {
&::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
}
}
}
.title {
font-weight: 500;
font-size: 16px;
color: #333333;
line-height: 28px;
padding: 15px 20px;
border-bottom: 1px solid #e5e5e5;
background-color: #fff;
}
.edit-tips {
font-size: 14px;
color: #999999;
}
.item-box {
width: 480px;
height: 52px;
background: #f9f9f9;
display: flex;
align-items: center;
padding-left: 20px;
box-sizing: border-box;
.end-time,
.options {
width: 284px;
/deep/.el-input {
width: 100% !important;
}
/deep/.el-tag--info {
max-width: 50%;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
import * as dayjs from 'dayjs'
const generateOptionsArray = function (count = 9) {
return Array.from({ length: count }, (_, index) => ({
optionId: Number(index + 1),
optionLabel: Number(index + 1)
}))
},
required = true,
trigger = 'change'
export const formData = that => {
return [
{
label: '所属渠道',
name: 'merchantId',
type: 'select',
width: '432px',
attrs: {
'filter-method': (e) => {
that.getMerchantList(e)
},
remote: true
},
noFilter: false,
optionList: [],
optionId: 'confId',
optionLabel: 'confName'
},
{
label: '群接龙种类',
type: 'radio',
name: 'type',
optionList: [
{
text: '猜数字',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
},
{
label: '群接龙说明',
name: 'description',
type: 'textBox',
excludeMenus: ['video', 'code', 'table', 'splitLine'],
boxHeight: 240
},
{
label: '卡片标题',
name: 'cardTitle',
type: 'input',
maxlength: 20
},
{
label: '卡片封面',
name: 'cardCover',
type: 'upload',
width: '320px',
limitSize: 10,
maxPhotoNum: 1,
suffixSlot: 'cardCover',
beforeLoading: true,
handleUpload: async (e, file, targetItem, config) => {
try {
const { result: imgFile } = e.target,
arrBase64 = imgFile.split(',')[1],
str = file.name.split('.'),
base64 = str.at(-1) + '@' + arrBase64,
res = await that.$apis.common.pictureUpload({ file: base64, fileType: 'image' })
that.$loading().close()
if (res) {
config[targetItem.name] = res
that.formRef.validateField(targetItem.name)
} else throw '上传失败'
} catch (error) {
that.$loading().close()
that.$message(error)
}
}
},
{
label: '数字上限',
name: 'maxNumber',
type: 'select',
optionList: generateOptionsArray(),
optionId: 'optionId',
optionLabel: 'optionLabel',
},
{
label: '中奖数字',
name: 'winningNumber',
type: 'select',
optionList: [
{
optionId: 0,
optionLabel: '随机'
},
...generateOptionsArray()
],
optionId: 'optionId',
optionLabel: 'optionLabel',
},
{
label: '接龙结束时间',
type: 'radio',
name: 'endTimeType',
optionList: [
{
text: '无限制',
id: 0
},
{
text: '选择时间',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
suffixSlot: 'endTimeType',
},
{
label: '接龙开奖时间',
name: 'winningTime',
addHtml: 'winningTime'
},
{
label: '转发群限制',
type: 'radio',
name: 'groupType',
optionList: [
{
text: '无限制',
id: 0
},
{
text: '限制群',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
suffixSlot: 'groupType',
},
{
label: '关联奖品',
name: 'prizeId',
addHtml: 'prizeId'
}
]
}
export const rule = that => {
return {
type: [{ required, message: '请选择接龙种类', trigger }],
merchantId: [{ required, message: '请选择所属渠道', trigger }],
description: [{ required, message: '请输入群接龙说明', trigger }],
cardTitle: [{ required, message: '请输入卡片标题', trigger }],
cardCover: [{ required, message: '请上传卡片封面', trigger }],
maxNumber: [{ required }],
winningNumber: [{ required }],
endTimeType: [{
required,
validator: (rule, value, callback) => {
try {
if (value == 1) {
if (!that.configForm.endTime) throw '请选择接龙结束时间'
else {
if (dayjs(that.configForm.endTime).valueOf() < dayjs().valueOf()) throw '接龙结束时间需大于当前时间'
}
}
callback()
} catch (error) {
callback(new Error(error))
}
},
}],
winningTime: [{
required, trigger,
validator: (rule, value, callback) => {
try {
if (!value) throw '请选择接龙开奖时间'
else {
if (that.configForm.endTimeType != 1) {
if (dayjs(value).valueOf() < dayjs().valueOf()) throw '接龙开奖时间需大于当前时间'
} else {
if (dayjs(value).valueOf() < dayjs(that.configForm.endTime).valueOf()) throw '接龙开奖时间需大于或等于接龙结束时间'
}
}
callback()
} catch (error) {
callback(new Error(error))
}
},
}],
groupType: [{
required,
validator: (rule, value, callback) => {
if (value == 1 && !that.configForm.groupList.length) {
callback(new Error('请选择群'))
}
callback()
},
}],
prizeId: [{ required, message: '请选择关联奖品', trigger }]
}
}
export const afterRangePickerOptions = {
disabledDate (time) {
let oneDay = 60 * 60 * 24 * 1000;
return time.getTime() < Date.now() - oneDay
},
}
// computed: {
// afterRangePickerOptions () {
// //这里判断是不是今天
// let newVal = new Date(this.configForm.endTime)
// let selectableRange = '00:00:00 - 23:59:59' //默认的时间范围
// if (
// newVal &&
// newVal.getFullYear() == new Date().getFullYear() &&
// newVal.getMonth() == new Date().getMonth() &&
// newVal.getDate() == new Date().getDate()
// ) {
// //如果为今天,则限制当前时间前的时间+1分钟不能选择。
// selectableRange = new Date().getHours() + ':' + (new Date().getMinutes() + 1) + ':00 - 23:59:59'
// }
// return {
// selectableRange,
// disabledDate (time) {
// // 只能选大于当前截止时间的
// return time.getTime() < Date.now() - 8.64e7
// }
// }
// }
// }
\ No newline at end of file \ No newline at end of file
<template>
<div
@click="chooseRed(data.id)"
:class="['item',{'disabled':disabled},{'active':configForm.prizeId == data.id}]"
>
<div class="radio">
<img src="@/assets/red-radio.png" />
</div>
<div class="icon">
<img src="@/assets/activity-2.png" />
</div>
<div class="icon"></div>
<div class="title">{{ data.couponName }}</div>
<template v-if="[2,3,6].includes(data.effectiveType)">
<div class="type">有效期:
<template v-if="data.effectiveType == 2">
{{ data.effectiveStartTime ? data.effectiveStartTime.split(' ')[0] : '' }}~{{ data.effectiveEndTime ? data.effectiveEndTime.split(' ')[0] : '' }}
</template>
<template v-if="data.effectiveType == 3">
无限制
</template>
<template v-if="data.effectiveType == 6">
{{ data.effectiveDays }}天
</template>
</div>
</template>
<div class="time">使用途径: {{ data.useChannel == 1 ? '线上商品' : '到店核销' }}</div>
<div class="status flex">数量:{{ data.residueAmount || 0 }}</div>
</div>
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
export default {
name: '',
props: {
data: {
type: Object,
default: () => { }
},
configForm: {
type: Object,
default: () => { }
},
disabled: Boolean
},
data () {
return {
dayjs,
}
},
mounted () {
},
methods: {
chooseRed (id) {
const { prizeId } = this.configForm,
{ disabled } = this
if (disabled) return
if (prizeId && prizeId == id) id = ''
this.$emit('choose', id)
}
}
}
</script>
<style scoped lang='scss'>
.item {
width: 100%;
height: 96px;
background: #fff;
border-radius: 4px;
box-sizing: border-box;
cursor: pointer;
padding: 0 16px;
font-size: 12px;
color: #999999;
line-height: 17px;
position: relative;
user-select: none;
.icon {
position: absolute;
right: 0;
bottom: 0;
width: 28px;
height: 28px;
}
.radio {
display: none;
}
.title {
font-weight: 500;
font-size: 14px;
color: #333333;
padding: 10px 0 7px;
}
&:hover {
opacity: 0.95;
}
}
.active {
border-color: #5850ff;
.radio {
display: block;
position: absolute;
right: 0;
top: 0;
width: 16px;
height: 16px;
background-color: #5850ff;
border-radius: 0 0 0 4px;
overflow: hidden;
}
&::after{
content:'';
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border: 1px solid #5850ff;
box-sizing: border-box;
}
}
.disabled {
cursor: not-allowed;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div
@click="chooseRed(data.equityClassId)"
:class="['item',{'disabled':disabled},{'active':configForm.prizeId == data.equityClassId}]"
>
<div class="radio">
<img src="@/assets/red-radio.png" />
</div>
<div class="icon">
<img src="@/assets/activity-3.png" />
</div>
<div class="title">品牌:{{ data.equityName }}</div>
<div class="time">商品名称:{{data.orderCode}}</div>
<div class="status flex">券面额:{{data.freeDay }}天</div>
</div>
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
export default {
name: '',
props: {
data: {
type: Object,
default: () => { }
},
configForm: {
type: Object,
default: () => { }
},
disabled: Boolean
},
data () {
return {
dayjs,
}
},
mounted () {
},
methods: {
chooseRed (id) {
const { prizeId } = this.configForm,
{ disabled } = this
if (disabled) return
if (prizeId && prizeId == id) id = ''
this.$emit('choose', id)
}
}
}
</script>
<style scoped lang='scss'>
.item {
width: 100%;
height: 75px;
background: #fff;
border-radius: 4px;
box-sizing: border-box;
cursor: pointer;
padding: 0 16px;
font-size: 12px;
color: #999999;
line-height: 17px;
position: relative;
user-select: none;
.icon {
position: absolute;
right: 0;
bottom: 0;
width: 28px;
height: 28px;
}
.radio {
display: none;
}
.title {
padding-top: 12px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
&:hover {
opacity: 0.95;
}
}
.active {
.radio {
display: block;
position: absolute;
right: 0;
top: 0;
width: 16px;
height: 16px;
background-color: #5850ff;
border-radius: 0 0 0 4px;
overflow: hidden;
}
&::after{
content:'';
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border: 1px solid #5850ff;
box-sizing: border-box;
}
}
.disabled {
cursor: not-allowed;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="tab-box">
<el-tabs
ref="tabs"
v-model="prizeType"
@tab-click="handleClick"
>
<template v-for="(i,index) in prizeList">
<el-tab-pane
:key="index"
:label="i.label"
:name="i.name"
>
<template v-if="dataList[i.name].list.length">
<div class="content-box">
<template v-for="(item,ind) in dataList[i.name].list">
<template>
<component
:key="ind"
:is="{
3: 'EquityItem',
2: 'CouponItem',
1: 'RedEnvelopeItem'
}[prizeType]"
:configForm="form"
:data="item"
@choose="choose"
></component>
</template>
</template>
</div>
<el-pagination
background
@current-change="handleCurrentChange"
:page-size="15"
layout="total, prev, pager, next"
:total="dataList[i.name].total"
>
</el-pagination>
</template>
<template v-else>
<div class="nothing">
<img :src="url">
暂无数据
</div>
</template>
</el-tab-pane>
</template>
</el-tabs>
</div>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/empty.png'
import EquityItem from './EquityItem.vue'
import CouponItem from './CouponItem.vue'
import RedEnvelopeItem from './RedEnvelopeItem.vue'
export default {
name: 'prize-box',
components: { RedEnvelopeItem, EquityItem, CouponItem },
props: {
form: {
type: Object,
default: () => { }
}
},
data () {
return {
url,
prizeType: 1,
prizeList: [
{ label: '红包活动', name: 1 },
{ label: '商城券', name: 2 },
{ label: '权益卡券', name: 3 },
],
dataList: {
1: {
list: [],
total: 0,
pageNum: 1
},
2: {
list: [],
total: 0,
pageNum: 1
},
3: {
list: [],
total: 0,
pageNum: 1
}
}
}
},
mounted () {
this.init()
},
methods: {
reset () {
this.dataList = this.$options.data.call(this).dataList
this.handleClick()
},
init () {
const { prizeType } = this
this.$nextTick(() => {
this.$refs.tabs.$emit('tab-click', { name: prizeType })
})
},
handleClick () {
this.resetActivePosition(this.$refs.tabs.$el)
this.getActivityList()
},
resetActivePosition ($el) { // tabs的样式修改
this.$nextTick(() => {
const activeEl = $el.querySelector('.el-tabs__item.is-active'),
lineEl = $el.querySelector('.el-tabs__active-bar'),
style = getComputedStyle(activeEl),
pl = style.paddingLeft.match(/\d+/)[0] * 1,
pr = style.paddingRight.match(/\d+/)[0] * 1,
w = style.width.match(/\d+/)[0] * 1
lineEl.style.transform = 'translateX(' + (activeEl.offsetLeft + pl) + 'px)'
lineEl.style.width = (w - pl - pr) + 'px'
})
},
handleCurrentChange (e) {
console.log(e)
},
async getActivityList () {
const { prizeType: index } = this,
{ merchantId } = this.form,
{ pageNum } = this.dataList[index],
targetApi = {
3: 'getEquityActivityList',
2: 'getMerchantCouponList',
1: 'getActivityRedEnvelopeList'
}[index],
params = {
merchantId,
pageNum,
pageSize: 15
}
if (!merchantId) return
try {
this.$loading()
const res = await this.$apis.questionnaire[targetApi](params)
let data = res
this.dataList[index].list = index == 2 ? data.list : data
this.$loading().close()
} catch (error) {
console.log(error)
this.$loading().close()
}
},
choose (prizeId) {
this.$emit('choose', {
prizeId,
prizeType: this.prizeType
})
}
}
}
</script>
<style scoped lang='scss'>
.tab-box {
width: 824px;
padding: 0 20px 20px;
background: #f9f9f9;
/deep/.el-tabs--top {
line-height: 56px;
}
/deep/.el-tabs__item.is-active {
font-weight: 700;
}
/deep/.el-pager {
line-height: 28px;
}
.content-box {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-top: 5px;
}
.nothing {
display: flex;
flex-direction: column;
padding: 4px 0;
justify-content: center;
align-items: center;
color: #909399;
font-size: 14px;
img {
margin-bottom: 12px;
width: 64px;
height: 40px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div
@click="chooseRed(data.id)"
:class="['item',{'disabled':disabled},{'active':configForm.prizeId == data.id}]"
>
<div class="radio">
<img src="@/assets/red-radio.png" />
</div>
<div class="icon">
<img src="@/assets/activity-1.png" />
</div>
<div class="title">{{ data.activityName }}</div>
<div class="type">活动形式:{{ {0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[data.activityType] }}</div>
<div class="time">活动时间:{{dayjs(data.activityStartTime).format('YYYY/MM/DD')}}-{{dayjs(data.activityEndTime).format('YYYY/MM/DD')}}</div>
<div class="status">状态:{{ {0: '活动待进行', 1: '活动进行中', 2: '红包已用完', 3: '活动已结束' }[data.activityStatus] }}</div>
</div>
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
export default {
name: '',
props: {
data: {
type: Object,
default: () => { }
},
configForm: {
type: Object,
default: () => { }
},
disabled: Boolean
},
data () {
return {
dayjs,
}
},
mounted () {
},
methods: {
chooseRed (id) {
const { prizeId } = this.configForm,
{ disabled } = this
if (disabled) return
if (prizeId && prizeId == id) id = ''
this.$emit('choose', id)
}
}
}
</script>
<style scoped lang='scss'>
.item {
width: 100%;
height: 96px;
background: #fff;
border-radius: 4px;
box-sizing: border-box;
cursor: pointer;
padding: 0 16px;
font-size: 12px;
color: #999999;
line-height: 17px;
position: relative;
user-select: none;
.radio {
display: none;
}
.icon {
position: absolute;
right: 0;
bottom: 0;
width: 28px;
height: 28px;
}
.title {
font-weight: 500;
font-size: 14px;
color: #333333;
padding: 10px 0 7px;
}
&:hover {
opacity: 0.95;
}
}
.active {
border-color: #5850ff;
.radio {
display: block;
position: absolute;
right: 0;
top: 0;
width: 16px;
height: 16px;
background-color: #5850ff;
border-radius: 0 0 0 4px;
overflow: hidden;
}
&::after {
content: '';
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border: 1px solid #5850ff;
box-sizing: border-box;
}
}
.disabled {
cursor: not-allowed;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="layout">
<div class="fixed-content">
<template v-for="(i,index) in fixedForm">
<template>
<div
:key="index"
class="item flex"
>
<div class="label">{{i.label}}:</div>
<div class="value">
<template v-if="i.formatter">
{{i.formatter(data)}}
</template>
<template v-else>
{{ data[i.key] || '--'}}
</template>
</div>
</div>
</template>
</template>
</div>
<div class="container">
<div class="sticky">
<GLCombiForm
ref="showSearch"
:rowNumber="2"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<div class="sticky-btns">
<div class="btns">
<el-button
type="default"
@click="handleExport"
>导出</el-button>
</div>
</div>
</div>
<div class="tabelList">
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="searchForm"
:noDataImg="url"
:tableParams="tableParams"
:pageConf="pageConf"
>
<template
slot="status"
slot-scope="scope"
>
<div :class="`status status-${scope.scope.status}`">
{{{
'0':'未领取',
'1':'已领取'
}[scope.scope.status]}}
</div>
</template>
</GLTable>
</div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/empty.png'
import { exportFn } from '@/common/constant'
import util from '@/utils/util'
const solitaireTableColumns = [
{
label: '手机号码',
prop: 'name',
minWidth: 120
},
{
label: '用户名称',
prop: 'cardTitle',
minWidth: 100
},
{
label: '接龙数字',
prop: 'cardTitle',
minWidth: 100
},
{
label: '接龙时间',
prop: 'cardTitle',
minWidth: 100
},
], winningTableColumns = [
{
label: '手机号码',
prop: 'name',
minWidth: 120
},
{
label: '用户名称',
prop: 'cardTitle',
minWidth: 100
},
{
label: '接龙数字',
prop: 'cardTitle',
minWidth: 100
},
{
label: '接龙时间',
prop: 'cardTitle',
minWidth: 100
},
{
label: '状态',
minWidth: 100,
addHtml: 'status'
},
]
export default {
name: 'Questionnaire',
data () {
return {
url,
data: {},
fixedForm: [
{
label: '卡片标题',
key: ''
},
{
label: '创建时间',
formatter (cell) {
return cell
}
},
{
label: '开奖时间',
formatter (cell) {
return cell
}
},
{
label: '中奖数字',
key: ''
},
{
label: '关联奖品',
key: ''
},
{
label: '所属渠道',
key: ''
},
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
searchForm: {
phone: '',
name: '',
activityTime: ''
},
searchFormData: [
{
label: '手机号码',
name: 'phone',
type: 'input',
maxlength: 11
},
{
label: '用户名称',
name: 'name',
type: 'input',
maxlength: 100
},
{
label: '接龙时间',
name: 'activityTime',
type: 'datePicker',
isClear: true,
valueFormat: 'yyyy-MM-dd',
customPickerOptions: {
disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate()))
return date > yesterday
}
}
},
],
getListApi: this.$apis.questionnaire.getQuestionnaireList,
tableParams: {
listName: 'data',
tableColumns: this.$route.query.type ? winningTableColumns : solitaireTableColumns
},
}
},
mounted () {
},
methods: {
handleSearch () {
this.$refs.listRef.refreshTable()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
handleExport () {
this.$apis.questionnaire.exportQuestionnaireList({ ...this.searchForm, ...this.$refs.listRef.page }).then(res => {
exportFn(res)
})
},
download (url) {
util.downloadIamge(url)
},
}
}
</script>
<style scoped lang='scss'>
.layout {
height: calc(100vh - 80px);
.fixed-content {
height: 100px;
background: #ffffff;
margin-bottom: 16px;
display: grid;
grid-template-columns: repeat(3, 1fr);
font-size: 14px;
color: #666666;
.item {
line-height: 20px;
.label {
width: 154px;
text-align: right;
flex-shrink: 0;
}
.value {
color: #333333;
}
}
}
.container {
height: calc(100% - 116px);
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 20px;
overflow-y: scroll;
.sticky {
position: relative;
z-index: 2;
/deep/.el-tag--info {
max-width: 50%;
}
&-btns {
position: absolute;
right: 0;
bottom: 10px;
overflow: hidden;
.el-button + .el-button {
margin-left: 8px;
}
.btns {
transition: all 0.25s;
.el-button {
padding: 8px 15px;
min-width: 60px;
}
}
}
}
.qr {
width: 36px;
height: 36px;
img {
width: 100%;
height: 100%;
vertical-align: top;
}
}
}
}
.img-plus {
width: 200px;
height: 200px;
}
.download-img {
cursor: pointer;
margin-top: 10px;
font-size: 14px;
font-weight: 600;
color: #5850ff;
line-height: 20px;
text-align: center;
}
.status {
display: flex;
align-items: center;
&::before {
content: '';
width: 8px;
height: 8px;
border-radius: 100%;
margin-right: 8px;
background: #999999;
}
}
.status-0 {
&::before {
background: #f8b757;
}
}
.status-1 {
&::before {
background: #4aca74;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div>
<el-button
type="primary"
size="small"
@click="editForm"
icon="el-icon-plus"
>新建接龙</el-button>
<div class="container">
<div class="sticky">
<GLCombiForm
ref="showSearch"
:rowNumber="2"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<div class="sticky-btns">
<div class="btns">
<el-button
type="default"
@click="handleExport"
>导出</el-button>
</div>
</div>
</div>
<div class="tabelList">
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="searchForm"
:noDataImg="url"
:tableParams="tableParams"
:pageConf="pageConf"
>
<template
slot="qrcode"
slot-scope="scope"
>
<el-popover
placement="top"
trigger="click"
>
<img
class="img-plus"
:src="scope.scope.qrcode"
/>
<div
class="download-img "
@click="download(scope.scope.qrcode)"
>下载二维码</div>
<div
slot="reference"
class="qr"
>
<img :src="scope.scope.qrcode" />
</div>
</el-popover>
</template>
<template
slot="status"
slot-scope="scope"
>
<div :class="`status status-${scope.scope.status}`">
{{{
'-1':'已结束',
'0':'已结束',
'1':'已开始'
}[scope.scope.status]}}
</div>
</template>
<span
slot="auth-button"
slot-scope="scope"
>
<GLTableButton
:buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"
></GLTableButton>
</span>
</GLTable>
</div>
<GLDialog
:title="updateParams.title"
@onOk="updateQiestionStatus"
@onCancel="updateParams.show = false"
:visible.sync="updateParams.show"
mode="small"
>
<template #default>
<div class="over-box">
<div class="el-icon-warning"></div>
{{updateParams.text}}
</div>
</template>
</GLDialog>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/empty.png'
import { exportFn } from '@/common/constant'
import util from '@/utils/util'
export default {
name: 'Questionnaire',
data () {
return {
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
searchForm: {
merchantName: '',
name: '',
statuses: '0,1'
},
searchFormData: [
{
label: '卡片标题',
name: 'name',
type: 'input',
maxlength: 100
},
{
label: '状态',
name: 'statuses',
type: 'select',
maxlength: 100,
optionList: [
{ text: '全部', id: '0,1' },
{ text: '已开始', id: '0' },
{ text: '已结束', id: '1' },
],
optionId: 'id',
optionLabel: 'text'
},
{
label: '所属渠道',
name: 'merchantNames',
type: 'select',
width: '215px',
multiple: true,
attrs: {
multipleLimit: 10
},
noFilter: false,
optionList: [],
optionId: 'value',
optionLabel: 'label'
},
{
label: '创建时间',
name: 'activityTime',
type: 'datePicker',
isClear: true,
valueFormat: 'yyyy-MM-dd',
customPickerOptions: {
disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate()))
return date > yesterday
}
}
},
],
getListApi: this.$apis.questionnaire.getQuestionnaireList,
tableParams: {
listName: 'data',
tableOption: true,
tableColumns: [
{
label: '群接龙种类',
prop: 'name',
minWidth: 120
},
{
label: '所属渠道',
minWidth: 100,
formatter: cell => `${cell.merchantId}/${cell.merchantName}`
},
{
label: '卡片标题',
prop: 'cardTitle',
minWidth: 100
},
{
label: '关联奖品',
prop: 'cardTitle',
minWidth: 100
},
{
label: '状态',
minWidth: 100,
addHtml: 'status'
},
{
label: '中奖数字',
prop: 'cardTitle',
minWidth: 100
},
{
label: '创建时间',
prop: 'cardTitle',
minWidth: 100
},
{
label: '开奖时间',
prop: 'cardTitle',
minWidth: 100
},
{
label: '二维码',
minWidth: 100,
addHtml: 'qrcode'
},
]
},
// 表格按钮
tableButtonList: [
{
type: 'el-button',
name: '结束',
attrs: {
type: 'text',
},
condition: row => row.status == 1,
listeners: {
click: row => this.updateParams = {
show: true,
id: row.id,
title: '结束群接龙',
status: -1,
text: '请确认是否结束此群接龙活动?',
}
}
},
{
type: 'el-button',
name: '查看',
attrs: {
type: 'text',
},
listeners: {
click: row => this.editForm(row)
}
},
{
type: 'el-button',
name: '接龙明细',
attrs: {
type: 'text',
},
listeners: {
click: row => this.jumpDetail(row)
}
},
{
type: 'el-button',
name: '中奖明细',
attrs: {
type: 'text',
},
condition: row => row.status == 0,
listeners: {
click: row => this.jumpDetail(row, 1)
}
},
],
dataObj: {},
updateParams: {
show: false
},
rules: [{ required: true, message: '请输入问卷名称' }]
}
},
mounted () {
},
methods: {
handleSearch () {
this.$refs.listRef.refreshTable()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
updateQiestionStatus () {
const { id, status } = this.updateParams
this.Interceptor(async () => await this.$apis.questionnaire.updateQuestionnaireStatus({ id, status }), {
target: 'updateParams',
successText: '操作成功!',
errorText: '操作失败,请重试。'
})
},
async Interceptor (fun, params) {
let loading = this.$loading()
try {
const res = await fun()
if (res) {
this.$message({
message: params.successText,
type: 'success'
})
this[params.target] = this.$options.data.call(this)[params.target]
loading.close()
this.handleSearch()
} else throw params.errorText
} catch (error) {
loading.close()
if (error) this.$message.error(error)
}
},
handleExport () {
this.$apis.questionnaire.exportQuestionnaireList({ ...this.searchForm, ...this.$refs.listRef.page }).then(res => {
exportFn(res)
})
},
download (url) {
util.downloadIamge(url)
},
editForm (row, type = '') {
this.$router.push({
path: '/solitaire/add',
query: {
$title: row.id ? type == 'edit' ? '编辑' : '查看' : '新建',
id: row.id,
type
}
})
},
jumpDetail (row, type) {
this.$router.push({
path: '/solitaire/detail',
query: {
$title: type ? '中奖明细' : '接龙明细',
id: row.id,
type
}
})
}
}
}
</script>
<style scoped lang='scss'>
.container {
height: calc(100% - 64px);
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 20px;
margin-top: 16px;
.sticky {
position: relative;
z-index: 2;
/deep/.el-tag--info {
max-width: 50%;
}
&-btns {
position: absolute;
right: 0;
bottom: 10px;
overflow: hidden;
.el-button + .el-button {
margin-left: 8px;
}
.btns {
transition: all 0.25s;
.el-button {
padding: 8px 15px;
min-width: 60px;
}
}
}
}
.qr {
width: 36px;
height: 36px;
img {
width: 100%;
height: 100%;
vertical-align: top;
}
}
}
.img-plus {
width: 200px;
height: 200px;
}
.download-img {
cursor: pointer;
margin-top: 10px;
font-size: 14px;
font-weight: 600;
color: #5850ff;
line-height: 20px;
text-align: center;
}
.status {
display: flex;
align-items: center;
&::before {
content: '';
width: 8px;
height: 8px;
border-radius: 100%;
margin-right: 8px;
background: #999999;
}
}
.status-0 {
&::before {
background: #f8b757;
}
}
.status-1 {
&::before {
background: #4aca74;
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -14,7 +14,7 @@ const resolve = dir => path.join(__dirname, dir) ...@@ -14,7 +14,7 @@ const resolve = dir => path.join(__dirname, dir)
const CDN_DOMAIN = 'https://img02.glsx.com.cn/' const CDN_DOMAIN = 'https://img02.glsx.com.cn/'
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`,
...@@ -41,7 +41,8 @@ module.exports = { ...@@ -41,7 +41,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!