new Vue({
	el: "#app",
	data: {
		code: "xiaoxi",
		xiaoxis: [],
		recordinfo: '',
	},
	mounted: function() {
		var vm = this
		var oauthInfo = JSON.parse(sessionStorage.getItem("oauthInfo"));
		vm.toUserId = oauthInfo.id
		vm.appId = httpRequest.client_id
		vm.getxiaoxi(1)
	},
	methods: {
		getxiaoxi: function(pageNo) {
			var vm = this
			var filters = "typeId?7;appId?" + vm.appId + ";toUserId?" + vm.toUserId
			jiuzhenAPI.messageList({
				filters: filters,
				size: 10,
				page: pageNo,
				sorts: "",
				fields: ""
			}).then(function(res) {
				vm.xiaoxis = res.detailModelList.map(function(v) {
					if(v.contentJsons.length == 1) {
						v.islong = false //短内容
					} else {
						v.islong = true
						v.issatisfaction = false
						if(v.portalMessagerTemplateType == "100" && v.notifieFlag == "0") {
							v.issatisfaction = true //长内容
						}
					}
					return v
				})
				vm.initPage(pageNo, res.totalPage, res.totalCount)
			})
		},
		initPage: function(pageNo, total, size) {
			var vm = this
			//分页初始化
			$("#page").paging({
				pageNo: pageNo,
				totalPage: total,
				totalSize: size,
				callback: function(num) {
					//回调的页数
					vm.getxiaoxi(num)
				}
			})
		},
		getinfo: function(orderid) {
			var vm = this
			if(orderid == null || orderid == undefined || orderid == "") {
				toastr.warning("该订单无法查看!");
			} else {
				jiuzhenAPI.getRegOrderInfo(orderid).then(function(res) {
					vm.recordinfo = res.obj
					$('#appointmentinfo').modal('show')
				})
			}
		},
		satisfactionbtn: function(id) {
			mineJiuZhenDialogForm.satisfaction(id)
		},
	}
});