Sfoglia il codice sorgente

审核不通过弹框重写

chenrui 3 anni fa
parent
commit
5c2dee01a3

+ 13 - 21
src/views/allocationManagement/transferOut/list.vue

@@ -109,6 +109,8 @@
     </s-table>
     <!-- 新增 -->
     <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+    <!-- 审核 -->
+    <auditModal :openModal="visibleAudit" @close="visibleAudit=false" @ok="auditOrder('WAIT_OUT_WAREHOUSE')" @fail="auditOrder('AUDIT_REJECT')" />
   </a-card>
 </template>
 
@@ -117,10 +119,11 @@ import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 import rangeDate from '@/views/common/rangeDate.vue'
+import auditModal from '@/views/common/auditModal.vue'
 import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport } from '@/api/allocateBill'
 import { allocateTypeAllList } from '@/api/allocateType'
 export default {
-  components: { STable, VSelect, basicInfoModal, rangeDate },
+  components: { STable, VSelect, basicInfoModal, rangeDate, auditModal },
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
@@ -167,6 +170,8 @@ export default {
           return data
         })
       },
+      visibleAudit: false,
+      auditInfo: null,
       allocateTypeList: [], //  调拨类型
       openModal: false //  新增编辑  弹框
     }
@@ -211,32 +216,19 @@ export default {
     },
     //  审核
     handleExamine (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要审核通过吗?',
-        centered: true,
-        closable: true,
-        okText: '审核通过',
-        cancelText: '审核不通过',
-        onOk () {
-          _this.auditOrder(row.allocateSn, 'WAIT_OUT_WAREHOUSE')
-        },
-        onCancel (e) {
-          if (!e.triggerCancel) {
-            _this.auditOrder(row.allocateSn, 'AUDIT_REJECT')
-          }
-          _this.$destroyAll()
-        }
-      })
+      this.auditInfo = row
+      this.visibleAudit = true
     },
     // 审核
