|
|
@@ -1,7 +1,10 @@
|
|
|
<script setup lang="ts">
|
|
|
import { ref } from "vue";
|
|
|
+import { useRequest } from "alova/client";
|
|
|
import { getImageUrl } from "@/utils/imageUtil";
|
|
|
import FilterSelect from "@/components/filter/filter.vue";
|
|
|
+import LsvList from "@/components/listScrollView/index.vue";
|
|
|
+import { getIssuanceSituation } from "@/api/home";
|
|
|
|
|
|
definePage({
|
|
|
style: {
|
|
|
@@ -10,54 +13,68 @@ definePage({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
-// 定义tab列表
|
|
|
-const tabList = ref([
|
|
|
- { label: "今天", value: "0" },
|
|
|
- { label: "近7天", value: "1" },
|
|
|
- { label: "近30天", value: "2" },
|
|
|
-]);
|
|
|
+const totalAmount = ref();
|
|
|
+const templateName = ref("");
|
|
|
|
|
|
-// 当前选中的tab
|
|
|
-const currentTab = ref("0");
|
|
|
+const listRef = ref();
|
|
|
+const isMounted = ref(false);
|
|
|
+const filterObj = ref({ type: "", date: "1", dataFilter: null });
|
|
|
|
|
|
-// 点击tab事件
|
|
|
-const handleTabClick = (value) => {
|
|
|
- currentTab.value = value;
|
|
|
- console.log("选中tab:", value);
|
|
|
+const search = () => {
|
|
|
+ reloadListRef();
|
|
|
};
|
|
|
|
|
|
-const keyword = ref("");
|
|
|
-async function search() {}
|
|
|
-async function clear() {}
|
|
|
+const filterParams = ref({});
|
|
|
+const selectValue = (selected) => {
|
|
|
+ if (!isMounted.value) {
|
|
|
+ isMounted.value = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ filterParams.value = selected;
|
|
|
+ reloadListRef();
|
|
|
+};
|
|
|
|
|
|
-const isOpen = ref(false);
|
|
|
-const popupRef = ref();
|
|
|
-function clickSelect() {
|
|
|
- isOpen.value = !isOpen.value;
|
|
|
- isOpen.value ? popupRef.value?.show() : popupRef.value?.close();
|
|
|
-}
|
|
|
+const clear = () => {
|
|
|
+ templateName.value = "";
|
|
|
+ reloadListRef();
|
|
|
+};
|
|
|
|
|
|
-const rewardTabs = ref([
|
|
|
- { label: "美食", type: "1" },
|
|
|
- { label: "车服务", type: "2" },
|
|
|
-]);
|
|
|
+const reloadListRef = (extraParams = {}) => {
|
|
|
+ listRef.value.reloadList({
|
|
|
+ templateName: templateName.value,
|
|
|
+ type: filterParams.value.date?.type,
|
|
|
+ classification: filterParams.value.type?.type,
|
|
|
+ startTime: filterParams.value.dataFilter
|
|
|
+ ? filterParams.value.dataFilter?.startDate + " 23:59:59"
|
|
|
+ : "",
|
|
|
+ endTime: filterParams.value.dataFilter
|
|
|
+ ? filterParams.value.dataFilter?.endDate + " 23:59:59"
|
|
|
+ : "",
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
-const classIndex = ref(-1);
|
|
|
-const classItem = ref({
|
|
|
- label: "",
|
|
|
- type: "",
|
|
|
-});
|
|
|
-function classClick(index, item) {
|
|
|
- classIndex.value = index;
|
|
|
- classItem.value = item;
|
|
|
- clickSelect();
|
|
|
-}
|
|
|
+const getCouponListApi = (params) => {
|
|
|
+ return getIssuanceSituation({
|
|
|
+ pageNo: params.pageNo,
|
|
|
+ pageSize: params.pageSize,
|
|
|
+ templateName: params.templateName || "",
|
|
|
+ type: params.type ?? 1,
|
|
|
+ startTime: params.startTime || "",
|
|
|
+ endTime: params.endTime || "",
|
|
|
+ classification: params.classification || "",
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
-const filter = ["type", "date", "dataFilter"];
|
|
|
+const afterFetch = (item) => {
|
|
|
+ totalAmount.value = item.totalAmount;
|
|
|
+};
|
|
|
|
|
|
-function selectValue(item) {
|
|
|
- console.log(item);
|
|
|
-}
|
|
|
+const couponTypeMap = {
|
|
|
+ "1": "权益券",
|
|
|
+ "2": "折扣券",
|
|
|
+ "3": "满减券",
|
|
|
+ "4": "兑换券",
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -66,49 +83,55 @@ function selectValue(item) {
|
|
|
:title-style="{ fontWeight: 'bold', color: '#000' }" leftIconColor="#000"></u-navbar>
|
|
|
|
|
|
<view class="invite-content-search">
|
|
|
- <u-search :showAction="true" actionText="搜索" bgColor="#F7F8FA" v-model="keyword" color='#333' placeholder='搜索券名称'
|
|
|
- :actionStyle='{ color: "#FF5365", fontSize: "32rpx" }'></u-search>
|
|
|
+ <u-search :showAction="true" actionText="搜索" bgColor="#F7F8FA" v-model="templateName" color='#333'
|
|
|
+ placeholder='搜索券名称' :actionStyle='{ color: "#FF5365", fontSize: "32rpx" }' @search="search" @clear='clear'
|
|
|
+ :clearabled="true" @custom="search"></u-search>
|
|
|
</view>
|
|
|
|
|
|
- <FilterSelect :filter="filter" @selectValue='selectValue'></FilterSelect>
|
|
|
+ <FilterSelect :filter="filterObj" @selectValue='selectValue'></FilterSelect>
|
|
|
|
|
|
<view class="send-content">
|
|
|
- <view class="send-total">合计领取:2384张</view>
|
|
|
- <view class="send-card">
|
|
|
- <view class="send-header">
|
|
|
- <view class="coupon-info">
|
|
|
- <text class="coupon-name">满100减50优惠券</text>
|
|
|
- <view class="coupon-tag">折扣券</view>
|
|
|
- </view>
|
|
|
- <!-- <text class="send-count send-red">免费兑换</text> -->
|
|
|
- <!-- <text class="send-number-box">
|
|
|
- <text class="send-number">9</text>
|
|
|
- <text class="send-unit">折</text>
|
|
|
- </text> -->
|
|
|
- <view class="send-number-box">
|
|
|
- <text class='add-title'>满100减</text>
|
|
|
- <text class="send-number-box">
|
|
|
- <text class="send-number">30</text>
|
|
|
- <text class="send-unit">元</text>
|
|
|
- </text>
|
|
|
- </view>
|
|
|
-
|
|
|
- </view>
|
|
|
- <view class="send-divider"></view>
|
|
|
- <view class="send-detail">
|
|
|
- <view class="detail-row">
|
|
|
- <text class="detail-label">品类</text>
|
|
|
- <text class="detail-value">2026-05-20 10:30:00</text>
|
|
|
- </view>
|
|
|
- <view class="detail-row">
|
|
|
- <text class="detail-label">用户领取</text>
|
|
|
- <text class="detail-value">微信朋友圈</text>
|
|
|
+ <view class="send-total">合计领取:{{ totalAmount || 0 }}张</view>
|
|
|
+ <LsvList ref="listRef" :api="getCouponListApi" key-name="detailList" @afterFetch='afterFetch'>
|
|
|
+ <template #list="{ data }">
|
|
|
+ <view v-for="(item, index) in data" :key="item.templateId || index" class="send-card">
|
|
|
+ <view class="send-header">
|
|
|
+ <view class="coupon-info">
|
|
|
+ <text class="coupon-name">{{ item.templateName }}</text>
|
|
|
+ <view class="coupon-tag">{{ couponTypeMap[item.type] || '优惠券' }}</view>
|
|
|
+ </view>
|
|
|
+ <view class="send-number-box">
|
|
|
+ <template v-if="item.type === '2'">
|
|
|
+ <text class="send-number">{{ item.ruleDiscountRate }}</text>
|
|
|
+ <text class="send-unit">折</text>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.type === '3'">
|
|
|
+ <text class='add-title'>满{{ item.ruleMinSpendAmount }}减</text>
|
|
|
+ <view class="send-number-box">
|
|
|
+ <text class="send-number">{{ item.ruleReductionAmount }}</text>
|
|
|
+ <text class="send-unit">元</text>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ <text v-else class="send-red">免费兑换</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="send-divider"></view>
|
|
|
+ <view class="send-detail">
|
|
|
+ <view class="detail-row">
|
|
|
+ <text class="detail-label">品类</text>
|
|
|
+ <text class="detail-value">{{ item.category || '全部' }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="detail-row">
|
|
|
+ <text class="detail-label">用户领取</text>
|
|
|
+ <text class="detail-value">{{ item.totalNum }}张</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <u--image class='coupon1-icon' :src="getImageUrl('@img/me/coupon1.png')" mode="aspectFit" width="66rpx"
|
|
|
+ height="60rpx">
|
|
|
+ </u--image>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <u--image class='coupon1-icon' :src="getImageUrl('@img/me/coupon1.png')" mode="aspectFit" width="66rpx"
|
|
|
- height="60rpx">
|
|
|
- </u--image>
|
|
|
- </view>
|
|
|
+ </template>
|
|
|
+ </LsvList>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -181,6 +204,10 @@ function selectValue(item) {
|
|
|
color: #ff5365;
|
|
|
font-weight: 600;
|
|
|
}
|
|
|
+ .discount-cap {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #ff5365;
|
|
|
+ }
|
|
|
.send-number-box {
|
|
|
display: flex;
|
|
|
align-items: baseline;
|