index.vue 7.6 KB

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