瀏覽代碼

分销管理优化

ymy 1 年之前
父節點
當前提交
5635cc4a6b

+ 8 - 0
src/api/distribution.ts

@@ -68,6 +68,14 @@ export function productCommissionSave(data?:any){
 		data: data
 	})
 }
+//修改商品佣金设置
+export function productCommissionUpdate(data?:any){
+	return request({
+		url: '/omsOrder/productCommission/update',
+		method: 'POST',
+		data: data
+	})
+}
 
 //佣金查询
 export function productCommissionQueryByProductId(data?:any){

+ 46 - 26
src/views/oms/distributionAd/components/commissionModal.vue

@@ -21,12 +21,14 @@
 
 <script lang="ts">
 import { Component, Prop, Vue, Watch } from "vue-property-decorator";
-import { productCommissionSave,productCommissionQueryByProductId } from '@/api/distribution'
+import { productCommissionSave,productCommissionQueryByProductId,productCommissionUpdate } from '@/api/distribution'
 import { saleRankList } from '@/api/distribution'
+import { v } from "vxe-table";
 @Component({components:{}})
 export default class CommissionModal extends Vue {
   value=false;
   load=false;
+  productCommissionValue:any=null;
   val1:any=0;
   val2:any=0;
   data:any=[];
@@ -39,26 +41,26 @@ export default class CommissionModal extends Vue {
     this.getCommissionValue()
   }
   minValChange(){
-    if(!this.commissionVal){
-      this.val1 = 0
-      return
-    }
-    if(this.val1 < this.commissionVal.minRate){
+    // if(!this.commissionVal){
+    //   this.val1 = 0
+    //   return
+    // }
+    if(this.commissionVal && this.val1 < this.commissionVal.minRate){
       this.val1 = this.commissionVal.minRate
     }
-    if(this.val1 > this.commissionVal.maxRate){
+    if(this.commissionVal && this.val1 > this.commissionVal.maxRate){
       this.val1 = this.commissionVal.maxRate
     }
   }
   maxValChange(){
-    if(!this.commissionVal){
-      this.val2 = 0
-      return
-    }
-    if(this.val2 < this.commissionVal.minRate){
+    // if(!this.commissionVal){
+    //   this.val2 = 0
+    //   return
+    // }
+    if(this.commissionVal && this.val2 < this.commissionVal.minRate){
       this.val2 = this.commissionVal.minRate
     }
-    if(this.val2 > this.commissionVal.maxRate){
+    if(this.commissionVal && this.val2 > this.commissionVal.maxRate){
       this.val2 = this.commissionVal.maxRate
     }
   }
@@ -68,27 +70,45 @@ export default class CommissionModal extends Vue {
   }
   show(){}
   hide(){
-    this.val1 = null
-    this.val2 = null
+    this.val1 = null;
+    this.val2 = null;
+    this.productCommissionValue=null;
   }
   queryProductCommission(){
     productCommissionQueryByProductId({productId:this.data.id}).then((res:any) => {
       this.val1 = res.data.commission1;
       this.val2 = res.data.commission2;
+      this.productCommissionValue = res.data;
     }).catch(() =>{})
   }
   btn(){
-    productCommissionSave({
-      productId:this.data.id,
-      commission1:this.val1,
-      commission2:this.val2
-    }).then(() => {
-      this.$message({
-        message:'商品“' + this.data.skuTitle + '”佣金设置成功!',
-        type:'success'
-      });
-      this.value = false
-    }).catch(() => {})
+    if(this.productCommissionValue && this.productCommissionValue.id){
+      productCommissionUpdate({
+        id:this.productCommissionValue.id,
+        productId:this.data.id,
+        commission1:this.val1,
+        commission2:this.val2
+      }).then(() => {
+        this.$message({
+          message:'商品“' + this.data.skuTitle + '”佣金修改成功!',
+          type:'success'
+        });
+        this.value = false
+      }).catch(() => {})
+    }else{
+      productCommissionSave({
+        productId:this.data.id,
+        commission1:this.val1,
+        commission2:this.val2
+      }).then(() => {
+        this.$message({
+          message:'商品“' + this.data.skuTitle + '”佣金设置成功!',
+          type:'success'
+        });
+        this.value = false
+      }).catch(() => {})
+    }
+    
   }
   getCommissionValue(){
     saleRankList({

+ 3 - 0
src/views/oms/distributionAd/components/influenceList.vue

@@ -40,6 +40,9 @@ export default class InfluenceList extends Vue {
       },{
         title:'流程ID',
         field:'processId',
+      },{
+        title:'状态',
+        field:'status',
       }]
     }
   }

+ 20 - 0
src/views/oms/distributionAd/components/orderList.vue

@@ -93,6 +93,26 @@ export default class ProductList extends Vue {
           width: 110,
           title: '来源渠道',
           field: 'upSourceName',
+        },
+        {
+          width: 110,
+          title: '抵扣金额',
+          field: 'freeAmount',
+        },
+        {
+          width: 110,
+          title: '应付',
+          field: 'payAmount',
+        },
+        {
+          width: 110,
+          title: '运费',
+          field: 'freight',
+        },
+        {
+          width: 110,
+          title: '实付金额',
+          field: 'paidAmount',
         }
       ]
     }

+ 1 - 2
src/views/oms/distributionAd/components/productList.vue

@@ -28,7 +28,7 @@ export default class ProductList extends Vue {
       },
       columns: [
         {
-          width: '200px',
+          // width: '200px',
           title: '标题',
           field: 'skuTitle',
         },
@@ -68,7 +68,6 @@ export default class ProductList extends Vue {
           action: true,
           plugins: [{
             name: '佣金明细',
-            audit: '',
             event: {
               click: (item:any) => {
                 (this.$refs.commissionModal as any).setData(item);

+ 2 - 2
src/views/oms/distributionAd/index.vue

@@ -7,9 +7,9 @@
       <el-tab-pane label="分销员余额" name="2">
         <userBalanceList v-if="activeName == '2'"  />
       </el-tab-pane>
-      <el-tab-pane label="带货" name="3">
+      <!-- <el-tab-pane label="带货" name="3">
         <InfluenceList v-if="activeName == '3'"  />
-      </el-tab-pane>
+      </el-tab-pane> -->
       <el-tab-pane label="商品" name="4">
         <ProductList v-if="activeName == '4'"  />
       </el-tab-pane>