源文件
This commit is contained in:
206
pages/plugins/coupon/detail/detail.vue
Normal file
206
pages/plugins/coupon/detail/detail.vue
Normal file
@@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view v-if="(data_base || null) != null" class="ht bg-white">
|
||||
<view class="plugins-coupon-container">
|
||||
<view class="coupon-content padding-top-main page-bottom-fixed">
|
||||
<!-- 优惠劵列表 -->
|
||||
<block v-if="(data || null) != null">
|
||||
<component-coupon-card :propData="data" :propStatusType="data.status_type" :propStatusOperableName="data.status_operable_name" propIndex="0" propIsProgress @call-back="coupon_receive_event"></component-coupon-card>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-fixed">
|
||||
<view class="bottom-line-exclude">
|
||||
<button class="item round cr-main bg-white br-main text-size wh-auto" type="default" hover-class="none" data-value="/pages/plugins/coupon/user/user" @tap="url_event">{{$t('index.index.lk0i6c')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentCouponCard from '@/components/coupon-card/coupon-card.vue';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: {},
|
||||
data: null,
|
||||
data_base: null,
|
||||
// 优惠劵领取
|
||||
temp_coupon_receive_index: null,
|
||||
temp_coupon_receive_value: null,
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentCouponCard,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: app.globalData.launch_params_handle(params),
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 数据加载
|
||||
this.get_data();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('detail', 'index', 'coupon'),
|
||||
method: 'POST',
|
||||
data: this.params,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
data: data.data || null,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
if ((this.data || null) != null) {
|
||||
// 基础自定义分享
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: this.data.name,
|
||||
desc: this.data.desc,
|
||||
path: '/pages/plugins/coupon/detail/detail',
|
||||
query: 'id='+this.data.id
|
||||
},
|
||||
});
|
||||
|
||||
// 导航名称
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.data.name,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 优惠劵领取事件
|
||||
coupon_receive_event(index, value) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
// 参数处理
|
||||
if ((index || null) == null && (value || null) == null) {
|
||||
var index = this.temp_coupon_receive_index;
|
||||
var value = this.temp_coupon_receive_value;
|
||||
} else {
|
||||
this.setData({
|
||||
temp_coupon_receive_index: index,
|
||||
temp_coupon_receive_value: value,
|
||||
});
|
||||
}
|
||||
// 登录校验
|
||||
var user = app.globalData.get_user_info(this, 'coupon_receive_event');
|
||||
if (user != false) {
|
||||
var data = this.data;
|
||||
if (data['is_operable'] != 0) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.processing_in_text'),
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('receive', 'coupon', 'coupon'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
coupon_id: value,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
data = res.data.data.coupon;
|
||||
this.setData({
|
||||
data_list: data,
|
||||
});
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data, this, 'coupon_receive_event')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
||||
38
pages/plugins/coupon/index/index.css
Normal file
38
pages/plugins/coupon/index/index.css
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 领券中心
|
||||
*/
|
||||
.plugins-coupon-container {
|
||||
padding-top: 408rpx;
|
||||
height: calc(100vh - 500rpx - var(--status-bar-height) - 5px);
|
||||
/* #ifdef H5 */
|
||||
padding-top: 408rpx;
|
||||
height: calc(100vh - 560rpx);
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.coupon-content {
|
||||
border-top: 42rpx solid #fff;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
min-height: calc(100% - 42rpx);
|
||||
}
|
||||
|
||||
.coupon-content .item {
|
||||
padding: 0 24rpx 24rpx 24rpx;
|
||||
}
|
||||
|
||||
.popup-btn {
|
||||
border: 2rpx solid #FF6E01;
|
||||
color: #FF6E01;
|
||||
border-radius: 22px;
|
||||
font-size: 32rpx;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 960px) {
|
||||
.plugins-coupon-container {
|
||||
/* #ifdef H5 */
|
||||
padding-top: 450px;
|
||||
height: calc(100vh - 525px);
|
||||
/* #endif */
|
||||
}
|
||||
}
|
||||
231
pages/plugins/coupon/index/index.vue
Normal file
231
pages/plugins/coupon/index/index.vue
Normal file
@@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<block v-if="(data_base || null) != null">
|
||||
<component-nav-back :propName="data_base.application_name || $t('index.index.p4872s')"></component-nav-back>
|
||||
<view class="pr">
|
||||
<view class="pa top-0 bg-img wh-auto">
|
||||
<image class="wh-auto dis-block" :src="data_base.app_banner_images || coupon_static_url + 'coupon-bg.png'" mode="widthFix" :data-value="data_base.url || ''" @tap="url_event"></image>
|
||||
</view>
|
||||
<view class="plugins-coupon-container">
|
||||
<view class="coupon-content bg-white pr page-bottom-fixed">
|
||||
<!-- 优惠劵列表 -->
|
||||
<view v-if="data_list.length > 0" class="flex-col">
|
||||
<block v-for="(item, index) in data_list" :key="index">
|
||||
<component-coupon-card :propData="item" :propStatusType="item.status_type" :propStatusOperableName="item.status_operable_name" :propIndex="index" propIsProgress @call-back="coupon_receive_event"></component-coupon-card>
|
||||
</block>
|
||||
</view>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-fixed">
|
||||
<view class="bottom-line-exclude">
|
||||
<button class="item round cr-main bg-white br-main text-size wh-auto" type="default" hover-class="none" data-value="/pages/plugins/coupon/user/user" @tap="url_event">{{$t('index.index.lk0i6c')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNavBack from '@/components/nav-back/nav-back';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentCouponCard from '@/components/coupon-card/coupon-card.vue';
|
||||
var coupon_static_url = app.globalData.get_static_url('coupon', true);
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
coupon_static_url: coupon_static_url + 'app/',
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_list: [],
|
||||
data_base: null,
|
||||
// 优惠劵领取
|
||||
temp_coupon_receive_index: null,
|
||||
temp_coupon_receive_value: null,
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNavBack,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentCouponCard,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 数据加载
|
||||
this.init();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data_list();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据
|
||||
init() {
|
||||
this.get_data_list();
|
||||
},
|
||||
// 获取数据
|
||||
get_data_list() {
|
||||
if (this.data_list.length <= 0) {
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
}
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'index', 'coupon'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var status = (data.data || []).length > 0;
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
data_list: data.data || [],
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: status ? 3 : 0,
|
||||
data_bottom_line_status: status,
|
||||
});
|
||||
if ((this.data_base || null) != null) {
|
||||
// 基础自定义分享
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: this.data_base.seo_title || this.data_base.application_name,
|
||||
desc: this.data_base.seo_desc,
|
||||
path: '/pages/plugins/coupon/index/index',
|
||||
},
|
||||
});
|
||||
|
||||
// #ifndef MP-ALIPAY
|
||||
// 导航名称
|
||||
if ((this.data_base.application_name || null) != null) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.data_base.application_name,
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 优惠劵领取事件
|
||||
coupon_receive_event(index, value) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
// 参数处理
|
||||
if ((index || null) == null && (value || null) == null) {
|
||||
var index = this.temp_coupon_receive_index;
|
||||
var value = this.temp_coupon_receive_value;
|
||||
} else {
|
||||
this.setData({
|
||||
temp_coupon_receive_index: index,
|
||||
temp_coupon_receive_value: value,
|
||||
});
|
||||
}
|
||||
// 登录校验
|
||||
var user = app.globalData.get_user_info(this, 'coupon_receive_event');
|
||||
if (user != false) {
|
||||
var temp_list = this.data_list;
|
||||
if (temp_list[index]['is_operable'] != 0) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.processing_in_text'),
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('receive', 'coupon', 'coupon'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
coupon_id: value,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
temp_list[index] = res.data.data.coupon;
|
||||
this.setData({
|
||||
data_list: temp_list,
|
||||
});
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data, this, 'coupon_receive_event')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// url事件
|
||||
url_event(e) {
|
||||
app.globalData.url_event(e);
|
||||
},
|
||||
|
||||
// 页面滚动监听
|
||||
onPageScroll(res) {
|
||||
uni.$emit('onPageScroll', res);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './index.css';
|
||||
</style>
|
||||
11
pages/plugins/coupon/shop/shop.css
Normal file
11
pages/plugins/coupon/shop/shop.css
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 领券中心
|
||||
*/
|
||||
.coupon-content .item {
|
||||
padding: 0 24rpx 24rpx 24rpx;
|
||||
}
|
||||
|
||||
.popup-bottom {
|
||||
box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
|
||||
z-index: 2;
|
||||
}
|
||||
231
pages/plugins/coupon/shop/shop.vue
Normal file
231
pages/plugins/coupon/shop/shop.vue
Normal file
@@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<view class="plugins-coupon-container">
|
||||
<!-- 优惠劵列表 -->
|
||||
<view v-if="data_list.length > 0" class="coupon-content bg-white pr padding-top-main page-bottom-fixed">
|
||||
<view class="flex-col">
|
||||
<block v-for="(item, index) in data_list" :key="index">
|
||||
<component-coupon-card :propData="item" :propStatusType="item.status_type" :propStatusOperableName="item.status_operable_name" :propIndex="index" propIsProgress @call-back="coupon_receive_event"></component-coupon-card>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 回到店铺 -->
|
||||
<view v-if="(shop || null) != null" class="popup-bottom bottom-fixed bg-white">
|
||||
<view class="bottom-line-exclude">
|
||||
<button class="bg-white cr-main br-main round dis-block text-size" type="default" hover-class="none" :data-value="shop.url" @tap="shop_event">{{ $t('index.index.i78v36') }}</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentCouponCard from '@/components/coupon-card/coupon-card.vue';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
data_list: [],
|
||||
data_base: null,
|
||||
shop: null,
|
||||
// 优惠劵领取
|
||||
temp_coupon_receive_index: null,
|
||||
temp_coupon_receive_value: null,
|
||||
// 自定义分享信息
|
||||
share_info: {},
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentCouponCard,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
|
||||
// 设置参数
|
||||
this.setData({
|
||||
params: params,
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 数据加载
|
||||
this.init();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 获取数据
|
||||
init() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data_list() {
|
||||
if (this.data_list.length <= 0) {
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
}
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('shop', 'index', 'coupon'),
|
||||
method: 'POST',
|
||||
data: this.params,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var status = (data.data || []).length > 0;
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
shop: data.shop || null,
|
||||
data_list: data.data || [],
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: status ? 3 : 0,
|
||||
data_bottom_line_status: status,
|
||||
});
|
||||
|
||||
if ((this.data_base || null) != null) {
|
||||
// 基础自定义分享
|
||||
this.setData({
|
||||
share_info: {
|
||||
title: this.data_base.seo_title || this.data_base.application_name,
|
||||
desc: this.data_base.seo_desc,
|
||||
path: '/pages/plugins/coupon/shop/shop',
|
||||
},
|
||||
});
|
||||
|
||||
// 导航名称
|
||||
if ((this.data_base.shop_application_name || null) != null) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.data_base.shop_application_name,
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle(this.share_info);
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 优惠劵领取事件
|
||||
coupon_receive_event(index, value) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
// 参数处理
|
||||
if ((index || null) == null && (value || null) == null) {
|
||||
var index = this.temp_coupon_receive_index;
|
||||
var value = this.temp_coupon_receive_value;
|
||||
} else {
|
||||
this.setData({
|
||||
temp_coupon_receive_index: index,
|
||||
temp_coupon_receive_value: value,
|
||||
});
|
||||
}
|
||||
// 登录校验
|
||||
var user = app.globalData.get_user_info(this, 'coupon_receive_event');
|
||||
if (user != false) {
|
||||
var temp_list = this.data_list;
|
||||
if (temp_list[index]['is_operable'] != 0) {
|
||||
uni.showLoading({
|
||||
title: this.$t('common.processing_in_text'),
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('receive', 'coupon', 'coupon'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
coupon_id: value,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
temp_list[index] = res.data.data.coupon;
|
||||
this.setData({
|
||||
data_list: temp_list,
|
||||
});
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data, this, 'coupon_receive_event')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 店铺事件
|
||||
shop_event(e) {
|
||||
var prev_url = app.globalData.prev_page();
|
||||
if (prev_url != null && prev_url.indexOf('pages/plugins/shop/detail/detail') != -1) {
|
||||
uni.navigateBack();
|
||||
} else {
|
||||
app.globalData.url_event(e);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './shop.css';
|
||||
</style>
|
||||
15
pages/plugins/coupon/user/user.css
Normal file
15
pages/plugins/coupon/user/user.css
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* 导航
|
||||
*/
|
||||
.nav-base .item {
|
||||
width: 33.33%;
|
||||
}
|
||||
|
||||
/*
|
||||
* 数据列表
|
||||
*/
|
||||
.plugins-coupon-container .item,
|
||||
.plugins-coupon-container .v-right,
|
||||
.plugins-coupon-container .v-right .circle {
|
||||
height: 230rpx;
|
||||
}
|
||||
197
pages/plugins/coupon/user/user.vue
Normal file
197
pages/plugins/coupon/user/user.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<view :class="theme_view">
|
||||
<!-- 导航 -->
|
||||
<view class="nav-base bg-white">
|
||||
<block v-for="(item, index) in nav_tabs_list" :key="index">
|
||||
<view :class="'item fl tc cr-grey ' + (item.value == nav_tabs_value ? 'cr-main nav-active-line' : '')" :data-index="index" :data-value="item.value" @tap="nav_tabs_event">{{ item.name }} </view>
|
||||
</block>
|
||||
</view>
|
||||
<scroll-view :scroll-y="true" class="scroll-box scroll-box-ece-nav" lower-threshold="60">
|
||||
<!-- 优惠劵列表 -->
|
||||
<view v-if="data_list != null" class="plugins-coupon-container padding-top-main">
|
||||
<!-- 未使用 -->
|
||||
<block v-if="(data_list.not_use || null) != null && data_list.not_use.length > 0 && nav_tabs_value == 'not_use'">
|
||||
<block v-for="(item, index) in data_list.not_use" :key="index">
|
||||
<component-coupon-card :propData="item.coupon" :propStartTime="item.time_start_show_text" :propEndTime="item.time_end_show_text" :propStatusType="item.status_type" :propStatusOperableName="item.status_operable_name" propBg="#f5f5f5"></component-coupon-card>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!-- 已使用 -->
|
||||
<block v-if="(data_list.already_use || null) != null && data_list.already_use.length > 0 && nav_tabs_value == 'already_use'">
|
||||
<block v-for="(item, index) in data_list.already_use" :key="index">
|
||||
<component-coupon-card :propData="item.coupon" :propStartTime="item.time_start_show_text" :propEndTime="item.time_end_show_text" :propStatusType="item.status_type" :propStatusOperableName="item.status_operable_name" propBg="#f5f5f5"></component-coupon-card>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!-- 已过期 -->
|
||||
<block v-if="(data_list.already_expire || null) != null && data_list.already_expire.length > 0 && nav_tabs_value == 'already_expire'">
|
||||
<block v-for="(item, index) in data_list.already_expire" :key="index">
|
||||
<component-coupon-card :propData="item.coupon" :propStartTime="item.time_start_show_text" :propEndTime="item.time_end_show_text" :propStatusType="item.status_type" :propStatusOperableName="item.status_operable_name" propBg="#f5f5f5"></component-coupon-card>
|
||||
</block>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg" :propUrl="coupon_static_url + 'no-data.png'"></component-no-data>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common"></component-common>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentCouponCard from '@/components/coupon-card/coupon-card.vue';
|
||||
const coupon_static_url = app.globalData.get_static_url('coupon', true);
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
coupon_static_url: coupon_static_url + 'app/',
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_list: null,
|
||||
nav_tabs_list: [
|
||||
{
|
||||
name: this.$t('user.user.s3y4ji'),
|
||||
value: 'not_use',
|
||||
},
|
||||
{
|
||||
name: this.$t('user.user.pggs6s'),
|
||||
value: 'already_use',
|
||||
},
|
||||
{
|
||||
name: this.$t('user.user.528t26'),
|
||||
value: 'already_expire',
|
||||
},
|
||||
],
|
||||
nav_tabs_value: 'not_use',
|
||||
// 首页地址
|
||||
home_page_url: app.globalData.app_tabbar_pages()[0],
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentCouponCard,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onload_handle(params);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 调用公共事件方法
|
||||
app.globalData.page_event_onshow_handle();
|
||||
|
||||
// 数据加载
|
||||
this.init();
|
||||
|
||||
// 公共onshow事件
|
||||
if ((this.$refs.common || null) != null) {
|
||||
this.$refs.common.on_show();
|
||||
}
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 获取数据
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
this.get_data_list();
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data_list() {
|
||||
if (this.data_list == null || (this.data_list[this.nav_tabs_value] || null) == null || this.data_list[this.nav_tabs_value].length <= 0) {
|
||||
this.setData({
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
}
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'coupon', 'coupon'),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
this.setData({
|
||||
data_list: res.data.data || null,
|
||||
data_list_loding_msg: this.$t('user.user.3ks1wi'),
|
||||
});
|
||||
this.data_view_handle();
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 数据处理
|
||||
data_view_handle() {
|
||||
if(this.data_list_loding_status != 2) {
|
||||
var status = 0;
|
||||
if (this.data_list != null && (this.data_list[this.nav_tabs_value] || null) != null && this.data_list[this.nav_tabs_value].length > 0) {
|
||||
status = 3;
|
||||
}
|
||||
this.setData({
|
||||
data_list_loding_status: status,
|
||||
data_bottom_line_status: status == 3,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
nav_tabs_event(e) {
|
||||
this.setData({
|
||||
nav_tabs_value: e.currentTarget.dataset.value,
|
||||
});
|
||||
this.data_view_handle();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './user.css';
|
||||
</style>
|
||||
Reference in New Issue
Block a user