giftCard.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="gift_card">
  3. <van-row
  4. style="border-bottom: solid 1px #e4e4e4; padding:5px"
  5. >
  6. <van-col span="8">
  7. <img :src="presentImg" style="max-width: 100%"/>
  8. </van-col>
  9. <van-col span="16">
  10. <van-row type="flex" justify="space-between">
  11. <van-col class="c"><p><strong>{{owner ? '对方' : '我'}}的礼物</strong></p></van-col>
  12. <van-col class="c"><p>{{place[placeId]}}</p></van-col>
  13. </van-row>
  14. <van-row type="flex" justify="space-between">
  15. <van-col class="c"><p>匹配性别</p></van-col>
  16. <van-col class="c"><p>{{gender ? '女' : '男'}}</p></van-col>
  17. </van-row>
  18. <van-row type="flex" justify="space-between">
  19. <van-col class="c"><p>礼物状态</p></van-col>
  20. <van-col class="c" ><p :style="{ color: statusColor[status] }">{{statusString[status]}}</p></van-col>
  21. </van-row>
  22. <van-row type="flex" justify="space-between">
  23. <van-col class="c"><p>微信</p></van-col>
  24. <van-col class="c">
  25. <p style="float: left">{{wechat}}</p>
  26. <van-button round size="mini"
  27. v-if="owner" style="margin-left: 5px"
  28. v-clipboard:copy="wechat"
  29. v-clipboard:success="onCopy"
  30. v-clipboard:error="onError"
  31. >复制</van-button>
  32. </van-col>
  33. </van-row>
  34. </van-col>
  35. </van-row>
  36. <p style="text-align: left; font-size: 110%"><strong>{{presentName}}</strong></p>
  37. <p style="text-align: left">{{presentDesc}}</p>
  38. </div>
  39. </template>
  40. <script>
  41. import { Card, Row, Col, Button } from 'vant';
  42. export default {
  43. name: "giftCard",
  44. components: {
  45. [Card.name]: Card,
  46. [Row.name]: Row, [Col.name]: Col,
  47. [Button.name]: Button,
  48. },
  49. data() {
  50. return {
  51. place: ['南区', '斋区', '西南', '西丽'],
  52. statusString: ['审核中', '匹配中', '匹配成功', '交换成功', '审核失败'],
  53. statusColor: ['#f43736', '#00ff00', '#00bfff', '#00fa9a', '#ff0000']
  54. }
  55. },
  56. props: {
  57. presentImg: {
  58. type: String,
  59. default: require('../assets/image_load_fail.jpg')
  60. },
  61. presentName: {
  62. type: String,
  63. default: "礼物名称"
  64. },
  65. presentDesc: {
  66. type: String,
  67. default: '这是一本我很喜欢的书,我曾经把这本书反反复复看了三遍,真的非常推荐。如果你也是科幻迷,你肯定会喜欢哒。圣诞快乐,喜欢这本书可以和我一起讨论哦!'
  68. },
  69. owner: {
  70. type: Number,
  71. default: 0 // 0: 我的; 1: 对方的
  72. },
  73. placeId: {
  74. type: Number,
  75. default: 0
  76. },
  77. gender: {
  78. type: Number,
  79. default: 0
  80. },
  81. status: {
  82. type: Number,
  83. default: 0
  84. },
  85. wechat: {
  86. type: String,
  87. default: 'undefined id'
  88. }
  89. },
  90. methods: {
  91. onCopy: function (e) {
  92. alert('You just copied: ' + e.text)
  93. },
  94. onError: function (e) {
  95. alert('Failed to copy texts')
  96. }
  97. }
  98. }
  99. </script>
  100. <style scoped>
  101. .c {
  102. height: 25px;
  103. margin-left: 10px;
  104. margin-right: 5px;
  105. }
  106. p {
  107. margin: 0;
  108. }
  109. .gift_card {
  110. margin: 20px 20px;
  111. background-color: white;
  112. padding: 10px;
  113. }
  114. </style>