searchOrder.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="pages flex flex_column">
  3. <view class="search-box">
  4. <u-search placeholder="请输入唯一码/手机号码" v-model="queryWord" @search="pageInit" @custom="pageInit"></u-search>
  5. </view>
  6. <view class="uuid-listbox">
  7. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  8. <view class="uuid-list">
  9. <view
  10. v-for="(item,index) in list"
  11. :key="item.id"
  12. @click="toDetail(item)"
  13. >
  14. <view class="flex align_center">
  15. <view class="uuid-info">
  16. <view><text>产品名称:</text>{{item.productName}}</view>
  17. <view style="margin-top: 0.2rem;"><text>产品编码:</text>{{item.productCode}}</view>
  18. </view>
  19. <view class="uuid-img" v-if="item.productMsg">
  20. <image :src="item.productMsg"></image>
  21. </view>
  22. </view>
  23. <view class="uuid-info" style="width: 100%;">
  24. <view class="uuid" style="margin-top: 0.2rem;"><text>唯一码:</text>{{item.traceCode}}</view>
  25. <view class="uuid"><text>质保时间:</text>{{item.warrantyStartDate.split(' ')[0]}}至{{item.warrantyEndDate.split(' ')[0]}}</view>
  26. <view class="uuid"><text>手机号码:</text>{{item.customMobile}}</view>
  27. </view>
  28. <view class="state" :class="item.state"></view>
  29. </view>
  30. <view style="border: 0;background: none;">
  31. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  32. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  33. </view>
  34. </view>
  35. </scroll-view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import { getWarrantyQueryList } from "@/api/trace"
  41. export default {
  42. data() {
  43. return {
  44. queryWord: '',
  45. pageNo: 1,
  46. pageSize: 10,
  47. list: [],
  48. total: 0,
  49. status: 'loading',
  50. noDataText: '暂无数据',
  51. }
  52. },
  53. onLoad(opts) {
  54. this.queryWord = opts.mobile || ''
  55. this.pageInit()
  56. },
  57. methods: {
  58. pageInit(){
  59. this.status = 'loading'
  60. this.total = 0
  61. this.pageNo = 1
  62. uni.showLoading({
  63. mask:true,
  64. title: "正在查询..."
  65. })
  66. this.getRow()
  67. },
  68. // 查询列表
  69. getRow (pageNo) {
  70. let _this = this
  71. if (pageNo) {
  72. this.pageNo = pageNo
  73. }
  74. // 查询条件
  75. let params = {
  76. pageNo: this.pageNo,
  77. pageSize: this.pageSize,
  78. queryWord: this.queryWord
  79. }
  80. this.status = "loading"
  81. getWarrantyQueryList(params).then(res => {
  82. if (res.status == 200) {
  83. const retList = res.data.list
  84. if(_this.pageNo>1){
  85. _this.list = _this.list.concat(retList || [])
  86. }else{
  87. _this.list = retList || []
  88. }
  89. _this.total = res.data.count || 0
  90. } else {
  91. _this.list = []
  92. _this.total = 0
  93. _this.noDataText = '暂无数据'
  94. }
  95. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  96. uni.hideLoading()
  97. })
  98. },
  99. // scroll-view到底部加载更多
  100. onreachBottom() {
  101. if(this.list.length < this.total){
  102. this.pageNo += 1
  103. this.getRow()
  104. }else{
  105. this.status = "nomore"
  106. }
  107. },
  108. toDetail(item){
  109. uni.navigateTo({
  110. url: "/pagesA/qualityPolicy/orderDetail?id="+item.id
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="less">
  117. .pages{
  118. height: 100vh;
  119. background: #f8f8f8;
  120. overflow: auto;
  121. .search-box{
  122. padding: 0.6rem 1rem;
  123. background: #fff;
  124. }
  125. .uuid-listbox{
  126. flex-grow: 1;
  127. height: calc(100vh - 52px);
  128. }
  129. .uuid-list{
  130. > view{
  131. justify-content: space-between;
  132. border-bottom: 1px solid #eee;
  133. padding: 0.6rem 1rem;
  134. position: relative;
  135. background: #fff;
  136. margin-top: 0.2rem;
  137. }
  138. .state{
  139. background-repeat: no-repeat;
  140. background-size: 100%;
  141. background-position: center center;
  142. position: absolute;
  143. width: 4.5rem;
  144. height: 4.5rem;
  145. z-index: 1000;
  146. bottom: 0.5rem;
  147. right: 1rem;
  148. }
  149. .RUN{
  150. background-image: url(/pagesA/static/inhand.png);
  151. }
  152. .END{
  153. background-image: url(/pagesA/static/outof.png);
  154. }
  155. color: #666;
  156. .uuid-info{
  157. flex-grow: 1;
  158. line-height: 1.5rem;
  159. width: 50%;
  160. > view{
  161. color: #666;
  162. text{
  163. color: #000;
  164. width: 70px;
  165. float: left;
  166. }
  167. }
  168. }
  169. .uuid-img{
  170. width: 6rem;
  171. height: 6rem;
  172. border: 1px solid #eee;
  173. overflow: hidden;
  174. display: flex;
  175. align-items: center;
  176. margin-left: 0.5rem;
  177. image {
  178. max-width: 100%;
  179. max-height: 100%;
  180. background: #eaeaea;
  181. }
  182. }
  183. }
  184. }
  185. </style>