index.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('order-comments/component/com-edit-template', dirname(__DIR__));
  4. ?>
  5. <style>
  6. .table-body {
  7. padding: 20px;
  8. background-color: #fff;
  9. }
  10. .input-item {
  11. display: inline-block;
  12. width: 350px;
  13. margin: 0 0 20px;
  14. }
  15. .input-item .el-input-group__prepend {
  16. background-color: #fff;
  17. }
  18. .input-item .el-input__inner {
  19. border-right: 0;
  20. }
  21. .input-item .el-input__inner:hover {
  22. border: 1px solid #dcdfe6;
  23. border-right: 0;
  24. outline: 0;
  25. }
  26. .input-item .el-input__inner:focus {
  27. border: 1px solid #dcdfe6;
  28. border-right: 0;
  29. outline: 0;
  30. }
  31. .input-item .el-input-group__append {
  32. background-color: #fff;
  33. border-left: 0;
  34. width: 10%;
  35. padding: 0;
  36. }
  37. .input-item .el-input-group__append .el-button {
  38. padding: 15px;
  39. }
  40. .label-text {
  41. height: 32px;
  42. margin-right: 10px;
  43. }
  44. .select {
  45. float: left;
  46. width: 100px;
  47. margin-right: 10px;
  48. }
  49. .table .el-button {
  50. padding: 0 !important;
  51. border: 0;
  52. margin: 0 5px;
  53. }
  54. .goods-info div {
  55. height: 50px;
  56. line-height: 50px;
  57. white-space: nowrap;
  58. overflow: hidden;
  59. text-overflow: ellipsis;
  60. }
  61. .open-img .el-dialog {
  62. margin-top: 0 !important;
  63. }
  64. .click-img {
  65. width: 100%;
  66. }
  67. .input-item .el-input-group__append .el-button {
  68. padding: 0;
  69. }
  70. .input-item .el-input-group__append .el-button {
  71. margin: 0;
  72. }
  73. .text {
  74. cursor: pointer;
  75. color: #419EFB;
  76. }
  77. </style>
  78. <div id="app" v-cloak>
  79. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  80. <div slot="header">
  81. <div flex="cross:center box:first">
  82. <div><span @click="$navigate({r:'mall/order-comments/index'})" class="text">评价管理</span>/回复模板</div>
  83. <div flex="dir:right">
  84. <div>
  85. <el-button type="primary" size="small"
  86. @click="openDialog(null, templateVisible = true)">添加模板
  87. </el-button>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="table table-body">
  93. <div flex="dir:left">
  94. <div flex="cross:center" class="label-text">模板类型</div>
  95. <el-select size="small" v-model="type" class="select" @change="change">
  96. <el-option key="-1" label="全部回复" :value="-1"></el-option>
  97. <el-option key="1" label="好评" :value="1"></el-option>
  98. <el-option key="2" label="中评" :value="2"></el-option>
  99. <el-option key="3" label="差评" :value="3"></el-option>
  100. </el-select>
  101. <div class="input-item">
  102. <el-input @keyup.enter.native="change" size="small" placeholder="请输入搜索内容" v-model="keyword" clearable
  103. @clear="change">
  104. <el-select size="small" v-model="keyword_name" slot="prepend" class="select">
  105. <el-option key="1" label="模板名称" value="title"></el-option>
  106. <el-option key="2" label="ID" value="id"></el-option>
  107. </el-select>
  108. <el-button slot="append" icon="el-icon-search" @click="change"></el-button>
  109. </el-input>
  110. </div>
  111. </div>
  112. <el-table :data="list" border v-loading="listLoading">
  113. <el-table-column prop="id" label="ID" width="80"></el-table-column>
  114. <el-table-column prop="title" label="模板名称" width="180"></el-table-column>
  115. <el-table-column prop="content" label="模板内容"></el-table-column>
  116. <el-table-column label="模板类型" width="120">
  117. <template slot-scope="scope">
  118. <span v-if="scope.row.type == 1">好评回复</span>
  119. <span v-if="scope.row.type == 2">中评回复</span>
  120. <span v-if="scope.row.type == 3">差评回复</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="操作" width="220">
  124. <template slot-scope="scope">
  125. <el-button size="small" type="text"
  126. @click="openDialog(scope.row, templateVisible = true)" circle>
  127. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  128. <img src="resources/img/mall/edit.png" alt="">
  129. </el-tooltip>
  130. </el-button>
  131. <el-button size="small" type="text" @click="destroy(scope.row)" circle>
  132. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  133. <img src="resources/img/mall/del.png" alt="">
  134. </el-tooltip>
  135. </el-button>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. <div style="text-align: right;margin: 20px 0;">
  140. <el-pagination @current-change="pagination" background layout="prev, pager, next"
  141. :page-count="pageCount"></el-pagination>
  142. </div>
  143. </div>
  144. <com-edit-template
  145. @close="dialogClose"
  146. @submit="dialogSubmit"
  147. :is-show="templateVisible"
  148. :template="template">
  149. </com-edit-template>
  150. </el-card>
  151. </div>
  152. <script>
  153. const app = new Vue({
  154. el: '#app',
  155. data() {
  156. return {
  157. list: [],
  158. pageCount: 0,
  159. listLoading: false,
  160. type: -1,
  161. keyword: '',
  162. keyword_name: 'title',
  163. btnLoading: false,
  164. template: null,
  165. templateVisible: false,
  166. };
  167. },
  168. methods: {
  169. pagination(currentPage) {
  170. this.page = currentPage;
  171. this.search();
  172. },
  173. change() {
  174. this.page = 1;
  175. this.search();
  176. },
  177. search() {
  178. this.listLoading = true;
  179. request({
  180. params: {
  181. r: 'mall/order-comment-templates/index',
  182. page: this.page,
  183. type: this.type,
  184. keyword: this.keyword,
  185. keyword_name: this.keyword_name,
  186. },
  187. }).then(e => {
  188. if (e.data.code === 0) {
  189. this.list = e.data.data.list;
  190. this.pageCount = e.data.data.page_count;
  191. } else {
  192. this.$message.error(e.data.msg);
  193. }
  194. this.listLoading = false;
  195. }).catch(e => {
  196. this.listLoading = false;
  197. });
  198. },
  199. //删除
  200. destroy: function (column) {
  201. this.$confirm('确认删除该记录吗?', '提示', {
  202. type: 'warning'
  203. }).then(() => {
  204. request({
  205. params: {
  206. r: 'mall/order-comment-templates/destroy'
  207. },
  208. data: {id: column.id},
  209. method: 'post'
  210. }).then(e => {
  211. if (e.data.code === 0) {
  212. this.$message.success(e.data.msg)
  213. this.search();
  214. } else {
  215. this.$message.error(e.data.msg)
  216. }
  217. }).catch(e => {
  218. });
  219. });
  220. },
  221. openDialog(template) {
  222. this.template = template;
  223. },
  224. dialogClose() {
  225. this.templateVisible = false;
  226. },
  227. dialogSubmit() {
  228. this.search();
  229. },
  230. },
  231. mounted: function () {
  232. this.search();
  233. }
  234. });
  235. </script>