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