index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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"
  6. @clickRight="clickRight"></uni-nav-bar>
  7. <view class="inputs" :style="{'width':width+'rpx'}">
  8. <input type="text" value="" placeholder="请输入设备ID或设备名称" v-model="imports" @input="searchinp"
  9. class="inputbox" :clearable="false" />
  10. <u-icon name="search" size="40" class="icon" @click="search"></u-icon>
  11. </view>
  12. </view>
  13. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app/image/afterSale/dcd7147f4b15d00c5c90006738b8453.png'"
  14. class="expertimages"></image>
  15. <view class="loading" v-if="loadingtf">
  16. <image src="../../static/images/ajax-loader.gif" mode="" class="img"></image>
  17. </view>
  18. <view class="aftersaleTF" v-if="aftersaleTF">
  19. 暂无数据
  20. </view>
  21. <view class="aftersale" v-else>
  22. <view class="aftersale_item" v-for="(item,index) in faultdata" :key="index">
  23. <view class="aftersale_item_title">
  24. <u-icon name="calendar" color="#71D8AF" size="34"></u-icon>
  25. <span>设备 ID:{{item.device_id}}</span>
  26. </view>
  27. <view class="aftersale_item_con">
  28. <p>设备类型:{{devtype[item.device_type]}}</p>
  29. <p>联系人:{{item.user?item.user:"无"}}</p>
  30. <p>联系电话:{{item.userphone?item.userphone:"无"}}</p>
  31. <p>位置:{{item.addr?item.addr:"无"}}</p>
  32. <!-- <p>故障上报时间:{{item.uptime|timeFormat()}}</p> -->
  33. <p>故障信息:{{item.errordesc}}</p>
  34. </view>
  35. <view class="aftersale_item_operate">
  36. <view class="aftersale_item_operate_tiem">
  37. {{item.uptime|timeFormat()}}
  38. </view>
  39. <view class="aftersale_item_operate_btn">
  40. <button :class="item.errorimg.length!=0?'imgs':'none'" :disabled="item.errorimg.length==0"
  41. @click="faultImg(item.errorimg)">图片</button>
  42. <button :class="item.errorvideo?'video':'none'" :disabled="!item.errorvideo"
  43. @click="faultVideo(item.errorvideo)">视频</button>
  44. </view>
  45. <!-- <button :class="item.errordesc?'fault':'none'" :disabled="!item.errordesc"
  46. @click="fault(item.errordesc)">故障原因</button> -->
  47. </view>
  48. <!-- <view class="aftersale_item_icon">
  49. <image
  50. :src="'http://www.hnyfwlw.com:8006/bigdata_app/image/afterSale/'+item.device_type+'.png'"
  51. mode=""></image>
  52. </view> -->
  53. </view>
  54. </view>
  55. <view class="addindent" @click="addf">
  56. 新 增 售 后 单
  57. </view>
  58. <u-modal v-model="show" :mask-close-able="maskcloseable" :show-confirm-button="showconfirmbutton" :title="title"
  59. class="model">
  60. <view class="model_box">
  61. <p v-if="faultinfo_tf">{{faultinfo}}</p>
  62. <u-swiper :list="faultimg" v-if="faultimg_tf" class="uswiper" height="400" style="width: 100%;"
  63. @click="examine(faultimg)"></u-swiper>
  64. <video :src="BASE_URL+faultvideo" controls v-if="faultvideo_tf" style="width:90%;"></video>
  65. </view>
  66. </u-modal>
  67. <view class="top" v-if="isTop" @click="top">
  68. <image src="http://www.hnyfwlw.com:8006/bigdata_app/image/6209a98f0cb3b5086f2ca36152c9269.png" mode="">
  69. </image>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import {
  75. Debounce,
  76. Throttle
  77. } from "../../util/anitthro.js"
  78. export default {
  79. data() {
  80. return {
  81. BASE_URL: 'http://8.136.98.49:8002',
  82. faultdata: [],
  83. title: "", //弹框标题
  84. show: false, //弹框先显示
  85. maskcloseable: true,
  86. showconfirmbutton: false,
  87. faultinfo: '', //故障信息
  88. faultinfo_tf: false, //故障信息显示
  89. faultvideo: '', //故障视频
  90. faultvideo_tf: false, //故障视频显示
  91. faultimg: [], //故障图片
  92. faultimg_tf: false, //故障图片显示
  93. page: 1,
  94. aftersaleTF: true,
  95. isTop: false,
  96. imports: "", //搜索设备id
  97. width: 0, //顶部搜索框的宽度
  98. loadingtf: false, //loading
  99. devtype: {
  100. }
  101. }
  102. },
  103. methods: {
  104. async getAftersale() {
  105. this.loadingtf = true
  106. const res = await this.$myRequest({
  107. url: '/api/api_gateway?method=after_sale.after_sale_manage.aftersale_info',
  108. data: {
  109. page: this.page,
  110. f_id: Number(this.imports)
  111. }
  112. })
  113. this.loadingtf = false
  114. if (res.counts == 0) {
  115. this.aftersaleTF = true
  116. } else {
  117. this.aftersaleTF = false
  118. }
  119. this.faultdata = this.faultdata.concat(res.data)
  120. for (var i = 0; i < this.faultdata.length; i++) {
  121. if (this.faultdata[i].errorimg) {
  122. if (!Array.isArray(this.faultdata[i].errorimg)) {
  123. this.faultdata[i].errorimg = JSON.parse(this.faultdata[i].errorimg)
  124. }
  125. } else {
  126. this.faultdata[i].errorimg = []
  127. }
  128. }
  129. console.log(res)
  130. },
  131. fault(info) { //查看故障信息
  132. this.title = "故障信息"
  133. this.show = true
  134. this.faultinfo = info
  135. this.faultimg_tf = false
  136. this.faultinfo_tf = true
  137. this.faultvideo_tf = false
  138. },
  139. faultImg(info) { //查看故障图片
  140. this.faultimg = []
  141. for (var i = 0; i < info.length; i++) {
  142. let obj = {}
  143. obj.image = info[i]
  144. this.faultimg.push(obj)
  145. }
  146. console.log(this.faultimg)
  147. this.title = "故障图片"
  148. this.show = true
  149. this.faultimg_tf = true
  150. this.faultinfo_tf = false
  151. this.faultvideo_tf = false
  152. },
  153. faultVideo(info) { //查看故障视频
  154. this.title = "故障视频"
  155. if (info.indexOf("[") != -1) {
  156. this.faultvideo = JSON.parse(info)[0]
  157. } else {
  158. this.faultvideo = info
  159. }
  160. console.log(this.faultvideo)
  161. this.show = true
  162. this.faultimg_tf = false
  163. this.faultinfo_tf = false
  164. this.faultvideo_tf = true
  165. },
  166. clickRight() { //搜索
  167. this.width = 600
  168. },
  169. addf() { //添加
  170. uni.navigateTo({
  171. url: "./addafter"
  172. })
  173. },
  174. clickLeft() {
  175. uni.switchTab({
  176. url: "../index/index"
  177. })
  178. },
  179. examine(url) {
  180. var imgarr = []
  181. for (var i = 0; i < url.length; i++) {
  182. imgarr.push(url[i].image)
  183. }
  184. console.log(imgarr)
  185. uni.previewImage({
  186. urls: imgarr
  187. });
  188. },
  189. top() {
  190. uni.pageScrollTo({
  191. scrollTop: 0,
  192. duration: 500
  193. })
  194. },
  195. search() { //搜索按钮搜索
  196. this.faultdata = []
  197. this.getAftersale()
  198. },
  199. searchinp() { //自动搜索
  200. Debounce(() => {
  201. this.faultdata = []
  202. this.getAftersale()
  203. }, 1000)()
  204. },
  205. async getdevtype() {
  206. const res = await this.$myRequest({
  207. url: '/api/api_gateway?method=home.homes.user_device_type',
  208. data: {}
  209. })
  210. console.log(res)
  211. for (var i = 0; i < res.length; i++) {
  212. this.devtype[res[i].id] = res[i].type_name
  213. }
  214. console.log(this.devtype)
  215. }
  216. },
  217. onLoad() {
  218. this.getdevtype()
  219. },
  220. onShow() {
  221. this.page = 1
  222. this.faultdata = []
  223. this.getAftersale()
  224. },
  225. onReachBottom() {
  226. this.page++
  227. this.getAftersale()
  228. },
  229. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  230. if (e.scrollTop > 200) { //距离大于200时显示
  231. this.isTop = true
  232. } else { //距离小于200时隐藏
  233. this.isTop = false
  234. }
  235. },
  236. }
  237. </script>
  238. <style lang="scss">
  239. .expertimages {
  240. width: 100%;
  241. height: 154rpx;
  242. position: fixed;
  243. top: 88px;
  244. z-index: 100;
  245. }
  246. .aftersale_search {
  247. position: fixed;
  248. z-index: 100;
  249. top: 104rpx;
  250. right: 20rpx;
  251. .sp_icon {
  252. font-size: 36rpx;
  253. margin-left: 16rpx;
  254. }
  255. }
  256. .aftersaleTF {
  257. width: 100%;
  258. position: relative;
  259. top: 340rpx;
  260. text-align: center;
  261. padding-top: 40rpx;
  262. font-size: 20px;
  263. }
  264. .loading {
  265. position: fixed;
  266. top: 440px;
  267. width: 95%;
  268. left: 2.5%;
  269. text-align: center;
  270. .img {
  271. width: 300rpx;
  272. height: 40rpx;
  273. }
  274. }
  275. .inputs {
  276. height: 54rpx;
  277. background-color: #E4E4E4;
  278. border-radius: 27rpx;
  279. position: absolute;
  280. right: 20rpx;
  281. top: 24rpx;
  282. transition: width 0.5s;
  283. overflow: hidden;
  284. padding-top: 8rpx;
  285. box-sizing: border-box;
  286. .inputbox {
  287. width: 85%;
  288. text-indent: 1rem;
  289. font-size: 26rpx;
  290. }
  291. .icon {
  292. position: absolute;
  293. top: 8rpx;
  294. right: 26rpx;
  295. }
  296. }
  297. .aftersale {
  298. width: 100%;
  299. position: relative;
  300. top: 340rpx;
  301. margin-bottom: 80rpx;
  302. .aftersale_item {
  303. width: 90%;
  304. margin: 0 auto 30rpx;
  305. box-shadow: 0 0 10rpx #bcb9ca;
  306. padding: 30rpx 20rpx 20rpx;
  307. position: relative;
  308. box-sizing: border-box;
  309. .aftersale_item_title {
  310. width: 100%;
  311. span {
  312. margin-left: 16rpx;
  313. font-weight: 700;
  314. }
  315. }
  316. .aftersale_item_con {
  317. width: 92%;
  318. margin-left: 8%;
  319. margin-top: 20rpx;
  320. p {
  321. // height: 48rpx;
  322. line-height: 48rpx;
  323. font-size: 24rpx;
  324. color: #7d7d7d;
  325. word-break: break-all;
  326. }
  327. }
  328. .aftersale_item_operate {
  329. width: 100%;
  330. display: flex;
  331. justify-content: space-between;
  332. margin-top: 20rpx;
  333. .aftersale_item_operate_btn{
  334. display: flex;
  335. }
  336. .aftersale_item_operate_tiem{
  337. // line-height: 60rpx;
  338. height: 60rpx;
  339. padding-top: 30rpx;
  340. color: #BEBEBE;
  341. font-size: 12px;
  342. box-sizing: border-box;
  343. }
  344. button {
  345. width: 130rpx;
  346. padding: 0;
  347. font-size: 24rpx;
  348. color: #FFFFFF;
  349. margin-left: 20rpx;
  350. }
  351. .fault {
  352. background-color: #F78E01;
  353. }
  354. .imgs {
  355. background-color: #71CD9A;
  356. }
  357. .video {
  358. background-color: #53C6E6;
  359. }
  360. .none {
  361. background-color: #F3F3F3;
  362. color: #B4B4B4;
  363. }
  364. }
  365. .aftersale_item_icon {
  366. position: absolute;
  367. top: 0;
  368. right: 36rpx;
  369. image {
  370. width: 68rpx;
  371. height: 64rpx;
  372. }
  373. }
  374. }
  375. }
  376. .model {
  377. width: 90%;
  378. .model_box {
  379. width: 90%;
  380. margin: 40rpx auto 48rpx;
  381. display: flex;
  382. justify-content: center;
  383. }
  384. }
  385. .top {
  386. position: fixed;
  387. right: 30px;
  388. bottom: 100px;
  389. z-index: 100;
  390. image {
  391. width: 100rpx;
  392. height: 100rpx;
  393. }
  394. }
  395. .addindent {
  396. width: 100%;
  397. position: fixed;
  398. bottom: 0;
  399. left: 0;
  400. height: 80rpx;
  401. text-align: center;
  402. line-height: 80rpx;
  403. background-color: #71cd9a;
  404. color: #ffffff;
  405. font-size: 16px;
  406. }
  407. </style>