Files
sykl-mall/pages/member/open/open.js
2023-07-22 19:01:37 +08:00

93 lines
2.2 KiB
JavaScript

/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
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.home().then(res => {
this.setData({
username: res.data.username
})
}).catch(err => {})
wx.$api.member.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 => {
wx.showToast({
title: '提交成功',
icon: 'none',
duration: 2000
})
setTimeout(()=>{
wx.redirectTo({
url: '/pages/member/examine/examine'
})
},3000)
this.setData({
disabled: true
})
}).catch(err => {
})
}
})