Browse Source

1.提现扫码h5不支持,改成了上传文件
2.管理后台提现拒绝后增加余额

13147038669 5 months ago
parent
commit
0f82a27d97

+ 4 - 0
crmeb_src/mer_java/crmeb-common/src/main/java/com/zbkj/common/constants/BalanceRecordConstants.java

@@ -19,6 +19,8 @@ public class BalanceRecordConstants {
     /** 余额记录类型—扣减 */
     public static final Integer BALANCE_RECORD_TYPE_SUB = 2;
 
+    /** 余额记录关联类型—提现 */
+    public static final String BALANCE_RECORD_LINK_TYPE_WITHDRAW_REFUSE = "withdraw_refuse";
     /** 余额记录关联类型—提现 */
     public static final String BALANCE_RECORD_LINK_TYPE_WITHDRAW = "withdraw";
     /** 余额记录关联类型—订单 */
@@ -32,6 +34,8 @@ public class BalanceRecordConstants {
     /** 余额记录关联类型—佣金转余额 */
     public static final String BALANCE_RECORD_LINK_TYPE_SVIP = "svip";
 
+    /** 余额记录备注—提现 */
+    public static final String BALANCE_RECORD_REMARK_WITHDRAW_REFUSE = "用户提现拒绝,增加余额{}sL,拒绝原因{}";
     /** 余额记录备注—提现 */
     public static final String BALANCE_RECORD_REMARK_WITHDRAW = "用户提现发起成功,扣余额{}sL";
     /** 余额记录备注—用户订单付款成功 */

+ 7 - 0
crmeb_src/mer_java/crmeb-service/src/main/java/com/zbkj/service/service/UserService.java

@@ -88,6 +88,13 @@ public interface UserService extends IService<User> {
      */
     User getInfo();
 
+
+    /**
+     * 根据Uid获取用户
+     */
+    User fromUidSelectUserInfo(Integer userId);
+
+
     /**
      * 移动端当前用户信息
      *

+ 8 - 0
crmeb_src/mer_java/crmeb-service/src/main/java/com/zbkj/service/service/impl/UserServiceImpl.java

@@ -695,6 +695,14 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
         return update(luw);
     }
 
+    @Override
+    public User fromUidSelectUserInfo(Integer userId){
+        LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
+        lqw.select(User::getId, User::getNickname, User::getPhone, User::getAvatar,User::getNowMoney);
+        lqw.eq(User::getId, userId);
+        return dao.selectOne(lqw);
+    }
+
     /**
      * 获取uidMap
      *

+ 35 - 1
crmeb_src/mer_java/crmeb-service/src/main/java/com/zbkj/service/service/impl/user/WithdrawalHistoryServiceImpl.java

@@ -1,17 +1,26 @@
 package com.zbkj.service.service.impl.user;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.zbkj.common.constants.BalanceRecordConstants;
+import com.zbkj.common.constants.Constants;
+import com.zbkj.common.model.user.User;
+import com.zbkj.common.model.user.UserBalanceRecord;
 import com.zbkj.common.request.PageParamRequest;
 import com.zbkj.common.request.WithdrawalAuditRequest;
 import com.zbkj.common.request.WithdrawalSearchRequest;
 import com.zbkj.common.model.user.WithdrawalHistory;
 import com.zbkj.service.dao.WithdrawalHistoryDao;
+import com.zbkj.service.service.UserBalanceRecordService;
+import com.zbkj.service.service.UserService;
 import com.zbkj.service.service.user.WithdrawalHistoryService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -24,6 +33,12 @@ public class WithdrawalHistoryServiceImpl extends ServiceImpl<WithdrawalHistoryD
     @Resource
     private WithdrawalHistoryDao dao;
 
+    @Autowired
+    private UserService userService;
+
+    @Autowired
+    private UserBalanceRecordService userBalanceRecordService;
+
     @Override
     public PageInfo<WithdrawalHistory> getPageList(WithdrawalSearchRequest request, PageParamRequest pageParamRequest) {
         PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
@@ -40,7 +55,26 @@ public class WithdrawalHistoryServiceImpl extends ServiceImpl<WithdrawalHistoryD
         if (withdrawalHistory.getStatus() != 0) {
             throw new RuntimeException("该记录已审核");
         }
-
+        // 如果是拒绝需要把扣掉的金额加回来
+        if (request.getStatus().equals(2)) {
+            User userInfo = userService.fromUidSelectUserInfo(withdrawalHistory.getUid());
+            Boolean update = Boolean.FALSE;
+            BigDecimal amount = withdrawalHistory.getAmount().add(withdrawalHistory.getHandlingFeeSl());
+            update = userService.updateNowMoney(userInfo.getId(), amount, Constants.OPERATION_TYPE_ADD);
+            if (update) {
+                // 用户余额记录
+                UserBalanceRecord userBalanceRecord = new UserBalanceRecord();
+                userBalanceRecord.setUid(userInfo.getId());
+                userBalanceRecord.setLinkId(withdrawalHistory.getTransactionId());
+                userBalanceRecord.setRate(withdrawalHistory.getRate());
+                userBalanceRecord.setLinkType(BalanceRecordConstants.BALANCE_RECORD_LINK_TYPE_WITHDRAW_REFUSE);
+                userBalanceRecord.setType(BalanceRecordConstants.BALANCE_RECORD_TYPE_ADD);
+                userBalanceRecord.setAmount(amount);
+                userBalanceRecord.setBalance(userInfo.getNowMoney().add(amount));
+                userBalanceRecord.setRemark(StrUtil.format(BalanceRecordConstants.BALANCE_RECORD_REMARK_WITHDRAW_REFUSE, amount, request.getRemark()));
+                userBalanceRecordService.save(userBalanceRecord);
+            }
+        }
         withdrawalHistory.setStatus(request.getStatus());
         if (request.getRemark() != null) {
             withdrawalHistory.setRemark(request.getRemark());

+ 1 - 1
crmeb_src/mer_uniapp/api/public.js

@@ -18,7 +18,7 @@ import { toLogin, checkLogin } from "../libs/login";
 export function getWechatConfig() {
   return request.get(
     "wechat/get/public/js/config",
-    { url: encodeURIComponent(wechat.signLink()) },
+    { url: wechat.signLink() },
     { noAuth: true }
   );
 }

+ 15 - 15
crmeb_src/mer_uniapp/libs/wechat.js

@@ -10,7 +10,7 @@
 
 // #ifdef H5
 import WechatJSSDK from "@/plugin/jweixin-module/index.js";
-import {getWechatConfig, wechatAuth} from "@/api/public";
+import { getWechatConfig, wechatAuth } from "@/api/public";
 import util from 'utils/util'
 import {
     WX_AUTH,
@@ -18,7 +18,7 @@ import {
     LOGINTYPE,
     BACK_URL
 } from '@/config/cache';
-import {parseQuery} from '@/utils';
+import { parseQuery } from '@/utils';
 import store from '@/store';
 import Cache from '@/utils/cache';
 
@@ -63,13 +63,13 @@ class AuthWechat {
                         resolve(this.instance);
                     })
                 }).catch(err => {
-                console.log('微信配置失败', err);
-                util.Tips({
-                    title: '请正确配置公众号后使用!' + err
+                    console.log('微信配置失败', err);
+                    util.Tips({
+                        title: '公众号配置失败:' + (err.msg || err.message || JSON.stringify(err))
+                    });
+                    this.status = false;
+                    reject(err);
                 });
-                this.status = false;
-                reject(err);
-            });
         });
     }
 
@@ -116,7 +116,7 @@ class AuthWechat {
     location() {
         return new Promise((resolve, reject) => {
             this.wechat().then(wx => {
-                this.toPromise(wx.getLocation, {type: 'wgs84'}).then(res => {
+                this.toPromise(wx.getLocation, { type: 'wgs84' }).then(res => {
                     resolve(res);
                 }).catch(err => {
                     reject(err);
@@ -205,8 +205,8 @@ class AuthWechat {
         return new Promise((resolve, reject) => {
             wechatAuth(code, Cache.get('spread'))
                 .then(({
-                           data
-                       }) => {
+                    data
+                }) => {
                     resolve(data);
                     Cache.set(WX_AUTH, code);
                     Cache.clear(STATE_KEY);
@@ -242,10 +242,10 @@ class AuthWechat {
         uni.removeStorageSync(BACK_URL);
         const state = Cache.get('login_back_url') || '/pages/user/index';
         uni.setStorageSync(STATE_KEY, state);
-        if(snsapiBase==='snsapi_base'){
-        	return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=${state}#wechat_redirect`;
-        }else{
-        	return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
+        if (snsapiBase === 'snsapi_base') {
+            return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=${state}#wechat_redirect`;
+        } else {
+            return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
         }
     }
 

+ 3 - 1
crmeb_src/mer_uniapp/package.json

@@ -1,5 +1,7 @@
 {
   "dependencies": {
-    "@qiun/ucharts": "^2.5.0-20230101"
+    "@qiun/ucharts": "^2.5.0-20230101",
+    "html5-qrcode": "^2.3.8",
+    "jsqr": "^1.4.0"
   }
 }

+ 3 - 2
crmeb_src/mer_uniapp/pages/users/user_bill/index.vue

@@ -15,6 +15,7 @@
 							<view class="itemn" v-for="(vo,indexn) in item.list" :key="indexn">
 								<view class='acea-row row-between-wrapper'>
 									<view>
+										<view class='name line1' v-if="vo.linkType === 'withdraw_refuse'">提现拒绝增加余额</view>
 										<view class='name line1' v-if="vo.linkType === 'withdraw'">提现操作</view>
 										<view class='name line1' v-if="vo.linkType === 'order'">订单消费</view>
 										<view class='name line1' v-if="vo.linkType === 'recharge'">充值入账</view>
@@ -29,10 +30,10 @@
 										<!-- 状态标签示例,请自行添加判断逻辑 -->
 										<!-- <view class="status-txt success">提现成功</view> -->
 										<!-- <view class="status-txt processing">提现中</view> -->
-										<!-- <view class="status-txt failure">提现失败</view> -->
+										<!-- <view class="status-txt failure">提现被拒</view> -->
 										<view class="status-txt success" v-if="vo.withdrawStatus === 1">提现成功</view>
 										<view class="status-txt processing" v-if="vo.withdrawStatus === 0">提现中</view>
-										<view class="status-txt failure" v-if="vo.withdrawStatus === 2">提现失败</view>
+										<view class="status-txt failure" v-if="vo.withdrawStatus === 2">提现被拒</view>
 									</view>
 								</view>
 								<view class="remark">说明:{{vo.remark}}</view>

+ 1 - 1
crmeb_src/mer_uniapp/pages/users/user_payment/index.vue

@@ -28,7 +28,7 @@
 					<view class="tips-box">
 						<view class="tips mt-30">注意事项:</view>
 						<view class="tips-samll" v-for="item in noticeList" :key="item">
-							{{ item }}--
+							{{ item }}
 						</view>
 					</view>
 				</view>

+ 134 - 7
crmeb_src/mer_uniapp/pages/users/user_withd_slgns/index.vue

@@ -28,6 +28,10 @@
 			-->
 		</view>
 		
+		<!-- #ifdef H5 -->
+		<canvas :canvas-id="canvasId" style="width: 800px; height: 800px; position: fixed; top: -9999px; left: -9999px;"></canvas>
+		<!-- #endif -->
+		
 		<!-- 提现表单区域 -->
 		<view class="form-card">
 			<!-- 提现金额 -->
@@ -54,11 +58,11 @@
 			<!-- 注意事项 -->
 			<view class="notes">
 				<view class="note-title">注意事项</view>
-				<view class="note-item">01.提现金额请填写整数;</view>
-				<view class="note-item">02.本次提现仅支持sLGNS币种;</view>
-				<view class="note-item">03.提现将收取5%的滑点费用;</view>
-				<view class="note-item">04.请仔细核对提现地址,地址填写错误导致的资产损失,平台不予负责;</view>
-                <view class="note-item">05.提现24小时内到账;</view>
+				<view class="note-item">1.提现金额请填写整数;</view>
+				<view class="note-item">2.本次提现仅支持sLGNS币种;</view>
+				<view class="note-item">3.提现将收取5%的手续费;</view>
+				<view class="note-item">4.请仔细核对提现地址,地址填写错误导致的资产损失,平台不予负责;</view>
+                <view class="note-item">5.考虑到资金安全,提现需要人工审核,提现申请后会在24h内到账,请耐心等待,需要咨询可以联系客服:{{this.$Cache.getItem('platChatConfig').servicePhone}};</view>
 			</view>
 		</view>
 		
@@ -90,9 +94,13 @@
 </template>
 
 <script>
+	
 	import { mapGetters } from "vuex";
-	import { sLgnsWithdrawApi } from "@/api/user.js";
+	import { sLgnsWithdrawApi,getRechargeApi } from "@/api/user.js";
 	import { rmbToLgns, getRmbToLgnsRate } from "@/utils";
+	// #ifdef H5
+	import jsQR from "jsqr";
+	// #endif
 	let app = getApp();
 	
 	export default {
@@ -104,7 +112,10 @@
                 rate: '',
 				sLGNS: 0, // 余额
 				showHistory: false,
-				historyList: []
+				historyList: [],
+				// #ifdef H5
+				canvasId: 'qr-canvas',
+				// #endif
 			};
 		},
 		onLoad(options) {
@@ -133,12 +144,92 @@
 			},
 			scanCode() {
 				// 扫码逻辑
+				// #ifdef MP || APP-PLUS
 				uni.scanCode({
+					scanType: ['qrCode', 'barCode'],
 					success: (res) => {
 						this.address = res.result;
+					},
+					fail: (err) => {
+						// console.log(err);
+					}
+				});
+				// #endif
+				
+				// #ifdef H5
+				// 使用图片选择+jsQR解析
+				uni.chooseImage({
+					count: 1,
+					sizeType: ['compressed'],
+					sourceType: ['camera', 'album'],
+					success: (res) => {
+						this.scanImageH5(res.tempFilePaths[0]);
+					},
+					fail: (err) => {
+						// console.log('选择图片失败', err);
 					}
 				});
+				// #endif
 			},
+			// #ifdef H5
+			scanImageH5(tempFilePath) {
+				uni.showLoading({ title: '识别中...' });
+				
+				uni.getImageInfo({
+					src: tempFilePath,
+					success: (image) => {
+						const ctx = uni.createCanvasContext(this.canvasId, this);
+						const width = image.width;
+						const height = image.height;
+						
+						// 限制尺寸以提高性能和避免内存问题,同时包含在canvas尺寸内(800x800)
+						const maxDim = 800; 
+						// 计算缩放比例,保证宽高都不超过800
+						const scale = Math.min(maxDim / width, maxDim / height, 1);
+						
+						const drawWidth = Math.floor(width * scale);
+						const drawHeight = Math.floor(height * scale);
+						
+						// 清空画布
+						ctx.clearRect(0, 0, maxDim, maxDim);
+						ctx.drawImage(tempFilePath, 0, 0, drawWidth, drawHeight);
+						ctx.draw(false, () => {
+							// 增加延时确保H5端绘制完成
+							setTimeout(() => {
+								uni.canvasGetImageData({
+									canvasId: this.canvasId,
+									x: 0,
+									y: 0,
+									width: drawWidth,
+									height: drawHeight,
+									success: (res) => {
+										// jsQR 期望的是 Uint8ClampedArray,res.data 就是
+										const code = jsQR(res.data, res.width, res.height);
+										if (code) {
+											this.address = code.data;
+											this.$util.Tips({title: '识别成功'});
+										} else {
+											this.$util.Tips({title: '未识别到二维码,请重试'});
+										}
+										uni.hideLoading();
+									},
+									fail: (err) => {
+										console.log('获取图片数据失败', err);
+										uni.hideLoading();
+										this.$util.Tips({title: '识别失败,请手动输入'});
+									}
+								}, this);
+							}, 300); 
+						});
+					},
+					fail: (err) => {
+						console.log('获取图片信息失败', err);
+						uni.hideLoading();
+						this.$util.Tips({title: '加载图片失败'});
+					}
+				});
+			},
+			// #endif
 			submitWithdraw() {
 				// 提交逻辑
 				if(!this.amount) return this.$util.Tips({title: '请输入提现金额'});
@@ -491,4 +582,40 @@
 			}
 		}
 	}
+	
+	/* H5 扫码覆盖层样式 */
+	/* #ifdef H5 */
+	.scan-overlay {
+		position: fixed;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+		background: rgba(0,0,0,0.8);
+		z-index: 999;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		
+		.scan-box {
+			width: 100%;
+			height: 100%;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			justify-content: center;
+		}
+		
+		.close-scan {
+			margin-top: 40rpx;
+			padding: 15rpx 60rpx;
+			background: #fff;
+			border-radius: 40rpx;
+			font-size: 28rpx;
+			color: #333;
+			z-index: 1000;
+		}
+	}
+	/* #endif */
 </style>