初始化代码
This commit is contained in:
113
uniapp/uni-app/mine/pages/balance/index.vue
Normal file
113
uniapp/uni-app/mine/pages/balance/index.vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<view class="mine-balance-index rel" v-if="isLoad">
|
||||
<view class="count-info flex-center flex-column c-base" :style="{background:primaryColor}">
|
||||
<view class="f-caption">{{mineInfo.is_user?'我的余额(元)':'可提余额(元)'}}</view>
|
||||
<view class="price mt-sm">{{mineInfo.is_user?mineInfo.balance:mineInfo.wallet_cash}}</view>
|
||||
<view class="flex-center btn-list f-paragraph mt-lg pt-lg">
|
||||
<view @tap.stop="$util.goUrl({url:`/mine/pages/balance/list`})"
|
||||
class="item-child flex-center fill-base c-title mr-lg radius">充值</view>
|
||||
<view @tap.stop="$util.goUrl({url:`/mine/pages/cash-out?type=business`})"
|
||||
class="item-child flex-center c-base radius" v-if="!mineInfo.is_user">提现</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="money-count fill-base flex-center pt-lg pb-lg" v-if="!mineInfo.is_user">
|
||||
<view class="item-child flex-center flex-column b-1px-r">
|
||||
<view class="flex-y-baseline f-lg-title">{{mineInfo.balance}}</view>
|
||||
<view class="f-caption c-caption">总金额(元)</view>
|
||||
</view>
|
||||
<view class="item-child flex-center flex-column">
|
||||
<view class="flex-y-baseline f-lg-title">{{mineInfo.frozen_cash}}</view>
|
||||
<view class="f-caption c-caption">不可用余额(元)</view>
|
||||
</view>
|
||||
</view>
|
||||
<view @tap.stop="$util.goUrl({url:`/mine/pages/balance/record`})" class="flex-between mt-md pd-lg fill-base">
|
||||
<view class="f-title c-title">交易记录</view>
|
||||
<i class="iconfont icon-right"></i>
|
||||
</view>
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions
|
||||
} from "vuex"
|
||||
import tabbar from "@/components/tabbar.vue"
|
||||
export default {
|
||||
components: {
|
||||
tabbar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detail: {},
|
||||
isLoad: false
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
commonOptions: state => state.user.commonOptions,
|
||||
userInfo: state => state.user.userInfo,
|
||||
mineInfo: state => state.user.mineInfo,
|
||||
}),
|
||||
onLoad() {
|
||||
this.$util.setNavigationBarColor({
|
||||
color: '#ffffff',
|
||||
bg: '#39b54a'
|
||||
});
|
||||
this.initIndex()
|
||||
},
|
||||
onUnload() {
|
||||
this.$util.back()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getMineInfo']),
|
||||
async initIndex() {
|
||||
await this.getMineInfo()
|
||||
this.$util.hideAll()
|
||||
this.isLoad = true
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.mine-balance-index {
|
||||
|
||||
.count-info {
|
||||
height: 450rpx;
|
||||
|
||||
.price {
|
||||
font-size: 70rpx;
|
||||
}
|
||||
|
||||
.btn-list {
|
||||
.item-child {
|
||||
width: 240rpx;
|
||||
height: 64rpx;
|
||||
border: 1rpx solid #fff;
|
||||
transform: rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.money-count {
|
||||
.item-child {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
313
uniapp/uni-app/mine/pages/balance/list.vue
Normal file
313
uniapp/uni-app/mine/pages/balance/list.vue
Normal file
@@ -0,0 +1,313 @@
|
||||
<template>
|
||||
<view class="mine-balance-list">
|
||||
<view class="count-info flex-center flex-column c-base" :style="{background:primaryColor}">
|
||||
<view class="f-caption">当前余额(元)</view>
|
||||
<view class="price mt-sm">{{userInfo.balance}}</view>
|
||||
</view>
|
||||
<view class="flex-center fill-base mg-big pd-lg box-shadow radius-24" v-for="(item,index) in list.data"
|
||||
:key="index">
|
||||
<view class="flex-1 mr-lg">
|
||||
<view class="flex-y-baseline f-caption c-warning text-bold">
|
||||
¥<view class="f-sm-title">{{item.price}}</view>
|
||||
</view>
|
||||
<view class="f-caption c-desc mt-sm">{{item.title}}</view>
|
||||
<view class="f-caption mt-sm" :style="{color:primaryColor}" v-if="item.member_level*1>0">
|
||||
{{item.member_title}}
|
||||
</view>
|
||||
</view>
|
||||
<view @tap.stop="toChangeItem('chooseInd',index)" class="stored-btn flex-center f-caption c-base radius-4"
|
||||
:style="{background:primaryColor}">立即充值
|
||||
</view>
|
||||
</view>
|
||||
<view class="fill-base mg-big pd-lg box-shadow radius-24">
|
||||
<view class="input-item flex-between radius-16">
|
||||
<input v-model="price" v-on:input="checkInput($event,'price')" type="digit"
|
||||
class="flex-1 mr-lg pt-md pb-md pl-lg f-paragraph c-title" placeholder="请输入充值金额,无赠送"
|
||||
placeholder-class="f-paragraph c-caption" />
|
||||
<view @tap.stop="toChangeItem('chooseInd','price')" class="stored-btn flex-center f-caption c-base"
|
||||
:style="{background:primaryColor}">立即充值
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fill-base mg-big pd-lg box-shadow radius-24">
|
||||
<view class="flex-y-center mb-lg">
|
||||
<view class="common-line" :style="{background:primaryColor}"></view>
|
||||
<view class="f-title c-title text-bold">充值说明</view>
|
||||
</view>
|
||||
<view class="f-desc c-caption" v-html="text"></view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="space-footer"></view>
|
||||
|
||||
<uni-popup ref="choose_item" type="bottom" :custom="true">
|
||||
<view @touchmove.stop.prevent class="popup-choose-item fill-base pt-lg pb-lg radius-top-34">
|
||||
<view @tap.stop="$refs.choose_item.close()" class="flex-between pl-lg pr-lg pb-lg" style="width: 100%;">
|
||||
<view class="flex-center f-title c-title text-bold">选择支付方式</view>
|
||||
<i class="iconfont icon-add-circle rotate-45" :style="{color:subColor}"></i>
|
||||
</view>
|
||||
|
||||
<view @tap.stop="toChangeItem('payInd',index)" class="flex-between ml-md mr-md pl-sm pr-sm pt-lg pb-lg"
|
||||
:class="[{'b-1px-t':index>0}]" v-for="(item,index) in payList" :key="index">
|
||||
<view class="pay-item flex-y-center"><i class="iconfont mr-md" :class="[item.icon]"
|
||||
:style="{color:item.id==1?primaryColor:'#01AAF2'}"></i>
|
||||
<view class="flex-y-baseline">{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
<i class="pay-icon iconfont c-caption"
|
||||
:class="[{'icon-xuanze':payInd != index},{'icon-radio-fill':payInd == index}]"
|
||||
:style="{color:payInd==index?primaryColor:''}"></i>
|
||||
</view>
|
||||
<view class="space-lg"></view>
|
||||
<view @tap="toPay" class="pay-btn flex-center f-title c-base radius" :style="{background:primaryColor}">
|
||||
立即支付</view>
|
||||
<view class="space-lg"></view>
|
||||
<view class="space-safe"></view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 1微信支付;2余额支付;3支付宝支付
|
||||
payList: [{
|
||||
id: 1,
|
||||
title: '微信支付',
|
||||
icon: 'icon-wechat-pay'
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
, {
|
||||
id: 3,
|
||||
title: '支付宝支付',
|
||||
icon: 'icon-alipay',
|
||||
is_disabled: false
|
||||
}
|
||||
// #endif
|
||||
],
|
||||
payInd: 0,
|
||||
chooseInd: 0,
|
||||
param: {
|
||||
page: 1,
|
||||
limit: 10
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false,
|
||||
text: `
|
||||
<p>1、充值的本金和赠送金额均不可提现、转移、转赠</p>
|
||||
<p>2、使用范围:本平台所有项目或者商品皆可购买</p>`,
|
||||
price: ''
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
async onLoad() {
|
||||
this.$util.showLoading()
|
||||
await this.initIndex()
|
||||
},
|
||||
onUnload() {
|
||||
this.$util.back()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getUserInfo']),
|
||||
async initIndex() {
|
||||
await this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
} = this
|
||||
let newList = await this.$api.mine.cardList(param);
|
||||
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.$util.hideAll()
|
||||
},
|
||||
checkInput(e, key) {
|
||||
let val = this.$util.formatMoney(e.detail.value)
|
||||
this.$nextTick(() => {
|
||||
this[key] = val
|
||||
})
|
||||
},
|
||||
toChangeItem(key, val) {
|
||||
this[key] = val
|
||||
if (key === 'payInd') return
|
||||
this.$refs.choose_item.open()
|
||||
this.lockTap = false
|
||||
},
|
||||
//表单验证
|
||||
validate(param) {
|
||||
let validate = new this.$util.Validate();
|
||||
validate.add(param.price, {
|
||||
name: "price",
|
||||
checkType: "isMoney",
|
||||
errorMsg: "请输入充值金额"
|
||||
});
|
||||
let message = validate.start();
|
||||
return message;
|
||||
},
|
||||
// 去支付
|
||||
async toPay() {
|
||||
let {
|
||||
chooseInd,
|
||||
price
|
||||
} = this
|
||||
let param = {}
|
||||
if (chooseInd == 'price') {
|
||||
param = {
|
||||
price
|
||||
}
|
||||
let msg = this.validate(param);
|
||||
if (msg) {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
let {
|
||||
id: card_id,
|
||||
} = this.list.data[chooseInd]
|
||||
param = {
|
||||
card_id
|
||||
}
|
||||
}
|
||||
let {
|
||||
id: pay_model
|
||||
} = this.payList[this.payInd]
|
||||
param.pay_model = pay_model
|
||||
if (this.lockTap) return;
|
||||
this.lockTap = true;
|
||||
this.$util.showLoading()
|
||||
try {
|
||||
let {
|
||||
pay_list
|
||||
} = await this.$api.mine.payBalanceOrder(param)
|
||||
this.$util.hideAll()
|
||||
if (pay_list) {
|
||||
if (param.pay_model == 3) {
|
||||
pay_list = {
|
||||
orderInfo: pay_list,
|
||||
provider: 'alipay'
|
||||
}
|
||||
}
|
||||
try {
|
||||
console.log(pay_list, "========pay_listpay_listpay_listpay_list")
|
||||
await this.$util.pay(pay_list)
|
||||
this.lockTap = false;
|
||||
this.price = ''
|
||||
this.$refs.choose_item.close()
|
||||
this.getUserInfo()
|
||||
this.$util.back()
|
||||
let url = `/mine/pages/stored/record`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
} catch (e) {
|
||||
this.lockTap = false;
|
||||
this.price = ''
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
this.price = ''
|
||||
this.$util.hideAll()
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.mine-balance-list {
|
||||
.count-info {
|
||||
height: 338rpx;
|
||||
|
||||
.price {
|
||||
font-size: 70rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.input-item {
|
||||
overflow: hidden;
|
||||
background: #F9F9F9;
|
||||
|
||||
.stored-btn {
|
||||
width: 134rpx;
|
||||
height: 88rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.stored-btn {
|
||||
width: 132rpx;
|
||||
height: 58rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.popup-choose-item {
|
||||
.icon-add-circle {
|
||||
font-size: 50rpx;
|
||||
}
|
||||
|
||||
.pay-item {
|
||||
.iconfont {
|
||||
font-size: 50rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.pay-icon {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.pay-btn {
|
||||
width: 500rpx;
|
||||
height: 88rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
295
uniapp/uni-app/mine/pages/balance/record.vue
Normal file
295
uniapp/uni-app/mine/pages/balance/record.vue
Normal file
@@ -0,0 +1,295 @@
|
||||
<template>
|
||||
<view class="mine-stored-record">
|
||||
<fixed>
|
||||
<view class="fill-base b-1px-b">
|
||||
<view class="pl-lg pr-lg">
|
||||
<view class="space-lg"></view>
|
||||
<uni-segmented-control :current="typeInd" :values="typeList"
|
||||
@clickItem="handerTabChange($event,'typeInd')" style-type="button" :active-color="primaryColor">
|
||||
</uni-segmented-control>
|
||||
</view>
|
||||
<tab @change="handerTabChange($event,'activeIndex')" :list="tabList"
|
||||
:lockTap="activeIndex==2&&tabList[2].start_time&&tabList[2].end_time ? false : true"
|
||||
:activeIndex="activeIndex" :activeColor="primaryColor" :width="100/tabList.length + '%'"
|
||||
height="100rpx"></tab>
|
||||
</view>
|
||||
</fixed>
|
||||
|
||||
<view class="fill-base pd-lg b-1px-b" v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between">
|
||||
<view class="max-446 ellipsis">{{typeType[item.type]}}</view>
|
||||
<view class="text-bold" :style="{color:primaryColor}">{{item.add?'+':'-'}} {{item.price}}</view>
|
||||
</view>
|
||||
<view class="flex-between f-caption c-desc mt-sm">
|
||||
<view class="c-caption">{{item.create_time}}</view>
|
||||
<view>余额:{{item.after_balance}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
|
||||
</load-more>
|
||||
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||
|
||||
<view class="space-footer"></view>
|
||||
|
||||
<uni-popup ref="show_choose_time" type="top" :custom="true" :maskClick="false">
|
||||
<view style="height: 184rpx;"></view>
|
||||
<view class="popup-choose-time fill-base f-paragraph c-desc pt-lg pb-lg radius-bottom-34">
|
||||
<view class="time-item flex-center pt-lg">
|
||||
<view @tap.stop="toShowTime('start_time')" class="item-child flex-center flex-column">
|
||||
<view>开始时间</view>
|
||||
<view class="mt-sm" :style="{color:tabList[2].start_time ? primaryColor : '#999'}">
|
||||
{{tabList[2].start_time || '选择时间'}}
|
||||
</view>
|
||||
</view>
|
||||
<view @tap.stop="toShowTime('end_time')" class="item-child flex-center flex-column b-1px-l">
|
||||
<view>结束时间</view>
|
||||
<view class="mt-sm" :style="{color:tabList[2].end_time ? primaryColor : '#999'}">
|
||||
{{tabList[2].end_time || '选择时间'}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="button-item flex-center">
|
||||
<view @tap.stop="toConfirm(1)" class="item-child disabled flex-center"> 取消 </view>
|
||||
<view @tap.stop="toConfirm(2)" class="item-child flex-center"
|
||||
:style="{background: primaryColor,color:'#fff'}"> 确定
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
<w-picker mode="date" :startYear="startYear" :endYear="endYear" :value="tabList[0].end_time" :current="false"
|
||||
fields="day" @confirm="onConfirm($event)" :disabled-after="false" ref="day" :themeColor="primaryColor"
|
||||
:visible.sync="showDate">
|
||||
</w-picker>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
import uniSegmentedControl from "@/components/uni-segmented-control.vue"
|
||||
import wPicker from "@/components/w-picker/w-picker.vue";
|
||||
export default {
|
||||
components: {
|
||||
uniSegmentedControl,
|
||||
wPicker
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
startYear: '',
|
||||
endYear: '',
|
||||
showKey: '',
|
||||
showDate: false,
|
||||
typeType: {
|
||||
1: '购买储值卡',
|
||||
2: '认养订单',
|
||||
3: '认养配送订单',
|
||||
4: '配送订单退款',
|
||||
5: '养殖订单',
|
||||
6: '土地订单',
|
||||
7: '商城交易支付',
|
||||
8: '提现',
|
||||
9: '土地配送订单',
|
||||
10: '商城订单退款',
|
||||
11: '商城交易收入',
|
||||
12: '拒绝提现',
|
||||
13: '认养订单退款',
|
||||
14: '',
|
||||
15: ''
|
||||
},
|
||||
typeList: [{
|
||||
id: 1,
|
||||
title: '收入记录'
|
||||
}, {
|
||||
id: 0,
|
||||
title: '支出记录'
|
||||
}],
|
||||
typeInd: 0,
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 1,
|
||||
title: '本周',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
}, {
|
||||
id: 2,
|
||||
title: '本月',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
}, {
|
||||
id: 3,
|
||||
title: '自定义',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
}],
|
||||
preTime: {
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
}),
|
||||
onLoad() {
|
||||
this.$util.showLoading()
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
let cur_time = new Date(Math.ceil(new Date().getTime()))
|
||||
const currentDate = new Date()
|
||||
//返回date是一周中的某一天
|
||||
const week = currentDate.getDay()
|
||||
//一天的毫秒数
|
||||
const millisecond = 1000 * 60 * 60 * 24
|
||||
//减去的天数
|
||||
const minusDay = week != 0 ? week - 1 : 6
|
||||
//本周 周一
|
||||
const monday = new Date(currentDate.getTime() - minusDay * millisecond)
|
||||
//本周 周日
|
||||
const sunday = new Date(monday.getTime() + 6 * millisecond)
|
||||
|
||||
this.tabList[0].start_time = this.$util.formatTime(monday, 'YY-M-D')
|
||||
this.tabList[0].end_time = this.$util.formatTime(sunday, 'YY-M-D')
|
||||
this.tabList[1].start_time = this.$util.formatTime(cur_time, 'YY-M') + '-01'
|
||||
this.tabList[1].end_time = this.$util.formatTime(cur_time, 'YY-M-D')
|
||||
let year = this.$util.formatTime(cur_time, 'YY') * 1
|
||||
this.startYear = year - 5
|
||||
this.endYear = year
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
activeIndex,
|
||||
tabList,
|
||||
typeInd,
|
||||
typeList,
|
||||
} = this
|
||||
let {
|
||||
start_time,
|
||||
end_time
|
||||
} = tabList[activeIndex]
|
||||
let param = this.$util.deepCopy(this.param)
|
||||
param.add = typeList[typeInd].id
|
||||
param.start_time = this.$util.DateToUnix(start_time)
|
||||
param.end_time = this.$util.DateToUnix(end_time) + 24 * 3600 - 1
|
||||
let newList = await this.$api.mine.userConsumeWater(param);
|
||||
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.$util.hideAll()
|
||||
},
|
||||
handerTabChange(index, key, ind = 2) {
|
||||
this[key] = index;
|
||||
if (key == 'activeIndex') {
|
||||
let methodModel = index == ind ? 'open' : 'close'
|
||||
this.$refs.show_choose_time[methodModel]()
|
||||
if (index == ind) return
|
||||
} else {
|
||||
this.$refs.show_choose_time.close()
|
||||
}
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
toShowTime(key, ind = 2) {
|
||||
if (key == 'end_time' && !this.tabList[ind].start_time) {
|
||||
this.$util.showToast({
|
||||
title: `请选择开始时间`
|
||||
})
|
||||
return
|
||||
}
|
||||
this.showKey = key
|
||||
this.showDate = true
|
||||
},
|
||||
async onConfirm(val, ind = 2) {
|
||||
let {
|
||||
start_time,
|
||||
end_time
|
||||
} = this.tabList[ind]
|
||||
let {
|
||||
showKey
|
||||
} = this
|
||||
if ((end_time && showKey == 'start_time' && this.$util.DateToUnix(end_time) < this.$util.DateToUnix(val
|
||||
.result)) || (
|
||||
showKey == 'end_time' && this.$util.DateToUnix(start_time) > this.$util.DateToUnix(val.result)
|
||||
)) {
|
||||
this.$util.showToast({
|
||||
title: `结束时间不能小于开始时间`
|
||||
})
|
||||
return
|
||||
}
|
||||
this.tabList[ind][showKey] = val.result;
|
||||
if (showKey == 'end_time') {
|
||||
this.showDate = false
|
||||
}
|
||||
},
|
||||
toConfirm(type, ind = 2) {
|
||||
let {
|
||||
start_time = '',
|
||||
end_time = ''
|
||||
} = type == 1 ? this.preTime : this.tabList[ind]
|
||||
if (type == 1) {
|
||||
this.tabList[ind].start_time = start_time
|
||||
this.tabList[ind].end_time = end_time
|
||||
} else {
|
||||
if (!start_time || !end_time) {
|
||||
this.$util.showToast({
|
||||
title: !start_time ? `请选择开始时间` : `请选择结束时间`
|
||||
})
|
||||
return
|
||||
}
|
||||
this.preTime.start_time = start_time
|
||||
this.preTime.end_time = end_time
|
||||
}
|
||||
this.activeIndex = start_time && end_time ? ind : 0
|
||||
this.$refs.show_choose_time.close()
|
||||
this.param.page = 1
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
Reference in New Issue
Block a user