index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="会员ID" prop="userId">
  5. <el-input
  6. v-model="queryParams.userId"
  7. placeholder="请输入会员ID"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="用户昵称" prop="nickName">
  14. <el-input
  15. v-model="queryParams.nickName"
  16. placeholder="请输入用户昵称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="手机号码" prop="phone">
  23. <el-input
  24. v-model="queryParams.phone"
  25. placeholder="请输入手机号码"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="加密号码" prop="phoneMk">
  32. <el-input
  33. v-model="queryParams.phoneMk"
  34. placeholder="请输入手机号码"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item label="app来源" prop="source">
  41. <el-input
  42. v-model="queryParams.source"
  43. placeholder="请输入手机号码"
  44. clearable
  45. size="small"
  46. @keyup.enter.native="handleQuery"
  47. />
  48. </el-form-item>
  49. <el-form-item label="用户状态" prop="status">
  50. <el-select v-model="queryParams.status" placeholder="请选择用户状态" clearable size="small">
  51. <el-option
  52. v-for="dict in userOptions"
  53. :key="dict.dictValue"
  54. :label="dict.dictLabel"
  55. :value="dict.dictValue"
  56. />
  57. </el-select>
  58. </el-form-item>
  59. <el-form-item label="是否购药" prop="isBuy">
  60. <el-select v-model="queryParams.isBuy" placeholder="请选择用户状态" clearable size="small">
  61. <el-option
  62. v-for="dict in orOptions"
  63. :key="dict.dictValue"
  64. :label="dict.dictLabel"
  65. :value="dict.dictValue"
  66. />
  67. </el-select>
  68. </el-form-item>
  69. <el-form-item label="推广员" prop="isPromoter">
  70. <el-select v-model="queryParams.isPromoter" placeholder="请选择推广员" clearable size="small">
  71. <el-option
  72. v-for="dict in userIsPromoterOptions"
  73. :key="dict.dictValue"
  74. :label="dict.dictLabel"
  75. :value="dict.dictValue"
  76. />
  77. </el-select>
  78. </el-form-item>
  79. <el-form-item label="注册时间" prop="createTime">
  80. <el-date-picker v-model="createTime" size="small" style="width: 230px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  81. </el-form-item>
  82. <el-form-item>
  83. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  84. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  85. </el-form-item>
  86. </el-form>
  87. <el-row :gutter="10" class="mb8">
  88. <el-col :span="1.5">
  89. <el-button
  90. type="warning"
  91. plain
  92. icon="el-icon-download"
  93. size="mini"
  94. :loading="exportLoading"
  95. @click="handleExport"
  96. v-hasPermi="['his:user:export']"
  97. >导出</el-button>
  98. </el-col>
  99. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  100. </el-row>
  101. <el-table height="660" v-loading="loading" border :data="userList" @selection-change="handleSelectionChange" >
  102. <el-table-column type="selection" width="55" align="center" />
  103. <el-table-column label="会员id" align="center" prop="userId" width="150px"/>
  104. <el-table-column label="用户昵称" align="center" prop="nickName" width="150px"/>
  105. <el-table-column label="会员头像" align="center" width="80">
  106. <template slot-scope="scope">
  107. <el-popover
  108. placement="right"
  109. title=""
  110. trigger="hover"
  111. >
  112. <img slot="reference" :src="scope.row.avatar" width="50" >
  113. <img :src="scope.row.avatar" style="max-width: 120px;">
  114. </el-popover>
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="手机号码" align="center" prop="phone" width="150px" />
  118. <el-table-column label="用户积分" align="center" prop="integral" />
  119. <el-table-column label="用户状态" align="center" prop="status" >
  120. <template slot-scope="scope">
  121. <dict-tag :options="userOptions" :value="scope.row.status"/>
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="用户备注" align="center" prop="remark" />
  125. <!-- 会员等级 -->
  126. <el-table-column label="会员等级" align="center" prop="level" width="100">
  127. <template slot-scope="scope">
  128. <dict-tag :options="userLevelOptions" :value="scope.row.level"/>
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="上级昵称" align="center" prop="tuiName" />
  132. <el-table-column label="app来源" align="center" prop="source" />
  133. <el-table-column label="登陆设备" align="center" prop="loginDevice" />
  134. <el-table-column label="上级手机号码" align="center" prop="tuiPhone" width="150px"/>
  135. <el-table-column label="下级人数" align="center" prop="tuiUserCount" />
  136. <el-table-column label="最后一次登录ip" align="center" prop="lastIp" width="130px"/>
  137. <el-table-column label="余额" align="center" prop="balance" />
  138. <el-table-column label="注册时间" align="center" prop="createTime" width="150px" />
  139. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="220px">
  140. <template slot-scope="scope">
  141. <el-button
  142. size="mini"
  143. type="text"
  144. icon="el-icon-edit"
  145. @click="handleUpdate(scope.row)"
  146. v-hasPermi="['his:user:edit']"
  147. >修改</el-button>
  148. <el-button
  149. size="mini"
  150. type="text"
  151. @click="handledetails(scope.row)"
  152. >详情</el-button>
  153. <el-button
  154. size="mini"
  155. type="text"
  156. @click="handleDelete(scope.row)"
  157. v-hasPermi="['his:user:remove']"
  158. >删除</el-button>
  159. <el-button
  160. size="mini"
  161. type="text"
  162. @click="handleAddPoint(scope.row)"
  163. v-hasPermi="['his:user:addPoint']"
  164. >添加积分</el-button>
  165. <el-button
  166. size="mini"
  167. type="text"
  168. @click="openBindPhone(scope.row)"
  169. v-hasPermi="['his:user:bindPhNum']"
  170. >{{ scope.row.phone ? '修改手机号' : '绑定手机号' }}</el-button>
  171. <el-button
  172. size="mini"
  173. type="text"
  174. @click="handleCallPhone(scope.row)"
  175. >外呼</el-button>
  176. </template>
  177. </el-table-column>
  178. </el-table>
  179. <pagination
  180. v-show="total>0"
  181. :total="total"
  182. :page.sync="queryParams.pageNum"
  183. :limit.sync="queryParams.pageSize"
  184. @pagination="getList"
  185. />
  186. <!-- 添加或修改用户对话框 -->
  187. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  188. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  189. <el-form-item label="用户昵称" prop="nickName">
  190. <el-input v-model="form.nickName" placeholder="请输入用户昵称" />
  191. </el-form-item>
  192. <el-form-item label="用户状态" prop="status">
  193. <el-select v-model="form.status" placeholder="请选择状态" clearable size="small">
  194. <el-option
  195. v-for="dict in userOptions"
  196. :key="dict.dictValue"
  197. :label="dict.dictLabel"
  198. :value="dict.dictValue"
  199. />
  200. </el-select>
  201. </el-form-item>
  202. <!-- 会员等级 -->
  203. <el-form-item label="会员等级" prop="level">
  204. <el-select v-model="form.level" placeholder="请选择会员等级" clearable size="small">
  205. <el-option
  206. v-for="dict in userLevelOptions"
  207. :key="dict.dictValue"
  208. :label="dict.dictLabel"
  209. :value="dict.dictValue"
  210. />
  211. </el-select>
  212. </el-form-item>
  213. <el-form-item label="会员昵称" prop="nickname">
  214. <el-input v-model="form.nickname" placeholder="请输入用户昵称" />
  215. </el-form-item>
  216. <el-form-item label="手机号码" prop="phone" v-if = "projectCode != 'ddgy' ">
  217. <el-input v-model="form.phone" disabled placeholder="请输入手机号码" />
  218. </el-form-item>
  219. <el-form-item label="手机号码" prop="phone" v-if = "projectCode === 'ddgy' ">
  220. <el-input v-model="form.phone" placeholder="请输入手机号码" />
  221. </el-form-item>
  222. <el-form-item label="进线日期" prop="registerDate">
  223. <el-date-picker clearable size="small"
  224. v-model="form.registerDate"
  225. type="date"
  226. value-format="yyyy-MM-dd"
  227. placeholder="选择进线日期">
  228. </el-date-picker>
  229. </el-form-item>
  230. <el-form-item label="推线编码" prop="registerCode">
  231. <el-input v-model="form.registerCode" placeholder="请输入推线编码" />
  232. </el-form-item>
  233. <el-form-item label="渠道来源" prop="source">
  234. <el-input v-model="form.source" placeholder="请输入渠道来源" />
  235. </el-form-item>
  236. <el-form-item label="是否为推广员" prop="isPromoter">
  237. <el-select style="width: 200px" v-model="form.isPromoter" placeholder="请选择" clearable size="small" >
  238. <el-option
  239. v-for="item in userIsPromoterOptions"
  240. :key="item.dictValue"
  241. :label="item.dictLabel"
  242. :value="item.dictValue"
  243. />
  244. </el-select>
  245. </el-form-item>
  246. <el-form-item label="用户备注" prop="remark" >
  247. <el-input v-model="form.remark" placeholder="请输入用户备注" type="textarea"/>
  248. </el-form-item>
  249. </el-form>
  250. <div slot="footer" class="dialog-footer">
  251. <el-button type="primary" @click="submitForm">确 定</el-button>
  252. <el-button @click="cancel">取 消</el-button>
  253. </div>
  254. </el-dialog>
  255. <el-drawer
  256. :with-header="false"
  257. size="75%"
  258. :title="show.title" :visible.sync="show.open">
  259. <!-- <userDetails ref="userDetails" />-->
  260. <userDetailsByNew ref="userDetailsByNew" />
  261. </el-drawer>
  262. <el-dialog :title="addPointDialog.title" :visible.sync="addPointDialog.open" width="500px" append-to-body>
  263. <el-form ref="addPointForm" :model="addPointDialog.form" :rules="addPointDialog.rules" label-width="100px">
  264. <el-form-item label="积分" prop="point">
  265. <el-input-number :min="0" :step="1" :precision="0" v-model="addPointDialog.form.point" placeholder="请输入积分" />
  266. <div style="color: #a95812">积分不能为小数</div>
  267. </el-form-item>
  268. <el-form-item label="备注" prop="remark">
  269. <el-input type="textarea" v-model="addPointDialog.form.remark" placeholder="请输入备注说明" />
  270. </el-form-item>
  271. </el-form>
  272. <div slot="footer" class="dialog-footer">
  273. <el-button type="primary" @click="submitAddPointForm">确 定</el-button>
  274. <el-button @click="cancelAddPoint">取 消</el-button>
  275. </div>
  276. </el-dialog>
  277. <!-- ============================================================ -->
  278. <!-- 一键外呼弹窗组件 -->
  279. <!-- ============================================================ -->
  280. <sip-call-phone-dialog
  281. :sip-visible.sync="callDialogVisible"
  282. :sip-encrypted-phone="currentEncryptedPhone"
  283. :sip-encrypted-user-id="currentEncryptedUserId"
  284. :sip-dial-type="currentDialType"
  285. />
  286. <!-- 绑定/修改手机号弹窗 -->
  287. <el-dialog
  288. :title="bindPhoneHasPhone ? '修改手机号' : '绑定手机号'"
  289. :visible.sync="bindPhoneVisible"
  290. width="420px"
  291. append-to-body
  292. @close="resetBindPhoneForm"
  293. >
  294. <el-form ref="bindPhoneForm" :model="bindPhoneForm" :rules="bindPhoneRules" label-width="90px">
  295. <el-form-item label="手机号码" prop="phNum">
  296. <el-input v-model="bindPhoneForm.phNum" placeholder="请输入手机号码" maxlength="11" />
  297. </el-form-item>
  298. </el-form>
  299. <div slot="footer" class="dialog-footer">
  300. <el-button @click="bindPhoneVisible = false">取 消</el-button>
  301. <el-button type="primary" :loading="bindPhoneLoading" @click="submitBindPhone">确 定</el-button>
  302. </div>
  303. </el-dialog>
  304. </div>
  305. </template>
  306. <script>
  307. import { listUser, getUser, delUser, addUser, updateUser, exportUser, addPoint, bindPhNum } from "@/api/his/user";
  308. import { getCompanyUserList, changeCompanyUser, getCompanyList } from '@/api/company/companyUser';
  309. import userDetails from '../../components/his/userDetails.vue';
  310. import userDetailsByNew from './userDetails.vue';
  311. import sipCallPhoneDialog from '@/components/sipCall/sipCallPhoneDialog.vue';
  312. export default {
  313. name: "User",
  314. components: {userDetails,userDetailsByNew,sipCallPhoneDialog},
  315. data() {
  316. return {
  317. // ========== 外呼弹窗控制 ==========
  318. callDialogVisible: false,
  319. currentEncryptedPhone: '',
  320. currentEncryptedUserId: null,
  321. currentDialType: 'audio',
  322. // 绑定/修改手机号
  323. bindPhoneVisible: false,
  324. bindPhoneLoading: false,
  325. bindPhoneHasPhone: false,
  326. bindPhoneFsUserId: null,
  327. bindPhoneForm: {
  328. phNum: ''
  329. },
  330. bindPhoneRules: {
  331. phNum: [
  332. { required: true, message: '请输入手机号码', trigger: 'blur' },
  333. {
  334. pattern: /^1[3-9]\d{9}$/,
  335. message: '请输入正确的手机号码',
  336. trigger: 'blur'
  337. }
  338. ]
  339. },
  340. projectCode: process.env.VUE_APP_PROJECT_CODE,
  341. userIsPromoterOptions:[],
  342. companyName: null,
  343. companyUserNickName: null,
  344. companyOptions: [],
  345. companyUserOptions: [],
  346. show:{
  347. title:"用户详情",
  348. open:false,
  349. },
  350. userOptions: [],
  351. // 用户等级
  352. userLevelOptions:[],
  353. // 遮罩层
  354. loading: true,
  355. // 导出遮罩层
  356. exportLoading: false,
  357. // 选中数组
  358. ids: [],
  359. orOptions:[],
  360. // 非单个禁用
  361. single: true,
  362. // 非多个禁用
  363. multiple: true,
  364. // 显示搜索条件
  365. showSearch: true,
  366. // 总条数
  367. total: 0,
  368. // 用户表格数据
  369. userList: [],
  370. // 弹出层标题
  371. title: "",
  372. // 是否显示弹出层
  373. open: false,
  374. createTime:null,
  375. // 查询参数
  376. queryParams: {
  377. pageNum: 1,
  378. pageSize: 10,
  379. nickName: null,
  380. avatar: null,
  381. phone: null,
  382. phoneMk: null,
  383. integral: null,
  384. status: null,
  385. tuiUserId: null,
  386. tuiTime: null,
  387. tuiUserCount: null,
  388. maOpenId: null,
  389. mpOpenId: null,
  390. unionId: null,
  391. isDel: null,
  392. userCode: null,
  393. lastIp: null,
  394. balance: null,
  395. sTime:null,
  396. eTime:null,
  397. isBuy:null,
  398. source:null,
  399. companyName: null,
  400. userId: null
  401. },
  402. // 表单参数
  403. form: {},
  404. // 表单校验
  405. rules: {
  406. nickName: [
  407. { required: true, message: "昵称不能为空", trigger: "blur" }
  408. ],
  409. status: [
  410. { required: true, message: "用户状态不能为空", trigger: "blur" }
  411. ],
  412. integral: [
  413. { required: true, message: "用户积分不能为空", trigger: "blur" }
  414. ],
  415. },
  416. addPointDialog: {
  417. open: false,
  418. title: "添加积分",
  419. form: {
  420. userId: null,
  421. point: null,
  422. remark: null
  423. },
  424. rules: {
  425. point: [
  426. { required: true, message: "请输入积分", trigger: "blur" },
  427. { validator: (rule, value, callback) => {
  428. if (Number(value) > 0) {
  429. callback(); // 验证通过
  430. } else {
  431. callback(new Error("积分必须大于0"));
  432. }
  433. },
  434. trigger: "blur" }
  435. ]
  436. }
  437. }
  438. };
  439. },
  440. created() {
  441. this.getList();
  442. this.getDicts("sys_user_status").then(response => {
  443. this.userOptions = response.data;
  444. });
  445. this.getDicts("sys_company_or").then(response => {
  446. this.orOptions = response.data;
  447. });
  448. this.getDicts("user_level").then(response => {
  449. this.userLevelOptions = response.data;
  450. });
  451. this.getDicts("user_is_promoter").then((response) => {
  452. this.userIsPromoterOptions = response.data;
  453. });
  454. },
  455. methods: {
  456. /** 销售选择变化 */
  457. handleCompanyUserChange(userId) {
  458. if (!this.changeCompanyUserForm.companyId) {
  459. this.$message.warning('请先选择公司');
  460. this.changeCompanyUserForm.companyUserId = null;
  461. return;
  462. }
  463. },
  464. change(){
  465. if(this.createTime!=null){
  466. this.queryParams.sTime=this.createTime[0];
  467. this.queryParams.eTime=this.createTime[1];
  468. }else{
  469. this.queryParams.sTime=null;
  470. this.queryParams.eTime=null;
  471. }
  472. },
  473. handledetails(row){
  474. this.show.open=true;
  475. setTimeout(() => {
  476. this.$refs.userDetailsByNew.getDetails(row.userId);
  477. }, 1);
  478. },
  479. /** 查询用户列表 */
  480. getList() {
  481. this.loading = true;
  482. listUser(this.queryParams).then(response => {
  483. this.userList = response.rows;
  484. this.total = response.total;
  485. this.loading = false;
  486. });
  487. },
  488. // 取消按钮
  489. cancel() {
  490. this.open = false;
  491. this.reset();
  492. },
  493. // 表单重置
  494. reset() {
  495. this.form = {
  496. userId: null,
  497. nickName: null,
  498. avatar: null,
  499. phone: null,
  500. integral: null,
  501. status: null,
  502. tuiUserId: null,
  503. tuiTime: null,
  504. tuiUserCount: null,
  505. level:null,
  506. maOpenId: null,
  507. mpOpenId: null,
  508. unionId: null,
  509. isDel: null,
  510. userCode: null,
  511. remark: null,
  512. createTime: null,
  513. updateTime: null,
  514. lastIp: null,
  515. balance: null
  516. };
  517. this.resetForm("form");
  518. },
  519. /** 搜索按钮操作 */
  520. handleQuery() {
  521. this.queryParams.pageNum = 1;
  522. this.getList();
  523. },
  524. /** 重置按钮操作 */
  525. resetQuery() {
  526. this.resetForm("queryForm");
  527. this.createTime=null;
  528. this.queryParams.sTime=null;
  529. this.queryParams.eTime=null;
  530. this.handleQuery();
  531. },
  532. // 多选框选中数据
  533. handleSelectionChange(selection) {
  534. this.ids = selection.map(item => item.userId)
  535. this.single = selection.length!==1
  536. this.multiple = !selection.length
  537. },
  538. /** 新增按钮操作 */
  539. handleAdd() {
  540. this.reset();
  541. this.open = true;
  542. this.title = "添加用户";
  543. },
  544. /** 修改按钮操作 */
  545. handleUpdate(row) {
  546. this.reset();
  547. const userId = row.userId || this.ids
  548. getUser(userId).then(response => {
  549. this.form = response.data;
  550. this.open = true;
  551. this.title = "修改用户";
  552. this.form.status = String(this.form.status)
  553. this.form.level = String(this.form.level)
  554. this.form.isPromoter = String(this.form.isPromoter)
  555. });
  556. },
  557. /** 提交按钮 */
  558. submitForm() {
  559. this.$refs["form"].validate(valid => {
  560. if (valid) {
  561. if (this.form.userId != null) {
  562. updateUser(this.form).then(response => {
  563. this.msgSuccess("修改成功");
  564. this.open = false;
  565. this.getList();
  566. });
  567. } else {
  568. addUser(this.form).then(response => {
  569. this.msgSuccess("新增成功");
  570. this.open = false;
  571. this.getList();
  572. });
  573. }
  574. }
  575. });
  576. },
  577. /** 删除按钮操作 */
  578. handleDelete(row) {
  579. const userIds = row.userId || this.ids;
  580. this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
  581. confirmButtonText: "确定",
  582. cancelButtonText: "取消",
  583. type: "warning"
  584. }).then(function() {
  585. return delUser(userIds);
  586. }).then(() => {
  587. this.getList();
  588. this.msgSuccess("删除成功");
  589. }).catch(() => {});
  590. },
  591. handleAddPoint(row) {
  592. console.log(row)
  593. this.resetForm("addPointForm");
  594. this.addPointDialog.form = {
  595. userId: row.userId,
  596. point: 0,
  597. remark: ''
  598. }
  599. this.addPointDialog.open = true
  600. },
  601. openBindPhone(row) {
  602. this.resetBindPhoneForm();
  603. this.bindPhoneFsUserId = row.userId;
  604. this.bindPhoneHasPhone = !!row.phone;
  605. this.bindPhoneVisible = true;
  606. },
  607. resetBindPhoneForm() {
  608. this.bindPhoneForm = { phNum: '' };
  609. this.bindPhoneLoading = false;
  610. this.bindPhoneFsUserId = null;
  611. this.bindPhoneHasPhone = false;
  612. if (this.$refs.bindPhoneForm) {
  613. this.$refs.bindPhoneForm.clearValidate();
  614. }
  615. },
  616. submitBindPhone() {
  617. this.$refs.bindPhoneForm.validate(valid => {
  618. if (!valid) return;
  619. if (!this.bindPhoneFsUserId) {
  620. this.$message.warning('无法获取会员信息');
  621. return;
  622. }
  623. this.bindPhoneLoading = true;
  624. bindPhNum({
  625. phNum: Number(this.bindPhoneForm.phNum),
  626. fsUserId: this.bindPhoneFsUserId
  627. }).then(res => {
  628. if (res.code === 200) {
  629. this.msgSuccess(res.msg || '操作成功');
  630. this.bindPhoneVisible = false;
  631. this.getList();
  632. } else {
  633. this.msgError(res.msg || '操作失败');
  634. }
  635. }).catch(() => {
  636. // 错误信息由请求拦截器处理
  637. }).finally(() => {
  638. this.bindPhoneLoading = false;
  639. });
  640. });
  641. },
  642. submitAddPointForm() {
  643. this.$refs["addPointForm"].validate(valid => {
  644. if (valid) {
  645. addPoint(this.addPointDialog.form).then(response => {
  646. const {code} = response
  647. if (code !== 200) {
  648. this.msgError(response.msg || '添加失败');
  649. return
  650. }
  651. this.msgSuccess("添加成功");
  652. this.addPointDialog.open = false;
  653. this.getList();
  654. });
  655. }
  656. });
  657. },
  658. cancelAddPoint() {
  659. this.addPointDialog.open = false;
  660. },
  661. /** 导出按钮操作 */
  662. handleExport() {
  663. const queryParams = this.queryParams;
  664. this.$confirm('是否确认导出当前用户数据项?', "警告", {
  665. confirmButtonText: "确定",
  666. cancelButtonText: "取消",
  667. type: "warning"
  668. }).then(() => {
  669. this.exportLoading = true;
  670. return exportUser(queryParams);
  671. }).then(response => {
  672. this.download(response.msg);
  673. this.exportLoading = false;
  674. }).catch(() => {
  675. this.exportLoading = false;
  676. });
  677. },
  678. /**
  679. * 外呼电话
  680. */
  681. handleCallPhone(row) {
  682. if (!row.phone) {
  683. this.$message.warning('该用户没有手机号码');
  684. return;
  685. }
  686. // 1. 设置加密手机号
  687. this.currentEncryptedPhone = row.phone
  688. this.currentEncryptedUserId = row.userId
  689. // 2. 设置外呼类型(可选,默认 audio)
  690. this.currentDialType = 'audio'
  691. // 3. 打开弹窗(组件内部自动完成所有流程)
  692. this.callDialogVisible = true
  693. console.log("currentEncryptedUserId",this.currentEncryptedUserId)
  694. },
  695. /**
  696. * 外呼对话框关闭处理
  697. */
  698. handleCallDialogClose() {
  699. console.log('[外呼] 对话框已关闭');
  700. this.callDialogVisible = false;
  701. this.currentCallPhone = '';
  702. },
  703. }
  704. };
  705. </script>