-    auditOrder (sn, state) {
+    auditOrder (state) {
       const _this = this
-      allocateBillAudit({ sn: sn, state: state }).then(res => {
+      allocateBillAudit({ sn: this.auditInfo.allocateSn, state: state }).then(res => {
         if (res.status == 200) {
+          _this.visibleAudit = false
           _this.$message.success(res.message)
           _this.$refs.table.refresh()
+        } else {
+          _this.visibleAudit = false
         }
       })
     },

+ 91 - 0
src/views/common/auditModal.vue

@@ -0,0 +1,91 @@
+<template>
+  <a-modal
+    centered
+    class="audit-modal"
+    :footer="null"
+    :maskClosable="false"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="416">
+    <div class="audit-main">
+      <a-icon type="question-circle" style="color: #faad14;font-size: 22px;margin-right: 16px;" />
+      <div class="audit-cont">
+        <p class="audit-tit">提示</p>
+        <p class="audit-txt">请点击下方按钮确认操作?</p>
+      </div>
+    </div>
+    <div class="btn-box">
+      <a-button type="primary" class="button-error" @click="handleAuditFail">审核不通过</a-button>
+      <a-button type="primary" class="button-info" @click="handleAuditOk">审核通过</a-button>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+export default {
+  name: 'AuditModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal //  是否打开弹框
+    }
+  },
+  methods: {
+    // 审核通过
+    handleAuditOk () {
+      this.$emit('ok')
+    },
+    // 审核不通过
+    handleAuditFail () {
+      this.$emit('fail')
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .audit-modal{
+    .ant-modal-body{
+      padding: 32px 32px 24px;
+    }
+    .audit-main{
+      display: flex;
+      .audit-cont{
+        .audit-tit{
+          color: rgba(0, 0, 0, 0.85);
+          font-weight: 500;
+          font-size: 16px;
+          line-height: 1.4;
+          margin: 0;
+        }
+        .audit-txt{
+          margin: 8px 0 0;
+          color: rgba(0, 0, 0, 0.65);
+          font-size: 14px;
+          line-height: 1.5;
+        }
+      }
+    }
+    .btn-box{
+      text-align: right;
+      margin-top: 24px;
+    }
+  }
+</style>

+ 13 - 27
src/views/dealerManagement/merchantInfoManagement/detailModal.vue

@@ -78,20 +78,24 @@
           type="primary"
           class="button-primary"
           style="margin-right: 50px;"
-          @click="handleAudit">审核</a-button>
+          @click="visibleAudit=true">审核</a-button>
         <a-button id="merchantInfoManagement-back" size="large" @click="isShow = false" style="font-size: 12px;">返回列表</a-button>
       </div>
     </div>
     <div style="padding: 50px;text-align: center;" v-else>
       <a-spin />
     </div>
+    <!-- 审核 -->
+    <auditModal :openModal="visibleAudit" @close="visibleAudit=false" @ok="auditOrder('PASS')" @fail="auditOrder('REJECT')" />
   </a-modal>
 </template>
 
 <script>
+import auditModal from '@/views/common/auditModal.vue'
 import { dealerAudit, dealerDetailBySn, dealerFindUpdateInfoBySn } from '@/api/dealer'
 export default {
   name: 'MerchantInfoManagementModal',
+  components: { auditModal },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -107,41 +111,23 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       form: null,
-      title: ''
+      title: '',
+      visibleAudit: false
     }
   },
   methods: {
     // 审核
-    auditOrder (dealerAuditSn, auditState) {
+    auditOrder (auditState) {
       dealerAudit({
-        dealerAuditSn,
-        auditState
+        dealerAuditSn: this.form.dealerAuditSn,
+        auditState: auditState
       }).then(res => {
         if (res.status == 200) {
+          this.visibleAudit = false
           this.$message.success(res.message)
           this.$emit('ok')
-        }
-      })
-    },
-    //  审核确认
-    handleAudit () {
-      const _this = this
-      const row = this.form
-      this.$confirm({
-        title: '提示',
-        content: '请点击下方按钮确认操作?',
-        centered: true,
-        closable: true,
-        okText: '审核通过',
-        cancelText: '审核不通过',
-        onOk () {
-          _this.auditOrder(row.dealerAuditSn, 'PASS')
-        },
-        onCancel (e) {
-          if (!e.triggerCancel) {
-            _this.auditOrder(row.dealerAuditSn, 'REJECT')
-          }
-          _this.$destroyAll()
+        } else {
+          this.visibleAudit = false
         }
       })
     },

+ 15 - 23
src/views/salesManagement/examineVerify/list.vue

@@ -99,6 +99,8 @@
         <span v-else>--</span>
       </template>
     </s-table>
+    <!-- 审核 -->
+    <auditModal :openModal="visibleAudit" @close="visibleAudit=false" @ok="auditOrder('OUTING_WAREHOUSE')" @fail="auditOrder('STOCK_UP_REJECT')" />
   </a-card>
 </template>
 
@@ -106,11 +108,12 @@
 import moment from 'moment'
 import getDate from '@/libs/getDate.js'
 import rangeDate from '@/views/common/rangeDate.vue'
+import auditModal from '@/views/common/auditModal.vue'
 import { STable, VSelect } from '@/components'
 import custList from '@/views/common/custList.vue'
 import { dispatchlList, dispatchQueryCount, dispatchStockUpAduit } from '@/api/dispatch'
 export default {
-  components: { STable, VSelect, custList, rangeDate },
+  components: { STable, VSelect, custList, rangeDate, auditModal },
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
@@ -171,7 +174,9 @@ export default {
           this.disabled = false
           return data
         })
-      }
+      },
+      visibleAudit: false,
+      auditInfo: null
     }
   },
   methods: {
@@ -199,33 +204,20 @@ export default {
     },
     //  审核
     handleExamine (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '请点击下方按钮确认操作?',
-        centered: true,
-        closable: true,
-        okText: '审核通过',
-        cancelText: '审核不通过',
-        onOk () {
-          _this.auditOrder(row.dispatchBillSn, 'OUTING_WAREHOUSE')
-        },
-        onCancel (e) {
-          if (!e.triggerCancel) {
-            _this.auditOrder(row.dispatchBillSn, 'STOCK_UP_REJECT')
-          }
-          _this.$destroyAll()
-        }
-      })
+      this.auditInfo = row
+      this.visibleAudit = true
     },
