Commit 9532421d by chenwq

计算

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