diff --git a/src/api/channel.js b/src/api/channel.js index bc7c9c8..cd1b05e 100644 --- a/src/api/channel.js +++ b/src/api/channel.js @@ -58,7 +58,7 @@ export function ListChannel(pram) { export function ListChannels(pram) { const data = { channelId: pram.channelId, - + dateLimit:pram.dateLimit, page: pram.page, limit: pram.limit, }; diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index ff386ec..2ed2e11 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -62,7 +62,7 @@ export default { return {}; }, mounted(){ - console.log(this.item,'itemitem'); + // console.log(this.item,'itemitem'); }, methods: { hasOneShowingChild(child = [], parent) { diff --git a/src/libs/public.js b/src/libs/public.js index b24889f..1481d58 100644 --- a/src/libs/public.js +++ b/src/libs/public.js @@ -46,11 +46,11 @@ export function isLogin() { * @description 核销员列表 */ export function getStoreStaff() { - return new Promise((resolve, reject) => { - storeStaffListApi({ page: 1, limit: 9999 }).then(async (res) => { - localStorage.setItem('storeStaffList', res.list ? JSON.stringify(res.list) : []); - }); - }); + // return new Promise((resolve, reject) => { + // storeStaffListApi({ page: 1, limit: 9999 }).then(async (res) => { + // localStorage.setItem('storeStaffList', res.list ? JSON.stringify(res.list) : []); + // }); + // }); } /** diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 07be2df..06d9420 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -89,6 +89,7 @@ const actions = { return new Promise((resolve, reject) => { getInfo(state.token) .then((data) => { + localStorage.setItem('userInfo', JSON.stringify(data)); if (!data) { reject('Verification failed, please Login again.'); } diff --git a/src/views/channel/creatChannel.vue b/src/views/channel/creatChannel.vue index a3b40fc..789b186 100644 --- a/src/views/channel/creatChannel.vue +++ b/src/views/channel/creatChannel.vue @@ -98,24 +98,26 @@ export default { return (value * 100).toFixed(2) + '%'; } }, - // info(id) { - // this.loading = true; - // levelInfoApi({ id: id }) - // .then((res) => { - // this.formValidate = res; - // this.loading = false; - // }) - // .catch(() => { - // this.loading = false; - // }); - // }, + info(id) { + this.loading = true; + levelInfoApi({ id: id }) + .then((res) => { + this.formValidate = res; + this.loading = false; + }) + .catch(() => { + this.loading = false; + }); + }, handleClose() { this.dialogVisible = false; // this.user = Object.assign({}, '') }, submitForm: Debounce(function (formName) { this.$refs.channelInfo.validate((valid) => { + console.log(valid,'validvalid'); if (valid) { + console.log('进入了判断1'); this.loading = true; // debugger // this.channelInfo.amountComesUp = (this.channelInfo.amountComesUpStr)/100; @@ -158,7 +160,20 @@ export default { this.formValidate = Object.assign({}, obj); }); } else { - return false; + // return false; + AddChannel(this.channelInfo) + .then((res) => { + this.$message.success('添加成功'); + this.loading = false; + this.handleClose(); + this.formValidate = Object.assign({}, obj); + this.$parent.getList(); + clog + }) + .catch(() => { + this.loading = false; + this.formValidate = Object.assign({}, obj); + }); } }); }), diff --git a/src/views/channel/index.vue b/src/views/channel/index.vue index 346021a..26e8ef0 100644 --- a/src/views/channel/index.vue +++ b/src/views/channel/index.vue @@ -87,7 +87,7 @@
总转化率:{{ chooselist.totalConversionRatio }}
回款率:{{ chooselist.totalReturnRate }}
-
+
总注册:{{ chooselist.totalRegisterNum }}
总订单金额:{{ chooselist.totalAmount }}
总订单数量:{{ chooselist.totalOrderNum }}
@@ -96,6 +96,10 @@
渠道链接:{{ chooselist.url }}
+
+
渠道账号:{{ chooselist.account }}
+
渠道密码:初始密码为123456
+
日统计报表
@@ -269,18 +273,22 @@ export default { }, copyurl(url){ console.log(url); - navigator.clipboard.writeText(url) - .then(() => { - console.log('URL已成功复制到剪贴板'); - this.$message({ - message: '复制成功', - type: 'success', - center:true - }); - }) - .catch(err => { - console.error('无法复制URL到剪贴板:', err); - }); + const textarea = document.createElement('textarea'); + textarea.value = url; + document.body.appendChild(textarea); + textarea.select(); + document.execCommand('copy'); + document.body.removeChild(textarea); + // alert('文本已复制到剪贴板!'); + this.$message.success('复制成功'); + // navigator.clipboard.writeText(url) + // .then(() => { + // console.log('URL已成功复制到剪贴板'); + // this.$message.success('复制成功'); + // }) + // .catch(err => { + // console.error('无法复制URL到剪贴板:', err); + // }); }, getuserlist(){ Listuser(this.userPrams) @@ -435,13 +443,13 @@ export default { font-family: Source Han Sans; font-size: 20px; font-weight: bold; - line-height: 70px; + line-height:30px; letter-spacing: 0px; } .infobox { width: 90%; - margin: 20px auto; + margin: 5px auto; display: flex; flex-wrap: wrap; @@ -454,9 +462,9 @@ export default { .li { width: 33%; - font-size: 20px; + font-size: 16px; font-weight: normal; - line-height: 70px; + line-height: 40px; letter-spacing: 0px; align-self: flex-start; // 使每个 .li 在顶部对齐 } diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 3886adf..8dac6a4 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -156,8 +156,8 @@ export default { }, }, loginForm: { - account: 'admin', - pwd: '123456', + account: '', + pwd: '', key: '', code: '', captcha: { diff --git a/src/views/statistic/channel/components/channel.vue b/src/views/statistic/channel/components/channel.vue index 9a031b3..f2bbae0 100644 --- a/src/views/statistic/channel/components/channel.vue +++ b/src/views/statistic/channel/components/channel.vue @@ -6,7 +6,7 @@
- + import { channelOverviewApi, channelTrendApi } from '@/api/statistic'; +import { ListChannel,ListChannels,Listuser, AddChannel, UpdateChannel, InfoChannel, DelChannel } from '@/api/channel'; import echartsNew from '@/components/echartsNew/index'; import exportExcel from '@/utils/newToExcel.js'; //表格导出方法 import { checkPermi } from '@/utils/permission'; // 权限判断函数 @@ -99,18 +100,36 @@ export default { options: this.$timeOptions, name: '近30天', timeVal: [], - fromList: this.$constants.timeList, - dateLimit: '', - dateLimitPram: {}, + // fromList: this.$constants.timeList, + fromList:{ + custom:true, + title:'选择时间', + fromTxt:[ + {text:'全部',val:'all'}, + {text:'昨天',val:'yesterday'}, + {text:'最近7天',val:'lately7'}, + {text:'最近30天',val:"lately30"}, + ] + + }, + + dateLimit: 'lately7', + dateLimitPram: 'lately7', list: [], optionData: {}, channelId: '', channelList:[ - {name:"百度",id: 1}, - {name:"头条",id: 2}, + ], + listPram: { + productId: 1, + productName: null, + page: 1, + limit: this.$constants.page.limit[0], + }, style: { height: '400px' }, pickerOptions: this.$timeOptions, + userInfo:{} }; }, created() { @@ -120,10 +139,21 @@ export default { this.timeVal = [start, end]; }, mounted() { - this.dateLimit = 'lately7'; - this.dateLimitPram = 'lately7'; - this.getStatistics(); - this.getTrend(); + console.log(this.fromList,'this.fromListthis.fromList'); +// 获取存储的用户信息 +const userInfoString = localStorage.getItem('userInfo'); + +// 将 JSON 字符串解析为 JavaScript 对象 +this. userInfo = JSON.parse(userInfoString); + +// 现在 userInfo 变量中存储了之前存储在本地存储中的用户信息 + + // this.dateLimit = 'all'; + // this.dateLimitPram = 'all'; + this.getList() + + // this.getTrend(); + }, methods: { checkPermi, @@ -132,7 +162,39 @@ export default { this.timeVal = e; this.$set(this, 'dateLimitPram', e ? this.timeVal.join(',') : ''); }, + getList() { + ListChannel(this.listPram) + .then((res) => { + // 如果用户是 admin,则直接处理接口返回的数据 + if (this.userInfo.account=='admin') { + this.channelList = res.list; + this.channelId = this.channelList[0].id; + this.getStatistics(); + this.$parent.getlist(this.channelId, this.dateLimitPram); + } else { + // 如果用户不是 admin,则根据用户账号过滤接口返回的数据 + const userAccount = this.userInfo ? this.userInfo.account : null; + if (userAccount) { + this.channelList = res.list.filter(item => item.account === userAccount); + if (this.channelList.length > 0) { + this.channelId = this.channelList[0].id; + this.getStatistics(); + this.$parent.getlist(this.channelId, this.dateLimitPram); + } + } + } + console.log(res); + }) + .catch(() => { + // 处理错误 + }); +}, + idchange(){ + this.$parent.getlist( this.channelId,this.dateLimitPram) + this.getStatistics(); + }, selectChange(limit) { + console.log(limit,'limitlimit'); if (limit == '') { //昨天的时间 let day1 = new Date(); @@ -142,17 +204,18 @@ export default { let s1 = day1.getFullYear() + '-' + (day1.getMonth() + 1) + '-' + day1.getDate(); let s2 = day2.getFullYear() + '-' + (day2.getMonth() + 1) + '-' + day2.getDate(); this.dateLimitPram = `${s1},${s2}`; - this.getTrend(); + // this.getTrend(); this.getStatistics(); } else { this.dateLimitPram = limit; - this.getTrend(); + // this.getTrend(); this.getStatistics(); } + // this.$parent.getlist( this.channelId,this.dateLimitPram) }, onSeach() { this.getStatistics(); - this.getTrend(); + // this.getTrend(); }, async exports() { let [th, filekey, data, fileName] = [[], [], [], '']; diff --git a/src/views/statistic/channel/components/newtoday.vue b/src/views/statistic/channel/components/newtoday.vue new file mode 100644 index 0000000..7cf6851 --- /dev/null +++ b/src/views/statistic/channel/components/newtoday.vue @@ -0,0 +1,385 @@ + + + + + + diff --git a/src/views/statistic/channel/components/toDay.vue b/src/views/statistic/channel/components/toDay.vue index 5c2e00d..97936ac 100644 --- a/src/views/statistic/channel/components/toDay.vue +++ b/src/views/statistic/channel/components/toDay.vue @@ -1,6 +1,6 @@