You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

add-work-supplement.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <view class="bg">
  3. <view class="title_wrap"><text class="title">基本信息</text><text class="common-word">{{state.orderStatusArr[state.orderStatus]}}</text></view>
  4. <car-number-input :defaultStr="state.form.vehiclePlate" :isClick="isClick"></car-number-input>
  5. <u-form label-width="230" :model="state.form" ref="uForm" :label-style='labelStyle'>
  6. <u-form-item label="车牌颜色" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  7. borderBottom>
  8. <u-input v-model="state.form.vehiclePlateColorStr" input-align='right'disabled/>
  9. </u-form-item>
  10. <u-form-item label="姓名" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  11. borderBottom>
  12. <u-input placeholder='请输入姓名' v-model="state.form.customerName" maxlength="18"
  13. inputAlign="right" disabled/>
  14. </u-form-item>
  15. <u-form-item label="联系方式" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  16. borderBottom>
  17. <u-input placeholder='请输入手机号码' type="number" v-model="state.form.customerTel" maxlength="11"
  18. inputAlign="right" disabled/>
  19. </u-form-item>
  20. </u-form>
  21. </view>
  22. <view class="bg">
  23. <view class="title">工单信息</view>
  24. <u-form label-width="230" :model="state.form" ref="uForm" :label-style='labelStyle' borderBottom>
  25. <u-form-item label="工单号码" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  26. borderBottom>
  27. <u-input placeholder='请输入工单号码' v-model="state.params.serviceOrderId" inputAlign="right" disabled/>
  28. </u-form-item>
  29. <u-form-item label="工单类型" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  30. borderBottom>
  31. <u-input v-model="state.form.questionTypeStr" input-align='right' disabled/>
  32. </u-form-item>
  33. <u-form-item label="是否ETC用户" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  34. borderBottom>
  35. <u-input v-model="state.form.etcUserStr" input-align='right' disabled/>
  36. </u-form-item>
  37. <u-form-item label="事件发生日期" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  38. borderBottom>
  39. <u-input v-model="state.form.eventOccurrenceDate" input-align='right' disabled/>
  40. </u-form-item>
  41. <u-form-item label="申请日期" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  42. borderBottom>
  43. <u-input v-model="state.form.insertTime" input-align='right' disabled/>
  44. </u-form-item>
  45. <u-form-item label="客户投诉" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  46. borderBottom>
  47. </u-form-item>
  48. <view class="userAppeals" v-for="(item,index) in state.userAppeals">
  49. <view class="time"><text>申请日期:</text><text>{{item.insertTime}}</text></view>
  50. <view><text>投诉内容:</text><text>{{item.userAppeals}}</text></view>
  51. </view>
  52. <u-form-item label="文件" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  53. borderBottom>
  54. </u-form-item>
  55. <view class="down-wrap1" v-for="(item,index) in state.supportingMaterialsUrls" :key="index">
  56. <view class="time"><text>申请日期:</text><text>{{item.insertTime}}</text></view>
  57. <view class="yulan">
  58. <text>附件{{index+1}}</text>
  59. <view>
  60. <text class="down" @click="down(item,index)">预览</text>
  61. </view>
  62. </view>
  63. </view>
  64. </u-form>
  65. </view>
  66. <!-- orderStatus=='1' 待补充 展示详情-->
  67. <view class="bg" v-if="state.orderStatus=='1'">
  68. <view class="title_wrap" style="margin-bottom: 0;"><text class="title">请补充如下的资料</text></view>
  69. <u-form label-width="230" :model="state.form" ref="uForm" :label-style='labelStyle' borderBottom>
  70. <u-form-item label="补充描述" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  71. borderBottom>
  72. </u-form-item>
  73. <textarea v-model="state.params.appeal" style="border: 1rpx dashed rgb(192, 196, 204);min-height: 200rpx; width: 100%;border-radius: 18rpx;padding: 20rpx;box-sizing: border-box;" placeholder="请根据自身情况进行补充。" auto-height adjust-position></textarea>
  74. <u-form-item label="其他佐证材料" :left-icon='`${$imgUrl}issuance/point-form.png`' :left-icon-style='leftIcon'
  75. borderBottom>
  76. <text class="common-word">(不限于图片、文件、不超过5个。)</text>
  77. </u-form-item>
  78. <view class="down-wrap" v-for="(item,index) in state.form.supportingMaterialsUrlShow" :key="index">
  79. <text>附件{{index+1}}</text>
  80. <view>
  81. <text class="down" @click="down(item,index)">预览</text>
  82. <text class="down" @click="deleteFile(index)">删除</text>
  83. </view>
  84. </view>
  85. <button type="default" class="ui-btn-another" @click="addFile()">
  86. +添加附件
  87. </button>
  88. </u-form>
  89. </view>
  90. <view class="action" v-if="state.orderStatus=='1'">
  91. <button type="default" class="ui-btn" @click="savaHandle()">
  92. 提交
  93. </button>
  94. </view>
  95. </template>
  96. <script setup lang="ts">
  97. import { navTo,uploadFile,strReplace,msg} from "@/utils/utils";
  98. import { reactive,ref } from "vue";
  99. import carNumberInput from "@/components/car-number-input/car-number-input.vue";
  100. import { onLoad } from "@dcloudio/uni-app";
  101. import { getItem } from "@/utils/storage.ts"
  102. import {selfServiceView,selfServiceUserUpload} from "@/utils/network/api.js";
  103. import {requestNew} from "@/utils/network/request.js";
  104. const labelStyle = {
  105. color: "#004576",
  106. fontSize: "28rpx",
  107. }
  108. const leftIcon = {
  109. height: '100%',
  110. width: '8rpx',
  111. display: 'flex',
  112. 'align-items': 'center',
  113. 'margin-right': '4rpx',
  114. }
  115. const isClick = ref(false);
  116. const state = reactive({
  117. form: {
  118. customerName: "",
  119. customerTel: "",
  120. vehiclePlate: "",
  121. vehiclePlateColor: "",
  122. vehiclePlateColorStr:"",//车牌颜色中文
  123. questionType:"",
  124. questionTypeStr:"",
  125. etcUser:"",
  126. etcUserStr:"",
  127. eventOccurrenceDate:"",//2016-09-01 00:00:00
  128. supportingMaterialsUrlShow:[],
  129. insertTime:"",
  130. },
  131. params:{
  132. appeal:"",
  133. attachFile:"",
  134. serviceOrderId:""
  135. },
  136. userAppeals:[],
  137. supportingMaterialsUrls:[],
  138. colorRange: [],
  139. questionTypeRange:[
  140. {value: 1, label: "工单1"},
  141. {value: 2, label: "工单2"},
  142. ],
  143. etcUserRange:[
  144. {value: 1, label: "是"},
  145. {value: 0, label: "否"},
  146. ],
  147. orderStatus:"",
  148. orderStatusArr:['待处理','待补充','已结束']
  149. })
  150. onLoad((option : any) => {
  151. state.params.serviceOrderId=option.id
  152. state.orderStatus=option.orderStatus
  153. let getColor = getItem('key')['VEHICLE_COLOR_TYPE'];
  154. for (var k = 0; k < getColor.length; k++) {
  155. let obj = {};
  156. obj['value'] = getColor[k]['code']
  157. obj['label'] = getColor[k]['name']
  158. state.colorRange.push(obj)
  159. }
  160. details()
  161. console.log("state.colorRange",state.colorRange,option)
  162. });
  163. const details=()=>{
  164. const options = {
  165. type: 2,
  166. data: {
  167. id:state.params.serviceOrderId
  168. },
  169. method: "POST",
  170. showLoading: true,
  171. };
  172. requestNew(selfServiceView, options).then((res) => {
  173. state.form.vehiclePlate=res.vehiclePlate
  174. state.form.vehiclePlateColor=res.vehiclePlateColor
  175. // 车牌颜色中文
  176. for(var i=0;i<state.colorRange.length;i++){
  177. console.log("state.colorRange[i]['value']",state.colorRange[i]['value'],res.vehiclePlateColor)
  178. if(state.colorRange[i]['value']==res.vehiclePlateColor){
  179. console.log("state.colorRange[i]['value']",state.colorRange[i]['value'],res.vehiclePlateColor)
  180. state.form.vehiclePlateColorStr=state.colorRange[i]['label']
  181. break;
  182. }
  183. }
  184. state.form.customerName=res.customerName
  185. state.form.customerTel=res.customerTel
  186. state.form.questionType=res.questionType
  187. // 工单类型中文
  188. for(var i=0;i<state.questionTypeRange.length;i++){
  189. if(state.questionTypeRange[i]['value']==res.questionType){
  190. state.form.questionTypeStr=state.questionTypeRange[i]['label']
  191. break;
  192. }
  193. }
  194. state.form.etcUser=res.etcUser
  195. // 是否ETC用户中文
  196. for(var i=0;i<state.etcUserRange.length;i++){
  197. if(state.etcUserRange[i]['value']==res.etcUser){
  198. state.form.etcUserStr=state.etcUserRange[i]['label']
  199. break;
  200. }
  201. }
  202. state.form.eventOccurrenceDate=res.eventOccurrenceDate
  203. state.form.insertTime=res.insertTime
  204. state.userAppeals=res.userAppeals
  205. state.supportingMaterialsUrls=res.supportingMaterialsUrls
  206. console.log("自助工单详情",res,state.supportingMaterialsUrls)
  207. });
  208. }
  209. //车牌号输入
  210. const carNumber = (val : any) => {
  211. state.form.vehiclePlate = val.trim();
  212. };
  213. const savaHandle = () => {
  214. if(!state.params.appeal){
  215. msg('请输入述求');
  216. return;
  217. }
  218. if(!state.form.supportingMaterialsUrlShow){
  219. msg('请上传其他佐证材料');
  220. return;
  221. }
  222. state.params.attachFile=state.form.supportingMaterialsUrlShow.toString()
  223. const options = {
  224. type: 2,
  225. data: {
  226. ...state.params
  227. },
  228. method: "POST",
  229. showLoading: true,
  230. };
  231. requestNew(selfServiceUserUpload, options).then((res) => {
  232. console.log("添加成功",res)
  233. msg("新增自助工单成功")
  234. setTimeout(()=>{
  235. uni.navigateBack()
  236. },1500)
  237. });
  238. }
  239. const addFile=()=>{
  240. const count =5-state.form.supportingMaterialsUrlShow.length
  241. uni.chooseMessageFile({
  242. count: count,
  243. type: 'all',
  244. success (res) {
  245. // tempFilePath可以作为img标签的src属性显示图片
  246. console.log("res",res)
  247. var files=res.tempFiles
  248. for(var i=0;i<files.length;i++){
  249. uploadFile(files[i]['path'], "", "").then((data) => {
  250. state.form.supportingMaterialsUrlShow.push(data);
  251. console.log("state.form.supportingMaterialsUrlShow",state.form.supportingMaterialsUrlShow)
  252. })
  253. }
  254. }
  255. })
  256. }
  257. const cardFileImageUpdate = () => {
  258. uni.chooseImage({
  259. count: 1, //只能选取一张照片
  260. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  261. sourceType: ["camera", "album"], //从相册选择
  262. success: function (res) {
  263. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  264. state.form.proxyUrl = data;
  265. })
  266. },
  267. });
  268. };
  269. const down=(item,index)=>{
  270. // 找到最后一个点(.)的位置
  271. const lastDotIndex = item.lastIndexOf(".");
  272. // 截取最后一个点后面的内容
  273. const result = item.substring(lastDotIndex+1);
  274. if(result=='jpg' || result=='png'){
  275. uni.previewImage({
  276. urls:[item],
  277. longPressActions: {
  278. itemList: ['发送给朋友', '保存图片', '收藏'],
  279. success: function(data) {
  280. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  281. },
  282. fail: function(err) {
  283. console.log(err.errMsg);
  284. }
  285. }
  286. });
  287. }else{
  288. uni.downloadFile({
  289. url: item,
  290. filePath: wx.env.USER_DATA_PATH + '/附件' +index ,
  291. success(res) {
  292. console.log("下载",res)
  293. const filePath = res.filePath
  294. uni.openDocument({
  295. filePath: filePath,
  296. fileType: result,
  297. showMenu: true, //关键点
  298. success: function (res) {
  299. msg("打开文档成功");
  300. },
  301. fail: function (err) {
  302. msg("打开文档失败");
  303. }
  304. });
  305. },
  306. fail: function (err) {
  307. msg("下载文档失败");
  308. console.log("err", err)
  309. },
  310. complete(res) {
  311. }
  312. })
  313. }
  314. }
  315. const deleteFile=(index)=>{
  316. state.form.supportingMaterialsUrlShow.splice(index,1)
  317. }
  318. </script>
  319. <style lang="scss" scoped>
  320. .bg {
  321. background-color: white;
  322. width: 88%;
  323. margin: 0 auto;
  324. margin-top: 20rpx;
  325. border-radius: 12px;
  326. border: 1px solid #FFFFFF;
  327. padding: 20rpx;
  328. overflow: hidden;
  329. .title_wrap {
  330. display: flex;
  331. font-weight: 400;
  332. margin-bottom: 40rpx;
  333. justify-content: space-between;
  334. .title {
  335. font-size: 30rpx;
  336. color: #01243A;
  337. }
  338. }
  339. .des {
  340. font-weight: 400;
  341. font-size: 28rpx;
  342. color: #01243A;
  343. line-height: 56rpx;
  344. margin-top: 10rpx;
  345. text-indent: 1rem;
  346. }
  347. }
  348. .action {
  349. position: absolute;
  350. left: 0;
  351. height: 188rpx;
  352. background-color: #fff;
  353. border-radius: 30rpx 30rpx 0 0;
  354. width: 100vw;
  355. display: flex;
  356. align-items: center;
  357. justify-content: center;
  358. flex-direction: column;
  359. margin-top: 20rpx;
  360. }
  361. .picker{
  362. text-align: right;
  363. color: rgb(192, 196, 204);
  364. }
  365. .data{
  366. text-align: right;
  367. }
  368. .five{
  369. color: rgb(195,188,157);
  370. }
  371. .picture-wrapper {
  372. margin-top: 30rpx;
  373. .bg {
  374. background: #F5F9FB;
  375. border-radius: 10rpx;
  376. padding: 40rpx 30rpx;
  377. display: flex;
  378. justify-content: space-between;
  379. .name {
  380. padding-top: 30rpx;
  381. font-size: 32rpx;
  382. font-family: SourceHanSansSC, SourceHanSansSC;
  383. font-weight: 500;
  384. color: #111;
  385. line-height: 34rpx;
  386. }
  387. .value {
  388. margin-top: 20rpx;
  389. font-size: 22rpx;
  390. font-family: SourceHanSansSC, SourceHanSansSC;
  391. font-weight: 400;
  392. color: #999999;
  393. line-height: 24rpx;
  394. }
  395. .tip {
  396. margin-top: 20rpx;
  397. text-align: center;
  398. width: 100rpx;
  399. height: 30rpx;
  400. border-radius: 6rpx;
  401. border: 1rpx solid #CCB375;
  402. .tip-value {
  403. font-size: 20rpx;
  404. font-family: Microsoft YaHei;
  405. font-weight: 400;
  406. color: #CCB375;
  407. line-height: 30rpx;
  408. opacity: 1;
  409. }
  410. }
  411. }
  412. .icon {
  413. width: 304rpx;
  414. height: 190rpx;
  415. background-image: var(--bgimg);
  416. background-size: 100% 100%;
  417. background-repeat: no-repeat;
  418. }
  419. }
  420. .down-wrap1{
  421. padding: 14rpx 0;
  422. border-bottom: 2rpx solid #E9EDF0;
  423. .time{
  424. display: flex;
  425. justify-content: space-between;
  426. margin-bottom: 16rpx;
  427. }
  428. .yulan{
  429. display: flex;
  430. justify-content: space-between;
  431. .down{
  432. width: 100rpx;
  433. height: 50rpx;
  434. border-radius: 20rpx;
  435. background:linear-gradient(90deg, #CCB375 0%, #E7D398 100%);
  436. font-weight: 400;
  437. font-size: 24rpx;
  438. color: #FFFFFF;
  439. text-align: center;
  440. line-height: 50rpx;
  441. display: inline-block;
  442. margin-left: 16rpx;
  443. }
  444. }
  445. }
  446. .down-wrap{
  447. display: flex;
  448. justify-content: space-between;
  449. margin-bottom: 30rpx;
  450. .down{
  451. width: 100rpx;
  452. height: 50rpx;
  453. border-radius: 20rpx;
  454. background:linear-gradient(90deg, #CCB375 0%, #E7D398 100%);
  455. font-weight: 400;
  456. font-size: 24rpx;
  457. color: #FFFFFF;
  458. text-align: center;
  459. line-height: 50rpx;
  460. display: inline-block;
  461. margin-left: 16rpx;
  462. }
  463. }
  464. .userAppeals{
  465. margin: 10rpx 0;
  466. border-bottom: 2rpx solid #E9EDF0;
  467. padding: 14rpx 0;
  468. .time{
  469. display: flex;
  470. justify-content: space-between;
  471. margin-bottom: 16rpx;
  472. }
  473. }
  474. </style>