Selaa lähdekoodia

feat:推广收益列表

zhanghui 2 vuotta sitten
vanhempi
sitoutus
662be712e5

+ 1 - 1
main.js

@@ -17,7 +17,7 @@ Vue.prototype.$idCardPattern = '^([1-6][1-9]|50)\\d{4}(18|19|20)\\d{2}((0[1-9])|
 //后端接口地址
 Vue.prototype.$baseUrl = env.baseUrl;
 //小程序地址
-Vue.prototype.$xcxUrl = 'https://jje.admin.xinyuekj.com.cn/recharge/recharge';
+Vue.prototype.$xcxUrl = 'https://jje.xinyuekj.com.cn/spread/spread';
 //拓客端地址
 Vue.prototype.$tkUrl = 'http://tk.gzzzyd.com/#/pages/register/register';
 Vue.prototype.$api = api;

+ 8 - 93
pages/earningsList/earningsList.vue

@@ -2,64 +2,25 @@
 	<view class="page">
 		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="我的收益" @clickLeft="back" />
 		<view :style="{height:height}" class="list">
-			<mescroll-uni ref="mescrollRef" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
-						  :up="upOption" @up="upCallback" @emptyclick="emptyClick">
-				<view  class="flex-row justify-between item" v-for="(item,index) in 10">
-					<view class="flex-row avatar">
-						<image :src="'/static/ud4.png'"></image>
-					</view>
-					<view class="flex-col justify-between userMsg">
-						<view class="flex-row justify-between">
-							<text class="name">张辉</text>
-							<text class="time">2024-01-29 12:00:00</text>
-						</view>
-						<view class="flex-row justify-between">
-							<text class="indirect">
-								间推收益:<text class="number">+20</text>
-							</text>
-							<text class="indirect">
-								累计收益:<text class="number">200</text>
-							</text>
-						</view>
-					</view>
-
-				</view>
-			</mescroll-uni>
+			<mescroll-item ref="MescrollItem" :i="0"  :index="0"  :height="height">
+			</mescroll-item>
 		</view>
 	</view>
 </template>
 
 <script>
-	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
-	import MescrollMoreItemMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js"
+	import MescrollItem from "./module/mescrollUni-item.vue";
 	export default {
-		mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
-		components: {},
+		components: {
+			MescrollItem
+		},
 		data() {
 			return {
-				height:'',
-				downOption: {
-					auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
-				},
-				upOption: {
-					auto: false, // 不自动加载
-					// page: {
-					// 	num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
-					// 	size: 10 // 每页数据的数量
-					// },
-					noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
-					empty: {
-						icon: '',
-						tip: '暂无内容', // 提示
-						// btnText: '去看看'
-					},
-					textNoMore: '没有更多了'
-				},
-				list: [],
+				height:''
+
 			}
 		},
 		onLoad(e) {
-
 			let sysInfo = uni.getSystemInfoSync()
 			this.height = sysInfo.windowHeight  - 70 + 'px' //除标题栏栏外的屏幕可用高度
 		},
@@ -69,52 +30,6 @@
 					delta: 1
 				})
 			},
-
-
-			/*下拉刷新的回调 */
-			downCallback() {
-				// 这里加载你想下拉刷新的数据, 比如刷新轮播数据
-				// loadSwiper();
-				// 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
-				this.mescroll.resetUpScroll()
-			},
-			/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
-			upCallback(page) {
-
-				let status = this.index
-				if (this.index === 3){
-					status = 4
-				}
-
-				//联网加载数据
-				this.$api.service.getRecord({
-					pageNum: page.num,
-					pageSize: 10
-				}).then((res) => {
-					//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
-					this.mescroll.endSuccess(res.data.data.records.length, res.data.data.records.length === 10);
-					//设置列表数据
-					if (page.num === 1) this.list = []; //如果是第一页需手动制空列表
-					res.data.data.records.forEach(i=>{
-						if (i.avatar){
-							i.avatar = i.avatar.replace(/^http:/, "https:")
-						}
-					})
-					this.list = this.list.concat(res.data.data.records); //追加新数据
-					console.log(this.list)
-				}).catch((err) => {
-					//联网失败, 结束加载
-					this.mescroll.endErr();
-				})
-			},
-			//点击空布局按钮的回调
-			emptyClick() {
-				uni.showToast({
-					title: '点击了按钮,具体逻辑自行实现'
-				})
-			},
-
-
 		}
 	}
 </script>

+ 2 - 38
pages/earningsList/index.rpx.css

