index.vue 6.0 KB

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