Sfoglia il codice sorgente

销售绑定用户 直播数据修改 直播数据修复

yuhongqi 1 settimana fa
parent
commit
5b223eec52

+ 26 - 0
src/api/company/companyUser.js

@@ -334,3 +334,29 @@ export function updateBatchUserRoles(data) {
     data: data
   })
 }
+
+// 根据手机号码查询fs_user(完全匹配)
+export function queryFsUserByPhone(phone) {
+  return request({
+    url: '/company/user/fsUser/queryByPhone',
+    method: 'get',
+    params: { phone: phone }
+  })
+}
+
+// 批量绑定用户到员工
+export function batchBindCompanyUserId(data) {
+  return request({
+    url: '/company/user/batchBindCompanyUserId',
+    method: 'post',
+    data: data
+  })
+}
+
+// 查询已绑定的用户
+export function getBoundUsers(companyUserId) {
+  return request({
+    url: '/company/user/getBoundUsers/' + companyUserId,
+    method: 'get'
+  })
+}

+ 181 - 1
src/views/company/companyUser/index.vue

@@ -245,6 +245,14 @@
                 v-hasPermi="['qw:user:bind']"
               >查或换绑企微</el-button>
 
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-user"
+                plain
+                @click="handleBindUser(scope.row)"
+              >绑定用户</el-button>
+
               <el-button v-if="scope.row.userType !== '00'" size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['company:user:edit']">修改</el-button>
               <el-button v-if="scope.row.userType !== '00'" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['company:user:remove']">删除</el-button>
               <el-button size="mini" type="text" icon="el-icon-key" @click="handleResetPwd(scope.row)" v-hasPermi="['company:user:resetPwd']">重置密码</el-button>
@@ -618,6 +626,61 @@
       <selectDoctor ref="selectDoctor" @bindCompanyUserDoctorId="bindCompanyUserDoctorId"></selectDoctor>
     </el-dialog>
 
+    <!-- 绑定用户对话框 -->
+    <el-dialog title="绑定用户" :visible.sync="bindUserDialog.open" width="900px" append-to-body @close="resetBindUserForm">
+      <el-form :model="bindUserForm" label-width="100px">
+        <el-form-item label="手机号码">
+          <el-input
+            v-model="bindUserForm.phone"
+            placeholder="请输入手机号码(完全匹配)"
+            clearable
+            style="width: 300px;"
+            @keyup.enter.native="queryFsUserByPhone"
+          >
+            <el-button slot="append" icon="el-icon-search" @click="queryFsUserByPhone">查询</el-button>
+          </el-input>
+        </el-form-item>
+      </el-form>
+
+      <!-- 已绑定用户信息 -->
+      <div v-if="boundUsersList.length > 0" style="margin-bottom: 20px;">
+        <el-divider content-position="left">已绑定用户</el-divider>
+        <el-table :data="boundUsersList" border style="width: 100%">
+          <el-table-column prop="userId" label="用户ID" width="100" align="center"></el-table-column>
+          <el-table-column prop="nickname" label="用户名称" align="center"></el-table-column>
+          <el-table-column prop="phone" label="电话" align="center"></el-table-column>
+        </el-table>
+      </div>
+
+      <!-- 查询结果 -->
+      <div v-if="fsUserList.length > 0">
+        <el-divider content-position="left">查询结果(可多选)</el-divider>
+        <el-table
+          :data="fsUserList"
+          border
+          v-loading="bindUserLoading"
+          @selection-change="handleFsUserSelectionChange"
+          style="width: 100%"
+        >
+          <el-table-column type="selection" width="55" align="center"></el-table-column>
+          <el-table-column prop="userId" label="用户ID" width="100" align="center"></el-table-column>
+          <el-table-column prop="nickname" label="用户名称" align="center"></el-table-column>
+          <el-table-column prop="phone" label="电话" align="center"></el-table-column>
+        </el-table>
+      </div>
+      <div v-else-if="bindUserForm.phone && !bindUserLoading" style="text-align: center; padding: 20px; color: #909399;">
+        暂无查询结果
+      </div>
+      <div v-if="bindUserLoading" style="text-align: center; padding: 20px;">
+        <i class="el-icon-loading"></i> 查询中...
+      </div>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="bindUserDialog.open = false">取 消</el-button>
+        <el-button type="primary" @click="submitBindUser" :disabled="selectedFsUserIds.length === 0">确 定</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -636,7 +699,10 @@ import {
   generateSubDomain,
   setIsRegisterMember,
   updateCompanyUserAreaList,
-  isAllowedAllRegister, unBindDoctorId, bindDoctorId,updateBatchUserRoles
+  isAllowedAllRegister, unBindDoctorId, bindDoctorId,updateBatchUserRoles,
+  queryFsUserByPhone,
+  batchBindCompanyUserId,
+  getBoundUsers
 } from "@/api/company/companyUser";
 import { getToken } from "@/utils/auth";
 import { treeselect } from "@/api/company/companyDept";
