index.blade.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. @extends('layouts.base')
  2. @section('title', '推广中心设置')
  3. @section('content')
  4. <link href="{{static_url('yunshop/css/total.css')}}" media="all" rel="stylesheet" type="text/css" />
  5. <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
  6. <style>
  7. .text-color {
  8. color: #999999;
  9. font-size: 12px;
  10. }
  11. .nav {
  12. cursor: default;
  13. user-select: none;
  14. }
  15. .new {
  16. display: flex;
  17. width: 1000px;
  18. }
  19. .nav-btn {
  20. color: black;
  21. font-family: "微软雅黑";
  22. padding: 9px 13px 9px 13px;
  23. border-radius: 10px;
  24. margin-right: 10px;
  25. background-color: white;
  26. font-family: SourceHanSansCN-Regular;
  27. font-size: 14px;
  28. font-weight: normal;
  29. font-stretch: normal;
  30. letter-spacing: 2px;
  31. color: #333;
  32. }
  33. .nav-btn-back {
  34. color: #FFF;
  35. background-color: #29BA9C;
  36. }
  37. /* 颜色选项部分 */
  38. .el-color-picker__trigger {
  39. margin-top: 2px;
  40. }
  41. /* 表单加粗 */
  42. .el-form-item__label {
  43. font-weight: 600;
  44. }
  45. /* p文字标签通用 */
  46. .text-p {
  47. color: #999999;
  48. font-size: 12px;
  49. line-height: 5px;
  50. font-family: SourceHanSansCN-Regular;
  51. font-weight: normal;
  52. font-stretch: normal;
  53. letter-spacing: 0px;
  54. }
  55. .promotion_center {
  56. margin-top: 5px;
  57. }
  58. .h1_title {
  59. width: calc(100% - 400px);
  60. font-size: 15px;
  61. font-weight: 600;
  62. padding-bottom: 15px;
  63. border-bottom: 1px solid #ccc;
  64. }
  65. .industry_class {
  66. width: calc(100% - 350px)
  67. }
  68. .p-text-box {
  69. width: 90%;
  70. line-height: 18px;
  71. margin-top: 10px;
  72. }
  73. .p-text {
  74. font-size: 12px;
  75. font-weight: 600;
  76. opacity: .5;
  77. }
  78. /* 单选框列表 */
  79. .money-show-box {
  80. margin-left: 100px;
  81. }
  82. .money-show-box .el-form-item {
  83. padding-left: 20px;
  84. text-align: left;
  85. }
  86. [v-cloak] {
  87. display: none;
  88. }
  89. .amount_displayed_txt {
  90. margin-left: 92px;
  91. font-family: SourceHanSansCN-Regular;
  92. font-size: 15px;
  93. font-weight: normal;
  94. font-stretch: normal;
  95. letter-spacing: 1px;
  96. color: #29ba9c;
  97. }
  98. .mar_left_10 {
  99. margin-left: 10px;
  100. }
  101. </style>
  102. <div class="all">
  103. <div id="app" v-loading="loading" v-cloak>
  104. <!-- 头部导航 -->
  105. <div class="nav total-head">
  106. <ul class="new">
  107. <li @click="btnEvent(i)" class="nav-btn " :class="{'nav-btn-back': isIndex===i}" v-for='(item,i) in navlist' :key="i">[[item]]</li>
  108. </ul>
  109. </div>
  110. <div class="total-sect">
  111. <div class="vue-title">
  112. <div class="vue-title-left"></div>
  113. <div class="vue-title-content">基础设置</div>
  114. </div>
  115. <el-form label-width="200px" style="margin-top:25px;">
  116. {{-- <!-- 颜色选项 -->--}}
  117. {{-- <el-form-item label="主题色">--}}
  118. {{-- <div class="mar_left_10">--}}
  119. {{-- <el-color-picker v-model="active_color"></el-color-picker>--}}
  120. {{-- <p class="text-p">只支持推广中心模板1</p>--}}
  121. {{-- </div>--}}
  122. {{-- </el-form-item>--}}
  123. <!-- 不显示插件 -->
  124. <el-form-item label="不显示插件">
  125. <div class="promotion_center mar_left_10">
  126. <el-checkbox-group v-model="promotion_center_list">
  127. <el-checkbox label="extension">推广中心</el-checkbox>
  128. </el-checkbox-group>
  129. </div>
  130. <!-- 插件列表多选框 -->
  131. <div v-for="(title,i) in plugClassData " :key="i" class="industry_class_box mar_left_10">
  132. <h1 class="h1_title">[[title.name]]</h1>
  133. <div v-if="item!==null" v-for="(item,j) in plugcheckbox" :key="j" class="industry_class">
  134. <el-checkbox-group v-model="plugcheckboxData">
  135. <el-checkbox v-if="items.type==title.type" v-for="(items,k) in item" :key="k" :label="items.name"></el-checkbox>
  136. </el-checkbox-group>
  137. </div>
  138. </div>
  139. <div class="p-text-box mar_left_10">
  140. <p class="p-text">勾选推广中心,则不显示也无法访问推广中心页面,会员中心不显示我的推广。 其他插件如果勾选,则推广不显示插件前端页面入口。</p>
  141. <p class="p-text" style="line-height:5px;">勾选端口访问不显示的页面,将强制跳转到跳转页面。若是没有设置跳转链接,则默认跳到商城首页。</p>
  142. </div>
  143. </el-form-item>
  144. <el-form-item label="H5跳转页面">
  145. <el-input class="mar_left_10" clearable v-model="h5_link" style="width: 80%;" placeholder="请输入https开头链接"></el-input>
  146. </el-form-item>
  147. <!-- 小程序链接微信微信小程序才打开 -->
  148. <el-form-item v-if="this.isIndex===1" label="小程序链接">
  149. <el-input class="mar_left_10" clearable v-model="applet_link" style="width: 80%;">
  150. <template slot="append">
  151. <el-button @click="showLink('mini','min_link_two')">选择链接</el-button>
  152. </template>
  153. </el-input>
  154. </el-form-item>
  155. <el-form-item label="更多权限显示">
  156. <el-switch class="mar_left_10" active-value="1" inactive-value="0" v-model="more_switch" active-color="#29BA9C" inactive-color="#ccc">
  157. </el-switch>
  158. </el-form-item>
  159. <el-form-item label="会员ID">
  160. <el-switch class="mar_left_10" active-value="1" inactive-value="0" v-model="memberId_switch" active-color="#29BA9C" inactive-color="#ccc">
  161. </el-switch>
  162. </el-form-item>
  163. <program :pro="pro" @replacepro="changeprogram" @addpro="parpro"></program>
  164. </el-form>
  165. </div>
  166. <div class="total-floo">
  167. <div class="vue-title">
  168. <div class="vue-title-left"></div>
  169. <div class="vue-title-content">插件显示设置</div>
  170. </div>
  171. <el-form label-width="10px" style="margin-top:45px">
  172. <p class="amount_displayed_txt">插件金额显示</p>
  173. <el-form-item>
  174. <div class="money-show-box">
  175. <el-form label-width="200px" style="margin-left:-130px;">
  176. <el-form-item v-for="(item,i) in plugRadio" :label="item.name">
  177. <div style="margin-left:10px">
  178. <el-radio-group v-model="item.status">
  179. <el-radio :label="0">累计金额</el-radio>
  180. <el-radio :label="1">剩余可提现金额</el-radio>
  181. </el-radio-group>
  182. </div>
  183. </el-form-item>
  184. </el-form>
  185. </div>
  186. </el-form-item>
  187. </el-form>
  188. </div>
  189. <div class="fixed total-floo">
  190. <div class="fixed_box">
  191. <el-form>
  192. <el-form-item>
  193. <el-button type="primary" @click="submit">提交</el-button>
  194. </el-form-item>
  195. </el-form>
  196. </div>
  197. </div>
  198. </div>
  199. <!-- 上传链接 -->
  200. @include('public.admin.program')
  201. <script>
  202. let vm = new Vue({
  203. el: '#app',
  204. delimiters: ['[[', ']]'],
  205. data() {
  206. return {
  207. // //选中的颜色
  208. // active_color: '',
  209. //推广中心
  210. promotion_center_list: [],
  211. //插件类
  212. plugClassData: [],
  213. //插件多选框
  214. plugcheckbox: [],
  215. plugcheckboxData: [],
  216. //多选框插件集合
  217. vue_route: [],
  218. //插件单选框
  219. plugRadio: [],
  220. plugRadioDate: {},
  221. //mark
  222. plugin_mark: [],
  223. //导航头部标签
  224. navlist: ["微信公众号", "微信小程序", "WAP", "APP", "支付宝"],
  225. //切换选项卡标识
  226. isIndex: 0,
  227. //h5_链接
  228. h5_link: "",
  229. //小程序链接
  230. applet_link: "",
  231. //开关按钮
  232. more_switch: "0",
  233. memberId_switch: "0",
  234. //是否开启小程序弹窗
  235. pro: false,
  236. isCount: 0,
  237. loading: true,
  238. isplug: false,
  239. }
  240. },
  241. created() {
  242. //优化在不同设备固定定位挡住的现象设置父元素的内边距
  243. window.onload = function() {
  244. let all = document.querySelector(".all");
  245. let h = window.innerHeight * 0.03;
  246. all.style.paddingBottom = h + "px";
  247. }
  248. let i = window.sessionStorage.getItem("i", this.isIndex);
  249. this.isIndex = Number(i);
  250. if (i == 1) {
  251. this.postWeChatApplet();
  252. } else if (i == 2) {
  253. this.postWap();
  254. } else if (i == 3) {
  255. this.postApp()
  256. } else if (i == 4) {
  257. this.postAlipayt()
  258. } else {
  259. this.postWeChat();
  260. }
  261. },
  262. watch: {
  263. //推广中心
  264. "promotion_center_list": {
  265. handler(val) {
  266. this.multiple();
  267. },
  268. deep: true,
  269. immediate: true
  270. },
  271. // 多选插件
  272. "plugcheckboxData": {
  273. handler(val) {
  274. this.multiple();
  275. },
  276. deep: true,
  277. immediate: true
  278. },
  279. //单选
  280. "plugRadio": {
  281. handler(val) {
  282. val.forEach(item => {
  283. this.plugRadioDate[item.value] = Number(item.status);
  284. })
  285. },
  286. deep: true,
  287. immediate: true
  288. }
  289. },
  290. methods: {
  291. //点击选项卡函数
  292. btnEvent(i) {
  293. this.isIndex = i;
  294. window.sessionStorage.setItem("i", this.isIndex);
  295. if (this.isIndex == 0) {
  296. this.postWeChat();
  297. } else if (this.isIndex == 1) {
  298. this.postWeChatApplet();
  299. } else if (this.isIndex == 2) {
  300. this.postWap();
  301. } else if (this.isIndex == 3) {
  302. this.postApp()
  303. } else {
  304. this.postAlipayt()
  305. }
  306. },
  307. //请求微信公众号回显数据
  308. postWeChat(count) {
  309. this.$http.post("{!!yzWebFullUrl('member.popularize-page-show.wechatSet')!!}", {
  310. set: this.isCount == count ? this.argumentObj() : ""
  311. }).then(res => {
  312. this.loadingIcon(res.body, count);
  313. })
  314. },
  315. //请求微信小程序回显数据
  316. postWeChatApplet(count) {
  317. this.$http.post("{!!yzWebFullUrl('member.popularize-page-show.miniSet')!!}", {
  318. set: this.isCount == count ? this.argumentObj() : ""
  319. }).then(res => {
  320. this.loadingIcon(res.body, count);
  321. })
  322. },
  323. //请求wap回显数据
  324. postWap(count) {
  325. this.$http.post("{!!yzWebFullUrl('member.popularize-page-show.wapSet')!!}", {
  326. set: this.isCount == count ? this.argumentObj() : ""
  327. }).then(res => {
  328. this.loadingIcon(res.body, count);
  329. })
  330. },
  331. //请求app回显数据
  332. postApp(count) {
  333. this.$http.post("{!!yzWebFullUrl('member.popularize-page-show.appSet')!!}", {
  334. set: this.isCount == count ? this.argumentObj() : ""
  335. }).then(res => {
  336. this.loadingIcon(res.body, count);
  337. })
  338. },
  339. //请求支付宝回显数据
  340. postAlipayt(count) {
  341. this.$http.post("{!!yzWebFullUrl('member.popularize-page-show.alipaySet')!!}", {
  342. set: this.isCount == count ? this.argumentObj() : ""
  343. }).then(res => {
  344. this.loadingIcon(res.body, count);
  345. })
  346. },
  347. // 参数
  348. argumentObj() {
  349. return {
  350. // background_color: this.active_color,
  351. vue_route: this.vue_route,
  352. plugin_mark: this.plugin_mark,
  353. callback_url: this.h5_link,
  354. small_extension_link: this.applet_link,
  355. is_show_unable: this.more_switch,
  356. show_member_id: this.memberId_switch,
  357. plugin: this.plugRadioDate
  358. }
  359. },
  360. //列表数据
  361. showinfo(res, count) {
  362. console.log(res, 46545);
  363. if (count) {
  364. // 提交的时候
  365. if (res.result == 1) {
  366. this.$message.success('保存成功');
  367. history.go(0);
  368. } else {
  369. this.$message.error(res.msg);
  370. }
  371. return;
  372. }
  373. if (this.isCount == 0) {
  374. //初始化清空
  375. this.promotion_center_list = [];
  376. let {
  377. // background_color,
  378. extension,
  379. plugin_type,
  380. not_plugin,
  381. callback_url,
  382. small_extension_link,
  383. is_show_unable,
  384. show_member_id
  385. } = res.data.basics;
  386. if (res.data.basics !== null && JSON.stringify(res.data.basics) !== "{}") {
  387. //主题颜色
  388. // this.active_color = background_color
  389. // 推广中心选中
  390. if (extension == 1) {
  391. this.promotion_center_list.push("extension")
  392. }
  393. //插件类名
  394. //初始化清空
  395. this.plugClassData = [];
  396. this.plugcheckboxData = [];
  397. if (not_plugin !== null && JSON.stringify(not_plugin) !== "{}") {
  398. for (let i in not_plugin) {
  399. if (not_plugin[i] !== null) {
  400. //插件类
  401. this.plugClassData.push({
  402. type: i,
  403. name: plugin_type[i]
  404. })
  405. //插件多选框回显
  406. not_plugin[i].forEach(item => {
  407. if (item.status == 1) {
  408. this.plugcheckboxData.push(item.name)
  409. }
  410. })
  411. }
  412. }
  413. }
  414. //插件多选框
  415. this.plugcheckbox = not_plugin;
  416. //H5跳转页面
  417. this.h5_link = callback_url;
  418. if (this.isIndex == 1) {
  419. //小程序链接
  420. this.applet_link = small_extension_link
  421. }
  422. //更多权限显示
  423. this.more_switch = is_show_unable;
  424. //会员ID
  425. this.memberId_switch = show_member_id;
  426. }
  427. let {
  428. plugin
  429. } = res.data;
  430. this.plugRadio=[];
  431. if (plugin !== null && plugin.length !== 0) {
  432. //插件单选
  433. console.log(plugin);
  434. for (let i in plugin) {
  435. this.plugRadio.push({
  436. name: plugin[i].name,
  437. status: Number(plugin[i].status),
  438. value: plugin[i].value
  439. });
  440. }
  441. }
  442. }
  443. },
  444. //拼接多选框数据
  445. multiple() {
  446. this.vue_route = [];
  447. let itemObj = [];
  448. for (let i in this.plugcheckbox) {
  449. if (this.plugcheckbox[i] !== null) {
  450. this.plugcheckbox[i].forEach(item => {
  451. itemObj.push(item);
  452. })
  453. }
  454. }
  455. let itemName = [];
  456. let plugin_markArr = [];
  457. itemObj.forEach(item => {
  458. // console.log(item);
  459. this.plugcheckboxData.forEach(name => {
  460. if (item.name == name) {
  461. plugin_markArr.push(item.mark)
  462. itemName.push(item.url)
  463. }
  464. })
  465. })
  466. //拼接数据
  467. this.vue_route = [...itemName, ...this.promotion_center_list];
  468. this.plugin_mark = [...plugin_markArr];
  469. // console.log(this.vue_route);
  470. },
  471. //请求响应反应
  472. loadingIcon(res, count) {
  473. this.loading = true;
  474. if (res.result == 1) {
  475. setTimeout(() => {
  476. this.loading = false;
  477. this.showinfo(res, count);
  478. }, 300)
  479. }
  480. },
  481. //上传微信小程序链接
  482. showLink(type, name) {
  483. // console.log(type, name);
  484. if (type == "link") {
  485. this.chooseLink = name;
  486. this.show = true;
  487. } else {
  488. this.chooseMiniLink = name;
  489. this.pro = true;
  490. }
  491. },
  492. //小程序链接
  493. changeprogram(item) {
  494. this.pro = item;
  495. },
  496. //小程序插件弹窗显示与隐藏的控制
  497. changeLink(item) {
  498. this.show = item;
  499. },
  500. //绑定小程序链接
  501. parpro(child, confirm) {
  502. this.pro = confirm;
  503. this.applet_link = child;
  504. },
  505. //提交
  506. submit() {
  507. //判断对应保存数据
  508. if (this.isIndex == 0) {
  509. this.isCount = 1;
  510. this.postWeChat(1);
  511. } else if (this.isIndex == 1) {
  512. this.isCount = 2;
  513. this.postWeChatApplet(2)
  514. } else if (this.isIndex == 2) {
  515. this.isCount = 3;
  516. this.postWap(3);
  517. } else if (this.isIndex == 3) {
  518. this.isCount = 4;
  519. this.postApp(4);
  520. } else {
  521. this.isCount = 5;
  522. this.postAlipayt(5);
  523. }
  524. }
  525. }
  526. })
  527. </script>
  528. @endsection