index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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="'http://www.hnyfwlw.com:8006/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="'http://www.hnyfwlw.com:8006/bigdata_app'+aftersale_icon[Number(item.device_type)-2].src" 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="'http://www.hnyfwlw.com:8006/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://182.92.193.64:8002',
  60. faultdata: [],
  61. aftersale_icon: [{
  62. src: '/image/afterSale/6.png'
  63. },
  64. {
  65. src: '/image/afterSale/1.png'
  66. },
  67. {
  68. src: '/image/afterSale/4.png'
  69. },
  70. {
  71. src: '/image/afterSale/3.png'
  72. },
  73. {
  74. src: '/image/afterSale/5.png'
  75. },
  76. {
  77. src: '/image/afterSale/2.png'
  78. }
  79. ],
  80. title:"",//弹框标题
  81. show: false,//弹框先显示
  82. maskcloseable: true,
  83. showconfirmbutton: false,
  84. faultinfo: '',//故障信息
  85. faultinfo_tf:false,//故障信息显示
  86. faultvideo: '',//故障视频
  87. faultvideo_tf:false,//故障视频显示
  88. faultimg: [],//故障图片
  89. faultimg_tf: false,//故障图片显示
  90. page:1,
  91. aftersaleTF:true,
  92. isTop:false
  93. }
  94. },
  95. methods: {
  96. async getAftersale() {
  97. const res = await this.$myRequest({
  98. url: '/api/api_gateway?method=after_sale.after_sale_manage.aftersale_info',
  99. data:{
  100. page:this.page
  101. }
  102. })
  103. console.log(res)
  104. if(res.counts == 0){
  105. this.aftersaleTF = true
  106. }else{
  107. this.aftersaleTF = false
  108. }
  109. this.faultdata =this.faultdata.concat(res.data)
  110. console.log(this.faultdata)
  111. // for (var i = 0; i < this.faultdata.length; i++) {
  112. // if (this.faultdata[i].errorimg) {
  113. // this.faultdata[i].errorimg = JSON.parse(this.faultdata[i].errorimg)
  114. // }else{
  115. // this.faultdata[i].errorimg = []
  116. // }
  117. // console.log(this.faultdata[i].errorimg)
  118. // }
  119. // console.log(res)
  120. },
  121. fault(info) { //查看故障信息
  122. this.title="故障信息"
  123. this.show = true
  124. this.faultinfo = info
  125. this.faultimg_tf = false
  126. this.faultinfo_tf=true
  127. this.faultvideo_tf=false
  128. },
  129. faultImg(info) { //查看故障图片
  130. console.log(JSON.parse(info))
  131. this.faultimg=JSON.parse(info)
  132. console.log(this.faultimg)
  133. this.title="故障图片"
  134. this.show = true
  135. this.faultimg_tf = true
  136. this.faultinfo_tf=false
  137. this.faultvideo_tf=false
  138. },
  139. faultVideo(info) { //查看故障视频
  140. console.log(info)
  141. this.title="故障视频"
  142. if(info.indexOf("[")!=-1){
  143. this.faultvideo=JSON.parse(info)[0]
  144. }else{
  145. this.faultvideo=info
  146. }
  147. console.log(this.faultvideo)
  148. this.show = true
  149. this.faultimg_tf = false
  150. this.faultinfo_tf=false
  151. this.faultvideo_tf=true
  152. },
  153. search() { //搜索
  154. uni.navigateTo({
  155. url:"./search"
  156. })
  157. },
  158. addf() { //添加
  159. uni.navigateTo({
  160. url:"./addafter"
  161. })
  162. },
  163. clickLeft(){
  164. uni.switchTab({
  165. url:"../index/index"
  166. })
  167. },
  168. examine(url) {
  169. var imgarr =[]
  170. for(var i=0;i<url.length;i++){
  171. imgarr.push(url[i].image)
  172. }
  173. console.log(imgarr)
  174. uni.previewImage({
  175. urls: imgarr
  176. });
  177. },
  178. top() {
  179. uni.pageScrollTo({
  180. scrollTop: 0,
  181. duration: 500
  182. })
  183. }
  184. },
  185. onLoad() {
  186. // this.getAftersale()
  187. },
  188. onShow(){
  189. this.getAftersale()
  190. },
  191. onReachBottom() {
  192. this.page++
  193. this.getAftersale()
  194. },
  195. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  196. if (e.scrollTop > 200) { //距离大于200时显示
  197. this.isTop = true
  198. } else { //距离小于200时隐藏
  199. this.isTop = false
  200. }
  201. },
  202. }
  203. </script>
  204. <style lang="scss">
  205. .expertimages {
  206. width: 100%;
  207. height: 154rpx;
  208. position: fixed;
  209. top: 84px;
  210. z-index: 100;
  211. }
  212. .aftersaleTF{
  213. width: 100%;
  214. position: relative;
  215. top: 320rpx;
  216. text-align: center;
  217. padding-top: 40rpx;
  218. font-size: 20px;
  219. }
  220. .bases_search {
  221. width: 60%;
  222. background-color: #FFFFFF;
  223. position: absolute;
  224. top: 10rpx;
  225. left: 50%;
  226. margin-left: -33%;
  227. .bases_search_text {
  228. width: 90%;
  229. margin: 0 auto;
  230. background-color: #F8F8F8;
  231. height: 60rpx;
  232. border-radius: 30rpx;
  233. display: flex;
  234. line-height: 60rpx;
  235. .search {
  236. padding: 0 20rpx;
  237. font-size: 34rpx;
  238. }
  239. input {
  240. width: 80%;
  241. margin-top: 10rpx;
  242. font-size: 28rpx;
  243. }
  244. }
  245. }
  246. .aftersale {
  247. width: 100%;
  248. position: relative;
  249. top: 330rpx;
  250. margin-bottom: 100rpx;
  251. .aftersale_item {
  252. width: 90%;
  253. margin: 0 auto 30rpx;
  254. box-shadow: 0 0 10rpx #bcb9ca;
  255. padding: 30rpx 20rpx 20rpx;
  256. position: relative;
  257. box-sizing: border-box;
  258. .aftersale_item_title {
  259. width: 100%;
  260. span {
  261. margin-left: 16rpx;
  262. font-weight: 700;
  263. }
  264. }
  265. .aftersale_item_con {
  266. width: 92%;
  267. margin-left: 8%;
  268. margin-top: 20rpx;
  269. p {
  270. height: 48rpx;
  271. font-size: 24rpx;
  272. color: #BEBEBE;
  273. }
  274. }
  275. .aftersale_item_operate {
  276. width: 70%;
  277. display: flex;
  278. margin: 18rpx 0 0 30%;
  279. button {
  280. width: 130rpx;
  281. padding: 0;
  282. font-size: 24rpx;
  283. color: #FFFFFF;
  284. }
  285. .fault {
  286. background-color: #F78E01;
  287. }
  288. .imgs {
  289. background-color: #71CD9A;
  290. }
  291. .video {
  292. background-color: #53C6E6;
  293. }
  294. .none {
  295. background-color: #F3F3F3;
  296. color: #B4B4B4;
  297. }
  298. }
  299. .aftersale_item_icon {
  300. position: absolute;
  301. top: 0;
  302. right: 36rpx;
  303. image {
  304. width: 68rpx;
  305. height: 64rpx;
  306. }
  307. }
  308. }
  309. }
  310. .model {
  311. width: 90%;
  312. .model_box {
  313. width: 90%;
  314. margin: 40rpx auto 48rpx;
  315. display: flex;
  316. justify-content: center;
  317. }
  318. }
  319. .top {
  320. position: fixed;
  321. right: 30px;
  322. bottom: 100px;
  323. z-index: 100;
  324. image{
  325. width: 100rpx;
  326. height: 100rpx;
  327. }
  328. }
  329. .addindent{
  330. width: 100%;
  331. position: fixed;
  332. bottom: 0;
  333. left: 0;
  334. height: 80rpx;
  335. text-align: center;
  336. line-height: 80rpx;
  337. background-color: #71cd9a;
  338. color: #ffffff;
  339. font-size: 16px;
  340. }
  341. </style>