index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <template>
  2. <block>
  3. <view class="topBack" :style="'top: ' + menuButton.top + 'px'">
  4. <!-- <text class="ico-moon icon-leftarrow" wx:if="{{pages > 1}}" bindtap="toPage" data-mold="back"></text> -->
  5. <image v-if="pages > 1" @tap="toback"
  6. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/f566738e424f33a415dea22dc4e11eec.png"
  7. class="ico-moon"></image>
  8. <image mode="heightFix" :style="'height: ' + menuButton.height * 2 + 'rpx'" @click="toPage1"
  9. class="h-backBtn" v-else
  10. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/2847/41c5f36528b8f4204130c4977c1ec2c5.png">
  11. </image>
  12. <view class="userName">积分商城</view>
  13. </view>
  14. <view class="tpBg" :style="'padding-top: ' + (menuButton.top+menuButton.height) + 'px'">
  15. <view class="userinfo">
  16. <image class="userimg"
  17. src="http://cdn.shop.weivee.com/shop/20200408/6162b21922f336ae9b320bc06582ab7f.png" mode=""></image>
  18. <view class="userintergal" @click="toPage" data-url='/pages/wallet/integral'>
  19. <view>
  20. 我的积分
  21. </view>
  22. <view>
  23. {{info.score||0}}
  24. <image class="usearrow"
  25. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/2e9b0e2d66ccbc9cdce81a5503262b83.png"
  26. mode=""></image>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="content">
  32. <view class="box">
  33. <view class="daitem" @click="toPage" data-url='/pages/wallet/integral'>
  34. <image
  35. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/d17b79704d2bfbaa99e6c092b2bf2488.png"
  36. mode=""></image>
  37. <view>
  38. 积分明细
  39. </view>
  40. </view>
  41. <view class="daitem" @click="toPage" data-url='/pages/intergalShop/logs'>
  42. <image
  43. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/cb0958aaba111ea7ba861e3a1ad5e4e7.png"
  44. mode=""></image>
  45. <view>
  46. 我的兑换
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="content1">
  52. <view class="iNav iflex">
  53. <view class="iflexC aliCen tabItem" @tap="changeNav" :data-index="index" v-for="(item, index) in navs"
  54. :key="index">
  55. <text :class="'iNav-text ' + (navIndex == index ? 'ifontweight' : '')">{{ item.name }}</text>
  56. <image
  57. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0d08dcd267a9ecfb5aec198436d00646.png"
  58. v-if="navIndex == index"></image>
  59. </view>
  60. </view>
  61. <view class="goodsList">
  62. <view class="goodsItem" @tap="toPage" data-url="/pages/intergalShop/goodsDetail" :data-id="item.product_id"
  63. v-for="(item, index) in list" :key="index">
  64. <image :src="item.image" class="goodsImg"></image>
  65. <view class="goodsTitle">{{ item.title }}</view>
  66. <view class="goodsInfo">
  67. <view>¥{{ item.sales_price }}</view>
  68. <view>已兑{{ item.sales }}</view>
  69. </view>
  70. </view>
  71. <view v-if="!list.length" style='width:100%;color:#999;text-align:center;margin:150rpx 0;font-size:30rpx'>暂无数据</view>
  72. </view>
  73. </view>
  74. </block>
  75. </template>
  76. <script module="parse" lang="wxs">
  77. module.exports = {
  78. filterTime: function(time) {
  79. console.log(time)
  80. var nowDate = getDate(time * 1000);
  81. var year = nowDate.getFullYear();
  82. var month = nowDate.getMonth() + 1;
  83. var date = nowDate.getDate();
  84. var hours = nowDate.getHours();
  85. var minutes = nowDate.getMinutes();
  86. var seconds = nowDate.getSeconds();
  87. month = month > 9 ? month : '0' + month;
  88. date = date > 9 ? date : '0' + date;
  89. hours = hours > 9 ? hours : '0' + hours;
  90. minutes = minutes > 9 ? minutes : '0' + minutes;
  91. seconds = seconds > 9 ? seconds : '0' + seconds;
  92. return year + '-' + month + '-' + date + " " + hours + ":" + minutes + ":" + seconds;
  93. }
  94. }
  95. </script>
  96. <script>
  97. // pages/backstage/index/index.js
  98. var app = getApp();
  99. export default {
  100. data() {
  101. return {
  102. navs: [
  103. ],
  104. navIndex: 0,
  105. list: [
  106. ],
  107. loaded: false,
  108. page: 1,
  109. info: {
  110. },
  111. menuButton: {
  112. top: '',
  113. height: 0
  114. },
  115. };
  116. }
  117. /**
  118. * 生命周期函数--监听页面加载
  119. */
  120. ,
  121. async onLoad(options) {
  122. let page = getCurrentPages();
  123. var menuButton = uni.getMenuButtonBoundingClientRect();
  124. console.log(menuButton);
  125. this.pages = page.length
  126. this.menuButton = menuButton
  127. this.getinfo();
  128. let data = await this.$api.request('/category/all','GET',{
  129. type:"intergral"
  130. });
  131. this.navs = data;
  132. console.log(this.navs)
  133. this.getlist();
  134. },
  135. /**
  136. * 生命周期函数--监听页面显示
  137. */
  138. onShow: function() {},
  139. onPullDownRefresh: function() {
  140. },
  141. /**
  142. * 页面上拉触底事件的处理函数
  143. */
  144. onReachBottom: function() {
  145. this.loaded || this.getlist();
  146. },
  147. /**
  148. * 用户点击右上角分享
  149. */
  150. onShareAppMessage: function() {},
  151. methods: {
  152. async getlist() {
  153. var that = this;
  154. let res = await this.$api.request('/product/lists', 'GET', {
  155. page: this.page,
  156. pagesize: 10,
  157. type:1,
  158. fid :this.navs[this.navIndex].id
  159. });
  160. console.log(res)
  161. if (res) {
  162. if (res.length > 0) {
  163. this.list = this.list.concat(res);
  164. this.page++;
  165. } else {
  166. this.loaded = true
  167. this.$api.msg('没有更多数据');
  168. }
  169. }
  170. },
  171. changeNav(e) {
  172. let index = e.currentTarget.dataset.index;
  173. console.log(index);
  174. if (this.navIndex != index) {
  175. this.navIndex = index
  176. this.page = 1
  177. this.list = []
  178. this.loaded = false
  179. this.getlist();
  180. }
  181. },
  182. async getinfo() {
  183. let data = await this.$api.request('/wallet/index');
  184. if (data) {
  185. this.info = data;
  186. }
  187. },
  188. toPage(e) {
  189. app.globalData.toPage(e);
  190. },
  191. toPage1() {
  192. console.log(1)
  193. uni.switchTab({
  194. url:'/pages/index/index'
  195. })
  196. },
  197. toback() {
  198. uni.navigateBack({
  199. delta: 1
  200. });
  201. },
  202. }
  203. };
  204. </script>
  205. <style>
  206. page {
  207. background: #F4F5F9;
  208. }
  209. .topBack {
  210. position: absolute;
  211. top: 0;
  212. left: 0;
  213. z-index: 1;
  214. margin-top: 2rpx;
  215. display: flex;
  216. align-items: center;
  217. }
  218. .topBack .ico-moon {
  219. padding: 0 0rpx 0 30rpx;
  220. width: 70rpx;
  221. height: 40rpx;
  222. }
  223. .h-backBtn {
  224. margin-left: 30rpx;
  225. }
  226. .homeImg {
  227. height: 40rpx;
  228. width: 40rpx;
  229. margin-right: 10rpx;
  230. }
  231. .userName {
  232. font-size: 28rpx;
  233. color: #fff;
  234. margin-left: 20rpx;
  235. font-size: 36rpx;
  236. }
  237. .tpBg {
  238. background: url(https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/55fe2551ab3fd04275f3e1cc384081de.png);
  239. background-size: 100% 100%;
  240. width: 100%;
  241. height: 456rpx;
  242. box-sizing: border-box;
  243. }
  244. .content {
  245. margin: -80rpx 30rpx 25rpx;
  246. }
  247. .box {
  248. border-radius: 12rpx;
  249. background: #fff;
  250. padding: 40rpx 66rpx 50rpx 50rpx;
  251. margin-bottom: 25rpx;
  252. display: flex;
  253. align-items: center;
  254. justify-content: space-between;
  255. }
  256. .totalAllTitle {
  257. color: #9194A6;
  258. margin-bottom: 28rpx;
  259. text-align: center;
  260. }
  261. .total {
  262. display: flex;
  263. align-items: center;
  264. justify-content: center;
  265. padding-bottom: 20rpx;
  266. }
  267. .totalNum {
  268. font-size: 50rpx;
  269. }
  270. .totalJump {
  271. display: flex;
  272. align-items: center;
  273. width: 220rpx;
  274. height: 70rpx;
  275. justify-content: center;
  276. background: #FB4C6F;
  277. border-radius: 12rpx;
  278. border-radius: 12rpx;
  279. }
  280. .totalJump>view {
  281. font-size: 28rpx;
  282. color: #fff;
  283. }
  284. .totalJump>image {
  285. width: 14rpx;
  286. margin-left: 14rpx;
  287. margin-top: 5rpx;
  288. }
  289. .tip {
  290. font-size: 30rpx;
  291. padding-bottom: 10rpx;
  292. }
  293. .box1 {
  294. border-radius: 12rpx;
  295. background: #fff;
  296. padding: 50rpx;
  297. margin-bottom: 25rpx;
  298. padding-top: 0;
  299. }
  300. view {
  301. font-size: 24rpx;
  302. }
  303. .rWrap {
  304. display: flex;
  305. align-items: center;
  306. }
  307. .intergal {
  308. color: #000000;
  309. font-size: 30rpx;
  310. margin-right: 12rpx;
  311. }
  312. .userinfo {
  313. display: flex;
  314. align-items: center;
  315. padding: 60rpx 0 0 50rpx;
  316. }
  317. .userimg {
  318. width: 120rpx;
  319. height: 120rpx;
  320. border-radius: 50%;
  321. }
  322. .userintergal {
  323. margin-left: 20rpx;
  324. }
  325. .userintergal>view:nth-child(1) {
  326. font-size: 28rpx;
  327. color: #fff;
  328. }
  329. .userintergal>view:nth-child(2) {
  330. font-size: 80rpx;
  331. font-weight: 700;
  332. color: #fff;
  333. }
  334. .usearrow {
  335. width: 10rpx;
  336. height: 18rpx;
  337. vertical-align: center;
  338. margin: 0 0 20rpx 20rpx;
  339. }
  340. .daitem {
  341. display: flex;
  342. align-items: center;
  343. }
  344. .daitem>view {
  345. font-size: 28rpx;
  346. color: #000;
  347. margin-left: 18rpx;
  348. }
  349. .daitem>image {
  350. width: 60rpx;
  351. height: 60rpx;
  352. }
  353. .iNav {
  354. width: 710rpx;
  355. /* padding: 0 20rpx 0; */
  356. /* margin-top: 34rpx; */
  357. line-height: 1;
  358. }
  359. .iNav .iNav-text {
  360. padding: 30rpx 0rpx 28rpx;
  361. /* padding-top: 34rpx;
  362. padding-bottom: 28rpx; */
  363. color: #121212;
  364. font-size: 34rpx;
  365. }
  366. .iNav image {
  367. width: 68rpx;
  368. height: 10rpx;
  369. margin-top: -30rpx;
  370. z-index: -1;
  371. }
  372. .jsbet {
  373. justify-content: space-between;
  374. }
  375. .iflex {
  376. display: flex;
  377. }
  378. .aliCen {
  379. align-items: center;
  380. }
  381. .iflexC {
  382. display: flex;
  383. flex-direction: column;
  384. }
  385. .ifontweight {
  386. font-weight: 700;
  387. }
  388. .content1 {
  389. padding: 0 30rpx;
  390. box-sizing: border-box;
  391. }
  392. .tabItem {
  393. margin-right: 70rpx;
  394. }
  395. .goodsList {
  396. display: flex;
  397. justify-content: space-between;
  398. flex-wrap: wrap;
  399. }
  400. .goodsItem {
  401. width: 330rpx;
  402. padding: 10rpx 12rpx 28rpx;
  403. box-sizing: border-box;
  404. margin-bottom: 20rpx;
  405. background: #fff;
  406. border-radius: 12rpx;
  407. }
  408. .goodsImg {
  409. width: 308rpx;
  410. height: 308rpx;
  411. border-radius: 12rpx;
  412. }
  413. .goodsTitle {
  414. margin-top: 22rpx;
  415. color: #011b33;
  416. font-weight: 700;
  417. font-size: 30rpx;
  418. width: 300rpx;
  419. overflow: hidden;
  420. text-overflow: ellipsis;
  421. display: -webkit-box;
  422. -webkit-line-clamp: 2;
  423. -webkit-box-orient: vertical;
  424. -webkit-line-clamp: 2;
  425. }
  426. .goodsInfo {
  427. margin-top: 22rpx;
  428. display: flex;
  429. align-items: center;
  430. justify-content: space-between;
  431. }
  432. .goodsInfo>view:nth-child(1) {
  433. color: #F15071;
  434. font-size: 30rpx;
  435. }
  436. .goodsInfo>view:nth-child(2) {
  437. font-size: 22rpx;
  438. color: #999999;
  439. }
  440. </style>