equipment.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <view class="container">
  3. <u-navbar bgColor="#2C6FF3" :placeholder="true" :autoBack="false">
  4. <view slot="left" style="color:#fff;font-size: 36rpx;">
  5. 设备管理
  6. </view>
  7. </u-navbar>
  8. <view class="total">
  9. <view class="total-item">
  10. <view class="num">
  11. {{totalData.onlineNum}}/{{totalData.offlineNum}}
  12. </view>
  13. <view class="name">
  14. 在线/离线
  15. </view>
  16. </view>
  17. <view class="total-item">
  18. <view class="num">
  19. {{totalData.operatingNum}}/{{totalData.closedNum}}
  20. </view>
  21. <view class="name">
  22. 运营/停业
  23. </view>
  24. </view>
  25. <view class="total-item" @click="$tab.navigateTo('/pages/replenish/replenishmentManagement')">
  26. <view class="num">
  27. {{totalData.needToFillNum}}
  28. </view>
  29. <view class="name">
  30. 待补货
  31. </view>
  32. </view>
  33. </view>
  34. <view class="search">
  35. <!-- <u-search animation placeholder="请输入设备名称/编号搜索" :showAction="false"
  36. disabled @click.native="$tab.navigateTo('/pages/equipment/search')">
  37. </u-search> -->
  38. <u-search animation placeholder="请输入设备名称/编号搜索" :showAction="false"
  39. @change="search">
  40. </u-search>
  41. </view>
  42. <view class="content">
  43. <view class="xy-card" v-for="(item,index) in list" :key="item.placeLineId">
  44. <view class="eq-line-title">
  45. {{item.placeLineName}}({{item.deviceNum}}台)
  46. <view class="arrow-right">
  47. <u-icon name="arrow-right" size="14"></u-icon>
  48. </view>
  49. </view>
  50. <view class="eq-item" @click="$tab.navigateTo(`/pages/equipment/detail?id=${item1.deviceId}`)"
  51. v-for="(item1,index1) in item.deviceInfos" :key="item1.deviceId">
  52. <view class="eq-content">
  53. <view class="eq-wrap">
  54. <view class="eq-name flex justify-between">
  55. <view class="eq-title" v-if="item1.deviceName">{{item1.deviceName}}<text style="color: #666;">({{item1.deviceId}})</text></view>
  56. <view class="eq-title" v-else>{{item1.deviceId}}</view>
  57. <view class="eq-status-box flex align-center">
  58. <view class="eq-status" :class="[item1.netState==1?'online':'']"><text></text>{{item1.netStateName}}
  59. </view>
  60. <view class="eq-status" :class="[item1.busyState==1?'online':'']"><text></text>{{item1.busyStateName}}
  61. </view>
  62. </view>
  63. </view>
  64. <view class="eqeq-type">
  65. <view>
  66. 设备类型:
  67. </view>
  68. <view>
  69. {{item1.deviceTypeName}}
  70. </view>
  71. </view>
  72. <view class="eqeq-type">
  73. <view>
  74. 资产编号:
  75. </view>
  76. <view>
  77. {{item1.mercDeviceCode||'无'}}
  78. </view>
  79. </view>
  80. <view class="eqeq-type">
  81. <view>
  82. 今日交易笔数:
  83. </view>
  84. <view>
  85. {{item1.dayOrderNum}}
  86. </view>
  87. </view>
  88. <view class="eqeq-type">
  89. <view>
  90. 今日销售额:
  91. </view>
  92. <view>
  93. ¥{{$xy.delMoney(item1.daySalesPrice)}}
  94. </view>
  95. </view>
  96. </view>
  97. <view class="status">
  98. <view class="s-name">
  99. 在售/补货
  100. </view>
  101. <view class="s-num">
  102. {{item1.onSaleNum||0}}/{{item1.fillNum||0}}
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <!-- <view class="more" @click="$tab.navigateTo('/pages/equipment/search')">
  108. 查看全部
  109. </view> -->
  110. </view>
  111. <view class="empty" v-if="list.length==0">
  112. <u-empty></u-empty>
  113. </view>
  114. </view>
  115. </view>
  116. </template>
  117. <script>
  118. import {
  119. mercHomeList,
  120. mercHomeStatistical,
  121. } from "@/api/device/device.js"
  122. export default {
  123. components: {},
  124. data() {
  125. return {
  126. online: true,
  127. list: [],
  128. totalData: {
  129. closedNum: 0,
  130. needToFillNum: 0,
  131. offlineNum: 0,
  132. onlineNum: 0,
  133. operatingNum: 0,
  134. keyWords:''
  135. },
  136. }
  137. },
  138. created() {
  139. this.getTotalData('')
  140. this.getList('')
  141. },
  142. methods: {
  143. onshow(){
  144. this.getList('')
  145. },
  146. search(e) {
  147. console.log(e)
  148. this.keyWords=e
  149. this.getTotalData(this.keyWords)
  150. this.getList(this.keyWords)
  151. },
  152. getTotalData(deviceId) {
  153. mercHomeStatistical({
  154. deviceName: '',
  155. deviceId: deviceId
  156. }).then(res => {
  157. this.totalData = res.data;
  158. })
  159. },
  160. getList(deviceId) {
  161. mercHomeList({
  162. deviceName: '',
  163. deviceId: deviceId
  164. }).then(res => {
  165. this.list = res.data;
  166. })
  167. },
  168. }
  169. }
  170. </script>
  171. <style lang="scss">
  172. .container {
  173. .nav-style {
  174. font-size: 32rpx;
  175. font-weight: bold;
  176. color: #fff;
  177. }
  178. .search {
  179. padding: 24rpx 24rpx;
  180. background-color: #fff;
  181. }
  182. .total {
  183. display: flex;
  184. flex-flow: row nowrap;
  185. justify-content: space-around;
  186. align-items: center;
  187. text-align: center;
  188. color: #fff;
  189. background-color: #2C6FF3;
  190. padding: 40rpx 24rpx ;
  191. .total-item {
  192. .num {
  193. font-weight: bold;
  194. font-size: 52rpx;
  195. }
  196. .name {
  197. font-size: 26rpx;
  198. }
  199. }
  200. }
  201. .content {
  202. padding: 24rpx;
  203. padding-bottom:calc(124rpx + env(safe-area-inset-bottom) / 2);
  204. .xy-card {
  205. margin-bottom: 24rpx;
  206. }
  207. .eq-line-title {
  208. font-size: 32rpx;
  209. padding-bottom: 24rpx;
  210. position: relative;
  211. .arrow-right {
  212. position: absolute;
  213. right: 0;
  214. top: 0;
  215. }
  216. }
  217. .eq-item {
  218. position: relative;
  219. &+.eq-item {
  220. padding-top: 12rpx;
  221. }
  222. .eq-content {
  223. .eq-wrap {
  224. border-radius: 8rpx;
  225. background-color: rgb(245, 248, 251);
  226. box-sizing: border-box;
  227. padding: 24rpx 12rpx;
  228. font-size: 26rpx;
  229. .eq-name {
  230. font-size: 32rpx;
  231. font-weight: bold;
  232. margin-bottom: 24rpx;
  233. position: relative;
  234. >.eq-title{
  235. width: 420rpx;
  236. >text{
  237. font-size: 30rpx;
  238. color: #666;
  239. font-weight: normal;
  240. }
  241. }
  242. .eq-status-box{
  243. float: right;
  244. position: absolute;
  245. right:0;
  246. top:0;
  247. }
  248. .eq-status {
  249. font-size: 28rpx;
  250. color: #666;
  251. font-weight: normal;
  252. margin-left: 12rpx;
  253. >text {
  254. display: inline-block;
  255. background-color: #666;
  256. width: 16rpx;
  257. height: 16rpx;
  258. border-radius: 16rpx;
  259. margin-right: 12rpx;
  260. }
  261. &.online {
  262. color: #f56c6c;
  263. >text {
  264. background-color: green;
  265. }
  266. }
  267. }
  268. }
  269. }
  270. .eqeq-type {
  271. display: flex;
  272. flex-direction: row;
  273. align-items: center;
  274. font-size: 28rpx;
  275. >view:nth-child(1) {
  276. color: #000;
  277. width: 200rpx;
  278. }
  279. >view:nth-child(2) {
  280. color: #666;
  281. padding-left: 6rpx;
  282. }
  283. }
  284. .eqeq-type+.eqeq-type{
  285. margin-top: 16rpx;
  286. }
  287. .status {
  288. width: 130rpx;
  289. height: 120rpx;
  290. box-sizing: border-box;
  291. border-radius: 120rpx;
  292. // border: 6rpx solid #2C6FF3;
  293. text-align: center;
  294. display: flex;
  295. flex-flow: column;
  296. justify-content: space-around;
  297. align-items: center;
  298. position: absolute;
  299. right: 12rpx;
  300. bottom: 24rpx;
  301. .s-name {
  302. font-size: 28rpx;
  303. padding-top: 20rpx;
  304. font-weight: bold;
  305. }
  306. .s-num {
  307. font-size: 32rpx;
  308. padding-bottom: 20rpx;
  309. }
  310. }
  311. }
  312. }
  313. .more {
  314. text-align: center;
  315. font-size: 28rpx;
  316. color: #2C6FF3;
  317. line-height: 80rpx;
  318. }
  319. }
  320. .empty {
  321. margin: 40% auto 0;
  322. }
  323. }
  324. </style>