第一次提交

This commit is contained in:
wangxiaowei
2025-06-11 10:21:51 +08:00
commit 52932d54b1
2341 changed files with 185283 additions and 0 deletions

View File

@ -0,0 +1,137 @@
<template>
<view class="coupon-wrap bg-white" v-if="!loadding">
<block v-if="DataList.length > 0">
<view class="item-wrap" v-for="(item, index) in DataList" :key="index">
<view :class="'coupon-item coupon-item-'+item.color.text" @click="lookRule(item)">
<!--装饰用的小圆-->
<view class="circles">
<text v-for="(circle,num) in 8" :key="num"></text>
</view>
<view class="info">
<view >{{item.coupon_type.text}}</view>
</view>
<view class="operation d-b-c w-b">
<view class="flex-1 coupon-content">
<view :class="item.is_expire==0&&item.is_use==0?item.color.text:''">
<template v-if=" item.coupon_type.value == 10 ">
<view class="price" >
<text></text>
<text class="f40 fb">{{ item.reduce_price }}</text>
</view>
</template>
<template v-if="item.coupon_type.value == 20 ">
<text class="f40 fb">{{ item.discount }}</text><text></text>
</template>
</view>
<view class="f30">{{item.name}}</view>
<view class="f24">
<template v-if="item.expire_type ==10">
有效期领取{{ item.expire_day }}天内有效
</template>
<template v-if="item.expire_type ==20">
有效期{{item.start_time.text}}{{item.end_time.text}}
</template>
</view>
</view>
<view class="btns d-c-c">
<button type="default" v-if="item.state.value>0" :class="'btn-'+item.color.text" v-on:click.stop="receive(item.coupon_id )">
立即领取
</button>
<button type="default" v-else class="btn-gray" v-on:click.stop>
{{ item.state.text }}
</button>
</view>
</view>
</view>
</view>
</block>
<block v-else>
<view class="none-data-box">
<image src="/static/none.png" mode="widthFix"></image>
<text>暂无数据</text>
</view>
</block>
</view>
</template>
<script>
export default {
data() {
return {
/*是否加载完成*/
loadding: true,
indicatorDots: true,
autoplay: true,
interval: 2000,
duration: 500,
DataList: [],
/*当前页面*/
page: 1,
/*每页条数*/
list_rows: 10,
};
},
mounted() {
uni.showLoading({
title: '加载中'
});
/*获取优惠券列表*/
this.getData();
},
methods: {
/*获取数据*/
getData() {
let self = this;
self._get('coupon.coupon/lists', {
page: self.page,
list_rows: self.list_rows,
}, function(res) {
self.DataList = res.data.list;
self.loadding = false;
uni.hideLoading();
});
},
/*查看规则*/
lookRule(item) {
item.rule = true;
},
/*关闭规则*/
closeRule(item) {
item.rule = false;
},
/*领取优惠券*/
receive(e) {
let self = this;
uni.showLoading({
title: '领取中'
});
self._post('user.coupon/receive', {
coupon_id: e,
}, function(res) {
uni.hideLoading();
uni.showToast({
title: '领取成功',
duration: 2000,
icon: 'success'
});
});
self.getData();
},
}
};
</script>
<style>
.coupon-wrap {
padding: 30rpx;
}
.item-wrap {
margin-bottom: 20rpx;
}
</style>

156
pages/diy-page/diy-page.vue Normal file
View File

@ -0,0 +1,156 @@
<template>
<view class="diy-page">
<!-- #ifdef APP-PLUS -->
<view class="tc d-b-c header"
:style="topBarHeight() == 0 ? '': 'height:'+topBarHeight()+'px;padding-top:'+(topBarTop() + 5)+'px'">
<view class="reg180" :style="topBarHeight() == 0 ? '': 'height:'+topBarHeight()+'px;'">
<text v-if="hasPage()" @click="goback" class="icon iconfont icon-jiantou"></text>
</view>
<view class="gray3 f28">{{page_info.params.name}}</view>
<view class="gray3 m20" @click="showShare()"><text class="icon iconfont icon-share1"></text></view>
</view>
<view :style="topBarHeight() == 0 ? '': 'height:'+topBarHeight()+'px;padding-top:'+(topBarTop() + 5)+'px'"
class="ww100"></view>
<!-- #endif -->
<diy :diyItems="items"></diy>
<!--底部弹窗-->
<share :isMpShare="isMpShare" @close="closeBottmpanel"></share>
<!--app分享-->
<AppShare :isAppShare="isAppShare" :appParams="appParams" @close="closeAppShare"></AppShare>
</view>
</template>
<script>
import diy from '@/components/diy/diy.vue';
import share from '@/components/mp-share.vue';
import AppShare from '@/components/app-share.vue';
export default {
components: {
diy,
share,
AppShare
},
data() {
return {
/*页面ID*/
page_id:null,
/*diy类别*/
items:{},
/*页面信息*/
page_info:{
params: {}
},
/*分享*/
isMpShare: false,
/*app分享*/
isAppShare: false,
appParams: {
title: '',
summary: '',
path: ''
},
url: '',
}
},
onLoad(e) {
this.page_id=e.page_id;
this.getData();
//#ifdef H5
this.url = window.location.href;
//#endif
},
methods: {
hasPage(){
var pages = getCurrentPages();
return pages.length > 1;
},
goback() {
uni.navigateBack();
},
/*获取数据*/
getData(page_id) {
let self = this;
self._get('index/diy', {
page_id: self.page_id,
url: self.url
}, function(res) {
self.page_info = res.data.page;
self.items = res.data.items;
self.setPage(self.page_info);
// 配置微信分享参数
//#ifdef H5
if (self.url != '') {
let params = {
page_id: self.page_id
};
self.configWx(res.data.share.signPackage, res.data.share.shareParams, params);
}
//#endif
});
},
/*设置页面*/
setPage(page){
uni.setNavigationBarTitle({
title: page.params.name
});
let colors='#000000';
if(page.style.titleTextColor=='white'){
//字母要小写
colors='#ffffff'
}
uni.setNavigationBarColor({
frontColor: colors,
backgroundColor: page.style.titleBackgroundColor
})
},
/*分享当前页面*/
onShareAppMessage() {
let self = this;
let params = self.getShareUrlParams({
page_id: self.page_id
});
return {
title: self.page_info.params.name,
path: '/pages/diy-page/diy-page?' + params
};
},
//分享按钮
showShare() {
let self = this;
//#ifdef MP-WEIXIN
return;
//#endif
//#ifndef APP-PLUS
self.isMpShare = true;
//#endif
//#ifdef APP-PLUS
self.appParams.title = self.page_info.params.share_title;
self.appParams.summary = self.page_info.params.name;
// 构建页面参数
let params = self.getShareUrlParams({
page_id: self.page_id
});
self.appParams.path = '/pages/diy-page/diy-page?' + params;
self.appParams.image = self.page_info.params.share_img;
self.isAppShare = true;
//#endif
},
//关闭分享
closeBottmpanel(data) {
this.isMpShare = false;
},
//关闭分享
closeAppShare(data) {
this.isAppShare = false;
},
},
}
</script>
<style>
</style>