Browse Source

绑定接口

yuxingxing 2 years ago
parent
commit
7311b908a0
2 changed files with 66 additions and 32 deletions
  1. 13 1
      api/home.js
  2. 53 31
      pages/users/user_invoice_list/index.vue

+ 13 - 1
api/home.js

@@ -160,6 +160,12 @@ export function postLoginAuth(data) {
 	});
 }
 
+// 服务商数据
+export function postStatistics(data) {
+	let url = "?userId="+data.userId
+	return request.post("v1/linked/getStatistics"+url,data);
+}
+
 // 获取分享连接
 export function postLinkedUrl(data) {
 	// let url = "?code="+data.code+"&getPhoneNumberCode="+data.getPhoneNumberCode
@@ -170,7 +176,13 @@ export function postLinkedUrl(data) {
 export function leaderboard(data) {
 	return request.get('v1/re/leaderboard', data)
 }
+
 // 红包首页数据-统计
 export function todayStatistics(data) {
-	return request.get('/v1/re/todayStatistics', data)
+	return request.get('v1/re/todayStatistics', data)
+}
+
+// 绑定记录
+export function linkedBindLogList(data) {
+	return request.get('v1/linked/linkedBindLogList', data)
 }

+ 53 - 31
pages/users/user_invoice_list/index.vue

@@ -8,29 +8,29 @@
 		</view>
 		<view v-show="(nav === 2)" class="record-wrapper">
 			<u-cell-group>
-				<u-cell>
+				<u-cell v-for="(item, index) in invoiceList" :key="index">
 					<view slot="title" class="u-slot-title">
-						<u--text mode="name" text="罗德隆" bold></u--text>
-						<u--text text="前上级:"></u--text>
-						<u--text text="现上级:"></u--text>
+						<u--text mode="name" :text="item.userName" bold></u--text>
+						<u--text :text="('前上级:'+item.beforeParentName)"></u--text>
+						<u--text :text="('现上级:'+item.afterParentName)"></u--text>
 					</view>
 					<view slot="right-icon" style="margin-top: 20px">
-						<u--text text="购买订单" bold align="right"></u--text>
-						<u--text text="2022-11-24 17:11:11"></u--text>
+						<u--text :text="item.typeMsg" bold align="right"></u--text>
+						<u--text :text="item.updateTime"></u--text>
 					</view>
 				</u-cell>
 			</u-cell-group>
-			<view v-show="page === 2 && !orderList.length" class="nothing">
+			<view v-show="page === 2 && !invoiceList.length" class="nothing">
 				<image :src="imgHost + '/statics/images/noInvoice.png'"></image>
 				<view>{{ $t(`没有绑定信息哟~`) }}</view>
 			</view>
 		</view>
 		<view v-show="(nav === 1)">
 			<view class="list">
-				<u-grid :border="true" col="2">
+				<u-grid :border="true" col="2" @click="click">
 					<u-grid-item v-for="(listItem, listIndex) in list" :key="listIndex">
-						<text class="grid-text">{{ listItem.title }}</text>
-						<text class="grid-text-amount">0</text>
+						<text class="grid-text">{{( listItem.title) }}{{listIndex ==0 ?' >':''}}</text>
+						<text class="grid-text-amount">{{ listItem.count }}{{listIndex <=1?'元':''}}</text>
 					</u-grid-item>
 				</u-grid>
 				<view class="imageUrl">
@@ -42,10 +42,10 @@
 					</view>
 				</view>
 			</view>
-			<view v-show="page === 2 && !invoiceList.length" class="nothing">
+			<!-- <view v-show="page === 2 && !invoiceList.length" class="nothing">
 				<image :src="imgHost + '/statics/images/noInvoice.png'"></image>
 				<view>{{ $t(`没有消费商信息哟~`) }}</view>
-			</view>
+			</view> -->
 			<navigator class="add-link" :url="`/pages/users/user_invoice_form/index?specialInvoice=${specialInvoice}`">
 				{{ $t(`邀请用户立即参与`) }}</navigator>
 		</view>
@@ -65,6 +65,10 @@ import {
 	invoiceDelete,
 	getUserInfo
 } from '@/api/user.js';
+import {
+	postStatistics,
+	linkedBindLogList
+} from '@/api/home.js';
 import {
 	orderInvoiceList
 } from '@/api/order.js';
@@ -79,27 +83,33 @@ export default {
 		return {
 			list: [{
 				name: 'photo',
-				title: '累计收益'
+				title: '累计收益',
+				count: 0
 			},
 			{
 				name: 'lock',
-				title: '今日收益'
+				title: '今日收益',
+				count: 0
 			},
 			{
 				name: 'star',
-				title: '直属伙伴'
+				title: '直属伙伴',
+				count: 0
 			},
 			{
 				name: 'hourglass',
-				title: '团队伙伴'
+				title: '团队伙伴',
+				count: 0
 			},
 			{
 				name: 'home',
-				title: '我的幸运数'
+				title: '我的幸运数',
+				count: 0
 			},
 			{
 				name: 'star',
-				title: '当前幸运数'
+				title: '当前幸运数',
+				count: 0
 			},
 			],
 			imgHost: HTTP_REQUEST_URL,
@@ -121,11 +131,11 @@ export default {
 				switch (value) {
 					case 1:
 						this.orderList = [];
-						// this.getOrderList();
+						this.getStatistics();
 						break;
 					case 2:
 						this.invoiceList = [];
-						// this.getInvoiceList();
+						this.getInvoiceList();
 						break;
 				}
 			}
@@ -136,19 +146,30 @@ export default {
 		if (option.from === 'invoice_form') {
 			this.nav = 2;
 		}
-		// this.getUserInfo();
+		this.getStatistics();
 	},
 	methods: {
 		click(name) {
-			this.$refs.uToast.success(`点击了第${name}个`)
+			console.log(name);
 		},
-		getUserInfo() {
-			getUserInfo().then(res => {
-				const {
-					special_invoice
-				} = res.data;
-				this.specialInvoice = special_invoice
+		getStatistics() {
+			uni.showLoading({
+				title: this.$t(`加载中`)
+			});
+			postStatistics({
+				userId: this.$store.state.app.uid
+			}
+			).then(res => {
+				this.list[0].count = res.data.earningsCount || 0
+				this.list[1].count = res.data.todayEarnings || 0
+				this.list[2].count = res.data.oneCount || 0
+				this.list[3].count = res.data.twoCount || 0
+				this.list[4].count = res.data.sort || 0
+				this.list[5].count = res.data.outSort || 0
+				this.specialInvoice = true
+				uni.hideLoading();
 			});
+			
 		},
 		// 菜单切换
 		navTab(nav) {
@@ -184,9 +205,10 @@ export default {
 			uni.showLoading({
 				title: this.$t(`加载中`)
 			});
-			invoiceList({
-				page: this.page,
-				limit: this.limit
+			linkedBindLogList({
+				userId: this.$store.state.app.uid,
+				current: this.page,
+				size: this.limit
 			}).then(res => {
 				const {
 					data