hmp 4 年之前
父節點
當前提交
8e775047f2
共有 6 個文件被更改,包括 50 次插入12 次删除
  1. 7 0
      App.vue
  2. 3 0
      assets/http/api.js
  3. 6 3
      assets/http/global.js
  4. 1 4
      pages/webview/webview.vue
  5. 6 3
      pagesB/pages/agent/agentDetail.vue
  6. 27 2
      pagesC/pages/checkstand/index.vue

+ 7 - 0
App.vue

@@ -2,6 +2,8 @@
 	import Global from './assets/http/global.js'
 	export default {
 		onLaunch: function() {
+			//开启调试模式
+			this.setEnableDebug()
 			//更新版本
 			this.updateApp()
 			//获取token
@@ -11,6 +13,11 @@
 			this.getAudit()
 		},
 		methods:{
+			setEnableDebug(){
+				uni.setEnableDebug({
+				    enableDebug: Global.enabledDebug
+				})
+			},
 			getAudit(){
 				let params={
 					paramKey:'applet_audit'

+ 3 - 0
assets/http/api.js

@@ -164,6 +164,9 @@ const pay = {
 	}),
 	//支付策略
 	getPointPayType: p => http.post('cyzh-ldt/loginuser/getPointPayType', p),
+	//取消支付
+	cancelTrade:p => http.post('client/trade/cancelTrade', p),
+	
 }
 
 const billRecord = {

+ 6 - 3
assets/http/global.js

@@ -2,24 +2,27 @@ let global = {}
 
 
 // const application='prod'	
-const application='dev'
-// const application='test'
+// const application='dev'
+const application='test'
 
 if (application == 'prod') {
 	//正式环境
 	global.baseUrl = 'https://ldt.guosen-fumao.cn/api/'
 	global.WebSocketUrl='wss://ldt.guosen-fumao.cn/websocket/'
-	global.enabledCrypto = true
+	global.enabledCrypto = true //是否开启api加密
+	global.enabledDebug=false //是否开启调试模式
 }else if (application == 'dev') {
 	//开发环境
 	global.baseUrl = 'http://192.168.1.168:2366/'
 	global.WebSocketUrl = 'ws://192.168.1.168:2366/websocket/'
 	global.enabledCrypto = true
+	global.enabledDebug= true
 }else if (application == 'test') {
 	//测试环境
 	global.baseUrl = 'http://139.159.240.119:2366/'
 	global.WebSocketUrl = 'ws://139.159.240.119:2366/websocket/'
 	global.enabledCrypto = true
+	global.enabledDebug= true
 }
 
 

+ 1 - 4
pages/webview/webview.vue

@@ -1,9 +1,6 @@
 <template>
 	<view>
-		<web-view
-			src="https://test-m-stg.ppppoints.com/event/2019/blankPage/index.html?interCode=CYS0001&character=00&ipAddress=121.76.139.240&partnerId=S9990141&requestId=1454264898547634177615945_KB_001&reqTime=20211115181904&signType=MD5&type=mobile&version=1.0.0&mobile=19124812883&outTokenId=19124812883_out&outType=00&callbackUrl=https%3A%2F%2Fldt.guosen-fumao.cn%2Fwapp%2Fauth.html&channelSource=02000000&reserved1=&reserved2=&hmac=884f85a9d8fcba3addce478b0e7e9ee7">
-		</web-view>
-		<!-- <web-view :src="url"></web-view> -->
+		<web-view :src="url"></web-view>
 	</view>
 </template>
 

+ 6 - 3
pagesB/pages/agent/agentDetail.vue

@@ -33,13 +33,16 @@
 			}
 		},
 		methods: {
-			fetchDetail() {
+			async fetchDetail() {
 				let params = {
 					paramKey: 'agent_detail' || '-1'
 				}
-				this.$api.wxApp.appParams(params).then(res => {
+				let res=await this.$api.wxApp.appParams(params)
+				if (this.$isNotEmpty(res.data)) {
 					this.src=res.data.paramValue
-				})
+				}else{
+					this.src="https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/db833cc4148149058b185efdfb5f6e6e-pQIwdxWHG6XR5e5284ccb535e82d8cb8a3bc669323ac.png"
+				}
 			},
 			nav() {
 				uni.navigateTo({

+ 27 - 2
pagesC/pages/checkstand/index.vue

@@ -90,7 +90,9 @@
 					pointsNum: 0,
 					//消耗现金值
 					amountNum: 0,
-				}
+				},
+				// 是否主动点击取消支付,防止主动调一次取消支付,退出页面也调一次取消支付
+				isCancelTrade:false,
 			}
 		},
 		async onLoad(options) {
@@ -136,6 +138,16 @@
 		onShow() {
 			console.log(this.orderAmount);
 		},
+		onUnload() {
+			if (!this.isCancelTrade) {
+				this.cancelTrade()
+			}
+		},
+		onBackPress() {
+			if (!this.isCancelTrade) {
+				this.cancelTrade()
+			}
+		},
 		methods: {
 			handelScanResult(res){
 				let result=res.result
@@ -348,6 +360,12 @@
 					this.payShow=true
 					return
 				}
+				
+				//交易失败,把冻结的积分重新解冻
+				this.isCancelTrade=true
+				this.cancelTrade()
+				
+				this.payConfirmType=''
 				this.payResult.msg = '交易失败'
 				this.payResult.isSuccess = false
 				uni.navigateTo({
@@ -364,10 +382,17 @@
 				}
 				this.doWxPay(this.bills.id)
 			},
-			cancelClick(){
+			async cancelClick(){
+				this.isCancelTrade=true
+				await this.cancelTrade()
 				this.title="收银台"
 				this.isBack=true
 				this.payShow=false
+			},
+			async cancelTrade(){
+				if (this.payConfirmType!='paySuccess') {
+					let res=await this.$api.pay.cancelTrade(this.payParams)
+				}
 			}
 			
 		}