Ver Fonte

全民营销-分销人员:批量设置佣金比例

shipeng há 11 horas atrás
pai
commit
ae86e995de

+ 8 - 0
src/api/distribution/personnelMr.js

@@ -102,6 +102,14 @@ export const batchUpdateRetailRate = (data) => {
     data: data
   })
 }
+// 批量设置佣金比例
+export const batchUpdateRate = (data) => {
+  return request({
+    url: '/member/marketPersons/batchUpdateRetailAmountRatio',
+    method: 'post',
+    data: data
+  })
+}
 
 //  导出
 export function downOrderListXls(params) {

+ 115 - 4
src/views/distribution/personnelMr/index.vue

@@ -108,6 +108,14 @@
             @click="openRetailRate"
             v-hasPermi="['personnelMr:personnelMr:RetailRate']"
           >批量设置佣金税率</el-button>
+          <el-button
+            type="warning"
+            plain
+            icon="el-icon-s-tools"
+            size="mini"
+            @click="openAmountRate"
+            v-hasPermi="['personnelMr:personnelMr:AmountRate']"
+          >批量设置佣金比例</el-button>
           <el-button
             type="primary"
             size="mini"
@@ -146,7 +154,12 @@
           </el-table-column>
           <el-table-column label="签约商户号" align="center" prop="unionMid" />
           <el-table-column label="签约失败原因" align="center" prop="unionErrReason" />
-          <el-table-column label="佣金税率" align="center" prop="type">
+          <el-table-column label="佣金比例" align="center" prop="retailAmountRatio">
+            <template slot-scope="scope">
+              <span>{{ scope.row.retailAmountRatio }}%</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="佣金税率" align="center" prop="retailRate">
             <template slot-scope="scope">
               <span>{{ scope.row.retailRate }}%</span>
             </template>
@@ -339,6 +352,7 @@
       width="650px"
       :destroy-on-close="true"
       :close-on-click-modal="false"
+      @close="closeRetailRate"
     >
       <el-form :model="retailRateForm" ref="retailRateForm" :rules="retailRateFormRules" label-width="120px">
         <el-form-item label="佣金税率设置" prop="retailRate">
@@ -355,7 +369,7 @@
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button @click="showRetailRate = false">取消</el-button>
+        <el-button @click="closeRetailRate">取消</el-button>
         <el-button
           type="primary"
           @click="submitRetailRateForm"
@@ -369,6 +383,44 @@
         </el-button>
       </div>
     </el-dialog>
+    <!-- 佣金比例设置 -->
+    <el-dialog
+      title="佣金比例设置"
+      :visible.sync="isShowRate"
+      width="650px"
+      :destroy-on-close="true"
+      :close-on-click-modal="false"
+      @close="closeShowRate"
+    >
+      <el-form :model="rateForm" ref="rateForm" :rules="rateFormRules" label-width="120px">
+        <el-form-item label="佣金比例设置" prop="retailAmountRatio">
+          <el-input
+            type="number"
+            v-model="rateForm.retailAmountRatio"
+            placeholder="请输入佣金比例"
+            clearable
+            @change="retailAmountRatioChange"
+            style="width: 260px;"
+          >
+            <template slot="append">%</template>
+          </el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="closeShowRate">取消</el-button>
+        <el-button
+          type="primary"
+          @click="submitRateForm"
+          v-loading.fullscreen.lock="loading"
+          element-loading-text="请等待..."
+          element-loading-spinner="el-icon-loading"
+          element-loading-background="rgba(0, 0, 0, 0.8)"
+        >
+          <span v-if="loading">提交中...</span>
+          <span v-else>保存</span>
+        </el-button>
+      </div>
+    </el-dialog>
 
     <!-- 推广链接内容设置 -->
     <linkSetVue ref="linkSetVue" @refresh="getList" />
@@ -383,8 +435,9 @@ import {
   updateStatus, 
   configUpdate, 
   getSetInfo, 
-  getRetailQrcode ,
+  getRetailQrcode,
   batchUpdateRetailRate,
+  batchUpdateRate,
   downOrderListXls,
   updateQrStatusApi
 } from '@/api/distribution/personnelMr'
@@ -492,6 +545,13 @@ export default {
         ],
       },
       handleExportLoading: false,
+      isShowRate: false,
+      rateForm: {ids:[],retailAmountRatio:undefined},
+      rateFormRules: {
+        retailAmountRatio: [
+          { required: true, message: '请输入佣金比例', trigger: ['change','blur'] },
+        ],
+      },
     };
   },
   created() {
@@ -568,9 +628,55 @@ export default {
         this.$message.warning("请选择分销商");
         return;
       }
-      console.log('ids',this.ids)
+      // console.log('ids',this.ids)
       this.showRetailRate = true;
     },
+    // 佣金比例输入事件
+    retailAmountRatioChange(value) {
+      // 检查输入值是否大于0
+      if (value <= 0) {
+        // 如果小于等于0,则将输入值置为0
+        this.rateForm.retailAmountRatio = 0;
+      } else {
+        // 如果大于0,则保留输入值
+        this.rateForm.retailAmountRatio = value;
+      }
+    },
+    // 佣金比例设置
+    openAmountRate() {
+      if(this.ids.length == 0){
+        this.$message.warning("请选择分销商");
+        return;
+      }
+      this.isShowRate = true;
+    },
+    // 关闭弹框
+    closeShowRate() {
+      this.isShowRate = false;
+      this.rateForm={ids:[],retailAmountRatio:undefined};
+    },
+    // 佣金税率设置
+    submitRateForm(){
+      this.rateForm.ids = this.ids;
+      this.$refs["rateForm"].validate(async (valid) => {
+        if (valid) {
+          try {
+            this.loading = true;
+            const { code } = await batchUpdateRate({ ...this.rateForm });
+            if (code === 200) {
+              this.setLoading = false;
+              this.$message.success("操作成功!");
+              this.getList();
+              this.rateForm={ids:[],retailAmountRatio:undefined};
+              this.isShowRate = false;
+            }
+          } catch (error) {
+          } finally {
+            this.loading = false;
+          }
+        }
+      });
+    },
     /** 海报设置按钮操作 */
     codeSet() {
       this.$refs["promotionCode"].openDialog("海报设置", null);
@@ -645,6 +751,11 @@ export default {
         this.retailRateForm.retailRate = value;
       }
     },
+    // 关闭弹框
+    closeRetailRate() {
+      this.retailRateForm={ids:[],retailRate:undefined};
+      this.showRetailRate = false;
+    },
     // 佣金税率设置
     submitRetailRateForm(){
       this.retailRateForm.ids = this.ids;