123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <template>
- <view class="container">
- <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
- :placeholder="true" :title="title"></u-navbar>
- <view class="content">
- <scroll-view class="scrollview" :scroll-with-animation="true" scroll-y lower-threshold="100"
- @scrolltolower="scrolltolower" :style="{height:fullHeight}">
- <view v-if="list.length>0">
- <block v-for="(item,index) in list" :key="index">
- <view class="equipment-container" @click="details(item)">
- <view class="flex align-center justify-between">
- <view class="title" v-if="type==0">
- {{item.deviceName}}<text>{{item.deviceId}}</text>
- </view>
- <view class="title" v-else>{{item.goodsName}}</view>
- </view>
-
- <view class="flex align-center">
- <view class="" v-if="type==1" style="margin-right: 30rpx;margin-top: 20rpx;">
- <u--image width="110rpx" height="110rpx" :src="item.cover" mode="widthFix" :lazy-lord="true">
- </u--image>
- </view>
- <view class="">
- <view class="order-detail-item">
- <view>缺货:</view>{{item.lackSum}}
- </view>
-
- <view class="order-detail-item">
- <view>库存:</view>{{item.stockSum}}
- </view>
-
- <view class="order-detail-item">
- <view>容量:</view>{{item.capacitySum}}
- </view>
-
- <view class="order-detail-item percent">
- <view>缺货占比:</view>{{item.percent}}%
- </view>
- </view>
- </view>
- </view>
- </block>
- </view>
- <view v-else class='empty'>
- <u-empty mode="data" text="数据为空"></u-empty>
- </view>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- import {
- stockByGoodsDetail,
- stockByDeviceDetail
- } from '@/api/replenishment/replenishment.js'
- export default {
- data() {
- return {
- fullHeight: 0,
- id: null,
- type: null,
- list: {},
- title:null
- }
- },
- onLoad(o) {
- let _this = this;
- const query = uni.createSelectorQuery().in(this);
- query.select(".scrollview").boundingClientRect((data) => {
- uni.getSystemInfo({
- success(res) {
- // 针对iPhone X等机型底部安全距离做适配
- const model = res.model;
- const modelInclude = [
- "iPhone X",
- 'iPhone XR',
- "iPhone XS",
- "iPhone XS MAX",
- "iPhone 12/13 mini",
- "iPhone 12/13 (Pro)",
- "iPhone 12/13 Pro Max",
- "iPhone 14 Pro Max"
- ];
- let safeDistance = modelInclude.includes(model)
- //动态设置商品区域高度
- console.log(res.windowHeight, data.top)
- if (safeDistance) {
- _this.fullHeight = res.windowHeight - data.top - 40 + 'px';
- } else {
- _this.fullHeight = res.windowHeight - data.top + 'px';
- }
- },
- });
- }).exec();
- this.id = o.id
- this.type = o.type
- this.title=o.title
- if (this.type == 0) {
- this.getDetailByGoods()
- } else {
- this.getDetailByDev()
- }
- },
- methods: {
- getDetailByGoods() {
- stockByGoodsDetail({
- goodsId: this.id
- }).then(res => {
- this.list = res.data
- })
- },
- getDetailByDev() {
- stockByDeviceDetail({
- deviceId: this.id
- }).then(res => {
- this.list = res.data
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .container {
- .content {
- .equipment-container {
- margin: 13rpx 13rpx 0;
- padding: 12rpx 20rpx 24rpx;
- border-radius: 14rpx;
- background-color: #fff;
- box-shadow: 0px 0px 10rpx 0px rgba(174, 201, 255, 0.2);
- position: relative;
-
- .sb-box {
- padding: 24rpx 18rpx;
- background-color: #f5f8fb;
- border-radius: 8rpx;
- margin-top: 12rpx;
- }
-
- .title {
- height: 60rpx;
- line-height: 60rpx;
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
-
- >text {
- font-size: 24rpx;
- color: #333;
- }
- }
-
- .order-detail-item {
- font-size: 28rpx;
- margin-top: 12rpx;
- color: #777;
-
- >view {
- display: inline-block;
- width: 170rpx;
- }
- }
-
- .percent {
- position: absolute;
- right: 40rpx;
- bottom: 20rpx;
- line-height: 140rpx;
- color: red;
-
- >view {
- color: #777;
- width: 150rpx;
- }
- }
- }
- }
- }
- </style>
|