This commit is contained in:
dzc committed 2025-09-20 19:13:08 +08:00
commit 0e76e0e794
4 files changed
+70 -54

No files matched your search

+48 -40
View File
@@ -1,71 +1,79 @@
<template>
<crud-layout mainIsScroll bg="/static/page/blue-bg.png">
<template #main-top>
<view class="bg-white rounded-16rpx px-20rpx my-20rpx mx-4">
<z-tabs :list="tabs" @change="doTab" />
</view>
</template>
<view
class="card w-full h-400rpx relative activity-card overflow-hidden mb-2 px-10 py-2"
:style="{ backgroundColor: getActStatus(item.actStatus)?.color }"
v-for="(item, index) in couponList"
:key="index"
<z-paging
ref="pageRef"
height="100%"
:fixed="false"
v-model="pageHook.list"
:default-page-size="10"
safe-area-inset-bottom
:loading-more-enabled="true"
:show-scrollbar="false"
@query="query"
:auto-clean-list-when-reload="false"
:auto-scroll-to-top-when-reload="false"
@scroll="pageHook.scroll"
>
<view class="ribbon" :style="{ backgroundColor: getActStatus(item.actStatus)?.color }">
{{ getActStatus(item.actStatus)?.name }}
</view>
<view class="text-28 c-#fff text-right">ID {{ item.id }}</view>
<view class="flex justify-between font-bold mt-1">
<text class="text-32 c-#FFD941">限时领取</text>
<text class="text-32 c-#FFD941 px-1 rounded-full bg-#eeeeee44">2025-09-21</text>
</view>
<view class="w-4/5 py-2 text-30 c-#fff">店内消费额外支付1元可领取价值89元的速干T恤1件</view>
<view class="absolute bottom-60 left-80 text-28 bg-#eeeeee44 c-#fff px-2 rounded-full">限量领取 先领先得</view>
<view class="absolute bottom-40 right-80 text-20 c-#fff">领取时间 {{ item.createTime }}</view>
<view class="absolute bottom-10 right-80 text-20 c-#fff">核销时间 {{ item.receiverTime }}</view>
</view>
<template #top>
<view class="bg-white rounded-16rpx my-20rpx">
<z-tabs :list="tabs" @change="doTab" />
</view>
</template>
<view class="h-100rpx"></view>
<view
class="card w-full h-400rpx relative activity-card overflow-hidden mb-2 py-2"
:style="{ backgroundColor: getActStatus(item.actStatus)?.color }"
v-for="(item, index) in pageHook.list"
:key="index"
>
<view class="ribbon" :style="{ backgroundColor: getActStatus(item.actStatus)?.color }">
{{ getActStatus(item.actStatus)?.name }}
</view>
<view class="text-28 c-#fff text-right px-2">ID {{ item.id }}</view>
<view class="flex justify-between font-bold mt-1 px-8">
<text class="text-32 c-#FFD941">限时领取</text>
<text class="text-32 c-#FFD941 px-1 rounded-full bg-#eeeeee44">2025-09-21~2025-12-20</text>
</view>
<view class="w-4/5 py-2 text-30 c-#fff px-8">店内核销将会自动扣费1元并领取价值89元的速干T恤1件</view>
<view class="absolute bottom-100 left-60 text-28 bg-#eeeeee44 c-#fff px-2 rounded-full">限量领取 先领先得</view>
<view v-if="item.receiverTime" class="absolute bottom-40 right-20 text-20 c-#fff">领取时间 {{ item.receiverTime }}</view>
<view v-if="item.cancelTime" class="absolute bottom-10 right-20 text-20 c-#fff">核销时间 {{ item.cancelTime }}</view>
</view>
</z-paging>
</crud-layout>
</template>
<script setup lang="ts">
import { actCancel } from "@/sheep/api"
import { onLoad } from "@dcloudio/uni-app"
import { reactive, ref } from "vue"
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
import { hooks } from "@/sheep"
const tabs = [
{ id: null, name: "全部", disabled: false },
{ id: null, name: "全部", disabled: false, color: "#7f7f7f77" },
{ id: 1, name: "未核销", disabled: false, color: "#1879ff77" },
{ id: 2, name: "已核销", disabled: false, color: "#03DC6C77" },
{ id: 2, name: "已核销", disabled: false, color: "#25944577" },
{ id: 3, name: "已过期", disabled: false, color: "#FF672B77" },
]
const params = reactive({
actStatus: tabs[0].id,
})
const couponList = ref<any>([])
onLoad(() => {
getCouponList()
})
const pageRef = ref<any>(null)
const pageHook = hooks.usePage(pageRef, actCancel.appMchPage, null, "data.records")
const query = (page: number, pagesize: number) => {
pageHook.startPage(page, pagesize, false, params)
}
const doTab = (e: any) => {
params.actStatus = tabs[e].id
getCouponList()
pageRef.value && pageRef.value.reload(false)
}
const getActStatus = (actStatus: string | number) => {
return tabs.find((item: any) => item.id == actStatus)
}
// 商家查看优惠券列表
const getCouponList = async () => {
const { code, data, msg }: any = await actCancel.appMchPage(params)
if (code != 0) return uni.showToast({ title: msg || "列表获取失败", icon: "none" })
couponList.value = data ?? []
}
</script>
<style scoped>
+4 -4
View File
@@ -3,12 +3,12 @@
<view class="px-2 py-4">
<view class="card w-full h-400rpx relative activity-card overflow-hidden">
<view class="ribbon">兑换券</view>
<view class="px-10 py-4 flex justify-between font-bold">
<view class="px-8 pt-5 flex justify-between items-center font-bold">
<text class="text-32 c-#FF4F3F">限时领取</text>
<text class="text-32 c-#FF4F3F px-1 rounded-full bg-#eeeeee44">2025-09-21</text>
<text class="text-30 c-#FF4F3F px-1 rounded-full bg-#eeeeee44">2025-09-21~2025-12-20</text>
</view>
<view class="w-4/5 px-10 py-2 text-30 c-#fff">店内消费额外支付1元可领取价值89元的速干T恤1件</view>
<view class="absolute bottom-60 left-80 text-28 bg-#eeeeee44 c-#fff px-2 rounded-full">限量领取 先领先得</view>
<view class="w-4/5 px-8 pt-4 text-30 c-#fff">店内核销将会自动扣费1元并领取价值89元的速干T恤1件</view>
<view class="absolute bottom-60 left-60 text-28 bg-#eeeeee44 c-#fff px-2 rounded-full">限量领取 先领先得</view>
</view>
<view v-if="isGet" class="text-center card p-3 sub-text-30">已 领 取</view>
<view v-else class="text-center card p-3 sub-text-30" @click="doGetCoupon">立 即 领 取</view>
+16 -9
View File
@@ -51,12 +51,12 @@
</crud-layout>
<tm-modal :show="state.actModalShow" :showCancel="false" title="核销活动兑换券" zIndex="999" @confirm="" @cancel="" @close="">
<view class="text-center second-text-28">是否确认核销该活动兑换券?</view>
<view class="text-center second-text-28">确认核销将会对用户的消费钱包扣除 1元 钱</view>
<view class="text-center text-28">是否核销该活动兑换券?</view>
<view class="text-center text-28">确认核销将会对用户的 消费钱包 扣除 1元 钱</view>
<template #footer>
<view class="w-full flex justify-center gap-6">
<tm-button skin="thin" @tap="actModalCancel">取消</tm-button>
<tm-button color="primary" @tap="actModalConfirm">确认</tm-button>
<tm-button skin="thin" @tap="actModalCancel">取 消</tm-button>
<tm-button color="primary" @tap="actModalConfirm">确 认</tm-button>
</view>
</template>
</tm-modal>
@@ -272,11 +272,18 @@ const actModalShow = (v) => {
}
// 确认核销
const actModalConfirm = async () => {
const { code, msg }: any = await actCancel.appCreateActOrder(state.actVal)
if (code != 0) return uni.showToast({ title: msg || "核销失败", icon: "none" })
uni.showToast({ title: "核销成功", icon: "success" })
state.actModalShow = false
state.actVal = {}
try {
uni.showLoading({ title: "核销中...", mask: true })
const { code, msg }: any = await actCancel.appCreateActOrder(state.actVal)
if (code != 0) return uni.showToast({ title: msg || "核销失败", icon: "none" })
uni.showToast({ title: "核销成功", icon: "success" })
state.actModalShow = false
state.actVal = {}
} catch (error) {
uni.showToast({ title: "核销失败", icon: "none" })
} finally {
uni.hideLoading()
}
}
// 取消核销
const actModalCancel = () => {
+2 -1
View File
@@ -15,7 +15,8 @@ export function useScanCode(actModalShow) {
// const testQrCode = "http://192.168.101.45:8889/h5/#/pages/pay/scanPay?id=1905816751043452930&name=测试新县府超市" // 邓本地-测试环境-新县府超市收款二维码
// const testQrCode = "http://192.168.101.45:8889/h5/#/pages/pay/scanPay?hardDoorId=1913157080418295809&cabinetNo=1" // 测试智能柜柜门二维码
// const testQrCode = "eyJhY3RJZCI6IjE5NjkyNTAwOTg1MTM4MDUzMTQiLCJ0b3RhbFByaWNlIjoxfQ==" // 测试商户活动核销
const testQrCode = "eyJhY3RJZCI6IjE5NjkzMjQwNjMwNTk4Nzc4OTAiLCJ0b3RhbFByaWNlIjoxfQ==" // 测试商户活动核销
// const testQrCode = "eyJhY3RJZCI6IjE5NjkzMjQwNjMwNTk4Nzc4OTAiLCJ0b3RhbFByaWNlIjoxfQ==" // 测试商户活动核销
const testQrCode = "eyJhY3RJZCI6IjE5NjkzMjU3NDQxNDUzMDk2OTciLCJ0b3RhbFByaWNlIjoxfQ==" // 测试商户活动核销
uni.showModal({ content: "开发环境不是浙政钉和诗画环境,扫码仅供测试" })
return Promise.resolve(testQrCode)
}