diff --git a/pages/goods/index.vue b/pages/goods/index.vue
index 1d6f6a9f..845dbc92 100644
--- a/pages/goods/index.vue
+++ b/pages/goods/index.vue
@@ -87,8 +87,12 @@
+
+
+
+
@@ -100,6 +104,7 @@
import { reactive, computed } from 'vue';
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
import sheep from '@/sheep';
+ import CouponApi from '@/sheep/api/promotion/coupon';
import { formatSales, formatGoodsSwiper, fen2yuan, } from '@/sheep/hooks/useGoods';
import detailNavbar from './components/detail/detail-navbar.vue';
import detailCellSku from './components/detail/detail-cell-sku.vue';
@@ -114,9 +119,6 @@
isEmpty
} from 'lodash';
- // import detailActivityTip from './components/detail/detail-activity-tip.vue';
- // import detailTab from './components/detail/detail-tab.vue';
- // import detailCoupon from './components/detail/detail-coupon.vue';
onPageScroll(() => {});
const state = reactive({
@@ -125,8 +127,8 @@
goodsInfo: {}, // SPU 信息
showSelectSku: false, // 是否展示 SKU 选择弹窗
selectedSku: {}, // 选中的 SKU
- showModel: false,
- couponInfo: [],
+ showModel: false, // 是否展示 Coupon 优惠劵的弹窗
+ couponInfo: [], // 可领取的 Coupon 优惠劵的列表
showActivityModel: false,
activityInfo: [],
});
@@ -161,7 +163,7 @@
state.showActivityModel = true;
}
- //立即领取 TODO 芋艿:待测试
+ // 立即领取 TODO 芋艿:待测试
async function onGet(id) {
const {
error,
@@ -215,19 +217,14 @@
state.skeletonLoading = false;
state.goodsInfo = res.data;
});
- // TODO 芋艿:下面接口的调整
- if (true) {
- return
- }
// 2. 加载优惠劵信息
- const {
- error,
- data
- } = await sheep.$api.coupon.listByGoods(state.goodsId);
- if (error === 0) {
- state.couponInfo = data;
- }
+ CouponApi.getCouponTemplateList(state.goodsId,2, 10).then((res) => {
+ if (res.code !== 0) {
+ return;
+ }
+ state.couponInfo = res.data;
+ });
});
diff --git a/sheep/api/promotion/coupon.js b/sheep/api/promotion/coupon.js
index d4e62dd5..9bdbb19e 100644
--- a/sheep/api/promotion/coupon.js
+++ b/sheep/api/promotion/coupon.js
@@ -1,12 +1,20 @@
import request from '@/sheep/request';
export default {
- // 获得优惠劵模板列表
- getCouponTemplateListByIds: (ids) => {
- return request({
- url: '/app-api/promotion/coupon-template/list-by-ids',
- method: 'GET',
- params: { ids }
- });
- }
-}
+ // 获得优惠劵模板列表
+ getCouponTemplateListByIds: (ids) => {
+ return request({
+ url: '/app-api/promotion/coupon-template/list-by-ids',
+ method: 'GET',
+ params: { ids },
+ });
+ },
+ // 获得优惠劵模版列表
+ getCouponTemplateList: (spuId, productScope, count) => {
+ return request({
+ url: '/app-api/promotion/coupon-template/list',
+ method: 'GET',
+ params: { spuId, productScope, count },
+ });
+ },
+};