Browse Source

2023-10-17

cmy 1 year ago
parent
commit
6023f4228e
2 changed files with 42 additions and 18 deletions
  1. 2 1
      api/mypledge.js
  2. 40 17
      pages/myPledge/zyXingqing.vue

+ 2 - 1
api/mypledge.js

@@ -24,10 +24,11 @@ export function lockDetail(data) {
 		method: 'GET',
 	});
 }
-// 质押项目详情
+// 参与质押
 export function lockJoin(data) {
 	return request({
 		url: `/api/lock/${data.id}`,
 		method: 'POST',
+		data
 	});
 }

+ 40 - 17
pages/myPledge/zyXingqing.vue

@@ -63,7 +63,8 @@
 				<view class="icon flex-start">
 					<image class="ic" src="../../static/img/xq3.png" mode=""></image>
 					<view class="jiaru">
-						{{$t('zy.m14')}}:{{base.single_time_max*1}}*({{base.day_get}}%+100%)*{{base.day}}</view>
+						{{$t('zy.m14')}}:{{base.single_time_max*1}}*({{base.day_get}}%+100%)*{{base.day}}
+					</view>
 				</view>
 
 				<view class="icon flex-start">
@@ -91,13 +92,17 @@
 		<view class="aaa"></view>
 
 		<view class="liji">
-			<view class="jr" @click="joinLock">
+			<view class="jr" @click="joinNumOpen">
 				<view class="jia">{{$t('zy.m19')}}</view>
 			</view>
 		</view>
 		<uni-popup type="bottom" ref="popup">
 			<inputPassword @commit='KeyInfo'></inputPassword>
 		</uni-popup>
+		<uni-popup ref="inputDialog" type="dialog">
+			<uni-popup-dialog ref="inputClose" mode="input" title="押注金额" :value="num" placeholder="请输入购买金额(USDT)"
+				@confirm="joinNum" confirmText='确定' cancelText='取消'></uni-popup-dialog>
+		</uni-popup>
 	</view>
 </template>
 
@@ -145,25 +150,43 @@
 				this.colsePayPassword();
 				this.joinLock();
 			},
-			// 购买数量
-			joinNum() {
-
+			// 打开输入弹窗
+			joinNumOpen() {
+				this.$refs.inputDialog.open();
+			},
+			// 输入的金额
+			joinNum(e) {
+				if (isNaN(Number(e))) {
+					uni.showToast({
+						title: "请输入数字",
+						icon: "error"
+					})
+					return
+				}
+				this.num = e;
+				this.$refs.popup.open();
+				console.log(e, '233');
 			},
 			// 购买质押
 			joinLock() {
-				lockJoin({
-					id: this.id,
-					number: this.num,
-					trade_password: this.password
-				}).then(
+				const that = this;
+				const data = {
+					id: that.id,
+					number: that.num,
+					trade_password: that.password
+				}
+				// 初始化数量
+				that.num = '';
+				lockJoin(data).then(
 					(res) => {
-						console.log(res);
-					}
-				).then(
-					() => {
-
+						uni.showToast({
+							title:"质押成功"
+						})
+						that.gameWallet();
 					}
-				)
+				).then((err) => {
+					console.log(err);
+				})
 			},
 			gameWallet() {
 				gameWallet().then((res) => {
@@ -178,7 +201,7 @@
 					(res) => {
 						that.base = res.data.data;
 						that.allMoney = that.base.single_time_max * (that.base.day_get * 1 + 100) * that.base.day /
-						100;
+							100;
 					}
 				).catch(
 					(res) => {