task_detail_zx.vue 18 KB

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