From f09c736d261e1ad41d97b6e974a81bb014ef1265 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期四, 23 十月 2025 17:45:50 +0800
Subject: [PATCH] 页面调整
---
manager/src/views/promotions/coupon/coupon-receive.vue | 41 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/manager/src/views/promotions/coupon/coupon-receive.vue b/manager/src/views/promotions/coupon/coupon-receive.vue
index 160d475..dab6836 100644
--- a/manager/src/views/promotions/coupon/coupon-receive.vue
+++ b/manager/src/views/promotions/coupon/coupon-receive.vue
@@ -67,6 +67,12 @@
class="search-btn"
>鎼滅储</Button
>
+ <Button
+ @click="queryExportCoupon"
+ type="primary"
+ class="search-btn">
+ 瀵煎嚭棰嗗彇璁板綍
+ </Button>
</Form>
<Table
v-if="refreshTable"
@@ -97,7 +103,7 @@
</div>
</template>
<script>
-import { getCouponReceiveList } from "@/api/promotion";
+import { getCouponReceiveList,queryExportCoupon } from "@/api/promotion";
import {
memberPromotionsStatusRender,
promotionsScopeTypeRender,
@@ -254,6 +260,39 @@
},
},
methods: {
+ queryExportCoupon(){
+ console.log(this.selectDate.length === 0);
+
+ if(this.selectDate.length === 0){
+ this.$Message.error("蹇呴』閫夋嫨鏃堕棿鑼冨洿锛屾悳绱㈠悗杩涜瀵煎嚭锛�");
+ this.searchForm.startTime = null;
+ this.searchForm.endTime = null;
+ }else{
+ this.searchForm.startTime = this.selectDate[0].getTime();
+ this.searchForm.endTime = this.selectDate[1].getTime();
+ queryExportCoupon(this.searchForm).then(res =>{
+ const blob = new Blob([res], {
+ type: "application/vnd.ms-excel;charset=utf-8",
+ });
+ //瀵逛簬<a>鏍囩锛屽彧鏈� Firefox 鍜� Chrome锛堝唴鏍革級 鏀寔 download 灞炴��
+ //IE10浠ヤ笂鏀寔blob浣嗘槸渚濈劧涓嶆敮鎸乨ownload
+ if ("download" in document.createElement("a")) {
+ //鏀寔a鏍囩download鐨勬祻瑙堝櫒
+ const link = document.createElement("a"); //鍒涘缓a鏍囩
+ link.download = "浼樻儬鍒搁鍙栬褰�.xlsx"; //a鏍囩娣诲姞灞炴��
+ link.style.display = "none";
+ link.href = URL.createObjectURL(blob);
+ document.body.appendChild(link);
+ link.click(); //鎵ц涓嬭浇
+ URL.revokeObjectURL(link.href); //閲婃斁url
+ document.body.removeChild(link); //閲婃斁鏍囩
+ } else {
+ navigator.msSaveBlob(blob, fileName);
+ }
+ })
+ }
+
+ },
back() {
this.$store.commit("removeTag", "coupon-receive");
this.$router.go(-1);
--
Gitblit v1.8.0