reportDetail.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <view class="maintenance-container">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="报工信息" @clickLeft="back"></uni-nav-bar>
  4. <view class="maintenance-wrapper">
  5. <view class="maintenance-content">
  6. <view :scroll-y='true' class="kd-baseInfo">
  7. <view class="kd-cell">
  8. <text class="kd-label">里程</text>
  9. <uni-easyinput v-model="formData.mileage" :clearable='false' :inputBorder='false'>
  10. <template #right>
  11. <view>KM</view>
  12. </template>
  13. </uni-easyinput>
  14. </view>
  15. <template v-for="(item,index) in formData.costList">
  16. <view style="margin-top: 20px;">
  17. <view class="kd-cell">
  18. <text class="kd-label">费用类型</text>
  19. <text class="kd-content">{{ getDict('logistic_list_cost_type',item.costType )}}</text>
  20. </view>
  21. <view class="kd-cell">
  22. <text class="kd-label">金额</text>
  23. <text class="kd-content">{{item.cost}}</text>
  24. </view>
  25. <view class="kd-cell">
  26. <text class="kd-label">备注</text>
  27. <text class="kd-content">{{item.remark}}</text>
  28. </view>
  29. <view style="float: right;" v-if='formData.status==1'>
  30. <button class="btn-reassignment del" type="primary"
  31. @click="handleDelFee(index)">删除</button>
  32. </view>
  33. </view>
  34. </template>
  35. </view>
  36. <template v-if='formData.status==1'>
  37. <button class="btn-execute" type="primary" @click="handleExecute(2)">保存</button>
  38. <button class="btn-reassignment " type="primary" @click="handleAddFee">新增费用</button>
  39. </template>
  40. <template v-else>
  41. <button class="btn-execute" type="primary" @click="back(1)">返回</button>
  42. </template>
  43. </view>
  44. </view>
  45. <u-popup :show="popShow" @close="close">
  46. <view class="select-container">
  47. <view class="title">
  48. <text class="btn cancel" @tap="close">取消</text>
  49. 新增费用
  50. <text class="btn confirm" @tap="submit">确定</text>
  51. </view>
  52. <view class="select-wrapper">
  53. <view class="col deptInp">
  54. <text class="label">费用类型:</text>
  55. <zxz-uni-data-select :localdata="costTypeList" v-model="form.costType"
  56. filterable></zxz-uni-data-select>
  57. </view>
  58. <view class="col userInp">
  59. <text class="label">金额:</text>
  60. <uni-easyinput v-model="form.cost" type='number'></uni-easyinput>
  61. </view>
  62. <view class="col userInp">
  63. <text class="label">备注:</text>
  64. <uni-easyinput v-model="form.remark" type='textarea'></uni-easyinput>
  65. </view>
  66. </view>
  67. </view>
  68. </u-popup>
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. logistictraklistnoteUpdateAPI
  74. } from '@/api/pda/dispatchManage/index.js'
  75. export default {
  76. components: {},
  77. data() {
  78. return {
  79. costTypeList: [],
  80. form: {},
  81. popShow: false,
  82. value: '',
  83. info: {},
  84. formData: {
  85. costList: []
  86. }
  87. }
  88. },
  89. onLoad(options) {
  90. this.formData = JSON.parse(options.item)
  91. this.costTypeList = this.formData.dictList['logistic_list_cost_type'].map(item => {
  92. let values = Object.keys(item)
  93. return {
  94. text: item[values[0]],
  95. value: values[0],
  96. }
  97. })
  98. },
  99. computed: {
  100. getDict() {
  101. return (dictName, val) => {
  102. let find = this.formData.dictList[dictName].find(item => item[val]) || {}
  103. return find[val] ? find[val] : ''
  104. }
  105. }
  106. },
  107. methods: {
  108. back(num = 1) {
  109. uni.navigateBack({
  110. delta: num
  111. })
  112. },
  113. async handleExecute(status) {
  114. if (!this.formData.mileage) {
  115. uni.showToast({
  116. icon: 'error',
  117. title: '请输入里程'
  118. })
  119. return
  120. }
  121. await logistictraklistnoteUpdateAPI({...this.formData,status})
  122. uni.showModal({
  123. title: `此工单报工成功`,
  124. content: '',
  125. confirmText: '确认',
  126. showCancel: false, // 是否显示取消按钮,默认为 true
  127. success: res => {
  128. if (res.confirm) {
  129. this.back(2)
  130. }
  131. }
  132. })
  133. },
  134. handleAddFee() {
  135. this.popShow = true
  136. },
  137. handleDelFee(index) {
  138. this.formData.costList.splice(index, 1)
  139. },
  140. submit() {
  141. if (!this.form.costType) {
  142. uni.showToast({
  143. icon: 'error',
  144. title: '请选择费用类型'
  145. })
  146. return
  147. }
  148. if (!this.form.cost) {
  149. uni.showToast({
  150. icon: 'error',
  151. title: '请输入金额'
  152. })
  153. return
  154. }
  155. this.form.listId = this.formData.id
  156. this.formData.costList.push({
  157. ...this.form
  158. })
  159. this.form = {}
  160. this.close()
  161. },
  162. close() {
  163. this.popShow = false
  164. },
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. @import '@/components/submitted.scss';
  170. .list-cell {
  171. display: flex;
  172. align-items: center;
  173. justify-content: space-between;
  174. color: $uni-text-color-grey;
  175. padding: 5rpx 20rpx;
  176. }
  177. .font-sm {
  178. font-size: $uni-font-size-sm;
  179. }
  180. .font-text {
  181. color: $uni-text-color;
  182. }
  183. .btn-execute {
  184. background-color: $j-primary-border-green;
  185. width: 450rpx;
  186. margin-top: 10vh;
  187. }
  188. .btn-sparepart {
  189. width: 450rpx;
  190. margin-top: 20rpx;
  191. }
  192. .btn-reassignment {
  193. color: $uni-color-primary;
  194. background-color: transparent;
  195. border: none;
  196. box-shadow: none;
  197. &::after {
  198. display: none;
  199. }
  200. }
  201. .del {
  202. color: red;
  203. font-size: 1.5rex;
  204. }
  205. .maintenance-container {
  206. position: fixed;
  207. top: 0;
  208. bottom: 0;
  209. width: 100vw;
  210. display: flex;
  211. flex-direction: column;
  212. /deep/.u-popup {
  213. flex: none !important;
  214. }
  215. }
  216. .maintenance-wrapper {
  217. position: relative;
  218. flex: 1;
  219. }
  220. .maintenance-content {
  221. padding-top: 40rpx;
  222. box-sizing: border-box;
  223. // height: calc(100vh - 88rpx);
  224. position: absolute;
  225. top: 0;
  226. bottom: 0;
  227. left: 0;
  228. right: 0;
  229. display: flex;
  230. flex-direction: column;
  231. }
  232. .kd-cell {
  233. line-height: 90rpx;
  234. border-bottom: 1px dashed #dadada;
  235. display: flex;
  236. justify-content: space-between;
  237. .kd-label {
  238. display: inline-block;
  239. width: 7em;
  240. font-weight: bold;
  241. }
  242. .kd-content {
  243. flex: 1;
  244. text-align: left;
  245. word-break: break-all;
  246. }
  247. }
  248. .kd-baseInfo {
  249. padding: 0 32rpx;
  250. font-size: 28rpx;
  251. height: 70%;
  252. }
  253. .kd-equipment {
  254. flex: 1;
  255. display: flex;
  256. flex-direction: column;
  257. overflow: hidden;
  258. .kd-type-box {
  259. text-align: center;
  260. padding: 26rpx 0;
  261. view {
  262. position: relative;
  263. display: inline-block;
  264. width: 120rpx;
  265. padding: 4rpx 0;
  266. color: #747474;
  267. margin: 0 20rpx;
  268. background-color: rgba(215, 215, 215, 0.5);
  269. &.type—active {
  270. background-color: #1e7f35;
  271. color: #fff;
  272. }
  273. .count {
  274. position: absolute;
  275. top: -9px;
  276. right: -9px;
  277. width: 18px;
  278. height: 18px;
  279. border-radius: 50%;
  280. font-size: 12px;
  281. background-color: red;
  282. color: #fff;
  283. }
  284. }
  285. }
  286. .kd-list-container {
  287. flex: 1;
  288. display: flex;
  289. flex-direction: column;
  290. overflow: hidden;
  291. padding: 12rpx 18rpx;
  292. background-color: $page-bg;
  293. .u-list {
  294. flex: 1;
  295. height: 100% !important;
  296. }
  297. }
  298. }
  299. .spare-parts {
  300. flex: 1;
  301. overflow: hidden;
  302. }
  303. .kd-card {
  304. background-color: #fff;
  305. margin-bottom: 20rpx;
  306. padding: 8rpx 0;
  307. font-size: 28rpx;
  308. word-break: break-all;
  309. .kd-card-wrapper {
  310. padding: 0 30rpx;
  311. border-bottom: 1px solid #dadada;
  312. }
  313. .kd-cell {
  314. line-height: 60rpx;
  315. }
  316. .kd-cell:last-of-type {
  317. border-bottom: none;
  318. }
  319. .status-box {
  320. margin-right: 16rpx;
  321. }
  322. .card-footer {
  323. display: flex;
  324. justify-content: flex-end;
  325. align-items: center;
  326. padding: 8rpx 0 20rpx;
  327. button {
  328. width: 180rpx;
  329. height: 56rpx;
  330. line-height: 56rpx;
  331. font-size: 28rpx;
  332. margin: 0 8rpx;
  333. }
  334. .primary-btn {
  335. background-color: $j-primary-border-green;
  336. }
  337. }
  338. }
  339. .apply-box {
  340. width: 70%;
  341. margin: 0 auto;
  342. display: flex;
  343. align-items: center;
  344. justify-content: space-around;
  345. }
  346. .select-container {
  347. min-height: 60vh;
  348. .title {
  349. display: flex;
  350. justify-content: space-between;
  351. align-items: center;
  352. height: 100rpx;
  353. line-height: 100rpx;
  354. text-align: center;
  355. background-color: $j-primary-border-green;
  356. font-weight: bold;
  357. position: relative;
  358. font-size: 32rpx;
  359. color: #fff;
  360. // .btn-box {
  361. // position: absolute;
  362. // top: 50%;
  363. // right: 10rpx;
  364. // transform: translateY(-50%);
  365. // }
  366. .btn {
  367. width: 80rpx;
  368. height: 32rpx;
  369. display: inline-block;
  370. font-size: 32rpx;
  371. border: 1px solid #fff;
  372. text-align: center;
  373. line-height: 30rpx;
  374. }
  375. }
  376. .select-wrapper {
  377. .col {
  378. display: flex;
  379. // min-height: 0rpx;
  380. margin-top: 22rpx;
  381. align-items: center;
  382. padding-right: 14rpx;
  383. .label {
  384. display: inline-block;
  385. width: 200rpx;
  386. text-align: right;
  387. }
  388. .input_text {
  389. flex: 1;
  390. height: 66rpx;
  391. line-height: 66rpx;
  392. padding: 0rpx 16rpx;
  393. box-sizing: border-box;
  394. font-size: 28rpx;
  395. border: 1px solid #eceeec;
  396. border-radius: 8rpx;
  397. }
  398. input {
  399. flex: 1;
  400. border: 1rpx solid #e5e5e5;
  401. height: 66rpx;
  402. border-radius: 8rpx;
  403. font-size: 28rpx;
  404. padding: 0rpx 16rpx;
  405. color: #6a6a6a;
  406. }
  407. textarea {
  408. border: 1rpx solid #e5e5e5;
  409. flex: 1;
  410. height: 100rpx;
  411. }
  412. .tab_box {
  413. display: flex;
  414. flex-direction: row;
  415. flex-wrap: wrap;
  416. width: 520rpx;
  417. .tab {
  418. display: flex;
  419. flex-direction: row;
  420. border: 2rpx solid #d9ecff;
  421. background-color: #f4f4f5;
  422. border-color: #e9e9eb;
  423. color: #909399;
  424. margin-left: 8rpx;
  425. margin-bottom: 8rpx;
  426. padding: 2rpx 8rpx;
  427. font-size: 28rpx;
  428. }
  429. .icon {
  430. margin-left: 6rpx;
  431. }
  432. }
  433. }
  434. }
  435. }
  436. </style>