Commit e64f95c9 by 前端

Merge branch 'v3.20.0' into 'master'

合并物业独立版本V3.20.0

See merge request !10
2 parents 70fabf14 0d952489
...@@ -1837,7 +1837,6 @@ ...@@ -1837,7 +1837,6 @@
"thread-loader": "^2.1.3", "thread-loader": "^2.1.3",
"url-loader": "^2.2.0", "url-loader": "^2.2.0",
"vue-loader": "^15.9.2", "vue-loader": "^15.9.2",
"vue-loader-v16": "npm:vue-loader@^16.1.0",
"vue-style-loader": "^4.1.2", "vue-style-loader": "^4.1.2",
"webpack": "^4.0.0", "webpack": "^4.0.0",
"webpack-bundle-analyzer": "^3.8.0", "webpack-bundle-analyzer": "^3.8.0",
...@@ -12674,75 +12673,6 @@ ...@@ -12674,75 +12673,6 @@
} }
} }
}, },
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": { "vue-router": {
"version": "3.5.4", "version": "3.5.4",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.4.tgz", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.4.tgz",
......
import { http } from '@/main'
const url = '/rop-scrm-marketing/router'
export default {
/**获取红包配置列表 */
getRedEnvelopeConfigList (params) {
params.method = 'marketing.api.activityRedEnvelope.page'
return http({
url,
data: params
})
},
/**获取红包活动列表 */
getRedEnvelopeActivityList (params) {
params.method = 'marketing.api.activityRedEnvelope.merchant.list'
return http({
url,
data: params
})
},
/**获取所属渠道列表 */
getRedEnvelopeMerchantList (params) {
params.method = 'scrm.api.carlife.merchant.listWithPageByCurMerchant'
params.pageSize = 999999
params.currentPage = 1
return http({
url: '/rop-scrm-carlife/router',
data: params
})
},
/**查询红包活动详情 */
getRedEnvelopeActivityDetail (params) {
params.method = 'marketing.api.activityRedEnvelope.findOne'
return http({
url,
data: params
})
},
/** 新建红包活动接口 */
createActivityRedEnvelope (params) {
params.method = 'marketing.api.activityRedEnvelope.create'
return http({
url,
data: params
})
},
/** 更新红包活动 */
updateActivityRedEnvelope (params) {
params.method = 'marketing.api.activityRedEnvelope.update'
return http({
url,
data: params
})
},
/**
* /新建活动文件校验上传文件接口
*/
createCheckFile (params) {
params.method = 'marketing.api.activityRedEnvelope.createCheckFile'
return http({
url,
data: params
})
},
/**
* /编辑活动文件校验上传文件接口
*/
updateCheckFile (params) {
params.method = 'marketing.api.activityRedEnvelope.updateCheckFile'
return http({
url,
data: params
})
},
/** 红包配置列表导出 */
exportActivityRedEnvelope (params) {
params.method = 'marketing.api.activityRedEnvelope.export'
return http({
url,
data: params
})
},
/** 查询红包链接详情 */
getActivityRedEnvelopeLinkDetailPage (params) {
params.method = 'marketing.api.activityRedEnvelope.linkDetailPage'
return http({
url,
data: params
})
},
/**获取红包记录列表 */
getRedEnvelopeRecordList (params) {
params.method = 'marketing.api.activityRedEnvelope.record.page'
return http({
url,
data: params
})
},
/**
* /校验中奖记录导入
*/
checkImport (params) {
params.method = 'marketing.api.activityRedEnvelope.winningRecord.checkImport'
return http({
url,
data: params
})
},
/** 导入中奖记录 */
importRedEnvelopeRecord (params) {
params.method = 'marketing.api.activityRedEnvelope.winningRecord.import'
return http({
url,
data: params
})
},
}
\ No newline at end of file \ No newline at end of file
...@@ -7,6 +7,9 @@ html { ...@@ -7,6 +7,9 @@ html {
overflow: hidden; overflow: hidden;
background-color: #f4f5fa; background-color: #f4f5fa;
} }
.el-message {
z-index: 3000 !important;
}
.el-form-item__content { .el-form-item__content {
width: 284px; width: 284px;
.el-input__inner { .el-input__inner {
......
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则 // 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, maxValue, regRule) { function limitPrice (newValue, oldValue, intergerDigit, pointDigit, minValue, maxValue, regRule) {
/* eslint-disable */ /* eslint-disable */
var reg = { var reg = {
priceReg: /^\d[\d\.]*$/, priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/, numReg: /^[1-9]\d*$/,
zNumReg: /^\d*$/ zNumReg: /^\d*$/
} }
/* eslint-enable */ /* eslint-enable */
regRule = regRule || 'priceReg' regRule = regRule || 'priceReg'
if (newValue && ((minValue && newValue < minValue) || (maxValue && newValue > maxValue))) { if (newValue && ((minValue && newValue < minValue) || (maxValue && newValue > maxValue))) {
return oldValue || '' return oldValue || ''
...@@ -62,29 +62,29 @@ const deliveryTypeList = [ ...@@ -62,29 +62,29 @@ const deliveryTypeList = [
//会员中心得状态list //会员中心得状态list
const statusList = [ const statusList = [
// { // {
// confId: '', // confId: '',
// confName: '全部' // confName: '全部'
// }, // },
{ {
confId: 1,
confName: '生效中'
},
{
confId: 2,
confName: '已失效'
}
]
//会员订单类型字典
const orderTypesList = [{
confId: 1, confId: 1,
confName: '套餐' confName: '生效中'
}, },
{ {
confId: 2, confId: 2,
confName: '会员卡' confName: '已失效'
} }
] ]
//会员订单类型字典
const orderTypesList = [{
confId: 1,
confName: '套餐'
},
{
confId: 2,
confName: '会员卡'
}
]
const orderStatusList = [ const orderStatusList = [
// 2: '待收货', // 2: '待收货',
// 3: '已完成', // 3: '已完成',
...@@ -113,42 +113,85 @@ const orderStatusList = [ ...@@ -113,42 +113,85 @@ const orderStatusList = [
}, },
] ]
const serviceStatusList = [{ const serviceStatusList = [{
confId: 1, confId: 1,
confName: '未生效' confName: '未生效'
}, },
{ {
confId: 2, confId: 2,
confName: '生效中' confName: '生效中'
}, },
{ {
confId: 3, confId: 3,
confName: '已失效' confName: '已失效'
} }
] ]
const memberTypeList = [{ const memberTypeList = [{
confId: 1, confId: 1,
confName: '正式会员' confName: '正式会员'
}, },
{ {
confId: 2, confId: 2,
confName: '试用会员' confName: '试用会员'
} }
] ]
const stateList = [{ const stateList = [{
confId: 0, confId: 0,
confName: '待上架' confName: '待上架'
}, },
{ {
confId: 1, confId: 1,
confName: '在售中' confName: '在售中'
}, },
{ {
confId: 2, confId: 2,
confName: '已下架' confName: '已下架'
}, },
] ]
function getExplorer () {
var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = 'IE'
} else if (ua.match(/firefox/) != null) {
browserType = '火狐'
} else if (ua.match(/ubrowser/) != null) {
browserType = 'UC'
} else if (ua.match(/opera/) != null) {
browserType = '欧朋'
} else if (ua.match(/bidubrowser/) != null) {
browserType = '百度'
} else if (ua.match(/metasr/) != null) {
browserType = '搜狗'
} else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
browserType = 'QQ'
} else if (ua.match(/maxthon/) != null) {
browserType = '遨游'
} else {
browserType = '谷歌'
}
return browserType
}
function exportFn (url) {
let browserType = getExplorer()
if (browserType == 'QQ') {
window.open(url)
return
}
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = url
document.body.appendChild(iframe)
}
const activityStatusList = [
// 0:活动待进行;1:活动进行中;2:红包已用完;3:活动已结束
{ text: '全部', id: '' },
{ text: '活动待开始', id: 0 },
{ text: '活动进行中', id: 1 },
{ text: '红包已用完', id: 2 },
{ text: '活动已结束', id: 3 }
]
export { export {
limitPrice, limitPrice,
orderManageStatusList, orderManageStatusList,
...@@ -159,5 +202,8 @@ export { ...@@ -159,5 +202,8 @@ export {
memberTypeList, memberTypeList,
stateList, stateList,
orderTypesList, orderTypesList,
orderStatusList orderStatusList,
exportFn,
getExplorer,
activityStatusList
} }
\ No newline at end of file \ No newline at end of file
<template>
<GLDialog
mode="mid"
class="muti"
:title="editObj.title"
:before-close="handleClose"
@onOk="handleConfirm"
@onCancel="handleClose"
:visible.sync="editObj.show"
append-to-body
>
<el-form
ref="configRef"
label-width="154px"
:rules="configRules"
:model="configForm"
>
<el-form-item
label="活动名称:"
prop="activityName"
class="m-t-20"
>
<el-input
:style="formItemWidth"
:size="size"
v-model="configForm.activityName"
placeholder="请输入"
maxlength="25"
:disabled="disabled"
></el-input>
</el-form-item>
<el-form-item
label="所属渠道:"
prop="merchantId"
class="m-t-20"
>
<el-select
:size="size"
:style="formItemWidth"
v-model="configForm.merchantId"
placeholder="请选择"
:disabled="disabled"
filterable
>
<el-option
v-for="item in merchantList"
:key="item.confId"
:label="item.confName"
:value="item.confId"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="活动时间:"
prop="activityTime"
class="m-t-20"
>
<el-date-picker
:size="size"
:style="formItemWidth"
v-model="configForm.activityTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="afterRangePickerOptions"
>
</el-date-picker>
</el-form-item>
<el-form-item
label="活动形式:"
prop="activityType"
class="m-t-20"
>
<el-radio-group
:size="size"
v-model="configForm.activityType"
style="width: 400px;"
:disabled="disabled"
>
<el-radio :label="0">随机红包</el-radio>
<el-radio :label="1">九宫格</el-radio>
<el-radio :label="2">翻牌</el-radio>
<el-radio :label="3">大转盘</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label="导入链接:"
prop="exportUrl"
class="m-t-20"
>
<div class="activity-link">
<div class="upload-btn">
<el-button size="small">
<i class="el-icon-plus"></i>
上传文件
</el-button>
<input
type="file"
style="opacity: 0"
ref="file"
accept="*"
@change="uploadFile"
/>
</div>
<a
href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/红包链接.xlsx"
target="_blank"
>下载导入模板</a>
<template v-if="configForm.exportUrl">
<div class="file-info flex">
{{fileName}}
<div class="el-icon-success"></div>
</div>
</template>
<template v-if="fileError">
<div class="file-info flex error">
<a
:href="fileError"
target="_blank"
>下载失败列表</a>
<div class="el-icon-error"></div>
</div>
</template>
</div>
</el-form-item>
</el-form>
</GLDialog>
</template>
<script type='text/ecmascript-6'>
export const afterRangePickerOptions = {
disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
if (date < yesterday) {
return true
}
return false
}
}
import commonFun from '../common/fun.js'
import * as dayjs from 'dayjs'
export default {
name: '',
props: {
editObj: {
type: Object,
default: () => { }
}
},
data () {
return {
afterRangePickerOptions,
formItemWidth: 'width: 284px;',
size: 'small',
disabled: false,
configForm: {
activityName: '',
merchantId: '',
activityTime: '',
activityType: 0,
exportUrl: '',
},
configRules: {
activityName: [
{
required: true,
message: '请输入活动名称',
trigger: 'blur'
}
],
merchantId: [
{
required: true,
message: '请选择所属渠道',
trigger: 'blur'
}
],
activityTime: [
{
required: true,
message: '请输入活动时间',
trigger: 'blur'
}
],
activityType: [
{
required: true,
}
],
exportUrl: [
{
required: true,
message: '请导入链接',
}
],
},
merchantList: [],
fileName: '',
fileError: ''
}
},
mounted () {
this.getMerchantList()
},
watch: {
'editObj' (n) {
this.configRules.exportUrl[0].required = true
if (n.id) this.getRedEnvelopeActivityDetail(n.id)
}
},
methods: {
async getRedEnvelopeActivityDetail (id) {
try {
const { configForm } = this,
res = await this.$apis.redenvelope.getRedEnvelopeActivityDetail({ id })
this.configForm = {
...configForm,
activityName: res.activityName,
activityType: res.activityType,
merchantId: String(res.merchantId),
activityTime: [dayjs(res.activityStartTime).toDate(), dayjs(res.activityEndTime).toDate()],
id
}
this.disabled = true
this.configRules.exportUrl[0].required = false
console.log(res)
} catch (error) {
this.$message.error(error)
}
},
async getMerchantList () {
const { list } = await this.$apis.redenvelope.getRedEnvelopeMerchantList({})
let merchantList = []
list && list.map(e => {
merchantList.push({
confId: e.merchantNo,
confName: e.merchantName,
})
})
this.merchantList = merchantList
},
handleClose () {
this.configForm = this.$options.data.call(this).configForm
this.disabled = false
this.fileError = ''
this.$refs.configRef.resetFields()
this.$emit('update:editObj', {})
},
handleConfirm () {
this.$refs.configRef.validate(async (valid) => {
if (valid) {
try {
const { configForm, merchantList } = this
let params = this.$common.utils.deepClone(configForm),
targetName = params.id ? 'updateActivityRedEnvelope' : 'createActivityRedEnvelope'
params.activityStartTime = dayjs(params.activityTime[0]).format('YYYY-MM-DD')
params.activityEndTime = dayjs(params.activityTime[1]).format('YYYY-MM-DD')
params.merchantName = merchantList.find(e => e.confId == params.merchantId).confName
delete params.activityTime
console.log(JSON.parse(JSON.stringify(params)))
const res = await this.$apis.redenvelope[targetName](params)
if (res) {
this.$message({
message: params.id ? '编辑成功' : '创建成功',
type: 'success'
})
this.handleClose()
this.$parent.handleSearch()
}
else throw params.id ? '编辑失败' : '创建失败'
} catch (error) {
this.$message.error(error)
}
}
})
},
async uploadFile (e) {
const { id } = this.configForm,
target = id ? 'updateCheckFile' : 'createCheckFile'
try {
const { url, name } = await commonFun.uploadFile(e, this),
params = { exportUrl: url }
if (id) params.id = id
this.$refs.file.value = ''
const res = await this.$apis.redenvelope[target](params)
if (res) {
if (res.totalCount == 0 || res.failCount > 0) {
this.fileError = res.errorUrl
this.$message.error('红包链接导入失败')
this.configForm.exportUrl = ''
return
}
this.$message({
message: '导入成功',
type: 'success'
})
this.fileError = ''
this.configForm.exportUrl = url
this.fileName = name
}
} catch (error) {
console.log(error)
if (error) this.$message.error(error)
this.$refs.file.value = ''
}
}
}
}
</script>
<style scoped lang='scss'>
.activity-link {
display: flex;
width: 500px;
.upload-btn {
position: relative;
width: 110px;
height: 32px;
.el-button--small {
width: 100%;
height: 100%;
}
input {
cursor: pointer;
position: absolute;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
font-size: 0px;
}
}
a,
.error {
margin-left: 8px;
color: #5850ff;
font-size: 14px;
cursor: pointer;
}
.file-info {
margin-left: 8px;
.el-icon-success {
margin-left: 8px;
color: #67c23a;
}
.el-icon-error {
margin-left: 8px;
color: red;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="container">
<div class="sticky">
<GLCombiForm
ref="showSearch"
:rowNumber="1"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<div class="sticky-btns">
<div class="btns">
<el-button
type="default"
plain
@click="showEditFun"
>新建</el-button>
<el-button
type="default"
@click="handleExport"
>导出</el-button>
</div>
</div>
</div>
<div class="tabelList">
<div class="table-title">红包配置列表</div>
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="tableSearchForm"
:noDataImg="url"
:tableParams="tableParams"
:pageConf="pageConf"
>
<span
slot="auth-button"
slot-scope="scope"
>
<GLTableButton
:buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"
></GLTableButton>
</span>
</GLTable>
</div>
<link-detail :linkDetailObj.sync="linkDetailObj"></link-detail>
<edit :editObj.sync="editObj"></edit>
</div>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/empty.png'
import * as dayjs from 'dayjs'
import linkDetail from './linkDetail.vue'
import edit from './edit.vue'
import { exportFn, activityStatusList } from '@/common/constant'
export default {
components: { linkDetail, edit },
name: 'RedEnvelopeConfig',
data () {
return {
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
searchForm: {
activityName: '',
merchantId: '',
activityStatus: '',
activityTime: ''
},
searchFormData: [
{
label: '活动名称',
name: 'activityName',
type: 'input',
maxlength: 40
},
{
label: '所属渠道',
name: 'merchantName',
type: 'input',
maxlength: 40
},
{
label: '状态',
name: 'activityStatus',
type: 'select',
optionList: activityStatusList,
optionId: 'id',
optionLabel: 'text'
},
{
label: '活动时间',
name: 'activityTime',
type: 'datePicker',
isClear: true
},
],
getListApi: this.$apis.redenvelope.getRedEnvelopeConfigList,
tableParams: {
listName: 'data',
tableOption: true,
tableColumns: [
{
label: '活动名称',
prop: 'activityName',
minWidth: 100
},
{
label: '所属渠道',
prop: 'merchantName',
minWidth: 100
},
{
label: '活动时间',
prop: 'questionCount',
minWidth: 100,
formatter: cell => {
return `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}`
}
},
{
label: '活动形式',
prop: 'activityTypeStr',
minWidth: 100
},
{
label: '红包链接总数',
prop: 'amount',
minWidth: 150
},
{
label: '已用总数',
prop: 'usedAmount',
minWidth: 100
},
{
label: '可用总数',
prop: 'usableAmount',
minWidth: 100
},
{
label: '状态',
prop: 'activityStatusStr',
minWidth: 100
},
]
},
// 表格按钮
tableButtonList: [
{
type: 'el-button',
name: '编辑',
attrs: {
type: 'text',
},
listeners: {
click: row => this.showEditFun(row)
}
},
{
type: 'el-button',
name: '链接详情',
attrs: {
type: 'text',
},
listeners: {
click: row => this.jumpDetail(row)
}
}
],
editObj: {},
linkDetailObj: {},
tableSearchForm: {}
}
},
mounted () {
},
methods: {
getParams () {
const searchForm = JSON.parse(JSON.stringify(this.searchForm))
if (searchForm.activityTime) {
searchForm.activityStartTime = dayjs(this.searchForm.activityTime[0]).format('YYYY-MM-DD')
searchForm.activityEndTime = dayjs(this.searchForm.activityTime[1]).format('YYYY-MM-DD')
}
delete searchForm.activityTime
return searchForm
},
handleSearch () {
this.tableSearchForm = this.getParams()
this.$refs.listRef.refreshTable()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
jumpDetail (e) {
this.linkDetailObj = {
show: true,
id: e.id
}
},
showEditFun (e) {
this.editObj = {
show: true,
title: e.id ? '编辑' : '新建',
id: e.id || ''
}
},
handleExport (row) {
this.$apis.redenvelope.exportActivityRedEnvelope(this.getParams()).then(res => {
exportFn(res)
})
},
}
}
</script>
<style scoped lang='scss'>
.container {
height: 100%;
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 20px;
.table-title {
font-weight: 700;
font-size: 16px;
color: #333333;
padding-bottom: 18px;
}
.sticky {
position: relative;
z-index: 2;
&-btns {
position: absolute;
right: 0;
bottom: -23px;
overflow: hidden;
.el-button + .el-button {
margin-left: 8px;
}
.btns {
transition: all 0.25s;
.el-button {
padding: 8px 15px;
min-width: 60px;
}
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<GLDialog
mode="big"
class="muti link"
bigTitle="链接详情"
:hasFooter="false"
:before-close="handleClose"
:visible.sync="linkDetailObj.show"
>
<GLCombiForm
ref="showSearch"
:rowNumber="2"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<GLTable
ref="listRef"
:tableData="tableData"
:noDataImg="url"
:tableParams="tableParams"
@refreshTable="refreshTable"
:tableTotal="tableTotal"
:pageConf="pageConf"
>
</GLTable>
</GLDialog>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/empty.png'
import * as dayjs from 'dayjs'
export default {
name: '',
props: {
linkDetailObj: {
type: Object,
default: () => { }
}
},
data () {
return {
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
searchForm: {
status: '',
wechatName: '',
userPhone: ''
},
searchFormData: [
{
label: '状态',
name: 'status',
type: 'select',
optionList: [
{ text: '全部', id: '' },
{ text: '未使用', id: 0 },
{ text: '已使用', id: 1 },
],
optionId: 'id',
optionLabel: 'text'
},
{
label: '手机号码',
name: 'userPhone',
type: 'input',
maxlength: 11
},
{
label: '微信昵称',
name: 'wechatName',
type: 'input',
maxlength: 100
},
],
tableParams: {
listName: 'data',
tableOption: false,
tableColumns: [
// {
// label: '红包链接',
// prop: 'link',
// minWidth: 180
// },
{
label: '导入时间',
prop: 'exportTime',
minWidth: 180
},
{
label: '状态',
prop: 'statusStr',
minWidth: 100,
},
{
label: '微信昵称',
prop: 'wechatName',
minWidth: 100
},
{
label: '手机号',
prop: 'userPhone',
minWidth: 100
},
{
label: '绑定时间',
prop: 'bindingTime',
minWidth: 100
},
{
label: '来源',
prop: 'bindingSourceStr',
minWidth: 100
},
]
},
tableData: [],
tableTotal: 0
}
},
mounted () {
},
watch: {
'linkDetailObj' (n) {
this.searchForm = this.$options.data.call(this).searchForm
if (n.id) this.refreshTable()
}
},
methods: {
async refreshTable (pageCon) {
pageCon && (this.pageConfig = pageCon)
this.searchForm.redEnvelopeId = this.linkDetailObj.id
const params = {
...this.searchForm,
pageSize: 10,
pageNum: 1,
...this.pageConfig
}
const { data, count } = await this.$apis.redenvelope.getActivityRedEnvelopeLinkDetailPage(params)
this.tableData = data || []
this.tableTotal = count || 0
},
handleClose () {
this.$emit('update:linkDetailObj', {})
},
handleSearch () {
this.refreshTable()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
}
}
</script>
<style scoped lang='scss'>
.link {
/deep/.el-form-item--small {
width: fit-content;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<GLDialog
mode="mid"
class="muti"
title="导入记录"
:before-close="handleClose"
@onOk="handleConfirm"
@onCancel="handleClose"
:visible.sync="show"
:modal-append-to-body="true"
>
<el-form
ref="recordRef"
label-width="154px"
:rules="configRules"
:model="recordForm"
>
<el-form-item
label="活动形式:"
prop="importType"
class="m-t-20"
>
<el-radio-group
:size="size"
v-model="recordForm.importType"
>
<el-radio :label="3">中奖记录</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label="导入链接:"
prop="exportUrl"
class="m-t-20"
>
<div class="activity-link">
<div class="upload-btn">
<el-button size="small">
<i class="el-icon-plus"></i>
上传文件
</el-button>
<input
type="file"
style="opacity: 0"
ref="file"
accept="*"
@change="uploadFile"
/>
</div>
<a
href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/中奖记录.xlsx"
target="_blank"
>下载中奖记录模板</a>
<template v-if="recordForm.exportUrl">
<div class="file-info flex">
{{fileName}}
<div class="el-icon-success"></div>
</div>
</template>
<template v-if="fileError">
<div class="file-info flex error">
<a
:href="fileError"
target="_blank"
>下载失败列表</a>
<div class="el-icon-error"></div>
</div>
</template>
</div>
</el-form-item>
</el-form>
</GLDialog>
</template>
<script type='text/ecmascript-6'>
import commonFun from '../common/fun.js'
export default {
name: '',
props: {
show: Boolean,
},
data () {
return {
formItemWidth: 'width: 284px;',
size: 'small',
channelList: [],
recordForm: {
importType: 3,
exportUrl: ''
},
configRules: {
importType: [
{
required: true,
trigger: 'change'
}
],
exportUrl: [
{
required: true,
message: '请导入链接',
}
],
},
fileName: '',
fileError: ''
}
},
mounted () {
},
methods: {
handleClose () {
this.recordForm = this.$options.data.call(this).recordForm
this.fileError = ''
this.$refs.recordRef.resetFields()
this.$emit('update:show', false)
},
handleConfirm () {
this.$refs.recordRef.validate(async (valid) => {
if (valid) {
try {
const { recordForm } = this,
res = await this.$apis.redenvelope.importRedEnvelopeRecord(recordForm)
if (res) {
this.$message({
message: '导入成功',
type: 'success'
})
this.handleClose()
this.$parent.handleSearch()
}
else throw '导入成功'
} catch (error) {
this.$message.error(error)
}
}
})
},
async uploadFile (e) {
try {
const { url, name } = await commonFun.uploadFile(e, this),
{ importType } = this.recordForm
this.$refs.file.value = ''
const res = await this.$apis.redenvelope.checkImport({ importType, exportUrl: url })
if (res) {
if (res.totalCount == 0 || res.failCount > 0) {
this.fileError = res.errorUrl
this.$message.error('红包记录导入失败')
this.recordForm.exportUrl = ''
return
}
this.$message({
message: '导入成功',
type: 'success'
})
this.fileError = ''
this.recordForm.exportUrl = url
this.fileName = name
}
} catch (error) {
console.log(error)
if (error) this.$message.error(error)
}
}
}
}
</script>
<style scoped lang='scss'>
.activity-link {
display: flex;
width: 500px;
.upload-btn {
position: relative;
width: 110px;
height: 32px;
.el-button--small {
width: 100%;
height: 100%;
}
input {
cursor: pointer;
position: absolute;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
font-size: 0px;
}
}
a,
.error {
margin-left: 8px;
color: #5850ff;
font-size: 14px;
cursor: pointer;
}
.file-info {
margin-left: 8px;
.el-icon-success {
margin-left: 8px;
color: #67c23a;
}
.el-icon-error {
margin-left: 8px;
color: red;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="container">
<div class="sticky">
<GLCombiForm
ref="showSearch"
:rowNumber="1"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<div class="sticky-btns">
<div class="btns">
<el-button
type="default"
plain
@click="showImportRecord = true"
>导入记录</el-button>
</div>
</div>
</div>
<div class="tabelList">
<div class="table-title">红包记录列表</div>
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="searchForm"
:noDataImg="url"
:tableParams="tableParams"
:pageConf="pageConf"
>
<span
slot="auth-button"
slot-scope="scope"
>
<GLTableButton
:buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"
></GLTableButton>
</span>
</GLTable>
</div>
<import-record :show.sync="showImportRecord"></import-record>
</div>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/empty.png'
import * as dayjs from 'dayjs'
import importRecord from './importRecord.vue'
export default {
name: 'RedEnvelopeConfig',
components: { importRecord },
data () {
return {
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: {
merchantName: '',
merchantId: '',
staffName: ''
},
searchFormData: [
{
label: '活动名称',
name: 'activityName',
type: 'input',
maxlength: 100
},
{
label: '所属渠道',
name: 'merchantName',
type: 'input',
maxlength: 100
},
{
label: '微信昵称',
name: 'wechatName',
type: 'input',
maxlength: 100
},
{
label: '手机号码',
name: 'userPhone',
type: 'input',
maxlength: 11
},
],
getListApi: this.$apis.redenvelope.getRedEnvelopeRecordList,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '手机号码',
prop: 'userPhone',
minWidth: 100
},
{
label: '微信昵称',
prop: 'wechatName',
minWidth: 100
},
{
label: '活动名称',
prop: 'activityName',
minWidth: 100
},
{
label: '所属渠道',
minWidth: 100,
formatter: cell => `${cell.merchantId}/${cell.merchantName}`
},
{
label: '活动时间',
minWidth: 150,
formatter: cell => `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}`
},
{
label: '活动形式',
prop: 'activityType',
minWidth: 100,
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
},
// {
// label: '红包链接',
// prop: 'link',
// minWidth: 100
// },
{
label: '奖品类型',
prop: 'thirdPrizeName',
minWidth: 100
},
{
label: '中奖金额',
prop: 'thirdPrizeMoney',
minWidth: 100
},
]
},
showImportRecord: false
}
},
mounted () {
},
methods: {
handleSearch () {
this.$refs.listRef.refreshTable()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
}
}
</script>
<style scoped lang='scss'>
.container {
height: 100%;
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 20px;
.table-title {
font-weight: 700;
font-size: 16px;
color: #333333;
padding-bottom: 18px;
}
.sticky {
position: relative;
z-index: 2;
&-btns {
position: absolute;
right: 0;
bottom: -23px;
overflow: hidden;
.el-button + .el-button {
margin-left: 8px;
}
.btns {
transition: all 0.25s;
.el-button {
padding: 8px 15px;
min-width: 60px;
}
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
export default {
uploadFile (e, _this, maxSize) {
return new Promise((resolve, reject) => {
const file = e.srcElement.files[0]
let AllImgExt = '.xls|.xlsx'
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
if (AllImgExt.indexOf(extName) === -1) {
_this.$message.error('上传格式不正确')
return reject()
}
const size = file.size / 1024 / 1024
if (maxSize && size > maxSize) {
_this.$message.error('单文件体积需小于8M')
return reject()
}
this.downloadStatus = true
this.setInter = setInterval(this.addProcess, 100)
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = async event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const splitStr = file.name.split('.')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
const res = await _this.$apis.common.pictureUpload({ file: fileUrl })
if (res) resolve({ url: res, name: file.name })
else reject('上传失败')
}
})
},
}
\ No newline at end of file \ No newline at end of file
<template>
<div class="layout">
<div class="tabs">
<GLTabs
v-model="currentComponent"
:tabPaneList="tabPaneList"
@tab-click="handleClick"
></GLTabs>
</div>
<div class="component">
<component
:is="currentComponent"
ref="componentRef"
></component>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import RedEnvelopeConfig from './components/RedEnvelopeConfig/index.vue'
import RedEnvelopeRecord from './components/RedEnvelopeRecord/index.vue'
export default {
components: {
RedEnvelopeConfig,
RedEnvelopeRecord,
},
name: '',
data () {
return {
currentComponent: 'RedEnvelopeConfig',
tabPaneList: [
{
label: '红包配置',
name: 'RedEnvelopeConfig'
},
{
label: '红包记录',
name: 'RedEnvelopeRecord'
},
]
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.tabs{
margin-bottom: 16px;
}
</style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!