mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 04:08:44 +08:00 
			
		
		
		
	拼团记录:优化页面布局,添加日期快捷选项
This commit is contained in:
		@@ -181,5 +181,6 @@ export enum DICT_TYPE {
 | 
				
			|||||||
  PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式
 | 
					  PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式
 | 
				
			||||||
  PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态
 | 
					  PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态
 | 
				
			||||||
  PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
 | 
					  PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
 | 
				
			||||||
  PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status' // 砍价记录的状态
 | 
					  PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status', // 砍价记录的状态
 | 
				
			||||||
 | 
					  PROMOTION_COMBINATION_RECORD_STATUS = 'promotion_combination_record_status' // 拼团记录的状态
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,44 +65,63 @@
 | 
				
			|||||||
      </ContentWrap>
 | 
					      </ContentWrap>
 | 
				
			||||||
    </el-col>
 | 
					    </el-col>
 | 
				
			||||||
  </el-row>
 | 
					  </el-row>
 | 
				
			||||||
 | 
					 | 
				
			||||||
  <ContentWrap>
 | 
					  <ContentWrap>
 | 
				
			||||||
    <!-- 检索条件 -->
 | 
					    <!-- 搜索工作栏 -->
 | 
				
			||||||
    <div class="mb-[10px]">
 | 
					    <el-form
 | 
				
			||||||
      <span class="font-size-[14px]" style="font-weight: bold; color: #606266">时间段:</span>
 | 
					      ref="queryFormRef"
 | 
				
			||||||
      <el-date-picker
 | 
					      :inline="true"
 | 
				
			||||||
        v-model="queryParams.createTime"
 | 
					      :model="queryParams"
 | 
				
			||||||
        :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
 | 
					      class="-mb-15px"
 | 
				
			||||||
        class="!w-240px"
 | 
					      label-width="68px"
 | 
				
			||||||
        end-placeholder="结束日期"
 | 
					    >
 | 
				
			||||||
        start-placeholder="开始日期"
 | 
					      <el-form-item label="创建时间" prop="createTime">
 | 
				
			||||||
        type="daterange"
 | 
					        <el-date-picker
 | 
				
			||||||
        value-format="YYYY-MM-DD HH:mm:ss"
 | 
					          v-model="queryParams.createTime"
 | 
				
			||||||
      />
 | 
					          :shortcuts="shortcuts"
 | 
				
			||||||
      <span class="ml-[10px] font-size-[14px] font-bold" style="color: #606266">拼团状态:</span>
 | 
					          class="!w-240px"
 | 
				
			||||||
      <el-select v-model="queryParams.status" class="!w-240px" clearable placeholder="全部">
 | 
					          end-placeholder="结束日期"
 | 
				
			||||||
        <el-option
 | 
					          start-placeholder="开始日期"
 | 
				
			||||||
          v-for="(dict, index) in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
 | 
					          type="daterange"
 | 
				
			||||||
          :key="index"
 | 
					          value-format="YYYY-MM-DD HH:mm:ss"
 | 
				
			||||||
          :label="dict.label"
 | 
					 | 
				
			||||||
          :value="dict.value"
 | 
					 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
      </el-select>
 | 
					      </el-form-item>
 | 
				
			||||||
    </div>
 | 
					      <el-form-item label="拼团状态" prop="status">
 | 
				
			||||||
 | 
					        <el-select v-model="queryParams.status" class="!w-240px" clearable placeholder="全部">
 | 
				
			||||||
 | 
					          <el-option
 | 
				
			||||||
 | 
					            v-for="(dict, index) in getIntDictOptions(
 | 
				
			||||||
 | 
					              DICT_TYPE.PROMOTION_COMBINATION_RECORD_STATUS
 | 
				
			||||||
 | 
					            )"
 | 
				
			||||||
 | 
					            :key="index"
 | 
				
			||||||
 | 
					            :label="dict.label"
 | 
				
			||||||
 | 
					            :value="dict.value"
 | 
				
			||||||
 | 
					          />
 | 
				
			||||||
 | 
					        </el-select>
 | 
				
			||||||
 | 
					      </el-form-item>
 | 
				
			||||||
 | 
					      <el-form-item>
 | 
				
			||||||
 | 
					        <el-button @click="handleQuery">
 | 
				
			||||||
 | 
					          <Icon class="mr-5px" icon="ep:search" />
 | 
				
			||||||
 | 
					          搜索
 | 
				
			||||||
 | 
					        </el-button>
 | 
				
			||||||
 | 
					        <el-button @click="resetQuery">
 | 
				
			||||||
 | 
					          <Icon class="mr-5px" icon="ep:refresh" />
 | 
				
			||||||
 | 
					          重置
 | 
				
			||||||
 | 
					        </el-button>
 | 
				
			||||||
 | 
					      </el-form-item>
 | 
				
			||||||
 | 
					    </el-form>
 | 
				
			||||||
 | 
					  </ContentWrap>
 | 
				
			||||||
 | 
					  <ContentWrap>
 | 
				
			||||||
    <!--   分页列表数据展示   -->
 | 
					    <!--   分页列表数据展示   -->
 | 
				
			||||||
    <el-tabs v-model="queryParams.dateType" @tab-click="handleTabClick">
 | 
					 | 
				
			||||||
      <el-tab-pane
 | 
					 | 
				
			||||||
        v-for="item in tabsData"
 | 
					 | 
				
			||||||
        :key="item.type"
 | 
					 | 
				
			||||||
        :label="item.name + '(' + item.count + ')'"
 | 
					 | 
				
			||||||
        :name="item.value"
 | 
					 | 
				
			||||||
      />
 | 
					 | 
				
			||||||
    </el-tabs>
 | 
					 | 
				
			||||||
    <el-table v-loading="loading" :data="pageList">
 | 
					    <el-table v-loading="loading" :data="pageList">
 | 
				
			||||||
      <el-table-column align="center" label="编号" prop="id" />
 | 
					      <el-table-column align="center" label="编号" prop="id" />
 | 
				
			||||||
      <!-- TODO 是否需要做一个点击用户头像跳转或查看用户信息的功能  -->
 | 
					      <!-- TODO 是否需要做一个点击用户头像跳转或查看用户信息的功能  -->
 | 
				
			||||||
      <el-table-column align="center" label="头像" prop="avatars" />
 | 
					      <el-table-column align="center" label="头像" prop="avatar" />
 | 
				
			||||||
      <el-table-column align="center" label="开团团长" prop="avatar" />
 | 
					      <el-table-column align="center" label="开团团长" prop="headId">
 | 
				
			||||||
 | 
					        <template #default="{ row }: { row: CombinationRecordApi.CombinationRecordVO }">
 | 
				
			||||||
 | 
					          {{
 | 
				
			||||||
 | 
					            row.headId ? pageList.find((item) => item.id === row.headId)?.nickname : row.nickname
 | 
				
			||||||
 | 
					          }}
 | 
				
			||||||
 | 
					        </template>
 | 
				
			||||||
 | 
					      </el-table-column>
 | 
				
			||||||
      <el-table-column
 | 
					      <el-table-column
 | 
				
			||||||
        :formatter="dateFormatter"
 | 
					        :formatter="dateFormatter"
 | 
				
			||||||
        align="center"
 | 
					        align="center"
 | 
				
			||||||
