zs 2 years ago
parent
commit
1bea7b582f
5 changed files with 246 additions and 79 deletions
  1. 0 6
      pages.json
  2. 0 8
      pagesMy/assets/cash.vue
  3. 193 53
      pagesMy/assets/index.vue
  4. 52 11
      pagesMy/assets/info.vue
  5. 1 1
      pagesMy/order/service.vue

+ 0 - 6
pages.json

@@ -147,12 +147,6 @@
 						"navigationBarTitleText": "资产详情"
 					}
 				},
-				{
-					"path": "assets/cash",
-					"style": {
-						"navigationBarTitleText": "资产提现"
-					}
-				},
 				{
 					"path": "dough/index",
 					"style": {

+ 0 - 8
pagesMy/assets/cash.vue

@@ -1,8 +0,0 @@
-<template>
-</template>
-
-<script>
-</script>
-
-<style>
-</style>

+ 193 - 53
pagesMy/assets/index.vue

@@ -5,43 +5,115 @@
 				<view class="one_1">
 					<text>¥</text><text>{{money}}</text>
 				</view>
-				<view class="one_2" @click="toCash">
+				<view class="one_2" @tap="toCash">
 					<button type="default" size="mini">提现</button>
 				</view>
 			</view>
 			<view class="two">
-				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
-					<view class="list-scroll-view">
-						<view class="list" v-for="(item, index) in list" :key="index">
-							<view class="other" @tap="toDetail(item)">
-								<view class="other_1">
-									<view class="source">{{item.zhSource}}</view>
-									<view class="time">{{item.time}}</view>
+				<tabs :tabs="tabs" @tabsChange="tabsChange">
+					<view class="tabsList">
+						<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
+							<view class="list-scroll-view">
+								<view class="list" v-for="(item, index) in list" :key="index">
+									<view v-if="tabs.active=='0'" class="other" @tap="toDetail(item,'0')">
+										<view class="other_1">
+											<view class="source">{{item.zhSource}}</view>
+											<view class="time">{{item.time}}</view>
+										</view>
+										<view class="other_2">
+											<view class="money">+{{item.money}}</view>
+											<text class="iconfont icon-jiantouyou"></text>
+										</view>
+									</view>
+									<view v-if="tabs.active=='1'" class="other" @tap="toDetail(item,'1')">
+										<view class="other_1">
+											<view class="source">{{item.zhSource}}</view>
+											<view class="time">{{item.time}}</view>
+										</view>
+										<view class="other_2">
+											<view class="money">-{{item.money}}</view>
+											<text class="iconfont icon-jiantouyou"></text>
+										</view>
+									</view>
 								</view>
-								<view class="other_2">
-									<view class="money">+{{item.money}}</view>
-									<text class="iconfont icon-jiantouyou"></text>
+								<view class="is_bottom" v-if="is_bottom">
+									<text>{{config.bottom_title}}</text>
 								</view>
 							</view>
-						</view>
-						<view class="is_bottom" v-if="is_bottom">
-							<text>{{config.bottom_title}}</text>
-						</view>
+						</scroll-view>
 					</view>
-				</scroll-view>
+				</tabs>
 			</view>
 		</view>
+		<uni-popup ref="popup" background-color="#fff" type="bottom">
+			<view class="popup">
+				<uni-forms ref="form" :rules="rules" :model="form" label-width="auto">
+					<uni-forms-item label="姓名" name="name">
+						<uni-easyinput disabled v-model="form.name" placeholder="请输入姓名" />
+					</uni-forms-item>
+					<uni-forms-item label="提现金额" name="money">
+						<uni-easyinput type="digit" v-model="form.money" @input="toMoney" placeholder="请输入提现金额" />
+						<view class="money">
+							可提现金额为{{moneyInfo.payTotal||0}},<text @tap="toAll">全部提现</text>
+						</view>
+					</uni-forms-item>
+					<uni-forms-item label="提现理由" name="reason">
+						<uni-easyinput type="textarea" v-model="form.reason" placeholder="请输入提现理由" />
+					</uni-forms-item>
+					<view class="btn">
+						<button type="primary" @tap="onSubmit('form')">提现</button>
+					</view>
+				</uni-forms>
+			</view>
+		</uni-popup>
 	</mobile-frame>
 </template>
 
 <script>
+	import tabs from '@/components/tabs/index.vue';
 	export default {
+		components: {
+			tabs
+		},
 		data() {
 			return {
 				// 系统设置
 				config: {},
 				user: {},
 				money: 0,
+				tabs: {
+					active: '0',
+					menu: [ //菜单列表
+						{
+							title: '收益记录',
+							active: '0'
+						},
+						{
+							title: '提现记录',
+							active: '1'
+						}
+					]
+				},
+				// 提现金额
+				moneyInfo: {
+					payTotal: 1
+				},
+				// 提现
+				form: {},
+				rules: {
+					money: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入提现金额',
+						}]
+					},
+					reason: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入提现理由',
+						}]
+					},
+				},
 				list: [],
 				total: 0,
 				skip: 0,
