jwyu 9 tháng trước cách đây
mục cha
commit
5619464216

+ 4 - 0
README.md

@@ -1,2 +1,6 @@
 # ETA
 
+1. 全局挂载了formatTime(时间字符串,输出形式默认YYYY-MM-DD HH:mm:ss)方法,在组件中可直接使用
+2. 图标尽量使用svg,使用方法 <svg-icon name="close">
+3. Element-plus 中的icon 可以用<el-icon><i-ep-CirclePlus /></el-icon> 此种方式 就是加个 i-ep;在vite.config中配置了
+4. 全局组件直接在components中定义就好,已经做了自动导入,直接在页面中用文件名即可

+ 3 - 1
src/main.js

@@ -9,10 +9,12 @@ import '@/styles/element.scss'
 //引入注册脚本
 import 'virtual:svg-icons-register'
 import registerGlobalComponents from '@/components/globalComponents';
+import {formatTime} from '@/utils/common'
 
 const app= createApp(App)
 
-
+// 挂载一个全局格式化时间方法
+app.config.globalProperties.formatTime=formatTime
 
 // 注册全局指令
 import * as directives from '@/directives'

+ 9 - 0
src/router/modules/customer.js

@@ -60,6 +60,15 @@ export default[
           title:'潜在用户列表'
         },
       },
+      {
+        path:'userTransform',
+        component:()=>import('@/views/customer/UserEdit.vue'),
+        name:"CustomerUserTransform",
+        meta:{
+          title:'转客户',
+          from:'潜在用户列表'
+        },
+      },
     ]
   }
 ]

+ 0 - 5
src/styles/element.scss

@@ -20,11 +20,6 @@
   }
 }
 
