選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

add-equity.vue 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="content">
  3. <view class="item" v-for="(item,index) in state.list" :key='index'>
  4. <!-- <view class="item"> -->
  5. <view class="title">
  6. <view>
  7. <text><text>{{item.productName}}</text>&nbsp;&nbsp;<text>¥{{item.discountPrice * 0.01}}</text></text>
  8. </view>
  9. <text class="add" @click="add()">加购</text>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script setup lang="ts">
  15. import { onLoad } from "@dcloudio/uni-app";
  16. import { reactive } from "vue";
  17. import { equityProductsApi, addEquityListApi } from "@/utils/network/api.js";
  18. import { stringToJson } from "@/utils/network/encryption";
  19. import { request } from "@/utils/network/request";
  20. import { msg, navTo } from "@/utils/utils";
  21. import { getEquityListApi } from "@/utils/network/api";
  22. import {
  23. getItem,
  24. StorageKeys,
  25. setItem
  26. } from "@/utils/storage";
  27. const state = reactive({
  28. list: [], //权益数据
  29. })
  30. onLoad((option : any) => {
  31. // 获取全部权益列表
  32. getList();
  33. console.log("option", option)
  34. })
  35. const getList = () => {
  36. const options = {
  37. type: 2,
  38. data: {
  39. "pageNo": 10,
  40. "pageSize": 1,
  41. },
  42. method: 'POST',
  43. showLoading: true,
  44. }
  45. request(getEquityListApi, options).then((res) => {
  46. const data = stringToJson(res.bizContent);
  47. state.list = data.data
  48. console.log("222", data.data)
  49. })
  50. }
  51. const add = () => {
  52. navTo('/subpackage/after-sale/add-equity/choice-order', true)
  53. // const options = {
  54. // type: 2,
  55. // data: {
  56. // "type": 1,
  57. // "openId": getItem(StorageKeys.OpenId),
  58. // "orderId": ""
  59. // },
  60. // method: 'POST',
  61. // showLoading: true,
  62. // }
  63. // request(addEquityListApi, options).then((res) => {
  64. // const data = stringToJson(res.bizContent);
  65. // state.list = data.data
  66. // console.log("加购", data.data)
  67. // })
  68. }
  69. </script>
  70. <style scoped lang="scss">
  71. .content {
  72. width: 100%;
  73. }
  74. .item {
  75. width: 90%;
  76. margin: 20rpx auto;
  77. background-color: rgb(41, 199, 207);
  78. border-radius: 20rpx;
  79. padding: 20rpx;
  80. box-sizing: border-box;
  81. color: white;
  82. font-size: 32rpx;
  83. }
  84. .item>.title {
  85. width: 100%;
  86. display: flex;
  87. justify-content: space-between;
  88. align-items: center;
  89. }
  90. .add {
  91. background: white;
  92. border-radius: 10rpx;
  93. padding: 4rpx 6rpx;
  94. color: #000;
  95. }
  96. </style>