Commit 8f8074b6 by 前端

更新紧急版本代码

1 parent 8eac9ab5
......@@ -149,6 +149,39 @@ export default {
url,
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,7 +47,7 @@
</div>
<link-detail :linkDetailObj.sync="linkDetailObj"></link-detail>
<edit :editObj.sync="editObj"></edit>
<whiteList :linkDetailObj.sync="whiteListObj">
<whiteList :whiteListObj.sync="whiteListObj">
</whiteList>
</div>
</template>
......
......@@ -5,7 +5,7 @@
bigTitle="白名单"
:hasFooter="true"
:before-close="handleClose"
:visible.sync="linkDetailObj.show"
:visible.sync="whiteListObj.show"
@onOk="handleConfirm"
@onCancel="handleClose"
>
......@@ -19,6 +19,8 @@
<div class="component">
<component
:is="currentComponent"
:DetailObj="whiteListObj"
v-if="currentComponent"
ref="componentRef"
></component>
</div>
......@@ -35,7 +37,7 @@ export default {
WhiteListSearch,
WhiteListImport },
props: {
linkDetailObj: {
whiteListObj: {
type: Object,
default: () => { }
}
......@@ -56,16 +58,25 @@ export default {
}
},
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:linkDetailObj', {})
this.$emit('update:whiteListObj', {
id:this.whiteListObj.id,
show:false
})
this.currentComponent = this.tabPaneList[0].name;
},
}
......
......@@ -31,7 +31,7 @@
>下载导入模板</a>
<template v-if="recordForm.exportUrl">
<div class="file-info flex">
{{fileName}}
{{ fileName }}
<div class="el-icon-success"></div>
</div>
</template>
......@@ -55,10 +55,17 @@ import commonFun from "../common/fun";
export default {
name: "whiteListImport",
data(){
return{
props: {
DetailObj: {
type: Object,
default: () => {
}
}
},
data() {
return {
recordForm: {
importType: 5,
activityRedEnvelopeId: this.DetailObj.id,
exportUrl: ''
},
configRules: {
......@@ -73,44 +80,44 @@ export default {
fileError: ''
}
},
methods:{
handleClose () {
methods: {
handleClose() {
this.recordForm = this.$options.data.call(this).recordForm
this.fileError = ''
this.$refs.recordRef.resetFields()
this.$emit('update:show', false)
},
handleConfirm () {
handleConfirm() {
this.$refs.recordRef.validate(async (valid) => {
if (valid) {
try {
const { recordForm } = this,
res = await this.$apis.redenvelope.importRedEnvelopeRecord(recordForm)
const {recordForm} = this,
res = await this.$apis.redenvelope.whiteListImport(recordForm)
if (res) {
this.$message({
message: '导入成功',
type: 'success'
})
this.handleClose()
this.$parent.handleSearch()
this.$parent.handleClose()
}
else throw '导入成功'
} catch (error) {
this.$message.error(error)
}
}
})
},
async uploadFile (e) {
async uploadFile(e) {
try {
const { url, name } = await commonFun.uploadFile(e, this),
{ importType } = this.recordForm
const {url, name} = await commonFun.uploadFile(e, this),
{activityRedEnvelopeId} = this.recordForm
this.$refs.file.value = ''
const res = await this.$apis.redenvelope.checkImport({ importType, exportUrl: url })
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.$message.error('导入失败')
this.recordForm.exportUrl = ''
return
}
......@@ -123,7 +130,6 @@ export default {
this.fileName = name
}
} catch (error) {
console.log(error)
if (error) this.$message.error(error)
}
}
......@@ -132,20 +138,24 @@ export default {
</script>
<style scoped lang='scss'>
.whiteListImport{
.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;
......@@ -156,6 +166,7 @@ export default {
font-size: 0px;
}
}
a,
.error {
margin-left: 8px;
......@@ -163,12 +174,15 @@ export default {
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;
......
......@@ -13,6 +13,7 @@
:getListApi="getListApi"
:tableData="tableData"
:noDataImg="url"
:searchForm="searchForm"
:tableParams="tableParams"
@refreshTable="refreshTable"
:tableTotal="tableTotal"
......@@ -35,22 +36,29 @@
<script>
import url from '@/assets/empty.png'
import * as dayjs from "dayjs";
export default {
name: "whiteListSearch",
data () {
props: {
DetailObj: {
type: Object,
default: () => {
}
}
},
data() {
return {
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count'},
searchForm: {
status: '',
wechatName: '',
userPhone: ''
activityRedEnvelopeId:this.DetailObj.id,
phone: ''
},
getListApi: this.$apis.redenvelope.getRedEnvelopeRecordList,
getListApi: this.$apis.redenvelope.getWhiteListPage,
searchFormData: [
{
label: '手机号码',
name: 'userPhone',
name: 'phone',
type: 'input',
maxlength: 11
}
......@@ -61,13 +69,13 @@ export default {
tableColumns: [
{
label: '手机号',
prop: 'userPhone',
prop: 'phone',
minWidth: 100
},
{
label: '导入时间',
prop: 'exportTime',
prop: 'importTime',
minWidth: 180
},
......@@ -92,31 +100,39 @@ export default {
},
methods: {
handleSearch () {
handleSearch() {
console.log(this.DetailObj)
this.$refs.listRef.refreshTable()
},
handleReset () {
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()
}
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{
.whiteListSearch {
margin-top: 20px;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!