topicList.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. @extends('layouts.base')
  2. @section('title', '选品专题')
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/store-cashier/src/common/static/index.css')}}">
  5. <style>
  6. .top-category {
  7. margin: 10px;
  8. }
  9. .el-radio-button__inner {
  10. min-width: 83px;
  11. }
  12. .special-goods {
  13. margin: 10px;
  14. }
  15. .special-goods .special-pane {
  16. /* display: flex;
  17. justify-content: space-between;
  18. flex-wrap: wrap; */
  19. display: grid;
  20. grid-column-gap: 10px;
  21. grid-template-columns: 1fr 1fr 1fr;
  22. }
  23. .special-card {
  24. /* width: 32.8%; */
  25. background: white;
  26. padding-top: 10px;
  27. border-radius: 10px;
  28. margin-bottom: 15px;
  29. display: flex;
  30. flex-direction: column;
  31. justify-content: space-between;
  32. }
  33. .top , .middle-img , .copywriting {
  34. padding: 0 15px;
  35. word-break: break-all;
  36. text-overflow: ellipsis;
  37. display: -webkit-box;
  38. -webkit-box-orient: vertical;
  39. -webkit-line-clamp: 2;
  40. overflow: hidden;
  41. min-height: 42px;
  42. }
  43. .special-card .top {
  44. display: flex;
  45. justify-content: space-between;
  46. }
  47. .special-card .applet {
  48. background: #deb547;
  49. color: white;
  50. padding: 3px 8px;
  51. border-radius: 5px;
  52. margin-right: 5px;
  53. min-width: 58px;
  54. text-align: center;
  55. }
  56. .special-card .left {
  57. display: flex;
  58. height: fit-content;
  59. align-items: center;
  60. width: 75%;
  61. flex-wrap: wrap;
  62. }
  63. .special-card .special-name {
  64. font-size: 15px;
  65. word-break: break-all;
  66. text-overflow: ellipsis;
  67. display: -webkit-box;
  68. -webkit-box-orient: vertical;
  69. -webkit-line-clamp: 1;
  70. overflow: hidden;
  71. max-width: 50%;
  72. }
  73. .special-card .right-type {
  74. color: #72b59d;
  75. line-height: 27px;
  76. }
  77. .special-card .middle-img {
  78. display: flex;
  79. width: 100%;
  80. justify-content: space-around;
  81. }
  82. .hava-img {
  83. display: flex;
  84. width: 100%;
  85. justify-content: space-between;
  86. }
  87. .middle-img-active {
  88. /* height: 152px !important;
  89. width: 152px !important; */
  90. }
  91. .special-card .middle-img img {
  92. height: fit-content;
  93. width: 32%;
  94. }
  95. .special-card .copywriting {
  96. margin: 10px;
  97. font-weight: bold;
  98. }
  99. .bottom-pane {
  100. border-top: 1px solid #bbbbbb;
  101. display: flex;
  102. justify-content: space-evenly;
  103. align-items: center;
  104. }
  105. .bottom-pane .detail {
  106. color: #79b9a2;
  107. font-weight: 500;
  108. font-size: 16px;
  109. margin: 10px;
  110. cursor: pointer;
  111. }
  112. .bottom-pane .line {
  113. width: 1px;
  114. height: 50px;
  115. background: #bbb;
  116. }
  117. </style>
  118. <div class="all">
  119. <div id="app" v-cloak>
  120. <div class="vue-crumbs">
  121. 聚合供应链专题 > 选品专题
  122. </div>
  123. <div class="vue-head">
  124. <div class="top-category">
  125. <span>分类:</span>
  126. <el-radio-group v-model="search_form.cate" @change="getData(1)">
  127. <el-radio-button :label="item" v-for="(item,index) in cate" :key="index">[[item]]</el-radio-button>
  128. </el-radio-group>
  129. </div>
  130. <div class="top-category top-type">
  131. <span>类型:</span>
  132. <el-radio-group v-model="search_form.type" @change="getData(1)">
  133. <el-radio-button :label="item.value" v-for="(item,index) in type" :key="index">[[item.name]]</el-radio-button>
  134. </el-radio-group>
  135. </div>
  136. <div style="margin-left: 3.5em">
  137. <p>导入专题页面后,在装修DIY插件--店铺页面中生成专题页面,自动导入专题包含的商品(根据基础设置定价策略导入,注意设置好定价策略);复制页面可直接用于推广。</p>
  138. <p>详情:可以查看专题banner(用于装修、广告等场景引导用户点击进入专题),海报背景图(使用新海报插件设计专题推广海报、用户分享海报跳转专题页);</p>
  139. <p>相关商品:查看该专题包含的商品信息。</p>
  140. </div>
  141. </div>
  142. <div class="special-goods">
  143. <div class="special-pane">
  144. <div class="special-card" v-for="(item,index) in list" :key="index">
  145. <div>
  146. <div class="top">
  147. <div class="left">
  148. <span class="applet">[[item.type]]</span>
  149. <b class="special-name">[[item.name]]</b>
  150. <b>&nbsp;([[item.example.count]]款)</b>
  151. </div>
  152. <b class="right-type">[[item.cate]]</b>
  153. </div>
  154. <div class="middle-img">
  155. <div v-if="item.example.cover.length" class="hava-img"><img :src="item" v-for="(item,index) in item.example.cover" :key="index" ></div>
  156. <img src="{!! request()->getSchemeAndHttpHost().plugin_assets('jd-supply', 'assent/image/space.png') !!}" v-if="!item.example.cover.length" v-for="(UrlItem,UrlIndex) in 3" :key="UrlIndex">
  157. </div>
  158. <p class="copywriting" v-html="item.promote"></p>
  159. </div>
  160. <div class="bottom-pane">
  161. <span class="detail" @click="goDetail(item)">详情</span>
  162. <span class="line"></span>
  163. <span class="detail" @click="goGoods(item)">相关商品</span>
  164. <span class="line"></span>
  165. <span class="detail" @click="update(item)" v-if="item.is_import && item.is_update">更新</span>
  166. <span class="detail" @click="del(item)" v-if="!item.is_import">导入</span>
  167. <span class="detail" v-if="item.is_import">已导入</span>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. <!-- 分页 -->
  173. <div class="vue-page" v-if="total">
  174. <el-row>
  175. <el-col align="right">
  176. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  177. :page-size="per_page" :current-page="current_page" background
  178. ></el-pagination>
  179. </el-col>
  180. </el-row>
  181. </div>
  182. </div>
  183. </div>
  184. <script>
  185. var app = new Vue({
  186. el: "#app",
  187. delimiters: ['[[', ']]'],
  188. name: 'test',
  189. data() {
  190. return {
  191. list:[],
  192. search_form:{
  193. type:"",
  194. cate:"全部"
  195. },
  196. current_page:1,
  197. total:1,
  198. per_page:1,
  199. count:-1,
  200. cate:[],
  201. type:[]
  202. }
  203. },
  204. created() {
  205. },
  206. mounted() {
  207. this.getData(1);
  208. },
  209. methods: {
  210. getData(page) {
  211. let json = {
  212. page:page,
  213. search:{
  214. name:this.search_form.name,
  215. type:this.search_form.type,
  216. cate:this.search_form.cate,
  217. }
  218. };
  219. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  220. this.$http.post('{!! yzWebFullUrl('plugin.jd-supply.admin.topic.index') !!}',json).then(function(response) {
  221. if (response.data.result) {
  222. this.list = response.data.data.data.data;
  223. this.current_page=response.data.data.data.current_page;
  224. this.total=response.data.data.data.total;
  225. this.per_page=response.data.data.data.per_page;
  226. this.cate=response.data.data.cate;
  227. loading.close();
  228. console.log(this.cate);
  229. for(let item of this.list) {
  230. item.promote = this.subStr(item.promote);
  231. }
  232. this.type = [{value:"",name:"全部"},{value:"1",name:"H5"},{value:"2",name:"小程序"}]
  233. } else {
  234. this.$message({
  235. message: response.data.msg,
  236. type: 'error'
  237. });
  238. }
  239. loading.close();
  240. }, function(response) {
  241. this.$message({
  242. message: response.data.msg,
  243. type: 'error'
  244. });
  245. loading.close();
  246. });
  247. },
  248. editChild(item) {
  249. let link = `{!! yzWebFullUrl('plugin.jd-supply-topic.admin.topic.edit') !!}`+`&id=`+item.id;
  250. window.location.href = link;
  251. },
  252. goDetail(item) {
  253. console.log(item);
  254. let link = `{!! yzWebFullUrl('plugin.jd-supply.admin.topic.detail') !!}`+`&id=`+item.id;
  255. window.open(link);
  256. },
  257. search(val) {
  258. this.getData(val);
  259. },
  260. // 添加
  261. addModal() {
  262. let link = `{!! yzWebFullUrl('plugin.jd-supply-topic.admin.topic.add') !!}`;
  263. window.location.href = link;
  264. },
  265. del(index) {
  266. this.$confirm('确定导入吗,该过程可能耗时较长,请确保在服务器运载低时导入', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  267. this.loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  268. this.count = 0;
  269. this.$http.post('{!! yzWebFullUrl('plugin.jd-supply.admin.topic.import') !!}',{data:index,count:this.count}).then(function (response) {
  270. if (response.data.result) {
  271. this.loop(index,response.data.data.count);
  272. }
  273. else{
  274. this.$message({type: 'error',message: response.data.msg});
  275. }
  276. },function (response) {
  277. this.$message({type: 'error',message: response.data.msg});
  278. loading.close();
  279. }
  280. );
  281. }).catch(() => {
  282. this.$message({type: 'info',message: '已取消操作'});
  283. });
  284. },
  285. loop(index,current_count) {
  286. this.$http.post('{!! yzWebFullUrl('plugin.jd-supply.admin.topic.import') !!}',{data:index,count:current_count}).then(function (response) {
  287. if (response.data.result) {
  288. if (response.data.data.status == 1) {
  289. this.$message({type: 'success',message: '导入成功!'});
  290. this.getData(this.current_page);
  291. this.loading.close();
  292. this.search(this.current_page)
  293. } else {
  294. this.$message({type: 'success',message: "导入中:"+response.data.data.process});
  295. this.loop(index,response.data.data.count);
  296. }
  297. }
  298. else{
  299. this.$message({type: 'error',message: response.data.msg});
  300. }
  301. },function (response) {
  302. this.$message({type: 'error',message: response.data.msg});
  303. loading.close();
  304. }
  305. );
  306. },
  307. update(index) {
  308. console.log(index)
  309. this.$confirm('该过程可能耗时较长,且会覆盖原装修模板数据,请确保在服务器运载低时操作', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  310. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  311. this.$http.post('{!! yzWebFullUrl('plugin.jd-supply.admin.topic.updateDiy') !!}',{data:index}).then(function (response) {
  312. if (response.data.result) {
  313. this.$message({type: 'success',message: '导入成功!'});
  314. this.getData(this.current_page);
  315. }
  316. else{
  317. this.$message({type: 'error',message: response.data.msg});
  318. }
  319. loading.close();
  320. this.search(this.current_page)
  321. },function (response) {
  322. this.$message({type: 'error',message: response.data.msg});
  323. loading.close();
  324. }
  325. );
  326. }).catch(() => {
  327. this.$message({type: 'info',message: '已取消操作'});
  328. });
  329. },
  330. goGoods(item) {
  331. let link = `{!! yzWebFullUrl('plugin.jd-supply.admin.goods-import.index') !!}`+`&topicId=`+item.id;
  332. window.open(link);
  333. },
  334. subStr(description) {
  335. let str = JSON.parse(JSON.stringify(description));
  336. str = str.replace(/\\n/g, "");
  337. str = str.replace(/(\t)/g, "");
  338. str = str.replace(/(\r)/g, "");
  339. str = str.replace(/<\/?[^>]*>/g, "");
  340. str = str.replace(/\s*/g, "");
  341. return str;
  342. },
  343. },
  344. })
  345. </script>
  346. @endsection