Browse Source

2.1 联调登录接口 配置接口 还有一堆接口 后端还没给

hfll
hflllll 3 months ago
parent
commit
92aaba90a5
13 changed files with 138 additions and 49 deletions
  1. +5
    -5
      App.vue
  2. +1
    -1
      api/api.js
  3. +12
    -0
      api/model/my.js
  4. +25
    -0
      api/model/order.js
  5. +12
    -1
      pages/index/cart.vue
  6. +4
    -1
      pages/index/category.vue
  7. +3
    -1
      pages/index/center.vue
  8. +20
    -20
      pages_order/auth/wxLogin.vue
  9. +28
    -17
      pages_order/auth/wxUserInfo.vue
  10. +13
    -1
      pages_order/mine/coupon.vue
  11. +10
    -0
      pages_order/mine/share.vue
  12. +3
    -1
      store/store.js
  13. +2
    -1
      utils/utils.js

+ 5
- 5
App.vue View File

@ -4,11 +4,11 @@
this.$store.commit('initConfig') this.$store.commit('initConfig')
this.$store.commit('getCategoryList') this.$store.commit('getCategoryList')
// token访 // token访
/*
if(uni.getStorageSync('token')){
this.$store.commit('getQrCode')
}
*/
// if(uni.getStorageSync('token')){
// this.$store.commit('getQrCode')
// }
// token // token
this.$store.commit('getQrCode') this.$store.commit('getQrCode')


+ 1
- 1
api/api.js View File

@ -5,7 +5,7 @@ import utils from '../utils/utils.js'
let limit = {} let limit = {}
let debounce = {} let debounce = {}
const models = ['login', 'index', 'order']
const models = ['login', 'index', 'order', 'my']
const config = { const config = {
// 示例 // 示例


+ 12
- 0
api/model/my.js View File

@ -0,0 +1,12 @@
// 我的 相关接口
const api = {
// 我的-获取推荐二维码
getInviteCode: {
url: '/teambuy/share/getInviteCode',
method: 'POST',
limit: 500
},
}
export default api

+ 25
- 0
api/model/order.js View File

@ -7,6 +7,31 @@ const api = {
method: 'GET', method: 'GET',
limit: 500, 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 export default api

+ 12
- 1
pages/index/cart.vue View File

@ -95,6 +95,14 @@ export default {
} }
}, },
methods: { methods: {
//
getCartData(){
this.$api('queryShopcarList', {}, res => {
if (res.code == 200){
console.log(res);
}
})
},
toggleSelect(item) { toggleSelect(item) {
this.updateCart(); this.updateCart();
}, },
@ -187,7 +195,10 @@ export default {
// //
}, 800) }, 800)
} }
}
},
onLoad(){
this.getCartData()
}
} }
</script> </script>


+ 4
- 1
pages/index/category.vue View File

@ -112,8 +112,11 @@ export default {
change(e) { change(e) {
// this.queryParams.classId = this.category[e].id // this.queryParams.classId = this.category[e].id
this.currentChildren = e this.currentChildren = e
console.log(this.currentChildren);
console.log(this.category[e].id);
// //
this.getData()
this.getData({ categoryId: this.category[e].id })
}, },
clickTabs({ index }) { clickTabs({ index }) {
this.current = index this.current = index


+ 3
- 1
pages/index/center.vue View File

@ -230,7 +230,9 @@ export default {
} }
}, },
onLoad (){ onLoad (){
this.$store.commit('getUserInfo')
//
//
// this.$store.commit('getUserInfo')
uni.setStorageSync('identity', 0) // uni.setStorageSync('identity', 0) //
this.identity = uni.getStorageSync('identity') // this.identity = uni.getStorageSync('identity') //
} }


+ 20
- 20
pages_order/auth/wxLogin.vue View File

