You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
4.0 KiB

2 years ago
  1. $(function () {
  2. 'use strict';
  3. var sLang = $('[http-equiv="content-language"]').attr('content') || 'zh-TW',
  4. bEn = sLang === 'en',
  5. sAppointNO = getUrlParam('AppointNO'),
  6. sExpo = g_db.GetDic('Expo'),
  7. saOrderInfo = g_db.GetDic('OrderInfo'),
  8. oContactInfo = g_db.GetDic('ContactInfo'),
  9. sTotal = g_db.GetDic('Total'),
  10. /*
  11. * 目的 獲取預約明細
  12. */
  13. fnGetAppointInfo = function (confbtn) {
  14. return g_api.ConnectLite(Service.apite, 'GetAppointInfo', {
  15. AppointNO: sAppointNO
  16. }, function (res) {
  17. if (res.RESULT) {
  18. var oAppointInfo = res.DATA.rel,
  19. oRuleInfo = res.DATA.rule;
  20. if (oAppointInfo) {
  21. oAppointInfo.ExpoName = oRuleInfo.ExpoName;
  22. if(oAppointInfo.PaymentWay === "1"){
  23. oAppointInfo.PaymentWayDesc = "匯款";
  24. } else if (oAppointInfo.PaymentWay === "2"){
  25. oAppointInfo.PaymentWayDesc = "現場付現";
  26. }
  27. var sHtml = $('#temp_contact').render(oAppointInfo);
  28. $('#contactInfo').append(sHtml);
  29. $('#AppointUser').text(oAppointInfo.AppointUser);
  30. }
  31. if (oAppointInfo.PackingInfo) {
  32. oAppointInfo.PackingInfo = JSON.parse(oAppointInfo.PackingInfo);
  33. var sHtml = $('#temp_service').render(oAppointInfo.PackingInfo);
  34. $('#Servicebox').append(sHtml);
  35. $('#Total').text(fMoney(oAppointInfo.Total || 0, 0, 'NTD'));
  36. $('#ServiceInstruction').html(bEn ? oRuleInfo.Info.ServiceInstruction_EN || '' : oRuleInfo.Info.ServiceInstruction || '');
  37. }
  38. }
  39. });
  40. },
  41. init = function () {
  42. var myHelpers = {
  43. setDate: function (val) {
  44. return new Date(val).formate('yyyy:MM:dd HH:mm');
  45. },
  46. setMoney: function (val, flag) {
  47. return (flag ? 'NT$' : '') + fMoney(val || 0, 0, 'NTD');
  48. },
  49. setExpoType: function (val) {
  50. var oExpoType = {
  51. 'zh-TW': { '01': '裸機', '02': '木箱', '03': '散貨', '04': '打板', '05': '其他' },
  52. 'en': { '01': 'Unwrapped', '02': 'Wooden Crate', '03': 'Bulk Cargo', '04': 'Pallet', '05': 'Other' }
  53. };
  54. return val ? oExpoType[sLang][val] : '';
  55. },
  56. setService: function (ExpoStack, ExpoSplit, ExpoPack, ExpoFeed, ExpoStorage, ExpoDays) {
  57. var oService = {
  58. 'zh-TW': ['堆高機服務', '拆箱(含空箱收送與儲存)', '裝箱', '空箱收送', '空箱儲存', '天'],
  59. 'en': ['Forklift', 'Unpacking (including empty crate transport & storage)', 'Packing', 'Empty Crate Transport', 'Empty Crate Storage', 'Days']
  60. },
  61. saText = [];
  62. if (ExpoStack) {
  63. saText.push(oService[sLang][0]);
  64. }
  65. if (ExpoSplit) {
  66. saText.push(oService[sLang][1]);
  67. }
  68. if (ExpoPack) {
  69. saText.push(oService[sLang][2]);
  70. }
  71. if (ExpoFeed) {
  72. saText.push(oService[sLang][3]);
  73. }
  74. if (ExpoStorage) {
  75. saText.push(oService[sLang][4] + ExpoDays + oService[sLang][5]);
  76. }
  77. return saText.join(',');
  78. }
  79. };
  80. $.views.helpers(myHelpers);
  81. if (sAppointNO) {
  82. fnGetAppointInfo();
  83. $('.print').click(function () {
  84. $("#Result").jqprint({ operaSupport: false });
  85. });
  86. }
  87. };
  88. init();
  89. });