diff --git a/App.vue b/App.vue index cc5c84b..6a8e8f6 100644 --- a/App.vue +++ b/App.vue @@ -4,11 +4,11 @@ this.$store.commit('initConfig') this.$store.commit('getCategoryList') // 注释掉token检查,允许未登录用户访问所有页面 - /* - if(uni.getStorageSync('token')){ - this.$store.commit('getQrCode') - } - */ + + // if(uni.getStorageSync('token')){ + // this.$store.commit('getQrCode') + // } + // 无需token,直接获取二维码 this.$store.commit('getQrCode') diff --git a/api/api.js b/api/api.js index c93d2cb..b87f90e 100644 --- a/api/api.js +++ b/api/api.js @@ -5,7 +5,7 @@ import utils from '../utils/utils.js' let limit = {} let debounce = {} -const models = ['login', 'index', 'order'] +const models = ['login', 'index', 'order', 'my'] const config = { // 示例 diff --git a/api/model/my.js b/api/model/my.js new file mode 100644 index 0000000..73649fa --- /dev/null +++ b/api/model/my.js @@ -0,0 +1,12 @@ +// 我的 相关接口 + +const api = { + // 我的-获取推荐二维码 + getInviteCode: { + url: '/teambuy/share/getInviteCode', + method: 'POST', + limit: 500 + }, +} + +export default api \ No newline at end of file diff --git a/api/model/order.js b/api/model/order.js index 2dffb92..51e90b8 100644 --- a/api/model/order.js +++ b/api/model/order.js @@ -7,6 +7,31 @@ const api = { method: 'GET', limit: 500, }, + // 订单-查看优惠券列表-详情 + queryCouponList: { + url: '/teambuy/coupon/queryCouponList', + method: 'GET', + limit: 500 + }, + // 订单- 查询团餐订单列表 - 详情 + queryLeaderOrderList: { + url: '/teambuy/order/queryLeaderOrderList', + method: 'GET', + limit: 500 + }, + // 订单-查看团员订单列表-详情 + queryMemberOrderList: { + url: '/teambuy/order/queryMemberOrderList', + method: 'GET', + limit: 500 + }, + // 订单-查看购物车列表-详情 + queryShopcarList: { + url: '/teambuy/shopcar/queryShopcarList', + method: 'GET', + limit: 500 + } + } export default api \ No newline at end of file diff --git a/pages/index/cart.vue b/pages/index/cart.vue index e64286c..9f06c7c 100644 --- a/pages/index/cart.vue +++ b/pages/index/cart.vue @@ -95,6 +95,14 @@ export default { } }, methods: { + // 获取购物车数据 + getCartData(){ + this.$api('queryShopcarList', {}, res => { + if (res.code == 200){ + console.log(res); + } + }) + }, toggleSelect(item) { this.updateCart(); }, @@ -187,7 +195,10 @@ export default { // 编写删除函数的调用 }, 800) } - } + }, + onLoad(){ + this.getCartData() + } } diff --git a/pages/index/category.vue b/pages/index/category.vue index 2b189c0..efdcd6c 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -112,8 +112,11 @@ export default { change(e) { // this.queryParams.classId = this.category[e].id this.currentChildren = e + console.log(this.currentChildren); + console.log(this.category[e].id); + // 重新加载数据 - this.getData() + this.getData({ categoryId: this.category[e].id }) }, clickTabs({ index }) { this.current = index diff --git a/pages/index/center.vue b/pages/index/center.vue index b2603c2..d24eef1 100644 --- a/pages/index/center.vue +++ b/pages/index/center.vue @@ -230,7 +230,9 @@ export default { } }, onLoad (){ - this.$store.commit('getUserInfo') + // 进来加载的时候 会检查一次信息是否完整 若不完整 重新进入登录界面 + // 因为是开发模式 取消这个限制 + // this.$store.commit('getUserInfo') uni.setStorageSync('identity', 0) // 一开始的身份默认为团员 this.identity = uni.getStorageSync('identity') // 获取身份 } diff --git a/pages_order/auth/wxLogin.vue b/pages_order/auth/wxLogin.vue index 962ee60..190bc86 100644 --- a/pages_order/auth/wxLogin.vue +++ b/pages_order/auth/wxLogin.vue @@ -5,7 +5,7 @@ - 欢迎使用{{ $store.state.configList.config_app_name }} + {{ configList.config_app_name }} @@ -82,7 +82,7 @@ export default { if(query.path){ this.config = query // 从路由拿取配置? } - console.log(this.configList.config_app_name); + console.log('这是从路由拿到的配置', this.config); }, methods: { openPrivacyPopup(index){ @@ -101,7 +101,7 @@ export default { if(!this.checkboxValue.length){ return uni.showToast({ title: '请先同意隐私协议', - icon:'error' + icon:'error', }) } this.$store.commit('login', this.config) @@ -129,29 +129,29 @@ export default { flex-direction: column; position: relative; .logo{ - height: 140rpx; - width: 140rpx; + height: 400rpx; + width: 400rpx; image{ - height: 140rpx; - width: 140rpx; + height: 400rpx; + width: 400rpx; border-radius: 30rpx; } margin-bottom: 20rpx; } .title{ position: relative; - font-weight: 900; - font-size: 45rpx; - &::after{ - content: ''; - position: absolute; - left: 0; - top: 100%; - display: block; - height: 8rpx; - width: 210rpx; - background: linear-gradient(to right,$uni-color, #fff); - } + font-weight: 600; + font-size: 40rpx; + // &::after{ + // content: ''; + // position: absolute; + // left: 0; + // top: 100%; + // display: block; + // height: 8rpx; + // width: 210rpx; + // background: linear-gradient(to right,$uni-color, #fff); + // } } .btn{ all: unset; @@ -198,7 +198,7 @@ export default { .mt{ color: #fff; background-color: $uni-color; - margin-top: 200rpx; + margin-top: 100rpx; } diff --git a/pages_order/auth/wxUserInfo.vue b/pages_order/auth/wxUserInfo.vue index 4451038..3549309 100644 --- a/pages_order/auth/wxUserInfo.vue +++ b/pages_order/auth/wxUserInfo.vue @@ -93,20 +93,25 @@ this.userInfoForm.headImage = url }) }, - getPhone(e){ + getPhone(e){ this.$api('bindPhone', { phoneCode : e.detail.code }, res => { if(res.code == 200){ let phoneObj = JSON.parse(res.result) - if(phoneObj.errmsg == 'ok'){ + console.log(phoneObj); + if (phoneObj.errmsg == 'ok'){ this.userInfoForm.phone = phoneObj.phone_info.phoneNumber - }else{ - uni.showModal({ - title: phoneObj.errmsg - }) } - console.log(phoneObj); + // let phoneObj = JSON.parse(res.result) + // if(phoneObj.errmsg == 'ok'){ + // this.userInfoForm.phone = phoneObj.phone_info.phoneNumber + // }else{ + // uni.showModal({ + // title: phoneObj.errmsg + // }) + // } + // console.log(phoneObj); } }) }, @@ -129,17 +134,23 @@ })) { return } + + // 更新个人资料函数 + + // self.$api('updateInfo', { + // avatarUrl : self.userInfoForm.headImage, + // nickName : self.userInfoForm.nickName, + // phone : self.userInfoForm.phone, + // }, res => { + // if (res.code == 200) { + // uni.reLaunch({ + // url:'/pages/index/category' + // }) + // } + // }) - self.$api('updateInfo', { - avatarUrl : self.userInfoForm.headImage, - nickName : self.userInfoForm.nickName, - phone : self.userInfoForm.phone, - }, res => { - if (res.code == 200) { - uni.reLaunch({ - url:'/pages/index/index' - }) - } + uni.reLaunch({ + url:'/pages/index/category' }) }) diff --git a/pages_order/mine/coupon.vue b/pages_order/mine/coupon.vue index 2f7b5f3..89bc03e 100644 --- a/pages_order/mine/coupon.vue +++ b/pages_order/mine/coupon.vue @@ -62,7 +62,8 @@ export default { this.unusedCoupons = unusedCoupons this.usedCoupons = usedCoupons // 暂时 没有已过期的优惠卷 - // this.expiredCoupons = expiredCoupons + // this.expiredCoupons = expiredCoupons + this.getCoupon() }, methods: { // 切换标签页 @@ -94,6 +95,17 @@ export default { }, 1000) } }) + }, + // 获取优惠卷 + getCoupon() { + this.$api('queryCouponList', { + pageNo: 1, + pageSize: 10000 + }, res => { + if (res.code === 200){ + console.log(res); + } + }) } } } diff --git a/pages_order/mine/share.vue b/pages_order/mine/share.vue index 048ce3f..e1e1777 100644 --- a/pages_order/mine/share.vue +++ b/pages_order/mine/share.vue @@ -55,8 +55,18 @@ export default { }, onLoad() { this.shareData = shareData + this.getCode() }, methods: { + // 获取邀请码 + getCode(){ + this.$api('getInviteCode', {}, res => { + if(res.code == 200){ + console.log('获取邀请二维码', res); + + } + }) + }, // 分享给好友 - 微信小程序特有功能 shareToFriend() { // 触发按钮形式的分享,提示用户使用右上角的分享 diff --git a/store/store.js b/store/store.js index 9461652..80ae536 100644 --- a/store/store.js +++ b/store/store.js @@ -24,6 +24,7 @@ const store = new Vuex.Store({ const configList = { ...state.configList, } + if (res.code == 200) { res.result.records.forEach(n => { state.configList[n.paramCode] = n.paramValueText || @@ -32,7 +33,8 @@ const store = new Vuex.Store({ }); console.log('configList', state.configList); } - state.configList = configList + // state.configList = configList + uni.$emit('initConfig', state.configList) }) diff --git a/utils/utils.js b/utils/utils.js index 9a2017d..4bdc8b9 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -75,7 +75,7 @@ function verificationAll(data, msg){ if (!data[key]) { uni.showToast({ title: msg[key], - icon: "none" + icon: "error" }) return true } @@ -222,6 +222,7 @@ export function redirectTo(...args){ export const toLogin = function(){ let time = 0 return () => { + // 一点小防抖 if(new Date().getTime() - time < 1000){ return }