【组件库】订单结算页面

海轰Pro

共 9153字,需浏览 19分钟

 · 2021-08-03


效果展示

效果图

Demo代码

wxml

<view class="box">
  <view class="iphone">
    <view class="header">
      <view class="title-1">确认订单</view>
    </view>
    <form class="form">
      <view>
        <view class="title-2">收货地址</view>
        <view class="card">
          <text class="name">海轰</text>
          <text class="phone">0123456789\n</text>
          <text class="address">广东省深圳市**区**街道\n</text>
          <text class="attention">收货不便时,可选择寄存服务</text>
        </view>
      </view>
      <view class="pay">
        <view class="title-3">支付方式</view>
        <view class="form__radios">
          <view class="form__radio">
            <view>微信</view>
            <radio checked />
          </view>
          <view class="form__radio">
            <view>支付宝</view>
            <radio />
          </view>
          <view class="form__radio">
            <view for="mastercard">其他</view>
            <radio id="mastercard" name="payment-method" type="radio" />
          </view>
        </view>
      </view>
      <view>
        <view class="title-2">购物清单</view>
        <view class="goods">
          <view class="goods-buy">
            <view class="good">
              <text>薯片</text>
              <text>1.00 元</text>
            </view>
            <view class="good">
              <text>芬达</text>
              <text>3.00 元</text>
            </view>
            <view class="good">
              <text>牛奶</text>
              <text>5.00 元</text>
            </view>
          </view>
          <view class="allgoods">
            <text>总计</text>
            <text>9.00 元</text>
          </view>
        </view>
      </view>
      <view>
        <button class="button button--full">提交订单</button>
      </view>
    </form>
  </view>
</view>

wxss

page {
  --color-background#fae3ea;
  --color-primary#fc8080;
  --font-family-base: Poppin, sans-serif;
  --font-size-h11.25rem;
  --font-size-h21rem;
  /* box-sizing: inherit; */
  box-sizing: border-box;
}

.box {
  background-colorvar(--color-background);
  display: grid;
  font-familyvar(--font-family-base);
  line-height1.5;
  margin0;
  min-block-size50vh;
  padding5vmin;
  place-items: center;
}

.iphone {
  background-color#fbf6f7;
  background-imagelinear-gradient(to bottom, #fbf6f7, #fff);
  border-radius2em;
  /* block-size: 812px; */
  width80%;
  box-shadow0 0 1em rgba(0000.0625);
  overflow: auto;
  padding2em;
}

.header {
  display: flex;
  justify-content: center;
  padding-block0.5em;
  padding-inline1em;
}

.phone {
  font-size18px;
  opacity0.8;
}


.title-1 {
  font-sizevar(--font-size-h1);
  line-height1.2;
  margin-block0 1em;
}

.title-2 {
  font-sizevar(--font-size-h2);
  line-height1.2;
  margin-block0 1em;
}

.title-3 {
  font-weight600;
  margin-block-end0.5em;
  padding0;
}

.pay {
  border0;
  margin5px;
  padding0;
}

.card {
  border-radius1em;
  background-colorvar(--color-primary);
  color#fff;
  padding1em;
  font-style: normal;
}

.name {
  font-size18px;
  letter-spacing3px;
}

.address {
  font-size12px;
}

.attention {
  font-size12px;
}

.form__radio {
  align-items: center;
  background-color#fefdfe;
  border-radius1em;
  box-shadow0 0 1em rgba(0000.0625);
  display: flex;
  padding1em;
}

.form__radio view {
  align-items: center;
  display: flex;
  flex1;
  gap1em;
}

.goods {
  border-collapse: collapse;
  inline-size100%;
}

button {
  border0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.goods-buy {
  color#b4b4b4;
}

.good {
  padding-block0.125em;
  display: flex;
  justify-content: space-between;
}

.allgoods {
  border-top1px solid #b4b4b4;
  font-weight600;
  display: flex;
  justify-content: space-between;
}

.align {
  display: grid;
  place-items: center;
}

.button {
  align-items: center;
  background-colorvar(--color-primary);
  border-radius999em;
  color#fff;
  display: flex;
  gap0.5em;
  justify-content: center;
  padding-block0.75em;
  padding-inline1em;
  transition0.3s;
}

.button--full {
  inline-size100%;
}

.form {
  display: grid;
  gap2em;
}

.form__radios {
  display: grid;
  gap1em;
}

结语

文章仅作为学习笔记,记录从0到1的一个过程

希望对您有所帮助,如有错误欢迎小伙伴指正~

写留言

浏览 42
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报