task_detail_hyrk.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  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. })
  160. that.$api.request('tran', 'getCarInfoBySendCarNo', {
  161. sendCarNo: options.sendCarNo
  162. }, failres => {
  163. that.$api.msg(failres.errmsg)
  164. uni.hideLoading()
  165. }).then(res => {
  166. that.carInfo = res.data
  167. // that.inPersonName = res.data.receiver
  168. that.grossWeight = that.carInfo.grossWeightRec
  169. that.skinWeight = that.carInfo.skinWeightRec
  170. that.netWeight = that.carInfo.netWeightRec
  171. that.poundImg = that.carInfo.poundImgRec
  172. that.carNo=that.carInfo.carNo
  173. that.inFee=that.carInfo.inFee
  174. that.inOtherFee=that.carInfo.inOtherFee
  175. uni.hideLoading()
  176. })
  177. },
  178. onReady(){
  179. },
  180. methods: {
  181. inFeeInput(e){
  182. this.inFee = e.detail.value
  183. },
  184. // inCarNoInput(e){
  185. // this.inCarNo = e.detail.value
  186. // },
  187. inOtherFeeInput(e){
  188. this.inOtherFee = e.detail.value
  189. },
  190. numFilter (value) {
  191. if(!value){
  192. return 0
  193. }
  194. // 截取当前数据到小数点后两位
  195. let realVal = parseFloat(value).toFixed(2)
  196. return realVal
  197. },
  198. ChooseSignImage() {
  199. this.handwriting = new Handwriting({
  200. lineColor: this.lineColor,
  201. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  202. canvasName: 'handWriting',
  203. })
  204. this.showAutograph = true
  205. },
  206. uploadScaleStart(event){
  207. this.handwriting.uploadScaleStart(event)
  208. },
  209. uploadScaleMove(event){
  210. this.handwriting.uploadScaleMove(event)
  211. },
  212. uploadScaleEnd(event){
  213. this.handwriting.uploadScaleEnd(event)
  214. },
  215. retDraw() {
  216. this.handwriting.retDraw()
  217. },
  218. hideModal(e) {
  219. this.modalName = null
  220. },
  221. ViewImage(e) {
  222. var img = [];
  223. img = e.currentTarget.dataset.url.split(' ')
  224. uni.previewImage({
  225. current:0,
  226. urls: img
  227. });
  228. },
  229. DelImg(e) {
  230. uni.showModal({
  231. title: '提示',
  232. content: '确定要删除该磅单照片吗?',
  233. cancelText: '取消',
  234. confirmText: '确定',
  235. success: res => {
  236. if (res.confirm) {
  237. this.poundImg = "";
  238. }
  239. }
  240. })
  241. },
  242. ChooseImage() {
  243. uni.chooseImage({
  244. count: 1, //默认9
  245. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  246. sourceType: ['album','camera'], //从相册选择
  247. success: (res) => {
  248. //上传图片
  249. //图片路径可自行修改
  250. uploadImage(res.tempFilePaths[0], 'carNoImg/',
  251. result => {
  252. this.poundImg = result
  253. uni.hideLoading();
  254. }
  255. )
  256. }
  257. });
  258. },
  259. grossWeightInput(e) {
  260. this.grossWeight = e.detail.value
  261. if(this.grossWeight && this.skinWeight){
  262. this.netWeight = this.numFilter(this.grossWeight - this.skinWeight)
  263. if(this.netWeight > this.carInfo.num){
  264. this.addNumStatus = true
  265. }
  266. }
  267. },
  268. skinWeightInput(e) {
  269. this.skinWeight = e.detail.value
  270. if(this.grossWeight && this.skinWeight){
  271. this.netWeight = this.numFilter(this.grossWeight - this.skinWeight)
  272. if(this.netWeight > this.carInfo.num){
  273. this.addNumStatus = true
  274. }
  275. else{
  276. this.addNumStatus = false
  277. }
  278. }
  279. },
  280. save(){
  281. const that = this
  282. uni.showLoading({
  283. title: '正在加载'
  284. })
  285. that.$api.request('tran', 'saveInTrainInfo', {
  286. sendCarNo: that.carInfo.sendCarNo,
  287. grossWeight:!that.grossWeight?'':that.grossWeight,
  288. skinWeight:!that.skinWeight?'':that.skinWeight,
  289. netWeight:!that.netWeight?'':that.netWeight,
  290. poundImg:!that.poundImg?'':that.poundImg,
  291. inFee:!that.inFee?'':that.inFee,
  292. inOtherFee:!that.inOtherFee?'':that.inOtherFee
  293. }, failres => {
  294. that.$api.msg(failres.errmsg)
  295. uni.hideLoading()
  296. }).then(res => {
  297. that.$api.msg('保存成功')
  298. uni.hideLoading()
  299. })
  300. },
  301. finish(){
  302. const that = this
  303. if(!that.grossWeight){
  304. this.$api.msg('请填写毛重');
  305. return;
  306. }
  307. if(!that.skinWeight){
  308. this.$api.msg('请填写皮重');
  309. return;
  310. }
  311. if(!that.poundImg){
  312. this.$api.msg('请上传磅单照片');
  313. return;
  314. }
  315. if (!that.inFee ) {
  316. that.$api.msg('请填写入库费用');
  317. return
  318. }
  319. uni.showLoading({
  320. title: '正在加载'
  321. })
  322. that.$api.request('tran', 'finishInTrainInfo', {
  323. sendCarNo: that.carInfo.sendCarNo,
  324. grossWeight:that.grossWeight,
  325. skinWeight:that.skinWeight,
  326. netWeight:that.netWeight,
  327. poundImg:that.poundImg,
  328. inFee:that.inFee,
  329. inOtherFee:that.inOtherFee,
  330. taskId:that.taskId,
  331. }, failres => {
  332. that.$api.msg(failres.errmsg)
  333. uni.hideLoading()
  334. }).then(res => {
  335. uni.hideLoading()
  336. that.$api.msg('完成成功')
  337. setTimeout(()=>{uni.navigateBack({
  338. delta: 1
  339. })},1000);
  340. })
  341. },
  342. gaipai(){
  343. const that = this
  344. uni.showLoading({
  345. title: '正在加载'
  346. })
  347. that.$api.request('user', 'getUserList', {
  348. role:'外勤'
  349. }, failres => {
  350. that.$api.msg(failres.errmsg)
  351. uni.hideLoading()
  352. }).then(res => {
  353. that.userList = res.data
  354. if(that.userList.length == 0){
  355. that.$api.msg('暂无外勤信息')
  356. }
  357. else{
  358. var height = that.userList.length * 100
  359. var width = 500
  360. that.userStyle = "height:"+height+"rpx;width:" + width+"rpx"
  361. that.modalName = 'userModal'
  362. }
  363. uni.hideLoading()
  364. })
  365. },
  366. mygaipai(id){
  367. var that = this
  368. that.$api.request('tran', 'gaipai',{
  369. taskId: that.taskId,
  370. outPersonId:id,
  371. taskType:that.taskType
  372. },failres => {
  373. that.$api.msg(failres.errmsg)
  374. that.modalName = null
  375. uni.hideLoading()
  376. }).then(res => {
  377. that.modalName = null
  378. uni.navigateBack({
  379. delta: 2
  380. })
  381. uni.hideLoading()
  382. })
  383. },
  384. },
  385. }
  386. </script>
  387. <style lang='scss' scoped="true">
  388. .container{
  389. padding-bottom: 160upx;
  390. }
  391. .detail-desc {
  392. background: #fff;
  393. margin-top: 16upx;
  394. width: 750upx;
  395. .d-header {
  396. display: flex;
  397. justify-content: center;
  398. align-items: center;
  399. height: 80upx;
  400. font-size: $font-base + 2upx;
  401. color: $font-color-dark;
  402. position: relative;
  403. text {
  404. padding: 0 20upx;
  405. background: #fff;
  406. position: relative;
  407. z-index: 1;
  408. }
  409. &:after {
  410. position: absolute;
  411. left: 50%;
  412. top: 50%;
  413. transform: translateX(-50%);
  414. width: 300upx;
  415. height: 0;
  416. content: '';
  417. border-bottom: 1px solid #ccc;
  418. }
  419. }
  420. }
  421. .c-list {
  422. font-size: $font-sm + 2upx;
  423. color: $font-color-base;
  424. background: #fff;
  425. .c-row {
  426. display: flex;
  427. align-items: center;
  428. padding: 20upx 30upx;
  429. position: relative;
  430. }
  431. .tit {
  432. width: 220upx;
  433. }
  434. .con {
  435. flex: 1;
  436. color: $font-color-dark;
  437. .selected-text {
  438. margin-right: 10upx;
  439. }
  440. }
  441. .bz-list {
  442. height: 40upx;
  443. font-size: $font-sm+2upx;
  444. color: $font-color-dark;
  445. text {
  446. display: inline-block;
  447. margin-right: 30upx;
  448. }
  449. }
  450. .con-list {
  451. flex: 1;
  452. display: flex;
  453. flex-direction: column;
  454. color: $font-color-dark;
  455. line-height: 40upx;
  456. text-align: right;
  457. padding-right: 20upx;
  458. }
  459. .red {
  460. color: $uni-color-primary;
  461. }
  462. }
  463. .page-bottom {
  464. .action-btn-group {
  465. .action-btn {
  466. width: 33.3333%;
  467. }
  468. }
  469. }
  470. @mixin playcenter {
  471. display: flex;
  472. align-items: center;
  473. justify-content: center;
  474. }
  475. .xsh-start {
  476. width: 105rpx;
  477. height: 105rpx;
  478. background: #FFFFFF;
  479. border-radius: 50%;
  480. font-size: 29rpx;
  481. color: #4135EB;
  482. @include playcenter;
  483. flex-wrap: wrap;
  484. }
  485. .x-modal {
  486. width: 100%;
  487. .x-m-title {
  488. width: 100%;
  489. height: 90rpx;
  490. padding: 0 38rpx 0 31rpx;
  491. box-sizing: border-box;
  492. font-size: 29rpx;
  493. color: #333333;
  494. border-bottom: 1px dashed #999;
  495. @include playcenter;
  496. justify-content: space-between;
  497. .xm-t-clear {
  498. font-size: 25rpx;
  499. color: #341DB7;
  500. @include playcenter;
  501. >image {
  502. width: 28rpx;
  503. height: 28rpx;
  504. display: block;
  505. margin-right: 8rpx;
  506. }
  507. }
  508. }
  509. .x-m-con {
  510. width: 100%;
  511. padding: 0 31rpx 18rpx;
  512. margin-top: 5rpx;
  513. box-sizing: border-box;
  514. }
  515. }
  516. .wrapper {
  517. width: 100%;
  518. height: 100%;
  519. margin: 30upx 0;
  520. overflow: hidden;
  521. display: flex;
  522. align-content: center;
  523. flex-direction: column;
  524. justify-content: center;
  525. font-size: 28upx;
  526. }
  527. .handWriting {
  528. background: #fff;
  529. width: 100%;
  530. height: 350upx;
  531. }
  532. .handRight {
  533. align-items: center;
  534. }
  535. .handCenter {
  536. border: 4upx dashed #e9e9e9;
  537. flex: 5;
  538. overflow: hidden;
  539. box-sizing: border-box;
  540. width: 90%;
  541. margin: 0 auto;
  542. }
  543. .handTitle {
  544. flex: 1;
  545. color: #666;
  546. justify-content: center;
  547. font-size: 30upx;
  548. }
  549. .handBtn {
  550. flex-direction: column;
  551. padding: 40upx 20upx;
  552. }
  553. .buttons{
  554. width: 100%;
  555. margin-top: 20upx;
  556. justify-content: space-between;
  557. }
  558. .buttons>button{
  559. font-size: 30upx;
  560. height: 80upx;
  561. }
  562. .delBtn {
  563. background: #23df02;
  564. color: #fff;
  565. }
  566. .color{
  567. align-items: center;
  568. }
  569. .color>text{
  570. margin-right: 20upx;
  571. }
  572. .subBtn {
  573. background: #008ef6;
  574. color: #fff;
  575. text-align: center;
  576. justify-content: center;
  577. }
  578. .black-select {
  579. width: 60upx;
  580. height: 60upx;
  581. }
  582. .black-select.color_select {
  583. width: 90upx;
  584. height: 90upx;
  585. }
  586. .red-select {
  587. width: 60upx;
  588. height: 60upx;
  589. }
  590. .red-select.color_select {
  591. width: 90upx;
  592. height: 90upx;
  593. }
  594. .slide-wrapper {
  595. align-items: center;
  596. margin-bottom: 20upx;
  597. }
  598. .slider{
  599. width: 400upx;
  600. padding-left: 20upx;
  601. }
  602. .drop {
  603. width: 50upx;
  604. height: 50upx;
  605. border-radius: 50%;
  606. background: #FFF;
  607. position: absolute;
  608. left: 0upx;
  609. top: -10upx;
  610. box-shadow: 0px 1px 5px #888888;
  611. }
  612. .slide {
  613. width: 250upx;
  614. height: 30upx;
  615. }
  616. .showimg{
  617. border: 4upx solid #e9e9e9;
  618. overflow: hidden;
  619. width: 90%;
  620. margin: 0 auto;
  621. background: #eee;
  622. height: 350upx;
  623. margin-top: 40upx;
  624. align-items: center;
  625. justify-content: center;
  626. }
  627. .showimg>image{
  628. width: 100%;
  629. height: 100%;
  630. }
  631. .showimg>text{
  632. font-size: 40upx;
  633. color: #888;
  634. }
  635. .indexFixed{
  636. position: fixed;
  637. left:0;
  638. bottom:0;
  639. right:0;
  640. }
  641. </style>