send_detail.blade.php 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', trans('发货单模版编辑'))
  4. <script language='javascript' src="{{resource_get('plugins/exhelper/src/common/static/js/jquery.min.js', 1)}}"></script>
  5. <script language='javascript' src="{{resource_get('plugins/exhelper/src/common/static/js/designer.js', 1)}}"></script>
  6. <script language='javascript' src="{{resource_get('plugins/exhelper/src/common/static/js/designer.js', 1)}}"></script>
  7. <script language='javascript' src="{{resource_get('plugins/exhelper/src/common/static/js/jquery.contextMenu.js', 1)}}"></script>
  8. <script language='javascript' src="{{resource_get('plugins/exhelper/src/common/static/js/jquery.form.js', 1)}}"></script>
  9. <link href="{{resource_get('plugins/exhelper/src/common/static/js/jquery.contextMenu.css', 1)}}" rel="stylesheet">
  10. <style type='text/css'>
  11. #container {
  12. border: 1px solid #ccc;
  13. position: relative;
  14. background: #fff;
  15. overflow: hidden;
  16. }
  17. .items label {
  18. width: 120px;
  19. margin: 0;
  20. float: left;
  21. }
  22. #container .bg {
  23. position: absolute;
  24. width: 100%;
  25. z-index: 0;
  26. }
  27. #container .drag {
  28. position: absolute;
  29. min-width: 120px;
  30. min-height: 25px;
  31. border: 1px solid #aaa;
  32. z-index: 1;
  33. top: 10px;
  34. left: 100px;
  35. background: #fff;
  36. cursor: move;
  37. }
  38. #container .rRightDown,
  39. .rLeftDown,
  40. .rLeftUp,
  41. .rRightUp,
  42. .rRight,
  43. .rLeft,
  44. .rUp,
  45. .rDown {
  46. position: absolute;
  47. width: 7px;
  48. height: 7px;
  49. z-index: 1;
  50. font-size: 0;
  51. }
  52. .rRightDown,
  53. .rLeftDown,
  54. .rLeftUp,
  55. .rRightUp,
  56. .rRight,
  57. .rLeft,
  58. .rUp,
  59. .rDown {
  60. position: absolute;
  61. background: #428bca;
  62. width: 6px;
  63. height: 6px;
  64. z-index: 5;
  65. font-size: 0;
  66. }
  67. .rLeftDown,
  68. .rRightUp {
  69. cursor: ne-resize;
  70. }
  71. .rRightDown,
  72. .rLeftUp {
  73. cursor: nw-resize;
  74. }
  75. .rRight,
  76. .rLeft {
  77. cursor: e-resize;
  78. }
  79. .rUp,
  80. .rDown {
  81. cursor: n-resize;
  82. }
  83. .rRightDown {
  84. bottom: -3px;
  85. right: -3px;
  86. background: #2a6496;
  87. }
  88. .rLeftDown {
  89. bottom: -3px;
  90. left: -3px;
  91. }
  92. .rRightUp {
  93. top: -3px;
  94. right: -3px;
  95. }
  96. .rLeftUp {
  97. top: -3px;
  98. left: -3px;
  99. }
  100. .rRight {
  101. right: -3px;
  102. top: 50%;
  103. margin-top: -3px;
  104. }
  105. .rLeft {
  106. left: -3px;
  107. top: 50%;
  108. margin-top: -3px;
  109. }
  110. .rUp {
  111. top: -3px;
  112. left: 50%;
  113. }
  114. .rDown {
  115. bottom: -3px;
  116. left: 50%
  117. }
  118. .context-menu-layer {
  119. z-index: 9999;
  120. }
  121. .context-menu-list {
  122. z-index: 9999;
  123. }
  124. .items .checkbox-inline,
  125. .col-xs-12 .checkbox-inline {
  126. margin: 0;
  127. float: left;
  128. width: 100px;
  129. }
  130. </style>
  131. <div class="main rightlist">
  132. <form id='dataform' action="" method="post" class="form-horizontal form">
  133. <input type="hidden" name="id" value="{{$item->id}}" />
  134. <input type="hidden" name="cate" value="{{$cate}}" />
  135. <input type="hidden" id="datas" name="datas" value="" />
  136. <input type="hidden" id="expresscom" name="expresscom" value="" />
  137. <div class="panel panel-default">
  138. <div class="panel-heading">发货单模版编辑</div>
  139. <div class="panel-body">
  140. <div>
  141. <div class="input-group">
  142. <div class="input-group-addon" style="border-right:none">发货单名称</div>
  143. <input type="text" name="expressname" class="form-control" value="{{$item->expressname}}" />
  144. <div class="input-group-addon" style="border-right:none; border-left: none;"> 单据宽度</div>
  145. <input type="number" name="width" class="form-control" value="@if(!empty($item->width)){{$item->width}}@else{{250}}@endif" onchange="pagesize()" />
  146. <div class="input-group-addon" style="border-right:none; border-left: none;">mm(毫米) 单据高度</div>
  147. <input type="number" name="height" class="form-control" value="@if(!empty($item->height)){{$item->height}}@else{{150}}@endif" onchange="pagesize()" />
  148. <div class="input-group-addon" style="border-right:none; border-left: none;">mm(毫米)</div>
  149. <div class="input-group-addon" style="border-right:none;">发货单底图</div>
  150. <input id="bg" type="text" name="background" class="form-control" value="{{$item->bg}}" />
  151. <span style="background: #fff;" class="input-group-addon btn btn-default " onclick="changeBG()">选择图片</span>
  152. <span style="background: #fff;" class="input-group-addon btn btn-default " onclick="changeBG(1)">清除图片</span>
  153. </div>
  154. {{--<div class="input-group" style="margin-top: 10px; width: 300px;">
  155. <div class="input-group-addon" style="border-right:none">快递类型</div>
  156. <select id="express" name="express" class="form-control">
  157. <option @if($item->express == '') selected="" @endif data-name="" value="" >其他快递</option>
  158. <option @if($item->express == 'shunfeng') selected="" @endif data-name="顺丰" value="shunfeng">顺丰</option>
  159. <option @if($item->express == 'shentong') selected="" @endif data-name="申通" value="shentong">申通</option>
  160. <option @if($item->express == 'yunda') selected="" @endif data-name="韵达快运" value="yunda">韵达快运</option>
  161. <option @if($item->express == 'tiantian') selected="" @endif data-name="天天快递" value="tiantian">天天快递</option>
  162. <option @if($item->express == 'yuantong') selected="" @endif data-name="圆通速递" value="yuantong">圆通速递</option>
  163. <option @if($item->express == 'zhongtong') selected="" @endif data-name="中通速递" value="zhongtong">中通速递</option>
  164. <option @if($item->express == 'ems') selected="" @endif data-name="ems快递" value="ems">ems快递</option>
  165. <option @if($item->express == 'huitongkuaidi') selected="" @endif data-name="汇通快运" value="huitongkuaidi">汇通快运</option>
  166. <option @if($item->express == 'quanfengkuaidi') selected="" @endif data-name="全峰快递" value="quanfengkuaidi">全峰快递</option>
  167. <option @if($item->express == 'zhaijisong') selected="" @endif data-name="宅急送" value="zhaijisong">宅急送</option>
  168. <option @if($item->express == 'aae') selected="" @endif data-name="aae全球专递" value="aae">aae全球专递</option>
  169. <option @if($item->express == 'anjie') selected="" @endif data-name="安捷快递" value="anjie">安捷快递</option>
  170. <option @if($item->express == 'anxindakuaixi') selected="" @endif data-name="安信达快递" value="anxindakuaixi">安信达快递</option>
  171. <option @if($item->express == 'biaojikuaidi') selected="" @endif data-name="彪记快递" value="biaojikuaidi">彪记快递</option>
  172. <option @if($item->express == 'bht') selected="" @endif data-name="bht" value="bht">bht</option>
  173. <option @if($item->express == 'baifudongfang') selected="" @endif data-name="百福东方国际物流" value="baifudongfang">百福东方国际物流</option>
  174. <option @if($item->express == 'coe') selected="" @endif data-name="中国东方(COE)" value="coe">中国东方(COE)</option>
  175. <option @if($item->express == 'changyuwuliu') selected="" @endif data-name="长宇物流" value="changyuwuliu">长宇物流</option>
  176. <option @if($item->express == 'datianwuliu') selected="" @endif data-name="大田物流" value="datianwuliu">大田物流</option>
  177. <option @if($item->express == 'debangwuliu') selected="" @endif data-name="德邦物流" value="debangwuliu">德邦物流</option>
  178. <option @if($item->express == 'dhl') selected="" @endif data-name="dhl" value="dhl">dhl</option>
  179. <option @if($item->express == 'dpex') selected="" @endif data-name="dpex" value="dpex">dpex</option>
  180. <option @if($item->express == 'dsukuaidi') selected="" @endif data-name="d速快递" value="dsukuaidi">d速快递</option>
  181. <option @if($item->express == 'disifang') selected="" @endif data-name="递四方" value="disifang">递四方</option>
  182. <option @if($item->express == 'fedex') selected="" @endif data-name="fedex(国外)" value="fedex">fedex(国外)</option>
  183. <option @if($item->express == 'feikangda') selected="" @endif data-name="飞康达物流" value="feikangda">飞康达物流</option>
  184. <option @if($item->express == 'fenghuangkuaidi') selected="" @endif data-name="凤凰快递" value="fenghuangkuaidi">凤凰快递</option>
  185. <option @if($item->express == 'feikuaida') selected="" @endif data-name="飞快达" value="feikuaida">飞快达</option>
  186. <option @if($item->express == 'guotongkuaidi') selected="" @endif data-name="国通快递" value="guotongkuaidi">国通快递</option>
  187. <option @if($item->express == 'ganzhongnengda') selected="" @endif data-name="港中能达物流" value="ganzhongnengda">港中能达物流</option>
  188. <option @if($item->express == 'guangdongyouzhengwuliu') selected="" @endif data-name="广东邮政物流" value="guangdongyouzhengwuliu">广东邮政物流</option>
  189. <option @if($item->express == 'gongsuda') selected="" @endif data-name="共速达" value="gongsuda">共速达</option>
  190. <option @if($item->express == 'hengluwuliu') selected="" @endif data-name="恒路物流" value="hengluwuliu">恒路物流</option>
  191. <option @if($item->express == 'huaxialongwuliu') selected="" @endif data-name="华夏龙物流" value="huaxialongwuliu">华夏龙物流</option>
  192. <option @if($item->express == 'haihongwangsong') selected="" @endif data-name="海红" value="haihongwangsong">海红</option>
  193. <option @if($item->express == 'haiwaihuanqiu') selected="" @endif data-name="海外环球" value="haiwaihuanqiu">海外环球</option>
  194. <option @if($item->express == 'jiayiwuliu') selected="" @endif data-name="佳怡物流" value="jiayiwuliu">佳怡物流</option>
  195. <option @if($item->express == 'jinguangsudikuaijian') selected="" @endif data-name="京广速递" value="jinguangsudikuaijian">京广速递</option>
  196. <option @if($item->express == 'jixianda') selected="" @endif data-name="急先达" value="jixianda">急先达</option>
  197. <option @if($item->express == 'jjwl') selected="" @endif data-name="佳吉物流" value="jjwl">佳吉物流</option>
  198. <option @if($item->express == 'jymwl') selected="" @endif data-name="加运美物流" value="jymwl">加运美物流</option>
  199. <option @if($item->express == 'jindawuliu') selected="" @endif data-name="金大物流" value="jindawuliu">金大物流</option>
  200. <option @if($item->express == 'jialidatong') selected="" @endif data-name="嘉里大通" value="jialidatong">嘉里大通</option>
  201. <option @if($item->express == 'jykd') selected="" @endif data-name="晋越快递" value="jykd">晋越快递</option>
  202. <option @if($item->express == 'kuaijiesudi') selected="" @endif data-name="快捷速递" value="kuaijiesudi">快捷速递</option>
  203. <option @if($item->express == 'lianb') selected="" @endif data-name="联邦快递(国内)" value="lianb">联邦快递(国内)</option>
  204. <option @if($item->express == 'lianhaowuliu') selected="" @endif data-name="联昊通物流" value="lianhaowuliu">联昊通物流</option>
  205. <option @if($item->express == 'longbanwuliu') selected="" @endif data-name="龙邦物流" value="longbanwuliu">龙邦物流</option>
  206. <option @if($item->express == 'lijisong') selected="" @endif data-name="立即送" value="lijisong">立即送</option>
  207. <option @if($item->express == 'lejiedi') selected="" @endif data-name="乐捷递" value="lejiedi">乐捷递</option>
  208. <option @if($item->express == 'minghangkuaidi') selected="" @endif data-name="民航快递" value="minghangkuaidi">民航快递</option>
  209. <option @if($item->express == 'meiguokuaidi') selected="" @endif data-name="美国快递" value="meiguokuaidi">美国快递</option>
  210. <option @if($item->express == 'menduimen') selected="" @endif data-name="门对门" value="menduimen">门对门</option>
  211. <option @if($item->express == 'ocs') selected="" @endif data-name="OCS" value="ocs">OCS</option>
  212. <option @if($item->express == 'peisihuoyunkuaidi') selected="" @endif data-name="配思货运" value="peisihuoyunkuaidi">配思货运</option>
  213. <option @if($item->express == 'quanchenkuaidi') selected="" @endif data-name="全晨快递" value="quanchenkuaidi">全晨快递</option>
  214. <option @if($item->express == 'quanjitong') selected="" @endif data-name="全际通物流" value="quanjitong">全际通物流</option>
  215. <option @if($item->express == 'quanritongkuaidi') selected="" @endif data-name="全日通快递" value="quanritongkuaidi">全日通快递</option>
  216. <option @if($item->express == 'quanyikuaidi') selected="" @endif data-name="全一快递" value="quanyikuaidi">全一快递</option>
  217. <option @if($item->express == 'rufengda') selected="" @endif data-name="如风达" value="rufengda">如风达</option>
  218. <option @if($item->express == 'santaisudi') selected="" @endif data-name="三态速递" value="santaisudi">三态速递</option>
  219. <option @if($item->express == 'shenghuiwuliu') selected="" @endif data-name="盛辉物流" value="shenghuiwuliu">盛辉物流</option>
  220. <option @if($item->express == 'sue') selected="" @endif data-name="速尔物流" value="sue">速尔物流</option>
  221. <option @if($item->express == 'shengfeng') selected="" @endif data-name="盛丰物流" value="shengfeng">盛丰物流</option>
  222. <option @if($item->express == 'saiaodi') selected="" @endif data-name="赛澳递" value="saiaodi">赛澳递</option>
  223. <option @if($item->express == 'tiandihuayu') selected="" @endif data-name="天地华宇" value="tiandihuayu">天地华宇</option>
  224. <option @if($item->express == 'tnt') selected="" @endif data-name="tnt" value="tnt">tnt</option>
  225. <option @if($item->express == 'ups') selected="" @endif data-name="ups" value="ups">ups</option>
  226. <option @if($item->express == 'wanjiawuliu') selected="" @endif data-name="万家物流" value="wanjiawuliu">万家物流</option>
  227. <option @if($item->express == 'wenjiesudi') selected="" @endif data-name="文捷航空速递" value="wenjiesudi">文捷航空速递</option>
  228. <option @if($item->express == 'wuyuan') selected="" @endif data-name="伍圆" value="wuyuan">伍圆</option>
  229. <option @if($item->express == 'wxwl') selected="" @endif data-name="万象物流" value="wxwl">万象物流</option>
  230. <option @if($item->express == 'xinbangwuliu') selected="" @endif data-name="新邦物流" value="xinbangwuliu">新邦物流</option>
  231. <option @if($item->express == 'xinfengwuliu') selected="" @endif data-name="信丰物流" value="xinfengwuliu">信丰物流</option>
  232. <option @if($item->express == 'yafengsudi') selected="" @endif data-name="亚风速递" value="yafengsudi">亚风速递</option>
  233. <option @if($item->express == 'yibangwuliu') selected="" @endif data-name="一邦速递" value="yibangwuliu">一邦速递</option>
  234. <option @if($item->express == 'youshuwuliu') selected="" @endif data-name="优速物流" value="youshuwuliu">优速物流</option>
  235. <option @if($item->express == 'youzhengguonei') selected="" @endif data-name="邮政包裹挂号信" value="youzhengguonei">邮政包裹挂号信</option>
  236. <option @if($item->express == 'youzhengguoji') selected="" @endif data-name="邮政国际包裹挂号信" value="youzhengguoji">邮政国际包裹挂号信</option>
  237. <option @if($item->express == 'yuanchengwuliu') selected="" @endif data-name="远成物流" value="yuanchengwuliu">远成物流</option>
  238. <option @if($item->express == 'yuanweifeng') selected="" @endif data-name="源伟丰快递" value="yuanweifeng">源伟丰快递</option>
  239. <option @if($item->express == 'yuanzhijiecheng') selected="" @endif data-name="元智捷诚快递" value="yuanzhijiecheng">元智捷诚快递</option>
  240. <option @if($item->express == 'yuntongkuaidi') selected="" @endif data-name="运通快递" value="yuntongkuaidi">运通快递</option>
  241. <option @if($item->express == 'yuefengwuliu') selected="" @endif data-name="越丰物流" value="yuefengwuliu">越丰物流</option>
  242. <option @if($item->express == 'yad') selected="" @endif data-name="源安达" value="yad">源安达</option>
  243. <option @if($item->express == 'yinjiesudi') selected="" @endif data-name="银捷速递" value="yinjiesudi">银捷速递</option>
  244. <option @if($item->express == 'zhongtiekuaiyun') selected="" @endif data-name="中铁快运" value="zhongtiekuaiyun">中铁快运</option>
  245. <option @if($item->express == 'zhongyouwuliu') selected="" @endif data-name="中邮物流" value="zhongyouwuliu">中邮物流</option>
  246. <option @if($item->express == 'zhongxinda') selected="" @endif data-name="忠信达" value="zhongxinda">忠信达</option>
  247. <option @if($item->express == 'zhimakaimen') selected="" @endif data-name="芝麻开门" value="zhimakaimen">芝麻开门</option>
  248. </select>
  249. </div>--}}
  250. </div>
  251. </div>
  252. </div>
  253. <div class="panel" style="height: auto; overflow: hidden; background: none;">
  254. @include('Yunshop\Exhelper::admin.print.print_tpl_items')
  255. <div class="edit-right">
  256. <div id="container" style=" height: @if(!empty($item->height)){{$item->height.'mm'}}@else{{'150mm'}}@endif;">
  257. <img id="bgimg" src="{{$item->bg}}" @if(empty($item->bg)) style="display: none;"@endif />
  258. @foreach($panel_datas as $key => $value)
  259. <div class="drag" cate="{{$value['cate']}}" index="{{$key}}" items="{{$value['items']}}" item-string="{{$value['string']}}" item-font="{{$value['font']}}" item-size="{{$value['size']}}" item-color="{{$value['color']}}" item-bold="{{$value['bold']}}" item-pre="{{$value['pre']}}" item-last="{{$value['last']}}" item-align="{{$value['align']}}" style="font-size:{{$value['size']}}pt; z-index:{{$key}};left:{{$value['left']}};top:{{$value['top']}};width:{{$value['width']}};height:auto; text-align:@if($value['align'] == '' || $value['align'] == 1) left @elseif($value['align'] == 2) center @elseif($value['align'] == 3) right @endif" item-virtual="{{$value['virtual']}}" cate="{{$value['cate']}}">
  260. @if($value['cate']==1)
  261. <div class="text" style="@if(!empty($value['font']))font-family: {{$value['font']}};@endif font-size:@if(!empty($value['size'])){{$value['size']}}@else{{10}}@endif pt;@if(!empty($value['color']))color: {{$value['color']}};@endif @if(!empty($value['bold']))font-weight:bold;@endif">
  262. {{$value['pre']}}{{$value['string']}}{{$value['last']}}
  263. </div>
  264. @elseif($value['cate']==2)
  265. <div class="text-table" style="color: rgb(0, 0, 0);">
  266. <table border="1" style="width:100%">
  267. <tbody>
  268. <tr style="font-weight:bold">
  269. @foreach($value['strings'] as $titleItem)
  270. <td>&nbsp;{{ $titleItem }}&nbsp;</td>
  271. @endforeach
  272. </tr>
  273. @foreach($panelDataLoopCount as $index=> $item)
  274. <tr>
  275. @foreach($value['virtuals'] as $itemIndex => $virtualItem)
  276. @if($value['strings'][$itemIndex] === "运费"||$value['strings'][$itemIndex] === "实付费")
  277. @if($index==0)
  278. <td rowspan="5">{{ $virtualItem }}{{ $itemIndex }}{{ $item }}</td>
  279. @endif
  280. @else
  281. <td>{{ $virtualItem }}{{ $itemIndex }}{{ $item }}</td>
  282. @endif
  283. @endforeach
  284. </tr>
  285. @endforeach
  286. <tr>
  287. <td colspan="{{ $value['columnCount'] }}">提示: 以上表格数据为虚拟数据,打印时将替换为订单数据且打印时此行不会出现。</td>
  288. </tr>
  289. </tbody>
  290. </table>
  291. </div>
  292. @endif
  293. <div class="rRightDown"> </div>
  294. <div class="rLeftDown"> </div>
  295. <div class="rRightUp"> </div>
  296. <div class="rLeftUp"> </div>
  297. <div class="rRight"> </div>
  298. <div class="rLeft"> </div>
  299. <div class="rUp"> </div>
  300. <div class="rDown"></div>
  301. </div>
  302. @endforeach
  303. </div>
  304. </div>
  305. </div>
  306. <div class='panel-body'>
  307. <div class="form-group">
  308. <div class="col-sm-9 col-xs-12">
  309. <a href="{{yzWebUrl(\Yunshop\Exhelper\common\models\Express::EXPRESS_INDEX_URL)}}"><span class="btn btn-default" style="float: left; margin-right: 10px;"><i class="fa fa-reply"></i> 返回列表</span></a>
  310. <input type="button" name="btnsave" value="保 存" class="btn btn-primary col-lg btnsave" onclick="save(false)" />
  311. <input type="button" name="btnpreview" value="保存并预览" class="btn btn-success col-lg btnsave" onclick="save(true)" style="margin-left:10px;" />
  312. <div style="float: left; margin-left: 10px;">
  313. <label class="radio-inline">
  314. <input type="radio" name='isdefault' value="1" @if($item->isdefault == 1) checked @endif /> 设为默认打印模版
  315. </label>
  316. <label class="radio-inline">
  317. <input type="radio" name='isdefault' value="0" @if($item->isdefault == 0) checked @endif /> 不设为默认打印模版
  318. </label>
  319. </div>
  320. @if($item->isdefault == 1)<span class="help-block">默认模版</span>@endif
  321. </div>
  322. </div>
  323. </div>
  324. </form>
  325. </div>
  326. <script language='javascript' src="{{resource_get('plugins/exhelper/src/common/static/js/LodopFuncs.js', 1)}}"></script>
  327. {{--<script src='http://@if(empty($print_set->id)){{8000}}@else{{$print_set->id}}@endif:@if(empty($print_set->port)){{8000}}@else{{$print_set->port}}@endif/CLodopfuncs.js'></script>--}}
  328. <script language='javascript'>
  329. function pagesize() {
  330. var _width = $("input[name=width]").val();
  331. var _height = $("input[name=height]").val();
  332. if (_width < 10) {
  333. alert("最低宽度不小于10");
  334. $("input[name=width]").val("10");
  335. return;
  336. }
  337. if (_width > 400) {
  338. alert("最大宽度不大于400");
  339. $("input[name=width]").val("400");
  340. return;
  341. }
  342. $("#container").height(_height + "mm").width(_width + "mm");
  343. }
  344. function delInput() {
  345. var _index = currentDrag.attr("index");
  346. $(".drag").each(function() {
  347. var index = $(this).attr("index");
  348. if (index == _index) {
  349. $(this).remove();
  350. }
  351. });
  352. $(".deleteinput").hide();
  353. }
  354. function addInput(n) {
  355. var index = $('#container .drag').length + 1;
  356. if (n == 1) {
  357. var data = '<div class="drag" cate="2" style="width: auto; height: auto; padding: 10px;" index="' + index + '" style="z-index:' + index + '" fields="" item-size="12" item-font="微软雅黑" item-align="1">';
  358. data += '<div class="text-table">';
  359. data += '请在左侧先选择列';
  360. data += '</div>';
  361. data += '<div class="rRightDown"> </div><div class="rLeftDown"> </div><div class="rRightUp"> </div><div class="rLeftUp"> </div><div class="rRight"> </div><div class="rLeft"> </div><div class="rUp"> </div><div class="rDown"></div>';
  362. data += '</div>';
  363. var drag = $(data)
  364. } else {
  365. var drag = $('<div class="drag" cate="1" index="' + index + '" style="z-index:' + index + '" fields="" item-size="12" item-font="微软雅黑" item-align="1"><div class="text" style="font-size:12pt"></div><div class="rRightDown"> </div><div class="rLeftDown"> </div><div class="rRightUp"> </div><div class="rLeftUp"> </div><div class="rRight"> </div><div class="rLeft"> </div><div class="rUp"> </div><div class="rDown"></div></div>');
  366. }
  367. $('#container').append(drag);
  368. bindEvents(drag);
  369. setCurrentDrag(drag);
  370. }
  371. function changeBG(n) {
  372. if (n) {
  373. $("#bgimg").attr("src", "").hide();
  374. $("#bg").val("");
  375. } else {
  376. util.image('', function(data) {
  377. $("#bgimg").attr("src", data.url).show();
  378. $("#bg").val(data.url);
  379. });
  380. }
  381. }
  382. var currentDrag = false;
  383. function bindEvents(obj) {
  384. var index = obj.attr('index');
  385. var rs = new Resize(obj, {
  386. Max: true,
  387. mxContainer: "#container"
  388. });
  389. rs.Set($(".rRightDown", obj), "right-down");
  390. rs.Set($(".rLeftDown", obj), "left-down");
  391. rs.Set($(".rRightUp", obj), "right-up");
  392. rs.Set($(".rLeftUp", obj), "left-up");
  393. rs.Set($(".rRight", obj), "right");
  394. rs.Set($(".rLeft", obj), "left");
  395. rs.Set($(".rUp", obj), "up");
  396. rs.Set($(".rDown", obj), "down");
  397. new Drag(obj, {
  398. Limit: true,
  399. mxContainer: "#container"
  400. });
  401. $('.drag .remove').unbind('click').click(function() {
  402. $(this).parent().remove();
  403. });
  404. $.contextMenu({
  405. selector: '.drag[index=' + index + ']',
  406. callback: function(key, options) {
  407. var index = $(this).attr('index');
  408. if (key == 'next') {
  409. var nextdiv = $(this).next('.drag');
  410. if (nextdiv.length > 0) {
  411. nextdiv.insertBefore($(this));
  412. }
  413. } else if (key == 'prev') {
  414. var prevdiv = $(this).prev('.drag');
  415. if (prevdiv.length > 0) {
  416. $(this).insertBefore(prevdiv);
  417. }
  418. } else if (key == 'last') {
  419. var len = $('.drag').length;
  420. if (index >= len - 1) {
  421. return;
  422. }
  423. var last = $('#container .drag:last');
  424. if (last.length > 0) {
  425. $(this).insertAfter(last);
  426. }
  427. } else if (key == 'first') {
  428. var index = $(this).index();
  429. if (index <= 1) {
  430. return;
  431. }
  432. var first = $('#container .drag:first');
  433. if (first.length > 0) {
  434. $(this).insertBefore(first);
  435. }
  436. } else if (key == 'delete') {
  437. $(this).remove();
  438. $('.items').hide();
  439. $(".item-tip").show();
  440. $(".deleteinput").hide();
  441. }
  442. var n = 1;
  443. $('.drag').each(function() {
  444. $(this).css("z-index", n);
  445. n++;
  446. })
  447. },
  448. items: {
  449. "next": {
  450. name: "调整到上层"
  451. },
  452. "prev": {
  453. name: "调整到下层"
  454. },
  455. "last": {
  456. name: "调整到最顶层"
  457. },
  458. "first": {
  459. name: "调整到最低层"
  460. },
  461. "delete": {
  462. name: "删除元素"
  463. }
  464. }
  465. });
  466. obj.unbind('mousedown').mousedown(function() {
  467. setCurrentDrag(obj);
  468. });
  469. }
  470. var timer = 0;
  471. function setCurrentDrag(obj) {
  472. currentDrag = obj;
  473. var cate = obj.attr('cate');
  474. bindItems();
  475. $(".item-tip").hide();
  476. $('.items').show();
  477. $(".deleteinput").show();
  478. if (cate == 1) {
  479. $(".cate1").show();
  480. $(".cate2").hide();
  481. }
  482. if (cate == 2) {
  483. $(".cate2").show();
  484. $(".cate1").hide();
  485. }
  486. $('.drag').css('border', '1px solid #aaa');
  487. obj.css('border', '1px solid #428bca');
  488. }
  489. function bindItems() {
  490. var items = currentDrag.attr('items') || "";
  491. var values = items.split(',');
  492. $('.items').find(':checkbox').each(function() {
  493. $(this).get(0).checked = false;
  494. });
  495. $('#item-font').val('');
  496. $('#item-size').val('');
  497. $('#item-bold').val('');
  498. for (var i in values) {
  499. if (values[i] != '') {
  500. $('.items').find(":checkbox[value='" + values[i] + "']").get(0).checked = true;
  501. }
  502. }
  503. $('#item-font').val(currentDrag.attr('item-font') || '');
  504. $('#item-size').val(currentDrag.attr('item-size') || '');
  505. $('#item-bold').val(currentDrag.attr('item-bold') || '');
  506. $('#item-pre').val(currentDrag.attr('item-pre') || '');
  507. $('#item-last').val(currentDrag.attr('item-last') || '');
  508. $('#item-align').val(currentDrag.attr('item-align') || '');
  509. var itemcolor = $('#item-color');
  510. var input = itemcolor.find('input:first');
  511. var picker = itemcolor.find('.sp-preview-inner');
  512. var color = currentDrag.attr('item-color') || '#000';
  513. input.val(color);
  514. picker.css({
  515. 'background-color': color
  516. });
  517. timer = setInterval(function() {
  518. var cate = currentDrag.attr("cate");
  519. if (cate == 1) {
  520. currentDrag.attr('item-color', input.val()).find('.text').css('color', input.val());
  521. }
  522. if (cate == 2) {
  523. currentDrag.attr('item-color', input.val()).find('.text-table').css('color', input.val());
  524. }
  525. currentDrag.attr('item-pre', $('#item-pre').val());
  526. currentDrag.attr('item-last', $('#item-last').val());
  527. var pre = currentDrag.attr('item-pre') || "";
  528. var last = currentDrag.attr('item-last') || "";
  529. var string = currentDrag.attr('item-string') || "";
  530. currentDrag.find('.text').html(pre + string + last);
  531. }, 10);
  532. }
  533. $(function() {
  534. $('#dataform').ajaxForm();
  535. $('.drag').each(function() {
  536. bindEvents($(this));
  537. })
  538. $('.items .checkbox-inline').click(function(e) {
  539. if ($(e.target).find('input').length > 0) {
  540. return;
  541. }
  542. if (currentDrag) {
  543. var cate = currentDrag.attr("cate");
  544. var values = [];
  545. var titles = [];
  546. var datas = [];
  547. var vd = [];
  548. $('.items').find(':checkbox:checked').each(function() {
  549. var _titles = $(this).attr('title');
  550. var _values = $(this).val();
  551. var _vd = $(this).data('vd');
  552. titles.push(_titles);
  553. values.push(_values);
  554. vd.push(_vd);
  555. datas.push({
  556. "value": _values,
  557. "title": _titles,
  558. "vd": _vd
  559. });
  560. });
  561. if (cate == 1) {
  562. currentDrag.attr('items', values.join(',')).attr('item-string', titles.join(',')).find('.text').text(titles.join(','));
  563. }
  564. if (cate == 2) {
  565. var _table = '';
  566. _table += '<table border="1" style="width:100%">';
  567. _table += '<tr style="font-weight:bold">';
  568. $.each(datas, function(i, data) {
  569. _table += '<td>&nbsp;' + data.title + '&nbsp;</td>';
  570. });
  571. _table += '</tr>';
  572. let isMerge = false;
  573. for (i = 0; i < datas.length; i++) {
  574. _table += '<tr>';
  575. $.each(datas, function(ii, data) {
  576. if (data.vd != '') {
  577. if (data.vd == 'number') {
  578. _table += '<td>' + i + '</td>';
  579. } else if (data['value'] === "price" || data['value'] == "dispatchprice") {
  580. if(i==0){
  581. _table += '<td rowspan=' + datas.length + ' style="text-align:center;">' + data.vd + i + '</td>';
  582. }
  583. } else {
  584. _table += '<td>' + data.vd + i + '</td>';
  585. }
  586. } else {
  587. if (data['value'] == "dispatchprice" || data['value'] === "price") {
  588. if (isMerge === false) {
  589. _table += '<td rowspan="4">' + data.vd + i + '</td>';
  590. isMerge = true;
  591. }
  592. } else {
  593. _table += '<td>' + data.vd + '</td>';
  594. }
  595. }
  596. });
  597. _table += '</tr>';
  598. }
  599. _table += '<tr><td colspan="' + datas.length + '">提示: 以上表格数据为虚拟数据,打印时将替换为订单数据且打印时此行不会出现。</td></tr>';
  600. _table += '</table>';
  601. currentDrag.attr('items', values.join(',')).attr({
  602. 'item-string': titles.join(','),
  603. 'item-virtual': vd.join(',')
  604. }).find('.text-table').html(_table);
  605. }
  606. }
  607. });
  608. $('#item-font').change(function() {
  609. if (currentDrag) {
  610. var cate = currentDrag.attr("cate");
  611. var data = $(this).val();
  612. currentDrag.attr('item-font', data);
  613. if (data == '') {
  614. data = "微软雅黑";
  615. }
  616. if (cate == 1) {
  617. currentDrag.attr('item-font', data).find(".text").css('font-family', data);
  618. }
  619. if (cate == 2) {
  620. currentDrag.attr('item-font', data).find(".text-table").css('font-family', data);
  621. }
  622. }
  623. });
  624. $('#item-align').change(function() {
  625. if (currentDrag) {
  626. var cate = currentDrag.attr("cate");
  627. var data = $(this).val();
  628. currentDrag.attr('item-align', data);
  629. if (data == '') {
  630. data = "1";
  631. }
  632. var str = '';
  633. if (data == 1) {
  634. str = "left";
  635. }
  636. if (data == 2) {
  637. str = "center";
  638. }
  639. if (data == 3) {
  640. str = "right";
  641. }
  642. if (cate == 1) {
  643. currentDrag.attr('item-font', data).find(".text").css('text-align', str);
  644. }
  645. if (cate == 2) {
  646. currentDrag.attr('item-font', data).find(".text-table").css('text-align', str);
  647. }
  648. }
  649. });
  650. $('#item-size').change(function() {
  651. if (currentDrag) {
  652. var cate = currentDrag.attr("cate");
  653. var data = $(this).val();
  654. currentDrag.attr('item-size', data);
  655. if (data == '') {
  656. data = 12;
  657. }
  658. if (cate == 1) {
  659. currentDrag.find(".text").css('font-size', data + "pt");
  660. }
  661. if (cate == 2) {
  662. currentDrag.find(".text-table").css('font-size', data + "pt");
  663. }
  664. }
  665. });
  666. $('#item-bold').change(function() {
  667. if (currentDrag) {
  668. var cate = currentDrag.attr("cate");
  669. var data = $(this).val();
  670. currentDrag.attr('item-bold', data);
  671. if (cate == 1) {
  672. if (data == 'bold') {
  673. currentDrag.css('font-weight', 'bold');
  674. } else {
  675. currentDrag.find(".text").css('font-weight', 'normal');
  676. }
  677. }
  678. if (cate == 2) {
  679. if (data == 'bold') {
  680. currentDrag.css('font-weight', 'bold');
  681. } else {
  682. currentDrag.find(".text-table").css('font-weight', 'normal');
  683. }
  684. }
  685. }
  686. });
  687. });
  688. function renderDrag() {
  689. }
  690. function save(ispreview) {
  691. var data = [];
  692. $('.drag').each(function() {
  693. var obj = $(this);
  694. var d = {
  695. left: obj.css('left'),
  696. top: obj.css('top'),
  697. width: obj.css('width'),
  698. height: obj.css('height'),
  699. items: obj.attr('items'),
  700. font: obj.attr('item-font'),
  701. size: obj.attr('item-size'),
  702. color: obj.attr('item-color'),
  703. bold: obj.attr('item-bold'),
  704. string: obj.attr('item-string'),
  705. pre: obj.attr('item-pre'),
  706. last: obj.attr('item-last'),
  707. align: obj.attr('item-align'),
  708. cate: obj.attr('cate'),
  709. virtual: obj.attr('item-virtual'),
  710. };
  711. data.push(d);
  712. });
  713. //$("#expresscom").val($("#express").find("option:selected").data("name"));
  714. $('#datas').val(JSON.stringify(data));
  715. $('.btnsave').button('loading');
  716. $('#dataform').ajaxSubmit(function(res) {
  717. $('.btnsave').button('reset');
  718. //data = eval("(" + data + ")");
  719. //$(':hidden[name=id]').val(data.id);
  720. if (ispreview) {
  721. previews();
  722. } else {
  723. if (res == 'success') {
  724. location.href = "{!! yzWebUrl(\Yunshop\Exhelper\common\models\Express::SEND_INDEX_URL) !!}";
  725. }
  726. }
  727. })
  728. return;
  729. }
  730. function previews() {
  731. var LODOP = getCLodop();
  732. alert("保存成功!正在生成预览。。。");
  733. var Width = $("input[name=width]").val() + "pt";
  734. var Height = $("input[name=height]").val() + "pt";
  735. LODOP.PRINT_INITA(0, 0, Width, Height, "发货单预览"); //1188
  736. LODOP.ADD_PRINT_HTM(0, 0, 869, 480, $("#container").html());
  737. LODOP.PREVIEW();
  738. }
  739. </script>
  740. @endsection