@@ -1,39 +1,3 @@
-.page {
-	height: 100vh;
-	padding: 0 32rpx;
-	background: #f7f7f7;
-}
-.item{
-	padding: 20rpx 32rpx;
-	background: #FFFFFF;
-	margin-top: 24rpx;
-	border-radius: 15rpx;
-}
-.avatar{
-	width: 100rpx;
-	height: 100rpx;
-	border-radius: 50rpx;
-	overflow: hidden;
-}
-.avatar image{
-	width: 100rpx;
-	height: 100rpx;
-}
-.userMsg{
-	background: white;
-	width: 500rpx;
-}
-
-.name{
-	font-size: 30rpx;
-	font-weight: bold;
-}
-.time{
-	font-size: 30rpx;
-	color: #999999;
-}
-.number{
-	font-size: 30rpx;
-	font-weight: bold;
-	color: #4cd964;
+.page{
+	padding: 0 24rpx;
 }

+ 54 - 0
pages/earningsList/module/index.rpx.css

@@ -0,0 +1,54 @@
+.item{
+    height: 156rpx;
+    border-bottom: 1px solid #EEEEEE;
+}
+.leftText{
+    width: 84rpx;
+    height: 84rpx;
+    text-align: center;
+    color: #FFFFFF;
+    line-height: 84rpx;
+    border-radius: 42rpx;
+    font-size: 24rpx;
+    font-family: PingFangSC-Regular, PingFang SC;
+    margin-top: 32rpx ;
+}
+.rightText{
+    margin-top: 32rpx;
+    width: 590rpx;
+    padding: 0 20rpx;
+}
+.text1{
+    height: 44rpx;
+    font-size: 28rpx;
+    font-family: PingFangSC-Regular, PingFang SC;
+    font-weight: 400;
+    color: #333333;
+    line-height: 44rpx;
+}
+
+.text2{
+    height: 44rpx;
+    font-size: 28rpx;
+    font-family: PingFangSC-Medium, PingFang SC;
+    font-weight: bold;
+    color: #333333;
+    line-height: 44rpx;
+}
+.text3{
+    height: 40rpx;
+    font-size: 24rpx;
+    font-family: PingFangSC-Regular, PingFang SC;
+    font-weight: 400;
+    color: #999999;
+    line-height: 40rpx;
+}
+.backColor1{
+    background: #ED569F;
+}
+.backColor2{
+    background: #93D21A;
+}
+.backColor3{
+    background: #FFAF36;
+}

+ 147 - 0
pages/earningsList/module/mescrollUni-item.vue

@@ -0,0 +1,147 @@
+<template>
+	<!--
+    swiper中的transfrom会使fixed失效,此时用height固定高度;
+    swiper中无法触发mescroll-mixins.js的onPageScroll和onReachBottom方法,只能用mescroll-uni,不能用mescroll-body
+    -->
+	<!-- ref动态生成: 字节跳动小程序编辑器不支持一个页面存在相同的ref (如不考虑字节跳动小程序可固定值为 ref="mescrollRef") -->
+	<!-- top的高度等于悬浮菜单tabs的高度 -->
+	<mescroll-uni :ref="'mescrollRef' + i" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
+		:up="upOption" @up="upCallback" @emptyclick="emptyClick">
+		<view>
+			<view class="item" v-for="(item,index) in list" :key="index">
+				<view class="flex-row justify-between" @click="goOrderDetail(item)">
+					<view class="leftText" :class="{'backColor2':item.isAdd == '1','backColor1':item.isAdd != '1'}">
+						<text v-if="item.isAdd == '1'">增加</text>
+						<text v-else>减少</text>
+					</view>
+					<view class="rightText flex-col">
+						<view class=" flex-row justify-between">
+							<text class="text1">{{item.description}}</text>
+							<text class="text2" v-if="item.isAdd == '1'">{{item.amount}}</text>
+							<text class="text2" v-else>-{{item.amount}}</text>
+						</view>
+						<view class=" flex-row justify-between">
+							<text class="text3">{{item.createTime}}</text>
+							<!--									<text class="text3">账户余额:{{item.afterAmount || 0}}</text>-->
+						</view>
+					</view>
+				</view>
+			</view>
+		</view>
+
+	</mescroll-uni>
+</template>
+
+<script>
+	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
+	import MescrollMoreItemMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js"
+	export default {
+		mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
+		components: {
+		},
+
+		data() {
+			return {
+				downOption: {
+					auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
+				},
+				upOption: {
+					auto: false, // 不自动加载
+					// page: {
+					// 	num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
+					// 	size: 10 // 每页数据的数量
+					// },
+					noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
+					empty: {
+						icon: '/static/imageIcon/empty.png',
+						tip: '暂无内容', // 提示
+						// btnText: '去看看'
+					},
+					textNoMore: '没有更多了'
+				},
+				list:[],
+			}
+		},
+		props: {
+			i: Number, // 每个tab页的专属下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
+			index: { // 当前tab的下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
+				type: Number,
+				default () {
+					return 0
+				}
+			},
+
+			height: [Number, String], // mescroll的高度
+
+		},
+		watch:{
+
+		},
+
+		created(){
+
+
+		},
+
+		methods: {
+
+
+			/*下拉刷新的回调 */
+			downCallback() {
+				// 这里加载你想下拉刷新的数据, 比如刷新轮播数据
+				// loadSwiper();
+				// 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
+				this.mescroll.resetUpScroll()
+			},
+			/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
+			upCallback(page) {
+
+				//联网加载数据
+				let httpData = {
+					pageNum:page.num,
+					pageSize:10
+				}
+
+				this.$api.service.getRecord(httpData).then((res) => {
+					//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
+					this.mescroll.endSuccess(res.data.data.length,res.data.data.length === 10);
+					//设置列表数据
+					if (page.num === 1) this.list = []; //如果是第一页需手动制空列表
+					this.list = this.list.concat(res.data.data); //追加新数据
+					console.log(this.list)
+				}).catch((err) => {
+					//联网失败, 结束加载
+					this.mescroll.endErr();
+				})
+
+
+			},
+
+			//点击空布局按钮的回调
+			emptyClick() {
+				uni.showToast({
+					title: '点击了按钮,具体逻辑自行实现'
+				})
+			},
+			// 搜索
+			doSearch() {
+				this.list = []; // 先清空列表,显示加载进度
+				this.mescroll.resetUpScroll();
+			},
+
+
+
+
+			goOrderDetail(item){
+				uni.navigateTo({
+					url:'/myPages/transactionRecordDetail/index?item='+JSON.stringify(item)
+				})
+			},
+		}
+	}
+</script>
+<style>
+	@import '/common/css/common.css';
+	@import './index.rpx.css';
+
+</style>

BIN
static/dataNull.png