View.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <template>
  2. <view class="container" v-if="isShow">
  3. <view class="evaluateBtn" v-if="type == 'mine' && infoData.isVisit" @tap="onEvaluateViewTo(infoData.id)">查看满意度评价</view>
  4. <view class="itemBox" v-if="type == 'mine'">
  5. <view v-if="infoData.redPackStatusTxt">
  6. <view class="itemHeader">奖励审核结果</view>
  7. <view class="itemBody">
  8. <text>{{infoData.redPackStatusTxt}}</text>
  9. </view>
  10. </view>
  11. <view v-if="infoData.auditRemark">
  12. <view class="itemHeader" style="padding-top: 40rpx;">审批意见</view>
  13. <view class="itemBody">
  14. <text>{{infoData.auditRemark}}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="itemBox">
  19. <view class="itemHeader">线索信息</view>
  20. <view class="itemBody">
  21. <view class="infoItemBox">
  22. <text class="infoLable">工单编号</text>
  23. <text class="infoText">{{infoData.no || ''}}</text>
  24. </view>
  25. <!-- <view class="infoItemBox" style="display: none;">
  26. <text class="infoLable">线索类型</text>
  27. <text class="infoText">{{infoData.AcceptanceType || ''}}</text>
  28. </view> -->
  29. <view class="infoItemBox">
  30. <text class="infoLable">线索标题</text>
  31. <text class="infoText">{{infoData.title || ''}}</text>
  32. </view>
  33. <view class="infoItemBox">
  34. <view class="fway-form-lable-block" style="width: 100%;padding: 10rpx 0;">
  35. <view class="fway-form-lable-title" style="width: 160rpx;color: #666666;">事件描述</view>
  36. <view class="fway-form-lable-btn" style="width: calc(100% - 180rpx);">
  37. <view class="vioceBox">
  38. <view v-if="vioceList.length > 0" class="vioceListBox">
  39. <view class="vioceItemBox" v-for="(item, index) in vioceList" :key="index">
  40. <view class="vioceItemImgBox" @tap="onPlayVioce(item.tempFilePath)">
  41. <view class="vioceItemBG" :style="'width: '+ vioceItemBGWidth + '%'"></view>
  42. <image class="vioceItemImg" src="/static/img/write/bofang.png"
  43. v-if="!item.isPlay"></image>
  44. <image class="vioceItemImg" src="/static/img/write/zanting.png" v-else>
  45. </image>
  46. <text class="vioceItemDuration"
  47. v-if="item.duration > 0">{{Math.round(item.duration / 1000)}}s</text>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <text class="infoText"
  55. style="width: calc(100% - 10rpx);margin-left: 10rpx;">{{infoData.content || ''}}</text>
  56. </view>
  57. <view class="infoItemBox">
  58. <text class="infoLable">事发地点</text>
  59. <text class="infoText">{{infoData.county || ''}}</text>
  60. </view>
  61. <view class="infoItemBox">
  62. <text class="infoLable">是否保密</text>
  63. <text class="infoText" v-if="infoData.isSecret == '1'">保密</text>
  64. <text class="infoText" v-else>不保密</text>
  65. </view>
  66. <view class="infoItemBox">
  67. <text class="infoLable">上报时间</text>
  68. <text class="infoText">{{infoData.creationTime || ''}}</text>
  69. </view>
  70. <view class="infoItemBox" v-if="photoList.length > 0">
  71. <text class="infoLable">现场图片</text>
  72. <view class="infoContent">
  73. <view class="photoListBox">
  74. <view class="photoItemBox" v-for="(item, index) in photoList" :key="index"
  75. @tap="onPreviewImage" :data-url="item.tempFilePath">
  76. <image class="photoItemImg" :src="item.tempFilePath" mode="aspectFit"></image>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="infoItemBox" v-if="videoList.length > 0">
  82. <text class="infoLable">现场视频</text>
  83. <view class="infoContent">
  84. <view class="photoListBox">
  85. <view class="photoItemBox" v-for="(item, index) in videoList" :key="index">
  86. <video class="photoItemImg" :id="index" :src="item.tempFilePath"></video>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="infoItemBox" v-if="fileList.length > 0">
  92. <text class="infoLable">其他附件</text>
  93. <view class="infoContent">
  94. <view class="fileListBox">
  95. <view class="fileItemBox" v-for="(item, index) in fileList" :key="index" @tap="onPreviewFile(item.tempFilePath)">
  96. <text class="fileName">{{item.FileName}}</text>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="itemBox">
  104. <view class="itemHeader">回复结果</view>
  105. <view class="itemBody">
  106. <text v-if="infoData.opinion">{{infoData && infoData.opinion}}</text>
  107. <view class="noneBox" v-else>
  108. <image class="noneImg" src="/static/img/mine/noneBG.png"></image>
  109. <text class="noneText">暂无办理结果,请稍后</text>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="itemBox">
  114. <view class="itemHeader">办理流程</view>
  115. <view class="example-body">
  116. <uni-steps :options="listDetail" active-color="#007AFF" :active="active" direction="column" />
  117. </view>
  118. </view>
  119. <!-- <block v-if="infoData.ProcState == '办理完成'">
  120. <view class="fway-btnBox">
  121. <button class="fway-btn" @tap="onAppraiseTo" v-if="isCanAppraise == '1'">满意度评价</button>
  122. <button class="fway-btn" @tap="onAppraiseViewTo" v-elif="isCanAppraise == '0'">查看满意度评价</button>
  123. </view>
  124. </block> -->
  125. </view>
  126. </template>
  127. <script>
  128. const innerAudioContext = uni.createInnerAudioContext();
  129. var that;
  130. export default {
  131. data() {
  132. return {
  133. isShow: false,
  134. id: '',
  135. type: 'mine', // mine:我提交的隐患 open:隐患公示
  136. userType: '',
  137. infoData: null,
  138. vioceList: [],
  139. vioceItemBGWidth: 0,
  140. photoList: [],
  141. videoList: [],
  142. fileList: [],
  143. isCanAppraise: '',
  144. active: 1,
  145. listDetail: []
  146. }
  147. },
  148. onLoad(options) {
  149. that = this;
  150. that.id = options.id;
  151. that.type = options.type;
  152. that.userType = uni.getStorageSync('userInfo').userType;
  153. if (that.type == 'open'){
  154. that.onGetOpenData(function(){
  155. that.isShow = true;
  156. });
  157. }else if (that.type == 'mine'){
  158. that.onGetMineData(function(){
  159. that.isShow = true;
  160. });
  161. }
  162. },
  163. methods: {
  164. onGetOpenData(fun) {
  165. that.$admin.reqDirect({
  166. method: 'GET',
  167. url: '/api/v1/Snapshot/order/published/' + that.id
  168. }).then(res => {
  169. if (res) {
  170. if (res.fileJson && res.fileJson.length > 0){
  171. that.onFileData(res.fileJson);
  172. }
  173. if (res.workflow && res.workflow.length > 0){
  174. that.onFlowData(res.workflow)
  175. }
  176. res.creationTime = that.$util.formatTime(new Date(res.creationTime))
  177. that.infoData = res;
  178. }
  179. typeof fun === 'function' && fun();
  180. })
  181. },
  182. onGetMineData(fun) {
  183. that.$admin.req({
  184. method: 'GET',
  185. url: '/api/v1/Snapshot/order/' + that.id
  186. }).then(res => {
  187. if (res) {
  188. if (res.fileJson && res.fileJson.length > 0){
  189. that.onFileData(res.fileJson);
  190. }
  191. if (res.workflow && res.workflow.length > 0){
  192. that.onFlowData(res.workflow)
  193. }
  194. res.creationTime = that.$util.formatTime(new Date(res.creationTime))
  195. that.infoData = res;
  196. }
  197. typeof fun === 'function' && fun();
  198. })
  199. },
  200. // 附件数据生成
  201. onFileData(arrData){
  202. arrData.forEach((item, index) => {
  203. let fileType = item.fileType;
  204. switch (fileType) {
  205. // 照片
  206. case 'jpg':
  207. case 'png':
  208. case 'jpeg':
  209. case 'svg':
  210. case 'gif':
  211. case 'webp':
  212. case 'bmp':
  213. let strImg = item.path ? item.path : '';
  214. if (strImg) {
  215. that.photoList.push({
  216. tempFilePath: strImg
  217. })
  218. }
  219. break;
  220. case 'mp4':
  221. case '3gp':
  222. case 'm3u8':
  223. // 视频
  224. let strVideo = item.path ? item.path : '';
  225. if (strVideo) {
  226. that.videoList.push({
  227. tempFilePath: strVideo
  228. })
  229. }
  230. break;
  231. case 'mp3':
  232. case 'aac':
  233. case 'm4a':
  234. case 'wav':
  235. // 音频
  236. let strVioce = item.path ? item.path : '';
  237. if (strVioce) {
  238. that.vioceList.push({
  239. tempFilePath: strVioce,
  240. duration: item.Duration * 1,
  241. isPlay: false
  242. })
  243. }
  244. break;
  245. case 'xls':
  246. case 'xlsx':
  247. case 'xlsm':
  248. case 'pdf':
  249. case 'doc':
  250. case 'docx':
  251. // 其他附件
  252. let strFile = item.path ? item.path : '';
  253. if (strFile) {
  254. that.fileList.push({
  255. tempFilePath: strFile,
  256. FileName: item.fileName
  257. })
  258. }
  259. break;
  260. default:
  261. console.log('文件格式暂不支持')
  262. break;
  263. }
  264. })
  265. },
  266. // 流程数据生成
  267. onFlowData(data){
  268. data.forEach((item, index) => {
  269. that.listDetail.push({title: item.name, desc: that.$util.formatTime(new Date(item.handleTime))})
  270. })
  271. that.active = that.listDetail.length - 1
  272. },
  273. onPreviewImage(e) {
  274. let arrStrPhoto = [];
  275. that.photoList.forEach((item, index) => {
  276. arrStrPhoto.push(item.tempFilePath)
  277. })
  278. uni.previewImage({
  279. urls: arrStrPhoto,
  280. current: e.currentTarget.dataset.url
  281. });
  282. },
  283. onPreviewFile(filePath) {
  284. // #ifdef MP-WEIXIN
  285. wx.downloadFile({
  286. url: filePath,
  287. success: function (res) {
  288. const strFilePath = res.tempFilePath
  289. wx.openDocument({
  290. filePath: strFilePath
  291. })
  292. }
  293. })
  294. // #endif
  295. },
  296. onPlayVioce(src) {
  297. let that = this;
  298. if (src) {
  299. let indexVioce = '';
  300. that.vioceList.forEach((item, index) => {
  301. if (item.tempFilePath == src) {
  302. indexVioce = index;
  303. that.vioceList[index].isPlay = true;
  304. that.$set(that.vioceList, index, that.vioceList[index]);
  305. }
  306. })
  307. innerAudioContext.src = src;
  308. innerAudioContext.play();
  309. // 设置录音控制
  310. let vioceInterval = '';
  311. let vioceTime = 0;
  312. innerAudioContext.onPlay(function() {
  313. // 定时器设置背景色宽度
  314. vioceInterval = setInterval(() => {
  315. vioceTime += 100;
  316. let numTime = (vioceTime / that.vioceList[indexVioce].duration).toFixed(3) * 100;
  317. that.vioceItemBGWidth = numTime > 100 ? 100 : numTime
  318. }, 100)
  319. });
  320. innerAudioContext.onEnded(function() {
  321. that.vioceList[indexVioce].isPlay = false;
  322. that.$set(that.vioceList, indexVioce, that.vioceList[indexVioce]);
  323. clearInterval(vioceInterval);
  324. that.vioceItemBGWidth = 0
  325. });
  326. }
  327. },
  328. onEvaluateViewTo(id) {
  329. uni.navigateTo({
  330. url: '/pagesBase/Order/EvaluateView?id=' + encodeURIComponent(id)
  331. })
  332. }
  333. }
  334. }
  335. </script>
  336. <style lang="less">
  337. .container {
  338. background-color: #efefef;
  339. }
  340. .evaluateBtn {
  341. background-color: #3e6ffd;
  342. color: #fff;
  343. font-size: 32rpx;
  344. text-align: center;
  345. margin: 26rpx 100rpx;
  346. padding: 30rpx 20rpx;
  347. border-radius: 10rpx;
  348. }
  349. .itemBox {
  350. background-color: #ffffff;
  351. margin: 26rpx 20rpx;
  352. padding: 30rpx 20rpx;
  353. border-radius: 10rpx;
  354. }
  355. .itemHeader {
  356. color: #000006;
  357. font-weight: bold;
  358. margin-bottom: 30rpx;
  359. font-size: 34rpx;
  360. }
  361. .itemBody {
  362. line-height: 48rpx;
  363. color: #333333;
  364. font-size: 28rpx;
  365. }
  366. .noneBox {
  367. text-align: center;
  368. }
  369. .noneImg {
  370. width: 190rpx;
  371. height: 180rpx;
  372. margin-bottom: 10rpx;
  373. }
  374. .noneText {
  375. display: block;
  376. color: #999999;
  377. font-size: 28rpx;
  378. }
  379. .infoItemBox {
  380. font-size: 28rpx;
  381. line-height: 60rpx;
  382. }
  383. .infoLable {
  384. width: 160rpx;
  385. display: inline-block;
  386. vertical-align: top;
  387. color: #666666;
  388. }
  389. .infoText {
  390. width: calc(100% - 160rpx);
  391. display: inline-block;
  392. vertical-align: top;
  393. color: #333333;
  394. word-break: break-all;
  395. }
  396. .infoContent {
  397. margin-top: 10rpx;
  398. }
  399. .photoListBox {
  400. width: calc(100%);
  401. line-height: 2;
  402. }
  403. .photoItemBox {
  404. width: calc(30% - 2rpx);
  405. height: 160rpx;
  406. position: relative;
  407. display: inline-block;
  408. border: 2rpx #E5E5E5 solid;
  409. margin-right: 3%;
  410. }
  411. .photoItemImg {
  412. width: 100%;
  413. height: 160rpx;
  414. }
  415. .vioceBox {
  416. display: inline-block;
  417. margin-right: 10rpx;
  418. height: 100%;
  419. }
  420. .vioceListBox {
  421. height: 100%;
  422. }
  423. .vioceItemBox {
  424. height: 100%;
  425. width: calc(100%);
  426. }
  427. .vioceItemImgBox {
  428. display: inline-block;
  429. vertical-align: middle;
  430. width: 100rpx;
  431. padding: 6rpx 20rpx;
  432. background-color: #fff;
  433. color: #999999;
  434. border: 2rpx #ccc solid;
  435. border-radius: 10rpx;
  436. text-align: left;
  437. position: relative;
  438. }
  439. .vioceItemBG {
  440. background-color: #bfbfbf;
  441. width: 0;
  442. position: absolute;
  443. left: 0;
  444. top: 0;
  445. height: 44rpx;
  446. border-radius: 10rpx;
  447. z-index: 0;
  448. }
  449. .isPlay {
  450. background-color: #F6F7F8;
  451. color: #000;
  452. }
  453. .vioceItemImg {
  454. width: 32rpx;
  455. height: 32rpx;
  456. display: inline-block;
  457. vertical-align: middle;
  458. margin-right: 20rpx;
  459. position: relative;
  460. z-index: 99;
  461. }
  462. .vioceItemDuration {
  463. color: #515151;
  464. display: inline-block;
  465. vertical-align: middle;
  466. position: relative;
  467. z-index: 99;
  468. }
  469. .fileListBox{
  470. padding: 10rpx 10rpx 20rpx;
  471. }
  472. .fileItemBox{
  473. display: flex;
  474. justify-content: space-between;
  475. align-items: center;
  476. width: 100%;
  477. }
  478. .fileItemBox + .fileItemBox{
  479. margin-top: 30rpx;
  480. }
  481. .fileName{
  482. width: calc(100%);
  483. white-space: nowrap;
  484. overflow: hidden;
  485. text-overflow: ellipsis;
  486. color: #53d4fc;
  487. }
  488. </style>