equity.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. @extends('layouts.base')
  2. @section('title', "订单列表")
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/aggregation-cps/static/index.css')}}">
  5. <style>
  6. .el-table_1_column_2:hover .edit-i{font-weight:900;padding:0;margin:0;display:inline-block;}
  7. .list-title .list-title-1{display:flex;align-items:center;justify-content: center;}
  8. .el-radio-button .el-radio-button__inner,.el-radio-button:first-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;border-left: 0px;}
  9. .el-radio-button__inner{border:0;}
  10. .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
  11. </style>
  12. <div class="all">
  13. <div id="app" v-cloak>
  14. <div class="vue-crumbs">
  15. {!! (defined('CPS_PLUGIN_NAME') ? CPS_PLUGIN_NAME : '聚合CPS') !!} > 品牌券
  16. </div>
  17. <div class="vue-head">
  18. <el-radio-group v-model="search_form.category_id" @change="search(1)">
  19. <el-radio-button v-for="(item,index) in category" :key="item.label" v-if="category" :label="item.b_id" :name="item.b_id">[[item.name]]</el-radio-button>
  20. </el-radio-group>
  21. </div>
  22. <div class="vue-head">
  23. <div class="vue-search" id="loading1">
  24. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  25. <el-form-item label="">
  26. <el-input v-model="search_form.name" placeholder="分类名称"></el-input>
  27. </el-form-item>
  28. <el-form-item label="" prop="is_hot">
  29. <el-checkbox v-model="search_form.is_hot" :active-value="1" :inactive-value="0">热门</el-checkbox>
  30. </el-form-item>
  31. <el-button type="primary" @click="search(1)">搜索</el-button>
  32. <el-button type="primary" @click="updateCategory">刷新分类</el-button>
  33. <el-button type="primary" @click="updateBrand">刷新品牌</el-button>
  34. <el-button type="primary" @click="updateGoods">刷新商品</el-button>
  35. </el-form>
  36. </div>
  37. </div>
  38. <div class="vue-main">
  39. <div class="vue-main-form">
  40. <div class="vue-main-title" style="margin-bottom:20px">
  41. <div class="vue-main-title-left"></div>
  42. <div class="vue-main-title-content" style="flex:0 0 160px">品牌列表</div>
  43. </div>
  44. <el-table :data="list" style="width: 100%">
  45. <el-table-column label="品牌ID" align="center" prop="b_id">
  46. </el-table-column>
  47. <el-table-column label="品牌名称" align="center" prop="name">
  48. </el-table-column>
  49. <el-table-column label="品牌logo" align="center" prop="logo">
  50. <template slot-scope="scope">
  51. <div>
  52. <div v-if="scope.row.logo">
  53. <el-image :src="scope.row.logo" alt="" style="width:40px;height:40px;"></el-image>
  54. </div>
  55. </div>
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="品牌描述" align="center" prop="description" >
  59. </el-table-column>
  60. <el-table-column label="前端显示" align="center" width="80">
  61. <template slot-scope="scope">
  62. <div>
  63. <el-tooltip placement="top">
  64. <div slot="content">[[scope.row.show_state==1?'显示':'隐藏']]</div>
  65. <el-switch v-model="scope.row.show_state" @change="changeShow(scope.row.id,scope.row.show_state)" :active-value="1" :inactive-value="0"></el-switch>
  66. </el-tooltip>
  67. </div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="热门" align="center" width="80">
  71. <template slot-scope="scope">
  72. <div>
  73. <el-tooltip placement="top">
  74. <div slot="content">[[scope.row.is_hot==1?'显示':'隐藏']]</div>
  75. <el-switch v-model="scope.row.is_hot" @change="changeHot(scope.row.id,scope.row.is_hot)" :active-value="1" :inactive-value="0"></el-switch>
  76. </el-tooltip>
  77. </div>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. </div>
  82. </div>
  83. <!-- 分页 -->
  84. <div class="vue-page" v-if="total>0">
  85. <el-row>
  86. <el-col align="right">
  87. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  88. :page-size="per_page" :current-page="current_page" background
  89. ></el-pagination>
  90. </el-col>
  91. </el-row>
  92. </div>
  93. </div>
  94. </div>
  95. <script>
  96. var app = new Vue({
  97. el: "#app",
  98. delimiters: ['[[', ']]'],
  99. name: 'test',
  100. data() {
  101. return {
  102. activeName:'2',
  103. list:[],
  104. count:{},
  105. change_sort:'',
  106. category:[],
  107. data:"",
  108. areaLoading:false,
  109. search_form:{
  110. category:'',
  111. name:''
  112. },
  113. rules: {},
  114. current_page:1,
  115. total:1,
  116. per_page:1,
  117. }
  118. },
  119. created() {
  120. },
  121. mounted() {
  122. this.getData(1);
  123. },
  124. methods: {
  125. getData(page) {
  126. let json = {
  127. page:page,
  128. };
  129. json.search = this.search_form;
  130. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  131. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.equity.get-data') !!}',json).then(function(response) {
  132. if (response.data.result) {
  133. this.list = response.data.data.brand.data;
  134. this.current_page=response.data.data.brand.current_page;
  135. this.total=response.data.data.brand.total;
  136. this.per_page=response.data.data.brand.per_page;
  137. this.category=response.data.data.category;
  138. loading.close();
  139. } else {
  140. this.$message({
  141. message: response.data.msg,
  142. type: 'error'
  143. });
  144. }
  145. loading.close();
  146. }, function(response) {
  147. this.$message({
  148. message: response.data.msg,
  149. type: 'error'
  150. });
  151. loading.close();
  152. });
  153. },
  154. search(val) {
  155. this.getData(val);
  156. },
  157. changeShow(id, is_show) {
  158. let loading = this.$loading({
  159. target: document.querySelector(".content"),
  160. background: 'rgba(0, 0, 0, 0)'
  161. });
  162. let url = `{!! yzWebFullUrl('plugin.aggregation-cps.admin.equity.changeShow') !!}`;
  163. this.$http.post(url, {id: id, show_state: is_show}).then(function (response) {
  164. if (response.data.result) {
  165. this.$message({type: 'success', message: '操作成功!'});
  166. } else {
  167. this.$message({type: 'error', message: response.data.msg});
  168. }
  169. loading.close();
  170. this.search(this.current_page);
  171. }, function (response) {
  172. this.$message({type: 'error', message: response.data.msg});
  173. loading.close();
  174. })
  175. },
  176. // 设置显不显示
  177. changeHot(id,is_hot) {
  178. let json = {
  179. id:id,
  180. is_hot:is_hot,
  181. }
  182. let url = `{!! yzWebFullUrl('plugin.aggregation-cps.admin.equity.is-hot') !!}`;
  183. console.log(json);
  184. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  185. this.$http.post(url,json).then(function (response) {
  186. if (response.data.result) {
  187. this.$message({type: 'success',message: '操作成功!'});
  188. }
  189. else{
  190. this.$message({type: 'error',message: response.data.msg});
  191. }
  192. loading.close();
  193. this.search(this.current_page);
  194. },function (response) {
  195. this.$message({type: 'error',message: response.data.msg});
  196. loading.close();
  197. })
  198. },
  199. updateCategory() {
  200. let loading = this.$loading({target:document.querySelector("#loading"),background: 'rgba(0, 0, 0, 0)'});
  201. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.equity.category') !!}',{id:this.id}).then(function (response) {
  202. if (response.data.result){
  203. this.$message({message: response.data.msg,type: 'success'});
  204. }
  205. else {
  206. this.$message({message: response.data.msg,type: 'error'});
  207. }
  208. loading.close();
  209. location.reload();
  210. },function (response) {
  211. this.$message({message: response.data.msg,type: 'error'});
  212. loading.close();
  213. }
  214. );
  215. },
  216. updateBrand() {
  217. let loading = this.$loading({target:document.querySelector("#loading"),background: 'rgba(0, 0, 0, 0)'});
  218. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.equity.brand') !!}',{id:this.id}).then(function (response) {
  219. if (response.data.result){
  220. this.$message({message: response.data.msg,type: 'success'});
  221. }
  222. else {
  223. this.$message({message: response.data.msg,type: 'error'});
  224. }
  225. loading.close();
  226. location.reload();
  227. },function (response) {
  228. this.$message({message: response.data.msg,type: 'error'});
  229. loading.close();
  230. }
  231. );
  232. },
  233. updateGoods() {
  234. let loading = this.$loading({target:document.querySelector("#loading1"),background: 'rgba(0, 0, 0, 0)'});
  235. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.equity.update-goods') !!}',{id:this.id}).then(function (response) {
  236. if (response.data.result){
  237. this.$message({message: response.data.msg,type: 'success'});
  238. }
  239. else {
  240. this.$message({message: response.data.msg,type: 'error'});
  241. }
  242. loading.close();
  243. location.reload();
  244. },function (response) {
  245. this.$message({message: response.data.msg,type: 'error'});
  246. loading.close();
  247. }
  248. );
  249. },
  250. // 字符转义
  251. escapeHTML(a) {
  252. a = "" + a;
  253. return a.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'");;
  254. },
  255. },
  256. })
  257. </script>
  258. @endsection