-// .el-form-item__label {
-//   height: var(--el-component-size) !important;
-//   line-height: var(--el-component-size) !important;
-// }
-
 .el-pagination {
   padding: 16px 20px;
   background-color: #fff;

+ 8 - 1
src/utils/common.js

@@ -1,3 +1,4 @@
+import { dayjs } from "element-plus"
 //验证密码的正则 产品定的规则是:8位及以上,包含数字、大写字母、小写字母、特殊字符中的三个类型
 export const patternPassWord = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{8,}$/
 export function checkPassWord(pwd){
@@ -27,4 +28,10 @@ export function isMobileNo(account) {
     return phonePatter.test(account)
   }
 //验证邮箱的正则
-export const patternEmail = /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/
+export const patternEmail = /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/
+
+// 格式话时间 t时间字符串 f要格式化的样式
+export function formatTime(t,f='YYYY-MM-DD HH:mm:ss'){
+    if(!t) return ''
+    return dayjs(t).format(f)
+}

+ 4 - 4
src/views/customer/PotentialUserList.vue

@@ -24,7 +24,7 @@ const tableColOpt = [
   },
   {
     label: '注册时间',
-    key: '',
+    key: 'RegisterTime',
     sort: true
   },
   {
@@ -72,7 +72,7 @@ function handleTableSort(e) {
 
 function handleEditUser(e) {
   router.push({
-    path: '/customer/userEdit',
+    path: '/customer/userTransform',
     query: {
       id: e.UserId
     }
@@ -93,7 +93,7 @@ function handleEditUser(e) {
           range-separator="至"
           start-placeholder="注册时间"
           end-placeholder="注册时间"
-          size="large"
+          value-format="YYYY-MM-DD"
         />
       </div>
       <div style="width: 235px">
@@ -104,7 +104,7 @@ function handleEditUser(e) {
           range-separator="至"
           start-placeholder="最近一次阅读时间"
           end-placeholder="最近一次阅读时间"
-          size="large"
+          value-format="YYYY-MM-DD"
         />
       </div>
       <el-input

+ 9 - 9
src/views/customer/UserEdit.vue

@@ -10,7 +10,7 @@ import OperationRecord from './components/OperationRecord.vue'
 const route = useRoute()
 const router = useRouter()
 
-const userId = route.query.id || 0
+const userId = ref(route.query.id || 0)
 
 const isView=computed(()=>{
   return route.path==='/customer/userDetail'
@@ -76,9 +76,9 @@ const formState = reactive({
 const checkedIds = ref([])
 
 function getUserInfo() {
-  if (!userId) return
+  if (!userId.value) return
   apiCustomerUser.userInfo({
-    UserId: userId
+    UserId: userId.value
   }).then(res => {
     if (res.Ret === 200) {
       const { Detail } = res.Data
@@ -109,15 +109,15 @@ async function handleSave() {
     Company: formState.company,
     ChartPermission: checkedIds.value
   }
-  if (userId) {
-    params.UserId = Number(userId)
+  if (userId.value) {
+    params.UserId = Number(userId.value)
     params.IsEnabled = true
   }
   console.log(params);
-  const res = userId ? await apiCustomerUser.userEdit(params) : await apiCustomerUser.userAdd(params)
+  const res = userId.value ? await apiCustomerUser.userEdit(params) : await apiCustomerUser.userAdd(params)
   if (res.Ret !== 200) return
-  ElMessage.success(userId ? '编辑成功' : '新增成功')
-  router.back()
+  ElMessage.success(userId.value ? '编辑成功' : '新增成功')
+  router.replace('/customer/userList')
 
 }
 
@@ -224,7 +224,7 @@ async function handleSave() {
         >
       </div>
       <!-- 操作记录 -->
-      <OperationRecord v-if="$route.query.id!=0"/>
+      <OperationRecord v-if="userId!==0&&$route.path!=='/customer/userTransform'"/>
     </div>
   </div>
 </template>

+ 41 - 12
src/views/customer/UserList.vue

@@ -33,7 +33,7 @@ const tableColOpt = [
   },
   {
     label: '营业部/销售',
-    key: ''
+    key: 'SellerName'
   },
   {
     label: '用户状态',
@@ -41,11 +41,12 @@ const tableColOpt = [
   },
   {
     label: '有效期',
-    key: ''
+    key: 'ValidStartTime',
+    width:'200px'
   },
   {
     label: '到期时长',
-    key: '',
+    key: 'ExpirationTime',
     sort: true
   },
   {
@@ -79,8 +80,9 @@ async function getUserList() {
   const res = await apiCustomerUser.userList({
     PageSize: pageSize.value,
     CurrentIndex: page.value,
-    KeyWord: filterState.keyword,
+    SellerId:filterState.seller?filterState.seller.join(','):'',
     Status: filterState.status,
+    KeyWord: filterState.keyword,
     IsRegistered: filterState.register,
     IsSubscribed: filterState.subscribe,
     RegisterStartDate: filterState.regsiterTime ? filterState.regsiterTime[0] : '',
@@ -103,6 +105,10 @@ function handleTableSort(e) {
   // console.log(e);
   const { order, prop } = e//order:"descending",prop: "RegisterTime"
 }
+function handleFilterList(){
+  page.value=1
+  getUserList()
+}
 
 
 
@@ -176,30 +182,35 @@ function handleDelUser(row) {
           emitPath: false,
           multiple: true,
         }"
+        clearable
+        @change="handleFilterList"
       />
       <el-select
         placeholder="用户状态"
         v-model="filterState.status"
-        
         style="width: 165px"
+        @change="handleFilterList"
+        clearable
       >
-        <el-option label="启用" :value="1"></el-option>
-        <el-option label="禁用" :value="0"></el-option>
+        <el-option label="启用" value="正式"></el-option>
+        <el-option label="禁用" value="禁用"></el-option>
       </el-select>
       <el-select
         placeholder="注册状态"
         v-model="filterState.register"
-        
         style="width: 165px"
+        clearable
+        @change="handleFilterList"
       >
         <el-option label="是" value="是"></el-option>
         <el-option label="否" value="否"></el-option>
       </el-select>
       <el-select
         placeholder="是否关注公众号"
-        v-model="filterState.register"
-        
+        v-model="filterState.subscribe"
         style="width: 165px"
+        clearable
+        @change="handleFilterList"
       >
         <el-option label="是" value="是"></el-option>
         <el-option label="否" value="否"></el-option>
@@ -212,7 +223,9 @@ function handleDelUser(row) {
           range-separator="至"
           start-placeholder="注册时间"
           end-placeholder="注册时间"
-          
+          clearable
+          value-format="YYYY-MM-DD"
+          @change="handleFilterList"
         />
       </div>
       <div style="width: 235px">
@@ -223,7 +236,9 @@ function handleDelUser(row) {
           range-separator="至"
           start-placeholder="创建时间"
           end-placeholder="创建时间"
-          
+          value-format="YYYY-MM-DD"
+          clearable
+          @change="handleFilterList"
         />
       </div>
       <el-input
@@ -232,6 +247,7 @@ function handleDelUser(row) {
         :prefix-icon="Search"
         clearable
         style="max-width: 359px;margin-left:auto"
+        @input="handleFilterList"
       />
     </div>
     <div class="userlist-wrap" style="margin-top: 20px">
@@ -250,6 +266,7 @@ function handleDelUser(row) {
           :prop="column.key"
           :label="column.label"
           :sortable="column.sort ? 'custom' : false"
+          :width="column.width"
         >
           <template v-if="column.headerTips" #header>
             <span>{{ column.label }}</span>
@@ -281,6 +298,18 @@ function handleDelUser(row) {
               @click="$router.push('/customer/userDetail?id=' + row.UserId)"
               >{{ row[column.key] }}</span
             >
+            <span
+              v-else-if="column.key === 'ValidStartTime'"
+              >{{ formatTime(row.ValidStartTime,'YYYY-MM-DD') }}~{{formatTime(row.ValidEndTime,'YYYY-MM-DD')}}</span
+            >
+            <span
+              v-else-if="column.key === 'RegisterTime'"
+              >{{ formatTime(row.RegisterTime) }}</span
+            >
+            <span
+              v-else-if="column.key === 'CreateTime'"
+              >{{ formatTime(row.CreateTime) }}</span
+            >
             <span v-else>{{ row[column.key] }}</span>
           </template>
         </el-table-column>

+ 1 - 1
src/views/customer/reportStatistic/Index.vue

@@ -2,7 +2,7 @@
 import List from './List.vue'
 import Chart from './Chart.vue'
 
-const activeComp=shallowRef(Chart)
+const activeComp=shallowRef(List)
 
 function changeComp(type){
   activeComp.value=type==='list'?Chart:List