lilei преди 1 година
родител
ревизия
3d91d3a495

+ 12 - 8
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -17,7 +17,7 @@
             :cell-span-option="cellSpanOption"
             :column-width-resize-option="columnWidthResizeOption"
           />
-        <div v-show="showEmpty" class="empty-data">暂无数据</div>
+        <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品"/></div>
         <!-- 活动规则详情 -->
         <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
     </a-spin>
@@ -152,9 +152,9 @@
                         款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
                         数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
                         {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
-                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total ? (<span>优惠金额:<strong>{record.total.lossAmount||'--'}</strong>;</span>):('')}
-                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total ? (<span>采购额结余:<strong>{_this.toThousands(Number(record.total.totalPromoGiftsAmount) - Number(record.total.totalUsePromoGiftsAmount))}</strong>;</span>):('')}
-                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total ? (<span>采购额超出:<strong>{_this.toThousands(Number(record.total.totalUsePromoGiftsAmount) - Number(record.total.totalPromoGiftsAmount))}</strong>;</span>):('')}
+                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.lossAmount ? (<span>优惠金额:<strong>{record.total.lossAmount}</strong>;</span>):('')}
+                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount ? (<span>采购额结余:<strong>{_this.toThousands(record.total.cgejyAmount)}</strong>;</span>):('')}
+                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgeccAmount ? (<span>采购额超出:<strong>{_this.toThousands(record.total.cgeccAmount)}</strong>;</span>):('')}
                         {record.expenseAccountFlag!='WAIT' ? record.expenseAccountFlagDictValue : ''}
                     </div>
                   </div>
@@ -283,10 +283,10 @@
             // 正常产品
             const proList = await salesDetailAllList(params).then(res => res.data)
             const norTotal = await salesDetaiCount(params).then(res => res.data)
-            let listData = [{
+            let listData = proList.length ? [{
                 id: 'promo-normal',
                 total: norTotal
-              },...proList]
+              },...proList] : []
             
             // 循环获取活动产品
             const active = this.activeList
@@ -303,11 +303,15 @@
               const aclist = await salesDetailAllList(activeParams).then(res => res.data)
               // 获取活动产品统计
               const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
-              const retList = [{
+              // 采购额结余
+              acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount) - Number(acTotal.totalUsePromoGiftsAmount)
+              // 采购额超出
+              acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount) - Number(acTotal.totalPromoGiftsAmount)
+              const retList = aclist.length ? [{
                 id: 'promo-'+i,
                 promo: promo,
                 total: acTotal
-              },...aclist]
+              },...aclist] : []
               listData = aclist&&aclist.length ? listData.concat(retList) : listData
             }
 

+ 16 - 41
src/views/salesManagement/salesQueryNew/edit.vue

@@ -133,6 +133,12 @@
     :totalAmount="updataData.totalAmount" 
     @ok="updatePrice" 
     @cancel="priceUpdateModal=false"></setPriceModal>
+    <!-- 新活动窗口 -->
+    <newPromoModal
+    :show="showNewActiveModal"
+    :salesBillSn="salesBillSn"
+    :newActiveList="newActiveList"
+    ></newPromoModal>
  </div>
 </template>
 
@@ -142,7 +148,8 @@ import productList from './comps/productList.vue'
 import productNormalList from './comps/productNormalList.vue'
 import chooseProduct from './comps/chooseProduct.vue'
 import setPriceModal from './setPriceModal.vue'
