list.blade.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. @extends('layouts.base')
  2. @section('title', '商品评论管理')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
  5. <style>
  6. .edit-i{display:none;}
  7. .el-table_1_column_2:hover .edit-i{font-weight:900;padding:0;margin:0;display:inline-block;}
  8. .el-tabs__item,.is-top{font-size:16px}
  9. .el-tabs__active-bar { height: 3px;}
  10. .description .el-form-item__label{line-height:24px}
  11. </style>
  12. <div class="all">
  13. <div id="app" v-cloak>
  14. <div class="vue-nav" style="margin-bottom:15px">
  15. <el-tabs v-model="activeName" @tab-click="handleClick">
  16. <el-tab-pane label="基础设置" name="1"></el-tab-pane>
  17. <el-tab-pane label="评价列表" name="2"></el-tab-pane>
  18. <el-tab-pane label="审核列表" name="3"></el-tab-pane>
  19. </el-tabs>
  20. </div>
  21. <div class="vue-head">
  22. <div class="vue-main-title" style="margin-bottom:20px">
  23. <div class="vue-main-title-left"></div>
  24. <div class="vue-main-title-content">商品评论列表( [[total]] 条)</div>
  25. <div class="vue-main-title-button">
  26. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">新增评论</el-button>
  27. </div>
  28. </div>
  29. <div class="vue-search">
  30. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  31. <el-form-item label="">
  32. <el-input v-model="search_form.keyword" placeholder="商品标题"></el-input>
  33. </el-form-item>
  34. <el-form-item label="">
  35. <el-input v-model="search_form.order_sn" placeholder="订单编号"></el-input>
  36. </el-form-item>
  37. <el-form-item label="">
  38. <el-select v-model="search_form.fade" clearable placeholder="全部评价类型">
  39. <el-option
  40. v-for="(item,index) in options"
  41. :key="item.id"
  42. :label="item.name"
  43. :value="item.id">
  44. </el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item label="">
  48. <el-select v-model="search_form.searchtime" clearable placeholder="是否搜索时间">
  49. <el-option label="不搜索时间" value="0"></el-option>
  50. <el-option label="搜索时间" value="1"></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item label="">
  54. <el-date-picker
  55. v-model="times"
  56. type="datetimerange"
  57. value-format="timestamp"
  58. range-separator="至"
  59. start-placeholder="开始日期"
  60. end-placeholder="结束日期"
  61. style="margin-left:5px;"
  62. align="right">
  63. </el-date-picker>
  64. </el-form-item>
  65. <el-form-item label="">
  66. <el-button type="primary" @click="search(1)">搜索</el-button>
  67. </el-form-item>
  68. </el-form>
  69. </div>
  70. </div>
  71. <div class="vue-main">
  72. <div class="vue-main-form">
  73. <el-table :data="list" style="width: 100%">
  74. <el-table-column label="商品信息">
  75. <template slot-scope="scope">
  76. <div v-if="scope.row.goods" style="display:flex;align-items: center">
  77. <img v-if="scope.row.goods.thumb" :src="scope.row.goods.thumb" onerror="this.src='{{static_url("resource/images/nopic.jpg")}}'; this.title='图片未找到.'" style="width:50px;height:50px"></img>
  78. <div style="margin-left:10px">[[scope.row.goods.title]]</div>
  79. </div>
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="评价者">
  83. <template slot-scope="scope">
  84. <div style="display:flex;align-items: center">
  85. <img v-if="scope.row.head_img_url" :src="scope.row.head_img_url" onerror="this.src='{{static_url("resource/images/nopic.jpg")}}'; this.title='图片未找到.'" style="width:50px;height:50px"></img>
  86. <div style="margin-left:10px">[[scope.row.nick_name]]</div>
  87. </div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="订单编号" align="center">
  91. <template slot-scope="scope">
  92. <div>
  93. <a v-if="scope.row.order_id!=0" @click="orderDetails(scope.row.order_id)">[[scope.row.has_one_order.order_sn]]</a>
  94. </div>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="评分等级" align="center">
  98. <template slot-scope="scope">
  99. <div>
  100. <el-rate v-model="scope.row.level" disabled show-score></el-rate>
  101. </div>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="时间" align="center" prop="created_at"></el-table-column>
  105. <el-table-column label="显示" align="center" width="90">
  106. <template slot-scope="scope">
  107. <el-switch
  108. v-model="scope.row.is_show"
  109. :active-value="1" :inactive-value="0"
  110. active-color="#13ce66"
  111. @change="Switch2(scope,'show')">
  112. </el-switch>
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="置顶" align="center" width="90">
  116. <template slot-scope="scope">
  117. <el-switch
  118. v-model="scope.row.is_top"
  119. :active-value="1" :inactive-value="0"
  120. active-color="#13ce66"
  121. @change="Switch2(scope,'top')">
  122. </el-switch>
  123. </template>
  124. </el-table-column>
  125. <el-table-column prop="refund_time" label="操作" align="center" width="320">
  126. <template slot-scope="scope">
  127. <!-- <el-link v-if="scope.row.uid" type="warning" :underline="false" :href="'{{ yzWebUrl('goods.comment.reply-view', array('id' => '')) }}'+[[scope.row.id]]" class="el-link-edit el-link-edit-middle">
  128. 进行回复
  129. </el-link>
  130. <el-link v-else type="warning" :underline="false" :href="'{{ yzWebUrl('goods.comment.edit-view', array('id' => '')) }}'+[[scope.row.id]]" class="el-link-edit el-link-edit-middle">
  131. 修改评价
  132. </el-link>
  133. <el-link type="warning" :underline="false" :href="'{{ yzWebUrl('goods.comment.edit-view', array('goods_id' => '')) }}'+[[scope.row.goods_id]]" title="添加此商品评论" class="el-link-edit el-link-edit-middle">
  134. 添加评价
  135. </el-link>
  136. <el-link type="warning" :underline="false" @click="del(scope.row.id,scope.$index)" class="el-link-edit el-link-edit-end">
  137. 删除
  138. </el-link> -->
  139. <el-link v-if="scope.row.uid" title="进行回复" :underline="false" :href="'{{ yzWebUrl('goods.comment.reply-view', array('id' => '')) }}'+[[scope.row.id]]" style="width:50px;">
  140. <i class="iconfont icon-supplier_release"></i>
  141. </el-link>
  142. <el-link v-else title="修改评价" :underline="false" :href="'{{ yzWebUrl('goods.comment.edit-view', array('id' => '')) }}'+[[scope.row.id]]" style="width:50px;">
  143. <i class="iconfont icon-ht_operation_edit"></i>
  144. </el-link>
  145. <el-link title="添加评价" :underline="false" :href="'{{ yzWebUrl('goods.comment.edit-view', array('goods_id' => '')) }}'+[[scope.row.goods_id]]" style="width:50px;">
  146. <i class="iconfont icon-ht_operation_add"></i>
  147. </el-link>
  148. <el-link title="删除评论" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
  149. <i class="iconfont icon-ht_operation_delete"></i>
  150. </el-link>
  151. </template>
  152. </el-table-column>
  153. </el-table>
  154. </div>
  155. </div>
  156. <!-- 分页 -->
  157. <div class="vue-page" v-if="total>0">
  158. <el-row>
  159. <el-col align="right">
  160. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  161. :page-size="per_page" :current-page="current_page" background
  162. ></el-pagination>
  163. </el-col>
  164. </el-row>
  165. </div>
  166. </div>
  167. </div>
  168. <script>
  169. var app = new Vue({
  170. el: "#app",
  171. delimiters: ['[[', ']]'],
  172. name: 'test',
  173. data() {
  174. return {
  175. list:[],
  176. change_sort:'',
  177. times:[],
  178. options:[
  179. {id:0,name:'全部评价类型'},
  180. {id:1,name:'真实评价'},
  181. {id:2,name:'模拟评价'},
  182. ],
  183. search_form:{
  184. },
  185. rules: {},
  186. current_page:1,
  187. total:1,
  188. per_page:1,
  189. activeName:'2',
  190. }
  191. },
  192. created() {
  193. },
  194. mounted() {
  195. this.getData(1);
  196. },
  197. methods: {
  198. handleClick(val) {
  199. console.log(val.name)
  200. if(val.name == 1) {
  201. window.location.href = `{!! yzWebFullUrl('goods.comment.index') !!}`;
  202. }
  203. else if(val.name == 2) {
  204. window.location.href = `{!! yzWebFullUrl('goods.comment.list') !!}`;
  205. }
  206. else if(val.name == 3) {
  207. window.location.href = `{!! yzWebFullUrl('goods.comment.audit') !!}`;
  208. }
  209. },
  210. Switch2(scope, type){
  211. let json={
  212. comment_id:scope.row.id,
  213. is_show:scope.row.is_show,
  214. is_top:scope.row.is_top,
  215. type:type,
  216. }
  217. this.$http.post('{!! yzWebFullUrl('goods.comment.changeCommentStatus') !!}',json).then(function (response){
  218. if (response.data.result){
  219. this.$message.success("修改状态成功");
  220. this.searchRecharge(this.current_page)
  221. }
  222. else{
  223. this.$message({message: response.data.msg,type: 'error'});
  224. }
  225. },function (response) {
  226. console.log(response);
  227. this.loading = false;
  228. }
  229. );
  230. },
  231. getData(page) {
  232. // let json = this.;
  233. console.log(this.times);
  234. let json = {
  235. keyword:this.search_form.keyword,
  236. fade:this.search_form.fade,
  237. searchtime:this.search_form.searchtime,
  238. order_sn:this.search_form.order_sn
  239. };
  240. if(this.times && this.times.length>0) {
  241. json.starttime = this.times[0]/1000;
  242. json.endtime = this.times[1]/1000
  243. }
  244. console.log(json)
  245. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  246. this.$http.post('{!! yzWebFullUrl('goods.comment.comment-data') !!}',{page:page,search:json}).then(function(response) {
  247. if (response.data.result) {
  248. this.list = response.data.data.list.data;
  249. this.list.forEach((item,index) => {
  250. if(item.goods) {
  251. item.goods.title = this.escapeHTML(item.goods.title);
  252. }
  253. });
  254. this.current_page=response.data.data.list.current_page;
  255. this.total=response.data.data.list.total;
  256. this.per_page=response.data.data.list.per_page;
  257. loading.close();
  258. } else {
  259. this.$message({
  260. message: response.data.msg,
  261. type: 'error'
  262. });
  263. }
  264. loading.close();
  265. }, function(response) {
  266. this.$message({
  267. message: response.data.msg,
  268. type: 'error'
  269. });
  270. loading.close();
  271. });
  272. },
  273. orderDetails(order_id){
  274. let link = `{!! yzWebFullUrl('order.detail.vue-index') !!}`
  275. link = link + '&id=' + order_id
  276. window.open(link)
  277. },
  278. search(val) {
  279. this.getData(val);
  280. },
  281. // 添加新品牌
  282. addModal() {
  283. let link = `{!! yzWebFullUrl('goods.comment.edit-view') !!}`;
  284. console.log(link);
  285. window.location.href = link;
  286. },
  287. del(id,index) {
  288. console.log(id,index)
  289. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  290. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  291. this.$http.post('{!! yzWebFullUrl('goods.comment.deleted') !!}',{id:id}).then(function (response) {
  292. if (response.data.result) {
  293. this.list.splice(index,1);
  294. this.$message({type: 'success',message: '删除成功!'});
  295. }
  296. else{
  297. this.$message({type: 'error',message: response.data.msg});
  298. }
  299. loading.close();
  300. this.search(this.current_page)
  301. },function (response) {
  302. this.$message({type: 'error',message: response.data.msg});
  303. loading.close();
  304. }
  305. );
  306. }).catch(() => {
  307. this.$message({type: 'info',message: '已取消删除'});
  308. });
  309. },
  310. // 编辑排序
  311. editTitle(index) {
  312. let that = this;
  313. that.change_sort = "";
  314. that.change_sort = that.list[index].display_order;
  315. },
  316. confirmChangeSort(id) {
  317. let that = this;
  318. if (!(/^\d+$/.test(that.change_sort))) {
  319. that.$message.error('请输入正确数字');
  320. return false;
  321. }
  322. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  323. let json = {id: id, sort: that.change_sort};
  324. that.$http.post("{!! yzWebFullUrl('goods.dispatch.sort-v2') !!}", json).then(response => {
  325. console.log(response);
  326. if (response.data.result == 1) {
  327. that.$message.success('操作成功!');
  328. // that.$refs.search_form.click();
  329. if (document.all) {
  330. document.getElementById('app').click();
  331. } else {// 其它浏览器
  332. var e = document.createEvent('MouseEvents')
  333. e.initEvent('click', true, true)
  334. document.getElementById('app').dispatchEvent(e)
  335. }
  336. that.search(this.current_page);
  337. } else {
  338. that.$message.error(response.data.msg);
  339. }
  340. loading.close();
  341. }), function (res) {
  342. console.log(res);
  343. loading.close();
  344. };
  345. },
  346. // 快速修改
  347. changeStatus(id,index,type,value) {
  348. let that = this;
  349. let json = {id: id, type: type, status: value};
  350. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0.2)'});
  351. that.$http.post("{!! yzWebFullUrl('goods.dispatch.quick-edit') !!}", json).then(response => {
  352. console.log(response);
  353. if (response.data.result == 1) {
  354. that.$message.success('操作成功!');
  355. } else {
  356. that.$message.error(response.data.msg);
  357. that.list[index][type] == 1 ? 0 : 1;
  358. }
  359. that.search(this.current_page);
  360. loading.close();
  361. }), function (res) {
  362. console.log(res);
  363. loading.close();
  364. };
  365. },
  366. // 字符转义
  367. escapeHTML(a) {
  368. a = "" + a;
  369. return a.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'");;
  370. },
  371. },
  372. })
  373. </script>
  374. @endsection