Fly 2 anni fa
parent
commit
ba29d1ec4f

+ 5 - 1
components/headModules/reverse-back.vue

@@ -12,6 +12,10 @@
 			iconColor:{
 				type:String,
 				default:'#000'
+			},
+			path:{
+				type:String,
+				default:''
 			}
 		},
 		data() {
@@ -21,7 +25,7 @@
 		},
 		methods: {
 			reverseBackBtn() {
-				reverseBack()
+				reverseBack(this.path)
 			}
 		}
 	}

+ 54 - 25
pages/content/select-currency.vue

@@ -17,8 +17,8 @@
 
 		<view class="currency-box">
 			<block v-for="(item , index) in currencyList" :key="`currency_${index}`">
-				<view class="currency-item" @click.stop="topUp(item.name)">
-					<image class="currency-icon" :src="item.icon" mode="aspectFit"></image>
+				<view class="currency-item" @click.stop="topUp(item)">
+					<image class="currency-icon" :src="item.logo" mode="aspectFit"></image>
 					<text class="currency-name">{{ item.name }}</text>
 				</view>
 			</block>
@@ -28,30 +28,31 @@
 
 <script>
 	import reverseBack from "@/components/headModules/reverse-back.vue"
-	import { Api_getBiTypeList , Api_getFlashRecord , Api_getSubmit} from "@/api/index.js"
+	import { Api_getQuotationNew , Api_getBiTypeList , Api_getFlashRecord , Api_getSubmit} from "@/api/index.js"
 	export default {
 		name: 'selectCurrency',
 		components: {
 			reverseBack
 		},
 		data() {
-			return {
-				currencyList: [{
-						icon: require('@/static/images/bi/bi_01.png'),
-						name: 'BTC'
-					},
-					{
-						icon: require('@/static/images/bi/bi_02.png'),
-						name: 'BTC'
-					},
-					{
-						icon: require('@/static/images/bi/bi_03.png'),
-						name: 'BTC'
-					},
-					{
-						icon: require('@/static/images/bi/bi_03.png'),
-						name: 'BTC'
-					}
+			return { 
+				currencyList: [
+					// {
+					// 	icon: require('@/static/images/bi/bi_01.png'),
+					// 	name: 'BTC'
+					// },
+					// {
+					// 	icon: require('@/static/images/bi/bi_02.png'),
+					// 	name: 'BTC'
+					// },
+					// {
+					// 	icon: require('@/static/images/bi/bi_03.png'),
+					// 	name: 'BTC'
+					// },
+					// {
+					// 	icon: require('@/static/images/bi/bi_03.png'),
+					// 	name: 'BTC'
+					// }
 				]
 			};
 		},
@@ -61,17 +62,44 @@
 	 
 		methods:{
 			getBiTypeList(){
-				Api_getBiTypeList().then(res => {
+				uni.showLoading()
+				Api_getQuotationNew().then(res => {
 					console.log('Api_getBiTypeList = ' , res)
+					this.currencyList = res || []
 				}).catch(err => {
 					console.log('Api_getBiTypeList = ' , err)
+				}).finally(() => {
+					uni.hideLoading()
 				})
 			},
 			// pages/content/top-up
-			topUp(name){
-				uni.navigateTo({
-					url:`/pages/content/top-up?name=${name}`
-				})
+			topUp(item){
+				
+				
+				
+				const time = new Date().getTime();
+				let key = {};
+				key[`bi_${time}`] = item
+				this.$setStorageSync('select' , key)
+				
+				let path = `/pages/content/top-up?key=${`bi_${time}`}`
+				
+				const pages = getCurrentPages()
+				if(pages.length > 2 && pages[pages.length - 2].route === 'pages/content/top-up' ){
+				console.log('pages 11 = ' , pages , pages[pages.length - 2].route)
+					 
+					uni.redirectTo({
+						url:path
+					})
+				}else{
+					console.log('222')
+					uni.navigateTo({
+						url: path
+					});
+				}
+				// uni.navigateTo({
+				// 	url: path
+				// });
 			},
 			// 查看充值记录
 			lookRecord(){
@@ -79,6 +107,7 @@
 					url:'/pages/content/charge-record'
 				})
 			}
+			
 		}
 	}
 </script>

+ 20 - 23
pages/content/top-up.vue

@@ -3,7 +3,7 @@
 		<!-- 头部 -->
 		<headContent>
 			<template #left>
-				<reverse-back />
+				<reverse-back path="pages/content/top-up"/>
 			</template>
 			<template #content>
 				<view class="haed-title">
@@ -18,8 +18,10 @@
 		<view class="currency-box">
 			<view class="currency-item">
 				<view class="currency-info">
-					<image class="currency-icon" src="@/static/images/bi/bi_01.png" mode="aspectFit"></image>
-					<text class="currency-name">BTC</text>
+					<template  v-if="biInfo">
+						<image class="currency-icon" :src="biInfo.logo" mode="aspectFit"></image>
+						<text class="currency-name">{{ biInfo.name }}</text>
+					</template>
 				</view>
 				<view class="select-currency" @click.stop="selectCurrency">
 					<text>请选择币种</text>
@@ -43,31 +45,26 @@
 		},
 		data() {
 			return {
-				currencyList: [{
-						icon: require('@/static/images/bi/bi_01.png'),
-						name: 'BTC'
-					},
-					{
-						icon: require('@/static/images/bi/bi_02.png'),
-						name: 'BTC'
-					},
-					{
-						icon: require('@/static/images/bi/bi_03.png'),
-						name: 'BTC'
-					},
-					{
-						icon: require('@/static/images/bi/bi_03.png'),
-						name: 'BTC'
-					}
-				]
+				biInfo:null,
 			};
 		},
+		onLoad(opt) {
+			const key = opt?.key || '';
+			this.biInfo = this.$getStorageSync('select')[key];
+		},
 		methods: {
 			// pages/content/top-up
 			selectCurrency(){
-				uni.redirectTo({
-					url: '/pages/content/select-currency'
-				});
+				const pages = getCurrentPages()
+				console.log('pages = ' , pages)
+				if(pages.length > 1 && pages[pages.length - 1].route === 'pages/content/select-currency' ){
+					uni.navigateBack()
+				}else{
+					uni.navigateTo({
+						url: '/pages/content/select-currency'
+					});
+				}
+				
 			},
 			// 查看充值记录
 			lookRecord(){

+ 3 - 1
pages/contract/grants/index.vue

@@ -16,14 +16,16 @@
 		</view>
 		
 		<openPopup ref="openPopupRef" />
+		<popupHint />
 	</view>
 </template>
 
 <script>
 	import openPopup from "./open.vue"
+	import popupHint from "../modules/popup-hint.vue"
 	export default {
 		name: 'login',
-		components:{openPopup},
+		components:{openPopup , popupHint},
 		data() {
 			return {
 

+ 1 - 1
pages/contract/index.vue

@@ -34,7 +34,7 @@
 		components:{notarize , sustainability , grants},
 		data() {
 			return {
-				contractIndex:0,
+				contractIndex:2,
 				contractArr:[
 					'永续合约',
 					'快捷合约',

+ 126 - 0
pages/contract/modules/popup-hint.vue

@@ -0,0 +1,126 @@
+<template>
+	<uni-popup ref="popupRef" :isMaskClick="false">
+		<!-- @change="popupChange" -->
+		<view class="hint-box">
+			<view class="hint-title">赠金交易</view>
+			<view class="hint-content">
+				<view class="">
+					赠金交易是BiKing交易所的赠品交易系统,交易盈利部分可实时划转至合约钱包。
+				</view>
+				<view class="">
+					赠金获取方式:
+				</view>
+
+				<view class="content-list">
+					<text>1. 完成任务中心的各项任务</text>
+					<text>2. 参与平台活动</text>
+					<text>3. 不定期新老用户赠金空投</text>
+				</view>
+				<view class="">
+					更多内容请点击<text class="explain">《赠金交易》</text>
+				</view>
+
+				<view class="hite-box">
+					<text class="box">
+						<text class="iconfont">&#xe6c5;</text>
+					</text>
+					<text>不在提示</text>
+				</view>
+				<view class="confirm-btn" @click.stop="confirmBtn">
+					确定
+				</view>
+			</view>
+		</view>
+	</uni-popup>
+</template>
+
+<script>
+	export default {
+
+		data() {
+			return {
+
+			};
+		},
+		watch: {
+
+		},
+		mounted() {
+			this.open();
+		},
+		methods: {
+			open() {
+				this.$nextTick(() => {
+					this.$refs.popupRef.open()
+				})
+			},
+			confirmBtn(){
+				this.$refs.popupRef.close()
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.hint-box {
+		width: 650rpx;
+		background-color: #fff;
+
+		.hint-title {
+			width: 100%;
+			height: 80rpx;
+			line-height: 80rpx;
+			text-align: center;
+			border-bottom: 1rpx solid $border-color;
+		}
+
+		.hint-content {
+			width: 100%;
+			padding: 80rpx 60rpx;
+			font-size: 28rpx;
+
+			.content-list {
+				text {
+					display: block;
+				}
+			}
+
+			.explain {
+				color: $Theme-Color;
+			}
+
+			// <view class="hite-box">
+			// 	<text class="box"></text>
+			// 	<text>不在提示</text>
+			// </view>
+			.hite-box {
+				display: flex;
+				align-items: center;
+				padding-top: 20rpx;
+				.box {
+					border: 1rpx solid #ccc;
+					width: 30rpx;
+					height: 30rpx;
+					margin-right: 10rpx;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					.iconfont{
+						font-size: 32rpx;
+						color: $Theme-Color;
+					}
+				}
+			}
+			.confirm-btn{
+				width: 100%;
+				height: 80rpx;
+				text-align: center;
+				line-height: 80rpx;
+				background-color: $Theme-Color;
+				margin-top: 50rpx;
+				color: #fff;
+				font-size: 28rpx;
+			}
+		}
+	}
+</style>

+ 1 - 1
pages/property/index.vue

@@ -57,7 +57,7 @@
 		},
 		data() {
 			return {
-				navigationIndex: 3,
+				navigationIndex: 0,
 				navigationArr: [
 					'合约账户',
 					'币币账户',

+ 2 - 2
pages/property/modules/Bibi/index.vue

@@ -43,8 +43,8 @@
 				<template v-if="bibiAccount.balance">
 					<uni-tr v-for="(item , index) in bibiAccount.balance" v-if="hideNoName(hideNoNums , index)">
 						<uni-td style="flex: 1;">{{ item.currency_name }}</uni-td>
-						<uni-td style="flex: 1;">{{ showMoney ? index % 2 ? 111 : 0.00 : '*****' }}</uni-td>
-						<uni-td style="text-align: right; flex: 1;">{{ showMoney ? 111 : '*****' }}</uni-td>
+						<uni-td style="flex: 1;">{{ showMoney ? item.usdt_price : '*****' }}</uni-td>
+						<uni-td style="text-align: right; flex: 1;">{{ showMoney ? item.usdt_price : '*****' }}</uni-td>
 					</uni-tr>
 				</template>
 			</uni-table>

+ 6 - 10
pages/property/modules/legalTender/index.vue

@@ -31,18 +31,11 @@
 				<template v-if="legalAccount.balance">
 					<uni-tr v-for="item in legalAccount.balance">
 						<uni-td style="flex: 1;">{{ item.currency_name }}</uni-td>
-						<uni-td style="flex: 1;">{{ showMoney ? 111 : '*****' }}</uni-td>
-						<uni-td style="flex: 1;">{{ showMoney ? 111 : '*****' }}</uni-td>
-						<uni-td style="text-align: right; flex: 1;">{{ showMoney ? 111 : '*****' }}</uni-td>
+						<uni-td style="flex: 1;">{{ showMoney ? getNums(item.lock_legal_balance , item.usdt_price) : '*****' }}</uni-td>
+						<uni-td style="flex: 1;">{{ showMoney ? item.lock_legal_balance : '*****' }}</uni-td>
+						<uni-td style="text-align: right; flex: 1;">{{ showMoney ? item.usdt_price : '*****' }}</uni-td>
 					</uni-tr>
 				</template>
-				<!-- <uni-tr v-for="item in 5">
-					<uni-td style="flex: 1;">USDT</uni-td>
-					<uni-td style="flex: 1;">298587458</uni-td>
-					<uni-td style="flex: 1;">00000</uni-td>
-					<uni-td style="text-align: right, flex: 1;">29997.9123</uni-td>
-				</uni-tr> -->
-
 			</uni-table>
 
 
@@ -101,6 +94,9 @@
 					checkBill(path)
 				}
 			
+			},
+			getNums(a = 0, b = 0){
+				return this.$decimalNum.add(a , b)
 			}
 		}
 	}

+ 9 - 2
pages/property/modules/switch.vue

@@ -123,16 +123,23 @@
 			},
 			changeAccount(){
 				let data = {
-					currency_id:'1',
+					currency_id: 3,
 					number:this.moneyNum,
 					from_field:this.from_field,
 					to_field:this.to_field
 				}
 				setChangeAccount(data).then(res => {
+					this.$store.dispatch('possession/getPossession').then(res => {
+						console.log('获取成功')
+					}).catch(err => {
+						console.log('获取shibai ')
+					})
 					
 				}).catch(err => {
 					
-				}).finally(() => {})
+				}).finally(() => {
+					this.close()
+				})
 			},
 			 
 

+ 5 - 1
store/modules/possession.js

@@ -48,6 +48,8 @@
  	}, data) {
  		// commit('SET_TOKEN', token)
  		return new Promise((resolve, reject) => {
+			
+			uni.showLoading()
  			Api_getAccountInfo().then(res => {
 				commit('SET_CONTRACT' , res.lever_wallet);
 				commit('SET_BIBI' , res.change_wallet);
@@ -57,7 +59,9 @@
 				resolve()
  			}).catch(err => {
  				reject()
- 			})
+ 			}).finally(() => {
+				uni.hideLoading()
+			})
  		})
  	},
 

+ 41 - 9
utils/common.js

@@ -23,6 +23,25 @@ export const getToken = () => {
 	}
 }
 
+export const setStorageSync = (key, val) => {
+	console.log('setStorageSync = ', key, val)
+	try {
+		uni.setStorageSync(key, val);
+	} catch (e) {
+		// error
+	}
+}
+
+export const getStorageSync = (key) => {
+	try {
+		const value = uni.getStorageSync(key);
+		return value || ''
+	} catch (e) {
+		// error
+	}
+}
+
+
 // 判断是否登录
 export const ifLogin_ = () => {
 	return new Promise((resolve, reject) => {
@@ -40,15 +59,28 @@ export const ifLogin_ = () => {
 
 
 
-export const reverseBack = () => {
+export const reverseBack = (path = undefined) => {
 	const pages = getCurrentPages()
 	if (pages.length <= 1) {
 		uni.reLaunch({
 			url: '/pages/index/index'
 		});
 	} else {
+		let deltaNum = 1;
+		if (path) {
+			const pageLength = pages.length
+			let num = pageLength - 1;
+			for (let i = 1; i < pageLength; i++) {
+				num -= 1;
+				if (pages[num].route !== path) {
+					deltaNum = i;
+					break;
+				}
+			}
+			
+		};
 		uni.navigateBack({
-			delta: 1,
+			delta: deltaNum,
 			fail: err => {}
 		})
 	}
@@ -56,22 +88,22 @@ export const reverseBack = () => {
 
 export const decimalNum = {
 	// 加法
-	add:(a , b) => {
-		return new Decimal(a).add(new Decimal(b)) 
+	add: (a, b) => {
+		return new Decimal(a).add(new Decimal(b))
 	},
 	// 减法
-	sub:(a , b) => {
+	sub: (a, b) => {
 		return new Decimal(a).sub(new Decimal(b))
 	},
 	// 乘法
-	mul:(a , b) => {
+	mul: (a, b) => {
 		return new Decimal(a).mul(new Decimal(b))
 	},
 	// 除法
-	div:(a , b) => {
+	div: (a, b) => {
 		return new Decimal(a).div(new Decimal(b))
 	},
-	
+
 	// // 加法
 	// let c = new Decimal(a).add(new Decimal(b)) 
 	// // 减法
@@ -80,5 +112,5 @@ export const decimalNum = {
 	// let e = new Decimal(a).mul(new Decimal(b))
 	// // 除法
 	// let f = new Decimal(a).div(new Decimal(b))
- 
+
 }

+ 6 - 3
utils/initialize.js

@@ -1,16 +1,19 @@
 
 import config from "./config.js"
-import { decimalNum } from "./common.js"
+import { decimalNum , setStorageSync , getStorageSync } from "./common.js"
+
 
 // import share from "@/components/headModules/share.vue"
 // import reverseBack from "@/components/headModules/reverse-back.vue"
 
 export default {
-	install(Vue) {decimalNum
+	install(Vue) {
 		// 挂载全局对象
 		Vue.prototype.$config = config; // 全局配置
 		Vue.prototype.$stocksColorObj = config.stocksColorObj; // 股票颜色
-		Vue.prototype.$decimalNum = decimalNum; // 股票颜色
+		Vue.prototype.$decimalNum = decimalNum; // 计算精度
+		Vue.prototype.$setStorageSync = setStorageSync; // 计算精度
+		Vue.prototype.$getStorageSync = getStorageSync; // 计算精度
 
 		// Vue.component('share', share)
 		// Vue.component('reverseBack', reverseBack)

+ 0 - 0
utils/websock.js