task_detail_ys.vue 15 KB

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