task_detail_ys.vue 15 KB

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