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