diff --git a/pages/coupon/list.vue b/pages/coupon/list.vue
index 4833d38b..566195bf 100644
--- a/pages/coupon/list.vue
+++ b/pages/coupon/list.vue
@@ -1,265 +1,231 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
+ }" @tap="loadMore" />
+
\ No newline at end of file
+ .disabled-btn {
+ background: #cccccc;
+ background-color: #cccccc !important;
+ color: #fff !important;
+ }
+
diff --git a/pages/index/search.vue b/pages/index/search.vue
index 3e9b7fcd..84972987 100644
--- a/pages/index/search.vue
+++ b/pages/index/search.vue
@@ -1,3 +1,4 @@
+
@@ -33,14 +34,18 @@
import { reactive } from 'vue';
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
+
const state = reactive({
historyList: [],
});
// 搜索
function onSearch(keyword) {
- if (!keyword) return;
+ if (!keyword) {
+ return;
+ }
saveSearchHistory(keyword);
+ // 前往商品列表(带搜索条件)
sheep.$router.go('/pages/goods/list', { keyword });
}
@@ -53,7 +58,7 @@
// 置顶关键词
state.historyList.unshift(keyword);
- // 最多保留10条记录
+ // 最多保留 10 条记录
if (state.historyList.length >= 10) {
state.historyList.length = 10;
}
@@ -72,6 +77,7 @@
},
});
}
+
onLoad(() => {
state.historyList = uni.getStorageSync('searchHistory') || [];
});
diff --git a/sheep/api/coupon.js b/sheep/api/coupon.js
index 3f5e8e6e..95fd11c8 100644
--- a/sheep/api/coupon.js
+++ b/sheep/api/coupon.js
@@ -12,18 +12,7 @@ export default {
showLoading: false,
},
}),
- userCoupon: (params) =>
- request2({
- url: 'promotion/coupon/page',
- method: 'GET',
- params,
- }),
- // userCoupon: (params) =>
- // request({
- // url: 'user/coupon',
- // method: 'GET',
- // params,
- // }),
+
detail: (id, user_coupon_id) =>
request({
url: 'coupon/' + id,
@@ -37,9 +26,4 @@ export default {
url: 'coupon/get/' + id,
method: 'POST',
}),
- listByGoods: (id) =>
- request({
- url: 'coupon/listByGoods/' + id,
- method: 'GET',
- }),
};
\ No newline at end of file
diff --git a/sheep/api/promotion/coupon.js b/sheep/api/promotion/coupon.js
index 9bdbb19e..9ff66d2b 100644
--- a/sheep/api/promotion/coupon.js
+++ b/sheep/api/promotion/coupon.js
@@ -1,6 +1,6 @@
import request from '@/sheep/request';
-export default {
+const CouponApi = {
// 获得优惠劵模板列表
getCouponTemplateListByIds: (ids) => {
return request({
@@ -17,4 +17,30 @@ export default {
params: { spuId, productScope, count },
});
},
+ // 获得优惠劵模版分页
+ getCouponTemplatePage: (params) => {
+ return request({
+ url: '/app-api/promotion/coupon-template/page',
+ method: 'GET',
+ params,
+ });
+ },
+ // 我的优惠劵列表
+ getCouponPage: (params) => {
+ return request({
+ url: '/app-api/promotion/coupon/page',
+ method: 'GET',
+ params,
+ });
+ },
+ // 领取优惠券
+ takeCoupon: (templateId) => {
+ return request({
+ url: '/app-api/promotion/coupon/take',
+ method: 'POST',
+ data: { templateId },
+ });
+ },
};
+
+export default CouponApi;
\ No newline at end of file
diff --git a/sheep/components/s-coupon-list/s-coupon-list.vue b/sheep/components/s-coupon-list/s-coupon-list.vue
index 648b32da..bb7f8081 100644
--- a/sheep/components/s-coupon-list/s-coupon-list.vue
+++ b/sheep/components/s-coupon-list/s-coupon-list.vue
@@ -1,195 +1,210 @@
-
-
-
-
-
- {{ data.name }}
-
-
- ¥
- {{ data.amount }}
- 折
-
-
-
-
-
- {{'有效期:' + data.use_start_time.substring(0, 11) }}至
- {{ data.use_end_time.substring(0, 11) }}
-
-
- 满{{ data.enough }}可用
-
-
-
+ :class="isDisable ? 'disabled-bg-color' : 'info-bg-color'"
+ >
+ {{ data.discountType === 1 ? '满减券' : '折扣券' }}
+
+
+
+
+ {{ data.name }}
+
+
+
+ ¥
+
+ {{
+ data.discountType === 1
+ ? fen2yuan(data.discountPrice)
+ : data.discountPercent / 10.0
+ }}
+
+ 折
+
+
+
+
+
+ 有效期:领取后 {{ data.fixedEndTerm }} 天内可用
+
+
+ 有效期: {{ sheep.$helper.timeFormat(data.validStartTime, 'yyyy-mm-dd') }} 至
+ {{ sheep.$helper.timeFormat(data.validEndTime, 'yyyy-mm-dd') }}
+
+
+ 满 {{ fen2yuan(data.usePrice) }} 可用
+
+
+
+
-
-
-
- {{ data.description }}
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {{ data.description }}
+
+
+
+
+
+
+
+
+
\ No newline at end of file