index.vue 7.9 KB

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