ソースを参照

采购退货申请单新增修改

chenrui 4 ヶ月 前
コミット
5b35aef2ea

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1739350633491
+  "version": 1739408272323
 }

+ 142 - 0
src/views/purchasingManagement/purchaseReturnApplyForm/addModal.vue

@@ -0,0 +1,142 @@
+<template>
+  <a-modal
+    centered
+    class="purchaseReturnApply-add-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="新建采购退货申请单"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="500">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-form-model
+        id="purchaseReturnApply-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="供应商名称" prop="returnTargetSn">
+          <span>箭冠营销中心</span>
+        </a-form-model-item>
+        <div style="color:#999;margin:0 0 15px 6px;">
+          <div>说明:</div>
+          <div>1、采购退货申请单提交后,箭冠营销中心系统将能查看到此单并进行后续处理。</div>
+          <div>2、采购退货申请单中的产品,不会占用库存。</div>
+        </div>
+        <a-form-model-item label="退货类别" prop="goodFlag">
+          <v-select
+            id="purchaseReturnApply-goodFlag"
+            v-model="form.goodFlag"
+            code="GOOD_FLAG"
+            placeholder="请选择退货类别"
+            allowClear></v-select>
+        </a-form-model-item>
+        <a-form-model-item label="产品类别" prop="goodFlag">
+          <v-select
+            id="purchaseReturnApply-returnProductType"
+            showType="radio"
+            v-model="form.returnProductType"
+            code="RETURN_PRODUCT_TYPE"
+            placeholder="请选择产品类别"
+            allowClear></v-select>
+        </a-form-model-item>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button style="margin-right:25px;" id="writeOff-modal-back" @click="isShow = false">取消</a-button>
+        <a-button type="primary" :loading="confirmLoading" id="writeOff-modal-back" @click="handleSubmit">确定</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { VSelect } from '@/components'
+export default {
+  name: 'PurchaseReturnApplyAddModal',
+  components: { VSelect },
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      confirmLoading: false, // 按钮loading
+      isShow: this.openModal, //  是否打开弹框
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 18 }
+      },
+      form: {
+        goodFlag: 'DEFECTIVE_PRODUCT_RETURN', // 退货类别
+        returnProductType: undefined // 产品类别
+      },
+      rules: {
+        goodFlag: [
+          { required: true, message: '请选择退货类别', trigger: 'change' }
+        ],
+        returnProductType: [
+          { required: true, message: '请选择产品类别', trigger: 'change' }
+        ]
+      }
+    }
+  },
+  methods: {
+    // 重置列表
+    resetForm () {
+      this.form.goodFlag = 'DEFECTIVE_PRODUCT_RETURN'
+      this.form.returnProductType = undefined
+      this.$refs.ruleForm.resetFields()
+      this.spinning = false
+      this.confirmLoading = false
+    },
+    //  保存
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.spinning = true
+          _this.confirmLoading = true
+          _this.$emit('ok', this.form)
+        } else {
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.resetForm()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .purchaseReturnApply-add-modal{
+    .ant-modal-body {
+      padding: 20px 40px 24px;
+    }
+    .ant-form-item{
+      margin-bottom:13px !important;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+  }
+</style>

+ 20 - 63
src/views/purchasingManagement/purchaseReturnApplyForm/list.vue

@@ -140,48 +140,10 @@
         </template>
       </s-table>
     </a-spin>
-
     <!-- 生成采购退货单 -->
     <creatPurchaseReutn ref="creatPurchaseReutn" :openModal="openCpModal" @close="openCpModal=false" @creatOk="$refs.table.refresh()"></creatPurchaseReutn>
-    <!-- 新建弹框 -->
-    <common-modal
-      :openModal="openTipsModal"
-      modalTit="新建采购退货申请单"
-      okText="确定"
-      @ok="creatReturnOrder"
-      @close="closeCreatModal">
-      <div>
-        <div style="padding:10px 0;">供应商:箭冠营销中心</div>
-        <div style="color:#999;">
-          <div>说明:</div>
-          <div>1、采购退货申请单提交后,箭冠营销中心系统将能查看到此单并进行后续处理。</div>
-          <div>2、采购退货申请单中的产品,不会占用库存。</div>
-        </div>
-        <div style="display:flex;align-items: center;padding-top: 20px;">
-          <span style="color:red;">*</span>
-          <span>退货类别:</span>
-          <v-select
-            id="purchaseReturnList-goodFlag-btn"
-            style="width:250px;"
-            v-model="goodFlag"
-            code="GOOD_FLAG"
-            placeholder="请选择退货类别"
-            allowClear></v-select>
-        </div>
-        <div style="display:flex;align-items: center;padding-top: 20px;">
-          <span style="color:red;">*</span>
-          <span>产品类别:</span>
-          <v-select
-            id="purchaseReturnList-goodFlag-btn"
-            style="width:250px;"
-            showType="radio"
-            v-model="returnProductType"
-            code="RETURN_PRODUCT_TYPE"
-            placeholder="请选择产品类别"
-            allowClear></v-select>
-        </div>
-      </div>
-    </common-modal>
+    <!-- 新增 -->
+    <addModal ref="attTipsModal" :openModal="openTipsModal" @ok="creatReturnOrder" @close="openTipsModal=false"/>
   </a-card>
 </template>
 
@@ -191,11 +153,11 @@ import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import getDate from '@/libs/getDate.js'
 import creatPurchaseReutn from './creatPurchaseReutn.vue'
-import commonModal from '@/views/common/commonModal.vue'
+import addModal from './addModal.vue'
 import { purchaseReturnList, purchaseReturnSave, purchaseReturnDel, purchaseReturnAgainCreate } from '@/api/purchaseReturnApply'
 export default {
   name: 'PurchaseReturnList',
-  components: { STable, VSelect, rangeDate, creatPurchaseReutn, commonModal },
+  components: { STable, VSelect, rangeDate, creatPurchaseReutn, addModal },
   mixins: [commonMixin],
   data () {
     return {
@@ -219,8 +181,6 @@ export default {
         endAuditDate: '', // 审核结束时间
         returnProductType: undefined// 产品类别
       },
-      goodFlag: 'DEFECTIVE_PRODUCT_RETURN', // 退货类别默认值
-      returnProductType: undefined, // 产品类别
       disabled: false, //  查询、重置按钮是否可操作
       tableHeight: 0, // 表格高度
       // 加载数据方法 必须为 Promise 对象
@@ -337,26 +297,23 @@ export default {
       this.goodFlag = 'DEFECTIVE_PRODUCT_RETURN'
     },
     // 生成销售退货单成功
-    creatReturnOrder () {
+    creatReturnOrder (ajaxData) {
       const _this = this
-      if (_this.goodFlag) {
-        _this.spinning = true
-        purchaseReturnSave({ goodFlag: _this.goodFlag, returnProductType: _this.returnProductType }).then(res => {
-          if (res.status == 200) {
-            const data = res.data
-            _this.spinning = false
-            _this.openTipsModal = false
-            // 重置查询条件
-            _this.resetData()
-            // 进入编辑页面
-            _this.$router.push({ name: 'purchaseReturnApplyFormEdit', params: { sn: data.purchaseReturnApplySn, val: data.returnProductType } })
-          } else {
-            _this.spinning = false
-          }
-        })
-      } else {
-        this.$message.success('请选择退货类别')
-      }
+      _this.spinning = true
+      purchaseReturnSave(ajaxData).then(res => {
+        if (res.status == 200) {
+          const data = res.data
+          _this.spinning = false
+          _this.openTipsModal = false
+          // 重置查询条件
+          _this.resetData()
+          _this.$refs.attTipsModal.resetForm()
+          // 进入编辑页面
+          _this.$router.push({ name: 'purchaseReturnApplyFormEdit', params: { sn: data.purchaseReturnApplySn, val: data.returnProductType } })
+        } else {
+          _this.spinning = false
+        }
+      })
     },
     // 再次编辑
     handleFinishBill (row) {