contract_detail.vue 12 KB

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