task_detail_zx.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  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. })
  201. that.$api.request('task', 'getTaskInfoZX', {
  202. taskId: options.taskId
  203. }, failres => {
  204. that.$api.msg(failres.errmsg)
  205. uni.hideLoading()
  206. }).then(res => {
  207. that.taskInfo = res.data
  208. that.grossWeight = res.data.grossWeight
  209. that.skinWeight = res.data.skinWeight
  210. that.netWeight = res.data.netWeight
  211. that.poundImg = res.data.poundImg
  212. that.boxImg = res.data.boxImg
  213. that.boxNoImg = res.data.boxNoImg
  214. that.titleNoImg = res.data.titleNoImg
  215. that.carNo = res.data.carNo
  216. that.boxNo = res.data.boxNo
  217. that.titleNo = res.data.titleNo
  218. uni.hideLoading()
  219. })
  220. },
  221. methods: {
  222. numFilter (value) {
  223. if(!value){
  224. return 0
  225. }
  226. // 截取当前数据到小数点后两位
  227. let realVal = parseFloat(value).toFixed(2)
  228. return realVal
  229. },
  230. ChooseImageBox() {
  231. var that = this
  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], 'boxImg/',
  240. result => {
  241. that.boxImg = result
  242. uni.hideLoading();
  243. }
  244. )
  245. }
  246. });
  247. },
  248. ChooseImageBoxNo() {
  249. var that = this
  250. uni.chooseImage({
  251. count: 1, //默认9
  252. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  253. sourceType: ['album','camera'], //从相册选择
  254. success: (res) => {
  255. //上传图片
  256. //图片路径可自行修改
  257. uploadImage(res.tempFilePaths[0], 'boxNoImg/',
  258. result => {
  259. that.boxNoImg = result
  260. uni.hideLoading();
  261. }
  262. )
  263. }
  264. });
  265. },
  266. ChooseImageTitleNo() {
  267. var that = this
  268. uni.chooseImage({
  269. count: 1, //默认9
  270. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  271. sourceType: ['album','camera'], //从相册选择
  272. success: (res) => {
  273. //上传图片
  274. //图片路径可自行修改
  275. uploadImage(res.tempFilePaths[0], 'titleNoImg/',
  276. result => {
  277. that.titleNoImg = result
  278. uni.hideLoading();
  279. }
  280. )
  281. }
  282. });
  283. },
  284. hideModal(e) {
  285. this.modalName = null
  286. },
  287. ViewImage(e) {
  288. var img = [];
  289. img = e.currentTarget.dataset.url.split(' ')
  290. uni.previewImage({
  291. current:0,
  292. urls: img
  293. });
  294. },
  295. DelImg(e) {
  296. uni.showModal({
  297. title: '提示',
  298. content: '确定要删除该照片吗?',
  299. cancelText: '取消',
  300. confirmText: '确定',
  301. success: res => {
  302. if (res.confirm) {
  303. if(e.currentTarget.dataset.index == 0){
  304. this.poundImg = "";
  305. }
  306. else if(e.currentTarget.dataset.index == 1){
  307. this.boxImg = "";
  308. }
  309. else if(e.currentTarget.dataset.index == 2){
  310. this.boxNoImg = "";
  311. }
  312. else if(e.currentTarget.dataset.index == 3){
  313. this.titleNoImg = "";
  314. }
  315. }
  316. }
  317. })
  318. },
  319. ChooseImagePound() {
  320. uni.chooseImage({
  321. count: 1, //默认9
  322. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  323. sourceType: ['album','camera'], //从相册选择
  324. success: (res) => {
  325. //上传图片
  326. //图片路径可自行修改
  327. uploadImage(res.tempFilePaths[0], 'poundImg/',
  328. result => {
  329. this.poundImg = result
  330. uni.hideLoading();
  331. }
  332. )
  333. }
  334. });
  335. },
  336. grossWeightInput(e) {
  337. this.grossWeight = e.detail.value
  338. if(this.grossWeight && this.skinWeight){
  339. this.netWeight = this.grossWeight - this.skinWeight
  340. }
  341. },
  342. skinWeightInput(e) {
  343. this.skinWeight = e.detail.value
  344. if(this.grossWeight && this.skinWeight){
  345. this.netWeight = this.grossWeight - this.skinWeight
  346. }
  347. },
  348. carNoInput(e) {
  349. this.carNo = e.detail.value
  350. },
  351. boxNoInput(e) {
  352. this.boxNo = e.detail.value
  353. },
  354. titleNoInput(e) {
  355. this.titleNo = e.detail.value
  356. },
  357. save(){
  358. const that = this
  359. uni.showLoading({
  360. title: '正在加载'
  361. })
  362. that.$api.request('task', 'saveTaskInfoZX', {
  363. taskId: that.taskId,
  364. grossWeight:!that.grossWeight?'':that.grossWeight,
  365. skinWeight:!that.skinWeight?'':that.skinWeight,
  366. netWeight:!that.netWeight?'':that.netWeight,
  367. poundImg:!that.poundImg?'':that.poundImg,
  368. carNo:!that.carNo?'':that.carNo,
  369. boxNo:!that.boxNo?'':that.boxNo,
  370. titleNo:!that.titleNo?'':that.titleNo,
  371. boxImg:!that.boxImg?'':that.boxImg,
  372. boxNoImg:!that.boxNoImg?'':that.boxNoImg,
  373. titleNoImg:!that.titleNoImg?'':that.titleNoImg
  374. }, failres => {
  375. that.$api.msg(failres.errmsg)
  376. uni.hideLoading()
  377. }).then(res => {
  378. that.$api.msg('保存成功')
  379. uni.hideLoading()
  380. })
  381. },
  382. finish(){
  383. const that = this
  384. // if(!that.grossWeight){
  385. // this.$api.msg('请填写毛重');
  386. // return;
  387. // }
  388. // if(!that.skinWeight){
  389. // this.$api.msg('请填写皮重');
  390. // return;
  391. // }
  392. if(!that.carNo){
  393. this.$api.msg('请填写车牌号');
  394. return;
  395. }
  396. if(!that.boxNo){
  397. this.$api.msg('请填写箱号');
  398. return;
  399. }
  400. if(!that.titleNo){
  401. this.$api.msg('请填写封号');
  402. return;
  403. }
  404. // if(!that.poundImg){
  405. // this.$api.msg('请上传磅单照片');
  406. // return;
  407. // }
  408. if(!that.boxImg){
  409. this.$api.msg('请上传箱体照片');
  410. return;
  411. }
  412. if(!that.boxNoImg){
  413. this.$api.msg('请上传箱号照片');
  414. return;
  415. }
  416. if(!that.titleNoImg){
  417. this.$api.msg('请上传封号照片');
  418. return;
  419. }
  420. uni.showModal({
  421. title: '温馨提示',
  422. content: '是否指派外勤继续完成装箱进港发运任务',
  423. confirmText:"是",
  424. cancelText:"否",
  425. success: function (res) {
  426. if (res.confirm) {
  427. uni.showLoading({
  428. title: '正在加载'
  429. })
  430. that.$api.request('user', 'getUserList', {
  431. role:'外勤'
  432. }, failres => {
  433. that.$api.msg(failres.errmsg)
  434. uni.hideLoading()
  435. }).then(res => {
  436. that.userList = res.data
  437. if(that.userList.length == 0){
  438. that.$api.msg('暂无外勤信息')
  439. }
  440. else{
  441. var height = that.userList.length * 100
  442. var width = 500
  443. that.userStyle = "height:"+height+"rpx;width:" + width+"rpx"
  444. that.modalName = 'workModal'
  445. }
  446. uni.hideLoading()
  447. })
  448. } else if (res.cancel) {
  449. uni.showLoading({
  450. title: '正在加载'
  451. })
  452. that.$api.request('task', 'finishTaskInfoZX', {
  453. taskId: that.taskId,
  454. grossWeight:!that.grossWeight?'':that.grossWeight,
  455. skinWeight:!that.skinWeight?'':that.skinWeight,
  456. netWeight:!that.netWeight?'':that.netWeight,
  457. poundImg:!that.poundImg?'':that.poundImg,
  458. carNo:!that.carNo?'':that.carNo,
  459. boxNo:!that.boxNo?'':that.boxNo,
  460. titleNo:!that.titleNo?'':that.titleNo,
  461. boxImg:!that.boxImg?'':that.boxImg,
  462. boxNoImg:!that.boxNoImg?'':that.boxNoImg,
  463. titleNoImg:!that.titleNoImg?'':that.titleNoImg,
  464. nextUserId: -1
  465. }, failres => {
  466. that.$api.msg(failres.errmsg)
  467. uni.hideLoading()
  468. }).then(res => {
  469. uni.hideLoading()
  470. that.$api.msg('完成成功')
  471. setTimeout(()=>{uni.navigateBack({})},1000);
  472. })
  473. }
  474. }
  475. });
  476. },
  477. gaipai(){
  478. const that = this
  479. uni.showLoading({
  480. title: '正在加载'
  481. })
  482. that.$api.request('user', 'getUserList', {
  483. role:'外勤'
  484. }, failres => {
  485. that.$api.msg(failres.errmsg)
  486. uni.hideLoading()
  487. }).then(res => {
  488. that.userList = res.data
  489. if(that.userList.length == 0){
  490. that.$api.msg('暂无外勤信息')
  491. }
  492. else{
  493. var height = that.userList.length * 100
  494. var width = 500
  495. that.userStyle = "height:"+height+"rpx;width:" + width+"rpx"
  496. that.modalName = 'userModal'
  497. }
  498. uni.hideLoading()
  499. })
  500. },
  501. mygaipai(id){
  502. var that = this
  503. uni.showLoading({
  504. title: '正在加载'
  505. })
  506. that.$api.request('task', 'gaipai',{
  507. taskId: that.taskId,
  508. outPersonId:id
  509. },failres => {
  510. that.$api.msg(failres.errmsg)
  511. that.modalName = null
  512. uni.hideLoading()
  513. }).then(res => {
  514. that.modalName = null
  515. uni.navigateBack({
  516. delta: 2
  517. })
  518. uni.hideLoading()
  519. })
  520. },
  521. nextPerson(id){
  522. var that = this
  523. uni.showLoading({
  524. title: '正在加载'
  525. })
  526. that.$api.request('task', 'finishTaskInfoZX', {
  527. taskId: that.taskId,
  528. grossWeight:!that.grossWeight?'':that.grossWeight,
  529. skinWeight:!that.skinWeight?'':that.skinWeight,
  530. netWeight:!that.netWeight?'':that.netWeight,
  531. poundImg:!that.poundImg?'':that.poundImg,
  532. carNo:!that.carNo?'':that.carNo,
  533. boxNo:!that.boxNo?'':that.boxNo,
  534. titleNo:!that.titleNo?'':that.titleNo,
  535. boxImg:!that.boxImg?'':that.boxImg,
  536. boxNoImg:!that.boxNoImg?'':that.boxNoImg,
  537. titleNoImg:!that.titleNoImg?'':that.titleNoImg,
  538. nextUserId: id
  539. }, failres => {
  540. that.$api.msg(failres.errmsg)
  541. uni.hideLoading()
  542. }).then(res => {
  543. uni.hideLoading()
  544. that.$api.msg('完成成功')
  545. setTimeout(()=>{uni.navigateBack({})},1000);
  546. })
  547. },
  548. },
  549. }
  550. </script>
  551. <style lang='scss'>
  552. .container{
  553. padding-bottom: 160upx;
  554. }
  555. .detail-desc {
  556. background: #fff;
  557. margin-top: 16upx;
  558. width: 750upx;
  559. .d-header {
  560. display: flex;
  561. justify-content: center;
  562. align-items: center;
  563. height: 80upx;
  564. font-size: $font-base + 2upx;
  565. color: $font-color-dark;
  566. position: relative;
  567. text {
  568. padding: 0 20upx;
  569. background: #fff;
  570. position: relative;
  571. z-index: 1;
  572. }
  573. &:after {
  574. position: absolute;
  575. left: 50%;
  576. top: 50%;
  577. transform: translateX(-50%);
  578. width: 300upx;
  579. height: 0;
  580. content: '';
  581. border-bottom: 1px solid #ccc;
  582. }
  583. }
  584. }
  585. .c-list {
  586. font-size: $font-sm + 2upx;
  587. color: $font-color-base;
  588. background: #fff;
  589. .c-row {
  590. display: flex;
  591. align-items: center;
  592. padding: 20upx 30upx;
  593. position: relative;
  594. }
  595. .tit {
  596. width: 220upx;
  597. }
  598. .con {
  599. flex: 1;
  600. color: $font-color-dark;
  601. .selected-text {
  602. margin-right: 10upx;
  603. }
  604. }
  605. .bz-list {
  606. height: 40upx;
  607. font-size: $font-sm+2upx;
  608. color: $font-color-dark;
  609. text {
  610. display: inline-block;
  611. margin-right: 30upx;
  612. }
  613. }
  614. .con-list {
  615. flex: 1;
  616. display: flex;
  617. flex-direction: column;
  618. color: $font-color-dark;
  619. line-height: 40upx;
  620. text-align: right;
  621. padding-right: 20upx;
  622. }
  623. .red {
  624. color: $uni-color-primary;
  625. }
  626. }
  627. /* 底部操作菜单 */
  628. .page-bottom {
  629. .action-btn-group {
  630. .action-btn {
  631. width: 33.333%;
  632. }
  633. }
  634. }
  635. @mixin playcenter {
  636. display: flex;
  637. align-items: center;
  638. justify-content: center;
  639. }
  640. .xsh-start {
  641. width: 105rpx;
  642. height: 105rpx;
  643. background: #FFFFFF;
  644. border-radius: 50%;
  645. font-size: 29rpx;
  646. color: #4135EB;
  647. @include playcenter;
  648. flex-wrap: wrap;
  649. }
  650. .x-modal {
  651. width: 100%;
  652. .x-m-title {
  653. width: 100%;
  654. height: 90rpx;
  655. padding: 0 38rpx 0 31rpx;
  656. box-sizing: border-box;
  657. font-size: 29rpx;
  658. color: #333333;
  659. border-bottom: 1px dashed #999;
  660. @include playcenter;
  661. justify-content: space-between;
  662. .xm-t-clear {
  663. font-size: 25rpx;
  664. color: #341DB7;
  665. @include playcenter;
  666. >image {
  667. width: 28rpx;
  668. height: 28rpx;
  669. display: block;
  670. margin-right: 8rpx;
  671. }
  672. }
  673. }
  674. .x-m-con {
  675. width: 100%;
  676. padding: 0 31rpx 18rpx;
  677. margin-top: 5rpx;
  678. box-sizing: border-box;
  679. }
  680. }
  681. </style>