Parcourir la source

选择商家组件修改key

yujinwen il y a 4 jours
Parent
commit
57175718ef

+ 11 - 1
src/api/customer/user.js

@@ -32,6 +32,16 @@ export default{
   // 导入用户
   importUser:params=>{
     return post('/eta_business/user/import',params)
-  }
+  },
+
+  // 用户行为统计
+  getUserActionStatistic:params=>{
+    return get('/chart_collect/stat/user',params)
+  },
+
+  // 用户行为统计图表数据
+  getUserActionStatisticChartData:()=>{
+    return get('/chart_collect/stat/chart',{})
+  },
 
 }

+ 3 - 2
src/components/SelectBusiness.vue

@@ -57,14 +57,15 @@ function handleChange(value,context){
     :placeholder="props.placeholder"
     :clearable="props.clearable"
     :loading="loading"
+    :minCollapsedNum="1"
     :disabled="props.disabled"
     @search="remoteMethod"
     @change="handleChange"
   >
     <t-option 
       v-for="item in options" 
-      :key="item.BusinessCode" 
-      :value="item.BusinessCode" 
+      :key="item.EtaBusinessId" 
+      :value="item.EtaBusinessId" 
       :label="item.BusinessName"
     />
   </t-select>

+ 9 - 1
src/views/customer/user/Index.vue

@@ -5,6 +5,9 @@ import MoveUser from './components/MoveUser.vue'
 import ConfirmImportUser from './components/ConfirmImportUser.vue'
 import {apiCustomerUser} from '@/api/customer'
 
+// 下载用户导入模板
+const downloadTempUrl=ref(import.meta.env.VITE_APP_API_URL+'/eta_business/user/template?'+sessionStorage.getItem('token'))
+
 const jobOpts = [
   {
     label: '在职',
@@ -143,7 +146,12 @@ async function handleImportUser(e){
         <t-button style="width: 120px; margin-left: 10px">批量导入用户</t-button>
       </t-upload>
 
-      <t-button style="width: 120px; margin-left: 10px" theme="primary" variant="text">下载导入模板</t-button>
+      <t-button 
+        style="width: 120px; margin-left: 10px" 
+        theme="primary" 
+        variant="text"
+        :href="downloadTempUrl"
+      >下载导入模板</t-button>
       <t-input
         style="width: 310px; margin-left: auto"
         placeholder="姓名/手机号"

+ 59 - 11
src/views/customer/user/components/ActionStatisticForCustomer.vue

@@ -1,6 +1,8 @@
 <script setup>
 import FavChartStatistic from './FavChartStatistic.vue'
 import { Calendar1Icon } from 'tdesign-icons-vue-next'
+import {apiCustomerUser} from '@/api/customer'
+import moment from 'moment'
 
 const timeType = [
   {
@@ -22,20 +24,53 @@ const timeType = [
 ]
 const timeTypeValue = ref('')
 const selectDate = ref([])
-const selectBusinessValue=ref('')
+const selectBusinessValue=ref([])
 
 const tableData = ref([])
 const columns = [
-  { align: 'center', colKey: '', title: '用户名' },
-  { align: 'center', colKey: '', title: '客户名' },
-  { align: 'center', colKey: '', title: '累计收藏图表' },
-  { align: 'center', colKey: '', title: '最近一次收藏时间', sorter: true, },
+  { align: 'center', colKey: 'RealName', title: '用户名' },
+  { align: 'center', colKey: 'BusinessName', title: '客户名' },
+  { align: 'center', colKey: 'CollectNum', title: '累计收藏图表' },
+  { align: 'center', colKey: 'LastCollectChartTime', title: '最近一次收藏时间', sorter: true, },
 ]
-const tablePagination = {
-  defaultCurrent: 1,
-  defaultPageSize: 20,
+const tablePagination = ref({
+  current: 1,
+  pageSize: 20,
   total: 0,
   showPageSize: false
+})
+async function getStatisticList(){
+  let StartDate='',EndDate='';
+  const res=await apiCustomerUser.getUserActionStatistic({
+    CurrentIndex:tablePagination.value.current,
+    PageSize:tablePagination.value.pageSize,
+    EtaBusinessIds:selectBusinessValue.value.join(','),
+    StartDate:selectDate.value?.[0]||'',
+    EndDate:selectDate.value?.[1]||'',
+  })
+  if(res.Ret!==200) return
+  tableData.value=res.Data.List||[]
+  tablePagination.value.total=res.Data.Paging.Totals 
+
+}
+getStatisticList()
+
+function refreshList(){
+  tablePagination.value.current=1
+  tableData.value=[]
+  getStatisticList()
+}
+
+// 日期类型切换
+function handleTimeTypeChange(item){
+  timeTypeValue.value=item.value
+  selectDate.value=[]
+  refreshList()
+}
+// 选择具体日期
+function handleSelectDate(){
+  timeTypeValue.value=''
+  refreshList()
 }
 
 const showFavChart=ref(false)
@@ -44,15 +79,24 @@ const showFavChart=ref(false)
 
 <template>
   <div class="flex top-filter">
-    <select-business placeholder="输入社会信用码或客户名称" filterable v-model="selectBusinessValue" style="width: 240px; margin-right: 50px" />
+    <select-business 
+      placeholder="输入社会信用码或客户名称" 
+      filterable
+      multiple
+      clearable
+      v-model="selectBusinessValue" 
+      style="width: 240px; margin-right: 50px" 
+      @change="refreshList"
+    />
     <t-button
       :variant="timeTypeValue === item.value ? 'base' : 'outline'"
       v-for="item in timeType"
       :key="item.value"
       style="width: 100px"
+      @click="handleTimeTypeChange(item)"
       >{{ item.label }}</t-button
     >
-    <t-date-range-picker v-model="selectDate" clearable style="width: 300px" />
+    <t-date-range-picker v-model="selectDate" clearable style="width: 300px" @change="handleSelectDate"/>
   </div>
   <t-table
     rowKey="id"
@@ -62,7 +106,11 @@ const showFavChart=ref(false)
     :pagination="tablePagination"
     show-header
     resizable
-  />
+  >
+    <template #CollectNum="{row}">
+      <t-button size="small" theme="primary" variant="text">{{row.CollectNum}}</t-button>
+    </template>
+  </t-table>
 
   <!-- 用户收藏图表 -->
   <FavChartStatistic v-model:show="showFavChart"/>