chooseProduct.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="moreShelfPart flex flex_column">
  3. <view class="moreShelfPart-search">
  4. <u-search
  5. placeholder="请输入货位号/产品编码/产品名称搜索"
  6. v-model="queryWord"
  7. :show-action="isGobleSearch"
  8. @focus="isGobleSearch=true"
  9. @custom="searchPart"
  10. @search="searchPart"
  11. @clear="searchPart"
  12. :action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': '#57a3f3', 'border-radius': '6upx', 'padding': '12upx 0'}">
  13. </u-search>
  14. <view class="p-title">
  15. <text></text>
  16. 西安车领主常青二路数字货架
  17. </view>
  18. </view>
  19. <view class="moreShelfPart-body">
  20. <scroll-view
  21. class="nav-right"
  22. scroll-y
  23. @scrolltolower="onreachBottom">
  24. <view class="partList-list-box" v-for="item in partList" :key="item.id">
  25. <view class="product flex align_center">
  26. <view class="flex align_center flex_1">
  27. <view class="pimgs">
  28. <u-image width="128" height="128" border-radius="10"></u-image>
  29. </view>
  30. <view class="pinfo">
  31. <view class="pname">
  32. 箭牌机油滤清器10款进口大众途锐 5.0L V10 TDI
  33. </view>
  34. <view class="ptxt flex align_center justify_between">
  35. <view>
  36. <text class="pcode">JB-11066A</text>
  37. </view>
  38. <view>
  39. 库存数量:<text class="pnums">3个</text>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="ptools flex align_center justify_between">
  46. <view></view>
  47. <view class="print" @click="print(item)">
  48. <u-image :src="`/static/${$config('themePath')}/icon_printer@3x.png`" width="48" height="48"></u-image>
  49. </view>
  50. </view>
  51. </view>
  52. <view v-if="partList&&partList.length==0">
  53. <u-empty v-if="status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" mode="list" :margin-top="50"></u-empty>
  54. </view>
  55. <view style="padding: 20upx;" v-if="total>pageSize || status=='loading'">
  56. <u-loadmore :status="status" />
  57. </view>
  58. </scroll-view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import { getShelfList } from '@/api/shelf'
  64. export default {
  65. data() {
  66. return {
  67. queryWord: '',
  68. isGobleSearch: false,
  69. partList: [],
  70. pageNo:1,
  71. pageSize: 10,
  72. total: 0, // 列表总数
  73. noDataText: '暂无货架',
  74. status: 'loading',
  75. vinstatus: 'loading'
  76. }
  77. },
  78. onLoad(opts) {
  79. this.getpartList()
  80. },
  81. methods: {
  82. clearSearch(){
  83. this.queryWord = ''
  84. this.pageNo = 1
  85. this.partList = []
  86. },
  87. // 搜索配件
  88. searchPart(){
  89. if(this.queryWord != ''){
  90. this.clearSearch()
  91. this.getpartList()
  92. }
  93. },
  94. // 获取数字货架列表
  95. getpartList(){
  96. const _this = this
  97. let params = {
  98. pageNo: this.pageNo,
  99. pageSize: this.pageSize,
  100. queryWord: this.queryWord
  101. }
  102. _this.status = 'loading'
  103. getShelfList(params).then(res => {
  104. uni.hideLoading()
  105. if(res.status == 200){
  106. let list = res.data.list
  107. if (list && list.length){
  108. // 分页 拼接数据
  109. if (_this.pageNo != 1) {
  110. _this.partList = _this.partList ? _this.partList.concat(list) : list
  111. } else {
  112. _this.partList = list
  113. }
  114. this.total = res.data.count
  115. if (_this.partList.length == res.data.count) {
  116. _this.status = 'nomore'
  117. } else {
  118. _this.status = 'loadmore'
  119. }
  120. } else {
  121. _this.partList = list || []
  122. this.total = 0
  123. _this.status = 'nomore'
  124. }
  125. _this.noDataText = '暂无配件'
  126. }else{
  127. _this.status = 'loadmore'
  128. _this.partList = []
  129. _this.total = 0
  130. _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
  131. }
  132. })
  133. },
  134. // 加载更多
  135. onreachBottom () {
  136. if(this.partList.length < this.total ){
  137. if(this.isGobleSearch&&this.queryWord==''){
  138. return
  139. }
  140. this.pageNo++
  141. this.getpartList()
  142. }else{
  143. this.status = "nomore"
  144. }
  145. },
  146. print(item){
  147. uni.navigateTo({
  148. url: "/pages/common/printTag/printTag?id="+item.id
  149. })
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="less">
  155. .moreShelfPart{
  156. width: 100%;
  157. height: 100vh;
  158. .moreShelfPart-search{
  159. padding: 20rpx 20rpx 0;
  160. background-color: #FFFFFF;
  161. border-bottom: 2rpx solid #f5f5f5;
  162. }
  163. .p-title{
  164. padding: 20rpx;
  165. display: flex;
  166. align-items: center;
  167. color: #222;
  168. font-size: 32rpx;
  169. text{
  170. display: block;
  171. height: 32rpx;
  172. width: 6rpx;
  173. background: #0485F6;
  174. margin-right: 10rpx;
  175. border-radius: 10rpx;
  176. }
  177. }
  178. .moreShelfPart-body{
  179. flex-grow: 1;
  180. background-color: #fff;
  181. }
  182. .nav-right{
  183. padding: 0 30upx;
  184. height: calc(100vh - 180rpx);
  185. box-sizing: border-box;
  186. .partList-list-box{
  187. padding: 10px 0;
  188. border-bottom: 2rpx solid #f5f5f5;
  189. &:last-child{
  190. border:0;
  191. }
  192. .product{
  193. flex-grow: 1;
  194. .checkbox{
  195. width: 60rpx;
  196. }
  197. .pinfo{
  198. flex-grow: 1;
  199. padding-left: 20rpx;
  200. .pname{
  201. font-size: 32rpx;
  202. color: #191919;
  203. font-weight: bold;
  204. margin-bottom: 10rpx;
  205. }
  206. .pno{
  207. background-color: rgba(3, 54, 146, 0.15);
  208. border-radius: 50rpx;
  209. padding: 0 20rpx;
  210. color: #033692;
  211. font-size: 24rpx;
  212. margin-right: 10rpx;
  213. }
  214. .ptxt{
  215. font-size: 28rpx;
  216. color: #999;
  217. .pnums{
  218. color: #222;
  219. }
  220. }
  221. }
  222. }
  223. .ptools{
  224. margin-top: 20rpx;
  225. .pcurnums{
  226. > text{
  227. margin-right: 20rpx;
  228. }
  229. }
  230. }
  231. }
  232. }
  233. }
  234. </style>