guhongwei 2 lat temu
rodzic
commit
596cfaae0b
5 zmienionych plików z 282 dodań i 81 usunięć
  1. 0 6
      pages.json
  2. 1 1
      pagesHome/exchange/index.vue
  3. 0 8
      pagesMy/assets/cash.vue
  4. 217 54
      pagesMy/assets/index.vue
  5. 64 12
      pagesMy/assets/info.vue

+ 0 - 6
pages.json

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

+ 1 - 1
pagesHome/exchange/index.vue

@@ -135,7 +135,7 @@
 						if (res.confirm) {
 							const arr = await that.$api(`/userCoupon/getCoupon/${e._id}`, 'POST');
 							if (arr.errcode == '0') {
-								if (arr.data.result == false) {
+								if (arr.data) {
 									uni.showToast({
 										title: arr.data.msg,
 										icon: 'none'

+ 0 - 8
pagesMy/assets/cash.vue

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

+ 217 - 54
pagesMy/assets/index.vue

@@ -5,43 +5,114 @@
 				<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 textOver">{{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 textOver">{{item.apply_reason}}</view>
+											<view class="time">{{item.apply_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="apply_reason">
+						<uni-easyinput type="textarea" v-model="form.apply_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 moment from 'moment';
+	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: {},
+				// 提现
+				form: {},
+				rules: {
+					money: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入提现金额',
+						}]
+					},
+					apply_reason: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入提现理由',
+						}]
+					},
+				},
 				list: [],
 				total: 0,
 				skip: 0,
@@ -93,15 +164,26 @@
 			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') {
+						info.inviter = user._id;
+						// 收益记录
+						res = await that.$api(`/cashBack`, 'GET', {
+							...info,
+						})
+					} else {
+						info.customer = user._id;
+						// 提现记录
+						res = await that.$api(`/cashOut`, '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,63 @@
 			// 提现
 			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'
+					})
+				}
+			},
+			// 全部提现
+			toAll() {
+				const that = this;
+				that.$set(that.form, `money`, that.moneyInfo.payTotal)
+			},
+			// 提交保存
+			async onSubmit(ref) {
+				const that = this;
+				let money = that.moneyInfo.payTotal;
+				that.$refs[ref].validate().then(async params => {
+					if (parseFloat(params.money) > parseFloat(money)) {
+						uni.showToast({
+							title: '输入金额不能超过可提现金额',
+							icon: 'none'
+						})
+					} else {
+						params.customer = that.user._id;
+						params.apply_time = moment().format('YYYY-MM-DD HH:mm:ss')
+						const arr = await that.$api(`/cashOut`, 'POST', params);
+						if (arr.errcode == '0') {
+							uni.showToast({
+								title: `提现申请成功`,
+								icon: 'success',
+							});
+							that.$refs.popup.close();
+							that.clearPage();
+							that.search()
+						} else {
+							uni.showToast({
+								title: arr.errmsg,
+								icon: 'none',
+							})
+						}
+					}
 				})
 			},
 			// 明细
-			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 +366,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 +438,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>

+ 64 - 12
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,36 @@
 					<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.deal_person}}</view>
+				</view>
+				<view class="two">
+					<view class="left">申请时间</view>
+					<view class="right">{{info.apply_time}}</view>
+				</view>
+				<view class="two">
+					<view class="left">审核时间</view>
+					<view class="right">{{info.exam_time}}</view>
+				</view>
+				<view class="two">
+					<view class="left">申请理由</view>
+					<view class="right">{{info.apply_reason}}</view>
+				</view>
+				<view class="two">
+					<view class="left">审核理由</view>
+					<view class="right">{{info.exam_reason}}</view>
+				</view>
+				<view class="two">
+					<view class="left">审核状态</view>
+					<view class="right">{{info.zhStatus}}</view>
+				</view>
+			</view>
 		</view>
 	</mobile-frame>
 </template>
@@ -32,10 +62,14 @@
 		data() {
 			return {
 				id: '',
+				// 类型
+				type: '',
 				user: {},
 				info: {},
-				// 状态
+				// 收益状态
 				statusList: [],
+				// 提现状态
+				cashstatusList: [],
 				// 来源
 				sourceList: [],
 			};
@@ -43,6 +77,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();
 		},
@@ -63,6 +98,12 @@
 				if (res.errcode == '0') {
 					that.$set(that, `sourceList`, res.data)
 				}
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "withdrawal_exam_status"
+				});
+				if (res.errcode == '0') {
+					that.$set(that, `cashstatusList`, res.data)
+				}
 			},
 			// 监听用户是否登录
 			watchLogin() {
@@ -74,16 +115,27 @@
 						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(`/cashOut/${that.id}`, 'GET')
+									if (arr.errcode == '0') {
+										let status = that.cashstatusList.find(i => i.value == arr.data.status)
+										if (status) arr.data.zhStatus = status.label;
+										that.$set(that, `info`, arr.data)
+									}
 								}
 							}
 						}