zxl
1 天以前 ecdd0fb84ddd09e84143896eb99956bcf9629446
manager/src/views/activity-prize/prize-store.vue
@@ -108,6 +108,7 @@
            class="add-btn"
            v-if="row.generateStatus ==='NOT_GENERATE'"
          >生成优惠卷</Button>
          <Button
            @click="detail(row)"
            style="margin-left: 10px;"
@@ -154,20 +155,27 @@
    </Modal>
    <Modal
      v-model="showCouponStore"
      v-model="showPrizeClaim"
      width="1200"
      :mask-closable="false"
      @on-cancel="handleCancelCouponStore"
    >
      <Table
        :loading="couponStoreLoading"
        :loading="showPrizeClaimLoading"
        border
        :columns="couponStoreColumns"
        :data="couponStoreData"
        :columns="prizeClaimColumns"
        :data="prizeClaimData"
        ref="table"
      >
        <template slot-scope="{ row }" slot="action">
          <Button
            @click="lookSupplementaryMaterials(row)"
            type="primary"
            class="add-btn"
            :disabled="row.material === 'NOT_GENERATE'"
          >查看材料</Button>
          <Button
            style="margin-left: 20px"
            @click="generalQrCode(row)"
            type="primary"
            class="add-btn"
@@ -177,11 +185,11 @@
      </Table>
      <Row type="flex" justify="center" class="mt_10">
        <Page
          :current="storeCouponSingleQuery.pageNumber"
          :total="couponStoreTotal"
          :page-size="storeCouponSingleQuery.pageSize"
          @on-change="couponStoreChangePage"
          @on-page-size-change="couponStoreChangePageSize"
          :current="prizeClaimQuery.pageNumber"
          :total="prizeClaimTotal"
          :page-size="prizeClaimQuery.pageSize"
          @on-change="prizeCliamChangePage"
          @on-page-size-change="prizeCliamChangePageSize"
          :page-size-opts="[10, 20, 50]"
          size="small"
          show-total
@@ -269,12 +277,41 @@
        <Button type="primary" @click="handleSubmit" :loading="submitLoading">确定</Button>
      </div>
    </Modal>
    <Modal
      v-model="dialogVisible2"
      title="材料详情"
      width="1200"
      :mask-closable="false"
      @on-cancel="handleCancel2">
      <Row :gutter="16">
        <Col span="12">
          <div class="detail-item">
            <label>文本内容:</label>
            <span>{{ detailData.content }}</span>
          </div>
        </Col>
        <Col span="24">
          <div class="detail-item">
            <label>文件:</label>
            <div v-if="detailData.urlPath" class="detail-image">
              <img
                :src="detailData.urlPath" alt="奖品封面"
                class="preview-image-limit"
              >
            </div>
          </div>
        </Col>
      </Row>
    </Modal>
  </div>
