Commit 8babe65d by chenwq

卡片组件

1 parent da5dabb7
...@@ -4,9 +4,17 @@ Component({ ...@@ -4,9 +4,17 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
senceActive: {
type: Number,
value: -1
},
formData: { formData: {
type: Object, type: Object,
value: () => { } value: () => { }
},
sencePriceList: {
type: Array,
value: () => []
} }
}, },
...@@ -27,13 +35,16 @@ Component({ ...@@ -27,13 +35,16 @@ Component({
}, { }, {
title: '12个月以上', title: '12个月以上',
subTitle: '1.3存量用户众筹' subTitle: '1.3存量用户众筹'
}], }]
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
handleClick(e) {
let { idx } = e.currentTarget.dataset
this.triggerEvent('handleSenceChange', { senceIdx: idx })
}
} }
}) })
<!--pages/tab/output/components/senceBox/senceBox.wxml--> <!--pages/tab/output/components/senceBox/senceBox.wxml-->
<view class="flex sence"> <view class="flex sence">
<view class="sence-item {{ formData['sence' + (index + 1)] ? 'active' : ''}}" wx:for="{{custSenceList}}" wx:key="index"> <view class="sence-item {{ formData['sence' + (index + 1)] ? 'open' : ''}} {{ (senceActive != -1 && senceActive == index + 1) ? 'active' : ''}}" wx:for="{{custSenceList}}" wx:key="index" bindtap="handleClick" data-idx="{{index + 1}}">
<view wx:if="{{formData['sence' + (index + 1)]}}" class="active-icon">已开通</view> <view wx:if="{{formData['sence' + (index + 1)] && senceActive != (index + 1)}}" class="open-icon">已开通</view>
<image wx:if="{{formData['sence' + (index + 1)]}}" class="sence-img" src="{{IMGURL}}output/client/icon/scene-{{index + 1}}-checked.png?v={{img_version}}" /> <image wx:if="{{formData['sence' + (index + 1)]}}" class="sence-img" src="{{IMGURL}}output/caract0{{index + 1}}.png?v={{img_version}}" />
<image wx:else class="sence-img" src="{{IMGURL}}output/client/icon/scene-{{index + 1}}.png?v={{img_version}}" /> <image wx:else class="sence-img" src="{{IMGURL}}output/car0{{index + 1}}.png?v={{img_version}}" />
<view class="sence-title">{{item.title}}</view> <view class="sence-title">{{item.title}}</view>
<view>{{item.subTitle}}</view> <view>{{item.subTitle}}</view>
<view class="total-price" wx:if="{{sencePriceList.length}}">¥ {{sencePriceList[index].total}}</view>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
} }
.sence-item { .sence-item {
box-sizing: border-box;
position: relative; position: relative;
width: 25%; width: 25%;
background: #F7F8FC; background: #F7F8FC;
...@@ -31,15 +32,16 @@ ...@@ -31,15 +32,16 @@
margin: 10rpx 0 4rpx; margin: 10rpx 0 4rpx;
} }
.active.sence-item { /* 已开通 - start */
.open.sence-item {
background: #F0F7FF; background: #F0F7FF;
} }
.active-icon { .open-icon {
box-sizing: border-box; box-sizing: border-box;
position: absolute; position: absolute;
left: 0; left: 0.5rpx;
top: 0; top: 0.5rpx;
width: 56rpx; width: 56rpx;
height: 32rpx; height: 32rpx;
line-height: 24rpx; line-height: 24rpx;
...@@ -50,11 +52,34 @@ ...@@ -50,11 +52,34 @@
padding: 4rpx; padding: 4rpx;
} }
/* 已开通 - end */
/* 选中 - start */
.active.sence-item {
background-image: linear-gradient(145deg, #F0F7FF 0%, #FFFFFF 73%);
border: 2rpx solid #3666FE;
box-shadow: 0 4rpx 8rpx 0 rgba(180, 186, 204, 0.32), 0 8rpx 20rpx 0 rgba(180, 186, 204, 0.40);
/* background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/output/carselect.png') no-repeat;
background-size: 100% 100%; */
}
/* 选中 - end */
.sence-title { .sence-title {
color: #323436; color: #323436;
font-weight: 600;
} }
.sence-img { .sence-img {
width: 56rpx; width: 56rpx;
height: 56rpx; height: 56rpx;
} }
.total-price {
height: 40rpx;
line-height: 40rpx;
margin-top: 22rpx;
font-size: 24rpx;
color: #3666FE;
font-weight: 600;
}
\ No newline at end of file \ No newline at end of file
...@@ -10,9 +10,26 @@ Page({ ...@@ -10,9 +10,26 @@ Page({
sence1: false, sence1: false,
sence2: true, sence2: true,
sence3: false, sence3: false,
sence4: true, sence4: true
}, },
senceActive: 0 sencePriceList: [{
total: 0
}, {
total: 1000.45
}, {
total: 0
}, {
total: 14580.45
}],
senceActive: 1
},
handleSenceChange(e) {
var idx = e.detail.senceIdx
this.setData({
senceActive: idx
})
console.log('换内容---')
}, },
/** /**
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<view class="layout"> <view class="layout">
<view class="title">选产品/活动</view> <view class="title">选产品/活动</view>
<view class="sence-box"> <view class="sence-box">
<sence-box formData="{{formData}}"></sence-box> <sence-box formData="{{formData}}" sencePriceList="{{sencePriceList}}" senceActive="{{senceActive}}" bindhandleSenceChange="handleSenceChange"></sence-box>
</view> </view>
</view> </view>
<view class="btn-blue">点击开通</view> <view class="btn-blue">点击开通</view>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
color: #8A8C90; color: #8A8C90;
padding: 0 20rpx 0 32rpx; padding: 0 20rpx 0 32rpx;
margin-bottom: 16rpx; margin-bottom: 16rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/output/client/bg-profit.png') no-repeat; background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/output/bg-profit.png') no-repeat;
background-size: 100% 96rpx; background-size: 100% 96rpx;
.price-txt { .price-txt {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!