|
@@ -211,72 +211,102 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
post(){
|
|
|
- var parm={
|
|
|
- stock_date: this.data.stock_date,
|
|
|
- today_stock:this.data.stock,
|
|
|
- is_markt: this.data.is_markt,
|
|
|
- today_stock_img: this.data.today_stock_img,
|
|
|
- today_fund: Number(this.data.today_fund),
|
|
|
- experience: this.data.experience
|
|
|
- }
|
|
|
- if (!parm.today_fund){
|
|
|
- wx.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: '请输入今日净资产'
|
|
|
+ $api.getAuthinfo().then(res => {
|
|
|
+ this.setData({
|
|
|
+ need_fill: res.data.data.need_fill,
|
|
|
})
|
|
|
- return
|
|
|
- }
|
|
|
- if (!parm.is_markt){
|
|
|
- // for (let i = 0; i < parm.today_stock.length;i++){
|
|
|
- // if (!parm.today_stock[i].name || !parm.today_stock[i].fund) {
|
|
|
- // wx.showToast({
|
|
|
- // icon: 'none',
|
|
|
- // title: '请选择股票并输入资金额'
|
|
|
- // })
|
|
|
- // return;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- }else{
|
|
|
- parm.today_stock = []
|
|
|
- }
|
|
|
- if (parm.today_stock_img.length<=0) {
|
|
|
+ if (!this.data.need_fill){
|
|
|
+ var parm = {
|
|
|
+ stock_date: this.data.stock_date,
|
|
|
+ today_stock: this.data.stock,
|
|
|
+ is_markt: this.data.is_markt,
|
|
|
+ today_stock_img: this.data.today_stock_img,
|
|
|
+ today_fund: Number(this.data.today_fund),
|
|
|
+ experience: this.data.experience
|
|
|
+ }
|
|
|
+ if (!parm.today_fund) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请输入今日净资产'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!parm.is_markt) {
|
|
|
+ // for (let i = 0; i < parm.today_stock.length;i++){
|
|
|
+ // if (!parm.today_stock[i].name || !parm.today_stock[i].fund) {
|
|
|
+ // wx.showToast({
|
|
|
+ // icon: 'none',
|
|
|
+ // title: '请选择股票并输入资金额'
|
|
|
+ // })
|
|
|
+ // return;
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ parm.today_stock = []
|
|
|
+ }
|
|
|
+ if (parm.today_stock_img.length <= 0) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请上传截图'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ wx.showLoading({
|
|
|
+ title: '正在提交',
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ disable: true
|
|
|
+ })
|
|
|
+ $api.updateRecord(parm).then(res => {
|
|
|
+ wx.hideLoading()
|
|
|
+ wx.showToast({
|
|
|
+ title: '提交成功',
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ freshen: true,
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ this.setData({
|
|
|
+ stock: [{ label: '', name: '', code: '', fund: '' }],
|
|
|
+ stockList: [],
|
|
|
+ today_stock_img: [],
|
|
|
+ value: [-1],
|
|
|
+ is_markt: 0,
|
|
|
+ today_fund: '',
|
|
|
+ disable: false
|
|
|
+ })
|
|
|
+ wx.switchTab({
|
|
|
+ url: '../index/index',
|
|
|
+ })
|
|
|
+ }, 200)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ fundchange(e) {
|
|
|
+ this.setData({
|
|
|
+ init_fund: e.detail.value
|
|
|
+ })
|
|
|
+ },
|
|
|
+ save() {
|
|
|
+ if (!this.data.init_fund) {
|
|
|
wx.showToast({
|
|
|
icon: 'none',
|
|
|
- title: '请上传截图'
|
|
|
+ title: '请输入初始资金',
|
|
|
})
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- wx.showLoading({
|
|
|
- title: '正在提交',
|
|
|
- })
|
|
|
- this.setData({
|
|
|
- disable:true
|
|
|
- })
|
|
|
- $api.updateRecord(parm).then(res=>{
|
|
|
- wx.hideLoading()
|
|
|
+ $api.initfund({ init_fund: this.data.init_fund }).then(res => {
|
|
|
wx.showToast({
|
|
|
title: '提交成功',
|
|
|
})
|
|
|
- this.setData({
|
|
|
- freshen: true,
|
|
|
- })
|
|
|
- setTimeout(() => {
|
|
|
- this.setData({
|
|
|
- stock: [{ label: '', name: '', code: '', fund: '' }],
|
|
|
- stockList: [],
|
|
|
- today_stock_img: [],
|
|
|
- value: [-1],
|
|
|
- is_markt: 0,
|
|
|
- today_fund: '',
|
|
|
- disable: false
|
|
|
- })
|
|
|
- wx.switchTab({
|
|
|
- url: '../index/index',
|
|
|
- })
|
|
|
- }, 200)
|
|
|
+ this.getUserData()
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|