✨ 商品详情:接入优惠劵 API
parent
0e189711a8
commit
6326cf80c5
|
|
@ -87,8 +87,12 @@
|
||||||
<button class="ss-reset-button disabled-btn" disabled> 已售罄 </button>
|
<button class="ss-reset-button disabled-btn" disabled> 已售罄 </button>
|
||||||
</view>
|
</view>
|
||||||
</detail-tabbar>
|
</detail-tabbar>
|
||||||
|
|
||||||
|
<!-- 优惠劵弹窗 -->
|
||||||
<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false"
|
<s-coupon-get v-model="state.couponInfo" :show="state.showModel" @close="state.showModel = false"
|
||||||
@get="onGet" />
|
@get="onGet" />
|
||||||
|
|
||||||
|
<!-- TODO 芋艿:待接入 -->
|
||||||
<s-activity-pop v-model="state.activityInfo" :show="state.showActivityModel"
|
<s-activity-pop v-model="state.activityInfo" :show="state.showActivityModel"
|
||||||
@close="state.showActivityModel = false" />
|
@close="state.showActivityModel = false" />
|
||||||
</block>
|
</block>
|
||||||
|
|
@ -100,6 +104,7 @@
|
||||||
import { reactive, computed } from 'vue';
|
import { reactive, computed } from 'vue';
|
||||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
|
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||||
import { formatSales, formatGoodsSwiper, fen2yuan, } from '@/sheep/hooks/useGoods';
|
import { formatSales, formatGoodsSwiper, fen2yuan, } from '@/sheep/hooks/useGoods';
|
||||||
import detailNavbar from './components/detail/detail-navbar.vue';
|
import detailNavbar from './components/detail/detail-navbar.vue';
|
||||||
import detailCellSku from './components/detail/detail-cell-sku.vue';
|
import detailCellSku from './components/detail/detail-cell-sku.vue';
|
||||||
|
|
@ -114,9 +119,6 @@
|
||||||
isEmpty
|
isEmpty
|
||||||
} from 'lodash';
|
} 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(() => {});
|
onPageScroll(() => {});
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
|
@ -125,8 +127,8 @@
|
||||||
goodsInfo: {}, // SPU 信息
|
goodsInfo: {}, // SPU 信息
|
||||||
showSelectSku: false, // 是否展示 SKU 选择弹窗
|
showSelectSku: false, // 是否展示 SKU 选择弹窗
|
||||||
selectedSku: {}, // 选中的 SKU
|
selectedSku: {}, // 选中的 SKU
|
||||||
showModel: false,
|
showModel: false, // 是否展示 Coupon 优惠劵的弹窗
|
||||||
couponInfo: [],
|
couponInfo: [], // 可领取的 Coupon 优惠劵的列表
|
||||||
showActivityModel: false,
|
showActivityModel: false,
|
||||||
activityInfo: [],
|
activityInfo: [],
|
||||||
});
|
});
|
||||||
|
|
@ -215,19 +217,14 @@
|
||||||
state.skeletonLoading = false;
|
state.skeletonLoading = false;
|
||||||
state.goodsInfo = res.data;
|
state.goodsInfo = res.data;
|
||||||
});
|
});
|
||||||
// TODO 芋艿:下面接口的调整
|
|
||||||
if (true) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 加载优惠劵信息
|
// 2. 加载优惠劵信息
|
||||||
const {
|
CouponApi.getCouponTemplateList(state.goodsId,2, 10).then((res) => {
|
||||||
error,
|
if (res.code !== 0) {
|
||||||
data
|
return;
|
||||||
} = await sheep.$api.coupon.listByGoods(state.goodsId);
|
|
||||||
if (error === 0) {
|
|
||||||
state.couponInfo = data;
|
|
||||||
}
|
}
|
||||||
|
state.couponInfo = res.data;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,15 @@ export default {
|
||||||
return request({
|
return request({
|
||||||
url: '/app-api/promotion/coupon-template/list-by-ids',
|
url: '/app-api/promotion/coupon-template/list-by-ids',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: { ids }
|
params: { ids },
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}
|
// 获得优惠劵模版列表
|
||||||
|
getCouponTemplateList: (spuId, productScope, count) => {
|
||||||
|
return request({
|
||||||
|
url: '/app-api/promotion/coupon-template/list',
|
||||||
|
method: 'GET',
|
||||||
|
params: { spuId, productScope, count },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue