task_detail_pc.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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="weight" @input="weightInput"></input>
  24. </view>
  25. </view>
  26. <view class="cu-bar bg-white ">
  27. <view class="action">
  28. 磅单照片
  29. </view>
  30. </view>
  31. <view class="cu-form-group">
  32. <view class="grid col-2 grid-square flex-sub">
  33. <view class="bg-img" v-if="poundImg != ''" @tap="ViewImage" :data-url="poundImg">
  34. <image :src="poundImg" mode="aspectFit"></image>
  35. <view class="cu-tag bg-red" @tap.stop="DelImg" >
  36. <text class='cuIcon-close'></text>
  37. </view>
  38. </view>
  39. <view class="solids" @tap="ChooseImage" v-if="poundImg == ''">
  40. <text class='cuIcon-cameraadd'></text>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="c-row b-b">
  45. <text class="tit">合同内容</text>
  46. <view class="con-list">
  47. <button class='cu-btn bg-green shadow' @click="downLoadContract" >查看</button>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="cu-modal" :class="modalName=='userModal'?'show':''" @tap="hideModal">
  53. <scroll-view scroll-y class="cu-dialog" :style="userStyle" @tap.stop="">
  54. <view class="cu-list menu text-center" >
  55. <view class="cu-item" v-for="(item,index) in userList" :key="index" @click="mygaipai(item.id)">
  56. <label class="flex justify-between align-center flex-sub">
  57. <view class="flex-sub">{{item.userName}}</view>
  58. </label>
  59. </view>
  60. </view>
  61. </scroll-view>
  62. </view>
  63. <view class="cu-modal" :class="modalName=='workModal'?'show':''" @tap="hideModal">
  64. <scroll-view scroll-y class="cu-dialog" :style="userStyle" @tap.stop="">
  65. <view class="cu-list menu text-center" >
  66. <view class="cu-item" v-for="(item,index) in userList" :key="index" @click="nextPerson(item.id)">
  67. <label class="flex justify-between align-center flex-sub">
  68. <view class="flex-sub">{{item.userName}}</view>
  69. </label>
  70. </view>
  71. </view>
  72. </scroll-view>
  73. </view>
  74. <view v-if="taskStatus == 1" class="page-bottom">
  75. <view class="action-btn-group">
  76. <button type="primary" class=" action-btn no-border buy-now-btn" @click="save">保存</button>
  77. <button type="primary" class=" action-btn no-border add-cart-btn" @click="finish">完成</button>
  78. <button type="primary" class=" action-btn no-border add-cart-btn" @click="gaipai">改派</button>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import uploadImage from '@/components/ossutil/uploadFile.js';
  85. import {
  86. mapState
  87. } from 'vuex';
  88. export default {
  89. data() {
  90. return {
  91. taskInfo:[],
  92. poundImg:'',
  93. weight:'',
  94. taskStatus:'',
  95. userStyle:'',
  96. modalName:'',
  97. userList:[],
  98. taskType:'',
  99. taskId:'',
  100. };
  101. },
  102. computed: {
  103. ...mapState(['hasLogin','userInfo'])
  104. },
  105. onShow() {
  106. },
  107. onLoad(options) {
  108. const that = this
  109. this.taskId = options.taskId
  110. this.taskStatus = options.taskStatus
  111. uni.showLoading({
  112. title: '正在加载',
  113. mask:true
  114. })
  115. that.$api.request('task', 'getTaskInfo', {
  116. taskId: options.taskId
  117. }, failres => {
  118. that.$api.msg(failres.errmsg)
  119. uni.hideLoading()
  120. }).then(res => {
  121. that.taskInfo = res.data
  122. that.weight = res.data.workNum
  123. that.poundImg = res.data.workPoundImg
  124. uni.hideLoading()
  125. })
  126. },
  127. methods: {
  128. downLoadContract(){
  129. var that = this
  130. uni.showLoading({
  131. title: '正在加载',
  132. mask:true
  133. })
  134. uni.downloadFile({
  135. url: that.taskInfo.workContractFile,
  136. success: function (res) {
  137. var filePath = res.tempFilePath;
  138. uni.openDocument({
  139. filePath: filePath,
  140. success: function (res) {
  141. uni.hideLoading()
  142. console.log('打开文档成功');
  143. }
  144. });
  145. },
  146. })
  147. },
  148. hideModal(e) {
  149. this.modalName = null
  150. },
  151. ViewImage(e) {
  152. var img = [];
  153. img = e.currentTarget.dataset.url.split(' ')
  154. uni.previewImage({
  155. current:0,
  156. urls: img
  157. });
  158. },
  159. DelImg(e) {
  160. uni.showModal({
  161. title: '提示',
  162. content: '确定要删除该磅单照片吗?',
  163. cancelText: '取消',
  164. confirmText: '确定',
  165. success: res => {
  166. if (res.confirm) {
  167. this.poundImg = "";
  168. }
  169. }
  170. })
  171. },
  172. ChooseImage() {
  173. uni.chooseImage({
  174. count: 1, //默认9
  175. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  176. sourceType: ['album','camera'], //从相册选择
  177. success: (res) => {
  178. //上传图片
  179. //图片路径可自行修改
  180. uploadImage(res.tempFilePaths[0], 'poundImg/',
  181. result => {
  182. this.poundImg = result
  183. uni.hideLoading();
  184. }
  185. )
  186. }
  187. });
  188. },
  189. weightInput(e) {
  190. this.weight = e.detail.value
  191. },
  192. save(){
  193. const that = this
  194. uni.showLoading({
  195. title: '正在加载',
  196. mask:true
  197. })
  198. that.$api.request('task', 'saveTaskInfo', {
  199. taskId: that.taskId,
  200. workNum:!that.weight?'':that.weight,
  201. workPoundImg:!that.poundImg?'':that.poundImg
  202. }, failres => {
  203. that.$api.msg(failres.errmsg)
  204. uni.hideLoading()
  205. }).then(res => {
  206. that.$api.msg('保存成功')
  207. uni.hideLoading()
  208. })
  209. },
  210. finish(){
  211. const that = this
  212. if(!that.weight){
  213. this.$api.msg('请填写出库数量');
  214. return;
  215. }
  216. if(!that.poundImg){
  217. this.$api.msg('请上传磅单照片');
  218. return;
  219. }
  220. uni.showModal({
  221. title: '温馨提示',
  222. content: '是否指派外勤继续完成平仓发运任务',
  223. confirmText:"是",
  224. cancelText:"否",
  225. success: function (res) {
  226. if (res.confirm) {
  227. uni.showLoading({
  228. title: '正在加载',
  229. mask:true
  230. })
  231. that.$api.request('user', 'getUserList', {
  232. role:'外勤'
  233. }, failres => {
  234. that.$api.msg(failres.errmsg)
  235. uni.hideLoading()
  236. }).then(res => {
  237. that.userList = res.data
  238. if(that.userList.length == 0){
  239. that.$api.msg('暂无外勤信息')
  240. }
  241. else{
  242. var height = that.userList.length * 100
  243. var width = 500
  244. that.userStyle = "height:"+height+"rpx;width:" + width+"rpx"
  245. that.modalName = 'workModal'
  246. }
  247. uni.hideLoading()
  248. })
  249. } else if (res.cancel) {
  250. uni.showLoading({
  251. title: '正在加载',
  252. mask:true
  253. })
  254. that.$api.request('task', 'finishTaskInfo', {
  255. taskId: that.taskId,
  256. workNum:!that.weight?'':that.weight,
  257. workPoundImg:!that.poundImg?'':that.poundImg,
  258. nextUserId: -1
  259. }, failres => {
  260. that.$api.msg(failres.errmsg)
  261. uni.hideLoading()
  262. }).then(res => {
  263. that.$api.msg('完成成功')
  264. setTimeout(()=>{uni.navigateBack({})},1000);
  265. uni.hideLoading()
  266. })
  267. }
  268. }
  269. });
  270. },
  271. gaipai(){
  272. const that = this
  273. uni.showLoading({
  274. title: '正在加载',
  275. mask:true
  276. })
  277. that.$api.request('user', 'getUserList', {
  278. role:'外勤'
  279. }, failres => {
  280. that.$api.msg(failres.errmsg)
  281. uni.hideLoading()
  282. }).then(res => {
  283. that.userList = res.data
  284. if(that.userList.length == 0){
  285. that.$api.msg('暂无外勤信息')
  286. }
  287. else{
  288. var height = that.userList.length * 100
  289. var width = 500
  290. that.userStyle = "height:"+height+"rpx;width:" + width+"rpx"
  291. that.modalName = 'userModal'
  292. }
  293. uni.hideLoading()
  294. })
  295. },
  296. mygaipai(id){
  297. var that = this
  298. uni.showLoading({
  299. title: '正在加载',
  300. mask:true
  301. })
  302. that.$api.request('task', 'gaipai',{
  303. taskId: that.taskId,
  304. outPersonId:id
  305. },failres => {
  306. that.$api.msg(failres.errmsg)
  307. that.modalName = null
  308. uni.hideLoading()
  309. }).then(res => {
  310. that.modalName = null
  311. uni.navigateBack({
  312. delta: 2
  313. })
  314. uni.hideLoading()
  315. })
  316. },
  317. nextPerson(id){
  318. var that = this
  319. uni.showLoading({
  320. title: '正在加载',
  321. mask:true
  322. })
  323. that.$api.request('task', 'finishTaskInfo', {
  324. taskId: that.taskId,
  325. workNum:!that.weight?'':that.weight,
  326. workPoundImg:!that.poundImg?'':that.poundImg,
  327. nextUserId: id
  328. }, failres => {
  329. that.$api.msg(failres.errmsg)
  330. uni.hideLoading()
  331. }).then(res => {
  332. uni.hideLoading()
  333. that.$api.msg('完成成功')
  334. setTimeout(()=>{uni.navigateBack({
  335. delta: 2
  336. })},1000);
  337. })
  338. },
  339. },
  340. }
  341. </script>
  342. <style lang='scss'>
  343. .container{
  344. padding-bottom: 160upx;
  345. }
  346. .detail-desc {
  347. background: #fff;
  348. margin-top: 16upx;
  349. width: 750upx;
  350. .d-header {
  351. display: flex;
  352. justify-content: center;
  353. align-items: center;
  354. height: 80upx;
  355. font-size: $font-base + 2upx;
  356. color: $font-color-dark;
  357. position: relative;
  358. text {
  359. padding: 0 20upx;
  360. background: #fff;
  361. position: relative;
  362. z-index: 1;
  363. }
  364. &:after {
  365. position: absolute;
  366. left: 50%;
  367. top: 50%;
  368. transform: translateX(-50%);
  369. width: 300upx;
  370. height: 0;
  371. content: '';
  372. border-bottom: 1px solid #ccc;
  373. }
  374. }
  375. }
  376. .c-list {
  377. font-size: $font-sm + 2upx;
  378. color: $font-color-base;
  379. background: #fff;
  380. .c-row {
  381. display: flex;
  382. align-items: center;
  383. padding: 20upx 30upx;
  384. position: relative;
  385. }
  386. .tit {
  387. width: 220upx;
  388. }
  389. .con {
  390. flex: 1;
  391. color: $font-color-dark;
  392. .selected-text {
  393. margin-right: 10upx;
  394. }
  395. }
  396. .bz-list {
  397. height: 40upx;
  398. font-size: $font-sm+2upx;
  399. color: $font-color-dark;
  400. text {
  401. display: inline-block;
  402. margin-right: 30upx;
  403. }
  404. }
  405. .con-list {
  406. flex: 1;
  407. display: flex;
  408. flex-direction: column;
  409. color: $font-color-dark;
  410. line-height: 40upx;
  411. text-align: right;
  412. padding-right: 20upx;
  413. }
  414. .red {
  415. color: $uni-color-primary;
  416. }
  417. }
  418. /* 底部操作菜单 */
  419. .page-bottom {
  420. .action-btn-group {
  421. .action-btn {
  422. width: 33.3333%;
  423. }
  424. }
  425. }
  426. @mixin playcenter {
  427. display: flex;
  428. align-items: center;
  429. justify-content: center;
  430. }
  431. .xsh-start {
  432. width: 105rpx;
  433. height: 105rpx;
  434. background: #FFFFFF;
  435. border-radius: 50%;
  436. font-size: 29rpx;
  437. color: #4135EB;
  438. @include playcenter;
  439. flex-wrap: wrap;
  440. }
  441. .x-modal {
  442. width: 100%;
  443. .x-m-title {
  444. width: 100%;
  445. height: 90rpx;
  446. padding: 0 38rpx 0 31rpx;
  447. box-sizing: border-box;
  448. font-size: 29rpx;
  449. color: #333333;
  450. border-bottom: 1px dashed #999;
  451. @include playcenter;
  452. justify-content: space-between;
  453. .xm-t-clear {
  454. font-size: 25rpx;
  455. color: #341DB7;
  456. @include playcenter;
  457. >image {
  458. width: 28rpx;
  459. height: 28rpx;
  460. display: block;
  461. margin-right: 8rpx;
  462. }
  463. }
  464. }
  465. .x-m-con {
  466. width: 100%;
  467. padding: 0 31rpx 18rpx;
  468. margin-top: 5rpx;
  469. box-sizing: border-box;
  470. }
  471. }
  472. </style>