searchOrder.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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"><view style="display: inline-block;color: #000;" @click.stop="showTip">质保时间<u-icon size="30" color="#ff8100" name="question-circle-fill"></u-icon>:</view>{{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. showTip(){
  69. uni.showModal({
  70. title: "提示",
  71. content: "使用超过3年或者行驶超过5万公里则不在质保期内。",
  72. showCancel: false,
  73. confirmText: "知道了"
  74. })
  75. },
  76. // 查询列表
  77. getRow (pageNo) {
  78. let _this = this
  79. if (pageNo) {
  80. this.pageNo = pageNo
  81. }
  82. // 查询条件
  83. let params = {
  84. pageNo: this.pageNo,
  85. pageSize: this.pageSize,
  86. queryWord: this.queryWord
  87. }
  88. this.status = "loading"
  89. getWarrantyQueryList(params).then(res => {
  90. if (res.status == 200) {
  91. const retList = res.data.list
  92. if(_this.pageNo>1){
  93. _this.list = _this.list.concat(retList || [])
  94. }else{
  95. _this.list = retList || []
  96. }
  97. _this.total = res.data.count || 0
  98. } else {
  99. _this.list = []
  100. _this.total = 0
  101. _this.noDataText = '暂无数据'
  102. }
  103. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  104. uni.hideLoading()
  105. })
  106. },
  107. // scroll-view到底部加载更多
  108. onreachBottom() {
  109. if(this.list.length < this.total){
  110. this.pageNo += 1
  111. this.getRow()
  112. }else{
  113. this.status = "nomore"
  114. }
  115. },
  116. toDetail(item){
  117. uni.navigateTo({
  118. url: "/pagesA/qualityPolicy/orderDetail?id="+item.id
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="less">
  125. .pages{
  126. height: 100vh;
  127. background: #f8f8f8;
  128. overflow: auto;
  129. .search-box{
  130. padding: 0.6rem 1rem;
  131. background: #fff;
  132. }
  133. .uuid-listbox{
  134. flex-grow: 1;
  135. height: calc(100vh - 52px);
  136. }
  137. .uuid-list{
  138. > view{
  139. justify-content: space-between;
  140. border-bottom: 1px solid #eee;
  141. padding: 0.6rem 1rem;
  142. position: relative;
  143. background: #fff;
  144. margin-top: 0.2rem;
  145. }
  146. .state{
  147. background-repeat: no-repeat;
  148. background-size: 100%;
  149. background-position: center center;
  150. position: absolute;
  151. width: 4.5rem;
  152. height: 4.5rem;
  153. z-index: 1000;
  154. bottom: 0.5rem;
  155. right: 1rem;
  156. }
  157. .RUN{
  158. background-image: url(/pagesA/static/inhand.png);
  159. }
  160. .END{
  161. background-image: url(/pagesA/static/outof.png);
  162. }
  163. color: #666;
  164. .uuid-info{
  165. flex-grow: 1;
  166. line-height: 1.5rem;
  167. width: 50%;
  168. > view{
  169. color: #666;
  170. > text{
  171. color: #000;
  172. width: 70px;
  173. float: left;
  174. }
  175. }
  176. }
  177. .uuid-img{
  178. width: 6rem;
  179. height: 6rem;
  180. border: 1px solid #eee;
  181. overflow: hidden;
  182. display: flex;
  183. align-items: center;
  184. margin-left: 0.5rem;
  185. image {
  186. max-width: 100%;
  187. max-height: 100%;
  188. background: #eaeaea;
  189. }
  190. }
  191. }
  192. }
  193. </style>