detail.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. @extends('layouts.base')
  2. @section('content')
  3. <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
  4. <style>
  5. .panel{
  6. margin-bottom:10px!important;
  7. padding-left: 20px;
  8. border-radius: 10px;
  9. }
  10. .panel .active a {
  11. background-color: #29ba9c!important;
  12. border-radius: 18px!important;
  13. color:#fff;
  14. }
  15. .panel a{
  16. border:none!important;
  17. background-color:#fff!important;
  18. }
  19. .content{
  20. background: #eff3f6;
  21. padding: 10px!important;
  22. }
  23. .con{
  24. padding-bottom:40px;
  25. position:relative;
  26. min-height:100vh;
  27. background-color:#fff;
  28. border-radius: 8px;
  29. }
  30. .con .setting .block{
  31. padding:10px;
  32. background-color:#fff;
  33. border-radius: 8px;
  34. }
  35. .con .setting .block .title{
  36. display:flex;
  37. align-items:center;
  38. margin-bottom:15px;
  39. }
  40. .confirm-btn{
  41. width: calc(100% - 266px);
  42. position:fixed;
  43. bottom:0;
  44. right:0;
  45. margin-right:10px;
  46. line-height:63px;
  47. background-color: #ffffff;
  48. box-shadow: 0px 8px 23px 1px
  49. rgba(51, 51, 51, 0.3);
  50. background-color:#fff;
  51. text-align:center;
  52. }
  53. b{
  54. font-size:14px;
  55. }
  56. .left{
  57. width:42%;
  58. height:100%;
  59. float:left;
  60. }
  61. .right{
  62. width:58%;
  63. height:100%;
  64. float:left;
  65. border-left:solid 1px #f6f7f9;
  66. }
  67. .block:after{
  68. content:'';
  69. display:block;
  70. clear:both;
  71. }
  72. .head{
  73. width: 100%;
  74. height: 43px;
  75. background-color: #f6f7f9;
  76. display:flex;
  77. align-items:center;
  78. margin:0 auto;
  79. }
  80. .vue-crumbs a {
  81. color: #333;
  82. }
  83. .vue-crumbs a:hover {
  84. color: #29ba9c;
  85. }
  86. .vue-crumbs {
  87. margin: 0 20px;
  88. font-size: 14px;
  89. color: #333;
  90. font-weight: 400;
  91. padding-bottom: 10px;
  92. line-height: 32px;
  93. }
  94. </style>
  95. <div id='re_content' >
  96. <div class="vue-crumbs">
  97. <a @click="goBack">系统</a> > 微信模板消息 > 自定义模板管理 > 添加模板
  98. </div>
  99. <div class="con">
  100. <div class="setting">
  101. <div class="block">
  102. <div class="title"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>添加微信自定义模板</b><span style="margin-left:20px;font-size:12px;">请选择对应模板变量, 否则消息通知内容有误</span></div>
  103. <el-form ref="form" :model="form" label-width="20%">
  104. <div class="left">
  105. <div style="margin-left:20px;margin-bottom:20px;">选择模板区域</div>
  106. <el-form-item label="添加模板">
  107. <el-input v-model="templateidshort" style="width:70%;" ></el-input>
  108. <el-button type="primary" @click="addQuick">快速添加</el-button>
  109. </el-form-item>
  110. <el-form-item label="选择模板">
  111. <template>
  112. <el-select style="width:90%;" filterable placeholder="请选择" v-model="form.template_id" @change="Select" filterable>
  113. <el-option
  114. v-for="item in tmp_list"
  115. :label="item.title"
  116. :value="item.template_id">
  117. </el-option>
  118. </el-select>
  119. </template>
  120. </el-form-item>
  121. <el-form-item label="模板展示" v-if="content">
  122. <div style="width: 90%;min-height:129px;background-color: #f6f7f9;border-radius: 4px;box-sizing:border-box;padding:8px;" v-html="content">
  123. </div>
  124. </el-form-item>
  125. <el-form-item label="模板变量类型" >
  126. <template>
  127. <el-select style="width:90%;" filterable placeholder="请选择" v-model="value" @change="paramSelect" filterable>
  128. <el-option
  129. v-for="item in temp"
  130. :label="item.title"
  131. :value="item.value">
  132. </el-option>
  133. </el-select>
  134. </template>
  135. <div v-if="param.length>0" style="width:90%;">提示:点击变量后会自动插入选择的文本框的焦点位置,在发送给粉丝时系统会自动替换对应变量值</div>
  136. </el-form-item>
  137. <el-form-item label="类型选择" v-if="param.length>0" >
  138. <div style="width:90%;">
  139. <template v-for="(item,index,key) in param">
  140. <el-tag style="margin-right:10px;margin-bottom:10px;" @click="add(item)">[[item]]</el-tag>
  141. </template>
  142. </div>
  143. </el-form-item>
  144. </div>
  145. </el-form>
  146. <el-form ref="form" :model="form" label-width="15%">
  147. <div class="right">
  148. <div style="margin-left:20px;margin-bottom:20px;">模板设置变量区域</div>
  149. <el-form-item label="模板名称">
  150. <el-input v-model="form.title" @focus="addName('title')" style="width:80%;" ref="title"></el-input>
  151. </el-form-item>
  152. <el-form-item label="模板消息ID">
  153. <el-input v-model="form.template_id" style="width:80%;" disabled></el-input>
  154. </el-form-item>
  155. <el-form-item label="头部标题">
  156. <el-input type="textarea" v-model="form.first" @focus="addName('first')" style="width:80%;" ref="first"></el-input>
  157. </el-form-item>
  158. {{-- <el-form-item label="文字颜色">--}}
  159. {{-- <div><el-color-picker v-model="form.first_color" @change="change" ></el-color-picker></div>--}}
  160. {{-- </el-form-item>--}}
  161. <el-form-item label="键值设置">
  162. <div class="tabel-data" style="width:80%;">
  163. <div class="head">
  164. <div style="width:25%;text-align:center;">键名</div>
  165. <div style="width:50%;text-align:center;">描述</div>
  166. <div style="width:25%;text-align:center;">颜色</div>
  167. </div>
  168. <div class="data">
  169. <div v-for="(item,index,key) in block" style="display:flex;align-items:center;margin-top:20px;">
  170. <div style="width:25%;text-align:center;">[[item.title]]</div>
  171. <div style="width:50%;text-align:center;">
  172. <el-input type="textarea" v-model="item.value" @focus="addName(item)" ></el-input>
  173. </div>
  174. <div style="width:25%;text-align:center;display:flex;align-items:center;justify-content:center;"><el-color-picker v-model="item.color" @change="change"></el-color-picker></div>
  175. </div>
  176. </div>
  177. </div>
  178. </el-form-item>
  179. <el-form-item label="尾部描述">
  180. <el-input type="textarea" v-model="form.remark" @focus="addName('remark')" style="width:80%;" ref="remark"></el-input>
  181. </el-form-item>
  182. <el-form-item label="文字颜色">
  183. <div><el-color-picker v-model="form.remark_color" @change="change"></el-color-picker></div>
  184. </el-form-item>
  185. <el-form-item label="跳转链接地址">
  186. <el-input v-model="form.news_link" @focus="addName('new_link')" style="width:70%;" ref="new_link"></el-input><el-button @click="show=true" style="margin-left:10px;">选择链接</el-button>
  187. </el-form-item>
  188. </div>
  189. </el-form>
  190. </div>
  191. </div>
  192. <div class="confirm-btn">
  193. <el-button type="primary" @click="submit">提交</el-button>
  194. </div>
  195. <pop :show="show" @replace="changeProp1" @add="parHref"></pop>
  196. </div>
  197. </div>
  198. @include('public.admin.pop')
  199. <script>
  200. var vm = new Vue({
  201. el: "#re_content",
  202. delimiters: ['[[', ']]'],
  203. data() {
  204. return {
  205. templateidshort:'',
  206. name:'',
  207. activeName: 'first',
  208. show:false,
  209. tmp_list:[],
  210. content:'',
  211. temp:[],
  212. param:[],
  213. block:[],
  214. value:'',
  215. form:{
  216. tp_kw:[],
  217. tp_color:[],
  218. tp_value:[],
  219. title:'',
  220. template_id:'',
  221. first:'',
  222. first_color:"#101111",
  223. remark:'',
  224. remark_color:"#101111",
  225. news_link:'',
  226. },
  227. }
  228. },
  229. mounted () {
  230. this.gettemp();
  231. this.getData();
  232. },
  233. methods: {
  234. goBack() {
  235. window.location.href = `{!! yzWebFullUrl('setting.shop.index') !!}`;
  236. },
  237. addQuick(){
  238. this.$http.post("{!! yzWebUrl('setting.wechat-notice.addTmp') !!}",{templateidshort:this.templateidshort}).then(function (response){
  239. if (response.data.result) {
  240. this.$message({message: response.data.msg,type: 'success'});
  241. }
  242. else {
  243. this.$message({message: response.data.msg,type: 'error'});
  244. }
  245. },function (response) {
  246. this.$message({message: response.data.msg,type: 'error'});
  247. })
  248. },
  249. change(val){
  250. this.$forceUpdate()
  251. },
  252. add(item){
  253. if(!this.name){
  254. return
  255. }
  256. if(this.name instanceof Object){
  257. this.block.forEach((list,index,key)=>{
  258. if(list.title==this.name.title){
  259. this.block[index].value=this.block[index].value+`[${item}]`
  260. }
  261. })
  262. }else{
  263. this.form[this.name]=this.$refs[this.name].value+`[${item}]`
  264. }
  265. },
  266. addName(name){
  267. this.name=name
  268. },
  269. // 弹窗显示与隐藏的控制
  270. changeProp1(item){
  271. this.show=item;
  272. },
  273. // 当前链接的增加
  274. parHref(child,confirm){
  275. this.show=confirm;
  276. this.form.news_link=child;
  277. },
  278. paramSelect(val){
  279. this.temp.forEach((item,index,key)=>{
  280. if(item.value==val){
  281. this.param=this.temp[index].param
  282. }
  283. })
  284. },
  285. Select(val){
  286. this.block=[];
  287. this.tmp_list.forEach((item,index,key)=>{
  288. if(item.template_id==val){
  289. this.content=this.tmp_list[index].content
  290. this.form.template_id=item.template_id
  291. this.form.title=item.title
  292. this.tmp_list[index].contents.slice(1,this.tmp_list[index].contents.length-1).forEach((list,index,key)=>{
  293. this.block.push({title:list,color:"#101111",value:''})
  294. })
  295. }
  296. })
  297. },
  298. getData(){
  299. this.$http.post('{!! yzWebFullUrl('setting.diy-temp.add') !!}').then(function (response){
  300. if (response.data.result) {
  301. this.temp=response.data.data.temp
  302. }
  303. else {
  304. this.$message({message: response.data.msg,type: 'error'});
  305. }
  306. },function (response) {
  307. this.$message({message: response.data.msg,type: 'error'});
  308. })
  309. },
  310. gettemp(){
  311. this.$http.post('{!! yzWebFullUrl('setting.wechat-notice.returnJson') !!}').then(function (response){
  312. if (response.data.result) {
  313. this.tmp_list=response.data.data.tmp_list
  314. }
  315. else {
  316. this.$message({message: response.data.msg,type: 'error'});
  317. }
  318. },function (response) {
  319. this.$message({message: response.data.msg,type: 'error'});
  320. })
  321. },
  322. submit() {
  323. this.block.forEach((item,index,key)=>{
  324. this.form.tp_kw.push(item.title)
  325. this.form.tp_value.push(item.value)
  326. this.form.tp_color.push(item.color)
  327. })
  328. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  329. this.$http.post('{!! yzWebFullUrl('setting.diy-temp.add') !!}',{'temp':this.form}).then(function (response){
  330. this.$message({message: response.data.msg,type: 'success'});
  331. window.location.href='{!! yzWebFullUrl('setting.diy-temp.index') !!}'
  332. },function (response) {
  333. this.$message({message: response.data.msg,type: 'error'});
  334. })
  335. },
  336. },
  337. });
  338. </script>
  339. @endsection