chenrui 10 ay önce
ebeveyn
işleme
eef79cd1cb

+ 55 - 13
src/views/salesManagement/salesQueryNew/detail.vue

@@ -235,16 +235,7 @@ import stockOutDetail from './stockOutDetailModal.vue'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 import detailProductList from './comps/detailProductList.vue'
 // 接口
-import {
-  salesDetailBySn,
-  salesDetailPrint,
-  salesDetailExcel,
-  salesDetailTypeExcel,
-  salesWriteAuditPass,
-  salesWriteAuditReject,
-  salesWriteAuditPush,
-  getThirdStockQty
-} from '@/api/salesNew'
+import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAuditPass, salesWriteAuditReject, salesWriteAuditPush, getThirdStockQty, salesPromoValidaSubmit } from '@/api/salesNew'
 
 export default {
   name: 'SalesDetailNew',
@@ -372,7 +363,59 @@ export default {
       this.$router.push({ name: 'waitDispatchNew', params: { salesBillSn: row.salesBillSn } })
     },
     // 打开审核/一键审核弹框
-    handleAudit (isBatch) {
+    async  handleAudit (isBatch) {
+      // 校验产品是否付个促销活动规则
+      const vaildActive = await salesPromoValidaSubmit({ 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) // 可跳过继续提交
+        // 弹出不符合规则弹框,不可提交
+        if (a.length) {
+          this.$info({
+            title: '提示',
+            centered: true,
+            class: 'confirm-center',
+            okText: '关闭',
+            width: 600,
+            content: <div style="padding-top:15px;">
+              <ol>
+                {a.map(item => (
+                  <li style="padding:3px 0;">{item.message}</li>
+                ))}
+              </ol>
+              <div style="padding:10px 0;text-align:center"><strong>请按照以上提示修改后再提交</strong></div>
+            </div>
+          })
+          this.spinning = false
+        } else {
+          // 弹出确认提示信息,可跳过继续提交
+          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
+          } else {
+            this.verificationSuccess(isBatch)
+          }
+        }
+      }
+    },
+    // 验证通过
+    verificationSuccess (isBatch) {
       if (isBatch) { // 一键审核
         if (this.$refs.productList.hasOutStockOfActive) {
           this.$info({
@@ -391,7 +434,6 @@ export default {
           })
           return
         }
-
         if (this.$refs.productList.hasJGtire) {
           this.$info({
             title: '提示',
@@ -400,7 +442,7 @@ export default {
           })
           return
         }
-
+        // 一键审核成功
         this.showDsModal = true
         this.$refs.dsModal.setDetail(this.detailData)
       } else {

+ 13 - 2
src/views/salesManagement/salesQueryNew/list.vue

@@ -240,7 +240,7 @@
                 type="link"
                 class="button-info"
                 v-if="record.salesBillSource == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'HQ_CHANGE') && $hasPermissions('B_salesEdit')"
-                @click="handleEdit(record)"
+                @click="handleChangeOrder(record)"
               >
                 改单
               </a-button>
@@ -304,6 +304,8 @@
       <baseDataModal ref="expenseModal" @expenseSaveOk="expenseSaveOk" :show="openBaseModal" @close="openBaseModal=false"></baseDataModal>
       <!-- 导出提示框 -->
       <reportModal :visible="showExport" @close="showExport=false"></reportModal>
+      <!-- 改单 -->
+      <tipModal :openModal="openTipModal" @close="openTipModal=false" @ok="openTipModalOk"></tipModal>
     </a-card>
   </div>
 </template>
@@ -320,6 +322,7 @@ import rangeDate from '@/views/common/rangeDate.vue'
 import { STable, VSelect } from '@/components'
 import commonModal from '@/views/common/commonModal.vue'
 import chooseCustomModal from './chooseCustomModal.vue'
+import tipModal from './tipModal.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import baseDataModal from '@/views/expenseManagement/expenseReimbursement/baseDataModal.vue'
 import reportModal from '@/views/common/reportModal.vue'
@@ -333,7 +336,7 @@ import { salesDetailExport } from '@/api/salesBillReport'
 export default {
   name: 'SalesQueryList',
   mixins: [commonMixin],
-  components: { STable, VSelect, chooseCustomModal, dealerSubareaScopeList, Area, rangeDate, subarea, commonModal, reportModal, chooseWarehouse, baseDataModal, customerService },
+  components: { STable, VSelect, tipModal, chooseCustomModal, dealerSubareaScopeList, Area, rangeDate, subarea, commonModal, reportModal, chooseWarehouse, baseDataModal, customerService },
   data () {
     return {
       spinning: false,
@@ -346,6 +349,7 @@ export default {
       exportLoading: false, // 导出按钮加载状态
       expenseOption: false, // 已选转费用报销单状态
       tableHeight: 0, // 表格高度
+      openTipModal: false, // 改单提示弹窗
       // 默认时间
       time: [
         moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
@@ -572,6 +576,13 @@ export default {
     handleEdit (row) {
       this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn } })
     },
+    // 改单
+    handleChangeOrder (row) {
+      this.openTipModal = true
+    },
+    openTipModalOk () {
+      this.openTipModal = false
+    },
     // 删除
     handleDel (row) {
       const _this = this

+ 145 - 0
src/views/salesManagement/salesQueryNew/tipModal.vue

@@ -0,0 +1,145 @@
+<template>
+  <a-modal
+    centered
+    :footer="null"
+    :maskClosable="false"
+    class="sales-print-type-modal"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="600">
+    <solt>提示:(销售单号: XS240717000014      客户名称:箭冠汽配武汉四新店)</solt>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="tipModal-content">
+        <strong class="tipModal-tit">销售单以下产品价格发生变更,请确认</strong>
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: 500 }"
+          :showPagination="false"
+          :defaultLoadData="false"
+          bordered>
+        </s-table>
+        <div>
+          <a-radio-group v-model="priceVal">
+            <a-radio :value="item.id" v-for="item in priceSelectList" :key="item.id">
+              {{ item.name }}
+            </a-radio>
+          </a-radio-group>
+        </div>
+        <div style="margin-top:36px;text-align:center;">
+          <a-button @click="isShow = false" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
+          <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定</a-button>
+        </div>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+// 组件
+import { STable } from '@/components'
+// 接口
+import { salesDetailAddPromo } from '@/api/salesDetailNew'
+export default {
+  name: 'NewPromoModal',
+  mixins: [commonMixin],
+  components: { STable },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    const _this = this
+    return {
+      isShow: this.openModal,
+      spinning: false,
+      newPromoSnList: [], // 新活动选项sn
+      confirmLoading: false,
+      columns: [
+        { title: '产品编码', dataIndex: 'productCode', width: '33%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '初始价', dataIndex: 'product.name', width: '33%', align: 'left', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '最新价', dataIndex: 'product.origCode', width: '33%', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+      ],
+      priceSelectList: [{
+        id: 1,
+        name: '以【初始价】为准'
+      }, {
+        id: 2,
+        name: '以【最新价】为准'
+      }],
+      priceVal: undefined,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        // 查询列表
+        return salesList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            // 计算编号
+            const no = (data.pageNo - 1) * data.pageSize
+            data.list.forEach((con, i) => {
+              con.no = no + i + 1
+            })
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    //  保存
+    handleSubmit () {
+      const _this = this
+      if (_this.newPromoSnList.length) {
+        salesDetailAddPromo({
+          'salesBillSn': _this.salesBillSn,
+          'promoSnList': _this.newPromoSnList
+        }).then(res => {
+          if (res.status == 200) {
+            _this.$emit('ok')
+          }
+        })
+      } else {
+        _this.$message.info('请选择要参与的新活动')
+        return true
+      }
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+  .tipModal-content{
+    width:80%;
+    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;
+    }
+  }
+</style>