123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600 |
- <template>
- <view class="all">
-
- {{ item }}
-
- <view style="padding-top: 0;">
- <view class="listBox">
- <view class="titleTetx">数量</view>
- <view class="flex listTpl">
- <input type="number" class="inputBox" v-model="number" placeholder="请输入数量" />
- <view class="flex_item">
- <view class="listTip">USDT</view>
- <view class="listAll" @click="number=money">全部</view>
- </view>
- </view>
- <view class="flex tipBox">
- <view class="tip1">可用余额{{money}}USDT</view>
- <view class="tip1">限额{{baseData.min_sell}}到{{baseData.max_sell}}个</view>
- </view>
- </view>
- <view class="listBox" style="padding-top: 0rpx;">
- <view class="listTpl">
- <input type="number" class="inputBox" v-model="price" placeholder="请输入单价" />
- </view>
- <view class="flex tipBox">
- <view class="tip1">单价不得大于参考汇率</view>
- </view>
- </view>
- <template v-if="actionitem.length > 0" v-for="(item,index) in actionitem">
- <view class="bankList flex">
- <view class="infoTpl">
- <view class="tplName flex_item">
- <image src="/static/image/bank.png" class="typeTipImg" v-if="item.type == 'bank'"
- mode="widthFix"></image>
- <image src="/static/image/wx.png" class="typeTipImg" v-if="item.type == 'wx'"
- mode="widthFix"></image>
- <image src="/static/image/alipay.png" class="typeTipImg" v-if="item.type == 'alipay'"
- mode="widthFix"></image>
- <view class="titleBox">
- <view class="tip">{{item.name}}</view>
- </view>
- </view>
- </view>
- <view class="det" @click="showBank = true">
- 修改
- </view>
- </view>
- </template>
- <view class="submission">
- <button class="golden" type="golden" hover-class="none" @click="submission">一键卖币</button>
- </view>
- <view class="tips">*参考汇率{{baseData.us_price}}</view>
- </view>
- <uni-popup ref="popup" :is-mask-click="false" type="bottom" @maskClick="showBank = false">
- <view class="alertBottom">
- <view class="flex alertTitle">
- <view class="alertTitleName">
- 选择支付方式
- </view>
- <uni-icons type="close" size="28" @click="showBank = false"></uni-icons>
- </view>
- <view class="bankList flex" @click="bankSelect(item)" v-if="bankList.length > 0"
- v-for="(item,index) in bankList">
- <view class="infoTpl">
- <view class="tplName flex_item">
- <image src="/static/image/bank.png" class="typeTipImg" v-if="item.type == 'bank'"
- mode="widthFix"></image>
- <image src="/static/image/wx.png" class="typeTipImg" v-if="item.type == 'wx'"
- mode="widthFix"></image>
- <image src="/static/image/alipay.png" class="typeTipImg" v-if="item.type == 'alipay'"
- mode="widthFix"></image>
- <view class="titleBox">
- <view class="tip">{{item.name}}</view>
- </view>
- </view>
- </view>
- <view class="det">
- 选择
- </view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import {
- getsell,
- sellPush,
- sellBuy
- } from '@/api/game.js';
- import {
- getIndex
- } from '@/api/index.js';
- import {
- mapState,
- } from 'vuex';
- import {
- qianBao
- } from '@/api/wallet.js';
- import {
- getBank
- } from '@/api/set.js';
- import dayjs from '@/libs/dayjs/dayjs.min.js';
- export default {
- computed: {
- ...mapState('user', ['hasLogin', 'userInfo'])
- },
- filters: {
- dateFormat: function(value) {
- return dayjs(value * 1000).format('YYYY/MM/DD HH:mm');
- }
- },
- data() {
- return {
- number: '',
- money: '',
- price: '',
- page: 1,
- limit: 10,
- list: [],
- loadingType: 'more',
- baseData: {
- min_sell: '',
- max_sell: ''
- },
- loaded: false,
- showBank: false,
- bankList: [],
- bank_id: '',
- bank: {
- id: '',
- bank_real_name: '',
- bank_code: '',
- bank: '',
- bank_name: '',
- },
-
- actionitem: [],
- infoChecked: {
- sell_alipay_open: "0",
- sell_bank_open: "0",
- sell_weixin_open: "0"
- }
- }
- },
- watch: {
- showBank(newValue, oldValue) {
- if (newValue) {
- this.$refs.popup.open()
- } else {
- this.$refs.popup.close()
- }
- }
- },
- onNavigationBarButtonTap(res) {
- uni.navigateTo({
- url: '/pages/index/order'
- })
- },
- onShow() {
- this.init();
- },
- onLoad() {
- this.getIndex()
- },
- methods: {
- qianBao() {
- const that = this;
- qianBao().then((res) => {
- that.money = +res.data.like_usdt;
- })
- },
- getBank() {
- const obj = this;
- getBank().then((res) => {
- let data = res.data.list
- let reg = /^(.{4})(?:\d+)(.{4})$/
- if (data.length > 0) {
- obj.infoChecked = res.data;
- data.forEach(item => {
- if (item.type == 'bank') {
- item.bank_code1 = item.bank_code.replace(reg, "**** $2")
- item.name = item.bank + ' ' + item.bank_code1
- } else {
- item.name = item.name + ' ' + item.phone
- }
- })
- let onArr = [];
- obj.bankList = data.filter((re) => {
- if (re.type == 'bank' && obj.infoChecked.sell_bank_open == "1") {
- return true
- }
- if (re.type == 'wx' && obj.infoChecked.sell_weixin_open == "1") {
- return true
- }
- if (re.type == 'alipay' && obj.infoChecked.sell_alipay_open == "1") {
- return true
- }
- });
-
- if (obj.bankList.length > 0) {
- obj.actionitem = [obj.bankList[0]];
- obj.bank_id = obj.bank.id;
- obj.bank = obj.bankList[0];
- }
- }
- })
- },
- bankSelect(e) {
- const obj = this;
- this.bank_id = e.id;
- this.actionitem = [e];
- obj.showBank = false;
- },
- getIndex() {
- getIndex({})
- .then(({
- data
- }) => {
- this.baseData = data;
- this.price = data.us_price
- console.log(data);
- })
- .catch(e => {});
- },
-
- commitorder(item) {
- let obj = this
- uni.showModal({
- title: '请输入支付密码',
- editable: true,
- success: res => {
- if (res.confirm) {
- if (res.content) {
- uni.showLoading({
- title: '支付中。。。',
- mask: true
- });
- sellBuy({
- id: item.id,
- trade_psw: res.content,
- }).then((
- data
- ) => {
- uni.hideLoading();
- uni.showModal({
- title: '提示',
- content: data.msg,
- showCancel: false,
- });
- setTimeout(function() {
- obj.page = 1;
- obj.list = [];
- obj.loadingType = 'more';
- obj.loadData();
- }, 1000);
- })
- .catch(e => {
- uni.hideLoading()
- console.log(e);
- });
- }
- }
- },
- });
- },
-
- submission() {
- let obj = this;
- if (!obj.number) {
- uni.showToast({
- title: '请输入数量',
- icon: 'none'
- });
- return
- }
- if (!obj.price) {
- uni.showToast({
- title: '请输入单价',
- icon: 'none'
- });
- return
- }
- if (obj.price > obj.baseData.us_price) {
- uni.showToast({
- title: '单价不得大于当前汇率',
- icon: 'none'
- });
- return
- }
- uni.showModal({
- title: '请输入支付密码',
- editable: true,
- success: res => {
- if (res.confirm) {
- sellPush({
- type: 'USDT',
- num: obj.number,
- price: obj.price,
- phone: obj.userInfo.phone || '',
- trade_psw: res.content,
- sell_type: 'money',
- bank_id: obj.bank_id
- }).then((
- data
- ) => {
- obj.qianBao();
- obj.number = '';
- obj.trade_psw = '';
- uni.showToast({
- title: data.msg,
- });
- setTimeout(
- () => {
- uni.navigateTo({
- url: '/pages/index/order'
- })
- }
- )
- })
- .catch(e => {
- console.log(e);
- });
- }
- },
- fail: () => {},
- complete: () => {}
- });
- },
- init() {
- this.page = 1;
- this.list = [];
- this.loadingType = 'more';
-
- this.qianBao();
- this.getBank();
- },
- async loadData(source) {
- const that = this;
-
- let navItem = that;
- if (source === 'tabChange' && navItem.loaded === true) {
-
- return;
- }
- if (navItem.loadingType === 'loading') {
-
- return;
- }
- if (navItem.loadingType === 'noMore') {
-
- return;
- }
-
- navItem.loadingType = 'loading';
- getsell({
- page: navItem.page,
- limit: navItem.limit
- })
- .then(({
- data
- }) => {
-
- let arr = data.list.map(e => {
- e.num = e.num * 1;
- e.price = e.price * 1;
- return e;
- });
- navItem.list = navItem.list.concat(arr);
- if (navItem.limit == data.length) {
- navItem.page++;
-
- navItem.loadingType = 'more';
- return;
- } else {
-
- navItem.loadingType = 'noMore';
- }
- uni.hideLoading();
- that.loaded = true;
- })
- .catch(e => {
- console.log(e);
- });
- },
- }
- };
- </script>
- <style lang="scss">
- .all {
- width: 750rpx;
- height: 100%;
- background-color: #051137;
- padding-top: var(--status-bar-height);
- padding-bottom: 40rpx;
- color: #fff;
- }
- .listBox {
- padding: 62rpx 32rpx;
- .titleTetx {
- font-weight: bold;
- font-size: 24rpx;
- color: #FFFFFF;
- padding-bottom: 25rpx;
- }
- .tipBox {
- padding-top: 15rpx;
- font-size: 24rpx;
- }
- }
- .listTpl {
- border-bottom: 1rpx solid #6A7288;
- padding-bottom: 25rpx;
- .inputBox {
- font-size: 35rpx;
- color: #FFFFFF;
- }
- .listTip {}
- .listAll {
- padding-left: 30rpx;
- font-size: 24rpx;
- color: #0C5AFA;
- }
- }
- .submission {
- padding: 80rpx 25rpx;
- padding-bottom: 25rpx;
- .golden {
- background: #0C5AFA;
- color: #ffffff;
- }
- }
- .tips {
- text-align: center;
- }
- .listItemBox {
- padding-top: 44px;
- .listItem {
- padding: 34rpx 34rpx;
- border-bottom: 1rpx solid #6A7288;
- .name {
- font-family: PingFang SC;
- font-weight: bold;
- font-size: 30rpx;
- color: #FFFFFF;
- padding-left: 25rpx;
- }
- .itemTpl {
- font-family: PingFang SC;
- font-weight: bold;
- font-size: 36rpx;
- color: #0C5AFA;
- padding-top: 25rpx;
- }
- .itemTip {
- .tipText {
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 24rpx;
- color: #C1C1C1;
- padding-top: 15rpx;
- }
- .tipBtn {
- font-family: PingFang SC;
- font-weight: bold;
- font-size: 24rpx;
- color: #FFFFFF;
- background: linear-gradient(90deg, #0C5AFA, #1356FF);
- border-radius: 7rpx;
- padding: 15rpx 35rpx;
- }
- }
- }
- }
- .changeBank {
- text-align: right;
- margin-top: 25rpx;
- padding-right: 35rpx;
- .btnChange {
- background: #0C5AFA;
- color: #fff;
- display: inline-block;
- font-size: 24rpx;
- padding: 15rpx 25rpx;
- border-radius: 15rpx;
- }
- }
- .login_text {
- width: 100%;
- // padding: 25rpx 0rpx;
- font-size: 28rpx !important;
- padding: 0rpx 25rpx;
- }
- .login_input {
- border-bottom: 1px solid #464755;
- padding: 35rpx;
- }
- .alertBottom {
- padding-bottom: 55px;
- background-color: #FFF;
- .alertTitle {
- padding: 20rpx 30rpx;
- font-size: 30rpx;
- color: #333333;
- .alertTitleName {
- font-weight: bold;
- }
- }
- .bankList {
- background: #FFF;
- border-bottom: 1px solid #eeeeee;
- border-radius: 0;
- .infoTpl {
- .tplName {
- .titleBox {
- .tip {
- color: #999 !important;
- }
- }
- }
- }
- }
- }
- .bankList {
- color: #fff;
- background: #1F2A4A;
- padding: 36rpx 38rpx;
- border-radius: 20rpx;
- margin-bottom: 25rpx;
- position: relative;
- .typeTipImg {
- width: 40rpx;
- height: 40rpx
- }
- .det {
- color: #0C5AFA;
- }
- .infoTpl {
- .tplName {
- .titleBox {
- padding-left: 25rpx;
- .name {
- font-weight: bold;
- font-size: 30rpx;
- color: #FFFFFF;
- }
- .tip {
- font-weight: 500;
- font-size: 25rpx;
- color: rgba(255, 255, 255, 0.64);
- }
- }
- }
- }
- }
- </style>
|