123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <a-modal
- centered
- class="setPurchaseQty-modal"
- :footer="null"
- :maskClosable="false"
- title="设置采购数量"
- v-model="isShow"
- @cancel="isShow = false"
- :width="600">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="setPurchaseQty-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol"
- >
- <a-form-model-item label="产品名称:">
- {{ dateilData&&dateilData.productName }}
- </a-form-model-item>
- <a-form-model-item label="产品编码">
- {{ dateilData&&dateilData.productCode }}
- </a-form-model-item>
- <a-form-model-item label="采购数量" prop="qty">
- <a-input-number
- id="shelfMonitoringList-maxUnsalableDays"
- style="width:60%"
- v-model="form.qty"
- :precision="0"
- :min="1"
- :max="999999"
- placeholder="采购数量"/>
- </a-form-model-item>
- </a-form-model>
- <div class="btn-cont">
- <a-button type="primary" id="setPurchaseQty-modal-save" @click="handleSave">保存</a-button>
- <a-button id="setPurchaseQty-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { purchaseCartSave } from '@/api/purchaseCart'
- import { mapActions } from 'vuex'
- export default {
- name: 'ChainTransferOutBasicInfoModal',
- mixins: [commonMixin],
- props: {
- openModal: {
- // 弹框显示状态
- type: Boolean,
- default: false
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal, // 是否打开弹框
- formItemLayout: {
- labelCol: { span: 4 },
- wrapperCol: { span: 20 }
- },
- form: {
- qty: 1,
- productSn: '',
- productCode: '',
- sysFlag: ''
- },
- rules: {
- qty: [{ required: true, message: '请输入采购数量', trigger: 'change' }]
- },
- dateilData: null
- }
- },
- methods: {
- ...mapActions(['getCartList']),
- setData (row) {
- this.dateilData = row
- this.form.productSn = row.productSn
- this.form.productCode = row.productCode
- this.form.sysFlag = row.dealerProduct.sysFlag
- this.form.qty = 1
- },
- // 保存
- handleSave () {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- const form = JSON.parse(JSON.stringify(_this.form))
- _this.spinning = true
- purchaseCartSave(form).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- setTimeout(() => {
- _this.isShow = false
- _this.$emit('ok', res.data)
- _this.getCartList()
- _this.spinning = false
- }, 1000)
- } else {
- _this.spinning = false
- }
- })
- } else {
- return false
- }
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.$refs.ruleForm.resetFields()
- }
- }
- }
- }
- </script>
- <style lang="less">
- .setPurchaseQty-modal {
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|