index.vue 7.5 KB

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