stockquery.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view class="order-list content" :class="shelfShow ?'popupShow':''">
  3. <u-sticky bgColor="#fff">
  4. <view class="search-wrap">
  5. <view class="input-wrap">
  6. <u-search
  7. bgColor='#fff'
  8. :showAction='false'
  9. placeholder="搜索备件编号"
  10. @search="searchList"
  11. @clear='searchList'
  12. v-model="code">
  13. </u-search>
  14. <view class="search-btn" @click="searchList">{{$t("customer_meter.search")}}</view>
  15. </view>
  16. <!-- <uni-icons type="plus" size='32' @click="onClickRight"></uni-icons> -->
  17. </view>
  18. </u-sticky>
  19. <view class="swiper-box">
  20. <template v-if="tableData.length">
  21. <u-list @scrolltolower="scrolltolower" :preLoadScreen="1.5">
  22. <u-list-item v-for="(item, index) in tableData" :key="index">
  23. <view class="order-card">
  24. <view class="order-card-title">
  25. 备件编号:{{item.code}}
  26. </view>
  27. <view class="order-info">
  28. <p class="info-line">
  29. <text class="label">备件名称:</text>
  30. <text class="info">{{item.name || ''}}</text>
  31. </p>
  32. <p class="info-line">
  33. <text class="label">所属仓库:</text>
  34. <text class="info">{{item.storeName || ''}}</text>
  35. </p>
  36. <p class="info-line">
  37. <text class="label">当前库存:</text>
  38. <text class="info" >{{item.totalNum }}</text>
  39. </p>
  40. <p class="info-line">
  41. <text class="label">货架查看:</text>
  42. <u-icon class="info" name="list" size="30" @click="openShelf(item)" color="#2979ff"></u-icon>
  43. </p>
  44. <p class="info-line">
  45. <text class="label">规格型号:</text>
  46. <text class="info">{{item.spec || ''}}</text>
  47. </p>
  48. <p class="info-line">
  49. <text class="label">计量单位:</text>
  50. <text class="info">{{getLabel(item.unit,unitList)}}</text>
  51. </p>
  52. </view>
  53. <view>
  54. <view class="card-oper">
  55. <view class="btn">
  56. <u-button type='primary' color='#4680F9' size="small" @click="toDetail(item)">库存动态</u-button>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </u-list-item>
  62. </u-list>
  63. </template>
  64. <template v-else>
  65. <u-empty mode="list" icon="https://cdn.uviewui.com/uview/empty/list.png">
  66. </u-empty>
  67. </template>
  68. </view>
  69. <u-loading-page
  70. color="#666"
  71. loading-mode="semicircle"
  72. :loading="loading">
  73. </u-loading-page>
  74. <u-popup :show="shelfShow" mode="center" @close="shelfShow = false" >
  75. <view class="picker-card">
  76. <view style="height:100%;overflow-y:auto;display:block">
  77. <view class="order-card shelf-card" v-for="(item, index) in currentRow.materialShelves" :key="index">
  78. <view class="order-info">
  79. <p class="info-line">
  80. <text class="label">货架:</text>
  81. <text class="info">{{item.shelf}}</text>
  82. </p>
  83. <p class="info-line">
  84. <text class="label">货层:</text>
  85. <text class="info">{{item.floor}}</text>
  86. </p>
  87. <p class="info-line">
  88. <text class="label">货位:</text>
  89. <text class="info">{{item.seat}}</text>
  90. </p>
  91. <p class="info-line">
  92. <text class="label">附加码:</text>
  93. <text class="info">{{item.sign}}</text>
  94. </p>
  95. <p class="info-line">
  96. <text class="label">数量:</text>
  97. <text class="info">{{item.shelfNum}}</text>
  98. </p>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="card-oper">
  103. <view class="btn">
  104. <u-button type='primary' @click="shelfShow = false">{{$t('settings.confirmText')}}</u-button>
  105. </view>
  106. </view>
  107. </view>
  108. </u-popup>
  109. </view>
  110. </template>
  111. <script>
  112. import {request} from '../../utils/request'
  113. import { getLabel } from '../../utils/util'
  114. import {materialLiveList} from '../../api/stock'
  115. export default {
  116. components:{
  117. },
  118. data() {
  119. return {
  120. getLabel,
  121. shelfShow:false,
  122. tableData:[],
  123. loading:false,
  124. code:'',
  125. hasMore:false,
  126. page: {
  127. pages: 1,
  128. size: 10,
  129. },
  130. unitList:[],
  131. currentRow:{},
  132. };
  133. },
  134. onLoad(options) {
  135. this.getList()
  136. this.getOption()
  137. },
  138. // onShow() {
  139. // this.getList()
  140. // },
  141. methods: {
  142. //获取单位
  143. getOption(){
  144. request({
  145. url:'/admin/dict/type/spare_unit',
  146. method:'get',
  147. })
  148. .then(res=>{
  149. if(res.data.code == 0){
  150. this.unitList = res.data.data
  151. }
  152. })
  153. },
  154. //打开货架
  155. openShelf(item){
  156. console.log(item);
  157. this.currentRow = item
  158. this.shelfShow = true
  159. },
  160. //查看明细
  161. toDetail(item){
  162. uni.navigateTo({ url: `/subpages/spare/dynamics?materialId=${item.id}&store=${item.store}`})
  163. },
  164. //搜索列表
  165. searchList(){
  166. this.page.pages = 1
  167. this.hasMore = false
  168. this.getList()
  169. },
  170. //获取订单列表
  171. getList() {
  172. this.loading = true
  173. let data = {
  174. current: this.page.pages,
  175. size: this.page.size,
  176. code:this.code || '' ,
  177. kind:'11'
  178. };
  179. materialLiveList(data).then((res) => {
  180. if (res.data.code == 0) {
  181. if (this.hasMore) {
  182. this.tableData = [
  183. ...this.tableData,
  184. ...res.data.data.records,
  185. ];
  186. } else {
  187. this.tableData = res.data.data.records;
  188. }
  189. console.log(this.tableData);
  190. this.total = res.data.data.total;
  191. if (this.tableData.length >= this.total) {
  192. this.hasMore = false;
  193. } else {
  194. this.hasMore = true;
  195. }
  196. this.loading = false
  197. }
  198. });
  199. },
  200. //加载更多
  201. scrolltolower() {
  202. if (this.hasMore) {
  203. this.page.pages += 1;
  204. this.getList();
  205. }
  206. },
  207. },
  208. };
  209. </script>
  210. <style>
  211. /* #ifndef APP-NVUE */
  212. view {
  213. /* display: flex; */
  214. box-sizing: border-box;
  215. /* flex-direction: column; */
  216. }
  217. page {
  218. box-sizing: border-box;
  219. /* padding: 40rpx 40rpx 80rpx; */
  220. height: 100%;
  221. }
  222. /* #endif*/
  223. </style>
  224. <style lang="scss" scoped>
  225. @import '../../common/css/public.scss';
  226. .order-list {
  227. // height: calc(100vh - var(--window-top)) ;
  228. // overflow: hidden;
  229. background-color: #f8f8f8;
  230. .qrcode-wrap{
  231. padding: 24rpx;
  232. text-align: center;
  233. .info-line{
  234. text-align: center;
  235. font-size: 32rpx;
  236. margin-top: 24rpx;
  237. }
  238. }
  239. }
  240. .popupShow {
  241. overflow: hidden;
  242. position: fixed;
  243. }
  244. .picker-card{
  245. padding: 32rpx 32rpx 144rpx;
  246. position: relative;
  247. height: 100%;
  248. overflow-y: scroll;
  249. display: block;
  250. .card-oper{
  251. position: absolute;
  252. width: 100%;
  253. bottom: 0;
  254. left:0;
  255. display: flex;
  256. flex-direction: row;
  257. justify-content: space-between;
  258. padding: 24rpx;
  259. .btn{
  260. width: 100%;
  261. }
  262. }
  263. }
  264. /deep/ .u-popup__content{
  265. height: 70%;
  266. overflow-y: scroll;
  267. border-radius: 6px;
  268. width: 90%;
  269. }
  270. .shelf-card{
  271. margin: 0 0 24rpx;
  272. display: block;
  273. .order-info{
  274. display: flex;
  275. flex-direction: row;
  276. flex-wrap: wrap;
  277. .info-line{
  278. width: 50%;
  279. .label{
  280. width: 120rpx;
  281. }
  282. }
  283. }
  284. }
  285. </style>