Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
marketing
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
marketing-web
marketing
Commits
6e588716
Commit
6e588716
authored
Aug 13, 2020
by
chenxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: save
parent
0c38d936
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
15 deletions
+36
-15
cdKeyApi.js
src/service/api/cdKeyApi.js
+3
-2
form.vue
src/views/cdkey/form.vue
+33
-13
No files found.
src/service/api/cdKeyApi.js
View file @
6e588716
...
...
@@ -16,8 +16,6 @@ export const cdkeyPlanDelete = params => requests(PREFIX + 'cdkey-plan-delete',
// 兑换详情
export
const
cdkeyPlanEdit
=
params
=>
requests
(
PREFIX
+
'cdkey-plan-edit'
,
params
);
// 下载导入失败记录
export
const
cdkeyFailExport
=
params
=>
requests
(
PREFIX
+
'cdkey-fail-export'
,
params
);
// 兑换记录
export
const
cdkeyLogRecord
=
params
=>
requests
(
PREFIX
+
'cdkey-log-record'
,
params
);
...
...
@@ -25,6 +23,9 @@ export const cdkeyLogRecord = params => requests(PREFIX + 'cdkey-log-record', pa
// 保存/修改兑换码计划
export
const
cdkeyPlanSave
=
PREFIX
+
'cdkey-plan-save'
;
// 下载导入失败记录
export
const
cdkeyFailExport
=
PREFIX
+
'cdkey-fail-export'
;
// 校验兑换码
export
const
cdkeyCheck
=
PREFIX
+
'cdkey-check'
;
...
...
src/views/cdkey/form.vue
View file @
6e588716
...
...
@@ -2,25 +2,25 @@
<div
class=
"dm-wrap"
v-loading=
"loading"
>
<el-form
:model=
"ruleForm"
:rules=
"rules"
ref=
"ruleForm"
label-width=
"140px"
>
<el-form-item
label=
"兑换码名称"
prop=
"cdkeyName"
>
<dm-input
class=
"w400"
v-model=
"ruleForm.cdkeyName"
placeholder=
"请输入兑换码名称"
:byteType=
"1"
:maxlength=
"24"
></dm-input>
<dm-input
:disabled=
"!canEdit"
class=
"w400"
v-model=
"ruleForm.cdkeyName"
placeholder=
"请输入兑换码名称"
:byteType=
"1"
:maxlength=
"24"
></dm-input>
</el-form-item>
<el-form-item
prop=
"marketingActivityId"
>
<activity-select
style=
"margin-left:-68px"
class=
"activity"
:actId
.
sync=
"ruleForm.marketingActivityId"
:readOnly=
"!
isAdd
"
></activity-select>
<activity-select
style=
"margin-left:-68px"
class=
"activity"
:actId
.
sync=
"ruleForm.marketingActivityId"
:readOnly=
"!
canEdit
"
></activity-select>
</el-form-item>
<el-form-item
prop=
"dateTime"
label=
"有效期"
>
<el-date-picker
class=
"w400"
v-model=
"dateTime"
type=
"datetimerange"
:picker-options=
"pickerOptions"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
></el-date-picker>
<el-date-picker
:disabled=
"!canEdit"
class=
"w400"
v-model=
"dateTime"
type=
"datetimerange"
:picker-options=
"pickerOptions"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
></el-date-picker>
</el-form-item>
<el-form-item
label=
"兑换码类型"
prop=
"cdkeyValue"
>
<el-radio-group
v-model=
"ruleForm.cdkeyType"
>
<el-radio-group
:disabled=
"!canEdit"
v-model=
"ruleForm.cdkeyType"
>
<el-radio
:label=
"1"
style=
"margin-right:44px;"
>
专属码
</el-radio>
<el-radio
:label=
"2"
>
通用码
</el-radio>
</el-radio-group>
<div
v-if=
"ruleForm.cdkeyType == 2"
>
<div
class=
"code1"
>
码值:
<el-input
style=
"width:180px;"
clearable
v-model=
"ruleForm.cdkeyValue"
maxlength=
"12"
palceholder=
"请输入码值"
></el-input></div>
<div
class=
"code1"
>
码值:
<el-input
:disabled=
"!canEdit"
style=
"width:180px;"
clearable
v-model=
"ruleForm.cdkeyValue"
maxlength=
"12"
palceholder=
"请输入码值"
></el-input></div>
</div>
</el-form-item>
<el-form-item
label=
"券码生成方式"
prop=
"fileId"
>
<el-radio-group
v-model=
"ruleForm.cdkeyMode"
>
<el-radio-group
:disabled=
"!canEdit"
v-model=
"ruleForm.cdkeyMode"
>
<el-radio
:label=
"1"
>
系统生成
</el-radio>
<el-radio
:label=
"2"
>
手工导入
</el-radio>
</el-radio-group>
...
...
@@ -36,23 +36,25 @@
<i
class=
"el-icon-success fr success-color ml5"
style=
"line-height:40px;"
></i>
</div>
<!-- eslint-disable-next-line -->
<div
v-if=
"importRes.fileId"
style=
"line-height:1;"
>
导入成功
{{
importRes
.
success
}}
条,导入失败
<span
class=
"warning-span"
>
{{
importRes
.
fail
}}
</span>
条,
<el-button
type=
"text"
>
下载导入失败记录
</el-button></div>
<div
v-if=
"importRes.fileId"
style=
"line-height:1;"
>
导入成功
{{
importRes
.
success
}}
条,导入失败
<span
class=
"warning-span"
>
{{
importRes
.
fail
}}
</span>
条
<template
v-if=
"importRes.fail > 0"
>
,
<el-button
type=
"text"
@
click=
"cdkeyFailExport"
>
下载导入失败记录
</el-button></
template
>
</div>
</div>
</div>
</el-form-item>
<el-form-item
:label=
"`${ruleForm.cdkeyType == 2 ? '兑换次数上限' : '兑换码数量'}`"
v-if=
"ruleForm.cdkeyMode == 1"
prop=
"cdkeyCount"
class=
"is-required"
>
<el-input-number
style=
"width:140px;"
v-model=
"ruleForm.cdkeyCount"
controls-position=
"right"
:min=
"1"
:max=
"1000"
></el-input-number>
<el-input-number
:disabled=
"!canEdit"
style=
"width:140px;"
v-model=
"ruleForm.cdkeyCount"
controls-position=
"right"
:min=
"1"
:max=
"1000"
></el-input-number>
<span
class=
"gray ml10"
v-if=
"ruleForm.cdkeyType != 2"
>
券码数量请控制在10000以内
</span>
</el-form-item>
<el-form-item
label=
"兑换内容"
prop=
"cdkeyContentRelated"
>
<el-button
v-show=
"!ruleForm.cdkeyContentRelated"
@
click=
"showCardDialog = true"
>
选择卡券
</el-button>
<div
v-show=
"ruleForm.cdkeyContentRelated"
>
{{ ruleForm.cdkeyContentDescribe }}
<el-button
v-if=
"
isAdd
"
type=
"text"
@
click=
"cleanCard"
class=
"ml10"
>
删除
</el-button>
<el-button
v-if=
"
canEdit
"
type=
"text"
@
click=
"cleanCard"
class=
"ml10"
>
删除
</el-button>
</div>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"submit"
>
确认新建
</el-button>
<el-button
type=
"primary"
@
click=
"submit"
v-if=
"canEdit"
>
确认{{ isAdd ? '新建' : '保存' }}
</el-button>
</el-form-item>
</el-form>
<vue-gic-card
appendToBody
:showCardDialog=
"showCardDialog"
@
selectCard=
"selectCard"
:cardLimit=
"-1"
:cardType=
"null"
></vue-gic-card>
...
...
@@ -64,7 +66,7 @@ import axios from 'axios';
import
file
from
'@/components/upload/file'
;
import
{
formatDateTimeByType
}
from
'@/utils/index.js'
;
import
activitySelect
from
'@/components/activity-select'
;
import
{
cdkeyCheck
,
cdkeyPlanSave
,
cdkeyPlanEdit
}
from
'@/service/api/cdKeyApi.js'
;
import
{
cdkeyCheck
,
cdkeyPlanSave
,
cdkeyPlanEdit
,
cdkeyFailExport
}
from
'@/service/api/cdKeyApi.js'
;
import
{
_debounce
}
from
'@/utils/index'
;
export
default
{
name
:
'cdkey-form'
,
...
...
@@ -79,7 +81,7 @@ export default {
// if ((new Date(date1).getTime() - 24 * 60 * 60 * 1000)
<
new
Date
())
{
// callback(new Error('开始时间不能小于当前时间'));
// }
if
(
new
Date
(
date2
).
getTime
()
-
new
Date
(
date1
).
getTime
()
>
90
*
24
*
60
*
60
*
1000
)
{
if
(
new
Date
(
date2
).
getTime
()
-
new
Date
(
date1
).
getTime
()
>
90
*
24
*
60
*
60
*
1000
&&
this
.
canEdit
)
{
callback
(
new
Error
(
rule
.
message
||
'时间跨度不能超过三个月'
));
}
callback
();
...
...
@@ -124,7 +126,7 @@ export default {
cdkeyContentType
:
''
,
// 1卡券
cdkeyContentRelated
:
''
,
// 1是cardId
cdkeyContentDescribe
:
''
,
// 1是cardName
cdkeyMode
:
2
,
cdkeyMode
:
1
,
cdkeyType
:
1
,
cdkeyValue
:
''
,
cdkeyEffectTime
:
''
,
...
...
@@ -168,6 +170,12 @@ export default {
activitySelect
,
file
},
computed
:
{
canEdit
()
{
// 是新增或编辑未生效
return
this
.
isAdd
||
this
.
isEdit
&&
new
Date
()
<
this
.
dateTime
[
0
];
}
},
methods
:
{
// 下载明细
downloadMX
()
{
...
...
@@ -207,6 +215,9 @@ export default {
// 手工导入
formData
.
append
(
'file'
,
this
.
importRes
.
file
);
}
if
(
this
.
isEdit
)
{
formData
.
append
(
'cdkeyPlanId'
,
this
.
cdkeyPlanId
);
}
Object
.
keys
(
params
).
forEach
(
key
=>
{
formData
.
append
(
key
,
params
[
key
]);
});
...
...
@@ -230,6 +241,15 @@ export default {
});
});
}),
// 下载失败记录
cdkeyFailExport
()
{
let
formData
=
new
FormData
();
formData
.
append
(
'requestProject'
,
'gic-web'
);
formData
.
append
(
'file'
,
this
.
importRes
.
file
);
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
"post"
,
cdkeyFailExport
);
xhr
.
send
(
formData
);
},
// *********卡券选择器******
cleanCard
()
{
this
.
ruleForm
.
cdkeyContentRelated
=
''
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment