You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

115 lines
2.1 KiB

// pages/pbService/library/mybook/index.js
import commonApi from "../../../../utils/https/common"
Page({
/**
* 页面的初始数据
*/
data: {
list:[],
card_no:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
commonApi.user_post("pbservice/Booking/loginNeedAuth",{}).then(res=>{
if(res.code==1 && res.data && res.data.card_no){
let card_no = res.data.card_no
this.setData({
card_no:card_no
})
this.getList()
}
})
},
getList:function(){
commonApi.user_post("pbservice/Booking/currentBorrow",{
card_no:this.data.card_no
}).then(res=>{
this.setData({
list:res.data
})
})
},
cancel:function(e){
let item = e.currentTarget.dataset.item;
commonApi.user_post("pbservice/Booking/cancelBorrow",{
card_no:this.data.card_no,
item_id:item.itemid
}).then(res=>{
if(res.code==1){
wx.showToast({
title: '取消成功',
icon:'none'
});
this.getList()
}
})
},
add:function(e){
let item = e.currentTarget.dataset.item;
commonApi.user_post("pbservice/Booking/renewBook",{
card_no:this.data.card_no,
bar_code:item.barcode
}).then(res=>{
if(res.code==1){
wx.showToast({
title: '续借成功',
icon:'none'
});
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})