@@ -137,10 +156,13 @@
 | 
				
			|||||||
      />
 | 
					      />
 | 
				
			||||||
      <el-table-column align="center" label="拼团状态" prop="status">
 | 
					      <el-table-column align="center" label="拼团状态" prop="status">
 | 
				
			||||||
        <template #default="scope">
 | 
					        <template #default="scope">
 | 
				
			||||||
          <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
 | 
					          <dict-tag
 | 
				
			||||||
 | 
					            :type="DICT_TYPE.PROMOTION_COMBINATION_RECORD_STATUS"
 | 
				
			||||||
 | 
					            :value="scope.row.status"
 | 
				
			||||||
 | 
					          />
 | 
				
			||||||
        </template>
 | 
					        </template>
 | 
				
			||||||
      </el-table-column>
 | 
					      </el-table-column>
 | 
				
			||||||
      <el-table-column align="center" label="操作">
 | 
					      <el-table-column align="center" fixed="right" label="操作">
 | 
				
			||||||
        <template #default></template>
 | 
					        <template #default></template>
 | 
				
			||||||
      </el-table-column>
 | 
					      </el-table-column>
 | 
				
			||||||
    </el-table>
 | 
					    </el-table>
 | 
				
			||||||
@@ -159,7 +181,6 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
 | 
				
			|||||||
