Commit 9532421d by chenwq

计算

1 parent cc86ae95
......@@ -10,6 +10,10 @@ Page({
sales: 100,
count: 1
},
actualForm: {
sales: 100,
count: 1
},
IMGURL: wx.$imgUrl,
height: 'calc(100vh - 100rpx)',
tagIndex: 0,
......@@ -128,5 +132,8 @@ Page({
handleConfirm() {
console.log('提交---')
this.setData({
actualForm: this.data.editForm
})
}
})
\ No newline at end of file
......@@ -34,7 +34,7 @@
<view class="tips">预估收益根据您的新车销量 {{ editForm.sales }}台 测算所得</view>
</view>
<view wx:for="{{cardList}}" wx:key="index">
<card cardForm="{{item}}" bindclick="handleCardClick"></card>
<card cardForm="{{item}}" actualForm="{{actualForm}}" sales="{{sales}}" bindclick="handleCardClick"></card>
</view>
</view>
</add-tab-view>
......
......@@ -57,7 +57,7 @@ page {
width: 256rpx;
border: 2rpx solid #E6E6E6;
border-radius: 4rpx;
padding: 12rpx 20rpx;
padding: 0 20rpx;
}
.suffix {
......
......@@ -6,9 +6,22 @@ Component({
properties: {
cardForm: {
type: Object,
value: {}
      observer(n) {
        this.setData({
cardForm: n
        })
}
},
actualForm: {
type: Object,
observer(n) {
      this.setData({
actualForm: n
      })
this.calcProfit()
}
}
},
/**
* 组件的初始数据
......@@ -39,7 +52,6 @@ Component({
},
},
ready() {
},
/**
* 组件的方法列表
......@@ -48,5 +60,22 @@ Component({
handleClick() {
this.triggerEvent('click', this.data.cardForm)
},
calcProfit() {
var targetItem = this.data.cardForm
let sales = +this.data.actualForm.sales
let defaultPrice = +targetItem.priceList[0].value
if(targetItem.detailAttrName) {
switch(targetItem.detailAttrName) {
case 'digitRight':
targetItem.profit = sales * 0.5 * defaultPrice * 12
break
default:
break
}
}
this.setData({
cardForm: targetItem
})
},
}
})
......@@ -13,10 +13,11 @@
</view>
</view>
<view class="flex-space card-row">
<view>
<view wx:if="{{cardForm.profit}}">
<text class="m-r-8">预估收益</text>
<text class="profit-txt">¥{{cardForm.profit}}</text>
</view>
<view wx:else="">暂无预估收益,敬请期待</view>
<view class="profit-jump">产品介绍<text class="arrow"></text></view>
</view>
</view>
......
......@@ -13,9 +13,10 @@ var tabList = [{
name: '均客单价',
value: '2000'
}],
profit: '880'
profit: '1200000'
}, {
proName: '汽车太阳膜',
detailAttrName: 'sunMembrane',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'membrane',
priceList: [{
......@@ -23,7 +24,7 @@ var tabList = [{
value: '1500'
}, {
name: '豪华品牌',
value: '2500'
value: '2000'
}],
profit: '1260'
}]
......@@ -35,20 +36,22 @@ var tabList = [{
},
cardList: [{
proName: '漆面保护膜',
detailAttrName: 'paintMembrane',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'membrane',
priceList: [{
name: '均客单价',
value: '90'
value: '13000'
}],
profit: '880'
}, {
proName: '改色膜',
detailAttrName: 'colorMembrane',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'membrane',
priceList: [{
name: '均客单价',
value: '90'
value: '5000'
}],
profit: '880'
}]
......@@ -59,34 +62,38 @@ var tabList = [{
imgUrl: 'addTransform/card/deliver/introduce.png'
},
cardList: [{
proName: '镀晶等美容项目',
proName: '数字化美容',
detailAttrName: 'digitBeauty',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'beauty',
priceList: [{
name: '均客单价',
value: '2000'
value: '350'
}],
profit: '880'
}, {
proName: '360全包脚垫',
proName: '座椅通风',
detailAttrName: 'chair',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'light',
priceList: [{
name: '均客单价',
value: '2000'
value: '500'
}],
profit: '880'
}, {
proName: 'AR导航',
detailAttrName: 'ar',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'light',
priceList: [{
name: '均客单价',
value: '2000'
value: '1600'
}],
profit: '880'
}, {
proName: '氛围灯',
detailAttrName: 'lamp',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'light',
priceList: [{
......@@ -96,11 +103,12 @@ var tabList = [{
profit: '880'
}, {
proName: '360全景导航',
detailAttrName: 'navigation',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'light',
priceList: [{
name: '均客单价',
value: '2000'
value: '2500'
}],
profit: '880'
}]
......@@ -116,25 +124,26 @@ var tabList = [{
type: 'service',
priceList: [{
name: '均客单价',
value: '2000'
value: '2500'
}],
profit: '880'
profit: null
}, {
proName: '金融车贷',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'service',
priceList: [{
name: '均客单价',
value: '2000'
value: '20000'
}],
profit: '880'
profit: null
}, {
proName: '镀晶等美容项目',
proName: '数字化美容',
detailAttrName: 'digitBeauty',
imgUrl: 'addTransform/card/deliver/card-0.png',
type: 'beauty',
priceList: [{
name: '均客单价',
value: '2000'
value: '350'
}],
profit: '880'
}]
......@@ -325,6 +334,17 @@ var addDatailObj = {
videoList: [{
url: 'addTransform/detail/video.mp4'
}]
},
sunMembrane: {
imgList: [{
url: 'addTransform/card/deliver/introduce.png'
}, {
url: 'addTransform/card/deliver/card-0.png'
}],
text: '太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜太阳膜。',
videoList: [{
url: 'addTransform/detail/video.mp4'
}]
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!