diff --git a/components/RankingPopup.vue b/components/RankingPopup.vue new file mode 100644 index 0000000..d174f86 --- /dev/null +++ b/components/RankingPopup.vue @@ -0,0 +1,997 @@ + + + + + diff --git a/components/RankingPopupExample.vue b/components/RankingPopupExample.vue new file mode 100644 index 0000000..2e4d364 --- /dev/null +++ b/components/RankingPopupExample.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/components/noticePopup.vue b/components/noticePopup.vue index 49884e5..91e2827 100644 --- a/components/noticePopup.vue +++ b/components/noticePopup.vue @@ -19,7 +19,6 @@
- @@ -42,12 +41,12 @@ export default { } }, mounted() { - this.getUserTc() + // this.getUserTc() }, methods: { closeTap() { this.noticeFlag = false - // this.$emit("getTree"); + this.$emit('close') }, getUserTc(data) { api @@ -63,6 +62,8 @@ export default { if (items == this.publishLocationIndex) { this.noticeFlag = true this.content = res.data[0] + } else { + this.$emit('close') } }) } diff --git a/components/region-select/index.vue b/components/region-select/index.vue index 59824a0..4679daa 100644 --- a/components/region-select/index.vue +++ b/components/region-select/index.vue @@ -101,20 +101,24 @@ export default { if (!this.autoTrigger) { return } - uni.showLoading({ - title: '加载中...', - }) - this.getRegionSelect() - .then(selectedList => { - this.selectedList = selectedList - const area = selectedList.shift() - this.open(area) - }) - .catch(() => { - uni.hideLoading() - }) + this.init() }, methods: { + init() { + uni.showLoading({ + title: '加载中...', + }) + this.getRegionSelect() + .then(selectedList => { + this.selectedList = selectedList + const area = selectedList.shift() + this.open(area) + }) + .catch(() => { + this.$emit('success') + uni.hideLoading() + }) + }, async getRegionSelect() { return new Promise(async (resolve, reject) => { try { @@ -125,7 +129,6 @@ export default { .filter(key => res.data[key]) .filter(key => !res.data?.data?.[`${key}Data`]) .reverse() - console.log(needSelected, 'needSelected') if ( needSelected?.length && Object.keys(res.data?.data || {}).length < needSelected?.length @@ -274,6 +277,7 @@ export default { throw new Error(res.message || 'Failed to set region') } } catch (error) { + this.$emit('success') console.error('Failed to set region:', error) } }, diff --git a/config/index.js b/config/index.js index 5d2d869..3525b65 100644 --- a/config/index.js +++ b/config/index.js @@ -1,19 +1,30 @@ - const http = uni.$u.http //首页 -export const userIndex = (params) => http.get('/sale/api/wares/get-app-index', { params }) +export const userIndex = params => + http.get('/sale/api/wares/get-app-index', { params }) //修改头像 -export const updateHead = (data) => http.post('/member/api/member/update-head', data) +export const updateHead = data => + http.post('/member/api/member/update-head', data) //提货记录列表 -export const pickList = (params) => http.get('/activity/api/pick/list', { params }) +export const pickList = params => + http.get('/activity/api/pick/list', { params }) //提货专区列表 -export const pickLogList = (params) => http.get('/activity/api/pick/pick-log', { params }) +export const pickLogList = params => + http.get('/activity/api/pick/pick-log', { params }) //植树活动 -export const queryTreeActivity = (params) => http.get('/activity/api/sa-tree-order/queryTreeActivity', { params }) +export const queryTreeActivity = params => + http.get('/activity/api/sa-tree-order/queryTreeActivity', { params }) //创客空间列表 -export const marketList = (params) => http.get('/member/api/maker-space/list', { params }) \ No newline at end of file +export const marketList = params => + http.get('/member/api/maker-space/list', { params }) + +export const getTopPeople = params => + http.post('/member/api/member-statistics/topPeople', params) + +export const getTopAmount = params => + http.post('/member/api/member-statistics/topAmount', params) diff --git a/config/request.js b/config/request.js index 4b3290c..de3f61c 100644 --- a/config/request.js +++ b/config/request.js @@ -57,7 +57,6 @@ module.exports = vm => { // 响应拦截 uni.$u.http.interceptors.response.use( response => { - console.log(response, '......response') const data = response.data // uni.$u.toast(data.msg) // if (data.code == 200) { diff --git a/pages/index/index.vue b/pages/index/index.vue index 576377e..71006c1 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -27,6 +27,7 @@ + @@ -54,7 +55,7 @@
- + +
- +
@@ -107,6 +112,7 @@ import { mapGetters } from 'vuex' import RegionSelect from '@/components/region-select/index.vue' import RaisedTabbar from '@/components/raised-tabbar.vue' import GoodsList from '@/components/goods-list.vue' +import RankingPopup from '@/components/RankingPopup.vue' export default { components: { noticePopup, @@ -116,6 +122,7 @@ export default { areaProductList, RegionSelect, GoodsList, + RankingPopup, }, filters: { seles(value) { @@ -128,6 +135,7 @@ export default { }, data() { return { + rankingComplete: false, newShareMember: false, promptFlag: false, promptMsg: '', @@ -353,6 +361,7 @@ export default { // this.getLanguage(); this.getService() + // this.showRankingPopups() }, onShow() { this.$store.dispatch('getCarLength') @@ -360,6 +369,10 @@ export default { this.user = uni.getStorageSync('User') this.getAreaGoods() this.newShareMember = this.user?.loginType !== 0 + if (this.user.memberCode !== 'BD68880628') { + console.log('init') + this.$refs.regionSelect.init() + } }) }, onPullDownRefresh() { @@ -379,6 +392,33 @@ export default { } }, + // 显示排行榜弹窗 + async showRankingPopups() { + try { + this.$nextTick(async () => { + await this.$refs.rankingPopup.showRankingPopups() + }) + } catch (error) { + console.error('显示排行榜失败:', error) + uni.showToast({ + title: '加载排行榜失败', + icon: 'error', + }) + } + }, + + // 排行榜查看完成回调 + handleRankingComplete() { + this.rankingComplete = true + this.$refs.child.getUserTc() + }, + regionSelectSuccess() { + if (this.rankingComplete) { + return + } + this.showRankingPopups() + }, + goAreaUrl() { ban.agreementName().then(res => { if (res.data == 0) { @@ -450,15 +490,11 @@ export default { } }) }, - callChildMethod() { - this.$refs.child.getUserTc() - }, callznMethod() { this.$refs.child2.getUserTc2() }, - // 植树弹层 - getTree() { - this.$refs.tree.getData() + noticePopupHandleClose() { + // this.$refs.regionSelect.getRegionSelect() }, isEmpty(v) { switch (typeof v) { @@ -619,6 +655,37 @@ export default { height: 100%; } } + +// 排行榜入口样式 +.ranking-entry { + padding: 20rpx 30rpx; + + .ranking-btn { + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + border-radius: 25rpx; + padding: 20rpx 30rpx; + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 4rpx 12rpx rgba(102, 126, 234, 0.3); + + .ranking-icon { + font-size: 32rpx; + margin-right: 12rpx; + } + + .ranking-text { + color: #fff; + font-size: 28rpx; + font-weight: bold; + } + + &:active { + transform: scale(0.98); + transition: transform 0.1s ease; + } + } +} .content1 { background: url('~@/static/images/fBgd.jpg') no-repeat; background-size: 100% 100%; diff --git a/pages/other/index.vue b/pages/other/index.vue index d4364f9..240b809 100644 --- a/pages/other/index.vue +++ b/pages/other/index.vue @@ -20,7 +20,12 @@
--> - + - + { - deleteList.push({ - shoppingId: item, + return new Promise((resolve, reject) => { + let deleteList = [] + this.shoppingArr.forEach(item => { + deleteList.push({ + shoppingId: item, + }) }) - }) - this.allGoodsData.deleteList = deleteList - this.allGoodsData.upgradeMemberCode = this.form.upgradeMemberCode + this.allGoodsData.deleteList = deleteList + this.allGoodsData.upgradeMemberCode = this.form.upgradeMemberCode - api.memLevel(this.allGoodsData).then(res => { - if (res.data.isEnough) { - console.log(res.data, 'res.data...memLevel') - this.form.pkGradeVal = res.data.pkGradeVal - } else { - this.isLoading.close() - } + api + .memLevel(this.allGoodsData) + .then(res => { + if (res.data.isEnough) { + this.form.pkGradeVal = res.data.pkGradeVal + resolve() + } else { + this.isLoading.close() + reject() + } + }) + .catch(err => { + reject(err) + }) }) }, addAdress() { @@ -827,34 +846,60 @@ export default { // 升级编号获取name upgradeMemberCodePass(rule, value, callback) { if (!value) { - callback(new Error('请输入会员编号')) - } else { + return callback(new Error('请输入会员编号')) + } + callback() + // else { + + // api + // .upgRel({ + // upgradeMemberCode: value, + // }) + // .then(res => { + // if (res.code == 200) { + // this.form.upgradeMemberName = res.data.upgradeMemberName + // if ( + // this.specialArea == 2 || + // this.specialArea == 25 || + // this.specialArea == 27 + // ) { + // this.getMember() + // } + // this.$forceUpdate() + // callback() + // } else { + // callback(new Error(res.msg)) + // } + // }) + // .catch(err => { + // callback(new Error(err)) + // }) + // } + }, + getMemberName(val) { + return new Promise((resolve, reject) => { + const promiseResolve = resolve + const promiseReject = reject api .upgRel({ - upgradeMemberCode: value, + upgradeMemberCode: val || this.form.upgradeMemberCode, }) .then(res => { - if (res.code == 200) { + if (res.code === 200) { + promiseResolve() this.form.upgradeMemberName = res.data.upgradeMemberName - if ( - this.specialArea == 2 || - this.specialArea == 25 || - this.specialArea == 27 - ) { - this.getMember() - } this.$forceUpdate() - callback() } else { - callback(new Error(res.msg)) + promiseReject() } }) - .catch(err => { - callback(new Error(err)) - }) - } + }) + }, + upgradeMemberCodeHandleCb(val) { + this.getMemberName(val).then(() => { + this.getMember() + }) }, - sureCk(e) { const { value } = e this.form.pkStorehouse = value[0].id @@ -1017,16 +1062,8 @@ export default { uni.setStorageSync('mToken', res.msg) }) }, - goBuy() { - this.$refs.uForm.validate().then(res => { - if (this.agreementShow.length == 0) { - uni.showToast({ - title: '请阅读并同意购买协议', - icon: 'none', - duration: 1500, - }) - return - } + async goBuy() { + this.$refs.uForm.validate().then(async res => { if (this.specialArea == 31) { if (this.totalAmont < 1000) { uni.showToast({ @@ -1038,6 +1075,14 @@ export default { } } this.isLoading = true + try { + await this.getMemberName() + await this.getMember() + } catch (err) { + this.isLoading = false + return + } + let deleteList = [] this.shoppingArr.forEach(item => { deleteList.push({ diff --git a/static/images/rank-1.svg b/static/images/rank-1.svg new file mode 100644 index 0000000..2e71275 --- /dev/null +++ b/static/images/rank-1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/images/rank-2.svg b/static/images/rank-2.svg new file mode 100644 index 0000000..cd262ed --- /dev/null +++ b/static/images/rank-2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/images/rank-3.svg b/static/images/rank-3.svg new file mode 100644 index 0000000..cc5c979 --- /dev/null +++ b/static/images/rank-3.svg @@ -0,0 +1 @@ + \ No newline at end of file