123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- // dispatcher/pages/withdraw_library/withdraw_library.js
- import { routers, viewImage, sharePage, isFn, getGlobalVal } from '../../../utils/util.js'
- import { GetWithdrawLibrary } from '../../../utils/api.js'
- const { navigateTo, redirectTo, navigateBack } = routers()
- const { globalData } = getApp()
- const { baseImgUrl } = globalData
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- isLoaded: false,
- content: '',
- pageNo: 1,
- pageSize: 10,
- isAll: false,
- list: [
- // {
- // league_name: '私塾家华景新城文字文字文字文字文字文文字门店GZ100',
- // id: ''
- // },
- // {
- // league_name: '私塾家华景新城文字文字文字文字文字文文字门店GZ100',
- // id: ''
- // },
- // {
- // league_name: '私塾家华景新城文字文字文字文字文字文文字门店GZ100',
- // id: ''
- // },
- // {
- // league_name: '私塾家华景新城文字文字文字文字文字文文字门店GZ100',
- // id: ''
- // },
- // {
- // league_name: '私塾家华景新城文字文字文字文字文字文文字门店GZ100',
- // id: ''
- // },
- // {
- // league_name: '私塾家华景新城文字文字文字文字文字文文字门店GZ100',
- // id: ''
- // },
- ],
- nodataArray: {
- text: "搜索无结果"
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({ options })
- this.getData()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- const obj = { navigateTo, redirectTo, navigateBack, viewImage }
- for (const i in obj) {
- this[i] = obj[i]
- }
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.setData({ pageNo: 1 })
- this.getData(() => {
- wx.stopPullDownRefresh()
- })
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- const { isAll } = this.data
- if (isAll) return
- this.getData()
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- if (isFn(sharePage)) return sharePage()
- },
- /**
- * 获取撤馆列表
- */
- getData: function (cb) {
- const continuousFn = { fn: this.getData, param: { ...arguments } }
- const { content, pageNo, pageSize, list } = this.data
- GetWithdrawLibrary({ data: { content, pageNo, pageSize }, continuousFn }).then(res => {
- const newList = res.data.list
- let tempList = []
- if (pageNo == 1) {
- tempList = newList
- } else {
- tempList = [...list, ...newList]
- }
- const temp = {}
- temp['list'] = tempList
- temp['pageNo'] = newList.length == pageSize ? ~~pageNo + 1 : pageNo
- temp['isAll'] = newList.length < pageSize
- temp['isLoaded'] = true
- this.setData(temp)
- if (isFn(cb)) cb()
- }).catch(res => {
- this.setData({ isLoaded: true })
- if (isFn(cb)) cb()
- })
- },
- /**
- * 输入搜索值
- */
- inputSearchCtl: function (e) {
- const { value } = e.detail
- const { content } = this.data
- if (content == value) return
- this.setData({ content: value })
- },
- /**
- * 清除搜索值
- */
- clearSearchCtl: function () {
- this.setData({ content: '' })
- },
- /**
- * 提交搜索值
- */
- submitSearchCtl: function () {
- this.setData({ isReturn: 1, pageNo: 1 })
- this.getData()
- },
- /**
- * 选择馆
- */
- selectLiCtl: function (e) {
- const { index } = e.currentTarget.dataset
- const { list } = this.data
- const { id } = list[index]
- if (!id) {
- wx.showToast({
- title: '当前馆没有馆ID',
- icon: 'none'
- })
- return
- }
- redirectTo({ url: 'dispatcher/pages/withdraw_detail/withdraw_detail', paras: { libId: id, type: 1 }, zindex: 3 })
- }
- })
|