orderConfirm.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. var id=mobile.getUrlVars("id");
  2. var order;
  3. var money = 0;
  4. var product;
  5. mui.init();
  6. mui.ready(function(){
  7. getById();
  8. $("#product").on("tap","li",function(e){
  9. if($(this).attr("data-id")){
  10. location.href=base+"/mobile/productDetail.jsp?id="+$(this).attr("data-id");
  11. }
  12. });
  13. });
  14. function getById(){
  15. mobile.ajaxPost(base+'/userOrder/getById',{id:id},function(json){
  16. order = json.data;
  17. product = order.list[0];
  18. var html= [];
  19. html.push('<li class="mui-table-view-cell mui-media">');
  20. html.push('<div>'+order.consignee+' '+ order.mobile +'</div>');
  21. html.push('</li>');
  22. $.each(order.list,function(id,item){
  23. html.push('<li class="mui-table-view-cell mui-media" data-id="'+item.id+'">');
  24. html.push('<div class="product-img mui-pull-left">');
  25. html.push('<img src="'+imgUrl+item.product_main_img+'">');
  26. if(item.order_hour<=0){
  27. html.push('<span class="img-icon">免预约</span>')
  28. }
  29. html.push('</div>');
  30. html.push('<div class="mui-media-body pl10">');
  31. html.push('<p class="product-merchant mui-ellipsis">'+item.merchant_name+'</p>');
  32. html.push('<p class="product-title mui-ellipsis-2">'+item.product_name+'</p>');
  33. html.push('<p class="product-price items">');
  34. html.push('<em class="item"><b>¥</b>'+item.product_price+'<span class="del-line color3 ml5">'+item.product_old_price+'元</span></em>');
  35. html.push('<span class="color2 fs14">x'+item.product_qty+'</span></p>');
  36. html.push('</div>');
  37. html.push('</li>');
  38. });
  39. if(order.order_status=="10"){
  40. $('#pay_amt').prev().html('需付款');
  41. $('.mui-title').html('待付款');
  42. $('#pay_amt').html('<em class="fs16"><b>¥</b>'+order.order_amt+'</em>');
  43. }else if(order.order_status=="20"){
  44. $('#pay_amt').prev().html('已付款');
  45. $('.mui-title').html('待使用');
  46. $('#pay_amt').html('<em class="fs16"><b>¥</b>'+mobile.nullToZore(order.pay_amt)+'</em>');
  47. }else if(order.order_status=="30"){
  48. $('#pay_amt').prev().html('已付款');
  49. $('.mui-title').html('交易成功');
  50. $('#pay_amt').html('<em class="fs16"><b>¥</b>'+mobile.nullToZore(order.pay_amt)+'</em>');
  51. }else{
  52. $('.mui-title').html('订单失效');
  53. }
  54. if(order.order_type=="10"){
  55. $("#sumPrice").removeClass("mui-hidden");
  56. }else if(order.order_type=="20"){
  57. $("#sumIntegral").removeClass("mui-hidden");
  58. }
  59. $('#order_amt').html("¥"+order.order_amt);
  60. $('#order_type').html(mobile.getDictVal("order_type",order.order_type));
  61. $('#order_no').html(order.order_no);
  62. $('#order_integral').html(order.order_integral);
  63. $('#create_time').html(order.create_time);
  64. $('#finish_time').html(order.finish_time);
  65. if(order.pay_type=="10"){
  66. $('#pay_type').html("微信支付");
  67. }else if(order.pay_type=="20"){
  68. $('#pay_type').html("余额支付");
  69. }else{
  70. $('#pay_type').parent().hide();
  71. }
  72. $('.mui-content').removeClass('mui-hidden');
  73. $('#product').html(html.join(''));
  74. });
  75. }