setting.blade.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  1. @extends('layouts.base')
  2. @section('title', trans('基础设置'))
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/aggregation-cps/static/index.css')}}">
  5. <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
  6. <style>
  7. .el-tag1 {
  8. line-height: 60px !important;
  9. height: 60px !important;
  10. font-size: 16px;
  11. }
  12. .el-form-item1 .el-form-item__label {
  13. line-height: 28px;
  14. }
  15. /* 导航 */
  16. .el-radio-button .el-radio-button__inner, .el-radio-button:first-child .el-radio-button__inner {
  17. border-radius: 4px 4px 4px 4px;
  18. border-left: 0px;
  19. }
  20. .el-radio-button__inner {
  21. border: 0;
  22. }
  23. .el-radio-button:last-child .el-radio-button__inner {
  24. border-radius: 4px 4px 4px 4px;
  25. }
  26. </style>
  27. <div class="all">
  28. <div id="app" v-cloak>
  29. <div class="vue-head">
  30. <el-tabs v-model="activeName" style="margin:10px 0;">
  31. <el-tab-pane v-for="(item,index) in tab_list" :key="index" v-if="item.show==1" :label="item.name"
  32. :name="item.value"></el-tab-pane>
  33. </el-tabs>
  34. </div>
  35. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  36. <!-- 基础 -->
  37. <div class="vue-main" v-show="activeName=='basic'">
  38. @include('Yunshop\AggregationCps::admin.setting.basic')
  39. </div>
  40. <!-- 基础 -->
  41. <!-- 营销 -->
  42. <div v-show="activeName=='market'">
  43. @include('Yunshop\AggregationCps::admin.setting.market')
  44. </div>
  45. <!-- 营销 -->
  46. <!-- 分润 -->
  47. <div v-show="activeName=='profit'">
  48. @include('Yunshop\AggregationCps::admin.setting.profit')
  49. </div>
  50. <!-- 分润 -->
  51. <!-- 每日红包设置 -->
  52. <div class="vue-main" v-show="activeName=='red-packet'">
  53. @include('Yunshop\AggregationCps::admin.setting.red-packet')
  54. </div>
  55. <!-- 每日红包设置 -->
  56. <!-- app下载页设置 -->
  57. <div v-show="activeName=='app_version'">
  58. @include('Yunshop\AggregationCps::admin.setting.app-version')
  59. </div>
  60. <!-- app下载页设置 -->
  61. <!-- app设置 -->
  62. <div v-show="activeName=='link_category'">
  63. @include('Yunshop\AggregationCps::admin.setting.link-category')
  64. </div>
  65. <!-- app设置 -->
  66. <!-- 协议设置 -->
  67. <div v-show="activeName=='page_text'">
  68. @include('Yunshop\AggregationCps::admin.setting.page-text')
  69. </div>
  70. <!-- 协议设置 -->
  71. <!-- 支付设置 -->
  72. <div v-show="activeName=='pay_info'">
  73. @include('Yunshop\AggregationCps::admin.setting.pay-info')
  74. </div>
  75. <!-- 支付设置 -->
  76. <!-- 回调地址 -->
  77. <div v-show="activeName=='call_back'">
  78. @include('Yunshop\AggregationCps::admin.setting.order-call-back')
  79. </div>
  80. <!-- 回调地址 -->
  81. </el-form>
  82. <el-dialog title="上传文件" :visible.sync="app_show" width="30%">
  83. <el-upload
  84. class="upload-demo"
  85. drag
  86. :action="upload_url"
  87. :before-upload="beforeAppUpload"
  88. :on-success="uploadSuccess"
  89. :on-error="uploadFailed"
  90. :limit=1
  91. :file-list="app_list"
  92. ref="app-upload"
  93. multiple>
  94. <i class="el-icon-upload"></i>
  95. <div v-if="app_modal_text1" class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  96. <div v-if="app_modal_text2" class="el-upload__text">文件上传中,请稍后....</div>
  97. <div class="el-upload__tip" slot="tip">证书文件格式为pem</div>
  98. </el-upload>
  99. </el-dialog>
  100. <!-- 分页 -->
  101. <div class="vue-page">
  102. <div class="vue-center">
  103. <el-button type="primary" @click="submitForm('form')">提交</el-button>
  104. <el-button @click="goBack">返回</el-button>
  105. </div>
  106. </div>
  107. <upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp"
  108. @sure="sureImg"></upload-img>
  109. <upload-img :upload-show="uploadShow2" :name="chooseImgName2" @replace="changeProp2"
  110. @sure="sureImg2"></upload-img>
  111. <upload-img :upload-show="uploadShow3" :name="chooseImgName3" @replace="changeProp3"
  112. @sure="sureImg3"></upload-img>
  113. <pop :show="show" @replace="changeLink" @add="parHref"></pop>
  114. </div>
  115. </div>
  116. <script src="{{resource_get('static/yunshop/tinymce4.7.5/tinymce.min.js')}}"></script>
  117. @include('public.admin.tinymceee')
  118. @include('public.admin.uploadImg')
  119. @include('public.admin.pop')
  120. {{-- @include('public.admin.uploadMultimediaImg')--}}
  121. <script>
  122. var app = new Vue({
  123. el: "#app",
  124. delimiters: ['[[', ']]'],
  125. name: 'test',
  126. data() {
  127. return {
  128. weixin_appid_show: true,
  129. weixin_secret_show: true,
  130. order_type: 1,
  131. activeName: "basic",
  132. tab_list: [],
  133. list: [],
  134. award_list: [],
  135. id: 0,
  136. love_name: '爱心值',
  137. // 优惠券
  138. coupon_show: false,
  139. coupon_keyword: "",
  140. coupon_list: [],
  141. table_loading: false,
  142. form: {
  143. basic: {
  144. app_key: '',
  145. app_secret: '',
  146. buy_show: 2,
  147. share_show: 0,
  148. download_url: '',
  149. weixin_appid: '',
  150. weixin_secret: '',
  151. plugin_name: '',
  152. },
  153. market: {
  154. point: {
  155. reward_point: '',
  156. reward_point1: '',
  157. reward_point2: '',
  158. },
  159. love: {
  160. love_show: 0,
  161. love_name: '',
  162. award_proportion: '',
  163. parent_award_proportion: '',
  164. second_award_proportion: '',
  165. },
  166. frozen_love: {
  167. award_proportion: '',
  168. parent_award_proportion: '',
  169. second_award_proportion: '',
  170. reward_event: '0',
  171. },
  172. balance: {
  173. reward_balance: '',
  174. reward_balance1: '',
  175. reward_balance2: '',
  176. },
  177. integral: {
  178. is_show: '0',
  179. award_proportion: '',
  180. parent_award_proportion: '',
  181. second_award_proportion: '',
  182. },
  183. },
  184. // 分润
  185. profit: {
  186. commission: {
  187. is_show: 0,
  188. is_commission: 0,
  189. level: [],
  190. },
  191. team_dividend: {
  192. is_show: 0,
  193. is_dividend: 0,
  194. level: [],
  195. },
  196. shareholder_dividend: {
  197. is_no_count: 0,
  198. },
  199. area_dividend: {
  200. open_state: 0,
  201. point_open_state: 0,
  202. },
  203. commission_point: {
  204. plugin_name:'分销消费积分',
  205. status: 0,
  206. is_sub: 0,
  207. is_alone: 0,
  208. level_list: [],
  209. },
  210. 'performance_new': {
  211. plugin_name: '新业绩奖励',
  212. is_open: 0,
  213. },
  214. },
  215. // 每日红包
  216. red_packet: {
  217. is_cps: 0,
  218. cps_scale: '',
  219. cps_proportion: '',
  220. },
  221. app_version: {
  222. download_page_url: '',
  223. top_image: '',
  224. top_image_url: '',
  225. top_image_link: '',
  226. app_text: '',
  227. app_logo: '',
  228. app_logo_url: '',
  229. app_name: '',
  230. apk_name: '',
  231. },
  232. link_category: {
  233. open_search_coupon: 0,
  234. open_withdraw: 0,
  235. open_decorate: 0,
  236. max_level: '3',
  237. shape: '1',
  238. radius: '0',
  239. top_color_open_state: 1,
  240. top_color: '#F8072F',
  241. bottom_default_color: '#000000',
  242. bottom_select_color: '#08ED41',
  243. search_state: 1,
  244. bottom_button_select_top_color: '',
  245. bottom_button_select_bottom_color: '',
  246. bottom_button_default_top_color: '',
  247. bottom_button_default_bottom_color: '',
  248. search_div_type: 2,
  249. bottom_button_color: {
  250. open_state: 0,
  251. select_top_color: '',
  252. select_bottom_color: '',
  253. default_top_color: '',
  254. default_bottom_color: '',
  255. },
  256. },
  257. page_text: {
  258. privacy_policy: '',
  259. user_agreement: '',
  260. },
  261. pay_info: {
  262. weixin_pay: 0,
  263. weixin_appid: '',
  264. weixin_secret: '',
  265. weixin_mchid: '',
  266. weixin_apisecret: '',
  267. weixin_version: 0,
  268. weixin_cert: '',
  269. weixin_key: '',
  270. },
  271. },
  272. uploadShow: false,
  273. uploadShow2: false,
  274. uploadShow3: false,
  275. chooseImgName: '',
  276. chooseImgName2: '',
  277. chooseImgName3: '',
  278. show: false,
  279. chooseLink: '',
  280. submit_url: '',
  281. showVisible: false,
  282. loading: false,
  283. upload_url: '',
  284. download_page_url: '',
  285. app_show: false,
  286. app_modal_text1: true,
  287. app_modal_text2: false,
  288. show_bottom_type: '1',
  289. default_bottom_color1: '',
  290. default_bottom_color2: '',
  291. select_bottom_color1: '',
  292. select_bottom_color2: '',
  293. app_list: [],
  294. rules: {
  295. // name:{ required: true, message: '请输入品牌名称'}
  296. },
  297. }
  298. },
  299. created() {
  300. },
  301. mounted() {
  302. this.id = this.getParam("store_id");
  303. this.getData();
  304. },
  305. methods: {
  306. beforeAppUpload: function (file) {
  307. if (file == 'undefined') {
  308. return false;
  309. }
  310. this.app_modal_text1 = false;
  311. this.app_modal_text2 = true;
  312. },
  313. showAppModal: function (type) {
  314. if (type == 1) {
  315. this.upload_url = "{!! yzWebFullUrl('plugin.aggregation-cps.admin.setting.uploadFile',['type'=>1]) !!}";
  316. } else if (type == 2) {
  317. this.upload_url = "{!! yzWebFullUrl('plugin.aggregation-cps.admin.setting.uploadFile',['type'=>2]) !!}";
  318. }
  319. this.app_list = [];
  320. this.app_show = true;
  321. this.app_modal_text1 = true;
  322. this.app_modal_text2 = false;
  323. this.showUploaderEl = true;
  324. },
  325. clearUpload() {
  326. this.$refs['app-upload'].clearFiles();
  327. },
  328. uploadSuccess: function (res, file) {
  329. console.log('上传成功回调');
  330. this.app_modal_text1 = true;
  331. this.app_modal_text2 = false;
  332. if (res.result == 1) {
  333. this.$message({message: res.msg, type: 'success'});
  334. this.app_show = false;
  335. if (res.data.type == 1) {
  336. this.form.pay_info.weixin_cert = res.data.path;
  337. } else if (res.data.type == 2) {
  338. this.form.pay_info.weixin_key = res.data.path;
  339. }
  340. // this.showEditModal(res.data);
  341. } else {
  342. this.$message({message: res.msg, type: 'error'});
  343. }
  344. this.clearUpload();
  345. },
  346. uploadFailed: function (res) {
  347. console.log('上传失败回调');
  348. this.app_modal_text1 = true;
  349. this.app_modal_text2 = false;
  350. this.clearUpload();
  351. this.$message({message: '上传失败', type: 'error'});
  352. },
  353. bottomButtonChange(data) {
  354. if (data.open_state == 1) {
  355. var count = 0;
  356. this.form.link_category.bottom_button.forEach(function (v) {
  357. if (v.open_state == 1) {
  358. count = count + 1;
  359. }
  360. });
  361. if (count > 5) {
  362. data.open_state = 0;
  363. this.$message({message: '底部栏最多开启5个', type: 'error'});
  364. }
  365. }
  366. },
  367. copyUrl(url, msg) {
  368. let oInput = document.createElement('input');
  369. oInput.value = url;
  370. document.body.appendChild(oInput);
  371. oInput.select(); // 选择对象;
  372. console.log(oInput.value);
  373. document.execCommand("Copy"); // 执行浏览器复制命令
  374. this.$message({message: msg, type: 'success'});
  375. oInput.remove()
  376. },
  377. changeLink(item) {
  378. this.show = item;
  379. },
  380. showLink(type, name) {
  381. if (type == "link") {
  382. this.chooseLink = name;
  383. this.show = true;
  384. }
  385. },
  386. parHref(child, confirm) {
  387. this.show = confirm;
  388. // this.form.link=child;
  389. let arr = []
  390. if (this.chooseLink.indexOf(".") != -1) {
  391. arr = this.chooseLink.split(".")
  392. this.form[arr[0]][arr[1]] = child;
  393. } else {
  394. this.form[this.chooseLink] = child;
  395. }
  396. },
  397. getParam(name) {
  398. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  399. var r = window.location.search.substr(1).match(reg);
  400. if (r != null) return unescape(r[2]);
  401. return null;
  402. },
  403. getData() {
  404. let loading = this.$loading({
  405. target: document.querySelector(".content"),
  406. background: 'rgba(0, 0, 0, 0)'
  407. });
  408. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.setting.get-setting') !!}', {id: this.id}).then(function (response) {
  409. if (response.data.result) {
  410. this.tab_list = response.data.data.tab;
  411. this.form.basic = {
  412. ...response.data.data.basic
  413. };
  414. this.form.market = {
  415. ...response.data.data.market
  416. }
  417. // 分润
  418. let profit_obj = this.tab_list.find((item, index) => {
  419. return item.value == 'profit'
  420. })
  421. if (profit_obj.show == 1) {
  422. this.form.profit = {
  423. commission: {
  424. ...response.data.data.profit.commission
  425. },
  426. team_dividend: {
  427. ...response.data.data.profit['team-dividend']
  428. },
  429. shareholder_dividend: {
  430. ...response.data.data.profit['shareholder-dividend']
  431. },
  432. area_dividend: {
  433. ...response.data.data.profit['area_dividend']
  434. },
  435. 'performance_new': {
  436. ...response.data.data.profit['performance_new']
  437. },
  438. commission_point: {
  439. ...response.data.data.profit['commission_point']
  440. },
  441. }
  442. }
  443. // 每日红包
  444. let red_packet_obj = this.tab_list.find((item, index) => {
  445. return item.value == 'red-packet'
  446. })
  447. if (red_packet_obj.show == 1) {
  448. this.form.red_packet = {
  449. ...response.data.data['red-packet']
  450. }
  451. }
  452. console.log(response.data.data);
  453. let app_version_obj = this.tab_list.find((item, index) => {
  454. return item.value == 'app_version'
  455. })
  456. if (app_version_obj.show == 1) {
  457. // console.log(123);
  458. // console.log(...response.data.data['app_version']);
  459. this.form.app_version = {
  460. ...response.data.data['app_version']
  461. }
  462. }
  463. let link_category_obj = this.tab_list.find((item, index) => {
  464. return item.value == 'link_category'
  465. })
  466. if (link_category_obj.show == 1) {
  467. this.form.link_category = {
  468. ...response.data.data['link_category']
  469. }
  470. }
  471. let pay_info_obj = this.tab_list.find((item, index) => {
  472. return item.value == 'pay_info'
  473. })
  474. if (pay_info_obj.show == 1) {
  475. this.form.pay_info = {
  476. ...response.data.data['pay_info']
  477. }
  478. }
  479. let page_text_obj = this.tab_list.find((item, index) => {
  480. return item.value == 'page_text'
  481. })
  482. if (page_text_obj.show == 1) {
  483. this.form.page_text = {
  484. ...response.data.data['page_text']
  485. }
  486. }
  487. this.love_name = response.data.data.market.love.love_name || '爱心值';
  488. console.log(this.form);
  489. this.getShow();
  490. } else {
  491. this.$message({message: response.data.msg, type: 'error'});
  492. }
  493. loading.close();
  494. }, function (response) {
  495. this.$message({message: response.data.msg, type: 'error'});
  496. loading.close();
  497. }
  498. );
  499. },
  500. submitForm(formName) {
  501. console.log(this.form)
  502. let that = this;
  503. let json = {
  504. id: this.id,
  505. basic: this.form.basic,
  506. market: {
  507. point: {
  508. reward_point: this.form.market.point.reward_point,
  509. reward_point1: this.form.market.point.reward_point1,
  510. reward_point2: this.form.market.point.reward_point2,
  511. },
  512. balance: {
  513. reward_balance: this.form.market.balance.reward_balance,
  514. reward_balance1: this.form.market.balance.reward_balance1,
  515. reward_balance2: this.form.market.balance.reward_balance2,
  516. },
  517. },
  518. // 分润
  519. profit: {},
  520. };
  521. // app版本管理
  522. json.app_version = {
  523. top_image: this.form.app_version.top_image,
  524. top_image_link: this.form.app_version.top_image_link,
  525. app_logo: this.form.app_version.app_logo,
  526. app_name: this.form.app_version.app_name,
  527. app_text: this.form.app_version.app_text,
  528. apk_name: this.form.app_version.apk_name,
  529. };
  530. json.link_category = {
  531. open_decorate: this.form.link_category.open_decorate,
  532. open_search_coupon: this.form.link_category.open_search_coupon,
  533. open_withdraw: this.form.link_category.open_withdraw,
  534. max_level: this.form.link_category.max_level,
  535. shape: this.form.link_category.shape,
  536. radius: this.form.link_category.radius,
  537. top_color_open_state: this.form.link_category.top_color_open_state,
  538. top_color: this.form.link_category.top_color,
  539. bottom_select_color: this.form.link_category.bottom_select_color,
  540. bottom_default_color: this.form.link_category.bottom_default_color,
  541. bottom_button: this.form.link_category.bottom_button,
  542. search_state: this.form.link_category.search_state,
  543. search_div_type: this.form.link_category.search_div_type,
  544. bottom_button_color: {
  545. open_state: this.form.link_category.bottom_button_color.open_state,
  546. select_top_color: this.form.link_category.bottom_button_color.select_top_color,
  547. select_bottom_color: this.form.link_category.bottom_button_color.select_bottom_color,
  548. default_top_color: this.form.link_category.bottom_button_color.default_top_color,
  549. default_bottom_color: this.form.link_category.bottom_button_color.default_bottom_color,
  550. },
  551. login_type: {
  552. sms: this.form.link_category.login_type.sms,
  553. mobile: this.form.link_category.login_type.mobile,
  554. wechat: this.form.link_category.login_type.wechat,
  555. together: this.form.link_category.login_type.together,
  556. },
  557. register_type: this.form.link_category.register_type,
  558. };
  559. json.pay_info = {
  560. weixin_pay: this.form.pay_info.weixin_pay,
  561. weixin_appid: this.form.pay_info.weixin_appid,
  562. weixin_secret: this.form.pay_info.weixin_secret,
  563. weixin_mchid: this.form.pay_info.weixin_mchid,
  564. weixin_apisecret: this.form.pay_info.weixin_apisecret,
  565. weixin_cert: this.form.pay_info.weixin_cert,
  566. weixin_key: this.form.pay_info.weixin_key,
  567. };
  568. json.page_text = {
  569. user_agreement: this.form.page_text.user_agreement,
  570. privacy_policy: this.form.page_text.privacy_policy
  571. };
  572. if (this.form.market.love.love_show) {
  573. json.market.love = {
  574. award_proportion: this.form.market.love.award_proportion,
  575. parent_award_proportion: this.form.market.love.parent_award_proportion,
  576. second_award_proportion: this.form.market.love.second_award_proportion,
  577. }
  578. }
  579. if (this.form.market.love.love_show) {
  580. json.market.frozen_love = {
  581. award_proportion: this.form.market.frozen_love.award_proportion,
  582. parent_award_proportion: this.form.market.frozen_love.parent_award_proportion,
  583. second_award_proportion: this.form.market.frozen_love.second_award_proportion,
  584. reward_event: this.form.market.frozen_love.reward_event,
  585. }
  586. }
  587. if (this.form.market.integral.is_show) {
  588. json.market.integral = {
  589. award_proportion: this.form.market.integral.award_proportion,
  590. parent_award_proportion: this.form.market.integral.parent_award_proportion,
  591. second_award_proportion: this.form.market.integral.second_award_proportion,
  592. }
  593. }
  594. if (this.form.profit.commission.is_show) {
  595. json.profit.commission = {
  596. is_commission: this.form.profit.commission.is_commission,
  597. level: this.form.profit.commission.level,
  598. }
  599. }
  600. if (this.form.profit.area_dividend.is_show) {
  601. json.profit.area_dividend = {
  602. open_state: this.form.profit.area_dividend.open_state,
  603. point_open_state: this.form.profit.area_dividend.point_open_state,
  604. }
  605. }
  606. if (this.form.profit.commission_point.is_show) {
  607. json.profit.commission_point = {
  608. status: this.form.profit.commission_point.status,
  609. is_alone: this.form.profit.commission_point.is_alone,
  610. is_sub:this.form.profit.commission_point.is_sub,
  611. level_list:this.form.profit.commission_point.level_list,
  612. }
  613. }
  614. if (this.form.profit['performance_new'].is_show) {
  615. json.profit.performance_new = {
  616. is_open: this.form.profit.performance_new.is_open,
  617. }
  618. }
  619. if (this.form.profit.team_dividend.is_show) {
  620. json.profit['team-dividend'] = {
  621. is_dividend: this.form.profit.team_dividend.is_dividend,
  622. level: this.form.profit.team_dividend.level,
  623. }
  624. }
  625. if (this.form.profit.shareholder_dividend.is_show) {
  626. json.profit['shareholder-dividend'] = {
  627. is_no_count: this.form.profit.shareholder_dividend.is_no_count,
  628. }
  629. }
  630. if (this.form.profit.shareholder_dividend.is_show) {
  631. json.profit['area_dividend'] = {
  632. open_state: this.form.profit.area_dividend.open_state,
  633. point_open_state: this.form.profit.area_dividend.point_open_state,
  634. }
  635. }
  636. // 每日红包
  637. let red_packet_obj = this.tab_list.find((item, index) => {
  638. return item.value == 'red-packet'
  639. })
  640. if (red_packet_obj.show == 1) {
  641. json.red_packet = {
  642. is_cps: this.form.red_packet.is_cps,
  643. cps_scale: this.form.red_packet.cps_scale,
  644. cps_proportion: this.form.red_packet.cps_proportion,
  645. }
  646. }
  647. console.log(json);
  648. this.$refs[formName].validate((valid) => {
  649. if (valid) {
  650. let loading = this.$loading({
  651. target: document.querySelector(".content"),
  652. background: 'rgba(0, 0, 0, 0)'
  653. });
  654. this.$http.post("{!! yzWebFullUrl('plugin.aggregation-cps.admin.setting.set') !!}", json).then(response => {
  655. if (response.data.result) {
  656. this.$message({type: 'success', message: '操作成功!'});
  657. window.location.reload();
  658. } else {
  659. this.$message({message: response.data.msg, type: 'error'});
  660. }
  661. loading.close();
  662. }, response => {
  663. loading.close();
  664. });
  665. } else {
  666. console.log('error submit!!');
  667. return false;
  668. }
  669. });
  670. },
  671. posterQrcode(formName) {
  672. console.log(this.form)
  673. let json = {
  674. download_url: this.form.basic.download_url,
  675. };
  676. console.log(json)
  677. this.$refs[formName].validate((valid) => {
  678. if (valid) {
  679. let loading = this.$loading({
  680. target: document.querySelector(".content"),
  681. background: 'rgba(0, 0, 0, 0)'
  682. });
  683. this.$http.post("{!! yzWebFullUrl('plugin.aggregation-cps.admin.setting.poster-qrcode') !!}", json).then(response => {
  684. if (response.data.result) {
  685. this.$message({type: 'success', message: '操作成功!'});
  686. } else {
  687. this.$message({message: response.data.msg, type: 'error'});
  688. }
  689. loading.close();
  690. }, response => {
  691. loading.close();
  692. });
  693. } else {
  694. console.log('error submit!!');
  695. return false;
  696. }
  697. });
  698. },
  699. goBack() {
  700. history.go(-1)
  701. },
  702. openUpload(str) {
  703. this.chooseImgName = str;
  704. this.uploadShow = true;
  705. },
  706. changeProp(val) {
  707. if (val == true) {
  708. this.uploadShow = false;
  709. } else {
  710. this.uploadShow = true;
  711. }
  712. },
  713. changeProp2(val) {
  714. if (val == true) {
  715. this.uploadShow2 = false;
  716. } else {
  717. this.uploadShow2 = true;
  718. }
  719. },
  720. changeProp3(val) {
  721. if (val == true) {
  722. this.uploadShow3 = false;
  723. } else {
  724. this.uploadShow3 = true;
  725. }
  726. },
  727. sureImg(name, image, image_url) {
  728. this.form[name] = image;
  729. this.form[name + '_url'] = image_url;
  730. },
  731. sureImg2(name, image, image_url) {
  732. this.form.app_version.top_image = image;
  733. this.form.app_version.top_image_url = image_url;
  734. console.log(this.form);
  735. },
  736. sureImg3(name, image, image_url) {
  737. this.form.app_version.app_logo = image;
  738. this.form.app_version.app_logo_url = image_url;
  739. console.log(this.form);
  740. },
  741. clearImg(str) {
  742. this.form[str] = "";
  743. this.form[str + '_url'] = "";
  744. this.$forceUpdate();
  745. },
  746. blurSearchFor() {
  747. this.form.basic.weixin_secret = '';
  748. },
  749. ResetValue(str) {
  750. switch (str) {
  751. case 'basic.weixin_appid' :
  752. this.form.basic.weixin_appid = ''
  753. this.weixin_appid_show = true
  754. break;
  755. case 'basic.weixin_secret' :
  756. this.form.basic.weixin_secret = ''
  757. this.weixin_secret_show = true
  758. break;
  759. }
  760. },
  761. getShow() {
  762. if (this.form.basic.weixin_appid) {
  763. this.weixin_appid_show = false
  764. }
  765. if (this.form.basic.weixin_secret) {
  766. this.weixin_secret_show = false
  767. }
  768. },
  769. },
  770. })
  771. </script>
  772. @endsection