Browse Source

销售员日历,销售员实现,日历小圆点

cxmo 1 year ago
parent
commit
d1c65e4468

+ 5 - 0
src/router/ssbg/index.js

@@ -15,6 +15,11 @@ export const ssbgRoutes = [
 				path: 'researcher',
 				name: 'researcherCalendar',
 				component: () => import("@/views/ssbg/roadshow/rsCalendar.vue")
+			},
+			{
+				path: 'seller',
+				name: 'sellerCalendar',
+				component: () => import("@/views/ssbg/roadshow/sellerCalendar.vue")
 			}
 		]
 	},

+ 68 - 4
src/views/ssbg/components/calendar.vue

@@ -18,6 +18,10 @@ const props = defineProps({
   eventList: {
     type: Array,
     required: true
+  },
+  selectUserValue:{
+      type:Number,
+      default:0
   }
 })
 
@@ -172,7 +176,7 @@ defineExpose({ toogeCurrentWeek,calendarApi });
 <template>
   <Sticky>
     <div class="header">
-      <swiperCalendar @dateChange="datechangeHandle" ref="swiperCalendarRef"/>
+      <swiperCalendar @dateChange="datechangeHandle" ref="swiperCalendarRef" :selectUserValue="selectUserValue"/>
     </div>
   </Sticky>
   <FullCalendar :options="calendarOptions" ref="FullCalendarRef">
@@ -184,8 +188,8 @@ defineExpose({ toogeCurrentWeek,calendarApi });
     </template>
   </FullCalendar>
 
-<!-- 弹窗层 -->
-  <Popup
+<!-- 弹窗层 旧版-->
+<!--   <Popup
     v-model:show="isShowPopup"
     closeable
   >
@@ -219,6 +223,51 @@ defineExpose({ toogeCurrentWeek,calendarApi });
         <p v-if="selectEventInfo.CooperationName">{{ selectEventInfo.CooperationName }}</p>
         <p v-if="['公开会议','内部会议','路演'].includes(selectEventInfo.ActivityType)">发起人:{{selectEventInfo.SysUserRealName}}</p>
     </div>
+  </Popup> -->
+  <!-- 新版 -->
+  <Popup
+    v-model:show="isShowPopup"
+    round closeable
+    style="width:90%;"
+  >
+    <div class="pop-dialog-wrap">
+        <div class="pop-header">
+            <p>{{selectEventInfo.ActivityType?`${selectEventInfo.RoadshowType}${selectEventInfo.ActivityType}`:'事项'}}</p>
+        </div>
+        <div class="popover-body">
+            <p>开始时间:{{`${selectEventInfo.StartDate} ${selectEventInfo.StartTime}(${selectEventInfo.StartWeek})`}}</p>
+            <p>结束时间:{{`${selectEventInfo.EndDate} ${selectEventInfo.EndTime}(${selectEventInfo.EndWeek})`}}</p>
+            <template v-if="selectEventInfo.ActivityType==='路演'">
+                <p v-if="selectEventInfo.RoadshowType==='线上'">
+                    路演平台:{{selectEventInfo.RoadshowPlatform}}
+                </p>
+                <p v-else>
+                    路演城市:{{selectEventInfo.Province}}{{selectEventInfo.City}}
+                </p>
+                <p>客户名称:{{selectEventInfo.CompanyName}}</p>
+            </template>
+            <template v-if="selectEventInfo.ActivityType==='公开会议'">
+                <p v-if="selectEventInfo.RoadshowType==='线上'">
+                    会议平台:{{selectEventInfo.RoadshowPlatform}}
+                </p>
+                <p v-else>
+                    会议城市:{{selectEventInfo.Province}}{{selectEventInfo.City}}
+                </p>
+                <p>会议主题:{{selectEventInfo.Theme}}</p>
+                <p>合作方名称:{{selectEventInfo.CooperationName}}</p>
+            </template>
+            <template v-if="selectEventInfo.ActivityType">
+                <p>研究员:{{selectEventInfo.ResearcherName}}</p>
+                <p>发起人:{{selectEventInfo.SysUserRealName}}</p>
+            </template>
+            <template v-else>
+                <p>事项内容:{{selectEventInfo.MatterContent}}</p>
+                <p v-if="selectEventInfo.modifyReason">
+                    最近变更记录:{{}}(<span>{{}}</span>)
+                </p>
+            </template>
+        </div>
+    </div>
   </Popup>
 </template>
 
@@ -226,7 +275,7 @@ defineExpose({ toogeCurrentWeek,calendarApi });
 
 .header {
   background: #fff;
-  padding-bottom: 20px;
+  /* padding-bottom: 20px; */
   box-shadow: 0px 3px 6px rgba(172, 172, 172, 0.16);
   .tab-cont {
 		padding: 30px;
@@ -276,4 +325,19 @@ defineExpose({ toogeCurrentWeek,calendarApi });
     color: #333;
   }
 }
