dispatch-arrived.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div>
  3. <el-dialog
  4. title="订单送达"
  5. width="50%"
  6. :close-on-click-modal="false"
  7. :visible.sync="visible">
  8. <!-- 表单 -->
  9. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  10. <el-row class="my-row">
  11. <el-col :span="12">
  12. <el-form-item label="订单编码" prop="orderCode">
  13. <el-input v-model="dataForm.orderCode" :disabled="true"></el-input>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="12">
  17. <el-form-item label="送达时间" prop="arrivedTime">
  18. <el-date-picker
  19. v-model="dataForm.arrivedTime"
  20. value-format="yyyy-MM-dd HH:mm:ss"
  21. type="datetime">
  22. </el-date-picker>
  23. </el-form-item>
  24. </el-col>
  25. </el-row>
  26. <el-row class="my-row">
  27. <el-form-item label="客户反馈" prop="customerFeedback">
  28. <el-input type="textarea" v-model="dataForm.customerFeedback" placeholder="客户反馈"></el-input>
  29. </el-form-item>
  30. </el-row>
  31. <el-row class="my-row">
  32. <upload-component :display="false" :title="'证明附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
  33. </el-row>
  34. </el-form>
  35. <span slot="footer" class="dialog-footer">
  36. <el-button @click="visible = false">取消</el-button>
  37. <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
  38. </span>
  39. </el-dialog>
  40. </div>
  41. </template>
  42. <script>
  43. import UploadComponent from '../common/upload-component'
  44. export default {
  45. name: 'dispatch-arrived',
  46. components: { UploadComponent },
  47. data () {
  48. return {
  49. visible: false,
  50. fileList: [],
  51. dataForm: {},
  52. dataRule: {
  53. customerFeedback: [{ required: true, message: '客户反馈不能为空', trigger: 'blur' }],
  54. arrivedTime: [{ required: true, message: '送达时间不能为空', trigger: 'change' }]
  55. }
  56. }
  57. },
  58. methods: {
  59. async init (orderId, orderCode) {
  60. if (!orderId) return
  61. this.fileList = []
  62. this.dataForm = {
  63. orderId: orderId,
  64. orderCode: orderCode
  65. }
  66. this.visible = true
  67. },
  68. uploadSuccess (fileList) {
  69. this.fileList = fileList
  70. },
  71. validateField (type) {
  72. this.$refs.dataForm.validateField(type)
  73. },
  74. // 表单提交
  75. dataFormSubmit () {
  76. this.$refs['dataForm'].validate((valid) => {
  77. if (valid) {
  78. // 附件检查
  79. let fList = this.fileList
  80. if (fList.length > 0) {
  81. this.dataForm.attachList = []
  82. for (let i = 0; i < fList.length; i++) {
  83. this.dataForm.attachList.push({
  84. fileName: fList[i].name,
  85. url: fList[i].url
  86. })
  87. }
  88. } else {
  89. this.$message.error('请上传文件')
  90. return
  91. }
  92. this.$http({
  93. url: this.$http.adornUrl(`/biz-service/order/arrived`),
  94. method: 'post',
  95. data: this.$http.adornData({...this.dataForm})
  96. }).then(({data}) => {
  97. if (data && data.code === '200') {
  98. this.$message({
  99. message: '操作成功',
  100. type: 'success',
  101. duration: 1500,
  102. onClose: () => {
  103. this.visible = false
  104. this.$emit('refreshDataList')
  105. }
  106. })
  107. } else {
  108. this.$message.error(data.msg)
  109. }
  110. })
  111. }
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style scoped>
  118. </style>