|
@@ -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>
|