freight_setting_details.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="warp">
  3. <view class="transaction">
  4. <u-form :model="purchaseOrder" ref="uForm" class="uForm">
  5. <u-form-item label="合同编号" prop="receivingAddress" label-width="140">
  6. <u-input v-model="purchaseOrder.receivingAddress" input-align="right" placeholder="" disabled/>
  7. </u-form-item>
  8. <u-form-item label="任务编号" prop="receivingAddress" label-width="140">
  9. <u-input v-model="purchaseOrder.receivingAddress" input-align="right" placeholder="" disabled/>
  10. </u-form-item>
  11. <u-form-item label="货名" prop="receivingAddress" label-width="140">
  12. <u-input v-model="purchaseOrder.receivingAddress" input-align="right" placeholder="" disabled/>
  13. </u-form-item>
  14. <u-form-item label="发货地址" prop="receivingAddress" label-width="140" label-position='top'>
  15. <u-input v-model="purchaseOrder.receivingAddress" input-align="left" placeholder="" disabled/>
  16. </u-form-item>
  17. <u-form-item label="收货地址" prop="receivingAddress" label-width="140" label-position='top'>
  18. <u-input v-model="purchaseOrder.receivingAddress" input-align="left" placeholder="请输入收货地址" disabled/>
  19. </u-form-item>
  20. <u-form-item label="运费(元/吨)" prop="freightUnitPrice" label-width="250">
  21. <u-input v-model="purchaseOrder.freightUnitPrice" input-align="right" placeholder="请输入运费单价" />
  22. </u-form-item>
  23. </u-form>
  24. </view>
  25. <u-toast ref="uToast" />
  26. <view class="bottom-btn">
  27. <u-button type="primary" class="submit" hover-class="none">已通过</u-button>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. purchaseOrder: {
  36. freightUnitPrice: "123",
  37. receivingAddress:'444'
  38. },
  39. rules: {
  40. freightUnitPrice: [{
  41. validator: (rule, value, callback) => {
  42. return !this.$u.test.isEmpty(value)
  43. },
  44. message: '运费不能为空',
  45. trigger: ['change', 'blur']
  46. },
  47. {
  48. validator: (rule, value, callback) => {
  49. return this.$u.test.amount(value)
  50. },
  51. message: '数值类型,最多保留两位小数',
  52. trigger: ['change', 'blur'],
  53. }
  54. ]
  55. }
  56. }
  57. },
  58. onReady() {
  59. this.$refs.uForm.setRules(this.rules);
  60. },
  61. methods: {
  62. passSubmit(){
  63. this.$refs.uForm.validate(valid => {
  64. if (valid) {
  65. uni.showLoading({
  66. title: '正在加载',
  67. mask: true
  68. })
  69. console.log('验证通过');
  70. this.$api.doRequest('post',
  71. '/freightReceivingDispatching/api/insertFreightReceivingDispatching',
  72. this
  73. .purchaseOrder).then(res => {
  74. if (res.data.code == 200) {
  75. uni.showToast({
  76. title: '提交成功',
  77. icon: 'none',
  78. duration: 2000,
  79. success: function() {
  80. uni.navigateTo({
  81. url: `/pageA/freightTransport/index`
  82. })
  83. }
  84. })
  85. }
  86. }).catch(res => {
  87. // uni.showToast({
  88. // title: res.data.message,
  89. // icon: 'none',
  90. // duration: 2000
  91. // })
  92. })
  93. } else {
  94. console.log('验证失败');
  95. }
  96. });
  97. }
  98. }
  99. }
  100. </script>
  101. <style scoped lang="scss">
  102. .transaction {
  103. background-color: #FFFFFF;
  104. margin: 10rpx;
  105. padding-bottom: 10rpx;
  106. border-radius: 20rpx;
  107. }
  108. .uForm {
  109. padding: 0 40rpx;
  110. }
  111. .u-form-item{
  112. padding: 0;
  113. }
  114. .bottom-btn {
  115. width: 100%;
  116. position: fixed;
  117. bottom: 40rpx;
  118. display: flex;
  119. z-index: 2;
  120. }
  121. .submit {
  122. width: 40%;
  123. background: #22C572;
  124. border-radius: 10rpx;
  125. }
  126. </style>