integral.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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. this.getInfo()
  79. console.log(this.$store.getters.userInfo)
  80. },
  81. methods:{
  82. //用户信息
  83. getInfo(){
  84. this.$api.my.userInfo().then(res=>{
  85. this.$store.dispatch('user/info', res.data)
  86. this.userIntegral=this.$store.getters.userInfo.integral
  87. })
  88. },
  89. // 获取积分产品列表
  90. getProductList(){
  91. this.$api.product.getProducts({
  92. page:0,
  93. type:2,
  94. }).then(res=>{
  95. console.log(res,"积分产品")
  96. if(res.code==0){
  97. this.integralList=res.data.data
  98. this.shortLong()
  99. }
  100. })
  101. },
  102. shortLong() {
  103. this.integralList.forEach((item, index, arr) => {
  104. if (index % 4 === 0) {
  105. item.short = true
  106. }
  107. if (index % 4 === 1) {
  108. item.long = true
  109. }
  110. if (index % 4 === 2) {
  111. item.long = true
  112. item.marginTop = -68 + "rpx"
  113. }
  114. if (index % 4 === 3) {
  115. item.short = true
  116. }
  117. })
  118. },
  119. // 跳转积分规则
  120. gointegralRule(){
  121. uni.navigateTo({
  122. url:'/pages/my/integral/integralRule'
  123. })
  124. },
  125. // 跳转积分记录
  126. gointegralRecord(){
  127. uni.navigateTo({
  128. url:'/pages/my/integral/integralRecord'
  129. })
  130. },
  131. // 跳转积分产品详情
  132. goIntegralDetail(id){
  133. uni.navigateTo({
  134. url:`/pages/goods/goods-detail/index?id=${id}&type=2`
  135. })
  136. },
  137. // 跳转订单记录
  138. goMyorder(){
  139. uni.navigateTo({
  140. url:'/pages/my/myorders/orders'
  141. })
  142. },
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped>
  147. $pageColor:#F9F9F9;
  148. $bgColor:#FFFFFF;
  149. // flex布局居中对齐
  150. @mixin flexlayout {
  151. display: flex;
  152. align-items: center;
  153. justify-content: center;
  154. }
  155. .integral{
  156. height: 100%;
  157. background:$bgColor ;
  158. }
  159. .home-bottom {
  160. background-color: #FFF;
  161. padding-bottom: 84rpx;
  162. }
  163. .nav{
  164. width: 100%;
  165. height: 238rpx;
  166. position: fixed;
  167. z-index: 100;
  168. background-color: #F9F9F9;
  169. .PointsColumn{
  170. position: absolute;
  171. width: 690rpx;
  172. border-radius: 8rpx;
  173. height: 74rpx;
  174. background: #FFFFFF;
  175. border-radius: $bgColor;
  176. left:30rpx;
  177. top:32rpx;
  178. display: flex;
  179. align-items: center;
  180. image{
  181. margin-left: 30rpx;
  182. width: 46rpx;
  183. height: 46rpx;
  184. }
  185. text{
  186. margin-left: 16rpx;
  187. font-size: 48rpx;
  188. font-family: DINAlternate-Bold, DINAlternate;
  189. font-weight: 500;
  190. color: #333333;
  191. }
  192. }
  193. .titletext{
  194. position: absolute;
  195. bottom:30rpx;
  196. left: 30rpx;
  197. width: 690rpx;
  198. height: 74rpx;
  199. display: flex;
  200. align-items: center;
  201. justify-content: space-between;
  202. .textitem{
  203. display: flex;
  204. align-items: center;
  205. image{
  206. width: 44rpx;
  207. height: 44rpx;
  208. }
  209. text{
  210. margin-left: 8rpx;
  211. font-size: 30rpx;
  212. font-family: PingFang-SC-Bold, PingFang-SC;
  213. font-weight: bold;
  214. color: $bgColor;
  215. }
  216. }
  217. }
  218. }
  219. .shopList{
  220. padding-top: 24rpx;
  221. width: 100%;
  222. background: $bgColor;
  223. border-radius: 16rpx 16rpx 0px 0px;
  224. padding: 0 30rpx;
  225. box-sizing: border-box;
  226. padding-top: 32rpx;
  227. .listTop{
  228. @include flexlayout;
  229. margin-bottom: 40rpx;
  230. text{
  231. font-size: 36rpx;
  232. font-family: PingFang-SC-Bold, PingFang-SC;
  233. font-weight: bold;
  234. color: #333333;
  235. }
  236. }
  237. .ListContent{
  238. .home-hotel-img-content {
  239. display: flex;
  240. align-items: flex-start;
  241. justify-content: space-between;
  242. flex-wrap: wrap;
  243. .home-hotel-img-content-item {
  244. width: 332rpx;
  245. background: #FFFFFF;
  246. box-shadow: 0px 4rpx 8rpx 0px rgba(0, 0, 0, 0.04);
  247. border-radius: 12rpx;
  248. margin-bottom: 26rpx;
  249. overflow: hidden;
  250. .home-hotel-img-content-item-img {
  251. width: 332rpx;
  252. height: 332rpx;
  253. object-fit: cover;
  254. object-position: center;
  255. }
  256. .home-hotel-img-content-item-img-long {
  257. width: 332rpx;
  258. height: 400rpx;
  259. object-fit: cover;
  260. object-position: center;
  261. }
  262. .text {
  263. display: flex;
  264. flex-direction: column;
  265. align-items: flex-start;
  266. justify-content: center;
  267. padding: 18rpx 22rpx 32rpx;
  268. .text-top {
  269. font-size: 28rpx;
  270. font-weight: bold;
  271. color: #333;
  272. }
  273. .text-main {
  274. margin-top: 20rpx;
  275. font-size: 24rpx;
  276. color: #999999;
  277. }
  278. }
  279. }
  280. }
  281. }
  282. // display: flex;
  283. // flex-wrap: wrap;
  284. // .contentItemShort{
  285. // width: 332rpx;
  286. // background: $bgColor;
  287. // box-sizing: border-box;
  288. // box-shadow: 0px 4rpx 8rpx 0px rgba(0,0,0,0.04);
  289. // border-radius: 12rpx;
  290. // display: inline-block;
  291. // margin-bottom: 24rpx;
  292. // image{
  293. // width: 332rpx;
  294. // height: 332rpx;
  295. // }
  296. // .itemName{
  297. // margin:0 18rpx 20rpx 22rpx ;
  298. // font-size: 28rpx;
  299. // font-family: PingFang-SC-Bold, PingFang-SC;
  300. // font-weight: bold;
  301. // color: #333333;
  302. // overflow: hidden;
  303. // }
  304. // .itemPrice{
  305. // margin-left: 22rpx;
  306. // font-size: 28rpx;
  307. // font-family: PingFang-SC-Bold, PingFang-SC;
  308. // font-weight: bold;
  309. // color: #FF6200;
  310. // }
  311. // }
  312. // .contentItemLong{
  313. // width: 332rpx;
  314. // background: $bgColor;
  315. // box-sizing: border-box;
  316. // box-shadow: 0px 4rpx 8rpx 0px rgba(0,0,0,0.04);
  317. // border-radius: 12rpx;
  318. // margin-bottom: 24rpx;
  319. // display: inline-block;
  320. // clear: both;
  321. // image{
  322. // width: 332rpx;
  323. // height: 400rpx;
  324. // }
  325. // .itemName{
  326. // margin:0 18rpx 20rpx 22rpx ;
  327. // font-size: 28rpx;
  328. // font-family: PingFang-SC-Bold, PingFang-SC;
  329. // font-weight: bold;
  330. // color: #333333;
  331. // overflow: hidden;
  332. // }
  333. // .itemPrice{
  334. // margin-left: 22rpx;
  335. // font-size: 28rpx;
  336. // font-family: PingFang-SC-Bold, PingFang-SC;
  337. // font-weight: bold;
  338. // color: #FF6200;
  339. // }
  340. // }
  341. // .contentItem:nth-child(odd){
  342. // margin-right: 26rpx;
  343. // }
  344. // }
  345. }
  346. </style>