integral.vue 13 KB

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