import { dateFormatter } from '@/utils/formatTime'
 | 
					import { dateFormatter } from '@/utils/formatTime'
 | 
				
			||||||
import { createImageViewer } from '@/components/ImageViewer'
 | 
					import { createImageViewer } from '@/components/ImageViewer'
 | 
				
			||||||
import * as CombinationRecordApi from '@/api/mall/promotion/combination/combinationRecord'
 | 
					import * as CombinationRecordApi from '@/api/mall/promotion/combination/combinationRecord'
 | 
				
			||||||
import { TabsPaneContext } from 'element-plus'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
defineOptions({ name: 'CombinationRecord' })
 | 
					defineOptions({ name: 'CombinationRecord' })
 | 
				
			||||||
const queryParams = ref({
 | 
					const queryParams = ref({
 | 
				
			||||||
@@ -169,15 +190,16 @@ const queryParams = ref({
 | 
				
			|||||||
  pageSize: 10,
 | 
					  pageSize: 10,
 | 
				
			||||||
  pageNo: 1
 | 
					  pageNo: 1
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					const queryFormRef = ref() // 搜索的表单
 | 
				
			||||||
const loading = ref(true) // 列表的加载中
 | 
					const loading = ref(true) // 列表的加载中
 | 
				
			||||||
const total = ref(0) // 总记录数
 | 
					const total = ref(0) // 总记录数
 | 
				
			||||||
const pageList = ref([]) // 分页数据
 | 
					const pageList = ref<CombinationRecordApi.CombinationRecordVO[]>([]) // 分页数据
 | 
				
			||||||
/** 查询列表 */
 | 
					/** 查询列表 */
 | 
				
			||||||
const getList = async () => {
 | 
					const getList = async () => {
 | 
				
			||||||
  loading.value = true
 | 
					  loading.value = true
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    const data = await CombinationRecordApi.getCombinationRecordPage(queryParams.value)
 | 
					    const data = await CombinationRecordApi.getCombinationRecordPage(queryParams.value)
 | 
				
			||||||
    pageList.value = data.list
 | 
					    pageList.value = data.list as CombinationRecordApi.CombinationRecordVO[]
 | 
				
			||||||
    total.value = data.total
 | 
					    total.value = data.total
 | 
				
			||||||
  } finally {
 | 
					  } finally {
 | 
				
			||||||
    loading.value = false
 | 
					    loading.value = false
 | 
				
			||||||
@@ -193,64 +215,85 @@ const recordSummary = ref({
 | 
				
			|||||||
const getSummary = async () => {
 | 
					const getSummary = async () => {
 | 
				
			||||||
  recordSummary.value = await CombinationRecordApi.getCombinationRecordSummary()
 | 
					  recordSummary.value = await CombinationRecordApi.getCombinationRecordSummary()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					// 日期快捷选项
 | 
				
			||||||
// tabs 数据
 | 
					const shortcuts = ref([
 | 
				
			||||||
const tabsData = ref([
 | 
					 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    count: 0,
 | 
					    text: '今天',
 | 
				
			||||||
    name: '全部',
 | 
					 | 
				
			||||||
    type: 'all',
 | 
					 | 
				
			||||||
    value: 0
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    count: 0,
 | 
					 | 
				
			||||||
    name: '今天',
 | 
					 | 
				
			||||||
    type: 'toDay',
 | 
					    type: 'toDay',
 | 
				
			||||||
    value: 1
 | 
					    value: () => {
 | 
				
			||||||
 | 
					      queryParams.value.dateType = 1
 | 
				
			||||||
 | 
					      return new Date()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    count: 0,
 | 
					    text: '昨天',
 | 
				
			||||||
    name: '昨天',
 | 
					 | 
				
			||||||
    type: 'yesterday',
 | 
					    type: 'yesterday',
 | 
				
			||||||
    value: 2
 | 
					    value: () => {
 | 
				
			||||||
 | 
					      const date = new Date()
 | 
				
			||||||
 | 
					      date.setTime(date.getTime() - 3600 * 1000 * 24)
 | 
				
			||||||
 | 
					      queryParams.value.dateType = 2
 | 
				
			||||||
 | 
					      return [date, date]
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    count: 0,
 | 
					    text: '最近七天',
 | 
				
			||||||
    name: '最近七天',
 | 
					 | 
				
			||||||
    type: 'lastSevenDays',
 | 
					    type: 'lastSevenDays',
 | 
				
			||||||
    value: 3
 | 
					    value: () => {
 | 
				
			||||||
 | 
					      const date = new Date()
 | 
				
			||||||
 | 
					      date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
 | 
				
			||||||
 | 
					      queryParams.value.dateType = 3
 | 
				
			||||||
 | 
					      return [date, new Date()]
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    count: 0,
 | 
					    text: '最近30天',
 | 
				
			||||||
    name: '最近30天',
 | 
					 | 
				
			||||||
    type: 'last30Days',
 | 
					    type: 'last30Days',
 | 
				
			||||||
    value: 4
 | 
					    value: () => {
 | 
				
			||||||
 | 
					      const date = new Date()
 | 
				
			||||||
 | 
					      date.setTime(date.getTime() - 3600 * 1000 * 24 * 30)
 | 
				
			||||||
 | 
					      queryParams.value.dateType = 4
 | 
				
			||||||
 | 
					      return [date, new Date()]
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    count: 0,
 | 
					    text: '本月',
 | 
				
			||||||
    name: '本月',
 | 
					 | 
				
			||||||
    type: 'thisMonth',
 | 
					    type: 'thisMonth',
 | 
				
			||||||
    value: 5
 | 
					    value: () => {
 | 
				
			||||||
 | 
					      const date = new Date()
 | 
				
			||||||
 | 
					      date.setDate(1) // 设置为当前月的第一天
 | 
				
			||||||
 | 
					      queryParams.value.dateType = 5
 | 
				
			||||||
 | 
					      return [date, new Date()]
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    count: 0,
 | 
					    text: '今年',
 | 
				
			||||||
    name: '今年',
 | 
					 | 
				
			||||||
    type: 'thisYear',
 | 
					    type: 'thisYear',
 | 
				
			||||||
    value: 6
 | 
					    value: () => {
 | 
				
			||||||
 | 
					      const date = new Date()
 | 
				
			||||||
 | 
					      queryParams.value.dateType = 6
 | 
				
			||||||
 | 
					      return [new Date(`${date.getFullYear()}-01-01`), date]
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
])
 | 
					])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 获得每个 Tab 的数量 */
 | 
					/** 获得每个 Tab 的数量 */
 | 
				
			||||||
const getTabsCount = async () => {
 | 
					const getTabsCount = async () => {
 | 
				
			||||||
  const res = await CombinationRecordApi.getCombinationRecordCount()
 | 
					  const res = await CombinationRecordApi.getCombinationRecordCount()
 | 
				
			||||||
  tabsData.value.forEach((tab) => {
 | 
					  shortcuts.value.forEach((tab) => {
 | 
				
			||||||
    tab.count = res[tab.type]
 | 
					    tab.text += `(${res[tab.type]})`
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const handleTabClick = async (tab: TabsPaneContext) => {
 | 
					/** 搜索按钮操作 */
 | 
				
			||||||
  queryParams.value.dateType = tab.paneName as number
 | 
					const handleQuery = () => {
 | 
				
			||||||
  await getList()
 | 
					  queryParams.value.pageNo = 1
 | 
				
			||||||
 | 
					  getList()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 重置按钮操作 */
 | 
				
			||||||
 | 
					const resetQuery = () => {
 | 
				
			||||||
 | 
					  queryFormRef.value.resetFields()
 | 
				
			||||||
 | 
					  handleQuery()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 商品图预览 */
 | 
					/** 商品图预览 */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user