@@ -93,15 +165,25 @@
 			async search() {
 				const that = this;
 				let user = that.user;
+				let active = that.tabs.active;
 				if (user._id) {
 					let info = {
 						skip: that.skip,
 						limit: that.limit,
 						inviter: user._id,
 					}
-					let res = await that.$api(`/cashBack`, 'GET', {
-						...info,
-					})
+					let res;
+					if (active == '0') {
+						// 收益记录
+						res = await that.$api(`/cashBack`, 'GET', {
+							...info,
+						})
+					} else {
+						// 提现记录
+						res = await that.$api(`/cashBack`, 'GET', {
+							...info,
+						})
+					}
 					if (res.errcode == '0') {
 						let list = [...that.list, ...res.data];
 						for (let val of list) {
@@ -154,6 +236,13 @@
 				let num = Math.sign(up - e.detail.scrollTop);
 				if (num == 1) that.$set(that, `is_bottom`, false);
 			},
+			// 选择选项卡
+			tabsChange(e) {
+				const that = this;
+				that.$set(that.tabs, `active`, e.active)
+				that.clearPage();
+				that.search()
+			},
 			// 清空列表
 			clearPage() {
 				const that = this;
@@ -165,17 +254,40 @@
 			// 提现
 			toCash() {
 				const that = this;
-				that.clearPage();
-				uni.navigateTo({
-					url: `/pagesMy/assets/cash`
+				let user = that.user;
+				that.$set(that.form, `name`, user.name)
+				that.$refs.popup.open()
+			},
+			// 提现金额
+			toMoney(value) {
+				const that = this;
+				let money = that.moneyInfo.payTotal;
+				if (parseFloat(value) > parseFloat(money)) {
+					uni.showToast({
+						title: '输入金额不能超过可提现金额',
+						icon: 'none'
+					})
+					return
+				}
+			},
+			// 全部提现
+			toAll() {
+				const that = this;
+				that.$set(that.form, `money`, that.moneyInfo.payTotal)
+			},
+			// 提交保存
+			async onSubmit(ref) {
+				const that = this;
+				that.$refs[ref].validate().then(async params => {
+					console.log(params);
 				})
 			},
 			// 明细
-			toDetail(item) {
+			toDetail(item, type) {
 				const that = this;
 				that.clearPage();
 				uni.navigateTo({
-					url: `/pagesMy/assets/info?id=${item._id}`
+					url: `/pagesMy/assets/info?id=${item._id}&type=${type}`
 				})
 			},
 		},
@@ -231,42 +343,48 @@
 			flex-grow: 1;
 			padding: 2vw 0 0 0;
 
-			.list {
-				width: 92vw;
-				border-bottom: 0.5vw solid var(--f1Color);
-				margin: 2vw 2vw 0 2vw;
-				padding: 2vw;
-				border-radius: 5px;
-
-				.other {
-					display: flex;
-					justify-content: space-between;
-					align-items: center;
+			.tabsList {
+				position: relative;
+				width: 100vw;
+				height: 82vh;
 
-					.other_1 {
-						width: 60vw;
-						font-size: var(--font16Size);
-						margin: 0 0 1vw 0;
+				.list {
+					width: 92vw;
+					border-bottom: 0.5vw solid var(--f1Color);
+					margin: 2vw 2vw 0 2vw;
+					padding: 2vw;
+					border-radius: 5px;
 
-						.time {
-							margin: 1vw 0 0 0;
-							color: var(--f85Color);
-							font-size: var(--font12Size);
-						}
-					}
-
-					.other_2 {
+					.other {
 						display: flex;
+						justify-content: space-between;
 						align-items: center;
 
-						.money {
-							font-size: var(--font18Size);
-							font-weight: bold;
-							margin: 0 1vw;
+						.other_1 {
+							width: 60vw;
+							font-size: var(--font16Size);
+							margin: 0 0 1vw 0;
+
+							.time {
+								margin: 1vw 0 0 0;
+								color: var(--f85Color);
+								font-size: var(--font12Size);
+							}
 						}
 
-						.iconfont {
-							font-size: 16px;
+						.other_2 {
+							display: flex;
+							align-items: center;
+
+							.money {
+								font-size: var(--font18Size);
+								font-weight: bold;
+								margin: 0 1vw;
+							}
+
+							.iconfont {
+								font-size: 16px;
+							}
 						}
 					}
 				}
@@ -297,4 +415,26 @@
 			font-size: 14px;
 		}
 	}
+
+	.popup {
+		min-height: 80vw;
+		padding: 2vw;
+
+		.money {
+			margin: 1vw 0 0 0;
+			font-size: 12px;
+
+			text {
+				color: #6A5ACD;
+			}
+		}
+
+		.btn {
+			text-align: center;
+
+			button {
+				background-color: var(--fFB1Color);
+			}
+		}
+	}
 </style>

+ 52 - 11
pagesMy/assets/info.vue

@@ -1,7 +1,7 @@
 <template>
 	<mobile-frame>
 		<view class="main">
-			<view class="info">
+			<view class="info" v-if="type=='0'">
 				<view class="one">
 					<view class="left">返现金额</view>
 					<view class="right">+{{info.money}}</view>
@@ -23,6 +23,28 @@
 					<view class="right">{{info.zhSource}}</view>
 				</view>
 			</view>
+			<view class="info" v-else>
+				<view class="one">
+					<view class="left">提现金额</view>
+					<view class="right">-{{info.money}}</view>
+				</view>
+				<view class="two">
+					<view class="left">状态</view>
+					<view class="right">{{info.zhStatus}}</view>
+				</view>
+				<view class="two">
+					<view class="left">提现时间</view>
+					<view class="right">{{info.time}}</view>
+				</view>
+				<view class="two">
+					<view class="left">推荐人</view>
+					<view class="right">{{info.inviter_name}}</view>
+				</view>
+				<view class="two">
+					<view class="left">提现理由</view>
+					<view class="right">{{info.zhSource}}</view>
+				</view>
+			</view>
 		</view>
 	</mobile-frame>
 </template>
@@ -32,6 +54,8 @@
 		data() {
 			return {
 				id: '',
+				// 类型
+				type: '',
 				user: {},
 				info: {},
 				// 状态
@@ -43,6 +67,7 @@
 		onLoad: async function(e) {
 			const that = this;
 			that.$set(that, `id`, e.id || '');
+			that.$set(that, `type`, e.type || '');
 			await that.searchOther();
 			await that.watchLogin();
 		},
@@ -74,16 +99,32 @@
 						if (user) {
 							that.$set(that, `user`, user);
 							if (that.id) {
-								let arr = await that.$api(`/cashBack/${that.id}`, 'GET')
-								if (arr.errcode == '0') {
-									let status = that.statusList.find(i => i.value == arr.data.status)
-									if (status) arr.data.zhStatus = status.label;
-									let source = that.sourceList.find(i => i.value == arr.data.source)
-									if (source) arr.data.zhSource = source.label;
-									// 查询推荐人信息
-									let res = await that.$api(`/user/${arr.data.inviter}`, 'GET');
-									if (res.errcode == '0') arr.data.inviter_name = res.data.name
-									that.$set(that, `info`, arr.data)
+								if (that.type == '0') {
+									// 收益记录
+									let arr = await that.$api(`/cashBack/${that.id}`, 'GET')
+									if (arr.errcode == '0') {
+										let status = that.statusList.find(i => i.value == arr.data.status)
+										if (status) arr.data.zhStatus = status.label;
+										let source = that.sourceList.find(i => i.value == arr.data.source)
+										if (source) arr.data.zhSource = source.label;
+										// 查询推荐人信息
+										let res = await that.$api(`/user/${arr.data.inviter}`, 'GET');
+										if (res.errcode == '0') arr.data.inviter_name = res.data.name
+										that.$set(that, `info`, arr.data)
+									}
+								} else {
+									// 提现记录
+									let arr = await that.$api(`/cashBack/${that.id}`, 'GET')
+									if (arr.errcode == '0') {
+										let status = that.statusList.find(i => i.value == arr.data.status)
+										if (status) arr.data.zhStatus = status.label;
+										let source = that.sourceList.find(i => i.value == arr.data.source)
+										if (source) arr.data.zhSource = source.label;
+										// 查询推荐人信息
+										let res = await that.$api(`/user/${arr.data.inviter}`, 'GET');
+										if (res.errcode == '0') arr.data.inviter_name = res.data.name
+										that.$set(that, `info`, arr.data)
+									}
 								}
 							}
 						}

+ 1 - 1
pagesMy/order/service.vue

@@ -53,7 +53,7 @@
 					<uni-forms-item label="退款金额" name="money" v-if="form.type=='0'||form.type=='1'">
 						<uni-easyinput type="digit" v-model="form.money" @input="toMoney" placeholder="请输入退款金额" />
 						<view>
-							最大退款金额不能超过{{moneyInfo.payTotal||'暂无'}}
+							最大退款金额不能超过{{moneyInfo.payTotal||0}}
 						</view>
 					</uni-forms-item>
 					<uni-forms-item label="申请理由" name="reason">