ordersMsg.htm 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. ##tlayout("admin/layout.htm"){
  2. <div class="breadcrumbs" style="height: 45px;">
  3. <div class="col-xs-12" style="text-align: right;">
  4. <a class="btn btn-info btn-sm" style="margin-left: 12px;" href="/admin/orders/print?id=${orders.id!}" target="_blank">打印订单</a>
  5. </div>
  6. </div>
  7. <div class="page-content">
  8. <div class="row" style="margin-top:10px;">
  9. <div class="col-xs-12">
  10. <table class="table table_new_dingdan">
  11. <tr class="one">
  12. <th>订单号码</th>
  13. <th>订单状态</th>
  14. <th>下单时间</th>
  15. <th>收件人</th>
  16. <th>订单金额</th>
  17. </tr>
  18. <tr>
  19. <td>${orders.code!}</td>
  20. <td>
  21. ##if(orders.status==0){
  22. 未付款
  23. ##}else if(orders.status==1){
  24. 付款审核中
  25. <a href="javascript:changeStatus(${orders.id!}, 2, '设置为已收款')" style="margin-left: 25px;">设置已收款</a>
  26. <a href="javascript:changeStatus(${orders.id!}, 0, '款项未收到')" style="margin-left: 25px;">款项未收到</a>
  27. ##}else if(orders.status==2){
  28. 待发货
  29. <a href="javascript:showAlert('/admin/orders/addTracking?id=${_item.id!}')" style="margin-left: 25px;">设置为已发运</a>
  30. ##}else if(orders.status==3){
  31. 已发货
  32. ##}else if(orders.status==4){
  33. 已收货
  34. ##}else if(orders.status==5){
  35. 已完成
  36. ##}else{
  37. 退款中
  38. <a href="javascript:changeStatus(${orders.id!}, 5, '退款通过')" style="margin-left: 25px;">退款通过</a>
  39. <a href="javascript:changeStatus(${orders.id!}, 4, '退款驳回')" style="margin-left: 25px;">退款驳回</a>
  40. ##}
  41. </td>
  42. <td>${orders.create_date!, dateFormat='yyyy-MM-dd HH:mm'}</td>
  43. <td>${orders.take_name!}</td>
  44. <td>
  45. <div>¥${orders.grand_total!}</div>
  46. <div style="margin-top: 5px;">(运费:¥${orders.freight_price!})</div>
  47. </td>
  48. </tr>
  49. ##if(orders.take_name!=null && orders.take_name!=""){
  50. <tr>
  51. <td colspan="5">
  52. 收件地址:
  53. <span>${orders.take_name!}</span>
  54. <span style="margin-left: 10px;">${orders.take_phone}</span>
  55. <span style="margin-left: 10px;">${orders.take_area_msg!}</span>
  56. <span style="margin-left: 10px;">${orders.take_address!}</span>
  57. <span style="margin-left: 10px;">${orders.take_post_code!}</span>
  58. </td>
  59. </tr>
  60. ##}
  61. ##if(orders.tracking_code!=null && orders.tracking_code!=""){
  62. <tr>
  63. <td colspan="5">
  64. 运单号:
  65. <a href="javascript:showAlert('/admin/orders/trackingMsg?id=${orders.id!}">${orders.tracking_code!}</a>
  66. <span style="margin-left: 10px;">${orders.tracking_date!,dateFormat='yyyy-MM-dd HH:mm'}</span>
  67. </td>
  68. </tr>
  69. ##}
  70. ##if(orders.remark!=null && orders.remark!=""){
  71. <tr>
  72. <td colspan="5">备注:${orders.remark!}</td>
  73. </tr>
  74. ##}
  75. ##if(orders.payment!=null && orders.payment!=""){
  76. <tr>
  77. <td colspan="5">
  78. ##if(orders.payment==1){
  79. <div>付款信息:微信支付</div>
  80. ##}else if(orders.payment==2){
  81. <div>付款信息:银行卡支付</div>
  82. <div style="margin-top: 5px;">收款账号:${orders.to_bank_number!}&nbsp;|&nbsp;${orders.to_bank_name!}&nbsp;|&nbsp;${orders.to_bank_type!}&nbsp;|&nbsp;${orders.to_bank_address!}</div>
  83. <div style="margin-top: 5px;">转账账号:${orders.from_bank_number!}&nbsp;|&nbsp;${orders.from_bank_name!}</div>
  84. ##}else{
  85. <div>付款信息:支付宝支付</div>
  86. ##}
  87. </td>
  88. </tr>
  89. ##}
  90. ##if(orders.invoice_name!=null && orders.invoice_name!=""){
  91. <tr>
  92. <td colspan="5">
  93. <span>发票抬头:${orders.invoice_name!}</span>
  94. <span style="margin-left: 10px;">发票税号:${orders.invoice_number!}</span>
  95. </td>
  96. </tr>
  97. ##}
  98. </table>
  99. </div>
  100. <div class="col-xs-12">
  101. <div class="table-responsive">
  102. <table class="table table-striped table-bordered table-hover">
  103. <thead>
  104. <tr>
  105. <th colspan="2" style="width: 40%">商品</th>
  106. <th>规格</th>
  107. <th>数量/箱(1箱=24瓶)</th>
  108. <th>单价</th>
  109. <th>小计</th>
  110. <th>操作</th>
  111. </tr>
  112. </thead>
  113. <tbody>
  114. ##for(_item in item_list!){
  115. <tr>
  116. <td colspan="2" style="border-right:none !important;">
  117. <div>
  118. <a href="${_item.diy_img_url!}" target="_blank">
  119. <img src="${_item.diy_img_url!}" style="height:400px;"/>
  120. </a>
  121. </div>
  122. </td>
  123. <td>${_item.bottle_title!}&nbsp;|&nbsp;${_item.bottle_type_title!}</td>
  124. <td>${_item.item_number!}箱</td>
  125. <td>¥${_item.item_price!}</td>
  126. <td>¥${_item.subtotal!}</td>
  127. <td>
  128. <a href="javascript:createImg(${_item.id!})">生成高清图片</a>
  129. </td>
  130. </tr>
  131. ##}
  132. </tbody>
  133. </table>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="popup_bg"></div>
  139. <div class="popup">
  140. <div class="popup_title">
  141. <span>下载pdf</span>
  142. <img onclick="hidePopup()" src="/admin/images/close_icon.png"/>
  143. </div>
  144. <div class="popup_body">
  145. <div id="gaoqing_img" class="gaoqing_img"></div>
  146. </div>
  147. <div class="popup_foot">
  148. <span onclick="createPdf()">下载PDF</span>
  149. </div>
  150. </div>
  151. <canvas id="diy"></canvas>
  152. <script src="/admin/js/fabric/dist/fabric.js"></script>
  153. <script src="/admin/js/jspdf.min.js"></script>
  154. <input type="hidden" value="${orders.code!}" id="orderCode"/>
  155. <script type="text/javascript">
  156. function changeStatus(id, status, msg){
  157. if(confirm("确定要" + msg + "该记录吗?")){
  158. $.post("/admin/orders/changeStatus",{id:id,status:status},function(data){
  159. alert(data.msg);
  160. if(data.success){
  161. location.reload();
  162. }
  163. });
  164. }
  165. }
  166. var app = {};
  167. //把当前画布保存成图片
  168. app.returnCanvasImg = function(width){
  169. var that= this;
  170. app.outputWidth = width || 500 ;
  171. app.outputHeight = app.outputWidth/app.plateRATIO;
  172. //新的缩放比例
  173. var afterCutRATIO = app.outputWidth/app.oldCutWidth;
  174. //执行新的缩放
  175. that.mainCanvas.zoomToPoint(new fabric.Point(app.width/2,app.height/2),afterCutRATIO);
  176. //生成剪切图片
  177. var dataURL = that.mainCanvas.toDataURL({
  178. format: 'jpeg',
  179. left: app.width/2 -app.outputWidth/2 ,
  180. top: app.height/2 - app.outputHeight/2,
  181. width: app.outputWidth,
  182. height: app.outputHeight
  183. });
  184. return dataURL;
  185. }
  186. app.mainCanvas = new fabric.Canvas('diy',{
  187. selectionColor: 'rgba(0,0,0,0.1)',
  188. controlsAboveOverlay:true,
  189. preserveObjectStacking:true,
  190. backgroundColor:'rgba(255,255,255,0)',
  191. selctionBorderColor:'#000',
  192. selectionDashArray:[3,6],
  193. selectionLineWidth: 1,
  194. width:100,
  195. height:100
  196. });
  197. function createImg(id){
  198. var url = '/admin/api/getUserDiyById?id='+ id;
  199. $.get(url,function(data){
  200. if(!data.success){
  201. alert(data.msg);
  202. return false;
  203. }
  204. $(".popup").show();
  205. $(".popup_bg").show();
  206. var json = JSON.parse(data.orders_item.diy_content);
  207. app.plateRATIO = json.plateRATIO;
  208. app.oldCutWidth = json.oldCutWidth;
  209. app.oldCutHeight = json.oldCutHeight;
  210. app.width = json.width;
  211. app.height = json.height;
  212. console.log(app.plateRATIO)
  213. app.mainCanvas.loadFromJSON(json,function(obj){
  214. app.mainCanvas.width = 1;
  215. app.mainCanvas.height = 1;
  216. app.mainCanvas.renderAll.bind(app.mainCanvas);
  217. app.imgUrl = app.returnCanvasImg(2000);
  218. var img = '<img src="'+ app.imgUrl +'"/>';
  219. $("#gaoqing_img").html(img);
  220. });
  221. });
  222. }
  223. function createPdf(){
  224. var arr = new Array(2);
  225. arr[0] = 118;
  226. arr[1] = 118*app.plateRATIO;
  227. var doc = new jsPDF('portrait','mm',arr);
  228. doc.addImage(app.imgUrl, 'JPEG', 0, 0,118*app.plateRATIO,118);
  229. var timestamp = $("#orderCode").val();
  230. doc.save(timestamp+'.pdf');
  231. }
  232. function hidePopup(){
  233. $(".popup").hide();
  234. $(".popup_bg").hide();
  235. }
  236. </script>
  237. ##}