index.vue 6.6 KB

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