freight.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template name="freight">
  2. <view class="freight-template">
  3. <!-- 运费信息 -->
  4. <view class="invoice-freight">
  5. <view class="freight-left">
  6. 运费
  7. <!-- <text class="iconfont icon-yunfeishuoming" @click="showTip"></text> -->
  8. </view>
  9. <view class="freight-right">
  10. <text>{{freightText}}</text>
  11. <text class="text" v-if="freightData.freePostFlag == 1">¥{{orderPriceToFixed(freightMoney)}}</text>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default{
  18. name:"freight",
  19. props:{
  20. freightData:{
  21. type:Object
  22. }
  23. },
  24. data() {
  25. return{
  26. freightText:'',
  27. freightMoney:''
  28. }
  29. },
  30. created(){
  31. this.initData(this.freightData)
  32. },
  33. computed: {
  34. },
  35. methods:{
  36. initData(res) {
  37. switch(res.freePostFlag){
  38. case 0:
  39. this.freightText = '包邮'
  40. this.freightData.freight = 0
  41. break
  42. case 1:
  43. this.freightText = '不包邮'
  44. this.freightMoney = res.freight
  45. break
  46. case -1:
  47. this.freightText = '到付'
  48. this.freightData.freight = 0
  49. break
  50. }
  51. },
  52. orderPriceToFixed (num){
  53. let price ='';
  54. price = parseInt(num).toFixed(2);
  55. return price
  56. },
  57. showTip(){
  58. this.$emit('showFreightAlert');
  59. },
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. .freight-template{
  65. width: 100%;
  66. height: auto;
  67. background: #FFFFFF;
  68. float: left;
  69. margin-top: 24rpx;
  70. .invoice-freight{
  71. width: 702rpx;
  72. padding: 0 24rpx;
  73. height: 86rpx;
  74. line-height: 86rpx;
  75. font-size: $font-size-28;
  76. color: $text-color;
  77. background: #FFFFFF;
  78. float: left;
  79. font-weight: bold;
  80. .freight-left{
  81. float: left;
  82. .icon-yunfeishuoming{
  83. height: 100%;
  84. padding:15rpx;
  85. color: $color-system;
  86. font-weight: normal;
  87. }
  88. }
  89. .freight-right{
  90. float: right;
  91. color: #2A81FF;
  92. .text{
  93. line-height: 88rpx;
  94. color: #ff0000;
  95. margin:0 20rpx;
  96. font-weight: normal;
  97. }
  98. }
  99. }
  100. }
  101. </style>