BatchSetPriceModal.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div ref="container">
  3. <a-modal
  4. :title="title"
  5. :width="500"
  6. :visible="visible"
  7. :confirm-loading="confirmLoading"
  8. :getContainer="() => $refs.container"
  9. :maskStyle="{ top: '93px', left: '154px' }"
  10. :wrapClassName="wrapClassNameInfo()"
  11. :mask="isDesktop()"
  12. :maskClosable="false"
  13. @ok="handleOk"
  14. @cancel="handleCancel"
  15. cancelText="取消"
  16. okText="保存"
  17. style="top: 30%; height: 30%"
  18. >
  19. <template slot="footer">
  20. <a-button key="back" v-if="isReadOnly" @click="handleCancel"> 取消 </a-button>
  21. </template>
  22. <a-spin :spinning="confirmLoading">
  23. <a-form :form="form">
  24. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="请输入价格">
  25. <a-input placeholder="请输入价格" v-decorator.trim="['price', validatorRules.price]" />
  26. </a-form-item>
  27. </a-form>
  28. </a-spin>
  29. </a-modal>
  30. </div>
  31. </template>
  32. <script>
  33. import { mixinDevice } from '@/utils/mixin'
  34. export default {
  35. name: 'BatchSetPriceModal',
  36. mixins: [mixinDevice],
  37. data() {
  38. return {
  39. title: '批量设置',
  40. visible: false,
  41. isReadOnly: false,
  42. batchType: '',
  43. model: {},
  44. labelCol: {
  45. xs: { span: 24 },
  46. sm: { span: 5 },
  47. },
  48. wrapperCol: {
  49. xs: { span: 24 },
  50. sm: { span: 16 },
  51. },
  52. confirmLoading: false,
  53. form: this.$form.createForm(this),
  54. validatorRules: {
  55. price: {
  56. rules: [{ required: true, message: '请输入价格!' }],
  57. },
  58. },
  59. }
  60. },
  61. created() {},
  62. methods: {
  63. add(type) {
  64. this.batchType = type
  65. if (type === 'purchase') {
  66. this.title = '采购价-批量设置'
  67. } else if (type === 'commodity') {
  68. this.title = '零售价-批量设置'
  69. } else if (type === 'wholesale') {
  70. this.title = '销售价-批量设置'
  71. } else if (type === 'low') {
  72. this.title = '最低售价-批量设置'
  73. }
  74. this.edit({})
  75. },
  76. edit(record) {
  77. this.form.resetFields()
  78. this.model = Object.assign({}, record)
  79. this.visible = true
  80. },
  81. close() {
  82. this.$emit('close')
  83. this.visible = false
  84. },
  85. handleOk() {
  86. let price = this.form.getFieldValue('price')
  87. this.$emit('ok', price, this.batchType)
  88. this.visible = false
  89. },
  90. handleCancel() {
  91. this.close()
  92. },
  93. },
  94. }
  95. </script>
  96. <style scoped></style>