فهرست منبع

销售端新增用户列表,针对手动,自动,做一个红包领取开关,默认打开,可以领取红包,关闭后不允许领取红包,手动自动都无法领取,答完题显示答题成功,并且有答题记录,但是不走红包领取接口

xw 1 ماه پیش
والد
کامیت
ba6673ca03

+ 9 - 0
src/api/user/fsUser.js

@@ -53,6 +53,15 @@ export function updateUser(data) {
   })
 }
 
+// 修改会员是否允许领红包(red_status:1 允许,0 关闭)
+export function updateFsUserRedStatus(data) {
+  return request({
+    url: '/user/fsUser/redStatus',
+    method: 'put',
+    data: data
+  })
+}
+
 // 修改用户
 export function updateMemberUser(data) {
   return request({

+ 40 - 2
src/views/member/list.vue

@@ -233,6 +233,20 @@
           <span>{{ scope.row.isBuy === 1 ? '是' : '否' }}</span>
         </template>
       </el-table-column>
+      <el-table-column label="允许领红包" align="center" width="100">
+        <template slot-scope="scope">
+          <el-switch
+            v-model="scope.row.fsUserRedStatus"
+            :active-value="1"
+            :inactive-value="0"
+            active-color="#13ce66"
+            inactive-color="#dcdfe6"
+            :disabled="!!scope.row._fsUserRedStatusSaving"
+            v-hasPermi="['user:fsUser:edit']"
+            @change="handleFsUserRedStatusChange(scope.row)"
+          />
+        </template>
+      </el-table-column>
       <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -352,7 +366,8 @@ import {
   delUser,
   exportUser,
   auditUser,
-  updateMemberUser
+  updateMemberUser,
+  updateFsUserRedStatus
 } from '@/api/user/fsUser'
 import {getUserList} from "@/api/company/companyUser";
 import userDetails from '@/views/store/components/userDetails.vue';
@@ -517,12 +532,35 @@ export default {
       }
 
       listUser(this.queryParams).then(response => {
-        this.userList = response.rows;
+        this.userList = (response.rows || []).map(r => ({
+          ...r,
+          fsUserRedStatus: [1, '1'].includes(r.redStatus != null ? r.redStatus : r.red_status) ? 1 : 0
+        }));
         this.total = response.total;
         this.loading = false;
       });
     },
 
+    handleFsUserRedStatusChange(row) {
+      const userId = row.userId
+      if (userId == null) {
+        return
+      }
+      const newVal = row.fsUserRedStatus
+      const prev = newVal === 1 ? 0 : 1
+      this.$set(row, '_fsUserRedStatusSaving', true)
+      updateFsUserRedStatus({ userId, redStatus: newVal })
+        .then(() => {
+          this.msgSuccess('领红包设置已保存')
+        })
+        .catch(() => {
+          this.$set(row, 'fsUserRedStatus', prev)
+        })
+        .finally(() => {
+          this.$set(row, '_fsUserRedStatusSaving', false)
+        })
+    },
+
     /** 获取标签选项 */
     getTagOptions() {
       this.tagOptions = [

+ 40 - 2
src/views/member/mylist.vue

@@ -263,6 +263,20 @@
         </template>
       </el-table-column>
       <el-table-column label="营期名称" align="center" prop="periodName" />
+      <el-table-column label="允许领红包" align="center" width="100">
+        <template slot-scope="scope">
+          <el-switch
+            v-model="scope.row.fsUserRedStatus"
+            :active-value="1"
+            :inactive-value="0"
+            active-color="#13ce66"
+            inactive-color="#dcdfe6"
+            :disabled="!!scope.row._fsUserRedStatusSaving"
+            v-hasPermi="['user:fsUser:edit']"
+            @change="handleFsUserRedStatusChange(scope.row)"
+          />
+        </template>
+      </el-table-column>
       <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -396,7 +410,8 @@ import {
   auditUser,
   getMemberUser,
   updateMemberUser,
-  delCompanyUser
+  delCompanyUser,
+  updateFsUserRedStatus
 } from '@/api/user/fsUser'
 import {transferUser} from "@/api/users/user";
 import {getUserList} from "@/api/company/companyUser";
@@ -594,7 +609,10 @@ export default {
 
       myListUser(this.queryParams).then(response => {
         console.log('我的会员列表查询结果:', response);
-        this.userList = response.rows;
+        this.userList = (response.rows || []).map(r => ({
+          ...r,
+          fsUserRedStatus: [1, '1'].includes(r.redStatus != null ? r.redStatus : r.red_status) ? 1 : 0
+        }));
         this.total = response.total;
         this.loading = false;
       }).catch(error => {
@@ -604,6 +622,26 @@ export default {
       });
     },
 
+    handleFsUserRedStatusChange(row) {
+      const userId = row.userId
+      if (userId == null) {
+        return
+      }
+      const newVal = row.fsUserRedStatus
+      const prev = newVal === 1 ? 0 : 1
+      this.$set(row, '_fsUserRedStatusSaving', true)
+      updateFsUserRedStatus({ userId, redStatus: newVal })
+        .then(() => {
+          this.msgSuccess('领红包设置已保存')
+        })
+        .catch(() => {
+          this.$set(row, 'fsUserRedStatus', prev)
+        })
+        .finally(() => {
+          this.$set(row, '_fsUserRedStatusSaving', false)
+        })
+    },
+
     /** 获取标签选项 */
     getTagOptions() {
       this.tagOptions = [

+ 39 - 1
src/views/qw/externalContact/index.vue

@@ -514,6 +514,22 @@
           <el-tag v-else type="info"> 未绑定</el-tag>
         </template>
       </el-table-column>
+      <el-table-column label="允许领红包" width="100px" align="center" fixed="right">
+        <template slot-scope="scope">
+          <span v-if="!scope.row.fsUserId" style="color: #c0c4cc;">-</span>
+          <el-switch
+            v-else
+            v-model="scope.row.fsUserRedStatus"
+            :active-value="1"
+            :inactive-value="0"
+            active-color="#13ce66"
+            inactive-color="#dcdfe6"
+            :disabled="!!scope.row._fsUserRedStatusSaving"
+            v-hasPermi="['user:fsUser:edit']"
+            @change="handleFsUserRedStatusChange(scope.row)"
+          />
+        </template>
+      </el-table-column>
       <el-table-column label="修改" align="center" class-name="small-padding fixed-width" width="200px" fixed="right">
         <template slot-scope="scope">
           <el-button
@@ -1028,6 +1044,7 @@ import  selectUser  from "@/views/qw/externalContact/selectUser.vue";
 import  collection  from "@/views/qw/externalContact/collection.vue";
 import info from "@/views/qw/externalContact/info.vue";
 import { editTalk } from "@/api/qw/externalContactInfo";
+import { updateFsUserRedStatus } from '@/api/user/fsUser'
 import PaginationMore from "../../../components/PaginationMore/index.vue";
 import userDetails from '@/views/store/components/userDetails.vue';
 import {courseList, videoList} from "@/api/course/courseRedPacketLog";
@@ -1509,12 +1526,33 @@ export default {
         }
       });
     },
+    handleFsUserRedStatusChange(row) {
+      if (!row.fsUserId) {
+        return
+      }
+      const newVal = row.fsUserRedStatus
+      const prev = newVal === 1 ? 0 : 1
+      this.$set(row, '_fsUserRedStatusSaving', true)
+      updateFsUserRedStatus({ userId: row.fsUserId, redStatus: newVal })
+        .then(() => {
+          this.msgSuccess('领红包设置已保存')
+        })
+        .catch(() => {
+          this.$set(row, 'fsUserRedStatus', prev)
+        })
+        .finally(() => {
+          this.$set(row, '_fsUserRedStatusSaving', false)
+        })
+    },
     /** 查询企业微信客户列表 */
     getList() {
       this.loading = true;
       const { qwUserName, ...queryParams } = this.queryParams;
       listExternalContact(queryParams).then(response => {
-        this.externalContactList = response.rows;
+        this.externalContactList = (response.rows || []).map(r => ({
+          ...r,
+          fsUserRedStatus: [1, '1'].includes(r.redStatus != null ? r.redStatus : r.red_status) ? 1 : 0
+        }));
         this.total = response.total;
         this.loading = false;
       });

+ 39 - 1
src/views/qw/externalContact/myExternalContact.vue

@@ -465,6 +465,22 @@
           <el-tag v-else type="info"> 未绑定</el-tag>
         </template>
       </el-table-column>
+      <el-table-column label="允许领红包" width="100px" align="center" fixed="right">
+        <template slot-scope="scope">
+          <span v-if="!scope.row.fsUserId" style="color: #c0c4cc;">-</span>
+          <el-switch
+            v-else
+            v-model="scope.row.fsUserRedStatus"
+            :active-value="1"
+            :inactive-value="0"
+            active-color="#13ce66"
+            inactive-color="#dcdfe6"
+            :disabled="!!scope.row._fsUserRedStatusSaving"
+            v-hasPermi="['user:fsUser:edit']"
+            @change="handleFsUserRedStatusChange(scope.row)"
+          />
+        </template>
+      </el-table-column>
       <el-table-column label="修改" align="center" class-name="small-padding fixed-width" width="200px" fixed="right">
         <template slot-scope="scope">
           <el-button
@@ -1085,6 +1101,7 @@ import PaginationMore from "../../../components/PaginationMore/index.vue";
 import Collection from './collection.vue';
 import {courseList, videoList} from "@/api/course/courseRedPacketLog";
 import userDetails from '@/views/store/components/userDetails.vue';
+import { updateFsUserRedStatus } from '@/api/user/fsUser'
 export default {
   name: "ExternalContact",
   components:{PaginationMore, mycustomer,customerDetails,SopDialog,selectUser,info,Collection,userDetails},
@@ -1708,11 +1725,32 @@ export default {
       });
     },
 
+    handleFsUserRedStatusChange(row) {
+      if (!row.fsUserId) {
+        return
+      }
+      const newVal = row.fsUserRedStatus
+      const prev = newVal === 1 ? 0 : 1
+      this.$set(row, '_fsUserRedStatusSaving', true)
+      updateFsUserRedStatus({ userId: row.fsUserId, redStatus: newVal })
+        .then(() => {
+          this.msgSuccess('领红包设置已保存')
+        })
+        .catch(() => {
+          this.$set(row, 'fsUserRedStatus', prev)
+        })
+        .finally(() => {
+          this.$set(row, '_fsUserRedStatusSaving', false)
+        })
+    },
     /** 查询企业微信客户列表 */
     getList() {
       this.loading = true;
       myList(this.queryParams).then(response => {
-        this.externalContactList = response.rows;
+        this.externalContactList = (response.rows || []).map(r => ({
+          ...r,
+          fsUserRedStatus: [1, '1'].includes(r.redStatus != null ? r.redStatus : r.red_status) ? 1 : 0
+        }));
         this.total = response.total;
         this.loading = false;
       });