shish 7 часов назад
Родитель
Сommit
dd78b1a210
3 измененных файлов с 31 добавлено и 6 удалено
  1. 7 5
      ghsApp/src/admin/billing/forwardResult.vue
  2. 5 0
      ghsApp/src/api/custom/index.js
  3. 19 1
      hdApp/src/admin/ghs/pay.vue

+ 7 - 5
ghsApp/src/admin/billing/forwardResult.vue

@@ -18,13 +18,14 @@
 /**
 /**
  * 冲销单退款凭证页(ssh 冲销单功能)
  * 冲销单退款凭证页(ssh 冲销单功能)
  * 用途:affirmForward.vue 提交冲销单成功后,如果客户选择"返充到余额",跳转到本页,
  * 用途:affirmForward.vue 提交冲销单成功后,如果客户选择"返充到余额",跳转到本页,
- * 用 Canvas 绘制一张可长按转发/保存的退款凭证海报(客户名、退款金额、最新余额、冲销单号 + 收款二维码),
- * 二维码复用 CustomController::actionGetGatheringCode,扫码后跳转 hdApp 的 admin/ghs/pay 页面查看余额明细。
+ * 用 Canvas 绘制一张可长按转发/保存的退款凭证海报(客户名、退款金额、最新余额、冲销单号 + 收款小程序码),
+ * 小程序码复用 CustomController::actionGetGatheringMiniCode,识别后直接打开 hdApp 小程序的
+ * admin/ghs/pay 页面查看余额明细(比普通二维码少一次跳转浏览器的步骤)。
  * 如果没有返充余额,则走通用的 /admin/billing/result 成功页,不显示本页。
  * 如果没有返充余额,则走通用的 /admin/billing/result 成功页,不显示本页。
  */
  */
 import appResult from '@/components/app-result';
 import appResult from '@/components/app-result';
 import ItemPosterPopup from '@/components/item-poster-popup.vue';
 import ItemPosterPopup from '@/components/item-poster-popup.vue';
-import { getGatheringCode } from '@/api/custom';
+import { getGatheringMiniCode } from '@/api/custom';
 import dayjs from 'dayjs';
 import dayjs from 'dayjs';
 
 
 export default {
 export default {
@@ -55,14 +56,15 @@ export default {
     this.generatePoster();
     this.generatePoster();
   },
   },
   methods: {
   methods: {
-    /** 拉取收款二维码图片并绘制海报,绘制完成后自动弹出预览 */
+    /** 拉取收款小程序码图片并绘制海报,绘制完成后自动弹出预览 */
     generatePoster() {
     generatePoster() {
       if (!this.customId) {
       if (!this.customId) {
         return;
         return;
       }
       }
       let that = this;
       let that = this;
       uni.showLoading({ mask: true, title: '生成凭证中' });
       uni.showLoading({ mask: true, title: '生成凭证中' });
-      getGatheringCode({ id: this.customId })
+      const envVersion = process.env.NODE_ENV === 'development' ? 'develop' : 'release';
+      getGatheringMiniCode({ id: this.customId, env_version: envVersion })
         .then((res) => {
         .then((res) => {
           if (res.code == 1 && res.data && res.data.imgUrl) {
           if (res.code == 1 && res.data && res.data.imgUrl) {
             uni.downloadFile({
             uni.downloadFile({

+ 5 - 0
ghsApp/src/api/custom/index.js

@@ -12,6 +12,11 @@ export const getGatheringCode = data => {
 	return https.get('/custom/get-gathering-code', data)
 	return https.get('/custom/get-gathering-code', data)
 }
 }
 
 
+//获取收款小程序码:扫码直接打开hd小程序admin/ghs/pay页,用于冲销单退款凭证海报 ssh 冲销单功能
+export const getGatheringMiniCode = data => {
+	return https.get('/custom/get-gathering-mini-code', data)
+}
+
 export const getCustomBalanceChange = data => {
 export const getCustomBalanceChange = data => {
 	return https.get('/custom-balance-change/list', data)
 	return https.get('/custom-balance-change/list', data)
 }
 }

+ 19 - 1
hdApp/src/admin/ghs/pay.vue

@@ -173,7 +173,11 @@
 		methods: {
 		methods: {
 			init() {
 			init() {
 			},
 			},
-			// 解析路由参数 id/salt
+			// 解析路由参数 id/salt:分别兼容三种进入方式——
+			// 1. 普通页面路径跳转/H5链接:option.id/option.salt 直接就是query参数
+			// 2. 微信"扫一扫"识别到普通链接二维码后跳转小程序:option.q 是被编码过的完整原链接
+			// 3. 小程序码(getwxacodeunlimit):微信不会解析生成时传入的scene,只会原样放进 option.scene,
+			//    是一个"id=xxx&salt=xxx"格式的裸字符串,需要自己按&/=拆分。ssh 冲销单功能
 			parsePayPageParams() {
 			parsePayPageParams() {
 				let id = 0
 				let id = 0
 				let salt = ''
 				let salt = ''
@@ -196,6 +200,20 @@
 					if (sceneArray.salt) {
 					if (sceneArray.salt) {
 						salt = sceneArray.salt
 						salt = sceneArray.salt
 					}
 					}
+				} else if (option.scene) {
+					const sceneStr = decodeURIComponent(option.scene)
+					const sceneItem = sceneStr.split('&')
+					const sceneArray = {}
+					for (let i = 0, l = sceneItem.length; i < l; i++) {
+						const arr = sceneItem[i].split('=')
+						sceneArray[arr[0]] = arr[1]
+					}
+					if (sceneArray.id) {
+						id = sceneArray.id
+					}
+					if (sceneArray.salt) {
+						salt = sceneArray.salt
+					}
 				}
 				}
 				return { id, salt }
 				return { id, salt }
 			},
 			},