123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <template>
- <view class="goods-page">
- <u-navbar
- height="40px"
- title="货物信息录入"
- bgColor="#fff"
- autoBack
- placeholder
- >
- <view class="u-nav-slot depot-label" slot="right" @click="stashClick">
- <view class="name">{{ curDepotName }}</view>
- </view>
- </u-navbar>
- <view class="container_main">
- <u-sticky :offsetTop="offsetTop" bgColor="#fff">
- <view class="search-box">
- <u-search
- placeholder="请输入单据编号或名称"
- shape="square"
- v-model="query.number"
- :showAction="false"
- :clearabled="true"
- @search="handleSearch"
- @clear="handleSearch"
- ></u-search>
- </view>
- </u-sticky>
- <view class="content-box">
- <view class="content-box-val"> </view>
- <u-empty
- mode="data"
- text="暂无内容"
- marginTop="60"
- icon="https://xiangli-erp.oss-cn-hangzhou.aliyuncs.com/APP/no-notifcations.png"
- v-if="list.length == 0"
- ></u-empty>
- <!-- 加载更多 -->
- <u-loadmore
- v-if="list.length > 0"
- :status="loadStatus"
- @loadmore="onLoadMore"
- />
- </view>
- </view>
- <error-pop
- v-model="actionPop.errorShow"
- isCenter
- cancelBtnText="取消"
- confirmBtnText="确定"
- @close="actionPop.errorShow = false"
- @confirm="submit"
- :content="actionPop.errorText"
- ></error-pop>
- </view>
- </template>
- <script>
- import checkItem from "./components/check-item.vue";
- import {
- taskStocktakingList,
- startTask,
- taskComplete,
- taskStocktakingDetail,
- } from "@/common/request/apis/inventoryTask";
- import { mapGetters } from "vuex";
- export default {
- components: {
- checkItem,
- errorPop,
- },
- data() {
- return {
- offsetTop: 0,
- query: {
- number: "",
- },
- currentPage: 1,
- pageSize: 10,
- loadStatus: "loadmore", //加载前值为loadmore,加载中为loading,没有数据为nomore
- list: [],
- // 中心仓
- cangName: "",
- };
- },
- computed: {
- ...mapGetters(["depotInfo"]),
- curDepotId() {
- return this.depotInfo ? this.depotInfo.id : "";
- },
- curDepotName() {
- return this.depotInfo ? this.depotInfo.depotName : "";
- },
- },
- onLoad() {
- let systemInfo = uni.getSystemInfoSync();
- let statusBarHeight = systemInfo.statusBarHeight;
- this.offsetTop = statusBarHeight + 40;
- this.loadData();
- },
- onShow() {},
- onPullDownRefresh() {
- // 下拉刷新
- this.onRefresh();
- },
- onReachBottom() {
- // 触底加载更多
- this.onLoadMore();
- },
- methods: {
- async onRefresh() {
- try {
- await this.loadData(true);
- } finally {
- uni.stopPullDownRefresh();
- }
- },
- async onLoadMore() {
- if (this.loadStatus !== "loadmore") return;
- this.loadStatus = "loading";
- try {
- await this.loadData();
- } catch (e) {
- this.loadStatus = "loadmore";
- }
- },
- async loadData(isRefresh = false) {
- if (isRefresh) {
- this.currentPage = 1;
- this.list = [];
- }
- try {
- this.loadStatus = "loading";
- const currentPage = this.currentPage;
- const pageSize = this.pageSize;
- const params = {
- currentPage,
- pageSize,
- ...this.query,
- depotId: this.curDepotId,
- };
- console.log("params=====", params);
- const res = await taskStocktakingList(params);
- const { rows, total } = res.data;
- this.list = [...this.list, ...rows];
- if (currentPage * pageSize < Number(total)) {
- this.currentPage++;
- this.loadStatus = "loadmore";
- } else {
- this.loadStatus = "nomore";
- }
- } catch (error) {}
- },
- handleSearch(value) {
- this.loadData(true);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .goods-page {
- min-height: 100vh;
- background-color: #f0f6fb;
- .container_main {
- .search-box {
- background-color: rgba(191, 200, 219, 0.2);
- margin: 0 32rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-radius: 8rpx;
- ::v-deep .u-search__content {
- background-color: transparent !important;
- .u-search__content__input {
- background-color: transparent !important;
- }
- }
- .scan-icon {
- width: 100rpx;
- height: 100%;
- image {
- width: 40rpx;
- height: 40rpx;
- }
- }
- }
- .content-box {
- padding: 24rpx;
- &-val {
- border-radius: 16rpx 16rpx 0 0;
- overflow: hidden;
- }
- }
- }
- }
- </style>
|