123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- <template>
- <view class="container">
- <view class="logo"><image :src="moneyData.logo"></image></view>
- <view class="select-box flex_item">
- <view @tap="handleTap('picker')">{{ title }}</view>
- <lb-picker
- ref="picker"
- v-model="value"
- mode="selector"
- :list="typeList"
- :dataset="{ name: 'type' }"
- @change="handleChange"
- @confirm="handleConfirm"
- @cancel="handleCancel"
- ></lb-picker>
- <image src="../../static/img/xiaj.png"></image>
- </view>
- <view class="list" v-show="list.length > 0">
- <view class="list-box" v-for="(ls, index) in list" :key="index" @click="nav(index)">
- <view class="flex">
- <view class="list-tpl flex_item">
- <image src="../../static/img/qian.png"></image>
- <view class="tpl-name">{{ ls.title }}</view>
- </view>
- <view class="num clamp" v-if="ls.pm === 0">- {{ ls.number }}</view>
- <view class="num clamp" v-else>+ {{ ls.number }}</view>
- </view>
- <view class="tpl-time" v-if="ls.status == 1">{{ ls.add_time }}</view>
- <view class="tpl-time" v-if="ls.status == 0">待发放</view>
- </view>
- </view>
- <u-loadmore :status="loadType"></u-loadmore>
- <view class="empty-box" v-show="list.length == 0"><u-empty></u-empty></view>
- <view class="flex submit-box">
- <view class="submit" @click="recharge" v-if="moneyData.isTi">充币</view>
- <view class="tip" v-if="moneyData.type==1"></view>
- <view class="submit" @click="withdraw" v-if="moneyData.type==1">提币</view>
- </view>
- <uni-popup ref="mation" type="center">
- <view class="popup">
- <view class="cancel flex" @click="close2"><view class="tip">x</view></view>
- <view class="list-boxs">
- <view class="textBox flex">
- <view class="font">交易前:</view>
- <view class="number">{{ before * 1 }} {{ moneyData.code }}</view>
- </view>
- <view class="xian"></view>
- <view class="textBox flex">
- <view class="font">交易额:</view>
- <view class="number">{{ pm }}{{ number * 1 }} {{ moneyData.code }}</view>
- </view>
- <view class="xian"></view>
- <view class="textBox flex">
- <view class="font">交易后:</view>
- <view class="number">{{ balance * 1 }} {{ moneyData.code }}</view>
- </view>
- <view class="xian"></view>
- <scroll-view scroll-y="true" class="textBox">
- <view class="font">流水详情:</view>
- <view class="text">{{ text }}</view>
- </scroll-view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import { moneyLog, recharge, wallet } from '@/api/finance.js';
- import LbPicker from '@/components/lb-picker';
- export default {
- components: {
- LbPicker
- },
- data() {
- return {
- title: '筛选',
- type: '',//当前筛选的类型查询用
- value: '',//当前选中的类型名称
- typeList: [],//记录列表
- list: [],//历史记录列表
- // num: '',//充值金额
- moneyTypeList: [],
- text: '',//当前选中的流水详情
- balance: '',//当前选中的流水金额
- before: '',//交易前金额
- number: '',//当前选中的弹窗交易金额
- pm: '',
- less: '',
- page: 1,
- limit: 10,
- loadType:'loadmore',
- isLast: true,
- name: '', //币名称
- moneyData: {
- code: '',
- money: '',
- name: '',
- logo: '',
- type:'',
- }
- };
- },
- onReachBottom(){
- this.getdata();
- },
- onLoad(option) {
- this.name = option.name;
- this.moneyType();
- this.loadData();
- },
- onShow() {},
- methods: {
- async loadData() {
- let obj = this;
- uni.showLoading({
- title: '加载中'
- });
- this.getdata()
- },
- getdata(){
- let obj = this;
- if(obj.loadType == 'nomore'){
- return
- }
- if(obj.loadType == "loading"){
- return
- }
- obj.loadType = "loading"
- moneyLog(
- {
- page: obj.page,
- limit: obj.limit,
- type: obj.type
- },
- obj.name
- ).then(({ data }) => {
- obj.typeList = data.type_list;
- obj.typeList.unshift({
- title:'全部',
- type:''
- })
- obj.list = obj.list.concat(data.list);
- console.log(obj.list);
- if(data.list.length == obj.limit){
- obj.loadType = 'loadmore';
- obj.page++
- }else {
- obj.loadType = 'nomore'
- }
- uni.hideLoading();
- });
- },
- // 所有币种
- async moneyType() {
-
- let obj = this;
- wallet({}).then(({ data }) => {
- const dat = data.back[this.name];
- obj.moneyData.logo = dat.LOGO;
- obj.moneyData.name = dat.name;
- obj.moneyData.code = dat.code;
- obj.moneyData.money = dat.money.money;
- obj.moneyData.type = +dat.can_cash
- if(dat.money.address){
- obj.moneyData.isTi = true
- }else {
- obj.moneyData.isTi = false
- }
- console.log(obj.moneyData)
- });
- },
- selectOne(options) {
- this.name = options.name;
- this.moneyData.code = options.code;
- },
- useOutClickSide() {
- this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
- },
- handleTap(name) {
- this.$refs[name].show();
- },
- handleChange(e) {
- // this.title = e.item.title;
- // this.type = e.item.type;
- },
- handleConfirm(e) {
- this.title = e.item.title;
- this.type = e.item.type;
- this.loadData();
- },
- handleCancel(e) {},
- // 充币按钮跳转页面
- recharge() {
- uni.navigateTo({
- url:'/pages/assets/recharge'
- })
- },
- withdraw() {
- uni.navigateTo({
- url:'/pages/assets/withdraw?name=' + this.name
- })
- },
- close() {
- this.$refs.popup.close();
- },
- navTo(url) {
- uni.navigateTo({
- url
- });
- },
- nav(index) {
- const obj = this;
- obj.text = obj.list[index].mark;
- obj.balance = obj.list[index].balance;
- obj.number = obj.list[index].number;
- if (obj.list[index].pm == 1) {
- obj.pm = '+';
- obj.before = obj.subNum(obj.balance, obj.number);
- } else {
- obj.pm = '-';
- obj.before = this.addNum(obj.balance, obj.number);
- }
- this.$refs.mation.open();
- },
- addNum(num1, num2) {
- let sq1, sq2, multiple;
- try {
- sq1 = num1.toString().split('.')[1].length;
- } catch (e) {
- sq1 = 0;
- }
- try {
- sq2 = num2.toString().split('.')[1].length;
- } catch (e) {
- sq2 = 0;
- }
- multiple = Math.pow(10, Math.max(sq1, sq2) + 1);
- return (num1 * multiple + num2 * multiple) / multiple;
- },
- close2() {
- this.$refs.mation.close();
- },
- subNum(num1, num2) {
- let sq1, sq2, multiple;
- try {
- sq1 = num1.toString().split('.')[1].length;
- } catch (e) {
- sq1 = 0;
- }
- try {
- sq2 = num2.toString().split('.')[1].length;
- } catch (e) {
- sq2 = 0;
- }
- multiple = Math.pow(10, Math.max(sq1, sq2) + 1);
- return (num1 * multiple - num2 * multiple) / multiple;
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- min-height: 100%;
- background-color: #ffffff;
- .container {
- width: 100%;
- padding: 60rpx 30rpx 120rpx 30rpx;
- }
- }
- .logo {
- text-align: center;
- image {
- width: 119rpx;
- height: 119rpx;
- }
- }
- .select-box {
- position: absolute;
- right: 0;
- padding: 30rpx 30rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: #333333;
- image {
- width: 21rpx;
- height: 11rpx;
- margin-left: 15rpx;
- }
- .select-name {
- padding-right: 15rpx;
- }
- }
- .list {
- margin-top: 120rpx;
- }
- .list-box {
- padding: 60rpx 0rpx 30rpx 0rpx;
- font-size: 30rpx;
- font-weight: 400;
- color: #333333;
- .tpl-time {
- font-size: 24rpx;
- font-weight: 400;
- color: #999999;
- width: 100%;
- text-align: right;
- padding-top: 25rpx;
- }
- .list-tpl {
- image {
- width: 39rpx;
- height: 43rpx;
- }
- .tpl-name {
- padding: 0rpx 15rpx 0rpx 30rpx;
- }
- }
- .num {
- font-size: 36rpx;
- font-weight: 400;
- color: #fb3a2f;
- width: 50%;
- text-align: right;
- }
- }
- .empty-box {
- width: 100%;
- height: 500rpx;
- padding-top: 200rpx;
- }
- .submit-box {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- background: linear-gradient(90deg, #60BAB0, #45969B);
- color: #ffffff;
- text-align: center;
- .submit {
- padding: 20rpx 20%;
- flex-grow: 1;
- }
- .tip {
- width: 2rpx;
- height: 37rpx;
- background: #ffffff;
- }
- }
- //弹窗
- .popup {
- background-color: #ffffff;
- border-radius: 25rpx;
- font-size: 30rpx;
- .cancel {
- text-align: center;
- width: 100%;
- line-height: 60rpx;
- .tip {
- background-color: #5771df;
- color: #ffffff;
- width: 70rpx;
- height: 70rpx;
- border-top-right-radius: 25rpx;
- }
- }
- .list-boxs {
- padding: 0rpx 80rpx;
- .password {
- padding: 50rpx 0rpx;
- width: 100%;
- input {
- width: 70%;
- height: 80rpx;
- border: 2rpx solid #999999;
- padding-left: 25rpx;
- box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.27);
- border-radius: 11rpx;
- }
- }
- .confirm-btn {
- padding-bottom: 120rpx;
- padding-top: 30rpx;
- text {
- background-color: #5771df;
- color: #ffffff;
- width: 70%;
- text-align: center;
- padding: 25rpx 90rpx;
- border-radius: 15rpx;
- }
- }
- }
- }
- .popup {
- height: 618rpx;
- background: #ffffff;
- box-shadow: 3rpx 3rpx 6rpx 0rpx rgba(31, 31, 31, 0.17);
- border-radius: 40rpx;
- width: 700rpx;
- .cancel {
- text-align: center;
- width: 100%;
- line-height: 60rpx;
- position: relative;
- .tip {
- color: #000000;
- width: 70rpx;
- height: 70rpx;
- position: absolute;
- top: 0;
- right: 0;
- background-color: #fff;
- }
- }
- .list-boxs {
- width: 90%;
- margin: 0 auto;
- margin-top: 100rpx;
- .textBox {
- padding: 24rpx 18rpx;
- .font {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #4f4f4f;
- }
- .number {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #fb3a2f;
- }
- .text {
- text-indent: 2em;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #4f4f4f;
- }
- }
- .xian {
- width: 100%;
- height: 1px;
- background: #e7dfe8;
- }
- }
- }
- </style>
|