我的页面用户接口调用

dev
shuxiaoquan 11 months ago
parent eacca7c3b3
commit 62587d6b8b
  1. 7
      api/user.js
  2. 70
      pages/user/index.vue

@ -6,7 +6,7 @@ const api = {
assets: 'user/assets', assets: 'user/assets',
bindMobile: 'user/bindMobile', bindMobile: 'user/bindMobile',
personal: 'user/personal', personal: 'user/personal',
todoCounts: "order/todoCounts" todoCounts: "order/todoCounts"
} }
// 当前登录的用户信息 // 当前登录的用户信息
@ -19,6 +19,11 @@ export const info = (param, option) => {
return request.get(api.userInfo, param, options) return request.get(api.userInfo, param, options)
} }
// 订单数量
export const actionCounts = (param, option) => {
return request.post('order/actionCounts', param, option)
}
// 订单数量 // 订单数量
export const todoCounts = (param, option) => { export const todoCounts = (param, option) => {
return request.post(api.todoCounts, param, option) return request.post(api.todoCounts, param, option)

@ -23,7 +23,7 @@
</view> </view>
</view> </view>
<view style="display: flex; flex: 1; justify-content: flex-end;"> <view style="display: flex; flex: 1; justify-content: flex-end;">
<view class="group_2"> <view class="group_2" @click="goJump('/pages/news/user/message')">
<image :src="$picUrl+'/static/home/news.png'" class="thumbnail"></image> <image :src="$picUrl+'/static/home/news.png'" class="thumbnail"></image>
<text lines="1" class="text_2">消息</text> <text lines="1" class="text_2">消息</text>
</view> </view>
@ -125,7 +125,7 @@
<view class="walletList"> <view class="walletList">
<view class="listItem" @click="goPage('pages/cart/index')"> <view class="listItem" @click="goPage('pages/cart/index')">
<view class="num"> <view class="num">
235 {{actionCountsInfo.cart_number}}
</view> </view>
<view class="info"> <view class="info">
购物车 购物车
@ -133,7 +133,7 @@
</view> </view>
<view class="listItem" @click="goJump('pages/news/park/browsingHistory')"> <view class="listItem" @click="goJump('pages/news/park/browsingHistory')">
<view class="num"> <view class="num">
2 {{actionCountsInfo.view_number}}
</view> </view>
<view class="info"> <view class="info">
浏览记录 浏览记录
@ -141,7 +141,7 @@
</view> </view>
<view class="listItem" @click="goJump('pages/news/park/recordHistory')"> <view class="listItem" @click="goJump('pages/news/park/recordHistory')">
<view class="num"> <view class="num">
235 {{actionCountsInfo.reservation_number}}
</view> </view>
<view class="info"> <view class="info">
预约记录 预约记录
@ -149,7 +149,7 @@
</view> </view>
<view class="listItem" @click="goJump('pages/news/coupon/list')"> <view class="listItem" @click="goJump('pages/news/coupon/list')">
<view class="num"> <view class="num">
2 {{actionCountsInfo.view_number}}
</view> </view>
<view class="info"> <view class="info">
优惠券 优惠券
@ -167,28 +167,28 @@
<view class="image-text_21" @click="goGoodsOrder('payment')"> <view class="image-text_21" @click="goGoodsOrder('payment')">
<image :src="$picUrl+'/static/user/unpay.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/unpay.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text class="text_71">2</text> <text class="text_71" v-if="orderTodoInfo.goods_order.payment_number">{{orderTodoInfo.goods_order.payment_number>=100?"99+":orderTodoInfo.goods_order.payment_number}}</text>
<text class="text_81">待付款</text> <text class="text_81">待付款</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="goGoodsOrder('delivery')"> <view class="image-text_21" @click="goGoodsOrder('delivery')">
<image :src="$picUrl+'/static/user/unsend.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/unsend.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text class="text_71">2</text> <text class="text_71" v-if="orderTodoInfo.goods_order.delivery_number">{{orderTodoInfo.goods_order.delivery_number>=100?"99+":orderTodoInfo.goods_order.delivery_number}}</text>
<text class="text_81">待发货</text> <text class="text_81">待发货</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="goGoodsOrder('received')"> <view class="image-text_21" @click="goGoodsOrder('received')">
<image :src="$picUrl+'/static/user/untake.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/untake.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text class="text_71">2</text> <text class="text_71" v-if="orderTodoInfo.goods_order.received_number">{{orderTodoInfo.goods_order.received_number>=100?"99+":orderTodoInfo.goods_order.received_number}}</text>
<text class="text_81">待收货</text> <text class="text_81">待收货</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="goGoodsOrder('received')"> <view class="image-text_21" @click="goGoodsOrder('received')">
<image :src="$picUrl+'/static/user/over.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/over.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text class="text_71">2</text> <text class="text_71" v-if="orderTodoInfo.goods_order.finish_number">{{orderTodoInfo.goods_order.finish_number>=100?"99+":orderTodoInfo.goods_order.finish_number}}</text>
<text class="text_81">已完成</text> <text class="text_81">已完成</text>
</view> </view>
</view> </view>
@ -204,28 +204,28 @@
<view class="image-text_21" @click="toFuwu(3)"> <view class="image-text_21" @click="toFuwu(3)">
<image :src="$picUrl+'/static/user/unpay.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/unpay.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text class="text_71">2</text> <text class="text_71" v-if="orderTodoInfo.service_order.confirm_number">{{orderTodoInfo.service_order.confirm_number}}</text>
<text class="text_81">待确认</text> <text class="text_81">待确认</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="toFuwu(2)"> <view class="image-text_21" @click="toFuwu(2)">
<image :src="$picUrl+'/static/user/unsend.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/unsend.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text class="text_71">2</text> <text class="text_71" v-if="orderTodoInfo.service_order.service_number">{{orderTodoInfo.service_order.service_number}}</text>
<text class="text_81">待服务</text> <text class="text_81">待服务</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="toFuwu(1)"> <view class="image-text_21" @click="toFuwu(1)">
<image :src="$picUrl+'/static/user/untake.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/untake.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text class="text_71">2</text> <text class="text_71" v-if="orderTodoInfo.service_order.payment_number">{{orderTodoInfo.service_order.payment_number}}</text>
<text class="text_81">待支付</text> <text class="text_81">待支付</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="toFuwu(4)"> <view class="image-text_21" @click="toFuwu(4)">
<image :src="$picUrl+'/static/user/detail.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/detail.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text class="text_71">2</text> <text class="text_71" v-if="orderTodoInfo.service_order.check_number">{{orderTodoInfo.service_order.check_number}}</text>
<text class="text_81">已完成</text> <text class="text_81">已完成</text>
</view> </view>
</view> </view>
@ -241,35 +241,35 @@
<view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=1')"> <view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=1')">
<image :src="$picUrl+'/static/user/unpay.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/unpay.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text lines="1" class="text_7">2</text> <text lines="1" class="text_7" v-if="orderTodoInfo.distribution_order.payment_number">{{orderTodoInfo.distribution_order.payment_number}}</text>
<text lines="1" class="text_8">待付款</text> <text lines="1" class="text_8">待付款</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=2')"> <view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=2')">
<image :src="$picUrl+'/static/user/unsend.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/unsend.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text lines="1" class="text_7">2</text> <text lines="1" class="text_7" v-if="orderTodoInfo.distribution_order.delivery_number">{{orderTodoInfo.distribution_order.delivery_number}}</text>
<text lines="1" class="text_8">待发货</text> <text lines="1" class="text_8">待发货</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=7')"> <view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=7')">
<image :src="$picUrl+'/static/user/untake.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/untake.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text lines="1" class="text_7">2</text> <text lines="1" class="text_7" v-if="orderTodoInfo.distribution_order.received_number">{{orderTodoInfo.distribution_order.received_number}}</text>
<text lines="1" class="text_8">待收货</text> <text lines="1" class="text_8">待收货</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=5')"> <view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=5')">
<image :src="$picUrl+'/static/user/over.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/over.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text lines="1" class="text_7">2</text> <text lines="1" class="text_7" v-if="orderTodoInfo.distribution_order.finish_number">{{orderTodoInfo.distribution_order.finish_number}}</text>
<text lines="1" class="text_8">已完成</text> <text lines="1" class="text_8">已完成</text>
</view> </view>
</view> </view>
<view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=4')"> <view class="image-text_21" @click="goJump('/pages/news3/fenxiao?type=4')">
<image :src="$picUrl+'/static/user/detail.png'" class="label_11"></image> <image :src="$picUrl+'/static/user/detail.png'" class="label_11"></image>
<view class="text-group_21"> <view class="text-group_21">
<text lines="1" class="text_7">2</text> <text lines="1" class="text_7" v-if="orderTodoInfo.distribution_order.retund_number">{{orderTodoInfo.distribution_order.retund_number}}</text>
<text lines="1" class="text_8">退款中</text> <text lines="1" class="text_8">退款中</text>
</view> </view>
</view> </view>
@ -501,6 +501,12 @@
background: 'url(https://www.royaum.com.cn/static/news/login-bg.png) center top no-repeat', background: 'url(https://www.royaum.com.cn/static/news/login-bg.png) center top no-repeat',
backgroundSize: '100% auto', backgroundSize: '100% auto',
}, },
orderTodoInfo: {
distribution_order: {},
goods_order: {},
service_order: {},
},
actionCountsInfo: {},
userType: 2, userType: 2,
memberCode: false, memberCode: false,
isLogin: false, isLogin: false,
@ -550,6 +556,7 @@
.then(result => { .then(result => {
that.userInfo = result.data.userInfo that.userInfo = result.data.userInfo
that.getOrderInfo(); that.getOrderInfo();
that.getActionCountsInfo();
uni.setStorageSync('userInfo', that.userInfo) uni.setStorageSync('userInfo', that.userInfo)
resolve(that.userInfo) resolve(that.userInfo)
}) })
@ -563,6 +570,7 @@
}) })
}) })
}, },
// //
getOrderInfo() { getOrderInfo() {
const that = this const that = this
@ -571,8 +579,29 @@
load: that.isFirstload load: that.isFirstload
}) })
.then(result => { .then(result => {
console.log(result.data) that.orderTodoInfo = result.data
resolve(that.userInfo) resolve(that.orderTodoInfo)
})
.catch(err => {
if (err.result && err.result.status == 401) {
that.isLogin = false
resolve(null)
} else {
reject(err)
}
})
})
},
//
getActionCountsInfo() {
const that = this
return new Promise((resolve, reject) => {
!that.isLogin ? resolve(null) : UserApi.actionCounts({}, {
load: that.isFirstload
})
.then(result => {
that.actionCountsInfo = result.data
resolve(that.actionCountsInfo)
}) })
.catch(err => { .catch(err => {
if (err.result && err.result.status == 401) { if (err.result && err.result.status == 401) {
@ -584,7 +613,6 @@
}) })
}) })
}, },
toFuwu(type) { toFuwu(type) {
if (!uni.getStorageSync('AccessToken')) { if (!uni.getStorageSync('AccessToken')) {
uni.navigateTo({ uni.navigateTo({

Loading…
Cancel
Save