diff --git a/App.vue b/App.vue
index 0c1c10b..189a16c 100644
--- a/App.vue
+++ b/App.vue
@@ -3,62 +3,57 @@
App.vue本身不是页面,这里不能编写视图元素,也就是没有
-->
\ No newline at end of file
+// 优惠券插槽公用样式
+.my-coupon-item-list {
+ padding-bottom: 28upx;
+ .my-coupon-item-item {
+ &:not(:first-child) {
+ margin-top: 28upx;
+ }
+ .my-coupon-item-row-wrap {
+ .row {
+ display: flex;
+ &:not(:first-child) {
+ margin-top: 12upx;
+ }
+ .title {
+ width: 200upx;
+ font-size: 28upx;
+ color: #666;
+ }
+ .info {
+ flex: 1;
+ font-size: 28upx;
+ color: #333;
+ }
+ }
+ }
+ }
+}
+
diff --git a/components/my-components/my-coupon-item.vue b/components/my-components/my-coupon-item.vue
new file mode 100644
index 0000000..6921e8f
--- /dev/null
+++ b/components/my-components/my-coupon-item.vue
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+ {{ item.giveNum }}
+ 总发放
+
+
+ {{ item.giftNum }}
+ 已领取
+
+
+ {{ item.useNum }}
+ 已使用
+
+
+
+ 无限
+ {{ item.leftNum }}
+
+ 剩余
+
+
+
+
+
+
+
+
+
diff --git a/components/my-components/my-footer-btn.vue b/components/my-components/my-footer-btn.vue
index b4adcb5..21c298b 100644
--- a/components/my-components/my-footer-btn.vue
+++ b/components/my-components/my-footer-btn.vue
@@ -25,7 +25,7 @@ const props = defineProps({
},
shape: {
type: String,
- default: 'squre' // squre circle
+ default: 'circle' // squre circle
}
});
diff --git a/components/my-components/my-select-goods.vue b/components/my-components/my-select-goods.vue
index 6152db7..e2670c6 100644
--- a/components/my-components/my-select-goods.vue
+++ b/components/my-components/my-select-goods.vue
@@ -141,10 +141,6 @@ function updateSelectGoods() {
}
// 确定
-const foods = defineModel('foods', {
- type: [Array, String],
- default: []
-});
function confirmHandle() {
confirmSelectGoods();
popupShow.value = false;
@@ -162,7 +158,7 @@ function confirmSelectGoods() {
});
});
- foods.value = selectGoodsCount.value.map((item) => item.id);
+ modelValue.value = selectGoodsCount.value.map((item) => item.id);
}
// 获取商品列表
@@ -170,8 +166,8 @@ async function getProductListAjax() {
try {
const res = await getProductList();
res.forEach((item, index) => {
- console.log('modelValue.value===', modelValue.value);
- console.log('index===', item.id.includes(modelValue.value));
+ // console.log('modelValue.value===', modelValue.value);
+ // console.log('index===', item.id.includes(modelValue.value));
if (modelValue.value.includes(item.id)) {
item.selected = true;
} else {
@@ -226,6 +222,13 @@ onMounted(async () => {
font-size: 28upx;
color: #999;
}
+ .t {
+ display: block;
+ max-width: 400upx;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
}
}
}
diff --git a/http/api/market/index.js b/http/api/market/index.js
index f27f64f..d23757c 100644
--- a/http/api/market/index.js
+++ b/http/api/market/index.js
@@ -35,4 +35,16 @@ export function limitTimeDiscount(data) {
method: data.id ? 'put' : 'post',
data
});
+}
+
+/**
+ * 限时折扣-分页
+ * @param {Object} params
+ */
+export function couponPage(params) {
+ return request({
+ url: `${urlType}/admin/coupon/page`,
+ method: "GET",
+ params
+ });
}
\ No newline at end of file
diff --git a/pageMarket/addCoupon/index.vue b/pageMarket/addCoupon/index.vue
new file mode 100644
index 0000000..ffe5c56
--- /dev/null
+++ b/pageMarket/addCoupon/index.vue
@@ -0,0 +1,7 @@
+
+ 添加优惠券
+
+
+
+
+
diff --git a/pageMarket/exchangeCoupon/index.vue b/pageMarket/exchangeCoupon/index.vue
new file mode 100644
index 0000000..7585594
--- /dev/null
+++ b/pageMarket/exchangeCoupon/index.vue
@@ -0,0 +1,243 @@
+
+
+
+
+
+
+
+
+
+ 赠券门槛
+ 满{{ item.fullAmount }}元赠送
+
+
+ 每人限量
+
+ 无限制
+ {{ item.useLimit }}张
+
+
+
+ 每次赠送
+
+ 无限制
+ {{ item.getLimit }}张
+
+
+
+
+
+ 使用门槛
+ 满{{ item.fullAmount }}元减{{ item.discountAmount }}元
+
+
+ 使用门槛
+ 满{{ item.fullAmount }}元可用
+
+
+ 最大折扣金额
+ 满{{ item.discountAmount }}元可用
+
+
+ 发放方式
+ 用户{{ getEmunListLabel('getType', item.getType) }}
+
+
+ 有效期
+
+ 领券后{{ item.validDays }}天过期
+ {{ item.validStartTime }}至{{ item.validEndTime }}
+
+
+
+
+ 创建时间
+ {{ item.createTime }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pageMarket/limitDiscount/add.vue b/pageMarket/limitDiscount/add.vue
index a1b6cd1..b1a7817 100644
--- a/pageMarket/limitDiscount/add.vue
+++ b/pageMarket/limitDiscount/add.vue
@@ -3,9 +3,9 @@
-
+
-
+
@@ -39,7 +39,7 @@
-
+
数值越大,排序越靠前。重复时段下,按照排序值最高的折扣使用
@@ -48,7 +48,7 @@
-
+
@@ -63,14 +63,13 @@
diff --git a/pageMarket/limitDiscount/index.vue b/pageMarket/limitDiscount/index.vue
index bb680ba..80a18c6 100644
--- a/pageMarket/limitDiscount/index.vue
+++ b/pageMarket/limitDiscount/index.vue
@@ -11,26 +11,29 @@
-
+
活动时间:
- {{ item.updateTime }}
+ {{ item.validStartTime }}至{{ item.validEndTime }}
{{ item.useDays }}
+
+ {{ convertTimeFormat(item.useStartTime) }} - {{ convertTimeFormat(item.useEndTime) }}
+
折扣:{{ item.discountRate }}%
@@ -45,6 +48,7 @@ import { reactive, ref } from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import { limitTimeDiscountPage, limitTimeDiscountDel } from '@/http/api/market/index.js';
import go from '@/commons/utils/go.js';
+import { convertTimeFormat } from '@/utils/index.js';
// 去编辑
function editorHandle(item) {
@@ -118,15 +122,21 @@ const tableData = reactive({
// 滚动到底部
onReachBottom(() => {
- tableData.page++;
- limitTimeDiscountPageAjax();
+ if (tableData.status != 'nomore') {
+ tableData.page++;
+ limitTimeDiscountPageAjax();
+ }
});
// 获取限时折扣分页
async function limitTimeDiscountPageAjax() {
try {
+ uni.showLoading({
+ title: '加载中...',
+ mask: true
+ });
const res = await limitTimeDiscountPage({
- page: 1,
+ page: tableData.page,
size: 10,
startTime: '',
endTime: ''
@@ -142,6 +152,9 @@ async function limitTimeDiscountPageAjax() {
} catch (error) {
console.log(error);
}
+ setTimeout(() => {
+ uni.hideLoading();
+ }, 500);
}
onShow(() => {
@@ -159,7 +172,7 @@ page {
diff --git a/utils/index.js b/utils/index.js
index ce2d838..8216033 100644
--- a/utils/index.js
+++ b/utils/index.js
@@ -1,3 +1,7 @@
+import dayjs from 'dayjs';
+import customParseFormat from 'dayjs/plugin/customParseFormat';
+dayjs.extend(customParseFormat); // 注册插件
+
/**
* 过滤输入,只允许数字和最多两位小数
* @param {string} value - 输入框当前值
@@ -41,4 +45,30 @@ export function filterNumberInput(value, isIntegerOnly = false) {
}
return filtered;
-}
\ No newline at end of file
+}
+
+/**
+ * 时间格式互转:HH:mm → HH:mm:ss;HH:mm:ss → HH:mm
+ * @param {string} timeStr - 输入的时间字符串
+ * @returns {string} 转换后的时间字符串
+ */
+export const convertTimeFormat = (timeStr) => {
+ if (!timeStr) return '00:00';
+
+ // 正则判断格式
+ const isHms = /^\d{1,2}:\d{2}:\d{2}$/.test(timeStr); // HH:mm:ss
+ const isHm = /^\d{1,2}:\d{2}$/.test(timeStr); // HH:mm
+
+ if (isHm) {
+ // HH:mm → 解析后格式化为 HH:mm:ss
+ return dayjs(timeStr, 'HH:mm').format('HH:mm:ss');
+ }
+
+ if (isHms) {
+ // HH:mm:ss → 解析后格式化为 HH:mm
+ return dayjs(timeStr, 'HH:mm:ss').format('HH:mm');
+ }
+
+ // 非法格式兜底
+ return '00:00';
+};
\ No newline at end of file