123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- // parents//pages/apply_book/apply_book.js
- import { routers, viewImage, sharePage, isFn, getGlobalVal } from '../../../utils/util.js'
- import { GetThemeAllBook, PostApplyBookList, ApplyBook } from '../../../utils/api.js'
- const { navigateTo, redirectTo, navigateBack } = routers()
- const { globalData } = getApp()
- const { baseImgUrl, thumbnail } = globalData
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- baseImgUrl,
- thumbnail,
- isLoaded: 0,
- title: '',
- pageNo: 1,
- pageSize: 10,
- isAll: false,
- navIndex: 0,
- list: [],
- isAllCheck: 0,
- isManage: 0,
- totalNum: 0,
- hiddenModel:false,
- isDelete: false,
- infofromstorage:[],
- stepList: [
- {
- number: '1',
- text: '填写书单申请',
- unit: '->'
- },
- {
- number: '2',
- text: '通过申请采购',
- unit: '->'
- },
- {
- number: '3',
- text: '新书到馆',
- unit: ''
- }
-
- ],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let _this = this
- options.vipId = getGlobalVal('vipId', `vipId_${getGlobalVal('userId')}`) || ''
- // options.vipId ='ea4e93ee-8b22-41bd-bb09-ec36e88eab78'
- options.libId = getGlobalVal('library').id || ''
- // wx.setNavigationBarTitle({
- // title: `${options.theme}`,
- // })
- this.setData({ options, isAllCheck: options.status == 1 })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- const obj = { navigateTo, redirectTo, navigateBack, viewImage }
- for (const i in obj) {
- this[i] = obj[i]
- }
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- let _this = this
- wx.getStorage({
- key: 'parentsList',
- success: function (res) {
- _this.setData({
- infofromstorage: res.data,
- })
- console.log(res)
- }
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- if (isFn(sharePage)) return sharePage()
- },
- /**
- * 提示框隐藏
- */
- allShowModel: function () {
- this.setData({ hiddenModel: false})
- },
- /**
- * 提示框打开
- */
- showModel: function () {
- this.setData({ hiddenModel: true })
- },
- /**
- * 确认调入
- */
- getCallin: function () {
- const continuousFn = { fn: this.getCallin, param: { ...arguments } }
- const { infofromstorage=[], options } = this.data
- if (infofromstorage.length==0)return
- const { vipId, libId} = options
- ApplyBook({ data: { libId, vipId, detailList: infofromstorage }, continuousFn }).then(res => {
- wx.removeStorageSync('parentsList')
- this.setData({
- infofromstorage: [],
- })
- wx.showToast({
- title: `已加入调入列表`
- })
- })
- },
- /**
- * 管理
- */
- cancelCallin: function () {
- const { isDelete, infofromstorage = [] } = this.data
- if (infofromstorage.length == 0) return
- this.setData({ isDelete: !isDelete })
- },
- /**
- * 删除
- */
- deleteBtn: function (e) {
- const { index } = e.currentTarget.dataset
- const { infofromstorage } = this.data
- infofromstorage.splice(index, 1)
- this.setData({ infofromstorage })
- wx.setStorageSync('parentsList', infofromstorage)
- },
- /**
- * 提交搜索值
- */
- submitSearchCtl: function () {
- const temp = {}
- temp[`pageNo`] = 1
- this.setData(temp)
- this.getData()
- },
- })
|