const config = require('../../../../config/config.js') const Http = require('../../../../utils/HttpBasics.js') const util = require('../../../../utils/util.js') const app = getApp(); Page({ /** * 页面的初始数据 */ data: { id: "", organizationType: "", merchantShortname: "", servicePhone: "", }, save(e) { let flag = e.currentTarget.dataset.flag let errMeg = ""; let errFlag = false; if (!this.data.merchantShortname) { errMeg = "请输入店铺名称" errFlag = true } else if (!this.data.servicePhone) { errMeg = "请输入客服电话" errFlag = true } if (errFlag) { wx.showToast({ title: errMeg, icon: "none", duration: 2000 }) return } let parame = { id: this.data.id, organizationType: this.data.organizationType, merchantShortname: this.data.merchantShortname, servicePhone: this.data.servicePhone, }; Http.post({ url: config.api.receiverAdd, data: parame }).then(res => { console.log(res, "res") if (flag == "save") { wx.reLaunch({ url: '/pages/warehouse/warehouse', }) } else if (flag == "next") { wx.navigateTo({ url: '/pages/warehouse/detail/industryFirm/industryFirm', }) } }).catch(err => { wx.showToast({ title: err.message, icon: "none", duration: 2000 }) }) }, 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) { this.setData({ organizationType: res.data.organizationType }) } if (res.data && res.data.id) { this.setData({ id: res.data.id }) } if (res.data && res.data.merchantShortname) { this.setData({ merchantShortname: res.data.merchantShortname }) } if (res.data && res.data.servicePhone) { this.setData({ servicePhone: res.data.servicePhone }) } wx.hideLoading(); }).catch(err => { wx.hideLoading(); wx.showToast({ title: err.message, icon: "none", duration: 2000 }) }) }, setMerchantShortname(e) { let value = e.detail.value.trim() this.setData({ merchantShortname: value }) }, setServicePhone(e) { let value = e.detail.value.trim() this.setData({ servicePhone: value }) }, showImg1() { wx.previewImage({ current: 'https://formall.oss-accelerate.aliyuncs.com/789/malinkbapi/2022-08-24/0df5c9256e8d4e32b4b99ab866a885f6.png', // 当前显示图片的 http 链接 urls: ['https://formall.oss-accelerate.aliyuncs.com/789/malinkbapi/2022-08-24/0df5c9256e8d4e32b4b99ab866a885f6.png'] // 需要预览的图片 http 链接列表 }) }, showImg2() { wx.previewImage({ current: 'https://formall.oss-accelerate.aliyuncs.com/789/malinkadmin/2022-08-17/7d01489194be41bcad54f63e3188e815.png', // 当前显示图片的 http 链接 urls: ['https://formall.oss-accelerate.aliyuncs.com/789/malinkadmin/2022-08-17/7d01489194be41bcad54f63e3188e815.png'] // 需要预览的图片 http 链接列表 }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getReceiverApply() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })