search.vue 5.5 KB

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