Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

add-work-supplement.vue 16KB

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