123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- <template>
- <view class="container" :style="{ height: winHeight+ 'px' }">
- <!-- 状态栏高度 -->
- <view :style="{ height: `${statusBarHeight}px` }"></view>
- <!-- 进行中/历史订单 -->
- <view class="status-bar">
- <view>
- <text :class="isShow? 'status-true': 'status-false'" @click="statusClick">外卖配送</text>
- <text :class="!isShow? 'status-true': 'status-false'" @click="statusClick">到店自取(15分钟后取餐)</text>
- </view>
- </view>
- <view style="background-color: white;border-radius: 23rpx;margin-bottom: 10rpx;padding: 19rpx 38rpx 38rpx 38rpx">
- <view class='address' @tap='onAddress'>
- <view class='addressCon' v-if="addressInfo.realName">
- <view class='name acea-row'>
- <view class="line1 select-name">{{addressInfo.realName}}</view>
- <view class='phone'>{{addressInfo.phone}}</view>
- </view>
- <view class="acea-row">
- <view class="line1"><text class='default font_color' v-if="addressInfo.isDefault">[默认]</text>{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{ addressInfo.street}}{{addressInfo.detail}}</view>
- </view>
- </view>
- <view class='addressCon' v-else>
- <view class='setaddress'>设置收货地址</view>
- </view>
- <view class='iconfont icon-jiantou ' style="font-size: 30rpx;"></view>
- </view>
- <view class="item-go" @tap="goIndex = true" :class="goIndex ? 'item-go-avt' : ''">
- <text style="font-weight: 600;font-size: 27rpx;">立即配送</text>
- <text style="font-weight: 500;font-size: 23rpx;margin-left: 76rpx">预计10:12送达</text>
- <image class="go-img"></image>
- </view>
- <view style="margin-top: 10rpx;" class="item-go" @tap="goIndex = false" :class="!goIndex ? 'item-go-avt' : ''">
- <text style="font-weight: 600;font-size: 27rpx;">预约配送</text>
- <text style="font-weight: 500;font-size: 23rpx;margin-left: 76rpx">选择时间 》</text>
- <image class="go-img"></image>
- </view>
- </view>
- <view class="item-goods">
- <text>吉啊婆麻辣烫</text>
- <view class="good" v-for="(good, key) in goods_list" :key="key">
- <image :src="good.images" class="image" @tap="console.log('点击图片')"></image>
- <view class="right">
- <text class="name">{{ good.name }}</text>
- <text class="tips">{{ good.content }}</text>
- <view class="price_and_action">
- <text class="price">¥{{ good.price }}</text>
- <view class="btn-group">
- <view class="dot"></view>
- </view>
- </view>
- </view>
- </view>
- <view style="width: 100%; height: 2rpx;border: 2rpx dashed #D6D7DC;position: relative;bottom: 20rpx;"></view>
- <view class='item-con'>
- <text>打包费</text>
- <text>¥2</text>
- </view>
- <view class='item-con' style="margin: 0;">
- <text>用户配送费</text>
- <text style="text-decoration: line-through;">¥2 <text>免费配送</text></text>
- </view>
- <view style="font-weight: 400;font-size: 21rpx;color: #999999;margin-bottom: 10rpx;">配送高峰期,可能配送费上调</view>
- <view class='item-con'>
- <text @tap="isZhuan = !isZhuan">已享优惠 <text :style="{ transform: isZhuan ? 'rotate(90deg)' : 'rotate(-90deg)'}"
- class='iconfont icon-jiantou xuanzhuan' style="font-size: 22rpx;display: inline-block;"></text></text>
- <text>- ¥2</text>
- </view>
- <view v-if="isZhuan" class='item-con' style="background: #F8F9FB;padding: 8rpx 19rpx;font-weight: 500;font-size: 21rpx;color: #FF6702;">
- <text>活动红包</text>
- <text>- ¥2</text>
- </view>
- </view>
- <!-- 购物车栏 begin -->
- <view class="cart-box" :style="{top: (winHeight - 100) + 'px'}">
- <view style="margin-left: 39rpx;">
- <view style="font-weight: 600;font-size: 27rpx;color: #FFFFFF;" class="price">¥{{ total }}</view>
- <text style="font-weight: 400;font-size: 23rpx;color: #999999;">已优惠¥2</text>
- </view>
- <button type="primary" class="pay-btn bg-color" @tap="toPay">
- 去支付
- </button>
- </view>
- <!-- 购物车栏 end -->
- </view>
- </template>
- <script>
- import {
- getAddressDetail,
- getAddressDefault
- } from '@/api/user.js';
- var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
- let app = getApp();
- export default {
- data() {
- return {
- total: 0,
- statusBarHeight: app.globalData.statusBarHeight,
- navigationBarHeight: 0,
- winHeight: 0,
- isZhuan: true,
- isShow: true,
- goIndex: true,
- orderNo: '', //预下单订单号
- addressInfo: {}, //地址信息
- addressId: 0, //地址id
- goods_list: [{
- id: 11,
- name: '土豆片',
- content: '月销371',
- price: 1,
- images: '/static/img/img7.png'
- },
- {
- id: 12,
- name: '娃娃菜',
- content: '月销371',
- price: 2,
- images: '/static/img/img7.png'
- },
- {
- id: 13,
- name: '方便面',
- content: '月销371',
- price: 3,
- images: '/static/img/img7.png'
- }
- ],
- cart: []
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- },
- onLoad(options) {
- let that = this;
- uni.getSystemInfo({
- success: function(res) {
- that.winHeight = res.windowHeight
- },
- });
- //首页数据加载
- // this.getIndexConfig();
- // #ifdef MP-WEIXIN
- // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
- const custom = wx.getMenuButtonBoundingClientRect()
- // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
- this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
- // console.log("导航栏高度:"+this.globalData.navigationBarHeight)
- // #endif
- this.cart = uni.getStorageSync('cart')
- this.total = (this.cart.reduce((acc, cur) => acc + cur.number * cur.price, 0)).toFixed(2)
- },
- onShow() {
- },
- methods: {
- statusClick() {
- this.isShow = !this.isShow;
- },
- toPay() {
- // if(!this.isLogin) {
- // uni.navigateTo({url: '/pages/login/login'})
- // return
- // }
- },
- onAddress: function() {
- uni.navigateTo({
- url: '/pages/address/user_address_list/index?orderNo=' + this.orderNo
- });
- },
- /*
- * 获取默认收货地址或者获取某条地址信息
- */
- getaddressInfo: function() {
- if (this.addressId) {
- getAddressDetail(this.addressId).then(res => {
- if (res.data) {
- res.data.isDefault = res.data.isDefault;
- this.addressInfo = res.data || {};
- }
- })
- }
- },
- },
- mounted() {
- },
- }
- </script>
- <style lang="scss" scoped>
- .bg-color {
- background-color: $bg-color-primary;
- }
- .status-bar {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 125rpx;
- background-color: #FF6702;
- text-align: center;
- padding: 20px 0 16rpx 0;
- }
- .status-bar view {
- display: flex;
- align-items: center;
- justify-content: center;
- background: #EB5E00;
- border-radius: 37rpx;
- }
- .status-true {
- display: inline-block;
- width: 326rpx;
- padding: 10rpx 0;
- background-color: white;
- color: #FF6600;
- border-radius: 37rpx;
- }
- .status-false {
- display: inline-block;
- width: 326rpx;
- padding: 10rpx 0;
- color: #FFCBA9;
- border-radius: 37rpx;
- }
- .icon-jiantou {
- font-size: 26rpx;
- color: #515151;
- margin-left: 14rpx;
- }
- .address {
- margin-bottom: 40rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .item-go {
- position: relative;
- width: 100%;
- padding: 20rpx 0;
- padding-left: 39rpx;
- background: #FFFFFF;
- border-radius: 15rpx;
- border: 2rpx solid #D6D7DC;
- }
- .item-go-avt {
- position: relative;
- color: #FF6702;
- background: #FFECE0;
- border-radius: 15rpx;
- border: 2rpx solid #FF6702;
- }
- .go-img {
- width: 54rpx;
- height: 54rpx;
- position: absolute;
- right: 0;
- top: 0;
- }
- .item-goods {
- width: 100%;
- height: 100%;
- padding: 19rpx 38rpx;
- background: #FFFFFF;
- border-radius: 23rpx 23rpx 0rpx 0rpx;
- }
- .good {
- display: flex;
- align-items: center;
- margin-bottom: 30rpx;
- .image {
- width: 160rpx;
- height: 160rpx;
- margin-right: 20rpx;
- border-radius: 8rpx;
- }
- .right {
- flex: 1;
- // height: 160rpx;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: space-between;
- padding-right: 14rpx;
- .name {
- font-size: $font-size-base;
- margin-bottom: 10rpx;
- }
- .tips {
- width: 100%;
- height: 40rpx;
- line-height: 40rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-size: $font-size-sm;
- color: $text-color-assist;
- margin-bottom: 10rpx;
- }
- .price_and_action {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .price {
- font-size: $font-size-base;
- font-weight: 600;
- }
- }
- }
- }
- .cart-box {
- position: absolute;
- // bottom: 30rpx;
- left: 30rpx;
- right: 30rpx;
- height: 96rpx;
- border-radius: 48rpx;
- box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
- background-color: #000;
- display: flex;
- align-items: center;
- justify-content: space-between;
- z-index: 9999;
- .cart-img {
- width: 50rpx;
- height: 47rpx;
- position: relative;
- // margin-top: -48rpx;
- }
- .pay-btn {
- height: 100%;
- padding: 0 30rpx;
- color: #FFFFFF;
- border-radius: 0 50rpx 50rpx 0;
- display: flex;
- align-items: center;
- font-size: $font-size-base;
- }
- .price {
- flex: 1;
- color: $text-color-base;
- }
- }
- .item-con {
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-weight: 500;
- font-size: 21rpx;
- color: #141414;
- margin-bottom: 10rpx;
- }
- .container {
- overflow: hidden;
- position: relative;
- }
- </style>
|