Commit de1fbc00 by chenyu

update: 分享有礼到期校验

parent 41deb665
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"echarts": "^4.4.0", "echarts": "^4.4.0",
"element-ui": "^2.12.0", "element-ui": "^2.12.0",
"file-saver": "^1.3.8", "file-saver": "^1.3.8",
"moment": "^2.29.1",
"sass": "^1.26.11", "sass": "^1.26.11",
"tinymce": "^4.9.6", "tinymce": "^4.9.6",
"v-charts": "^1.19.0", "v-charts": "^1.19.0",
......
...@@ -130,9 +130,15 @@ import { _debounce } from '@/common/js/public'; ...@@ -130,9 +130,15 @@ import { _debounce } from '@/common/js/public';
// import showMsg from '@/common/js/showmsg'; // import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
import timeFormat from '@/common/js/timeFormat'; import timeFormat from '@/common/js/timeFormat';
import moment from 'moment'
export default { export default {
name: 'base-config', name: 'base-config',
props: {}, props: {
endDate: {
type: Number,
default: new Date().getTime()
}
},
components: { components: {
limitInput limitInput
}, },
...@@ -154,6 +160,12 @@ export default { ...@@ -154,6 +160,12 @@ export default {
callback(new Error('请选择开始日期')); callback(new Error('请选择开始日期'));
} else if(!value[1]) { } else if(!value[1]) {
callback(new Error('请选择结束日期')); callback(new Error('请选择结束日期'));
} else if(value[0]&&value[1]&&new Date(this.activeInfoData.endDate).getTime()> this.endDate){
this.$message({
message: `您的分享有礼功能${moment(this.endDate).format('YYYY年MM月DD日')}到期,活动结束时间无法超过该日期。`,
type: 'warning'
});
callback(new Error(' '));
} else { } else {
callback(); callback();
} }
...@@ -183,7 +195,7 @@ export default { ...@@ -183,7 +195,7 @@ export default {
}, },
rules: { rules: {
activityName: [{ required: true, message: '请输入活动名称', trigger: 'blur' }], activityName: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
dateRange: [{ validator: checkDate, trigger: 'change' }] dateRange: [{ validator: checkDate, trigger: 'blur' }]
}, },
choiceDateCopy: [], choiceDateCopy: [],
pickerOptions: { pickerOptions: {
...@@ -216,10 +228,10 @@ export default { ...@@ -216,10 +228,10 @@ export default {
disabledDate: time => { disabledDate: time => {
let disabled = time.getTime() < Date.now() - 8.64e7; let disabled = time.getTime() < Date.now() - 8.64e7;
if(this.activeInfoData.startDate) { if(this.activeInfoData.startDate) {
disabled = disabled || (time.getTime() < new Date(this.activeInfoData.startDate).getTime()); disabled = disabled || time.getTime() > this.endDate||(time.getTime() < new Date(this.activeInfoData.startDate).getTime());
} }
if(!this.activeInfoData.startDate || (new Date(this.activeInfoData.startDate).toDateString() === new Date().toDateString())) { if(!this.activeInfoData.startDate || (new Date(this.activeInfoData.startDate).toDateString() === new Date().toDateString())) {
disabled = disabled || (time.getTime() <= new Date().setHours(0,0,0)); disabled = disabled || time.getTime() > this.endDate||(time.getTime() <= new Date().setHours(0,0,0));
} }
return disabled; return disabled;
} }
......
...@@ -13,8 +13,14 @@ import inProgressActive from '@/components/active/in-progress-active.vue'; ...@@ -13,8 +13,14 @@ import inProgressActive from '@/components/active/in-progress-active.vue';
--> -->
<template> <template>
<div v-if="inProgressData.length"> <div v-if="inProgressData.length" style="margin-top:-9px;">
<div class="separator-space">- 当前有计划中的活动,无法创建新的活动 -</div> <div class="flex-top-wrap">
<div class="separator-space">- 当前有计划中的活动,无法创建新的活动 -</div>
<div class="alert-wrap" v-if="dueData.dueDay<=90"
><i class="el-icon-warning" ></i
><template v-if="dueData.isOverdue===0">您的分享有礼功能将在 <span class="red">{{dueData.dueDay}}</span> 天后过期,为不影响使用,请及时联系达摩运营经理购买(<span class="red">过期截止时间{{dueData.endDate|dateFilter}}</span></template
><template v-else>您的分享有礼功能<span class="red">已过期</span>,如需继续使用,请联系达摩运营经理购买使用。</template></div>
</div>
<div class="in-progress-active border-box"> <div class="in-progress-active border-box">
<ul> <ul>
<template v-for="(item, index) in inProgressData"> <template v-for="(item, index) in inProgressData">
...@@ -151,11 +157,25 @@ import { _debounce } from '@/common/js/public'; ...@@ -151,11 +157,25 @@ import { _debounce } from '@/common/js/public';
import showMsg from '@/common/js/showmsg'; import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
import { getRequest } from '@/api/api'; import { getRequest } from '@/api/api';
import moment from 'moment'
export default { export default {
name: 'in-progress-active', name: 'in-progress-active',
components: { components: {
outDateActive outDateActive
}, },
props: {
dueData: {
type: Object,
default: ()=>{
return {
dueDay: 0, // 即将到期天数
endDate: new Date().getTime(), // 到期时间
isOverdue: 0, // 是否过期,0:未过期,1:已过期
overdueDay: 0 // 过期天数
}
}
}
},
data() { data() {
return { return {
funnelData: {}, funnelData: {},
...@@ -328,6 +348,11 @@ export default { ...@@ -328,6 +348,11 @@ export default {
mounted() { mounted() {
const that = this; const that = this;
that.getTableList(); that.getTableList();
},
filters:{
dateFilter(v){
return moment(v).format('YYYY年MM月DD日')
}
} }
}; };
</script> </script>
...@@ -335,17 +360,43 @@ export default { ...@@ -335,17 +360,43 @@ export default {
.m-t-7 { .m-t-7 {
margin-top: 7px; margin-top: 7px;
} }
.separator-space { .red{
color:red;
}
.flex-top-wrap{
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
width: 100%; width: 100%;
height: 60px; height: 40px;
line-height: 60px; margin-bottom: 9px;
text-align: center; .separator-space {
font-size: 14px; margin-right: 19px;
color: #909399; line-height: 40px;
font-weight: 600; text-align: center;
&.no-active { font-size: 14px;
height: 40px; color: #909399;
line-height: 20px; font-weight: 600;
&.no-active {
height: 40px;
line-height: 20px;
}
}
.alert-wrap{
// width:774px;
height:40px;
padding:0 7px 0 17px;
line-height:40px;
background:#FFFBE6;
border-radius:4px;
border:1pxsolid#FFE58F;
color:#606266;
font-size:14px;
.el-icon-warning{
margin-right:9px;
color:#FAAD14;
}
} }
} }
.in-progress-active { .in-progress-active {
......
...@@ -233,7 +233,7 @@ export default { ...@@ -233,7 +233,7 @@ export default {
url = '//' + window.location.host + '/gic-web/#/reportCenter'; url = '//' + window.location.host + '/gic-web/#/reportCenter';
} */ } */
if (window.location.origin.includes('gicdev')) { if (window.location.origin.includes('gicdev')) {
window.open('/gic-web/reportCenter'); window.open('/gic-web/#/reportCenter');
return false; return false;
} }
window.open('/gic-web/#/reportCenter'); window.open('/gic-web/#/reportCenter');
......
...@@ -8,7 +8,7 @@ const BASEURL = host.indexOf('localhost') > -1 ? 'http://gicdev.demogic.com/gic- ...@@ -8,7 +8,7 @@ const BASEURL = host.indexOf('localhost') > -1 ? 'http://gicdev.demogic.com/gic-
const server = axios.create({ const server = axios.create({
baseURL: BASEURL, baseURL: BASEURL,
timeout: 10000 timeout: 10000,
}); });
server.interceptors.request.use( server.interceptors.request.use(
......
// 解析时间 // 解析时间
export function dateformat(time, fmt) { export function dateformat(time, fmt) {
let o = { let o = {
"M+": time.getMonth() + 1, //月份 "M+": time.getMonth() + 1, //月份
"d+": time.getDate(), //日 "d+": time.getDate(), //日
"h+": time.getHours(), //小时 "h+": time.getHours(), //小时
"m+": time.getMinutes(), //分 "m+": time.getMinutes(), //分
"s+": time.getSeconds(), //秒 "s+": time.getSeconds(), //秒
"q+": Math.floor((time.getMonth() + 3) / 3), //季度 "q+": Math.floor((time.getMonth() + 3) / 3), //季度
"S": time.getMilliseconds() //毫秒 "S": time.getMilliseconds() //毫秒
}; };
if (/(y+)/.test(fmt)) { if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (time.getFullYear() + "").substr(4 - RegExp.$1.length)); fmt = fmt.replace(RegExp.$1, (time.getFullYear() + "").substr(4 - RegExp.$1.length));
} }
for (var k in o) { for (var k in o) {
if (new RegExp("(" + k + ")").test(fmt)) { if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
} }
} }
return fmt; return fmt;
} }
export const __VERSION = '1.1'; export const __VERSION = '1.1';
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<div class="step-body"> <div class="step-body">
<base-config <base-config
v-if="activeStep == '1'" v-if="activeStep == '1'"
:endDate="dueData.endDate"
@submitNext="submitNext" @submitNext="submitNext"
></base-config> ></base-config>
<center-config <center-config
...@@ -57,6 +58,8 @@ import centerConfig from '@/components/active-config/center-config.vue'; ...@@ -57,6 +58,8 @@ import centerConfig from '@/components/active-config/center-config.vue';
import cardConfig from '@/components/active-config/card-config.vue'; import cardConfig from '@/components/active-config/card-config.vue';
import posterConfig from '@/components/active-config/poster-config.vue'; import posterConfig from '@/components/active-config/poster-config.vue';
import rewardConfig from '@/components/active-config/reward-config.vue'; import rewardConfig from '@/components/active-config/reward-config.vue';
import { getRequest } from '@/api/api';
import errMsg from '@/common/js/error';
export default { export default {
name: 'createCompletion', name: 'createCompletion',
components: { components: {
...@@ -105,6 +108,12 @@ export default { ...@@ -105,6 +108,12 @@ export default {
hasSet: false hasSet: false
} }
], ],
dueData: {
dueDay: 0, // 即将到期天数
endDate: new Date().getTime(), // 到期时间
isOverdue: 0, // 是否过期,0:未过期,1:已过期
overdueDay: 0 // 过期天数
}
} }
}, },
watch: { watch: {
...@@ -116,6 +125,28 @@ export default { ...@@ -116,6 +125,28 @@ export default {
}, },
methods: { methods: {
/** /**
* 是否过期
*/
judgeDue() {
const that = this;
let para = {};
getRequest('/sharing-core-web/isOverdue', para)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
that.dueData=Object.assign({},that.dueData,resData.result)
return false;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/**
* 下一步 * 下一步
*/ */
submitNext() { submitNext() {
...@@ -128,11 +159,13 @@ export default { ...@@ -128,11 +159,13 @@ export default {
*/ */
submitBack() { submitBack() {
const that = this; const that = this;
console.log(that.activeStep)
that.activeStep--; that.activeStep--;
that.stepData[that.activeStep - 1 ].hasSet = false; that.stepData[that.activeStep - 1 ].hasSet = false;
} }
}, },
mounted(){
this.judgeDue()
}
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -10,15 +10,19 @@ ...@@ -10,15 +10,19 @@
<div class="share-index common-wrap"> <div class="share-index common-wrap">
<div class="right-content border-box"> <div class="right-content border-box">
<div v-if="canCreate"> <div v-if="canCreate">
<div class="separator-space no-active"> <div class="flex-top-wrap">
- 当前无进行中的活动,请创建活动,别让业绩白白流失!- <div class="separator-space">- 当前无进行中的活动,请创建活动,别让业绩白白流失! -</div>
</div> <div class="alert-wrap" v-if="dueData.isOverdue===0"
<active-select></active-select> ><i class="el-icon-warning" ></i>您的分享有礼功能将在 <span class="red">{{dueData.dueDay}}</span> 天后过期,为不影响使用,请及时联系达摩运营经理购买(<span class="red">过期截止时间{{dueData.endDate|dateFilter}}</span></div>
</div>
<active-select :isOverdue="dueData.isOverdue"></active-select>
</div> </div>
<div> <div>
<!-- v-if="!canCreate" --> <!-- v-if="!canCreate" -->
<in-progress-active></in-progress-active> <in-progress-active v-if="!canCreate" :dueData="dueData"></in-progress-active>
<!-- <div class="separator-space">- 当前有未开始的活动 -</div> <!-- <div class="separator-space">- 当前有未开始的活动 -</div>
<will-start-active></will-start-active> --> <will-start-active></will-start-active> -->
...@@ -36,6 +40,7 @@ import finishedActive from '@/components/active/finished-active.vue'; ...@@ -36,6 +40,7 @@ import finishedActive from '@/components/active/finished-active.vue';
// import showMsg from '@/common/js/showmsg'; // import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
import { getRequest } from '@/api/api'; import { getRequest } from '@/api/api';
import moment from 'moment'
export default { export default {
name: 'share-index', name: 'share-index',
components: { components: {
...@@ -46,11 +51,39 @@ export default { ...@@ -46,11 +51,39 @@ export default {
}, },
data() { data() {
return { return {
canCreate: true canCreate: true,
dueData: {
dueDay: 0, // 即将到期天数
endDate: new Date().getTime(), // 到期时间
isOverdue: 0, // 是否过期,0:未过期,1:已过期
overdueDay: 0 // 过期天数
}
}; };
}, },
methods: { methods: {
/** /**
* 是否过期
*/
judgeDue() {
const that = this;
let para = {};
getRequest('/sharing-core-web/isOverdue', para)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
that.dueData=Object.assign({},that.dueData,resData.result)
return false;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/**
* 是否可以创建活动 * 是否可以创建活动
*/ */
judgeCreate() { judgeCreate() {
...@@ -102,19 +135,34 @@ export default { ...@@ -102,19 +135,34 @@ export default {
beforeMount() { beforeMount() {
const that = this; const that = this;
that.judgePay(); that.judgePay();
that.judgeDue();
}, },
mounted() { mounted() {
const that = this; const that = this;
that.judgeCreate(); that.judgeCreate();
},
filters: {
dateFilter(v){
return moment(v).format('YYYY年MM月DD日')
}
} }
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.share-index { .red{
color:red;
}
.flex-top-wrap{
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
width: 100%;
height: 40px;
margin-bottom: 9px;
.separator-space { .separator-space {
width: 100%; margin-right: 19px;
height: 60px; line-height: 40px;
line-height: 60px;
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
color: #909399; color: #909399;
...@@ -124,5 +172,20 @@ export default { ...@@ -124,5 +172,20 @@ export default {
line-height: 20px; line-height: 20px;
} }
} }
.alert-wrap{
// width:774px;
height:40px;
padding:0 7px 0 17px;
line-height:40px;
background:#FFFBE6;
border-radius:4px;
border:1pxsolid#FFE58F;
color:#606266;
font-size:14px;
.el-icon-warning{
margin-right:9px;
color:#FAAD14;
}
}
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment