Browse Source

fix: 增加智能推送

fix: 沙河分院修改deptCode
carver 2 năm trước cách đây
mục cha
commit
823c108f79

+ 17 - 4
antbuilder/industry/hospitalV2/components/appointment-result/index.js

@@ -4,6 +4,7 @@ import { cuttingDate } from "../../utils";
 import history from "../../utils/history";
 import { tradePay } from "../../utils/tradePay";
 import { reportApi } from "../../utils/cloudMonitorHelper";
+import { getAuthUser } from "../../../../core/utils/jsapi";
 Component({
 	props: {},
 	data: {
@@ -124,7 +125,7 @@ Component({
 				} else if (status === 1) {
 					/* 如果是从下单页面过来的,拉起消息授权 */
 					if (where === "order-pay") {
-						this.grantSubscribe();
+						this.grantSubscribe(query.orderId);
 					}
 				}
 
@@ -179,8 +180,20 @@ Component({
 		},
 
 		// 消息订阅授权
-		grantSubscribe() {
-			// this.subscribe.subscribeMessage();
+		async grantSubscribe(orderId) {
+			// todo 添加智能推送接口
+			console.log("orderId =====>", orderId);
+			const [err, authResult] = await getAuthUser([
+				"auth_user",
+				"hospital_order",
+			]);
+			if (err) {
+				my.showToast({
+					type: "fail",
+					content: "智能消息推送授权失败",
+				});
+			}
+			console.log("authResult ===>", authResult.authCode);
 			console.log("预约成功后调起消息订阅授权");
 		},
 
@@ -226,7 +239,7 @@ Component({
 			).then(() => {
 				this.orderDetail(); // 支付成功之后发起消息订阅授权
 
-				this.grantSubscribe();
+				this.grantSubscribe(query.orderId);
 				// this.subscribe.subscribeMessage();
 			});
 			/* 服务办结,挂号缴费 */

+ 15 - 2
antbuilder/industry/hospitalV2/components/hospital-project/index.js

@@ -1,4 +1,5 @@
 import { createSubscribe } from "applet-page-component";
+import { getAuthUser } from "../../../../core/utils/jsapi";
 import {
 	getTestTimeList,
 	getQuestionnaire,
@@ -11,7 +12,7 @@ import { tradePay } from "../../utils/tradePay";
 import { reportCmPV_YL } from "../../utils/cloudMonitorHelper";
 const deptCodeMap = {
 	黄石总院: 500,
-	沙河分院: 667,
+	沙河分院: 499,
 };
 Component(
 	createSubscribe({
@@ -329,7 +330,19 @@ Component(
 								tradeType: "Appointment",
 							}
 						)
-							.then(() => {
+							.then(async () => {
+								// todo 添加智能推送接口
+								const [err, authResult] = await getAuthUser([
+									"auth_user",
+									"hospital_order",
+								]);
+								console.log("authResult ===>", authResult.authCode);
+								if (err) {
+									my.showToast({
+										type: "fail",
+										content: "智能消息推送授权失败",
+									});
+								}
 								history.replace({
 									query: {
 										hospitalDistrictId,

+ 43 - 47
antbuilder/industry/hospitalV2/components/index-head/indexHead.sjs

@@ -1,75 +1,71 @@
 /*
-* 获取扩展字段
-* */
+ * 获取扩展字段
+ * */
 const getExtInfo = (item) => {
-  const { componentExtInfo } = item;
-  return componentExtInfo || {};
+	const { componentExtInfo } = item;
+	return componentExtInfo || {};
 };
 
 /*
-* 获取消息列表
-* */
+ * 获取消息列表
+ * */
 const getNotifyList = (item) => {
-  const { serviceList = [] } = item;
-  return serviceList;
+	const { serviceList = [] } = item;
+	return serviceList;
 };
 
 const msgClass = (item, showMsg) => {
-  const { length } = getNotifyList(item);
-  return !length || !showMsg ? ' no-msg' : '';
+	const { length } = getNotifyList(item);
+	return !length || !showMsg ? " no-msg" : "";
 };
 
 /*
-* 获取样式
-* */
+ * 获取样式
+ * */
 const getStyleMode = (item) => {
-  const {
-    icon,
-    styleMode = 'a',
-  } = getExtInfo(item);
-  /*
-  * 三种模式
-  * */
-  const modes = {
-    a: 'head-a',
-    b: 'head-b',
-    c: 'head-c',
-  };
-  return icon ? 'head-custom' : modes[styleMode];
+	const { icon, styleMode = "a" } = getExtInfo(item);
+	/*
+	 * 三种模式
+	 * */
+	const modes = {
+		a: "head-a",
+		b: "head-b",
+		c: "head-c",
+	};
+	return icon ? "head-custom" : modes[styleMode];
 };
 
-const getImgUrl = (url, prefix) => (
-  url.length === 32 ? `${prefix}${url}` : url
-);
+const getImgUrl = (url, prefix) =>
+	url.length === 32 ? `${prefix}${url}` : url;
 
 const getBgStyle = (item, imgSrcPrefix) => {
-  const styles = [];
-  const { icon } = getExtInfo(item);
-  if (icon) {
-    styles.push(`background-image:url(${getImgUrl(icon, imgSrcPrefix)})`);
-  }
-  return styles.join(';');
+	const styles = [];
+	const { icon } = getExtInfo(item);
+	if (icon) {
+		styles.push(`background-image:url(${getImgUrl(icon, imgSrcPrefix)})`);
+	}
+	return styles.join(";");
 };
 
 /*
-* 获取二级标题
-* */
+ * 获取二级标题
+ * */
 const getSubTitle = (item) => {
-  const { desc } = getExtInfo(item);
-  return desc || '了解本院特色';
+	const { desc } = getExtInfo(item);
+	return desc || "了解本院特色";
 };
 
 const getTitle = (item) => {
-  const { title } = getExtInfo(item);
-  return title || '首页';
+	const { title } = getExtInfo(item);
+	return title || "";
 };
 
 export default {
-  msgClass,
-  getTitle,
-  getBgStyle,
-  getExtInfo,
-  getStyleMode,
-  getNotifyList,
-  getSubTitle,
+	msgClass,
+	getTitle,
+	getBgStyle,
+	getExtInfo,
+	getStyleMode,
+	getNotifyList,
+	getSubTitle,
 };

+ 6 - 6
antbuilder/industry/hospitalV2/components/pay-result/index.js

@@ -1,6 +1,6 @@
 import { getDepositDetails, getsubscribeID } from "./service";
 import { reportApi } from "../../utils/cloudMonitorHelper";
-import { getAuthUser } from "../../../../core/utils/jsapi";
+// import { getAuthUser } from "../../../../core/utils/jsapi";
 Component({
 	data: {
 		showSubscrible: true,
@@ -68,11 +68,11 @@ Component({
 				// 		console.log("authCode ===>", res.authCode);
 				// 	},
 				// });
-				const [err, authResult] = await getAuthUser([
-					"auth_user",
-					"hospital_order",
-				]);
-				console.log("authResult ===>", authResult.authCode);
+				// const [err, authResult] = await getAuthUser([
+				// 	"auth_user",
+				// 	"hospital_order",
+				// ]);
+				// console.log("authResult ===>", authResult.authCode);
 				// const subscribeID = await getsubscribeID();
 				// await this.requestSubscribeMessageFn(subscribeID.depositTemplateId);
 			} catch (error) {