port.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <view class="portList">
  3. <view class="nav">
  4. <navigation-bar-view ref="nav"></navigation-bar-view>
  5. </view>
  6. <view class="header">
  7. <picker mode="selector" :range="cabinetTypeList" range-key="label" :value="cabinetTypeIndex" @change="changeCabinetType">
  8. <view class="title">
  9. <text>{{cabinetTypeIndex ? cabinetTypeList[cabinetTypeIndex].label: '端口类型'}}</text>
  10. </view>
  11. </picker>
  12. <picker mode="selector" :range="statusList" range-key="label" :value="statusIndex" @change="changeStatus">
  13. <view class="title">
  14. <text>{{statusIndex ? statusList[statusIndex].label: '端口状态'}}</text>
  15. </view>
  16. </picker>
  17. <picker mode="selector" :range="useStatusList" range-key="label" :value="useStatusIndex" @change="changeUseStatus">
  18. <view class="title">
  19. <text>{{useStatusIndex ? useStatusList[useStatusIndex].label: '使用状态'}}</text>
  20. </view>
  21. </picker>
  22. </view>
  23. <view style="height: 21.8vw"></view>
  24. <block v-for="(item, i) in list" :key="i">
  25. <view class="cell">
  26. <view class="top">
  27. <view class="order-sn">端口号:{{item.portSn}}</view>
  28. <view class="status">
  29. <text v-if="item.useStatus == 0">空闲中</text>
  30. <text v-if="item.useStatus == 1">使用中</text>
  31. </view>
  32. </view>
  33. <view class="center">
  34. <view class="message">柜子号:{{item.caseSn}}</view>
  35. <view class="message">
  36. <text>格口类型:</text>
  37. <text v-if="item.cabinetType == 1">小格子</text>
  38. <text v-if="item.cabinetType == 2">中格子</text>
  39. <text v-if="item.cabinetType == 3">大格子</text>
  40. </view>
  41. <view class="message">
  42. <text>柜子状态:{{item.payTime}}</text>
  43. <text v-if="item.status == 0">禁用</text>
  44. <text v-if="item.status == 1">启用</text>
  45. <text v-if="item.status == 2">冻结</text>
  46. </view>
  47. </view>
  48. <view class="bottom">
  49. <view class="btn" @click="knockOut(item)">清箱</view>
  50. <view class="btn" @click="handelDoor(item, 1)">开门</view>
  51. <view class="btn" @click="handelDoor(item, 0)">关门</view>
  52. </view>
  53. </view>
  54. </block>
  55. <view style="height: 3.3vw;"></view>
  56. </view>
  57. </template>
  58. <script>
  59. import navigationBarView from '../../components/navigationBarView.vue';
  60. export default {
  61. components: {
  62. navigationBarView
  63. },
  64. data() {
  65. return {
  66. list: [],
  67. params: {
  68. deviceSn: '',
  69. cabinetType: '',
  70. status: '',
  71. useStatus: ''
  72. },
  73. cabinetTypeList: [{
  74. label: '全部',
  75. value: ''
  76. }, {
  77. label: '小格子',
  78. value: 1
  79. }, {
  80. label: '中格子',
  81. value: 2
  82. }, {
  83. label: '大格子',
  84. value: 3
  85. }],
  86. cabinetTypeIndex: 0,
  87. statusList: [{
  88. label: '全部',
  89. value: ''
  90. }, {
  91. label: '禁用',
  92. value: 0
  93. }, {
  94. label: '启用',
  95. value: 1
  96. }, {
  97. label: '冻结',
  98. value: 2
  99. }],
  100. statusIndex: 0,
  101. useStatusList: [{
  102. label: '全部',
  103. value: ''
  104. }, {
  105. label: '空闲中',
  106. value: 0
  107. }, {
  108. label: '使用中',
  109. value: 1
  110. }],
  111. useStatusIndex: 0
  112. }
  113. },
  114. onLoad() {
  115. this.params.deviceSn = uni.getStorageSync('sn');
  116. this.getData()
  117. },
  118. methods: {
  119. getData() {
  120. uni.showLoading({
  121. title: "加载中..."
  122. })
  123. this.$api.managerPortList(this.params).then(res => {
  124. this.list = res.data;
  125. })
  126. },
  127. changeCabinetType(e) {
  128. this.cabinetTypeIndex = e.detail.value;
  129. this.params.cabinetType = this.cabinetTypeList[e.detail.value].value;
  130. this.getData();
  131. },
  132. changeStatus(e) {
  133. this.statusIndex = e.detail.value;
  134. this.params.status = this.statusList[e.detail.value].value;
  135. this.getData();
  136. },
  137. changeUseStatus(e) {
  138. this.useStatusIndex = e.detail.value;
  139. this.params.useStatus = this.useStatusList[e.detail.value].value;
  140. this.getData();
  141. },
  142. knockOut(e) {
  143. const _ = this;
  144. uni.showModal({
  145. title: '提示',
  146. content: '请确认是否对这个端口清箱?',
  147. success: r => {
  148. if (r.confirm) {
  149. let sn = uni.getStorageSync('sn');
  150. _.$api.managerTranslateSys({
  151. deviceSn: sn,
  152. port: e.portSn
  153. }).then(res => {
  154. uni.showToast({
  155. title: '操作成功'
  156. })
  157. setTimeout(function() {
  158. _.getData()
  159. }, 3000)
  160. })
  161. }
  162. }
  163. })
  164. },
  165. handelDoor(e, witch) {
  166. const _ = this;
  167. uni.showModal({
  168. title: '提示',
  169. content: `请确认是否这个${witch ? '开启' : '关闭'}端口?`,
  170. success: r => {
  171. if (r.confirm) {
  172. let sn = uni.getStorageSync('sn');
  173. _.$api.managerOperationSys({
  174. deviceSn: sn,
  175. witch: witch,
  176. port: e.portSn
  177. }).then(res => {
  178. uni.showToast({
  179. title: '操作成功'
  180. })
  181. setTimeout(function() {
  182. _.getData()
  183. }, 3000)
  184. })
  185. }
  186. }
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="scss">
  193. .portList {
  194. min-height: 100vh;
  195. background-color: #eee;
  196. .nav {
  197. position: fixed;
  198. top: 0;
  199. left: 0;
  200. background: #FFF;
  201. }
  202. .header {
  203. position: fixed;
  204. top: 11.3vw;
  205. display: flex;
  206. align-items: center;
  207. justify-content: space-around;
  208. width: 100vw;
  209. height: 10.5vw;
  210. background-color: #FFFFFF;
  211. .title {
  212. display: flex;
  213. align-items: center;
  214. font-size: 3.5vw;
  215. color: #161920;
  216. }
  217. }
  218. .cell {
  219. padding: 0 3.3vw;
  220. border-radius: 1.6vw;
  221. background-color: #FFFFFF;
  222. margin: 3.3vw 4vw 0;
  223. .top {
  224. display: flex;
  225. align-items: center;
  226. justify-content: space-between;
  227. height: 10.7vw;
  228. border-bottom: .3vw solid #eee;
  229. .order-sn {
  230. color: #999999;
  231. font-size: 3.5vw;
  232. }
  233. .status {
  234. display: flex;
  235. align-items: center;
  236. justify-content: center;
  237. width: 16vw;
  238. height: 5.6vw;
  239. border-radius: 5.6vw;
  240. background: linear-gradient(to right, #FEE704, #FDD001);
  241. font-size: 3.2vw;
  242. }
  243. }
  244. .center {
  245. padding-top: 4.5vw;
  246. padding-bottom: 4.5vw;
  247. .take-code {
  248. display: flex;
  249. align-items: center;
  250. margin-bottom: 4.4vw;
  251. font-weight: bold;
  252. line-height: 4vw;
  253. .label {
  254. font-size: 4vw;
  255. }
  256. .code {
  257. color: #FFB706;
  258. font-size: 4.8vw;
  259. }
  260. }
  261. .message {
  262. margin-bottom: 3.1vw;
  263. color: #666666;
  264. font-size: 3.5vw;
  265. line-height: 3.5vw;
  266. }
  267. }
  268. .bottom {
  269. display: flex;
  270. justify-content: flex-end;
  271. padding-bottom: 3.2vw;
  272. .btn {
  273. display: flex;
  274. align-items: center;
  275. justify-content: center;
  276. width: 22.7vw;
  277. height: 8.3vw;
  278. border-radius: 8.3vw;
  279. border: .3vw solid #CCCCCC;
  280. color: #222222;
  281. font-size: 3.5vw;
  282. margin-left: 2vw;
  283. }
  284. }
  285. }
  286. }
  287. </style>