@@ -847,6 +913,19 @@ export default {
         userIds: [],
         roleIds: []
       },
+      // 绑定用户相关
+      bindUserDialog: {
+        open: false,
+        title: '绑定用户'
+      },
+      bindUserForm: {
+        phone: '',
+        companyUserId: null
+      },
+      fsUserList: [],
+      selectedFsUserIds: [],
+      boundUsersList: [],
+      bindUserLoading: false,
     };
   },
   watch: {
@@ -1609,6 +1688,107 @@ export default {
         this.getList();
       })
     },
+    /** 绑定用户按钮操作 */
+    handleBindUser(row) {
+      this.bindUserForm.companyUserId = row.userId;
+      this.bindUserForm.phone = '';
+      this.fsUserList = [];
+      this.selectedFsUserIds = [];
+      this.boundUsersList = [];
+      this.bindUserDialog.open = true;
+
+      // 查询已绑定的用户
+      this.loadBoundUsers(row.userId);
+    },
+    /** 查询已绑定的用户 */
+    loadBoundUsers(companyUserId) {
+      getBoundUsers(companyUserId).then(response => {
+        if (response.code === 200 && response.data) {
+          this.boundUsersList = Array.isArray(response.data) ? response.data : [response.data];
+        } else {
+          this.boundUsersList = [];
+        }
+      }).catch(() => {
+        this.boundUsersList = [];
+      });
+    },
+    /** 根据手机号码查询fs_user */
+    queryFsUserByPhone() {
+      if (!this.bindUserForm.phone) {
+        this.$message.warning('请输入手机号码');
+        return;
+      }
+
+      // 验证手机号码格式
+      const phonePattern = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
+      if (!phonePattern.test(this.bindUserForm.phone)) {
+        this.$message.error('请输入正确的手机号码');
+        return;
+      }
+
+      this.bindUserLoading = true;
+      queryFsUserByPhone(this.bindUserForm.phone).then(response => {
+        this.bindUserLoading = false;
+        if (response.code === 200) {
+          if (response.data) {
+            // 如果返回的是单个对象,转换为数组
+            this.fsUserList = Array.isArray(response.data) ? response.data : [response.data];
+            if (this.fsUserList.length === 0) {
+              this.$message.info('未找到匹配的用户');
+            }
+          } else {
+            this.fsUserList = [];
+            this.$message.info('未找到匹配的用户');
+          }
+        } else {
+          this.fsUserList = [];
+          this.$message.error(response.msg || '查询失败');
+        }
+      }).catch(error => {
+        this.bindUserLoading = false;
+        this.fsUserList = [];
+        this.$message.error('查询失败');
+      });
+    },
+    /** 处理fs_user选择变化 */
+    handleFsUserSelectionChange(selection) {
+      this.selectedFsUserIds = selection.map(item => item.userId);
+    },
+    /** 提交绑定用户 */
+    submitBindUser() {
+      if (this.selectedFsUserIds.length === 0) {
+        this.$message.warning('请至少选择一个用户');
+        return;
+      }
+
+      const data = {
+        companyUserId: this.bindUserForm.companyUserId,
+        fsUserIds: this.selectedFsUserIds
+      };
+
+      batchBindCompanyUserId(data).then(response => {
+        if (response.code === 200) {
+          this.$message.success('绑定成功');
+          this.bindUserDialog.open = false;
+          this.getList();
+        } else {
+          this.$message.error(response.msg || '绑定失败');
+        }
+      }).catch(error => {
+        this.$message.error('绑定失败');
+      });
+    },
+    /** 重置绑定用户表单 */
+    resetBindUserForm() {
+      this.bindUserForm = {
+        phone: '',
+        companyUserId: null
+      };
+      this.fsUserList = [];
+      this.selectedFsUserIds = [];
+      this.boundUsersList = [];
+      this.bindUserLoading = false;
+    },
   },
 }
 </script>

+ 32 - 0
src/views/live/live/index.vue

