matronPrepon.js 2.7 KB
// pages/cityWide/matronPrepon/matronPrepon.js
const app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    page: 1,
    matronCon:[],
    priIndex: 0,
    ageIndex: 0,
    studyIndex: 0,
    orgIndex: 0,
    fourthid: '',
    conPrice: ['工种', '月嫂', '育儿嫂'],
    conAge: ['年龄', '35岁以下', '35~45岁', '45岁以上'],
    conStudy: ['经验', '初级', '中级', '高级', '金牌', '首席'],
    conOrgan: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getMatronlist()
  },

  // 获取优选月嫂列表
  getMatronlist: function(){
    let that = this;
    let url = "/api/portal/Maternity/index";
    let params = {
      first: that.data.priIndex,
      second: that.data.ageIndex,
      third: that.data.studyIndex,
      fourth: that.data.fourthid,
      page: that.data.page
    }
    app.post(url, params).then((res) => {
      that.setData({
        matronCon: res.list,
        conOrgan: res.score
      })
    }).catch((errMsg) => {})
  },
  //工种下拉
  priceTap: function (e) {
    let that = this;
    that.setData({
      priIndex: e.detail.value
    })
    that.getMatronlist()
  },
  //年龄下拉
  ageTap: function (e) {
    let that = this;
    that.setData({
      ageIndex: e.detail.value
    })
    that.getMatronlist()
  },
  //经验下拉
  studyTap: function (e) {
    let that = this;
    that.setData({
      studyIndex: e.detail.value
    })
    that.getMatronlist()
  },
  //机构下拉
  organTap: function (e) {
    let that = this;
    that.setData({
      orgIndex: e.detail.value,
      fourthid: that.data.conOrgan[e.detail.value].id
    })
    that.getMatronlist()
  },

  //跳转到 月嫂详情
  detailTap: function (e) {
    let maternityId = e.currentTarget.dataset.maternityid;
    wx.navigateTo({
      url: '../matronDetail/matronDetail?maternityId=' + maternityId,
    })
  },
  //跳转到 一键找月嫂
  findTap: function (e) {
    wx.navigateTo({
      url: '../keyFind/keyFind',
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})