lilei пре 7 месеци
родитељ
комит
1ff6822659

+ 23 - 0
src/api/salesNew.js

@@ -167,6 +167,18 @@ export const salesPromoValidaSubmit = (params) => {
   })
 }
 
+// 审核时活动规则校验
+export const salesPromoValidaAudit = (params) => {
+  return axios({
+    url: `/salesPromo/validationAudit/${params.salesBillSn}`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('审核前活动规则校验')
+    }
+  })
+}
+
 //  销售 审核通过
 export const salesWriteAuditPass = (params) => {
   return axios({
@@ -189,6 +201,17 @@ export const salesWriteAuditReject = (params) => {
     }
   })
 }
+// 销售 审核通过 待上级审核
+export const salesWriteUpAuditPass = (params) => {
+  return axios({
+    url: '/sales/upAuditPass',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('审核通过,待上级审核')
+    }
+  })
+}
 //  销售 一键审核下推
 export const salesWriteAuditPush = (params) => {
   return axios({

+ 2 - 1
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -411,9 +411,10 @@ export default {
         item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
         item.productOrigUnit = productOrigUnit || '--'
         item.epushedQty = Number(item.pushedQty) - Number(item.pushQty)
-        // 判断是否有转采购单
+        // 判断是否缺货
         if (item.unpushedQty && (Number(item.stockQty) < Number(item.unpushedQty))) {
           str += item.productCode + '、'
+          // 参与促销活动产品是否缺货
           if (item.promotionFlag != 0) {
             this.hasOutStockOfActive = true
           }

+ 80 - 45
src/views/salesManagement/salesQueryNew/detail.vue

@@ -161,7 +161,7 @@
         type="primary"
         class="button-info"
         id="salesDetail-audit-btn"
-        v-if="detailData&&detailData.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
+        v-if="(detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus=='WAIT_UP_AUDIT_PASS'))&&$hasPermissions('B_salesAudit')"
         @click="handleAudit()"
       >
         审核
@@ -220,8 +220,10 @@
     <dsModal ref="dsModal" title="销售单一键审核" :openModal="showDsModal" @close="showDsModal=false" @ok="handleOnceAudit" />
     <!-- 缺货明细 -->
     <stockOutDetail :openModal="showStockOut" :detailData="detailData" :salesBillSn="$route.params.sn || bizSn" @close="showStockOut=false"></stockOutDetail>
-    <!-- 改单 -->
+    <!-- 改单时价格变更提示 -->
     <tipModal ref="tipModal" :openModal="openTipModal" :dataList="sourceData" @close="closeTipModal" @ok="openTipModalOk"></tipModal>
+    <!-- 审核时校验销售价低于成本价提示 -->
+    <vaildPriceModal ref="vaildPriceModal" :openModal="openVaildPriceModal" :dataObj="tempData" @close="openVaildPriceModal=false" @ok="vaildPriceOk"></vaildPriceModal>
   </div>
 </template>
 
@@ -237,13 +239,14 @@ import stockOutDetail from './stockOutDetailModal.vue'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 import detailProductList from './comps/detailProductList.vue'
 import tipModal from './tipModal.vue'
+import vaildPriceModal from './vaildPriceModal.vue'
 // 接口
-import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAuditPass, salesWriteAuditReject, salesWriteAuditPush, getThirdStockQty, salesPromoValidaSubmit, changeBillCheckUpdatePrice, changeBillCheck } from '@/api/salesNew'
+import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAuditPass, salesWriteUpAuditPass, salesWriteAuditReject, salesWriteAuditPush, getThirdStockQty, salesPromoValidaAudit, changeBillCheckUpdatePrice, changeBillCheck } from '@/api/salesNew'
 
 export default {
   name: 'SalesDetailNew',
   mixins: [commonMixin],
-  components: { VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse, detailProductList, tipModal },
+  components: { VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse, detailProductList, tipModal, vaildPriceModal },
   props: {
     bizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],
@@ -270,7 +273,9 @@ export default {
       warehouseSn: undefined, // 所在仓库
       promoFlag: undefined, // 产品类型
       openTipModal: false, // 改单弹窗
-      sourceData: undefined// 价格变动数据
+      sourceData: undefined, // 价格变动数据
+      tempData: undefined, // 校验临时数据
+      openVaildPriceModal: false // 校验价格弹框
     }
   },
   computed: {
@@ -360,6 +365,32 @@ export default {
       this.openTipModal = false
       this.$router.push({ name: 'salesNewEdit', params: { sn: this.$route.params.sn } })
     },
+    // 价格低于成本校验提示,继续审核
+    vaildPriceOk (type) {
+      // 不通过
+      if (type == 'AUDIT_REJECT') {
+        this.auditOrder(type)
+      } else {
+        // 如果时 待上级审核,调用
+        if (this.detailData.billStatus == 'WAIT_UP_AUDIT_PASS') {
+          this.auditOrder(type)
+          return
+        }
+        this.spinning = true
+        // 通过,业务状态变更 待上级审核
+        salesWriteUpAuditPass({
+          salesBillSn: this.bizSn || this.$route.params.sn,
+          billStatus: type
+        }).then(res => {
+          if (res.status == 200) {
+            this.$message.success(res.message)
+            this.handleBack()
+          }
+          this.$refs.vaildPriceModal.spinning = false
+          this.spinning = false
+        })
+      }
+    },
     //  重置
     resetSearchForm () {
       this.warehouseSn = undefined
@@ -410,12 +441,14 @@ export default {
       this.$router.push({ name: 'waitDispatchNew', params: { salesBillSn: row.salesBillSn } })
     },
     // 打开审核/一键审核弹框
-    async  handleAudit (isBatch) {
+    async handleAudit (isBatch) {
+      const _this = this
       // 校验产品是否付个促销活动规则
-      const vaildActive = await salesPromoValidaSubmit({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => res.data)
+      const vaildActive = await salesPromoValidaAudit({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => res.data)
       if (vaildActive && vaildActive.length > 0) {
         const a = vaildActive.filter(item => item.type == 1) // 不可提交
         const b = vaildActive.filter(item => item.type == 0) // 可跳过继续提交
+        const d = vaildActive.filter(item => item.type == 'audit') // 售价是否低于参考成本价
         // 弹出不符合规则弹框,不可提交
         if (a.length) {
           this.$info({
@@ -434,62 +467,64 @@ export default {
             </div>
           })
           this.spinning = false
-        } else {
-          const _this = this
+        } else if (b.length) {
           // 弹出确认提示信息,可跳过继续提交
-          if (b.length) {
-            _this.$confirm({
-              title: '提示',
-              centered: true,
-              class: 'confirm-center',
-              okText: '提交',
-              width: 600,
-              content: <div style="padding-top:15px;">
-                <ol>
-                  {b.map(item => (
-                    <li style="padding:3px 0;">{item.message}</li>
-                  ))}
-                </ol>
-              </div>,
-              onOk () {
-                _this.verificationSuccess(isBatch)
-              }
-            })
-            _this.spinning = false
+          _this.$confirm({
+            title: '提示',
+            centered: true,
+            class: 'confirm-center',
+            okText: '提交',
+            width: 600,
+            content: <div style="padding-top:15px;">
+              <ol>
+                {b.map(item => (
+                  <li style="padding:3px 0;">{item.message}</li>
+                ))}
+              </ol>
+            </div>,
+            onOk () {
+              _this.verificationSuccess(isBatch)
+            }
+          })
+          _this.spinning = false
+        } else if (d.length) {
+          _this.tempData = d[0]
+          // 售价是否低于参考成本价
+          if (isBatch) { // 一键审核
+            const codeStr = _this.tempData.salesPromoDetailEntityList.map(item => item.productCode)
+            // 直接提示文字信息
+            _this.messageInfo(codeStr + '售价已低于成本价,不可一键审核!')
           } else {
-            _this.verificationSuccess(isBatch)
+            _this.openVaildPriceModal = true
           }
+        } else {
+          this.verificationSuccess(isBatch)
         }
       } else {
         this.verificationSuccess(isBatch)
       }
     },
+    // 消息提示
+    messageInfo (content) {
+      this.$info({
+        title: '提示',
+        content: content,
+        centered: true
+      })
+    },
     // 验证通过
     verificationSuccess (isBatch) {
       if (isBatch) { // 一键审核
         if (this.$refs.productList.hasOutStockOfActive) {
-          this.$info({
-            title: '提示',
-            content: '参加促销活动的产品存在缺货,不可一键审核!',
-            centered: true
-          })
+          this.messageInfo('参加促销活动的产品存在缺货,不可一键审核!')
           return
         }
-
         if (this.$refs.productList.showConvertPromoGifts) {
-          this.$info({
-            title: '提示',
-            content: '该活动规则中,促销产品可转费用报销单,不可一键审核!',
-            centered: true
-          })
+          this.messageInfo('该活动规则中,促销产品可转费用报销单,不可一键审核!')
           return
         }
         if (this.$refs.productList.hasJGtire) {
-          this.$info({
-            title: '提示',
-            content: '销售单内有品牌是【箭冠】,且三级分类是【轮胎】的产品,不可一键审核!',
-            centered: true
-          })
+          this.messageInfo('销售单内有品牌是【箭冠】,且三级分类是【轮胎】的产品,不可一键审核!')
           return
         }
         // 一键审核成功

+ 1 - 1
src/views/salesManagement/salesQueryNew/list.vue

@@ -216,7 +216,7 @@
                 size="small"
                 type="link"
                 class="button-warning"
-                v-if="record.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
+                v-if="(record.billStatus == 'WAIT_AUDIT'||record.billStatus=='WAIT_UP_AUDIT_PASS')&&$hasPermissions('B_salesAudit')"
                 @click="handleDetailAudit(record)"
               >审核</a-button>
               <a-button

+ 126 - 0
src/views/salesManagement/salesQueryNew/vaildPriceModal.vue

@@ -0,0 +1,126 @@
+<template>
+  <a-modal
+    centered
+    :footer="null"
+    :maskClosable="false"
+    class="sales-print-type-modal"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="900">
+    <div class="title">提示</div>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="tipModal-content">
+        <a-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :dataSource="dataList"
+          :scroll="{ y: 300 }"
+          :pagination="false"
+          bordered>
+        </a-table>
+        <div style="padding: 20px;text-align: center;" v-if="dataObj&&dataObj.message">
+          {{ dataObj.message }}
+        </div>
+        <div style="margin-top:36px;text-align:center;">
+          <!-- <a-button @click="handleCancel" style="margin-right: 15px" id="chooseCustom-btn-back">关闭</a-button> -->
+          <a-button type="primary" style="margin-right: 15px" @click="handleSubmit('AUDIT_REJECT')" id="chooseCustom-btn-noPasss">审核不通过</a-button>
+          <a-button type="primary" class="button-info" @click="handleSubmit('AUDIT_PASS')" id="chooseCustom-btn-Pass">审核通过</a-button>
+        </div>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+export default {
+  name: 'VaildPriceModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    dataObj: {
+      type: Object,
+      default: () => {
+        return null
+      }
+    }
+  },
+  data () {
+    const _this = this
+    return {
+      isShow: this.openModal,
+      spinning: false,
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center', customRender: function (text, row, index) { return index + 1 } },
+        { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '参考成本价', dataIndex: 'showCost', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '售价', dataIndex: 'promotionPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '销售数量', dataIndex: 'qty', width: '10%', align: 'center', isShow: false, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'product.unit', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '售价小计', dataIndex: 'totalAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '参考成本价小计', dataIndex: 'totalCostAmount', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '亏损金额', dataIndex: 'totalKsAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+      ]
+    }
+  },
+  computed: {
+    dataList () {
+      const list = this.dataObj && this.dataObj.salesPromoDetailEntityList || []
+      list.map(item => {
+        item.totalAmount = item.promotionPrice * item.qty
+        item.totalCostAmount = item.showCost * item.qty
+        item.totalKsAmount = item.totalAmount - item.totalCostAmount
+      })
+      return list
+    }
+  },
+  methods: {
+    // 保存
+    handleSubmit (type) {
+      this.spinning = true
+      this.$emit('ok', type)
+    },
+    // 关闭弹窗
+    handleCancel () {
+      this.isShow = false
+      this.$emit('close')
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+  .tipModal-content{
+    width:87%;
+    margin:30px auto 0;
+    text-align:center;
+    .tipModal-tit{
+      font-size: 20px;
+    }
+    .sTable{
+      margin:15px 0 25px;
+    }
+   .ant-radio-wrapper:first-child{
+      margin-right:70px !important;
+    }
+    .redWord{
+      color:#ed1c24;
+    }
+  }
+</style>