Commit 1f158b37 by chenwq

展业测算

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