-    auditOrder (dispatchBillSn, billStatus) {
+    auditOrder (billStatus) {
       dispatchStockUpAduit({
-        dispatchBillSn,
-        billStatus
+        dispatchBillSn: this.auditInfo.dispatchBillSn,
+        billStatus: billStatus
       }).then(res => {
         if (res.status == 200) {
+          this.visibleAudit = false
           this.$message.success(res.message)
           this.$refs.table.refresh()
+        } else {
+          this.visibleAudit = false
         }
       })
     },

+ 16 - 24
src/views/salesManagement/salesQuery/list.vue

@@ -181,19 +181,22 @@
     </s-table>
     <!-- 选择客户弹框 -->
     <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
+    <!-- 审核 -->
+    <auditModal :openModal="visibleAudit" @close="visibleAudit=false" @ok="auditOrder('OUTING_WAREHOUSE')" @fail="auditOrder('AUDIT_REJECT')" />
   </a-card>
 </template>
 
 <script>
 import rangeDate from '@/views/common/rangeDate.vue'
 import { STable, VSelect } from '@/components'
+import auditModal from '@/views/common/auditModal.vue'
 import chooseCustomModal from './chooseCustomModal.vue'
 import custList from '@/views/common/custList.vue'
 import { salesList, salesDel, salesWriteAudit, salesCount } from '@/api/sales'
 import { findBySalesBillSn } from '@/api/dispatch'
 export default {
   name: 'TableList',
-  components: { STable, VSelect, chooseCustomModal, custList, rangeDate },
+  components: { STable, VSelect, chooseCustomModal, custList, rangeDate, auditModal },
   data () {
     return {
       tableHeight: 0,
@@ -269,7 +272,9 @@ export default {
           this.disabled = false
           return data
         })
-      }
+      },
+      visibleAudit: false,
+      auditInfo: null
     }
   },
   methods: {
@@ -299,36 +304,23 @@ export default {
     },
     //  审核
     handleEexamine (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '请点击下方按钮确认操作?',
-        centered: true,
-        closable: true,
-        okText: '审核通过',
-        cancelText: '审核不通过',
-        onOk () {
-          _this.auditOrder(row.salesBillSn, 'OUTING_WAREHOUSE')
-        },
-        onCancel (e) {
-          if (!e.triggerCancel) {
-            _this.auditOrder(row.salesBillSn, 'AUDIT_REJECT')
-          }
-          _this.$destroyAll()
-        }
-      })
+      this.auditInfo = row
+      this.visibleAudit = true
     },
