setMealItem.vue 6.1 KB

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