orderprocessreport.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. <!--
  2. * @Title:
  3. * @Description: 维修任务填报提交页
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <view class="container">
  11. <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
  12. @clickLeft="toBack">
  13. <view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
  14. <text style="color: white;font-size: 1rem;">{{title}}</text>
  15. </view>
  16. </uni-nav-bar>
  17. <uni-forms ref="baseForm" :model="formData">
  18. <uni-section :title="failureCheckTitle" ftitleFontSize="0.8rem" type="circle">
  19. <!-- <template v-slot:decoration>
  20. <view class="decoration"></view>
  21. </template> -->
  22. <view style="padding-top: 10px;padding-bottom: 0px;padding-left: 15px;padding-right: 15px;">
  23. <uni-forms-item name='networkPayer' required>
  24. <uni-easyinput :styles="styles" type="textarea" v-model="formData.failureCheckDesc"
  25. :placeholder="failureCheckPlaceholder" />
  26. </uni-forms-item>
  27. </view>
  28. </uni-section>
  29. <uni-section title="解决措施说明" ftitleFontSize="0.8rem" type="circle">
  30. <!-- <template v-slot:decoration>
  31. <view class="decoration"></view>
  32. </template> -->
  33. <view style="padding-top: 10px;padding-bottom: 10px;padding-left: 15px;padding-right: 15px;">
  34. <uni-forms-item required>
  35. <uni-easyinput type="textarea" v-model="formData.processDesc" placeholder="请录入解决方案说明" />
  36. </uni-forms-item>
  37. <uni-card title="拍摄照片" extra="点击下方按钮开始拍摄" :is-shadow="false">
  38. <view class="view-flex-rs-flex-wrap">
  39. <view v-for="(item, index) in failureProcessPhotos" :key="index" class="view-flex-cc"
  40. style="width: 80px;">
  41. <view class="img-container">
  42. <view class="note-image-box">
  43. <view class="note-image-item">
  44. <view class="close-icon" @click="onPhotoDel(index)">
  45. <uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
  46. </view>
  47. <view class="image-box">
  48. <image :src="toOss(item)" mode="widthFix">
  49. </image>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="view-flex-cc" style="width: 80px;">
  56. <view class="img-container">
  57. <view class="note-image-box">
  58. <view class="note-image-item" @click="onCheckPhotoAdd()">
  59. <view class="image-box">
  60. <uni-icons type="plusempty" size="50" color="#eee"></uni-icons>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </uni-card>
  68. </view>
  69. </uni-section>
  70. <uni-section v-if="orderType ==1" title="费用申报" ftitleFontSize="0.8rem" type="circle">
  71. <!-- <template v-slot:decoration>
  72. <view class="decoration"></view>
  73. </template> -->
  74. <view style="padding-top: 10px;padding-bottom: 10px;padding-left: 15px;padding-right: 15px;">
  75. <uni-forms-item label="是否产生费用" label-width="130px" required>
  76. <uni-data-checkbox v-model="formData.costsReport"
  77. :localdata="costsReportItems.items"></uni-data-checkbox>
  78. </uni-forms-item>
  79. <uni-forms-item v-if="formData.costsReport==2">
  80. <uni-easyinput type="textarea" v-model="formData.costsReportDesc" placeholder="请录入费用说明" />
  81. </uni-forms-item>
  82. </view>
  83. </uni-section>
  84. </uni-forms>
  85. <view class="footer">
  86. <view class="control">
  87. <view class="view-flex-rc">
  88. <view class="block"
  89. style="width: 160px;height:32px;margin-left: 10px;margin-right: 10px;border-radius:7px;background-color:lightsalmon"
  90. @click="toSubmit()">
  91. <view class="view-flex-cc">
  92. <uni-icons class="input-uni-icon" type="checkmarkempty" size="18" color="#999" />
  93. </view>
  94. <view class="view-flex-cc" style="padding-left:5px;">
  95. <text style="color:black;font-size:0.7rem">立即提交</text>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import http from '@/http/api.js';
  105. import {
  106. pathToBase64,
  107. base64ToPath
  108. } from '@/js_sdk/mmmm-image-tools/index.js';
  109. import {
  110. oss,
  111. devUrl,
  112. prodUrl
  113. } from '@/common/setting';
  114. export default {
  115. components: {},
  116. data() {
  117. return {
  118. styles: {
  119. color: '#333',
  120. borderColor: '#e5e5e5',
  121. disableColor: '#FFFFFF'
  122. },
  123. rules: {
  124. failureCheckDesc: {
  125. rules: [{
  126. required: true,
  127. errorMessage: '必填项',
  128. }]
  129. },
  130. failureSolutionDesc: {
  131. rules: [{
  132. required: true,
  133. errorMessage: '必填项',
  134. }, ]
  135. },
  136. },
  137. skipPage: 1,
  138. costsApprove: 0,
  139. orderId: 0,
  140. orderType: 1,
  141. formData: {
  142. failureCheckDesc: '',
  143. processDesc: '',
  144. costsReport: 1,
  145. costsReportDesc: '',
  146. },
  147. failureProcessPhotos: [],
  148. pattern: {
  149. color: '#7A7E83',
  150. backgroundColor: '#fff',
  151. selectedColor: '#007AFF',
  152. buttonColor: '#007AFF',
  153. iconColor: '#fff'
  154. },
  155. baseURL: '',
  156. baseOSS: '',
  157. costsReportItems: {
  158. items: [{
  159. 'value': 1,
  160. 'text': '否'
  161. }, {
  162. 'value': 2,
  163. 'text': '是'
  164. }],
  165. current: 1,
  166. },
  167. title: '工单处理填报',
  168. desc: '',
  169. failureCheckTitle: '',
  170. failureCheckPlaceholder: '',
  171. }
  172. },
  173. computed: {},
  174. onLoad(options) {
  175. this.skipPage = options.skipPage;
  176. this.costsApprove = options.costsApprove;
  177. this.orderProcessId = options.orderProcessId;
  178. this.orderId = options.orderId;
  179. this.orderType = options.orderType;
  180. console.log("order type "+this.orderType);
  181. if (this.orderType == 1) {
  182. this.failureCheckTitle = '故障问题描述';
  183. this.failureCheckPlaceholder = '请录入故障问题现象';
  184. } else if (this.orderType == 2) {
  185. this.failureCheckTitle = '服务内容描述';
  186. this.failureCheckPlaceholder = '请录入服务内容';
  187. }
  188. this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
  189. this.baseOSS = oss;
  190. if (this.costsApprove == '2') {
  191. this.getDetail();
  192. }
  193. },
  194. onReady() {
  195. console.log("onReady++++++++++++++")
  196. // 需要在onReady中设置规则
  197. this.$refs.baseForm.setRules(this.rules)
  198. },
  199. onShow() {},
  200. methods: {
  201. toOss(path) {
  202. let url = this.baseOSS + path;
  203. //console.log("tooss " + url)
  204. return url;
  205. },
  206. toBack() {
  207. uni.navigateBack({
  208. delta: Number(this.skipPage)
  209. })
  210. },
  211. getDetail() {
  212. let that = this;
  213. let postData = {};
  214. postData['orderId'] = this.orderId;
  215. http.request({
  216. url: '/galaxy-business/order/process/last/report',
  217. method: 'GET',
  218. data: postData
  219. }).then(res => {
  220. if (res.data != null) {
  221. console.log(JSON.stringify(res.data))
  222. that.formData.processDesc = res.data.processDesc;
  223. that.formData.failureCheckDesc = res.data.failureCheckDesc;
  224. if (res.data.failureProcessPhotoList != null) {
  225. that.failureProcessPhotos = res.data.failureProcessPhotoList;
  226. }
  227. }
  228. }).catch(err => {
  229. console.log(err)
  230. })
  231. },
  232. onCheckPhotoAdd() {
  233. let that = this;
  234. uni.chooseImage({
  235. sourceType: ['album ','camera'],
  236. sizeType: ['compressed'],
  237. success: (res) => {
  238. const len = res.tempFilePaths.length;
  239. if (len === 1) {
  240. res.tempFilePaths.forEach(path => {
  241. that.uploadPhoto(path);
  242. })
  243. } else {
  244. uni.showModal({
  245. content: '只能选择一张图片,请确认!',
  246. showCancel: false
  247. });
  248. }
  249. }
  250. })
  251. },
  252. uploadPhoto(imagePath) {
  253. let that = this;
  254. uni.showLoading({
  255. title: '上传中'
  256. });
  257. uni.uploadFile({
  258. url: this.baseURL + '/galaxy-resource/oss/endpoint/put-file-attach?Blade-Auth=' +
  259. uni.getStorageSync('accessToken'),
  260. fileType: 'image',
  261. filePath: imagePath,
  262. name: 'file',
  263. success: (uploadFileRes) => {
  264. if (uploadFileRes.statusCode == 200) {
  265. let data = JSON.parse(uploadFileRes.data);
  266. if (data.success) {
  267. let path = data.data['name'];
  268. that.failureProcessPhotos.push(path);
  269. }
  270. }
  271. },
  272. fail: (err) => {
  273. console.log(err);
  274. reject('err')
  275. },
  276. complete() {
  277. uni.hideLoading()
  278. }
  279. });
  280. },
  281. onPhotoDel(index) {
  282. this.failureProcessPhotos.splice(index, 1);
  283. },
  284. toSubmit() {
  285. console.log('表单提交');
  286. let that = this;
  287. this.$refs.baseForm.validate().then(res => {
  288. that.submitData();
  289. }).catch(err => {
  290. console.log('表单错误信息:', err);
  291. uni.showModal({
  292. content: "内容填报错误,请根据提示信息检查录入内容!",
  293. showCancel: false,
  294. success(res) {
  295. if (res.confirm) {
  296. //that.$refs.baseForm.clearValidate();
  297. }
  298. }
  299. });
  300. })
  301. },
  302. submitData() {
  303. let formdata = this.formData;
  304. formdata['orderId'] = this.orderId;
  305. if (this.failureProcessPhotos.length > 0) {
  306. let photos = '';
  307. for (let i = 0; i < this.failureProcessPhotos.length; i++) {
  308. if (photos.length > 0) {
  309. photos = photos + ',';
  310. }
  311. photos = photos + this.failureProcessPhotos[i];
  312. }
  313. formdata['failureProcessPhotos'] = photos;
  314. }
  315. let that = this;
  316. http.request({
  317. url: '/galaxy-business/order/process/save',
  318. method: 'POST',
  319. data: formdata
  320. }).then(res => {
  321. if (res.success) {
  322. uni.showModal({
  323. content: '已成功提交',
  324. showCancel: false,
  325. success(res) {
  326. if (res.confirm) {
  327. that.toBack();
  328. }
  329. }
  330. });
  331. } else {
  332. uni.showModal({
  333. content: '' + res.msg,
  334. showCancel: false
  335. });
  336. }
  337. }).catch(err => {
  338. console.log(err)
  339. })
  340. },
  341. formReset: function(e) {
  342. console.log('清空数据')
  343. },
  344. }
  345. }
  346. </script>
  347. <style>
  348. /* page {
  349. background-color: rgb(240, 242, 244);
  350. } */
  351. </style>
  352. <style lang="scss" scoped>
  353. .cell-hover-class {
  354. background-color: rgb(235, 237, 238);
  355. }
  356. .view-flex-rs {
  357. display: flex;
  358. flex-direction: row;
  359. justify-content: flex-start;
  360. align-items: center;
  361. }
  362. .view-flex-rc {
  363. display: flex;
  364. flex-direction: row;
  365. justify-content: center;
  366. align-items: center;
  367. }
  368. .view-flex-re {
  369. display: flex;
  370. flex-direction: row;
  371. justify-content: flex-end;
  372. align-items: center;
  373. }
  374. .view-flex-cs {
  375. display: flex;
  376. flex-direction: column;
  377. justify-content: flex-start;
  378. }
  379. .view-flex-cc {
  380. display: flex;
  381. flex-direction: column;
  382. justify-content: center;
  383. }
  384. .view-flex-ce {
  385. display: flex;
  386. flex-direction: column;
  387. justify-content: flex-end;
  388. }
  389. .line-body {
  390. padding-left: 10px;
  391. padding-right: 10px;
  392. }
  393. .required-star {
  394. color: #FF0000;
  395. font-size: 15px;
  396. width: 20px;
  397. text-align: center;
  398. padding-left: 0px;
  399. padding-right: 2px;
  400. }
  401. .item-title {
  402. color: #909399;
  403. font-size: 15px;
  404. }
  405. .mline-text {
  406. padding-left: 2px;
  407. width: 100%;
  408. /* background-color:#909399; */
  409. height: 70px;
  410. border: 1px solid #FF5A5F;
  411. border-radius: 5px;
  412. }
  413. .footer {
  414. position: fixed;
  415. bottom: 0;
  416. left: 0;
  417. right: 0;
  418. z-index: 1;
  419. height: 100rpx;
  420. padding: 20rpx;
  421. box-sizing: border-box;
  422. display: flex;
  423. align-items: center;
  424. justify-content: flex-end;
  425. background-color: whitesmoke;
  426. .ipt {
  427. width: 380rpx;
  428. height: 77rpx;
  429. background: #f7f7f7;
  430. border-radius: 38px;
  431. padding: 0 37rpx;
  432. box-sizing: border-box;
  433. margin-right: 20rpx;
  434. }
  435. .control {
  436. flex: 1;
  437. display: flex;
  438. align-items: center;
  439. justify-content: flex-end;
  440. .block {
  441. display: flex;
  442. align-items: center;
  443. justify-content: center;
  444. flex: 1;
  445. }
  446. .icon {
  447. height: auto;
  448. }
  449. .c {
  450. width: 41rpx;
  451. margin-right: 10rpx;
  452. }
  453. .s {
  454. width: 36rpx;
  455. }
  456. .t {
  457. width: 31rpx;
  458. }
  459. }
  460. }
  461. .container {
  462. padding: 0 0 100rpx;
  463. }
  464. .img-container {
  465. margin-bottom: 0px;
  466. width: 80px;
  467. height: 80px;
  468. .note-image-box {
  469. margin-top: 5px;
  470. display: flex;
  471. flex-wrap: wrap;
  472. padding: 0px;
  473. .note-image-item {
  474. position: relative;
  475. width: 100%;
  476. height: 0;
  477. padding-top: 100%;
  478. box-sizing: border-box;
  479. // background-color: #18B566;
  480. .close-icon {
  481. display: flex;
  482. justify-content: center;
  483. align-items: center;
  484. position: absolute;
  485. right: 0px;
  486. top: 0px;
  487. width: 22px;
  488. height: 22px;
  489. border-radius: 50%;
  490. background-color: #d5d5d5;
  491. z-index: 2;
  492. }
  493. .image-box {
  494. display: flex;
  495. justify-content: center;
  496. align-items: center;
  497. position: absolute;
  498. top: 0px;
  499. right: 0px;
  500. border: 0px;
  501. left: 0px;
  502. border: 1px #eee solid;
  503. border-radius: 5px;
  504. overflow: hidden;
  505. width: 98%;
  506. height: 98%;
  507. }
  508. }
  509. }
  510. }
  511. .input-body {
  512. background-color: #fff;
  513. padding: 10px;
  514. }
  515. .mb-10 {
  516. margin-top: 0px;
  517. margin-bottom: 0px;
  518. }
  519. .decoration {
  520. width: 6px;
  521. height: 6px;
  522. margin-right: 4px;
  523. border-radius: 50%;
  524. background-color: cadetblue;
  525. }
  526. </style>