Commit 3b18e49c by crushh

Merge branch 'feature/act-code' into dev

parents 6e8c35b5 4a874332
......@@ -41,3 +41,21 @@ export const detailClerkList = params => postJsonRequest('/haoban-manage3-web/hm
//【欢迎语】-- 特殊欢迎语关联详情列表
export const welcomeRelationList = params => getRequest('/haoban-manage3-web/welcome/relation/list', params);
// 【活码链接】-- 新增
export const linkAdd = params => postJsonRequest('/haoban-manage3-web/hm/link/add', params);
// 【活码链接】-- 编辑
export const linkUpdate = params => postJsonRequest('/haoban-manage3-web/hm/link/update', params);
// 【活码链接】-- 详情 actCode
export const linkDetail = params => postJsonRequest('/haoban-manage3-web/hm/link/detail', params);
// 【活码链接】 -- 统计-总计
export const statisticsTotal = params => postJsonRequest('/haoban-manage3-web/hm/link/statistics/total', params);
// 【活码链接】 -- 统计-图表
export const statisticsChart = params => postJsonRequest('/haoban-manage3-web/hm/link/statistics/chart', params);
// 【活码链接】 -- 统计--查看明细
export const statisticsClerk = params => postJsonRequest('/haoban-manage3-web/hm/link/statistics/clerk', params);
......@@ -64,8 +64,6 @@ Vue.axios.interceptors.request.use(
let haobanSign = sessionStorage.getItem('userInfoBrandId');
haobanSign ? (config.headers.enterpriseId = haobanSign) : '';
}
console.log(config);
return config;
},
err => {
......
......@@ -14,25 +14,24 @@
export default {
/*
* var storeBusinessTime="10:00-22:00" to
*/
* var storeBusinessTime="10:00-22:00" to
*/
timeToDate: function(val) {
var date = new Date()
var date = new Date();
var y = date.getFullYear();
var m = date.getMonth() +1;
var m = date.getMonth() + 1;
var day = date.getDate();
var d = [],newArr = [];
var d = [],
newArr = [];
var dArr = val.split('-');
dArr.forEach(function(ele,index){
newArr.push(ele.split(':'))
})
d = [new Date(y,m,day,newArr[0][0],newArr[0][1]),new Date(y,m,day,newArr[1][0],newArr[1][1])]
dArr.forEach(function(ele, index) {
newArr.push(ele.split(':'));
});
d = [new Date(y, m, day, newArr[0][0], newArr[0][1]), new Date(y, m, day, newArr[1][0], newArr[1][1])];
return d;
},
dateToTime(val) {
// console.log(val)
// (0-9)年月数字的显示
......@@ -40,9 +39,9 @@ export default {
return num > 9 ? '' + num : '0' + num;
}
var t;
var t1 = formatDig(new Date(val[0]).getHours())+':'+formatDig(new Date(val[0]).getMinutes())
var t2 = formatDig(new Date(val[1]).getHours())+':'+formatDig(new Date(val[1]).getMinutes())
t= t1+'-'+t2
var t1 = formatDig(new Date(val[0]).getHours()) + ':' + formatDig(new Date(val[0]).getMinutes());
var t2 = formatDig(new Date(val[1]).getHours()) + ':' + formatDig(new Date(val[1]).getMinutes());
t = t1 + '-' + t2;
return t;
}
}
};
var SIGN_REGEXP = /([yMdhsm])(\1*)/g;
var DEFAULT_PATTERN = 'yyyy-MM-dd';
function padding(s, len) {
var len = len - (s + '').length;
for (var i = 0; i < len; i++) { s = '0' + s; }
return s;
};
var len = len - (s + '').length;
for (var i = 0; i < len; i++) {
s = '0' + s;
}
return s;
}
export default {
getQueryStringByName: function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
var context = "";
if (r != null)
context = r[2];
reg = null;
r = null;
return context == null || context == "" || context == "undefined" ? "" : context;
getQueryStringByName: function(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
var context = '';
if (r != null) context = r[2];
reg = null;
r = null;
return context == null || context == '' || context == 'undefined' ? '' : context;
},
formatDate: {
format: function(date, pattern) {
pattern = pattern || DEFAULT_PATTERN;
return pattern.replace(SIGN_REGEXP, function($0) {
switch ($0.charAt(0)) {
case 'y':
return padding(date.getFullYear(), $0.length);
case 'M':
return padding(date.getMonth() + 1, $0.length);
case 'd':
return padding(date.getDate(), $0.length);
case 'w':
return date.getDay() + 1;
case 'h':
return padding(date.getHours(), $0.length);
case 'm':
return padding(date.getMinutes(), $0.length);
case 's':
return padding(date.getSeconds(), $0.length);
}
});
},
formatDate: {
format: function (date, pattern) {
pattern = pattern || DEFAULT_PATTERN;
return pattern.replace(SIGN_REGEXP, function ($0) {
switch ($0.charAt(0)) {
case 'y': return padding(date.getFullYear(), $0.length);
case 'M': return padding(date.getMonth() + 1, $0.length);
case 'd': return padding(date.getDate(), $0.length);
case 'w': return date.getDay() + 1;
case 'h': return padding(date.getHours(), $0.length);
case 'm': return padding(date.getMinutes(), $0.length);
case 's': return padding(date.getSeconds(), $0.length);
}
});
},
parse: function (dateString, pattern) {
var matchs1 = pattern.match(SIGN_REGEXP);
var matchs2 = dateString.match(/(\d)+/g);
if (matchs1.length == matchs2.length) {
var _date = new Date(1970, 0, 1);
for (var i = 0; i < matchs1.length; i++) {
var _int = parseInt(matchs2[i]);
var sign = matchs1[i];
switch (sign.charAt(0)) {
case 'y': _date.setFullYear(_int); break;
case 'M': _date.setMonth(_int - 1); break;
case 'd': _date.setDate(_int); break;
case 'h': _date.setHours(_int); break;
case 'm': _date.setMinutes(_int); break;
case 's': _date.setSeconds(_int); break;
}
}
return _date;
}
return null;
parse: function(dateString, pattern) {
var matchs1 = pattern.match(SIGN_REGEXP);
var matchs2 = dateString.match(/(\d)+/g);
if (matchs1.length == matchs2.length) {
var _date = new Date(1970, 0, 1);
for (var i = 0; i < matchs1.length; i++) {
var _int = parseInt(matchs2[i]);
var sign = matchs1[i];
switch (sign.charAt(0)) {
case 'y':
_date.setFullYear(_int);
break;
case 'M':
_date.setMonth(_int - 1);
break;
case 'd':
_date.setDate(_int);
break;
case 'h':
_date.setHours(_int);
break;
case 'm':
_date.setMinutes(_int);
break;
case 's':
_date.setSeconds(_int);
break;
}
}
return _date;
}
return null;
}
}
};
<template>
<el-popover placement="bottom" style="min-width: 357px" v-model="departmentVisible">
<dm-simple-transfer v-model="checked" :data="data" :item-size="56" :titles="['选择门店', '已选门店']" filterable filter-placeholder="请输入门店名称/code">
<dm-simple-transfer v-model="checked" :props="props" :data="data" :item-size="56" :titles="['选择门店', '已选门店']" filterable filter-placeholder="请输入门店名称/code" @change="change">
<div slot-scope="{ option }">
<p>{{ option.label }}</p>
<p style="font-size: 12px;line-height: 18px">{{ option.key }}</p>
<p style="font-size: 12px;line-height: 18px">{{ option.code }}</p>
</div>
</dm-simple-transfer>
<div class="flex-column item-cell-select inline-block " slot="reference">
<el-input></el-input>
<div class="show-select-num cursor-pointer w-250" slot="reference">
已经选择{{ checked.length }}家门店
<span class="el-input__suffix"
><span class="el-input__suffix-inner"><i :class="['el-select__caret el-input__icon el-icon-arrow-up', departmentVisible ? 'is-reverse' : '']"></i></span
></span>
</div>
</el-popover>
</template>
<script>
import { getRequest } from '@/api/api';
export default {
data() {
return {
departmentVisible: false,
checked: [],
data: []
data: [],
props: {
key: 'storeId',
label: 'storeName'
},
form: {
storeSearchParams: '',
pageSize: 20,
pageNum: 1
}
};
},
mounted() {
this.getList();
},
methods: {
getList() {
getRequest('/haoban-manage3-web/hm/store-list', {}).then(res => {
console.log(res);
const { result } = res.data;
this.data = result || [];
});
},
change(val) {
this.$emit('change', val);
}
}
};
</script>
<style></style>
<style lang="scss" scoped>
.show-select-num {
position: relative;
display: inline-block;
font-size: inherit;
height: 32px;
line-height: 32px;
padding-left: 10px;
-webkit-appearance: none;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #606266;
.el-select__caret {
color: #c0c4cc;
font-size: 14px;
transition: transform 0.3s;
transform: rotate(180deg);
cursor: pointer;
&.is-reverse {
transform: rotate(0deg);
}
}
}
</style>
......@@ -47,7 +47,8 @@ export default {
this.card = { pageTitle, merchantName, merchantPhoneNumber, merchantLogo, pageBackgroundImg, guideComment };
}
},
deep: true
deep: true,
immediate: true
}
}
};
......
<template>
<div class="target-group">
<div class="target" :style="{ width: `${100 / dataList.length}%` }" v-for="(el, index) in dataList" :key="index">
<div class="target-label">
{{ el.label }}
<el-tooltip v-if="el.tips" placement="top" popper-class="target-tooltip">
<div slot="content" v-html="el.tips" style="max-width: 450px"></div>
<i class="iconfont icon-QuestionCircleOutlined target-label-icon"></i>
</el-tooltip>
</div>
<div class="target-value">
{{ el.value }}<span v-if="el.unit" class="target-value-unit">{{ el.unit }}</span>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'TargetGroup',
props: {
dataList: {
type: Array,
default: () => []
}
}
};
</script>
<style lang="scss" scoped>
.target-group {
display: flex;
justify-content: flex-start;
align-items: flex-start;
margin-top: 16px;
padding: 20px;
width: 100%;
min-width: 265px;
background: #f7f8fa;
border-radius: 4px;
box-sizing: border-box;
.target {
flex-shrink: 0;
.target-label {
font-size: 14px;
font-weight: 400;
color: #606266;
line-height: 20px;
.target-label-icon {
font-size: inherit;
}
}
.target-value {
display: flex;
justify-content: flex-start;
align-items: flex-end;
margin-top: 8px;
font-size: 24px;
font-family: DIN Alternate-Bold, DIN Alternate;
font-weight: bold;
color: #303133;
line-height: 28px;
.target-value-unit {
font-size: 14px;
line-height: 25px;
font-weight: 600;
}
}
}
}
</style>
......@@ -28,7 +28,7 @@ const attractFlowLinkRouter = [
meta: {
type: 'info'
},
component: _import('salesleads/actCodeManage/attractFlowLink', 'detail')
component: _import('salesleads/actCodeManage/attractFlowLink', 'info')
},
{
path: '/ladingPageList',
......
......@@ -3,32 +3,32 @@
*/
export function isvalidUsername(str) {
const valid_map = ['admin', 'editor']
return valid_map.indexOf(str.trim()) >= 0
const valid_map = ['admin', 'editor'];
return valid_map.indexOf(str.trim()) >= 0;
}
/* 合法uri*/
export function validateURL(textval) {
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return urlregex.test(textval)
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;
return urlregex.test(textval);
}
/* 小写字母*/
export function validateLowerCase(str) {
const reg = /^[a-z]+$/
return reg.test(str)
const reg = /^[a-z]+$/;
return reg.test(str);
}
/* 大写字母*/
export function validateUpperCase(str) {
const reg = /^[A-Z]+$/
return reg.test(str)
const reg = /^[A-Z]+$/;
return reg.test(str);
}
/* 大小写字母*/
export function validateAlphabets(str) {
const reg = /^[A-Za-z]+$/
return reg.test(str)
const reg = /^[A-Za-z]+$/;
return reg.test(str);
}
/**
......@@ -37,7 +37,23 @@ export function validateAlphabets(str) {
* @returns {boolean}
*/
export function validateEmail(email) {
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return re.test(email)
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
/** 表单校验滚动到第一个错误项
* @param {Object} that vue实例
* this.scrollToError(this);
*/
export const scrollToError = that => {
that.$nextTick(_ => {
const isError = document.getElementsByClassName('is-error');
isError[0].scrollIntoView({
// 滚动到指定节点
// 值有start,center,end,nearest,当前显示在视图区域中间
block: 'center',
// 值有auto、instant,smooth,缓动动画(当前是慢速的)
behavior: 'smooth'
});
});
};
......@@ -2,7 +2,7 @@
<div class="daily-set-wrap">
<div class="daily-set-content border-box">
<div class="salutatory-set-wrap m-t-20">
<el-form label-width="117px" ref="form" :model="form" :rules="rules" refs="form" class="form">
<el-form label-width="117px" ref="form" :model="form" :rules="rules" class="form">
<el-form-item label="欢迎语标题" prop="title">
<el-input show-word-limit placeholder="请输入欢迎语标题" type="text" v-model="form.title" maxlength="20" class="w-384"></el-input>
</el-form-item>
......
......@@ -3,7 +3,7 @@
<dm-sub-title class="m-b-10">
<div class="title">
<span>引流加入</span>
<span class="info-content cur-po"><i class="iconfont-hb3 iconzhibiaoshuoming info-icon"></i>指标说明</span>
<el-button type="text"><i class="iconfont-hb3 iconzhibiaoshuoming info-icon"></i>指标说明</el-button>
</div>
</dm-sub-title>
<!-- <el-tabs v-model="activeName" @tab-click="handleClick">
......@@ -163,16 +163,16 @@ export default {
btnArr: [
{
text: '数据',
handler: row => this.goInformation(row)
handler: row => this.goDetail(row, 'second')
},
{
text: '详情',
handler: row => this.goDetail(row)
handler: row => this.goDetail(row, 'first')
},
{
text: '链接',
visible: row => {
return row.linkType;
return row.linkType == 2;
},
handler: row => this.goLink(row)
},
......@@ -251,11 +251,8 @@ export default {
goLanding() {
this.$router.push('/ladingPageList');
},
goInformation(row) {
console.log(row);
},
goDetail(row) {
console.log(row);
goDetail(row, type) {
this.$router.push(`attractFlowLinkInfo/${row.linkId}?type=${type}`);
},
goLink(row) {
this.linkUrl = row.linkUrl;
......@@ -265,6 +262,7 @@ export default {
},
goEdit(row) {
console.log(row);
this.$router.push(`attractFlowLinkEdit/${row.linkId}`);
}
}
};
......@@ -274,10 +272,6 @@ export default {
width: 100%;
display: flex;
justify-content: space-between;
.info-content {
color: #2f54eb;
font-size: 14px;
}
.info-icon {
margin-right: 8px;
}
......
<template>
<div>
<div class="daily-set-content">
<el-form label-width="100px" ref="form" :model="form" :rules="rules" refs="form" class="form">
<el-form label-width="100px" ref="form" :model="form" :rules="rules" class="form">
<el-form-item label="模板名称" prop="pageName" required>
<el-input show-word-limit placeholder="请输入模板名称" type="text" v-model="form.pageName" maxlength="20" class="w-340"></el-input>
</el-form-item>
......@@ -41,6 +41,7 @@
import singleUpload from '@/components/single-upload.vue';
import previewPage from '@/components/preview-page.vue';
import { guidePageDetail, guidePageEdit, guidePageSave, wxEnterpriseList } from '@/api/actCode';
export default {
components: {
previewPage,
......@@ -132,11 +133,14 @@ export default {
});
},
save() {
if (this.isEdit) {
this.guidePageEdit();
} else {
this.guidePageSave();
}
this.$refs.form.validate(val => {
if (!val) return;
if (this.isEdit) {
this.guidePageEdit();
} else {
this.guidePageSave();
}
});
}
}
};
......
......@@ -2,7 +2,7 @@
<div class="daily-set-content">
<div class="flex flex-space-between m-b-16">
<div class="flex flex-align-center">
<el-input placeholder="请输入模板ID/名称、创建人" class="w-260" v-model="form.pageSearchText" @keyup.native="value => toInput(value, searchInput)" clearable @clear="getList"> <i slot="prefix" class="el-input__icon el-icon-search"></i> </el-input>
<el-input placeholder="请输入模板ID/名称、创建人" class="w-260" v-model="form.pageSearchText" @keyup.native="toInput" clearable @clear="getList"> <i slot="prefix" class="el-input__icon el-icon-search"></i> </el-input>
<span style="font-size:14px;" class="m-l-10">模板创建时间:</span>
<el-date-picker class="m-l-10 w-256" v-model="form.dateRange" @change="getList" type="daterange" :value-format="'yyyy-MM-dd'" clearable @clear="getList" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker>
</div>
......
<template>
<div :id="id"></div>
<!-- <div v-if="charData.length" :id="id"></div> -->
<!-- <div v-else class="chart--nodata"></div> -->
</template>
<script>
// import G2 from '@antv/g2';
import * as G2 from '@antv/g2';
export default {
data() {
return {
chart: null
};
},
props: {
charData: {
type: Array,
default() {
return [];
}
},
id: String,
width: {
type: Number,
default: 1192
}
},
mounted() {
setTimeout(() => {
this.drawChart(); // 第一步是创建的时候更新图表,但是这个不适用于异步请求接口获取相关数据,采用下面的监听的方式
}, 30);
},
beforeUpdate() {
this.drawChart();
},
watch: {
charData() {
this.drawChart();
}
},
methods: {
async drawChart() {
this.chart && this.chart.destroy();
this.chart = new G2.Chart({
container: this.id,
height: 359,
forceFit: true,
width: this.width,
padding: [20, 40, 80, 80]
});
this.chart.data(this.charData, {
bizDate: {
// type: 'cat', //分类
alias: '日期' //别名
},
addNum: {
alias: '今日添加人数'
},
clickNum: {
alias: '今日点击人数'
},
clickTimes: {
alias: '今日点击人次'
}
});
//坐标轴配置(法一配置)
this.chart.axis('bizDate', {
line: {
style: {
stroke: '#606266',
lineDash: [3, 3]
}
},
tickLine: {
style: {
fill: '#E4E7ED',
lineDash: [3, 3]
}
},
label: {
style: {
fill: '#606266'
}
}
});
// this.chart.axis('新增人数', {
// grid: {
// line: {
// type: 'line',
// style: {
// stroke: '#E4E7ED',
// lineDash: [3, 3]
// }
// }
// },
// label: {
// style: {
// fill: '#606266'
// },
// formatter: val => {
// // 格式化参数值
// return val;
// }
// }
// });
// 图例
this.chart.legend({
custom: true,
position: 'top-left',
items: [
{ name: '今日添加人数', value: 'addNum', marker: { symbol: 'line', style: { stroke: '#4B74E8', lineWidth: 12, lineHeight: 8 } } },
{ name: '今日点击人次', value: 'clickTimes', marker: { symbol: 'line', style: { stroke: '#D6B38C', lineWidth: 12, lineHeight: 8 } } },
{ name: '今日点击人数', value: 'clickNum', marker: { symbol: 'line', style: { stroke: '#14C9C9', lineWidth: 12, lineHeight: 8 } } }
]
});
this.chart
.line()
.position('bizDate*addNum')
.color('#4B74E8');
this.chart
.line()
.position('bizDate*clickTimes')
.color('#D6B38C');
this.chart
.line()
.position('bizDate*clickNum')
.color('#14C9C9');
this.chart.removeInteraction('legend-filter'); // 自定义图例,移除默认的分类图例筛选交互
//图表绘制的最后一步,用于将图表渲染至画布
this.chart.render();
}
}
};
</script>
export default {
data() {
return {
dateKey: 0,
dateLis: [
{ key: 0, value: '近7天' },
{ key: 1, value: '近30天' },
{ key: 2, value: '近三个月' },
{ key: 3, value: '近半年' },
{ key: 4, value: '近一年' }
],
dateDefault: [],
pickerOptions() {
let pickerMinDate;
return {
onPick(obj) {
pickerMinDate = obj.minDate;
},
disabledDate(time) {
let start = new Date();
start = new Date(`${start.getFullYear()}-${start.getMonth() + 1}-${start.getDate()}`);
let start2 = new Date(pickerMinDate);
let end = new Date();
end = new Date(`${end.getFullYear()}-${end.getMonth() + 1}-${end.getDate()} 23:59:59`);
let end2 = new Date(pickerMinDate);
if (pickerMinDate) {
start = start.setFullYear(start.getFullYear() - 2);
start2 = start2.setDate(start2.getDate() - 60);
start = start > start2 ? start : start2;
end2 = end2.setDate(end2.getDate() + 60);
end = end.getTime() > end2 ? end2 : end.getTime();
} else {
start = start.setFullYear(start.getFullYear() - 2);
end = end.getTime();
}
return time.getTime() < start || time.getTime() > end;
}
};
}
};
},
methods: {
getDateRange(setEndDate) {
const start = new Date();
let end = new Date();
end = setEndDate(end);
function getDate(date) {
const result = [];
result.push(date.getFullYear());
result.push((date.getMonth() + 1).toString().padStart(2, '0'));
result.push(
date
.getDate()
.toString()
.padStart(2, '0')
);
return result.join('-');
}
// yyyy-MM-dd
return [getDate(start), getDate(end)];
},
btnChange(index) {
let that = this;
that.dateKey = index;
that.dateDefault = [];
let setDate;
if (index == 0) {
// 近7天
setDate = endDate => {
endDate.setDate(endDate.getDate() - 6);
return new Date(endDate);
};
} else if (index == 1) {
// 近30天
setDate = endDate => {
endDate.setDate(endDate.getDate() - 29);
return new Date(endDate);
};
} else if (index == 2) {
// 近三个月
setDate = endDate => {
endDate.setMonth(endDate.getMonth() - 3);
endDate.setDate(endDate.getDate() + 1);
return new Date(endDate);
};
} else if (index == 3) {
// 近半年
setDate = endDate => {
endDate.setMonth(endDate.getMonth() - 6);
endDate.setDate(endDate.getDate() + 1);
return new Date(endDate);
};
} else {
// 近一年
setDate = endDate => {
endDate.setFullYear(endDate.getFullYear() - 1);
endDate.setDate(endDate.getDate() + 1);
return new Date(endDate);
};
}
const [start, end] = that.getDateRange(setDate);
that.dateDefault.push(end);
that.dateDefault.push(start);
that.getChartList();
}
}
};
......@@ -56,7 +56,7 @@
</div>
</template>
<script>
import actCodeDetailInfo from './actCodeDetailInfo.vue';
import actCodeDetailInfo from '../../components/actCodeDetailInfo.vue';
import actCodeDetailStatistics from './actCodeDetailStatistics.vue';
import { _throttle } from '@/common/js/public';
import { getRequest, deleteRequest } from '@/api/api';
......
......@@ -64,6 +64,7 @@
import dataDetail from '../../components/dataDetail.vue';
import newAddChart from './newAddChart.vue';
import { postJsonRequest } from '@/api/api';
import mixin from '../components/mixin';
import errMsg from '@/common/js/error';
export default {
name: 'act-code-detail-statistics',
......@@ -76,45 +77,11 @@ export default {
}
}
},
mixins: [mixin],
data() {
return {
loading: false,
dateKey: 0,
dateLis: [
{ key: 0, value: '近7天' },
{ key: 1, value: '近30天' },
{ key: 2, value: '近三个月' },
{ key: 3, value: '近半年' },
{ key: 4, value: '近一年' }
],
dateDefault: [],
pickerOptions() {
let pickerMinDate;
return {
onPick(obj) {
pickerMinDate = obj.minDate;
},
disabledDate(time) {
let start = new Date();
start = new Date(`${start.getFullYear()}-${start.getMonth() + 1}-${start.getDate()}`);
let start2 = new Date(pickerMinDate);
let end = new Date();
end = new Date(`${end.getFullYear()}-${end.getMonth() + 1}-${end.getDate()} 23:59:59`);
let end2 = new Date(pickerMinDate);
if (pickerMinDate) {
start = start.setFullYear(start.getFullYear() - 2);
start2 = start2.setDate(start2.getDate() - 60);
start = start > start2 ? start : start2;
end2 = end2.setDate(end2.getDate() + 60);
end = end.getTime() > end2 ? end2 : end.getTime();
} else {
start = start.setFullYear(start.getFullYear() - 2);
end = end.getTime();
}
return time.getTime() < start || time.getTime() > end;
}
};
},
overViewData: { addNumT: 0, addNum: 0, dateList: [] }
};
},
......@@ -187,70 +154,7 @@ export default {
});
});
},
getDateRange(setEndDate) {
const start = new Date();
let end = new Date();
end = setEndDate(end);
function getDate(date) {
const result = [];
result.push(date.getFullYear());
result.push((date.getMonth() + 1).toString().padStart(2, '0'));
result.push(
date
.getDate()
.toString()
.padStart(2, '0')
);
return result.join('-');
}
// yyyy-MM-dd
return [getDate(start), getDate(end)];
},
btnChange(index) {
let that = this;
that.dateKey = index;
that.dateDefault = [];
let setDate;
if (index == 0) {
// 近7天
setDate = endDate => {
endDate.setDate(endDate.getDate() - 6);
return new Date(endDate);
};
} else if (index == 1) {
// 近30天
setDate = endDate => {
endDate.setDate(endDate.getDate() - 29);
return new Date(endDate);
};
} else if (index == 2) {
// 近三个月
setDate = endDate => {
endDate.setMonth(endDate.getMonth() - 3);
endDate.setDate(endDate.getDate() + 1);
return new Date(endDate);
};
} else if (index == 3) {
// 近半年
setDate = endDate => {
endDate.setMonth(endDate.getMonth() - 6);
endDate.setDate(endDate.getDate() + 1);
return new Date(endDate);
};
} else {
// 近一年
setDate = endDate => {
endDate.setFullYear(endDate.getFullYear() - 1);
endDate.setDate(endDate.getDate() + 1);
return new Date(endDate);
};
}
const [start, end] = that.getDateRange(setDate);
that.dateDefault.push(end);
that.dateDefault.push(start);
this.getChartList();
},
onDateChange(res) {
onDateChange() {
this.dateKey = -1;
this.getChartList();
}
......
......@@ -152,14 +152,31 @@ export default {
async getTableList() {
const that = this;
that.loading = true;
let para = {
pageNum: that.currentPage, // 当前页
pageSize: that.pageSize, // 一页显示个数
hmId: that.$route.query.hmId,
createTimeOrder: that.sortType || ''
};
let para = {};
let api = '';
if (this.$route.query.hmId) {
api = '/haoban-manage3-web/hm/qrcode/wxUserAddLog/list';
para = {
pageNum: that.currentPage, // 当前页
pageSize: that.pageSize, // 一页显示个数
hmId: that.$route.query.hmId,
createTimeOrder: that.sortType || ''
};
} else if (this.$route.query.linkId) {
const { startTime, endTime, clerkId, linkId } = this.$route.query;
api = '/haoban-manage3-web/hm/link/statistics/log';
para = {
pageNum: that.currentPage, // 当前页
pageSize: that.pageSize, // 一页显示个数
linkId,
clerkId,
startTime,
endTime
// createTimeOrder: that.sortType || ''
};
}
// console.log(para);
postJsonRequest('/haoban-manage3-web/hm/qrcode/wxUserAddLog/list', para)
postJsonRequest(api, para)
.then(res => {
let resData = res.data;
that.loading = false;
......
......@@ -31,7 +31,7 @@
<preview-welcome :welcomeContent="welcomeData.welcomeContent" :mediaList="welcomeData.welcomeMediaList"></preview-welcome>
</div>
</div>
<div>
<div v-if="type == 'actCode'">
<div class="title flex">
<div class="blue-block"></div>
<span class="font-w-500 color-303133">使用成员</span>
......@@ -89,6 +89,10 @@ export default {
hmId: {
type: String,
default: ''
},
type: {
type: String,
default: 'actCode'
}
},
data() {
......@@ -133,6 +137,7 @@ export default {
},
getwelcomeInfo() {
let that = this;
if (!this.welcomeId) return;
let para = {
welcomeId: this.welcomeId,
enterpriseId: this.enterpriseId || ''
......@@ -183,8 +188,10 @@ export default {
}
},
mounted() {
let that = this;
that.getUseTableList();
if (this.type == 'actCode') {
this.getUseTableList();
}
this.getwelcomeInfo();
},
watch: {
welcomeId: function(newData, oldData) {
......
......@@ -61,6 +61,10 @@ export default {
type: String,
default: ''
},
api: {
type: Function,
default: detailClerkList
},
typeT: {
type: String,
default: 'code'
......@@ -125,7 +129,6 @@ export default {
created() {
// 默认显示近七天
this.btnChange(0);
this.getTableList();
},
methods: {
getDateRange(setEndDate) {
......@@ -224,10 +227,12 @@ export default {
if (this.pageParam.inFields.clerkSelect == '') {
delete this.pageParam.inFields.clerkSelect;
}
await detailClerkList(this.pageParam).then(res => {
await this.api(this.pageParam).then(res => {
console.log(res);
if (res.data.code == 0) {
this.tableData = res.data.result.data || [];
this.totalCount = res.result.totalCount;
this.tableData = res.data.result.result || [];
this.totalCount = res.data.result.totalCount;
} else {
return this.$message(res.data.message);
}
......@@ -237,7 +242,14 @@ export default {
if (row.hmId) {
this.$router.push(`/actCodeRecord?hmId=${row.hmId}`);
} else if (row.linkId) {
this.$router.push(`/actCodeRecord?linkId=${row.linkId}`);
const { clerkId, linkId } = row;
const startTime = this.dateDefault && this.dateDefault.length ? this.dateDefault[0] : undefined;
const endTime = this.dateDefault && this.dateDefault.length ? this.dateDefault[1] : undefined;
let query = { linkId, clerkId };
startTime ? (query.startTime = startTime) : '';
endTime ? (query.endTime = endTime) : '';
this.$router.push({ path: '/actCodeRecord', query: query });
}
}
}
......
......@@ -474,6 +474,9 @@ input:focus {
.p-t-185 {
padding-top: 185px;
}
.p-b-40{
padding-bottom: 40px;
}
.m-l-10 {
margin-left: 10px;
......@@ -481,6 +484,7 @@ input:focus {
.m-l-16 {
margin-left: 16px;
}
.m-t-6{
margin-top: 6px;
}
......
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