index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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="返回" title="售后系统"></uni-nav-bar>
  6. </view>
  7. <view class="aftersale_search">
  8. <u-icon name="search" class="sp_icon" @click="search"></u-icon>
  9. <u-icon name="plus" class="sp_icon" @click="addf"></u-icon>
  10. </view>
  11. <image src="../../static/image/afterSale/dcd7147f4b15d00c5c90006738b8453.png" class="expertimages"></image>
  12. <view class="aftersale">
  13. <view class="aftersale_item" v-for="(item,index) in faultdata" :key="index">
  14. <view class="aftersale_item_title">
  15. <u-icon name="calendar" color="#71D8AF" size="34"></u-icon>
  16. <span>设备 ID:{{item.device_id}}</span>
  17. </view>
  18. <view class="aftersale_item_con">
  19. <p>联系人:{{item.user}}</p>
  20. <p>联系电话:{{item.userphone}}</p>
  21. <p>位置:{{item.addr}}</p>
  22. <p>故障上报时间:{{item.uptime|timeFormat()}}</p>
  23. </view>
  24. <view class="aftersale_item_operate">
  25. <button :class="item.errordesc?'fault':'none'" :disabled="!item.errordesc" @click="fault(item.errordesc)">故障原因</button>
  26. <button :class="item.errorimg.length!=0?'imgs':'none'" :disabled="item.errorimg.length==0" @click="faultImg(item.errorimg)">图片</button>
  27. <button :class="item.errorvideo?'video':'none'" :disabled="!item.errorvideo" @click="faultVideo(item.errorvideo)">视频</button>
  28. </view>
  29. <view class="aftersale_item_icon">
  30. <image :src="aftersale_icon[Number(item.device_type)-2].src" mode=""></image>
  31. </view>
  32. </view>
  33. </view>
  34. <u-modal v-model="show" :mask-close-able="maskcloseable" :show-confirm-button="showconfirmbutton" :title="title" class="model">
  35. <view class="model_box">
  36. <p v-if="faultinfo_tf">{{faultinfo}}</p>
  37. <u-swiper :list="faultimg" v-if="faultimg_tf" class="uswiper" height="400" style="width: 100%;" @click="examine(faultimg)"></u-swiper>
  38. <video :src="BASE_URL+faultvideo" controls v-if="faultvideo_tf" style="width:90%;"></video>
  39. </view>
  40. </u-modal>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  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. page:1
  79. }
  80. },
  81. methods: {
  82. async getAftersale() {
  83. const res = await this.$myRequest({
  84. url: '/api/api_gateway?method=after_sale.after_sale_manage.aftersale_info',
  85. data:{
  86. page:this.page
  87. }
  88. })
  89. this.faultdata =this.faultdata.concat(res.data)
  90. for (var i = 0; i < this.faultdata.length; i++) {
  91. this.faultdata[i].errorimg = JSON.parse(this.faultdata[i].errorimg)
  92. if (this.faultdata[i].errorimg == null) {
  93. this.faultdata[i].errorimg = []
  94. }
  95. }
  96. console.log(res.data)
  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. console.log(this.faultimg)
  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. if(info.indexOf("[")!=-1){
  123. this.faultvideo=JSON.parse(info)[0]
  124. }else{
  125. this.faultvideo=info
  126. }
  127. console.log(this.faultvideo)
  128. this.show = true
  129. this.faultimg_tf = false
  130. this.faultinfo_tf=false
  131. this.faultvideo_tf=true
  132. },
  133. search() { //搜索
  134. uni.navigateTo({
  135. url:"./search"
  136. })
  137. },
  138. addf() { //添加
  139. uni.navigateTo({
  140. url:"./addafter"
  141. })
  142. },
  143. clickLeft(){
  144. uni.switchTab({
  145. url:"../index/index"
  146. })
  147. },
  148. examine(url) {
  149. var imgarr =[]
  150. for(var i=0;i<url.length;i++){
  151. imgarr.push(url[i].image)
  152. }
  153. console.log(imgarr)
  154. uni.previewImage({
  155. urls: imgarr
  156. });
  157. },
  158. },
  159. onLoad() {
  160. this.getAftersale()
  161. },
  162. onReachBottom() {
  163. this.page++
  164. this.getAftersale()
  165. }
  166. }
  167. </script>
  168. <style lang="scss">
  169. .expertimages {
  170. width: 100%;
  171. height: 154rpx;
  172. position: fixed;
  173. top: 88px;
  174. z-index: 100;
  175. }
  176. .aftersale_search {
  177. position: fixed;
  178. z-index: 100;
  179. top: 104rpx;
  180. right: 20rpx;
  181. .sp_icon {
  182. font-size: 36rpx;
  183. margin-left: 16rpx;
  184. }
  185. }
  186. .aftersale {
  187. width: 100%;
  188. // margin-top: 20rpx;
  189. position: relative;
  190. top: 340rpx;
  191. .aftersale_item {
  192. width: 90%;
  193. margin: 0 auto 30rpx;
  194. box-shadow: 0 0 10rpx #bcb9ca;
  195. padding: 30rpx 20rpx 20rpx;
  196. position: relative;
  197. box-sizing: border-box;
  198. .aftersale_item_title {
  199. width: 100%;
  200. span {
  201. margin-left: 16rpx;
  202. font-weight: 700;
  203. }
  204. }
  205. .aftersale_item_con {
  206. width: 92%;
  207. margin-left: 8%;
  208. margin-top: 20rpx;
  209. p {
  210. height: 48rpx;
  211. font-size: 24rpx;
  212. color: #BEBEBE;
  213. }
  214. }
  215. .aftersale_item_operate {
  216. width: 70%;
  217. display: flex;
  218. margin: 18rpx 0 0 30%;
  219. button {
  220. width: 130rpx;
  221. padding: 0;
  222. font-size: 24rpx;
  223. color: #FFFFFF;
  224. }
  225. .fault {
  226. background-color: #F78E01;
  227. }
  228. .imgs {
  229. background-color: #71CD9A;
  230. }
  231. .video {
  232. background-color: #53C6E6;
  233. }
  234. .none {
  235. background-color: #F3F3F3;
  236. color: #B4B4B4;
  237. }
  238. }
  239. .aftersale_item_icon {
  240. position: absolute;
  241. top: 0;
  242. right: 36rpx;
  243. image {
  244. width: 68rpx;
  245. height: 64rpx;
  246. }
  247. }
  248. }
  249. }
  250. .model {
  251. width: 90%;
  252. .model_box {
  253. width: 90%;
  254. margin: 40rpx auto 48rpx;
  255. display: flex;
  256. justify-content: center;
  257. }
  258. }
  259. </style>