integral.vue 9.8 KB

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