| | |
| | | // pages/calculator/index.js |
| | | // import { imageUrl } from '../../utils/config' |
| | | // import { calculatorOption, calculatorSave, decodePhone, bindPhone } from '../../api/index' |
| | | import { getBjParamConfig, saveRenovationCalculator } from '../../api/index' |
| | | // import Ls from '../../utils/storage' |
| | | // let ls = new Ls |
| | | Page({ |
| | |
| | | containerContentStyle: 'hidden;' |
| | | }, |
| | | |
| | | onLoad: function (options) { |
| | | let that = this |
| | | this.getCalculatorOption() |
| | | const userInfo = wx.getStorageSync('member') |
| | | if (userInfo.phone) { |
| | | that.setData({ userPhone: userInfo.phone }) |
| | | } |
| | | }, |
| | | // 返回上一页 |
| | | navigateBack () { |
| | | wx.navigateBack({ |
| | |
| | | submit () { |
| | | // console.log('立即计算') |
| | | let { userPhone } = this.data |
| | | ls.get('userInfo').then(res => { |
| | | // console.log(res) |
| | | const res = wx.getStorageSync('member') |
| | | |
| | | if (userPhone) { |
| | | let { type, info, area, money, typeArray, infoArray, calculatorOptions: options } = this.data |
| | | let submitData = {} |
| | |
| | | this.setData({ calculatorOptions: options, showResultMoney: true, containerContentStyle: 'auto' }) |
| | | this.submitCalculatorResult(submitData) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 提交计算结果 |
| | | submitCalculatorResult (data) { |
| | | calculatorSave({ info: data }).then(res => { |
| | | saveRenovationCalculator({ info: data }).then(res => { |
| | | // console.log(res) |
| | | if (res.success) { |
| | | wx.showToast({ |
| | |
| | | |
| | | // 获取计算器配置 |
| | | getCalculatorOption () { |
| | | calculatorOption().then(res => { |
| | | getBjParamConfig().then(res => { |
| | | this.setData({ calculatorOptions: res.data }) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad: function (options) { |
| | | let that = this |
| | | // this.getCalculatorOption() |
| | | // ls.get('userInfo').then(res => { |
| | | // if (res.phone) { |
| | | // that.setData({ userPhone: res.phone }) |
| | | // } |
| | | // }) |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady: function () { |
| | | |
| | | }, |