普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 lines
3.6 KiB

  1. <template>
  2. <view class="flex card">
  3. <view>
  4. <uv-checkbox-group
  5. v-model="checkboxValue"
  6. shape="circle"
  7. @change="onChange"
  8. >
  9. <uv-checkbox
  10. size="36rpx"
  11. icon-size="36rpx"
  12. activeColor="#7451DE"
  13. :name="1"
  14. ></uv-checkbox>
  15. </uv-checkbox-group>
  16. </view>
  17. <view class="img-box">
  18. <image class="img" :src="data.url" mode="aspectFit"></image>
  19. </view>
  20. <view class="info">
  21. <view class="title">{{ data.name }}</view>
  22. <view class="desc">{{ data.desc }}</view>
  23. <view class="flex price-box">
  24. <view class="flex price">¥<text class="highlight">{{ data.price.toFixed(2) }}</text>/</view>
  25. <view class="price-origin">{{ `¥${data.originalPrice}/次` }}</view>
  26. </view>
  27. <view class="flex tool">
  28. <view class="flex count">规格<text class="highlight">{{ `x${data.count}` }}</text></view>
  29. <button class="flex btn" @click="jumpToProductDetail">详情</button>
  30. </view>
  31. </view>
  32. <view v-if="data.customized" class="sup">
  33. 定制组合
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. props: {
  40. data: {
  41. type: Object,
  42. default() {
  43. return {}
  44. }
  45. },
  46. },
  47. data() {
  48. return {
  49. checkboxValue : []
  50. }
  51. },
  52. computed: {
  53. checked: {
  54. set(val) {
  55. this.checkboxValue = val ? [1] : []
  56. if (this.data.selected == val) {
  57. return
  58. }
  59. this.$emit('select', val)
  60. },
  61. get() {
  62. return this.checkboxValue[0] == 1 ? true : false
  63. }
  64. }
  65. },
  66. watch: {
  67. data: {
  68. handler(val) {
  69. this.checked = val.selected
  70. },
  71. immediate: true,
  72. deep: true,
  73. }
  74. },
  75. methods: {
  76. onChange(arr) {
  77. this.checked = arr[0] == 1 ? true : false
  78. },
  79. jumpToProductDetail() {
  80. // todo
  81. },
  82. },
  83. }
  84. </script>
  85. <style scoped lang="scss">
  86. .card {
  87. position: relative;
  88. height: 272rpx;
  89. padding: 0 32rpx;
  90. background-image: linear-gradient(#FAFAFF, #F3F3F3);
  91. border: 2rpx solid #FFFFFF;
  92. border-radius: 32rpx;
  93. box-sizing: border-box;
  94. column-gap: 24rpx;
  95. overflow: hidden;
  96. /deep/ .uv-checkbox__label-wra {
  97. padding: 0;
  98. }
  99. }
  100. .img {
  101. &-box {
  102. width: 144rpx;
  103. height: 144rpx;
  104. border-radius: 16rpx;
  105. overflow: hidden;
  106. }
  107. width: 100%;
  108. height: 100%;
  109. }
  110. .info {
  111. flex: 1;
  112. font-family: PingFang SC;
  113. font-weight: 400;
  114. line-height: 1.4;
  115. font-size: 26rpx;
  116. color: #8B8B8B;
  117. .title {
  118. font-weight: 600;
  119. font-size: 28rpx;
  120. color: #000000;
  121. }
  122. .desc {
  123. margin-top: 8rpx;
  124. line-height: 1.5;
  125. }
  126. .price {
  127. &-box {
  128. margin-top: 8rpx;
  129. justify-content: flex-start;
  130. column-gap: 20rpx;
  131. }
  132. font-weight: 600;
  133. font-size: 24rpx;
  134. color: #7451DE;
  135. .highlight {
  136. margin: 0 8rpx;
  137. font-size: 32rpx;
  138. }
  139. &-origin {
  140. font-size: 28rpx;
  141. line-height: 1;
  142. text-decoration: line-through;
  143. }
  144. }
  145. .tool {
  146. margin-top: 8rpx;
  147. justify-content: space-between;
  148. .count {
  149. .highlight {
  150. margin-left: 8rpx;
  151. color: #252545;
  152. }
  153. }
  154. .btn {
  155. padding: 8rpx 22rpx;
  156. font-size: 28rpx;
  157. color: #252545;
  158. border: 2rpx solid #252545;
  159. border-radius: 30rpx;
  160. }
  161. }
  162. }
  163. .sup {
  164. position: absolute;
  165. top: 28rpx;
  166. right: -60rpx;
  167. padding: 5rpx 52rpx;
  168. font-family: PingFang SC;
  169. font-weight: 400;
  170. font-size: 28rpx;
  171. line-height: 1.5;
  172. white-space: nowrap;
  173. color: #FFFFFF;
  174. background: #252545;
  175. transform: rotate(45deg);
  176. }
  177. </style>