From 8269f619b8f30e9f8d32c6db253a2f55f86d655b Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Fri, 21 Nov 2025 14:33:11 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=88=B8=E5=85=91=E6=8D=A2?=
=?UTF-8?q?=E7=A0=81=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pageMarket/components/choose-coupon.vue | 37 +--
pageMarket/components/coupon-list.vue | 86 +++++-
pageMarket/components/modal.vue | 136 ++++-----
pageMarket/couponExchangeCode/add.vue | 190 ++++++------
.../couponExchangeCode/components/status.vue | 52 ++++
pageMarket/couponExchangeCode/detail.vue | 280 ++++++++++++++++++
pageMarket/couponExchangeCode/index.vue | 4 +-
pages.json | 9 +-
8 files changed, 612 insertions(+), 182 deletions(-)
create mode 100644 pageMarket/couponExchangeCode/components/status.vue
create mode 100644 pageMarket/couponExchangeCode/detail.vue
diff --git a/pageMarket/components/choose-coupon.vue b/pageMarket/components/choose-coupon.vue
index 3e74159..d7197ea 100644
--- a/pageMarket/components/choose-coupon.vue
+++ b/pageMarket/components/choose-coupon.vue
@@ -7,6 +7,7 @@
-
+
- {{ item.name }}
+ {{ item.title }}
¥{{ item.lowPrice }}
+
{{ cancelText }}
@@ -47,7 +49,6 @@
\ No newline at end of file
+.choose-coupon {
+ padding: 10rpx 20rpx;
+ border-radius: 8rpx;
+ border: 1px solid #d9d9d9;
+}
+
diff --git a/pageMarket/components/modal.vue b/pageMarket/components/modal.vue
index 99916c1..5d5641d 100644
--- a/pageMarket/components/modal.vue
+++ b/pageMarket/components/modal.vue
@@ -1,84 +1,84 @@
-
-
-
+
+
-
\ No newline at end of file
+
diff --git a/pageMarket/couponExchangeCode/add.vue b/pageMarket/couponExchangeCode/add.vue
index 58b12a3..2060500 100644
--- a/pageMarket/couponExchangeCode/add.vue
+++ b/pageMarket/couponExchangeCode/add.vue
@@ -6,32 +6,47 @@
+
活动日期
-
+
+
+
+
+ 发行数量
+
+
+ 个
+
-
优惠券
-
+
- 指定时间段可用
-
-
+
+
+
+ 添加
+
@@ -47,7 +62,7 @@
import { reactive, onMounted } from "vue";
import DateTimePicker from "@/pageMarket/components/date-time-picker.vue";
import CouponList from "@/pageMarket/components/coupon-list.vue";
-import * as suggestApi from "@/http/api/market/suggest.js";
+import * as couponRedemptionApi from "@/http/api/market/couponRedemption.js";
import {
onLoad,
onReady,
@@ -57,103 +72,106 @@ import {
onBackPress,
} from "@dcloudio/uni-app";
+
+function cancel() {
+ uni.navigateBack({
+ delta: 1,
+ });
+}
+
const form = reactive({
- useStartTime: "",
- useTimeType: "all",
- useEndTime: "",
- startTime:'',
- endTime:'',
- couponInfoList: [],
+ name: "",
+ startTime: "",
+ endTime: "",
+ stock: "",
+ total: 0,
+ couponInfoList: [
+ {
+ id: "",
+ num: "",
+ title: "",
+ },
+ ],
});
function save() {
- if (!form.title) {
+ if (!form.name) {
uni.showToast({
- title: "请输入模版名称",
+ title: "请输入兑换码名称",
icon: "none",
});
return;
}
- if (form.useTimeType == "custom") {
- if (!form.useStartTime) {
- uni.showToast({
- title: "请选择开始时间",
- icon: "none",
- });
- return;
- }
- if (!form.useEndTime) {
- uni.showToast({
- title: "请选择结束时间",
- icon: "none",
- });
- return;
- }
- }
- if (form.useDays.length == 0) {
+ if (!form.startTime || !form.endTime) {
uni.showToast({
- title: "请选择可用周期",
+ title: "请选择活动日期",
icon: "none",
});
return;
}
- if (!form.foods) {
+
+ if (!form.total) {
uni.showToast({
- title: "请选择商品",
+ title: "请输入发行数量",
icon: "none",
});
return;
}
- if(options.type=='edit'){
- suggestApi
- .editSuggest({
- title: form.title,
- id: form.id,
- foods: form.foods,
- useDays: form.useDays.join(","),
- useStartTime: form.useStartTime,
- useTimeType: form.useTimeType,
- useEndTime: form.useEndTime,
- })
- .then((res) => {
- uni.showToast({
- title: "修改成功",
- icon: "none",
+ if (options.type == "edit") {
+ couponRedemptionApi
+ .editSuggest({
+ title: form.title,
+ id: form.id,
+ foods: form.foods,
+ useDays: form.useDays.join(","),
+ useStartTime: form.useStartTime,
+ useTimeType: form.useTimeType,
+ useEndTime: form.useEndTime,
+ })
+ .then((res) => {
+ uni.showToast({
+ title: "修改成功",
+ icon: "none",
+ });
+ setTimeout(() => {
+ uni.navigateBack({
+ delta: 1,
+ });
+ }, 1500);
});
- setTimeout(() => {
- uni.navigateBack({
+ return;
+ }
+ console.log('form.couponInfoList',form.couponInfoList)
+
+ //判断优惠券列表是否选择了优惠券,数量是否填写
+ if (form.couponInfoList.some((item) => !item.id || !item.num)) {
+ uni.showToast({
+ title: "请选择优惠券并填写数量",
+ icon: "none",
+ });
+ return;
+ }
+ couponRedemptionApi.add(form).then((res) => {
+ uni.showToast({
+ title: "添加成功",
+ icon: "none",
+ });
+ setTimeout(() => {
+ uni.navigateBack({
delta: 1,
});
- }, 1500);
-
- });
- return
- }
- suggestApi
- .addSuggest({
- title: form.title,
- foods: form.foods,
- useDays: form.useDays.join(","),
- useStartTime: form.useStartTime,
- useTimeType: form.useTimeType,
- useEndTime: form.useEndTime,
- })
- .then((res) => {
- uni.showToast({
- title: "添加成功",
- icon: "none",
- });
- setTimeout(() => {
- uni.navigateBack({
- delta: 1,
- });
- }, 1500);
- });
+ }, 1500);
+ });
}
-const options=reactive({})
-onLoad((opt) => {
-
-});
+function addCoupon() {
+ form.couponInfoList.push({
+ id: "",
+ num: "",
+ title: "",
+ });
+}
+const options = reactive({});
+onLoad((opt) => {});
diff --git a/pageMarket/couponExchangeCode/index.vue b/pageMarket/couponExchangeCode/index.vue
index 2b6b0e4..23add6a 100644
--- a/pageMarket/couponExchangeCode/index.vue
+++ b/pageMarket/couponExchangeCode/index.vue
@@ -204,8 +204,8 @@ function refreshList() {
}
function handleEdit(item) {
- uni.setStorageSync("suggestItem", item);
- go.to("PAGES_MARKET_ORDER_RECOMMENDATION_ADD", {
+ uni.setStorageSync("couponRedemptionItem", item);
+ go.to("PAGES_MARKET_COUPON_EXCHANGE_CODE_DETAIL", {
type: "edit",
});
}
diff --git a/pages.json b/pages.json
index 5f7539f..e363174 100644
--- a/pages.json
+++ b/pages.json
@@ -733,7 +733,14 @@
"style": {
"navigationBarTitleText": "添加券兑换码"
}
- }
+ },
+ {
+ "pageId": "PAGES_MARKET_COUPON_EXCHANGE_CODE_DETAIL",
+ "path": "couponExchangeCode/detail",
+ "style": {
+ "navigationBarTitleText": "券兑换码详情"
+ }
+ },
]