推广小程序前端代码
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.

234 lines
8.8 KiB

6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
  1. <template>
  2. <view class="invoiceIssuance">
  3. <view class="head-box"></view>
  4. <Navbar :title="$t('pages_my.collection.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_" @click="toDetail(item)" v-for="(item, index) in cardListData" :key="index">
  15. <view class="left">
  16. <image :src="item[typeKey[item.type]].image &&
  17. item[typeKey[item.type]].image.split(',')[0]" alt="" />
  18. </view>
  19. <view class="right">
  20. <view class="detailed">
  21. <!-- <view class="title">{{ item[typeKey[item.type]].title }}</view>
  22. <view class="date">{{ item[typeKey[item.type]].startTime }}</view>
  23. <view class="address">{{ item[typeKey[item.type]].address }}</view> -->
  24. <view class="title">{{ $ot(item[typeKey[item.type]], typeKey2[item.type], 'title') }}</view>
  25. <view class="date">{{ item[typeKey[item.type]].startTime }}</view>
  26. <view class="address">{{ $ot(item[typeKey[item.type]], typeKey2[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">{{ $t('pages_my.collection.sign_up_now') }}</view><!-- 立即报名 -->
  31. <view class="btn-box btn-box2" v-if="item[typeKey[item.type]].state == 1">{{ $t('pages_my.collection.ended') }}</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: this.$t('pages_my.collection.tabs.activity') // 活动
  91. },
  92. {
  93. id: 1,
  94. name: this.$t('pages_my.collection.tabs.travel') // 旅行
  95. },
  96. ],
  97. typeKey: ['activityObject', 'travelObject'],
  98. typeKey2: ['active', 'travel'],
  99. }
  100. },
  101. onReachBottom() {
  102. if (this.params.pageNo >= this.totalPage) return
  103. this.params.pageNo++
  104. this.collectPageList()
  105. },
  106. onLoad() {
  107. this.collectPageList()
  108. },
  109. onPullDownRefresh() {
  110. this.params.pageNo = 1
  111. this.cardListData = []
  112. this.collectPageList()
  113. },
  114. methods: {
  115. tabs(e) {
  116. this.tabCurrent = e.index
  117. this.cardListData = []
  118. this.params.pageNo = 1
  119. this.collectPageList()
  120. },
  121. collectPageList() {
  122. this.params.type = this.tabCurrent
  123. this.$api('collectPageList', this.params, res => {
  124. uni.stopPullDownRefresh()
  125. if (res.code == 200) {
  126. this.totalPage = res.result.pages
  127. this.cardListData = [...this.cardListData, ...res.result.records]
  128. if (this.params.pageNo >= this.totalPage) {
  129. this.status = "nomore"
  130. } else {
  131. this.status = "loadmore"
  132. }
  133. }
  134. })
  135. },
  136. toDetail(item) {
  137. if (item.type == 0) { // 活动
  138. uni.navigateTo({
  139. url: `/pages_order/huodong-detail?activityId=${item.activityObject.id}`
  140. })
  141. } else { // 旅行
  142. uni.navigateTo({
  143. url: `/pages_order/lvyou-detail?travelId=${item.travelObject.id}`
  144. })
  145. }
  146. },
  147. collect(item) {
  148. uni.showModal({
  149. title: this.$t('pages_my.collection.confirm_cancel_collection'), // 确认取消收藏吗?
  150. success: res => {
  151. if (!res.confirm) return
  152. this.$api('collect', {
  153. id: item[this.typeKey[item.type]].id,
  154. type: item.type,
  155. }, res => {
  156. if (res.code == 200) {
  157. this.cardListData = []
  158. this.params.pageNo = 1
  159. this.collectPageList()
  160. uni.showToast({
  161. title: res.message,
  162. icon: 'none'
  163. })
  164. }
  165. })
  166. }
  167. })
  168. },
  169. }
  170. }
  171. </script>
  172. <style scoped lang="scss">
  173. .invoiceIssuance {
  174. .content {
  175. .info {
  176. position: relative;
  177. margin: 10rpx 32rpx 36rpx;
  178. border-radius: 26rpx;
  179. .icon {
  180. position: absolute;
  181. right: 0;
  182. top: 0;
  183. display: block;
  184. width: 66rpx;
  185. height: 56rpx;
  186. background: red;
  187. background: url('@/static/image/icon.png') no-repeat;
  188. background-size: 100% 100%;
  189. }
  190. .right {
  191. .data {
  192. display: flex;
  193. justify-content: space-between;
  194. align-items: center;
  195. .mini-btn {
  196. display: flex;
  197. align-items: center;
  198. margin: 0;
  199. background: linear-gradient(to right, #FE5E5E, #E41522);
  200. height: 45rpx;
  201. width: 181rpx;
  202. color: #fff;
  203. border-radius: 60rpx;
  204. padding-bottom: 10rpx;
  205. }
  206. .btn-box {
  207. width: 180rpx;
  208. height: 54rpx;
  209. background: url('@/static/image/member/btn-2.png') no-repeat;
  210. background-size: 100% 100%;
  211. font-weight: 500;
  212. font-size: 23rpx;
  213. color: #FFFFFF;
  214. text-align: center;
  215. line-height: 54rpx;
  216. }
  217. .btn-box2 {
  218. background: #34312E;
  219. color: #AFAFAF;
  220. border-radius: 60rpx;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. }
  227. </style>