index.vue 9.5 KB

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