Merge remote-tracking branch 'origin/master'
| | |
| | | data |
| | | }) |
| | | } |
| | | // ç»å®ææºå· |
| | | export const binDingPhone = (data) => { |
| | | return request({ |
| | | url: '/web/customer/binDingPhone', |
| | | method: "POST", |
| | | data |
| | | }) |
| | | } |
| | | // è·ååå
¸å¼ |
| | | export const getDictData = (data) => { |
| | | return request({ |
| | |
| | | } |
| | | .arrow_right{ |
| | | width: 16rpx; |
| | | } |
| | | |
| | | /* */ |
| | | .flex { |
| | | display: flex; |
| | | } |
| | | |
| | | .flex-c { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .flex-cc { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .flex-cb { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .flex-ca { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-around; |
| | | } |
| | | |
| | | .flex-1 { |
| | | flex: 1; |
| | | } |
| | | |
| | | .flex-column { |
| | | flex-direction: column; |
| | | } |
| | |
| | | import { |
| | | wxLoginCustomer, |
| | | getDictData, |
| | | getWxMiniPhone |
| | | getWxMiniPhone, |
| | | binDingPhone |
| | | } from '../../api/index' |
| | | Page({ |
| | | |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | loginIn() { |
| | | const { agreementFalg } = this.data |
| | | if(!agreementFalg) return wx.showToast({ |
| | | title: '请å
é
读并åæç¸å
³åè®®', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }) |
| | | }, |
| | | getPhoneNumber (e) { |
| | | console.log(e.detail) |
| | | console.log(e.detail.iv) |
| | |
| | | getWxMiniPhone({ |
| | | encryptedData: data.encryptedData, |
| | | iv: data.iv, |
| | | sessionKey: wx.getStorageSync('sessionKey'), |
| | | }) |
| | | }, |
| | | loginIn() { |
| | | const { agreementFalg } = this.data |
| | | if(!agreementFalg) return wx.showToast({ |
| | | title: '请å
é
读并åæç¸å
³åè®®', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }) |
| | | wx.login({ |
| | | success: (res) => { |
| | | if (res.code) { |
| | | // è·åå°ç¨æ·ç»å½åè¯ code |
| | | const code = res.code; |
| | | wx.setStorageSync('code', res.code) |
| | | // å° code åéç»å端æå¡å¨ |
| | | wxLoginCustomer({code}).then(ress => { |
| | | wx.setStorageSync('token', ress.data.token) |
| | | wx.setStorageSync('member', ress.data.member) |
| | | wx.redirectTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | sessionKey: wx.getStorageSync('sessionKey') || data.iv, |
| | | }).then(res => { |
| | | binDingPhone({ |
| | | phone: res.data |
| | | }).then((res) => { |
| | | if(res.code == 200){ |
| | | wx.setStorageSync('member', res.data) |
| | | wx.switchTab({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | } else { |
| | | console.error('è·åç¨æ·ç»å½åè¯å¤±è´¥', res.errMsg); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | console.error('è°ç¨ wx.login 失败', err); |
| | | }, |
| | | }) |
| | | }) |
| | | }, |
| | | onOpen(e){ |
| | |
| | | <text data-index="1" bindtap="onOpen" class="primary">ãZBOMç¨æ·éç§æ¿çã</text> |
| | | </view> |
| | | </view> |
| | | <button class="btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">ææºå·å¿«æ·ç»å½</button> |
| | | <button class="btn" wx:if="{{ !agreementFalg }}" bindtap="loginIn">ææºå·å¿«æ·ç»å½</button> |
| | | <button wx:else class="btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">ææºå·å¿«æ·ç»å½</button> |
| | | </view> |
| | | </view> |
| | | <!-- --> |
| | |
| | | // pages/calculator/index.js |
| | | // import { imageUrl } from '../../utils/config' |
| | | // import { calculatorOption, calculatorSave, decodePhone, bindPhone } from '../../api/index' |
| | | import { getBjParamConfig, saveRenovationCalculator } from '../../api/index' |
| | | import { getBjParamConfig, saveRenovationCalculator, getDictData, getWxMiniPhone, binDingPhone } from '../../api/index' |
| | | // import Ls from '../../utils/storage' |
| | | // let ls = new Ls |
| | | Page({ |
| | |
| | | * 页é¢çåå§æ°æ® |
| | | */ |
| | | data: { |
| | | // background: imageUrl + 'calculator/background.jpg', |
| | | background: '', |
| | | userPhone: '', |
| | | type: '', |
| | | info: '', |
| | |
| | | 'ä¸å®¤ä¸å
', '两室ä¸å
', '两室两å
', 'ä¸å®¤ä¸¤å
', |
| | | 'å室两å
', 'äºå®¤ä¸¤å
å以ä¸' |
| | | ], |
| | | calculatorOptions: [], |
| | | calculatorOptions: {}, |
| | | activeList: [], |
| | | showPopup: false, |
| | | activePicker: '', |
| | | pickerIndex: 0, |
| | |
| | | that.setData({ userPhone: userInfo.phone }) |
| | | } |
| | | }, |
| | | // è¿åä¸ä¸é¡µ |
| | | navigateBack () { |
| | | wx.navigateBack({ |
| | | delta: 1, |
| | |
| | | |
| | | // è·åç¨æ·ææºå· |
| | | getPhoneNumber (e) { |
| | | // console.log(e) |
| | | let that = this |
| | | decodePhone({ code: e.detail.code }) |
| | | .then(res => { |
| | | if (res.phone === undefined || res.phone.length === null || !res.phone) { |
| | | wx.showToast({ |
| | | title: res.msg, |
| | | icon: 'none' |
| | | }) |
| | | } else { |
| | | bindPhone({ phone: res.phone }) |
| | | .then(newInfo => { |
| | | ls.set('userInfo', newInfo.member) |
| | | that.setData({ userPhone: res.phone }) |
| | | that.submit() |
| | | }) |
| | | const data = { ...e.detail } |
| | | getWxMiniPhone({ |
| | | encryptedData: data.encryptedData, |
| | | iv: data.iv, |
| | | sessionKey: wx.getStorageSync('sessionKey') || data.iv, |
| | | }).then(res => { |
| | | binDingPhone({ |
| | | phone: res.data |
| | | }).then((res) => { |
| | | if(res.code == 200){ |
| | | wx.setStorageSync('member', res.data) |
| | | this.submit() |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | // ç«å³è®¡ç® |
| | |
| | | const res = wx.getStorageSync('member') |
| | | |
| | | if (userPhone) { |
| | | let { type, info, area, money, typeArray, infoArray, calculatorOptions: options } = this.data |
| | | let { type, info, area, money, typeArray, infoArray, calculatorOptions } = this.data |
| | | let submitData = {} |
| | | submitData.name = res.name |
| | | submitData.phone = res.phone |
| | |
| | | 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) |
| | | // submitData = ['æ¿å±ç±»åï¼' + typeArray[type], 'æ·åä¿¡æ¯ï¼' + infoArray[info], 'æ¿å±é¢ç§¯ï¼' + area + 'ã¡', 'è£
ä¿®é¢ç®ï¼' + money + 'ä¸å
'].join('-') |
| | | let activeList = type == '0' ? [...calculatorOptions.exquisiteList] : [...calculatorOptions.roughList] |
| | | activeList.forEach(item => { |
| | | item.money = (money * item.rate / 100).toFixed(1) |
| | | if(item.children && item.children.length > 0){ |
| | | item.children.forEach(child => { |
| | | child.money = (money * child.rate / 100).toFixed(2) |
| | | }) |
| | | } |
| | | } |
| | | this.setData({ calculatorOptions: options, showResultMoney: true, containerContentStyle: 'auto' }) |
| | | this.submitCalculatorResult(submitData) |
| | | }) |
| | | console.log('activeList', activeList); |
| | | saveRenovationCalculator({ |
| | | area, |
| | | budget: money, |
| | | houseStatus: type, |
| | | houseType: info |
| | | }).then(res => { |
| | | // console.log(res) |
| | | if (res.success) { |
| | | wx.showToast({ |
| | | title: 'è®¡ç®æå', |
| | | icon: 'none' |
| | | }) |
| | | } else { |
| | | console.log(res.msg) |
| | | } |
| | | }) |
| | | this.setData({ activeList, showResultMoney: true, containerContentStyle: 'auto' }) |
| | | } |
| | | }, |
| | | |
| | |
| | | getBjParamConfig().then(res => { |
| | | this.setData({ calculatorOptions: res.data }) |
| | | }) |
| | | getDictData({ |
| | | code: 'WEIXIN_DEFAULT_IMGS', |
| | | label: 'JISUAN_BG' |
| | | }).then(res => { |
| | | this.setData({ background: res.data.code }) |
| | | }) |
| | | }, |
| | | onReady: function () { |
| | | |
| | |
| | | <!--pages/calculator/index.wxml--> |
| | | <view class="container" style="background-image: {{ 'url(' + background + ')' }};"> |
| | | <view class="container"> |
| | | <image class="main_bg" src="{{ background }}" mode="widthFix"></image> |
| | | <view class="container-content" style="overflow-y: {{ containerContentStyle }};"> |
| | | <van-nav-bar border="{{ false }}" custom-class="top-head-transparent" bind:click-left="navigateBack" fixed placeholder> |
| | | <van-nav-bar title="è£
修计ç®å¨" border="{{ false }}" custom-class="top-head-transparent" bind:click-left="navigateBack" fixed placeholder> |
| | | <van-icon name="arrow-left" class="top-head-icon" slot="left" /> |
| | | </van-nav-bar> |
| | | |
| | |
| | | <view class="td rate">åèæ¯ä¾</view> |
| | | <view class="td money">åèä»·æ ¼</view> |
| | | </view> |
| | | <view class="item" wx:for="{{ calculatorOptions }}" wx:key="index" |
| | | <view class="item" wx:for="{{ activeList }}" wx:key="index" |
| | | hidden="{{ type == item.info }}"> |
| | | <view class="flex th"> |
| | | <view class="td name">{{ item.name }}</view> |
| | | <view class="td rate">å æ¯{{ item.rate }}%</view> |
| | | <view class="td money">å计{{ item.money }}(ä¸å
)</view> |
| | | </view> |
| | | <view class="flex tr" wx:for="{{ item.childList }}" wx:for-item="ite" wx:for-index="idx" wx:key="idx"> |
| | | <view class="flex tr" wx:for="{{ item.children }}" wx:for-item="ite" wx:for-index="idx" wx:key="idx"> |
| | | <view class="td name">{{ ite.name }}</view> |
| | | <view class="td rate">{{ ite.rate }}%</view> |
| | | <view class="td money">{{ ite.money }}</view> |
| | |
| | | /* pages/calculator/index.wxss */
|
| | | .container {
|
| | | color: #fff;
|
| | | background-position: center;
|
| | | background-repeat: no-repeat;
|
| | | background-size: cover;
|
| | | position: relative;
|
| | | overflow: hidden;
|
| | | overflow: auto;
|
| | | }
|
| | |
|
| | | .container::before {
|
| | | content: '';
|
| | | display: block;
|
| | | width: 100%;
|
| | | height: 100%;
|
| | | .main_bg{
|
| | | position: fixed;
|
| | | top: 0;
|
| | | left: 0;
|
| | | background-color: rgba(255,255,255,0.5);
|
| | | position: absolute;
|
| | | }
|
| | |
|
| | | .container-content {
|
| | | background-color: rgba(0,0,0,0.75);
|
| | | position: absolute;
|
| | | height: 100%;
|
| | | width: 100%;
|
| | | left: 0;
|
| | | right: 0;
|
| | | z-index: -1;
|
| | | }
|
| | |
|
| | | .top-head-transparent {
|
| | | background-color: transparent!important;
|
| | | color: #222222 !important;
|
| | | }
|
| | |
|
| | | .top-head-transparent .van-icon.van-icon-arrow-left {
|
| | | font-size: 40rpx!important;
|
| | | color: #fff!important;
|
| | | color: #222222 !important;
|
| | | }
|
| | |
|
| | | .calculator {
|
| | |
| | | .calculator .tips {
|
| | | font-size: 28rpx;
|
| | | margin-bottom: 70rpx;
|
| | | opacity: 0.8;
|
| | | font-weight: 300;
|
| | | color: #333333;
|
| | | }
|
| | |
|
| | | .calculator .form-item {
|
| | |
| | | .calculator .input-box {
|
| | | display: flex;
|
| | | flex: 1;
|
| | | border: 1px solid #fff;
|
| | | background-color: rgba(0,0,0,0.1);
|
| | | border: 1px solid #B08771;
|
| | | padding: 0 40rpx;
|
| | | border-radius: 8rpx;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | .calculator .input-box .placeholder {
|
| | | color: rgba(255,255,255,0.6);
|
| | | color: #999999;
|
| | | }
|
| | |
|
| | | .calculator .submit-btn {
|
| | | text-align: center;
|
| | | line-height: 100rpx;
|
| | | height: 100rpx;
|
| | | background: linear-gradient(180deg, #E0B49C 0%, #B68B74 100%);
|
| | | box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(176,135,113,0.3000), inset 0rpx 2rpx 2rpx 0rpx rgba(255,255,255,0.3300);
|
| | | border-radius: 8rpx;
|
| | | background: #B08771;
|
| | | border-radius: 8rpx;
|
| | | width: 100%;
|
| | | font-size: 32rpx;
|
| | | color: #fff;
|
| | |
| | | }
|
| | |
|
| | | .results {
|
| | | background-color: #f7f7f7;
|
| | | position: relative;
|
| | | z-index: 1;
|
| | | background: #FFFFFF;
|
| | | color: #222;
|
| | | text-align: center;
|
| | | margin: 0 30rpx 60rpx;
|
| | |
| | | import { getDictData } from '../../api/index' |
| | | import { getDictData, getMemberInfo } from '../../api/index' |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | topHeadStyle: 1, |
| | | showWhiteHead: true, |
| | | topHeadBorder: false, |
| | | member: {}, |
| | | |
| | | bannerList: [ |
| | | {imgurl: ''}, |
| | |
| | | }, |
| | | |
| | | toSearch() {}, |
| | | onShow() { |
| | | getMemberInfo().then(res => { |
| | | this.setData({member: res.data}) |
| | | }) |
| | | }, |
| | | onLoad(options) { |
| | | this.initData() |
| | | }, |
| | |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å次渲æå®æ |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢æ¾ç¤º |
| | | */ |
| | | onShow() { |
| | | |
| | | }, |
| | | |
| | |
| | | </view> |
| | | </view> |
| | | <!-- --> |
| | | <authCard type="1" /> |
| | | <authCard type="{{ member.authStatus }}" /> |
| | | <!-- 产åè§é¢ --> |
| | | <view class="product_video" bindtap="jumpProVideo"> |
| | | <view class="com_header"> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { request } from '../utils/request' |
| | | import { baseUrl } from '../utils/config' |
| | | |
| | | export const uploadUrl = baseUrl + '/public/upload' |
| | | // å°ç¨åºç»å½ |
| | | export const wxLoginCustomer = (data) => { |
| | | return request({ |
| | | url: '/web/customer/wxLoginCustomer', |
| | | data |
| | | }) |
| | | } |
| | | // è·åææºå· |
| | | export const getWxMiniPhone = (data) => { |
| | | return request({ |
| | | url: '/web/customer/getWxMiniPhone', |
| | | method: "POST", |
| | | data |
| | | }) |
| | | } |
| | | // ç»å®ææºå· |
| | | export const binDingPhone = (data) => { |
| | | return request({ |
| | | url: '/web/customer/binDingPhone', |
| | | method: "POST", |
| | | data |
| | | }) |
| | | } |
| | | // è·ååå
¸å¼ |
| | | export const getDictData = (data) => { |
| | | return request({ |
| | | url: '/public/getDictData', |
| | | data, |
| | | loading: '0' |
| | | }) |
| | | } |
| | | // è·åä¼åä¿¡æ¯ |
| | | export const getMemberInfo = () => { |
| | | return request({ |
| | | url: '/web/customer/getMemberInfo', |
| | | }) |
| | | } |
| | | // è·åé¨åºå表 |
| | | export const getShopPage = (data) => { |
| | | return request({ |
| | | url: '/web/customer/shopPage', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | // è·åé¨åºè¯¦æ
|
| | | export const getShopDetail = (data) => { |
| | | return request({ |
| | | url: '/web/customer/shopDetail', |
| | | data |
| | | }) |
| | | } |
| | | // æ´æ°ä¼åä¿¡æ¯ |
| | | export const editMember = (data) => { |
| | | return request({ |
| | | url: '/web/customer/editMember', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | // 0å
å®å¶ä¿¡æ¯ |
| | | export const saveFreeCustomizationApply = (data) => { |
| | | return request({ |
| | | url: '/web/customer/saveFreeCustomizationApply', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | // è·å计ç®å¨é
ç½® |
| | | export const getBjParamConfig = (data) => { |
| | | return request({ |
| | | url: '/web/customer/getBjParamConfig', |
| | | data |
| | | }) |
| | | } |
| | | // ä¿å计ç®å¨é
ç½® |
| | | export const saveRenovationCalculator = (data) => { |
| | | return request({ |
| | | url: '/web/customer/saveRenovationCalculator', |
| | | method: 'POST', |
| | | data |
| | | }) |
| | | } |
| | | // è·åçå¸åº |
| | | export const getArea = (data) => { |
| | | return request({ |
| | | url: '/web/common/getArea', |
| | | data |
| | | }) |
| | | } |
| | | // å°ç¨åºæ³¨é |
| | | export const wxLogOff = (data) => { |
| | | return request({ |
| | | url: '/web/customer/logOff', |
| | | data |
| | | }) |
| | | } |
| | |
| | | "list": [ |
| | | { |
| | | "name": "", |
| | | "pathName": "pages/store/index", |
| | | "pathName": "pages/index/index", |
| | | "query": "", |
| | | "launchMode": "default", |
| | | "scene": null |
| | |
| | | |
| | | |
| | | // export const baseUrl = 'https://jiaxuan.zbom.com/jx/wechat/' //æ£å¼æå¡å¨ |
| | | export const baseUrl = 'http://192.168.0.124:8080/zbom/jx/wechat/' // æ¬å° |
| | | export const baseUrl = 'http://192.168.0.135:10027' // æ¬å° |
| | | // export const baseUrl = 'http://zbtest.ahapp.net/zbom_interface/jx/wechat/' //æµè¯æå¡å¨ |
| | | |
| | | |
| | | // export const imageUrl = 'https://osswebcdn.zbom.com/jiaxuan/images/' |
| | | |
| | |
| | | import { baseUrl } from "./config" |
| | | |
| | | export function request(options){ |
| | | let loading = options.loading || '1' // é»è®¤å¼1æ¾ç¤ºï¼å¦å䏿¾ç¤º |
| | | if(loading == '1'){ |
| | | wx.showLoading() |
| | | } |
| | | return new Promise(resolve => { |
| | | wx.request({ |
| | | url: baseUrl + options.url, |
| | | data: options.options || {}, |
| | | data: options.data || {}, |
| | | method: options.method || "GET", |
| | | header: { |
| | | 'content-type': 'application/x-www-form-urlencoded', |
| | | 'content-type': 'application/json;charset=utf-8', |
| | | 'token': wx.getStorageSync('token') || '' |
| | | }, |
| | | timeout: 12000, |
| | | success: (res) => { |
| | | if (res.code === 0) { |
| | | // res.msg && toast(res.msg) |
| | | if (res.data.code === 200) { |
| | | resolve(res.data || true) |
| | | } else { |
| | | res.msg && toast(res.msg || 'åçé误', 'none') |
| | | resolve(res.data || false) |
| | | if(res.data.code && res.data.code == 5112){ |
| | | wx.navigateTo({ |
| | | url: '/pages/auth/auth', |
| | | }) |
| | | } |
| | | res.data.message && wx.showToast({ |
| | | title: res.data.message || 'åçé误', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | fail() { |
| | | wxToast('ç½ç»é误', 'none') |
| | | fail(err) { |
| | | console.log('err', err); |
| | | err.message && wx.showToast({ |
| | | title: err.message || 'åçé误', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | complete() { |
| | | if(loading == '1'){ |
| | | wx.hideLoading() |
| | | } |
| | | } |
| | | }) |
| | | } ) |