zs 2 years ago
parent
commit
5c32461431
2 changed files with 59 additions and 23 deletions
  1. 32 7
      pagesMy/assets/index.vue
  2. 27 16
      pagesMy/assets/info.vue

+ 32 - 7
pagesMy/assets/index.vue

@@ -57,8 +57,8 @@
 							可提现金额为{{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 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>
@@ -70,6 +70,7 @@
 </template>
 
 <script>
+	import moment from 'moment';
 	import tabs from '@/components/tabs/index.vue';
 	export default {
 		components: {
@@ -107,7 +108,7 @@
 							errorMessage: '请输入提现金额',
 						}]
 					},
-					reason: {
+					apply_reason: {
 						rules: [{
 							required: true,
 							errorMessage: '请输入提现理由',
@@ -170,17 +171,18 @@
 					let info = {
 						skip: that.skip,
 						limit: that.limit,
-						inviter: user._id,
 					}
 					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(`/cashBack`, 'GET', {
+						res = await that.$api(`/cashOut`, 'GET', {
 							...info,
 						})
 					}
@@ -267,7 +269,6 @@
 						title: '输入金额不能超过可提现金额',
 						icon: 'none'
 					})
-					return
 				}
 			},
 			// 全部提现
@@ -278,8 +279,32 @@
 			// 提交保存
 			async onSubmit(ref) {
 				const that = this;
+				let money = that.moneyInfo.payTotal;
 				that.$refs[ref].validate().then(async params => {
-					console.log(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',
+							})
+						}
+					}
 				})
 			},
 			// 明细

+ 27 - 16
pagesMy/assets/info.vue

@@ -29,20 +29,28 @@
 					<view class="right">-{{info.money}}</view>
 				</view>
 				<view class="two">
-					<view class="left">状态</view>
-					<view class="right">{{info.zhStatus}}</view>
+					<view class="left">审核处理人</view>
+					<view class="right">{{info.deal_person}}</view>
 				</view>
 				<view class="two">
-					<view class="left">提现时间</view>
-					<view class="right">{{info.time}}</view>
+					<view class="left">申请时间</view>
+					<view class="right">{{info.apply_time}}</view>
 				</view>
 				<view class="two">
-					<view class="left">推荐人</view>
-					<view class="right">{{info.inviter_name}}</view>
+					<view class="left">审核时间</view>
+					<view class="right">{{info.exam_time}}</view>
 				</view>
 				<view class="two">
-					<view class="left">提现理由</view>
-					<view class="right">{{info.zhSource}}</view>
+					<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>
@@ -58,8 +66,10 @@
 				type: '',
 				user: {},
 				info: {},
-				// 状态
+				// 收益状态
 				statusList: [],
+				// 提现状态
+				cashstatusList: [],
 				// 来源
 				sourceList: [],
 			};
@@ -88,6 +98,12 @@
 				if (res.errcode == '0') {
 					that.$set(that, `sourceList`, res.data)
 				}
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "cashOut_status"
+				});
+				if (res.errcode == '0') {
+					that.$set(that, `cashstatusList`, res.data)
+				}
 			},
 			// 监听用户是否登录
 			watchLogin() {
@@ -114,15 +130,10 @@
 									}
 								} else {
 									// 提现记录
-									let arr = await that.$api(`/cashBack/${that.id}`, 'GET')
+									let arr = await that.$api(`/cashOut/${that.id}`, 'GET')
 									if (arr.errcode == '0') {
-										let status = that.statusList.find(i => i.value == arr.data.status)
+										let status = that.cashstatusList.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)
 									}
 								}