Browse Source

累计买赠产品弹窗

chenrui 6 tháng trước cách đây
mục cha
commit
3ba9909570

+ 14 - 0
src/api/salesNew.js

@@ -485,6 +485,8 @@ export const salesOverviewQueryPage = (params) => {
 // 累计产品选择列表
 export const salesDetailQueryBorrowPageList = (params) => {
   const url = `/sales/detail/queryWaitBorrowPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
   return axios({
     url: url,
     data: params,
@@ -506,3 +508,15 @@ export const salesDetailImportBorrow = (params) => {
     }
   })
 }
+
+//查看累计、同款产品 买赠产品列表
+export const queryRegularProductShortfallList = (params) => {
+  return axios.request({
+    url: '/salesPromo/queryRegularProductShortfallList',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('买赠产品列表')
+    }
+  })
+}

+ 48 - 30
src/views/salesManagement/salesQueryNew/comps/normalProductDetailModal.vue

@@ -13,16 +13,16 @@
       <a-form-model
         id="normalProduct-modal-form"
         ref="ruleForm"
-        :model="form"
+        :model="buyGiftsInfo"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol">
         <a-form-model-item label="活动简称">
-          {{ form.description||'--' }}
+          {{ buyGiftsInfo.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>
+          <span>{{ buyGiftsInfo.accrualFlag==='1'?'数量叠加;':'' }}</span>
+          <div v-if="buyGiftsInfo.giveRuleList&&buyGiftsInfo.giveRuleList.length">
+            <span v-for="item in buyGiftsInfo.giveRuleList" :key="item.scopeLevel">{{ buyGiftsInfo.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>
@@ -43,8 +43,8 @@
             <a-col :md="8" :sm="24">
               <a-form-item label="符合规则">
                 <v-select
-                  v-model="queryParam.flagVal"
-                  id="normalProduct-flagVal"
+                  v-model="queryParam.regularRuleResult"
+                  id="normalProduct-regularRuleResult"
                   code="FLAG"
                   placeholder="请选择是否符合规则"
                   allowClear></v-select>
@@ -65,7 +65,7 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
-        :pageSize="10"
+        :showPagination="false"
         :defaultLoadData="false"
         bordered>
       </s-table>
@@ -76,7 +76,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
-import { accumulatedProductsList } from '@/api/salesDetailNew'
+import { queryRegularProductShortfallList } from '@/api/salesNew'
 export default {
   name: 'TotalProductDetailModal',
   mixins: [commonMixin],
@@ -85,10 +85,13 @@ export default {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
+    },
+    buyGiftsInfo: {
+      type: Object,
+      default: null
     }
   },
   data () {
-    const _this = this
     return {
       isShow: this.openModal, // 打开弹窗
       spinning: false, // 页面加载动画
@@ -101,40 +104,55 @@ export default {
       // 查询参数
       queryParam: {
         productCode: '',
-        flagVal: undefined
-      },
-      form: {
-        description: undefined,
-        giveRuleList: []
+        regularRuleResult: undefined
       },
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return accumulatedProductsList(Object.assign(parameter, this.queryParam)).then(res => {
+        this.queryParam.salesPromoSn = this.buyGiftsInfo.salesPromoSn
+        return queryRegularProductShortfallList(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
+            for (var i = 0; i < data.length; i++) {
+              data[i].no = i + 1
             }
           }
           this.disabled = false
           this.spinning = false
           return data
         })
-      },
-      columns: [
+      }
+    }
+  },
+  computed: {
+    columns () {
+      const _this = this
+      let newArr = null
+      const arr = [
         { 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) : '--') } }
+        { title: '产品编码', dataIndex: 'productCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
+      // 买赠产品类型 ge按数量累计 yuan按金额累计
+      if (_this.buyGiftsInfo.regularUnit === 'GE') {
+        newArr = [
+          { title: '销售数量', dataIndex: 'qty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+          { title: '累计数量', dataIndex: 'borrowQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+          { title: '合计数量', dataIndex: 'totalQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+          { title: '差额', dataIndex: 'shortfall', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+        ]
+      } else {
+        newArr = [
+          { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '售价', dataIndex: 'promotionPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+          { title: '售价小计', dataIndex: 'promotionAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+          { title: '累计售价', dataIndex: 'borrowPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+          { title: '累计金额', dataIndex: 'borrowAmount', 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: 'subtract', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+        ]
+      }
+      return arr.concat(newArr)
     }
   },
   methods: {
@@ -144,7 +162,7 @@ export default {
     // 重置
     resetSearchForm () {
       this.queryParam.productCode = ''
-      this.queryParam.flagVal = undefined
+      this.queryParam.regularRuleResult = undefined
       this.$refs.table.refresh(true)
     }
   },