confirmpaygoods.vue 11 KB

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