index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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'" @tap="toPage"
  9. data-url="/pages/tabbar/index/index" 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. toback() {
  192. uni.navigateBack({
  193. delta: 1
  194. });
  195. },
  196. }
  197. };
  198. </script>
  199. <style>
  200. page {
  201. background: #F4F5F9;
  202. }
  203. .topBack {
  204. position: absolute;
  205. top: 0;
  206. left: 0;
  207. z-index: 1;
  208. margin-top: 2rpx;
  209. display: flex;
  210. align-items: center;
  211. }
  212. .topBack .ico-moon {
  213. padding: 0 0rpx 0 30rpx;
  214. width: 70rpx;
  215. height: 40rpx;
  216. }
  217. .h-backBtn {
  218. margin-left: 30rpx;
  219. }
  220. .homeImg {
  221. height: 40rpx;
  222. width: 40rpx;
  223. margin-right: 10rpx;
  224. }
  225. .userName {
  226. font-size: 28rpx;
  227. color: #fff;
  228. margin-left: 20rpx;
  229. font-size: 36rpx;
  230. }
  231. .tpBg {
  232. background: url(https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/55fe2551ab3fd04275f3e1cc384081de.png);
  233. background-size: 100% 100%;
  234. width: 100%;
  235. height: 456rpx;
  236. box-sizing: border-box;
  237. }
  238. .content {
  239. margin: -80rpx 30rpx 25rpx;
  240. }
  241. .box {
  242. border-radius: 12rpx;
  243. background: #fff;
  244. padding: 40rpx 66rpx 50rpx 50rpx;
  245. margin-bottom: 25rpx;
  246. display: flex;
  247. align-items: center;
  248. justify-content: space-between;
  249. }
  250. .totalAllTitle {
  251. color: #9194A6;
  252. margin-bottom: 28rpx;
  253. text-align: center;
  254. }
  255. .total {
  256. display: flex;
  257. align-items: center;
  258. justify-content: center;
  259. padding-bottom: 20rpx;
  260. }
  261. .totalNum {
  262. font-size: 50rpx;
  263. }
  264. .totalJump {
  265. display: flex;
  266. align-items: center;
  267. width: 220rpx;
  268. height: 70rpx;
  269. justify-content: center;
  270. background: #FB4C6F;
  271. border-radius: 12rpx;
  272. border-radius: 12rpx;
  273. }
  274. .totalJump>view {
  275. font-size: 28rpx;
  276. color: #fff;
  277. }
  278. .totalJump>image {
  279. width: 14rpx;
  280. margin-left: 14rpx;
  281. margin-top: 5rpx;
  282. }
  283. .tip {
  284. font-size: 30rpx;
  285. padding-bottom: 10rpx;
  286. }
  287. .box1 {
  288. border-radius: 12rpx;
  289. background: #fff;
  290. padding: 50rpx;
  291. margin-bottom: 25rpx;
  292. padding-top: 0;
  293. }
  294. view {
  295. font-size: 24rpx;
  296. }
  297. .rWrap {
  298. display: flex;
  299. align-items: center;
  300. }
  301. .intergal {
  302. color: #000000;
  303. font-size: 30rpx;
  304. margin-right: 12rpx;
  305. }
  306. .userinfo {
  307. display: flex;
  308. align-items: center;
  309. padding: 60rpx 0 0 50rpx;
  310. }
  311. .userimg {
  312. width: 120rpx;
  313. height: 120rpx;
  314. border-radius: 50%;
  315. }
  316. .userintergal {
  317. margin-left: 20rpx;
  318. }
  319. .userintergal>view:nth-child(1) {
  320. font-size: 28rpx;
  321. color: #fff;
  322. }
  323. .userintergal>view:nth-child(2) {
  324. font-size: 80rpx;
  325. font-weight: 700;
  326. color: #fff;
  327. }
  328. .usearrow {
  329. width: 10rpx;
  330. height: 18rpx;
  331. vertical-align: center;
  332. margin: 0 0 20rpx 20rpx;
  333. }
  334. .daitem {
  335. display: flex;
  336. align-items: center;
  337. }
  338. .daitem>view {
  339. font-size: 28rpx;
  340. color: #000;
  341. margin-left: 18rpx;
  342. }
  343. .daitem>image {
  344. width: 60rpx;
  345. height: 60rpx;
  346. }
  347. .iNav {
  348. width: 710rpx;
  349. /* padding: 0 20rpx 0; */
  350. /* margin-top: 34rpx; */
  351. line-height: 1;
  352. }
  353. .iNav .iNav-text {
  354. padding: 30rpx 0rpx 28rpx;
  355. /* padding-top: 34rpx;
  356. padding-bottom: 28rpx; */
  357. color: #121212;
  358. font-size: 34rpx;
  359. }
  360. .iNav image {
  361. width: 68rpx;
  362. height: 10rpx;
  363. margin-top: -30rpx;
  364. z-index: -1;
  365. }
  366. .jsbet {
  367. justify-content: space-between;
  368. }
  369. .iflex {
  370. display: flex;
  371. }
  372. .aliCen {
  373. align-items: center;
  374. }
  375. .iflexC {
  376. display: flex;
  377. flex-direction: column;
  378. }
  379. .ifontweight {
  380. font-weight: 700;
  381. }
  382. .content1 {
  383. padding: 0 30rpx;
  384. box-sizing: border-box;
  385. }
  386. .tabItem {
  387. margin-right: 70rpx;
  388. }
  389. .goodsList {
  390. display: flex;
  391. justify-content: space-between;
  392. flex-wrap: wrap;
  393. }
  394. .goodsItem {
  395. width: 330rpx;
  396. padding: 10rpx 12rpx 28rpx;
  397. box-sizing: border-box;
  398. margin-bottom: 20rpx;
  399. background: #fff;
  400. border-radius: 12rpx;
  401. }
  402. .goodsImg {
  403. width: 308rpx;
  404. height: 308rpx;
  405. border-radius: 12rpx;
  406. }
  407. .goodsTitle {
  408. margin-top: 22rpx;
  409. color: #011b33;
  410. font-weight: 700;
  411. font-size: 30rpx;
  412. width: 300rpx;
  413. overflow: hidden;
  414. text-overflow: ellipsis;
  415. display: -webkit-box;
  416. -webkit-line-clamp: 2;
  417. -webkit-box-orient: vertical;
  418. -webkit-line-clamp: 2;
  419. }
  420. .goodsInfo {
  421. margin-top: 22rpx;
  422. display: flex;
  423. align-items: center;
  424. justify-content: space-between;
  425. }
  426. .goodsInfo>view:nth-child(1) {
  427. color: #F15071;
  428. font-size: 30rpx;
  429. }
  430. .goodsInfo>view:nth-child(2) {
  431. font-size: 22rpx;
  432. color: #999999;
  433. }
  434. </style>