Browse Source

优化弹窗名称、代码

chenrui 7 months ago
parent
commit
c93eedaaf8

+ 16 - 4
src/views/salesManagement/salesQueryNew/comps/activeStatisticsList.vue

@@ -27,19 +27,22 @@
       @close="closeGuideModel"
       @ok="hanldeImportOk" />
     <!-- 查看累计产品 -->
-    <viewTotalProductModal :show="openTotalProductModal" @close="openTotalProductModal=false"></viewTotalProductModal>
+    <totalProductDetailModal ref="totalProductModal" :show="openTotalProductModal" @close="openTotalProductModal=false"></totalProductDetailModal>
+    <!-- 查看买赠产品详情 -->
+    <normalProductDetailModal ref="normalProductModal" :openModal="openNormalProductModal" @close="openNormalProductModal=false"></normalProductDetailModal>
   </div>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
 import detailModal from '@/views/promotionRulesManagement/dealerPromotions/detailModal.vue'
-import viewTotalProductModal from './viewTotalProductModal.vue'
+import totalProductDetailModal from './totalProductDetailModal.vue'
+import normalProductDetailModal from './normalProductDetailModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
 import { salesPromoDetailCount, salesDisablePromo, salesEnablePromoPromo, salesBatchInsert, importBorrowTotalProduct } from '@/api/salesDetailNew'
 export default {
   mixins: [commonMixin],
-  components: { detailModal, ImportGuideModal, viewTotalProductModal },
+  components: { detailModal, ImportGuideModal, totalProductDetailModal, normalProductDetailModal },
   props: {
     activeList: {
       type: Array,
@@ -79,6 +82,7 @@ export default {
         minWidth: 50
       },
       openTotalProductModal: false, // 查看累计产品
+      openNormalProductModal: false, // 查看买赠产品详情
       // 表格复选框
       checkboxOption: {
         hideSelectAll: true,
@@ -217,7 +221,10 @@ export default {
               key: 'k',
               title: '累计',
               width: 50,
-              align: 'center'
+              align: 'center',
+              renderBodyCell: ({ row, column, rowIndex }, h) => {
+                return (<span onClick={() => _this.openTotalProduct(row)}>{row[column.field]}</span>)
+              }
             },
             {
               field: 'col9',
@@ -565,6 +572,11 @@ export default {
         }
       })
     },
+    // 查看累计产品 详情
+    openTotalProduct (row) {
+      this.openTotalProductModal = true
+      this.$refs.totalProductModal.pageInit({ salesBillSn: row.salesBillSn, salesPromoSn: row.salesPromoSn })
+    },
     // 选择禁用活动选项
     changeDaOpt (e) {
       this.disabledActiveOption = e.target.value

+ 163 - 0
src/views/salesManagement/salesQueryNew/comps/normalProductDetailModal.vue

@@ -0,0 +1,163 @@
+<template>
+  <a-modal
+    v-model="isShow"
+    title="正价产品明细"
+    centered
+    class="view-normal-product-modal"
+    :maskClosable="false"
+    width="860px"
+    :footer="null"
+    @cancel="cancel"
+  >
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-form-model
+        id="normalProduct-modal-form"
+        ref="ruleForm"
+        :model="form"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol">
+        <a-form-model-item label="活动简称">
+          {{ form.description||'--' }}
+        </a-form-model-item>
+        <a-form-model-item label="促销规则">
+          <span>{{ form.accrualFlag==='1'?'数量叠加;':'' }}</span>
+          <div v-if="form.giveRuleList&&form.giveRuleList.length>0">
+            <span v-for="item in form.giveRuleList" :key="item.scopeLevel">{{ form.giveRuleList.length>1?item.scopeLevel+'、' :'' }}{{ item.regularSameFlag==='1'?'同款':'不同款' }}产品购买满 {{ item.regularUnit==='YUAN'?toThousands(item.regularValue):item.regularValue }} {{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送 {{ item.promotionValue }} 个促销产品</span>
+          </div>
+          <span v-else>--</span>
+        </a-form-model-item>
+      </a-form-model>
+      <!-- 筛选条件 -->
+      <div class="table-page-search-wrapper">
+        <a-form
+          layout="inline"
+          id="normalProduct-modal-search"
+          @keyup.enter.native="$refs.table.refresh(true)"
+        >
+          <a-row :gutter="15">
+            <a-col :md="8" :sm="24">
+              <a-form-item label="产品编码">
+                <a-input id="normalProduct-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+              </a-form-item>
+            </a-col>
+            <a-col :md="8" :sm="24">
+              <a-form-item label="符合规则">
+                <v-select
+                  v-model="queryParam.flagVal"
+                  id="normalProduct-flagVal"
+                  code="FLAG"
+                  placeholder="请选择是否符合规则"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="normalProduct-search">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="normalProduct-reset">重置</a-button>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :scroll="{ y: 200 }"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :pageSize="10"
+        :defaultLoadData="false"
+        bordered>
+      </s-table>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import { accumulatedProductsList } from '@/api/salesDetailNew'
+export default {
+  name: 'TotalProductDetailModal',
+  mixins: [commonMixin],
+  components: { STable, VSelect },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    const _this = this
+    return {
+      isShow: this.openModal, // 打开弹窗
+      spinning: false, // 页面加载动画
+      disabled: false, // 阻止查询重置按钮多次点击事件
+      // label 布局设置
+      formItemLayout: {
+        labelCol: { span: 2 },
+        wrapperCol: { span: 20 }
+      },
+      // 查询参数
+      queryParam: {
+        productCode: '',
+        flagVal: undefined
+      },
+      form: {
+        description: undefined,
+        giveRuleList: []
+      },
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return accumulatedProductsList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+          }
+          this.disabled = false
+          this.spinning = false
+          return data
+        })
+      },
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '售价', dataIndex: 'price', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '售价小计', dataIndex: 'totalPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '累计售价', dataIndex: 'qty', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '累计金额', dataIndex: 'totalAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '合计金额', dataIndex: 'buyerName', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '差额', dataIndex: 'warehouseName', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+      ]
+    }
+  },
+  methods: {
+    cancel () {
+      this.isShow = false
+    },
+    // 重置
+    resetSearchForm () {
+      this.queryParam.productCode = ''
+      this.queryParam.flagVal = undefined
+      this.$refs.table.refresh(true)
+    }
+  },
+  watch: {
+  //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>

+ 53 - 45
src/views/salesManagement/salesQueryNew/comps/viewTotalProductModal.vue → src/views/salesManagement/salesQueryNew/comps/totalProductDetailModal.vue

@@ -5,45 +5,41 @@
     centered
     class="view-total-product-modal"
     :maskClosable="false"
-    :confirmLoading="confirmLoading"
-    width="50%"
+    width="860px"
     :footer="null"
     @cancel="cancel"
   >
     <a-spin :spinning="spinning" tip="Loading...">
       <!-- 筛选条件 -->
-      <a-form
-        layout="inline"
-        id="view-total-product-search"
-        @keyup.enter.native="$refs.table.refresh(true)"
-        :label-col="formItemLayout.labelCol"
-        :wrapper-col="formItemLayout.wrapperCol">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="产品编码">
-              <a-input id="totalProduct-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="销售单号">
-              <a-input id="totalProduct-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="客户名称">
-              <a-input
-                id="totalProduct-targetName"
-                v-model.trim="queryParam.targetName"
-                allowClear
-                placeholder="请输入客户名称" />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="viewTotalProduct-search">查询</a-button>
-            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="viewTotalProduct-reset">重置</a-button>
-          </a-col>
-        </a-row>
-      </a-form>
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline" id="view-total-product-form" @keyup.enter.native="$refs.table.refresh(true)">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品编码">
+                <a-input id="totalProduct-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="销售单号">
+                <a-input id="totalProduct-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="客户名称">
+                <a-input
+                  id="totalProduct-targetName"
+                  v-model.trim="queryParam.targetName"
+                  allowClear
+                  placeholder="请输入客户名称" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="viewTotalProduct-search">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="viewTotalProduct-reset">重置</a-button>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
       <div class="totalProduct-delMore-btn">
         <a-button
           type="primary"
@@ -57,7 +53,7 @@
         class="sTable"
         ref="table"
         size="small"
-        :scroll="{ y: tableHeight }"
+        :scroll="{ y: 200 }"
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
@@ -87,28 +83,25 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import { accumulatedProductsList } from '@/api/salesDetailNew'
 export default {
-  name: 'ViewTotalProductModal',
+  name: 'TotalProductDetailModal',
   mixins: [commonMixin],
   components: { STable, VSelect },
   props: {
     show: [Boolean]
   },
   data () {
+    const _this = this
     return {
-      opened: this.show, // 是否打开累计产品弹窗
+      opened: _this.show, // 是否打开累计产品弹窗
       spinning: false, // 页面加载动画
       disabled: false, // 阻止查询重置按钮多次点击事件
-      // label 布局设置
-      formItemLayout: {
-        labelCol: { span: 8 },
-        wrapperCol: { span: 16 }
-      },
       // 查询参数
       queryParam: {
         productCode: '',
         salesBillNo: '',
         targetName: undefined
       },
+      rowSelectionInfo: null,
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
@@ -125,7 +118,19 @@ export default {
           this.spinning = false
           return data
         })
-      }
+      },
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '销售单号', dataIndex: 'salesBillNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '12%', align: 'center', ccustomRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '售价', dataIndex: 'qty', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '10%', align: 'center', ccustomRender: function (text) { return text || '--' } },
+        { title: '销售数量', dataIndex: 'buyerName1', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '销售小计', dataIndex: 'warehouseName', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
+      ]
     }
   },
   computed: {
@@ -134,7 +139,7 @@ export default {
       const selectNum = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
       let selProductNum = 0
       let selTotalPrice = 0
-      if (!selectNum) {
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys) {
         this.rowSelectionInfo.selectedRowKeys.forEach(item => {
           selProductNum += item.num
           selTotalPrice += item.price
@@ -144,14 +149,17 @@ export default {
     }
   },
   methods: {
+    cancel () {
+      this.opened = false
+    },
     // 表格选中项
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
     // 页面数据初始化
     pageInit (objInfo) {
-      // objInfo = { salesBillSn, salesPromoSn }
       this.parameter = { ...objInfo, ...this.parameter }
+      this.$refs.table.refresh(true)
     },
     // 重置
     resetSearchForm () {