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.

86 lines
3.8 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.apitg, '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. var sHtml = $('#temp_contact').render(oAppointInfo);
  23. $('#contactInfo').append(sHtml);
  24. $('#AppointUser').text(oAppointInfo.AppointUser);
  25. }
  26. if (oAppointInfo.PackingInfo) {
  27. oAppointInfo.PackingInfo = JSON.parse(oAppointInfo.PackingInfo);
  28. var sHtml = $('#temp_service').render(oAppointInfo.PackingInfo);
  29. $('#Servicebox').append(sHtml);
  30. $('#Total').text(fMoney(oAppointInfo.Total || 0, 0, 'NTD'));
  31. $('#ServiceInstruction').html(bEn ? oRuleInfo.Info.ServiceInstruction_EN || '' : oRuleInfo.Info.ServiceInstruction || '');
  32. }
  33. }
  34. });
  35. },
  36. init = function () {
  37. var myHelpers = {
  38. setDate: function (val) {
  39. return new Date(val).formate('yyyy:MM:dd HH:mm');
  40. },
  41. setMoney: function (val, flag) {
  42. return (flag ? 'NT$' : '') + fMoney(val || 0, 0, 'NTD');
  43. },
  44. setExpoType: function (val) {
  45. var oExpoType = {
  46. 'zh-TW': { '01': '裸機', '02': '木箱', '03': '散貨', '04': '打板', '05': '其他' },
  47. 'en': { '01': 'Unwrapped', '02': 'Wooden Crate', '03': 'Bulk Cargo', '04': 'Pallet', '05': 'Other' }
  48. };
  49. return val ? oExpoType[sLang][val] : '';
  50. },
  51. setService: function (ExpoStack, ExpoSplit, ExpoPack, ExpoFeed, ExpoStorage, ExpoDays) {
  52. var oService = {
  53. 'zh-TW': ['堆高機服務', '拆箱(含空箱收送與儲存)', '裝箱', '空箱收送', '空箱儲存', '天'],
  54. 'en': ['Forklift', 'Unpacking (including empty crate transport & storage)', 'Packing', 'Empty Crate Transport', 'Empty Crate Storage', 'Days']
  55. },
  56. saText = [];
  57. if (ExpoStack) {
  58. saText.push(oService[sLang][0]);
  59. }
  60. if (ExpoSplit) {
  61. saText.push(oService[sLang][1]);
  62. }
  63. if (ExpoPack) {
  64. saText.push(oService[sLang][2]);
  65. }
  66. if (ExpoFeed) {
  67. saText.push(oService[sLang][3]);
  68. }
  69. if (ExpoStorage) {
  70. saText.push(oService[sLang][4] + ExpoDays + oService[sLang][5]);
  71. }
  72. return saText.join(',');
  73. }
  74. };
  75. $.views.helpers(myHelpers);
  76. if (sAppointNO) {
  77. fnGetAppointInfo();
  78. $('.print').click(function () {
  79. $("#Result").jqprint({ operaSupport: false });
  80. });
  81. }
  82. };
  83. init();
  84. });