search.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view class="container">
  3. <u-navbar bgColor="#2C6FF3" :autoBack="true" :placeholder="true" leftIconColor="#fff">
  4. <view slot="center" class="nav-center">
  5. <u-search :animation="true" bgColor="#fff" height="56rpx" placeholder="输入设备名称搜索" v-model="keyword"
  6. :showAction="false" @search="search"></u-search>
  7. </view>
  8. </u-navbar>
  9. <FilterDrop menuTop="148" @confirm="confirm" />
  10. <view class="tab-list">
  11. <!-- <u-subsection bgColor="#fff" activeColor="#2C6FF3" :list="tabList" :current="current" @change="tabChange"></u-subsection> -->
  12. <u-tabs :list="tabList" @click="tabChange" :current="current" :scrollable="false" bgColor="#fff"
  13. lineColor="#2C6FF3" ></u-tabs>
  14. </view>
  15. <view class="content">
  16. <view class="xy-card" v-for="(item,index) in list" :key="item.id" @click="$tab.navigateTo(`/pages/equipment/detail?id=${item.deviceId}`)">
  17. <view class="title">
  18. {{item.deviceName}}
  19. <view>
  20. <u-tag text="运营中" type="success" plain v-if="item.busyState==1"> </u-tag>
  21. <u-tag text="已停运" type="info" plain v-else> </u-tag>
  22. </view>
  23. </view>
  24. <view class="total">
  25. <view class="t-left">
  26. <view>
  27. <view>{{item.daySalesPrice}}</view>
  28. <text>今日销售(元)</text>
  29. </view>
  30. <view>
  31. <view>{{item.dayOrderNum}}</view>
  32. <text>今日订单</text>
  33. </view>
  34. <view>
  35. <view><text>{{item.deviceStatus.stock}}</text>/{{item.deviceStatus.afterFillStock}}</view>
  36. <text>库存/补后</text>
  37. </view>
  38. </view>
  39. <!-- <view class="t-right">
  40. 机器详情
  41. </view> -->
  42. </view>
  43. <view class="t-content">
  44. <view class="c-item-t">
  45. <view class="c-item">
  46. <view>编号:</view>
  47. <view>{{item.mercDeviceCode}}</view>
  48. </view>
  49. <view class="c-item">
  50. <view>商户:</view>
  51. <view>{{item.mercName}}</view>
  52. </view>
  53. </view>
  54. <view class="c-item-t">
  55. <view class="c-item">
  56. <view>温度:</view>
  57. <view>{{item.deviceStatus.tempValue}}</view>
  58. </view>
  59. <view class="c-item">
  60. <view>信号强度:</view>
  61. <view>{{item.deviceStatus.netDbm}}</view>
  62. </view>
  63. </view>
  64. <view class="c-item">
  65. <view>软件版本:</view>
  66. <view>{{item.deviceSysinfo.appUpmVersion}}</view>
  67. </view>
  68. <view class="c-item">
  69. <view>最后更新时间:</view>
  70. <view>{{item.updateTime}}</view>
  71. </view>
  72. <!-- <view class="c-item" v-if="current==3">
  73. <view>故障原因:</view>
  74. <view style="color: red;">锁不能正常开启</view>
  75. </view> -->
  76. </view>
  77. <view class="btn">
  78. <button class="cu-btn" style="width:180rpx;">故障日志</button>
  79. <button class="cu-btn" style="width: 180rpx;margin: 0 12rpx;">流量卡</button>
  80. <button class="cu-btn" style="width: 180rpx;">温度曲线</button>
  81. </view>
  82. </view>
  83. <u-loadmore :status="status" v-if="list.length>=1" />
  84. </view>
  85. <view class="empty" v-if="list.length==0">
  86. <u-empty text="没有设备!"></u-empty>
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. import FilterDrop from './components/xy-filtedrop/index.vue'
  92. import {
  93. searchPage
  94. } from "@/api/device/device.js"
  95. import {
  96. areaTree
  97. } from "@/api/point/area"
  98. export default {
  99. components: {
  100. FilterDrop
  101. },
  102. data() {
  103. return {
  104. keyword: '',
  105. tabList: [{
  106. name: '在线'
  107. },
  108. {
  109. name: '离线'
  110. },
  111. {
  112. name: '停运'
  113. },
  114. {
  115. name: '故障'
  116. }
  117. ],
  118. current: 0,
  119. status: 'loadmore',
  120. list: [],
  121. page: 1,
  122. size: 10,
  123. searchParams:{},//筛选条件
  124. }
  125. },
  126. onLoad() {
  127. this.getList()
  128. },
  129. methods: {
  130. search(){
  131. this.reset()
  132. this.getList()
  133. },
  134. //接收菜单结果
  135. confirm(e) {
  136. this.searchParams=e;
  137. this.reset()
  138. this.getList()
  139. },
  140. tabChange(e) {
  141. this.current = e.index
  142. this.reset()
  143. this.getList()
  144. },
  145. reset() {
  146. this.status == 'loadmore'
  147. this.page = 1;
  148. this.list = [];
  149. },
  150. getList() {
  151. searchPage({
  152. page: {
  153. current: this.page,
  154. size: this.size
  155. },
  156. keywords: this.keyword,
  157. fault: this.current==3?true:'',
  158. netState:this.current==0?1:this.current==1?2:'',
  159. busyState: this.current==2?2:'',
  160. deviceType:this.searchParams[0],
  161. stockStatus:this.searchParams[1],
  162. districtId:this.searchParams[2],
  163. placeLineId:this.searchParams[3],
  164. }).then(res => {
  165. let data = res.data.records;
  166. if (data.length < 10) {
  167. this.status = "nomore"
  168. } else {
  169. this.status = "loadmore"
  170. }
  171. this.list = this.list.concat(data)
  172. })
  173. },
  174. scrolltolower() {
  175. if (this.status == 'nomore') return
  176. this.page++
  177. this.getList()
  178. },
  179. detail(id){
  180. this.$tab.navigateTo(`/pages/equipment/detail?id=${id}`)
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. .container {
  187. position: relative;
  188. .nav-center {
  189. width: 450rpx;
  190. margin-left: -120rpx;
  191. }
  192. .tab-list {
  193. position: fixed;
  194. top: 230rpx;
  195. left: 0;
  196. width: 100%;
  197. background-color: #fff;
  198. z-index: 999;
  199. /deep/ .u-subsection--button__bar {
  200. background-color: #f3f3f3;
  201. }
  202. }
  203. .content {
  204. margin-top: 180rpx;
  205. padding: 12rpx 24rpx 24rpx;
  206. .xy-card+.xy-card {
  207. margin-top: 18rpx;
  208. }
  209. .title {
  210. font-size: 28rpx;
  211. font-weight: bold;
  212. color: #333;
  213. position: relative;
  214. >view{
  215. position: absolute;
  216. right:0;
  217. top:-12rpx;
  218. }
  219. }
  220. .total {
  221. margin-top: 28rpx;
  222. .t-left {
  223. font-size: 26rpx;
  224. display: flex;
  225. flex-flow: row nowrap;
  226. justify-content: space-between;
  227. text-align: center;
  228. >view {
  229. >view {
  230. color: red;
  231. font-weight: bold;
  232. font-size: 28rpx;
  233. >text {
  234. color: #333;
  235. }
  236. }
  237. >text {
  238. margin-top: 12rpx;
  239. }
  240. }
  241. }
  242. .t-right {
  243. display: inline-block;
  244. line-height: 34rpx;
  245. font-size: 26rpx;
  246. background-color: #2C6FF3;
  247. color: #fff;
  248. border-radius: 8rpx;
  249. padding: 0rpx 12rpx;
  250. position: absolute;
  251. right: 0;
  252. bottom: 0;
  253. }
  254. }
  255. .t-content {
  256. border-radius: 8rpx;
  257. background-color: rgb(245, 248, 251);
  258. box-sizing: border-box;
  259. padding: 24rpx 12rpx;
  260. margin-top: 24rpx;
  261. font-size: 26rpx;
  262. .c-item {
  263. display: flex;
  264. flex-direction: row;
  265. margin-bottom: 12rpx;
  266. align-items: center;
  267. >view:nth-child(1) {
  268. color: #666;
  269. width: 200rpx;
  270. }
  271. >view:nth-child(2) {
  272. color: #333;
  273. }
  274. }
  275. .c-item-t {
  276. display: flex;
  277. flex-flow: row nowrap;
  278. .c-item {
  279. width: 50%;
  280. }
  281. }
  282. }
  283. .btn {
  284. display: flex;
  285. flex-flow: row nowrap;
  286. justify-content: flex-end;
  287. margin-top: 24rpx;
  288. .cu-btn {
  289. background-color: #2C6FF3;
  290. color: #fff;
  291. }
  292. }
  293. }
  294. .empty {
  295. position: fixed;
  296. left: 50%;
  297. top: 50%;
  298. transform: translate(-50%, -50%);
  299. }
  300. }
  301. </style>