You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
171 lines
3.3 KiB
171 lines
3.3 KiB
|
4 years ago
|
// pages/group/apply/index.js
|
||
|
|
import commonApi from "../../../utils/https"
|
||
|
|
import util from "../../../utils/util"
|
||
|
|
Page({
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面的初始数据
|
||
|
|
*/
|
||
|
|
data: {
|
||
|
|
info:{
|
||
|
|
company:"",
|
||
|
|
tel:"",
|
||
|
|
name:""
|
||
|
|
},
|
||
|
|
step:0,
|
||
|
|
venue:null,
|
||
|
|
applyInfo:null
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面加载
|
||
|
|
*/
|
||
|
|
onLoad: function (options) {
|
||
|
|
this.setData({
|
||
|
|
id:options.id
|
||
|
|
})
|
||
|
|
commonApi._post("scene/detail_for_venue",{
|
||
|
|
id:this.data.id
|
||
|
|
}).then(res=>{
|
||
|
|
this.setData({
|
||
|
|
venue:res.data
|
||
|
|
})
|
||
|
|
// 判断状态
|
||
|
|
this.getStatus()
|
||
|
|
})
|
||
|
|
|
||
|
|
},
|
||
|
|
getStatus:function(){
|
||
|
|
commonApi.user_post("team_order/apply_post",{
|
||
|
|
supplier_id:this.data.venue.product_venue.supplier_id,
|
||
|
|
product_code:this.data.venue.product_venue.product_code,
|
||
|
|
},'get').then(res=>{
|
||
|
|
// state 0:审核中 1:审核通过 2:审核拒绝 3:撤销申请
|
||
|
|
if(res && res.data){
|
||
|
|
this.setData({
|
||
|
|
applyInfo:res.data
|
||
|
|
})
|
||
|
|
if(res.data.state==0){
|
||
|
|
this.setData({
|
||
|
|
step:1
|
||
|
|
})
|
||
|
|
}
|
||
|
|
else if(res.data.state==2){
|
||
|
|
this.setData({
|
||
|
|
step:2
|
||
|
|
})
|
||
|
|
}
|
||
|
|
else if(res.data.state==1){
|
||
|
|
wx.redirectTo({
|
||
|
|
url: '/pages/info/museumInfo/index?isGroup=1&id='+this.data.id,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
changeInfo:function(e){
|
||
|
|
let info = this.data.info
|
||
|
|
info[e.currentTarget.dataset.key] = e.detail.value
|
||
|
|
this.setData({
|
||
|
|
info:info
|
||
|
|
})
|
||
|
|
},
|
||
|
|
submit:function(e){
|
||
|
|
// this.setData({
|
||
|
|
// step:1
|
||
|
|
// })
|
||
|
|
let info = this.data.info
|
||
|
|
commonApi.user_post("team_order/apply_post",{
|
||
|
|
supplier_id:this.data.venue.product_venue.supplier_id,
|
||
|
|
product_code:this.data.venue.product_venue.product_code,
|
||
|
|
organization_name:info.company,
|
||
|
|
apply_user:info.name,
|
||
|
|
mobile:info.tel
|
||
|
|
}).then(res=>{
|
||
|
|
if(res && res.code==1){
|
||
|
|
this.getStatus()
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
// 再次申请
|
||
|
|
reGet(){
|
||
|
|
this.setData({
|
||
|
|
step:0,
|
||
|
|
info:{
|
||
|
|
company:"",
|
||
|
|
tel:"",
|
||
|
|
name:""
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
// 撤销申请
|
||
|
|
cancel:function(){
|
||
|
|
commonApi.user_post('team_order/undo_apply',{
|
||
|
|
supplier_id:this.data.venue.product_venue.supplier_id,
|
||
|
|
product_code:this.data.venue.product_venue.product_code,
|
||
|
|
}).then(res=>{
|
||
|
|
if(res.code==1){
|
||
|
|
wx.showToast({
|
||
|
|
title: '撤销成功',
|
||
|
|
icon:"success",
|
||
|
|
mask:true
|
||
|
|
})
|
||
|
|
setTimeout(()=>{
|
||
|
|
util.back()
|
||
|
|
},1000)
|
||
|
|
// this.getStatus()
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
|
*/
|
||
|
|
onReady: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面显示
|
||
|
|
*/
|
||
|
|
onShow: function () {
|
||
|
|
// 判断状态
|
||
|
|
if(this.data.id && this.data.venue){
|
||
|
|
this.getStatus()
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面隐藏
|
||
|
|
*/
|
||
|
|
onHide: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面卸载
|
||
|
|
*/
|
||
|
|
onUnload: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
|
*/
|
||
|
|
onPullDownRefresh: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面上拉触底事件的处理函数
|
||
|
|
*/
|
||
|
|
onReachBottom: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 用户点击右上角分享
|
||
|
|
*/
|
||
|
|
onShareAppMessage: function () {
|
||
|
|
|
||
|
|
}
|
||
|
|
})
|