|
@@ -34,12 +34,18 @@ Page({
|
|
|
this.setData({
|
|
|
disable: false
|
|
|
})
|
|
|
- $api.getAuthinfo().then(res=>{
|
|
|
- this.setData({
|
|
|
- role: res.data.data.role,
|
|
|
- need_fill: res.data.data.need_fill,
|
|
|
- })
|
|
|
+
|
|
|
+ $api.initUser()
|
|
|
+
|
|
|
+ wx.getStorage({
|
|
|
+ key: 'user',
|
|
|
+ complete: res => {
|
|
|
+ this.setData({
|
|
|
+ role: res.data.role,
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
+
|
|
|
$api.getCurrecord().then(res=>{
|
|
|
if (!res.data.data.id){return}
|
|
|
let stock = res.data.data.today_stock
|
|
@@ -286,144 +292,112 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
post(){
|
|
|
- if (!this.data.need_fill) {
|
|
|
- var stocks = []
|
|
|
- var slist = this.data.stock
|
|
|
+ var stocks = []
|
|
|
+ var slist = this.data.stock
|
|
|
|
|
|
- for(let i=0;i<slist.length;i++){
|
|
|
- if(slist[i].name.length <= 0){
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- if(slist[i].fund > 5000){
|
|
|
- wx.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: '持仓金额单位为万'
|
|
|
- })
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- stocks.push(slist[i])
|
|
|
+ for(let i=0;i<slist.length;i++){
|
|
|
+ if(slist[i].name.length <= 0){
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
- var parm = {
|
|
|
- stock_date: this.data.stock_date,
|
|
|
- today_stock: stocks,
|
|
|
- is_markt: this.data.is_markt,
|
|
|
- today_stock_img: this.data.today_stock_img,
|
|
|
- today_fund: Number(this.data.today_fund),
|
|
|
- id:this.data.id,
|
|
|
- experience: this.data.experience
|
|
|
- }
|
|
|
- if (!parm.today_fund) {
|
|
|
+ if(slist[i].fund > 5000){
|
|
|
wx.showToast({
|
|
|
icon: 'none',
|
|
|
- title: '请输入今日净资产'
|
|
|
+ title: '持仓金额单位为万'
|
|
|
})
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- if (parm.today_fund >= 10000) {
|
|
|
- wx.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: '今日净资产单位为万'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
+ stocks.push(slist[i])
|
|
|
+ }
|
|
|
|
|
|
- // 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 = []
|
|
|
- // }
|
|
|
-
|
|
|
- console.log(parm)
|
|
|
- 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,
|
|
|
- disable: false
|
|
|
- })
|
|
|
- setTimeout(() => {
|
|
|
- this.setData({
|
|
|
- stock: [{ label: '', name: '', code: '', fund: '' }],
|
|
|
- stockList: [],
|
|
|
- today_stock_img: [],
|
|
|
- value: [-1],
|
|
|
- is_markt: 0,
|
|
|
- today_fund: ''
|
|
|
-
|
|
|
- })
|
|
|
- wx.switchTab({
|
|
|
- url: '../user/user',
|
|
|
- })
|
|
|
- }, 200)
|
|
|
+ var parm = {
|
|
|
+ stock_date: this.data.stock_date,
|
|
|
+ today_stock: stocks,
|
|
|
+ is_markt: this.data.is_markt,
|
|
|
+ today_stock_img: this.data.today_stock_img,
|
|
|
+ today_fund: Number(this.data.today_fund),
|
|
|
+ id:this.data.id,
|
|
|
+ experience: this.data.experience
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!parm.today_fund) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请输入今日净资产'
|
|
|
})
|
|
|
- .catch(
|
|
|
- this.setData({
|
|
|
- disable:false
|
|
|
- })
|
|
|
- )
|
|
|
- }else{
|
|
|
- this.setData({
|
|
|
- show:1
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (parm.today_fund >= 10000) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '今日净资产单位为万'
|
|
|
})
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- },
|
|
|
- fundchange(e) {
|
|
|
- this.setData({
|
|
|
- init_fund: e.detail.value
|
|
|
- })
|
|
|
- },
|
|
|
- save() {
|
|
|
- if (!this.data.init_fund) {
|
|
|
+ // 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 = []
|
|
|
+ // }
|
|
|
+
|
|
|
+ console.log(parm)
|
|
|
+ if (parm.today_stock_img.length <= 0) {
|
|
|
wx.showToast({
|
|
|
icon: 'none',
|
|
|
- title: '请输入初始资金',
|
|
|
+ title: '请上传截图'
|
|
|
})
|
|
|
- return;
|
|
|
+ return
|
|
|
}
|
|
|
- $api.initfund({ init_fund: this.data.init_fund }).then(res => {
|
|
|
+ wx.showLoading({
|
|
|
+ title: '正在提交',
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ disable: true
|
|
|
+ })
|
|
|
+ $api.updateRecord(parm).then(res => {
|
|
|
+ wx.hideLoading()
|
|
|
wx.showToast({
|
|
|
title: '提交成功',
|
|
|
})
|
|
|
this.setData({
|
|
|
- show: 0,
|
|
|
- need_fill:0,
|
|
|
- init_fund:''
|
|
|
+ freshen: true,
|
|
|
+ disable: false
|
|
|
})
|
|
|
- // this.getUserData()
|
|
|
+ setTimeout(() => {
|
|
|
+ this.setData({
|
|
|
+ stock: [{ label: '', name: '', code: '', fund: '' }],
|
|
|
+ stockList: [],
|
|
|
+ today_stock_img: [],
|
|
|
+ value: [-1],
|
|
|
+ is_markt: 0,
|
|
|
+ today_fund: ''
|
|
|
+
|
|
|
+ })
|
|
|
+ wx.switchTab({
|
|
|
+ url: '../user/user',
|
|
|
+ })
|
|
|
+ }, 200)
|
|
|
})
|
|
|
-
|
|
|
+ .catch(
|
|
|
+ this.setData({
|
|
|
+ disable:false
|
|
|
+ })
|
|
|
+ )
|
|
|
},
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|