+.pop-dialog-wrap{
+    padding:60px;
+    .pop-header{
+        text-align: center;
+        font-size: 32px;
+        font-weight: bold;
+        margin-bottom: 20px;
+    }
+    .popover-body{
+        p{
+            font-size: 30px;
+            margin-top: 10px;
+        }
+    }
+}
 </style>

+ 100 - 14
src/views/ssbg/components/swiperCalendar.vue

@@ -1,15 +1,22 @@
 <script setup>
 import { reactive, toRefs, ref, watch, onMounted } from 'vue';
 import { DatetimePicker , Popup } from 'vant';
+import { useRoute } from 'vue-router';
+import { myEvents,researchEvents} from '@/api/ssbg/api';
 import moment from 'moment';
 import 'moment/dist/locale/zh-cn';
 moment.locale('zh-cn');
 import _ from 'lodash';
 
+const route = useRoute();
 const emit = defineEmits(['dateChange']);
-
 const calendarRef = ref(null);
-
+const props = defineProps({
+  selectUserValue:{
+      type:Number,
+      default:0
+  }
+})
 const weekDays = ref([
   {
     label: '一',
@@ -78,9 +85,13 @@ const getRecentWeek = (day) => {
 
   state.weekDateList = weekeList;
   state.weekFirstDay = currenWeekStart;
+  
+  //获取日历日程
+  getEventList()
 };
 getRecentWeek(current.value.currentDate);
 
+
 /* 设置周日历选中的位置 */
 const setWeekIndex = (selectDate) => {
   const currentWeekDateList = state.weekDateList[1];
@@ -161,6 +172,48 @@ function onSelectCalendarConfirm(e){
   showCalendar.value=false
 }
 
+//获取日历日程
+async function getEventList (){
+  //日期:weekDateList[0][0],weekDateList[length-1][6]
+  const length = state.weekDateList.length
+  //如果是研究员/销售员日历,那等选择研究员/销售员后再获取
+  if(route.path==='/ssbg/roadshow/mine'){
+    if(localStorage.getItem('ssbg-role') === 'admin') return;
+    const { code,data } = await myEvents({
+        StartDate: moment(state.weekDateList[0][0]).format('YYYY-MM-DD'),
+        EndDate: moment(state.weekDateList[length-1][6]).format('YYYY-MM-DD')
+    })
+    if(code!==200) return 
+    getPlanDates(data)
+  }else if(route.path==='/ssbg/roadshow/researcher'){
+    if(!props.selectUserValue) return 
+    const { code,data } = await researchEvents({
+        StartDate: moment(state.weekDateList[0][0]).format('YYYY-MM-DD'),
+        EndDate: moment(state.weekDateList[length-1][6]).format('YYYY-MM-DD'),
+        ResearcherId: props.selectUserValue
+    })
+
+    if(code !== 200) return
+    getPlanDates(data)
+  }else if(route.path==='/ssbg/roadshow/seller'){
+    //销售员日历
+  }
+}
+
+let planDates = ref([])
+//获取有日程的日期
+function getPlanDates({CalendarList,RsMattersList}){
+    const calendarDay = CalendarList.map(item=>{
+        return [item.StartDate,item.EndDate]
+    })
+    const MatterDay = RsMattersList.map(item=>{
+        return [item.StartDate,item.EndDate]
+    })
+    planDates.value = [...calendarDay.flat(),...MatterDay.flat()]
+    planDates.value = Array.from(new Set(planDates.value))
+    console.log('arr',planDates.value)
+}
+
 /* 选中日期 更新日历 */
 watch(
   () => state.selectDate,
@@ -172,6 +225,10 @@ watch(
   }
 );
 
+watch(()=>props.selectUserValue,()=>{
+    getEventList()
+})
+
 defineExpose({
   getRecentWeek,
   selectDateHandle
@@ -216,14 +273,17 @@ const { weekDateList, selectDate, moveIndex, touch } = toRefs(state);
           :class="{
             act: selectDate === day,
             today: moment().format('YYYY-MM-DD') === day,
+            dot:planDates.includes(day)
           }"
           @touchstart.stop="selectDateHandle(day, day_index)"
         >
-          {{
-            moment().format('YYYY-MM-DD') === day
-              ? '今'
-              : moment(day).format('DD')
-          }}
+          <span class="text">
+                {{
+                    moment().format('YYYY-MM-DD') === day
+                    ? '今'
+                    : moment(day).format('DD')
+                }}
+          </span>
         </li>
       </ul>
     </div>
@@ -281,23 +341,49 @@ const { weekDateList, selectDate, moveIndex, touch } = toRefs(state);
       z-index: 11;
       li {
         color: #333;
-        height: 40px;
-        line-height: 40px;
+        height: 50px;
         width: calc(100% / 7);
         text-align: center;
         padding: 10px 0;
         margin: 0 24px;
+        position: relative;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        .text{
+            display: inline-block;
+            width:38px;
+            height: 38px;
+            border-radius: 50%;
+            margin-top: -20px;
+            text-align: center;
+            line-height: 40px;
+        }
         &.today {
-          background: #b4cef5;
-          border-radius: 50%;
+          .text{
+            background: #b4cef5;
+          }
           color: #fff;
         }
         &.act {
-          background: #39a9ed;
-          /* border-radius: 4px; */
-          border-radius: 50%;
+          .text{
+            background: #39a9ed;
+          }
           color: #fff;
         }
+        &.dot{
+            &::after{
+                content: '';
+                position: absolute;
+                bottom:20px;
+                left: 50%;
+                transform: translateX(-50%);
+                width:10px;
+                height:10px;
+                border-radius: 50%;
+                background-color: #D9D9D9;
+            }
+        }
       }
     }
   }

+ 4 - 0
src/views/ssbg/roadshow/common-calendar.js

@@ -42,6 +42,10 @@ export const getTabsByRole = (role) => {
 				label: '内部会议',
 				key:3
 			},
+			{
+				label: '事项',
+				key:5
+			},
 		] : ADMINLIST.includes(role)
 		? [
 			{

+ 2 - 1
src/views/ssbg/roadshow/myCalendar.vue

@@ -17,6 +17,7 @@ localStorage.setItem('ssbg-token',route.query.token ||  '5e532bc5fa7281aebaa6d89
 localStorage.setItem('ssbg-role',route.query.role ||  'researcher');
 
 const calendarRef = ref(null);//日历ref
+const showArr = ['ficc_seller', 'rai_seller', 'ficc_group', 'rai_group','seller',]
 const actionsList = ref([
   {
     label: '今天',
@@ -27,7 +28,7 @@ const actionsList = ref([
     label: '添加事项',
     key: 'add_matter',
 		icon: 'add-o',
-    show:  ['ficc_researcher', 'researcher', 'rai_researcher','ficc_admin', 'rai_admin'].includes(localStorage.getItem('ssbg-role'))
+    show:  [...['ficc_researcher', 'researcher', 'rai_researcher','ficc_admin', 'rai_admin'],...showArr].includes(localStorage.getItem('ssbg-role'))
   },
 ]);//底部固定数据
 const eventList = ref([]);//日程信息

+ 1 - 0
src/views/ssbg/roadshow/rsCalendar.vue

@@ -168,6 +168,7 @@ document.title = '研究员日历';
     <Calendar 
       ref="calendarRef"
       :eventList="eventList"
+      :selectUserValue="Number(state.selectResearcher)"
       @dateChange="getEventList" 
       @cellClick="cellClickHandle" 
     />

+ 235 - 0
src/views/ssbg/roadshow/sellerCalendar.vue

@@ -0,0 +1,235 @@
+<script setup>
+import { ref, reactive,toRefs,onMounted } from 'vue';
+import { useRoute } from 'vue-router';
+import { Icon, Toast,TreeSelect,Popup,Cascader } from 'vant';
+import moment from 'moment';
+import 'moment/dist/locale/zh-cn';
+moment.locale('zh-cn');
+
+import { researchEvents,apiSystemUsers} from '@/api/ssbg/api';
+import Calendar from '../components/calendar.vue';
+
+
+const route = useRoute();
+localStorage.setItem('ssbg-token',route.query.token ||  '5e532bc5fa7281aebaa6d89960b54c4ab22f1ab18e969258c634a7940fdb0922');
+
+const actionsList = ref([
+  {
+    label: '今天',
+    key: 'weeknow',
+    img: import("@/assets/ssbg/calendar_ico.png"),
+  },
+  {
+    label: '选择销售员',
+    key: 'choose',
+    img: import("@/assets/ssbg/choose_ico.png"),
+  },
+]);
+
+const calendarRef = ref(null);
+
+const state = reactive({
+  selectResearcher: '', // 选中的研究员
+  eventList: [],//日程信息
+});
+
+/* 获取日历日程列表 */
+const getEventList = async () => {
+  if(!selectUserValue.value) return
+
+  const { currentStart } = calendarRef.value.calendarApi.view;
+
+  const { code,data } = await researchEvents({
+    StartDate: moment(currentStart).format('YYYY-MM-DD'),
+    EndDate: moment(currentStart).format('YYYY-MM-DD'),
+    ResearcherId: Number(selectUserValue.value)
+  })
+
+  if(code !== 200) return
+
+  state.eventList = [
+    ...(data.CalendarList || []),
+    ...(data.RsMattersList || []),
+  ].map((item, index) => ( { ...item, id: index }));
+};
+
+/* 点击日历表格添加活动 */
+const cellClickHandle = (date) => {
+    //啥也不干
+};
+
+/* 底部操作 */
+const dealActionHandler = (type) => {
+  const deal_methods_handles = {
+    add: addActivityHandleByBtn,
+    weeknow: toogeCurrentWeek,
+    choose: selectSellerHandle,
+  };
+  deal_methods_handles[type]();
+};
+
+/* 点击按钮添加活动 */
+const addActivityHandleByBtn = () => {
+  wx.miniProgram.navigateTo({
+    url: '/pages-roadshow/addActivity/index',
+  });
+};
+
+/* 切换为今天 */
+const toogeCurrentWeek = () => {
+  calendarRef.value.toogeCurrentWeek();
+};
+
+// 选择用户
+const userFieldNames=ref({
+    text: 'RealName',
+    value: 'AdminId',
+    children: 'ChildrenList',
+})
+let selectUserValue=ref('')
+let isSellerPicker=ref(false)
+let userOpts=ref([])
+// 获取系统中所有用户’
+const getSystemUsers = ()=>{
+    apiSystemUsers().then(res=>{
+        if(res.code==200){
+            userOpts.value=res.data.List||[]
+        }
+    })
+}
+const selectSellerHandle = ()=>{
+    isSellerPicker.value = true
+}
+
+const onFinish = (e)=>{
+    getEventList()
+    isSellerPicker.value=false
+}
+onMounted(() => {
+    getSystemUsers()
+})
+
+const { eventList } = toRefs(state);
+
+document.title = '销售员日历';
+</script>
+
+<!--  -->
+<template>
+  <div class="rs-container">
+    <Calendar 
+      ref="calendarRef"
+      :eventList="eventList"
+      :selectUserValue="Number(selectUserValue)"
+      @dateChange="getEventList" 
+      @cellClick="cellClickHandle" 
+    />
+    <!-- v-if="isWxprogram()" -->
+    <div class="fix-action" >
+      <ul class="action-ul">
+        <li
+          v-for="item in actionsList"
+          key="item.key"
+          @click="dealActionHandler(item.key)"
+        >
+          <Icon :name="item.icon" class="item-icon" v-if="item.icon" />
+          <img
+            class="item-img"
+            src="@/assets/ssbg/calendar_ico.png"
+            alt=""
+            v-else-if="item.key === 'weeknow'"
+          />
+          <img
+            class="item-img"
+            src="@/assets/ssbg/choose_ico.png"
+            alt=""
+            v-else-if="item.key === 'choose'"
+          />
+          {{ item.label }}
+        </li>
+      </ul>
+    </div>
+    <!-- 选择销售员 -->
+    <Popup v-model:show="isSellerPicker" position="bottom">
+        <Cascader
+            v-model="selectUserValue"
+            title="请选择用户"
+            :options="userOpts"
+            :field-names="userFieldNames"
+            active-color="#3385FF"
+            @close="isSellerPicker = false"
+            @finish="onFinish"
+        />
+    </Popup>
+  </div>
+</template>
+
+<style scoped lang="scss">
+.rs-container {
+  .fix-action {
+    height: 160px;
+    position: fixed;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    z-index: 99;
+    background-color: #fff;
+    box-shadow: 0px -3px 6px rgba(172, 172, 172, 0.16);
+    padding-top: 20px;
+    padding-bottom: constant(safe-area-inset-bottom);
+    padding-bottom: env(safe-area-inset-bottom);
+    .action-ul {
+      height: 100%;
+      display: flex;
+      align-items: center;
+      justify-content: space-around;
+      color: #3385ff;
+      li:hover {
+        opacity: 0.8;
+      }
+      .item-icon {
+        font-size: 52px;
+        display: block;
+        text-align: center;
+        margin: 0 auto 10px;
+      }
+      .item-img {
+        display: block;
+        width: 46px;
+        height: 46px;
+        margin: 0 auto 10px;
+      }
+    }
+  }
+
+  .select-rs-header {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 30px 20px;
+
+    .cancel {
+      color: #969799;
+    }
+
+    .ensure {
+      color: #576b95;
+    }
+  }
+
+  .van-tree-select {
+		::v-deep(.van-sidebar-item--select:before) {
+			background-color: #1989fa;
+		}
+
+		::v-deep(.van-tree-select__item--active) {
+			color: #1989fa;
+		}
+
+    ::v-deep(.van-tree-select__selected) {
+      position: absolute !important;
+    }
+
+	}
+}
+</style>