Commit f64669d8 by sunchao

关联商机

parent 5b8afa93
......@@ -234,32 +234,36 @@ export class LifeCommonService {
//获取本周日期
makeDate() {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth();
var week = date.getDay();
// if(week ==0){
// week = 7;
// }
var month = month + 1;
//获取今天是几号
var day = date.getDate();
// 本周内今天的前几天的数量
var leftNum = week - 1;
var leftNum = week;
// 本周内今天的后几天的数量
var rightNum = 7 - week;
var rightNum = 6 - week;
// 本周内今天的前几天
for (var i = 0; i < leftNum; i++) {
this.weekArr[i].week = week - (week - i) + 1;
if (i == 0) {
this.weekArr[i].day = day - week;
} else {
this.weekArr[i].day = day - (week - i) + 1;
}
for (var i = 1; i <= leftNum; i++) {
this.weekArr[i].week = week- i
this.weekArr[i].day = day - i;
this.weekArr[i]['date'] = year + '-' + (month>9?month:'0'+month) + '-' + (day - i);
}
// 本周内今天的后几天
for (var i = 0; i < rightNum; i++) {
this.weekArr[i + week].week = week + i + 1;
this.weekArr[i + week].day = day + i + 1;
for (var i = 1; i <= rightNum; i++) {
this.weekArr[i + week].week = week + i ;
this.weekArr[i + week].day = day + i ;
this.weekArr[i + week]['date'] = year + '-' + (month>9?month:'0'+month) + '-' + (day + i);
}
// 今天
this.weekArr[week - 1].week = week;
this.weekArr[week - 1].day = day;
this.weekArr[week - 1].selected = true;
this.weekArr[week].week = week;
this.weekArr[week].day = day;
this.weekArr[week]['date'] = year + '-' + (month>9?month:'0'+month) + '-' + day;
this.weekArr[week].selected = true;
return this.weekArr;
}
......@@ -283,7 +287,7 @@ export class LifeCommonService {
if(str==6){
return '周六';
}
if(str ==7){
if(str ==0){
return '周日';
}
}
......
<div class="todo_wrapper">
<!-- <div Button (onClick)="showAlert()">customized buttons</div> -->
<div class="top">
<div class="head">
<h3 (click)="goBack()">&lt;</h3>
<h3>新建日程</h3>
<div class="am-demo-page">
<div id="add_calendar_wrapper">
<List className="calendar-list" style="backgroundColor: 'white'">
<ListItem [arrow]="'horizontal'" (onClick)="onClick_0()">
<ListItem (onClick)="clickCalendar()">
{{this.state.en ? '日历' : '日历'}}
</ListItem>
<ListItem *ngIf="this.state.startDate">
Time1: {{this.state.startDate.toLocaleString()}}
</ListItem>
<ListItem *ngIf="this.state.endDate">
Time2: {{this.state.endDate.toLocaleString()}}
</ListItem>
</List>
<ng-template #_switch>
<Switch className="right" [checked]="!this.state.en" (onChange)="this.changeLanguage()"></Switch>
</ng-template>
<Calendar [(ngModel)]="this.state.date"
[locale]="this.state.en ? 'enUS' : 'zhCN'"
[enterDirection]="this.state.enterDirection"
[visible]="this.state.show"
[getDateExtra]="this.state.getDateExtra"
[defaultDate]="this.state.now"
[minDate]="this.state.minDate"
[maxDate]="this.state.maxDate"
[pickTime]="this.state.pickTime"
[type]="this.state.type"
[rowSize]="this.state.rowSize"
......@@ -35,7 +23,6 @@
[onSelect]="this.state.onSelect"
(onCancel)="triggerCancel()"
(onConfirm)="triggerConfirm($event)"
(onSelectHasDisableDate)="triggerSelectHasDisableDate($event)"
></Calendar>
</div>
</div>
......@@ -82,7 +69,7 @@
</div>
<div class="footer">添加任务</div>
</div>
<div class="link_totast_wrapper" *ngIf="linkToastFlag">
<!-- <div class="link_totast_wrapper" *ngIf="linkToastFlag">
<div class="link_mask"></div>
<div class="link_totast_content_wrapper">
<div class="link_content">
......@@ -99,4 +86,4 @@
</div>
</div>
</div>
</div>
</div> -->
......@@ -12,6 +12,7 @@ ul,ol{
align-items: center;
padding: 0 8px;
margin-bottom: 8px;
}
.nav{
display: flex;
......
......@@ -2,25 +2,7 @@ import { Component, OnInit } from '@angular/core';
import {MyService} from '../my.service';
import { ModalService, ToastService } from 'ng-zorro-antd-mobile';
import { Router } from "@angular/router";
const extra = {
'2017/07/15': { info: 'Disable', disable: true }
};
const now = new Date();
extra[+new Date(now.getFullYear(), now.getMonth(), now.getDate() + 5)] = { info: 'Disable', disable: true };
extra[+new Date(now.getFullYear(), now.getMonth(), now.getDate() + 6)] = { info: 'Disable', disable: true };
extra[+new Date(now.getFullYear(), now.getMonth(), now.getDate() + 7)] = { info: 'Disable', disable: true };
extra[+new Date(now.getFullYear(), now.getMonth(), now.getDate() + 8)] = { info: 'Disable', disable: true };
for (let key in extra) {
if (extra.hasOwnProperty(key)) {
let info = extra[key];
const date = new Date(key);
if (!Number.isNaN(+date) && !extra[+date]) {
extra[+date] = info;
}
}
}
import {LifeCommonService} from '../../common/life-common.service';
@Component({
selector: 'ydlife-add-task',
......@@ -34,18 +16,15 @@ export class AddTaskComponent implements OnInit {
show: false,
pickTime: false,
now: new Date(),
type: 'range',
type: 'one',
enterDirection: '',
rowSize: 'normal',
showShortcut: false,
infinite: true,
defaultValue: undefined,
minDate: new Date(+now - 5184000000),
maxDate: new Date(+now + 31536000000),
minDate: new Date(+new Date() - 5184000000),
maxDate: new Date(+new Date() + 31536000000),
onSelect: undefined,
getDateExtra: date => {
return extra[+date];
}
}
tabList:Array<any>;
tabType:string;
......@@ -60,7 +39,9 @@ export class AddTaskComponent implements OnInit {
notice:string;
linkToastFlag:boolean = false;
totastTitle:string;
constructor(private myService:MyService,private router: Router) {
trackTime:any;
constructor(private myService:MyService,private router: Router,private _modal: ModalService, private _toast: ToastService,
public lifeCommonService:LifeCommonService) {
this.seasons = [
{label: '8:00',id:1},
{label: '8:30',id:2},
......@@ -101,7 +82,7 @@ export class AddTaskComponent implements OnInit {
{name:'周六',isLongTermTask:false},
{name:'周日',isLongTermTask:false}
];
// console.log(this.router.getCurrentNavigation().extras.state)
}
initPara() {
......@@ -112,18 +93,13 @@ export class AddTaskComponent implements OnInit {
date: null,
pickTime: false,
now: new Date(),
type: 'range',
type: 'one',
rowSize: 'normal',
infinite: true,
enterDirection: '',
onSelect: undefined,
showShortcut: false,
defaultValue: undefined,
minDate: new Date(+now - 5184000000),
maxDate: new Date(+now + 31536000000),
getDateExtra: date => {
return extra[+date];
}
}
};
}
......@@ -131,17 +107,44 @@ export class AddTaskComponent implements OnInit {
ngOnInit() {
this.tabList = [{code:'bizchance_promotion_action',name:'营销',taskType:1},{code:'team_building_track',name:'增员',taskType:2},{code:'pep_schedule_task_others',name:'其他',taskType:3}];
this.tabType = 'bizchance_promotion_action';
this.dropOptionsQuery(this.tabType)
this.dropOptionsQuery(this.tabType);
//如果有缓存切换到缓存数据
if(JSON.parse(sessionStorage.getItem('pageDwellDtatus'))){
this.tabType = JSON.parse(sessionStorage.getItem('pageDwellDtatus'))['tabType'];
this.dropOptionsQuery(this.tabType);
this.mdDropOptionId = JSON.parse(sessionStorage.getItem('pageDwellDtatus'))['mdDropOptionId'];
}else{
this.tabType = 'bizchance_promotion_action';
this.mdDropOptionId = null;
}
}
goBack(){
history.go(-1);
}
//判断是否选择同一个tab
selectTab(code,taskType){
this.tabType = code;
this.taskType = taskType;
this.dropOptionsQuery(this.tabType);
let pageDwellDtatus = {};
if(this.tabType == code){
pageDwellDtatus = {
tabType:this.tabType,
mdDropOptionId:this.mdDropOptionId,
taskType:this.taskType
}
sessionStorage.setItem('pageDwellDtatus',JSON.stringify(pageDwellDtatus));
}else{
this.tabType = code;
this.taskType = taskType;
this.mdDropOptionId = null;
this.dropOptionsQuery(this.tabType);
pageDwellDtatus = {
tabType:this.tabType,
mdDropOptionId:null,
taskType:this.taskType
}
sessionStorage.setItem('pageDwellDtatus',JSON.stringify(pageDwellDtatus));
}
}
dropOptionsQuery(code){
......@@ -151,6 +154,7 @@ export class AddTaskComponent implements OnInit {
}
})
}
onChange(result,type) {
if(type===1){
this.taskTimeFrom = result;
......@@ -164,14 +168,37 @@ export class AddTaskComponent implements OnInit {
selectTask(id){
this.mdDropOptionId=id;
const pageDwellDtatus = {
tabType:this.tabType,
mdDropOptionId:this.mdDropOptionId,
taskType:this.taskType
}
sessionStorage.setItem('pageDwellDtatus',JSON.stringify(pageDwellDtatus));
if(this.tabType == 'bizchance_promotion_action' ){
this.linkToastFlag = true;
// this.linkToastFlag = true;
this.totastTitle = '商机';
}
if(this.tabType == 'team_building_track'){
this.linkToastFlag = true;
// this.linkToastFlag = true;
this.totastTitle = '增员';
}
ModalService.alert(`是否联系到${this.totastTitle}`, '', [
{ text: '否', onPress: () => this.linkToastFlag=false,
style: {
borderTop:'1px #ddd solid'
}
},
{ text: '是', onPress: () => this.jumpToLink(),
style: {
color: '#f8002e',
background: '',
borderLeft:'1px #ddd solid',
borderTop:'1px #ddd solid'
}
},
]);
}
getValue(result) {
let value = [];
......@@ -183,10 +210,9 @@ export class AddTaskComponent implements OnInit {
return value;
}
onClick_0() {
clickCalendar(){
this.initPara();
this.state.show = true;
this.state.type = 'one';
this.state.date = new Date();
}
......@@ -194,9 +220,25 @@ export class AddTaskComponent implements OnInit {
this.state.show = false;
}
triggerConfirm(value) {
const { startDate, endDate } = value;
this.state = {
...this.state,
...{ show: false, startDate, endDate }
};
this.triggerCancel();
this.trackTime = this.lifeCommonService.dateFormat(startDate,"yyyy-MM-dd")
console.log(this.trackTime);
}
jumpToLink(){
if(this.tabType == 'bizchance_promotion_action'){
this.router.navigate(['/linkbusiness'])
}
if(this.tabType == 'team_building_track'){
this.router.navigate(['/linkrecruiting'])
}
}
}
......@@ -17,17 +17,18 @@
<div></div>
</div> -->
<div class="salesItem" *ngFor="let businessItem of showBusinessList"
(click)="isJumpToDetail(businessItem.opportunityId,businessItem.orderId,businessItem.leadsAssignedId)">
(click)="isJumpToDetail(businessItem.opportunityId,businessItem.orderId,businessItem.leadsAssignedId,businessItem)">
<div *ngIf="pageType=='business'" class="icon_bolck" [ngStyle]="{'background':businessItem.expertType=='1'? '#ddd' : 'none'}">
<span class="iconfont icon-xiansuo1" *ngIf="businessItem.expertType=='0'"></span>
<span class="iconfont icon-zhuanjia" style="color: #093d9b;" *ngIf="businessItem.expertType=='1'"></span>
</div>
<div *ngIf="pageType=='linkbusiness'" class="linkbusinessRadius">
<span class='circlebtn'></span>
<span class='circlebtn' *ngIf="selectedBusiness?.leadsAssignedId != businessItem.leadsAssignedId"></span>
<img src="assets/images/gou_icon.png" style="position: absolute;width: 100%;" *ngIf="selectedBusiness?.leadsAssignedId == businessItem.leadsAssignedId">
</div>
<div class="line">
<div>姓名:{{businessItem.name}}</div>
<span class="iconfont icon-ar-r" style="font-size: 10px;position: relative; right: -2px;"></span>
<span class="iconfont icon-ar-r" style="font-size: 10px;position: relative; right: -2px;" *ngIf="pageType=='business'"></span>
</div>
<div class="line">
<div> 手机号:{{businessItem.mobileNo}}</div>
......@@ -39,10 +40,11 @@
</div>
</div>
</div>
<div class="footer">
<div class="footer" *ngIf="pageType=='linkbusiness'" (click)="returnAddTask()">
确认
</div>
<div class="add" *ngIf="pageType=='business'">
<i class="iconfont icon-jiahao" (click)="addBussiness()"></i>
</div>
</div>
\ No newline at end of file
</div>
<ydlife-toast *ngIf="toastDialog" [toastInfo]="toastInfo"></ydlife-toast>
\ No newline at end of file
......@@ -2,15 +2,12 @@ import { Component, OnInit } from '@angular/core';
import { MyService } from '../my.service';
import { LifeCommonService } from '../../common/life-common.service';
import { Router , ActivatedRoute} from "@angular/router";
import {Location} from '@angular/common';
@Component({
selector: 'ydlife-my-business',
templateUrl: './my-business.component.html',
styleUrls: ['./my-business.component.scss'],
styles: [
`.am-demo-bd div{
border-bottom: none;
}
`]
})
export class MyBusinessComponent implements OnInit {
businessList: Array<any>;
......@@ -18,7 +15,11 @@ export class MyBusinessComponent implements OnInit {
pageType:any;
showBusinessList: Array<any>;
isSelectFlag:boolean;
constructor(private myService: MyService, public lifeCommonService: LifeCommonService, private router: Router,private activatedRoute: ActivatedRoute) {
selectedBusiness:any;
//控制弹框
toastDialog: boolean;
toastInfo: any;
constructor(private myService: MyService, public lifeCommonService: LifeCommonService, private router: Router,private activatedRoute: ActivatedRoute,private location:Location) {
this.pageType = this.activatedRoute.snapshot.data[0]['type'];
}
......@@ -43,11 +44,16 @@ export class MyBusinessComponent implements OnInit {
this.router.navigate(['/business/0']);
}
isJumpToDetail(opportunityId,orderId,leadsAssignedId){
isJumpToDetail(opportunityId,orderId,leadsAssignedId,businessItem?:any){
if(this.pageType == 'business'){
this.router.navigate([`/business/${opportunityId}`], { queryParams: { orderId: orderId, leadsAssignedId: leadsAssignedId } });
}else{
return;
if(!this.selectedBusiness){
this.selectedBusiness = businessItem;
}else{
this.selectedBusiness = undefined;
}
return;
}
}
......@@ -56,4 +62,20 @@ export class MyBusinessComponent implements OnInit {
return item.name.indexOf(event) !=-1;
})
}
returnAddTask(){
if(this.selectedBusiness){
const {leadsAssignedId,opportunityId}=this.selectedBusiness;
this.router.navigate(['/addtask/'], { queryParams: { customerId:opportunityId , referLeadsId: leadsAssignedId },state:this.selectedBusiness});
}else{
this.toastDialog = true;
this.toastInfo = {
status: 1,
msg:'请选择您需要关联的商机!',
timeout: 3000,
align: 'center'
};
return;
}
}
}
......@@ -42,7 +42,8 @@ const myRoutes: Routes = [
{ path: 'business/:id', component: MyBusinessDetailComponent, canActivate: [AuthGuard] },
{ path: 'rank', component: SalesRankComponent, canActivate: [AuthGuard] },
{ path: 'teamRank', component: TeamRankComponent, canActivate: [AuthGuard] },
{ path: 'recruiting', component: RecruitingComponent, canActivate: [AuthGuard] },
{ path: 'recruiting', component: RecruitingComponent, canActivate: [AuthGuard] ,data:[{type:'recruiting'}]},
{ path: 'linkrecruiting', component: RecruitingComponent, canActivate: [AuthGuard] ,data:[{type:'linkrecruiting'}]},
{ path: 'recruiting/:id', component: RecruitingDetailComponent, canActivate: [AuthGuard] },
{ path: 'thanks', component: ThanksComponent, canActivate: [AuthGuard] },
{ path: 'setting', component: MySettingComponent, canActivate: [AuthGuard] },
......
......@@ -3,7 +3,27 @@
<div class="head">
<h3 (click)="goBack()">&lt;</h3>
<h3>今日任务</h3>
<div>日历</div>
<div id="add_calendar_wrapper">
<List className="calendar-list" style="backgroundColor: 'white'">
<ListItem (onClick)="clickCalendar()">
{{this.state.en ? '日历' : '日历'}}
</ListItem>
</List>
<Calendar [(ngModel)]="this.state.date"
[visible]="this.state.show"
[getDateExtra]="this.state.getDateExtra"
[defaultDate]="this.state.now"
[pickTime]="this.state.pickTime"
[type]="this.state.type"
[rowSize]="this.state.rowSize"
[showShortcut]="this.state.showShortcut"
[infinite]="this.state.infinite"
[defaultValue]="this.state.defaultValue"
[onSelect]="this.state.onSelect"
(onCancel)="triggerCancel()"
(onConfirm)="triggerConfirm($event)"
></Calendar>
</div>
</div>
<ul class="week">
<li *ngFor="let weekItem of weekArr;index as i;" [ngClass]="{'selected':weekItem.selected}" (click)="selectDay(weekItem)">
......@@ -27,17 +47,22 @@
<div class="title">任务数量({{taskList.length}})</div>
<ul>
<li *ngFor="let taskItem of taskList">
<span>{{taskItem.taskTimeFrom}} - {{taskItem.taskTimeEnd}}</span>
<div class="todo_title">
<span *ngIf="taskItem.taskImportantTag">(重要)</span>
{{taskItem.mdDropOptionName}}
<div class="content_wrapper">
<div class="content_card">
<span>{{taskItem.taskTimeFrom}} - {{taskItem.taskTimeEnd}}</span>
<div class="todo_title">
<span *ngIf="taskItem.taskImportantTag">(重要)</span>
{{taskItem.mdDropOptionName}}
</div>
<div class="notice">{{taskItem.notice}}</div>
</div>
<div class="red" ></div>
</div>
<div class="notice">{{taskItem.notice}}</div>
</li>
</ul>
</div>
</div>
<div class="addBtn" (click)="addTask()" [ngStyle]="{'background':taskList?.length? '#ff002b' : '#eb6100','bottom':taskList?.length?'4%':'-15%'}" [routerLink]="['/addtask']">
<div class="addBtn" [ngStyle]="{'background':taskList?.length? '#ff002b' : '#eb6100','bottom':taskList?.length?'4%':'-15%'}" [routerLink]="['/addtask']">
<i class="iconfont icon-jiahao" ></i>
</div>
</div>
......
......@@ -3,7 +3,8 @@ ul,ol{
}
.todo_wrapper{
.top{
margin-bottom: 20px;
padding-bottom: 20px;
background: #fff;
.head{
display: flex;
height: 50px;
......@@ -93,18 +94,35 @@ ul,ol{
ul {
margin-top: 15px;
li{
background: #fff;
padding: 8px 12px;
border-radius: 10px;
margin-bottom: 10px;
.todo_title{
font-size: 16px;
color: #000;
font-weight: bold;
margin: 3px auto;
}
.notice{
color: #a0a0a0;
.content_wrapper{
position: relative;
.content_card{
background: #fff;
padding: 8px 12px;
border-radius: 10px;
position: relative;
z-index: 10;
.todo_title{
font-size: 16px;
color: #000;
font-weight: bold;
margin: 3px auto;
}
.notice{
color: #a0a0a0;
}
}
.red{
width: 90%;
height: 79%;
background-color: red;
position: absolute;
top: 12%;
margin-left: -1.5%;
z-index: 9;
border-radius: 8px;
}
}
}
......
......@@ -11,6 +11,23 @@ export class TodoListComponent implements OnInit {
weekArr: Array<any>;
taskList:Array<any> = [];
taskTimeList:Array<any> = [];
trackDate:string;
state: any = {
en: false,
date: null,
show: false,
pickTime: false,
now: new Date(),
type: 'one',
enterDirection: '',
rowSize: 'normal',
showShortcut: false,
infinite: true,
defaultValue: undefined,
minDate: new Date(+new Date() - 5184000000),
maxDate: new Date(+new Date() + 31536000000),
onSelect: undefined,
}
constructor(public lifeCommonService: LifeCommonService,private myService:MyService) {
this.taskTimeList = [
{id:1,time:'8:00'},
......@@ -30,6 +47,11 @@ export class TodoListComponent implements OnInit {
ngOnInit() {
this.weekArr = this.lifeCommonService.makeDate();
for(let i=0;i<this.weekArr.length;i++){
if(this.weekArr[i]['selected'] == true){
this.trackDate = this.weekArr[i]['date'];
}
}
this.queryScheduleTrackList();
}
......@@ -42,17 +64,62 @@ export class TodoListComponent implements OnInit {
this.weekArr[i].selected = false;
if(weekItem.day == this.weekArr[i]['day']){
this.weekArr[i].selected = true;
this.trackDate = this.weekArr[i]['date'];
}
}
this.queryScheduleTrackList();
}
initPara() {
this.state = {
...this.state,
...{
show: false,
date: null,
pickTime: false,
now: new Date(),
type: 'one',
rowSize: 'normal',
infinite: true,
enterDirection: '',
onSelect: undefined,
showShortcut: false,
defaultValue: undefined,
}
};
}
clickCalendar(){
this.initPara();
this.state.show = true;
this.state.date = new Date();
}
triggerCancel() {
this.state.show = false;
}
addTask(){
// this.taskList.push({time:'8:00-9:00',isImportant:true,taskTitle:'今天要完成的计划1',taskContent:'app界面和网页界面的设计'});
triggerConfirm(value) {
const { startDate, endDate } = value;
this.state = {
...this.state,
...{ show: false, startDate, endDate }
};
this.triggerCancel();
this.trackDate = this.lifeCommonService.dateFormat(startDate,"yyyy-MM-dd")
this.queryScheduleTrackList();
for(let i=0;i<this.weekArr.length;i++){
this.weekArr[i].selected = false;
if(this.trackDate == this.weekArr[i]['date']){
this.weekArr[i]['selected'] = true;
break;
}
}
}
queryScheduleTrackList(){
this.myService.queryScheduleTrackList({practitionerId:'1',trackDate:'2020-09-11'}).subscribe((res)=>{
console.log(res)
this.myService.queryScheduleTrackList({practitionerId:'1',trackDate:this.trackDate}).subscribe((res)=>{
if(res['success']){
this.taskList = res['data'];
}
......
......@@ -127,6 +127,15 @@ input::placeholder {
}
}
#add_calendar_wrapper{
.am-list-body::before{
background-color: transparent;
}
.am-list-body::after{
background-color: transparent;
}
}
@keyframes slowUp {
0% {
-webkit-transform: translateY(100%);
......
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