-import { salesDisablePromo, salesChangePromo, salesDetailAddPromo } from '@/api/salesDetailNew'
+import newPromoModal from './newPromoModal.vue'
+import { salesDisablePromo, salesChangePromo } from '@/api/salesDetailNew'
 import { salesDetailBySn,salesPromoQueryCount, salesWriteSubmit, submitCheck, updateBatch, salesPromoQueryList, salesQueryUnPartPromo,salesPromoValidaSubmit } from '@/api/salesNew'
 export default {
   name: 'SalesNewEdit',
@@ -151,7 +158,8 @@ export default {
     setPriceModal,
     productList,
     chooseProduct,
-    productNormalList
+    productNormalList,
+    newPromoModal
   },
   data () {
     return {
@@ -171,7 +179,8 @@ export default {
       showCpModal: false,
       cpCurRefId: '',
       disabledActiveOption: null,
-      yhDetail: null
+      yhDetail: null,
+      showNewActiveModal: false
     }
   },
   computed: {
@@ -218,10 +227,10 @@ export default {
     // 获取销售单参与的活动列表
     async getActiveList(){
       const hasNewActive = await salesQueryUnPartPromo({ salesBillSn: this.$route.params.sn }).then(res => res.data)
-      this.newActiveList = hasNewActive
       // 有新活动
       if(hasNewActive.length){
-        this.showNewActiveModal(hasNewActive)
+        this.newActiveList = hasNewActive
+        this.showNewActiveModal=true
       }
       this.activeList = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
       this.activeList.map(item => {
@@ -229,42 +238,8 @@ export default {
         this.activeDesKey['search-'+item.promoRuleSn] = false
       })
     },
-    // 新活动确认弹框
-    showNewActiveModal(data){
-      const _this = this
-      let arr = []
-      let promoSnList = []
-      data.map(item => {
-        arr.push(item.title)
-        promoSnList.push(item.promotionSn)
-      })
-      this.$confirm({
-        title: '新活动提醒',
-        centered: true,
-        class:'confirm-center',
-        content: <div>
-          <div style="padding:10px 0;text-align:center;">
-            系统发布新的促销活动:
-          </div>
-          <div style="text-align:center;color:#00aaff;">{arr.join(',')}</div>
-          <div style="padding:10px 0;text-align:center;">
-            是否将现有产品识别到新的活动中吗?
-          </div>
-        </div>,
-        onOk() {
-          salesDetailAddPromo({
-            "salesBillSn": _this.salesBillSn,
-            "promoSnList": promoSnList
-          }).then(res => {
-            if(res.status == 200){
-              _this.pageInit()
-            }else{
-              _this.showNewActiveModal(_this.newActiveList)
-            }
-          })
-        },
-        onCancel() {},
-      });
+    showNewActiveOk(){
+      this.pageInit()
     },
     // 添加产品,包括正常和活动的产品
     closeProductModal(){

+ 90 - 0
src/views/salesManagement/salesQueryNew/newPromoModal.vue

@@ -0,0 +1,90 @@
+<template>
+    <a-modal
+      v-model="opened"
+      title="新活动提醒"
+      centered
+      :maskClosable="false"
+      :confirmLoading="confirmLoading"
+      width="30%"
+      :footer="null"
+      @cancel="cancel"
+    >
+      <a-spin :spinning="spinning" tip="Loading...">
+        <div style="padding: 0 50px;">
+          <div style="padding:10px 0;text-align:left;">
+            系统发布新的促销活动,是否要参与?
+          </div>
+          <div style="text-align:left;color:#00aaff;">
+            <a-checkbox-group v-model="newPromoSnList">
+              <a-row v-for="item in newActiveList" :key="item.promotionSn">
+                <a-col :span="24"><a-checkbox :value="item.promotionSn">{{ item.title }}</a-checkbox></a-col>
+              </a-row>
+            </a-checkbox-group>
+          </div>
+        </div>
+        <div style="margin-top:36px;text-align:center;">
+          <a-button @click="cancel" 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>
+      </a-spin>
+    </a-modal>
+  </template>
+  
+  <script>
+  import { commonMixin } from '@/utils/mixin'
+  import { salesDetailAddPromo } from '@/api/salesDetailNew'
+  export default {
+    name: 'newPromoModal',
+    mixins: [commonMixin],
+    props: {
+      show: [Boolean],
+      newActiveList: [Array],
+      salesBillSn: [String]
+    },
+    data () {
+      return {
+        opened: this.show,
+        spinning: false,
+        newPromoSnList: [],
+        confirmLoading: false
+      }
+    },
+    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
+          }
+      },
+      cancel () {
+        this.opened = false
+        this.$emit('cancel')
+      }
+    },
+    watch: {
+      show (newValue, oldValue) {
+        this.opened = newValue
+        if (!newValue) {
+          this.newPromoSnList = []
+        }else{
+            // 默认全选
+            this.newActiveList.map(item => {
+               this.newPromoSnList.push(item.promotionSn)
+            })
+        }
+      }
+    }
+  }
+  </script>
+  

+ 1 - 1
src/views/salesManagement/waitDispatchNew/detailProductList.vue

@@ -29,7 +29,7 @@
                 :column-width-resize-option="columnWidthResizeOption"
                 :checkbox-option="checkboxOption"
               />
-          <div v-show="showEmpty" class="empty-data">暂无待下推产品</div>
+          <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品"/></div>
       </a-spin>
   
     </div>

+ 13 - 6
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -88,14 +88,14 @@
               :cellSelectionOption="{enable: false}"
               :virtual-scroll-option="{enable: true}"
               :columns="columns"
-              :table-data="dataSource"
+              :table-data="tableData"
               row-key-field-name="id"
               :cell-style-option="cellStyleOption"
               :cell-span-option="cellSpanOption"
               :column-width-resize-option="columnWidthResizeOption"
               :checkbox-option="checkboxOption"
             />
-        <div v-show="showEmpty" class="empty-data">暂无数据</div>
+        <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品"/></div>
         <!-- 活动规则详情 -->
         <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
     </a-spin>
@@ -152,6 +152,7 @@ export default {
       activeList: [], // 活动列表
       spinning: false,
       dataSource: [],
+      tableData: [],
       tableHeight: this.maxHeight,
       cellStyleOption: {
         bodyCellClass: ({ row, column, rowIndex }) => {
@@ -275,9 +276,9 @@ export default {
                   款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
                   数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
                   {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
-                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total ? (<span>优惠金额:<strong>{record.total.lossAmount||'--'}</strong>;</span>):('')}
-                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total ? (<span>采购额结余:<strong>{_this.toThousands(Number(record.total.totalPromoGiftsAmount) - Number(record.total.totalUsePromoGiftsAmount))}</strong>;</span>):('')}
-                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total ? (<span>采购额超出:<strong>{_this.toThousands(Number(record.total.totalUsePromoGiftsAmount) - Number(record.total.totalPromoGiftsAmount))}</strong>;</span>):('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.lossAmount ? (<span>优惠金额:<strong>{record.total.lossAmount}</strong>;</span>):('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount ? (<span>采购额结余:<strong>{_this.toThousands(record.total.cgejyAmount)}</strong>;</span>):('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgeccAmount ? (<span>采购额超出:<strong>{_this.toThousands(record.total.cgeccAmount)}</strong>;</span>):('')}
                   {record.expenseAccountFlag!='WAIT' ? record.expenseAccountFlagDictValue : ''}
                 </div>
               </div>
@@ -285,7 +286,7 @@ export default {
           </div>
         )
       }
-
+       
       let arr= [
             { title: "", field: "", key: "acheck", type: "checkbox", align: "center" },
             { title: '序号', field: 'no',key: "a", width: 50, align: 'center', operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return noFormat(row,row[column.field],h)} },
@@ -402,6 +403,10 @@ export default {
           const aclist = await salesDetailAllList(activeParams).then(res => res.data)
           // 获取活动产品统计
           const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
+          // 采购额结余
+          acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount) - Number(acTotal.totalUsePromoGiftsAmount)
+          // 采购额超出
+          acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount) - Number(acTotal.totalPromoGiftsAmount)
           const retList = [{
             id: 'promo-'+i,
             promo: promo,
@@ -434,6 +439,7 @@ export default {
         })
         this.showEmpty = this.dataSource.length <= 0
         this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
+        this.tableData = this.dataSource
         this.spinning = false
         this.disabled = false
     },
@@ -448,6 +454,7 @@ export default {
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
       this.queryParam.warehouseSn = undefined
+      this.queryParam.promoFlag = undefined
       this.productType = []
       this.dataSource = []
       this.clearSelectTable()