</template>
<script>
import vueQr from "vue-qr";
import { getPage,add,changeStatus,generateStorePrize} from "@/api/prize-store.js"
import { getPage,add,changeStatus,generateStorePrize,getClaimPage ,getDetailData} from "@/api/prize-store.js"
import * as API_Activity_Prize from "@/api/activity-prize.js"
import * as API_Order from "@/api/order";
@@ -286,27 +323,28 @@
  name: 'CouponManagement',
  data() {
    return {
      detailData:{},
      QRCodeUrl:"",
      showGeneralQrCode:false,
      codeLoading:false,
      codeUrl: this.QRcodeBaseUrl+ '/scanpage/couponStore',
      codeUrl: this.QRcodeBaseUrl+ '/scanpage/prize',
      showCouponStore:false,
      couponStoreTotal:0,
      couponStoreData:[],
      couponStoreLoading:false,
      couponStoreColumns: [
      showPrizeClaim:false,
      prizeClaimTotal:0,
      prizeClaimData:[],
      showPrizeClaimLoading:false,
      prizeClaimColumns: [
        {
          title: "优惠券名称",
          key: "couponName",
          title: "活动名",
          key: "prizeActivityName",
          width: 200,
          align: "center",
          tooltip: true
        },
        {
          title: "优惠券编号",
          key: "couponNo",
          title: "编号",
          key: "no",
          width: 200,
          align: "center",
          tooltip: true
@@ -333,7 +371,7 @@
          title: "操作",
          slot: "action",
          align: "center",
          width: 200,
          width: 400,
          fixed: "right"
        }
      ],
@@ -410,10 +448,10 @@
      total: 0,
      listLoading: false,
      submitLoading: false,
      storeCouponSingleQuery:{
      prizeClaimQuery:{
        pageNumber: 1,
        pageSize: 10,
        refId:""
        storePrizeId:""
      },
      listQuery: {
@@ -433,6 +471,8 @@
      dialogVisible: false,
      dialogStatus: '',
      dialogTitle: '',
      dialogVisible2: false,
      // 表单验证规则
      formRules: {
@@ -508,6 +548,17 @@
    }
  },
  methods: {
    lookSupplementaryMaterials(row){
      this.dialogVisible2 = true;
      getDetailData(row.id).then(res =>{
        if (res.code === 200){
          this.detailData = res.data;
        }
      })
    },
    closeGeneralQrCode(){
      this.showGeneralQrCode = false;
      this.QRCodeUrl = '';
@@ -521,12 +572,11 @@
    },
    detail(row){
      console.log(row)
      this.showCouponStore = true;
      this.storeCouponSingleQuery.refId = row.id
      this.storeCouponSingleQuery.pageSize = 10
      this.storeCouponSingleQuery.pageNumber = 1
      this.getCouponStoreDataList();
      this.showPrizeClaim = true;
      this.prizeClaimQuery.storePrizeId = row.id
      this.prizeClaimQuery.pageSize = 10
      this.prizeClaimQuery.pageNumber = 1
      this.getClaimPage();
    },
    generalStorePrize(row){
      generateStorePrize(row.id).then(response => {
@@ -556,16 +606,16 @@
      this.getActivityPrizeDataList();
    },
    couponStoreChangePage(v) {
    prizeCliamChangePage(v) {
      // 改变页码
      this.storeCouponSingleQuery.pageNumber = v;
      this.getCouponStoreDataList();
      this.prizeClaimQuery.pageNumber = v;
      this.getClaimPage();
    },
    couponStoreChangePageSize(v) {
    prizeCliamChangePageSize(v) {
      // 改变页数
      this.storeCouponSingleQuery.pageNumber = 1;
      this.storeCouponSingleQuery.pageSize = v;
      this.getCouponStoreDataList();
      this.prizeClaimQuery.pageNumber = 1;
      this.prizeClaimQuery.pageSize = v;
      this.getClaimPage();
    },
    handleRowClick(currentRow ,oldCurrentRow){
      console.log(currentRow)
@@ -576,15 +626,15 @@
      console.log(this.temp.couponId)
    },
    getCouponStoreDataList(){
      this.couponStoreLoading = true;
      // API_Activity_Prize(this.storeCouponSingleQuery).then((res) =>{
      //   this.couponStoreLoading =false;
      //   if (res.code === 200){
      //     this.couponStoreData = res.data;
      //     this.couponStoreTotal = res.total;
      //   }
      // })
    getClaimPage(){
      this.showPrizeClaimLoading = true;
      getClaimPage(this.prizeClaimQuery).then((res) =>{
        this.showPrizeClaimLoading =false;
        if (res.code === 200){
          this.prizeClaimData = res.data;
          this.prizeClaimTotal = res.total;
        }
      })
    },
    getActivityPrizeDataList() {
@@ -692,11 +742,14 @@
      return colorMap[status] || 'default';
    },
    handleCancelCouponStore(){
      this.showCouponStore = false;
      this.showPrizeClaim = false;
    },
    // 弹窗取消
    handleCancel() {
      this.dialogVisible = false;
    },
    handleCancel2() {
      this.dialogVisible2 = false;
    },
    // 提交表单
@@ -714,7 +767,29 @@
        }
      });
    }
    },
    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);
    },
  },
  mounted() {
    this.getStoreSelect();