Переглянути джерело

1.大中型业务发起产品退回流程

GouGengquan 3 місяців тому
батько
коміт
1f75bdcc95
1 змінених файлів з 115 додано та 1 видалено
  1. 115 1
      src/views/major/myOrder.vue

+ 115 - 1
src/views/major/myOrder.vue

@@ -161,6 +161,7 @@
             <el-button  type="text" size="small"
               @click="openFinanceInvoiceDialog(row.orderFundId, row.realAmount, row.clienteleName, row.clienteleSubName, row.productionFundId)">申请开票</el-button>
             <el-button type="text" size="small" @click="productionList(row.businessId)">产品包</el-button>
+            <el-button type="text" size="mini" @click="openProductionReturnDialog(row)">申请产品退回</el-button>
           </template>
         </el-table-column>
       </parentTable>
@@ -609,6 +610,66 @@
         </el-card>
       </el-form>
     </el-dialog>
+    <el-dialog :visible.sync="productionReturnDialog" width="55%" center @closed="resetProductionReturnForm()">
+        <el-form ref="productionReturnForm" :model="productionReturnForm" :rules="productionReturnFormRules">
+            <el-divider content-position="left">申请产品退回</el-divider>
+            <el-row>
+                <el-col :xs="24" :sm="24" :lg="24" :span="6">
+                    <el-form-item label="项目名称:" prop="name" label-width="140px" class="postInfo-container-item">
+                        <el-input v-model.trim="productionReturnForm.name" class="filter-item" disabled />
+                    </el-form-item>
+                </el-col>
+            </el-row>
+            <el-row>
+                <el-col :xs="24" :sm="12" :lg="12" :span="6">
+                    <el-form-item label="项目编号:" prop="orderId" label-width="140px" class="postInfo-container-item">
+                        <el-input v-model.trim="productionReturnForm.orderId" class="filter-item" disabled />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :lg="12" :span="6">
+                    <el-form-item label="产品编号:" prop="productionNo" label-width="140px" class="postInfo-container-item">
+                        <el-input v-model.trim="productionReturnForm.productionNo" class="filter-item" disabled />
+                    </el-form-item>
+                </el-col>
+            </el-row>
+            <el-row>
+                <el-col :xs="24" :sm="12" :lg="12" :span="6">
+                    <el-form-item label="客户名称:" prop="clientName" label-width="140px" class="postInfo-container-item">
+                        <el-input v-model.trim="productionReturnForm.clientName" class="filter-item" disabled />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :lg="12" :span="6">
+                    <el-form-item label="业务来源:" prop="clientSubName" label-width="140px" class="postInfo-container-item">
+                        <el-input v-model.trim="productionReturnForm.clientSubName" class="filter-item" disabled />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :lg="12" :span="6">
+                    <el-form-item label="委托人:" prop="bailor" label-width="140px" class="postInfo-container-item">
+                        <el-input v-model.trim="productionReturnForm.bailor" class="filter-item" disabled />
+                    </el-form-item>
+                </el-col>
+            </el-row>
+            <el-row>
+                <el-col :xs="24" :sm="12" :lg="12" :span="6">
+                    <el-form-item label="退产品原因:" prop="returnReason" label-width="140px" class="postInfo-container-item">
+                        <el-input v-model.trim="productionReturnForm.returnReason" class="filter-item" />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :lg="12" :span="6">
+                    <el-form-item label="是否退发票:" prop="returnInvoice" label-width="140px" class="postInfo-container-item">
+                        <el-select v-model="productionReturnForm.returnInvoice" style="width: 100%">
+                            <el-option label="退发票" value="true"></el-option>
+                            <el-option label="不退发票" value="false"></el-option>
+                        </el-select>
+                    </el-form-item>
+                </el-col>
+            </el-row>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+            <el-button @click="productionReturnDialog = false">取 消</el-button>
+            <el-button type="primary" @click="saveProductionreturn()">确 定</el-button>
+        </span>
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -741,6 +802,12 @@ export default {
         }]
       },
       hiddenLabels: [],
+      productionReturnForm: {},
+      productionReturnDialog: false,
+      productionReturnFormRules: {
+          returnReason: [{ required: true, message: '退产品原因不能为空', trigger: 'blur' }],
+          returnInvoice: [{ required: true, message: '请选择是否退发票', trigger: 'change' }],
+      },
     }
   },
   created() {
@@ -1446,7 +1513,54 @@ export default {
     },
     toCommission(productionNo,orderId,businessId,productionId,orderName){
         this.$router.push(`/income/major/declare/market?productionNo=${productionNo}&orderId=${orderId}&businessId=${businessId}&productionId=${productionId}&orderName=${orderName}`)
-    }
+    },
+    openProductionReturnDialog(row) {
+        // 判断产品是否已经出库了
+        if (row.repertoryState === '已出库') {
+            // 赋值基础信息
+            this.productionReturnForm.businessType = 'MAJOR_BUSINESS';
+            this.productionReturnForm.businessId = row.businessId;
+            this.productionReturnForm.productionId = row.id;
+            this.productionReturnForm.name = row.orderName;
+            this.productionReturnForm.orderId = row.orderId;
+            this.productionReturnForm.productionNo = row.productionNo;
+            this.productionReturnForm.productionType = row.production;
+            this.productionReturnForm.clientName = row.clienteleName;
+            this.productionReturnForm.clientSubName = row.clienteleSubName;
+            this.productionReturnForm.bailor = row.bailor;
+            // 打开dialog
+            this.productionReturnDialog = true;
+        } else {
+            this.$notify({
+                title: '警告',
+                message: '产品未出库,无需发起产品退回流程!',
+                type: 'warning',
+                duration: 2000,
+            });
+        }
+    },
+    // 发起产品退回流程
+    saveProductionreturn() {
+        this.$refs.productionReturnForm.validate((valid) => {
+            if (valid) {
+                this.$api.productionReturn.save(this.productionReturnForm).then((res) => {
+                    if (res.code === 200) {
+                        this.$notify({
+                            title: '成功',
+                            message: '产品退回申请流程已发起!',
+                            type: 'success',
+                            duration: 2000,
+                        });
+                        this.productionReturnDialog = false;
+                    }
+                });
+            }
+        });
+    },
+    // 重置表单
+    resetProductionReturnForm() {
+        this.$refs.productionReturnForm.resetFields();
+    },
   }
 
 }