Browse Source

Merge branch 'master' of http://git.liuniu946.com/lhl/nzhbsr

lhl 2 years ago
parent
commit
6915801242
4 changed files with 294 additions and 23 deletions
  1. 21 0
      api/wallet.js
  2. 252 4
      pages/transaction/cbdetail.vue
  3. BIN
      static/img/add.png
  4. 21 19
      utils/newRequest.js

+ 21 - 0
api/wallet.js

@@ -1,4 +1,7 @@
 import request from '@/utils/request'
+import {
+	upFilse
+} from '@/utils/request'
 
 // 资金列表
 export function usercoin(data) {
@@ -35,3 +38,21 @@ export function czpage(data) {
 		data
 	});
 }
+
+//上传图片
+export function upload(data) {
+	return upFilse({
+		url: '/api/User/recharge_img',
+		method: 'post',
+		data
+	});
+}
+
+// 充值
+export function paycoin(data) {
+	return request({
+		url: '/api/user/paycoin',
+		method: 'get',
+		data
+	});
+}

+ 252 - 4
pages/transaction/cbdetail.vue

@@ -2,21 +2,85 @@
 	<view class="content">
 		<view class="vheight"></view>
 		<view class="top flex">
-			<image class="top-icon1" src="../../static/img/cb2.png" mode=""></image>
+			<image @click="navTo('/pages/transaction/cblist')" class="top-icon1" src="../../static/img/cb2.png" mode=""></image>
 			<image class="top-icon2" src="../../static/img/cb1.png" mode=""></image>
 		</view>
 		<view class="title">充幣</view>
+		<view class="type flex" @click="navTo('/pages/transaction/cblist')">
+			<view class="type-left">幣種</view>
+			<view class="type-right">
+				<view class="type-name">{{ info.title }}</view>
+				<image class="type-icon" src="../../static/icon/user-back.png" mode=""></image>
+			</view>
+		</view>
+		<view class="main">
+			<view class="main-title">充幣網絡</view>
+			<view class="main-list">{{ info.czline }}</view>
+			<view class="main-title" style="margin-top: 20rpx;">充幣地址</view>
+			<view class="erweima">
+				<tki-qrcode
+					:cid="cid"
+					ref="qrcode"
+					:val="info.czaddress"
+					:size="size"
+					:unit="unit"
+					:background="background"
+					:foreground="foreground"
+					:pdground="pdground"
+					:iconSize="iconSize"
+					:lv="lv"
+					:onval="onval"
+					:loadMake="loadMake"
+					:usingComponents="usingComponents"
+					@result="qrR"
+				/>
+			</view>
+			<view class="address">{{ info.czaddress }}</view>
+			<view class="btn" @click="copy(info.czaddress)">複製地址</view>
+		</view>
+		<view class="info">
+			<view class="info-item red">最小充值金額:0.00BTC,小於最小金額的充值將不會上賬且無法退回</view>
+			<view class="info-item">請選擇正確的充值通道網絡,否則資產將不可找回</view>
+			<view class="info-item">最小充值金額:0.00BTC,小於最小金額的充值將不會上賬且無法退回</view>
+			<view class="info-item">您的充值地址不會經常改變,可以重複充值;如有更改,我們會盡量通過網站公告或郵件通知您</view>
+			<view class="info-item">請務必確認電腦及瀏覽器安全,防止信息被篡改或洩露</view>
+		</view>
+		<view class="sr">
+			<view class="sr-title">轉賬金額</view>
+			<view class="sr-input"><input placeholder="請輸入轉賬金額" type="number" v-model="num" /></view>
+			<view class="sr-title" style="margin-top: 20rpx;">上傳轉賬憑證</view>
+			<view class="sr-image">
+				<image :src="image" mode="" class="upload-img" @click.stop="imgsub" v-if="image"></image>
+				<image src="../../static/img/add.png" class="upload-img" mode="" v-if="!image" @click.stop="imgsub"></image>
+			</view>
+			<view class="sr-btn" @click="submit()">提交</view>
+		</view>
 	</view>
 </template>
 
 <script>
