index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view>
  3. <view style="position: fixed;z-index: 100;">
  4. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="售后系统"></uni-nav-bar>
  5. </view>
  6. <view class="aftersale_search">
  7. <u-icon name="search" class="sp_icon" @click="search"></u-icon>
  8. <u-icon name="plus" class="sp_icon" @click="addf"></u-icon>
  9. </view>
  10. <image src="../../static/image/afterSale/dcd7147f4b15d00c5c90006738b8453.png" class="expertimages"></image>
  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: 540rpx;"></video>
  38. </view>
  39. </u-modal>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  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() {
  81. const res = await this.$myRequest({
  82. url: '/api/api_gateway?method=after_sale.after_sale_manage.aftersale_info',
  83. })
  84. this.faultdata = res.data
  85. for (var i = 0; i < this.faultdata.length; i++) {
  86. this.faultdata[i].errorimg = JSON.parse(this.faultdata[i].errorimg)
  87. if (this.faultdata[i].errorimg == null) {
  88. this.faultdata[i].errorimg = []
  89. }
  90. }
  91. console.log(res.data)
  92. },
  93. fault(info) { //查看故障信息
  94. this.title="故障信息"
  95. this.show = true
  96. this.faultinfo = info
  97. this.faultimg_tf = false
  98. this.faultinfo_tf=true
  99. this.faultvideo_tf=false
  100. },
  101. faultImg(info) { //查看故障图片
  102. this.faultimg=[]
  103. console.log(info)
  104. for (var i = 0; i < info.length; i++) {
  105. let obj = {}
  106. obj.image = info[i]
  107. this.faultimg.push(obj)
  108. }
  109. this.title="故障图片"
  110. this.show = true
  111. this.faultimg_tf = true
  112. this.faultinfo_tf=false
  113. this.faultvideo_tf=false
  114. },
  115. faultVideo(info) { //查看故障视频
  116. this.title="故障视频"
  117. if(info.indexOf("[")!=-1){
  118. this.faultvideo=JSON.parse(info)[0]
  119. }else{
  120. this.faultvideo=info
  121. }
  122. console.log(this.faultvideo)
  123. this.show = true
  124. this.faultimg_tf = false
  125. this.faultinfo_tf=false
  126. this.faultvideo_tf=true
  127. },
  128. search() { //搜索
  129. uni.navigateTo({
  130. url:"./search"
  131. })
  132. },
  133. addf() { //添加
  134. uni.navigateTo({
  135. url:"./addafter"
  136. })
  137. },
  138. clickLeft(){
  139. uni.switchTab({
  140. url:"../index/index"
  141. })
  142. }
  143. },
  144. onLoad() {
  145. this.getAftersale()
  146. }
  147. }
  148. </script>
  149. <style lang="scss">
  150. .expertimages {
  151. width: 100%;
  152. height: 154rpx;
  153. position: fixed;
  154. top: 44px;
  155. z-index: 100;
  156. }
  157. .aftersale_search {
  158. position: fixed;
  159. z-index: 100;
  160. top: 24rpx;
  161. right: 20rpx;
  162. .sp_icon {
  163. font-size: 36rpx;
  164. margin-left: 16rpx;
  165. }
  166. }
  167. .aftersale {
  168. width: 100%;
  169. // margin-top: 20rpx;
  170. position: relative;
  171. top: 264rpx;
  172. .aftersale_item {
  173. width: 90%;
  174. margin: 0 auto 30rpx;
  175. box-shadow: 0 0 10rpx #bcb9ca;
  176. padding: 30rpx 20rpx 20rpx;
  177. position: relative;
  178. .aftersale_item_title {
  179. width: 100%;
  180. span {
  181. margin-left: 16rpx;
  182. font-weight: 700;
  183. }
  184. }
  185. .aftersale_item_con {
  186. width: 92%;
  187. margin-left: 8%;
  188. margin-top: 20rpx;
  189. p {
  190. height: 48rpx;
  191. font-size: 24rpx;
  192. color: #BEBEBE;
  193. }
  194. }
  195. .aftersale_item_operate {
  196. width: 70%;
  197. display: flex;
  198. margin: 18rpx 0 0 30%;
  199. button {
  200. width: 130rpx;
  201. padding: 0;
  202. font-size: 24rpx;
  203. color: #FFFFFF;
  204. }
  205. .fault {
  206. background-color: #F78E01;
  207. }
  208. .imgs {
  209. background-color: #71CD9A;
  210. }
  211. .video {
  212. background-color: #53C6E6;
  213. }
  214. .none {
  215. background-color: #F3F3F3;
  216. color: #B4B4B4;
  217. }
  218. }
  219. .aftersale_item_icon {
  220. position: absolute;
  221. top: 0;
  222. right: 36rpx;
  223. image {
  224. width: 68rpx;
  225. height: 64rpx;
  226. }
  227. }
  228. }
  229. }
  230. .model {
  231. width: 90%;
  232. .model_box {
  233. width: 90%;
  234. margin: 20rpx auto 48rpx;
  235. }
  236. }
  237. </style>