-    auditOrder (salesBillSn, billStatus) {
+    auditOrder (billStatus) {
       salesWriteAudit({
-        salesBillSn,
-        billStatus
+        salesBillSn: this.auditInfo.salesBillSn,
+        billStatus: billStatus
       }).then(res => {
         if (res.status == 200) {
+          this.visibleAudit = false
           this.$message.success(res.message)
           this.$refs.table.refresh()
           if (billStatus == 'OUTING_WAREHOUSE') {
-            this.handleDispatch({ salesBillSn })
+            this.handleDispatch({ salesBillSn: this.auditInfo.salesBillSn })
           }
+        } else {
+          this.visibleAudit = false
         }
       })
     },

+ 13 - 28
src/views/salesManagement/salesReturn/detail.vue

@@ -47,7 +47,7 @@
         style="width: 150px;"
         size="large"
         v-if="detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')"
-        @click="handleEexamine()"
+        @click="visibleAudit=true"
         id="salesReturn-eexamine-btn">审核</a-button>
       <a-button
         type="primary"
@@ -69,17 +69,20 @@
         @click="handleEdit()"
         id="salesReturn-edit-btn">改单</a-button>
     </a-card>
+    <!-- 审核 -->
+    <auditModal :openModal="visibleAudit" @close="visibleAudit=false" @ok="auditOrder('WAIT_CHECK')" @fail="auditOrder('AUDIT_REJECT')" />
   </div>
 </template>
 
 <script>
 import { getOperationalPrecision } from '@/libs/tools.js'
 import { STable, VSelect } from '@/components'
+import auditModal from '@/views/common/auditModal.vue'
 import { salesReturnDetail, salesReturnAudit } from '@/api/salesReturn'
 import { salesReturnDetailList } from '@/api/salesReturnDetail'
 export default {
   name: 'SalesReturnDetail',
-  components: { STable, VSelect },
+  components: { STable, VSelect, auditModal },
   data () {
     return {
       disabled: false,
@@ -179,7 +182,8 @@ export default {
           return data
         })
       },
-      detailData: null //  详情数据
+      detailData: null, //  详情数据
+      visibleAudit: false
     }
   },
   methods: {
@@ -187,36 +191,17 @@ export default {
     handleBack () {
       this.$router.push({ name: 'salesReturnList' })
     },
-    //  审核
-    handleEexamine () {
-      const _this = this
-      const row = this.detailData
-      this.$confirm({
-        title: '提示',
-        content: '请点击下方按钮确认操作?',
-        centered: true,
-        closable: true,
-        okText: '审核通过',
-        cancelText: '审核不通过',
-        onOk () {
-          _this.auditOrder(row.salesReturnBillSn, 'WAIT_CHECK')
-        },
-        onCancel (e) {
-          if (!e.triggerCancel) {
-            _this.auditOrder(row.salesReturnBillSn, 'AUDIT_REJECT')
-          }
-          _this.$destroyAll()
-        }
-      })
-    },
-    auditOrder (salesReturnBillSn, billStatus) {
+    auditOrder (billStatus) {
       salesReturnAudit({
-        salesReturnBillSn,
-        billStatus
+        salesReturnBillSn: this.detailData.salesReturnBillSn,
+        billStatus: billStatus
       }).then(res => {
         if (res.status == 200) {
+          this.visibleAudit = false
           this.$message.success(res.message)
           this.handleBack()
+        } else {
+          this.visibleAudit = false
         }
       })
     },

+ 16 - 23
src/views/salesManagement/salesReturn/list.vue

@@ -148,6 +148,8 @@
     </s-table>
     <!-- 选择客户弹框 -->
     <choose-custom-modal :show="openModal" @ok="handleEdit" @cancel="openModal=false"></choose-custom-modal>
+    <!-- 审核 -->
+    <auditModal :openModal="visibleAudit" @close="visibleAudit=false" @ok="auditOrder('WAIT_CHECK')" @fail="auditOrder('AUDIT_REJECT')" />
   </a-card>
 </template>
 
@@ -155,6 +157,7 @@
 import { STable, VSelect } from '@/components'
 import chooseCustomModal from './chooseCustomModal.vue'
 import custList from '@/views/common/custList.vue'
+import auditModal from '@/views/common/auditModal.vue'
 import rangeDate from '@/views/common/rangeDate.vue'
 import { salesReturnList, salesReturnQueryCount, salesReturnAudit, salesReturnDel } from '@/api/salesReturn'
 import moment from 'moment'
@@ -166,7 +169,8 @@ export default {
     VSelect,
     chooseCustomModal,
     custList,
-    rangeDate
+    rangeDate,
+    auditModal
   },
   data () {
     return {
@@ -227,7 +231,9 @@ export default {
           this.disabled = false
           return data
         })
-      }
+      },
+      visibleAudit: false,
+      auditInfo: null
     }
   },
   methods: {
@@ -277,33 +283,20 @@ export default {
     },
     //  审核
     handleEexamine (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '请点击下方按钮确认操作?',
-        centered: true,
-        closable: true,
-        okText: '审核通过',
-        cancelText: '审核不通过',
-        onOk () {
-          _this.auditOrder(row.salesReturnBillSn, 'WAIT_CHECK')
-        },
-        onCancel (e) {
-          if (!e.triggerCancel) {
-            _this.auditOrder(row.salesReturnBillSn, 'AUDIT_REJECT')
-          }
-          _this.$destroyAll()
-        }
-      })
+      this.auditInfo = row
+      this.visibleAudit = true
     },
-    auditOrder (salesReturnBillSn, billStatus) {
+    auditOrder (billStatus) {
       salesReturnAudit({
-        salesReturnBillSn,
-        billStatus
+        salesReturnBillSn: this.auditInfo.salesReturnBillSn,
+        billStatus: billStatus
       }).then(res => {
         if (res.status == 200) {
+          this.visibleAudit = false
           this.$message.success(res.message)
           this.$refs.table.refresh()
+        } else {
+          this.visibleAudit = false
         }
       })
     },