contract_detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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. if (this.goods.carNo.length == 0) {
  214. this.$api.msg('车牌号不能为空')
  215. return
  216. }
  217. if (this.goods.carNo.length != 7) {
  218. this.$api.msg('车牌号输入错误')
  219. return
  220. }
  221. if (this.goods.driverPhone.length == 0) {
  222. this.$api.msg('手机号不能为空')
  223. return
  224. }
  225. if (this.goods.driverPhone.length != 11) {
  226. this.$api.msg('司机手机号输入错误')
  227. return
  228. }
  229. if (this.goods.grossWeight == '') {
  230. this.$api.msg('毛重不能为空')
  231. return
  232. }
  233. if (this.goods.tare == '') {
  234. this.$api.msg('皮重不能为空')
  235. return
  236. }
  237. if (this.goods.grossWeight > 100) {
  238. this.$api.msg('毛重输入错误')
  239. return
  240. }
  241. if (this.goods.tare > 50) {
  242. this.$api.msg('皮重输入错误')
  243. return
  244. }
  245. var that = this
  246. uni.showModal({
  247. content: '确定提交发车信息?',
  248. success: function(res) {
  249. if (res.confirm) {
  250. that.$api.doRequest('post', '/tranCarInfo/api/addTranTask', that.goods).then(
  251. res => {
  252. if (res.data.code == 200) {
  253. uni.showModal({
  254. content: '提交成功!',
  255. cancelText: "返回",
  256. confirmText: "继续添加",
  257. success: function(res) {
  258. if (res.confirm) {
  259. uni.navigateTo({
  260. url: `/pageB/contract/contract_detail?`
  261. })
  262. }
  263. setTimeout(() => {
  264. var result = that.goods.tranCarNo
  265. .substr(that.goods.tranCarNo
  266. .indexOf("C") + 1, that
  267. .goods.tranCarNo.length);
  268. var num = Number(result) + 1
  269. if (num <= 9) {
  270. num = 'C00' + num
  271. } else if (num < 100 && num > 9) {
  272. num = 'C0' + num
  273. } else if (num < 1000 && num >
  274. 99) {
  275. num = 'C' + num
  276. }
  277. that.goods = {
  278. tranCarNo: num,
  279. carNo: '',
  280. grossWeight: '',
  281. tare: '',
  282. loadNetWeight: '',
  283. loadPoundImg: '',
  284. contractNo: that.contractNo,
  285. goodsName: that.goodsName,
  286. sendDateStart: '',
  287. driverPhone:''
  288. }
  289. uni.navigateBack({
  290. // delta: 1
  291. });
  292. }, 2000)
  293. },
  294. })
  295. } else if (res.data.code == 11015) {
  296. uni.showToast({
  297. title: '该司机未认证身份,请司机认证后再操作',
  298. icon: 'none',
  299. duration: 2000
  300. })
  301. }
  302. })
  303. .catch(res => {
  304. uni.showToast({
  305. title: res.errmsg,
  306. icon: 'none',
  307. duration: 2000
  308. })
  309. });
  310. } else if (res.cancel) {
  311. // setTimeout(()=>{uni.navigateBack({})},1000);
  312. }
  313. }
  314. });
  315. },
  316. ChooseImagePerson() {
  317. uni.chooseImage({
  318. count: 1, //默认9
  319. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  320. sourceType: ['album', 'camera'], //从相册选择
  321. success: (res) => {
  322. //上传图片
  323. //图片路径可自行修改
  324. uploadImage(res.tempFilePaths[0], 'loadPoundImg/',
  325. result => {
  326. this.goods.loadPoundImg = result
  327. uni.hideLoading();
  328. }
  329. )
  330. }
  331. });
  332. },
  333. ChooseImageDriver() {
  334. uni.chooseImage({
  335. count: 1, //默认9
  336. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  337. sourceType: ['album', 'camera'], //从相册选择
  338. success: (res) => {
  339. //上传图片
  340. //图片路径可自行修改
  341. uploadImage(res.tempFilePaths[0], 'driverNoImg/',
  342. result => {
  343. if (this.driverNoImg.length != 0) {
  344. this.driverNoImg1 = result
  345. } else {
  346. this.driverNoImg = result
  347. }
  348. uni.hideLoading();
  349. }
  350. )
  351. }
  352. });
  353. },
  354. ChooseImageCar() {
  355. uni.chooseImage({
  356. count: 1, //默认9
  357. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  358. sourceType: ['album', 'camera'], //从相册选择
  359. success: (res) => {
  360. //上传图片
  361. //图片路径可自行修改
  362. uploadImage(res.tempFilePaths[0], 'carNoImg/',
  363. result => {
  364. if (this.carNoImg.length != 0) {
  365. this.carNoImg1 = result
  366. } else {
  367. this.carNoImg = result
  368. }
  369. uni.hideLoading();
  370. }
  371. )
  372. }
  373. });
  374. },
  375. ViewImage(e) {
  376. var img = [];
  377. img = e.currentTarget.dataset.url.split(' ')
  378. uni.previewImage({
  379. current: 0,
  380. urls: img
  381. });
  382. },
  383. DelImg(e) {
  384. uni.showModal({
  385. title: '提示',
  386. content: '确定要删除该照片吗?',
  387. cancelText: '取消',
  388. confirmText: '确定',
  389. success: res => {
  390. if (res.confirm) {
  391. if (e.currentTarget.dataset.index == 0) {
  392. this.goods.loadPoundImg = "";
  393. }
  394. }
  395. }
  396. })
  397. },
  398. },
  399. }
  400. </script>
  401. <style scoped>
  402. .container {
  403. padding: 10px 10px;
  404. background-color: #F5F6FA;
  405. }
  406. .title1 {
  407. font-size: 18px;
  408. font-weight: 600;
  409. }
  410. .cu-form-group input {
  411. text-align: right;
  412. }
  413. .text-white text {
  414. background: linear-gradient(45deg, #3DC146, #B2D612);
  415. padding: 5px 10px;
  416. border-radius: 38rpx;
  417. }
  418. .cu-form-group textarea {
  419. text-align: right;
  420. }
  421. .commit {
  422. background: linear-gradient(45deg, #DF331C, #DA611A);
  423. color: #fff;
  424. }
  425. .c-row {
  426. display: -webkit-box;
  427. display: -webkit-flex;
  428. display: flex;
  429. -webkit-box-align: center;
  430. -webkit-align-items: center;
  431. align-items: center;
  432. padding: 20rpx 30rpx;
  433. position: relative;
  434. }
  435. .con-list {
  436. -webkit-box-flex: 1;
  437. -webkit-flex: 1;
  438. flex: 1;
  439. display: -webkit-box;
  440. display: -webkit-flex;
  441. display: flex;
  442. -webkit-box-orient: vertical;
  443. -webkit-box-direction: normal;
  444. -webkit-flex-direction: column;
  445. flex-direction: column;
  446. color: #303133;
  447. line-height: 40rpx;
  448. text-align: right;
  449. padding-right: 20rpx;
  450. font-size: 14px;
  451. }
  452. .information {
  453. background-color: #FFFFFF;
  454. border-radius: 20px;
  455. margin-top: 10px;
  456. }
  457. .btn {
  458. margin-top: 10px;
  459. border-radius: 25px;
  460. background-color: #22C572;
  461. border: none;
  462. color: #FFFFFF;
  463. }
  464. </style>