123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <view class="selectCar-box">
- <view v-if="state.list&&state.list.length>0" class="item" v-for="(item,i) in state.list" :key="i">
- <view class="iten-left">
- <view>权益名称:{{item.productName}}</view>
- <view>权益金额:{{item.discountPrice * 0.01}}</view>
- </view>
- </view>
- <view style="text-align: center;margin: 20rpx;font-size: 30rpx;" v-if="state.flags">我是有底线的~</view>
- <view v-else>
- <empty title='暂无权益记录' />
- </view>
- </view>
- </template>
-
- <script lang="ts" setup>
- import empty from "@/components/empty/empty.vue";
- import {
- reactive,
- ref
- } from "vue"
- import {
- msg,
- navTo
- } from "@/utils/utils"
- import {
- onLoad, onReachBottom
- } from "@dcloudio/uni-app";
- import {
- showEquityListApi
- } from "@/utils/network/api.js";
- import {
- request
- } from "@/utils/network/request.js";
- import {
- getItem,
- StorageKeys,
- } from "@/utils/storage";
- import {
- stringToJson
- } from "@/utils/network/encryption";
-
- const state = reactive({
- list: [],//车辆list,
- equtyId: "",//权益id
- flags: false,
- pageSize: 1,
- pageNo: 10
- });
- const flag = ref('0') //默认选择0
- onLoad((option) => {
- showEquityListRequest()
- });
- const showEquityListRequest = () => {
- const options = {
- type: 2,
- data: {
- "openId": getItem(StorageKeys.OpenId),
- "pageNo": state.pageNo,
- "pageSize": state.pageSize,
- },
- method: 'POST',
- showLoading: true,
- }
- request(showEquityListApi, options).then((res) => {
- const data = stringToJson(res.bizContent);
- console.log("购买2", data.data)
- state.list = data.data
- })
- }
- // 触底加载
- onReachBottom(() => {
- if (state.list.length < state.pageSize * 10) return state.flags = true
- console.log("触底了")
- state.pageSize++
- showEquityListRequest()
- })
- </script>
-
- <style>
- page {
- width: 100%;
- height: 100%;
- background-color: #EEF7F7;
- }
- </style>
- <style lang="scss" scoped>
- .selectCar-box {
- padding: 30rpx;
-
- .item {
- padding: 0 20rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 130rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
- border-radius: 20rpx;
- margin-bottom: 30rpx;
-
- .iten-left {
- align-items: center;
- font-size: 30rpx;
-
- text {
- margin-left: 20rpx;
- font-size: 32rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #333333;
- }
- }
-
- .choose-item {
- width: 44rpx;
- height: 44rpx;
- background: #FFFFFF;
- border: 2rpx solid #00B38B;
- border-radius: 50%;
- margin-right: 20rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- box-sizing: content-box;
- }
-
- .active {
- width: 34rpx;
- height: 34rpx;
- background: #00B38B;
- border-radius: 50%;
- }
- }
- }
- </style>
|