| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <template>
- <view class="common-page">
- <image :src="bgUrl" style="width: 100%; height: 252rpx" mode="aspectFill">
- </image>
- <view class="display-flex-content-center">
- <image src="https://work.hkmop.com/static/imgs/pt_title.png" style="width: 432rpx; height: 95rpx"
- mode="aspectFill">
- </image>
- </view>
- <view class="list-box">
- <CommercePart :data="data"></CommercePart>
- </view>
- </view>
- </template>
- <script>
- import CommercePart from "@/components/CommercePart.vue";
- import {
- getAdData
- } from '@/common/api/home.js'
- import {
- getPointsGoodsList
- } from '@/common/api/good.js'
- export default {
- components: {
- CommercePart
- },
- data() {
- return {
- pageOptions: {},
- bgUrl: '',
- data: [],
- page: 1,
- pageSize: 6,
- total: 0
- }
- },
- onLoad(options) {
- this.pageOptions = options
- this.getBanner()
- this.getData(true)
- },
- onReachBottom() {
- this.getData()
- },
- onShareAppMessage(res) {
- if (res.from === 'button') { // 来自页面内分享按钮
- console.log(res.target)
- }
- let userInfo = uni.getStorageSync('userInfo')
- userInfo = userInfo && JSON.parse(userInfo) || {}
- let params = {}
- if (userInfo.id) {
- params = {
- id: userInfo.id
- }
- }
- let configs = uni.getStorageSync('configs') || {}
- return {
- title: configs.shop_share_title,
- path: `/subPages/pointsZone/pointsZone${this.$stringPageOptions(params)}`
- }
- },
- onShareTimeline() {
- if (res.from === 'button') { // 来自页面内分享按钮
- console.log(res.target)
- }
- let userInfo = uni.getStorageSync('userInfo')
- userInfo = userInfo && JSON.parse(userInfo) || {}
- let params = {}
- if (userInfo.id) {
- params = {
- id: userInfo.id
- }
- }
- let configs = uni.getStorageSync('configs') || {}
- return {
- title: configs.shop_share_title,
- path: `/subPages/pointsZone/pointsZone${this.$stringPageOptions(params)}`
- }
- },
- methods: {
- getBanner() {
- getAdData({
- pstn_id: 4
- }).then(res => {
- this.bgUrl = res.data.length && res.data[0].pic
- })
- },
- getData(initFlag) {
- if (!initFlag) {
- if (this.page * this.pageSize < this.total) {
- this.page++
- } else {
- return
- }
- } else {
- this.page = 1
- this.total = 0
- this.data = []
- }
- const sendData = {
- pageSize: this.pageSize,
- page: this.page
- }
- getPointsGoodsList(sendData).then(res => {
- this.data = this.data.concat(res.data.list)
- this.total = res.data.page.total
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .common-page {
- background-color: #F39800;
- height: 100vh;
- // overflow-y: auto;
- .list-box {
- padding: 20rpx 20rpx 30rpx;
- }
- }
- </style>
|