integral.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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. <!-- 手机号授权 -->
  71. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  72. <view class="authorizCont" @click.stop="">
  73. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  74. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  75. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  76. </view>
  77. <view style="text-align: center;padding-top: 56rpx;">
  78. <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import nodata from '../../components/nodata/nodata.vue'
  85. export default {
  86. components: {
  87. nodata,
  88. },
  89. data() {
  90. return {
  91. page:1,
  92. topIndex:0,
  93. totalIntegral:'',
  94. hotlist:'',
  95. categoryList:'',
  96. list:[],
  97. categoryID:'',
  98. avaIntegral:'',
  99. authorizShow:false,
  100. userInfo:'',
  101. ext:'',
  102. wxOpenData:'',
  103. }
  104. },
  105. onLoad(opt) {
  106. this.totalIntegral=opt.totalIntegral;
  107. this.userInfo=this.$store.state.userInfo;
  108. this.ext=this.$common.getExtStoreId();
  109. if(this.userInfo){
  110. this.getintegralInfo()
  111. this.gethotExchange();
  112. this.getcategoryList();
  113. this.getintegralGoodsPage();
  114. }else{
  115. this.$common.automaticlogin().then(val => {
  116. this.userInfo=this.$store.state.userInfo;
  117. this.wxOpenData=this.$store.state.wxOpenData;
  118. if(!this.userInfo){
  119. this.authorizShow=true
  120. }
  121. this.getintegralInfo()
  122. this.gethotExchange();
  123. this.getcategoryList();
  124. this.getintegralGoodsPage();
  125. })
  126. }
  127. },
  128. methods: {
  129. authorizShowno(){
  130. this.authorizShow=false
  131. },
  132. decryptPhoneNumber: function(e) {
  133. console.log(e);
  134. this.code=e.detail.code
  135. this.wxPhoneLogin()
  136. this.authorizShow=false;
  137. },
  138. wxPhoneLogin(){
  139. var that=this;
  140. this.$http('miniApp2/sys/wxPhoneLogin', {
  141. appId:this.ext.appId,
  142. unionId:this.ext.unionId,
  143. code:this.code,
  144. openId:this.wxOpenData.openid
  145. },'POST').then(res => {
  146. var data = res.data;
  147. if(data.loginInfo){
  148. this.userInfo=data.loginInfo.openUser;
  149. this.wxOpenData=data.loginInfo;
  150. this.$store.commit('mutationswxOpenData', data)
  151. this.$store.commit('mutationsuserInfo', this.userInfo)
  152. this.myOrderCoupon()
  153. }
  154. })
  155. },
  156. btnTop(){
  157. //滚动回到顶部
  158. uni.pageScrollTo({
  159. scrollTop: 0,
  160. });
  161. },
  162. gorule(){
  163. uni.navigateTo({
  164. url:'rule'
  165. })
  166. },
  167. getintegralInfo(){
  168. this.$http('openIntegralMall/integralInfo', {
  169. }, 'GET').then(res => {
  170. this.avaIntegral=res.data.avaIntegral
  171. })
  172. },
  173. gethotExchange(){
  174. uni.showLoading({
  175. title: '加载中'
  176. })
  177. this.$http('openIntegralMall/hotExchange', {
  178. }, 'GET').then(res => {
  179. uni.hideLoading();
  180. this.hotlist=res.data;
  181. })
  182. },
  183. getcategoryList(){
  184. this.$http('openIntegralMall/categoryList', {
  185. }, 'GET').then(res => {
  186. this.categoryList=res.data;
  187. var obj={
  188. Id:'',
  189. Name:'全部'
  190. }
  191. this.categoryList.unshift(obj);
  192. })
  193. },
  194. getintegralGoodsPage(){
  195. uni.showLoading({
  196. title: '加载中'
  197. })
  198. this.$http('openIntegralMall/integralGoodsPage', {
  199. categoryID:this.categoryID,
  200. page:this.page,
  201. limit:10
  202. }, 'GET').then(res => {
  203. uni.hideLoading();
  204. var list=res.data.Items;
  205. this.list=this.list.concat(list)
  206. })
  207. },
  208. topClick(index,item){
  209. this.topIndex=index;
  210. this.categoryID=item.ID;
  211. if(item.ID==undefined){
  212. this.categoryID=''
  213. }
  214. this.list=[];
  215. this.page=1;
  216. this.getintegralGoodsPage();
  217. },
  218. goDetail(id){
  219. uni.navigateTo({
  220. url:'integralgoodsDetail?id='+id+'&avaIntegral='+this.avaIntegral
  221. })
  222. },
  223. goscoreRecord(){
  224. uni.navigateTo({
  225. url:'scoreRecord?avaIntegral='+this.avaIntegral
  226. })
  227. },
  228. goexchangeRecord(){
  229. uni.navigateTo({
  230. url:'exchangeRecord'
  231. })
  232. }
  233. },
  234. onReachBottom(){
  235. this.page++;
  236. this.getintegralGoodsPage();
  237. },
  238. onPullDownRefresh(){
  239. this.list=[];
  240. this.page=1;
  241. this.getintegralInfo();
  242. this.gethotExchange();
  243. this.getcategoryList();
  244. this.getintegralGoodsPage();
  245. setTimeout(() => {
  246. uni.stopPullDownRefresh(); // 关闭下拉刷新
  247. }, 2000);
  248. }
  249. }
  250. </script>
  251. <style scoped>
  252. .btn_top{
  253. width: 100rpx;
  254. height: 100rpx;
  255. position: fixed;
  256. right: 24rpx;
  257. bottom: 60rpx;
  258. }
  259. .scroll-X{
  260. width: 750rpx;
  261. }
  262. .goodsLineBOx{
  263. display: flex;
  264. flex-wrap: wrap;
  265. justify-content: space-between;
  266. padding: 0 24rpx;
  267. padding-bottom: env(safe-area-inset-bottom);
  268. }
  269. .exchangeLineImg2{
  270. width: 341rpx;
  271. height: 318rpx;
  272. border-bottom: 1px solid #eee;
  273. display: block;
  274. }
  275. .exchangeName2{
  276. font-weight: 400;
  277. color: #333333;
  278. font-size: 28rpx;
  279. padding-top: 16rpx;
  280. padding-left: 20rpx;
  281. width: 300rpx;
  282. overflow: hidden; /*超出隐藏*/
  283. text-overflow: ellipsis;/*隐藏后添加省略号*/
  284. white-space: nowrap;/*强制不换行*/
  285. padding-bottom:6rpx;
  286. }
  287. .exchangeLine2{
  288. /* margin-left: 24rpx; */
  289. margin-top: 30rpx;
  290. height: 439rpx;
  291. border-radius: 16rpx;
  292. border: 1px solid #EEEEEE;
  293. overflow: hidden;
  294. }
  295. .classificationBox{
  296. display: flex;
  297. padding-bottom: 12rpx;
  298. border-bottom: 1px solid #EEEEEE;
  299. }
  300. .classificationName{
  301. white-space: nowrap;
  302. font-size: 28rpx;
  303. color: #3C3C3C;
  304. line-height: 40rpx;
  305. padding:24rpx 24rpx 8rpx 24rpx;
  306. font-weight: 400;
  307. max-width:170rpx;
  308. overflow: hidden; /*超出隐藏*/
  309. text-overflow: ellipsis;/*隐藏后添加省略号*/
  310. white-space: nowrap;/*强制不换行*/
  311. }
  312. .classificationNameActive{
  313. font-weight: 500 !important;
  314. color: #FF0000 ;
  315. }
  316. .classificationHx{
  317. width: 40rpx;
  318. height: 4rpx;
  319. background: #FF0000;
  320. margin: 0 auto;
  321. }
  322. .exchangeBox{
  323. background: #FFFFFF;margin-top: 20rpx;
  324. }
  325. .goodsBox{
  326. background: #FFFFFF;margin-top: 20rpx;
  327. }
  328. .exchangeName{
  329. font-weight: 400;
  330. color: #333333;
  331. font-size: 28rpx;
  332. padding-top: 16rpx;
  333. padding-left: 20rpx;
  334. width: 240rpx;
  335. word-wrap: break-word; /*强制换行*/
  336. overflow: hidden; /*超出隐藏*/
  337. text-overflow: ellipsis;/*隐藏后添加省略号*/
  338. white-space: nowrap;/*强制不换行*/
  339. padding-bottom:6rpx;
  340. }
  341. .jfspan1{
  342. font-weight: 500;
  343. color: #FF0000;
  344. font-size:32rpx;
  345. line-height: 45rpx;
  346. padding-left: 20rpx;
  347. }
  348. .jfspan2{
  349. font-weight: 400;
  350. color: #FF0000;
  351. font-size:24rpx;
  352. line-height: 45rpx;
  353. padding-left: 10rpx;
  354. }
  355. .exchange{
  356. display: flex;
  357. flex-wrap: nowrap;
  358. background: #FFFFFF;
  359. padding-bottom: 30rpx;
  360. }
  361. .exchangeLine{
  362. margin-left: 24rpx;
  363. margin-top: 10rpx;
  364. height: 375rpx;
  365. border-radius: 16rpx;
  366. border: 1px solid #EEEEEE;
  367. overflow: hidden;
  368. width: 270rpx;
  369. display: inline-block;
  370. }
  371. .exchangeLineImg{
  372. width: 270rpx;
  373. height: 252rpx;
  374. border-bottom: 1px solid #eee;
  375. display: block;
  376. }
  377. .rehuoimg{
  378. width: 26rpx;
  379. height: 34rpx;
  380. }
  381. .exchangeTitle{
  382. font-weight: 500;
  383. color: #333333;
  384. font-size: 30rpx;
  385. line-height: 34rpx;
  386. padding-right: 16rpx;
  387. }
  388. .exchangeTitleBox{
  389. padding: 20rpx 24rpx;display: flex;
  390. }
  391. .box{
  392. background: #F4F5F7;
  393. min-height: 100vh;
  394. }
  395. .jfjt{
  396. width: 24rpx;height: 24rpx;margin-top: 12rpx;
  397. }
  398. .jfgz{
  399. display: flex;
  400. width: 150rpx;
  401. height: 48rpx;
  402. background: rgba(255,229,211,0.3);
  403. border-radius: 0px 2rpx 0px 26rpx;
  404. font-size: 24rpx;
  405. line-height: 48rpx;
  406. color: #573400;
  407. position: absolute;
  408. top: 0;
  409. right: 0;
  410. }
  411. .jfgzTxt{
  412. padding-left: 18rpx;
  413. }
  414. .topBox{
  415. width: 100%;
  416. height: 410rpx;
  417. background:#38394E;
  418. padding-top: 30rpx;
  419. position: relative;
  420. }
  421. .topCont{
  422. width: 702rpx;
  423. height: 200rpx;
  424. background: url('http://dmsphoto.66km.com.cn/thFiles/DCCDB197-4F64-4711-89C0-E5034B2F1788.png') no-repeat;
  425. background-size: 100% 100%;
  426. margin-left: 24rpx;
  427. position: relative;
  428. border-radius: 20rpx;
  429. overflow: hidden;
  430. }
  431. .topBottom{
  432. width: 750rpx;
  433. height: 180rpx;
  434. background: #FFFFFF;
  435. border-radius: 26rpx 26rpx 0px 0px;
  436. position: absolute;
  437. left: 0;
  438. bottom: 0;
  439. display: flex;
  440. justify-content: space-around;
  441. }
  442. .kyjf{
  443. padding-top: 46rpx;
  444. padding-left: 40rpx;
  445. }
  446. .kyjfTitle{
  447. color: #523509;font-size: 28rpx;
  448. }
  449. .kyjfNum{
  450. font-size: 60rpx;
  451. font-family: PingFangSC-Medium, PingFang SC;
  452. font-weight: 500;
  453. color: #523509;
  454. line-height: 84rpx;
  455. }
  456. .kyjfDq{
  457. width: 224rpx;
  458. height: 44rpx;
  459. background: linear-gradient(135deg, #FFC81B 0%, #FFA800 100%);
  460. border-radius: 22rpx 22rpx 22rpx 0px;
  461. text-align: center;
  462. color: #573400;
  463. line-height: 44rpx;
  464. font-size: 24rpx;
  465. margin-left:10rpx ;
  466. margin-top: 22rpx;
  467. }
  468. .kyjfCont{
  469. display: flex;
  470. }
  471. .topBottomLineImg{
  472. width: 54rpx;height: 54rpx;
  473. }
  474. .topBottomLineTxt{
  475. color: #333333;font-size: 24rpx;ppadding-top: 14rpx;
  476. }
  477. .topBottomSx{
  478. width: 1px;
  479. height: 94rpx;
  480. background-color:#EEEEEE;
  481. margin-top:42rpx;
  482. }
  483. .topBottomLine{
  484. text-align: center;padding-top: 40rpx;
  485. }
  486. .scroll-viewX{
  487. white-space: nowrap;
  488. width: 100%;
  489. padding-bottom: 20rpx;
  490. }
  491. .authorizBox{
  492. width: 100vw;
  493. height: 100vh;
  494. background: rgba(0, 0, 0, 0.5);
  495. position: fixed;
  496. top: 0;
  497. left: 0;
  498. }
  499. .authorizCont{
  500. margin-top: 30vh;
  501. width: 564rpx;
  502. height: 408rpx;
  503. background: #FFFFFF;
  504. border-radius: 24rpx;
  505. margin-left: 93rpx;
  506. position: relative;
  507. }
  508. .authorizCloseImg{
  509. width: 62rpx;
  510. height: 62rpx;
  511. }
  512. .sqLogoBox{
  513. width: 180rpx;
  514. height: 180rpx;
  515. background: #FFFFFF;
  516. border-radius: 90rpx;
  517. text-align: center;
  518. position: absolute;
  519. top: -50rpx;
  520. left: 192rpx;
  521. }
  522. .authorizName{
  523. color: #333333;
  524. line-height: 42rpx;
  525. font-size: 30rpx;
  526. text-align: center;
  527. padding-top: 58rpx;
  528. }
  529. .authorizMs{
  530. color: #999999;
  531. line-height: 36rpx;
  532. font-size: 26rpx;
  533. width: 452rpx;
  534. padding-top: 24rpx;
  535. text-align: center;
  536. margin-left: 56rpx;
  537. }
  538. .authorizContbutton{
  539. width: 422rpx;
  540. height: 88rpx;
  541. background: #D53533;
  542. border-radius: 44rpx;
  543. line-height: 88rpx;
  544. text-align: center;
  545. font-size:30rpx;
  546. color: #FFFFFF;
  547. margin-top: 62rpx;
  548. margin-left:71rpx;
  549. }
  550. </style>