integral.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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. this.$store.commit('mutationsckshopInfo', '')
  220. uni.navigateTo({
  221. url:'integralgoodsDetail?id='+id+'&avaIntegral='+this.avaIntegral
  222. })
  223. },
  224. goscoreRecord(){
  225. uni.navigateTo({
  226. url:'scoreRecord?avaIntegral='+this.avaIntegral
  227. })
  228. },
  229. goexchangeRecord(){
  230. uni.navigateTo({
  231. url:'exchangeRecord'
  232. })
  233. }
  234. },
  235. onReachBottom(){
  236. this.page++;
  237. this.getintegralGoodsPage();
  238. },
  239. onPullDownRefresh(){
  240. this.list=[];
  241. this.page=1;
  242. this.getintegralInfo();
  243. this.gethotExchange();
  244. this.getcategoryList();
  245. this.getintegralGoodsPage();
  246. setTimeout(() => {
  247. uni.stopPullDownRefresh(); // 关闭下拉刷新
  248. }, 2000);
  249. }
  250. }
  251. </script>
  252. <style scoped>
  253. .btn_top{
  254. width: 100rpx;
  255. height: 100rpx;
  256. position: fixed;
  257. right: 24rpx;
  258. bottom: 60rpx;
  259. }
  260. .scroll-X{
  261. width: 750rpx;
  262. }
  263. .goodsLineBOx{
  264. display: flex;
  265. flex-wrap: wrap;
  266. justify-content: space-between;
  267. padding: 0 24rpx;
  268. padding-bottom: env(safe-area-inset-bottom);
  269. }
  270. .exchangeLineImg2{
  271. width: 341rpx;
  272. height: 318rpx;
  273. border-bottom: 1px solid #eee;
  274. display: block;
  275. }
  276. .exchangeName2{
  277. font-weight: 400;
  278. color: #333333;
  279. font-size: 28rpx;
  280. padding-top: 16rpx;
  281. padding-left: 20rpx;
  282. width: 300rpx;
  283. overflow: hidden; /*超出隐藏*/
  284. text-overflow: ellipsis;/*隐藏后添加省略号*/
  285. white-space: nowrap;/*强制不换行*/
  286. padding-bottom:6rpx;
  287. }
  288. .exchangeLine2{
  289. /* margin-left: 24rpx; */
  290. margin-top: 30rpx;
  291. height: 439rpx;
  292. border-radius: 16rpx;
  293. border: 1px solid #EEEEEE;
  294. overflow: hidden;
  295. }
  296. .classificationBox{
  297. display: flex;
  298. padding-bottom: 12rpx;
  299. border-bottom: 1px solid #EEEEEE;
  300. }
  301. .classificationName{
  302. white-space: nowrap;
  303. font-size: 28rpx;
  304. color: #3C3C3C;
  305. line-height: 40rpx;
  306. padding:24rpx 24rpx 8rpx 24rpx;
  307. font-weight: 400;
  308. max-width:170rpx;
  309. overflow: hidden; /*超出隐藏*/
  310. text-overflow: ellipsis;/*隐藏后添加省略号*/
  311. white-space: nowrap;/*强制不换行*/
  312. }
  313. .classificationNameActive{
  314. font-weight: 500 !important;
  315. color: #FF0000 ;
  316. }
  317. .classificationHx{
  318. width: 40rpx;
  319. height: 4rpx;
  320. background: #FF0000;
  321. margin: 0 auto;
  322. }
  323. .exchangeBox{
  324. background: #FFFFFF;margin-top: 20rpx;
  325. }
  326. .goodsBox{
  327. background: #FFFFFF;margin-top: 20rpx;
  328. }
  329. .exchangeName{
  330. font-weight: 400;
  331. color: #333333;
  332. font-size: 28rpx;
  333. padding-top: 16rpx;
  334. padding-left: 20rpx;
  335. width: 240rpx;
  336. word-wrap: break-word; /*强制换行*/
  337. overflow: hidden; /*超出隐藏*/
  338. text-overflow: ellipsis;/*隐藏后添加省略号*/
  339. white-space: nowrap;/*强制不换行*/
  340. padding-bottom:6rpx;
  341. }
  342. .jfspan1{
  343. font-weight: 500;
  344. color: #FF0000;
  345. font-size:32rpx;
  346. line-height: 45rpx;
  347. padding-left: 20rpx;
  348. }
  349. .jfspan2{
  350. font-weight: 400;
  351. color: #FF0000;
  352. font-size:24rpx;
  353. line-height: 45rpx;
  354. padding-left: 10rpx;
  355. }
  356. .exchange{
  357. display: flex;
  358. flex-wrap: nowrap;
  359. background: #FFFFFF;
  360. padding-bottom: 30rpx;
  361. }
  362. .exchangeLine{
  363. margin-left: 24rpx;
  364. margin-top: 10rpx;
  365. height: 375rpx;
  366. border-radius: 16rpx;
  367. border: 1px solid #EEEEEE;
  368. overflow: hidden;
  369. width: 270rpx;
  370. display: inline-block;
  371. }
  372. .exchangeLineImg{
  373. width: 270rpx;
  374. height: 252rpx;
  375. border-bottom: 1px solid #eee;
  376. display: block;
  377. }
  378. .rehuoimg{
  379. width: 26rpx;
  380. height: 34rpx;
  381. }
  382. .exchangeTitle{
  383. font-weight: 500;
  384. color: #333333;
  385. font-size: 30rpx;
  386. line-height: 34rpx;
  387. padding-right: 16rpx;
  388. }
  389. .exchangeTitleBox{
  390. padding: 20rpx 24rpx;display: flex;
  391. }
  392. .box{
  393. background: #F4F5F7;
  394. min-height: 100vh;
  395. }
  396. .jfjt{
  397. width: 24rpx;height: 24rpx;margin-top: 12rpx;
  398. }
  399. .jfgz{
  400. display: flex;
  401. width: 150rpx;
  402. height: 48rpx;
  403. background: rgba(255,229,211,0.3);
  404. border-radius: 0px 2rpx 0px 26rpx;
  405. font-size: 24rpx;
  406. line-height: 48rpx;
  407. color: #573400;
  408. position: absolute;
  409. top: 0;
  410. right: 0;
  411. }
  412. .jfgzTxt{
  413. padding-left: 18rpx;
  414. }
  415. .topBox{
  416. width: 100%;
  417. height: 410rpx;
  418. background:#38394E;
  419. padding-top: 30rpx;
  420. position: relative;
  421. }
  422. .topCont{
  423. width: 702rpx;
  424. height: 200rpx;
  425. background: url('http://dmsphoto.66km.com.cn/thFiles/DCCDB197-4F64-4711-89C0-E5034B2F1788.png') no-repeat;
  426. background-size: 100% 100%;
  427. margin-left: 24rpx;
  428. position: relative;
  429. border-radius: 20rpx;
  430. overflow: hidden;
  431. }
  432. .topBottom{
  433. width: 750rpx;
  434. height: 180rpx;
  435. background: #FFFFFF;
  436. border-radius: 26rpx 26rpx 0px 0px;
  437. position: absolute;
  438. left: 0;
  439. bottom: 0;
  440. display: flex;
  441. justify-content: space-around;
  442. }
  443. .kyjf{
  444. padding-top: 46rpx;
  445. padding-left: 40rpx;
  446. }
  447. .kyjfTitle{
  448. color: #523509;font-size: 28rpx;
  449. }
  450. .kyjfNum{
  451. font-size: 60rpx;
  452. font-family: PingFangSC-Medium, PingFang SC;
  453. font-weight: 500;
  454. color: #523509;
  455. line-height: 84rpx;
  456. }
  457. .kyjfDq{
  458. width: 224rpx;
  459. height: 44rpx;
  460. background: linear-gradient(135deg, #FFC81B 0%, #FFA800 100%);
  461. border-radius: 22rpx 22rpx 22rpx 0px;
  462. text-align: center;
  463. color: #573400;
  464. line-height: 44rpx;
  465. font-size: 24rpx;
  466. margin-left:10rpx ;
  467. margin-top: 22rpx;
  468. }
  469. .kyjfCont{
  470. display: flex;
  471. }
  472. .topBottomLineImg{
  473. width: 54rpx;height: 54rpx;
  474. }
  475. .topBottomLineTxt{
  476. color: #333333;font-size: 24rpx;ppadding-top: 14rpx;
  477. }
  478. .topBottomSx{
  479. width: 1px;
  480. height: 94rpx;
  481. background-color:#EEEEEE;
  482. margin-top:42rpx;
  483. }
  484. .topBottomLine{
  485. text-align: center;padding-top: 40rpx;
  486. }
  487. .scroll-viewX{
  488. white-space: nowrap;
  489. width: 100%;
  490. padding-bottom: 20rpx;
  491. }
  492. .authorizBox{
  493. width: 100vw;
  494. height: 100vh;
  495. background: rgba(0, 0, 0, 0.5);
  496. position: fixed;
  497. top: 0;
  498. left: 0;
  499. }
  500. .authorizCont{
  501. margin-top: 30vh;
  502. width: 564rpx;
  503. height: 408rpx;
  504. background: #FFFFFF;
  505. border-radius: 24rpx;
  506. margin-left: 93rpx;
  507. position: relative;
  508. }
  509. .authorizCloseImg{
  510. width: 62rpx;
  511. height: 62rpx;
  512. }
  513. .sqLogoBox{
  514. width: 180rpx;
  515. height: 180rpx;
  516. background: #FFFFFF;
  517. border-radius: 90rpx;
  518. text-align: center;
  519. position: absolute;
  520. top: -50rpx;
  521. left: 192rpx;
  522. }
  523. .authorizName{
  524. color: #333333;
  525. line-height: 42rpx;
  526. font-size: 30rpx;
  527. text-align: center;
  528. padding-top: 58rpx;
  529. }
  530. .authorizMs{
  531. color: #999999;
  532. line-height: 36rpx;
  533. font-size: 26rpx;
  534. width: 452rpx;
  535. padding-top: 24rpx;
  536. text-align: center;
  537. margin-left: 56rpx;
  538. }
  539. .authorizContbutton{
  540. width: 422rpx;
  541. height: 88rpx;
  542. background: #D53533;
  543. border-radius: 44rpx;
  544. line-height: 88rpx;
  545. text-align: center;
  546. font-size:30rpx;
  547. color: #FFFFFF;
  548. margin-top: 62rpx;
  549. margin-left:71rpx;
  550. }
  551. </style>