123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <view class="content">
- <view class="item" v-for="(item,index) in state.list" :key='index'>
- <!-- <view class="item"> -->
- <view class="title">
- <view>
- <text><text>{{item.productName}}</text> <text>¥{{item.discountPrice * 0.01}}</text></text>
- </view>
- <text class="add" @click="add()">加购</text>
- </view>
- </view>
- </view>
- </template>
-
- <script setup lang="ts">
- import { onLoad } from "@dcloudio/uni-app";
- import { reactive } from "vue";
- import { equityProductsApi, addEquityListApi } from "@/utils/network/api.js";
- import { stringToJson } from "@/utils/network/encryption";
- import { request } from "@/utils/network/request";
- import { msg, navTo } from "@/utils/utils";
- import { getEquityListApi } from "@/utils/network/api";
- import {
- getItem,
- StorageKeys,
- setItem
- } from "@/utils/storage";
-
- const state = reactive({
- list: [], //权益数据
- })
-
- onLoad((option : any) => {
- // 获取全部权益列表
- getList();
-
- console.log("option", option)
- })
- const getList = () => {
- const options = {
- type: 2,
- data: {
- "pageNo": 10,
- "pageSize": 1,
- },
- method: 'POST',
- showLoading: true,
- }
- request(getEquityListApi, options).then((res) => {
- const data = stringToJson(res.bizContent);
- state.list = data.data
- console.log("222", data.data)
- })
- }
- const add = () => {
- navTo('/subpackage/after-sale/add-equity/choice-order', true)
-
- // const options = {
- // type: 2,
- // data: {
- // "type": 1,
- // "openId": getItem(StorageKeys.OpenId),
- // "orderId": ""
- // },
- // method: 'POST',
- // showLoading: true,
- // }
- // request(addEquityListApi, options).then((res) => {
- // const data = stringToJson(res.bizContent);
- // state.list = data.data
- // console.log("加购", data.data)
- // })
- }
- </script>
-
- <style scoped lang="scss">
- .content {
- width: 100%;
- }
-
- .item {
- width: 90%;
- margin: 20rpx auto;
- background-color: rgb(41, 199, 207);
- border-radius: 20rpx;
- padding: 20rpx;
- box-sizing: border-box;
- color: white;
- font-size: 32rpx;
-
- }
-
- .item>.title {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .add {
- background: white;
- border-radius: 10rpx;
- padding: 4rpx 6rpx;
- color: #000;
- }
- </style>
|