setMealItem.vue 5.9 KB

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