lilei 1 ano atrás
pai
commit
5b0c9a7643

+ 8 - 0
src/api/salesDetailNew.js

@@ -131,6 +131,14 @@ export const salesDisablePromo = params => {
     method: 'post'
   })
 }
+// 新活动是否参与
+export const salesDetailAddPromo = (params) => {
+  return axios({
+    url: '/salesn/detail/addPromo',
+    data: params,
+    method: 'post'
+  })
+}
 // 修改销售明细取消数量
 export const salesDetailUpdateCancelQty = (params) => {
   return axios({

+ 25 - 10
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -18,17 +18,20 @@
             :column-width-resize-option="columnWidthResizeOption"
           />
         <div v-show="showEmpty" class="empty-data">暂无数据</div>
+        <!-- 活动规则详情 -->
+        <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
     </a-spin>
   </template>
   
   <script>
     import { commonMixin } from '@/utils/mixin'
+    import detailModal from '@/views/promotionRulesManagement/dealerPromotions/detail.vue'
     import { salesPromoQueryList } from '@/api/salesNew'
     import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
     export default {
       name: 'DetailProductList',
       mixins: [commonMixin],
-      components: { },
+      components: { detailModal },
       props: {
         newLoading: Boolean,
         detailData: {
@@ -71,6 +74,8 @@
       data () {
         return {
           spinning: false,
+          openDetailModal: false,
+          detailSn: null,
           activeList: [], // 活动列表
           dataSource: [],
           tableHeight: this.maxHeight,
@@ -150,7 +155,7 @@
                         {_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>):('')}
-                        {record.expenseAccountFlagDictValue||''}
+                        {record.expenseAccountFlag!='WAIT' ? record.expenseAccountFlagDictValue : ''}
                     </div>
                   </div>
                 ):(<span>{data}</span>)}
@@ -159,10 +164,14 @@
           }
           // 显示折扣价
           const discountPriceFormat = function(record,data,h) {
-            if(record.promotionFlag == 'GIFT' || record.promotionFlag == 'DISCOUNT'){
-              return _this.toThousands(record.discountedPrice) + '(' + _this.toThousands(data) + ')'
-            }
-            return _this.toThousands(data)
+            return (
+              <div>
+                {_this.toThousands(data)}
+                {record.promotionFlag == 'GIFT' || record.promotionFlag == 'DISCOUNT' ? (
+                  <span style="color:#f5222d;" title="原价">({ _this.toThousands(record.origPrice)})</span>
+                ):''}
+              </div>
+            )
           }
 
           let arr= [
@@ -193,12 +202,12 @@
                 arr.push({ title: '市级价', field: 'cityPrice', width: 80,key: "j", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
                 if (this.$hasPermissions(this.authCode + '_salesPrice')) { //  售价权限
                   this.colspanNums = this.colspanNums + 1
-                    arr.push({ title: '销售价', field: 'price', width: 80,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return discountPriceFormat(row,row[column.field],h)} })
+                    arr.push({ title: '销售价', field: 'price', width: 120,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return discountPriceFormat(row,row[column.field],h)} })
                 }
             } else {
                 if (this.$hasPermissions(this.authCode + '_salesPrice')) { //  售价权限
                   this.colspanNums = this.colspanNums + 1
-                    arr.push({ title: '销售价', field: 'price', width: 80,key: "l", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return discountPriceFormat(row,row[column.field],h)} })
+                    arr.push({ title: '销售价', field: 'price', width: 120,key: "l", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return discountPriceFormat(row,row[column.field],h)} })
                 }
             }
 
@@ -224,6 +233,11 @@
         }
       },
       methods: {
+        // 关闭详情弹窗
+        closeDetailModal () {
+          this.detailSn = null
+          this.openDetailModal = false
+        },
          // 合并活动分类单元格
         bodyCellSpan({ row, column, rowIndex }) {
           if (row.id.indexOf('promo-')>=0) {
@@ -241,8 +255,9 @@
           }
         },
          // 查看活动详情
-        showDesc(e,item){
-
+        showDesc(row){
+          this.detailSn = row.promotionRuleSn
+          this.openDetailModal = true
         },
         // 获取销售单参与的活动列表
         pageInit(){

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

@@ -142,7 +142,7 @@ 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 } from '@/api/salesDetailNew'
+import { salesDisablePromo, salesChangePromo, salesDetailAddPromo } from '@/api/salesDetailNew'
 import { salesDetailBySn,salesPromoQueryCount, salesWriteSubmit, submitCheck, updateBatch, salesPromoQueryList, salesQueryUnPartPromo,salesPromoValidaSubmit } from '@/api/salesNew'
 export default {
   name: 'SalesNewEdit',
@@ -157,6 +157,7 @@ export default {
     return {
       spinning: false,
       activeList:[], // 活动列表
+      newActiveList: [], // 新活动列表
       activeDesKey: {},
       salesBillSn: null, // 销售单sn
       detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
@@ -217,7 +218,7 @@ export default {
     // 获取销售单参与的活动列表
     async getActiveList(){
       const hasNewActive = await salesQueryUnPartPromo({ salesBillSn: this.$route.params.sn }).then(res => res.data)
-      console.log(hasNewActive)
+      this.newActiveList = hasNewActive
       // 有新活动
       if(hasNewActive.length){
         this.showNewActiveModal(hasNewActive)
@@ -230,9 +231,12 @@ export default {
     },
     // 新活动确认弹框
     showNewActiveModal(data){
+      const _this = this
       let arr = []
+      let promoSnList = []
       data.map(item => {
         arr.push(item.title)
+        promoSnList.push(item.promotionSn)
       })
       this.$confirm({
         title: '新活动提醒',
@@ -248,7 +252,16 @@ export default {
           </div>
         </div>,
         onOk() {
-           
+          salesDetailAddPromo({
+            "salesBillSn": _this.salesBillSn,
+            "promoSnList": promoSnList
+          }).then(res => {
+            if(res.status == 200){
+              _this.pageInit()
+            }else{
+              _this.showNewActiveModal(_this.newActiveList)
+            }
+          })
         },
         onCancel() {},
       });