setLogistics.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="detail-view">
  3. <u-form label-width="150" :model="add_form" ref="uForm">
  4. <view class="form-model-view">
  5. <u-form-item required label="选择司机" prop="shopName">
  6. <u-input @click="goPage('/pagesT/driver/driver')" class="dis-input" disabled
  7. v-model="add_form.driverName" placeholder="请选择" />
  8. <u-icon name="arrow-right" size="24" color="#6c6c6c"></u-icon>
  9. </u-form-item>
  10. <u-form-item required label="货车车牌">
  11. <u-input input-align="right" v-model="add_form.plateNumber" />
  12. </u-icon>
  13. </u-form-item>
  14. <u-form-item required label="货车电话">
  15. <u-input input-align="right" v-model="add_form.phone" />
  16. </u-icon>
  17. </u-form-item>
  18. <u-form-item label="备注" label-position="top">
  19. <u-input type="textarea" v-model="add_form.remark" />
  20. </u-form-item>
  21. </view>
  22. </u-form>
  23. <view class="submit-btn">
  24. <view class="btn-min" @click="submit">确定</view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. add_form: {
  33. id: '',
  34. driverName: '',
  35. plateNumber: '',
  36. phone: '',
  37. remark: ''
  38. },
  39. driverData: '',
  40. sourceId: '',
  41. type: ''
  42. };
  43. },
  44. onLoad(options) {
  45. this.sourceId = options.sourceId
  46. this.type = options.type
  47. this.outId = options.outId
  48. this.getOrderInfoById()
  49. },
  50. watch: {
  51. driverData(val) {
  52. if (val) {
  53. this.add_form.driverName = val.driverName
  54. this.add_form.plateNumber = val.plateNumber
  55. this.add_form.phone = val.phone
  56. this.add_form.remark = val.remark
  57. this.add_form.id = val.id
  58. }
  59. }
  60. },
  61. methods: {
  62. getOrderInfoById() {
  63. this.$u.api.getOrderInfoById(1, {
  64. orderId: this.sourceId
  65. }).then(res => {
  66. if (res.data.logisticsData) {
  67. this.add_form.id = res.data.logisticsData.id
  68. this.add_form.plateNumber = res.data.logisticsData.truckName
  69. this.add_form.phone = res.data.logisticsData.truckTel
  70. this.add_form.driverName = res.data.logisticsData.name
  71. this.add_form.remark = res.data.logisticsData.remark
  72. }
  73. });
  74. },
  75. submit() {
  76. if (!this.add_form.driverName) {
  77. this.$u.toast('请选择司机');
  78. return;
  79. }
  80. if (this.type !== "5") {
  81. this.$u.api.inventoryOutAddLogistics({
  82. id: this.outId,
  83. driverId: this.add_form.id,
  84. driverName: this.add_form.driverName,
  85. truckName: this.add_form.plateNumber,
  86. truckTel: this.add_form.phone,
  87. remark: this.add_form.remark
  88. }).then(res => {
  89. this.$u.toast('添加成功');
  90. setTimeout(() => {
  91. uni.navigateBack();
  92. }, 500);
  93. })
  94. } else {
  95. this.$u.api.addLogistics({
  96. deliveryType: 3,
  97. logisticsData: {
  98. id: this.add_form.id,
  99. truckName: this.add_form.plateNumber,
  100. truckTel: this.add_form.phone,
  101. remark: this.add_form.remark,
  102. name: this.add_form.driverName,
  103. },
  104. deliveryNo: "",
  105. expressName: "",
  106. expressId: "",
  107. no: "",
  108. orderId: this.sourceId,
  109. }).then(res => {
  110. this.$u.toast('添加成功');
  111. setTimeout(() => {
  112. uni.navigateBack();
  113. }, 500);
  114. });
  115. }
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss">
  121. </style>