@@ -238,6 +238,11 @@
               >
                 <i class="el-icon-service"></i> 复制直播间
               </el-dropdown-item>
+              <el-dropdown-item
+                @click.native="handleLink(scope.row)"
+              >
+                <i class="el-icon-service"></i> 查看小程序链接
+              </el-dropdown-item>
               <el-dropdown-item
                 v-if="scope.row.liveCodeUrl == null"
                 @click.native="handleGenerateCode(scope.row)"
@@ -558,7 +563,34 @@ export default {
       deep: false // startTime 是字符串,无需深度监听
     }
   },
+  computed:{
+    companyUserId() {
+      return this.$store.state.user.user.userId
+    },
+    companyId() {
+      return this.$store.state.user.user.companyId
+    },
+  },
   methods: {
+
+    handleLink(row){
+      if (!row.liveId) {
+        this.$message.error('获取直播间id失败');
+        return
+      }
+      if (!this.companyUserId) {
+        this.$message.error('获取销售id失败');
+        return
+      }
+      if (!this.companyId) {
+        this.$message.error('获取销售公司失败');
+        return
+      }
+      const companyUrl = "/pages_course/living?companyId=" + this.companyId + "&companyUserId=" + this.companyUserId + "&liveId=" + row.liveId
+      this.$alert(companyUrl, '小程序跳转连接', {
+        confirmButtonText: '确定',
+      });
+    },
     beforeAvatarUpload(file) {
       const isLt1M = file.size / 1024 / 1024 < 1;
       if (!isLt1M) {

+ 30 - 7
src/views/live/liveOrder/index.vue

@@ -25,6 +25,25 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="订单号" prop="orderCode">
+        <el-input
+          v-model="queryParams.orderCode"
+          placeholder="请输入订单号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="收货人电话" prop="userPhone">
+        <el-input
+          v-model="queryParams.orderuserPhoneCode"
+          placeholder="请输入收货人电话"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
 
       <el-form-item label="商品规格" prop="productSpec">
         <el-input
@@ -100,11 +119,11 @@
       <el-form-item label="下单时间" prop="orderTimeRange">
         <el-date-picker
           v-model="orderTimeRange"
-          type="daterange"
+          type="datetimerange"
           range-separator="至"
           start-placeholder="开始日期"
           end-placeholder="结束日期"
-          value-format="yyyy-MM-dd"
+          value-format="yyyy-MM-dd HH:mm:ss"
           size="small"
           @change="handleOrderTimeChange"
         />
@@ -138,6 +157,8 @@
 
     <el-table border v-loading="loading" :data="liveOrderList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="订单号" align="center" prop="orderCode" />
+
       <el-table-column label="销售ID" align="center" prop="companyUserId" >
         <template slot-scope="scope">
           <span v-if="scope.row.companyUserId > 0" >{{ scope.row.companyUserId }}</span>
@@ -177,6 +198,7 @@
       <el-table-column label="商品规格" align="center" prop="productSpec" width="120" />
       <el-table-column label="商品数量" align="center" prop="totalNum" />
       <el-table-column label="销售价格" align="center" prop="totalPrice" />
+      <el-table-column label="成交价" align="center" prop="payMoney"/>
 <!--      <el-table-column label="成本价格" align="center" prop="costPrice" />-->
       <el-table-column label="收货地址" align="center" prop="userAddress" width="200" />
       <el-table-column label="对应供应商" align="center" prop="supplierName" width="120" />
@@ -302,10 +324,11 @@ export default {
     this.getList();
     this.getDicts("sys_live_order_status").then(response => {
       this.orderStatusOptions = response.data;
+      this.orderOptions = this.orderStatusOptions;
     });
-    this.getDicts("sys_order_status").then(response => {
-      this.orderOptions = response.data;
-    });
+    // this.getDicts("sys_order_status").then(response => {
+    //   this.orderOptions = response.data;
+    // });
     this.getDicts("sys_user_level").then(response => {
       this.memberLevelOptions = response.data;
     });
@@ -336,8 +359,8 @@ export default {
 // 下单时间范围选择变化处理
     handleOrderTimeChange(value) {
       if (value && value.length === 2) {
-        this.queryParams.createTimeStart = value[0] + ' 00:00:00';
-        this.queryParams.createTimeEnd = value[1] + ' 23:59:59';
+        this.queryParams.createTimeStart = value[0];
+        this.queryParams.createTimeEnd = value[1];
       } else {
         this.queryParams.createTimeStart = null;
         this.queryParams.createTimeEnd = null;