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