zxl
7 天以前 e8377ebeabf09c9a8d3397274b03dc02945c8dc7
manager/src/views/prize-record/index.vue
@@ -30,7 +30,7 @@
            style="width: 180px"
          />
        </FormItem>
        <FormItem label="中奖状态" prop="beginTime">
        <FormItem label="中奖状态" prop="prizeStatus">
          <Select
            v-model="searchForm.prizeStatus"
            placeholder="请选择中奖状态"
@@ -48,7 +48,7 @@
            </Option>
          </Select>
        </FormItem>
        <FormItem label="奖品发放状态" prop="beginTime">
        <FormItem label="奖品发放状态" prop="distributeStatus">
          <Select
            v-model="searchForm.distributeStatus"
            placeholder="请选择奖品发放状态"
@@ -66,6 +66,17 @@
            </Option>
          </Select>
        </FormItem>
        <FormItem label="报名开始时间" prop="time">
          <DatePicker
            v-model="time"
            type="datetimerange"
            placeholder="选择开始时间"
            style="width: 180px"
            @on-clear="handleSearch"
            @on-change="handleSearch"
          ></DatePicker>
        </FormItem>
        <Button
          @click="handleSearch"
          type="primary"
@@ -278,6 +289,16 @@
          }
        },
        {
          title: '抽奖时间',
          key: 'createTime',
          minWidth: 100,
          render: (h, params) => {
            return h('div', [
              h('div', `${this.formatDate(params.row.createTime,'YYYY-MM-DD HH:mm:ss')}`),
            ])
          }
        },
        {
          title: '操作',
          slot: 'action',
          width: 280,
@@ -287,13 +308,16 @@
      ],
      data:[],
      total:0,
      time:[],
      searchForm:{
        pageSize:10,
        pageNumber:1,
        nickName:'',
        activityName:'',
        prizeStatus:'',
        distributeStatus:''
        distributeStatus:'',
        startTime:'',
        endTime:''
      },
      distributeSelect:[
        {id: 1, value: 'NOT_WAIT', label: '未中奖'},
@@ -318,6 +342,28 @@
    this.init();
  },
  methods: {
    formatDate(date, format = 'YYYY-MM-DD HH:mm:ss') {
      if (!date) return '';
      const d = new Date(date);
      if (isNaN(d.getTime())) return '';
      const padZero = (num) => String(num).padStart(2, '0'); // 更可靠的补零方法
      const year = d.getFullYear();
      const month = padZero(d.getMonth() + 1); // 月份 0-11 → +1
      const day = padZero(d.getDate());
      const hours = padZero(d.getHours());
      const minutes = padZero(d.getMinutes());
      const seconds = padZero(d.getSeconds());
      return format
        .replace('YYYY', year)
        .replace('MM', month)
        .replace('DD', day)
        .replace('HH', hours)
        .replace('mm', minutes)
        .replace('ss', seconds);
    },
    queryExport(){
      queryExport(this.searchForm).then(res =>{
        const blob = new Blob([res], {
@@ -391,6 +437,9 @@
    resetSearch(){
      this.$refs.searchForm.resetFields()
      this.searchForm.pageNumber = 1
      this.searchForm.startTime = '';
      this.searchForm.endTime = '';
      this.time =[];
      this.getPage()
    },
    infoModelClose(){
@@ -417,26 +466,24 @@
    },
    handleSearch(type,value){
      if (type === 'beginTime') {
        this.searchForm.beginTime = value
      } else if (type === 'endTime') {
        this.searchForm.endTime = value
      }
      this.getPage()
      this.searchForm.startTime = this.formatDate(this.time[0]);
      this.searchForm.endTime = this.formatDate(this.time[1]);
      this.getPage();
    },
    // 初始化数据
    init() {
      this.getPage()
    },
    changePage(){
    changePage(page){
      this.searchForm.pageNumber = page
      this.getPage()
    },
    changePageSize(pageSize){
      this.searchForm.pageNumber = 1
      this.searchForm.pageSize = pageSize
      this.getPage()
    },
    changePageSize(){
      this.searchForm.pageNumber = page
      this.getPage()
    },
  },