query.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view >
  3. <tn-nav-bar fixed>下线查询</tn-nav-bar>
  4. <view class="" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  5. <view class="tn-border-solid">
  6. <view class="tn-flex tn-flex-col-bottom tn-margin">
  7. <view class="tn-flex-3 align-content-item tn-text-center ">
  8. <view class="content tn-flex tn-flex-direction-row tn-flex-col-center">
  9. <view class="content__title">产品二维码:</view>
  10. <view class="content__data tn-flex-1">
  11. <tn-input v-model="qrCode" type="text" placeholder="请扫描产品二维码" border :height="60" >
  12. </tn-input>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="tn-flex-1 align-content-item tn-text-right">
  17. <tn-button backgroundColor="#01BEFF" fontColor="tn-color-white" icon="tn-icon-scan" @click="openScan">
  18. <span class="tn-icon-scan tn-margin-right-xs"></span>扫码
  19. </tn-button>
  20. </view>
  21. </view>
  22. <view class="tn-flex tn-flex-col-bottom tn-margin">
  23. <view class="tn-flex-3 align-content-item tn-text-center ">
  24. <view class="content tn-flex tn-flex-direction-row tn-flex-col-center ">
  25. <view class="content__title">日期:</view>
  26. <view class="content__data tn-flex-1">
  27. <tn-input v-model="time" type="text" :disabled="true" placeholder="请选择日期" :height="60" border @click="openCalendar"></tn-input>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="tn-flex-1 align-content-item tn-text-right">
  32. <tn-button :plain="true" backgroundColor="#dcdfe6" @click="initList()">
  33. <span class="tn-icon-search tn-margin-right-xs"></span>查询
  34. </tn-button>
  35. </view>
  36. </view>
  37. </view>
  38. <view>
  39. <template v-for="(item,index) in list">
  40. <view class="tn-flex tn-border-solid-bottom tn-bg-white tn-padding" @click="toDetail(item.id)" >
  41. <view class="tn-flex-4 "style="height: 50rpx;line-height:50rpx;" :class="[!item.frontImg?'tn-color-red':'']">
  42. {{item.qrCode}}
  43. </view>
  44. <view class="tn-flex-1 tn-text-right ">
  45. <view v-if="item.status==-1" class="tn-btn-class tn-btn tn-round tn-main-gradient-orangered--reverse tn-text-center" style="height: 50rpx;line-height:50rpx;">
  46. 生产中
  47. </view>
  48. <view v-if="item.status==0" class="tn-btn-class tn-btn tn-round tn-main-gradient-orange tn-text-center" style="height: 50rpx;line-height:50rpx;">
  49. 作废
  50. </view>
  51. <view v-if="item.status==1" class="tn-btn-class tn-btn tn-round tn-main-gradient-red tn-text-center" style="height: 50rpx;line-height:50rpx;">
  52. 待维修
  53. </view>
  54. <view v-if="item.status==2" class="tn-btn-class tn-btn tn-round tn-main-gradient-green tn-text-center" style="height: 50rpx;line-height:50rpx;">
  55. 已下线
  56. </view>
  57. <view v-if="item.status==3" class="tn-btn-class tn-btn tn-round tn-main-gradient-blue tn-text-center" style="height: 50rpx;line-height:50rpx;">
  58. 已入库
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <tn-load-more class="tn-margin" status="nomore" v-if="total>0 && total<=list.length"></tn-load-more>
  64. </view>
  65. <view v-if="total==0" class="tn-padding tn-bg-white tn-border-solid-top">
  66. <tn-empty icon="../../../static/image/cart.jpg" text="暂无数据" :imgWidth="200" :imgHeight="200" class="tn-margin-top-xl "></tn-empty>
  67. </view>
  68. </view>
  69. <tn-calendar
  70. v-if="showCalendar"
  71. v-model="showCalendar"
  72. mode="date"
  73. :dateValue="time"
  74. :showLunar="false"
  75. :changeYear="false"
  76. @change="onChangeCalendar"
  77. ></tn-calendar>
  78. </view>
  79. </template>
  80. <script setup>
  81. export default {
  82. data(){
  83. return {
  84. showCalendar: false,
  85. time:'',
  86. qrCode:'',
  87. list:[],
  88. current:1,
  89. size:20,
  90. total:-1,
  91. status:'',
  92. }
  93. },
  94. onLoad(options){
  95. // if(options.status){
  96. // this.status = options.status
  97. // }
  98. // this.initList();
  99. },
  100. onReachBottom() { //监听上拉触底事件
  101. if(this.total<= this.list.length){
  102. return
  103. }
  104. this.getList();
  105. },
  106. onPullDownRefresh() {//下拉刷新
  107. this.initList();
  108. },
  109. onShow(){
  110. let pages = getCurrentPages();
  111. let currentPage = pages[pages.length-1];
  112. if(currentPage.options.status){
  113. this.status = currentPage.options.status
  114. }
  115. this.initList();
  116. },
  117. methods: {
  118. openScan(){
  119. // 允许从相机和相册扫码
  120. let that = this;
  121. uni.scanCode({
  122. success: function (res) {
  123. that.qrCode = res.result
  124. that.detail()
  125. }
  126. });
  127. },
  128. initList(){
  129. this.current = 1;
  130. this.list = [];
  131. this.getList();
  132. },
  133. getList(){
  134. let that = this,
  135. url = "wx/product/api/list",
  136. params = {
  137. current:that.current,
  138. size:that.size,
  139. isNg_ignore:that.status=='-1'?"1":"0",
  140. }
  141. if(this.qrCode){
  142. params.qrCode = this.qrCode;
  143. }
  144. if(this.time){
  145. params.createTime=this.time;
  146. }
  147. that.api.request(url, params,"get").then((res) => {
  148. console.log(res)
  149. let list=res.records;
  150. for(var i = 0; i < list.length; i++){
  151. that.list.push(list[i]);
  152. }
  153. if(list.length>0){
  154. that.current=that.current+1;
  155. }
  156. that.total = res.total
  157. uni.stopPullDownRefresh();
  158. }).catch((res) => {
  159. uni.stopPullDownRefresh();
  160. })
  161. },
  162. toDetail(id){
  163. uni.navigateTo({
  164. url:"/pages/product/details?id="+id
  165. })
  166. },
  167. openCalendar() {
  168. this.showCalendar = true
  169. },
  170. onChangeCalendar(event){
  171. this.time = event.date
  172. this.initList();
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .list-icon-text, .list-image-text {
  179. display: flex;
  180. align-items: center;
  181. justify-content: space-between;
  182. }
  183. .list {
  184. &__left {
  185. display: flex;
  186. align-items: center;
  187. justify-content: flex-start;
  188. min-width: 140rpx;
  189. &__icon, &__image {
  190. margin-right: 18rpx;
  191. }
  192. }
  193. &__right {
  194. display: flex;
  195. align-items: center;
  196. justify-content: flex-end;
  197. flex-wrap: wrap;
  198. word-break: break-all;
  199. }
  200. }
  201. .tn-image-upload {
  202. display: flex;
  203. flex-direction: row;
  204. flex-wrap: wrap;
  205. align-items: center;
  206. &__item {
  207. /* #ifndef APP-NVUE */
  208. display: flex;
  209. /* #endif */
  210. align-items: center;
  211. justify-content: center;
  212. width: 200rpx;
  213. height: 200rpx;
  214. overflow: hidden;
  215. margin: 12rpx;
  216. margin-left: 0;
  217. background-color: $tn-font-holder-color;
  218. position: relative;
  219. border-radius: 10rpx;
  220. &-preview {
  221. border: 1rpx solid $tn-border-solid-color;
  222. &__image {
  223. display: block;
  224. width: 100%;
  225. height: 100%;
  226. border-radius: 10rpx;
  227. }
  228. }
  229. }
  230. }
  231. </style>