Browse Source

优化步骤条组件样式

master
邓平艺 5 years ago
parent
commit
8bbac54763
  1. 46
      canteen/components/lf-price/lf-price.vue
  2. 44
      canteen/components/lf-stepbar/lf-stepbar.vue
  3. 67
      canteen/components/lf-title-line/lf-title-line.vue
  4. 203
      canteen/components/lf-ysteps/lf-ysteps.vue
  5. 46
      supplier/components/lf-price/lf-price.vue
  6. 44
      supplier/components/lf-stepbar/lf-stepbar.vue
  7. 67
      supplier/components/lf-title-line/lf-title-line.vue
  8. 203
      supplier/components/lf-ysteps/lf-ysteps.vue

46
canteen/components/lf-price/lf-price.vue

@ -1,46 +0,0 @@
<template>
<view>
<block v-if="isPoint">
<text class="text-price lf-font-48 lf-font-bold lf-color-price">{{ showPrice(1) }}</text>
<text class="lf-font-28 lf-font-bold lf-color-price">.{{ showPrice(2) }}</text>
</block>
<block v-else>
<text class="text-price lf-font-48 lf-font-bold lf-color-price">{{ showPrice() }}</text>
</block>
</view>
</template>
<script>
export default {
props: {
price: {
type: [Number, String],
default: ''
}
},
computed: {
//
isPoint(){
let price = parseFloat(this.$props.price).toString();
return price.indexOf('.') >= 0;
},
showPrice(){
let price = parseFloat(this.$props.price).toString(); // .00
return function(type){
let price_arr = price.split('.');
if(type == 1){
return price_arr[0];
}else if(type == 2){
return price_arr[1];
}else{
return price_arr[0];
}
}
}
}
}
</script>
<style lang="scss" scoped="scoped">
</style>

44
canteen/components/lf-stepbar/lf-stepbar.vue

