consult.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <style lang="scss">
  2. .del{
  3. display: inline-block;
  4. vertical-align: top;
  5. font-size: 28px;
  6. font-weight: 500;
  7. margin-left: 10px;
  8. color: #000;
  9. cursor: pointer;
  10. }
  11. .el-badge__content.is-fixed{
  12. top:10px;
  13. right: -10px;
  14. }
  15. .el-table tr{
  16. height: 45px;
  17. }
  18. .replyDiag{
  19. .consutlList{
  20. padding:20px;
  21. border:1px solid #ccc;
  22. height: 350px;
  23. overflow: scroll;
  24. }
  25. .el-dialog__body{
  26. padding:10px 20px!important;
  27. }
  28. .el-row{
  29. margin-bottom:15px;
  30. }
  31. }
  32. </style>
  33. <template>
  34. <section class="content data">
  35. <h4>顽主咨询</h4>
  36. <el-divider></el-divider>
  37. <el-form label-width="80px" class="filter-form">
  38. <el-row>
  39. <el-col :span="3">
  40. <el-form-item label="选手名字">
  41. <el-input clearable @clear="getData()" v-model="queryParams.username" placeholder="请输入选手名字/代码" size="mini"></el-input>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :span="4">
  45. <el-form-item style="margin-left:10px;" label-width="10">
  46. <el-button type="primary" @click="getData" size="mini">筛选</el-button>
  47. <el-button type="normal" @click="queryParams={},getData()" size="mini">重置</el-button>
  48. </el-form-item>
  49. </el-col>
  50. </el-row>
  51. <el-row :gutter="10">
  52. <el-col :span="6"></el-col>
  53. </el-row>
  54. </el-form>
  55. <el-table :data="list" height='55vh' style="width: 100%;margin-top:10px;" v-loading='loading'>
  56. <el-table-column prop="user_name" label="选手名称" width="200"/>
  57. <el-table-column prop="content" label="咨询内容">
  58. <template slot-scope="scope">
  59. <el-badge v-if="scope.row.unreply>0" :value="scope.row.unreply" class="item">
  60. <p style="font-size:18px;">{{scope.row.last_content}}</p>
  61. </el-badge>
  62. <p v-else style="font-size:18px;">{{scope.row.last_content}}</p>
  63. </template>
  64. </el-table-column>
  65. <el-table-column prop="reply_content" label="回复内容">
  66. <template slot-scope="scope">
  67. <p v-if="scope.row.unreply==0" style="font-size:18px;">{{scope.row.last_reply_content}}</p>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="ctime" label="咨询时间" width="250">
  71. <template slot-scope="scope">
  72. {{scope.row.ctime}}
  73. </template>
  74. </el-table-column>
  75. <el-table-column prop="date" label="操作" fixed="right" width="220">
  76. <template slot-scope="scope">
  77. <el-button @click="edit(scope.row)" size="mini" type="primary">回复</el-button>
  78. <el-button @click="del(scope.row.user_id)" size="mini" type="danger">删除</el-button>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <Page
  83. ref="pageButton"
  84. :current="form.page"
  85. :page_size="form.page_size"
  86. :total="total"
  87. @pageChange="gopage"
  88. />
  89. <!-- 回复 -->
  90. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body class="replyDiag">
  91. <div class="consutlList">
  92. <el-row :gutter="1" v-for="(item,index) in form.all_consult_list" :key="index">
  93. <el-col :span="3" v-if="item.user_id>0"><img :src="item.user_avatar" alt="" width="45px" height="45px" style="border-radius:5px;"/></el-col>
  94. <el-col :span="20" v-if="item.user_id>0"><p style="padding-left:5px;font-size:18px;">{{item.content}}</p></el-col>
  95. <el-col :span="20" v-if="item.user_id==0"><p style="padding-right:10px;text-align:right;font-size:18px;">{{item.reply_content}}</p></el-col>
  96. <el-col :span="3" v-if="item.user_id==0"><img src="..\..\assets\wz.jpg" alt="" width="45px" height="45px" style="border-radius:5px;"/></el-col>
  97. </el-row>
  98. </div>
  99. <div slot="footer" class="dialog-footer">
  100. <el-form ref="form" :model="form" label-width="80px">
  101. <el-row :gutter="10">
  102. <el-col :span="20">
  103. <el-input v-model="form.reply_content" type="textarea" rows="5" placeholder="请输入你要回复的内容..."></el-input>
  104. </el-col>
  105. <el-col :span="4">
  106. <el-button type="primary" @click="submitForm">发送</el-button>
  107. </el-col>
  108. </el-row>
  109. </el-form>
  110. </div>
  111. </el-dialog>
  112. </section>
  113. </template>
  114. <script>
  115. import Page from "../../components/Page";
  116. export default {
  117. components: {
  118. Page,
  119. },
  120. data(){
  121. return{
  122. loading:false,
  123. queryParams:{
  124. match_id:0,
  125. page:1,
  126. stock_date:this.getNowDate()
  127. },
  128. form:{
  129. stock_date:this.getNowDate(),
  130. page:1,
  131. page_size:20,
  132. consult_list:[],
  133. all_consult_list:[]
  134. },
  135. form1:{},
  136. list:[{},{}],
  137. total:0,
  138. title:'新增用户',
  139. open:false,
  140. open1:false,
  141. rules:{
  142. match_id: [
  143. { required: true, message: '请选择比赛', trigger: 'change' }
  144. ],
  145. player_id: [
  146. { required: true, message: '请输入用户代码', trigger: 'blur' }
  147. ],
  148. stock_date: [
  149. { required: true, message: '请选择持仓日期', trigger: 'blur' }
  150. ],
  151. today_fund: [
  152. { required: true, message: '请输入今日资产', trigger: 'blur' }
  153. ],
  154. is_markt: [
  155. { required: false, message: '请选择', trigger: 'change' }
  156. ]
  157. },
  158. matchList:[],
  159. playerList:[],
  160. groupList:[],
  161. stockList:[],
  162. missDayList:[
  163. {id:0,name:"否"},
  164. {id:1,name:"是"}
  165. ],
  166. orderStatusList:[
  167. {id:0,name:"未支付"},
  168. {id:1,name:"已支付"}
  169. ],
  170. signupTypeList:[
  171. {id:1,name:"选手"},
  172. {id:2,name:"游客"}
  173. ]
  174. }
  175. },
  176. methods:{
  177. updateRank(){
  178. this.loading = true
  179. this.$api.updateRank(this.queryParams).then((res)=>{
  180. this.loading = false
  181. this.$message({
  182. message: "更新成功!",
  183. type: "success",
  184. });
  185. })
  186. },
  187. getNowDate(){
  188. var y=new Date().getFullYear()
  189. var m=Number(new Date().getMonth() + 1)
  190. var d = new Date().getDate()
  191. m=m>9?m:'0'+m;
  192. d=d>9?d:'0'+d
  193. return y+'-'+m+'-'+d;
  194. },
  195. autoCompleteData(){
  196. this.loading = true
  197. this.$api.autoCompleteData(this.queryParams).then((res)=>{
  198. this.getData();
  199. this.loading = false;
  200. })
  201. },
  202. downloadExcel(){
  203. this.$api.downloadRecords(this.queryParams).then((res)=>{
  204. var elink = document.createElement('a');
  205. let blob=new Blob([res.data], {type: 'application/vnd.ms-excel,charset=UTF-8'});
  206. let objUrl=URL.createObjectURL(blob);
  207. let file_name=decodeURIComponent(res.headers['content-disposition'].split('=')[1]);
  208. console.log(file_name)
  209. elink.download = "参赛数据";
  210. elink.style.display = 'none';
  211. elink.href = objUrl;
  212. document.body.appendChild(elink);
  213. elink.click();
  214. document.body.removeChild(elink);
  215. this.download_loading = false;
  216. })
  217. },
  218. del(id) {
  219. this.$confirm("确定删除吗?", "提示", {
  220. type: "warning",
  221. }).then(() => {
  222. this.$api.delConsult({ id: id }).then((res) => {
  223. this.$message({
  224. message: "删除成功",
  225. type: "success",
  226. });
  227. this.getData();
  228. });
  229. });
  230. },
  231. gopage(size) {
  232. if (size) {
  233. this.queryParams.page_size = size;
  234. }
  235. this.queryParams.page = this.$refs.pageButton.page;
  236. this.getData();
  237. },
  238. getData(){
  239. this.loading = true;
  240. this.$api.getWanzhuConsultList(this.queryParams).then(res=>{
  241. this.list=res.data.data.list
  242. this.total = res.data.data.total;
  243. this.loading = false;
  244. })
  245. },
  246. edit(row){
  247. this.title = "回复:"+row.user_name
  248. this.open = true
  249. this.form = row
  250. },
  251. editComment(id){
  252. this.title = "顽主点评"
  253. this.$api.getRecordInfo({id:id}).then(res=>{
  254. this.form1 = res.data.data
  255. this.open1 = true
  256. })
  257. },
  258. saveComment(){
  259. this.$api.updateComment({id:this.form1.id,wanzhu_comment:this.form1.wanzhu_comment}).then(response => {
  260. if(response.data.code != 0){
  261. this.msgError(response.data.message);
  262. return
  263. }
  264. this.msgSuccess("修改成功");
  265. this.open1 = false;
  266. this.getData();
  267. });
  268. },
  269. handleAdd(){
  270. this.open=true;
  271. this.title='新增数据';
  272. this.form={
  273. match_id:this.matchList[0].id,
  274. today_stock:[{code: "", name:"",fund:''}],
  275. today_stock_img:[],
  276. stock_date:this.getNowDate()
  277. }
  278. },
  279. addCode(){
  280. this.form.today_stock.push({code: "", name:"",fund:''})
  281. },
  282. handleSuccess(res, file) {
  283. console.log(res)
  284. this.form.today_stock_img.push(res.data.url);
  285. },
  286. triggerClick(){
  287. document.onkeyup = e =>{
  288. // 为了更加严谨所以添加了路由路径的判断
  289. if (e.keyCode === 13) {
  290. //回车后执行搜索方法
  291. this.submitForm()
  292. }
  293. }
  294. },
  295. /** 提交按钮 */
  296. submitForm() {
  297. this.$refs["form"].validate(valid => {
  298. if (valid) {
  299. this.form.pid = this.form.consult_list[this.form.consult_list.length-1].id;
  300. this.$api.replyConsult(this.form).then(response => {
  301. if(response.data.code != 0){
  302. this.msgError(response.data.message);
  303. return
  304. }
  305. this.msgSuccess("回复成功!");
  306. this.open = false;
  307. this.getData();
  308. });
  309. }
  310. });
  311. },
  312. },
  313. created(){
  314. this.$api.getMatchList().then(res=>{
  315. this.matchList=res.data.data
  316. this.queryParams.match_id = this.matchList[0].id
  317. this.getData()
  318. })
  319. this.triggerClick()
  320. }
  321. }
  322. </script>