setMealItem.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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.$axios
  84. .$get('activity/v5/assist/bargaining/current/bargainingStatus')
  85. .then((res) => {
  86. if (res.success) {
  87. if (!res.data.bargainingStatus) {
  88. this.$router.push('/claimCloudPhone/1?menuRuleId=' + data.id);
  89. } else {
  90. setTimeout(() => {
  91. this.$toast('已参加正在砍价活动,请退出后重新进入');
  92. })
  93. }
  94. }
  95. })
  96. .finally(() => {
  97. this.$toast.clear();
  98. });
  99. return;
  100. }
  101. this.$emit('buy', data);
  102. },
  103. },
  104. };
  105. </script>
  106. <style lang="less" scoped>
  107. .set-meal-item {
  108. background: #ffffff;
  109. border-radius: 14px;
  110. border: 1px solid #feffef;
  111. margin-top: 12px;
  112. padding: 16px;
  113. font-family: PingFangSC, PingFang SC;
  114. & > img {
  115. height: 59px;
  116. width: 100%;
  117. margin-top: 12px;
  118. }
  119. .set-meal-item_content {
  120. max-height: 130px;
  121. overflow: hidden;
  122. &.expand-open {
  123. max-height: none;
  124. }
  125. .set-meal-item_content-item {
  126. padding: 14px 0;
  127. border-bottom: 1px solid #f0f0f0;
  128. display: flex;
  129. justify-content: space-between;
  130. .set-meal-item_content-item_left {
  131. display: flex;
  132. align-items: center;
  133. font-weight: bold;
  134. font-size: 14px;
  135. color: #6d2b12;
  136. line-height: 20px;
  137. text-align: left;
  138. font-style: normal;
  139. .invited {
  140. display: flex;
  141. align-items: center;
  142. & > img {
  143. width: 36px;
  144. height: 36px;
  145. }
  146. .invited-info {
  147. margin-left: 8px;
  148. & > div:last-of-type {
  149. display: flex;
  150. & > div {
  151. font-weight: bold;
  152. line-height: 20px;
  153. font-style: normal;
  154. }
  155. .actual-price {
  156. font-size: 16px;
  157. color: #f04646;
  158. }
  159. .original-price {
  160. font-size: 12px;
  161. color: #bbbbbb;
  162. line-height: 23px;
  163. text-decoration: line-through;
  164. margin-left: 8px;
  165. }
  166. }
  167. }
  168. }
  169. }
  170. .set-meal-item_content-item_right {
  171. display: flex;
  172. align-items: center;
  173. .set-meal-item_content-item_right-price {
  174. font-weight: bold;
  175. font-size: 16px;
  176. color: #f04646;
  177. line-height: 20px;
  178. text-align: left;
  179. font-style: normal;
  180. display: flex;
  181. align-items: center;
  182. margin-right: 5px;
  183. text-decoration: line-through;
  184. }
  185. & > div:last-of-type {
  186. height: 30px;
  187. padding: 6px 12px;
  188. background: linear-gradient(178deg, #fd8c50 0%, #fc3307 100%);
  189. border-radius: 21px;
  190. font-weight: bold;
  191. font-size: 14px;
  192. color: #ffffff;
  193. line-height: 18px;
  194. text-align: left;
  195. font-style: normal;
  196. }
  197. }
  198. }
  199. }
  200. .set-meal-item-title {
  201. font-weight: bold;
  202. font-size: 18px;
  203. color: #6d2b12;
  204. line-height: 20px;
  205. text-align: left;
  206. font-style: normal;
  207. }
  208. .expand {
  209. display: flex;
  210. justify-content: center;
  211. font-weight: 400;
  212. font-size: 12px;
  213. color: #7d6156;
  214. line-height: 16px;
  215. text-align: center;
  216. font-style: normal;
  217. margin-top: 16px;
  218. }
  219. }
  220. </style>