@ -40,19 +40,7 @@
list: {
type: Array,
default(){
return [{
desc: '订单创建',
date: '2021-07-23 13:23:52',
isFinished: false
},{
desc: '订单发货',
date: '2021-07-23 13:23:52',
isFinished: false
},{
desc: '订单发货',
date: '2021-07-23 13:23:52',
isFinished: false
}]
return []
}
}
}
@ -63,24 +51,24 @@
.content{
width: 100%;
height: max-content;
padding: 0 32rpx;
padding: 0 16px;
}
.list{
display: flex;
align-items: center;
justify-content: space-between;
min-height: 110rpx;
min-height: 46px;
.left{
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
align-items: center;
margin-right: 15rpx;
margin-right: 6px;
.up-line,.down-line{
height: 40rpx;
width: 2rpx;
border: 1rpx solid #1833F2;
height: 20px;
width: 1px;
border: 1px solid #1833F2;
background-color: #1833F2;
position: relative;
}
@ -91,17 +79,17 @@
.dotted-line::after{
content: '';
position: absolute;
left: -1rpx;
bottom: -40rpx;
height: 40rpx;
width: 0rpx;
border: 1rpx dashed #999999;
left: -1px;
bottom: -20px;
height: 20px;
width: 0px;
border: 1px dashed #999999;
}
.icon{
width: 60rpx;
height: 60rpx;
width: 30px;
height: 30px;
box-sizing: border-box;
border: 2rpx solid #1833F2;
border: 2px solid #1833F2;
color: #1833F2;
border-radius: 50%;
background-color: #fff;
@ -118,7 +106,7 @@
color: #222222;
.date{
position: absolute;
bottom: -36rpx;
bottom: -18px;
left: 0;
font-size: 24rpx;
color: #999999;

67
canteen/components/lf-title-line/lf-title-line.vue

@ -1,67 +0,0 @@
<template>
<view class="decorative-box" :class="{'padding-tb': isPadding}" @click="onClick">
<view class="decorative-liner"></view>
<view class="lf-flex decorative-content">
<view class="rhombus lf-m-r-23" v-if="isRhombus"></view>
<view class="lf-font-32 lf-font-bold title">{{ title }}</view>
<view class="rhombus lf-m-l-23" v-if="isRhombus"></view>
</view>
<view class="decorative-liner"></view>
</view>
</template>
<script>
export default {
props: {
title: {
type: [String, Number], //
default: '猜你喜欢'
},
isRhombus: {
type: Boolean, //
default: true
},
isPadding: {
type: Boolean,
default: true
}
},
methods: {
onClick(event){
this.$emit('click', event);
}
}
}
</script>
<style lang="scss" scoped="scoped">
.decorative-box {
width: 100%;
height: max-content;
display: flex;
justify-content: center;
align-content: center;
align-items: center;
box-sizing: border-box;
.decorative-liner{
width: 110rpx;
height: 1rpx;
border: 1rpx solid #DCDCDC;
}
.decorative-content{
padding: 0 30rpx;
.rhombus{
width: 16rpx;
height: 16rpx;
transform: rotateZ(45deg);
background: #222;
}
.title{
max-width: 340rpx;
}
}
}
.padding-tb{
padding: 25rpx 0;
}
</style>

203
canteen/components/lf-ysteps/lf-ysteps.vue

@ -1,203 +0,0 @@
<template>
<!--
stepList: [
{
date: '08-28', // --
time: '11:22', // --
info: '开卡', // --
index: '1', // Index --
isFinished: true, // index --
isActive: false, // Active 使 index --
isShowSlot: false // Slot --
},
{
date: '08-30',
time: '15:33',
info: '激活',
index: '2',
isFinished: false,
isActive: true,
isShowSlot: true
}
]
slot 示例
<y-steps :stepList="stepList">
<mx-button type="danger" value="激活网点查看" />
</y-steps>
可按自己需求修改 css 中颜色变量
-->
<view class="steps">
<view
v-for="(step, index) in stepList"
:key="'stepsItem' + index"
:class="['steps-item', step.isActive ? 'steps-item-active' : '', step.isFinished ? 'steps-item-finished' : '']">
<view class="steps-item-index">
<view :class="['line', index != 0 ? '' : 'line-transparent']" :style="{'background-color': color}"></view>
<!-- 完成的 -->
<view v-if="!step.isActive && step.isFinished" class="index index-success" :style="{'background-color': color, 'color': '#fff'}">
<u-icon name="checkmark" size="16"></u-icon>
</view>
<!-- 过程 -->
<view v-else class="index" :style="{'border-color': color, 'color': color}">
<u-icon name="arrow-down" size="16"></u-icon>
<view class="process-line" :style="{'background-color': color}" v-if="index == stepList.length - 1"></view>
</view>
<view :class="['line', index != stepList.length - 1 ? '' : 'line-transparent']" :style="{'background-color': color}"></view>
</view>
<view class="steps-item-right">
<view class="right-info-item">
<view>{{ step.info }}</view>
<view v-if="step.isShowSlot">
<slot></slot>
</view>
<view class="lf-font-24 lf-color-999">{{ step.time }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'YSteps',
props: {
stepList: {
type: Array,
default: () => []
},
color: {
type: String,
default: '#1A35F2'
}
}
};
</script>
<style lang="scss" scoped>
$normolColor: #009688;
$activeColor: #ff3838;
$finishedColor: #4DB6AC;
$normolBgColor: #80CBC4;
$activeBgColor: #F8BBD0;
$finishedBgColor: #B2DFDB;
.steps {
display: flex;
flex-direction: column;
.steps-item {
display: flex;
.steps-item-left {
display: flex;
align-items: center;
color: $normolColor;
.steps-item-left-date {
font-size: 30rpx;
padding-top: 32rpx;
line-height: 40rpx;
}
.steps-item-left-time {
font-size: 26rpx;
}
}
.steps-item-index {
padding: 0 20rpx;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
.line {
flex: 1;
width: 5rpx;
background-color: #1833F2;
position: relative;
z-index: 1;
}
.process-line{
position: absolute;
bottom: 0;
left: 44rpx;
width: 4rpx;
height: 40rpx;
z-index: 0;
}
.line-transparent {
background-color: transparent !important;
}
.index {
width: 50rpx;
height: 50rpx;
font-size: 25rpx;
font-weight: 900;
text-align: center;
line-height: 50rpx;
border-radius: 50rpx;
// color: $normolColor;
// background-color: $normolBgColor;
}
// /deep/ .index-success {
// display: flex;
// justify-content: center;
// align-items: center;
// .uni-icon-success_no_circle {
// color: #1833F2;
// }
// }
}
.steps-item-right {
display: flex;
flex-direction: column;
// padding: 20rpx 0;
font-size: 28rpx;
// color: $normolColor;
.right-info-item {
display: flex;
flex-direction: column;
justify-content: center;
padding: 30rpx;
padding-left: 0rpx;
text {
font-size: 30rpx;
font-weight: 600;
line-height: 30rpx;
}
}
}
}
.steps-item-finished {
.steps-item-left {
color: $finishedColor;
}
.steps-item-index {
.index {
// color: $finishedColor;
// background-color: $finishedBgColor;
// border: 2rpx solid #1833F2;
color: #1833F2;
}
}
// .steps-item-right {
// color: $finishedColor;
// }
}
.steps-item-active {
.steps-item-left {
color: $activeColor;
}
.steps-item-index {
.index {
// color: $activeColor;
// background-color: $activeBgColor;
// background-color: #1833F2;
border: 3rpx solid;
color: #FFFFFF;
}
}
// .steps-item-right {
// color: $activeColor;
// }
}
}
</style>

46
supplier/components/lf-price/lf-price.vue

@ -1,46 +0,0 @@
<template>
<view>
<block v-if="isPoint">
<text class="text-price lf-font-48 lf-font-bold lf-color-price">{{ showPrice(1) }}</text>
<text class="lf-font-28 lf-font-bold lf-color-price">.{{ showPrice(2) }}</text>
</block>
<block v-else>
<text class="text-price lf-font-48 lf-font-bold lf-color-price">{{ showPrice() }}</text>
</block>
</view>
</template>
<script>
export default {
props: {
price: {
type: [Number, String],
default: ''
}
},
computed: {
//
isPoint(){
let price = parseFloat(this.$props.price).toString();
return price.indexOf('.') >= 0;
},
showPrice(){
let price = parseFloat(this.$props.price).toString(); // .00
return function(type){
let price_arr = price.split('.');
if(type == 1){
return price_arr[0];
}else if(type == 2){
return price_arr[1];
}else{
return price_arr[0];
}
}
}
}
}
</script>
<style lang="scss" scoped="scoped">
</style>

44
supplier/components/lf-stepbar/lf-stepbar.vue

@ -40,19 +40,7 @@
list: {
type: Array,
default(){
return [{
desc: '订单创建',
date: '2021-07-23 13:23:52',
isFinished: false
},{
desc: '订单发货',
date: '2021-07-23 13:23:52',
isFinished: false
},{
desc: '订单发货',
date: '2021-07-23 13:23:52',
isFinished: false
}]
return []
}
}
}
@ -63,24 +51,24 @@
.content{
width: 100%;
height: max-content;
padding: 0 32rpx;
padding: 0 16px;
}
.list{
display: flex;
align-items: center;
justify-content: space-between;
min-height: 110rpx;
min-height: 46px;
.left{
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
align-items: center;
margin-right: 15rpx;
margin-right: 6px;
.up-line,.down-line{
height: 40rpx;
width: 2rpx;
border: 1rpx solid #1833F2;
height: 20px;
width: 1px;
border: 1px solid #1833F2;
background-color: #1833F2;
position: relative;
}
@ -91,17 +79,17 @@
.dotted-line::after{
content: '';
position: absolute;
left: -1rpx;
bottom: -40rpx;
height: 40rpx;
width: 0rpx;
border: 1rpx dashed #999999;
left: -1px;
bottom: -20px;
height: 20px;
width: 0px;
border: 1px dashed #999999;
}
.icon{
width: 60rpx;
height: 60rpx;
width: 30px;
height: 30px;
box-sizing: border-box;
border: 2rpx solid #1833F2;
border: 2px solid #1833F2;
color: #1833F2;
border-radius: 50%;
background-color: #fff;
@ -118,7 +106,7 @@
color: #222222;
.date{
position: absolute;
bottom: -36rpx;
bottom: -18px;
left: 0;
font-size: 24rpx;
color: #999999;

67
supplier/components/lf-title-line/lf-title-line.vue

@ -1,67 +0,0 @@
<template>
<view class="decorative-box" :class="{'padding-tb': isPadding}" @click="onClick">
<view class="decorative-liner"></view>
<view class="lf-flex decorative-content">
<view class="rhombus lf-m-r-23" v-if="isRhombus"></view>
<view class="lf-font-32 lf-font-bold title">{{ title }}</view>
<view class="rhombus lf-m-l-23" v-if="isRhombus"></view>
</view>
<view class="decorative-liner"></view>
</view>
</template>
<script>
export default {
props: {
title: {
type: [String, Number], //
default: '猜你喜欢'
},
isRhombus: {
type: Boolean, //
default: true
},
isPadding: {
type: Boolean,
default: true
}
},
methods: {
onClick(event){
this.$emit('click', event);
}
}
}
</script>
<style lang="scss" scoped="scoped">
.decorative-box {
width: 100%;
height: max-content;
display: flex;
justify-content: center;
align-content: center;
align-items: center;
box-sizing: border-box;
.decorative-liner{
width: 110rpx;
height: 1rpx;
border: 1rpx solid #DCDCDC;
}
.decorative-content{
padding: 0 30rpx;
.rhombus{
width: 16rpx;
height: 16rpx;
transform: rotateZ(45deg);
background: #222;
}
.title{
max-width: 340rpx;
}
}
}
.padding-tb{
padding: 25rpx 0;
}
</style>

203
supplier/components/lf-ysteps/lf-ysteps.vue

@ -1,203 +0,0 @@
<template>
<!--
stepList: [
{
date: '08-28', // --
time: '11:22', // --
info: '开卡', // --
index: '1', // Index --
isFinished: true, // index --
isActive: false, // Active 使 index --
isShowSlot: false // Slot --
},
{
date: '08-30',
time: '15:33',
info: '激活',
index: '2',
isFinished: false,
isActive: true,
isShowSlot: true
}
]
slot 示例
<y-steps :stepList="stepList">
<mx-button type="danger" value="激活网点查看" />
</y-steps>
可按自己需求修改 css 中颜色变量
-->
<view class="steps">
<view
v-for="(step, index) in stepList"
:key="'stepsItem' + index"
:class="['steps-item', step.isActive ? 'steps-item-active' : '', step.isFinished ? 'steps-item-finished' : '']">
<view class="steps-item-index">
<view :class="['line', index != 0 ? '' : 'line-transparent']" :style="{'background-color': color}"></view>
<!-- 完成的 -->
<view v-if="!step.isActive && step.isFinished" class="index index-success" :style="{'background-color': color, 'color': '#fff'}">
<u-icon name="checkmark" size="16"></u-icon>
</view>
<!-- 过程 -->
<view v-else class="index" :style="{'border-color': color, 'color': color}">
<u-icon name="arrow-down" size="16"></u-icon>
<view class="process-line" :style="{'background-color': color}" v-if="index == stepList.length - 1"></view>
</view>
<view :class="['line', index != stepList.length - 1 ? '' : 'line-transparent']" :style="{'background-color': color}"></view>
</view>
<view class="steps-item-right">
<view class="right-info-item">
<view>{{ step.info }}</view>
<view v-if="step.isShowSlot">
<slot></slot>
</view>
<view class="lf-font-24 lf-color-999">{{ step.time }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'YSteps',
props: {
stepList: {
type: Array,
default: () => []
},
color: {
type: String,
default: '#1A35F2'
}
}
};
</script>
<style lang="scss" scoped>
$normolColor: #009688;
$activeColor: #ff3838;
$finishedColor: #4DB6AC;
$normolBgColor: #80CBC4;
$activeBgColor: #F8BBD0;
$finishedBgColor: #B2DFDB;
.steps {
display: flex;
flex-direction: column;
.steps-item {
display: flex;
.steps-item-left {
display: flex;
align-items: center;
color: $normolColor;
.steps-item-left-date {
font-size: 30rpx;
padding-top: 32rpx;
line-height: 40rpx;
}
.steps-item-left-time {
font-size: 26rpx;
}
}
.steps-item-index {
padding: 0 20rpx;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
.line {
flex: 1;
width: 5rpx;
background-color: #1833F2;
position: relative;
z-index: 1;
}
.process-line{
position: absolute;
bottom: 0;
left: 44rpx;
width: 4rpx;
height: 40rpx;
z-index: 0;
}
.line-transparent {
background-color: transparent !important;
}
.index {
width: 50rpx;
height: 50rpx;
font-size: 25rpx;
font-weight: 900;
text-align: center;
line-height: 50rpx;
border-radius: 50rpx;
// color: $normolColor;
// background-color: $normolBgColor;
}
// /deep/ .index-success {
// display: flex;
// justify-content: center;
// align-items: center;
// .uni-icon-success_no_circle {
// color: #1833F2;
// }
// }
}
.steps-item-right {
display: flex;
flex-direction: column;
// padding: 20rpx 0;
font-size: 28rpx;
// color: $normolColor;
.right-info-item {
display: flex;
flex-direction: column;
justify-content: center;
padding: 30rpx;
padding-left: 0rpx;
text {
font-size: 30rpx;
font-weight: 600;
line-height: 30rpx;
}
}
}
}
.steps-item-finished {
.steps-item-left {
color: $finishedColor;
}
.steps-item-index {
.index {
// color: $finishedColor;
// background-color: $finishedBgColor;
// border: 2rpx solid #1833F2;
color: #1833F2;
}
}
// .steps-item-right {
// color: $finishedColor;
// }
}
.steps-item-active {
.steps-item-left {
color: $activeColor;
}
.steps-item-index {
.index {
// color: $activeColor;
// background-color: $activeBgColor;
// background-color: #1833F2;
border: 3rpx solid;
color: #FFFFFF;
}
}
// .steps-item-right {
// color: $activeColor;
// }
}
}
</style>
Loading…
Cancel
Save