packageList.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <!-- -->
  2. <template>
  3. <div class="d-flex mt-5 list">
  4. <div v-for="(val, i) in packData" :key="i" class="list-item cursor-pointer" :class="{'active': active === i }" @click="handleClickItem(val, i)">
  5. <div v-if="val.recommend" class="recommend">推荐</div>
  6. <div class="text-center font-weight-bold">{{ val.title }}</div>
  7. <div class="text-center my-5">
  8. <div v-if="val.price && !val.cycle">
  9. <span class="font-weight-bold font-size-20">{{ val.price }}</span>
  10. <!-- /年 -->
  11. </div>
  12. <div v-if="val.cycle">¥<span class="font-weight-bold font-size-18 font-size-20">{{ val.price }}</span><span class="font-size-14 mr-3">起</span> {{ val.cycle }}</div>
  13. <div v-if="val.customized" class="font-size-20 font-weight-bold">按需定制</div>
  14. </div>
  15. <v-divider></v-divider>
  16. <div v-if="val.equity">
  17. <div class="font-weight-bold my-3">权益</div>
  18. <ul>
  19. <li v-for="(k, num) in val.equity" :key="k" :class="{'greyText': num+1 > val.showLength}">{{ k }}</li>
  20. </ul>
  21. </div>
  22. <div v-else>
  23. <h3 class="my-3">授权范围:</h3>
  24. <div class="font-size-15">扫描下方二维码联系高级客户经理为您定制</div>
  25. </div>
  26. <div class="text-center item-btn">
  27. <v-btn v-if="!val.customized" color="error" variant="outlined" rounded @click="createOrder(val)">开通会员</v-btn>
  28. </div>
  29. </div>
  30. </div>
  31. <CtDialog :visible="open" :widthType="1" :footer="false" titleClass="text-h6" title="开通会员" @close="open = false">
  32. <m-pay
  33. :payPrice="100"
  34. :qrCode="qrCode"
  35. :disabled="disabled"
  36. @overdue="handleOverdue"
  37. @refreshQrCode="refreshQrCode"
  38. ></m-pay>
  39. </CtDialog>
  40. </template>
  41. <script setup>
  42. import { packData } from './packageList.js'
  43. import { ref } from 'vue'
  44. // import Snackbar from '@/plugins/snackbar'
  45. import MPay from '@/components/personalRecharge/pay.vue'
  46. import { orderCreated, getOrder } from '@/api/common'
  47. defineOptions({name: 'purchasePackage-packageList'})
  48. const active = ref(2)
  49. const handleClickItem = (val, i) => {
  50. active.value = i
  51. }
  52. const open = ref(false)
  53. const disabled = ref(false)
  54. const qrCode = ref('')
  55. // const itemInfo = ref(null)
  56. // 开通会员
  57. // const handleOpenMembership = (val) => {
  58. // console.log(val)
  59. // // createOrder()
  60. // // open.value = true
  61. // }
  62. // 重新获取订单
  63. const refreshQrCode = () => {
  64. // getOrder(payType)
  65. }
  66. // 创建订单
  67. async function createOrder (val) {
  68. try {
  69. const data = await getOrder({
  70. spuId: val.spuId, // 商品编号
  71. type: val.type
  72. })
  73. if (data) {
  74. return
  75. }
  76. const orderId = await orderCreated({
  77. spuId: val.spuId, // 商品编号
  78. spuName: val.title, // 商品名称
  79. price: val.price, // 价格
  80. type: val.type // 订单类型 0平台订单|1求职端订单|2招聘端订单|3用户会员-14天|4用户会员-30天|5用户会员-30天|6用户会员-90天|7用户会员-365天,
  81. })
  82. // 获取二维码
  83. console.log(orderId)
  84. // qrCode.value = data
  85. } catch (error) {
  86. // console.log(error)
  87. }
  88. }
  89. // 过期
  90. function handleOverdue () {
  91. disabled.value = true
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .greyText {
  96. color: #774e2085 !important;
  97. }
  98. .list {
  99. width: 100%;
  100. }
  101. .list-item {
  102. position: relative;
  103. // height: 400px;
  104. min-height: 480px;;
  105. width: calc((100% - 120px) / 5);
  106. min-width: calc((100% - 120px) / 5);
  107. max-width: calc((100% - 120px) / 5);
  108. padding: 30px 20px;
  109. border-radius: 14px;
  110. margin-right: 30px;
  111. color: #774e20;
  112. background-color: #fafafa;
  113. &:nth-child(5n) {
  114. margin-right: 0;
  115. }
  116. .item-btn {
  117. position: absolute;
  118. bottom: 30px;
  119. left: 50%;
  120. transform: translateX(-50%);
  121. }
  122. }
  123. ul li {
  124. list-style: none;
  125. font-size: 15px;
  126. margin: 10px 0;
  127. font-weight: 500;
  128. }
  129. .active {
  130. background-color: rgba(255, 251, 248, 1);
  131. border: 1px solid #f1b17a;
  132. box-shadow: 0px 6px 12px 0px rgba(216, 160, 82, 0.36);
  133. }
  134. :deep(.v-btn) {
  135. border: 1px solid #bc8b55;
  136. color: #c30f0f !important;
  137. font-weight: 700;
  138. }
  139. .tips {
  140. background-color: #fffbf8;
  141. border: 1px solid #f1b17a;
  142. border-radius: 4px;
  143. text-align: center;
  144. font-size: 15px;
  145. }
  146. .recommend {
  147. position: absolute;
  148. top: 0;
  149. left: 0;
  150. width: 55px;
  151. height: 26px;
  152. line-height: 26px;
  153. background-color: #ff8a04;
  154. border-radius: 12px 0 18px 0;
  155. font-weight: 600;
  156. font-size: 14px;
  157. color: #fff;
  158. text-align: center;
  159. }
  160. .scanCode {
  161. border: 1px dashed #ccc;
  162. border-radius: 10px;
  163. padding: 30px;
  164. .code-left {
  165. border: 1px solid #f1b17a;
  166. border-radius: 6px;
  167. padding: 5px;
  168. }
  169. .price {
  170. font-size: 30px;
  171. font-weight: 700;
  172. color: #ff9012;
  173. }
  174. }
  175. :deep(.v-slide-group__content) {
  176. background: none !important;
  177. }
  178. .package-title {
  179. height: 60px;
  180. line-height: 60px;
  181. color: #fff;
  182. background: linear-gradient(45deg, #ff8a04, transparent);
  183. font-weight: 700;
  184. font-size: 20px;
  185. text-align: center;
  186. border-radius: 4px;
  187. }
  188. </style>