Commit 5702b200 authored by zhengke's avatar zhengke

增加

parent 48b47479
......@@ -59,4 +59,53 @@ export function AuditCustomer(data) {
method: 'post',
data
})
}
\ No newline at end of file
}
/**
* 获取营销任务分页列表
*
*/
export function GetCustomerTaskPage(data) {
return request({
url: '/B2BCustomer/GetCustomerTaskPage',
method: 'post',
data
})
}
/**
* 删除营销任务
*
*/
export function RemoveCustomerTask(data) {
return request({
url: '/B2BCustomer/RemoveCustomerTask',
method: 'post',
data
})
}
/**
* 获取任务详情
*
*/
export function GetCustomerTask(data) {
return request({
url: '/B2BCustomer/GetCustomerTask',
method: 'post',
data
})
}
/**
* 保存任务详情
*
*/
export function SetCustomerTask(data) {
return request({
url: '/B2BCustomer/SetCustomerTask',
method: 'post',
data
})
}
<style>
.deleteCusBtn {
position: absolute;
right: 10px;
top: -10px;
}
</style>
<template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale">
<q-card style="width: 800px;max-width:900px;" class="CLM-Form">
<q-card-section>
<div class="text-h6">{{optionTitle}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.TaskName" ref="TaskName"
class="col-6 q-pb-lg q-pr-lg" label="任务名称" :rules="[val => !!val || '请输入任务名称']" />
</div>
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.TaskNum" ref="TaskNum"
class="col-6 q-pb-lg" label="完成任务数量" :rules="[val => !!val || '请输入任务数量']" />
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.TaskKudo" ref="TaskKudo"
class="col-6 q-pr-lg q-pb-lg" label="奖品名称" :rules="[val => !!val || '请输入奖品名称']" />
</div>
<div class="col-6">
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-input filled v-model="objOption.TaskStartTime" class="q-pr-lg" mask="date" :rules="['date']">
<template v-slot:append>
<q-icon name="event" class="cursor-pointer">
<q-popup-proxy ref="qDateProxy1" cover transition-show="scale" transition-hide="scale">
<q-date v-model="objOption.TaskStartTime">
<div class="row items-center justify-end">
<q-btn v-close-popup label="Close" color="primary" flat />
</div>
</q-date>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div>
<div class="col-6">
<q-input filled v-model="objOption.TaskEndTime" mask="date" :rules="['date']">
<template v-slot:append>
<q-icon name="event" class="cursor-pointer">
<q-popup-proxy ref="qDateProxy2" cover transition-show="scale" transition-hide="scale">
<q-date v-model="objOption.TaskEndTime">
<div class="row items-center justify-end">
<q-btn v-close-popup label="Close" color="primary" flat />
</div>
</q-date>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div>
</div>
<div class="row wrap q-pb-lg">
<q-btn size="10px" @click="addCourse()" round color="primary" icon="iconfont icon-img_haha" />
</div>
<div class="row wrap" v-for="(item,index) in objOption.DetailsList" :key="index">
<div class="col-6" style="position:relative;">
<q-select filled stack-label option-value="CourseId" option-label="CourseName" v-model="item.TargetId"
ref="CouseId" :options="CourseList" label="关联课程" :dense="false" class="col-6 q-pr-lg q-pb-lg" emit-value
map-options />
<q-btn size="8px" class="deleteCusBtn" @click="deleTarget(index)" round color="red"
icon="iconfont icon-guanbi1" />
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeTaskForm" />
<q-btn label="保存" color="accent q-px-md" style="font-weight:400 !important" :loading="saveCustomLoading"
@click="saveCustom">
</q-btn>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
SetCustomerTask,
GetCustomerTask
} from "../../api/sale/peemanagement";
import {
queryCourseDropdownList,
} from '../../api/course/index'
export default {
components: {},
props: {
taskOption: {
type: Object,
default: null
}
},
data() {
return {
persistent: true,
saveCustomLoading: false,
objOption: {
Id: 0,
TaskName: '', //任务名称
TaskNum: 0, //完成任务数量
TaskKudo: '', //奖品名称
TaskStartTime: "", //任务开始时间
TaskEndTime: "", //任务结束时间
DetailsList: []
},
optionTitle: '',
CourseList: []
}
},
created() {},
mounted() {
this.getCourseList();
this.initObj()
},
methods: {
//初始化表单
initObj() {
if (this.taskOption && this.taskOption.Id > 0) {
let msg = {
Id: this.taskOption.Id
}
GetCustomerTask(msg).then(res => {
if (res.Code == 1) {
let tempData = res.Data;
this.objOption.Id = tempData.Id;
this.objOption.TaskName = tempData.TaskName;
this.objOption.TaskNum = tempData.TaskNum;
this.objOption.TaskKudo = tempData.TaskKudo;
this.objOption.TaskStartTime = tempData.TaskStartTimeStr;
this.objOption.TaskEndTime = tempData.TaskEndTimeStr;
this.objOption.DetailsList = tempData.DetailsList;
}
})
this.optionTitle = "修改客户任务"
} else {
this.objOption.Id = 0;
this.objOption.TaskName = '';
this.objOption.TaskNum = 0;
this.objOption.TaskKudo = '';
this.objOption.TaskStartTime = '';
this.objOption.TaskEndTime = '';
this.objOption.DetailsList = [];
this.optionTitle = "新增客户任务"
}
},
//保存
saveCustom() {
this.$refs.TaskName.validate();
this.$refs.TaskNum.validate();
this.$refs.TaskKudo.validate();
if (!this.$refs.TaskName.hasError && !this.$refs.TaskNum.hasError && !this.$refs.TaskKudo.hasError) {
var oDate1 = new Date(this.objOption.TaskStartTime);
var oDate2 = new Date(this.objOption.TaskEndTime);
if (oDate1.getTime() > oDate2.getTime()) {
this.$q.notify({
type: 'negative',
position: "top",
message: `开始日期不能大于结束日期`
})
return
}
this.saveCustomLoading = true;
SetCustomerTask(this.objOption).then(res => {
if (res.Code == 1) {
this.saveCustomLoading = false;
this.$q.notify({
icon: "iconfont icon-chenggong",
color: "accent",
timeout: 2000,
message: "数据保存成功!",
position: "top",
});
this.$emit("success");
this.closeTaskForm()
}
})
}
},
//关闭弹窗
closeTaskForm() {
this.$emit('close');
this.persistent = false;
},
//新增课程
addCourse() {
let obj = {
DetailId: 0,
TaskId: 0,
TaskType: 1, //默认传1
TargetId: 1 //课程编号
}
this.objOption.DetailsList.push(obj);
},
//获取课程
getCourseList() {
queryCourseDropdownList({
IsQPrice: 1
}).then(res => {
if (res.Code == 1) {
this.CourseList = res.Data;
}
})
},
//删除
deleTarget(index) {
this.objOption.DetailsList.splice(index, 1);
}
},
}
</script>
<template>
<div class="page-body">
<div class="page-search row items-center">
<div class="col row wrap q-col-gutter-md">
<div class="col-3">
<q-input @input="resetSearch" clearable filled v-model="msg.TaskName" label="任务" />
</div>
</div>
</div>
<div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat
class="sticky-right-column-table sticky-column-table" separator="none" :data="dataList" :columns="columns"
row-key="name">
<template v-slot:top="props">
<div class="col-2 q-table__title">营销任务</div>
<q-space />
<div class="page-option">
<q-btn color="accent" size="sm" icon="add" label="新增任务" @click="EditTask(null)" />
</div>
</template>
<template v-slot:body-cell-TaskStartTimeStr="props">
<q-td>
<div>
{{props.row.TaskStartTimeStr}} - {{props.row.TaskEndTimeStr}}
</div>
</q-td>
</template>
<template v-slot:body-cell-optioned="props">
<q-td>
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
@click="EditTask(props.row)" />
<q-btn flat size="xs" icon="delete" color="negative" style="font-weight:400"
label="删除" @click="RemoveTask(props.row.Id)" />
</q-td>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template>
</q-table>
</div>
<saleForm v-if="isShowTask" :taskOption="taskOption" @close="closeSaleForm" @success="RefreshPage"></saleForm>
</div>
</template>
<script>
import {
GetCustomerTaskPage,
RemoveCustomerTask
} from '../../api/sale/peemanagement';
import saleForm from '../../components/sale/sale-form';
export default {
meta: {
title: "营销任务"
},
components: {
saleForm
},
data() {
return {
columns: [{
name: 'TaskName',
label: '任务名称',
align: 'left',
field: 'TaskName'
},
{
name: 'TaskKudo',
label: '奖品名称',
field: 'TaskKudo',
align: 'left'
},
{
name: 'TaskNum',
label: '完成任务数量',
field: 'TaskNum',
align: 'left',
},
{
name: 'TaskStartTimeStr',
label: '任务时间',
field: 'TaskStartTimeStr',
align: 'left',
},
{
name: 'CreateByName',
label: '创建人',
field: 'CreateByName',
align: 'left',
},
{
name: 'optioned',
label: '操作',
field: 'Id'
}
],
dataList: [],
loading: true,
msg: {
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
TaskName: "" //任务
},
pageCount: 0,
taskOption: null,
isShowTask: false,
}
},
created() {},
mounted() {
this.getList()
},
methods: {
resetSearch() {
this.loading = true;
this.msg.pageIndex = 1;
this.getList();
},
//删除
RemoveTask(id) {
let that = this
this.$q.dialog({
title: "删除营销任务",
message: "你正在进行删除任务行为,一旦执行无法找回,是否确认执行?",
persistent: true,
cancel: {
label: "取消",
flat: true
},
ok: {
label: "确认",
flat: true,
focus: true
}
}).onOk(() => {
RemoveCustomerTask({
Id: id
}).then(res => {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据删除成功!',
position: 'top'
})
this.getList()
})
});
},
changePage(val) {
this.msg.pageIndex = val;
this.loading = true;
this.getList();
},
RefreshPage() {
this.getList()
},
//新增修改
EditTask(obj) {
if (obj) {
this.taskOption = obj;
} else {
this.taskOption = null
}
this.isShowTask = true
},
closeSaleForm() {
this.isShowTask = false
},
//获取数据
getList() {
this.loading = true;
GetCustomerTaskPage(this.msg).then(res => {
this.loading = false;
if (res.Code == 1) {
this.dataList = res.Data.PageData;
this.pageCount = res.Data.PageCount;
}
}).catch(() => {
this.loading = false
})
}
},
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
......@@ -863,6 +863,11 @@ const routes = [{
component: () =>
import("pages/sale/peerApproval.vue")
},
{
path: "/sale/saleTask", //销售 营销任务
component: () =>
import("pages/sale/saleTask.vue")
},
{
path: "/sale/activityList", //销售 活动列表
component: () =>
......
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