Browse Source

提交代码

yh
杨豪 3 years ago
parent
commit
9d725d20b7
  1. 4
      api/http.js
  2. 14
      api/user.js
  3. 6
      app.js
  4. 53
      pages/user/bindCard/index.js
  5. 8
      pages/user/bindCard/index.wxml
  6. 53
      pages/user/cashOut/index.js
  7. 8
      pages/user/cashOut/index.wxml

4
api/http.js

@ -1,5 +1,5 @@
const baseURL= 'http://192.168.0.111:8088/api/'; // const baseURL= 'http://192.168.0.111:8088/api/';
// const baseURL= "https://www.cyjyyjy.com/api/" const baseURL= "https://www.cyjyyjy.com/api/"
export function $http(methods,url,params){ export function $http(methods,url,params){
var header = { var header = {
'content-type': 'application/json', 'content-type': 'application/json',

14
api/user.js

@ -1,8 +1,14 @@
const http = require('./http.js') const http = require('./http.js')
//绑定手机号 //绑定银行卡
export function bingPhone(){ export function bingCard(data){
return http.$http() return http.$http('post','userBank/saveBankInfo',data)
} }
//提现
export function cash(data){
return http.$http('post','extract/cash',data)
}
//获取用户信息 //获取用户信息
export function getUserInfo(){ export function getUserInfo(){
return http.$http('get','userinfo') return http.$http('get','userinfo')
@ -15,7 +21,7 @@ export function saleLeads(data){
// 获取我的团队 // 获取我的团队
export function getMyTeam(){ export function getMyTeam(){
return http.$http('post','user/myTeam') return http.$http('post','extract/cash')
} }
// 积分动态 // 积分动态

6
app.js

@ -44,6 +44,12 @@ App({
}) })
}) })
}, },
alertMessage(msg){
wx.showToast({
title: msg,
icon: 'none'
})
},
globalData: { globalData: {
http: http.$http, http: http.$http,
products: [] products: []

53
pages/user/bindCard/index.js

@ -1,11 +1,17 @@
// pages/user/bindCard/index.js // pages/user/bindCard/index.js
const app = getApp()
const user = require('../../../api/user.js')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
form: {
name: '',
card: '',
bank: ''
}
}, },
/** /**
@ -14,7 +20,50 @@ Page({
onLoad: function (options) { onLoad: function (options) {
}, },
inpChange(e){
let t= e.currentTarget.dataset.type
switch (t){
case 'name':
this.setData({
'form.name': e.detail.value
})
break
case 'card':
this.setData({
'form.card': e.detail.value
})
break
case 'bank':
this.setData({
'form.bank': e.detail.value
})
break
}
},
submit(){
console.log(this.data.form)
if(this.data.form.name == '' ){
return app.alertMessage('请输入持卡人姓名')
} else if(this.data.form.card == ''){
return app.alertMessage('请输入银行卡号')
} else if(this.data.form.bank == ''){
return app.alertMessage('请输入开户行')
}
user.bingCard({
bankName: this.data.form.bank,
cardNumber: this.data.form.card,
cardholderName: this.data.form.name
}).then((res)=>{
wx.showToast({
title: '绑定成功!',
})
setTimeout(()=>{
wx.navigateBack({
delta: 1,
})
},1500)
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

8
pages/user/bindCard/index.wxml

@ -3,16 +3,16 @@
<view class="form"> <view class="form">
<view class="form-item"> <view class="form-item">
<view class="label">持卡人</view> <view class="label">持卡人</view>
<input type="text" placeholder="请输入持卡人姓名" /> <input type="text" bindinput="inpChange" data-type="name" value="{{form.name}}" placeholder="请输入持卡人姓名" />
</view> </view>
<view class="form-item"> <view class="form-item">
<view class="label">银行卡号</view> <view class="label">银行卡号</view>
<input type="text" placeholder="请输入银行卡号" /> <input type="text" bindinput="inpChange" data-type="card" value="{{form.card}}" placeholder="请输入银行卡号" />
</view> </view>
<view class="form-item"> <view class="form-item">
<view class="label">开户行</view> <view class="label">开户行</view>
<input type="text" placeholder="请输入开户行" /> <input type="text" bindinput="inpChange" data-type="bank" value="{{form.bank}}" placeholder="请输入开户行" />
</view> </view>
</view> </view>
<view class="submit">确定</view> <view class="submit" bindtap="submit">确定</view>
</view> </view>

53
pages/user/cashOut/index.js

@ -1,23 +1,56 @@
// pages/user/cashOut/index.js // pages/user/cashOut/index.js
const app = getApp()
const user = require('../../../api/user.js')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
brokeragePrice: 0 userInfo: {},
cashNum: ''
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log(options)
},
allCash(){
this.setData({ this.setData({
brokeragePrice: options.brokeragePrice cashNum: this.data.brokeragePrice
}) })
}, },
cashChange(e){
this.setData({
cashNum: e.detail.value
})
},
cashClick(){
if(this.data.userInfo.userBank){
if(this.data.cashNum == '' || this.data.cashNum <= 100){
return app.alertMessage('请输入正确的积分')
}
user.cash({
extractType: 'bank',
money: this.data.cashNum
}).then((res)=>{
wx.showToast({
title: '申请提现成功',
})
setTimeout(()=>{
wx.navigateBack({
delta: 1,
})
},1500)
})
} else{
wx.navigateTo({
url: '/pages/user/bindCard/index',
})
}
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
@ -29,9 +62,15 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.getUserInfo()
},
getUserInfo(){
user.getUserInfo().then((res)=> {
this.setData({
userInfo: res.data.data
})
})
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */

8
pages/user/cashOut/index.wxml

@ -4,7 +4,7 @@
<image src="../../../images/profit.png" class="profit-bg"></image> <image src="../../../images/profit.png" class="profit-bg"></image>
<view class="profit-info"> <view class="profit-info">
<view>当前可提现积分<text class="s-word">(积分比例为1:1)</text></view> <view>当前可提现积分<text class="s-word">(积分比例为1:1)</text></view>
<view class="fz70">{{brokeragePrice || 0}}</view> <view class="fz70">{{userInfo.brokeragePrice || 0}}</view>
</view> </view>
</view> </view>
<view class="tips">注:提现需在每月20-26日进行,其他时间不可提现</view> <view class="tips">注:提现需在每月20-26日进行,其他时间不可提现</view>
@ -12,9 +12,9 @@
<view class="tit">提现金额</view> <view class="tit">提现金额</view>
<view class="inp-box acea-row row-between row-middle"> <view class="inp-box acea-row row-between row-middle">
<text class="fz50">¥</text> <text class="fz50">¥</text>
<input type="text" placeholder="最低提现100积分" /> <input type="text" bindinput="cashChange" value="{{cashNum}}" placeholder="最低提现100积分" />
<view class="colO">全部提现</view> <view class="colO" bindtap="allCash">全部提现</view>
</view> </view>
</view> </view>
<view class="submit-btn">提现</view> <view class="submit-btn" bindtap="cashClick">提现</view>
</view> </view>

Loading…
Cancel
Save