index.vue 9.1 KB

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