提交 0688f888 authored 作者: lidongxu's avatar lidongxu

feat(promotion): 促销任务列表

增加筛选条件,尝试调用线上接口
上级 b8d3aaa7
...@@ -7,6 +7,8 @@ VITE_APP_BASE_API = '/dev-api' ...@@ -7,6 +7,8 @@ VITE_APP_BASE_API = '/dev-api'
# VITE_APP_BASE_API = '/bclan' # VITE_APP_BASE_API = '/bclan'
# VITE_APP_BASE_API = '/home' # VITE_APP_BASE_API = '/home'
VITE_APP_PROMOTION_BASE_API = 'http://promotion.wxl66.cn:8010'
# 开发环境配置 # 开发环境配置
VITE_APP_ENV = 'development' VITE_APP_ENV = 'development'
......
...@@ -3,6 +3,7 @@ VITE_APP_TITLE = 王小卤-链路中心 ...@@ -3,6 +3,7 @@ VITE_APP_TITLE = 王小卤-链路中心
# 基地址 # 基地址
VITE_APP_BASE_API = '/api' VITE_APP_BASE_API = '/api'
VITE_APP_PROMOTION_BASE_API = 'http://promotion.wxl66.cn:8010'
# 生产环境配置 # 生产环境配置
VITE_APP_ENV = 'production' VITE_APP_ENV = 'production'
......
...@@ -3,6 +3,7 @@ VITE_APP_TITLE = 王小卤-链路中心 ...@@ -3,6 +3,7 @@ VITE_APP_TITLE = 王小卤-链路中心
# 基地址 # 基地址
VITE_APP_BASE_API = '/api' VITE_APP_BASE_API = '/api'
VITE_APP_PROMOTION_BASE_API = 'http://promotion.wxl66.cn:8010'
# 开发环境配置 # 开发环境配置
VITE_APP_ENV = 'staging' VITE_APP_ENV = 'staging'
......
...@@ -11,6 +11,7 @@ export * from './monitor/job' ...@@ -11,6 +11,7 @@ export * from './monitor/job'
export * from './monitor/jobLog' export * from './monitor/jobLog'
export * from './monitor/online' export * from './monitor/online'
export * from './monitor/server' export * from './monitor/server'
export * from './promotion/task'
export * from './system/dict/data' export * from './system/dict/data'
export * from './system/dict/type' export * from './system/dict/type'
export * from './system/attendance' export * from './system/attendance'
......
import request, { promotionBaseURL } from '@/utils/request'
import { parseTime } from '@/utils'
// 战区列表
export const getWarZoneListAPI = () => {
return request({
url: promotionBaseURL + '/user/dept/query/enroll/list',
method: 'POST',
data: {
"orgNameLike1": "战区",
// "orgName1": "重客运营部"
}
})
}
// 负责人列表
export const getChargeListAPI = () => {
return request({
url: promotionBaseURL + '/user/employee/query/enroll/list',
method: 'POST',
data: {
"waiqin365OrgId": '',
"empName": '',
"qcId": ''
}
})
}
// 任务列表
export const getTaskListAPI = (queryParams) => {
return request({
url: promotionBaseURL + '/activity/employee/query/page',
method: 'POST',
data: {
"pageNum": queryParams.page,
"pageSize": queryParams.pageSize,
"queryParams": {
"deptQcId": queryParams.zoneId,
// "createDateStart": parseTime(queryParams.date[0], '{y}-{m}-{d}'),
"createDateStart": '2025-01-12 00:00:00',
// "createDateEnd": parseTime(queryParams.date[1], '{y}-{m}-{d}'),
"createDateEnd": '2025-01-14 23:59:59',
"province": queryParams.province,
"city": queryParams.city,
"approverId": '',
"approveStatus": queryParams.taskStatus,
"storeNameLike": queryParams.storeName,
}
}
})
}
\ No newline at end of file
export const useDatePickerOptions = () => { /**
const nowMouth = [new Date().setDate((new Date().getDate() - 30)), new Date().setDate((new Date().getDate() - 1))] * 日期选项配置
* @param {*} type 0:从今天开始往前,-1 则是 T - 1 开始日期往前
* @returns {}
*/
export const useDatePickerOptions = (type = -1) => {
const last30Date = [new Date().setDate((new Date().getDate() - (30 - 1))), new Date().setDate((new Date().getDate() + type))]
const last7Date = [new Date().setDate((new Date().getDate() - (7 - 1))), new Date().setDate((new Date().getDate() + type))]
const pickerOptions = ref([// 日期选项配置 const pickerOptions = ref([// 日期选项配置
{ {
text: '最近一周', text: '最近一周',
value() { value() {
const end = new Date().setDate((new Date().getDate() - 1)); const end = new Date().setDate((new Date().getDate() + type));
const start = new Date(); const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); start.setTime(start.getTime() - 3600 * 1000 * 24 * (7 - 1));
return [start, end] return [start, end]
} }
}, { }, {
text: '最近一个月', text: '最近一个月',
value() { value() {
const end = new Date().setDate((new Date().getDate() - 1)); const end = new Date().setDate((new Date().getDate() + type));
const start = new Date(); const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); start.setTime(start.getTime() - 3600 * 1000 * 24 * (30 - 1));
return [start, end] return [start, end]
} }
} }
]) ])
return { return {
nowMouth, last30Date,
last7Date,
pickerOptions pickerOptions
} }
} }
\ No newline at end of file
...@@ -121,19 +121,6 @@ export function parseTime(time, pattern) { ...@@ -121,19 +121,6 @@ export function parseTime(time, pattern) {
return time_str return time_str
} }
/**
* 传入 "start" 获取 90 天前的时间戳,否则返回今天的年月日的日期对象(默认时间为 0 时 0 分 0 秒)
* @param {string} type
* @returns {Date}
*/
export function getTime(type) {
if (type === 'start') {
return new Date().getTime() - 3600 * 1000 * 24 * 90
} else {
return new Date(new Date().toDateString())
}
}
/** /**
* 时间后补 0 格式 例如:09:00 转成 09:00:00 * 时间后补 0 格式 例如:09:00 转成 09:00:00
* @param {*} time 时间字符串 * @param {*} time 时间字符串
......
...@@ -12,6 +12,9 @@ let downloadLoadingInstance; ...@@ -12,6 +12,9 @@ let downloadLoadingInstance;
// 是否显示重新登录 // 是否显示重新登录
export let isRelogin = { show: false }; export let isRelogin = { show: false };
// 其他系统后台 baseURL
export const promotionBaseURL = import.meta.env.VITE_APP_PROMOTION_BASE_API
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
......
...@@ -66,7 +66,7 @@ import { useDatePickerOptions } from '@/hooks' ...@@ -66,7 +66,7 @@ import { useDatePickerOptions } from '@/hooks'
const loading = ref(true) const loading = ref(true)
const brandList = ref([]) // 直播间列表 const brandList = ref([]) // 直播间列表
const typeList = ref(['销售额', '观看人次']) // 数据类型列表 const typeList = ref(['销售额', '观看人次']) // 数据类型列表
const { pickerOptions, nowMouth } = useDatePickerOptions() // 日期快捷方式 const { pickerOptions, last30Date } = useDatePickerOptions() // 日期快捷方式
const queryParams = reactive({ // 查询表单 const queryParams = reactive({ // 查询表单
brandList: [], brandList: [],
...@@ -225,7 +225,7 @@ const filterData = () => { ...@@ -225,7 +225,7 @@ const filterData = () => {
const init = async function () { const init = async function () {
// 初始化参数 // 初始化参数
queryParams.date = nowMouth queryParams.date = last30Date
queryParams.typeList = [typeList.value[0]] queryParams.typeList = [typeList.value[0]]
// 请求数据 // 请求数据
const data = await getList() const data = await getList()
......
...@@ -80,7 +80,7 @@ import { useDatePickerOptions } from '@/hooks' ...@@ -80,7 +80,7 @@ import { useDatePickerOptions } from '@/hooks'
const loading = ref(true) const loading = ref(true)
const prdList = ref([]) // 商品列表 const prdList = ref([]) // 商品列表
const typeList = ref(['支付买家数', '交易增速', '独立访客范围', '流量增速']) // 数据类型 const typeList = ref(['支付买家数', '交易增速', '独立访客范围', '流量增速']) // 数据类型
const { pickerOptions, nowMouth } = useDatePickerOptions() const { pickerOptions, last30Date } = useDatePickerOptions()
const showType = ref('charts') // 展示类型('charts' / 'table') const showType = ref('charts') // 展示类型('charts' / 'table')
const dateMerge = ref(false) // 表格中日期是否合并 const dateMerge = ref(false) // 表格中日期是否合并
...@@ -355,7 +355,7 @@ const dateMergeFn = () => { ...@@ -355,7 +355,7 @@ const dateMergeFn = () => {
// 默认打开页面请求一次所有数据,并保存在数据源 // 默认打开页面请求一次所有数据,并保存在数据源
async function init() { async function init() {
// 初始化参数 // 初始化参数
queryParams.date = nowMouth queryParams.date = last30Date
queryParams.typeList = [typeList.value[0]] queryParams.typeList = [typeList.value[0]]
await getPrdList() await getPrdList()
await getList() await getList()
......
...@@ -77,7 +77,7 @@ import { useDatePickerOptions } from '@/hooks' ...@@ -77,7 +77,7 @@ import { useDatePickerOptions } from '@/hooks'
const loading = ref(true) const loading = ref(true)
const brandList = ref([]) // 店铺列表 const brandList = ref([]) // 店铺列表
const typeList = ref(['支付买家数', '交易增速', '独立访客范围', '流量增速']) // 数据类型 const typeList = ref(['支付买家数', '交易增速', '独立访客范围', '流量增速']) // 数据类型
const { pickerOptions, nowMouth } = useDatePickerOptions() const { pickerOptions, last30Date } = useDatePickerOptions()
const showType = ref('charts') // 展示类型('charts' / 'table') const showType = ref('charts') // 展示类型('charts' / 'table')
const dateMerge = ref(false) // 表格中日期是否合并 const dateMerge = ref(false) // 表格中日期是否合并
...@@ -351,7 +351,7 @@ const dateMergeFn = () => { ...@@ -351,7 +351,7 @@ const dateMergeFn = () => {
// 默认打开页面请求一次所有数据,并保存在数据源 // 默认打开页面请求一次所有数据,并保存在数据源
async function init() { async function init() {
// 初始化参数 // 初始化参数
queryParams.date = nowMouth queryParams.date = last30Date
queryParams.typeList = [typeList.value[0]] queryParams.typeList = [typeList.value[0]]
await getStoreList() await getStoreList()
await getList() await getList()
......
<template>
<div class="app-container">
<div class="container">
<el-form :model="queryParams"
inline
label-width="auto">
<el-form-item label="选择日期"
prop="date">
<el-date-picker v-model="queryParams.date"
type="daterange"
:clearable="false"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:shortcuts="pickerOptions"
@change="queryChangeFn('date')" />
</el-form-item>
<el-form-item label="任务状态"
prop="taskStatus">
<el-radio-group v-model="queryParams.taskStatus">
<el-radio-button v-for="item in taskStatusList"
:key="item.value"
:label="item.label"
:value="item.value" />
</el-radio-group>
</el-form-item>
<el-form-item label="区域查询"
prop="region">
<el-radio-group v-model="queryParams.region">
<el-radio-button label="全国"
value="全国" />
<el-radio-button label="省"
value="省" />
<el-radio-button label="省-市"
value="省-市" />
</el-radio-group>
</el-form-item>
<el-form-item label="战区查询"
prop="zone">
<el-select v-model="queryParams.zoneId"
placeholder="请选择战区">
<el-option v-for="item in zoneList"
:key="item.value"
:label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="负责人"
prop="manager">
<el-select v-model="queryParams.managerId"
placeholder="请选择负责人">
<el-option v-for="item in managerList"
:key="item.value"
:label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="门店"
prop="store">
<el-input v-model="queryParams.storeName"
placeholder="请输入门店名称" />
</el-form-item>
</el-form>
</div>
</div>
</template>
<script setup>
import { reactive } from 'vue'
import { useDatePickerOptions } from '@/hooks'
import { getWarZoneListAPI, getChargeListAPI, getTaskListAPI } from '@/api'
const { pickerOptions, last7Date } = useDatePickerOptions(0)
const queryParams = reactive({
date: last7Date,
taskStatus: 'SUBMITTED',
region: '全国',
province: '',
city: '',
zoneId: undefined,
managerId: undefined,
storeName: undefined,
page: 1,
pageSize: 10
})
// 任务状态
const taskStatusList = ref([
{
label: '未审批',
value: 'SUBMITTED'
},
{
label: '已审批',
value: 'APPROVED'
},
{
label: '全部数据',
value: 'ALL'
}
])
// 战区列表
const zoneList = ref([])
const getZoneList = async () => {
const {data} = await getWarZoneListAPI()
zoneList.value = data.map(item => {
return {
label: item.orgName,
value: item.qcId
}
})
}
getZoneList()
// 负责人列表
const managerList = ref([])
const getManagerList = async () => {
const {data} = await getChargeListAPI()
managerList.value = data.map(item => {
return {
label: item.empName,
value: item.qcId
}
})
}
getManagerList()
// 任务列表
const tableList = ref([])
const getTaskList = async () => {
const {data} = await getTaskListAPI(queryParams)
tableList.value = data.map(item => {
return {
label: item.taskName,
value: item.taskId
}
})
}
getTaskList()
</script>
<style scoped
lang="scss"></style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论