index.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <span v-if="Number(value) >= Number(shopPrice)&&del" :class="{
  3. 'js_market_wrap': true,
  4. 'my_shop_price': true,
  5. 'is-del': del
  6. }" :data-orgp="value" :data-currency="currency" :data-original_amount="value">
  7. ¥{{ value }}
  8. </span>
  9. </template>
  10. <script>
  11. /**
  12. * D网用的 my-shop-price
  13. * 其他网站 my_shop_price
  14. */
  15. export default {
  16. name: 'unit-market-price',
  17. props: {
  18. // 价格
  19. value: {
  20. default: '0.00',
  21. required: true
  22. },
  23. // 售价,如果售价高于市场价,则不展示市场价
  24. shopPrice: {
  25. required: true
  26. },
  27. // 币种
  28. currency: {
  29. default: 'USD'
  30. },
  31. // 其他配置项
  32. config: {
  33. type: Object,
  34. default () {
  35. return {};
  36. }
  37. }
  38. },
  39. data() {
  40. return {
  41. };
  42. },
  43. computed: {
  44. // 是否展示删除线
  45. del() {
  46. let visible = true;
  47. visible = (this.config.market_price_del === undefined || this.config.market_price_del === null) ? true : Number(
  48. this.config.market_price_del) >= 1;
  49. return visible;
  50. }
  51. }
  52. };
  53. </script>
  54. <style lang="less" scoped>
  55. span.is-del {
  56. text-decoration: line-through;
  57. }
  58. </style>