Commit 1f158b37 by chenwq

展业测算

1 parent e3b7a92f
var measureList = Object.freeze([ var measureList = Object.freeze([
{ {
name: '新车洽谈场景', // name: '新车交付场景',
tips: '车损升级', name: '膜升级驻店',
iconName: 'icon1', // tips: '精品升级',
product: [
{
name: '车损升级',
parentName: '新车洽谈场景',
tips: '车损升级',
value: '0-0',
typeIndex: '1.0',
isCheck: false,
rate: '0.5',
averagePrice: 1200,
flowCost: '0.4',
flowCostText: '40%',
serviceDividendRatio: '0.23'
}
]
},
{
name: '新车交付场景',
tips: '精品升级',
iconName: 'icon2', iconName: 'icon2',
product: [ product: [
{ {
name: '太阳膜升级', name: '太阳膜升级',
parentName: '新车交付场景', parentName: '膜升级驻店',
tips: '精品升级', // tips: '精品升级',
value: '1-0', // value: '1-0',
typeIndex: '1.1', typeIndex: '1.1',
isCheck: false, isCheck: false,
rate: '0.55', rate: '0.55',
...@@ -40,15 +21,15 @@ var measureList = Object.freeze([ ...@@ -40,15 +21,15 @@ var measureList = Object.freeze([
] ]
}, },
{ {
name: '0-6月', name: '次新车二次转化',
iconName: 'icon3', iconName: 'icon3',
tips: '膨胀金活动', // tips: '膨胀金活动',
product: [ product: [
{ {
name: '膨胀金活动-车衣', name: '膨胀金活动-车衣',
parentName: '0-6月', parentName: '次新车二次转化',
tips: '膨胀金活动', // tips: '膨胀金活动',
value: '2-0', // value: '2-0',
typeIndex: '1.2', typeIndex: '1.2',
isCheck: false, isCheck: false,
rate: '0.09', rate: '0.09',
...@@ -59,9 +40,9 @@ var measureList = Object.freeze([ ...@@ -59,9 +40,9 @@ var measureList = Object.freeze([
}, },
{ {
name: '膨胀金活动-改色膜', name: '膨胀金活动-改色膜',
parentName: '0-6月', parentName: '次新车二次转化',
tips: '膨胀金活动', // tips: '膨胀金活动',
value: '2-1', // value: '2-1',
typeIndex: '1.2', typeIndex: '1.2',
isCheck: false, isCheck: false,
rate: '0.06', rate: '0.06',
...@@ -73,16 +54,16 @@ var measureList = Object.freeze([ ...@@ -73,16 +54,16 @@ var measureList = Object.freeze([
] ]
}, },
{ {
name: '6个月以上', name: '售后众筹',
iconName: 'icon4', iconName: 'icon4',
tips: '众筹活动', // tips: '众筹活动',
product: [ product: [
{ {
name: '360全景导航', name: '360全景导航',
parentName: '6个月以上', parentName: '售后众筹',
tips: '众筹活动', // tips: '众筹活动',
typeIndex: '1.3', typeIndex: '1.3',
value: '3-0', // value: '3-0',
isCheck: false, isCheck: false,
rate: '0.015', rate: '0.015',
averagePrice: 2680, averagePrice: 2680,
...@@ -92,9 +73,9 @@ var measureList = Object.freeze([ ...@@ -92,9 +73,9 @@ var measureList = Object.freeze([
}, },
{ {
name: 'AR导航', name: 'AR导航',
parentName: '6个月以上', parentName: '售后众筹',
tips: '众筹活动', // tips: '众筹活动',
value: '3-1', // value: '3-1',
typeIndex: '1.3', typeIndex: '1.3',
isCheck: false, isCheck: false,
rate: '0.015', rate: '0.015',
...@@ -105,9 +86,9 @@ var measureList = Object.freeze([ ...@@ -105,9 +86,9 @@ var measureList = Object.freeze([
}, },
{ {
name: '氛围灯', name: '氛围灯',
parentName: '6个月以上', parentName: '售后众筹',
tips: '众筹活动', // tips: '众筹活动',
value: '3-2', // value: '3-2',
typeIndex: '1.3', typeIndex: '1.3',
isCheck: false, isCheck: false,
rate: '0.015', rate: '0.015',
...@@ -118,9 +99,9 @@ var measureList = Object.freeze([ ...@@ -118,9 +99,9 @@ var measureList = Object.freeze([
}, },
{ {
name: '座椅通风', name: '座椅通风',
parentName: '6个月以上', parentName: '售后众筹',
tips: '众筹活动', // tips: '众筹活动',
value: '3-3', // value: '3-3',
typeIndex: '1.3', typeIndex: '1.3',
isCheck: false, isCheck: false,
rate: '0.01', rate: '0.01',
...@@ -131,9 +112,9 @@ var measureList = Object.freeze([ ...@@ -131,9 +112,9 @@ var measureList = Object.freeze([
}, },
{ {
name: '智能香薰', name: '智能香薰',
parentName: '6个月以上', parentName: '售后众筹',
tips: '众筹活动', // tips: '众筹活动',
value: '3-4', // value: '3-4',
typeIndex: '1.3', typeIndex: '1.3',
isCheck: false, isCheck: false,
rate: '0.015', rate: '0.015',
...@@ -143,7 +124,27 @@ var measureList = Object.freeze([ ...@@ -143,7 +124,27 @@ var measureList = Object.freeze([
serviceDividendRatio: '0.24' serviceDividendRatio: '0.24'
} }
] ]
} },
{
name: '车损险升级',
// tips: '车损升级',
iconName: 'icon1',
product: [
{
name: '车损升级',
parentName: '车损险升级',
// tips: '车损升级',
// value: '0-0',
typeIndex: '1.0',
isCheck: false,
rate: '0.5',
averagePrice: 1200,
flowCost: '0.4',
flowCostText: '40%',
serviceDividendRatio: '0.23'
}
]
},
]) ])
export default { export default {
......
...@@ -38,7 +38,7 @@ Page({ ...@@ -38,7 +38,7 @@ Page({
// } // }
// } // }
if (!this.data.isDisabled) { if (!this.data.isDisabled) {
console.log(this.data.checkArray) // console.log(this.data.checkArray)
let checkArray = [] let checkArray = []
this.data.measureList.forEach(item => { this.data.measureList.forEach(item => {
item.product.forEach(i => { item.product.forEach(i => {
...@@ -47,27 +47,26 @@ Page({ ...@@ -47,27 +47,26 @@ Page({
} }
}) })
}) })
console.log(checkArray) // console.log(checkArray)
const params = Object.assign({checkArray}, this.data.formData) const params = Object.assign({checkArray}, this.data.formData)
console.log(params) // console.log(params)
wx.$router.go("measureResult", params); wx.$router.go("measureResult", params);
} }
}, },
// 选择产品 // 选择产品
checkProduct(e) { checkProduct(e) {
const value = e.target.dataset.value const { pidx, idx } = e.currentTarget.dataset
const index = +value.split('-')[0] const value = pidx + '-' + idx
const productIndex = +value.split('-')[1] const name = `measureList[${pidx}].product[${idx}].isCheck`
const name = `measureList[${index}].product[${productIndex}].isCheck` const val = this.data.measureList[pidx].product[idx].isCheck
const val = this.data.measureList[index].product[productIndex].isCheck
!val ? checkMap.set(value, !val) : checkMap.delete(value) !val ? checkMap.set(value, !val) : checkMap.delete(value)
console.log(checkMap) // console.log(checkMap)
this.setData({ this.setData({
[name]: !val, [name]: !val,
checkArray: [...checkMap.keys()] checkArray: [...checkMap.keys()]
}) })
this.validForm() this.validForm()
console.log(this.data.checkArray) // console.log(this.data.checkArray)
}, },
// 必填校验 // 必填校验
...@@ -83,7 +82,7 @@ Page({ ...@@ -83,7 +82,7 @@ Page({
handleInput(e) { handleInput(e) {
let name = e.currentTarget.dataset.name let name = e.currentTarget.dataset.name
let val = this.validateNumber(e.detail.value) let val = this.validateNumber(e.detail.value)
console.log(val) // console.log(val)
const form = `formData.${name}` const form = `formData.${name}`
this.setData({ this.setData({
[form]: val [form]: val
...@@ -93,7 +92,7 @@ Page({ ...@@ -93,7 +92,7 @@ Page({
// 输入正整数校验 // 输入正整数校验
validateNumber(val) { validateNumber(val) {
console.log(val, val.replace(/\D/g, '')) // console.log(val, val.replace(/\D/g, ''))
return val == 0 ? '' : val.replace(/\D/g, '') return val == 0 ? '' : val.replace(/\D/g, '')
}, },
...@@ -101,7 +100,7 @@ Page({ ...@@ -101,7 +100,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
}, },
/** /**
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<view class="scenario"> <view class="scenario">
<image class="icon" webp src="{{IMGURL}}measure/{{i.iconName}}.png?v={{img_version}}"></image> <image class="icon" webp src="{{IMGURL}}measure/{{i.iconName}}.png?v={{img_version}}"></image>
{{i.name}} {{i.name}}
<view wx:if="{{i.tips}}" class="title-tip">{{i.tips}}</view> <!-- <view wx:if="{{i.tips}}" class="title-tip">{{i.tips}}</view> -->
</view> </view>
<view class="product-list"> <view class="product-list">
<view class="product-item {{j.isCheck ? 'active':''}}" wx:for="{{i.product}}" wx:for-item="j" wx:key="index" data-value="{{j.value}}" bindtap="checkProduct"> <view class="product-item {{j.isCheck ? 'active':''}}" wx:for="{{i.product}}" wx:for-item="j" wx:for-index="jIdx" wx:key="index" data-pidx="{{index}}" data-idx="{{jIdx}}" data-value="{{j.value}}" bindtap="checkProduct">
<image hidden="{{!j.isCheck}}" class="iconCheck" webp src="{{IMGURL}}measure/icon-check.png?v={{img_version}}"></image> <image hidden="{{!j.isCheck}}" class="iconCheck" webp src="{{IMGURL}}measure/icon-check.png?v={{img_version}}"></image>
{{j.name}}</view> {{j.name}}</view>
</view> </view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!