Commit 5ca7a823 by 徐忆琳

Merge branch 'v3.21.0_10' into 'v3.21.0'

更新紧急版本代码

See merge request !16
2 parents fe717744 b0da43fe
...@@ -149,6 +149,39 @@ export default { ...@@ -149,6 +149,39 @@ export default {
url, url,
data: params data: params
}) })
},
// 获取白名单列表
getWhiteListPage(params){
params.method = 'marketing.api.activityRedEnvelope.whiteList.page'
return http({
url,
data: params
})
},
// 校验红包活动白名单导入
checkImportWhiteList(params){
params.method = 'marketing.api.activityRedEnvelope.whiteList.checkImport'
return http({
url,
data: params
})
},
// 红包活动白名单导入
whiteListImport(params){
params.method = 'marketing.api.activityRedEnvelope.whiteList.import'
return http({
url,
data: params
})
},
whiteListDelete(params){
params.method = 'marketing.api.activityRedEnvelope.whiteList.delete'
return http({
url,
data: params
})
} }
} }
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
</div> </div>
<link-detail :linkDetailObj.sync="linkDetailObj"></link-detail> <link-detail :linkDetailObj.sync="linkDetailObj"></link-detail>
<edit :editObj.sync="editObj"></edit> <edit :editObj.sync="editObj"></edit>
<whiteList :whiteListObj.sync="whiteListObj">
</whiteList>
</div> </div>
</template> </template>
...@@ -55,9 +57,11 @@ import url from '@/assets/empty.png' ...@@ -55,9 +57,11 @@ import url from '@/assets/empty.png'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import linkDetail from './linkDetail.vue' import linkDetail from './linkDetail.vue'
import edit from './edit.vue' import edit from './edit.vue'
import { exportFn, activityStatusList } from '@/common/constant' import whiteList from './whiteList'
import {exportFn, activityStatusList} from '@/common/constant'
export default { export default {
components: { linkDetail, edit }, components: {linkDetail, edit, whiteList},
name: 'RedEnvelopeConfig', name: 'RedEnvelopeConfig',
data () { data () {
return { return {
...@@ -117,7 +121,7 @@ export default { ...@@ -117,7 +121,7 @@ export default {
prop: 'questionCount', prop: 'questionCount',
minWidth: 100, minWidth: 100,
formatter: cell => { formatter: cell => {
return `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}` return cell.activityStartTime ? `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')} `: ''
} }
}, },
{ {
...@@ -170,10 +174,21 @@ export default { ...@@ -170,10 +174,21 @@ export default {
listeners: { listeners: {
click: row => this.jumpDetail(row) click: row => this.jumpDetail(row)
} }
},
{
type: 'el-button',
name: '白名单',
attrs: {
type: 'text',
},
listeners: {
click: row => this.whiteList(row)
}
} }
], ],
editObj: {}, editObj: {},
linkDetailObj: {}, linkDetailObj: {},
whiteListObj: {},
tableSearchForm: {} tableSearchForm: {}
} }
}, },
...@@ -204,6 +219,12 @@ export default { ...@@ -204,6 +219,12 @@ export default {
id: e.id id: e.id
} }
}, },
whiteList(e) {
this.whiteListObj = {
show: true,
id: e.id
}
},
showEditFun (e) { showEditFun (e) {
this.editObj = { this.editObj = {
show: true, show: true,
......
<template>
<GLDialog
mode="big"
class="muti link"
bigTitle="白名单"
:hasFooter="true"
:before-close="handleClose"
:visible.sync="whiteListObj.show"
@onOk="handleConfirm"
@onCancel="handleClose"
>
<div class="tabs">
<GLTabs
v-model="currentComponent"
:tabPaneList="tabPaneList"
@tab-click="handleClick"
></GLTabs>
</div>
<div class="component">
<component
:is="currentComponent"
:DetailObj="whiteListObj"
v-if="currentComponent"
ref="componentRef"
></component>
</div>
</GLDialog>
</template>
<script type='text/ecmascript-6'>
import WhiteListImport from "./whiteListImport";
import WhiteListSearch from "./whiteListSearch";
export default {
name: '',
components: {
WhiteListSearch,
WhiteListImport },
props: {
whiteListObj: {
type: Object,
default: () => { }
}
},
data () {
return {
currentComponent: 'WhiteListSearch',
tabPaneList: [
{
label: '白名单列表',
name: 'WhiteListSearch'
},
{
label: '导入白名单',
name: 'WhiteListImport'
},
],
}
},
mounted () {
// this.currentComponent = this.tabPaneList[0].name;
},
methods: {
handleConfirm(){
if (this.currentComponent == 'WhiteListSearch'){
this.$message.success('确定成功')
this.handleClose()
}
if (this.currentComponent == 'WhiteListImport'){
this.$refs.componentRef.handleConfirm()
}
},
handleClose () {
this.$emit('update:whiteListObj', {
id:this.whiteListObj.id,
show:false
})
this.currentComponent = this.tabPaneList[0].name;
},
}
}
</script>
<style scoped lang='scss'>
.link {
/deep/.el-form-item--small {
width: fit-content;
}
}
</style>
<template>
<div class="whiteListImport">
<el-form
ref="recordRef"
label-width="154px"
:rules="configRules"
:model="recordForm"
>
<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>
</div>
</template>
<script>
import commonFun from "../common/fun";
export default {
name: "whiteListImport",
props: {
DetailObj: {
type: Object,
default: () => {
}
}
},
data() {
return {
recordForm: {
activityRedEnvelopeId: this.DetailObj.id,
exportUrl: ''
},
configRules: {
exportUrl: [
{
required: true,
message: '请导入白名单',
}
],
},
fileName: '',
fileError: ''
}
},
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.whiteListImport(recordForm)
if (res) {
this.$message({
message: '导入成功',
type: 'success'
})
this.handleClose()
this.$parent.handleClose()
}
} catch (error) {
this.$message.error(error)
}
}
})
},
async uploadFile(e) {
try {
const {url, name} = await commonFun.uploadFile(e, this),
{activityRedEnvelopeId} = this.recordForm
this.$refs.file.value = ''
const res = await this.$apis.redenvelope.checkImportWhiteList({activityRedEnvelopeId, 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) {
if (error) this.$message.error(error)
}
}
}
}
</script>
<style scoped lang='scss'>
.whiteListImport {
margin-top: 20px;
}
.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>
<template>
<div class="whiteListSearch">
<GLCombiForm
ref="showSearch"
:rowNumber="1"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<GLTable
ref="listRef"
:getListApi="getListApi"
:tableData="tableData"
:noDataImg="url"
:searchForm="searchForm"
:tableParams="tableParams"
@refreshTable="refreshTable"
:tableTotal="tableTotal"
:pageConf="pageConf"
>
<span
slot="auth-button"
slot-scope="scope"
>
<GLTableButton
:buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"
></GLTableButton>
</span>
</GLTable>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import * as dayjs from "dayjs";
export default {
name: "whiteListSearch",
props: {
DetailObj: {
type: Object,
default: () => {
}
}
},
data() {
return {
url,
pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count'},
searchForm: {
activityRedEnvelopeId:this.DetailObj.id,
phone: ''
},
getListApi: this.$apis.redenvelope.getWhiteListPage,
searchFormData: [
{
label: '手机号码',
name: 'phone',
type: 'input',
maxlength: 11
}
],
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '手机号',
prop: 'phone',
minWidth: 100
},
{
label: '导入时间',
prop: 'importTime',
minWidth: 180
},
]
},
// 表格按钮
tableButtonList: [
{
type: 'el-button',
name: '删除',
attrs: {
type: 'text',
},
listeners: {
click: row => this.showDelFun(row)
}
}
],
tableData: [],
tableTotal: 0
}
},
methods: {
handleSearch() {
console.log(this.DetailObj)
this.$refs.listRef.refreshTable()
},
handleReset() {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
showDelFun({id}) {
this.$confirm('是否确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
const params = {
id
}
this.$apis.redenvelope.whiteListDelete(params).then(res => {
if (res) {
this.$message.success('删除成功')
this.handleSearch()
}
})
})
.catch(() => {})
}
}
}
</script>
<style lang="scss" scoped>
.whiteListSearch {
margin-top: 20px;
}
</style>
...@@ -181,7 +181,7 @@ export default { ...@@ -181,7 +181,7 @@ export default {
}, },
{ {
label: '奖品类型', label: '奖品类型',
prop: 'thirdPrizeName', prop: 'thirdPrizeType',
minWidth: 100 minWidth: 100
}, },
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!