index.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // lionfish_comshop/components/orderInfo/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. orderInfo: {
  8. type: Object,
  9. observer: function (t) {
  10. let real_total = t.real_total * 1;
  11. var goodsTotal = parseFloat(real_total) - parseFloat(t.shipping_fare);
  12. let disAmount = parseFloat(t.voucher_credit) + parseFloat(t.fullreduction_money);
  13. disAmount = (disAmount > goodsTotal) ? goodsTotal : disAmount;
  14. let diyshipname = '';
  15. let groupInfo = this.data.groupInfo;
  16. if(t.delivery=='express') {
  17. diyshipname = groupInfo.placeorder_trans_name;
  18. } else {
  19. diyshipname = groupInfo.placeorder_tuan_name;
  20. }
  21. let changePrice = 0;
  22. if(t.is_change_price==1) {
  23. changePrice = Math.abs(t.admin_change_price);
  24. }
  25. this.setData({
  26. goodsTotal: goodsTotal.toFixed(2),
  27. disAmount: disAmount.toFixed(2),
  28. diyshipname,
  29. changePrice: changePrice.toFixed(2)
  30. });
  31. }
  32. },
  33. order_goods_list: {
  34. type: Array,
  35. observer: function (t) {
  36. let levelAmount = 0;
  37. let is_vipcard_buy = 0;
  38. let is_level_buy = 0;
  39. if(t&&t.length) {
  40. t.forEach(function(item){
  41. let total = item.total * 1;
  42. let old_total = item.old_total * 1;
  43. if (item.is_level_buy==1 || item.is_vipcard_buy==1) {
  44. levelAmount += old_total - total;
  45. is_vipcard_buy = item.is_vipcard_buy;
  46. is_level_buy = item.is_level_buy;
  47. }
  48. })
  49. }
  50. this.setData({
  51. levelAmount: levelAmount.toFixed(2),
  52. is_level_buy,
  53. is_vipcard_buy
  54. });
  55. }
  56. },
  57. ordername: {
  58. type: String,
  59. value: "订单"
  60. },
  61. groupInfo: {
  62. type: Object,
  63. value: {
  64. group_name: '社区',
  65. owner_name: '团长',
  66. delivery_ziti_name: '社区自提',
  67. delivery_tuanzshipping_name: '团长配送',
  68. delivery_express_name: '快递配送',
  69. placeorder_trans_name: '配送费',
  70. placeorder_tuan_name: '配送费',
  71. localtown_modifypickingname: '包装费'
  72. }
  73. },
  74. goodsTot: {
  75. type: Number,
  76. default: 0
  77. }
  78. },
  79. /**
  80. * 组件的初始数据
  81. */
  82. data: {
  83. disAmount: 0,
  84. goodsTotal: 0,
  85. changePrice: 0
  86. }
  87. })