From 39613118a5bae23c45498c4f5a939e83595f99f5 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 16 七月 2024 16:05:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
wechat_jiaxuan/pages/calculator/index.js | 127 +++++++++++++++++++----------------------
1 files changed, 59 insertions(+), 68 deletions(-)
diff --git a/wechat_jiaxuan/pages/calculator/index.js b/wechat_jiaxuan/pages/calculator/index.js
index 560f42b..03cd517 100644
--- a/wechat_jiaxuan/pages/calculator/index.js
+++ b/wechat_jiaxuan/pages/calculator/index.js
@@ -1,6 +1,7 @@
// 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({
@@ -29,6 +30,14 @@
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({
@@ -71,7 +80,7 @@
let { activePicker, pickerIndex } = this.data
this.setData({ [activePicker]: pickerIndex, showPopup: false })
},
-
+
// 鑾峰彇鐢ㄦ埛鎵嬫満鍙�
getPhoneNumber (e) {
// console.log(e)
@@ -98,60 +107,59 @@
submit () {
// console.log('绔嬪嵆璁$畻')
let { userPhone } = this.data
- ls.get('userInfo').then(res => {
- // console.log(res)
- if (userPhone) {
- let { type, info, area, money, typeArray, infoArray, calculatorOptions: options } = this.data
- let submitData = {}
- submitData.name = res.name
- submitData.phone = res.phone
-
- if (type === '') {
- wx.showToast({
- title: '璇烽�夋嫨鎴垮眿绫诲瀷',
- icon: 'none'
- })
- return false
- }
- if (info === '') {
- wx.showToast({
- title: '璇烽�夋嫨鎴峰瀷淇℃伅',
- icon: 'none'
- })
- return false
- }
- if (area === '') {
- wx.showToast({
- title: '璇疯緭鍏ユ埧灞嬮潰绉�',
- icon: 'none'
- })
- return false
- }
- if (money === '') {
- wx.showToast({
- title: '璇疯緭鍏ヨ淇绠�',
- icon: 'none'
- })
- return false
- }
-
- submitData = ['鎴垮眿绫诲瀷锛�' + typeArray[type], '鎴峰瀷淇℃伅锛�' + infoArray[info], '鎴垮眿闈㈢Н锛�' + area + '銕�', '瑁呬慨棰勭畻锛�' + money + '涓囧厓'].join('-')
- for (let i in options) {
- options[i].money = (money * options[i].rate / 100).toFixed(2)
- let childList = options[i].childList
- for(let j in childList) {
- childList[j].money = (money * childList[j].rate / 100).toFixed(2)
- }
- }
- this.setData({ calculatorOptions: options, showResultMoney: true, containerContentStyle: 'auto' })
- this.submitCalculatorResult(submitData)
+ const res = wx.getStorageSync('member')
+
+ if (userPhone) {
+ let { type, info, area, money, typeArray, infoArray, calculatorOptions: options } = this.data
+ let submitData = {}
+ submitData.name = res.name
+ submitData.phone = res.phone
+
+ if (type === '') {
+ wx.showToast({
+ title: '璇烽�夋嫨鎴垮眿绫诲瀷',
+ icon: 'none'
+ })
+ return false
+ }
+ if (info === '') {
+ wx.showToast({
+ title: '璇烽�夋嫨鎴峰瀷淇℃伅',
+ icon: 'none'
+ })
+ return false
+ }
+ if (area === '') {
+ wx.showToast({
+ title: '璇疯緭鍏ユ埧灞嬮潰绉�',
+ icon: 'none'
+ })
+ return false
+ }
+ if (money === '') {
+ wx.showToast({
+ title: '璇疯緭鍏ヨ淇绠�',
+ icon: 'none'
+ })
+ return false
}
- })
+
+ submitData = ['鎴垮眿绫诲瀷锛�' + typeArray[type], '鎴峰瀷淇℃伅锛�' + infoArray[info], '鎴垮眿闈㈢Н锛�' + area + '銕�', '瑁呬慨棰勭畻锛�' + money + '涓囧厓'].join('-')
+ for (let i in options) {
+ options[i].money = (money * options[i].rate / 100).toFixed(2)
+ let childList = options[i].childList
+ for(let j in childList) {
+ childList[j].money = (money * childList[j].rate / 100).toFixed(2)
+ }
+ }
+ 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({
@@ -166,27 +174,10 @@
// 鑾峰彇璁$畻鍣ㄩ厤缃�
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 () {
},
--
Gitblit v1.9.3