integral.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <view class="box">
  3. <view class="topBox">
  4. <view class="topCont">
  5. <view class="jfgz" @click="gorule">
  6. <view class="jfgzTxt">积分规则</view>
  7. <img src="../../static/timg/jthei.png" alt="" class="jfjt">
  8. </view>
  9. <view class="kyjf">
  10. <view class="kyjfTitle">可用积分</view>
  11. <view class="kyjfCont">
  12. <view class="kyjfNum">{{avaIntegral?avaIntegral:0}}</view>
  13. <!-- <view class="kyjfDq">333积分即将过期</view> -->
  14. </view>
  15. </view>
  16. </view>
  17. <view class="topBottom">
  18. <view class="topBottomLine" @click="goscoreRecord">
  19. <view><img src="../../static/timg/jfjl.png" alt="" class="topBottomLineImg"></view>
  20. <view class="topBottomLineTxt">积分记录</view>
  21. </view>
  22. <view class="topBottomSx"></view>
  23. <view class="topBottomLine" @click="goexchangeRecord">
  24. <view><img src="../../static/timg/dhjl.png" alt="" class="topBottomLineImg"></view>
  25. <view class="topBottomLineTxt">兑换记录</view>
  26. </view>
  27. </view>
  28. </view>
  29. <!-- 热门兑换 -->
  30. <view class="exchangeBox" v-if="hotlist.length>0">
  31. <view class="exchangeTitleBox">
  32. <view class="exchangeTitle">热门兑换</view>
  33. <img src="../../static/timg/renhuo.png" alt="" class="rehuoimg">
  34. </view>
  35. <view class="exchangeCont">
  36. <scroll-view scroll-x="true" class="scroll-viewX">
  37. <!-- <view class="exchange"> -->
  38. <view class="exchangeLine" v-for="(item,index) in hotlist" @click="goDetail(item.id)">
  39. <img class="exchangeLineImg" v-if="item.img" :src="item.img" alt="">
  40. <image v-else src="../../static/timg/noimg.png" mode="" class="exchangeLineImg"></image>
  41. <view class="exchangeName">{{item.name}}</view>
  42. <view> <span class="jfspan1">{{item.integral}}</span> <span class="jfspan2">积分</span></view>
  43. </view>
  44. <view style="width: 20rpx;"></view>
  45. <!-- </view> -->
  46. </scroll-view>
  47. </view>
  48. </view>
  49. <!-- 商品列表 -->
  50. <view class="goodsBox">
  51. <scroll-view scroll-x="true" class="scroll-X" >
  52. <view class="classificationBox">
  53. <view class="classification" v-for="(item,index) in categoryList" @click="topClick(index,item)">
  54. <view class="classificationName" :class="{classificationNameActive:topIndex==index}">{{item.Name}}</view>
  55. <view class="classificationHx" v-if="topIndex==index"></view>
  56. </view>
  57. </view>
  58. </scroll-view>
  59. <view class="goodsLineBOx">
  60. <view class="exchangeLine2" v-for="(item,index) in list" @click="goDetail(item.ID)">
  61. <img class="exchangeLineImg2" :src="item.url" alt="" v-if="item.url">
  62. <image v-else src="../../static/timg/noimg.png" mode="" class="exchangeLineImg2"></image>
  63. <view class="exchangeName2">{{item.Name}}</view>
  64. <view> <span class="jfspan1">{{item.Integral}}</span> <span class="jfspan2">积分</span></view>
  65. </view>
  66. </view>
  67. <nodata v-if="list.length==0"></nodata>
  68. </view>
  69. <img src="../../static/timg/btn_top@2x.png" alt="" class="btn_top" @click="btnTop">
  70. </view>
  71. </template>
  72. <script>
  73. import nodata from '../../components/nodata/nodata.vue'
  74. export default {
  75. components: {
  76. nodata,
  77. },
  78. data() {
  79. return {
  80. page:1,
  81. topIndex:0,
  82. totalIntegral:'',
  83. hotlist:'',
  84. categoryList:'',
  85. list:[],
  86. categoryID:'',
  87. avaIntegral:'',
  88. }
  89. },
  90. onLoad(opt) {
  91. this.totalIntegral=opt.totalIntegral;
  92. this.getintegralInfo()
  93. this.gethotExchange();
  94. this.getcategoryList();
  95. this.getintegralGoodsPage();
  96. },
  97. methods: {
  98. btnTop(){
  99. //滚动回到顶部
  100. uni.pageScrollTo({
  101. scrollTop: 0,
  102. });
  103. },
  104. gorule(){
  105. uni.navigateTo({
  106. url:'rule'
  107. })
  108. },
  109. getintegralInfo(){
  110. this.$http('openIntegralMall/integralInfo', {
  111. }, 'GET').then(res => {
  112. this.avaIntegral=res.data.avaIntegral
  113. })
  114. },
  115. gethotExchange(){
  116. uni.showLoading({
  117. title: '加载中'
  118. })
  119. this.$http('openIntegralMall/hotExchange', {
  120. }, 'GET').then(res => {
  121. uni.hideLoading();
  122. this.hotlist=res.data;
  123. })
  124. },
  125. getcategoryList(){
  126. this.$http('openIntegralMall/categoryList', {
  127. }, 'GET').then(res => {
  128. this.categoryList=res.data;
  129. var obj={
  130. Id:'',
  131. Name:'全部'
  132. }
  133. this.categoryList.unshift(obj);
  134. })
  135. },
  136. getintegralGoodsPage(){
  137. uni.showLoading({
  138. title: '加载中'
  139. })
  140. this.$http('openIntegralMall/integralGoodsPage', {
  141. categoryID:this.categoryID,
  142. page:this.page,
  143. limit:10
  144. }, 'GET').then(res => {
  145. uni.hideLoading();
  146. var list=res.data.Items;
  147. this.list=this.list.concat(list)
  148. })
  149. },
  150. topClick(index,item){
  151. this.topIndex=index;
  152. this.categoryID=item.ID;
  153. if(item.ID==undefined){
  154. this.categoryID=''
  155. }
  156. this.list=[];
  157. this.page=1;
  158. this.getintegralGoodsPage();
  159. },
  160. goDetail(id){
  161. uni.navigateTo({
  162. url:'integralgoodsDetail?id='+id+'&avaIntegral='+this.avaIntegral
  163. })
  164. },
  165. goscoreRecord(){
  166. uni.navigateTo({
  167. url:'scoreRecord?avaIntegral='+this.avaIntegral
  168. })
  169. },
  170. goexchangeRecord(){
  171. uni.navigateTo({
  172. url:'exchangeRecord'
  173. })
  174. }
  175. },
  176. onReachBottom(){
  177. this.page++;
  178. this.getintegralGoodsPage();
  179. },
  180. onPullDownRefresh(){
  181. this.list=[];
  182. this.page=1;
  183. this.getintegralInfo();
  184. this.gethotExchange();
  185. this.getcategoryList();
  186. this.getintegralGoodsPage();
  187. setTimeout(() => {
  188. uni.stopPullDownRefresh(); // 关闭下拉刷新
  189. }, 2000);
  190. }
  191. }
  192. </script>
  193. <style scoped>
  194. .btn_top{
  195. width: 100rpx;
  196. height: 100rpx;
  197. position: fixed;
  198. right: 24rpx;
  199. bottom: 60rpx;
  200. }
  201. .scroll-X{
  202. width: 750rpx;
  203. }
  204. .goodsLineBOx{
  205. display: flex;
  206. flex-wrap: wrap;
  207. justify-content: space-between;
  208. padding: 0 24rpx;
  209. padding-bottom: env(safe-area-inset-bottom);
  210. }
  211. .exchangeLineImg2{
  212. width: 341rpx;
  213. height: 318rpx;
  214. border-bottom: 1px solid #eee;
  215. display: block;
  216. }
  217. .exchangeName2{
  218. font-weight: 400;
  219. color: #333333;
  220. font-size: 28rpx;
  221. padding-top: 16rpx;
  222. padding-left: 20rpx;
  223. width: 300rpx;
  224. overflow: hidden; /*超出隐藏*/
  225. text-overflow: ellipsis;/*隐藏后添加省略号*/
  226. white-space: nowrap;/*强制不换行*/
  227. padding-bottom:6rpx;
  228. }
  229. .exchangeLine2{
  230. /* margin-left: 24rpx; */
  231. margin-top: 30rpx;
  232. height: 439rpx;
  233. border-radius: 16rpx;
  234. border: 1px solid #EEEEEE;
  235. overflow: hidden;
  236. }
  237. .classificationBox{
  238. display: flex;
  239. padding-bottom: 12rpx;
  240. border-bottom: 1px solid #EEEEEE;
  241. }
  242. .classificationName{
  243. white-space: nowrap;
  244. font-size: 28rpx;
  245. color: #3C3C3C;
  246. line-height: 40rpx;
  247. padding:24rpx 24rpx 8rpx 24rpx;
  248. font-weight: 400;
  249. max-width:170rpx;
  250. overflow: hidden; /*超出隐藏*/
  251. text-overflow: ellipsis;/*隐藏后添加省略号*/
  252. white-space: nowrap;/*强制不换行*/
  253. }
  254. .classificationNameActive{
  255. font-weight: 500 !important;
  256. color: #FF0000 ;
  257. }
  258. .classificationHx{
  259. width: 40rpx;
  260. height: 4rpx;
  261. background: #FF0000;
  262. margin: 0 auto;
  263. }
  264. .exchangeBox{
  265. background: #FFFFFF;margin-top: 20rpx;
  266. }
  267. .goodsBox{
  268. background: #FFFFFF;margin-top: 20rpx;
  269. }
  270. .exchangeName{
  271. font-weight: 400;
  272. color: #333333;
  273. font-size: 28rpx;
  274. padding-top: 16rpx;
  275. padding-left: 20rpx;
  276. width: 240rpx;
  277. word-wrap: break-word; /*强制换行*/
  278. overflow: hidden; /*超出隐藏*/
  279. text-overflow: ellipsis;/*隐藏后添加省略号*/
  280. white-space: nowrap;/*强制不换行*/
  281. padding-bottom:6rpx;
  282. }
  283. .jfspan1{
  284. font-weight: 500;
  285. color: #FF0000;
  286. font-size:32rpx;
  287. line-height: 45rpx;
  288. padding-left: 20rpx;
  289. }
  290. .jfspan2{
  291. font-weight: 400;
  292. color: #FF0000;
  293. font-size:24rpx;
  294. line-height: 45rpx;
  295. padding-left: 10rpx;
  296. }
  297. .exchange{
  298. display: flex;
  299. flex-wrap: nowrap;
  300. background: #FFFFFF;
  301. padding-bottom: 30rpx;
  302. }
  303. .exchangeLine{
  304. margin-left: 24rpx;
  305. margin-top: 10rpx;
  306. height: 375rpx;
  307. border-radius: 16rpx;
  308. border: 1px solid #EEEEEE;
  309. overflow: hidden;
  310. width: 270rpx;
  311. display: inline-block;
  312. }
  313. .exchangeLineImg{
  314. width: 270rpx;
  315. height: 252rpx;
  316. border-bottom: 1px solid #eee;
  317. display: block;
  318. }
  319. .rehuoimg{
  320. width: 26rpx;
  321. height: 34rpx;
  322. }
  323. .exchangeTitle{
  324. font-weight: 500;
  325. color: #333333;
  326. font-size: 30rpx;
  327. line-height: 34rpx;
  328. padding-right: 16rpx;
  329. }
  330. .exchangeTitleBox{
  331. padding: 20rpx 24rpx;display: flex;
  332. }
  333. .box{
  334. background: #F4F5F7;
  335. min-height: 100vh;
  336. }
  337. .jfjt{
  338. width: 24rpx;height: 24rpx;margin-top: 12rpx;
  339. }
  340. .jfgz{
  341. display: flex;
  342. width: 150rpx;
  343. height: 48rpx;
  344. background: rgba(255,229,211,0.3);
  345. border-radius: 0px 2rpx 0px 26rpx;
  346. font-size: 24rpx;
  347. line-height: 48rpx;
  348. color: #573400;
  349. position: absolute;
  350. top: 0;
  351. right: 0;
  352. }
  353. .jfgzTxt{
  354. padding-left: 18rpx;
  355. }
  356. .topBox{
  357. width: 100%;
  358. height: 410rpx;
  359. background:#38394E;
  360. padding-top: 30rpx;
  361. position: relative;
  362. }
  363. .topCont{
  364. width: 702rpx;
  365. height: 200rpx;
  366. background: url('http://dmsphoto.66km.com.cn/thFiles/DCCDB197-4F64-4711-89C0-E5034B2F1788.png') no-repeat;
  367. background-size: 100% 100%;
  368. margin-left: 24rpx;
  369. position: relative;
  370. border-radius: 20rpx;
  371. overflow: hidden;
  372. }
  373. .topBottom{
  374. width: 750rpx;
  375. height: 180rpx;
  376. background: #FFFFFF;
  377. border-radius: 26rpx 26rpx 0px 0px;
  378. position: absolute;
  379. left: 0;
  380. bottom: 0;
  381. display: flex;
  382. justify-content: space-around;
  383. }
  384. .kyjf{
  385. padding-top: 46rpx;
  386. padding-left: 40rpx;
  387. }
  388. .kyjfTitle{
  389. color: #523509;font-size: 28rpx;
  390. }
  391. .kyjfNum{
  392. font-size: 60rpx;
  393. font-family: PingFangSC-Medium, PingFang SC;
  394. font-weight: 500;
  395. color: #523509;
  396. line-height: 84rpx;
  397. }
  398. .kyjfDq{
  399. width: 224rpx;
  400. height: 44rpx;
  401. background: linear-gradient(135deg, #FFC81B 0%, #FFA800 100%);
  402. border-radius: 22rpx 22rpx 22rpx 0px;
  403. text-align: center;
  404. color: #573400;
  405. line-height: 44rpx;
  406. font-size: 24rpx;
  407. margin-left:10rpx ;
  408. margin-top: 22rpx;
  409. }
  410. .kyjfCont{
  411. display: flex;
  412. }
  413. .topBottomLineImg{
  414. width: 54rpx;height: 54rpx;
  415. }
  416. .topBottomLineTxt{
  417. color: #333333;font-size: 24rpx;ppadding-top: 14rpx;
  418. }
  419. .topBottomSx{
  420. width: 1px;
  421. height: 94rpx;
  422. background-color:#EEEEEE;
  423. margin-top:42rpx;
  424. }
  425. .topBottomLine{
  426. text-align: center;padding-top: 40rpx;
  427. }
  428. .scroll-viewX{
  429. white-space: nowrap;
  430. width: 100%;
  431. padding-bottom: 20rpx;
  432. }
  433. </style>