task_detail_jh.vue 11 KB

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