123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- <template>
- <view class="content">
- <view class="navbar">
- <view v-for="(item, index) in navlist" :key="index" class="nav-item"
- :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.title }}</view>
- </view>
- <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" disable-touch>
- <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navlist" :key="tabIndex">
- <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData" :style="{ height: height }">
- <!-- 空白页 -->
- <u-empty text="暂无数据" mode="list" v-if="tabItem.loaded && tabItem.list.length == 0"></u-empty>
- <!-- 订单列表 -->
- <view class="good" v-for="item in tabItem.list">
- <image src="" mode="" class="good-img"></image>
- <view class="good-info">
- <view class="good-tit clamp2">
- 涅槃旗下官方正品线雕提拉术
- </view>
- <view class="good-tip">
- 随时随地 预约服务
- </view>
- <view class="good-buy">
- 已售1000件
- </view>
- <view class="good-price">
- 34 <text class="ot-price"></text>
- </view>
- </view>
- <view class="add-jian-wrap">
- <image src="../../static/img/jian.png" mode="" v-if="nun > 0" @click="jian()"></image>
- <input type="number" class="input" v-model="nun" v-if="nun > 0" disabled>
- <image src="../../static/img/add.png" mode="" @click="add()"></image>
- </view>
- </view>
- <u-loadmore :status="tabItem.loadingType" />
- <view class="tc" style="height: 100rpx;"></view>
-
- </scroll-view>
- </swiper-item>
- </swiper>
- <view class="sub-btn">
- <view class="sub-info">
- 合计:<input type="number" >
- </view>
- <view class="sub" @click="sub">
- 结算(2)
- </view>
- </view>
- <u-modal
- v-model="tip_show"
- @confirm="ok()"
- @cancel="cancel()"
- :show-cancel-button="true"
- cancel-text="取消"
- confirm-text="确认"
- content="确认添加这些商品吗"
- title="确认"
- confirm-color="#FF5454"
- ></u-modal>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- tip_show: false,
- nun: 0,
- height: '',
- tabCurrentIndex: 0,
- navlist: [{
- status: 0,
- title: '服务项目',
- list: 10,
- page: 1,
- limit: 10,
- loaded: false,
- loadingType: 'loadmore'
- },
- {
- status: 1,
- title: '实体商品',
- list: [],
- page: 1,
- limit: 10,
- loaded: false,
- loadingType: 'loadmore'
- }
- ]
- }
- },
- onLoad(opt) {
- },
- onShow() {
- },
- onReachBottom() {
- },
- onReady() {
- var _this = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper-box').boundingClientRect();
- query.exec(function(res) {
- _this.height = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', _this.height);
- });
- },
- fail: res => {}
- });
- },
- methods: {
- // 减少商品
- jian() {
- this.nun--
- },
- // 增加商品
- add() {
- this.nun++
- },
- //顶部tab点击
- tabClick(index) {
- this.tabCurrentIndex = index;
- // this.loadData('tab')
- },
- // 获取数据
- loadData(type) {
- let that = this
- let index = that.tabCurrentIndex
- let item = that.navlist[index]
- if (type == 'reload') {
- item.loaded = false
- item.loadingType = 'more'
- item.page = 1
- item.list = []
- }
- if (type == 'tab' && item.loaded) {
- return
- }
- if (item.loadingType == 'loading' || item.loadingType == 'noMore') {
- return
- }
- item.loadingType = 'loading'
- },
- sub() {
- this.tip_show = true
- },
- ok() {
-
- },
- cancel() {
-
- }
- }
- }
- </script>
- <style lang="scss">
- .navbar {
- display: flex;
- height: 88rpx;
- padding: 0 5px;
- background: #fff;
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
- position: relative;
- z-index: 10;
- .nav-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- font-size: 15px;
- color: #999999;
- position: relative;
- &.current {
- color: #FD463E;
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 44px;
- height: 0;
- border-bottom: 2px solid #FD463E;
- }
- }
- }
- }
- .good {
- width: 690rpx;
- margin: 20rpx auto;
- display: flex;
- justify-content: flex-start;
- padding: 20rpx;
- background-color: #fff;
- border-radius: 20rpx;
- position: relative;
- .add-jian-wrap {
- position: absolute;
- // top: ;
- bottom: 30rpx;
- right: 50rpx;
- width: 150rpx;
- height: 44rpx;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- image {
- width: 44rpx;
- height: 44rpx;
- flex-shrink: 0;
- }
- .input {
- // display: flex;
- text-align: center;
- line-height: 44rpx;
- flex-grow: 1;
- font-size: 36rpx;
- font-weight: bold;
- color: #333333;
- }
- }
- .good-check {
- position: absolute;
- bottom: 20rpx;
- right: 20rpx;
- }
- .good-img {
- width: 256rpx;
- height: 256rpx;
- background: #D6DEE1;
- border-radius: 15rpx;
- flex-shrink: 0;
- margin-right: 15rpx;
- }
- .good-info {
- display: flex;
- flex-direction: column;
- // align-items: ;
- justify-content: space-between;
- align-items: flex-start;
- .good-tit {
- font-size: 28rpx;
- font-weight: 500;
- color: #333333;
- }
- .good-buy {
- font-size: 24rpx;
- font-weight: 500;
- color: #9a9a9a;
- }
-
- .good-tip {
- font-size: 24rpx;
- font-weight: 500;
- color: #FA7014;
- }
- .good-price {
- color: #fd463e;
- font-size: 32rpx;
- &::before {
- content: '¥';
- font-size: 22rpx;
- color: #fd463e;
- }
- text {
-
- }
- }
-
- }
-
- }
- .sub-btn {
- width: 750rpx;
- height: 100rpx;
- background: #FFFFFF;
- position: fixed;
- bottom: 0;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 30rpx;
- .sub-info {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- input {
- color: #FF4C4C;
- font-size: 32rpx;
- font-weight: bold;
- }
- }
- .sub {
- width: 220rpx;
- height: 80rpx;
- line-height: 80rpx;
- background: #FF4C4C;
- border-radius: 40rpx;
- font-size: 32rpx;
- font-weight: bold;
- color: #FFFFFF;
- text-align: center;
- }
- }
- </style>
|