/* * 手太欠 * 愿这世界都如故事里一样 美好而动人~ */ Page({ /** * 页面的初始数据 */ data: { service : '', username: '', //用户手机号 price : '', //打款金额 name : '', card_no : '', //打款凭证 showpath: '', path : '', disabled : false ,// 提交按钮状态 identityId: '' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ identityId: options.identity_id }) }, /** * 生命周期函数--监听页面显示 */ onShow() { wx.$api.user.userIndex().then(res => { this.setData({ username: res.data.username }) }).catch(err => {}) wx.$api.user.identitiesee(this.data.identityId).then(res => { this.setData({ service: res.data.identity.service, price : res.data.identity.price }) }).catch(err => {}) }, // 上传图片 openImg(){ wx.chooseMedia({ count : 1, success : path => { // 上传图片 wx.$api.file.uploadImg(path.tempFiles[0].tempFilePath, {}).then(res=>{ this.setData({ showpath: res.url, path : res.path }) }) } }) }, // 提交表单 issueForm(e) { let value = e.detail.value; let data = { name : value.name, price : value.price, cover : this.data.path } wx.$api.member.openIndex(this.data.identityId, data).then(res => { this.setData({ disabled: true }) wx.switchTab({ url: '/pages/user/index' }) }).catch(err => {}) } })