integral.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <view class="integral">
  3. <!-- 标题栏 -->
  4. <view class="nav">
  5. <image src="http://t9.9026.com/imgs/integralbg.png" style="width: 100%; height: 100%;"></image>
  6. <view class="PointsColumn">
  7. <image src="/static/icon/integralicon.png"></image>
  8. <text>{{userIntegral}}</text>
  9. </view>
  10. <view class="titletext">
  11. <view class="textitem" @click="gointegralRecord">
  12. <image src="/static/icon/integralrecord.png"></image>
  13. <text>积分记录</text>
  14. </view>
  15. <view class="textitem" @click="goMyorder">
  16. <image src="/static/icon/lament.png"></image>
  17. <text>我的兑换</text>
  18. </view>
  19. <view class="textitem" @click="gointegralRule">
  20. <image src="/static/icon/integralrule.png"></image>
  21. <text>积分规则</text>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- 占位 -->
  26. <view style="width: 100%; height: 238rpx; "></view>
  27. <!-- 积分商品 -->
  28. <view class="shopList">
  29. <view class="listTop">
  30. <text>积分兑换</text>
  31. </view>
  32. <view class="ListContent">
  33. <!-- <view :class="item.short?'[contentItemShort,contentItem]':'[contentItemLong,contentItem]'" v-for="item in integralList" @click="goIntegralDetail(item.id)" >
  34. <image :src="item.cover_img?item.cover_img:'http://t9.9026.com/imgs/loginBg.png'" ></image>
  35. <view class="itemName">{{item.name}}</view>
  36. <view class="itemPrice">{{item.integral}}积分</view>
  37. </view> -->
  38. <view class="home-hotel-img-content">
  39. <view @click="goIntegralDetail(item.id)" class="home-hotel-img-content-item" v-for="(item,index) in integralList" :key="index"
  40. :style="{marginTop:item.marginTop || 0 }" >
  41. <image class="home-hotel-img-content-item-img"
  42. :class="item.short?'home-hotel-img-content-item-img': 'home-hotel-img-content-item-img-long' "
  43. :src="item.cover_img" mode=""></image>
  44. <view class="text">
  45. <text class="text-top">{{item.name}}</text>
  46. <text class="text-main">{{item.hotel.name}}</text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 触底 -->
  52. <view class="home-bottom">
  53. <uni-load-more :status="status" color="#CCCCCC" :content-text="contentText" />
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default{
  60. data(){
  61. return{
  62. // 用户积分
  63. userIntegral:0,
  64. // 组件uni-load-more
  65. status: 'noMore',
  66. contentText: {
  67. contentdown: '查看更多',
  68. contentrefresh: '加载中',
  69. contentnomore: '—— 已经到底啦 ——'
  70. },
  71. // 积分产品列表
  72. integralList:[],
  73. arr:[],
  74. }
  75. },
  76. onLoad() {
  77. this.getProductList()
  78. console.log(this.$store.getters.userInfo)
  79. this.userIntegral=this.$store.getters.userInfo.integral
  80. },
  81. methods:{
  82. // 获取积分产品列表
  83. getProductList(){
  84. this.$api.product.getProducts({
  85. page:0,
  86. type:2,
  87. }).then(res=>{
  88. console.log(res,"积分产品")
  89. if(res.code==0){
  90. this.integralList=res.data.data
  91. this.shortLong()
  92. }
  93. })
  94. },
  95. shortLong() {
  96. this.integralList.forEach((item, index, arr) => {
  97. if (index % 4 === 0) {
  98. item.short = true
  99. }
  100. if (index % 4 === 1) {
  101. item.long = true
  102. }
  103. if (index % 4 === 2) {
  104. item.long = true
  105. item.marginTop = -68 + "rpx"
  106. }
  107. if (index % 4 === 3) {
  108. item.short = true
  109. }
  110. })
  111. console.log(this.goodsList);
  112. },
  113. // 跳转积分规则
  114. gointegralRule(){
  115. uni.navigateTo({
  116. url:'/pages/my/integral/integralRule'
  117. })
  118. },
  119. // 跳转积分记录
  120. gointegralRecord(){
  121. uni.navigateTo({
  122. url:'/pages/my/integral/integralRecord'
  123. })
  124. },
  125. // 跳转积分产品详情
  126. goIntegralDetail(id){
  127. uni.navigateTo({
  128. url:`/pages/goods/goods-detail/index?id=${id}&type=2`
  129. })
  130. },
  131. // 跳转订单记录
  132. goMyorder(){
  133. uni.navigateTo({
  134. url:'/pages/my/myorders/orders'
  135. })
  136. },
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. $pageColor:#F9F9F9;
  142. $bgColor:#FFFFFF;
  143. // flex布局居中对齐
  144. @mixin flexlayout {
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. }
  149. .integral{
  150. height: 100%;
  151. background:$bgColor ;
  152. }
  153. .home-bottom {
  154. background-color: #FFF;
  155. padding-bottom: 84rpx;
  156. }
  157. .nav{
  158. width: 100%;
  159. height: 238rpx;
  160. position: fixed;
  161. z-index: 100;
  162. background-color: #F9F9F9;
  163. .PointsColumn{
  164. position: absolute;
  165. width: 690rpx;
  166. border-radius: 8rpx;
  167. height: 74rpx;
  168. background: #FFFFFF;
  169. border-radius: $bgColor;
  170. left:30rpx;
  171. top:32rpx;
  172. display: flex;
  173. align-items: center;
  174. image{
  175. margin-left: 30rpx;
  176. width: 46rpx;
  177. height: 46rpx;
  178. }
  179. text{
  180. margin-left: 16rpx;
  181. font-size: 48rpx;
  182. font-family: DINAlternate-Bold, DINAlternate;
  183. font-weight: 500;
  184. color: #333333;
  185. }
  186. }
  187. .titletext{
  188. position: absolute;
  189. bottom:30rpx;
  190. left: 30rpx;
  191. width: 690rpx;
  192. height: 74rpx;
  193. display: flex;
  194. align-items: center;
  195. justify-content: space-between;
  196. .textitem{
  197. display: flex;
  198. align-items: center;
  199. image{
  200. width: 44rpx;
  201. height: 44rpx;
  202. }
  203. text{
  204. margin-left: 8rpx;
  205. font-size: 30rpx;
  206. font-family: PingFang-SC-Bold, PingFang-SC;
  207. font-weight: bold;
  208. color: $bgColor;
  209. }
  210. }
  211. }
  212. }
  213. .shopList{
  214. padding-top: 24rpx;
  215. width: 100%;
  216. background: $bgColor;
  217. border-radius: 16rpx 16rpx 0px 0px;
  218. padding: 0 30rpx;
  219. box-sizing: border-box;
  220. padding-top: 32rpx;
  221. .listTop{
  222. @include flexlayout;
  223. margin-bottom: 40rpx;
  224. text{
  225. font-size: 36rpx;
  226. font-family: PingFang-SC-Bold, PingFang-SC;
  227. font-weight: bold;
  228. color: #333333;
  229. }
  230. }
  231. .ListContent{
  232. .home-hotel-img-content {
  233. display: flex;
  234. align-items: flex-start;
  235. justify-content: space-between;
  236. flex-wrap: wrap;
  237. .home-hotel-img-content-item {
  238. width: 332rpx;
  239. background: #FFFFFF;
  240. box-shadow: 0px 4rpx 8rpx 0px rgba(0, 0, 0, 0.04);
  241. border-radius: 12rpx;
  242. margin-bottom: 26rpx;
  243. .home-hotel-img-content-item-img {
  244. width: 332rpx;
  245. height: 332rpx;
  246. object-fit: cover;
  247. object-position: center;
  248. }
  249. .home-hotel-img-content-item-img-long {
  250. width: 332rpx;
  251. height: 400rpx;
  252. object-fit: cover;
  253. object-position: center;
  254. }
  255. .text {
  256. display: flex;
  257. flex-direction: column;
  258. align-items: flex-start;
  259. justify-content: center;
  260. padding: 18rpx 22rpx 32rpx;
  261. .text-top {
  262. font-size: 28rpx;
  263. font-weight: bold;
  264. color: #333;
  265. }
  266. .text-main {
  267. margin-top: 20rpx;
  268. font-size: 24rpx;
  269. color: #999999;
  270. }
  271. }
  272. }
  273. }
  274. }
  275. // display: flex;
  276. // flex-wrap: wrap;
  277. // .contentItemShort{
  278. // width: 332rpx;
  279. // background: $bgColor;
  280. // box-sizing: border-box;
  281. // box-shadow: 0px 4rpx 8rpx 0px rgba(0,0,0,0.04);
  282. // border-radius: 12rpx;
  283. // display: inline-block;
  284. // margin-bottom: 24rpx;
  285. // image{
  286. // width: 332rpx;
  287. // height: 332rpx;
  288. // }
  289. // .itemName{
  290. // margin:0 18rpx 20rpx 22rpx ;
  291. // font-size: 28rpx;
  292. // font-family: PingFang-SC-Bold, PingFang-SC;
  293. // font-weight: bold;
  294. // color: #333333;
  295. // overflow: hidden;
  296. // }
  297. // .itemPrice{
  298. // margin-left: 22rpx;
  299. // font-size: 28rpx;
  300. // font-family: PingFang-SC-Bold, PingFang-SC;
  301. // font-weight: bold;
  302. // color: #FF6200;
  303. // }
  304. // }
  305. // .contentItemLong{
  306. // width: 332rpx;
  307. // background: $bgColor;
  308. // box-sizing: border-box;
  309. // box-shadow: 0px 4rpx 8rpx 0px rgba(0,0,0,0.04);
  310. // border-radius: 12rpx;
  311. // margin-bottom: 24rpx;
  312. // display: inline-block;
  313. // clear: both;
  314. // image{
  315. // width: 332rpx;
  316. // height: 400rpx;
  317. // }
  318. // .itemName{
  319. // margin:0 18rpx 20rpx 22rpx ;
  320. // font-size: 28rpx;
  321. // font-family: PingFang-SC-Bold, PingFang-SC;
  322. // font-weight: bold;
  323. // color: #333333;
  324. // overflow: hidden;
  325. // }
  326. // .itemPrice{
  327. // margin-left: 22rpx;
  328. // font-size: 28rpx;
  329. // font-family: PingFang-SC-Bold, PingFang-SC;
  330. // font-weight: bold;
  331. // color: #FF6200;
  332. // }
  333. // }
  334. // .contentItem:nth-child(odd){
  335. // margin-right: 26rpx;
  336. // }
  337. // }
  338. }
  339. </style>