addpaygoods.vue 11 KB

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