From 39ececc902ff22b3cf1ebaee4cb5667535b69cfa Mon Sep 17 00:00:00 2001 From: wangzimeng <3297159934@qq.com> Date: Tue, 29 Jul 2025 16:22:14 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E9=A6=96=E9=A1=B5=E7=9A=84=E8=BD=AE?= =?UTF-8?q?=E6=92=AD=E5=9B=BE=E7=9A=84=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/coupon/list.vue | 154 +++++++++++++++++++++++++++--------------- pages/index/index.vue | 23 +++++-- sheep/api/coupon.js | 90 ++++++++++++------------ sheep/api/home.js | 10 +++ sheep/api/index.js | 2 + 5 files changed, 175 insertions(+), 104 deletions(-) create mode 100644 sheep/api/home.js diff --git a/pages/coupon/list.vue b/pages/coupon/list.vue index f6c6f79..b1c5192 100644 --- a/pages/coupon/list.vue +++ b/pages/coupon/list.vue @@ -6,7 +6,7 @@ - + - + - 50 - 满减券 + {{item.amount}} + {{item.type_text}} - 满100减50 - 仅限原料商城可用 + {{item.name}} + 仅限原料商城可用 + - 去使用 + 去使用 - + - + - 1 + {{e.mobile_number}} 次数券 - 增加拨打次数 - 仅限增加拨打次数使用 + {{e.name}} + + 仅限增加拨打次数使用 - 去使用 + 去使用 - + - + - - + + - 暂无数据信息 + + 暂无数据信息 - + - - + + - + @@ -86,7 +91,7 @@ status: 1, }) const tabMaps = [{ - name: '优惠券', + name: '满减券', value: '1', }, { @@ -102,8 +107,16 @@ currentTab.value = e.index console.log('切换tabs', currentTab.value); listQuery.value.status = e.value - couponList.value = [] - getCouponList(); + listQuery.value.page = 1; + listQuery.value.limit = 10; + listQuery.value.list_rows = 10 + couponFullList.value = [] + couponTimesCount.value = [] + if (currentTab.value == 0) { + getCouponFullList(); + } else { + getCouponTimesList(); + } } //页面跳转 @@ -114,21 +127,21 @@ } - //满减券 - const couponList = ref([]) - const couponCount = ref(0) + /* 满减券 */ + const couponFullList = ref([]) + const couponFullCount = ref(0) const homrS = ref(false) - async function getCouponList() { - const res = await sheep.$api.app.scoreShop.fullList({ + async function getCouponFullList() { + const res = await sheep.$api.coupon.userCoupon({ page: listQuery.value.page, - limit: listQuery.value.limit, - status: listQuery.value.status, - order: 'normal' + list_rows: listQuery.value.list_rows, + add_type: 'reduce', + type: 'geted' }); if (res.code === 1) { - couponList.value = [...couponList.value, ...res.data.list]; - couponCount.value = res.data.count; - score.value = res.data.score + couponFullList.value = [...couponFullList.value, ...res.data.data]; + couponFullCount.value = res.data.total; + console.log('满减券',couponFullList.value,couponFullList.value[0]); } else { uni.showToast({ title: res.msg, @@ -136,6 +149,36 @@ }) } } + /* 次数券 */ + const couponTimesList = ref([]) + const couponTimesCount = ref(0) + async function getCouponTimesList() { + const res = await sheep.$api.coupon.userTimesList({ + page: listQuery.value.page, + limit: listQuery.value.limit, + status: 1, + order: 'normal' + }); + if (res.code === 1) { + couponTimesList.value = [...couponTimesList.value, ...res.data.list]; + couponTimesCount.value = res.data.count; + // score.value = res.data.score + } else { + uni.showToast({ + title: res.msg, + icon: 'none' + }) + } + } + + /* 使用券 */ + function toUseFull(item) { + + } + function toUseTimes(e) { + + } + //加载更多 function onScrolltolower() { if (couponList.value.length < couponCount.value) { @@ -163,9 +206,9 @@ couponList.value = []; getCouponList(); } - + onLoad(() => { - getCouponList(); + getCouponFullList(); }); @@ -175,32 +218,32 @@ font-size: 60rpx; line-height: 60rpx; } - + .fslh28 { font-size: 28rpx; line-height: 28rpx; } - + .fs32 { font-size: 32rpx; } - + .justify-center { justify-content: center; } - + .align-center { align-items: center; } - + .flex { display: flex; } - + .grid { display: grid; } - + .fs60 { font-size: 60rpx; } @@ -212,7 +255,7 @@ .bold { font-weight: bold; } - + .regular { font-weight: 400; } @@ -220,7 +263,7 @@ .c3 { color: #333333; } - + .c3D { color: #3d3d3d; } @@ -232,11 +275,10 @@ .container { background-color: #f7f7f7; height: 100vh; - + .exChangeBox { // background-color: #f7f7f7; width: 690rpx; - margin-top: 30rpx; .couponsList { width: 100%; @@ -256,7 +298,7 @@ background-size: 100%; display: flex; justify-content: space-between; - + .itemLeft { width: 84rpx; height: 103rpx; @@ -265,7 +307,7 @@ justify-content: center; align-items: center; } - + .itemRight { width: 446rpx; height: 103rpx; @@ -273,7 +315,7 @@ display: flex; justify-content: space-between; align-items: center; - + .item-RightLeft { // width: 84rpx; // height: 103rpx; @@ -282,7 +324,7 @@ justify-content: flex-start; align-items: center; } - + .item-btn { width: 160rpx; height: 70rpx; @@ -296,9 +338,9 @@ font-weight: bold; color: #333333; } - + } - + .item-text { padding: 30rpx; diff --git a/pages/index/index.vue b/pages/index/index.vue index 230745e..081c18e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -50,24 +50,24 @@ + @animationfinish="swiperChange" v-for="(item, index) in bannerList" :key="index"> - + - + - + + @click="click(item.url)" 跳转活动链接 - + --> @@ -227,6 +227,7 @@ onLoad((options) => { getList(); + getBanner(); // #ifdef MP // 小程序识别二维码 if (options.scene) { @@ -260,6 +261,16 @@ }); onPageScroll(() => {}); + + const bannerList = ref([]) + async function getBanner() { + const res = await sheep.$api.home.homeBanner({}); + console.log('banner',res); + if(res.code == 1) { + bannerList.value = res.data.list + } + + } const toPage = (e) => { diff --git a/sheep/api/coupon.js b/sheep/api/coupon.js index 8e82cf9..7553cdb 100644 --- a/sheep/api/coupon.js +++ b/sheep/api/coupon.js @@ -1,45 +1,51 @@ import request from '@/sheep/request'; export default { - // 优惠券 - list: (params) => - request({ - url: 'coupon', - method: 'GET', - params, - custom: { - showLoading: false, - }, - }), - userCoupon: (params) => - request({ - url: 'user.coupon', - method: 'GET', - params, - }), - detail: (id, user_coupon_id) => - request({ - url: 'coupon/detail', - method: 'GET', - params: { - id: id, - user_coupon_id, - }, - }), - get: (id) => - request({ - url: 'coupon/get', - method: 'POST', - params: { - id: id, - }, - }), - listByGoods: (id) => - request({ - url: 'coupon/listByGoods', - method: 'GET', - params: { - goods_id: id, - }, - }), -}; + // 优惠券 + list: (params) => + request({ + url: 'coupon', + method: 'GET', + params, + custom: { + showLoading: false, + }, + }), + userCoupon: (params) => + request({ + url: 'user.coupon', + method: 'GET', + params, + }), + userTimesList: (params) => + request({ + url: 'meal.score/mobile_list', + method: 'GET', + params, + }), + detail: (id, user_coupon_id) => + request({ + url: 'coupon/detail', + method: 'GET', + params: { + id: id, + user_coupon_id, + }, + }), + get: (id) => + request({ + url: 'coupon/get', + method: 'POST', + params: { + id: id, + }, + }), + listByGoods: (id) => + request({ + url: 'coupon/listByGoods', + method: 'GET', + params: { + goods_id: id, + }, + }), +}; \ No newline at end of file diff --git a/sheep/api/home.js b/sheep/api/home.js new file mode 100644 index 0000000..13bc610 --- /dev/null +++ b/sheep/api/home.js @@ -0,0 +1,10 @@ +import request from '@/sheep/request'; + +export default { + homeBanner: (params) => + request({ + url: 'home/homeImages', + method: 'GET', + params, + }) +}; \ No newline at end of file diff --git a/sheep/api/index.js b/sheep/api/index.js index 27561df..4e2a9f0 100644 --- a/sheep/api/index.js +++ b/sheep/api/index.js @@ -14,6 +14,7 @@ import trade from "./trade" import user from "./user" import rent from "./rent" import school from "./school" +import home from "./home" export default { activity, @@ -32,5 +33,6 @@ export default { user, rent, school, + home, }