search.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view style="position: fixed;z-index: 100;background-color: #FFFFFF;height: 80px;top: 40px;">
  5. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备搜索"></uni-nav-bar>
  6. <view class="search_top_input">
  7. <input type="text" value="" placeholder="请输入设备ID" v-model="imports" @input="searchinp" />
  8. <u-icon name="search" size="40" class="icon" @click="search"></u-icon>
  9. </view>
  10. </view>
  11. <view class="aftersaleinfo" v-if="aftersaleinfotf">
  12. 暂无此设备信息
  13. </view>
  14. <view class="aftersale" v-else>
  15. <view class="aftersale_item" v-for="(item,index) in faultdata" :key="index">
  16. <view class="aftersale_item_title">
  17. <u-icon name="calendar" color="#71D8AF" size="34"></u-icon>
  18. <span>设备 ID:{{item.device_id}}</span>
  19. </view>
  20. <view class="aftersale_item_con">
  21. <p>联系人:{{item.user}}</p>
  22. <p>联系电话:{{item.userphone}}</p>
  23. <p>位置:{{item.addr}}</p>
  24. <p>故障上报时间:{{item.uptime|timeFormat()}}</p>
  25. </view>
  26. <view class="aftersale_item_operate">
  27. <button class="fault" @click="fault(item.errordesc)">故障原因</button>
  28. <button :class="item.errorimg.length!=0?'imgs':'none'" :disabled="item.errorimg.length==0" @click="faultImg(item.errorimg)">图片</button>
  29. <button :class="item.errorvideo?'video':'none'" :disabled="!item.errorvideo" @click="faultVideo(item.errorvideo)">视频</button>
  30. </view>
  31. <view class="aftersale_item_icon">
  32. <image :src="$imageURL+'/bigdata_app'+aftersale_icon[Number(item.device_type)-2].src" mode=""></image>
  33. </view>
  34. </view>
  35. </view>
  36. <u-modal v-model="show" :mask-close-able="maskcloseable" :show-confirm-button="showconfirmbutton" :title="title" class="model">
  37. <view class="model_box">
  38. <p v-if="faultinfo_tf">{{faultinfo}}</p>
  39. <u-swiper :list="faultimg" v-if="faultimg_tf" class="uswiper" height="400" style="width: 100%;" @click="examine(faultimg)"></u-swiper>
  40. <video :src="BASE_URL+faultvideo" controls v-if="faultvideo_tf" style="width: 90%;"></video>
  41. </view>
  42. </u-modal>
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. Debounce,
  48. Throttle
  49. } from "../../util/anitthro.js"
  50. export default {
  51. data() {
  52. return {
  53. imports:'',
  54. BASE_URL: 'https://wx.hnyfwlw.com',
  55. faultdata:[],
  56. aftersale_icon: [{
  57. src: '/image/afterSale/6.png'
  58. },
  59. {
  60. src: '/image/afterSale/1.png'
  61. },
  62. {
  63. src: '/image/afterSale/4.png'
  64. },
  65. {
  66. src: '/image/afterSale/3.png'
  67. },
  68. {
  69. src: '/image/afterSale/5.png'
  70. },
  71. {
  72. src: '/image/afterSale/2.png'
  73. }
  74. ],
  75. title:"",//弹框标题
  76. show: false,//弹框先显示
  77. maskcloseable: true,
  78. showconfirmbutton: false,
  79. faultinfo: '',//故障信息
  80. faultinfo_tf:false,//故障信息显示
  81. faultvideo: '',//故障视频
  82. faultvideo_tf:false,//故障视频显示
  83. faultimg: [],//故障图片
  84. faultimg_tf: false,//故障图片显示
  85. aftersaleinfotf:'',
  86. page:1
  87. }
  88. },
  89. methods: {
  90. async getAftersale(num) {
  91. const res = await this.$myRequest({
  92. url: '/api/api_gateway?method=after_sale.after_sale_manage.aftersale_info',
  93. data:{
  94. f_id:num,
  95. page:this.page
  96. }
  97. })
  98. this.faultdata =this.faultdata.concat(res.data)
  99. console.log(this.faultdata)
  100. if(this.faultdata.length==0){
  101. this.aftersaleinfotf = true
  102. }else{
  103. this.aftersaleinfotf = false
  104. }
  105. for (var i = 0; i < this.faultdata.length; i++) {
  106. this.faultdata[i].errorimg = JSON.parse(this.faultdata[i].errorimg)
  107. if (this.faultdata[i].errorimg == null) {
  108. this.faultdata[i].errorimg = []
  109. }
  110. }
  111. },
  112. search(){
  113. this.getAftersale(Number(this.imports))
  114. },
  115. fault(info) { //查看故障信息
  116. this.title="故障信息"
  117. this.show = true
  118. this.faultinfo = info
  119. this.faultimg_tf = false
  120. this.faultinfo_tf=true
  121. this.faultvideo_tf=false
  122. },
  123. faultImg(info) { //查看故障图片
  124. this.faultimg=[]
  125. for (var i = 0; i < info.length; i++) {
  126. let obj = {}
  127. obj.image = info[i]
  128. this.faultimg.push(obj)
  129. }
  130. console.log(this.faultimg)
  131. this.title="故障图片"
  132. this.show = true
  133. this.faultimg_tf = true
  134. this.faultinfo_tf=false
  135. this.faultvideo_tf=false
  136. },
  137. faultVideo(info) { //查看故障视频
  138. this.title="故障视频"
  139. this.faultvideo=info
  140. this.show = true
  141. this.faultimg_tf = false
  142. this.faultinfo_tf=false
  143. this.faultvideo_tf=true
  144. },
  145. clickLeft(){
  146. uni.navigateTo({
  147. url:"./index"
  148. })
  149. },
  150. searchinp() {
  151. Debounce(() => {
  152. this.eqlistdata = []
  153. this.search()
  154. }, 1000)()
  155. },
  156. examine(url) {
  157. var imgarr =[]
  158. for(var i=0;i<url.length;i++){
  159. imgarr.push(url[i].image)
  160. }
  161. console.log(imgarr)
  162. uni.previewImage({
  163. urls: imgarr
  164. });
  165. },
  166. },
  167. onReachBottom() {
  168. this.page++
  169. this.getAftersale(Number(this.imports))
  170. }
  171. }
  172. </script>
  173. <style lang="scss">
  174. .search_top_input{
  175. width: 90%;
  176. height: 54rpx;
  177. background-color: #E4E4E4;
  178. border-radius: 27rpx;
  179. position: absolute;
  180. top: 100rpx;
  181. right: 5%;
  182. padding-top: 8rpx;
  183. box-sizing: border-box;
  184. input {
  185. width: 85%;
  186. // text-indent: 1rem;
  187. font-size: 26rpx;
  188. padding-left: 20px;
  189. }
  190. .icon{
  191. position: absolute;
  192. top: 8rpx;
  193. right: 26rpx;
  194. }
  195. }
  196. .aftersaleinfo{
  197. width: 100%;
  198. position: relative;
  199. top: 98px;
  200. height: 100rpx;
  201. text-align: center;
  202. line-height: 100rpx;
  203. font-size: 32rpx;
  204. }
  205. .aftersale {
  206. width: 100%;
  207. // margin-top: 20rpx;
  208. position: relative;
  209. top: 118px;
  210. .aftersale_item {
  211. width: 90%;
  212. margin: 0 auto 30rpx;
  213. box-shadow: 0 0 10rpx #bcb9ca;
  214. padding: 30rpx 20rpx 20rpx;
  215. position: relative;
  216. box-sizing: border-box;
  217. .aftersale_item_title {
  218. width: 100%;
  219. span {
  220. margin-left: 16rpx;
  221. font-weight: 700;
  222. }
  223. }
  224. .aftersale_item_con {
  225. width: 92%;
  226. margin-left: 8%;
  227. margin-top: 20rpx;
  228. p {
  229. height: 48rpx;
  230. font-size: 24rpx;
  231. color: #BEBEBE;
  232. }
  233. }
  234. .aftersale_item_operate {
  235. width: 70%;
  236. display: flex;
  237. margin: 18rpx 0 0 30%;
  238. button {
  239. width: 130rpx;
  240. padding: 0;
  241. font-size: 24rpx;
  242. color: #FFFFFF;
  243. }
  244. .fault {
  245. background-color: #F78E01;
  246. }
  247. .imgs {
  248. background-color: #71CD9A;
  249. }
  250. .video {
  251. background-color: #53C6E6;
  252. }
  253. .none {
  254. background-color: #F3F3F3;
  255. color: #B4B4B4;
  256. }
  257. }
  258. .aftersale_item_icon {
  259. position: absolute;
  260. top: 0;
  261. right: 36rpx;
  262. image {
  263. width: 68rpx;
  264. height: 64rpx;
  265. }
  266. }
  267. }
  268. }
  269. .model {
  270. width: 90%;
  271. .model_box {
  272. width: 90%;
  273. margin: 20rpx auto 48rpx;
  274. display: flex;
  275. justify-content: center;
  276. }
  277. }
  278. </style>