123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <template>
- <!-- 冷冻柜管理、 -->
- <view>
- <u-navbar autoBack placeholder></u-navbar>
- <u-sticky :customNavHeight="navbarHeight()">
- <view class="search_card">
- <u-search :showAction="false" v-model="keyword" @change="searchChange"
- placeholder="输入关键字快速查找"></u-search>
- </view>
- </u-sticky>
- <view class="card_incubator" v-if="orderList.length > 0">
- <view class="item_bator_cold" v-for="(item,index) in orderList" :key="index"
- @click.stop="selectIncubator(item)">
- <view style="display: flex;align-items: center;">
- <span class="iconfont icon-binggui" :class="iceColdFlag ? 'imagebwx' : 'imagebwx_cold'"></span>
- <view>{{item.name}}</view>
- </view>
- </view>
- <view style="width: 100%;">
- <u-loadmore lineColor="#ffffff" :status="loadStatus" :key="Math.random()" />
- </view>
- </view>
- <view style="margin-top: 20%;" v-else>
- <u-empty mode="list" text="暂无保温箱"></u-empty>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- keyword: '',
- currentPage: 1,
- pageSize: 15,
- loadingMore: true,
- loadStatus: 'loadmore', //loading 、nomore
- orderList: [],
- // 是否释冷
- iceColdFlag: true,
- detailsFlag: false,
- }
- },
- onReachBottom() {
- if (!this.loadingMore) {
- this.getIncubator()
- }
- },
- onLoad(option) {
- if (option.detailsFlag) {
- this.detailsFlag = true
- }
- },
- mounted() {
- this.getIncubator()
- },
- methods: {
- // 搜索
- searchChange(value) {
- this.currentPage = 1
- this.orderList = []
- this.loadingMore = true
- this.getIncubator()
- },
- // 获取保温箱
- getIncubator() {
- this.loadStatus = 'loading'
- this.loadingMore = true
- this.$api.get('/api/ice-locker', {
- page: this.currentPage,
- pageSize: this.pageSize,
- name: this.keyword,
- status: '2',
- }).then(res => {
- if (res.code == 200) {
- const data = res.data.list
- if (this.loadingMore == true && data) {
- this.orderList = this.orderList.concat(data);
- // console.log(this.orderList, 245)
- }
- if (data.length < this.pageSize) {
- this.loadingMore = true
- this.loading = '没有更多了'
- this.loadStatus = 'nomore'
- } else {
- this.loading = '加载中'
- this.loadStatus = 'loading'
- this.loadingMore = false
- this.currentPage++
- }
- }
- })
- },
- // 选择保温箱
- selectIncubator(value) {
- if (this.detailsFlag) {
- uni.navigateTo({
- url: '/pages/order/freezer?name=' + value.name + '&freezerId=' + value.id
- });
- } else {
- uni.setStorageSync('freezerValue', value)
- uni.navigateBack({
- delta: 1
- });
- }
- },
- navbarHeight() {
- let systemInfo = uni.getSystemInfoSync();
- /* (750 / systemInfo.windowWidth) */
- /* 在uview navBar组件中有一个默认高度,当这个默认高度加上状态栏高度后就是吸顶的位置,由于这两者相加是px,所以最后还需要转为rpx */
- let topHeight = 0
- // #ifdef APP-PLUS
- topHeight = 44 + systemInfo.statusBarHeight;
- // #endif
- // #ifdef MP
- let height = systemInfo.platform == 'ios' ? 44 : 48;
- topHeight = height + systemInfo.statusBarHeight
- // #endif
- /* 最后一步将px转为rpx */
- return topHeight * (750 / systemInfo.windowWidth) / 2
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .card_incubator {
- display: flex;
- flex-direction: column;
- margin-top: 10rpx;
- }
- .search_card {
- background-color: #fff;
- padding: 20rpx;
- }
- .item_bator {
- display: flex;
- flex-direction: column;
- background-color: #fff;
- border-radius: 10rpx;
- padding: 15rpx;
- margin: 10rpx 20rpx;
- }
- .item_bator_cold {
- display: flex;
- flex-direction: column;
- background-color: #fff;
- border-radius: 10rpx;
- padding: 30rpx;
- margin: 10rpx 20rpx;
- }
- .imagebwx {
- color: #2b85e4;
- font-size: 60rpx;
- margin-right: 20rpx;
- }
- .imagebwx_cold {
- color: #2b85e4;
- font-size: 70rpx;
- margin-right: 20rpx;
- }
- </style>
|