xiaol 6 months ago
parent
commit
942af3431d
2 changed files with 85 additions and 29 deletions
  1. 72 27
      pages/index/pledge.vue
  2. 13 2
      pages/public/register.vue

+ 72 - 27
pages/index/pledge.vue

@@ -54,6 +54,9 @@
 			</view>
 			<uni-load-more :status="loadingType"></uni-load-more>
 		</view>
+		<u-action-sheet :show="showBank" :actions="bankList" title="请选择银行卡"
+			@close="showBank = false" @select="bankSelect">
+		</u-action-sheet>
 	</view>
 </template>
 
@@ -72,10 +75,13 @@
 	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'])
+			...mapState('user', ['hasLogin','userInfo'])
 		},
 		filters: {
 			dateFormat: function(value) {
@@ -84,9 +90,10 @@
 		},
 		data() {
 			return {
-				tabCurrentIndex: 1,
+				tabCurrentIndex: 0,
 				navList: ['卖出', '买入'],
 				number: '',
+				money:'',
 				price: '',
 				page: 1,
 				limit: 10,
@@ -97,6 +104,9 @@
 					max_sell:''
 				},
 				loaded:false,
+				showBank:false,
+				bankList:[],
+				bank_id:'',
 			}
 		},
 		onNavigationBarButtonTap(res) {
@@ -117,6 +127,55 @@
 					that.money = +res.data.like_usdt;
 				})
 			},
+			getBank() {
+				const obj = this;
+				getBank().then((res) => {
+					let data = res.data.list
+					let reg = /^(.{4})(?:\d+)(.{4})$/
+					data.forEach(item => {
+						item.bank_code1 = item.bank_code.replace(reg, "**** $2")
+						item.name = item.bank+'   '+item.bank_code1
+					})
+					obj.bankList = data
+					console.log(obj.bankList,'obj.bankList')
+				})
+			},
+			bankSelect(e){
+				const obj = this;
+				this.bank_id = e.id
+				if(this.bank_id){
+					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
+									) => {
+								        uni.showModal({
+								        	title: '提示',
+								        	content: data.msg,
+								        	icon:'none'
+								        });
+									})
+									.catch(e => {
+										console.log(e);
+									});
+							}
+						},
+						fail: () => {},
+						complete: () => {}
+					});
+				}
+			},
 			getIndex(){
 				getIndex({})
 					.then(({
@@ -127,6 +186,7 @@
 					})
 					.catch(e => {});
 			},
+			
 			// 购买订单
 			commitorder(item) {
 				uni.showModal({
@@ -164,31 +224,15 @@
 			// 挂出
 			submission() {
 				let obj = this;
-				uni.showModal({
-					title: '请输入支付密码',
-					editable:true,
-					success: res => {
-						if(res.confirm){
-							sellPush({
-									type: 'USDT',
-									num: obj.number,
-									price: obj.price,
-									phone: '',
-									trade_psw: res.content,
-									sell_type: 'money',
-								}).then(({
-									data
-								}) => {
-							
-								})
-								.catch(e => {
-									console.log(e);
-								});
-						}
-					},
-					fail: () => {},
-					complete: () => {}
-				});
+				if(obj.bankList.length > 0){
+					obj.showBank = true
+				}else{
+					uni.showModal({
+						title: '提示',
+						content: '请先去添加银行卡',
+						icon:'none'
+					});
+				}
 			},
 			init() {
 				this.page = 1;
@@ -196,6 +240,7 @@
 				this.loadingType = 'more';
 				this.loadData();
 				this.qianBao();
+				this.getBank()
 			},
 			tabClick(index) {
 				this.tabCurrentIndex = index;

+ 13 - 2
pages/public/register.vue

@@ -39,7 +39,7 @@
 				<view class="login_name"><input class="uni-input" type="text" v-model="spread" focus
 						:placeholder="$t('login.b4')" /></view>
 			</view>
-			<view class="login_input flex">
+			<view class="login_input flex" style="margin-bottom: 25rpx;">
 				<view class="login_img">
 					<image src="/static/icon/ze3.png"></image>
 				</view>
@@ -48,6 +48,9 @@
 					<view class="code" @click="verification">{{ countDown == 0 ? $t('login.b5') : countDown }}</view>
 				</view>
 			</view>
+		    <!-- #ifdef H5 -->
+		    <view class="upload"><a href="">下载APP</a></view>
+		    <!-- #endif -->
 			<view><button type="green" @click="register" class="uni-button uni-button-green">{{$t('login.a7')}}</button>
 			</view>
 			<view><button class="uni-button uni-button-green uni-button-green-plain" type="green" plain="true"
@@ -250,7 +253,7 @@
 
 <style lang="scss">
 	page {
-		height: 100%;
+		
 	}
 
 	.container {
@@ -317,6 +320,14 @@
 				color: #999999;
 			}
 		}
+		.upload{
+			color: #FFF;
+			text-align: right;
+			a{
+				color: #FFF;
+				font-size: 28rpx;
+			}
+		}
 
 		// .weixin {
 		// 	width: 75rpx;