From 184e200752bb7e56cf1e09bf95394b4025ef717e Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Thu, 19 Jun 2025 00:06:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8A=BD=E5=A5=96):=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=A4=A7=E8=BD=AC=E7=9B=98=E6=8A=BD=E5=A5=96=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=8F=8A=E7=A7=AF=E5=88=86=E6=B6=88=E8=80=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor(列表): 优化列表加载逻辑并支持更多数据格式 fix(钱包): 修复跳转流水页面前更新用户信息的问题 style(表单): 统一学校字段命名规范 docs(API): 新增抽奖相关接口文档 --- api/api.js | 22 +++ mixins/list.js | 4 +- mixins/loadList.js | 107 ++++++++++++ pages/index/center.vue | 2 +- pages/index/index.vue | 7 +- pages_order/auth/wxUserInfo.vue | 12 +- pages_order/marketing/turntable.vue | 328 ++++++++++++++++++++++++++++------- pages_order/mine/customerService.vue | 51 ++---- pages_order/mine/purse.vue | 4 +- 9 files changed, 423 insertions(+), 114 deletions(-) create mode 100644 mixins/loadList.js diff --git a/api/api.js b/api/api.js index 920e8f1..635da6f 100644 --- a/api/api.js +++ b/api/api.js @@ -419,6 +419,28 @@ const config = { method: 'GET', auth : true, }, + + // 新-获取我的客服信息列表 + getMyService : { + url: '/token/getMyService', + method: 'GET', + auth : true, + }, + + // 新-获取大转盘抽奖列表 + getLuckDrawList : { + url: '/token/getLuckDrawList', + method: 'GET', + auth : true, + }, + + // 新-大转盘抽奖 + luckDraw : { + url: '/token/luckDraw', + method: 'POST', + auth : true, + showLoading : true, + }, } const models = ['order'] diff --git a/mixins/list.js b/mixins/list.js index d01a425..9e55cc9 100644 --- a/mixins/list.js +++ b/mixins/list.js @@ -55,9 +55,9 @@ export default { success(res.result) - this[this.mixinsListKey || 'list'] = res.result.records + this[this.mixinsListKey || 'list'] = res.result.records || res.result - this.total = res.result.total + this.total = res.result.total || res.result.length } }) }) diff --git a/mixins/loadList.js b/mixins/loadList.js new file mode 100644 index 0000000..a2f0c81 --- /dev/null +++ b/mixins/loadList.js @@ -0,0 +1,107 @@ + + + +function query(self, queryParams){ + // return (self.beforeGetData && self.beforeGetData()) || + // queryParams || self.queryParams + + // 深度合并对象 + return self.$utils.deepMergeObject( + + self.$utils.deepMergeObject(self.queryParams, + + (self.beforeGetData && self.beforeGetData()) || {}), + + queryParams) +} + + + +export default { + data() { + return { + queryParams: { + pageNo: 1, + pageSize: 10, + }, + total : 0, + List : [], + hasMore: true, // 是否还有更多数据 + loading: false, // 是否正在加载 + } + }, + onPullDownRefresh() { + this.refreshList() + }, + onReachBottom() { + this.loadMore() + }, + onLoad() { + this.refreshList() + }, + methods: { + // 刷新列表 + refreshList() { + this.queryParams.pageNo = 1; + this.hasMore = true; + this.List = []; + this.loadList(); + }, + + // 加载更多 + loadMore() { + console.log(this.hasMore , this.loading); + + if (!this.hasMore || this.loading) return; + this.queryParams.pageNo++; + this.loadList(); + }, + + // 加载订单列表 + loadList() { + return new Promise((success, error) => { + if(!this.mixinsListApi){ + return console.error('mixinsListApi 缺失'); + } + if (this.loading) return; + + this.loading = true; + + const params = { + ...this.queryParams, + }; + + + this.$api(this.mixinsListApi, query(this, params), res => { + this.loading = false; + uni.stopPullDownRefresh(); + + if (res.code === 200 && res.result) { + + this.getDataThen && this.getDataThen(res.result.records, res.result.total, res.result) + + success(res.result) + + const newList = res.result.records || []; + this.total = res.result.total + + if (this.pageNo === 1) { + this.List = newList; + } else { + this.List = [...this.List, ...newList]; + } + + // 判断是否还有更多数据 + this.hasMore = newList.length >= this.queryParams.pageSize; + } else { + uni.showToast({ + title: res.message || '加载失败', + icon: 'none' + }); + error(res) + } + }) + }) + }, + } +} \ No newline at end of file diff --git a/pages/index/center.vue b/pages/index/center.vue index 6822459..1585c5a 100644 --- a/pages/index/center.vue +++ b/pages/index/center.vue @@ -260,7 +260,7 @@ // 检查是否有用户信息或token来判断登录状态 const token = uni.getStorageSync('token') if (token) { - this.mixinsListApi = 'getMyPostPage' + this.mixinsListApi = this.apiList[this.type] this.isLogin = true this.$store.commit('getUserInfo') this.getData() diff --git a/pages/index/index.vue b/pages/index/index.vue index 83fd4ab..0fe5fc8 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -133,7 +133,7 @@ - @@ -181,7 +181,8 @@ import sharePopup from '@/components/user/sharePopup.vue' import signInOnePopup from '@/components/user/signInOnePopup.vue' import dynamicItem from '@/components/list/dynamic/dynamicItem.vue' - import mixinsList from '@/mixins/list.js' + // import mixinsList from '@/mixins/list.js' + import mixinsList from '@/mixins/loadList.js' import { mapState } from 'vuex' @@ -250,7 +251,7 @@ } else { delete this.queryParams.classId } - this.getData() + this.refreshList() }, //订阅模版消息 onSubscribeMessageTap(){ diff --git a/pages_order/auth/wxUserInfo.vue b/pages_order/auth/wxUserInfo.vue index 9c49ae6..55a1960 100644 --- a/pages_order/auth/wxUserInfo.vue +++ b/pages_order/auth/wxUserInfo.vue @@ -87,12 +87,12 @@ + v-model="form.czSchool" /> + v-model="form.gzSchool" /> @@ -150,8 +150,8 @@ yearDate : this.$dayjs().add(-18, 'y').valueOf(),//默认满18岁 address : '', phone : '', - middleSchool: '', - highSchool: '', + czSchool: '', + gzSchool: '', }, maxDate : this.$dayjs().valueOf(), minDate : this.$dayjs().add(-100, 'y').valueOf(), @@ -247,9 +247,9 @@ this.form.address = res.result.address || this.form.address - this.form.middleSchool = res.result.middleSchool || this.form.middleSchool + this.form.czSchool = res.result.czSchool || this.form.czSchool - this.form.highSchool = res.result.highSchool || this.form.highSchool + this.form.gzSchool = res.result.gzSchool || this.form.gzSchool } }) }, diff --git a/pages_order/marketing/turntable.vue b/pages_order/marketing/turntable.vue index ffa9e63..6715abd 100644 --- a/pages_order/marketing/turntable.vue +++ b/pages_order/marketing/turntable.vue @@ -13,8 +13,20 @@ 转一转,好运来! + + + + 当前积分: + {{ userPoints }} + + + 每次消耗: + {{ drawCost }}积分 + + + - + @@ -24,8 +36,8 @@ :key="index" class="wheel-sector" :style="{ - backgroundColor: sectorColors[index], - transform: `rotate(${index * 45}deg)` + backgroundColor: sectorColors[index % sectorColors.length], + transform: `rotate(${index * sectorAngle}deg)` }" > @@ -40,9 +52,9 @@ :style="prizeStyles[index]" > - {{ prize.icon }} - {{ prize.name }} - {{ prize.value }} + {{ getIcon(prize.type) }} + {{ prize.title }} + ¥{{ prize.price }} @@ -54,19 +66,31 @@ - - {{ isSpinning ? '抽奖中...' : '开始抽奖' }} + + {{ getButtonText() }} + + + + 加载中... + + 🎉 恭喜您 🎉 - {{ currentPrize.icon }} - {{ currentPrize.name }} - {{ currentPrize.value }} + + + + + {{ currentPrize.title }} + ¥{{ currentPrize.price }} + + + {{ getPointsChangeText() }} @@ -74,29 +98,28 @@ - + - 今日剩余抽奖次数: {{ remainingSpins }} + 消耗{{ drawCost }}积分即可抽奖,快来试试手气吧!