From 150b8b3ac7051d766f02bc26e336a68d2594e1ff Mon Sep 17 00:00:00 2001
From: dzc <2388224167@qq.com>
Date: Tue, 26 May 2026 18:24:57 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E6=94=AF=E4=BB=98=E9=80=89=E6=8B=A9?=
=?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env | 4 +-
src/pages/merchant/components/coupon-card.vue | 50 +++--
src/pages/merchant/merchant-activity.vue | 110 +++++++---
src/pages/merchant/my-act-list.vue | 28 ++-
.../pay/components/select-coupon-card.vue | 193 ++++++++++++++++++
src/pages/pay/scanPay.vue | 145 +++++++++++--
src/pages/pay/transferMoney.vue | 1 -
src/pages/tabbar/order.vue | 9 +-
src/sheep/api/act-coupon.ts | 9 +
.../base-just-flot-nav/base-just-flot-nav.vue | 1 +
.../components/base/base-nav/base-nav.vue | 1 +
.../crud/crud-layout/crud-layout.vue | 21 +-
src/sheep/components/number-keyboard.vue | 117 ++++++++---
src/sheep/constant/service-enum.ts | 1 +
src/sheep/hooks/use-scan-code.ts | 7 +-
15 files changed, 591 insertions(+), 106 deletions(-)
create mode 100644 src/pages/pay/components/select-coupon-card.vue
diff --git a/.env b/.env
index c26753f..691b9c4 100644
--- a/.env
+++ b/.env
@@ -17,9 +17,9 @@ VITE_PWD_ENC_KEY='pigxpigxpigxpigx'
VITE_OAUTH2_APP_CLIENT='mini:mini'
# --------------------------- start 开发环境 start ----------------------------------
-VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/api
+# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/api
# VITE_APP_DEV_SERVICE = http://localhost:9999
-# VITE_APP_DEV_SERVICE = https://dzc-test-1.fy.takin.cc
+VITE_APP_DEV_SERVICE = https://dzc-test-1.fy.takin.cc
# VITE_IMAGE_DEV_PATH = http://localhost:9999
# VITE_IMAGE_DEV_PATH = https://dzc-test-1.fy.takin.cc/api
diff --git a/src/pages/merchant/components/coupon-card.vue b/src/pages/merchant/components/coupon-card.vue
index 7361a6c..0d73b35 100644
--- a/src/pages/merchant/components/coupon-card.vue
+++ b/src/pages/merchant/components/coupon-card.vue
@@ -2,19 +2,25 @@
import { reactive, ref, computed } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
+import * as hooks from "@@/hooks"
import { serviceEnum } from "@@/constant"
const { actCouponTypeEnum } = serviceEnum
-const emit = defineEmits(["doVisibleQrcode"])
+const emit = defineEmits(["doVisibleQrcode", "doUse"])
-const props = withDefaults(defineProps<{ detail: any }>(), {
+const props = withDefaults(defineProps<{ mode?: 'list' | 'select', detail: any }>(), {
+ mode: "list",
detail: {},
})
const doVisibleQrcode = () => {
emit("doVisibleQrcode", { type: 'ACT_COUPON', detail: props.detail })
}
+
+const doUse = () => {
+ emit("doUse", { type: 'ACT_COUPON', detail: props.detail })
+}
@@ -31,20 +37,28 @@ const doVisibleQrcode = () => {
class="iconfont icon-weishiyong1 absolute font-size-80rpx! color-#cccccc" />
+
+
-
- ¥
- {{ detail.faceValue }}
+
+
+ 立减
+ {{ detail.faceValue }}%
+
+
+ ¥
+ {{ hooks.useMoney(detail.faceValue) }}
+
{{ detail.couponName }}
- 满{{ detail.minPoint }}可用
+ 满{{ hooks.useMoney(detail.minPoint) }}可用
+ {{ actCouponTypeEnum[detail.couponType] }}
- {{ actCouponTypeEnum[detail.couponType] }}
在{{ detail.startTime }}至{{ detail.endTime }}时间段使用
@@ -56,10 +70,18 @@ const doVisibleQrcode = () => {
-
- 核销码
- 已使用
- 已过期
+
+
+
+ 核销码
+ 去使用
+
+ 已使用
+ 已过期
+
+
+ 使用
+
@@ -117,7 +139,7 @@ const doVisibleQrcode = () => {
}
.amount {
- font-size: 48rpx;
+ font-size: 28rpx;
font-weight: bold;
margin: 0 8rpx 0 2rpx;
line-height: 1;
@@ -134,6 +156,8 @@ const doVisibleQrcode = () => {
}
.condition {
+ display: flex;
+ align-items: center;
font-size: 24rpx;
color: #0094ff;
opacity: 0.8;
@@ -188,7 +212,7 @@ const doVisibleQrcode = () => {
/* 右侧按钮区 */
.coupon-right {
- width: 160rpx;
+ width: 140rpx;
display: flex;
align-items: center;
justify-content: center;
diff --git a/src/pages/merchant/merchant-activity.vue b/src/pages/merchant/merchant-activity.vue
index daeb415..1b07652 100644
--- a/src/pages/merchant/merchant-activity.vue
+++ b/src/pages/merchant/merchant-activity.vue
@@ -1,23 +1,23 @@
-
+
兑换券
- 限时领取
-
+ 限时领取
+
{{ (state.actDetail.startTime?.split(" ")[0] || "") + "~" +
(state.actDetail.expireTime?.split(" ")[0] || "") }}
- {{ state.actDetail.actTitle }}
+ {{ state.actDetail.actTitle }}
¥{{ hooks.useMoney(state.actDetail.activeCancelPrice) }}
- ¥{{ hooks.useMoney(state.actDetail.activeOrgPrice)
+ ¥{{ hooks.useMoney(state.actDetail.activeOrgPrice)
}}
- 限量领取 先领先得
+ 限量领取 先领先得
{{ actCouponTypeEnum[state.actDetail.type] }}
- {{ state.actDetail.name }}
-
-
- {{ state.actDetail.validStartTime }}
- ~
- {{ state.actDetail.validEndTime }}
-
+ {{ state.actDetail.name }}
+
+
+ 剩余
+ {{ state.actDetail.surplusCount }}
+ /
+ {{ state.actDetail.totalCount }}
+ 张
+
+
+
+
+ 满{{ hooks.useMoney(state.actDetail.minPoint) }}元,
+
+ 立减{{ state.actDetail.faceValue }}%
+
+
+
+ 满减{{ hooks.useMoney(state.actDetail.faceValue) }}元
+
+
+ 立减{{ hooks.useMoney(state.actDetail.faceValue) }}元
-
-
+
+
领取后请在
{{ state.actDetail.validStartTime }}
~
{{ state.actDetail.validEndTime }}
时间段内使用
-
+
领取后请在
{{ state.actDetail.validDays }}
天内使用
+ class="m-l-20rpx m-y-20rpx w-55% text-28rpx bg-#eeeeee44 c-#fff p-16rpx rounded-16rpx">
{{ state.actDetail.description }}
@@ -75,7 +90,7 @@
我的礼券
-
+
@@ -87,10 +102,8 @@ import { reactive, ref, nextTick } from "vue"
import { onLoad } from "@dcloudio/uni-app"
import { actCancel, actComApi, actCouponApi, userApi } from "@/sheep/api"
-import * as hooks from "@@/hooks"
-import * as router from "@@/router"
-import { serviceEnum, storageConstant, SERVICE_IMAGE } from "@@/constant"
-import { filePath } from "@@/utils/file"
+import { hooks, router } from "@/sheep"
+import { serviceEnum, storageConstant } from "@@/constant"
import ModifyUser from "@@/components/modify-user.vue"
@@ -249,18 +262,10 @@ const modifyUserClose = () => {
background-image: url("../../static/page/activity-card-bg.png");
background-repeat: no-repeat;
background-size: contain;
- background-position: 150%;
+ background-position: 130%;
background-color: #1879ff77;
}
-.activity-sr-card {
- /* background-image: url("../../static/page/act_li_quan.jpg");
- background-repeat: no-repeat;
- background-size: contain;
- background-position: 150%;
- background-color: red; */
-}
-
.ribbon {
width: 160rpx;
height: 40rpx;
@@ -273,4 +278,47 @@ const modifyUserClose = () => {
color: #fff;
font-size: 24rpx;
}
+
+.coupon-stock-badge {
+ display: flex;
+ align-items: center;
+ padding: 8rpx 18rpx;
+ border-radius: 9999rpx;
+ background: rgba(238, 238, 238, 0.28);
+ backdrop-filter: blur(2px);
+ color: #fff;
+}
+
+.coupon-stock-dot {
+ width: 12rpx;
+ height: 12rpx;
+ margin-right: 10rpx;
+ border-radius: 9999rpx;
+ background: #0094ff;
+}
+
+.coupon-stock-label,
+.coupon-stock-unit,
+.coupon-stock-split,
+.coupon-stock-total {
+ font-size: 24rpx;
+ line-height: 1;
+}
+
+.coupon-stock-value {
+ margin: 0 4rpx 0 8rpx;
+ font-size: 24rpx;
+ font-weight: 700;
+ line-height: 1;
+}
+
+.coupon-stock-total {
+ margin-left: 4rpx;
+ opacity: 0.9;
+}
+
+.coupon-stock-unit {
+ margin-left: 6rpx;
+ opacity: 0.9;
+}
diff --git a/src/pages/merchant/my-act-list.vue b/src/pages/merchant/my-act-list.vue
index df2e2ea..3786bd6 100644
--- a/src/pages/merchant/my-act-list.vue
+++ b/src/pages/merchant/my-act-list.vue
@@ -2,15 +2,13 @@
import { reactive, ref, computed } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
-import * as router from "@@/router"
-import { SERVICE_IMAGE } from "@@/constant/index"
-import { filePath } from "@@/utils/file"
+import { router } from "@/sheep"
import uqrcode from "@@/utils/uqrcode"
import * as CryptoJS from "crypto-js"
import { actCancel, actComApi, actCouponApi, applyApi } from "@@/api"
-import * as hooks from "@@/hooks"
+import { hooks } from "@/sheep"
import { serviceEnum } from "@@/constant"
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
@@ -20,6 +18,8 @@ import CouponCard from "./components/coupon-card.vue"
const { actCouponTypeEnum } = serviceEnum
+const { scanCodeAction, processUrlScanResult, processBase64ScanResult } = hooks.useScanCode(false)
+
const pageRef = ref(null)
const showQrCodeDialog = ref(false)
@@ -72,6 +72,22 @@ const doTab = (e: any) => {
getUserTotal()
}
+// 去使用
+const doUse = async (detail: any) => {
+ const { type, detail: actDetail } = detail
+ console.log("去使用:", type, actDetail);
+ const scanResult = await scanCodeAction()
+ if (!scanResult) return uni.showToast({ title: "扫码错误", icon: "none" })
+ // 判断扫码结果
+ if (scanResult.startsWith("http")) {
+ // 扫码结果是url链接
+ processUrlScanResult(scanResult.replace("/#", ""))
+ } else {
+ // 扫码结果是base64字符串
+ processBase64ScanResult(scanResult)
+ }
+}
+
const doVisibleQrcode = async (detail: any) => {
const { type, detail: actDetail } = detail
console.log("生成二维码:", type, actDetail);
@@ -143,7 +159,7 @@ const genVerificationCode = async (params: Record) => {
-
+
) => {
+ @do-visible-qrcode="doVisibleQrcode" @doUse="doUse" />
+import * as hooks from "@@/hooks"
+
+const emit = defineEmits(["doSelect"])
+
+const props = withDefaults(defineProps<{ selectId?: any, detail: any, disabled?: boolean }>(), {
+ selectId: null,
+ detail: {},
+ disabled: false,
+})
+
+const doSelect = () => {
+ if (props.disabled) return
+ emit("doSelect", { type: 'ACT_COUPON', detail: props.detail })
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 立减
+ {{ detail.faceValue }}%
+
+
+ ¥
+ {{ hooks.useMoney(detail.faceValue) }}
+
+
+ {{ detail.couponName }}
+
+
+ 满{{ hooks.useMoney(detail.minPoint) }}可用
+
+
+
+
+
+
+
+
+
+
+
+ {{ disabled ? "不可用" : "使用" }}
+
+
+
+
+
diff --git a/src/pages/pay/scanPay.vue b/src/pages/pay/scanPay.vue
index ace0753..920f85a 100644
--- a/src/pages/pay/scanPay.vue
+++ b/src/pages/pay/scanPay.vue
@@ -1,19 +1,32 @@
-
+
-
- ¥
- {{ displayAmount }}
+
+
+ ¥
+ {{ displayAmount }}
+
+
+
+ 已优惠 ¥{{ couponDiscountDisplay }}
+
+
+ 券后实付
+ ¥{{ couponPayableDisplay }}
+
+
+
+ {{ couponUnavailableText }}
+
-
选择支付钱包:
-
+
{{ v.walletTypeName }}
@@ -22,29 +35,36 @@
-
+
+ 选择优惠券:
+
+
+
支 付
-
+
diff --git a/src/sheep/components/base/base-nav/base-nav.vue b/src/sheep/components/base/base-nav/base-nav.vue
index 8abe551..03e9841 100644
--- a/src/sheep/components/base/base-nav/base-nav.vue
+++ b/src/sheep/components/base/base-nav/base-nav.vue
@@ -46,6 +46,7 @@ function doBackClick() {
}
function doToDashboard() {
+ tabbarStore.setRootActiveIndex(0)
router.jump("/pages/root/dashboard", {}, 3)
}
diff --git a/src/sheep/components/crud/crud-layout/crud-layout.vue b/src/sheep/components/crud/crud-layout/crud-layout.vue
index d0bc0c3..5588aa8 100644
--- a/src/sheep/components/crud/crud-layout/crud-layout.vue
+++ b/src/sheep/components/crud/crud-layout/crud-layout.vue
@@ -182,16 +182,17 @@ defineExpose({
-
diff --git a/src/sheep/components/number-keyboard.vue b/src/sheep/components/number-keyboard.vue
index d811045..15390d3 100644
--- a/src/sheep/components/number-keyboard.vue
+++ b/src/sheep/components/number-keyboard.vue
@@ -1,33 +1,35 @@
-
-
-
-
-
-
-
- {{ key }}
+
+
+
+
-
-
-
- .
-
-
- 0
-
-
-
+
+
+
+ {{ key }}
+
+
+
+
+ .
+
+
+ 0
+
+
+
+
+
@@ -45,6 +47,10 @@ const keyboardLayout = ref([
])
const show = ref(true)
+const toggleShow = () => {
+ show.value = !show.value
+}
+
// 按下键盘
const handleKeyPress = (key) => {
if (key === "." && amount.value.includes(".")) return
@@ -74,3 +80,58 @@ const handleDelete = () => {
}
}
+
+
diff --git a/src/sheep/constant/service-enum.ts b/src/sheep/constant/service-enum.ts
index 7ec32ca..01cbbb8 100644
--- a/src/sheep/constant/service-enum.ts
+++ b/src/sheep/constant/service-enum.ts
@@ -76,6 +76,7 @@ const actUserReceiveEnum = {
"4": "已领取,核销码在我的礼券中",
"5": "用户不能参加此活动",
"6": "其他错误",
+ "7": "已领完",
"99": "用户可以参加活动",
// 特殊
"-100": "仅限生日当月使用",
diff --git a/src/sheep/hooks/use-scan-code.ts b/src/sheep/hooks/use-scan-code.ts
index 0ec1260..73c5500 100644
--- a/src/sheep/hooks/use-scan-code.ts
+++ b/src/sheep/hooks/use-scan-code.ts
@@ -1,8 +1,13 @@
import { router } from ".."
-import { getUrlParamsObj } from "../utils/app"
+import { getUrlParamsObj, isDevEnv } from "../utils/app"
export function useScanCode(actModalShow) {
async function scanCodeAction(): Promise {
+ if (isDevEnv()) {
+ const testQrCode = "https://stgl.pj.gov.cn/h5/#/pages/pay/scanPay?id=1931916121241079810"
+ uni.showModal({ content: "开发环境不是浙政钉和诗画环境,扫码仅供测试" })
+ return Promise.resolve(testQrCode)
+ }
const scanResult = await new Promise((resolve, reject) => {
uni.scanCode({
success: (res) => {