tanyanfei 4 rokov pred
rodič
commit
b585ca2733

+ 6 - 3
app.json

@@ -1,11 +1,14 @@
 {
   "pages": [
-    "pages/hotel/hotel",
     "pages/order/order",
-    "pages/order/hotel",
-   
     "pages/mine/mine",
     "pages/eventDetail/eventDetail",
+    "pages/hotel/hotel",
+    
+    "pages/order/hotel",
+   
+   
+    
     "pages/learning/learning",
     "pages/conference/conference",  
     

+ 101 - 10
pages/eventDetail/eventDetail.js

@@ -15,10 +15,13 @@ Page({
     sex: -1,
     job_array: ['非中科院单位','中科院单位'],
     job: 0,
-    show: 1,
+    show: 0,
     list:[],
     index:[0,0,0],
-    page:0
+    page:1,
+    proof_img:'',
+    user_id:'',   //用户id
+    apply_id:''   //报名ID
   },
 
   /**
@@ -29,6 +32,16 @@ Page({
     var that = this;
     wx.showNavigationBarLoading()
     var that = this;
+    wx.getStorage({
+      key: 'uid',
+      success: res => {
+        if (res.data) {
+          this.setData({
+            user_id: res.data
+          })
+        }
+      },
+    })
     wx.request({
       url: host + '/api/detail',
       method: 'GET',
@@ -67,6 +80,28 @@ Page({
       },
     })
   },
+  upload:function(){
+    wx.chooseImage({
+      count:0,
+      success: res=>{
+          wx.showLoading({
+            title: '正在上传',
+          })
+          wx.uploadFile({
+            url: host + '/api/uploadfile',
+            filePath: res.tempFilePaths[0],
+            name: 'file',
+            success:response=>{
+              wx.hideLoading();
+              let data = JSON.parse(response.data);
+              this.setData({
+                proof_img:data.data
+              })
+            }
+          })
+      },
+    })
+  },
   bindMultiPickerColumnChange:function(e){
     console.log('修改的列为', e.detail.column, ',值为', e.detail.value);
     var list = this.data.list, i = e.detail.value, j = e.detail.column;
@@ -88,10 +123,25 @@ Page({
       index: index
     })
   },
+  bindSexChange:function(e){
+    this.setData({
+      sex: e.detail.value
+    })
+  },
   bindPickerChange:function(e){
     this.setData({
       job: e.detail.value
     })
+  }, 
+  skip:function(){
+    this.setData({
+      page: this.data.page+2
+    })
+  },
+  sure: function () {
+    this.setData({
+      page: this.data.page + 1
+    })
   },
   close:function(){
     this.setData({
@@ -103,27 +153,68 @@ Page({
       show: 1
     })
   },
+  //提交报名信息
   submit: function (e) {
-    console.log(e.detail.value)
     var form = e.detail.value;
     var list = this.data.list, index=this.data.index;
     form.organizer_unit = list[0][index[0]].value+list[1][index[1]].value+list[2][index[2]].value
+    form.uid=this.data.user_id;
+    form.conference_id=this.data.info.id;
+    form.conference_name = this.data.info.name;
+    wx.showLoading({
+      title: '正在提交',
+    })
     wx.request({
       url: host + '/api/user/signup',
       method:'POST',
-      data: e.detail.value,
+      data: form,
       success:(res=>{
-        console.log(res)
         if(res.data.code == 0){
-            wx.showToast({
-              title: '提交成功',
+          wx.hideLoading()
+            this.setData({
+              page: 2,
+              apply_id:res.data.data
             })
+        }else{
+          wx.showToast({
+            title: '提交失败',
+            icon:'none'
+          })
         }
       })
     })
-    // this.setData({
-    //   show: 0
-    // })
+   
+  },
+  //提交凭证
+  submit1:function(e){
+    var form = e.detail.value;
+    form.id=this.data.apply_id;
+    form.proof_img = this.data.proof_img;
+    wx.showLoading({
+      title: '正在提交',
+    })
+    wx.request({
+      url: host + '/api/user/signup',
+      method: 'PUT',
+      data: e.detail.value,
+      success: (res => {
+        wx.hideLoading();
+        if (res.data.code == 0) {
+          wx.showToast({
+            title: '提交成功',
+          })
+          this.skip();
+        }
+      }),
+      fail:error=>{
+        wx.hideLoading()
+      }
+    })
+  },
+  home:function(){
+      wx.switchTab({
+        url: '../mine/mine',
+      })
   },
   zk1: function () {
     this.setData({

+ 26 - 22
pages/eventDetail/eventDetail.wxml

@@ -37,9 +37,9 @@
         </view>
         <view class="item">
             <label>性别:</label>
-             <picker name='sex' bindchange="bindPickerChange" value="{{sex}}" range="{{sex_array}}">
+             <picker name='sex' bindchange="bindSexChange" value="{{sex}}" range="{{sex_array}}">
               <view class="picker">
-                <text wx:if='sex<0'>请选择</text>
+                <text wx:if='{{sex<0}}'>请选择</text>
                 {{sex_array[sex]}}
               </view>
             </picker>
@@ -95,51 +95,55 @@
 
                 <text>(2)支票(仅限北京参会代表)。</text>
           </view>
-          <button   class="post">下一步</button>
+          <button  bindtap="sure" class="post">下一步</button>
     </view>
 
-    <view class="form form2" wx:if='{{page==3}}'>
+    <form class="form form2" wx:if='{{page==3}}'  bindsubmit='submit1'>
       <view class="form_tt">上传入住凭证</view>
-      <view class="upload">
-          <image  mode="widthFix" src="../images/up.png"></image>
-          (上传银行汇款凭证或其他财务转账证明)
+      <view class="upload" bindtap="upload">
+          <block wx:if='{{!proof_img}}'>
+            <image  mode="widthFix" src="../images/up.png"></image>
+            (上传银行汇款凭证或其他财务转账证明)
+          </block>
+          <image class="proof_img" wx:else mode="widthFix" src="{{proof_img}}"></image>
       </view>
         <view class="item">
             <label style="width:105rpx;">支付方式</label>
-            <radio-group>
-                <radio value="">汇款:</radio><radio style="margin-left:10px;" value="">支票</radio>
+            <radio-group name='paytype'>
+                <radio value="1">汇款:</radio>
+                <radio style="margin-left:10px;" value="2">支票</radio>
             </radio-group>
         </view>
         <view class="item">
             <label style="width:105rpx;">发票种类:</label>
-            <radio-group>
-                <radio value="">增值税普通发票</radio>
-                <radio  style="margin-left:8px;"  value="">增值税专用发票</radio>
+            <radio-group name='billtype'>
+                <radio value="1">增值税普通发票</radio>
+                <radio  style="margin-left:8px;"  value="2">增值税专用发票</radio>
             </radio-group>
         </view>
         <view class="item">
-            <label>发票抬头:</label><input name='job'></input>
+            <label>发票抬头:</label><input name='billhead'></input>
         </view>
         <view class="item">
-            <label>纳税人识别号:</label><input name='job'></input>
+            <label>纳税人识别号:</label><input name='billno'></input>
         </view>
         <view class="item">
-            <label>注册地址(专票必填):</label><input name='job'></input>
+            <label>注册地址(专票必填):</label><input name='billaddress'></input>
         </view>
         <view class="item">
-            <label>注册电话(专票必填):</label><input name='job'></input>
+            <label>注册电话(专票必填):</label><input name='billphone'></input>
         </view>
         <view class="item">
-            <label>开户行(专票必填):</label><input name='job'></input>
+            <label>开户行(专票必填):</label><input name='billbank'></input>
         </view>
         <view class="item">
-            <label>银行帐号(专票必填):</label><input name='job'></input>
+            <label>银行帐号(专票必填):</label><input name='billbankno'></input>
         </view>
         <view class="btns">
           <button  formType="submit">提交信息</button>
-          <button class="success">跳过</button>
+          <button bindtap="skip" class="success">跳过</button>
         </view>
-    </view>
+    </form>
 
     <view  class="form form1" style="height:600rpx;" wx:if='{{page==4}}'>
         <view class="form_tt">提示</view>
@@ -148,14 +152,14 @@
             <text>待文献情报中心财务部门确认收到会议费后,系统将发送授权码至报名手机。</text>
             <text>请您凭授权码登录报名系统预订酒店住房。</text>
         </view>
-        <button   class="post">关闭</button>
+        <button bindtap="sure"  class="post">关闭</button>
     </view>
 
     <view wx:if='{{page==5}}' class="bg end" style="background:#F1F1F1;">
         <icon type="success" size='72'></icon>
         <view>恭喜您报名成功</view>
         <view class="form_info">请您准时参加会议,到达会议地点届时将会有我方工作人员安排您的入住</view>
-        <button class="post">确认</button>
+        <button bindtap="home" class="post">确认</button>
     </view>
 </view>  
 

+ 4 - 0
pages/eventDetail/eventDetail.wxss

@@ -177,6 +177,10 @@ page{
   width: 100rpx;
   margin:0 auto 30rpx;
 }
+.upload .proof_img{
+  width: 100%;
+  margin: 0;
+}
 .form2 .item label{
   width: 40%;
   font-size: 24rpx;

+ 1 - 1
pages/mine/mine.wxml

@@ -11,7 +11,7 @@
     <button bindgetuserinfo="onGotUserInfo" open-type="getUserInfo">登录</button>
 </view>
 <view class="list">
-  <navigator class="list-item">
+  <navigator  url="../order/order"  class="list-item">
     <text>我的报名</text>
     <image src="../images/right.png"></image>
   </navigator>

+ 23 - 1
pages/order/hotel.js

@@ -1,4 +1,6 @@
 // pages/order/order.js
+const app = getApp()
+var host = app.globalData.host;
 Page({
 
   /**
@@ -12,7 +14,27 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    wx.showNavigationBarLoading()
+    wx.request({
+      url: host + '/api/signup/hotel/list',
+      method: 'GET',
+      data: {
+        id: options.id
+      },
+      success: res => {
+        wx.hideNavigationBarLoading();
+        this.setData({
+          list: res.data.data.list
+        })
+      },
+      fail: function () {
+        wx.hideLoading();
+        wx.showToast({
+          title: '服务器开小差啦!',
+          icon: 'none'
+        })
+      }
+    })
   },
   tab: function (e) {
     this.setData({

+ 4 - 4
pages/order/hotel.wxml

@@ -1,10 +1,10 @@
 <view class="content">
-    <navigator class="list">
+    <navigator class="list" wx:for='{{list}}'>
         <image src="../images/qk1.jpeg"></image>
         <view>
-            <view class="title">迎园饭店</view>
-            <text>地址:上海市嘉定区清河路115号</text>
-            <text>联系电话:021-59521346</text>
+            <view class="title">{{item.name}}</view>
+            <text>地址:{{item.address}}</text>
+            <text>联系电话:{{item.telephone}}</text>
         </view>
     </navigator>
 </view>

+ 43 - 3
pages/order/order.js

@@ -1,24 +1,64 @@
 // pages/order/order.js
+const app = getApp()
+var host = app.globalData.host;
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-      act:0,
-      code:0
+      act:1,
+      code:0,
+      uid:'',
+      list:[]
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    
+    wx.getStorage({
+      key: 'uid',
+      success: res => {
+        if (res.data) {
+          this.setData({
+            uid: res.data
+          })  
+          this.getData();
+        }
+      },
+    })
+  },
+  getData:function(){
+    wx.showNavigationBarLoading()
+    wx.request({
+      url: host + '/api/user/signup/list',
+      method: 'GET',
+      data: {
+        type: this.data.act,
+        uid: this.data.uid
+      },
+      success: res=> {
+        wx.hideNavigationBarLoading();
+        this.setData({
+          list: res.data.data.list
+        })
+      },
+      fail: function () {
+        wx.hideLoading();
+        wx.showToast({
+          title: '服务器开小差啦!',
+          icon: 'none'
+        })
+      }
+    })
   },
   tab:function(e){
       this.setData({
         act:e.target.dataset.id
       })
+      this.getData();
   },
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 7 - 7
pages/order/order.wxml

@@ -1,16 +1,16 @@
 <view class="tab">
-    <text bindtap="tab" data-id='0'  class="{{act==0?'act':''}}">未开始</text>
-    <text bindtap="tab" data-id='1' class="{{act==1?'act':''}}">已结束</text>
+    <text bindtap="tab" data-id='1'  class="{{act==1?'act':''}}">未开始</text>
+    <text bindtap="tab" data-id='2' class="{{act==2?'act':''}}">已结束</text>
 </view>
 <view class="content">
-    <navigator class="list">
+    <view class="list" wx:for='{{list}}'>
         <image src="../images/qk1.jpeg"></image>
         <view>
-            <view class="title">企业家点赞中科院创新成果展...</view>
-            <text>报名时间:2020-12-30 10:10:10</text>
-            <navigator class="btn">选酒店</navigator>
+            <view class="title">{{item.conference_name}}</view>
+            <text>报名时间:{{item.ctime}}</text>
+            <navigator wx:if='{{!item.hotel_id}}' url="../order/hotel?id={{item.conference_id}}"  class="btn">选酒店</navigator>
         </view>
-    </navigator>
+    </view>
 </view>
 
 <view class="bg" wx:if='{{code}}'>