const app = getApp();
|
Page({
|
|
/**
|
* 页面的初始数据
|
*/
|
data: {
|
barHeight: '',
|
navBarHeight: '',
|
searchValue: '',
|
userInfo: null,
|
path: '*',
|
pathList: [],
|
|
bookList: [],
|
//高级分类
|
iconList: {
|
value: "",
|
options: [],
|
},
|
//一级分类
|
stairList: {
|
value: '',
|
options: [],
|
},
|
//二级分类
|
secondList: {
|
value: [],
|
options: [],
|
},
|
//重点项目
|
majorProjectList: {
|
value: [],
|
options: [],
|
},
|
//新形态教材
|
newTextBook: {
|
value: [],
|
options: [],
|
},
|
//高级分类选中
|
assortCheck: {
|
name: '',
|
code: '',
|
},
|
|
stairCode: '', // 一级分类选中项
|
secondCode: '', // 二级分类选中项
|
sort: '', // 排序
|
//分页
|
page: 1,
|
limit: 10,
|
pageTotalCount: 0,
|
bottomLoading: false,
|
isMoreData: false,
|
// 返回顶部
|
isBackTop: false,
|
setScrollValue: 0,
|
skeletonLoding: true,
|
alreadyPaperBookList: [], //已申请纸质样书
|
alreadyElectronicBookList: [], //已申请电子样书
|
paperBookList: [], //样书单纸质书
|
electronicBookList: [], //样书单电子书
|
paperBookCount: 0, //纸质书剩余次数
|
ebookCount: 0, //电子书剩余次数
|
},
|
|
/**
|
* 生命周期函数--监听页面加载
|
*/
|
onLoad(options) {
|
const systInfo = wx.getSystemInfoSync();
|
const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息
|
const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度
|
this.setData({
|
barHeight: systInfo.statusBarHeight,
|
navBarHeight: navBarHeight,
|
});
|
// 搜索赋值
|
if (options && options.searchValue) {
|
this.setData({
|
searchValue: options.searchValue,
|
});
|
}
|
// 高级分类赋值
|
if (options && options.assortCode) {
|
this.setData({
|
assortCheck: {
|
name: options.assorName,
|
code: options.assortCode,
|
'iconList.value': options.assortCode
|
},
|
});
|
}
|
if (this.data.assortCheck.code) {
|
// 获取一级分类
|
this.getStairList(this.data.assortCheck.code);
|
}
|
// 一级分类和path赋值
|
if (options && options.assortCode && options.stairCode) {
|
this.setData({
|
'stairList.value': options.stairCode,
|
stairCode: options.stairCode,
|
path: `${options.assortCode}\\${options.stairCode}`,
|
});
|
}
|
// 二级分类赋值
|
if (options && options.secondCode) {
|
this.setData({
|
secondCode: options.secondCode,
|
pathList: [{
|
Path: options.secondCode,
|
Type: '*',
|
StoreRefCode: app.config.goodsStore,
|
}
|
],
|
})
|
}
|
this.getIconTypeList();
|
this.getBookList(false);
|
// 获取重点项目
|
this.getProjectList('bookClassification');
|
//新形态教材
|
this.getProjectList('newFormsTextbooks');
|
if (wx.getStorageSync(app.config.tokenKey)) {
|
this.getAlreadyPBookList()
|
this.getAlreadyEBookList()
|
}
|
if (wx.getStorageSync(app.config.userInfoKey)) {
|
this.setData({
|
userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey))
|
})
|
}
|
if (wx.getStorageSync("paperBookList")) {
|
this.setData({
|
paperBookList: wx.getStorageSync("paperBookList")
|
})
|
}
|
if (wx.getStorageSync("electronicBookList")) {
|
this.setData({
|
electronicBookList: wx.getStorageSync("electronicBookList")
|
})
|
}
|
},
|
|
/**
|
* 生命周期函数--监听页面初次渲染完成
|
*/
|
onReady() {
|
|
},
|
|
/**
|
* 生命周期函数--监听页面显示
|
*/
|
onShow() {
|
|
},
|
goBack() {
|
wx.navigateBack();
|
},
|
//获取高级分类
|
getIconTypeList() {
|
let query = {
|
path: '*',
|
filterList: [
|
{
|
value: 'Normal',
|
field: 'state'
|
}
|
],
|
queryType: '\\',
|
searchList: [],
|
size: '5',
|
start: '0',
|
storeRefCode: app.config.goodsStore,
|
sort: { type: 'Asc', field: 'LinkOrder' }
|
}
|
app.MG.store.getStoreChannelList(query).then((res) => {
|
let list = [];
|
if (res.datas.length > 0) (
|
res.datas.forEach((item) => {
|
item.value = item.refCode;
|
item.label = item.name;
|
if (item.refCode == 'jsek_higherEducation') {
|
list.push(item)
|
}
|
if (item.refCode == 'jsek_vocationalEducation') {
|
list.push(item)
|
}
|
|
})
|
)
|
this.setData({
|
'iconList.options': list,
|
'iconList.value': this.data.assortCode,
|
});
|
})
|
},
|
// 获取一级列表
|
getStairList(path) {
|
const query = {
|
path,
|
filterList: [],
|
queryType: '\\',
|
searchList: [],
|
size: '30',
|
start: '0',
|
storeRefCode: app.config.goodsStore,
|
sort: { type: 'Asc', field: 'LinkOrder' },
|
};
|
app.MG.store.getStoreChannelList(query).then(async (res) => {
|
let options = [];
|
if (res.datas.length > 0) {
|
for (let index = 0; index < res.datas.length; index++) {
|
let item = res.datas[index];
|
options.push({
|
value: item.refCode,
|
label: item.name,
|
});
|
}
|
}
|
this.setData({
|
'stairList.options': options,
|
'stairList.value': this.data.stairCode,
|
});
|
});
|
},
|
// 获取一级分类下二级分类
|
getSecondList(path) {
|
let options = [];
|
let query = {
|
path,
|
filterList: [],
|
queryType: '\\',
|
searchList: [],
|
size: '30',
|
start: '0',
|
storeRefCode: app.config.goodsStore,
|
sort: { type: 'Asc', field: 'LinkOrder' },
|
};
|
app.MG.store.getStoreChannelList(query).then((res) => {
|
if (res.datas.length > 0) {
|
for (let index = 0; index < res.datas.length; index++) {
|
const item = res.datas[index];
|
options.push({
|
value: `${item.pathLinks[0].linkPath}\\${item.id}`,
|
label: item.name,
|
});
|
}
|
}
|
this.setData({
|
'secondList.options': options,
|
});
|
const second = [this.data.secondCode]
|
this.setData({
|
'secondList.value': second
|
})
|
});
|
},
|
// 获取重点项目
|
getProjectList(type) {
|
const options = [];
|
const arr = [];
|
let array = [];
|
const query = {
|
refCodes: [type],
|
};
|
app.MG.store.getProductTypeField(query).then((res) => {
|
array = JSON.parse(res[0].config).option;
|
for (let index = 0; index < array.length; index++) {
|
const element = array[index];
|
if (element.child) {
|
for (let index = 0; index < element.child.length; index++) {
|
const item = element.child[index];
|
arr.push(item);
|
}
|
}
|
}
|
if (type == 'bookClassification') {
|
for (let index = 0; index < arr.length; index++) {
|
const element = arr[index];
|
options.push({
|
value: element.value,
|
label: element.name,
|
});
|
}
|
this.setData({
|
'majorProjectList.options': options,
|
});
|
} else if (type == 'newFormsTextbooks') {
|
for (let index = 0; index < arr.length; index++) {
|
const element = arr[index];
|
options.push({
|
value: element.value,
|
label: element.name,
|
});
|
}
|
this.setData({
|
'newTextBook.options': options,
|
});
|
console.log('重点项目', this.data.newTextBook);
|
}
|
});
|
},
|
// 获取图书列表
|
getBookList(isReachBottom) {
|
let that = this;
|
let sort;
|
let pathObj = {};
|
if (that.data.pathList.length) {
|
pathObj = {
|
subAccess: this.data.pathList,
|
};
|
} else {
|
pathObj = {
|
path: that.data.path,
|
queryType: '*',
|
};
|
}
|
if (that.data.sort) {
|
sort = {
|
Name: that.data.sort,
|
BaseType: '',
|
};
|
} else {
|
sort = {
|
type: 'Desc',
|
field: 'ViewCount',
|
};
|
}
|
// 搜索
|
let searchObj = {};
|
if (that.data.searchValue) {
|
searchObj = {
|
'Name*': that.data.searchValue,
|
'||author*': that.data.searchValue,
|
'||isbn*': that.data.searchValue,
|
'||seriesName*': that.data.searchValue,
|
};
|
}
|
const query = {
|
...pathObj,
|
filterList: [
|
{
|
value: 'Normal',
|
field: 'state',
|
},
|
],
|
sort,
|
coverSize: {
|
height: 145,
|
},
|
paging: {
|
start: that.data.page * that.data.limit - that.data.limit,
|
size: that.data.limit
|
},
|
fields: {
|
author: [],
|
isbn: [],
|
publicationDate: [],
|
isApplyBook: [],
|
'isApplyBook>': ['1'],
|
...searchObj,
|
},
|
};
|
app.MG.store.getProductList(query).then((res) => {
|
try {
|
if (res.datas.length > 0) {
|
res.datas.forEach((item) => {
|
item.paperDisabled = false
|
item.paperChecked = false
|
item.electronDisabled = false
|
item.electronChecked = false
|
if (item.purchasedSaleMethodIdList.indexOf(item.defaultSaleMethodId) > -1) {
|
item.electronDisabled = true
|
item.electronChecked = true
|
}
|
if (that.data.alreadyPaperBookList.length > 0) {
|
that.data.alreadyPaperBookList.forEach((pBook) => {
|
pBook.content.forEach((pBookItem) => {
|
if (pBookItem.id === item.id && pBook.state == 'WaitAudit') {
|
item.paperDisabled = true
|
item.paperChecked = true
|
}
|
if (pBookItem.id === item.id && pBook.state == 'Normal') {
|
item.paperDisabled = false
|
}
|
})
|
})
|
}
|
if (that.data.alreadyElectronicBookList.length > 0) {
|
that.data.alreadyElectronicBookList.forEach((eBook) => {
|
eBook.content.forEach((eBookItem) => {
|
if (eBookItem.id === item.id && !eBook.isExpiry && eBook.state != 'Reject') {
|
item.electronDisabled = true
|
item.electronChecked = true
|
}
|
})
|
})
|
}
|
if (that.data.paperBookList.length > 0) {
|
for (let i = 0; i < that.data.paperBookList.length; i++) {
|
if (that.data.paperBookList[i].id == item.id) {
|
item.paperChecked = true
|
}
|
}
|
}
|
if (that.data.electronicBookList.length > 0) {
|
for (let i = 0; i < that.data.electronicBookList.length; i++) {
|
if (that.data.electronicBookList[i].id == item.id) {
|
item.electronChecked = true
|
}
|
}
|
}
|
});
|
let list = res.datas;
|
//触底加载新数据并保留老数据
|
if (isReachBottom) {
|
list = [...this.data.bookList, ...list] //将新数据加入老数据中
|
}
|
that.setData({
|
bookList: list,
|
pageTotalCount: res.total,
|
bottomLoading: false,
|
isMoreData: list.length > 0 ? false : true,
|
skeletonLoding: false,
|
loading: false
|
})
|
} else {
|
that.setData({
|
skeletonLoding: false,
|
loading: false
|
})
|
}
|
} catch (error) {
|
console.log(error)
|
}
|
});
|
},
|
//高级分类选择
|
onChangeIcon(e) {
|
this.setData({
|
assortCheck: {
|
code: e.detail.value,
|
},
|
stairCode: '',
|
secondCode: '',
|
path: `${e.detail.value}`,
|
'iconList.value': e.detail.value,
|
});
|
this.getBookList(false);
|
this.getStairList(this.data.assortCheck.code);
|
|
},
|
// 一级分类切换
|
onChangeStair(e) {
|
const path = e.detail.value.length
|
? `${this.data.assortCheck.code}\\${e.detail.value}`
|
: this.data.assortCheck.code;
|
this.setData({
|
pathList: [],
|
stairCode: e.detail.value,
|
secondCode: '',
|
path: path,
|
'stairList.value': e.detail.value,
|
});
|
this.getBookList(false);
|
this.getSecondList(path);
|
},
|
// 二级分类切换
|
onChangeSecond(e) {
|
const pathList = [];
|
for (let index = 0; index < e.detail.value.length; index++) {
|
const element = e.detail.value[index];
|
pathList.push({
|
Path: element,
|
Type: '*',
|
StoreRefCode: app.config.goodsStore,
|
});
|
}
|
this.setData({
|
pathList: pathList,
|
'secondList.value': e.detail.value,
|
});
|
|
},
|
//
|
onConfirmSecond() {
|
this.getBookList(false);
|
},
|
// 重点项目改变
|
changeMajorProject(e) {
|
this.setData({
|
'majorProjectList.value': e.detail.value,
|
});
|
this.getBookList(false);
|
},
|
// 重点项目重置
|
resetMajorProject() {
|
this.setData({
|
'majorProjectList.value': [],
|
});
|
this.getBookList(false);
|
},
|
changeNewText(e) {
|
this.setData({
|
'newTextBook.value': e.detail.value,
|
});
|
this.getBookList(false);
|
},
|
resetNewText() {
|
this.setData({
|
'newTextBook.value': [],
|
});
|
this.getBookList(false);
|
},
|
// 排序按钮
|
sortClick() {
|
if (!this.data.sort.length) {
|
this.setData({
|
sort: 'Desc',
|
});
|
} else if (this.data.sort == 'Desc') {
|
this.setData({
|
sort: 'Asc',
|
});
|
} else if (this.data.sort == 'Asc') {
|
this.setData({
|
sort: '',
|
});
|
}
|
let path;
|
if (this.data.secondCode) {
|
path = this.data.secondCode;
|
} else if (this.data.stairCode) {
|
path = `${this.data.assortCheck.code
|
}\\${this.data.stairCode}`;
|
} else {
|
path = this.data.assortCheck.code;
|
}
|
this.setData({
|
path: path,
|
});
|
this.getBookList(false);
|
},
|
// 搜索图书
|
searchBook(e) {
|
console.log(e.detail.value);
|
this.setData({
|
searchValue: e.detail.value,
|
});
|
this.getBookList(false);
|
},
|
// 跳转图书详情
|
goDetail(e) {
|
const { book } = e.currentTarget.dataset;
|
wx.navigateTo({
|
url: `/packageBookService/pages/bookServices/detail/index?id=${book.id}&name=${book.name}`,
|
});
|
},
|
//获取已申请纸质样书
|
getAlreadyPBookList() {
|
const data = {
|
start: 0,
|
size: 9999,
|
topicIdOrRefCode: 'applyEntityBook',
|
appRefCode: app.config.appRefCode,
|
sort: {
|
type: 'Desc',
|
field: 'CreateDate'
|
}
|
}
|
app.MG.ugc.getTopicMessageList(data).then((res) => {
|
res.datas.map((item) => {
|
if (item.content) {
|
item.content = JSON.parse(item.content)
|
}
|
})
|
this.setData({
|
alreadyPaperBookList: res.datas,
|
});
|
})
|
},
|
//获取已申请电子样书
|
getAlreadyEBookList() {
|
const data = {
|
start: 0,
|
size: 9999,
|
topicIdOrRefCode: 'applyBook',
|
appRefCode: app.config.appRefCode,
|
sort: {
|
type: 'Desc',
|
field: 'CreateDate'
|
}
|
}
|
app.MG.ugc.getTopicMessageList(data).then((res) => {
|
let list = []
|
res.datas.map((item) => {
|
if (item.feedBack) {
|
item.feedBack = JSON.parse(item.feedBack)
|
if (item.feedBack.endDate) {
|
let times = new Date(item.feedBack.endDate + ' 23:59:59').getTime()
|
let currentDate = new Date().getTime()
|
if (times < currentDate) {
|
item.isExpiry = true
|
}
|
}
|
}
|
if (item.content) {
|
item.content = JSON.parse(item.content)
|
}
|
if (item.state != 'Reject') {
|
list.push(item)
|
}
|
})
|
this.setData({
|
alreadyElectronicBookList: list,
|
});
|
})
|
},
|
|
|
|
/**
|
* 页面相关事件处理函数--监听用户下拉动作
|
*/
|
onPullDownRefresh() {
|
if (this._freshing) return
|
this.setData({
|
page: 1,
|
limit: 10,
|
pageTotalCount: 0,
|
bottomLoading: false,
|
isMoreData: false
|
})
|
this._freshing = true;
|
this.setData({
|
triggered: false,
|
})
|
this.getBookList(false);
|
this._freshing = false
|
},
|
|
/**
|
* 页面上拉触底事件的处理函数
|
*/
|
onReachBottom() {
|
this.setData({
|
bottomLoading: true,
|
isMoreData: false
|
})
|
let bool = false;
|
if (this.data.pageTotalCount > this.data.bookList.length) {
|
bool = true;
|
this.setData({
|
page: this.data.page + 1,
|
})
|
|
} else {
|
setTimeout(() => {
|
this.setData({
|
bottomLoading: false,
|
isMoreData: true
|
})
|
}, 100)
|
return false;
|
}
|
this.getBookList(bool);
|
},
|
//纸质样书
|
onChangePaper(e) {
|
const item = e.currentTarget.dataset.book;
|
let role = this.data.userInfo != null ? this.data.userInfo.role : null
|
if (role) {
|
if (item.paperDisabled) {
|
wx.showToast({
|
title: "该样书已申请",
|
icon: 'none',
|
duration: 1000,
|
})
|
return
|
}
|
|
if (item.paperChecked) {
|
if (this.data.paperBookList.length > 0) {
|
this.data.paperBookList.forEach((obj, index) => {
|
if (obj.id == item.id) {
|
this.data.paperBookList.splice(index, 1);
|
}
|
})
|
}
|
item.paperChecked = false;
|
if (this.data.bookList.length > 0) {
|
this.data.bookList.forEach(i => {
|
if (i.id == item.id) {
|
i.paperChecked = false;
|
}
|
})
|
}
|
wx.showToast({
|
title: "已从样书申请单移除",
|
icon: 'none',
|
duration: 1000,
|
})
|
wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList));
|
return
|
}
|
if (role == 'Teacher') {
|
this.getSelectPaperBookCount(item)
|
} else {
|
item.paperChecked = false
|
wx.showModal({
|
title: '尊敬的用户,您好!', //提示的标题
|
content: '请先进行教师认证?', //提示的内容
|
success: function (res) {
|
if (res.confirm) {
|
wx.navigateTo({
|
url: "/packageDomain/pages/teacherCertification/index",
|
});
|
} else if (res.cancel) {
|
item.paperChecked = false
|
}
|
}
|
})
|
}
|
} else {
|
item.paperChecked = false
|
}
|
},
|
getSelectPaperBookCount(item) {
|
app.MG.app
|
.getTicketResult({
|
ticketRefCodeOrGuid: 'paperSampleBookapplyNum',
|
roleId: this.data.userInfo.roleId
|
})
|
.then((res) => {
|
this.setData({
|
paperBookCount: res.totalCount - res.usedCount
|
})
|
if (!item.paperDisabled) {
|
this.getAlreadyBookList(item, 'pBook')
|
}
|
})
|
},
|
//选择电子样书
|
onChangeElectron(e) {
|
const item = e.currentTarget.dataset.book;
|
let role = this.data.userInfo != null ? this.data.userInfo.role : null;
|
if (role) {
|
if (item.electronDisabled) {
|
wx.showToast({
|
title: "该样书已申请",
|
icon: 'none',
|
duration: 1000,
|
})
|
return
|
}
|
if (item.electronChecked) {
|
if (this.data.electronicBookList) {
|
this.data.electronicBookList.forEach((obj, index) => {
|
if (obj.id == item.id) {
|
this.data.electronicBookList.splice(index, 1);
|
}
|
})
|
}
|
if (this.data.bookList.length > 0) {
|
this.data.bookList.forEach(i => {
|
if (i.id == item.id) {
|
i.electronChecked = false;
|
}
|
})
|
}
|
item.electronChecked = false;
|
wx.showToast({
|
title: "已从样书申请单移除",
|
icon: 'none',
|
duration: 1000,
|
})
|
wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList));
|
return
|
}
|
if (role == 'Teacher') {
|
//有无子商品,子商品有无电子书文件
|
const obj = {
|
path: '*',
|
queryType: 'SubProduct',
|
sort: {
|
type: 'Desc',
|
field: 'CreateDate'
|
},
|
paging: {
|
start: 0,
|
size: 6
|
},
|
mainProductId: item.id,
|
fields: {
|
bookshelf_pdf: [],
|
bookshelf_protectedEpub: [],
|
}
|
}
|
app.MG.store.getProductList(obj).then((res) => {
|
if (res.datas.length > 0) {
|
if (res.datas[0].bookshelf_pdf || res.datas[0].bookshelf_protectedEpub) {
|
this.getSelectBookCount(item)
|
} else {
|
wx.showToast({
|
title: "暂无电子书文件,请联系管理员!",
|
icon: 'none',
|
duration: 1000,
|
})
|
}
|
} else {
|
this.getSelectBookCount(item)
|
}
|
})
|
} else {
|
item.electronChecked = false
|
wx.showModal({
|
title: '尊敬的用户,您好!', //提示的标题
|
content: '请先进行教师认证?', //提示的内容
|
success: function (res) {
|
if (res.confirm) {
|
wx.navigateTo({
|
url: "/packageDomain/pages/teacherCertification/index",
|
});
|
} else if (res.cancel) {
|
item.electronChecked = false
|
}
|
}
|
})
|
}
|
}
|
},
|
getSelectBookCount(item) {
|
app.MG.app
|
.getTicketResult({
|
ticketRefCodeOrGuid: 'electronicSampleBookapplyNum',
|
roleId: this.data.userInfo.roleId
|
})
|
.then((res) => {
|
this.setData({
|
ebookCount: res.totalCount - res.usedCount
|
})
|
if (!item.electronDisabled) {
|
this.getAlreadyBookList(item, 'eBook')
|
}
|
})
|
},
|
|
getAlreadyBookList(item, type) {
|
let itemAttr = null
|
let isHas = false
|
itemAttr = {
|
id: item.id,
|
title: item.name || '-',
|
icon: item.icon,
|
checked: false,
|
defaultSaleMethodId: item.defaultSaleMethodId,
|
md5: item.datas.Icon,
|
author: item.author || '-',
|
price: item.price || '-',
|
isbn: item.isbn || '-',
|
publicationDate: item.publicationDate
|
}
|
|
if (type == 'eBook') {
|
if (this.data.ebookCount > 0) {
|
const eBookData = this.data.electronicBookList
|
if (eBookData.length == 2) {
|
item.electronChecked = false
|
wx.showToast({
|
title: "每次最多只可申请2本样书",
|
icon: 'none',
|
duration: 1000,
|
})
|
return false
|
}
|
if (eBookData.length > 0) {
|
for (let i = 0; i < eBookData.length; i++) {
|
if (eBookData[i].id == item.id) {
|
isHas = true
|
}
|
}
|
if (!isHas) {
|
wx.showToast({
|
title: "添加成功,在样书申请单等您哦~",
|
icon: "none",
|
duration: 1000,
|
})
|
this.setData({
|
electronicBookList: [...this.data.electronicBookList, ...[item]]
|
})
|
wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList));
|
} else {
|
item.electronChecked = false
|
wx.showToast({
|
title: "该书已在清单列表中",
|
icon: "none",
|
duration: 1000,
|
})
|
}
|
} else {
|
wx.showToast({
|
title: "添加成功,在样书申请单等您哦~",
|
icon: "none",
|
duration: 1000,
|
})
|
this.setData({
|
electronicBookList: [...this.data.electronicBookList, ...[item]]
|
})
|
wx.setStorageSync("electronicBookList", JSON.stringify(this.data.electronicBookList));
|
}
|
} else {
|
item.electronChecked = false
|
wx.showToast({
|
title: "您的电子样书申请次数已用尽,若要继续,请联系管理员!",
|
icon: "none",
|
duration: 1000,
|
})
|
}
|
} else {
|
if (this.data.paperBookCount > 0) {
|
const pBookData = this.data.paperBookList
|
if (pBookData.length == 2) {
|
item.paperChecked = false
|
wx.showToast({
|
title: "每次最多只可申请2本样书",
|
icon: 'none',
|
duration: 1000,
|
})
|
return false
|
}
|
if (pBookData.length > 0) {
|
for (let i = 0; i < pBookData.length; i++) {
|
if (pBookData[i].id == item.id) {
|
isHas = true
|
}
|
}
|
if (!isHas) {
|
item.paperChecked = true
|
wx.showToast({
|
title: "添加成功,在样书申请单等您哦~",
|
icon: 'none',
|
duration: 1000,
|
})
|
this.setData({
|
paperBookList: [...this.data.paperBookList, ...[item]]
|
})
|
wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList));
|
console.log(this.data.paperBookList, "3")
|
} else {
|
item.paperChecked = false
|
wx.showToast({
|
title: "该书已在清单列表中",
|
icon: 'none',
|
duration: 1000,
|
})
|
}
|
} else {
|
item.paperChecked = true;
|
wx.showToast({
|
title: "添加成功,在样书申请单等您哦~",
|
icon: 'none',
|
duration: 1000,
|
})
|
this.setData({
|
paperBookList: [item]
|
})
|
wx.setStorageSync("paperBookList", JSON.stringify(this.data.paperBookList));
|
console.log(this.data.paperBookList, "4")
|
}
|
} else {
|
item.paperChecked = false
|
wx.showToast({
|
title: "您的纸质样书申请次数已用尽,若要继续,请联系管理员!",
|
icon: 'none',
|
duration: 1000,
|
})
|
}
|
}
|
},
|
//去样书申请单
|
goApply() {
|
wx.navigateTo({
|
url: "/packageDomain/pages/sampleBookList/applicationForm/index",
|
});
|
},
|
/**
|
* 用户点击右上角分享
|
*/
|
onShareAppMessage() {
|
|
}
|
})
|