search.vue 5.7 KB

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