outsource-pop.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <!-- 委外 -->
  2. <template>
  3. <div>
  4. <div class="my-title">委外</div>
  5. <!-- 表单 -->
  6. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  7. <el-form-item label="供应商" prop="supplierId">
  8. <supplier-component v-model="dataForm.supplierId" :supplier-id.sync="dataForm.supplierId"></supplier-component>
  9. </el-form-item>
  10. <el-form-item label="不含税单价" prop="price">
  11. <el-input-number v-model="dataForm.price" :step="1" :min="0" :precision="1"></el-input-number>
  12. </el-form-item>
  13. <el-form-item label="含税单价" prop="taxPrice">
  14. <el-input-number v-model="dataForm.taxPrice" :step="1" :min="0" :precision="1"></el-input-number>
  15. </el-form-item>
  16. <el-form-item label="含税总价" prop="taxAmount">
  17. <span>{{dataForm.cnt * dataForm.taxPrice}}</span>
  18. </el-form-item>
  19. <el-form-item label="税率" prop="taxRate">
  20. <el-input-number style="width: 160px" v-model="dataForm.taxRate" :step="1" :precision="1"/>&nbsp;%
  21. </el-form-item>
  22. </el-form>
  23. <span slot="footer" class="dialog-footer">
  24. <el-button @click="onChose">取消</el-button>
  25. <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
  26. </span>
  27. </div>
  28. </template>
  29. <script>
  30. import { updatePurCommissionDetail } from '@/api/sale'
  31. import SupplierComponent from '../common/supplier-component'
  32. export default {
  33. name: 'outsource-pop',
  34. components: {
  35. SupplierComponent
  36. },
  37. computed: {
  38. orgId: {
  39. get () { return this.$store.state.user.orgId }
  40. }
  41. },
  42. data () {
  43. return {
  44. id: 0,
  45. dataForm: {
  46. price: 1,
  47. taxPrice: 1,
  48. taxRate: 1,
  49. cnt: 1
  50. },
  51. dataRule: {
  52. supplierId: [{ required: true, message: '请选择供应商', trigger: 'change' }],
  53. price: [{ required: true, message: '不含税单价不能为空', trigger: 'change' }],
  54. taxPrice: [{ required: true, message: '含税单价不能为空', trigger: 'change' }],
  55. taxRate: [{ required: true, message: '税率不能为空', trigger: 'change' }]
  56. }
  57. }
  58. },
  59. methods: {
  60. onChose () {
  61. this.$emit('onChose')
  62. },
  63. async init (id, cnt) {
  64. this.dataForm.purComDetailId = id
  65. this.dataForm.cnt = cnt
  66. },
  67. validateField (type) {
  68. this.$refs.dataForm.validateField(type)
  69. },
  70. // 表单提交
  71. dataFormSubmit () {
  72. this.$refs['dataForm'].validate((valid) => {
  73. if (valid) {
  74. updatePurCommissionDetail(this.dataForm).then(({data}) => {
  75. if (data && data.code === '200') {
  76. this.$message({
  77. message: '操作成功',
  78. type: 'success',
  79. duration: 1500,
  80. onClose: () => {
  81. this.onChose()
  82. this.$emit('refreshDataList')
  83. }
  84. })
  85. } else {
  86. this.$message.error(data.msg)
  87. }
  88. })
  89. }
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style scoped>
  96. </style>