productPrice.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <template>
  2. <div class="record-warp">
  3. <div class="record-main">
  4. <el-row>
  5. <!-- <el-col :span="24">
  6. <div class="search-head">
  7. <span>公司名称:</span>
  8. <el-input v-model="name" clearable placeholder="请输入公司名称"></el-input>&nbsp;&nbsp;&nbsp;&nbsp;
  9. <el-button type="primary" icon="el-icon-search" @click="searchTarget">搜索</el-button>
  10. <el-button type="primary" icon="el-icon-delete-solid" @click="clearSearch">清空</el-button>
  11. </div>
  12. </el-col> -->
  13. </el-row>
  14. <el-row class="add_user_class">
  15. <el-col :span="24">
  16. <div class="search-head">
  17. <el-button type="success" round icon="el-icon-plus" @click="addPrice"
  18. >新增</el-button
  19. >
  20. <el-button
  21. type="delete"
  22. :disabled="multipleSelection.length == 0"
  23. round
  24. icon="el-icon-delete"
  25. @click="mulDeletePrice"
  26. >批量删除</el-button
  27. >
  28. </div>
  29. </el-col>
  30. </el-row>
  31. <div class="table-content">
  32. <el-table
  33. ref="multipleTable"
  34. :data="tableData"
  35. :row-style="{ height: '0px' }"
  36. :cell-style="{ padding: '5px' }"
  37. @selection-change="handleSelectionChange"
  38. >
  39. <el-table-column type="selection" align="center" width="" show-overflow-tooltip>
  40. </el-table-column>
  41. <el-table-column prop="productName" label="产品名" align="center" width="">
  42. </el-table-column>
  43. <el-table-column prop="reportName" label="报告名" align="center" width="">
  44. </el-table-column>
  45. <el-table-column prop="price" label="价格" align="center" width="">
  46. </el-table-column>
  47. <el-table-column prop="times" label="次数" align="center" width="">
  48. </el-table-column>
  49. <el-table-column
  50. prop="status"
  51. label="状态"
  52. align="center"
  53. :formatter="formatterState"
  54. width=""
  55. >
  56. </el-table-column>
  57. <el-table-column prop="type" label="接口类型" align="center" :formatter="formatterLevel" width="">
  58. </el-table-column>
  59. <el-table-column prop="description" label="接口描述" align="center" width="">
  60. </el-table-column>
  61. <!-- <el-table-column prop="isDelete" label="删除状态" align="center" :formatter="formatterDelete" width="">
  62. </el-table-column> -->
  63. <el-table-column label="操作" width="200px" align="center" fixed="right">
  64. <template slot-scope="scope">
  65. <el-button @click="viewUser(scope.row)" type="text" size="small"
  66. >查看</el-button
  67. >
  68. <el-button type="text" size="small" @click="editUser(scope.row)"
  69. >编辑</el-button
  70. >
  71. <el-popconfirm
  72. title="确定删除吗?"
  73. placement="top"
  74. @confirm="deletePrice([scope.row.id])"
  75. >
  76. <el-button
  77. size="small"
  78. style="margin-left: 10px"
  79. type="text"
  80. slot="reference"
  81. >删除</el-button
  82. >
  83. </el-popconfirm>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. </div>
  88. <el-pagination
  89. small
  90. background
  91. @current-change="handleCurrentChange"
  92. :current-page.sync="pageNum"
  93. layout="total, prev, pager, next"
  94. :page-size="pageSize"
  95. :total="total"
  96. >
  97. </el-pagination>
  98. <!-- <el-pagination small background layout="total prev, pager, next" :total="36">
  99. </el-pagination> -->
  100. </div>
  101. <ProductRegister ref="register" @search="searchTarget" />
  102. <el-dialog title="查看" :visible.sync="centerDialogVisible" width="60%" center>
  103. <div>
  104. <el-row>
  105. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  106. <div class="user_out">
  107. <div class="user_out_sub">产品名</div>
  108. <div class="user_out_subNext">
  109. {{ detailObj.productName }}
  110. </div>
  111. </div>
  112. </el-col>
  113. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  114. <div class="user_out">
  115. <div class="user_out_sub">报告名</div>
  116. <div class="user_out_subNext">
  117. {{ detailObj.reportName }}
  118. </div>
  119. </div>
  120. </el-col>
  121. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  122. <div class="user_out">
  123. <div class="user_out_sub">价格</div>
  124. <div class="user_out_subNext">
  125. {{ detailObj.price }}
  126. </div>
  127. </div>
  128. </el-col>
  129. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  130. <div class="user_out">
  131. <div class="user_out_sub">接口状态</div>
  132. <div class="user_out_subNext">
  133. {{ detailObj.status == "1" ? "生效中" : "未生效" }}
  134. </div>
  135. </div>
  136. </el-col>
  137. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  138. <div class="user_out">
  139. <div class="user_out_sub">次数</div>
  140. <div class="user_out_subNext">
  141. {{ detailObj.times }}
  142. </div>
  143. </div>
  144. </el-col>
  145. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  146. <div class="user_out">
  147. <div class="user_out_sub">接口类型</div>
  148. <div class="user_out_subNext">
  149. {{ detailObj.type == "1" ? "次卡" : "时效卡" }}
  150. </div>
  151. </div>
  152. </el-col>
  153. <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
  154. <div class="user_out">
  155. <div class="user_out_sub">描述</div>
  156. <div class="user_out_subNext">
  157. {{ detailObj.description }}
  158. </div>
  159. </div>
  160. </el-col>
  161. </el-row>
  162. </div>
  163. </el-dialog>
  164. </div>
  165. </template>
  166. <script>
  167. import { oSessionStorage } from "../../../utils/utils";
  168. import productRegister from "../../../components/ProductRegister.vue";
  169. export default {
  170. name: "channelManagement",
  171. components: {
  172. ProductRegister: productRegister,
  173. },
  174. data() {
  175. return {
  176. multipleSelection: [],
  177. centerDialogVisible: false,
  178. editUserFlag: false,
  179. startTime: "",
  180. endTime: "",
  181. value1: null,
  182. total: 0,
  183. pageSize: 10,
  184. pageNum: 1,
  185. keyword: "",
  186. tableData: [],
  187. userInfo: {}, //用户信息
  188. userId: "", //用户id
  189. name: "", //根据名称搜索
  190. userName: "", //根据昵称搜索
  191. hospitalOrDepartment: "", //医院科室
  192. invitationCode: "",
  193. roleType: "0",
  194. type: 0,
  195. view: {
  196. name: "",
  197. userName: "",
  198. channelId: "",
  199. role: "",
  200. },
  201. detailObj: {},
  202. };
  203. },
  204. created() {},
  205. mounted() {
  206. this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
  207. this.view.channelId = this.$route.query.channelId;
  208. this.invitationCode = this.userInfo.invitationCode;
  209. //判断是超级管理员吗
  210. if (this.userInfo.roleType == "1") {
  211. this.type = 0;
  212. } else if (this.userInfo.roleType == "3") {
  213. //如果登录的是代理用户
  214. this.type = 4;
  215. } else if (this.userInfo.roleType == "2") {
  216. this.type = 5;
  217. }
  218. if (this.$route.query.invitationCode) {
  219. this.invitationCode = this.$route.query.invitationCode;
  220. this.type = this.$route.query.type;
  221. }
  222. if (!this.userInfo) {
  223. //如果用户信息不存在跳转登陆页
  224. this.$router.push({ path: "/" });
  225. }
  226. this.searchTarget();
  227. },
  228. methods: {
  229. mulDeletePrice() {
  230. let that = this;
  231. let ids = [];
  232. for (let i = 0; i < this.multipleSelection.length; i++) {
  233. ids.push(this.multipleSelection[i].id);
  234. }
  235. this.$confirm("此操作将永久删除该价格, 是否继续?", "提示", {
  236. confirmButtonText: "确定",
  237. cancelButtonText: "取消",
  238. type: "warning",
  239. })
  240. .then(() => {
  241. that.deletePrice(ids);
  242. })
  243. .catch(() => {
  244. // this.$message({
  245. // type: 'info',
  246. // message: '已取消删除'
  247. // });
  248. });
  249. //获取id的集合
  250. // let ids=[]
  251. // for(let i){
  252. // }
  253. },
  254. handleSelectionChange(val) {
  255. this.multipleSelection = val;
  256. },
  257. formatterLevel(row) {
  258. if (row.type == "1") {
  259. return "次卡";
  260. } else if (row.type == "2") {
  261. return "时效卡";
  262. }
  263. },
  264. goBack() {
  265. this.$router.go(-1);
  266. },
  267. //格式化状态
  268. formatterIsDelete(row) {
  269. if (row.isDelete == "0") {
  270. return "正常";
  271. } else if (row.isDelete == "1") {
  272. return "已删除";
  273. } else {
  274. return "";
  275. }
  276. },
  277. //格式化状态
  278. formatterState(row) {
  279. if (row.status == "1") {
  280. return "生效中";
  281. } else if (row.status == "0") {
  282. return "未生效";
  283. }
  284. },
  285. formatterDelete(row) {
  286. if (row.isDelete == 0) {
  287. return "正常";
  288. } else {
  289. return "已删除";
  290. }
  291. },
  292. resetUser(index, val) {
  293. this.$http.get(`/user/reset/${val.id}`, {}, (res) => {
  294. // this.$toast.success({message:'成功'});
  295. if (res && res.code == 200) {
  296. this.$message.success("重置成功");
  297. this.searchTarget();
  298. } else {
  299. this.$message.error(res.msg);
  300. }
  301. });
  302. //重置密码
  303. },
  304. editUser(row) {
  305. this.editRegisterUser(row);
  306. },
  307. viewUser(row) {
  308. this.detailObj = row;
  309. this.centerDialogVisible = true;
  310. },
  311. addPrice() {
  312. this.addRegisterPrice(true);
  313. },
  314. clearSearch() {
  315. this.name = "";
  316. this.userName = "";
  317. this.searchTarget();
  318. },
  319. formatterRole(val) {
  320. if (val.type == "1") {
  321. return "超级管理员";
  322. } else {
  323. return "渠道用户";
  324. }
  325. },
  326. forma(val) {
  327. if (val.gender == "0") {
  328. return "男";
  329. } else {
  330. return "女";
  331. }
  332. },
  333. addRegisterPrice(val) {
  334. this.$refs.register.open(val);
  335. },
  336. editRegisterUser(val) {
  337. this.$refs.register.edit(val);
  338. },
  339. deletePrice(ids) {
  340. this.$http.post(`/product/delete`, ids, (res) => {
  341. // this.$toast.success({message:'成功'});
  342. if (res && res.code == 200) {
  343. this.$message.success("删除成功");
  344. this.searchTarget();
  345. } else {
  346. this.$message.error("删除失败");
  347. }
  348. });
  349. },
  350. handleCurrentChange(val) {
  351. this.pageNum = val;
  352. this.searchList();
  353. },
  354. //根据现有情况进行搜索
  355. searchList() {
  356. // let url =``
  357. this.$http.get(`/product/find/${this.pageNum}/${this.pageSize}`, {}, (res) => {
  358. // console.log(res,'用户测试记录')
  359. if (res && res.code == 200) {
  360. this.tableData = res.data.content;
  361. this.total = res.data.totalElements;
  362. } else {
  363. // this.$toast.fail(res.msg);
  364. this.$message.error(res.msg);
  365. }
  366. });
  367. },
  368. searchTarget() {
  369. this.pageNum = 1;
  370. this.searchList();
  371. },
  372. //跳转首页
  373. goHome() {
  374. this.$router.push({ path: "/home" });
  375. },
  376. //跳转记录页
  377. goRecord() {
  378. this.$router.push({ path: "/record" });
  379. },
  380. //退出登陆
  381. logout() {
  382. oSessionStorage.removeItem("userInfo");
  383. oSessionStorage.removeItem("token");
  384. this.$router.push({ path: "/" });
  385. },
  386. //点击日历获取日期
  387. getDate(param) {
  388. // console.log(param,"日期。。。")
  389. this.userRecord(param.dateStr);
  390. },
  391. //点击获取月出勤次数
  392. getTimes(param) {
  393. this.monthTimes = param;
  394. },
  395. // 用户测试记录显示
  396. userRecord(date) {
  397. this.$http.get(
  398. `gameRecord/findListByUserIdAndDate/${this.userId}/${date}`,
  399. {},
  400. (res) => {
  401. // console.log(res,'用户测试记录')
  402. if (res && res.code == 200) {
  403. this.listData = res.data;
  404. } else {
  405. this.$toast.fail(res.msg);
  406. }
  407. }
  408. );
  409. },
  410. },
  411. };
  412. </script>
  413. <style lang="less" scoped>
  414. @import "../../../styles/theme.less";
  415. .record-warp {
  416. width: 100%;
  417. height: 80vh;
  418. //background: url(../../assets/img/index/19.png) no-repeat center;
  419. //background-size: 100% 100%;
  420. position: relative;
  421. .record-main {
  422. width: 100%;
  423. height: 100%;
  424. box-sizing: border-box;
  425. overflow-y: auto;
  426. .search-head {
  427. width: 100%;
  428. display: flex;
  429. flex-direction: row;
  430. justify-content: flex-start;
  431. align-items: center;
  432. .zc-title {
  433. color: #606266;
  434. font-size: 14px;
  435. }
  436. }
  437. .table-content {
  438. margin: 10px 0;
  439. }
  440. }
  441. }
  442. .add_user_class {
  443. margin-top: 10px;
  444. display: flex;
  445. }
  446. .user_out {
  447. display: flex;
  448. width: 100%;
  449. align-items: center;
  450. border: 1px solid #eeeeef;
  451. line-height: 50px;
  452. margin-top: 10px;
  453. }
  454. .user_out_sub {
  455. flex: 1;
  456. background-color: #fafafa;
  457. text-align: center;
  458. // color:#ffffff
  459. }
  460. .user_out_subNext {
  461. padding-left: 10px;
  462. flex: 3;
  463. }
  464. </style>