task_detail_hyrk.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. <template>
  2. <view class="container">
  3. <view class="detail-desc">
  4. <view class="d-header">
  5. <text>派车单</text>
  6. </view>
  7. <view class="c-list">
  8. <view class="c-row b-b">
  9. <text class="tit">派车单号</text>
  10. <view class="con-list">
  11. <text>{{carInfo.sendCarNo}}</text>
  12. </view>
  13. </view>
  14. <!-- <view class="c-row b-b">
  15. <text class="tit">车皮号</text>
  16. <view class="con-list">
  17. <text>{{carInfo.carSkinNo}}</text>
  18. </view>
  19. </view>
  20. <view class="c-row b-b">
  21. <text class="tit">箱号</text>
  22. <view class="con-list">
  23. <text>{{carInfo.boxNo}}</text>
  24. </view>
  25. </view> -->
  26. <view class="c-row b-b">
  27. <text class="tit">运价</text>
  28. <view class="con-list">
  29. <text>{{carInfo.price}}</text>
  30. </view>
  31. </view>
  32. <view class="c-row b-b">
  33. <text class="tit">入库汽车号</text>
  34. <view class="con-list">
  35. <text>{{carInfo.carNo}}</text>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="d-header">
  40. <text>入库数据</text>
  41. </view>
  42. <view class="c-list">
  43. <view class="c-row b-b">
  44. <text class="tit">毛重(吨)</text>
  45. <view class="con-list">
  46. <input placeholder="请填写毛重" name="input" v-model="grossWeight" @input="grossWeightInput"></input>
  47. </view>
  48. </view>
  49. <view class="c-row b-b">
  50. <text class="tit">皮重(吨)</text>
  51. <view class="con-list">
  52. <input placeholder="请填写皮重" name="input" v-model="skinWeight" @input="skinWeightInput"></input>
  53. </view>
  54. </view>
  55. <view class="c-row b-b">
  56. <text class="tit">净重(自动计算)</text>
  57. <view class="con-list">
  58. <text>{{numFilter(netWeight)}}</text>
  59. </view>
  60. </view>
  61. <view class="cu-bar bg-white ">
  62. <view class="action">
  63. 磅单照片
  64. </view>
  65. </view>
  66. <view class="cu-form-group">
  67. <view class="grid col-2 grid-square flex-sub">
  68. <view class="bg-img" v-if="poundImg != ''" @tap="ViewImage" :data-url="poundImg">
  69. <image :src="poundImg" mode="aspectFit"></image>
  70. <view class="cu-tag bg-red" @tap.stop="DelImg" >
  71. <text class='cuIcon-close'></text>
  72. </view>
  73. </view>
  74. <view class="solids" @tap="ChooseImage" v-if="poundImg == ''">
  75. <text class='cuIcon-cameraadd'></text>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="c-row b-b">
  80. <text class="tit">入库费用(元/吨)</text>
  81. <view class="con-list">
  82. <input placeholder="请填写入库费用" name="input" v-model="inFee" @input="inFeeInput"></input>
  83. </view>
  84. </view>
  85. <view class="c-row b-b">
  86. <text class="tit">入库杂费(元/吨)</text>
  87. <view class="con-list">
  88. <input placeholder="请填写入库杂费" name="input" v-model="inOtherFee" @input="inOtherFeeInput"></input>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="cu-modal" :class="modalName=='userModal'?'show':''" @tap="hideModal">
  94. <scroll-view scroll-y class="cu-dialog" :style="userStyle" @tap.stop="">
  95. <view class="cu-list menu text-center" >
  96. <view class="cu-item" v-for="(item,index) in userList" :key="index" @click="mygaipai(item.id)">
  97. <label class="flex justify-between align-center flex-sub">
  98. <view class="flex-sub">{{item.userName}}</view>
  99. </label>
  100. </view>
  101. </view>
  102. </scroll-view>
  103. </view>
  104. <view v-if="taskStatus == 1 && (carInfo.status == 20 ||carInfo.status == 30)" class="page-bottom">
  105. <view class="action-btn-group">
  106. <button type="primary" class=" action-btn no-border buy-now-btn" @click="save">保存</button>
  107. <button type="primary" class=" action-btn no-border add-cart-btn" @click="finish">完成</button>
  108. <button type="primary" class=" action-btn no-border add-cart-btn" @click="gaipai">改派</button>
  109. </view>
  110. </view>
  111. </view>
  112. </template>
  113. <script>
  114. import uploadImage from '@/components/ossutil/uploadFile.js';
  115. import Handwriting from '@/components/ossutil/signature.js';
  116. import {
  117. mapState
  118. } from 'vuex';
  119. export default {
  120. data() {
  121. return {
  122. carInfo:[],
  123. poundImg:'',
  124. otherImg:'',
  125. grossWeight:'',
  126. skinWeight:'',
  127. netWeight:'',
  128. price:'',
  129. carNo:'',
  130. inFee:'',
  131. taskStatus:'',
  132. userStyle:'',
  133. userList:[],
  134. modalName:'',
  135. taskType:'',
  136. taskId:'',
  137. addNumStatus:false,
  138. inCarNo:'',
  139. inOtherFee:'',
  140. lineColor:'black',
  141. slideValue:50,
  142. handwriting:'',
  143. selectColor:'black',
  144. color:'',
  145. };
  146. },
  147. computed: {
  148. ...mapState(['hasLogin','userInfo'])
  149. },
  150. onShow() {
  151. },
  152. onLoad(options) {
  153. const that = this
  154. this.taskStatus = options.taskStatus
  155. this.taskType = options.taskType
  156. this.taskId = options.taskId
  157. uni.showLoading({
  158. title: '正在加载',
  159. mask:true
  160. })
  161. that.$api.request('tran', 'getCarInfoBySendCarNo', {
  162. sendCarNo: options.sendCarNo
  163. }, failres => {
  164. that.$api.msg(failres.errmsg)
  165. uni.hideLoading()
  166. }).then(res => {
  167. that.carInfo = res.data
  168. // that.inPersonName = res.data.receiver
  169. that.grossWeight = that.carInfo.grossWeightRec
  170. that.skinWeight = that.carInfo.skinWeightRec
  171. that.netWeight = that.carInfo.netWeightRec
  172. that.poundImg = that.carInfo.poundImgRec
  173. that.carNo=that.carInfo.carNo
  174. that.inFee=that.carInfo.inFee
  175. that.inOtherFee=that.carInfo.inOtherFee
  176. uni.hideLoading()
  177. })
  178. },
  179. onReady(){
  180. },
  181. methods: {
  182. inFeeInput(e){
  183. this.inFee = e.detail.value
  184. },
  185. // inCarNoInput(e){
  186. // this.inCarNo = e.detail.value
  187. // },
  188. inOtherFeeInput(e){
  189. this.inOtherFee = e.detail.value
  190. },
  191. numFilter (value) {
  192. if(!value){
  193. return 0
  194. }
  195. // 截取当前数据到小数点后两位
  196. let realVal = parseFloat(value).toFixed(2)
  197. return realVal
  198. },
  199. ChooseSignImage() {
  200. this.handwriting = new Handwriting({
  201. lineColor: this.lineColor,
  202. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  203. canvasName: 'handWriting',
  204. })
  205. this.showAutograph = true
  206. },
  207. uploadScaleStart(event){
  208. this.handwriting.uploadScaleStart(event)
  209. },
  210. uploadScaleMove(event){
  211. this.handwriting.uploadScaleMove(event)
  212. },
  213. uploadScaleEnd(event){
  214. this.handwriting.uploadScaleEnd(event)
  215. },
  216. retDraw() {
  217. this.handwriting.retDraw()
  218. },
  219. hideModal(e) {
  220. this.modalName = null
  221. },
  222. ViewImage(e) {
  223. var img = [];
  224. img = e.currentTarget.dataset.url.split(' ')
  225. uni.previewImage({
  226. current:0,
  227. urls: img
  228. });
  229. },
  230. DelImg(e) {
  231. uni.showModal({
  232. title: '提示',
  233. content: '确定要删除该磅单照片吗?',
  234. cancelText: '取消',
  235. confirmText: '确定',
  236. success: res => {
  237. if (res.confirm) {
  238. this.poundImg = "";
  239. }
  240. }
  241. })
  242. },
  243. ChooseImage() {
  244. uni.chooseImage({
  245. count: 1, //默认9
  246. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  247. sourceType: ['album','camera'], //从相册选择
  248. success: (res) => {
  249. //上传图片
  250. //图片路径可自行修改
  251. uploadImage(res.tempFilePaths[0], 'carNoImg/',
  252. result => {
  253. this.poundImg = result
  254. uni.hideLoading();
  255. }
  256. )
  257. }
  258. });
  259. },
  260. grossWeightInput(e) {
  261. this.grossWeight = e.detail.value
  262. if(this.grossWeight && this.skinWeight){
  263. this.netWeight = this.numFilter(this.grossWeight - this.skinWeight)
  264. if(this.netWeight > this.carInfo.num){
  265. this.addNumStatus = true
  266. }
  267. }
  268. },
  269. skinWeightInput(e) {
  270. this.skinWeight = e.detail.value
  271. if(this.grossWeight && this.skinWeight){
  272. this.netWeight = this.numFilter(this.grossWeight - this.skinWeight)
  273. if(this.netWeight > this.carInfo.num){
  274. this.addNumStatus = true
  275. }
  276. else{
  277. this.addNumStatus = false
  278. }
  279. }
  280. },
  281. save(){
  282. const that = this
  283. uni.showLoading({
  284. title: '正在加载',
  285. mask:true
  286. })
  287. that.$api.request('tran', 'saveInTrainInfo', {
  288. sendCarNo: that.carInfo.sendCarNo,
  289. grossWeight:!that.grossWeight?'':that.grossWeight,
  290. skinWeight:!that.skinWeight?'':that.skinWeight,
  291. netWeight:!that.netWeight?'':that.netWeight,
  292. poundImg:!that.poundImg?'':that.poundImg,
  293. inFee:!that.inFee?'':that.inFee,
  294. inOtherFee:!that.inOtherFee?'':that.inOtherFee
  295. }, failres => {
  296. that.$api.msg(failres.errmsg)
  297. uni.hideLoading()
  298. }).then(res => {
  299. that.$api.msg('保存成功')
  300. uni.hideLoading()
  301. })
  302. },
  303. finish(){
  304. const that = this
  305. if(!that.grossWeight){
  306. this.$api.msg('请填写毛重');
  307. return;
  308. }
  309. if(!that.skinWeight){
  310. this.$api.msg('请填写皮重');
  311. return;
  312. }
  313. if(!that.poundImg){
  314. this.$api.msg('请上传磅单照片');
  315. return;
  316. }
  317. if (!that.inFee ) {
  318. that.$api.msg('请填写入库费用');
  319. return
  320. }
  321. uni.showLoading({
  322. title: '正在加载',
  323. mask:true
  324. })
  325. that.$api.request('tran', 'finishInTrainInfo', {
  326. sendCarNo: that.carInfo.sendCarNo,
  327. grossWeight:that.grossWeight,
  328. skinWeight:that.skinWeight,
  329. netWeight:that.netWeight,
  330. poundImg:that.poundImg,
  331. inFee:that.inFee,
  332. inOtherFee:that.inOtherFee,
  333. taskId:that.taskId,
  334. }, failres => {
  335. that.$api.msg(failres.errmsg)
  336. uni.hideLoading()
  337. }).then(res => {
  338. uni.hideLoading()
  339. that.$api.msg('完成成功')
  340. setTimeout(()=>{uni.navigateBack({
  341. delta: 1
  342. })},1000);
  343. })
  344. },
  345. gaipai(){
  346. const that = this
  347. uni.showLoading({
  348. title: '正在加载',
  349. mask:true
  350. })
  351. that.$api.request('user', 'getUserList', {
  352. role:'外勤'
  353. }, failres => {
  354. that.$api.msg(failres.errmsg)
  355. uni.hideLoading()
  356. }).then(res => {
  357. that.userList = res.data
  358. if(that.userList.length == 0){
  359. that.$api.msg('暂无外勤信息')
  360. }
  361. else{
  362. var height = that.userList.length * 100
  363. var width = 500
  364. that.userStyle = "height:"+height+"rpx;width:" + width+"rpx"
  365. that.modalName = 'userModal'
  366. }
  367. uni.hideLoading()
  368. })
  369. },
  370. mygaipai(id){
  371. var that = this
  372. that.$api.request('tran', 'gaipai',{
  373. taskId: that.taskId,
  374. outPersonId:id,
  375. taskType:that.taskType
  376. },failres => {
  377. that.$api.msg(failres.errmsg)
  378. that.modalName = null
  379. uni.hideLoading()
  380. }).then(res => {
  381. that.modalName = null
  382. uni.navigateBack({
  383. delta: 2
  384. })
  385. uni.hideLoading()
  386. })
  387. },
  388. },
  389. }
  390. </script>
  391. <style lang='scss' scoped="true">
  392. .container{
  393. padding-bottom: 160upx;
  394. }
  395. .detail-desc {
  396. background: #fff;
  397. margin-top: 16upx;
  398. width: 750upx;
  399. .d-header {
  400. display: flex;
  401. justify-content: center;
  402. align-items: center;
  403. height: 80upx;
  404. font-size: $font-base + 2upx;
  405. color: $font-color-dark;
  406. position: relative;
  407. text {
  408. padding: 0 20upx;
  409. background: #fff;
  410. position: relative;
  411. z-index: 1;
  412. }
  413. &:after {
  414. position: absolute;
  415. left: 50%;
  416. top: 50%;
  417. transform: translateX(-50%);
  418. width: 300upx;
  419. height: 0;
  420. content: '';
  421. border-bottom: 1px solid #ccc;
  422. }
  423. }
  424. }
  425. .c-list {
  426. font-size: $font-sm + 2upx;
  427. color: $font-color-base;
  428. background: #fff;
  429. .c-row {
  430. display: flex;
  431. align-items: center;
  432. padding: 20upx 30upx;
  433. position: relative;
  434. }
  435. .tit {
  436. width: 220upx;
  437. }
  438. .con {
  439. flex: 1;
  440. color: $font-color-dark;
  441. .selected-text {
  442. margin-right: 10upx;
  443. }
  444. }
  445. .bz-list {
  446. height: 40upx;
  447. font-size: $font-sm+2upx;
  448. color: $font-color-dark;
  449. text {
  450. display: inline-block;
  451. margin-right: 30upx;
  452. }
  453. }
  454. .con-list {
  455. flex: 1;
  456. display: flex;
  457. flex-direction: column;
  458. color: $font-color-dark;
  459. line-height: 40upx;
  460. text-align: right;
  461. padding-right: 20upx;
  462. }
  463. .red {
  464. color: $uni-color-primary;
  465. }
  466. }
  467. .page-bottom {
  468. .action-btn-group {
  469. .action-btn {
  470. width: 33.3333%;
  471. }
  472. }
  473. }
  474. @mixin playcenter {
  475. display: flex;
  476. align-items: center;
  477. justify-content: center;
  478. }
  479. .xsh-start {
  480. width: 105rpx;
  481. height: 105rpx;
  482. background: #FFFFFF;
  483. border-radius: 50%;
  484. font-size: 29rpx;
  485. color: #4135EB;
  486. @include playcenter;
  487. flex-wrap: wrap;
  488. }
  489. .x-modal {
  490. width: 100%;
  491. .x-m-title {
  492. width: 100%;
  493. height: 90rpx;
  494. padding: 0 38rpx 0 31rpx;
  495. box-sizing: border-box;
  496. font-size: 29rpx;
  497. color: #333333;
  498. border-bottom: 1px dashed #999;
  499. @include playcenter;
  500. justify-content: space-between;
  501. .xm-t-clear {
  502. font-size: 25rpx;
  503. color: #341DB7;
  504. @include playcenter;
  505. >image {
  506. width: 28rpx;
  507. height: 28rpx;
  508. display: block;
  509. margin-right: 8rpx;
  510. }
  511. }
  512. }
  513. .x-m-con {
  514. width: 100%;
  515. padding: 0 31rpx 18rpx;
  516. margin-top: 5rpx;
  517. box-sizing: border-box;
  518. }
  519. }
  520. .wrapper {
  521. width: 100%;
  522. height: 100%;
  523. margin: 30upx 0;
  524. overflow: hidden;
  525. display: flex;
  526. align-content: center;
  527. flex-direction: column;
  528. justify-content: center;
  529. font-size: 28upx;
  530. }
  531. .handWriting {
  532. background: #fff;
  533. width: 100%;
  534. height: 350upx;
  535. }
  536. .handRight {
  537. align-items: center;
  538. }
  539. .handCenter {
  540. border: 4upx dashed #e9e9e9;
  541. flex: 5;
  542. overflow: hidden;
  543. box-sizing: border-box;
  544. width: 90%;
  545. margin: 0 auto;
  546. }
  547. .handTitle {
  548. flex: 1;
  549. color: #666;
  550. justify-content: center;
  551. font-size: 30upx;
  552. }
  553. .handBtn {
  554. flex-direction: column;
  555. padding: 40upx 20upx;
  556. }
  557. .buttons{
  558. width: 100%;
  559. margin-top: 20upx;
  560. justify-content: space-between;
  561. }
  562. .buttons>button{
  563. font-size: 30upx;
  564. height: 80upx;
  565. }
  566. .delBtn {
  567. background: #23df02;
  568. color: #fff;
  569. }
  570. .color{
  571. align-items: center;
  572. }
  573. .color>text{
  574. margin-right: 20upx;
  575. }
  576. .subBtn {
  577. background: #008ef6;
  578. color: #fff;
  579. text-align: center;
  580. justify-content: center;
  581. }
  582. .black-select {
  583. width: 60upx;
  584. height: 60upx;
  585. }
  586. .black-select.color_select {
  587. width: 90upx;
  588. height: 90upx;
  589. }
  590. .red-select {
  591. width: 60upx;
  592. height: 60upx;
  593. }
  594. .red-select.color_select {
  595. width: 90upx;
  596. height: 90upx;
  597. }
  598. .slide-wrapper {
  599. align-items: center;
  600. margin-bottom: 20upx;
  601. }
  602. .slider{
  603. width: 400upx;
  604. padding-left: 20upx;
  605. }
  606. .drop {
  607. width: 50upx;
  608. height: 50upx;
  609. border-radius: 50%;
  610. background: #FFF;
  611. position: absolute;
  612. left: 0upx;
  613. top: -10upx;
  614. box-shadow: 0px 1px 5px #888888;
  615. }
  616. .slide {
  617. width: 250upx;
  618. height: 30upx;
  619. }
  620. .showimg{
  621. border: 4upx solid #e9e9e9;
  622. overflow: hidden;
  623. width: 90%;
  624. margin: 0 auto;
  625. background: #eee;
  626. height: 350upx;
  627. margin-top: 40upx;
  628. align-items: center;
  629. justify-content: center;
  630. }
  631. .showimg>image{
  632. width: 100%;
  633. height: 100%;
  634. }
  635. .showimg>text{
  636. font-size: 40upx;
  637. color: #888;
  638. }
  639. .indexFixed{
  640. position: fixed;
  641. left:0;
  642. bottom:0;
  643. right:0;
  644. }
  645. </style>