zxl
7 天以前 e8377ebeabf09c9a8d3397274b03dc02945c8dc7
manager/src/views/prize-grant-record/index.vue
@@ -30,7 +30,7 @@
            style="width: 180px"
          />
        </FormItem>
        <FormItem label="中奖状态" prop="beginTime">
        <FormItem label="中奖状态" prop="grantStatus">
          <Select
            v-model="searchForm.grantStatus"
            placeholder="请选择中奖状态"
@@ -48,7 +48,16 @@
            </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"
@@ -179,6 +188,7 @@
      modelShow:false,
      modelTitle:'',
      loading:false,
      time:[],
      columns:[
        {
          title: '用户昵称',
@@ -212,6 +222,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,
@@ -226,7 +246,9 @@
        pageNumber:1,
        nickName:'',
        activityName:'',
        grantStatus:''
        grantStatus:'',
        startTime:'',
        endTime:''
      },
      typeSelect:[
        {id: 1, value: 'SUCCESS', label: '发放成功'},
@@ -245,6 +267,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], {
@@ -279,6 +323,9 @@
    resetSearch(){
      this.$refs.searchForm.resetFields()
      this.searchForm.pageNumber = 1
      this.searchForm.startTime = '';
      this.searchForm.endTime = '';
      this.time =[];
      this.getPage()
    },
    infoModelClose(){
@@ -305,11 +352,8 @@
    },
    handleSearch(type,value){
      if (type === 'beginTime') {
        this.searchForm.beginTime = value
      } else if (type === 'endTime') {
        this.searchForm.endTime = value
      }
      this.searchForm.startTime = this.formatDate(this.time[0]);
      this.searchForm.endTime = this.formatDate(this.time[1]);
      this.getPage()
    },
@@ -317,14 +361,15 @@
    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()
    },
  },