chore(组件): privacyPopup 组件全部使用注册机制
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
<ns-adv keyword="NS_ARTICLE" class-name="adv-wrap"></ns-adv>
|
||||
<view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)">
|
||||
<view class="article-img">
|
||||
<image class="cover-img" :src="$util.img(item.cover_img)" mode="widthFix" @error="imgError(index)"/>
|
||||
<image class="cover-img" :src="$util.img(item.cover_img)" mode="widthFix"
|
||||
@error="imgError(index)" />
|
||||
</view>
|
||||
<view class="info-wrap">
|
||||
<text class="title">{{ item.article_title }}</text>
|
||||
@@ -33,195 +34,184 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: []
|
||||
};
|
||||
},
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
onShow() {
|
||||
this.setPublicShare();
|
||||
},
|
||||
methods: {
|
||||
getData(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/article/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
|
||||
this.list = this.list.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail: res => {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: []
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.setPublicShare();
|
||||
},
|
||||
methods: {
|
||||
getData(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/article/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
toDetail(item) {
|
||||
this.$util.redirectTo('/pages_tool/article/detail', {
|
||||
article_id: item.article_id
|
||||
});
|
||||
},
|
||||
imgError(index) {
|
||||
if (this.list[index]) this.list[index].cover_img = this.$util.getDefaultImage().article;
|
||||
},
|
||||
// 设置公众号分享
|
||||
setPublicShare() {
|
||||
let shareUrl = this.$config.h5Domain + '/pages_tool/article/list';
|
||||
this.$util.setPublicShare({
|
||||
title: '文章列表',
|
||||
desc: '',
|
||||
link: shareUrl,
|
||||
imgUrl: this.siteInfo ? this.$util.img(this.siteInfo.logo_square) : ''
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
|
||||
this.list = this.list.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail: res => {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = '文章列表';
|
||||
var path = '/pages_tool/article/list';
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => {},
|
||||
fail: res => {}
|
||||
};
|
||||
toDetail(item) {
|
||||
this.$util.redirectTo('/pages_tool/article/detail', {
|
||||
article_id: item.article_id
|
||||
});
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline() {
|
||||
var title = '文章列表';
|
||||
var query = '/pages_tool/article/list';
|
||||
return {
|
||||
title: title,
|
||||
query: query,
|
||||
imageUrl: ''
|
||||
};
|
||||
imgError(index) {
|
||||
if (this.list[index]) this.list[index].cover_img = this.$util.getDefaultImage().article;
|
||||
},
|
||||
// 设置公众号分享
|
||||
setPublicShare() {
|
||||
let shareUrl = this.$config.h5Domain + '/pages_tool/article/list';
|
||||
this.$util.setPublicShare({
|
||||
title: '文章列表',
|
||||
desc: '',
|
||||
link: shareUrl,
|
||||
imgUrl: this.siteInfo ? this.$util.img(this.siteInfo.logo_square) : ''
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = '文章列表';
|
||||
var path = '/pages_tool/article/list';
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => { },
|
||||
fail: res => { }
|
||||
};
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline() {
|
||||
var title = '文章列表';
|
||||
var query = '/pages_tool/article/list';
|
||||
return {
|
||||
title: title,
|
||||
query: query,
|
||||
imageUrl: ''
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .fixed {
|
||||
position: relative;
|
||||
top: 0;
|
||||
/deep/ .fixed {
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.empty-wrap {
|
||||
padding-top: 200rpx;
|
||||
}
|
||||
|
||||
.article-wrap {
|
||||
background: #f8f8f8;
|
||||
|
||||
.adv-wrap {
|
||||
margin: 24rpx 24rpx 0 24rpx;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.empty-wrap {
|
||||
padding-top: 200rpx;
|
||||
}
|
||||
.item {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
margin: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
|
||||
.article-wrap {
|
||||
background: #f8f8f8;
|
||||
.article-img {
|
||||
margin-right: 20rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.adv-wrap {
|
||||
margin: 24rpx 24rpx 0 24rpx;
|
||||
width: auto;
|
||||
image {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
.info-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
margin: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.article-img {
|
||||
margin-right: 20rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
.title {
|
||||
font-weight: bold;
|
||||
margin-bottom: 10rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
}
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
font-size: 30rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.info-wrap {
|
||||
flex: 1;
|
||||
.abstract {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
|
||||
.read-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
color: #999ca7;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
line-height: 1;
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
margin-bottom: 10rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
font-size: 30rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.abstract {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
text {
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
|
||||
.read-wrap {
|
||||
display: flex;
|
||||
color: #999ca7;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
line-height: 1;
|
||||
.iconfont {
|
||||
font-size: 36rpx;
|
||||
vertical-align: bottom;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
.category-icon {
|
||||
width: 8rpx;
|
||||
height: 8rpx;
|
||||
border-radius: 50%;
|
||||
background: $base-color;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-size: 36rpx;
|
||||
vertical-align: bottom;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.category-icon {
|
||||
width: 8rpx;
|
||||
height: 8rpx;
|
||||
border-radius: 50%;
|
||||
background: $base-color;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.date {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.date {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,41 +2,23 @@
|
||||
<view>
|
||||
<view class="search-wrap uni-flex uni-row">
|
||||
<view class="flex-item input-wrap">
|
||||
<input
|
||||
class="uni-input"
|
||||
maxlength="50"
|
||||
placeholder="请输入您要搜索的文件名称"
|
||||
v-model="keyword"
|
||||
@confirm="search"
|
||||
@input="__set_model($event, 'keyword')"
|
||||
/>
|
||||
<input class="uni-input" maxlength="50" placeholder="请输入您要搜索的文件名称" v-model="keyword" @confirm="search"
|
||||
@input="__set_model($event, 'keyword')" />
|
||||
<text class="iconfont icon-sousuo3" @tap="search"></text>
|
||||
</view>
|
||||
</view>
|
||||
<mescroll-uni
|
||||
ref="mescroll"
|
||||
top="100"
|
||||
@getData="getData"
|
||||
>
|
||||
<mescroll-uni ref="mescroll" top="100" @getData="getData">
|
||||
<view slot="list">
|
||||
<block v-if="list.length > 0">
|
||||
<view class="article-wrap">
|
||||
<ns-adv
|
||||
keyword="NS_ARTICLE"
|
||||
class-name="adv-wrap"
|
||||
></ns-adv>
|
||||
<ns-adv keyword="NS_ARTICLE" class-name="adv-wrap"></ns-adv>
|
||||
<block v-for="(item, index) in list" :key="index">
|
||||
<view class="item" @tap="toDetail(item.$orig)">
|
||||
<view class="article-img">
|
||||
<image
|
||||
class="cover-img"
|
||||
:src="item.g1"
|
||||
mode="widthFix"
|
||||
@error="imgError(index)"
|
||||
></image>
|
||||
<image class="cover-img" :src="item.g1" mode="widthFix" @error="imgError(index)"></image>
|
||||
</view>
|
||||
<view class="info-wrap">
|
||||
<view class="title">{{item.$orig.files_title}}</view>
|
||||
<view class="title">{{ item.$orig.files_title }}</view>
|
||||
<view class="read-wrap">
|
||||
<text>查看PDF文件</text>
|
||||
</view>
|
||||
@@ -58,227 +40,231 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup,
|
||||
// #endif
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
category_id: '',
|
||||
list: [],
|
||||
title: '',
|
||||
keyword: ''
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.category_id > 0) {
|
||||
this.category_id = options.category_id
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
methods: {
|
||||
__set_model(event, field) {
|
||||
this[field] = event.detail.value
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
category_id: '',
|
||||
list: [],
|
||||
title: '',
|
||||
keyword: ''
|
||||
}
|
||||
search() {
|
||||
this.list = []
|
||||
this.$refs.mescroll.refresh()
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.category_id > 0) {
|
||||
this.category_id = options.category_id
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
methods: {
|
||||
__set_model(event, field) {
|
||||
this[field] = event.detail.value
|
||||
},
|
||||
search() {
|
||||
this.list = []
|
||||
this.$refs.mescroll.refresh()
|
||||
},
|
||||
getData(page) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/files/getpage',
|
||||
data: {
|
||||
page_size: page.size,
|
||||
page: page.num,
|
||||
category_id: this.category_id,
|
||||
keyword: this.keyword
|
||||
},
|
||||
success: res => {
|
||||
let list = []
|
||||
let message = res.message
|
||||
if (res.code === 0 && res.data) {
|
||||
list = res.data.list
|
||||
if (!this.title && res.data.list.length > 0) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.data.list[0].category_name
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: message
|
||||
getData(page) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/files/getpage',
|
||||
data: {
|
||||
page_size: page.size,
|
||||
page: page.num,
|
||||
category_id: this.category_id,
|
||||
keyword: this.keyword
|
||||
},
|
||||
success: res => {
|
||||
let list = []
|
||||
let message = res.message
|
||||
if (res.code === 0 && res.data) {
|
||||
list = res.data.list
|
||||
if (!this.title && res.data.list.length > 0) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.data.list[0].category_name
|
||||
})
|
||||
}
|
||||
page.endSuccess(list.length)
|
||||
if (page.num === 1) {
|
||||
this.list = []
|
||||
}
|
||||
this.list = this.list.concat(list.map(item => {
|
||||
const orig = item
|
||||
const g1 = this.$util.img("addon/personnel/shop/view/enterprise/fileicon.png")
|
||||
return { $orig: orig, g1: g1 }
|
||||
}))
|
||||
if (this.$refs.loadingCover) {
|
||||
this.$refs.loadingCover.hide()
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: message
|
||||
})
|
||||
}
|
||||
page.endSuccess(list.length)
|
||||
if (page.num === 1) {
|
||||
this.list = []
|
||||
}
|
||||
this.list = this.list.concat(list.map(item => {
|
||||
const orig = item
|
||||
const g1 = this.$util.img("addon/personnel/shop/view/enterprise/fileicon.png")
|
||||
return { $orig: orig, g1: g1 }
|
||||
}))
|
||||
if (this.$refs.loadingCover) {
|
||||
this.$refs.loadingCover.hide()
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
page.endErr()
|
||||
if (this.$refs.loadingCover) {
|
||||
this.$refs.loadingCover.hide()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
toDetail(item) {
|
||||
console.log(item.files_url)
|
||||
uni.showLoading({
|
||||
title: '正在加载'
|
||||
})
|
||||
try {
|
||||
uni.downloadFile({
|
||||
url: item.files_url,
|
||||
success: res => {
|
||||
console.log(res)
|
||||
if (res.statusCode === 200) {
|
||||
uni.openDocument({
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
console.log('打开成功')
|
||||
},
|
||||
fail: () => {
|
||||
},
|
||||
complete: () => {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
page.endErr()
|
||||
if (this.$refs.loadingCover) {
|
||||
this.$refs.loadingCover.hide()
|
||||
uni.hideLoading()
|
||||
},
|
||||
complete: res => {
|
||||
console.log('下载完成', res)
|
||||
if (res.statusCode === 404) {
|
||||
uni.showToast({
|
||||
title: '文件不存在',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
toDetail(item) {
|
||||
console.log(item.files_url)
|
||||
uni.showLoading({
|
||||
title: '正在加载'
|
||||
})
|
||||
try {
|
||||
uni.downloadFile({
|
||||
url: item.files_url,
|
||||
success: res => {
|
||||
console.log(res)
|
||||
if (res.statusCode === 200) {
|
||||
uni.openDocument({
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
console.log('打开成功')
|
||||
},
|
||||
fail: () => {
|
||||
},
|
||||
complete: () => {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading()
|
||||
},
|
||||
complete: res => {
|
||||
console.log('下载完成', res)
|
||||
if (res.statusCode === 404) {
|
||||
uni.showToast({
|
||||
title: '文件不存在',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
console.log('CatchClause', e)
|
||||
uni.hideLoading()
|
||||
}
|
||||
},
|
||||
imgError(index) {
|
||||
if (this.list[index]) {
|
||||
this.list[index].cover_img = this.$util.getDefaultImage().article
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('CatchClause', e)
|
||||
uni.hideLoading()
|
||||
}
|
||||
},
|
||||
imgError(index) {
|
||||
if (this.list[index]) {
|
||||
this.list[index].cover_img = this.$util.getDefaultImage().article
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.search-wrap {
|
||||
flex: 0.5;
|
||||
padding: 30rpx 30rpx 0;
|
||||
font-size: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.search-wrap .iconfont {
|
||||
margin-left: 16rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
.search-wrap .input-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
height: 64rpx;
|
||||
padding-left: 10rpx;
|
||||
border-radius: 70rpx;
|
||||
}
|
||||
.search-wrap .input-wrap input {
|
||||
width: 90%;
|
||||
background: #fff;
|
||||
font-size: 24rpx;
|
||||
height: 100%;
|
||||
padding: 0 25rpx 0 40rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
.search-wrap .input-wrap text {
|
||||
font-size: 32rpx;
|
||||
color: #909399;
|
||||
width: 80rpx;
|
||||
text-align: center;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.empty-wrap {
|
||||
padding-top: 200rpx;
|
||||
}
|
||||
.article-wrap {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
.article-wrap .adv-wrap {
|
||||
margin: 24rpx 24rpx 0 24rpx;
|
||||
width: auto;
|
||||
}
|
||||
.article-wrap .item {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
margin: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.article-wrap .item .article-img {
|
||||
margin-right: 20rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.article-wrap .item .article-img image {
|
||||
width: 100%;
|
||||
}
|
||||
.article-wrap .item .info-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.article-wrap .item .info-wrap .title {
|
||||
font-weight: 700;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.article-wrap .item .info-wrap .read-wrap {
|
||||
display: flex;
|
||||
color: #999ca7;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
.article-wrap .item .info-wrap .read-wrap text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.search-wrap {
|
||||
flex: 0.5;
|
||||
padding: 30rpx 30rpx 0;
|
||||
font-size: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-wrap .iconfont {
|
||||
margin-left: 16rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.search-wrap .input-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
height: 64rpx;
|
||||
padding-left: 10rpx;
|
||||
border-radius: 70rpx;
|
||||
}
|
||||
|
||||
.search-wrap .input-wrap input {
|
||||
width: 90%;
|
||||
background: #fff;
|
||||
font-size: 24rpx;
|
||||
height: 100%;
|
||||
padding: 0 25rpx 0 40rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
|
||||
.search-wrap .input-wrap text {
|
||||
font-size: 32rpx;
|
||||
color: #909399;
|
||||
width: 80rpx;
|
||||
text-align: center;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.empty-wrap {
|
||||
padding-top: 200rpx;
|
||||
}
|
||||
|
||||
.article-wrap {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.article-wrap .adv-wrap {
|
||||
margin: 24rpx 24rpx 0 24rpx;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.article-wrap .item {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
margin: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.article-wrap .item .article-img {
|
||||
margin-right: 20rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.article-wrap .item .article-img image {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.article-wrap .item .info-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.article-wrap .item .info-wrap .title {
|
||||
font-weight: 700;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.article-wrap .item .info-wrap .read-wrap {
|
||||
display: flex;
|
||||
color: #999ca7;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.article-wrap .item .info-wrap .read-wrap text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -24,104 +24,94 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
brandList: [],
|
||||
siteId: 0
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.site_id) this.siteId = options.site_id;
|
||||
},
|
||||
onShow() { },
|
||||
methods: {
|
||||
change(e) {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
brand_id: this.brandList[e.detail.index].brand_id
|
||||
});
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
brandList: [],
|
||||
siteId: 0
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.site_id) this.siteId = options.site_id;
|
||||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
change(e) {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
brand_id: this.brandList[e.detail.index].brand_id
|
||||
});
|
||||
},
|
||||
getBrandList(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/goodsbrand/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num,
|
||||
site_id: this.siteId
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.brandList = []; //如果是第一页需手动制空列表
|
||||
this.brandList = this.brandList.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail() {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
getBrandList(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/goodsbrand/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num,
|
||||
site_id: this.siteId
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = '你想要的大牌都在这里';
|
||||
var path = '/pages_tool/goods/brand';
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => {},
|
||||
fail: res => {}
|
||||
};
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.brandList = []; //如果是第一页需手动制空列表
|
||||
this.brandList = this.brandList.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail() {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var title = '你想要的大牌都在这里';
|
||||
var path = '/pages_tool/goods/brand';
|
||||
return {
|
||||
title: title,
|
||||
path: path,
|
||||
success: res => { },
|
||||
fail: res => { }
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/deep/ .uni-grid-item {
|
||||
width: calc((100vw - (#{$margin-both} * 2)) / 3) !important;
|
||||
/deep/ .uni-grid-item {
|
||||
width: calc((100vw - (#{$margin-both} * 2)) / 3) !important;
|
||||
}
|
||||
|
||||
.adv-wrap {
|
||||
margin: $margin-updown $margin-both;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.brand-content {
|
||||
padding: $padding 0;
|
||||
box-sizing: border-box;
|
||||
background: #ffffff;
|
||||
margin: $margin-updown $margin-both 0;
|
||||
|
||||
.brand-pic {
|
||||
width: 60%;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.adv-wrap {
|
||||
margin: $margin-updown $margin-both;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.brand-content {
|
||||
padding: $padding 0;
|
||||
box-sizing: border-box;
|
||||
background: #ffffff;
|
||||
margin: $margin-updown $margin-both 0;
|
||||
|
||||
.brand-pic {
|
||||
width: 60%;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.brand_name {
|
||||
width: 70%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
.brand_name {
|
||||
width: 70%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,42 +2,53 @@
|
||||
<view :style="themeColor">
|
||||
<view class="cf-container color-line-border">
|
||||
<view class="tab">
|
||||
<view @click="changeSort(1)"><text :class="sort == 1 ? 'color-base-text active color-base-border-bottom' : ''">全部</text></view>
|
||||
<view @click="changeSort(2, 'reward')"><text :class="sort == 2 ? 'color-base-text active color-base-border-bottom' : ''">满减券</text></view>
|
||||
<view @click="changeSort(3, 'discount')"><text :class="sort == 3 ? 'color-base-text active color-base-border-bottom' : ''">折扣券</text></view>
|
||||
<!-- <view @click="changeSort(4, 'no_threshold')"><text :class="sort == 4 ? 'color-base-text active color-base-border-bottom' : ''">无门槛券</text></view> -->
|
||||
<view @click="changeSort(1)"><text
|
||||
:class="sort == 1 ? 'color-base-text active color-base-border-bottom' : ''">全部</text></view>
|
||||
<view @click="changeSort(2, 'reward')"><text
|
||||
:class="sort == 2 ? 'color-base-text active color-base-border-bottom' : ''">满减券</text></view>
|
||||
<view @click="changeSort(3, 'discount')"><text
|
||||
:class="sort == 3 ? 'color-base-text active color-base-border-bottom' : ''">折扣券</text></view>
|
||||
<!-- <view @click="changeSort(4, 'no_threshold')"><text :class="sort == 4 ? 'color-base-text active color-base-border-bottom' : ''">无门槛券</text></view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<mescroll-uni ref="mescroll" top="100" @getData="getMemberCouponList">
|
||||
<block slot="list">
|
||||
<view class="coupon-listone">
|
||||
<view class="item" v-for="(item, index) in list" :key="index" @click="liClick(item, index)" :style="{ backgroundColor: item.useState == 2 ? '#F2F2F2' : 'var(--main-color-shallow)' }">
|
||||
<view class="item" v-for="(item, index) in list" :key="index" @click="liClick(item, index)"
|
||||
:style="{ backgroundColor: item.useState == 2 ? '#F2F2F2' : 'var(--main-color-shallow)' }">
|
||||
<view class="item-base" :class="{ disabled: item.useState == 2 }">
|
||||
<image class="coupon-line" mode="heightFix" :src="$util.img('public/uniapp/coupon/coupon_line.png')"></image>
|
||||
<image class="coupon-line" mode="heightFix"
|
||||
:src="$util.img('public/uniapp/coupon/coupon_line.png')"></image>
|
||||
<view>
|
||||
<view class="use_price price-font" v-if="item.type == 'reward'" :class="{ disabled: item.useState == 2 }">
|
||||
<view class="use_price price-font" v-if="item.type == 'reward'"
|
||||
:class="{ disabled: item.useState == 2 }">
|
||||
<text>¥</text>
|
||||
{{ parseFloat(item.money) }}
|
||||
</view>
|
||||
<view class="use_price price-font" v-else-if="item.type == 'discount'" :class="{ disabled: item.useState == 2 }">
|
||||
<view class="use_price price-font" v-else-if="item.type == 'discount'"
|
||||
:class="{ disabled: item.useState == 2 }">
|
||||
{{ parseFloat(item.discount) }}
|
||||
<text>折</text>
|
||||
</view>
|
||||
<view class="use_condition font-size-tag" v-if="item.at_least > 0" :class="{ disabled: item.useState == 2 }">满{{ item.at_least }}元可用</view>
|
||||
<view class="use_condition font-size-tag" v-else :class="{ disabled: item.useState == 2 }">无门槛优惠券</view>
|
||||
<view class="use_condition font-size-tag" v-if="item.at_least > 0"
|
||||
:class="{ disabled: item.useState == 2 }">满{{ item.at_least }}元可用</view>
|
||||
<view class="use_condition font-size-tag" v-else
|
||||
:class="{ disabled: item.useState == 2 }">无门槛优惠券</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-info">
|
||||
<view class="use_title">
|
||||
<view class="title">{{ item.coupon_name }}</view>
|
||||
<view class="max_price" v-if="item.goods_type == 2 || item.goods_type == 3" :class="{ disabled: item.useState == 2 }">指定商品</view>
|
||||
<view class="max_price" v-if="item.goods_type == 2 || item.goods_type == 3"
|
||||
:class="{ disabled: item.useState == 2 }">指定商品</view>
|
||||
<view class="max_price" v-else :class="{ disabled: item.useState == 2 }">全场商品</view>
|
||||
<view class="max_price" v-if="item.discount_limit != '0.00'">
|
||||
(最大优惠{{ item.discount_limit }}元)
|
||||
</view>
|
||||
<view class="max_price" :class="{ disabled: item.useState == 2 }">{{ item.use_channel_name }}</view>
|
||||
<!-- <view class="max_price truncate" v-if="item.use_channel!='online'" :class="{ disabled: item.useState == 2 }">
|
||||
<view class="max_price" :class="{ disabled: item.useState == 2 }">{{
|
||||
item.use_channel_name }}</view>
|
||||
<!-- <view class="max_price truncate" v-if="item.use_channel!='online'" :class="{ disabled: item.useState == 2 }">
|
||||
{{ item.use_store==='all'?'适用门店:全部门店': '适用门店:'+item.use_store_name}}
|
||||
</view> -->
|
||||
</view>
|
||||
@@ -70,400 +81,391 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
sort: 1,
|
||||
types: '',
|
||||
couponBtnSwitch: false,
|
||||
//分享建立上下级id
|
||||
mpShareData: null //小程序分享数据
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
setTimeout( () => {
|
||||
if (!this.addonIsExist.coupon) {
|
||||
this.$util.showToast({
|
||||
title: '商家未开启优惠券',
|
||||
mask: true,
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
|
||||
//小程序分享接收source_member
|
||||
if (option.source_member) {
|
||||
uni.setStorageSync('source_member', option.source_member);
|
||||
}
|
||||
// 小程序扫码进入,接收source_member
|
||||
if (option.scene) {
|
||||
var sceneParams = decodeURIComponent(option.scene);
|
||||
sceneParams = sceneParams.split('&');
|
||||
if (sceneParams.length) {
|
||||
sceneParams.forEach(item => {
|
||||
if (item.indexOf('sku_id') != -1) this.skuId = item.split('-')[1];
|
||||
if (item.indexOf('m') != -1) uni.setStorageSync('source_member', item.split('-')[1]);
|
||||
if (item.indexOf('is_test') != -1) uni.setStorageSync('is_test', 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
//记录分享关系
|
||||
if (this.storeToken && uni.getStorageSync('source_member')) {
|
||||
this.$util.onSourceMember(uni.getStorageSync('source_member'));
|
||||
}
|
||||
|
||||
//小程序分享
|
||||
// #ifdef MP-WEIXIN
|
||||
this.$util.getMpShare().then(res => {
|
||||
this.mpShareData = res;
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
//分享给好友
|
||||
onShareAppMessage() {
|
||||
return this.mpShareData.appMessage;
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline() {
|
||||
return this.mpShareData.timeLine;
|
||||
},
|
||||
methods: {
|
||||
changeSort(sort, types) {
|
||||
this.list = [];
|
||||
this.sort = sort;
|
||||
this.types = types;
|
||||
this.$refs.mescroll.refresh(false);
|
||||
},
|
||||
liClick(item, index) {
|
||||
if(['limit', 'expire', 'out'].includes(item.receivedType)) return false;
|
||||
if (item.useState == 0) this.receiveCoupon(item, index);
|
||||
else this.toGoodsList(item, index);
|
||||
},
|
||||
|
||||
//领取优惠券
|
||||
receiveCoupon(item, index) {
|
||||
if (this.couponBtnSwitch) return;
|
||||
this.couponBtnSwitch = true;
|
||||
if (this.storeToken) {
|
||||
this.$api.sendRequest({
|
||||
url: '/coupon/api/coupon/receive',
|
||||
data: {
|
||||
coupon_type_id: item.coupon_type_id,
|
||||
get_type: 2 //获取方式:1订单2.直接领取3.活动领取
|
||||
},
|
||||
success: res => {
|
||||
this.couponBtnSwitch = false;
|
||||
let msg = '领取成功,快去使用吧';
|
||||
let list = this.list;
|
||||
if (res.code < 0) msg = res.message;
|
||||
|
||||
if (res.data.is_exist == 1) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].coupon_type_id == item.coupon_type_id) {
|
||||
list[i].useState = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].coupon_type_id == item.coupon_type_id) {
|
||||
list[i].receivedType = res.data.type;
|
||||
list[i].useState = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
},
|
||||
fail: res => {
|
||||
this.couponBtnSwitch = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.couponBtnSwitch = false;
|
||||
this.$refs.login.open('/pages_tool/goods/coupon');
|
||||
}
|
||||
},
|
||||
//获取优惠券列表
|
||||
getMemberCouponList(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/coupon/api/coupon/typepagelists',
|
||||
data: {
|
||||
page: mescroll.num,
|
||||
page_size: mescroll.size,
|
||||
sort: this.sort,
|
||||
type: this.types
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
if (newArr.length) {
|
||||
newArr.forEach(v => {
|
||||
if (v.count == v.lead_count) v.useState = 2;
|
||||
else if (v.max_fetch != 0 && v.member_coupon_num && v.member_coupon_num >= v.max_fetch) v.useState = 1;
|
||||
else v.useState = 0;
|
||||
});
|
||||
}
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
|
||||
this.list = this.list.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail() {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
sort: 1,
|
||||
types: '',
|
||||
couponBtnSwitch: false,
|
||||
//分享建立上下级id
|
||||
mpShareData: null //小程序分享数据
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
setTimeout(() => {
|
||||
if (!this.addonIsExist.coupon) {
|
||||
this.$util.showToast({
|
||||
title: '商家未开启优惠券',
|
||||
mask: true,
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
//小程序分享接收source_member
|
||||
if (option.source_member) {
|
||||
uni.setStorageSync('source_member', option.source_member);
|
||||
}
|
||||
// 小程序扫码进入,接收source_member
|
||||
if (option.scene) {
|
||||
var sceneParams = decodeURIComponent(option.scene);
|
||||
sceneParams = sceneParams.split('&');
|
||||
if (sceneParams.length) {
|
||||
sceneParams.forEach(item => {
|
||||
if (item.indexOf('sku_id') != -1) this.skuId = item.split('-')[1];
|
||||
if (item.indexOf('m') != -1) uni.setStorageSync('source_member', item.split('-')[1]);
|
||||
if (item.indexOf('is_test') != -1) uni.setStorageSync('is_test', 1);
|
||||
});
|
||||
},
|
||||
imageError(index) {
|
||||
this.list[index].logo = this.$util.getDefaultImage().goods;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
couponImageError(index) {
|
||||
this.list[index].image = this.$util.img('public/uniapp/goods/coupon.png');
|
||||
this.$forceUpdate();
|
||||
},
|
||||
toGoodsList(item) {
|
||||
if (item.goods_type != 1) {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
coupon: item.coupon_type_id
|
||||
});
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_goods/list', {});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
//记录分享关系
|
||||
if (this.storeToken && uni.getStorageSync('source_member')) {
|
||||
this.$util.onSourceMember(uni.getStorageSync('source_member'));
|
||||
}
|
||||
|
||||
//小程序分享
|
||||
// #ifdef MP-WEIXIN
|
||||
this.$util.getMpShare().then(res => {
|
||||
this.mpShareData = res;
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
//分享给好友
|
||||
onShareAppMessage() {
|
||||
return this.mpShareData.appMessage;
|
||||
},
|
||||
//分享到朋友圈
|
||||
onShareTimeline() {
|
||||
return this.mpShareData.timeLine;
|
||||
},
|
||||
methods: {
|
||||
changeSort(sort, types) {
|
||||
this.list = [];
|
||||
this.sort = sort;
|
||||
this.types = types;
|
||||
this.$refs.mescroll.refresh(false);
|
||||
},
|
||||
liClick(item, index) {
|
||||
if (['limit', 'expire', 'out'].includes(item.receivedType)) return false;
|
||||
if (item.useState == 0) this.receiveCoupon(item, index);
|
||||
else this.toGoodsList(item, index);
|
||||
},
|
||||
|
||||
//领取优惠券
|
||||
receiveCoupon(item, index) {
|
||||
if (this.couponBtnSwitch) return;
|
||||
this.couponBtnSwitch = true;
|
||||
if (this.storeToken) {
|
||||
this.$api.sendRequest({
|
||||
url: '/coupon/api/coupon/receive',
|
||||
data: {
|
||||
coupon_type_id: item.coupon_type_id,
|
||||
get_type: 2 //获取方式:1订单2.直接领取3.活动领取
|
||||
},
|
||||
success: res => {
|
||||
this.couponBtnSwitch = false;
|
||||
let msg = '领取成功,快去使用吧';
|
||||
let list = this.list;
|
||||
if (res.code < 0) msg = res.message;
|
||||
|
||||
if (res.data.is_exist == 1) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].coupon_type_id == item.coupon_type_id) {
|
||||
list[i].useState = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].coupon_type_id == item.coupon_type_id) {
|
||||
list[i].receivedType = res.data.type;
|
||||
list[i].useState = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
},
|
||||
fail: res => {
|
||||
this.couponBtnSwitch = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.couponBtnSwitch = false;
|
||||
this.$refs.login.open('/pages_tool/goods/coupon');
|
||||
}
|
||||
},
|
||||
//获取优惠券列表
|
||||
getMemberCouponList(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/coupon/api/coupon/typepagelists',
|
||||
data: {
|
||||
page: mescroll.num,
|
||||
page_size: mescroll.size,
|
||||
sort: this.sort,
|
||||
type: this.types
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
if (newArr.length) {
|
||||
newArr.forEach(v => {
|
||||
if (v.count == v.lead_count) v.useState = 2;
|
||||
else if (v.max_fetch != 0 && v.member_coupon_num && v.member_coupon_num >= v.max_fetch) v.useState = 1;
|
||||
else v.useState = 0;
|
||||
});
|
||||
}
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
|
||||
this.list = this.list.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail() {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
imageError(index) {
|
||||
this.list[index].logo = this.$util.getDefaultImage().goods;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
couponImageError(index) {
|
||||
this.list[index].image = this.$util.img('public/uniapp/goods/coupon.png');
|
||||
this.$forceUpdate();
|
||||
},
|
||||
toGoodsList(item) {
|
||||
if (item.goods_type != 1) {
|
||||
this.$util.redirectTo('/pages_goods/list', {
|
||||
coupon: item.coupon_type_id
|
||||
});
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_goods/list', {});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.coupon-head {
|
||||
padding: 20rpx 50rpx;
|
||||
display: flex;
|
||||
background: #fff;
|
||||
.coupon-head {
|
||||
padding: 20rpx 50rpx;
|
||||
display: flex;
|
||||
background: #fff;
|
||||
|
||||
.sort {
|
||||
border: 2rpx solid #c5c5c5;
|
||||
padding: 1rpx 20rpx;
|
||||
border-radius: $border-radius;
|
||||
cursor: pointer;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
.sort {
|
||||
border: 2rpx solid #c5c5c5;
|
||||
padding: 1rpx 20rpx;
|
||||
border-radius: $border-radius;
|
||||
cursor: pointer;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-listone {
|
||||
padding: 0 30rpx;
|
||||
.coupon-listone {
|
||||
padding: 0 30rpx;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
background-color: #fff2f0;
|
||||
.item {
|
||||
display: flex;
|
||||
background-color: #fff2f0;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 20rpx;
|
||||
align-items: stretch;
|
||||
margin-top: $padding;
|
||||
overflow: hidden;
|
||||
|
||||
.item-base {
|
||||
position: relative;
|
||||
width: 197rpx;
|
||||
min-width: 197rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient(to left, var(--bg-color), var(--bg-color-shallow));
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 20rpx;
|
||||
align-items: stretch;
|
||||
margin-top: $padding;
|
||||
overflow: hidden;
|
||||
padding: 38rpx 10rpx 38rpx 18rpx;
|
||||
|
||||
.item-base {
|
||||
&.disabled {
|
||||
background: #dedede;
|
||||
}
|
||||
|
||||
.coupon-line {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
>view {
|
||||
height: auto;
|
||||
position: relative;
|
||||
width: 197rpx;
|
||||
min-width: 197rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient(to left, var(--bg-color), var(--bg-color-shallow));
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
padding: 38rpx 10rpx 38rpx 18rpx;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
|
||||
.use_price {
|
||||
font-size: 60rpx;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
|
||||
text {
|
||||
font-size: $font-size-toolbar;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
background: #dedede;
|
||||
}
|
||||
|
||||
.coupon-line {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
>view {
|
||||
height: auto;
|
||||
position: relative;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
|
||||
.use_price {
|
||||
font-size: 60rpx;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
|
||||
text {
|
||||
font-size: $font-size-toolbar;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
|
||||
.use_condition {
|
||||
color: #fff;
|
||||
margin-top: $padding;
|
||||
|
||||
&.margin_top_none {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
background-color: #f8f8f8;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
height: 30rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 0 30rpx 30rpx 0;
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
|
||||
.item-btn {
|
||||
width: 160rpx;
|
||||
min-width: 160rpx;
|
||||
align-self: center;
|
||||
position: relative;
|
||||
.use_condition {
|
||||
color: #fff;
|
||||
margin-top: $padding;
|
||||
|
||||
view {
|
||||
width: 100rpx;
|
||||
height: 50rpx;
|
||||
border-radius: $border-radius;
|
||||
line-height: 50rpx;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
background-image: linear-gradient(to right, var(--bg-color), var(--bg-color-shallow));
|
||||
color: var(--btn-text-color);
|
||||
&.margin_top_none {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
background-color: #f8f8f8;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
height: 30rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 0 30rpx 30rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.item-btn {
|
||||
width: 160rpx;
|
||||
min-width: 160rpx;
|
||||
align-self: center;
|
||||
position: relative;
|
||||
|
||||
view {
|
||||
width: 100rpx;
|
||||
height: 50rpx;
|
||||
border-radius: $border-radius;
|
||||
line-height: 50rpx;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
background-image: linear-gradient(to right, var(--bg-color), var(--bg-color-shallow));
|
||||
color: var(--btn-text-color);
|
||||
font-size: $font-size-tag;
|
||||
|
||||
&.disabled {
|
||||
background: #dedede !important;
|
||||
color: #909399 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
background-color: #f8f8f8;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
height: 30rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 30rpx 0 0 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-left: 20rpx;
|
||||
overflow: hidden;
|
||||
background-repeat-x: no-repeat;
|
||||
background-repeat-y: repeat;
|
||||
|
||||
.use_time {
|
||||
padding: 20rpx 0;
|
||||
border-top: 2rpx dashed #cccccc;
|
||||
font-size: $font-size-activity-tag;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.use_title {
|
||||
font-size: $font-size-base;
|
||||
font-weight: 500;
|
||||
padding: 20rpx 0;
|
||||
|
||||
// height:80rpx;
|
||||
.title {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.max_price {
|
||||
font-weight: 400;
|
||||
font-size: $font-size-tag;
|
||||
|
||||
&.disabled {
|
||||
background: #dedede !important;
|
||||
color: #909399 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
background-color: #f8f8f8;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
height: 30rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 30rpx 0 0 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-left: 20rpx;
|
||||
overflow: hidden;
|
||||
background-repeat-x: no-repeat;
|
||||
background-repeat-y: repeat;
|
||||
|
||||
.use_time {
|
||||
padding: 20rpx 0;
|
||||
border-top: 2rpx dashed #cccccc;
|
||||
font-size: $font-size-activity-tag;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.use_title {
|
||||
font-size: $font-size-base;
|
||||
font-weight: 500;
|
||||
padding: 20rpx 0;
|
||||
|
||||
// height:80rpx;
|
||||
.title {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.max_price {
|
||||
font-weight: 400;
|
||||
font-size: $font-size-tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.empty {
|
||||
margin-top: 200rpx;
|
||||
}
|
||||
.empty {
|
||||
margin-top: 200rpx;
|
||||
}
|
||||
|
||||
.cf-container {
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
.cf-container {
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.tab {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 86rpx;
|
||||
|
||||
>view {
|
||||
text-align: center;
|
||||
width: 33%;
|
||||
height: 86rpx;
|
||||
|
||||
>view {
|
||||
text-align: center;
|
||||
width: 33%;
|
||||
height: 86rpx;
|
||||
|
||||
text {
|
||||
display: inline-block;
|
||||
line-height: 86rpx;
|
||||
height: 80rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
text {
|
||||
display: inline-block;
|
||||
line-height: 86rpx;
|
||||
height: 80rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.active {
|
||||
border-bottom: 4rpx solid;
|
||||
}
|
||||
.truncate {
|
||||
overflow: hidden;
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.active {
|
||||
border-bottom: 4rpx solid;
|
||||
}
|
||||
|
||||
.truncate {
|
||||
overflow: hidden;
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
@@ -74,19 +74,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
goodsId: 0,
|
||||
|
||||
@@ -67,18 +67,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataList: [], //账号列表
|
||||
|
||||
@@ -100,18 +100,8 @@
|
||||
import {
|
||||
Weixin
|
||||
} from 'common/js/wx-jssdk.js';
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
addressList: [],
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<text class="uni-tab-item-title" :class="statusIndex == orderStatus ? 'uni-tab-item-title-active' : ''">{{ statusItem.name }}</text>
|
||||
</view>
|
||||
</scroll-view> -->
|
||||
<!-- <view class="tab color-bg">
|
||||
<!-- <view class="tab color-bg">
|
||||
<view class="tab-left">
|
||||
<picker mode="date" :value="searchType.date" @change="bindDateChange" fields="month">
|
||||
<view class="uni-input">
|
||||
@@ -27,15 +27,18 @@
|
||||
<block v-if="dataList.length > 0">
|
||||
<view class="detailed-wrap">
|
||||
<view class="balances" v-for="(item, index) in dataList" :key="index">
|
||||
<image :src="$util.img('public/uniapp/balance/recharge.png')" class="balances-img" v-if="item.account_data > 0"></image>
|
||||
<image v-else :src="$util.img('public/uniapp/balance/shopping.png')" mode="widthFix"></image>
|
||||
<image :src="$util.img('public/uniapp/balance/recharge.png')" class="balances-img"
|
||||
v-if="item.account_data > 0"></image>
|
||||
<image v-else :src="$util.img('public/uniapp/balance/shopping.png')" mode="widthFix">
|
||||
</image>
|
||||
<view class="balances-info" @click="toFromDetail(item)">
|
||||
<text class="title">{{ item.remark }}</text>
|
||||
<!-- <text>{{ item.remark }}</text> -->
|
||||
<!-- <text>{{ item.remark }}</text> -->
|
||||
<text>{{ $util.timeStampTurnTime(item.create_time) }}</text>
|
||||
</view>
|
||||
<view class="balances-num">
|
||||
<text :class="item.account_data > 0 ? 'color-base-text' : ''">{{ item.account_data > 0 ? '+' + item.account_data : item.account_data }}元</text>
|
||||
<text :class="item.account_data > 0 ? 'color-base-text' : ''">{{ item.account_data > 0 ?
|
||||
'+' + item.account_data : item.account_data }}元</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -51,318 +54,309 @@
|
||||
|
||||
<script>
|
||||
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
data() {
|
||||
const currentDate = this.getDate({
|
||||
format: true
|
||||
});
|
||||
return {
|
||||
dataList: [],
|
||||
statusList: [{
|
||||
name: '全部',
|
||||
id: '0'
|
||||
}, {
|
||||
name: '收入',
|
||||
id: '1'
|
||||
}, {
|
||||
name: '支出',
|
||||
id: '2'
|
||||
}],
|
||||
scrollInto: '',
|
||||
orderStatus: '0',
|
||||
date: currentDate,
|
||||
searchType: {
|
||||
from_type: 0,
|
||||
date: ''
|
||||
},
|
||||
balanceType: [{
|
||||
label: '全部',
|
||||
value: '0'
|
||||
}], //积分类型
|
||||
balanceIndex: 0,
|
||||
related_id: 0
|
||||
};
|
||||
},
|
||||
data() {
|
||||
const currentDate = this.getDate({
|
||||
format: true
|
||||
onLoad(option) {
|
||||
if (option.group_id) this.related_id = option.group_id ? option.group_id : 0;
|
||||
if (option.from_type) this.searchType.from_type = option.from_type;
|
||||
if (option.related_id) this.related_id = option.related_id ? option.related_id : 0;
|
||||
if (option.status) this.orderStatus = option.status;
|
||||
this.getbalanceType();
|
||||
},
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/balance');
|
||||
});
|
||||
return {
|
||||
dataList: [],
|
||||
statusList: [{
|
||||
name: '全部',
|
||||
id: '0'
|
||||
}, {
|
||||
name: '收入',
|
||||
id: '1'
|
||||
}, {
|
||||
name: '支出',
|
||||
id: '2'
|
||||
}],
|
||||
scrollInto: '',
|
||||
orderStatus: '0',
|
||||
date: currentDate,
|
||||
searchType: {
|
||||
from_type: 0,
|
||||
date: ''
|
||||
},
|
||||
balanceType: [{
|
||||
label: '全部',
|
||||
value: '0'
|
||||
}], //积分类型
|
||||
balanceIndex: 0,
|
||||
related_id: 0
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
bindDateChange: function (e) {
|
||||
var temp = e.target.value;
|
||||
var tempArr = temp.split('-');
|
||||
this.date = tempArr[0] + '年' + tempArr[1] + '月';
|
||||
this.searchType.date = e.target.value;
|
||||
this.$refs.mescroll.refresh();
|
||||
},
|
||||
onLoad(option) {
|
||||
if (option.group_id) this.related_id = option.group_id ? option.group_id : 0;
|
||||
if (option.from_type) this.searchType.from_type = option.from_type;
|
||||
if (option.related_id) this.related_id = option.related_id ? option.related_id : 0;
|
||||
if (option.status) this.orderStatus = option.status;
|
||||
this.getbalanceType();
|
||||
},
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/balance');
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
bindDateChange: function(e) {
|
||||
var temp = e.target.value;
|
||||
var tempArr = temp.split('-');
|
||||
this.date = tempArr[0] + '年' + tempArr[1] + '月';
|
||||
this.searchType.date = e.target.value;
|
||||
this.$refs.mescroll.refresh();
|
||||
},
|
||||
getDate(type) {
|
||||
const date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
getDate(type) {
|
||||
const date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
|
||||
if (type === 'start') {
|
||||
year = year - 60;
|
||||
} else if (type === 'end') {
|
||||
year = year + 2;
|
||||
}
|
||||
month = month > 9 ? month : '0' + month;
|
||||
day = day > 9 ? day : '0' + day;
|
||||
return `${year}年${month}月`;
|
||||
},
|
||||
bindPickerChange(e) {
|
||||
this.balanceIndex = e.detail.value;
|
||||
this.searchType.from_type = this.balanceType[this.balanceIndex].value;
|
||||
this.$refs.mescroll.refresh();
|
||||
},
|
||||
//获取分类类型
|
||||
getbalanceType() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/memberaccount/fromType',
|
||||
success: res => {
|
||||
let balanceType = Object.assign(res.balance, res.balance_money),
|
||||
typeArr = [{
|
||||
label: '全部',
|
||||
value: '0'
|
||||
}];
|
||||
for (var index in balanceType) {
|
||||
typeArr.push({
|
||||
label: balanceType[index].type_name,
|
||||
value: index
|
||||
})
|
||||
}
|
||||
this.balanceType = typeArr;
|
||||
if (type === 'start') {
|
||||
year = year - 60;
|
||||
} else if (type === 'end') {
|
||||
year = year + 2;
|
||||
}
|
||||
month = month > 9 ? month : '0' + month;
|
||||
day = day > 9 ? day : '0' + day;
|
||||
return `${year}年${month}月`;
|
||||
},
|
||||
bindPickerChange(e) {
|
||||
this.balanceIndex = e.detail.value;
|
||||
this.searchType.from_type = this.balanceType[this.balanceIndex].value;
|
||||
this.$refs.mescroll.refresh();
|
||||
},
|
||||
//获取分类类型
|
||||
getbalanceType() {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/memberaccount/fromType',
|
||||
success: res => {
|
||||
let balanceType = Object.assign(res.balance, res.balance_money),
|
||||
typeArr = [{
|
||||
label: '全部',
|
||||
value: '0'
|
||||
}];
|
||||
for (var index in balanceType) {
|
||||
typeArr.push({
|
||||
label: balanceType[index].type_name,
|
||||
value: index
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
ontabtap(e) {
|
||||
let index = e.currentTarget.dataset.current;
|
||||
this.orderStatus = this.statusList[index].id;
|
||||
this.$refs.mescroll.refresh();
|
||||
},
|
||||
getData(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/memberaccount/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num,
|
||||
account_type: 'balance,balance_money',
|
||||
from_type: this.searchType.from_type,
|
||||
date: this.searchType.date,
|
||||
related_id: this.related_id
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) {
|
||||
this.dataList = []; //如果是第一页需手动制空列表
|
||||
this.related_id = 0;
|
||||
}
|
||||
this.dataList = this.dataList.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail: res => {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
toFromDetail(item) {
|
||||
if (item.from_type == 'order' && !isNaN(parseInt(item.type_tag))) {
|
||||
this.$util.redirectTo('/pages_order/detail', {
|
||||
order_id: item.type_tag
|
||||
});
|
||||
} else if (item.from_type == 'refund' && parseInt(item.type_tag) != 0) {
|
||||
this.$util.redirectTo('/pages_order/detail', {
|
||||
order_id: item.type_tag
|
||||
});
|
||||
this.balanceType = typeArr;
|
||||
}
|
||||
});
|
||||
},
|
||||
ontabtap(e) {
|
||||
let index = e.currentTarget.dataset.current;
|
||||
this.orderStatus = this.statusList[index].id;
|
||||
this.$refs.mescroll.refresh();
|
||||
},
|
||||
getData(mescroll) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/memberaccount/page',
|
||||
data: {
|
||||
page_size: mescroll.size,
|
||||
page: mescroll.num,
|
||||
account_type: 'balance,balance_money',
|
||||
from_type: this.searchType.from_type,
|
||||
date: this.searchType.date,
|
||||
related_id: this.related_id
|
||||
},
|
||||
success: res => {
|
||||
let newArr = [];
|
||||
let msg = res.message;
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
if (mescroll.num == 1) {
|
||||
this.dataList = []; //如果是第一页需手动制空列表
|
||||
this.related_id = 0;
|
||||
}
|
||||
this.dataList = this.dataList.concat(newArr); //追加新数据
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
},
|
||||
fail: res => {
|
||||
mescroll.endErr();
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
toFromDetail(item) {
|
||||
if (item.from_type == 'order' && !isNaN(parseInt(item.type_tag))) {
|
||||
this.$util.redirectTo('/pages_order/detail', {
|
||||
order_id: item.type_tag
|
||||
});
|
||||
} else if (item.from_type == 'refund' && parseInt(item.type_tag) != 0) {
|
||||
this.$util.redirectTo('/pages_order/detail', {
|
||||
order_id: item.type_tag
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.detailed-wrap {
|
||||
padding-top: 20rpx;
|
||||
|
||||
margin: 24rpx;
|
||||
}
|
||||
.detailed-wrap {
|
||||
padding-top: 20rpx;
|
||||
|
||||
.tab {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 80rpx;
|
||||
background-color: $color-bg;
|
||||
margin: 24rpx;
|
||||
}
|
||||
|
||||
view {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
.tab {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 80rpx;
|
||||
background-color: $color-bg;
|
||||
|
||||
text {
|
||||
margin-left: 10rpx;
|
||||
font-size: $font-size-base;
|
||||
}
|
||||
}
|
||||
view {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
|
||||
.tab-left {
|
||||
display: flex;
|
||||
padding-left: 46rpx;
|
||||
}
|
||||
|
||||
.tab-right {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-right: 26rpx;
|
||||
text {
|
||||
margin-left: 10rpx;
|
||||
font-size: $font-size-base;
|
||||
}
|
||||
}
|
||||
|
||||
.order-nav {
|
||||
width: 100vw;
|
||||
height: 70rpx;
|
||||
.tab-left {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding-left: 46rpx;
|
||||
}
|
||||
|
||||
.tab-right {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-right: 26rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.order-nav {
|
||||
width: 100vw;
|
||||
height: 70rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
/* #ifndef APP-PLUS */
|
||||
white-space: nowrap;
|
||||
/* #endif */
|
||||
background: #fff;
|
||||
border-bottom-left-radius: 24rpx;
|
||||
border-bottom-right-radius: 24rpx;
|
||||
padding-bottom: 30rpx;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
z-index: 998;
|
||||
|
||||
.uni-tab-item {
|
||||
width: 33.33%;
|
||||
text-align: center;
|
||||
/* #ifndef APP-PLUS */
|
||||
display: inline-block;
|
||||
/* #endif */
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: $font-size-base;
|
||||
display: block;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
border-bottom: 4rpx solid #fff;
|
||||
padding: 0 10rpx;
|
||||
flex-wrap: nowrap;
|
||||
/* #ifndef APP-PLUS */
|
||||
white-space: nowrap;
|
||||
/* #endif */
|
||||
background: #fff;
|
||||
border-bottom-left-radius: 24rpx;
|
||||
border-bottom-right-radius: 24rpx;
|
||||
padding-bottom: 30rpx;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
z-index: 998;
|
||||
|
||||
.uni-tab-item {
|
||||
width: 33.33%;
|
||||
text-align: center;
|
||||
/* #ifndef APP-PLUS */
|
||||
display: inline-block;
|
||||
/* #endif */
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.uni-tab-item-title {
|
||||
color: #555;
|
||||
font-size: $font-size-base;
|
||||
display: block;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
border-bottom: 4rpx solid #fff;
|
||||
padding: 0 10rpx;
|
||||
flex-wrap: nowrap;
|
||||
/* #ifndef APP-PLUS */
|
||||
white-space: nowrap;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-tab-item-title-active {
|
||||
display: block;
|
||||
height: 64rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.balances {
|
||||
padding: $margin-both 24rpx;
|
||||
// margin: 0 $margin-both;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
border-bottom: 2rpx solid $color-line;
|
||||
background: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: 24rpx;
|
||||
image {
|
||||
width: 54rpx;
|
||||
height: 54rpx;
|
||||
border-radius: 50%;
|
||||
padding-top: 10rpx;
|
||||
}
|
||||
|
||||
.balances-info {
|
||||
flex: 1;
|
||||
margin-left: 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
text {
|
||||
font-size: $font-size-toolbar;
|
||||
line-height: 1;
|
||||
|
||||
&:last-child {}
|
||||
|
||||
&:nth-child(2) {
|
||||
margin-top: $margin-updown;
|
||||
font-size: $font-size-activity-tag;
|
||||
color: $color-tip;
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
font-size: $font-size-activity-tag;
|
||||
margin-top: $margin-updown;
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.balances-num {
|
||||
text {
|
||||
line-height: 1;
|
||||
font-size: $font-size-toolbar;
|
||||
font-weight: 500;
|
||||
color:#09c15f;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
.uni-tab-item-title-active {
|
||||
display: block;
|
||||
height: 64rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.empty {
|
||||
width: 100%;
|
||||
height: 500rpx;
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.balances {
|
||||
padding: $margin-both 24rpx;
|
||||
// margin: 0 $margin-both;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
border-bottom: 2rpx solid $color-line;
|
||||
background: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: 24rpx;
|
||||
|
||||
image {
|
||||
width: 54rpx;
|
||||
height: 54rpx;
|
||||
border-radius: 50%;
|
||||
padding-top: 10rpx;
|
||||
}
|
||||
|
||||
.balances-info {
|
||||
flex: 1;
|
||||
margin-left: 16rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
text {
|
||||
font-size: $font-size-toolbar;
|
||||
line-height: 1;
|
||||
|
||||
&:last-child {}
|
||||
|
||||
&:nth-child(2) {
|
||||
margin-top: $margin-updown;
|
||||
font-size: $font-size-activity-tag;
|
||||
color: $color-tip;
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
font-size: $font-size-activity-tag;
|
||||
margin-top: $margin-updown;
|
||||
color: $color-tip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.balances-num {
|
||||
text {
|
||||
line-height: 1;
|
||||
font-size: $font-size-toolbar;
|
||||
font-weight: 500;
|
||||
color: #09c15f;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.empty {
|
||||
width: 100%;
|
||||
height: 500rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
@@ -1,19 +1,24 @@
|
||||
<template>
|
||||
<view :style="themeColor">
|
||||
<mescroll-uni ref="mescroll" @getData="getData" class="member-point" :size="8" @listenRefresh="listenRefresh" v-if="storeToken">
|
||||
<mescroll-uni ref="mescroll" @getData="getData" class="member-point" :size="8" @listenRefresh="listenRefresh"
|
||||
v-if="storeToken">
|
||||
<view class="goods_list" slot="list">
|
||||
<block v-if="collectionList.length > 0">
|
||||
<view class="goods_li margin-top" v-for="(item, index) in collectionList" :key="index" @click.stop="toDetail(item)">
|
||||
<view class="goods_li margin-top" v-for="(item, index) in collectionList" :key="index"
|
||||
@click.stop="toDetail(item)">
|
||||
<view class="pic">
|
||||
<image :src="$util.img(item.goods_image.split(',')[0], { size: 'mid' })" mode="aspectFill" @error="goodsImageError(index)"></image>
|
||||
<image :src="$util.img(item.goods_image.split(',')[0], { size: 'mid' })" mode="aspectFill"
|
||||
@error="goodsImageError(index)"></image>
|
||||
</view>
|
||||
<view class="goods_info">
|
||||
<view class="goods_name font-size-base">{{ item.sku_name }}</view>
|
||||
<view class="goods_opection">
|
||||
<view class="left lineheight-clear ">
|
||||
<text class="symbol price-style small">¥</text>
|
||||
<text class="price price-style large">{{ parseFloat(item.discount_price).toFixed(2).split('.')[0] }}</text>
|
||||
<text class="symbol price-style small">.{{ parseFloat(item.discount_price).toFixed(2).split('.')[1] }}</text>
|
||||
<text class="price price-style large">{{
|
||||
parseFloat(item.discount_price).toFixed(2).split('.')[0] }}</text>
|
||||
<text class="symbol price-style small">.{{
|
||||
parseFloat(item.discount_price).toFixed(2).split('.')[1] }}</text>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="cars" @click.stop="deleteItem(item.goods_id)">
|
||||
@@ -36,57 +41,47 @@
|
||||
|
||||
<script>
|
||||
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
import collection from './public/js/collection.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
mixins: [collection],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
mixins: [collection],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
onShow() {
|
||||
if (this.storeToken) {
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/collection');
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
storeToken: function(nVal, oVal) {
|
||||
if (nVal) {
|
||||
this.$refs.mescroll.refresh();
|
||||
}
|
||||
onShow() {
|
||||
if (this.storeToken) {
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/collection');
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
storeToken: function (nVal, oVal) {
|
||||
if (nVal) {
|
||||
this.$refs.mescroll.refresh();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .fixed {
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
/deep/ .fixed {
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/deep/ .empty {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
/deep/ .empty {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
@import './public/css/collection.scss';
|
||||
@import './public/css/collection.scss';
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
max-height: unset !important;
|
||||
}
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
max-height: unset !important;
|
||||
}
|
||||
</style>
|
||||
@@ -70,17 +70,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type: '',
|
||||
|
||||
@@ -65,18 +65,7 @@
|
||||
<script>
|
||||
var dateList = [];
|
||||
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
goodsList: [],
|
||||
|
||||
@@ -45,17 +45,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
const currentDate = this.getDate({
|
||||
format: true
|
||||
|
||||
@@ -30,17 +30,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataList: []
|
||||
|
||||
@@ -28,17 +28,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni,
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataList: []
|
||||
|
||||
@@ -56,13 +56,8 @@
|
||||
|
||||
<script>
|
||||
import refundMethod from './public/js/refundMethod.js';
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
refundList: [],
|
||||
|
||||
@@ -41,12 +41,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
orderList: []
|
||||
|
||||
@@ -11,16 +11,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef MP-WEIXIN
|
||||
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
components: {
|
||||
// #ifdef MP-WEIXIN
|
||||
privacyPopup
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
src: ''
|
||||
|
||||
Reference in New Issue
Block a user