lilei 6 tháng trước cách đây
mục cha
commit
0b31854e6b

+ 60 - 11
src/views/salesManagement/salesQueryNew/comps/activeStatisticsList.vue

@@ -40,6 +40,7 @@ import totalProductDetailModal from './totalProductDetailModal.vue'
 import normalProductDetailModal from './normalProductDetailModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
 import { salesDisablePromo, salesEnablePromoPromo, salesBatchInsert, importBorrowTotalProduct } from '@/api/salesDetailNew'
+import { salesPromoSaveSort } from '@/api/salesNew'
 export default {
   mixins: [commonMixin],
   components: { detailModal, ImportGuideModal, totalProductDetailModal, normalProductDetailModal },
@@ -165,20 +166,23 @@ export default {
           align: 'center',
           fixed: 'left',
           renderBodyCell: ({ row, column, rowIndex }, h) => {
-            const equalWord = <div style="display:flex;">
-              <span style="width:12px;color:#ed1c24;text-align:center;margin-left:5px;cursor:pointer;" onClick={() => _this.moveTjRow(row, rowIndex, 'up')} title="上移">{rowIndex != 0 ? '⇡' : ''}</span>
-              <span style="width:12px;color:#108ee9;text-align:center;cursor:pointer;" onClick={() => _this.moveTjRow(row, rowIndex, 'down')} title="下移">{rowIndex != _this.activeList.length - 1 ? '⇣' : ''}</span>
+            const isTejia = row && row.promotionRule && row.promotionRule.promotionRuleType == 'PROMO_PROD' // 是否特价
+            const tejiaLen = _this.activeList.filter(item => item.promotionRule && item.promotionRule.promotionRuleType == 'PROMO_PROD').length // 特价活动数量
+            // 特价活动上移下移排序
+            const equalWord = <div class="table-arrow-box">
+              <span class="up" onClick={() => _this.moveTjRow(row, rowIndex, 1)} title="上移">{rowIndex != 0 ? '⇡' : ''}</span>
+              <span class="down" onClick={() => _this.moveTjRow(row, rowIndex, 0)} title="下移">{rowIndex != tejiaLen - 1 ? '⇣' : ''}</span>
             </div>
             // 买产品送产品  同款产品 是累计产品才弹详情窗
             if (row.promotionRule.promotionRuleType === 'BUY_PROD_GIVE_PROD' && row.promotion.borrowFlag == '1' && row.promotionRule.regularSameFlag == '1') {
               return (<div style="width:100%;display:flex;justify-content: space-between;">
                 <div class="table-link-text" onClick={() => _this.showBuyGifts(row)} style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title={row[column.field]}>{row[column.field]}</div>
-                {equalWord}
+                {isTejia ? equalWord : ''}
               </div>)
             } else {
               return (<div style="width:100%;display:flex;justify-content: space-between;">
                 <div style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title={row[column.field]}>{row[column.field]}</div>
-                {equalWord}
+                {isTejia ? equalWord : ''}
               </div>)
             }
           }
@@ -194,9 +198,9 @@ export default {
               <div class="table-link-text" title={row[column.field]}>
                 <span style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">{row[column.field]}</span>
               </div>
-              <div style="width:80px;">
-                {row.promotion.stackFlag == 1 ? <a-badge count="叠" numberStyle={{ backgroundColor: '#00aa00', marginLeft: '3px', zoom: '80%' }}/> : ''}
-                {row.promotion.borrowFlag == 1 ? <a-badge count="累" numberStyle={{ backgroundColor: '#F5222D', marginLeft: '3px', zoom: '80%' }} /> : ''}
+              <div style="position:absolute;right:0;background:#fff;">
+                {row.promotion.stackFlag == 1 ? <a-badge count="叠" numberStyle={{ backgroundColor: '#00aa00', marginLeft: '2px', zoom: '0.7' }}/> : ''}
+                {row.promotion.borrowFlag == 1 ? <a-badge count="累" numberStyle={{ backgroundColor: '#F5222D', marginLeft: '2px', zoom: '0.7' }} /> : ''}
               </div>
             </div>)
           }
@@ -447,7 +451,7 @@ export default {
       detailSn: null, // 销售单sn
       disabledActiveOption: null,
       openGuideModal: false, //  导入产品引导
-      uyGiftsInfo: null // 买赠产品弹窗详情信息
+      buyGiftsInfo: null // 买赠产品弹窗详情信息
     }
   },
   methods: {
@@ -530,8 +534,30 @@ export default {
       this.checkboxOption.disableSelectedRowKeys = this.tableData.filter(item => item.enabledFlag == 0).map(item => item.id)
     },
     // 上下移动特价活动
-    moveTjRow (row, index, type) {
-
+    moveTjRow (item, rowIndex, type) {
+      const temp = this.tableData[type == 1 ? rowIndex - 1 : rowIndex + 1]
+      const tempSort = temp.sort
+      temp.sort = item.sort
+      item.sort = tempSort
+      // 保存排序
+      const tejia = this.tableData.filter(item => item.promotionRule && item.promotionRule.promotionRuleType == 'PROMO_PROD')
+      const data = tejia.map(item => {
+        return {
+          id: item.id,
+          sort: item.sort
+        }
+      })
+      this.spinning = true
+      salesPromoSaveSort(data).then(res => {
+        this.spinning = false
+        if (res.status == 200) {
+          this.tableData = this.tableData.sort((a, b) => a.sort - b.sort)
+        } else {
+          // 恢复排序
+          item.sort = temp.sort
+          temp.sort = tempSort
+        }
+      })
     },
     // 刷新当前规则
     refashRow (item, enable) {
@@ -731,4 +757,27 @@ export default {
       text-decoration: underline;
     }
   }
+  .table-arrow-box{
+    display: flex;
+    span{
+      width:16px;
+      text-align:center;
+      cursor:pointer;
+      border-radius: 50px;
+    }
+    .up{
+      color:#ed1c24;
+      &:hover{
+        color:#fff;
+        background:#ed1c24;
+      }
+    }
+    .down{
+      color:#00aaff;
+      &:hover{
+        color:#fff;
+        background:#00aaff;
+      }
+    }
+  }
 </style>

+ 1 - 1
src/views/salesManagement/salesQueryNew/comps/normalProductDetailModal.vue

@@ -9,7 +9,7 @@
     :footer="null"
     @cancel="cancel"
   >
-    <a-spin :spinning="spinning" tip="Loading...">
+    <a-spin :spinning="spinning" tip="Loading..." v-if="buyGiftsInfo">
       <a-form-model
         id="normalProduct-modal-form"
         ref="ruleForm"

+ 2 - 2
src/views/salesManagement/salesQueryNew/edit.vue

@@ -167,7 +167,7 @@ import {
   salesDetailBySn,
   salesPromoQueryCount,
   salesWriteSubmit,
-  salesPromoQueryList,
+  salesPromoQueryStatisticsList,
   salesPromoDiscountSort,
   salesQueryUnPartPromo,
   salesPromoValidaSubmit,
@@ -271,7 +271,7 @@ export default {
     // 获取销售单参与的活动列表
     async getActiveList () {
       // 已参与活动列表
-      const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
+      const list = await salesPromoQueryStatisticsList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
       this.activeList = list.filter(item => item.promotion && item.promotionRule)
       // 触发活动统计查询变量
       this.$nextTick(() => {