const config = require('../../config/config.js') const Http = require('../../utils/HttpBasics.js') const util = require('../../utils/util.js') const app = getApp(); Page({ /** * 页面的初始数据 */ data: { // organizationType:null, obj: {},//=> item.applymentState }, submit() { Http.post({ url: config.api.applyment, data: { id: this.data.obj.id } }).then(res => { let this_ = this wx.showToast({ title: '提交成功', icon: "none", }) setTimeout(() => { this_.getReceiverApply() }, 2000) }).catch(err => { wx.hideLoading(); wx.showToast({ title: err.message, icon: "none", }) }) }, cut() { let this_ = this; // wx.showModal({ title: '提示', content: '更改主体类型后,将清空部分已填写的资料,请确认是否更改?', success(res) { if (res.confirm) { console.log('用户点击确定') this_.setData({ obj: {} }) } else if (res.cancel) { console.log('用户点击取消') } } }) }, go(e) { let type = e.currentTarget.dataset.type let url = "" if (type == 1) { url = "/pages/warehouse/detail/subjectFirm/subjectFirm?id=" + this.data.obj.id + '&organizationType=' + this.data.obj.organizationType } else if (type == 2) { url = "/pages/warehouse/detail/manageFirm/manageFirm?id=" + this.data.obj.id + '&organizationType=' + this.data.obj.organizationType } else if (type == 3) { url = "/pages/warehouse/detail/industryFirm/industryFirm?id=" + this.data.obj.id + '&organizationType=' + this.data.obj.organizationType } else if (type == 4) { url = "/pages/warehouse/detail/clearingFirm/clearingFirm?id=" + this.data.obj.id + '&organizationType=' + this.data.obj.organizationType } else if (type == 5) { url = "/pages/warehouse/detail/adminFirm/adminFirm?id=" + this.data.obj.id + '&organizationType=' + this.data.obj.organizationType } wx.navigateTo({ url: url, }) }, goLook() { wx.navigateTo({ url: `/pages/warehouse/lookStatus/lookStatus?id=${this.data.obj.id}`, }) }, getReceiverApply() { wx.showLoading({ title: '加载中...', }) Http.get({ url: config.api.getReceiverApply, data: { merchantId: app.globalData.merchant.merchant_id } }).then(res => { if (res.data && res.data.organizationType) { console.log(res.data, '获取的用户数据'); this.setData({ obj: res.data }) } wx.hideLoading(); }).catch(err => { wx.hideLoading(); wx.showToast({ title: err.message, icon: "none", duration: 2000 }) }) }, setReceiver(e) { let type = e.currentTarget.dataset.type Http.post({ url: config.api.receiverAdd, data: { merchantId: app.globalData.merchant.merchant_id, organizationType: type } }).then(res => { this.getReceiverApply() }).catch(err => { wx.showToast({ title: err.message, icon: "none" }) }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { // console.log(options.organizationType, "options.organizationType") // this.setData({ // organizationType: options.organizationType // }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getReceiverApply() }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })