combination-list.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. @extends('layouts.base')
  2. @section('title', "组合商品")
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/blind-box/views/admin/index.css')}}">
  5. <style>
  6. /* 导航 */
  7. .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;}
  8. .el-radio-button__inner{border:0;}
  9. .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
  10. </style>
  11. <div class="all">
  12. <div id="app" v-cloak>
  13. <div class="vue-head">
  14. <div class="vue-main-title" style="margin-bottom:20px">
  15. <div class="vue-main-title-left"></div>
  16. <div class="vue-main-title-content">组合商品</div>
  17. <div class="vue-main-title-button">
  18. </div>
  19. </div>
  20. <div class="vue-search">
  21. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  22. <el-form-item label="">
  23. <el-input v-model="search_form.id" placeholder="ID"></el-input>
  24. </el-form-item>
  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="">
  29. <el-button type="primary" @click="search(1)">搜索</el-button>
  30. </el-form-item>
  31. </el-form>
  32. </div>
  33. </div>
  34. <div class="vue-main">
  35. <div>
  36. <div class="vue-main-title" style="margin-bottom:20px">
  37. <div class="vue-main-title-left"></div>
  38. <div class="vue-main-title-content" style="flex:0 0 120px">组合商品列表</div>
  39. <div class="vue-main-title-button">
  40. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">新增组合</el-button>
  41. </div>
  42. </div>
  43. <el-table :data="list" style="width: 100%">
  44. <el-table-column label="ID" align="center" prop="id" width="100"></el-table-column>
  45. <el-table-column label="图片" align="center" prop="combination_img">
  46. <template slot-scope="scope">
  47. <div>
  48. <div><img :src="scope.row.combination_img_src" alt="" style="width:80px;height: 50px;"></div>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="组合名称" align="center" prop="combination_name"></el-table-column>
  53. <el-table-column label="价格" align="center" prop="price"></el-table-column>
  54. <el-table-column label="库存" align="center" prop="stock" ></el-table-column>
  55. <el-table-column label="销量" align="center" prop="sales" ></el-table-column>
  56. <el-table-column prop="refund_time" label="操作" align="center" width="320">
  57. <template slot-scope="scope">
  58. <el-link title="编辑" :underline="false" @click="gotoDetail(scope.row)" style="width:50px;">
  59. <i class="iconfont icon-ht_operation_edit"></i>
  60. </el-link>
  61. <el-link title="删除" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
  62. <i class="iconfont icon-ht_operation_delete"></i>
  63. </el-link>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. </div>
  68. </div>
  69. <!-- 分页 -->
  70. <div class="vue-page" v-if="total>0">
  71. <el-row>
  72. <el-col align="right">
  73. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  74. :page-size="per_page" :current-page="current_page" background
  75. ></el-pagination>
  76. </el-col>
  77. </el-row>
  78. </div>
  79. </div>
  80. </div>
  81. <script>
  82. var app = new Vue({
  83. el: "#app",
  84. delimiters: ['[[', ']]'],
  85. name: 'test',
  86. data() {
  87. return {
  88. order_type:'1',
  89. search_form:{
  90. name:"",
  91. id:""
  92. },
  93. list:[],
  94. rules: {},
  95. current_page:1,
  96. total:1,
  97. per_page:1,
  98. }
  99. },
  100. created() {
  101. },
  102. mounted() {
  103. this.getData(1);
  104. },
  105. methods: {
  106. getData(page) {
  107. let json = {
  108. page: page,
  109. search: {
  110. name:this.search_form.name,
  111. id:this.search_form.id,
  112. },
  113. };
  114. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  115. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.combination.combination-list') !!}',json).then(function(response) {
  116. if (response.data.result) {
  117. console.log(response.data.data);
  118. this.list = response.data.data.data;
  119. this.current_page=response.data.data.current_page;
  120. this.total=response.data.data.total;
  121. this.per_page=response.data.data.per_page;
  122. loading.close();
  123. } else {
  124. this.$message({
  125. message: response.data.msg,
  126. type: 'error'
  127. });
  128. }
  129. loading.close();
  130. }, function(response) {
  131. this.$message({
  132. message: response.data.msg,
  133. type: 'error'
  134. });
  135. loading.close();
  136. });
  137. },
  138. gotoDetail(item) {
  139. let link = `{!! yzWebFullUrl('plugin.blind-box.admin.combination.edit') !!}`+`&id=`+item.id;
  140. window.location.href = link;
  141. },
  142. search(val) {
  143. this.getData(val);
  144. },
  145. addModal() {
  146. let link = `{!! yzWebFullUrl('plugin.blind-box.admin.combination.add') !!}`;
  147. window.location.href = link;
  148. },
  149. del(id,index) {
  150. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  151. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  152. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.combination.del') !!}',{id:id}).then(function (response) {
  153. if (response.data.result) {
  154. this.list.splice(index,1);
  155. this.$message({type: 'success',message: '删除成功!'});
  156. }
  157. else{
  158. this.$message({type: 'error',message: response.data.msg});
  159. }
  160. loading.close();
  161. this.search(this.current_page)
  162. },function (response) {
  163. this.$message({type: 'error',message: response.data.msg});
  164. loading.close();
  165. }
  166. );
  167. }).catch(() => {
  168. this.$message({type: 'info',message: '已取消删除'});
  169. });
  170. },
  171. gotoOther(type) {
  172. let url = ""
  173. if(type==1) {
  174. //url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-list') !!}'
  175. }
  176. else if(type==2) {
  177. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.banner') !!}'
  178. }
  179. else if(type==3) {
  180. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.three-advert-list') !!}'
  181. }
  182. else if(type==4) {
  183. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.two-advert-list') !!}'
  184. }
  185. else if(type==5) {
  186. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-list') !!}'
  187. }
  188. if(url) {
  189. window.location.href=url
  190. }
  191. },
  192. // 字符转义
  193. escapeHTML(a) {
  194. a = "" + a;
  195. return a.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'");;
  196. },
  197. editStatus(id,index){
  198. let json = {
  199. id:id,
  200. }
  201. json.status = this.list[index].is_show;
  202. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  203. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.slide.edit-slide-status') !!}',json).then(function (response) {
  204. if (response.data.result){
  205. this.$message.success("操作成功");
  206. this.search(this.current_page);
  207. }
  208. else {
  209. this.$message.error( response.data.msg );
  210. }
  211. loading.close();
  212. },function (response) {
  213. this.$message.error(response.data.msg);
  214. loading.close();
  215. }
  216. );
  217. },
  218. },
  219. })
  220. </script>
  221. @endsection