123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <template>
- <!-- 冰排管理、 -->
- <view>
- <u-navbar autoBack placeholder @rightClick="rightClick">
- <view class="u-nav-slot" slot="right">
- <u-icon name="plus-circle" size="20"></u-icon>
- <span>添加</span>
- </view>
- </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" v-for="(item,index) in orderList" :key="index">
- <span class="iconfont imagebwx icon-bingpaiguanli"></span>
- <view style="width: 100%;">
- <view class="space_between">
- <view class="title_ice">{{item.code}}</view>
- <view :style="{color:geticeColor(item.status)}">{{geticeState(item.status)}}</view>
- </view>
- <view class="space_between">
- <view class="title_ice1">冷冻要求:{{item.freezeClaim}}</view>
- <view class="card_btn_emit center_in" @click="selectIncubator(item)">
- 编辑<u-icon name="edit-pen" size="26"></u-icon>
- </view>
- </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: 10,
- loadingMore: true,
- loadStatus: 'loadmore', //loading 、nomore
- incubatorValue: '',
- orderList: [],
- detailsFlag: false,
- }
- },
- onReachBottom() {
- if (!this.loadingMore) {
- this.getIncubator()
- }
- },
- mounted() {
- this.getIncubator()
- },
- methods: {
- rightClick() {
- uni.navigateTo({
- url: '/pages/order/addIceRaft'
- });
- },
- // 搜索
- searchChange(value) {
- this.currentPage = 1
- this.orderList = []
- this.loadingMore = true
- this.getIncubator()
- },
- // 获取冰排
- getIncubator() {
- this.loadStatus = 'loading'
- this.loadingMore = true
- this.$api.get('/api/ice-raft', {
- page: this.currentPage,
- pageSize: this.pageSize,
- code: this.keyword,
- }).then(res => {
- if (res.code == 200) {
- const data = res.data.list
- if (this.loadingMore == true && data) {
- this.orderList = this.orderList.concat(data);
- }
- 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) {
- let arr = {
- id: value.id,
- code: value.code,
- status: value.status,
- freezeClaim: value.freezeClaim,
- }
- uni.navigateTo({
- url: '/pages/order/addIceRaft?list=' + JSON.stringify(arr)
- });
- console.log(value, '详情')
- },
- geticeState(event) {
- let title = ''
- if (event == '2') {
- title = '正常'
- } else {
- title = '停用'
- }
- return title
- },
- geticeColor(event) {
- let color = ''
- if (event == '2') {
- color = '#19be6b'
- } else {
- color = '#fa3534'
- }
- return color
- },
- 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;
- align-items: center;
- background-color: #fff;
- border-radius: 10rpx;
- padding: 30rpx;
- margin: 10rpx 20rpx;
- }
- .imagebwx {
- color: #19be6b;
- font-size: 80rpx;
- margin-right: 20rpx;
- }
- .title_ice {
- font-size: 32rpx;
- }
- .title_ice1 {
- font-size: 30rpx;
- }
- .space_between {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- }
- .u-nav-slot {
- display: flex;
- align-items: center;
- span {
- font-size: 32rpx;
- margin-left: 5rpx;
- }
- }
- .card_btn_emit {
- margin-top: 4rpx;
- display: flex;
- justify-content: flex-end;
- width: 150rpx;
- color: #606266;
- font-size: 30rpx;
- border-radius: 40rpx;
- }
- </style>
|