const Service = require('../../utils/service.js');
const Util = require('../../utils/util.js');
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		list: [],
		showview: false
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function (options) {},
	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow: function () {
		let that = this
		that.getDrugList();
	},
	getDrugList() {
		let that = this
		Service.getDrugList(wx.getStorageSync("data").unionid).then((res) => {
			that.setData({
				list: res.data,
				showview: true
			})
		})
	},
	/**
	 * 查看处方
	 */
	getRecipe:Util.debouce(function (e) {
		wx.navigateTo({
			url: '/packageA/recipeDetails/recipeDetails?id=' + e.currentTarget.dataset.id+'&type='+ e.currentTarget.dataset.type,
		})
	},1000,true),
})