Parcourir la source

feature: 返利类型

chenqilong il y a 2 ans
Parent
commit
762e70c4c4
2 fichiers modifiés avec 76 ajouts et 162 suppressions
  1. 8 0
      src/api/policy_list.js
  2. 68 162
      src/views/sales_rebate/rebate_list_type.vue

+ 8 - 0
src/api/policy_list.js

@@ -295,7 +295,15 @@ export function updateType(params) {
 }
 
 // 返利钱包列表
+export function walletRebateListV2(data) {
+  return request({
+    url: `/wallet/rebate/list/v2?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
 
+// 返利钱包列表
 export function getWalletList(params) {
   return request({
     url: '/wallet/rebate/list',

+ 68 - 162
src/views/sales_rebate/rebate_list_type.vue

@@ -1,121 +1,13 @@
 <template>
-  <div class="app-container">
-    <div class="screen-container">
-      <Collapse :screen-form="screenForm">
-        <template #right_btn>
-          <el-button type="primary" size="mini" icon="el-icon-search" @click="submitScreenForm">查询</el-button>
-          <el-button type="primary" size="mini" @click="resetScreenForm">重置</el-button>
-        </template>
-        <template #search>
-          <el-form ref="screenForm" :model="screenForm" size="mini" label-width="100px" label-position="left">
-            <el-row :gutter="20">
-              <el-col :xs="24" :ms="6" :lg="6">
-                <el-form-item label="返利类型" prop="name">
-                  <el-input v-model="screenForm.name" placeholder="请输入返利类型" size="mini"></el-input>
-                </el-form-item>
-              </el-col>
-
-              <!-- <el-col :xs="24" :ms="6" :lg="6">
-                <el-form-item prop="status">
-                  <el-select
-                    v-model="screenForm.status"
-                    placeholder="请选择"
-                    size="small"
-                  >
-                    <el-option
-                      v-for="item in options"
-                      :key="item.value"
-                      :label="item.label"
-                      :value="item.value"
-                    >
-                    </el-option>
-                  </el-select>
-                </el-form-item>
-              </el-col> -->
-            </el-row>
-          </el-form>
-        </template>
-      </Collapse>
-      <el-button
-        type="primary"
-        size="mini"
-        icon="el-icon-plus"
-        v-if="$checkBtnRole('add', $route.meta.roles)"
-        @click=";(dialogVisible = true), (type = 1), getDictList()"
-        >新增</el-button
-      >
-    </div>
-
-    <div class="mymain-container">
-      <div class="table">
-        <el-table
-          v-loading="listLoading"
-          :data="dataList"
-          element-loading-text="Loading"
-          border
-          fit
-          highlight-current-row
-          stripe
-        >
-          <el-table-column type="selection" width="55" align="center"> </el-table-column>
-          <template v-for="col in columns">
-            <el-table-column
-              align="left"
-              :label="col.lable"
-              :prop="col.prop"
-              :min-width="col.widht"
-              show-overflow-tooltip
-              v-if="col.prop == 'status'"
-            >
-              <template slot-scope="scope">
-                <el-switch
-                  v-model="scope.row.status"
-                  @change="handleSwitch($event, scope.row.walletRebateId)"
-                  :active-text="scope.row.status ? '已启用' : '已禁用'"
-                >
-                </el-switch>
-              </template>
-            </el-table-column>
-            <el-table-column
-              v-else
-              align="left"
-              :label="col.lable"
-              :prop="col.prop"
-              :min-width="col.widht"
-              show-overflow-tooltip
-            >
-            </el-table-column>
-          </template>
-
-          <el-table-column align="center" fixed="right" label="操作" min-width="160">
-            <template slot-scope="scope">
-              <el-button type="text" size="small" @click="hanleDateil(scope.row)">查看</el-button>
-              <el-button
-                type="text"
-                size="small"
-                @click="hanleEdit(scope.row)"
-                v-if="$checkBtnRole('edit', $route.meta.roles)"
-                >编辑</el-button
-              >
-              <!-- <el-button type="text" size="small">编辑</el-button> -->
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
-      <!-- 分页 -->
-      <div class="fr">
-        <el-pagination
-          @size-change="handleSizeChange"
-          @current-change="handleCurrentChange"
-          :current-page="currentPage"
-          :page-sizes="[10, 20, 30, 50]"
-          :page-size="10"
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="listTotal"
-        >
-        </el-pagination>
-      </div>
-    </div>
+  <template-page
+    ref="pageRef"
+    :getList="getList"
+    :operation="operation()"
+    :optionsEvensGroup="optionsEvensGroup"
+    :columnParsing="columnParsing"
+    :tableAttributes="tableAttributes"
+    :tableEvents="tableEvents"
+  >
     <div>
       <el-dialog
         v-loading="addLoading"
@@ -163,31 +55,19 @@
         </template>
       </el-dialog>
     </div>
-  </div>
-  <!-- <template-page
-    ref="pageRef"
-    :getList="getList"
-    :operation="operation()"
-    :optionsEvensGroup="optionsEvensGroup"
-    :exportList="exportList"
-    :columnParsing="columnParsing"
-    :tableAttributes="tableAttributes"
-    :tableEvents="tableEvents"
-  >
-    
-  </template-page> -->
+  </template-page>
 </template>
 
 <script>
 import TemplatePage from '@/components/template/template-page-1.vue'
 import add_callback_mixin from '@/components/template/add_callback_mixin.js'
 
-import Mixin from '@/mixin/index'
-import Pagination from '@/components/Pagination'
-import { addWallet, getDictList, getTypeList, getWalletList, updateWallet } from '@/api/policy_list'
+// import Mixin from '@/mixin/index'
+// import Pagination from '@/components/Pagination'
+import { addWallet, getDictList, getTypeList, getWalletList, updateWallet, walletRebateListV2 } from '@/api/policy_list'
 
 export default {
-  mixins: [Mixin, add_callback_mixin],
+  mixins: [add_callback_mixin],
   data() {
     return {
       // 事件组合
@@ -196,7 +76,12 @@ export default {
           [
             {
               name: '新增',
-              click: this.addOn(() => {})
+              click: () => {
+                this.dialogVisible = true
+                this.type = 1
+                this.getDictList()
+              },
+              isRole: this.$checkBtnRole('add', this.$route.meta.roles)
             }
           ]
         ]
@@ -204,7 +89,7 @@ export default {
       // 表格属性
       tableAttributes: {
         // 启用勾选列
-        selectColumn: true
+        selectColumn: false
       },
       // 表格事件
       tableEvents: {
@@ -221,6 +106,7 @@ export default {
         saleTypeName: '',
         status: ''
       },
+      dialogVisible: false,
       dialogForm: {
         name: ''
         // mainName: "",
@@ -298,7 +184,7 @@ export default {
   },
   methods: {
     // 列表请求函数
-    // getList: levelList,
+    getList: walletRebateListV2,
     // 列表导出函数
     // exportList: exportLevelList,
     // 表格列解析渲染数据更改
@@ -313,7 +199,27 @@ export default {
       return (h, { row, index, column }) => {
         return (
           <div class="operation-btns">
-            <el-button size="mini" type="text" onClick={async () => {}}>
+            {this.$checkBtnRole('edit', this.$route.meta.roles) ? (
+              <el-button
+                size="mini"
+                type="text"
+                onClick={async () => {
+                  this.hanleEdit(row)
+                }}
+              >
+                编辑
+              </el-button>
+            ) : (
+              ''
+            )}
+
+            <el-button
+              size="mini"
+              type="text"
+              onClick={async () => {
+                this.hanleDateil(row)
+              }}
+            >
               查看
             </el-button>
           </div>
@@ -321,29 +227,29 @@ export default {
       }
     },
 
-    getList() {
-      this.listLoading = true
-      const params = {
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        name: this.screenForm.name,
-        // saleTypeCode: this.screenForm.saleTypeCode,
-        // saleTypeName: this.screenForm.saleTypeName,
-        status: this.screenForm.status
-      }
+    // getList() {
+    //   this.listLoading = true
+    //   const params = {
+    //     pageNum: this.currentPage,
+    //     pageSize: this.pageSize,
+    //     name: this.screenForm.name,
+    //     // saleTypeCode: this.screenForm.saleTypeCode,
+    //     // saleTypeName: this.screenForm.saleTypeName,
+    //     status: this.screenForm.status
+    //   }
 
-      getWalletList(params).then(res => {
-        this.dataList = res.data.records
-        this.listTotal = res.data.total
-        this.listLoading = false
-      })
-      // getProductList({
-      //   productCategoryName: "",
-      //   productCategoryNumber: "",
-      // }).then((res) => {
-      //   this.productList = res.data;
-      // });
-    },
+    //   getWalletList(params).then(res => {
+    //     this.dataList = res.data.records
+    //     this.listTotal = res.data.total
+    //     this.listLoading = false
+    //   })
+    //   // getProductList({
+    //   //   productCategoryName: "",
+    //   //   productCategoryNumber: "",
+    //   // }).then((res) => {
+    //   //   this.productList = res.data;
+    //   // });
+    // },
 
     handleChange(e) {
       console.log(e, this.typeList)
@@ -470,7 +376,7 @@ export default {
       }
       // this.$refs.dialogForm.resetFields()
       this.dialogVisible = false
-      this.getList()
+      this.$refs.pageRef.refreshList()
     },
     hanleCancel() {
       // this.type = "";
@@ -488,7 +394,7 @@ export default {
     }
   },
   components: {
-    Pagination
+    TemplatePage
   }
 }
 </script>