@ -5,7 +5,7 @@
</view> </view>
<view class="title"> <view class="title">
欢迎使用{{ $store.state.configList.config_app_name }}
{{ configList.config_app_name }}
</view> </view>
<view class="btn mt" @tap="wxLogin"> <view class="btn mt" @tap="wxLogin">
@ -82,7 +82,7 @@ export default {
if(query.path){ if(query.path){
this.config = query // this.config = query //
} }
console.log(this.configList.config_app_name);
console.log('这是从路由拿到的配置', this.config);
}, },
methods: { methods: {
openPrivacyPopup(index){ openPrivacyPopup(index){
@ -101,7 +101,7 @@ export default {
if(!this.checkboxValue.length){ if(!this.checkboxValue.length){
return uni.showToast({ return uni.showToast({
title: '请先同意隐私协议', title: '请先同意隐私协议',
icon:'error'
icon:'error',
}) })
} }
this.$store.commit('login', this.config) this.$store.commit('login', this.config)
@ -129,29 +129,29 @@ export default {
flex-direction: column; flex-direction: column;
position: relative; position: relative;
.logo{ .logo{
height: 140rpx;
width: 140rpx;
height: 400rpx;
width: 400rpx;
image{ image{
height: 140rpx;
width: 140rpx;
height: 400rpx;
width: 400rpx;
border-radius: 30rpx; border-radius: 30rpx;
} }
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.title{ .title{
position: relative; 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{ .btn{
all: unset; all: unset;
@ -198,7 +198,7 @@ export default {
.mt{ .mt{
color: #fff; color: #fff;
background-color: $uni-color; background-color: $uni-color;
margin-top: 200rpx;
margin-top: 100rpx;
} }


+ 28
- 17
pages_order/auth/wxUserInfo.vue View File

@ -93,20 +93,25 @@
this.userInfoForm.headImage = url this.userInfoForm.headImage = url
}) })
}, },
getPhone(e){
getPhone(e){
this.$api('bindPhone', { this.$api('bindPhone', {
phoneCode : e.detail.code phoneCode : e.detail.code
}, res => { }, res => {
if(res.code == 200){ if(res.code == 200){
let phoneObj = JSON.parse(res.result) let phoneObj = JSON.parse(res.result)
if(phoneObj.errmsg == 'ok'){
console.log(phoneObj);
if (phoneObj.errmsg == 'ok'){
this.userInfoForm.phone = phoneObj.phone_info.phoneNumber 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 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'
}) })
}) })


+ 13
- 1
pages_order/mine/coupon.vue View File

@ -62,7 +62,8 @@ export default {
this.unusedCoupons = unusedCoupons this.unusedCoupons = unusedCoupons
this.usedCoupons = usedCoupons this.usedCoupons = usedCoupons
// //
// this.expiredCoupons = expiredCoupons
// this.expiredCoupons = expiredCoupons
this.getCoupon()
}, },
methods: { methods: {
// //
@ -94,6 +95,17 @@ export default {
}, 1000) }, 1000)
} }
}) })
},
//
getCoupon() {
this.$api('queryCouponList', {
pageNo: 1,
pageSize: 10000
}, res => {
if (res.code === 200){
console.log(res);
}
})
} }
} }
} }


+ 10
- 0
pages_order/mine/share.vue View File

@ -55,8 +55,18 @@ export default {
}, },
onLoad() { onLoad() {
this.shareData = shareData this.shareData = shareData
this.getCode()
}, },
methods: { methods: {
//
getCode(){
this.$api('getInviteCode', {}, res => {
if(res.code == 200){
console.log('获取邀请二维码', res);
}
})
},
// - // -
shareToFriend() { shareToFriend() {
// 使 // 使


+ 3
- 1
store/store.js View File

@ -24,6 +24,7 @@ const store = new Vuex.Store({
const configList = { const configList = {
...state.configList, ...state.configList,
} }
if (res.code == 200) { if (res.code == 200) {
res.result.records.forEach(n => { res.result.records.forEach(n => {
state.configList[n.paramCode] = n.paramValueText || state.configList[n.paramCode] = n.paramValueText ||
@ -32,7 +33,8 @@ const store = new Vuex.Store({
}); });
console.log('configList', state.configList); console.log('configList', state.configList);
} }
state.configList = configList
// state.configList = configList
uni.$emit('initConfig', state.configList) uni.$emit('initConfig', state.configList)
}) })


+ 2
- 1
utils/utils.js View File

@ -75,7 +75,7 @@ function verificationAll(data, msg){
if (!data[key]) { if (!data[key]) {
uni.showToast({ uni.showToast({
title: msg[key], title: msg[key],
icon: "none"
icon: "error"
}) })
return true return true
} }
@ -222,6 +222,7 @@ export function redirectTo(...args){
export const toLogin = function(){ export const toLogin = function(){
let time = 0 let time = 0
return () => { return () => {
// 一点小防抖
if(new Date().getTime() - time < 1000){ if(new Date().getTime() - time < 1000){
return return
} }


Loading…
Cancel
Save