VipList.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <view :class="['qn-page-' + theme]">
  3. <u-tabs-swiper
  4. ref="tabs"
  5. font-size="28"
  6. :current="tab_current"
  7. inactive-color="#2A2A2A"
  8. :active-color="primaryColor"
  9. :bar-style="{ borderRadius: '0', height: '4rpx', backgroundColor: primaryColor }"
  10. :list="navList"
  11. :is-scroll="false"
  12. @change="tabClick"
  13. ></u-tabs-swiper>
  14. <!-- 空白页 -->
  15. <Aempty text="您还没有相关会员卡" src="https://onlineimg.qianniao.vip/list.png" v-if="vipList.length === 0"></Aempty>
  16. <scroll-view @scrolltolower="scrollBootom" scroll-y="true" class="vip-scroll">
  17. <view
  18. class="bg_color"
  19. :class="
  20. item.styleId === 1
  21. ? 'card-style-golden'
  22. : item.styleId === 2
  23. ? 'card-style-erythrine'
  24. : item.styleId === 3
  25. ? 'card-style-gray'
  26. : item.styleId === 4
  27. ? 'card-style-brown'
  28. : item.styleId === 5
  29. ? 'card-style-blue'
  30. : item.styleId === 6
  31. ? 'card-style-black'
  32. : ''
  33. "
  34. v-for="item in vipList"
  35. :key="item.id"
  36. @click="checkVip(item)"
  37. >
  38. <view class="clearfix one_title">
  39. <image class="float_left vip_img" src="https://onlineimg.qianniao.vip/vip-icon.png" mode="aspectFit" />
  40. <view class="float_left vip-name">{{ item.name }}</view>
  41. <view v-if="parseFloat(item.price) === 0 && parseInt(item.renew) === 4" class="float_right like_btn" @click.stop="goPay(item)">免费领取</view>
  42. <view v-else-if="parseInt(item.renew) === 4" class="float_right like_btn" @click.stop="goPay(item)">立即开通</view>
  43. <view v-else-if="parseInt(item.renew) === 5 && parseFloat(item.price) !== 0" class="float_right like_btn" @click.stop="goPay(item)">立即续费</view>
  44. </view>
  45. <view v-if="tab_current === 0" class="vip-time">有效期:{{ item.effectiveDate === 5 ? '永久有效' : item.effectiveMonth + '个月' }}</view>
  46. <view v-else class="vip-time">{{ item.effectiveDate === 5 ? '有效期:永久有效' : '有效期至:' + $_utils.formatDate(item.expireTime) }}</view>
  47. <view class="vip-bottom clearfix">
  48. <view class="vip-yh float_left">折扣优惠·更多权限</view>
  49. <view class="vip-price float_right">
  50. <text class="rmb-ic">¥</text>
  51. {{ Number(item.price) }}
  52. </view>
  53. </view>
  54. <view class="vip-discount">
  55. {{ parseFloat(item.discount) }}
  56. <text class="vip-dis">折</text>
  57. </view>
  58. </view>
  59. <u-loadmore margin-top="20" v-if="vipList.length" :status="loading_status" />
  60. </scroll-view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. title: '',
  68. sources: '',
  69. loading_status: 'loadmore',
  70. vipList: [],
  71. tab_current: 0,
  72. page: 1,
  73. source: '',
  74. pageSize: 10,
  75. pageTotal: 0,
  76. payInfo: '',
  77. // 判断是否领取过
  78. received: '', // 4当前没有会员卡,5当前用户有
  79. navList: [
  80. {
  81. name: '全部'
  82. },
  83. {
  84. name: '我的会员卡'
  85. }
  86. ]
  87. };
  88. },
  89. onLoad(options) {
  90. // 判断选择是1或2
  91. this.sources = parseInt(options.sources) || 0;
  92. if (this.sources === 1) {
  93. this.tab_current = 1;
  94. this.getMyVipCards();
  95. } else {
  96. this.getAllVipCard();
  97. }
  98. this.source = this.$common.source();
  99. },
  100. methods: {
  101. // 选择vip
  102. checkVip(item) {
  103. this.goPage(`/pagesT/user/VipDetail?id=${item.id}`);
  104. },
  105. async goPay(item) {
  106. // if (this.$store.state.baseSet.personnelReview === 5) {
  107. // 验证账户状态
  108. this.userAudit();
  109. if (!this.isUserAudit) {
  110. return;
  111. }
  112. // }
  113. if (this.received === 5) {
  114. uni.showModal({
  115. title: '此会员卡购买成功后,其余拥有会员卡自动作废',
  116. success: async res => {
  117. if (res.confirm) {
  118. this.payCheck(item);
  119. }
  120. }
  121. });
  122. } else {
  123. this.payCheck(item);
  124. }
  125. },
  126. payCheck(item) {
  127. if (item.price > 0) {
  128. uni.navigateTo({
  129. url: `/pagesT/money/pay?price=${item.price}&vip=${1}&vipId=${item.id}`
  130. });
  131. } else {
  132. this.$u.api
  133. .createVipCardOrder({
  134. payType: 1,
  135. source: this.source,
  136. vipCardId: item.id
  137. })
  138. .then(({ data }) => {
  139. this.payInfo = data;
  140. if (this.payInfo.orderId) {
  141. this.$api.msg('免费领取成功,请在我的会员卡里查看');
  142. this.getlist();
  143. }
  144. });
  145. }
  146. },
  147. // 下拉请求
  148. scrollBootom() {
  149. if (this.pageTotal / this.pageSize > this.page) {
  150. this.page += 1;
  151. this.getlist();
  152. }
  153. },
  154. getlist() {
  155. if (this.tab_current === 0) {
  156. this.getAllVipCard();
  157. } else {
  158. this.getMyVipCards();
  159. }
  160. },
  161. // 获取会员列表
  162. getAllVipCard() {
  163. this.loading_status = 'loading';
  164. this.$u.api
  165. .getAllVipCard({
  166. page: this.page,
  167. pageSize: this.pageSize
  168. })
  169. .then(({ data, pageTotal, received }) => {
  170. if (this.page === 1) {
  171. this.vipList = data;
  172. } else {
  173. this.vipList = this.vipList.concat(data);
  174. }
  175. this.pageTotal = pageTotal;
  176. this.received = received;
  177. this.loading_status = this.$_utils.loadStatus(this.page, this.pageSize, this.pageTotal);
  178. });
  179. },
  180. // 获取我的会员卡
  181. getMyVipCards() {
  182. this.loading_status = 'loading';
  183. this.$u.api
  184. .getMyVipCards({
  185. page: this.page,
  186. pageSize: this.pageSize
  187. })
  188. .then(({ data, pageTotal }) => {
  189. if (this.page === 1) {
  190. this.vipList = data;
  191. } else {
  192. this.vipList = this.vipList.concat(data);
  193. }
  194. this.pageTotal = pageTotal;
  195. this.loading_status = this.$_utils.loadStatus(this.page, this.pageSize, this.pageTotal);
  196. });
  197. },
  198. //顶部tab点击
  199. tabClick(index) {
  200. this.vipList = [];
  201. this.tab_current = index;
  202. this.getlist();
  203. },
  204. changeTab(e) {
  205. this.vipList = [];
  206. this.tab_current = e.target.current;
  207. this.getlist();
  208. }
  209. }
  210. };
  211. </script>
  212. <style lang="scss">
  213. page {
  214. background-color: #f5f9fc;
  215. }
  216. .vip-scroll {
  217. /* #ifdef H5 */
  218. height: calc(100vh - 88upx - 44px);
  219. /*#endif*/
  220. /* #ifdef MP || APP-PLUS*/
  221. height: calc(100vh - 88upx);
  222. /*#endif*/
  223. }
  224. .vip-discount {
  225. position: absolute;
  226. left: 0upx;
  227. top: 0upx;
  228. width: 100%;
  229. text-align: center;
  230. font-size: 200upx;
  231. opacity: 0.3;
  232. .vip-dis {
  233. font-size: 30upx;
  234. color: #ffffff;
  235. }
  236. }
  237. .card-style-golden {
  238. background: linear-gradient(to right, #c1a167, #e9d5aa);
  239. }
  240. .card-style-erythrine {
  241. background: linear-gradient(to right, #745757, #966d6d);
  242. }
  243. .card-style-gray {
  244. background: linear-gradient(to right, #434247, #7a7985);
  245. }
  246. .card-style-brown {
  247. background: linear-gradient(to right, #736e6c, #978c8c);
  248. }
  249. .card-style-blue {
  250. background: linear-gradient(to right, #576074, #6d7b96);
  251. }
  252. .card-style-black {
  253. background: linear-gradient(to right, #373737, #4a4a4a);
  254. }
  255. .bg_color {
  256. margin: 30upx auto 0;
  257. height: 270upx;
  258. width: 600upx;
  259. padding: 0 30upx;
  260. border-radius: 20upx;
  261. color: #ffffff;
  262. font-size: 25upx;
  263. color: rgba($color: #ffffff, $alpha: 0.8);
  264. position: relative;
  265. .vip-bottom {
  266. position: absolute;
  267. bottom: 5upx;
  268. left: 24upx;
  269. width: 550upx;
  270. line-height: 90upx;
  271. // padding: ;
  272. .vip-yh {
  273. color: rgba($color: #ffffff, $alpha: 0.8);
  274. padding-top: 10upx;
  275. }
  276. .vip-price {
  277. font-size: 60upx;
  278. font-weight: bold;
  279. text-align: right;
  280. color: #ffffff;
  281. .rmb-ic {
  282. font-weight: 400;
  283. font-size: 24upx;
  284. margin-right: 10upx;
  285. }
  286. }
  287. }
  288. .vip-time {
  289. padding-top: 20upx;
  290. font-size: 24upx;
  291. color: rgba($color: #ffffff, $alpha: 0.7);
  292. }
  293. .one_title {
  294. position: relative;
  295. padding-top: 30upx;
  296. .vip-name {
  297. color: #ffffff;
  298. font-size: 32upx;
  299. font-weight: 600;
  300. }
  301. .vip_img {
  302. width: 40rpx;
  303. height: 40rpx;
  304. // transform: translateX(-20rpx);
  305. vertical-align: middle;
  306. margin-right: 20upx;
  307. opacity: 0.9;
  308. }
  309. }
  310. .like_btn {
  311. position: relative;
  312. z-index: 10;
  313. font-size: 24upx;
  314. color: #333333;
  315. display: inline-block;
  316. height: 42upx;
  317. width: 120upx;
  318. border-radius: 28upx;
  319. background: rgba($color: #ffffff, $alpha: 0.6);
  320. text-align: center;
  321. line-height: 42upx;
  322. }
  323. .discount {
  324. font-size: 30upx;
  325. .normal_font {
  326. font-size: 18upx;
  327. }
  328. }
  329. .expiration {
  330. padding: 20upx 0;
  331. }
  332. }
  333. </style>