张延森 il y a 3 ans
Parent
révision
59c05750dc

+ 1
- 1
src/hotel/pages/landlord/landlord.jsx Voir le fichier

@@ -46,7 +46,7 @@ export default withLayout((props) => {
46 46
   const handleTabChange = (e) => {
47 47
     const { index } = e.detail
48 48
     setCurrentTab(index)
49
-    withSubscribeMessage(TPL_MESSAGE_HOTEL_CHECK_IN)
49
+    withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_IN])
50 50
   }
51 51
 
52 52
   useEffect(() => {

+ 1
- 1
src/pages/RoomOrder/index.jsx Voir le fichier

@@ -26,7 +26,7 @@ export default withLayout((props) => {
26 26
   const handleSubmit = (e) => {
27 27
 
28 28
     // 订阅消息
29
-    withSubscribeMessage(TPL_MESSAGE_HOTEL_CHECK_OUT, () => {
29
+    withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_OUT], () => {
30 30
       for (let i = 0, len = formData.length; i < len; i++) {
31 31
         const item = formData[i];
32 32
         if (!item.customerName || !item.customerPhone) {

+ 1
- 1
src/pages/index/index.jsx Voir le fichier

@@ -43,7 +43,7 @@ export default withLayout((props) => {
43 43
     setCurrentTab(index)
44 44
 
45 45
     if (index === 1) {
46
-      withSubscribeMessage(TPL_MESSAGE_HOTEL_CHECK_OUT)
46
+      withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_OUT])
47 47
     }
48 48
   }
49 49
   useEffect(() => {

+ 7
- 5
src/shop/pages/spread/spreadIndex.jsx Voir le fichier

@@ -4,7 +4,10 @@ import { useRouter } from '@tarojs/taro'
4 4
 import { getShopList, getShopMoney, getAccount, getVerifiedOrder, setGetVerifiedOrder } from '@/services/shopBoss'
5 5
 import { withSubscribeMessage } from '@/utils/subscribeMessage'
6 6
 import withLayout from '@/layouts'
7
-import { TPL_MESSAGE_SHOP_PAY_SUCCESS } from '@/utils/constants'
7
+import {
8
+  TPL_MESSAGE_SHOP_PAY_SUCCESS,
9
+  TPL_MESSAGE_SHOP_VERIFY_RESULT,
10
+} from '@/utils/constants'
8 11
 import tabList from './Shoptabbar'
9 12
 import ShopKeeper from '../../components/ShopKeeper/shopKeeper'
10 13
 import Sparead from '../../components/Sparead/spreadMoney'
@@ -38,18 +41,17 @@ export default withLayout((props) => {
38 41
       listRef.current.context.scrollTo({ top: 0 })
39 42
     }
40 43
 
41
-    withSubscribeMessage(TPL_MESSAGE_SHOP_PAY_SUCCESS)
44
+    withSubscribeMessage([TPL_MESSAGE_SHOP_PAY_SUCCESS, TPL_MESSAGE_SHOP_VERIFY_RESULT])
42 45
   }
43
-  const handelTypeOrder = () => {
44 46
 
47
+  const handelTypeOrder = () => {
45 48
     setAmountType('order')
46
-
47 49
   }
48 50
 
49 51
   const handelType = () => {
50 52
     setAmountType('commission')
51
-
52 53
   }
54
+
53 55
   //商铺列表
54 56
   useEffect(() => {
55 57
     getShopList().then((res) => {

+ 1
- 0
src/utils/constants.js Voir le fichier

@@ -2,3 +2,4 @@
2 2
 export const TPL_MESSAGE_HOTEL_CHECK_IN = "hotel_check_in";       // 民宿入住消息
3 3
 export const TPL_MESSAGE_HOTEL_CHECK_OUT = "hotel_check_out";     // 民宿离店消息
4 4
 export const TPL_MESSAGE_SHOP_PAY_SUCCESS = "shop_pay_success";   // 商铺下单成功通知
5
+export const TPL_MESSAGE_SHOP_VERIFY_RESULT = "shop_verify_result";   // 商铺下单成功通知

+ 4
- 5
src/utils/subscribeMessage.js Voir le fichier

@@ -1,19 +1,18 @@
1 1
 import Taro from "@tarojs/taro";
2 2
 import store from "@/store"
3 3
 
4
-export function subscribeMessage(...messageTypes) {
4
+export function subscribeMessage(messageTypes) {
5 5
   if (!messageTypes || messageTypes.length < 1) return Promise.resolve();
6 6
   
7 7
   const { messageTpls } = store.getModel('system').getState()
8 8
   if (!messageTpls || !messageTpls.length) return Promise.resolve();
9
-
9
+  
10 10
   return new Promise((resolve, reject) => {
11 11
     const tmplIds = messageTypes.map((messageType) => {
12 12
       const tpl = messageTpls.filter(x => x.messageType === messageType)[0] || {}
13 13
       return tpl.templateId;
14 14
     }).filter(Boolean)
15 15
 
16
-
17 16
     if (tmplIds && tmplIds.length > 0) {
18 17
       Taro.requestSubscribeMessage({
19 18
         tmplIds,
@@ -25,8 +24,8 @@ export function subscribeMessage(...messageTypes) {
25 24
   })
26 25
 }
27 26
 
28
-export function withSubscribeMessage(type, callback) {
29
-  subscribeMessage(type).then(() => {
27
+export function withSubscribeMessage(types, callback) {
28
+  subscribeMessage(types).then(() => {
30 29
     if (callback) {
31 30
       callback()
32 31
     }