index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <view>
  3. <view class="ordertop">
  4. <view>
  5. <view class="iconblue"></view>
  6. <text class="license">基础信息</text>
  7. </view>
  8. <view class="line">
  9. <u-line color="#ccc" border-style='dashed' />
  10. </view>
  11. <view class="basic" v-if="form.mdLoadAddr">
  12. <view>运单号</view>
  13. <view>{{form.mdLoadAddr}}</view>
  14. </view>
  15. <view class="basic" v-else>
  16. <view>运单号</view>
  17. <view></view>
  18. </view>
  19. <view class="basic">
  20. <view>车号</view>
  21. <view>{{form.carregNo}}</view>
  22. </view>
  23. <view class="basic">
  24. <view>调度员</view>
  25. <view>{{form.planUserId}}</view>
  26. </view>
  27. <view class="basic">
  28. <view>驾驶员</view>
  29. <view>{{form.driverName}}</view>
  30. </view>
  31. <view class="basic">
  32. <view>装货品名</view>
  33. <view>{{form.goodsId}}</view>
  34. </view>
  35. <view class="basic">
  36. <view>调度数量</view>
  37. <view>{{form.cntrQty}}</view>
  38. </view>
  39. <view class="basic">
  40. <view>提单号</view>
  41. <view>{{form.mblno}}</view>
  42. </view>
  43. </view>
  44. <view class="ordertop">
  45. <view>
  46. <view class="iconblue"></view>
  47. <text class="license">信息提交</text>
  48. </view>
  49. <view class="line">
  50. <u-line color="#ccc" border-style='dashed' />
  51. </view>
  52. <view style="width: 94%;margin: 0rpx auto;">
  53. <u-form-item v-if="option == 1" :border-bottom="false" label-width="155rpx" label="接单日期:">
  54. <u-input :clearable="false" v-model="form.acceptDate" placeholder="请选择接单日期" :disabled="true"
  55. @click="show = true" />
  56. </u-form-item>
  57. <u-form-item v-if="option == 3" :border-bottom="false" label-width="155rpx" label="提箱日期:">
  58. <u-input :clearable="false" v-model="form.loadDate" placeholder="请选择提箱日期" :disabled="true"
  59. @click="show = true" />
  60. </u-form-item>
  61. <u-form-item v-if="option == 4" :border-bottom="false" label-width="155rpx" label="装卸日期:">
  62. <u-input :clearable="false" v-model="form.mdLoadDate" placeholder="请选择装卸日期" :disabled="true"
  63. @click="show = true" />
  64. </u-form-item>
  65. <u-form-item v-if="option == 5" :border-bottom="false" label-width="155rpx" label="卸柜日期:">
  66. <u-input :clearable="false" v-model="form.unLoadDate" placeholder="请选择卸柜日期" :disabled="true"
  67. @click="show = true" />
  68. </u-form-item>
  69. </view>
  70. <view style="width: 94%;margin: 0rpx auto;">
  71. <u-form-item v-if="option == 1" :border-bottom="false" label-width="155rpx" label="接单备注:">
  72. <u-input type="textarea" :height="35" :clearable="false" v-model="form.acceptRemarks" />
  73. </u-form-item>
  74. <u-form-item v-if="option == 3" :border-bottom="false" label-width="155rpx" label="提箱备注:">
  75. <u-input type="textarea" :height="35" :clearable="false" v-model="form.loadRemarks" />
  76. </u-form-item>
  77. <u-form-item v-if="option == 4" :border-bottom="false" label-width="155rpx" label="装卸备注:">
  78. <u-input type="textarea" :height="35" :clearable="false" v-model="form.mdLoadRemarks" />
  79. </u-form-item>
  80. <u-form-item v-if="option == 5" :border-bottom="false" label-width="155rpx" label="卸柜备注:">
  81. <u-input type="textarea" :height="35" :clearable="false" v-model="form.unLoadRemarks" />
  82. </u-form-item>
  83. </view>
  84. <!-- <view style="width: 94%;margin: 0rpx auto;">
  85. <u-form-item :border-bottom="false" label-width="155rpx" label="起始里程:">
  86. <u-input :clearable="false" v-model="form.odometerFrom" />
  87. </u-form-item>
  88. </view>
  89. <view style="width: 94%;margin: 0rpx auto;">
  90. <u-form-item :border-bottom="false" label-width="155rpx" label="结束里程:">
  91. <u-input :clearable="false" v-model="form.odometerEnd " />
  92. </u-form-item>
  93. </view> -->
  94. </view>
  95. <view class="ordertop" v-if="option == 5">
  96. <view>
  97. <view class="iconblue"></view>
  98. <text class="license">费用信息</text>
  99. </view>
  100. <view class="line">
  101. <u-line color="#ccc" border-style='dashed' />
  102. </view>
  103. <view style="width: 94%;margin: 0rpx auto;">
  104. <u-form-item :border-bottom="false" label-width="155rpx" label="油气费:">
  105. <u-input type="digit" :height="35" :clearable="false" v-model="form.oilAmt"/>
  106. </u-form-item>
  107. <!-- <u-form-item :border-bottom="false" label-width="155rpx" label="单趟提成:">
  108. <u-input type="digit" :height="35" :clearable="false" v-model="form.driverbonus" />
  109. </u-form-item> -->
  110. <u-form-item :border-bottom="false" label-width="155rpx" label="其他费用:">
  111. <u-input type="digit" :height="35" :clearable="false" v-model="form.costOth" />
  112. </u-form-item>
  113. <u-form-item :border-bottom="false" label-width="155rpx" label="费用备注:">
  114. <u-input type="text" :height="35" :clearable="false" v-model="form.costRemarks" />
  115. </u-form-item>
  116. </view>
  117. <view style="width: 94%;margin: 0rpx auto;" v-if="form.billType == 1">
  118. <u-form-item :border-bottom="false" label-width="155rpx" label="修洗费:">
  119. <u-input type="digit" :height="35" :clearable="false" v-model="form.costomAmt03" />
  120. </u-form-item>
  121. <u-form-item :border-bottom="false" label-width="155rpx" label="吊装费:">
  122. <u-input type="digit" :height="35" :clearable="false" v-model="form.costomAmt04" />
  123. </u-form-item>
  124. <u-form-item :border-bottom="false" label-width="155rpx" label="其他费用:">
  125. <u-input type="digit" :height="35" :clearable="false" v-model="form.costomAmt01" />
  126. </u-form-item>
  127. <u-form-item :border-bottom="false" label-width="155rpx" label="费用备注:">
  128. <u-input type="text" :height="35" :clearable="false" v-model="form.costomStr01" />
  129. </u-form-item>
  130. </view>
  131. <view style="width: 94%;margin: 0rpx auto;" v-if="form.billType == 2">
  132. <u-form-item :border-bottom="false" label-width="155rpx" label="港杂费:">
  133. <u-input type="digit" :height="35" :clearable="false" v-model="form.costomAmt05" />
  134. </u-form-item>
  135. <u-form-item :border-bottom="false" label-width="155rpx" label="提箱费:">
  136. <u-input type="digit" :height="35" :clearable="false" v-model="form.costomAmt06" />
  137. </u-form-item>
  138. <u-form-item :border-bottom="false" label-width="155rpx" label="其他费用:">
  139. <u-input type="digit" :height="35" :clearable="false" v-model="form.costomAmt02" />
  140. </u-form-item>
  141. <u-form-item :border-bottom="false" label-width="155rpx" label="费用备注:">
  142. <u-input type="text" :height="35" :clearable="false" v-model="form.costomStr02" />
  143. </u-form-item>
  144. </view>
  145. </view>
  146. <view class="ordertop" style="margin-bottom: 120rpx;" v-if="operationType !== 'acceptDate'">
  147. <view>
  148. <view class="iconblue"></view>
  149. <text class="license">附件上传</text>
  150. </view>
  151. <view class="line">
  152. <u-line color="#ccc" border-style='dashed' />
  153. </view>
  154. <view style="width: 94%;margin: 0rpx auto;">
  155. <u-upload ref="uUpload" :action="action" :header="headers" @on-success="success" :file-list="fileList">
  156. </u-upload>
  157. </view>
  158. </view>
  159. <view style="position: fixed; bottom: 20rpx;width: 96%;margin-left: 2%;">
  160. <u-button type="primary" @click="submIt = true">提交</u-button>
  161. </view>
  162. <u-modal v-model="submIt" @confirm="submit" @cancel="submIt = false" :show-cancel-button="true"
  163. :content="content"></u-modal>
  164. <u-calendar v-model="show" :mode="mode" @change="change"></u-calendar>
  165. </view>
  166. </template>
  167. <script>
  168. import {
  169. request
  170. } from '@/common/request/request'
  171. export default {
  172. data() {
  173. return {
  174. title: '', //标题
  175. show: false,
  176. mode: 'date',
  177. option: '',
  178. action: 'https://jingrun.tubaosoft.com/prod-api/common/upload',
  179. headers: {
  180. Authorization: 'Bearer ' + uni.getStorageSync('vuex_token')
  181. },
  182. content: '是否确认提交',
  183. fileList: [],
  184. submIt: false,
  185. operationType: '',
  186. form: {
  187. mblno: '', //提单号
  188. carregNo: '', //车号
  189. planUserId: '', //调度员*
  190. goodsId: '', //装货品名
  191. cntrQty: '', //调度数量
  192. ysl: '', //船名
  193. voy: '', //航次
  194. loadAddr: '', //提箱地点
  195. loadDate: '', //提箱时间
  196. loadAttntel: '', //提箱联系
  197. mdLoadAddr: '', //装卸地点
  198. mdLoadDate: '', //装卸时间
  199. mdLoadAttnTel: '', //装卸联系
  200. unLoadAddrL: '', //卸车地点
  201. unLadDate: '', //卸车时间
  202. unLoadAttnTel: '' //卸车联系
  203. },
  204. }
  205. },
  206. onLoad: function(option) { //option为object类型,会序列化上个页面传递的参数
  207. console.log(option); //打印出上个页面传递的参数。
  208. this.option = option.res
  209. this.form = {}
  210. uni.showLoading({
  211. title: '加载中'
  212. });
  213. setTimeout(function() {
  214. uni.hideLoading();
  215. }, 1000);
  216. switch (option.res) {
  217. case '1':
  218. this.title = '接单状态'
  219. this.receiving(option.id, 1)
  220. this.operationType = "acceptDate"
  221. break
  222. case '2':
  223. this.title = '出车状态'
  224. this.receiving(option.id, 2)
  225. this.operationType = "offData"
  226. break
  227. case '3':
  228. this.title = '提箱状态'
  229. this.receiving(option.id, 3)
  230. this.operationType = "loadDate"
  231. break
  232. case '4':
  233. this.title = '装卸状态'
  234. this.receiving(option.id, 4)
  235. this.operationType = "mdLoadDate"
  236. break
  237. case '5':
  238. this.title = '卸柜状态'
  239. this.receiving(option.id, 5)
  240. this.operationType = "unLoadDate"
  241. break
  242. default:
  243. console.log("未知错误")
  244. break
  245. }
  246. },
  247. methods: {
  248. change(e) {
  249. // console.log(this.form.orderStatus)
  250. switch (this.form.orderStatus) {
  251. case 10:
  252. this.form.acceptDate = e.result
  253. break
  254. case 20:
  255. this.form.loadDate = e.result
  256. break
  257. case 40:
  258. this.form.mdLoadDate = e.result
  259. break
  260. case 50:
  261. this.form.unLoadDate = e.result
  262. break
  263. default:
  264. console.log("未知错误")
  265. break
  266. }
  267. },
  268. receiving(id, i) {
  269. // 获取当前时间
  270. let date = new Date();
  271. let dateYear = date.getFullYear(); //获取年 
  272. let dateMonth = date.getMonth(); //获取月  
  273. let dateDate = date.getDate(); //获取当日
  274. if (dateDate < 10) {
  275. dateDate = "0" + dateDate
  276. }
  277. uni.setNavigationBarTitle({
  278. title: this.title
  279. })
  280. request({
  281. url: '/fleet/ftmsorderbillscars/selectDriver',
  282. method: 'post',
  283. data: {
  284. id: id
  285. }
  286. }).then(res => {
  287. console.log(res)
  288. this.form = res.data.data.cars
  289. switch (i) {
  290. case 1:
  291. this.form.acceptDate = dateYear + '-' + Number(dateMonth+1) + '-' + dateDate
  292. break
  293. case 3:
  294. this.form.loadDate = dateYear + '-' + Number(dateMonth+1) + '-' + dateDate
  295. break
  296. case 4:
  297. this.form.mdLoadDate = dateYear + '-' + Number(dateMonth+1) + '-' + dateDate
  298. break
  299. case 5:
  300. this.form.unLoadDate = dateYear + '-' + Number(dateMonth+1) + '-' + dateDate
  301. break
  302. default:
  303. uni.showToast({
  304. icon: 'none',
  305. title: '未知错误状态=' + i,
  306. position: "bottom"
  307. })
  308. break
  309. }
  310. if (this.form.acceptDate) {
  311. this.form.acceptDate = this.form.acceptDate.slice(0, 10)
  312. }
  313. if (this.form.loadDate) {
  314. this.form.loadDate = this.form.loadDate.slice(0, 10)
  315. }
  316. if (this.form.mdLoadDate) {
  317. this.form.mdLoadDate = this.form.mdLoadDate.slice(0, 10)
  318. }
  319. if (this.form.unLoadDate) {
  320. this.form.unLoadDate = this.form.unLoadDate.slice(0, 10)
  321. }
  322. }).catch(err => {
  323. uni.showToast({
  324. icon: 'none',
  325. title: '网络繁忙请稍后再试',
  326. position: "bottom"
  327. })
  328. })
  329. },
  330. success(data, index, lists, name) {
  331. // console.log(data)
  332. // console.log(index)
  333. // console.log(lists)
  334. // console.log(this.fileList)
  335. },
  336. //提交
  337. submit() {
  338. // console.log(this.$refs.uUpload.lists)
  339. let lists = []
  340. if(this.operationType !== 'acceptDate'){
  341. for (let item in this.$refs.uUpload.lists) {
  342. lists.push({
  343. attachUrl: this.$refs.uUpload.lists[item].response.url,
  344. thumbnailUrl: this.$refs.uUpload.lists[item].response.thumbnailUrl,
  345. attachName: this.$refs.uUpload.lists[item].response.fileName
  346. })
  347. }
  348. }
  349. console.log(lists)
  350. if(this.operationType == 'acceptDate'){
  351. request({
  352. url: '/fleet/ftmsorderbillscars/wechatInsertDriver',
  353. method: 'post',
  354. data: {
  355. cars: JSON.stringify(this.form),
  356. attachs: JSON.stringify(lists),
  357. fees: "[]",
  358. operationType: this.operationType
  359. }
  360. }).then(res => {
  361. console.log(res)
  362. if (res.data.code == 500) {
  363. if(res.data.msg == 'parseDecimal error, field : oilAmt'){
  364. uni.showToast({
  365. icon: 'none',
  366. title: '数字不正确,请检查后再提交',
  367. position: "bottom"
  368. })
  369. }else{
  370. uni.showToast({
  371. icon: 'none',
  372. title: res.data.msg,
  373. position: "bottom"
  374. })
  375. }
  376. } else if (res.data.code == 200) {
  377. uni.navigateBack();
  378. }
  379. }).catch(err => {
  380. uni.showToast({
  381. icon: 'none',
  382. title: '网络繁忙请稍后再试',
  383. position: "bottom"
  384. })
  385. })
  386. }else{
  387. if (lists.length == this.$refs.uUpload.lists.length) {
  388. request({
  389. url: '/fleet/ftmsorderbillscars/wechatInsertDriver',
  390. method: 'post',
  391. data: {
  392. cars: JSON.stringify(this.form),
  393. attachs: JSON.stringify(lists),
  394. fees: "[]",
  395. operationType: this.operationType
  396. }
  397. }).then(res => {
  398. console.log(res)
  399. if (res.data.code == 500) {
  400. if(res.data.msg == 'parseDecimal error, field : oilAmt'){
  401. uni.showToast({
  402. icon: 'none',
  403. title: '数字不正确,请检查后再提交',
  404. position: "bottom"
  405. })
  406. }else{
  407. uni.showToast({
  408. icon: 'none',
  409. title: res.data.msg,
  410. position: "bottom"
  411. })
  412. }
  413. } else if (res.data.code == 200) {
  414. uni.navigateBack();
  415. }
  416. }).catch(err => {
  417. uni.showToast({
  418. icon: 'none',
  419. title: '网络繁忙请稍后再试',
  420. position: "bottom"
  421. })
  422. })
  423. }
  424. }
  425. }
  426. }
  427. };
  428. </script>
  429. <style scoped lang="scss">
  430. .basic {
  431. width: 94%;
  432. margin: 10rpx auto;
  433. display: flex;
  434. justify-content: space-between;
  435. }
  436. .basic>view {
  437. margin-bottom: 10rpx;
  438. }
  439. .basic>view:nth-child(1) {
  440. color: #797979;
  441. }
  442. .license {
  443. float: left;
  444. font-size: 32rpx;
  445. }
  446. .ordertop {
  447. width: 96%;
  448. background-color: #fff;
  449. margin: 20rpx auto;
  450. border-radius: 20rpx;
  451. padding-top: 20rpx;
  452. box-shadow: 0px 0px 8px 0px rgba(165, 189, 251, 0.4);
  453. padding-bottom: 10rpx;
  454. }
  455. .ordertop>view:nth-child(1) {
  456. width: 98%;
  457. margin-bottom: 60rpx;
  458. }
  459. .iconblue {
  460. width: 10rpx;
  461. height: 50rpx;
  462. float: left;
  463. background-color: #3a63cf;
  464. margin-right: 10rpx;
  465. }
  466. .line {
  467. width: 92%;
  468. margin: 0 auto;
  469. }
  470. </style>