setMealItem.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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)" :class="{ mark: type }">
  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. if (res.data.bargainingStatus === 6) {
  99. setTimeout(() => {
  100. this.$toast('活动已到期');
  101. });
  102. return;
  103. }
  104. setTimeout(() => {
  105. this.$toast('已参加正在砍价活动,请退出后重新进入');
  106. });
  107. }
  108. }
  109. })
  110. .finally(() => {
  111. this.$toast.clear();
  112. });
  113. return;
  114. }
  115. this.$emit('buy', data);
  116. },
  117. },
  118. computed: {
  119. list() {
  120. this.data.mealList.length > 10
  121. ? this.data.mealList.slice(0, 9)
  122. : this.data.mealList;
  123. },
  124. },
  125. };
  126. </script>
  127. <style lang="less" scoped>
  128. .set-meal-item {
  129. background: #ffffff;
  130. border-radius: 14px;
  131. border: 1px solid #feffef;
  132. margin-top: 12px;
  133. padding: 16px;
  134. font-family: PingFangSC, PingFang SC;
  135. & > img {
  136. height: 59px;
  137. width: 100%;
  138. margin-top: 12px;
  139. }
  140. .set-meal-item_content {
  141. max-height: 142px;
  142. overflow: hidden;
  143. &.expand-open {
  144. max-height: none;
  145. }
  146. .set-meal-item_content-item {
  147. padding: 14px 0;
  148. border-bottom: 1px solid #f0f0f0;
  149. display: flex;
  150. justify-content: space-between;
  151. .set-meal-item_content-item_left {
  152. display: flex;
  153. align-items: center;
  154. font-family: PingFangSC, PingFang SC;
  155. font-weight: 500;
  156. font-size: 14px;
  157. color: #6d2b12;
  158. line-height: 20px;
  159. text-align: left;
  160. font-style: normal;
  161. .invited {
  162. display: flex;
  163. align-items: center;
  164. & > img {
  165. width: 36px;
  166. height: 36px;
  167. }
  168. .invited-info {
  169. margin-left: 8px;
  170. & > div:last-of-type {
  171. display: flex;
  172. & > div {
  173. font-weight: bold;
  174. line-height: 20px;
  175. font-style: normal;
  176. }
  177. .actual-price {
  178. font-size: 16px;
  179. color: #f04646;
  180. }
  181. .original-price {
  182. font-size: 12px;
  183. color: #bbbbbb;
  184. line-height: 23px;
  185. text-decoration: line-through;
  186. margin-left: 8px;
  187. }
  188. }
  189. }
  190. }
  191. }
  192. .set-meal-item_content-item_right {
  193. display: flex;
  194. align-items: center;
  195. .set-meal-item_content-item_right-price {
  196. font-weight: bold;
  197. font-size: 16px;
  198. color: #f04646;
  199. line-height: 20px;
  200. text-align: left;
  201. font-style: normal;
  202. display: flex;
  203. align-items: center;
  204. margin-right: 5px;
  205. text-decoration: line-through;
  206. font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
  207. font-weight: bold;
  208. }
  209. & > div:last-of-type {
  210. height: 30px;
  211. padding: 6px 12px;
  212. background: linear-gradient(178deg, #fd8c50 0%, #fc3307 100%);
  213. border-radius: 21px;
  214. font-weight: bold;
  215. font-size: 14px;
  216. color: #ffffff;
  217. line-height: 18px;
  218. text-align: left;
  219. font-style: normal;
  220. &.mark {
  221. height: 42px;
  222. line-height: 42px;
  223. font-size: 24px;
  224. padding: 0 32px;
  225. }
  226. }
  227. }
  228. }
  229. }
  230. .set-meal-item-title {
  231. font-family: PingFangSC, PingFang SC;
  232. font-weight: 500;
  233. font-size: 18px;
  234. color: #6d2b12;
  235. line-height: 20px;
  236. text-align: left;
  237. font-style: normal;
  238. }
  239. .expand {
  240. display: flex;
  241. justify-content: center;
  242. font-weight: 400;
  243. font-size: 12px;
  244. color: #7d6156;
  245. line-height: 16px;
  246. text-align: center;
  247. font-style: normal;
  248. margin-top: 10px;
  249. }
  250. }
  251. </style>