chooseCloudPhone.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <layout @goBack="leaveFun" :isNavBar="isNavBar">
  3. <div class="choose-cloud-phone">
  4. <div class="choose-cloud-phone_info">
  5. <div class="choose-cloud-phone_info-name">亲爱的{{ info.phoneNumber || '用户' }}</div>
  6. <div class="choose-cloud-phone_info-tips">
  7. <div>恭喜您获得“0元领云机”大奖</div>
  8. <div>感谢您的陪伴与支持</div>
  9. </div>
  10. </div>
  11. <div class="choose-cloud-phone_select">
  12. <div>请选择</div>
  13. <div v-for="item in 2" :key="item" @click="selectJumpPhone(item)"></div>
  14. </div>
  15. <cloudMobilePhonePopup
  16. v-model="visible"
  17. titleText="选择续费云手机"
  18. :ids.sync="ids"
  19. @confirm="selectJumpPhone(3)"
  20. :data="packageList"
  21. :total="packageTotal"
  22. :loading="loading"
  23. :listLoading.sync="listLoading"
  24. @load="load"
  25. >
  26. <van-search
  27. v-model="keyWord"
  28. placeholder="请输入云机名称"
  29. style="padding: 0; width: 150px"
  30. @input="search"
  31. />
  32. </cloudMobilePhonePopup>
  33. <!-- <v-btn @click="$router.push('/claimCloudPhone/detail')">点击跳转</v-btn> -->
  34. </div>
  35. </layout>
  36. </template>
  37. <script>
  38. import debounce from 'lodash.debounce';
  39. import common from './mixins/common.js';
  40. import layout from './components/layout.vue';
  41. import cloudMobilePhonePopup from '@/components/cloudMobilePhonePopup';
  42. let _self = null;
  43. export default {
  44. name: 'chooseCloudPhone',
  45. auth: false,
  46. head: {
  47. title: '0元购机,尽情享受',
  48. },
  49. mixins: [common],
  50. components: {
  51. layout,
  52. cloudMobilePhonePopup,
  53. },
  54. data() {
  55. return {
  56. visible: false, // 显示续费云手机弹窗
  57. ids: [], // 选中的id
  58. // 续费云手机套餐相关参数
  59. pageNum: 1,
  60. pageSize: 50,
  61. keyWord: '', // 搜索云手机关键词
  62. packageList: [],
  63. packageTotal: 0,
  64. loading: false,
  65. listLoading: false,
  66. isNavBar: true,
  67. info: {}
  68. };
  69. },
  70. mounted() {
  71. if(localStorage.getItem('bargainingStatusInfo')) {
  72. this.info = JSON.parse(localStorage.getItem('bargainingStatusInfo'))
  73. }
  74. this.isNavBar = !(+localStorage.getItem('auth.inviteeNum'))
  75. _self = this;
  76. // 用来监听微信返回上一页的
  77. const { exit } = this.$route.query;
  78. if (exit) {
  79. this.wxIntercept(() => {
  80. this.leaveFun();
  81. });
  82. }
  83. this.getRenewalPackage();
  84. },
  85. methods: {
  86. // 选增新增云手机 of 续费云手机
  87. selectJumpPhone(item) {
  88. if (item === 2) {
  89. this.ids = [];
  90. this.visible = true;
  91. return;
  92. }
  93. let url = '/claimCloudPhone/zeroYuanClaim';
  94. if (item === 3) url += `?userCardId=${this.ids[0].id}`;
  95. this.$router.push(url);
  96. },
  97. // 搜索云机名称
  98. search: debounce(() => {
  99. _self.pageNum = 1;
  100. _self.packageList = [];
  101. _self.getRenewalPackage();
  102. }, 500),
  103. // 获取续费套餐
  104. getRenewalPackage(bool = true) {
  105. if (bool) this.loading = true;
  106. this.$axios
  107. .$post('resources/v5/activity/card/bargaining/list', {
  108. diskName: this.keyWord,
  109. pageNum: this.pageNum,
  110. pageSize: this.pageSize,
  111. })
  112. .then((res) => {
  113. if (res.success) {
  114. this.packageList.push(...res.data.list);
  115. this.packageTotal = res.data.total;
  116. }
  117. })
  118. .finally(() => {
  119. this.loading = false;
  120. !bool && (this.listLoading = false);
  121. });
  122. },
  123. // 触发续费云手机套餐分页
  124. load() {
  125. this.pageNum++;
  126. this.getRenewalPackage(false);
  127. }
  128. },
  129. };
  130. </script>
  131. <style lang="scss" scoped>
  132. .choose-cloud-phone {
  133. height: 100%;
  134. .choose-cloud-phone_info {
  135. .choose-cloud-phone_info-name {
  136. display: inline-block;
  137. padding: 5px 10px;
  138. background: linear-gradient(296deg, #fdf0e2 0%, #fcd9ae 100%);
  139. box-shadow: 0px 1px 2px 0px #facd8a;
  140. border-radius: 4px;
  141. font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
  142. font-weight: bold;
  143. font-size: 14px;
  144. color: #754213;
  145. line-height: 20px;
  146. text-align: center;
  147. font-style: normal;
  148. margin-bottom: 4px;
  149. }
  150. .choose-cloud-phone_info-tips {
  151. & > div:first-child {
  152. font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
  153. font-weight: bold;
  154. font-size: 20px;
  155. line-height: 27px;
  156. font-style: normal;
  157. background: linear-gradient(90deg, #fffbfb 0%, #fbce95 100%);
  158. /* 将文字颜色设置为透明,以便背景渐变可见 */
  159. color: transparent;
  160. /* 使用 blend-mode 来控制渐变背景与文字颜色的混合效果 */
  161. -webkit-background-clip: text;
  162. background-clip: text;
  163. }
  164. & > div:last-child {
  165. font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
  166. font-weight: 400;
  167. font-size: 12px;
  168. color: #ffffff;
  169. line-height: 17px;
  170. margin-bottom: 20px;
  171. }
  172. }
  173. }
  174. .choose-cloud-phone_select {
  175. & > div {
  176. margin-bottom: 12px;
  177. }
  178. & > div:nth-of-type(1) {
  179. font-family: PingFangSC, PingFang SC;
  180. font-weight: bold;
  181. font-size: 16px;
  182. color: #ffffff;
  183. line-height: 20px;
  184. font-style: normal;
  185. }
  186. & > div:nth-of-type(2) {
  187. background: url(~/assets/image/claimCloudPhone/addCloudMobilePhone.png)
  188. no-repeat;
  189. }
  190. & > div:nth-of-type(3) {
  191. background: url(~/assets/image/claimCloudPhone/renewCloudMobilePhone.png)
  192. no-repeat;
  193. }
  194. & > div:nth-of-type(2),
  195. & > div:nth-of-type(3) {
  196. height: 123px;
  197. background-size: 100% 100%;
  198. background-position: 0px 0px;
  199. }
  200. }
  201. }
  202. </style>