Commit 7c7a5950 by 赵雅纹

Merge branch 'feature-zyw-sc' into 'dev_7.1.0'

Feature zyw sc

See merge request !77
parents 24b71233 a3dbb76f
......@@ -11,7 +11,7 @@
>
<block wx:for="{{imageData}}" wx:key="{{item}}">
<swiper-item class="swiper-item">
<image wx:if="{{baseImgUrl}}" src="{{baseImgUrl}}{{item.imageUrl}}" data-appid="{{item.link.appid}}" data-path="{{item.link.url}}" data-link="{{item.link}}" data-item="{{item}}" bindtap='preview' class="slide-image" />
<image src="{{item.url}}" data-appid="{{item.id}}" data-path="{{item.link.url}}" data-link="{{item.link}}" data-item="{{item}}" bindtap='preview' class="slide-image" />
</swiper-item>
</block>
......
// component/waterFlowLayout/waterFlowLayout.js
const wxService = require('../../utils/wxService')
Component({
/**
* 组件的属性列表
......@@ -22,6 +24,50 @@ Component({
* 组件的方法列表
*/
methods: {
onTapLike(e){
console.log(e)
const { memberId } = wx.getStorageSync('_baseUserInfo')
var params = {
contentId: e.currentTarget.dataset.id,
type: e.currentTarget.dataset.type,
userId: memberId
}
if (!e.currentTarget.dataset.type){
wxService.post(`/merchant/contentMobileTerminal/operationSave`, params).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.showToast({
title: '点赞成功',
icon: 'none'
})
}
}).finally(() => {
})
}else{
wxService.post(`/merchant/contentMobileTerminal/operationDelete`, {
contentId: e.currentTarget.dataset.id,
userId: memberId
}).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.showToast({
title: '取消点赞成功',
icon: 'none'
})
}
}).finally(() => {
})
}
},
//详情
gotoDetail(e){
wxService.router(`/pages/wantToBuyDetail/wantToBuyDetail?id=${e.currentTarget.dataset.id}`)
}
}
})
......@@ -13,18 +13,18 @@
</view>
</view>
<template name="water-list">
<view class="item">
<view class="item" bindtap="gotoDetail" data-id="{{id}}">
<image class="item-img" src="{{url}}" mode="widthFix"></image>
<view class="item-title-box">
<view class="item-title">{{title}}</view>
<view class="item-title">{{headline}}</view>
</view>
<view class="share-wrap">
<view class="share-oprate">
<image class="share-img" src="/assets/imgs/heart-default.png"></image>
<text class="share-number">689</text>
<view class="share-oprate" bindtap="onTapLike" data-id="{{id}}" data-type="{{type}}">
<image class="share-img" src="{{type ? '/assets/imgs/heart-primary.png' : '/assets/imgs/heart-default.png'}}"></image>
<text class="share-number">{{enjoySum || 0}}</text>
</view> <view class="share-oprate">
<image class="share-img" src="/assets/imgs/share.png"></image>
<text class="share-number">298</text>
<text class="share-number">{{transmitSum || 0}}</text>
</view>
</view>
</view>
......
......@@ -9,6 +9,7 @@ wxService.page({
* 页面的初始数据
*/
data: {
categoryList:[], //分类
imageData: [
{
name: '大脸猫爱吃鱼大脸猫爱吃鱼大脸猫爱吃鱼大脸猫爱吃鱼大脸猫爱吃鱼',
......@@ -98,7 +99,7 @@ wxService.page({
redirectId: "10",
type: 0
}],
pageNo: 1,
pageNum: 1,
pageSize: 10,
invalidPageNo: 1,
totalPages: 0,
......@@ -110,26 +111,10 @@ wxService.page({
invalidTotalElements: 0,
currentTab: 0,
noMoreCoupon: false,
noMoreCouponInvalid: false
},
//滑动切换
swiperTab: function (e) {
const { current } = e.detail
if (this.data.currentTab == current) {
return false;
} else {
this.setData({
currentTab: current
})
}
// 可使用
if (current == 0) {
this.getCouponList(1, 10, 1)
} else if (current == 1) {
// 失效
this.getCouponList(1, 10, 0)
}
noMoreCouponInvalid: false,
contentList:[]
},
// 点击切换
clickTab: function (e) {
const { current } = e.target.dataset
......@@ -138,17 +123,9 @@ wxService.page({
} else {
this.setData({
currentTab: current,
// couponList: [], // 清空数据
// invalidCouponList: [],
})
}
// 可使用
if (current == 0) {
this.getCouponList(1, 10, 1)
} else if (current == 1) {
// 失效
this.getCouponList(1, 10, 0)
}
this.getContentList(current)
},
/**
* 生命周期函数--监听页面加载
......@@ -158,114 +135,74 @@ wxService.page({
* 生命周期函数--监听页面显示
*/
onShow() {
// 可使用 已失效
this.getCouponList(1, 10, 1)
this.getCouponList(1, 10, 0)
},
handelPresentCouponDetail(e) {
let { cardno } = e.currentTarget.dataset
wxService.router(`/pages/couponDetail/couponDetail`).search({ cardno })
},
handelPresentCouponCode(e) {
let { cardno } = e.currentTarget.dataset
wxService.router(`/pages/couponCodeDetail/couponCodeDetail`).search({ cardno })
this.getCategoryList()
},
//获取优惠券列表
getCouponList(pageNo, pageSize, statusNum) {
wx.showLoading({
title: '加载中'
})
let params;
if (statusNum == 1) {
params = {
status: 1
}
if (pageNo == 1) {
this.setData({
pageNo: 1,
couponList: [], // 清空数据
})
}
} else {
params = {
statusNot: 1
}
if (pageNo == 1) {
// 获取分类
getCategoryList(){
wxService.post(`/merchant/contentMobileTerminal/gatClassify`).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0 ) {
this.setData({
invalidCouponList: [],
invalidPageNo: 1
categoryList:data,
currentTab:data[0].id
})
getContentList(data[0].id)
}
}
wxService.post(`/coupon/coupon/listWithMember4Mina?number=${pageNo}&size=${pageSize}`, params).then(res => {
}).finally(() => {
})
},
// 获取发现内容
getContentList(classifyId){
const { memberId } = wx.getStorageSync('_baseUserInfo')
wxService.post(`/merchant/contentMobileTerminal/getContentList?pageNum=${this.data.pageNum}&pageSize=${this.data.pageSize}`, {
classifyId: classifyId,
userId: memberId
}).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
// 处理时间显示
if (!data.content) return false
data.content.forEach(item => {
item.startTime = item.startTime.substring(0, 10)
item.endTime = item.endTime.substring(0, 10)
})
// 可使用 or 已失效
if (statusNum == 1) {
// couponList
if (result == 0 ) {
if (data.content){
this.setData({
couponList: this.data.pageNo == 1 ? [...data.content] : [...this.data.couponList, ...data.content],
contentList: this.data.pageNum == 1 ? [...data.content] : [...this.data.contentList, ...data.content],
totalPages: data.totalPages,
totalElements: data.totalElements
})
} else {
// invalidCouponList
}else{
this.setData({
invalidCouponList: this.data.invalidPageNo == 1 ? [...data.content] : [...this.data.invalidCouponList, ...data.content],
invalidTotalPages: data.totalPages,
invalidTotalElements: data.totalElements
contentList: []
})
}
}
}).finally(() => {
wx.hideLoading();
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () { },
onPullDownRefresh: function () {
this.setData({
pageNum: 1,
})
this.getContentList(this.data.currentTab)
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
// 可使用 0 or 已失效 1
const { currentTab, pageNo, pageSize, totalPages, invalidPageNo, invalidTotalPages } = this.data
if (currentTab == 0) {
if (pageNo < totalPages) {
this.setData({
pageNo: pageNo + 1,
})
// status 1
this.getCouponList(this.data.pageNo, pageSize, 1)
} else {
this.setData({
noMoreCoupon: true
})
}
} else {
if (invalidPageNo < invalidTotalPages) {
this.setData({
invalidPageNo: invalidPageNo + 1,
})
// status 0
this.getCouponList(this.data.invalidPageNo, pageSize, 0)
} else {
this.setData({
noMoreCouponInvalid: true
})
}
}
},
const { pageNum, pageSize, totalPages } = this.data
if (pageNum < totalPages) {
this.setData({
pageNum: pageNum + 1,
})
this.getContentList(this.data.currentTab)
}
}
})
\ No newline at end of file
{
"navigationBarTitleText": "我的分享",
"navigationBarTitleText": "发现",
"enablePullDownRefresh": true,
"usingComponents": {
"water-flow-layout": "/component/waterFlowLayout/waterFlowLayout"
}
......
<view class='page-want-buy'>
<view class="swiper-tab">
<view class="swiper-tab-item {{currentTab==0 ? 'active' : ''}}" data-current="0" bindtap="clickTab">
分享订单
<view class="line" wx-if="{{currentTab==0}}"></view>
<view class="swiper-tab {{categoryList.length > 5 ? 'categoryList' : ''}}">
<view class="swiper-tab-item {{currentTab==item.id ? 'active' : ''}} " data-current="{{item.id}}" bindtap="clickTab" wx:for="{{categoryList}}" wx:key="{{index}}">
{{item.name}}
<view class="line" wx-if="{{currentTab==item.id}}"></view>
</view>
<view class="swiper-tab-item {{currentTab==1 ? 'active' : ''}}" data-current="1" bindtap="clickTab">分享会员
<view class="line" wx-if="{{currentTab==1}}"></view>
</view>
<scroll-view scroll-y >
<view class="main-content" wx:if="{{contentList.length > 0}}">
<water-flow-layout image-data="{{contentList}}"/>
</view>
<view class="swiper-tab-item {{currentTab==2 ? 'active' : ''}}" data-current="2" bindtap="clickTab">发现分享
<view class="line" wx-if="{{currentTab==2}}"></view>
<view class="empty" wx:if="{{!contentList || contentList.length < 1}}">
暂无内容哦~
</view>
</view>
<swiper current="{{currentTab}}" duration="300" bindchange="swiperTab">
<swiper-item>
11111
</swiper-item>
<swiper-item>
22222
</swiper-item>
<swiper-item>
<scroll-view scroll-y >
<water-flow-layout image-data="{{imageData}}"/>
</scroll-view>
</swiper-item>
</swiper>
</scroll-view>
</view>
......@@ -10,7 +10,7 @@ scroll-view{
position: relative;
}
.swiper-tab{
width: 100%;
width: 750rpx;
height: 60rpx;
display: flex;
background-color: #ffffff;
......@@ -19,6 +19,8 @@ scroll-view{
z-index:1;
justify-content: space-around;
padding-top: 32rpx;
white-space: nowrap;
overflow-x: scroll;
}
.swiper-tab-item{
text-align: center;
......@@ -35,17 +37,22 @@ scroll-view{
margin-top: 8rpx;
border-radius: 8rpx;
}
swiper {
width: 100%;
flex: 1;
height:100vh;
/* padding-bottom:20rpx; */
position: absolute;
overflow: scroll;
top: 60rpx;
.main-content{
margin-top: 110rpx;
}
.categoryList{
display: inline-block;
}
.categoryList .swiper-tab-item{
display: inline-block;
margin: 0 36rpx;
}
.empty{
width: 300rpx;
margin: 50% auto;
text-align: center;
color: #aaaaaa;
}
......
......@@ -9,189 +9,66 @@ wxService.page({
* 页面的初始数据
*/
data: {
imageData: [{
desc: "string",
imageUrl: "/group3/M00/00/0B/Cv6CBF0RvcuAXoDUAA5M5vbNswU382.png",
link: { linkId: "10", brandId: "2711", name: "会员服务", url: "5", type: 2, status: 0 },
number: 1,
redirectId: "10",
type: 0
}, {
desc: "string",
imageUrl: "/group3/M00/00/0B/Cv6CBF0RvcuAXoDUAA5M5vbNswU382.png",
link: { linkId: "10", brandId: "2711", name: "会员服务", url: "5", type: 2, status: 0 },
number: 1,
redirectId: "10",
type: 0
}],
pageNo: 1,
pageSize: 10,
invalidPageNo: 1,
totalPages: 0,
totalElements: 0,
invalidTotalElements: 0,
couponList: [],
invalidCouponList: [],
invalidTotalPages: 0,
invalidTotalElements: 0,
currentTab: 0,
noMoreCoupon: false,
noMoreCouponInvalid: false
contentInfo:[],
id:'',
pageNo:1,
pageSize:30,
proList:[]
},
//滑动切换
swiperTab: function (e) {
const { current } = e.detail
if (this.data.currentTab == current) {
return false;
} else {
this.setData({
currentTab: current
})
}
// 可使用
if (current == 0) {
this.getCouponList(1, 10, 1)
} else if (current == 1) {
// 失效
this.getCouponList(1, 10, 0)
}
},
// 点击切换
clickTab: function (e) {
const { current } = e.target.dataset
if (this.data.currentTab == current) {
return false;
} else {
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (options && options.id){
console.log(options.id)
this.setData({
currentTab: current,
// couponList: [], // 清空数据
// invalidCouponList: [],
id: options.id
})
}
// 可使用
if (current == 0) {
this.getCouponList(1, 10, 1)
} else if (current == 1) {
// 失效
this.getCouponList(1, 10, 0)
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() { },
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 可使用 已失效
this.getCouponList(1, 10, 1)
this.getCouponList(1, 10, 0)
},
handelPresentCouponDetail(e) {
let { cardno } = e.currentTarget.dataset
wxService.router(`/pages/couponDetail/couponDetail`).search({ cardno })
},
handelPresentCouponCode(e) {
let { cardno } = e.currentTarget.dataset
wxService.router(`/pages/couponCodeDetail/couponCodeDetail`).search({ cardno })
this.getContentDetail()
},
//获取优惠券列表
getCouponList(pageNo, pageSize, statusNum) {
wx.showLoading({
title: '加载中'
})
let params;
if (statusNum == 1) {
params = {
status: 1
}
if (pageNo == 1) {
this.setData({
pageNo: 1,
couponList: [], // 清空数据
})
}
} else {
params = {
statusNot: 1
}
if (pageNo == 1) {
this.setData({
invalidCouponList: [],
invalidPageNo: 1
})
}
}
wxService.post(`/coupon/coupon/listWithMember4Mina?number=${pageNo}&size=${pageSize}`, params).then(res => {
// 获取内容详情
getContentDetail(){
wxService.post(`/merchant/contentMobileTerminal/getContentParticulars?id=${this.data.id}`).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
// 处理时间显示
if (!data.content) return false
data.content.forEach(item => {
item.startTime = item.startTime.substring(0, 10)
item.endTime = item.endTime.substring(0, 10)
this.setData({
contentInfo: data
})
// 可使用 or 已失效
if (statusNum == 1) {
// couponList
this.setData({
couponList: this.data.pageNo == 1 ? [...data.content] : [...this.data.couponList, ...data.content],
totalPages: data.totalPages,
totalElements: data.totalElements
})
} else {
// invalidCouponList
this.setData({
invalidCouponList: this.data.invalidPageNo == 1 ? [...data.content] : [...this.data.invalidCouponList, ...data.content],
invalidTotalPages: data.totalPages,
invalidTotalElements: data.totalElements
})
}
this.getProList()
}
}).finally(() => {
wx.hideLoading();
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
// 可使用 0 or 已失效 1
const { currentTab, pageNo, pageSize, totalPages, invalidPageNo, invalidTotalPages } = this.data
if (currentTab == 0) {
if (pageNo < totalPages) {
this.setData({
pageNo: pageNo + 1,
})
// status 1
this.getCouponList(this.data.pageNo, pageSize, 1)
} else {
this.setData({
noMoreCoupon: true
})
}
} else {
if (invalidPageNo < invalidTotalPages) {
this.setData({
invalidPageNo: invalidPageNo + 1,
})
// status 0
this.getCouponList(this.data.invalidPageNo, pageSize, 0)
} else {
//获取内容下商品列表
getProList(){
var params = {
productIds: this.data.contentInfo.productIds
}
wxService.post(`/sale/product/buyer/listPageByCategoryId?pageNo=${this.data.pageNo}&pageSize=${this.data.pageSize}`, params).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
this.setData({
noMoreCouponInvalid: true
proList: data
})
}
}
},
}).finally(() => {
})
}
})
\ No newline at end of file
<view class='page-want-buy'>
<view class="swiper-tab">
<view class="swiper-tab-item {{currentTab==0?'active':''}}" data-current="0" bindtap="clickTab">达人</view>
<view class="swiper-tab-item {{currentTab==1?'active':''}}" data-current="1" bindtap="clickTab">精选</view>
</view>
<!--bindchange="swiperTab"-->
<swiper current="{{currentTab}}" duration="300" bindchange="swiperTab">
<swiper-item>
<buy-image-swiper bind:updatePage="updatePage" image-data="{{imageData}}"/>
<buy-image-swiper bind:updatePage="updatePage" image-data="{{contentInfo.shareShowPictureRESDTOList}}"/>
<view class="buy-desc">
<view>种草文案种草文案种草文案种草文案种草文案种草文案种草文案种草文案种</view>
<view>{{contentInfo.describe}}</view>
<view class="share-wrap">
<view class="share-oprate">
<image class="share-img" src="/assets/imgs/heart-default.png"></image>
<text class="share-number">689</text>
<image class="share-img" src="{{contentInfo.currentType ? '/assets/imgs/heart-primary.png' : '/assets/imgs/heart-default.png'}}"></image>
<text class="share-number">{{contentInfo.enjoySum || 0}}</text>
</view>
<view class="share-oprate">
<image class="share-img" src="/assets/imgs/share.png"></image>
<text class="share-number">298</text>
<text class="share-number">{{contentInfo.transmitSum || 0}}</text>
</view>
</view>
......@@ -54,10 +50,6 @@
</view>
</view>
</view>
</swiper-item>
<swiper-item>
22222
</swiper-item>
</swiper>
</view>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment