Commit dd469526 by 前端

提交紧急版本代码

1 parent e64f95c9
...@@ -15,11 +15,13 @@ ...@@ -15,11 +15,13 @@
type="default" type="default"
plain plain
@click="showEditFun" @click="showEditFun"
>新建</el-button> >新建
</el-button>
<el-button <el-button
type="default" type="default"
@click="handleExport" @click="handleExport"
>导出</el-button> >导出
</el-button>
</div> </div>
</div> </div>
</div> </div>
...@@ -47,6 +49,8 @@ ...@@ -47,6 +49,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 :linkDetailObj.sync="whiteListObj">
</whiteList>
</div> </div>
</template> </template>
...@@ -55,14 +59,16 @@ import url from '@/assets/empty.png' ...@@ -55,14 +59,16 @@ 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 {
url, url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }, pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count'},
searchForm: { searchForm: {
activityName: '', activityName: '',
merchantId: '', merchantId: '',
...@@ -117,7 +123,7 @@ export default { ...@@ -117,7 +123,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,18 +176,30 @@ export default { ...@@ -170,18 +176,30 @@ 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: {}
} }
}, },
mounted () { mounted() {
}, },
methods: { methods: {
getParams () { getParams() {
const searchForm = JSON.parse(JSON.stringify(this.searchForm)) const searchForm = JSON.parse(JSON.stringify(this.searchForm))
if (searchForm.activityTime) { if (searchForm.activityTime) {
searchForm.activityStartTime = dayjs(this.searchForm.activityTime[0]).format('YYYY-MM-DD') searchForm.activityStartTime = dayjs(this.searchForm.activityTime[0]).format('YYYY-MM-DD')
...@@ -190,28 +208,34 @@ export default { ...@@ -190,28 +208,34 @@ export default {
delete searchForm.activityTime delete searchForm.activityTime
return searchForm return searchForm
}, },
handleSearch () { handleSearch() {
this.tableSearchForm = this.getParams() this.tableSearchForm = this.getParams()
this.$refs.listRef.refreshTable() this.$refs.listRef.refreshTable()
}, },
handleReset () { handleReset() {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch() this.handleSearch()
}, },
jumpDetail (e) { jumpDetail(e) {
this.linkDetailObj = { this.linkDetailObj = {
show: true, show: true,
id: e.id id: e.id
} }
}, },
showEditFun (e) { whiteList(e) {
this.whiteListObj = {
show: true,
id: e.id
}
},
showEditFun(e) {
this.editObj = { this.editObj = {
show: true, show: true,
title: e.id ? '编辑' : '新建', title: e.id ? '编辑' : '新建',
id: e.id || '' id: e.id || ''
} }
}, },
handleExport (row) { handleExport(row) {
this.$apis.redenvelope.exportActivityRedEnvelope(this.getParams()).then(res => { this.$apis.redenvelope.exportActivityRedEnvelope(this.getParams()).then(res => {
exportFn(res) exportFn(res)
}) })
...@@ -227,25 +251,31 @@ export default { ...@@ -227,25 +251,31 @@ export default {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
padding: 20px; padding: 20px;
.table-title { .table-title {
font-weight: 700; font-weight: 700;
font-size: 16px; font-size: 16px;
color: #333333; color: #333333;
padding-bottom: 18px; padding-bottom: 18px;
} }
.sticky { .sticky {
position: relative; position: relative;
z-index: 2; z-index: 2;
&-btns { &-btns {
position: absolute; position: absolute;
right: 0; right: 0;
bottom: -23px; bottom: -23px;
overflow: hidden; overflow: hidden;
.el-button + .el-button { .el-button + .el-button {
margin-left: 8px; margin-left: 8px;
} }
.btns { .btns {
transition: all 0.25s; transition: all 0.25s;
.el-button { .el-button {
padding: 8px 15px; padding: 8px 15px;
min-width: 60px; min-width: 60px;
......
<template>
<GLDialog
mode="big"
class="muti link"
bigTitle="白名单"
:hasFooter="true"
:before-close="handleClose"
:visible.sync="linkDetailObj.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"
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: {
linkDetailObj: {
type: Object,
default: () => { }
}
},
data () {
return {
currentComponent: 'WhiteListSearch',
tabPaneList: [
{
label: '白名单列表',
name: 'WhiteListSearch'
},
{
label: '导入白名单',
name: 'WhiteListImport'
},
],
}
},
mounted () {
},
methods: {
handleConfirm(){
if (this.currentComponent == 'WhiteListImport'){
this.$refs.componentRef.handleConfirm()
}
},
handleClose () {
this.$emit('update:linkDetailObj', {})
},
}
}
</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",
data(){
return{
recordForm: {
importType: 5,
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.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'>
.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"
: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",
data () {
return {
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
searchForm: {
status: '',
wechatName: '',
userPhone: ''
},
getListApi: this.$apis.redenvelope.getRedEnvelopeRecordList,
searchFormData: [
{
label: '手机号码',
name: 'userPhone',
type: 'input',
maxlength: 11
}
],
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '手机号',
prop: 'userPhone',
minWidth: 100
},
{
label: '导入时间',
prop: 'exportTime',
minWidth: 180
},
]
},
// 表格按钮
tableButtonList: [
{
type: 'el-button',
name: '删除',
attrs: {
type: 'text',
},
listeners: {
click: row => this.showDelFun(row)
}
}
],
tableData: [],
tableTotal: 0
}
},
methods: {
handleSearch () {
this.$refs.listRef.refreshTable()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
showDelFun({id}){
const params ={
id
}
this.$apis.redenvelope.deleteWhiteList(params).then(res => {
if (res){
this.$message.success('删除成功')
this.handleSearch()
}
})
}
}
}
</script>
<style lang="scss" scoped>
.whiteListSearch{
margin-top: 20px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!