setMealItem.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <div class="set-meal-item">
  3. <div class="set-meal-item-title">
  4. {{ packageType[data.cloudSetMealType] }} 安卓{{ data.androidVersion }}
  5. </div>
  6. <img :src="IMG_URL + '/' + data.promotionalImages" alt="" />
  7. <div :class="['set-meal-item_content', { 'expand-open': isExpand }]">
  8. <div
  9. v-for="item in data.mealList"
  10. :key="item.id"
  11. class="set-meal-item_content-item"
  12. >
  13. <div class="set-meal-item_content-item_left">
  14. <div v-if="!type" class="invited">
  15. <img :src="require(`@/assets/image/${item.phoneType}_icon.png`)" />
  16. <div class="invited-info">
  17. <div>{{ packageType[item.phoneType] }}{{ item.day }}天套餐</div>
  18. <div>
  19. <div class="actual-price">
  20. <span>¥</span>{{ item.actualPrice }}
  21. </div>
  22. <div v-if="item.originalPrice" class="original-price">
  23. <span>¥</span>{{ item.originalPrice }}
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. <div v-else>
  29. {{ packageType[item.phoneType] }}{{ item.day }}天套餐
  30. </div>
  31. </div>
  32. <div class="set-meal-item_content-item_right">
  33. <div class="set-meal-item_content-item_right-price" v-if="type">
  34. <span>¥</span
  35. >{{ item.originalPrice ? item.originalPrice : item.actualPrice }}
  36. </div>
  37. <div @click="add(item)">
  38. {{ type ? '0元领' : '新增云手机' }}
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="expand" v-if="data.mealList.length > 2">
  44. <span @click="isExpand = !isExpand">
  45. {{ isExpand ? '收起' : '查看全部' }}
  46. <van-icon :name="isExpand ? 'arrow-up' : 'arrow-down'" />
  47. </span>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. export default {
  53. name: 'setMealItem',
  54. props: {
  55. type: {
  56. type: Number,
  57. default: 1, // 0是被邀请人 1是邀请人
  58. },
  59. data: {
  60. type: Object,
  61. default: () => {
  62. return {};
  63. },
  64. },
  65. },
  66. data() {
  67. return {
  68. isExpand: false,
  69. packageType: {
  70. VIP: '星动',
  71. SVIP: '星曜',
  72. STARRYSKY: '星空',
  73. STAR: '唔即',
  74. STARPRO: '唔即Pro',
  75. },
  76. IMG_URL: process.env.IMG_URL,
  77. };
  78. },
  79. mounted() {},
  80. methods: {
  81. add(data) {
  82. if (this.type) {
  83. this.$router.push('/claimCloudPhone/1?menuRuleId=' + data.id);
  84. return;
  85. }
  86. this.$emit('buy', data);
  87. },
  88. },
  89. };
  90. </script>
  91. <style lang="less" scoped>
  92. .set-meal-item {
  93. background: #ffffff;
  94. border-radius: 14px;
  95. border: 1px solid #feffef;
  96. margin-top: 12px;
  97. padding: 16px;
  98. font-family: PingFangSC, PingFang SC;
  99. & > img {
  100. height: 59px;
  101. width: 100%;
  102. margin-top: 12px;
  103. }
  104. .set-meal-item_content {
  105. max-height: 130px;
  106. overflow: hidden;
  107. &.expand-open {
  108. max-height: none;
  109. }
  110. .set-meal-item_content-item {
  111. padding: 14px 0;
  112. border-bottom: 1px solid #f0f0f0;
  113. display: flex;
  114. justify-content: space-between;
  115. .set-meal-item_content-item_left {
  116. display: flex;
  117. align-items: center;
  118. font-weight: bold;
  119. font-size: 14px;
  120. color: #6d2b12;
  121. line-height: 20px;
  122. text-align: left;
  123. font-style: normal;
  124. .invited {
  125. display: flex;
  126. align-items: center;
  127. & > img {
  128. width: 36px;
  129. height: 36px;
  130. }
  131. .invited-info {
  132. margin-left: 8px;
  133. & > div:last-of-type {
  134. display: flex;
  135. & > div {
  136. font-weight: bold;
  137. line-height: 20px;
  138. font-style: normal;
  139. }
  140. .actual-price {
  141. font-size: 16px;
  142. color: #f04646;
  143. }
  144. .original-price {
  145. font-size: 12px;
  146. color: #bbbbbb;
  147. line-height: 23px;
  148. text-decoration: line-through;
  149. margin-left: 8px;
  150. }
  151. }
  152. }
  153. }
  154. }
  155. .set-meal-item_content-item_right {
  156. display: flex;
  157. align-items: center;
  158. .set-meal-item_content-item_right-price {
  159. font-weight: bold;
  160. font-size: 16px;
  161. color: #f04646;
  162. line-height: 20px;
  163. text-align: left;
  164. font-style: normal;
  165. display: flex;
  166. align-items: center;
  167. margin-right: 5px;
  168. text-decoration: line-through;
  169. }
  170. & > div:last-of-type {
  171. height: 30px;
  172. padding: 6px 12px;
  173. background: linear-gradient(178deg, #fd8c50 0%, #fc3307 100%);
  174. border-radius: 21px;
  175. font-weight: bold;
  176. font-size: 14px;
  177. color: #ffffff;
  178. line-height: 18px;
  179. text-align: left;
  180. font-style: normal;
  181. }
  182. }
  183. }
  184. }
  185. .set-meal-item-title {
  186. font-weight: bold;
  187. font-size: 18px;
  188. color: #6d2b12;
  189. line-height: 20px;
  190. text-align: left;
  191. font-style: normal;
  192. }
  193. .expand {
  194. display: flex;
  195. justify-content: center;
  196. font-weight: 400;
  197. font-size: 12px;
  198. color: #7d6156;
  199. line-height: 16px;
  200. text-align: center;
  201. font-style: normal;
  202. margin-top: 16px;
  203. }
  204. }
  205. </style>