-import { czpage } from '@/api/wallet.js';
+import { czpage, upload, paycoin } from '@/api/wallet.js';
 import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
 import uniCopy from '@/js_sdk/xb-copy/uni-copy.js';
 export default {
 	data() {
 		return {
-			id: ''
+			id: '',
+			info: '',
+			cid: 'cid',
+			size: 100,
+			unit: '150',
+			background: '#FFFFFF',
+			foreground: '#000000',
+			pdground: '#000000',
+			icon: '',
+			iconSize: 40,
+			lv: 3,
+			onval: true,
+			loadMake: true,
+			usingComponents: true,
+			num: '',
+			image: ''
 		};
 	},
 	onLoad(opt) {
@@ -29,7 +93,54 @@ export default {
 	methods: {
 		loadData() {
 			czpage({ id: this.id }).then(e => {
-				console.log(e);
+				this.info = e.data;
+			});
+		},
+		qrR(res) {
+			console.log(res, '123456');
+		},
+		navTo(url) {
+			uni.navigateTo({
+				url
+			});
+		},
+		imgsub() {
+			console.log(111);
+			upload({
+				filename: ''
+			}).then(data => {
+				console.log('data', data);
+				this.image = data[0].src;
+			});
+		},
+		copy(item) {
+			let obj = this;
+			let content = item; //需要复制的内容
+			content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
+			const result = uniCopy(content);
+			if (result === false) {
+				uni.showToast({
+					title: '不支持'
+				});
+			} else {
+				uni.showToast({
+					title: '複製成功',
+					icon: 'none'
+				});
+			}
+		},
+		submit() {
+			console.log(222);
+			if (this.num < 0) {
+				return this.$api.msg('充值金額不能為0');
+			}
+			if (!this.image) {
+				return this.$api.msg('請上傳轉款憑證');
+			}
+			paycoin({ cid: this.id, zznum: this.num, payimg: this.image, coinname: this.info.title }).then(e => {
+				this.num = '';
+				this.image = '';
+				return this.$api.msg('提交申請成功,請耐心等待審核');
 			});
 		}
 	}
@@ -57,4 +168,141 @@ page,
 		height: 48rpx;
 	}
 }
+.title {
+	padding: 20rpx 20rpx 0;
+	font-size: 52rpx;
+	font-weight: 500;
+}
+.type {
+	margin: 20rpx auto 0;
+	width: 690rpx;
+	background: #ffffff;
+	border-radius: 20rpx;
+	padding: 30rpx 20rpx;
+	.type-left {
+		font-size: 32rpx;
+		color: #000;
+	}
+	.type-right {
+		display: flex;
+		align-items: center;
+		.type-name {
+			font-size: 36rpx;
+			font-weight: bold;
+			color: #fcd535;
+			margin-right: 10rpx;
+		}
+		.type-icon {
+			width: 24rpx;
+			height: 24rpx;
+		}
+	}
+}
+.main {
+	margin: 20rpx auto 0;
+	width: 690rpx;
+	background: #ffffff;
+	border-radius: 20rpx;
+	padding: 30rpx 20rpx;
+	.main-title {
+		font-size: 32rpx;
+		color: #000;
+	}
+	.main-list {
+		margin-top: 20rpx;
+		width: 200rpx;
+		height: 70rpx;
+		line-height: 70rpx;
+		text-align: center;
+		border: 2px solid #fcd535;
+		border-radius: 10rpx;
+		font-size: 28rpx;
+		color: #fcd535;
+	}
+	.erweima {
+		margin-top: 40rpx;
+		width: 100%;
+		display: flex;
+		justify-content: center;
+	}
+	.address {
+		margin-top: 20rpx;
+		width: 100%;
+		text-align: center;
+		font-size: 24rpx;
+		color: #000;
+	}
+	.btn {
+		width: 200rpx;
+		height: 60rpx;
+		line-height: 60rpx;
+		text-align: center;
+		border-radius: 10rpx;
+		border: 2px solid #fcd535;
+		font-size: 28rpx;
+		color: #fcd535;
+		margin: 20rpx auto 0;
+	}
+}
+.info {
+	margin: 20rpx auto 0;
+	width: 690rpx;
+	background: #ffffff;
+	border-radius: 20rpx;
+	padding: 30rpx 20rpx;
+	.info-item {
+		font-size: 24rpx;
+		color: #000;
+		margin-bottom: 20rpx;
+	}
+	.red {
+		color: red;
+	}
+}
+.sr {
+	margin: 20rpx auto 0;
+	width: 690rpx;
+	background: #ffffff;
+	border-radius: 20rpx;
+	padding: 30rpx 20rpx;
+	.sr-title {
+		font-size: 32rpx;
+		color: #000;
+	}
+	.sr-input {
+		display: flex;
+		align-items: center;
+		width: 100%;
+		height: 80rpx;
+		line-height: 80rpx;
+		background: #f5f5f5;
+		border-radius: 20rpx;
+		padding: 0rpx 30rpx;
+		input {
+			font-size: 28rpx;
+			padding-left: 30rpx;
+			background: #f5f5f5;
+		}
+	}
+	.sr-image {
+		display: flex;
+		justify-content: center;
+		margin: 20rpx;
+		image {
+			width: 200rpx;
+			height: 200rpx;
+		}
+	}
+	.sr-btn {
+		width: 100%;
+		height: 80rpx;
+		line-height: 80rpx;
+		text-align: center;
+		border-radius: 10rpx;
+		margin: 20rpx auto 0;
+		background: linear-gradient(to left, #eeb80d, #ffe35b);
+		font-size: 28rpx;
+		color: #000;
+	}
+}
 </style>

BIN
static/img/add.png


+ 21 - 19
utils/newRequest.js

@@ -43,26 +43,26 @@ let service = {
 	open: async function(data) {
 		return await new Promise(function(resolve, reject) {
 			let requestData = ''; //保存处理完成后请求数据
-			let url =''//保存链接地址
+			let url = '' //保存链接地址
 			//console.log(data);
 			// 请求前数据处理
 			requestData = service.request.success(data);
 			// #ifdef H5
-			
-			if(process.env.NODE_ENV === 'development'){
-				url= requestData.url;
-			    console.log('开发环境')
-			}else{
-				url=service.baseURL + requestData.url;
-			    console.log('生产环境')
+
+			if (process.env.NODE_ENV === 'development') {
+				url = requestData.url;
+				console.log('开发环境')
+			} else {
+				url = service.baseURL + requestData.url;
+				console.log('生产环境')
 			}
 			// #endif
 			// #ifndef H5
-			url=service.baseURL + requestData.url;
+			url = service.baseURL + requestData.url;
 			// #endif
 			// 数据复制用于请求
 			uni.request({
-				url:url,
+				url: url,
 				method: requestData.method || 'GET',
 				data: requestData.data,
 				header: data.header || service.header,
@@ -96,20 +96,20 @@ let service = {
 				service.request.error(e);
 			}
 			// #ifdef H5
-			if(process.env.NODE_ENV === 'development'){
-				url= requestData.url;
-			    console.log('开发环境')
-			}else{
-				url=service.baseURL + requestData.url;
-			    console.log('生产环境')
+			if (process.env.NODE_ENV === 'development') {
+				url = requestData.url;
+				console.log('开发环境')
+			} else {
+				url = service.baseURL + requestData.url;
+				console.log('生产环境')
 			}
 			// #endif
 			// #ifndef H5
-			url=service.baseURL + requestData.url;
+			url = service.baseURL + requestData.url;
 			// #endif
 			let config = {
 				// 上传图片的API
-				upload_img_url:url
+				upload_img_url: url
 			}
 
 			let Uploader = {
@@ -142,9 +142,11 @@ let service = {
 							filePath: path,
 							name: 'file',
 							header: {
-								"Authori-zation": 'Bearer ' + uni.getStorageSync('token')
+								"Authori-zation": 'Bearer ' + uni.getStorageSync(
+									'token')
 							},
 							success: (uploadFileRes) => {
+								console.log(uploadFileRes.data, "url");
 								if ("string" === typeof uploadFileRes.data) {
 									resolve(JSON.parse(uploadFileRes.data).data)
 								} else {