推广小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
6.1 KiB

2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
2 months ago
  1. <template>
  2. <view class="invoiceIssuance">
  3. <view class="head-box"></view>
  4. <Navbar title="我的收藏" :autoBack="true" :bgColor="bgColor" leftIconSize="18px" height="100rpx"
  5. :leftIconColor="leftIconColor" :titleStyle="{color:fontColor}" />
  6. <view class="content contentPosition_">
  7. <uv-sticky offsetTop="220rpx" :bgColor="bgColor">
  8. <uv-tabs :scrollable="false" @click="tabs" :list="tabList" lineWidth="40" :current="tabCurrent"
  9. :lineColor="`url(${lineBg}) 100% 100%`"
  10. :activeStyle="{color: '#FD5C5C', fontWeight: 'bold',transform: 'scale(1.05)'}"
  11. :inactiveStyle="{color: '#999', transform: 'scale(1)'}"
  12. itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;"></uv-tabs>
  13. </uv-sticky>
  14. <view class="info cardStyle_"
  15. @click="toDetail(item)"
  16. v-for="(item, index) in cardListData" :key="index">
  17. <view class="left">
  18. <image :src="
  19. item[typeKey[item.type]].image &&
  20. item[typeKey[item.type]].image.split(',')[0]" alt="">
  21. </view>
  22. <view class="right">
  23. <view class="detailed">
  24. <view class="title">{{item[typeKey[item.type]].title}}</view>
  25. <view class="date">{{item[typeKey[item.type]].startTime}}</view>
  26. <view class="address">{{item[typeKey[item.type]].address}}</view>
  27. </view>
  28. <view class="data">
  29. <view>{{item[typeKey[item.type]].num}}/{{item[typeKey[item.type]].sum}}</view>
  30. <view class="btn-box" v-if="item[typeKey[item.type]].state == 0">立即报名</view>
  31. <view class="btn-box btn-box2" v-if="item[typeKey[item.type]].state == 1">已结束</view>
  32. </view>
  33. </view>
  34. <i class="icon" @click.stop="collect(item)"></i>
  35. </view>
  36. <uv-load-more :status="status" fontSize="24rpx" dashed line />
  37. <!-- <view class="info cardStyle_">
  38. <view class="left">
  39. <image src="https://img0.baidu.com/it/u=4274003247,920124130&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1031" alt="">
  40. </view>
  41. <view class="right">
  42. <view class="detailed">
  43. <view class="title">夏日去撒野旅游计划</view>
  44. <view class="date">2024.10.28 10:00</view>
  45. <view class="address">成都市东丽湖露营地32号</view>
  46. </view>
  47. <view class="data">
  48. <view>12/30</view>
  49. <button class="mini-btn" size="mini" @click="toDetail(item)">立即报名</button>
  50. </view>
  51. </view>
  52. <i class="icon"></i>
  53. </view> -->
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import Navbar from '@/pages/components/Navbar.vue'
  59. import {
  60. globalMixin
  61. } from '../pages/mixins/globalMixin';
  62. export default {
  63. mixins: [globalMixin],
  64. components: {
  65. Navbar
  66. },
  67. computed: {
  68. customStyle1() {
  69. return {
  70. height: '30rpx',
  71. color: '#FF4546',
  72. }
  73. }
  74. },
  75. data() {
  76. return {
  77. lineBg: require('@/static/image/cart/tabIcon.png'),
  78. status:"loading",
  79. tabCurrent:0,
  80. params: {
  81. pageNo: 1,
  82. pageSize: 10,
  83. type:0,
  84. },
  85. totalPage: '',
  86. cardListData: [],
  87. tabList: [
  88. {
  89. id: 0,
  90. name: '活动'
  91. },
  92. {
  93. id: 1,
  94. name: '旅行'
  95. },
  96. ],
  97. typeKey : ['activityObject', 'travelObject'],
  98. }
  99. },
  100. onReachBottom() {
  101. if (this.params.pageNo >= this.totalPage) return
  102. this.params.pageNo++
  103. this.collectPageList()
  104. },
  105. onLoad() {
  106. this.collectPageList()
  107. },
  108. onPullDownRefresh() {
  109. this.params.pageNo = 1
  110. this.cardListData = []
  111. this.collectPageList()
  112. },
  113. methods: {
  114. tabs(e) {
  115. this.tabCurrent = e.index
  116. this.cardListData = []
  117. this.params.pageNo = 1
  118. this.collectPageList()
  119. },
  120. collectPageList() {
  121. this.params.type = this.tabCurrent
  122. this.$api('collectPageList', this.params, res => {
  123. uni.stopPullDownRefresh()
  124. if (res.code == 200) {
  125. this.totalPage = res.result.pages
  126. this.cardListData = [...this.cardListData, ...res.result.records]
  127. if(this.params.pageNo >= this.totalPage) {
  128. this.status = "nomore"
  129. }else {
  130. this.status = "loadmore"
  131. }
  132. }
  133. })
  134. },
  135. toDetail(item) {
  136. if(item.type == 0) {//活动
  137. uni.navigateTo({
  138. url: `/pages_order/huodong-detail?activityId=${item.activityObject.id}`
  139. })
  140. }else{//旅行
  141. uni.navigateTo({
  142. url: `/pages_order/lvyou-detail?travelId=${item.travelObject.id}`
  143. })
  144. }
  145. },
  146. collect(item){
  147. uni.showModal({
  148. title: '确认取消收藏吗?',
  149. success : res => {
  150. if(!res.confirm) return
  151. this.$api('collect', {
  152. id : item[this.typeKey[item.type]].id,
  153. type : item.type,
  154. }, res => {
  155. if(res.code == 200){
  156. this.cardListData = []
  157. this.params.pageNo = 1
  158. this.collectPageList()
  159. uni.showToast({
  160. title: res.message,
  161. icon: 'none'
  162. })
  163. }
  164. })
  165. }
  166. })
  167. },
  168. }
  169. }
  170. </script>
  171. <style scoped lang="scss">
  172. .invoiceIssuance {
  173. .content {
  174. .info {
  175. position: relative;
  176. margin: 10rpx 32rpx 36rpx;
  177. border-radius: 26rpx;
  178. .icon {
  179. position: absolute;
  180. right: 0;
  181. top: 0;
  182. display: block;
  183. width: 66rpx;
  184. height: 56rpx;
  185. background: red;
  186. background: url('@/static/image/icon.png') no-repeat;
  187. background-size: 100% 100%;
  188. }
  189. .right {
  190. .data {
  191. display: flex;
  192. justify-content: space-between;
  193. align-items: center;
  194. .mini-btn {
  195. display: flex;
  196. align-items: center;
  197. margin: 0;
  198. background: linear-gradient(to right, #FE5E5E, #E41522);
  199. height: 45rpx;
  200. width: 181rpx;
  201. color: #fff;
  202. border-radius: 60rpx;
  203. padding-bottom: 10rpx;
  204. }
  205. .btn-box {
  206. width: 180rpx;
  207. height: 54rpx;
  208. background: url('@/static/image/member/btn-2.png') no-repeat;
  209. background-size: 100% 100%;
  210. font-weight: 500;
  211. font-size: 23rpx;
  212. color: #FFFFFF;
  213. text-align: center;
  214. line-height: 54rpx;
  215. }
  216. .btn-box2 {
  217. background: #34312E;
  218. color: #AFAFAF;
  219. border-radius: 60rpx;
  220. }
  221. }
  222. }
  223. }
  224. }
  225. }
  226. </style>