zxl
23 小时以前 13f39a06acaca62e665b383b1395b2c76e0397a1
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"
@@ -103,6 +114,12 @@
              size="small"
              @click="detail(row)"
            >详情</Button>
            <Button
              v-if=" row.distributeStatus === 'WAIT'"
              type="info"
              size="small"
              @click="push(row)"
            >发放</Button>
          </div>
        </template>
      </Table>
@@ -205,7 +222,8 @@
<script>
import {
  getPage,
  queryExport
  queryExport,
  pushById
} from '@/api/prize-record.js'
export default {
@@ -278,6 +296,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 +315,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 +349,39 @@
    this.init();
  },
  methods: {
    push(row){
      this.loading = true;
      pushById(row.id).then(res =>{
        this.loading = false;
        if (res.code === 200){
          this.$Message.success(res.data)
        }else {
          this.$Message.error(res.data)
        }
      })
    },
    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 +455,9 @@
    resetSearch(){
      this.$refs.searchForm.resetFields()
      this.searchForm.pageNumber = 1
      this.searchForm.startTime = '';
      this.searchForm.endTime = '';
      this.time =[];
      this.getPage()
    },
    infoModelClose(){
@@ -417,26 +484,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()
    },
  },