From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- pages/product/feed/locationList.vue | 196 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 196 insertions(+), 0 deletions(-) diff --git a/pages/product/feed/locationList.vue b/pages/product/feed/locationList.vue new file mode 100644 index 0000000..3ca8fde --- /dev/null +++ b/pages/product/feed/locationList.vue @@ -0,0 +1,196 @@ +<template> + <view class="wrap"> + <view class="search"> + <u-search v-model="keywords" placeholder="璇疯緭鍏ュ簱浣嶅悕绉�" @clear="search" @custom="search" @search="search"> + </u-search> + </view> + <scroll-view class="scroll-list" scroll-y="true" > + <u-cell-group class="list" :border="false"> + <view v-if="locationList==0" class="nodata"> + <view>鏈煡鍒版暟鎹�</view> + </view> + <view v-else class="content" v-for="(item, index) in locationList" :key="item.locNo" :index="index" + @click="selectLocation(item)"> + <view class="row-list"> + <view class="_label"> + 搴撲綅缂栧彿: + </view> + <view class="_content"> + {{ item.locNo }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + 搴撲綅鍚嶇О: + </view> + <view class="_content"> + {{ item.locName }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + 搴撲綅绫诲瀷: + </view> + <view class="_content"> + {{ getLocTypeName(item.locType)}} + </view> + </view> + <view class="row-list"> + <view class="_label"> + 搴撲綅鐘舵��: + </view> + <view class="_content"> + {{getLocStatus(item.locStatus)}} + </view> + </view> + </view> + </u-cell-group> + </scroll-view> + <scan></scan> + </view> +</template> +<script> + import scan from "@/components/scan/scan.vue"; + export default { + components: { + scan + }, + data() { + return { + originList: [], + locationList: [], + keywords: "", + dictType: "warehouse_type", + listLocType: [] + }; + }, + onLoad(params) { + + //鑾峰彇鏁� 搴撲綅鐘舵�� + this.$u.api.dictData({ + dictType: this.dictType + }).then(res => { + this.listLocType = res.data; + + }); + + if (params && params.workstationNo !== "undefined") { + this.loadList(params.workstationNo); + } + + }, + onShow() { + + let that = this + + uni.$off('scan') // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒 + uni.$on('scan', function(data) { + console.log('onscan'); + //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲� + console.log('鎵爜缁撴灉锛�', data.code); + that.search(data.code); + }) + }, + onNavigationBarButtonTap(e) { + uni.scanCode({ + success: res => { + try { + const result = JSON.parse(res.result) + + } catch (e) {} + } + }); + }, + methods: { + getLocTypeName(locType) { + let reDate = "" + let that = this + //鍒ゆ柇鏁扮粍涓槸鍚﹀瓨鍦� + let list = that.listLocType.filter(item => item.value == locType) + if (list.length > 0) { + reDate = list[0].label + } + return reDate + }, + getLocStatus(locStatus) { + let reDate = "" + switch (locStatus) { + case 1: + reDate = "浣跨敤"; + break; + case 0: + reDate = "鍋滅敤"; + break; + } + + return reDate; + }, + selectLocation(location) { + this.refreshLastPage(location) + }, + //鍒锋柊涓婁竴涓〉闈� + refreshLastPage(location) { + // 鍛婄煡 A.vue 鏇存柊鏁版嵁 + // 鑾峰彇椤甸潰鏍� + let pages = getCurrentPages() + + // 鑾峰彇涓婁竴椤垫爤 + let prevPage = pages[pages.length - 2] + + // 瑙﹀彂涓婁竴椤� upData 鍑芥暟(骞舵惡甯﹀弬鏁�) + prevPage.$vm.setLocation(location) + + // 杩斿洖涓婁竴椤� + uni.navigateBack({ + delta: 1 + }) + }, + search(value) { + let that = this + if (value) { + that.locationList = that.originList.filter(item => item.locName.includes(value)) + } else { + that.locationList = that.originList + } + }, + loadList(workstationNo) { + let params = { + workstationNo: workstationNo + } + //鏍规嵁宸ヤ綔绔欑紪鍙疯幏鍙栬繘琛屼腑鐨勫伐鍗�&&瀵瑰簲鐨勭嚎杈逛粨 + this.$u.api.pigxFeed.getBasicInfoForPdaFeedByWorkstationNo(params).then(res => { + this.originList = res.data.locationList + this.locationList = this.originList + }); + }, + } + }; +</script> +<style lang="scss"> + .list .content { + font-size: 12px; + background-color: #efefef; + box-sizing: border-box; + border-radius: 14rpx; + margin: 8px; + padding: 5px 10px; + box-shadow: none; + } + + .row-list { + display: flex; + flex-direction: row; + } + + .row-list ._label { + flex: 0.8; + color: #909399; + } + + .row-list ._content { + flex: 1.5; + text-align: right; + } + + .nodata{width: 20%;margin: auto;} +</style> -- Gitblit v1.9.3