170 lines
4.6 KiB
JavaScript
170 lines
4.6 KiB
JavaScript
import { API } from './../../../utils/network/api'
|
||
const api = new API()
|
||
const app = getApp()
|
||
Page({
|
||
data: {
|
||
navbarData: {
|
||
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
||
title: '服务通知', //导航栏 中间的标题
|
||
},
|
||
height: app.globalData.height,
|
||
visible: false,
|
||
list: [],
|
||
current_page: 0,
|
||
total: 0,
|
||
per_page: 0,
|
||
last_page: 0,
|
||
contactKeFu: false,
|
||
confirmBtn: {
|
||
"openType": "contact",
|
||
"content": "确认",
|
||
}
|
||
},
|
||
onShow(){
|
||
this.getList();
|
||
},
|
||
onHide(){
|
||
console.log("onHideonHide")
|
||
this.setData({
|
||
list: [],
|
||
current_page: 0,
|
||
total: 0,
|
||
per_page: 0,
|
||
last_page: 0,
|
||
})
|
||
},
|
||
getList(){
|
||
let current_page = this.data.current_page;
|
||
current_page = current_page + 1;
|
||
this.setData({
|
||
current_page: current_page
|
||
})
|
||
let list = this.data.list;
|
||
api.getDoctorMessageService({page: current_page}).then(response => {
|
||
console.log(response);
|
||
this.setData({
|
||
list: list.concat(response.data.data),
|
||
current_page: response.data.current_page,
|
||
total: response.data.total,
|
||
per_page: response.data.per_page,
|
||
last_page: response.data.last_page,
|
||
})
|
||
}).catch(errors => {console.error(errors);})
|
||
},
|
||
onReachBottom() {
|
||
console.log('===触底了!!===');
|
||
if(this.data.current_page < this.data.last_page){//最后一页时停止分页
|
||
this.getList()
|
||
}
|
||
},
|
||
putMessageReadNoticeAll(){
|
||
api.putMessageReadNoticeAll({notice_type: 1}).then(response => {
|
||
console.log(response);
|
||
let new_list = [];
|
||
this.data.list.forEach(item => {
|
||
item.read_status = 1;
|
||
new_list.push(item)
|
||
})
|
||
this.setData({
|
||
list: new_list
|
||
})
|
||
let usertype = wx.getStorageSync('usertype');
|
||
let userID = wx.getStorageSync('user_id_'+usertype);
|
||
wx.setStorageSync( userID+"_service_notice_unreadnnum", "");
|
||
wx.showToast({
|
||
title: '操作成功',
|
||
icon: "success"
|
||
})
|
||
}).catch(errors => {console.error(errors);})
|
||
},
|
||
putMessageReadNotice(notice_id){
|
||
api.putMessageReadNotice({notice_id: notice_id}).then(response => {
|
||
console.log(response);
|
||
|
||
}).catch(errors => {console.error(errors);})
|
||
},
|
||
go(e){
|
||
let item = e.currentTarget.dataset.item;
|
||
this.putMessageReadNotice(item.notice_id);
|
||
console.log(item);
|
||
let link_type = item.link_type;
|
||
link_type = Number(link_type);
|
||
// 跳转页面类型(1:聊天详情页 2:问诊结束列表页 3:问诊消息列表页 4:我的名片 5:我的简介 6:我的账户 7:我的福利 8:药品订单详情页 9:物流详情 10:问诊订单详情 11:联系客服 12:协议详情 13:处方详情)
|
||
switch (link_type) {
|
||
case 1:
|
||
let from_account = item.link_params.from_account;
|
||
let order_inquiry_id = item.link_params.order_inquiry_id;
|
||
let inquiry_type = item.link_params.inquiry_type;
|
||
let url = "/Pages/yishi/chat/index?from_account="+from_account+"&order_inquiry_id="+order_inquiry_id+"&inquiry_type="+inquiry_type;
|
||
app.go(url);
|
||
break;
|
||
case 2:
|
||
wx.showToast({
|
||
title: '暂无页面',
|
||
icon: 'error'
|
||
})
|
||
break;
|
||
case 3:
|
||
wx.switchTab({
|
||
url: "/Pages/yishi/wenzhen_v2/wenzhen",
|
||
})
|
||
break;
|
||
case 4:
|
||
app.go("/Pages/yishi/mycard/index")
|
||
break;
|
||
case 5:
|
||
app.go("/Pages/yishi/myprofile/index")
|
||
break;
|
||
case 6:
|
||
app.go("/Pages/yishi/myaccount/index")
|
||
break;
|
||
case 7:
|
||
wx.showToast({
|
||
title: '暂无页面',
|
||
icon: 'error'
|
||
})
|
||
break;
|
||
case 8:
|
||
wx.showToast({
|
||
title: '暂无页面',
|
||
icon: 'error'
|
||
})
|
||
break;
|
||
case 9:
|
||
wx.showToast({
|
||
title: '暂无页面',
|
||
icon: 'error'
|
||
})
|
||
break;
|
||
case 10:
|
||
wx.showToast({
|
||
title: '暂无页面',
|
||
icon: 'error'
|
||
})
|
||
break;
|
||
case 11:
|
||
this.setData({
|
||
contactKeFu: true
|
||
})
|
||
break;
|
||
case 12:
|
||
wx.showToast({
|
||
title: '暂无页面',
|
||
icon: 'error'
|
||
})
|
||
break;
|
||
case 13:
|
||
let url1 = "/Pages/yishi/onlinechufang/index?order_inquiry_id="+item.link_params.order_inquiry_id+"&order_prescription_id="+item.link_params.order_prescription_id+"&from=chat";
|
||
app.go(url1);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
},
|
||
cancelContactDialog(){
|
||
console.log("cancelContactDialogcancelContactDialogcancelContactDialog");
|
||
this.setData({
|
||
contactKeFu: false
|
||
})
|
||
},
|
||
}) |