contract_detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <template>
  2. <view class="container">
  3. <view class="information">
  4. <!-- <block v-if="TabCur==2"> -->
  5. <view class="c-row">
  6. <view class="title1">发车信息</view>
  7. </view>
  8. <view class="c-row b-b">
  9. <view class="title">派车编号</view>
  10. <view class="con-list">
  11. <input disabled name="input" v-model="goods.tranCarNo"></input>
  12. </view>
  13. </view>
  14. <view class="c-row b-b">
  15. <view class="title">车牌号</view>
  16. <view class="con-list">
  17. <input maxlength='7' placeholder="请输入车牌号" name="input" v-model="goods.carNo"></input>
  18. </view>
  19. </view>
  20. <view class="c-row b-b">
  21. <view class="title">司机手机号</view>
  22. <view class="con-list">
  23. <input maxlength='11' placeholder="请输入司机手机号" name="input" v-model="goods.driverPhone"></input>
  24. </view>
  25. </view>
  26. <view class="c-row b-b">
  27. <view class="title">毛重(吨)</view>
  28. <view class="con-list">
  29. <input placeholder="请输入毛重" type="mobile" name="input" @input="grossWeightchange" v-model="goods.grossWeight"></input>
  30. </view>
  31. </view>
  32. <view class="c-row b-b">
  33. <view class="title">皮重(吨)</view>
  34. <view class="con-list">
  35. <input placeholder="请输入皮重" type="mobile" name="input" @input="tarechange" v-model="goods.tare"></input>
  36. </view>
  37. </view>
  38. <view class="c-row b-b">
  39. <view class="title">净重(吨)</view>
  40. <view class="con-list">
  41. <view class="con-list">
  42. <input placeholder="自动计算" type="mobile" name="input" v-model="goods.loadNetWeight"></input>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="c-row ">
  47. <view class="title">发货日期</view>
  48. <view class="con-list">
  49. <view @click="show = true">{{goods.sendDateStart!=''?goods.sendDateStart:time}}</view>
  50. <u-picker :params='params' :default-time='time' @confirm="DateChange" v-model="show" mode="time"></u-picker>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="information">
  55. <view class="c-row">
  56. <view class="action">
  57. 上传磅单照片
  58. </view>
  59. </view>
  60. <view class="c-row">
  61. <view class="grid col-4 grid-square flex-sub">
  62. <view class="bg-img" v-if="goods.loadPoundImg != ''" @tap="ViewImage" :data-url="goods.loadPoundImg">
  63. <image :src="goods.loadPoundImg" mode="aspectFit"></image>
  64. <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="0">
  65. <text class='cuIcon-close'></text>
  66. </view>
  67. </view>
  68. <view class="solids" @tap="ChooseImagePerson" v-if="goods.loadPoundImg == ''">
  69. <text class='cuIcon-cameraadd'></text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <button class="btn btns" @click="getList">提交</button>
  75. <!-- </block> -->
  76. </view>
  77. </template>
  78. <script>
  79. import uploadImage from '@/components/ossutil/uploadFile.js';
  80. import {
  81. mapState
  82. } from 'vuex';
  83. export default {
  84. name: "trust",
  85. data() {
  86. return {
  87. goods: {
  88. tranCarNo:'',
  89. carNo:'',
  90. grossWeight:'',
  91. tare:'',
  92. loadNetWeight:'',
  93. loadPoundImg:'',
  94. contractNo:'',
  95. goodsName:'',
  96. sendDateStart:''
  97. },
  98. params:{
  99. year: true,
  100. month: true,
  101. day: true,
  102. },
  103. carNo:'',
  104. PageCur: "trust",
  105. TabCur: 0,
  106. priceTypeIndex:-1,
  107. priceType: ['库内价', '到库价', '到港价'],
  108. unitPrice:0,
  109. price:'',
  110. seller:'',
  111. sellerPhone:'',
  112. minSale:'',
  113. exsitCount:0,
  114. origin:'',
  115. stock:'',
  116. show:false,
  117. goodsName:'',
  118. verifyCode:'',
  119. sendText0:'获取验证码',
  120. sendText1:'获取验证码',
  121. sendText2:'获取验证码',
  122. sendText3:'获取验证码',
  123. sendDisabled0: false,
  124. sendDisabled1: false,
  125. sendDisabled2: false,
  126. sendDisabled3: false,
  127. buyer:'',
  128. buyerPhone:'',
  129. level:'',
  130. sender:'',
  131. senderPhone:'',
  132. receiver:'',
  133. receiverPhone:'',
  134. total:0,
  135. startPlace:'',
  136. endPlace:'',
  137. driver:'',
  138. driverPhone:'',
  139. carNo:'',
  140. personNoImg:'',
  141. personNoImg1:'',
  142. driverNoImg:'',
  143. driverNoImg1:'',
  144. carNoImg:'',
  145. carNoImg1:'',
  146. goodsName:'',
  147. showTran:true
  148. };
  149. },
  150. computed: {
  151. ...mapState(['hasLogin','userInfo']),
  152. time() {
  153. var date=new Date()
  154. var year=date.getFullYear()
  155. var month=date.getMonth()
  156. var date1=date.getDate()
  157. if(month+1<10){
  158. month="0"+(month+1)
  159. }
  160. if(date1+1<10){
  161. date1="0"+date1
  162. }
  163. return year+'-'+month+"-"+date1
  164. },
  165. startDate() {
  166. //限制开始时间;
  167. //也可以直接限定为当天日期 var date= new Date(); return date
  168. return new Date(new Date(new Date().toLocaleDateString()).getTime()-(1*60*60*1000))
  169. },
  170. endDate() {
  171. return new Date()
  172. }
  173. },
  174. // onShow() {
  175. // },
  176. onLoad(option) {
  177. this.goods.planId = option.planId
  178. this.goodsName = option.goodsName
  179. this.contractNo = option.contractNo
  180. this.goods.goodsName = option.goodsName
  181. this.goods.contractNo = option.contractNo
  182. this.goods.tranCarNo = option.tranCarNo
  183. },
  184. methods: {
  185. DateChange(e) {
  186. this.goods.sendDateStart=e.year+'-'+e.month+'-'+e.day
  187. // this.goods.sendDateStart = e.detail.value
  188. },
  189. commit1(item){
  190. uni.navigateTo({
  191. url: `/pageB/contract/look?id=${item.id}&netWeight=${item.netWeight}&carNo=${item.carNo}&sendDateStart=${item.sendDateStart}`
  192. })
  193. },
  194. grossWeightchange(e) {
  195. if (this.goods.grossWeight && this.goods.tare) {
  196. this.goods.loadNetWeight = Number(
  197. this.goods.grossWeight - this.goods.tare
  198. )
  199. }
  200. },
  201. tarechange(e) {
  202. if (this.goods.grossWeight && this.goods.tare) {
  203. this.goods.loadNetWeight = Number(
  204. this.goods.grossWeight - this.goods.tare
  205. )
  206. }
  207. },
  208. getList(){
  209. // tranCarNo:'',
  210. // carNo:'',
  211. // grossWeight:'',
  212. // tare:'',
  213. // loadNetWeight:'',
  214. // loadPoundImg:'',
  215. // contractNo:'',
  216. // goodsName:'',
  217. if(this.goods.carNo.length==0){
  218. this.$api.msg('车牌号不能为空')
  219. return
  220. }
  221. if(this.goods.carNo.length!=7){
  222. this.$api.msg('车牌号输入错误')
  223. return
  224. }
  225. if(this.goods.driverPhone.length==0){
  226. this.$api.msg('手机号不能为空')
  227. return
  228. }
  229. if(this.goods.driverPhone.length!=11){
  230. this.$api.msg('司机手机号输入错误')
  231. return
  232. }
  233. if(this.goods.grossWeight==''){
  234. this.$api.msg('毛重不能为空')
  235. return
  236. }
  237. if(this.goods.tare==''){
  238. this.$api.msg('皮重不能为空')
  239. return
  240. }
  241. if(this.goods.grossWeight>100){
  242. this.$api.msg('毛重输入错误')
  243. return
  244. }
  245. if(this.goods.tare>50){
  246. this.$api.msg('皮重输入错误')
  247. return
  248. }
  249. var that=this
  250. uni.showModal({
  251. content: '确定提交发车信息?',
  252. success: function (res) {
  253. if (res.confirm) {
  254. that.$api.doRequest('post','/tranCarInfo/api/addTranTask',that.goods).then(res => {
  255. if(res.data.code==200){
  256. console.log(that.goods)
  257. uni.showModal({
  258. content: '提交成功!',
  259. success: function (res) {
  260. if (res.confirm) {
  261. var result = that.goods.tranCarNo.substr(that.goods.tranCarNo.indexOf("C") + 1,that.goods.tranCarNo.length);
  262. var num=Number(result)+1
  263. if(num<=9){
  264. num='C00'+num
  265. }else if(num<100&&num>9){
  266. num='C0'+num
  267. }else if(num<1000&&num>99){
  268. num='C'+num
  269. }
  270. that.goods={
  271. tranCarNo:num,
  272. carNo:'',
  273. grossWeight:'',
  274. tare:'',
  275. loadNetWeight:'',
  276. loadPoundImg:'',
  277. contractNo:that.contractNo,
  278. goodsName:that.goodsName,
  279. sendDateStart:''
  280. }
  281. }else if (res.cancel) {
  282. uni.navigateBack();
  283. }
  284. }
  285. });
  286. }else if(res.data.code==11015){
  287. uni.showToast({
  288. title: '该司机未认证身份,请司机认证后再操作',
  289. icon:'none',
  290. duration: 2000
  291. })
  292. }
  293. })
  294. .catch(res => {
  295. if(res.errmsg){
  296. uni.showToast({
  297. title: res.errmsg,
  298. icon: 'none',
  299. duration: 2000
  300. })
  301. }
  302. else{
  303. uni.showToast({
  304. title: "系统异常,请联系管理员",
  305. icon: 'none',
  306. duration: 2000
  307. })
  308. }
  309. });
  310. } else if (res.cancel) {
  311. }
  312. }
  313. });
  314. },
  315. ChooseImagePerson() {
  316. uni.chooseImage({
  317. count: 1, //默认9
  318. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  319. sourceType: ['album','camera'], //从相册选择
  320. success: (res) => {
  321. //上传图片
  322. //图片路径可自行修改
  323. uploadImage(res.tempFilePaths[0], 'loadPoundImg/',
  324. result => {
  325. this.goods.loadPoundImg = result
  326. uni.hideLoading();
  327. }
  328. )
  329. }
  330. });
  331. },
  332. ChooseImageDriver() {
  333. uni.chooseImage({
  334. count: 1, //默认9
  335. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  336. sourceType: ['album','camera'], //从相册选择
  337. success: (res) => {
  338. //上传图片
  339. //图片路径可自行修改
  340. uploadImage(res.tempFilePaths[0], 'driverNoImg/',
  341. result => {
  342. if (this.driverNoImg.length != 0) {
  343. this.driverNoImg1 = result
  344. } else {
  345. this.driverNoImg = result
  346. }
  347. uni.hideLoading();
  348. }
  349. )
  350. }
  351. });
  352. },
  353. ChooseImageCar() {
  354. uni.chooseImage({
  355. count: 1, //默认9
  356. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  357. sourceType: ['album','camera'], //从相册选择
  358. success: (res) => {
  359. //上传图片
  360. //图片路径可自行修改
  361. uploadImage(res.tempFilePaths[0], 'carNoImg/',
  362. result => {
  363. if (this.carNoImg.length != 0) {
  364. this.carNoImg1 = result
  365. } else {
  366. this.carNoImg = result
  367. }
  368. uni.hideLoading();
  369. }
  370. )
  371. }
  372. });
  373. },
  374. ViewImage(e) {
  375. var img = [];
  376. img = e.currentTarget.dataset.url.split(' ')
  377. uni.previewImage({
  378. current:0,
  379. urls: img
  380. });
  381. },
  382. DelImg(e) {
  383. uni.showModal({
  384. title: '提示',
  385. content: '确定要删除该照片吗?',
  386. cancelText: '取消',
  387. confirmText: '确定',
  388. success: res => {
  389. if (res.confirm) {
  390. if(e.currentTarget.dataset.index == 0){
  391. this.personNoImg = "";
  392. }
  393. else if(e.currentTarget.dataset.index == 1){
  394. this.personNoImg1 = "";
  395. }
  396. else if(e.currentTarget.dataset.index == 2){
  397. this.driverNoImg = "";
  398. }
  399. else if(e.currentTarget.dataset.index == 3){
  400. this.driverNoImg1 = "";
  401. }
  402. else if(e.currentTarget.dataset.index == 4){
  403. this.carNoImg = "";
  404. }
  405. else if(e.currentTarget.dataset.index == 5){
  406. this.carNoImg1 = "";
  407. }
  408. }
  409. }
  410. })
  411. },
  412. },
  413. }
  414. </script>
  415. <style scoped>
  416. .container{
  417. padding: 10px 10px;
  418. background-color: #F5F6FA;
  419. }
  420. .title1{
  421. font-size: 18px;
  422. font-weight: 600;
  423. }
  424. .cu-form-group input {
  425. text-align: right;
  426. }
  427. .text-white text{
  428. background: linear-gradient(45deg, #3DC146, #B2D612);
  429. padding:5px 10px;
  430. border-radius: 38rpx;
  431. }
  432. .cu-form-group textarea {
  433. text-align: right;
  434. }
  435. .commit{
  436. background: linear-gradient(45deg, #DF331C, #DA611A);
  437. color:#fff;
  438. }
  439. .c-row {
  440. display: -webkit-box;
  441. display: -webkit-flex;
  442. display: flex;
  443. -webkit-box-align: center;
  444. -webkit-align-items: center;
  445. align-items: center;
  446. padding: 20rpx 30rpx;
  447. position: relative;
  448. }
  449. .con-list {
  450. -webkit-box-flex: 1;
  451. -webkit-flex: 1;
  452. flex: 1;
  453. display: -webkit-box;
  454. display: -webkit-flex;
  455. display: flex;
  456. -webkit-box-orient: vertical;
  457. -webkit-box-direction: normal;
  458. -webkit-flex-direction: column;
  459. flex-direction: column;
  460. color: #303133;
  461. line-height: 40rpx;
  462. text-align: right;
  463. padding-right: 20rpx;
  464. font-size: 14px;
  465. }
  466. .information{
  467. background-color: #FFFFFF;
  468. border-radius: 20px;
  469. margin-top: 10px;
  470. }
  471. .btn{
  472. margin-top: 10px;
  473. border-radius: 25px;
  474. background-color: #22C572;
  475. border: none;
  476. color: #FFFFFF;
  477. }
  478. </style>