Showing
3 changed files
with
15 additions
and
5 deletions
| 1 | // pages/book/b_addnew.js | 1 | // pages/book/b_addnew.js |
| 2 | import util from '../../../utils/util'; | 2 | import util from '../../../utils/util'; |
| 3 | import App from '../../../utils/api'; | 3 | import App from '../../../utils/api'; |
| 4 | +import PubSub from '../../../utils/PubSub' | ||
| 4 | const formTpl = { | 5 | const formTpl = { |
| 5 | rid: '', | 6 | rid: '', |
| 6 | pnum: 6, | 7 | pnum: 6, |
| @@ -55,6 +56,10 @@ Page({ | @@ -55,6 +56,10 @@ Page({ | ||
| 55 | * 生命周期函数--监听页面加载 | 56 | * 生命周期函数--监听页面加载 |
| 56 | */ | 57 | */ |
| 57 | onLoad: async function (options) { | 58 | onLoad: async function (options) { |
| 59 | + PubSub.on('arrangeDesk',(res)=>{ | ||
| 60 | + console.log('arrangeDesk',res) | ||
| 61 | + this.getTables(); | ||
| 62 | + }) | ||
| 58 | this.options=options | 63 | this.options=options |
| 59 | this.sellerid = util.cache('enter_params')['seller_id']; | 64 | this.sellerid = util.cache('enter_params')['seller_id']; |
| 60 | this.getCustomRemark(); | 65 | this.getCustomRemark(); |
| @@ -98,7 +103,7 @@ Page({ | @@ -98,7 +103,7 @@ Page({ | ||
| 98 | * 生命周期函数--监听页面卸载 | 103 | * 生命周期函数--监听页面卸载 |
| 99 | */ | 104 | */ |
| 100 | onUnload: function () { | 105 | onUnload: function () { |
| 101 | - | 106 | + PubSub.off('arrangeDesk') |
| 102 | }, | 107 | }, |
| 103 | 108 | ||
| 104 | /** | 109 | /** |
| @@ -57,10 +57,10 @@ Page({ | @@ -57,10 +57,10 @@ Page({ | ||
| 57 | wx.removeStorage({ | 57 | wx.removeStorage({ |
| 58 | key:'tableid' | 58 | key:'tableid' |
| 59 | }) | 59 | }) |
| 60 | - PubSub.emit('arrangeDesk',{ | ||
| 61 | - tableid:this.checked_tids | ||
| 62 | - }) | ||
| 63 | } | 60 | } |
| 61 | + PubSub.emit('arrangeDesk',{ | ||
| 62 | + tableid:this.checked_tids | ||
| 63 | + }) | ||
| 64 | wx.navigateBack(); | 64 | wx.navigateBack(); |
| 65 | }, | 65 | }, |
| 66 | getdesklist: function () { | 66 | getdesklist: function () { |
| 1 | // pages/book/b_addnew.js | 1 | // pages/book/b_addnew.js |
| 2 | import util from '../../../utils/util'; | 2 | import util from '../../../utils/util'; |
| 3 | import App from '../../../utils/api'; | 3 | import App from '../../../utils/api'; |
| 4 | +import PubSub from '../../../utils/PubSub' | ||
| 4 | const formTpl = { | 5 | const formTpl = { |
| 5 | rid: '', | 6 | rid: '', |
| 6 | pnum: 6, | 7 | pnum: 6, |
| @@ -55,6 +56,10 @@ Page({ | @@ -55,6 +56,10 @@ Page({ | ||
| 55 | * 生命周期函数--监听页面加载 | 56 | * 生命周期函数--监听页面加载 |
| 56 | */ | 57 | */ |
| 57 | onLoad: async function (options) { | 58 | onLoad: async function (options) { |
| 59 | + PubSub.on('arrangeDesk',(res)=>{ | ||
| 60 | + console.log('arrangeDesk',res) | ||
| 61 | + this.getTables(); | ||
| 62 | + }) | ||
| 58 | this.options=options | 63 | this.options=options |
| 59 | this.sellerid = util.cache('enter_params')['seller_id']; | 64 | this.sellerid = util.cache('enter_params')['seller_id']; |
| 60 | this.getCustomRemark(); | 65 | this.getCustomRemark(); |
| @@ -98,7 +103,7 @@ Page({ | @@ -98,7 +103,7 @@ Page({ | ||
| 98 | * 生命周期函数--监听页面卸载 | 103 | * 生命周期函数--监听页面卸载 |
| 99 | */ | 104 | */ |
| 100 | onUnload: function () { | 105 | onUnload: function () { |
| 101 | - | 106 | + PubSub.off('arrangeDesk') |
| 102 | }, | 107 | }, |
| 103 | 108 | ||
| 104 | /** | 109 | /** |
-
Please register or login to post a comment