张延森 3 gadus atpakaļ
vecāks
revīzija
59c05750dc

+ 1
- 1
src/hotel/pages/landlord/landlord.jsx Parādīt failu

46
   const handleTabChange = (e) => {
46
   const handleTabChange = (e) => {
47
     const { index } = e.detail
47
     const { index } = e.detail
48
     setCurrentTab(index)
48
     setCurrentTab(index)
49
-    withSubscribeMessage(TPL_MESSAGE_HOTEL_CHECK_IN)
49
+    withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_IN])
50
   }
50
   }
51
 
51
 
52
   useEffect(() => {
52
   useEffect(() => {

+ 1
- 1
src/pages/RoomOrder/index.jsx Parādīt failu

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

+ 1
- 1
src/pages/index/index.jsx Parādīt failu

43
     setCurrentTab(index)
43
     setCurrentTab(index)
44
 
44
 
45
     if (index === 1) {
45
     if (index === 1) {
46
-      withSubscribeMessage(TPL_MESSAGE_HOTEL_CHECK_OUT)
46
+      withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_OUT])
47
     }
47
     }
48
   }
48
   }
49
   useEffect(() => {
49
   useEffect(() => {

+ 7
- 5
src/shop/pages/spread/spreadIndex.jsx Parādīt failu

4
 import { getShopList, getShopMoney, getAccount, getVerifiedOrder, setGetVerifiedOrder } from '@/services/shopBoss'
4
 import { getShopList, getShopMoney, getAccount, getVerifiedOrder, setGetVerifiedOrder } from '@/services/shopBoss'
5
 import { withSubscribeMessage } from '@/utils/subscribeMessage'
5
 import { withSubscribeMessage } from '@/utils/subscribeMessage'
6
 import withLayout from '@/layouts'
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
 import tabList from './Shoptabbar'
11
 import tabList from './Shoptabbar'
9
 import ShopKeeper from '../../components/ShopKeeper/shopKeeper'
12
 import ShopKeeper from '../../components/ShopKeeper/shopKeeper'
10
 import Sparead from '../../components/Sparead/spreadMoney'
13
 import Sparead from '../../components/Sparead/spreadMoney'
38
       listRef.current.context.scrollTo({ top: 0 })
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
     setAmountType('order')
48
     setAmountType('order')
46
-
47
   }
49
   }
48
 
50
 
49
   const handelType = () => {
51
   const handelType = () => {
50
     setAmountType('commission')
52
     setAmountType('commission')
51
-
52
   }
53
   }
54
+
53
   //商铺列表
55
   //商铺列表
54
   useEffect(() => {
56
   useEffect(() => {
55
     getShopList().then((res) => {
57
     getShopList().then((res) => {

+ 1
- 0
src/utils/constants.js Parādīt failu

2
 export const TPL_MESSAGE_HOTEL_CHECK_IN = "hotel_check_in";       // 民宿入住消息
2
 export const TPL_MESSAGE_HOTEL_CHECK_IN = "hotel_check_in";       // 民宿入住消息
3
 export const TPL_MESSAGE_HOTEL_CHECK_OUT = "hotel_check_out";     // 民宿离店消息
3
 export const TPL_MESSAGE_HOTEL_CHECK_OUT = "hotel_check_out";     // 民宿离店消息
4
 export const TPL_MESSAGE_SHOP_PAY_SUCCESS = "shop_pay_success";   // 商铺下单成功通知
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 Parādīt failu

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