From 0d3fc39d118fe82335b4a02624b17d60db53d2ef Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 16 七月 2024 17:38:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
wechat_jiaxuan/pages/auth/auth.js | 51 ++----
wechat_staff/utils/config.js | 3
wechat_staff/utils/request.js | 36 ++++-
wechat_jiaxuan/api/index.js | 8 +
wechat_jiaxuan/app.wxss | 36 +++++
wechat_staff/project.private.config.json | 2
wechat_jiaxuan/pages/calculator/index.wxss | 47 ++----
wechat_jiaxuan/pages/calculator/index.wxml | 9
wechat_jiaxuan/pages/auth/auth.wxml | 3
wechat_jiaxuan/pages/index/index.wxml | 2
wechat_jiaxuan/static/icon/logo.png | 0
wechat_staff/api/index.js | 102 ++++++++++++++
wechat_jiaxuan/pages/calculator/index.js | 81 +++++++----
wechat_jiaxuan/pages/index/index.js | 15 +-
14 files changed, 277 insertions(+), 118 deletions(-)
diff --git a/wechat_jiaxuan/api/index.js b/wechat_jiaxuan/api/index.js
index 1b0e672..982312f 100644
--- a/wechat_jiaxuan/api/index.js
+++ b/wechat_jiaxuan/api/index.js
@@ -17,6 +17,14 @@
data
})
}
+// 缁戝畾鎵嬫満鍙�
+export const binDingPhone = (data) => {
+ return request({
+ url: '/web/customer/binDingPhone',
+ method: "POST",
+ data
+ })
+}
// 鑾峰彇瀛楀吀鍊�
export const getDictData = (data) => {
return request({
diff --git a/wechat_jiaxuan/app.wxss b/wechat_jiaxuan/app.wxss
index 986db10..1325fd3 100644
--- a/wechat_jiaxuan/app.wxss
+++ b/wechat_jiaxuan/app.wxss
@@ -29,4 +29,40 @@
}
.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;
}
\ No newline at end of file
diff --git a/wechat_jiaxuan/pages/auth/auth.js b/wechat_jiaxuan/pages/auth/auth.js
index 7557404..15defe7 100644
--- a/wechat_jiaxuan/pages/auth/auth.js
+++ b/wechat_jiaxuan/pages/auth/auth.js
@@ -1,7 +1,7 @@
import {
- wxLoginCustomer,
getDictData,
- getWxMiniPhone
+ getWxMiniPhone,
+ binDingPhone
} from '../../api/index'
Page({
@@ -36,6 +36,14 @@
})
})
},
+ 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)
@@ -44,37 +52,18 @@
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){
diff --git a/wechat_jiaxuan/pages/auth/auth.wxml b/wechat_jiaxuan/pages/auth/auth.wxml
index dc6a84a..4ae6b5d 100644
--- a/wechat_jiaxuan/pages/auth/auth.wxml
+++ b/wechat_jiaxuan/pages/auth/auth.wxml
@@ -16,7 +16,8 @@
<text data-index="1" bindtap="onOpen" class="primary">銆奪BOM鐢ㄦ埛闅愮鏀跨瓥銆�</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>
<!-- -->
diff --git a/wechat_jiaxuan/pages/calculator/index.js b/wechat_jiaxuan/pages/calculator/index.js
index 03cd517..e8ef0df 100644
--- a/wechat_jiaxuan/pages/calculator/index.js
+++ b/wechat_jiaxuan/pages/calculator/index.js
@@ -1,7 +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 { getBjParamConfig, saveRenovationCalculator, getDictData, getWxMiniPhone, binDingPhone } from '../../api/index'
// import Ls from '../../utils/storage'
// let ls = new Ls
Page({
@@ -10,7 +10,7 @@
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
- // background: imageUrl + 'calculator/background.jpg',
+ background: '',
userPhone: '',
type: '',
info: '',
@@ -21,7 +21,8 @@
'涓�瀹や竴鍘�', '涓ゅ涓�鍘�', '涓ゅ涓ゅ巺', '涓夊涓ゅ巺',
'鍥涘涓ゅ巺', '浜斿涓ゅ巺鍙婁互涓�'
],
- calculatorOptions: [],
+ calculatorOptions: {},
+ activeList: [],
showPopup: false,
activePicker: '',
pickerIndex: 0,
@@ -38,7 +39,6 @@
that.setData({ userPhone: userInfo.phone })
}
},
- // 杩斿洖涓婁竴椤�
navigateBack () {
wx.navigateBack({
delta: 1,
@@ -83,24 +83,21 @@
// 鑾峰彇鐢ㄦ埛鎵嬫満鍙�
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()
}
})
+ })
},
// 绔嬪嵆璁$畻
@@ -110,7 +107,7 @@
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
@@ -144,16 +141,34 @@
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' })
}
},
@@ -177,6 +192,12 @@
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 () {
diff --git a/wechat_jiaxuan/pages/calculator/index.wxml b/wechat_jiaxuan/pages/calculator/index.wxml
index 88ace3a..3faaa93 100644
--- a/wechat_jiaxuan/pages/calculator/index.wxml
+++ b/wechat_jiaxuan/pages/calculator/index.wxml
@@ -1,7 +1,8 @@
<!--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>
@@ -70,14 +71,14 @@
<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>
diff --git a/wechat_jiaxuan/pages/calculator/index.wxss b/wechat_jiaxuan/pages/calculator/index.wxss
index 85e9ded..f2353f5 100644
--- a/wechat_jiaxuan/pages/calculator/index.wxss
+++ b/wechat_jiaxuan/pages/calculator/index.wxss
@@ -1,40 +1,22 @@
/* 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 {
@@ -49,7 +31,8 @@
.calculator .tips {
font-size: 28rpx;
margin-bottom: 70rpx;
- opacity: 0.8;
+ font-weight: 300;
+ color: #333333;
}
.calculator .form-item {
@@ -62,8 +45,7 @@
.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;
}
@@ -76,16 +58,15 @@
}
.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;
@@ -109,7 +90,9 @@
}
.results {
- background-color: #f7f7f7;
+ position: relative;
+ z-index: 1;
+ background: #FFFFFF;
color: #222;
text-align: center;
margin: 0 30rpx 60rpx;
diff --git a/wechat_jiaxuan/pages/index/index.js b/wechat_jiaxuan/pages/index/index.js
index 394b4e4..ea13e96 100644
--- a/wechat_jiaxuan/pages/index/index.js
+++ b/wechat_jiaxuan/pages/index/index.js
@@ -1,4 +1,4 @@
-import { getDictData } from '../../api/index'
+import { getDictData, getMemberInfo } from '../../api/index'
Page({
/**
@@ -9,6 +9,7 @@
topHeadStyle: 1,
showWhiteHead: true,
topHeadBorder: false,
+ member: {},
bannerList: [
{imgurl: ''},
@@ -31,6 +32,11 @@
},
toSearch() {},
+ onShow() {
+ getMemberInfo().then(res => {
+ this.setData({member: res.data})
+ })
+ },
onLoad(options) {
this.initData()
},
@@ -118,13 +124,6 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
*/
onReady() {
-
- },
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
- */
- onShow() {
},
diff --git a/wechat_jiaxuan/pages/index/index.wxml b/wechat_jiaxuan/pages/index/index.wxml
index f9253cb..34d82b2 100644
--- a/wechat_jiaxuan/pages/index/index.wxml
+++ b/wechat_jiaxuan/pages/index/index.wxml
@@ -35,7 +35,7 @@
</view>
</view>
<!-- -->
- <authCard type="1" />
+ <authCard type="{{ member.authStatus }}" />
<!-- 浜у搧瑙嗛 -->
<view class="product_video" bindtap="jumpProVideo">
<view class="com_header">
diff --git a/wechat_jiaxuan/static/icon/logo.png b/wechat_jiaxuan/static/icon/logo.png
index bba8e64..9a470c8 100644
--- a/wechat_jiaxuan/static/icon/logo.png
+++ b/wechat_jiaxuan/static/icon/logo.png
Binary files differ
diff --git a/wechat_staff/api/index.js b/wechat_staff/api/index.js
new file mode 100644
index 0000000..982312f
--- /dev/null
+++ b/wechat_staff/api/index.js
@@ -0,0 +1,102 @@
+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
+ })
+}
\ No newline at end of file
diff --git a/wechat_staff/project.private.config.json b/wechat_staff/project.private.config.json
index 2a3c8e2..2d02d1a 100644
--- a/wechat_staff/project.private.config.json
+++ b/wechat_staff/project.private.config.json
@@ -10,7 +10,7 @@
"list": [
{
"name": "",
- "pathName": "pages/store/index",
+ "pathName": "pages/index/index",
"query": "",
"launchMode": "default",
"scene": null
diff --git a/wechat_staff/utils/config.js b/wechat_staff/utils/config.js
index 55c408e..09164ce 100644
--- a/wechat_staff/utils/config.js
+++ b/wechat_staff/utils/config.js
@@ -1,9 +1,8 @@
// export const baseUrl = 'https://jiaxuan.zbom.com/jx/wechat/' //姝e紡鏈嶅姟鍣�
-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/'
diff --git a/wechat_staff/utils/request.js b/wechat_staff/utils/request.js
index 374f9cc..7d34329 100644
--- a/wechat_staff/utils/request.js
+++ b/wechat_staff/utils/request.js
@@ -1,26 +1,46 @@
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()
+ }
}
})
} )
--
Gitblit v1.9.3