deposit-ladder.blade.php 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946
  1. @extends('layouts.base')
  2. @section('title', '基础设置')
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/new-poster/views/admin/index.css')}}">
  5. <link rel="stylesheet" href="{{resource_get('plugins/new-poster/views/admin/edit.css')}}">
  6. <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
  7. <style>
  8. /* 导航 */
  9. .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;}
  10. .el-radio-button__inner{border:0;}
  11. .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
  12. .upload-boxed .el-icon-close {position: absolute;top: -5px;right: -5px;color: #fff;background: #333;border-radius: 50%;cursor: pointer;}
  13. .el-radio__inner { border: 1px solid #cfcfcf;}
  14. .edit-poster .el-form-item__label{width:20%!important}
  15. .edit-poster .el-form-item__content{margin-left:20%!important}
  16. </style>
  17. <div class="all">
  18. <div id="app" v-cloak>
  19. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  20. <div class="vue-head">
  21. <el-radio-group v-model="order_type">
  22. <el-radio-button label="1">海报设置</el-radio-button>
  23. </el-radio-group>
  24. </div>
  25. <div v-show="order_type==1">
  26. <div class="vue-head">
  27. <div class="vue-main-title">
  28. <div class="vue-main-title-left"></div>
  29. <div class="vue-main-title-content">基础设置</div>
  30. </div>
  31. <div class="vue-main-form">
  32. <el-form-item label="海报名称" prop="title">
  33. <el-input v-model="form.title" style="width:70%;" ref="title"></el-input>
  34. </el-form-item>
  35. <el-form-item label="是否启用" prop="status">
  36. <el-switch v-model="form.status" :active-value="1" :inactive-value="0"></el-switch>
  37. </el-form-item>
  38. </div>
  39. </div>
  40. <div class="vue-head" style="margin-top:20px">
  41. <div class="vue-main-title">
  42. <div class="vue-main-title-left"></div>
  43. <div class="vue-main-title-content">海报设计</div>
  44. </div>
  45. <div class="vue-main-form">
  46. <div style="width:85%;margin:auto;display:flex;margin-bottom:30px;">
  47. <div style="width: 320px;height: 504px;border: 1px solid #ccc;position: relative;" :style="{backgroundColor:(background_type==0?form.color:'')}">
  48. <img v-if="form.background_url&&background_type==1" :src="form.background_url" alt="" style="width:100%;height:100%;">
  49. <drag-resize
  50. v-for="(rect, index) in rects"
  51. :key="index"
  52. :w="rect.width"
  53. :h="rect.height"
  54. :x="rect.left"
  55. :y="rect.top"
  56. :axis="rect.axis"
  57. :is-active="rect.active"
  58. :minw="rect.minw"
  59. :minh="rect.minh"
  60. :is-draggable="rect.draggable"
  61. :is-resizable="rect.resizable"
  62. :parent-limitation="rect.parentLim"
  63. :aspect-ratio="rect.aspectRatio"
  64. :z="rect.zIndex"
  65. :content-class="rect.class"
  66. v-on:activated="activateEv(index)"
  67. v-on:deactivated="deactivateEv(index)"
  68. v-on:dragging="changePosition($event, index)"
  69. v-on:resizing="changeSize($event, index)"
  70. style="position: absolute;"
  71. >
  72. <!-- logo -->
  73. <img v-if="rect.type=='logo'" :src="rect.logo_type?rect.src_url:logo_url" alt="" style="width:100%;height:100%;">
  74. <!-- logo -->
  75. <!-- 商品主图 -->
  76. <img v-if="rect.type=='img'" :src="goods_url" alt="" style="width:100%;height:100%;">
  77. <!-- 商品主图 -->
  78. <!-- 商品名称 -->
  79. <!-- bold:0,italic:0,slide:0,under:0 -->
  80. <div v-if="rect.type=='title'"
  81. :style="{color:rect.color,fontSize:rect.size+'px',fontWeight:(rect.bold?'bold':''),fontStyle:(rect.italic?'italic':''),textDecoration:((rect.slide||rect.under)?rect.slide?'line-through':'underline':'')}"
  82. style="width:100%;height:100%;white-space:nowrap;overflow:hidden"
  83. >
  84. 商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称
  85. </div>
  86. <!-- 商品名称 -->
  87. <!-- 图片 -->
  88. <img v-if="rect.type=='other_img'" :src="rect.src_url" alt="" style="width:100%;height:100%;">
  89. <!-- 图片 -->
  90. <!-- 会员价 -->
  91. <div v-if="rect.type=='deposit'"
  92. :style="{color:rect.color,fontSize:rect.size+'px',fontWeight:(rect.bold?'bold':''),fontStyle:(rect.italic?'italic':''),textDecoration:((rect.slide||rect.under)?rect.slide?'line-through':'underline':'')}"
  93. style="width:100%;height:100%;white-space:nowrap;overflow:hidden"
  94. >
  95. 定金:¥20.00
  96. </div>
  97. <!-- 会员价 -->
  98. <!-- 现价 -->
  99. <div v-if="rect.type=='price'"
  100. :style="{color:rect.color,fontSize:rect.size+'px',fontWeight:(rect.bold?'bold':''),fontStyle:(rect.italic?'italic':''),textDecoration:((rect.slide||rect.under)?rect.slide?'line-through':'underline':'')}"
  101. style="width:100%;height:100%;white-space:nowrap;overflow:hidden"
  102. >
  103. 现价:¥20.00
  104. </div>
  105. <!-- 现价 -->
  106. <!-- 头像 -->
  107. <img v-if="rect.type=='head'" :src="head_url" alt="" style="width:100%;height:100%;">
  108. <!-- 关注二维码 -->
  109. <img v-if="rect.type=='qr'" :src="qr_url" alt="" style="width:100%;height:100%;">
  110. <!-- 关注二维码 -->
  111. <!-- <img v-if="rect.type=='img'" :src="rect.src_url" alt="" style="width:100%;height:100%;"> -->
  112. <div v-if="rect.type=='nickname'"
  113. :style="{color:rect.color,fontSize:rect.size+'px'}"
  114. style="width:100%;height:100%;"
  115. >
  116. 昵称
  117. </div>
  118. <div v-if="rect.type=='invite'"
  119. :style="{color:rect.color,fontSize:rect.size+'px'}"
  120. style="width:100%;height:100%;"
  121. >
  122. A1H3U5GF
  123. </div>
  124. <div v-if="rect.type=='mid'"
  125. :style="{color:rect.color,fontSize:rect.size+'px'}"
  126. style="width:100%;height:100%;"
  127. >
  128. 8888
  129. </div>
  130. </drag-resize>
  131. </div>
  132. <div class="edit-poster" style="flex:1;margin-left:10%">
  133. <!-- <div>背景图片</div> -->
  134. <el-form-item label="背景" prop="background">
  135. <el-radio v-model="background_type" :label="0">颜色</el-radio>
  136. <el-radio v-model="background_type" :label="1">自定义图片</el-radio>
  137. </el-form-item>
  138. <el-form-item label="" prop="background" v-if="background_type==1">
  139. <div class="upload-box" @click="openUpload('background')" v-if="!form.background_url">
  140. <i class="el-icon-plus" style="font-size:32px"></i>
  141. </div>
  142. <div @click="openUpload('background')" class="upload-boxed" v-if="form.background_url" style="height:236.25px">
  143. <img :src="form.background_url" alt="" style="width:150px;height:236.25px;border-radius: 5px;cursor: pointer;">
  144. <i class="el-icon-close" @click.stop="clearImg('background')" title="点击清除图片"></i>
  145. <div class="upload-boxed-text">点击重新上传</div>
  146. </div>
  147. <div class="tip">建议背景图片尺寸: 640*1008
  148. <span v-if="isDecorate">
  149. <span @click.stop="jumpUrl" style="color: #196dfa;font-weight: 600;margin-left: 15px;cursor:pointer;">图片智能在线设计</span><i class="el-icon-question" style="color:#196dfa;margin-left:2px;" @click="showIntroduce = true;"></i>
  150. </span>
  151. </div>
  152. </el-form-item>
  153. <el-form-item label="" prop="" v-else>
  154. <el-color-picker v-model="form.color" style="display:inline-block"></el-color-picker>
  155. </el-form-item>
  156. <el-form-item label="海报元素" prop="" >
  157. <div style="width:500px;">
  158. 活动名称,定金,现价,活动二维码,头像,昵称,会员id,邀请码
  159. <el-button size="small" @click="addEle('logo')">商城logo</el-button>
  160. <el-button size="small" @click="addEle('img')">商品主图</el-button>
  161. <el-button size="small" @click="addEle('deposit')">定金</el-button>
  162. <el-button size="small" @click="addEle('price')">现价</el-button>
  163. <el-button size="small" @click="addEle('qr')">活动二维码</el-button>
  164. <el-button size="small" @click="addEle('head')">头像</el-button>
  165. <el-button size="small" @click="addEle('nickname')">昵称</el-button>
  166. <el-button size="small" @click="addEle('invite')">邀请码</el-button>
  167. <el-button size="small" @click="addEle('mid')">会员ID</el-button>
  168. <el-button type="text" v-if="choosed_index!=-1" icon="iconfont icon-ht_operation_delete" @click="delEle" title="删除当前元素" style="color:#F56C6C"></el-button>
  169. </div>
  170. </el-form-item>
  171. <!-- logo设置项 -->
  172. <div v-if="choosed_obj.type=='logo'">
  173. <el-form-item label="商城logo" prop="background">
  174. <el-radio v-model="choosed_obj.logo_type" :label="0">默认</el-radio>
  175. <el-radio v-model="choosed_obj.logo_type" :label="1">自定义</el-radio>
  176. </el-form-item>
  177. <el-form-item label="图片设置" prop="" v-if="choosed_obj.logo_type==1">
  178. <div class="upload-box" @click="openUpload('src',2)" v-if="!choosed_obj.src_url">
  179. <i class="el-icon-plus" style="font-size:32px"></i>
  180. </div>
  181. <div @click="openUpload('src',2)" class="upload-boxed" v-if="choosed_obj.src_url" style="height:150px">
  182. <img :src="choosed_obj.src_url" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
  183. <i class="el-icon-close" @click.stop="clearImg('src',2)" title="点击清除图片"></i>
  184. <div class="upload-boxed-text">点击重新上传</div>
  185. </div>
  186. </el-form-item>
  187. </div>
  188. <!-- 商品主图设置项 -->
  189. <!-- <div v-if="choosed_obj.type=='img'">
  190. <el-form-item label="商品主图圆角" prop="background">
  191. <el-slider v-model="choosed_obj.borderRadius" style="width:500px" show-input></el-slider>
  192. </el-form-item>
  193. </div> -->
  194. <!-- 商品名称设置项 -->
  195. <div v-if="choosed_obj.type=='title'">
  196. <el-form-item label="商品名称文字颜色" prop="banner1">
  197. <el-color-picker v-model="choosed_obj.color" style="display:inline-block"></el-color-picker>
  198. </el-form-item>
  199. <el-form-item label="商品名称文字大小" prop="banner1">
  200. <el-input v-model="choosed_obj.size" style="width:200px">
  201. <template slot="append">PX</template>
  202. </el-input>
  203. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_blod" @click="changeText('b')" title="加粗" :style="{color:choosed_obj.bold?'':'#000'}"></el-button> -->
  204. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_italic" @click="changeText('i')" title="斜体" :style="{color:choosed_obj.italic?'':'#000'}"></el-button> -->
  205. <el-button type="text" icon="iconfont icon-ht_textstyle_delete" @click="changeText('s')" title="中划线" :style="{color:choosed_obj.slide?'':'#000'}"></el-button>
  206. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_delete1" @click="changeText('u')" title="下划线" :style="{color:choosed_obj.under?'':'#000'}"></el-button> -->
  207. </el-form-item>
  208. </div>
  209. <!-- 图片设置项 -->
  210. <div v-if="choosed_obj.type=='other_img'">
  211. <el-form-item label="图片设置" prop="">
  212. <div class="upload-box" @click="openUpload('src',2)" v-if="!choosed_obj.src_url">
  213. <i class="el-icon-plus" style="font-size:32px"></i>
  214. </div>
  215. <div @click="openUpload('src',2)" class="upload-boxed" v-if="choosed_obj.src_url" style="height:150px">
  216. <img :src="choosed_obj.src_url" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
  217. <i class="el-icon-close" @click.stop="clearImg('src',2)" title="点击清除图片"></i>
  218. <div class="upload-boxed-text">点击重新上传</div>
  219. </div>
  220. </el-form-item>
  221. </div>
  222. <!-- 会员价设置项 -->
  223. <div v-if="choosed_obj.type=='deposit'">
  224. <el-form-item label="定金文字颜色" prop="banner1">
  225. <el-color-picker v-model="choosed_obj.color" style="display:inline-block"></el-color-picker>
  226. </el-form-item>
  227. <el-form-item label="定金文字大小" prop="banner1">
  228. <el-input v-model="choosed_obj.size" style="width:200px">
  229. <template slot="append">PX</template>
  230. </el-input>
  231. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_blod" @click="changeText('b')" title="加粗" :style="{color:choosed_obj.bold?'':'#000'}"></el-button> -->
  232. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_italic" @click="changeText('i')" title="斜体" :style="{color:choosed_obj.italic?'':'#000'}"></el-button> -->
  233. <el-button type="text" icon="iconfont icon-ht_textstyle_delete" @click="changeText('s')" title="中划线" :style="{color:choosed_obj.slide?'':'#000'}"></el-button>
  234. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_delete1" @click="changeText('u')" title="下划线" :style="{color:choosed_obj.under?'':'#000'}"></el-button> -->
  235. </el-form-item>
  236. </div>
  237. <!-- 现价设置项 -->
  238. <div v-if="choosed_obj.type=='price'">
  239. <el-form-item label="现价文字颜色" prop="">
  240. <el-color-picker v-model="choosed_obj.color" style="display:inline-block"></el-color-picker>
  241. </el-form-item>
  242. <el-form-item label="现价文字大小" prop="">
  243. <el-input v-model="choosed_obj.size" style="width:200px">
  244. <template slot="append">PX</template>
  245. </el-input>
  246. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_blod" @click="changeText('b')" title="加粗" :style="{color:choosed_obj.bold?'':'#000'}"></el-button> -->
  247. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_italic" @click="changeText('i')" title="斜体" :style="{color:choosed_obj.italic?'':'#000'}"></el-button> -->
  248. <el-button type="text" icon="iconfont icon-ht_textstyle_delete" @click="changeText('s')" title="中划线" :style="{color:choosed_obj.slide?'':'#000'}"></el-button>
  249. <!-- <el-button type="text" icon="iconfont icon-ht_textstyle_delete1" @click="changeText('u')" title="下划线" :style="{color:choosed_obj.under?'':'#000'}"></el-button> -->
  250. </el-form-item>
  251. </div>
  252. <!-- 昵称、邀请码、会员ID设置项 -->
  253. <div v-if="choosed_obj.type=='nickname' || choosed_obj.type=='invite' || choosed_obj.type=='mid'">
  254. <el-form-item label="文字颜色" prop="banner1">
  255. <el-color-picker v-model="choosed_obj.color" style="display:inline-block"></el-color-picker>
  256. </el-form-item>
  257. <el-form-item label="文字大小" prop="banner1">
  258. <el-input v-model="choosed_obj.size" style="width:200px">
  259. <template slot="append">PX</template>
  260. </el-input>
  261. </el-form-item>
  262. </div>
  263. <!-- 小程序二维码设置项 -->
  264. <div v-if="choosed_obj.type=='qr'&&poster_type==2">
  265. <el-form-item label="小程序二维码链接跳转" prop="">
  266. <el-input v-model="choosed_obj.mini_link" style="width:300px;"></el-input>
  267. <el-button @click="showLink('mini','mini_link',2)">选择链接</el-button>
  268. <div class="tip">默认跳转小程序首页</div>
  269. </el-form-item>
  270. </div>
  271. <!-- H5二维码设置项 -->
  272. <div v-if="choosed_obj.type=='qr'&&poster_type==5">
  273. <el-form-item label="二维码链接跳转" prop="">
  274. <el-input v-model="choosed_obj.h5_link" style="width:300px;"></el-input>
  275. <el-button @click="showLink('link','h5_link',5)">选择链接</el-button>
  276. <div class="tip">默认跳转商城首页</div>
  277. </el-form-item>
  278. </div>
  279. </div>
  280. </div>
  281. </div>
  282. </div>
  283. </div>
  284. </el-form>
  285. <!-- 分页 -->
  286. <div class="vue-page">
  287. <div class="vue-center">
  288. <el-button type="primary" @click="submitForm('form')">提交</el-button>
  289. <el-button @click="goBack">返回</el-button>
  290. </div>
  291. </div>
  292. <upload-img :upload-show="uploadShow" :name="chooseImgName" @replace="changeProp" @sure="sureImg"></upload-img>
  293. <pop :show="show" @replace="changeLink" @add="parHref"></pop>
  294. <program :pro="pro" @replacepro="changeprogram" @addpro="parpro"></program>
  295. </div>
  296. </div>
  297. @include('public.admin.uploadImg')
  298. @include('public.admin.vueDragResize')
  299. @include('public.admin.pop')
  300. @include('public.admin.program')
  301. <script>
  302. const CktUrl = "{!! $ckt_url !!}"; //* 创客贴url
  303. const IsDecorate = "{!! $is_decorate !!}";
  304. </script>
  305. <script>
  306. const qr_url = `{!! resource_get('plugins/new-poster/assets/img/qr.png') !!}`;
  307. const head_url = `{!! resource_get('plugins/new-poster/assets/img/head.jpg') !!}`;
  308. const thumb_url = `{!! resource_get('plugins/new-poster/assets/img/img.jpg') !!}`;
  309. const app_qr_url = `{!! resource_get('plugins/new-poster/assets/img/qr_app_share.jpg') !!}`;
  310. const qr_shop = `{!! resource_get('plugins/new-poster/assets/img/qr_shop.jpg') !!}`;
  311. const logo_url = `{!! resource_get('plugins/new-poster/assets/img/logo.png') !!}`;
  312. const goods_url = `{!! resource_get('plugins/new-poster/assets/img/goods.png') !!}`;
  313. let data = {!! json_encode($data)?:'[]' !!};
  314. let poster = {!! json_encode($poster)?:'{}' !!};
  315. let shop_credit1 = {!! json_encode($shop_credit1)?:'{}' !!};
  316. let id = 0;
  317. let supplement = {};
  318. let background_type = 1;
  319. if(data==null) {
  320. data = [];
  321. }
  322. if(poster==null) {
  323. poster = {};
  324. }
  325. else{
  326. supplement = poster.supplement;
  327. id = poster.id;
  328. background_type = poster.background?1:0;
  329. }
  330. if(shop_credit1==null) {
  331. shop_credit1 = "";
  332. }
  333. console.log(data);
  334. console.log(poster);
  335. console.log(shop_credit1);
  336. console.log(id);
  337. console.log(background_type);
  338. var app = new Vue({
  339. el:"#app",
  340. delimiters: ['[[', ']]'],
  341. name: 'test',
  342. data() {
  343. return{
  344. id:id,
  345. poster_type:1,
  346. background_type:background_type,
  347. label_word:"",
  348. label_show:false,
  349. history_show:false,
  350. label_list:[],
  351. label_total:0,
  352. label_per_page:0,
  353. label_current_page:0,
  354. show:false,//是否开启公众号弹窗
  355. pro:false ,//是否开启小程序弹窗
  356. chooseLink:'',
  357. chooseMiniLink:'',
  358. link_type:1,
  359. coupon_word:"",
  360. coupon_show:false,
  361. coupon_list:[],
  362. coupon_total:0,
  363. coupon_per_page:0,
  364. coupon_current_page:0,
  365. coupon_type:0,
  366. rects:[],
  367. data:data,
  368. zIndex:0,//全局层次
  369. choosed_obj:{},
  370. choosed_index:-1,
  371. qr_url :qr_url,
  372. head_url :head_url,
  373. thumb_url:thumb_url,
  374. app_qr_url:app_qr_url,
  375. logo_url:logo_url,
  376. qr_shop:qr_shop,
  377. goods_url:goods_url,
  378. listWidth:"",
  379. listHeight:"",
  380. color1:'1',
  381. order_type:1,
  382. link_show:false,
  383. link_ref : "",
  384. link_type : "",
  385. link_form:{
  386. },
  387. form:{
  388. // poster
  389. title:poster.title || "",
  390. status:poster.status || 0,
  391. background:poster.background || "",
  392. background_url:poster.background_url || "",
  393. color:poster.color || "",
  394. },
  395. coupon_word1:"",
  396. coupon_word2:"",
  397. uploadShow:false,
  398. chooseImgName:'',
  399. img_type:"",
  400. submit_url:'',
  401. showVisible:false,
  402. loading: false,
  403. rules:{
  404. name:{ required: true, message: '请输入'}
  405. },
  406. isDecorate:IsDecorate,
  407. }
  408. },
  409. created() {
  410. },
  411. mounted() {
  412. if(this.id) {
  413. this.submit_url = '{!! yzWebFullUrl('plugin.new-poster.admin.poster.edit-deposit-ladder') !!}'
  414. }
  415. else {
  416. this.submit_url = '{!! yzWebFullUrl('plugin.new-poster.admin.poster.add-deposit-ladder') !!}'
  417. }
  418. this.poster_type = this.getParam('poster_type');
  419. console.log(this.poster_type)
  420. this.setPosterView(this.data);
  421. },
  422. methods: {
  423. setPosterView(data) {
  424. data.forEach((item,index) => {
  425. let width = parseInt(item.width);
  426. let height = parseInt(item.height);
  427. let top = parseInt(item.top);
  428. let left =parseInt(item.left);
  429. if(item.type=='logo') {
  430. this.rects.push(
  431. {zIndex:this.zIndex+1,type:item.type,src:item.src,src_url:item.src_url,logo_type:item.logo_type,width:width,height:width,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  432. )
  433. }
  434. else if(item.type=='img') {
  435. this.rects.push(
  436. {zIndex:this.zIndex+1,type:item.type,width:width,height:width,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  437. )
  438. }
  439. else if(item.type=='title') {
  440. let size = Number(item.size.split('p')[0]);
  441. this.rects.push(
  442. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  443. )
  444. }
  445. else if(item.type=="other_img") {
  446. this.rects.push(
  447. {zIndex:this.zIndex+1,type:item.type,src:item.src,src_url:item.src_url,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  448. )
  449. }
  450. else if(item.type=="member_price") {
  451. let size = Number(item.size.split('p')[0]);
  452. this.rects.push(
  453. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  454. )
  455. }
  456. else if(item.type=="market_price") {
  457. let size = Number(item.size.split('p')[0]);
  458. this.rects.push(
  459. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  460. )
  461. }
  462. else if(item.type=="deposit") {
  463. let size = Number(item.size.split('p')[0]);
  464. this.rects.push(
  465. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  466. )
  467. }
  468. else if(item.type=="price") {
  469. let size = Number(item.size.split('p')[0]);
  470. this.rects.push(
  471. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  472. )
  473. }
  474. else if(item.type=="qr"){
  475. this.rects.push(
  476. {zIndex:this.zIndex+1,type:item.type,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  477. )
  478. }
  479. else if(item.type=="nickname") {
  480. let size = Number(item.size.split('p')[0]);
  481. this.rects.push(
  482. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  483. )
  484. }
  485. else if(item.type=="invite") {
  486. let size = parseInt(item.size);
  487. this.rects.push(
  488. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  489. )
  490. }
  491. else if(item.type=="mid") {
  492. let size = Number(item.size.split('p')[0]);
  493. this.rects.push(
  494. {zIndex:this.zIndex+1,type:item.type,color:item.color,size:size,bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  495. )
  496. }
  497. else if(item.type=="head") {
  498. this.rects.push(
  499. {zIndex:this.zIndex+1,type:item.type,width:width,height:height,left:left,top:top,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  500. )
  501. }
  502. this.zIndex++;
  503. })
  504. },
  505. submitForm(formName) {
  506. console.log(this.form)
  507. console.log(this.rects)
  508. let that = this;
  509. let json = {
  510. poster:{
  511. poster_type:this.poster_type,
  512. title:this.form.title,
  513. status:this.form.status,
  514. background:this.form.background,
  515. background_url:this.form.background_url,
  516. color:this.form.color,
  517. },
  518. poster_supplement:{
  519. },
  520. data:[],
  521. };
  522. // 背景类型
  523. if(this.background_type==1) {
  524. json.poster.color = "";
  525. }
  526. else {
  527. json.poster.background = "";
  528. json.poster.background_url = "";
  529. }
  530. this.rects.forEach((item,index) => {
  531. if(item.type=="logo") {
  532. json.data.push({src:item.src,src_url:item.src_url,logo_type:item.logo_type,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type,})
  533. }
  534. if(item.type=="img") {
  535. json.data.push({width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  536. }
  537. if(item.type=="title") {
  538. json.data.push({color:item.color,size:item.size+'px',bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  539. }
  540. if(item.type=="other_img") {
  541. json.data.push({src:item.src,src_url:item.src_url,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type,})
  542. }
  543. if(item.type=="member_price") {
  544. json.data.push({color:item.color,size:item.size+'px',bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  545. }
  546. if(item.type=="deposit") {
  547. json.data.push({color:item.color,size:item.size+'px',bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  548. }
  549. if(item.type=="market_price") {
  550. json.data.push({color:item.color,size:item.size+'px',bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  551. }
  552. if(item.type=="price") {
  553. json.data.push({color:item.color,size:item.size+'px',bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  554. }
  555. if(item.type=="qr"){
  556. json.data.push({width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  557. }
  558. if(item.type=="nickname") {
  559. json.data.push({color:item.color,size:item.size+'px',bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  560. }
  561. if(item.type=="invite") {
  562. json.data.push({color:item.color,size:item.size+'px',bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  563. }
  564. if(item.type=="mid") {
  565. json.data.push({color:item.color,size:item.size+'px',bold:item.bold,italic:item.italic,slide:item.slide,under:item.under,width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  566. }
  567. if(item.type=="head") {
  568. json.data.push({width:item.width+'px',height:item.height+'px',top:item.top+'px',left:item.left+'px',type:item.type})
  569. }
  570. });
  571. let json1 = {
  572. form_data : json,
  573. }
  574. if(this.id) {
  575. json1.id = this.id
  576. }
  577. this.$refs[formName].validate((valid) => {
  578. if (valid) {
  579. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  580. this.$http.post(this.submit_url, json1).then(response => {
  581. if (response.data.result) {
  582. this.$message({type: 'success',message: '操作成功!'});
  583. this.goBack();
  584. } else {
  585. this.$message({message: response.data.msg,type: 'error'});
  586. }
  587. loading.close();
  588. },response => {
  589. loading.close();
  590. });
  591. }
  592. else {
  593. console.log('error submit!!');
  594. return false;
  595. }
  596. });
  597. },
  598. goBack() {
  599. history.go(-1)
  600. },
  601. openUpload(str,img_type) {
  602. this.chooseImgName = str;
  603. this.uploadShow = true;
  604. this.img_type = img_type;
  605. },
  606. changeProp(val) {
  607. if(val == true) {
  608. this.uploadShow = false;
  609. }
  610. else {
  611. this.uploadShow = true;
  612. }
  613. },
  614. sureImg(name,image,image_url) {
  615. if(this.img_type) {
  616. this.rects[this.choosed_index][name] = image;
  617. this.rects[this.choosed_index][name+'_url'] = image_url;
  618. this.choosed_obj[name] = image;
  619. this.choosed_obj[name+'_url'] = image_url;
  620. this.$forceUpdate();
  621. }
  622. else {
  623. this.form[name] = image;
  624. this.form[name+'_url'] = image_url;
  625. }
  626. console.log(this.rects)
  627. },
  628. clearImg(str,type) {
  629. if(type) {
  630. this.rects[this.choosed_index][str] = "";
  631. this.rects[this.choosed_index][str+'_url'] = "";
  632. this.choosed_obj[str] = "";
  633. this.choosed_obj[str+'_url'] = "";
  634. }
  635. else {
  636. this.form[str] = "";
  637. this.form[str+'_url'] = "";
  638. }
  639. this.$forceUpdate();
  640. },
  641. openCoupon(type) {
  642. this.coupon_type = type;
  643. this.coupon_show = true;
  644. },
  645. searchCoupon() {
  646. this.$http.post('{!! yzWebFullUrl('plugin.new-poster.admin.poster.getCouponByWord') !!}',{coupon_kwd:this.coupon_word}).then(response => {
  647. if (response.data.result) {
  648. this.coupon_list = response.data.data.list.data;
  649. this.coupon_total = response.data.data.list.total;
  650. this.coupon_per_page = response.data.data.list.per_page;
  651. this.coupon_current_page = response.data.data.list.current_page;
  652. } else {
  653. this.$message({message: response.data.msg,type: 'error'});
  654. }
  655. },response => {
  656. });
  657. },
  658. chooseCoupon(row) {
  659. if(this.coupon_type==1) {
  660. this.form.recommender_coupon_id = row.id;
  661. this.form.recommender_coupon_name = row.name;
  662. this.coupon_word1 = `【ID:】`+this.form.recommender_coupon_id+``+this.form.recommender_coupon_name;
  663. }
  664. else if(this.coupon_type==2) {
  665. this.form.subscriber_coupon_id = row.id;
  666. this.form.subscriber_coupon_name = row.name;
  667. this.coupon_word2 = `【ID:】`+this.form.subscriber_coupon_id+``+this.form.subscriber_coupon_name;
  668. }
  669. this.coupon_show = false;
  670. console.log(this.form)
  671. },
  672. clearCoupon(type) {
  673. if(type==1) {
  674. this.form.recommender_coupon_id = "";
  675. this.form.recommender_coupon_name = "";
  676. this.coupon_word1 = "";
  677. }
  678. else if(type==2) {
  679. this.form.subscriber_coupon_id = "";
  680. this.form.subscriber_coupon_name = "";
  681. this.coupon_word2 = "";
  682. }
  683. },
  684. addEle(type) {
  685. let is_true = false;
  686. let choose_index = -1;
  687. this.rects.some((item,index) => {
  688. if(item.type == type) {
  689. is_true = true;
  690. choose_index = index
  691. return true
  692. }
  693. })
  694. if(is_true) {
  695. this.rects[choose_index].active = true;
  696. return false;
  697. }
  698. if(type=="logo") {
  699. this.rects.push(
  700. {zIndex:this.zIndex+1,type:type,src:"",src_url:"",logo_type:0,width:100,height:100,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  701. )
  702. }
  703. if(type=="img") {
  704. this.rects.push(
  705. {zIndex:this.zIndex+1,type:type,width:100,height:100,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  706. )
  707. }
  708. if(type=="title") {
  709. this.rects.push(
  710. {zIndex:this.zIndex+1,type:type,color:"#000",size:14,bold:0,italic:0,slide:0,under:0,width:200,height:40,left:0,top:0,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  711. )
  712. }
  713. if(type=="other_img") {
  714. this.rects.push(
  715. {zIndex:this.zIndex+1,type:type,src:thumb_url,src_url:thumb_url,width:100,height:100,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  716. )
  717. }
  718. if(type=="member_price") {
  719. this.rects.push(
  720. {zIndex:this.zIndex+1,type:type,color:"#000",size:14,bold:0,italic:0,slide:0,under:0,width:200,height:40,left:0,top:0,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  721. )
  722. }
  723. if(type=="market_price") {
  724. this.rects.push(
  725. {zIndex:this.zIndex+1,type:type,color:"#000",size:14,bold:0,italic:0,slide:0,under:0,width:200,height:40,left:0,top:0,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  726. )
  727. }
  728. if(type=="deposit") {
  729. this.rects.push(
  730. {zIndex:this.zIndex+1,type:type,color:"#000",size:14,bold:0,italic:0,slide:0,under:0,width:200,height:40,left:0,top:0,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  731. )
  732. }
  733. if(type=="price") {
  734. this.rects.push(
  735. {zIndex:this.zIndex+1,type:type,color:"#000",size:14,bold:0,italic:0,slide:0,under:0,width:200,height:40,left:0,top:0,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  736. )
  737. }
  738. if(type=="qr"){
  739. this.rects.push(
  740. {zIndex:this.zIndex+1,type:type,width:100,height:100,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  741. )
  742. }
  743. if(type=="nickname") {
  744. this.rects.push(
  745. {zIndex:this.zIndex+1,type:type,color:"#f00",size:20,width:130,height:22,left:0,top:0,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  746. )
  747. }
  748. if(type=="invite") {
  749. this.rects.push(
  750. {zIndex:this.zIndex+1,type:type,color:"#f00",size:20,width:107,height:22,left:0,top:0,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  751. )
  752. }
  753. if(type=="mid") {
  754. this.rects.push(
  755. {zIndex:this.zIndex+1,type:type,color:"#f00",size:20,width:54,height:22,left:0,top:0,axis:"both",active:false,minw:40,minh:20,draggable:true,resizable:true,parentLim:true,aspectRatio:false,class:""}
  756. )
  757. }
  758. if(type=="head") {
  759. this.rects.push(
  760. {zIndex:this.zIndex+1,type:type,width:100,height:100,left:0,top:0,axis:"both",active:false,minw:40,minh:40,draggable:true,resizable:true,parentLim:true,aspectRatio:true,class:""}
  761. )
  762. }
  763. this.zIndex++;
  764. console.log(this.rects)
  765. },
  766. delEle() {
  767. console.log(this.rects);
  768. let list = JSON.parse(JSON.stringify(this.rects));
  769. list.splice(this.choosed_index,1);
  770. console.log(list);
  771. this.rects = [];
  772. // 样式处理
  773. setTimeout(() => {
  774. list.forEach((item,index) => {
  775. this.rects.push(item)
  776. })
  777. },10)
  778. this.choosed_obj = {};
  779. console.log(this.rects);
  780. this.choosed_index = -1;
  781. },
  782. activateEv(index) {
  783. console.log(index);
  784. if(this.choosed_index!=-1) {
  785. this.rects[this.choosed_index].active = false;
  786. }
  787. this.choosed_obj = this.rects[index];
  788. this.choosed_index = index;
  789. this.rects[index].active = true;
  790. },
  791. deactivateEv(index) {
  792. console.log(index)
  793. // this.rects[index].active = false;
  794. // this.choosed_index!=-1;
  795. },
  796. changePosition(newRect, index) {
  797. this.rects[index].top = newRect.top;
  798. this.rects[index].left = newRect.left;
  799. this.rects[index].width = newRect.width;
  800. this.rects[index].height = newRect.height;
  801. },
  802. changeSize(newRect, index) {
  803. this.rects[index].top = newRect.top;
  804. this.rects[index].left = newRect.left;
  805. this.rects[index].width = newRect.width;
  806. this.rects[index].height = newRect.height;
  807. },
  808. showLink(type,name,link_type) {
  809. if(type=="link") {
  810. this.chooseLink = name;
  811. this.show = true;
  812. }
  813. else {
  814. this.chooseMiniLink = name;
  815. this.pro = true;
  816. }
  817. this.link_type = link_type;
  818. },
  819. changeProp(val) {
  820. if(val == true) {
  821. this.uploadShow = false;
  822. }
  823. else {
  824. this.uploadShow = true;
  825. }
  826. },
  827. //弹窗显示与隐藏的控制
  828. changeLink(item){
  829. this.show=item;
  830. },
  831. //当前链接的增加
  832. parHref(child,confirm){
  833. this.show=confirm;
  834. // this.form.link=child;
  835. if(this.link_type!=5) {
  836. this.form[this.chooseLink] = child;
  837. }
  838. else {
  839. this.rects[this.choosed_index]['h5_link'] = child;
  840. this.$forceUpdate();
  841. }
  842. },
  843. changeprogram(item){
  844. this.pro=item;
  845. },
  846. parpro(child,confirm){
  847. this.pro=confirm;
  848. // this.form.prolink=child;
  849. if(this.link_type!=2) {
  850. this.form[this.chooseMiniLink] = child;
  851. }
  852. else {
  853. this.rects[this.choosed_index]['mini_link'] = child;
  854. this.$forceUpdate();
  855. }
  856. },
  857. changeText(type) {
  858. if(type=='b') {
  859. this.choosed_obj.bold = this.choosed_obj.bold==1?0:1;
  860. this.rects[this.choosed_index].bold = this.choosed_obj.bold;
  861. }
  862. if(type=='i') {
  863. this.choosed_obj.italic = this.choosed_obj.italic==1?0:1;
  864. this.rects[this.choosed_index].italic = this.choosed_obj.italic;
  865. }
  866. if(type=='s') {
  867. this.choosed_obj.slide = this.choosed_obj.slide==1?0:1;
  868. this.rects[this.choosed_index].slide = this.choosed_obj.slide;
  869. if(this.rects[this.choosed_index].slide) {
  870. this.rects[this.choosed_index].under = 0;
  871. }
  872. }
  873. if(type=='u') {
  874. this.choosed_obj.under = this.choosed_obj.under==1?0:1;
  875. this.rects[this.choosed_index].under = this.choosed_obj.under;
  876. if(this.rects[this.choosed_index].under) {
  877. this.rects[this.choosed_index].slide = 0;
  878. }
  879. }
  880. },
  881. getParam(name) {
  882. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  883. var r = window.location.search.substr(1).match(reg);
  884. if (r != null) return unescape(r[2]);
  885. return null;
  886. },
  887. jumpUrl() {
  888. window.open(CktUrl);
  889. },
  890. },
  891. })
  892. </script>
  893. @endsection