freight.vue 1.9 KB

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