index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view style="position: fixed;z-index: 100;top: 40px;">
  5. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回">
  6. <view class="bases_search">
  7. <view class="bases_search_text" @click="search">
  8. <u-icon name="search" class="search" @click="search"></u-icon>
  9. <input type="text" v-model="data.search" placeholder="设备ID搜索" disabled/>
  10. </view>
  11. </view>
  12. </uni-nav-bar>
  13. </view>
  14. <image :src="$imageURL+'/bigdata_app/image/afterSale/dcd7147f4b15d00c5c90006738b8453.png'" class="expertimages"></image>
  15. <view class="aftersaleTF" v-if="aftersaleTF">
  16. 暂无数据
  17. </view>
  18. <view class="aftersale" v-else>
  19. <view class="aftersale_item" v-for="(item,index) in faultdata" :key="index">
  20. <view class="aftersale_item_title">
  21. <u-icon name="calendar" color="#71D8AF" size="34"></u-icon>
  22. <span>设备 ID:{{item.device_id}}</span>
  23. </view>
  24. <view class="aftersale_item_con">
  25. <p>联系人:{{item.user}}</p>
  26. <p>联系电话:{{item.userphone}}</p>
  27. <p>位置:{{item.addr}}</p>
  28. <p>故障上报时间:{{item.uptime|timeFormat()}}</p>
  29. </view>
  30. <view class="aftersale_item_operate">
  31. <button :class="item.errordesc?'fault':'none'" :disabled="!item.errordesc" @click="fault(item.errordesc)">故障原因</button>
  32. <button :class="item.errorimg?'imgs':'none'" :disabled="!item.errorimg" @click="faultImg(item.errorimg)">图片</button>
  33. <button :class="item.errorvideo?'video':'none'" :disabled="!item.errorvideo" @click="faultVideo(item.errorvideo)">视频</button>
  34. </view>
  35. <view class="aftersale_item_icon">
  36. <image :src="$imageURL+'/bigdata_app/image/afterSale/'+item.device_type+'.png'" mode=""></image>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="addindent" @click="addf">
  41. 新 增 售 后 单
  42. </view>
  43. <u-modal v-model="show" :mask-close-able="maskcloseable" :show-confirm-button="showconfirmbutton" :title="title" class="model">
  44. <view class="model_box">
  45. <p v-if="faultinfo_tf">{{faultinfo}}</p>
  46. <u-swiper :list="faultimg" v-if="faultimg_tf" class="uswiper" height="400" style="width: 100%;" @click="examine(faultimg)"></u-swiper>
  47. <video :src="BASE_URL+faultvideo" controls v-if="faultvideo_tf" style="width:90%;"></video>
  48. </view>
  49. </u-modal>
  50. <view class="top" v-if="isTop" @click="top">
  51. <image :src="$imageURL+'/bigdata_app'+'/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. BASE_URL: 'http://114.115.147.140:8002',
  60. faultdata: [],
  61. title:"",//弹框标题
  62. show: false,//弹框先显示
  63. maskcloseable: true,
  64. showconfirmbutton: false,
  65. faultinfo: '',//故障信息
  66. faultinfo_tf:false,//故障信息显示
  67. faultvideo: '',//故障视频
  68. faultvideo_tf:false,//故障视频显示
  69. faultimg: [],//故障图片
  70. faultimg_tf: false,//故障图片显示
  71. page:1,
  72. aftersaleTF:true,
  73. isTop:false
  74. }
  75. },
  76. methods: {
  77. async getAftersale() {
  78. const res = await this.$myRequest({
  79. url: '/api/api_gateway?method=after_sale.after_sale_manage.aftersale_info',
  80. data:{
  81. page:this.page
  82. }
  83. })
  84. console.log(res)
  85. if(res.counts == 0){
  86. this.aftersaleTF = true
  87. }else{
  88. this.aftersaleTF = false
  89. }
  90. this.faultdata =this.faultdata.concat(res.data)
  91. console.log(this.faultdata)
  92. // for (var i = 0; i < this.faultdata.length; i++) {
  93. // if (this.faultdata[i].errorimg) {
  94. // this.faultdata[i].errorimg = JSON.parse(this.faultdata[i].errorimg)
  95. // }else{
  96. // this.faultdata[i].errorimg = []
  97. // }
  98. // console.log(this.faultdata[i].errorimg)
  99. // }
  100. // console.log(res)
  101. },
  102. fault(info) { //查看故障信息
  103. this.title="故障信息"
  104. this.show = true
  105. this.faultinfo = info
  106. this.faultimg_tf = false
  107. this.faultinfo_tf=true
  108. this.faultvideo_tf=false
  109. },
  110. faultImg(info) { //查看故障图片
  111. console.log(JSON.parse(info))
  112. this.faultimg=JSON.parse(info)
  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. console.log(info)
  122. this.title="故障视频"
  123. if(info.indexOf("[")!=-1){
  124. this.faultvideo=JSON.parse(info)[0]
  125. }else{
  126. this.faultvideo=info
  127. }
  128. console.log(this.faultvideo)
  129. this.show = true
  130. this.faultimg_tf = false
  131. this.faultinfo_tf=false
  132. this.faultvideo_tf=true
  133. },
  134. search() { //搜索
  135. uni.navigateTo({
  136. url:"./search"
  137. })
  138. },
  139. addf() { //添加
  140. uni.navigateTo({
  141. url:"./addafter"
  142. })
  143. },
  144. clickLeft(){
  145. uni.switchTab({
  146. url:"../index/index"
  147. })
  148. },
  149. examine(url) {
  150. var imgarr =[]
  151. for(var i=0;i<url.length;i++){
  152. imgarr.push(url[i].image)
  153. }
  154. console.log(imgarr)
  155. uni.previewImage({
  156. urls: imgarr
  157. });
  158. },
  159. top() {
  160. uni.pageScrollTo({
  161. scrollTop: 0,
  162. duration: 500
  163. })
  164. }
  165. },
  166. onLoad() {
  167. // this.getAftersale()
  168. },
  169. onShow(){
  170. this.faultdata=[]
  171. this.getAftersale()
  172. },
  173. onReachBottom() {
  174. this.page++
  175. this.getAftersale()
  176. },
  177. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  178. if (e.scrollTop > 200) { //距离大于200时显示
  179. this.isTop = true
  180. } else { //距离小于200时隐藏
  181. this.isTop = false
  182. }
  183. },
  184. }
  185. </script>
  186. <style lang="scss">
  187. .expertimages {
  188. width: 100%;
  189. height: 154rpx;
  190. position: fixed;
  191. top: 84px;
  192. z-index: 100;
  193. }
  194. .aftersaleTF{
  195. width: 100%;
  196. position: relative;
  197. top: 320rpx;
  198. text-align: center;
  199. padding-top: 40rpx;
  200. font-size: 20px;
  201. }
  202. .bases_search {
  203. width: 60%;
  204. background-color: #FFFFFF;
  205. position: absolute;
  206. top: 10rpx;
  207. left: 50%;
  208. margin-left: -33%;
  209. .bases_search_text {
  210. width: 90%;
  211. margin: 0 auto;
  212. background-color: #F8F8F8;
  213. height: 60rpx;
  214. border-radius: 30rpx;
  215. display: flex;
  216. line-height: 60rpx;
  217. .search {
  218. padding: 0 20rpx;
  219. font-size: 34rpx;
  220. }
  221. input {
  222. width: 80%;
  223. margin-top: 10rpx;
  224. font-size: 28rpx;
  225. }
  226. }
  227. }
  228. .aftersale {
  229. width: 100%;
  230. position: relative;
  231. top: 330rpx;
  232. margin-bottom: 100rpx;
  233. .aftersale_item {
  234. width: 90%;
  235. margin: 0 auto 30rpx;
  236. box-shadow: 0 0 10rpx #bcb9ca;
  237. padding: 30rpx 20rpx 20rpx;
  238. position: relative;
  239. box-sizing: border-box;
  240. .aftersale_item_title {
  241. width: 100%;
  242. span {
  243. margin-left: 16rpx;
  244. font-weight: 700;
  245. }
  246. }
  247. .aftersale_item_con {
  248. width: 92%;
  249. margin-left: 8%;
  250. margin-top: 20rpx;
  251. p {
  252. height: 48rpx;
  253. font-size: 24rpx;
  254. color: #BEBEBE;
  255. }
  256. }
  257. .aftersale_item_operate {
  258. width: 70%;
  259. display: flex;
  260. margin: 18rpx 0 0 30%;
  261. button {
  262. width: 130rpx;
  263. padding: 0;
  264. font-size: 24rpx;
  265. color: #FFFFFF;
  266. }
  267. .fault {
  268. background-color: #F78E01;
  269. }
  270. .imgs {
  271. background-color: #71CD9A;
  272. }
  273. .video {
  274. background-color: #53C6E6;
  275. }
  276. .none {
  277. background-color: #F3F3F3;
  278. color: #B4B4B4;
  279. }
  280. }
  281. .aftersale_item_icon {
  282. position: absolute;
  283. top: 0;
  284. right: 36rpx;
  285. image {
  286. width: 68rpx;
  287. height: 64rpx;
  288. }
  289. }
  290. }
  291. }
  292. .model {
  293. width: 90%;
  294. .model_box {
  295. width: 90%;
  296. margin: 40rpx auto 48rpx;
  297. display: flex;
  298. justify-content: center;
  299. }
  300. }
  301. .top {
  302. position: fixed;
  303. right: 30px;
  304. bottom: 100px;
  305. z-index: 100;
  306. image{
  307. width: 100rpx;
  308. height: 100rpx;
  309. }
  310. }
  311. .addindent{
  312. width: 100%;
  313. position: fixed;
  314. bottom: 0;
  315. left: 0;
  316. height: 80rpx;
  317. text-align: center;
  318. line-height: 80rpx;
  319. background-color: #71cd9a;
  320. color: #ffffff;
  321. font-size: 16px;
  322. }
  323. </style>