优惠券领取失败错误修复
parent
5d0abf9bdd
commit
c92b4c27a1
|
|
@ -222,7 +222,7 @@
|
|||
<view class="oh">
|
||||
<view class="item margin-vertical-xs mini-coupon flex-row flex-nowrap" :class="item.status_type === 2 ? 'received-coupon mini-coupon-br' : 'not-received-coupon'">
|
||||
<text class="nowrap" @tap="popup_coupon_event">{{ item.desc || item.name }}</text>
|
||||
<text class="dis-inline-block nowrap margin-left-sm padding-left-sm divider-l" @tap="coupon_receive_event(index, item.id)">{{ item.status_operable_name }}</text>
|
||||
<text class="dis-inline-block nowrap margin-left-sm padding-left-sm divider-l" :data-index="index" :data-value="item.id" @tap="coupon_receive_event">{{ item.status_operable_name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -529,7 +529,7 @@
|
|||
<view class="plugins-coupon-container padding-bottom-main">
|
||||
<block v-if="(plugins_coupon_data || null) != null && plugins_coupon_data.data.length > 0">
|
||||
<block v-for="(item, index) in plugins_coupon_data.data" :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>
|
||||
<component-coupon-card :propData="item" :propStatusType="item.status_type" :propStatusOperableName="item.status_operable_name" :propIndex="index" propIsProgress @call-back="coupon_receive_back_event"></component-coupon-card>
|
||||
</block>
|
||||
</block>
|
||||
<block v-else>
|
||||
|
|
@ -743,8 +743,6 @@
|
|||
plugins_seckill_is_valid: false,
|
||||
// 优惠劵插件
|
||||
plugins_coupon_data: null,
|
||||
temp_coupon_receive_index: null,
|
||||
temp_coupon_receive_value: null,
|
||||
popup_coupon_status: false,
|
||||
// 购买记录插件
|
||||
plugins_salerecords_data: null,
|
||||
|
|
@ -1345,55 +1343,69 @@
|
|||
});
|
||||
},
|
||||
|
||||
// 优惠劵领取事件
|
||||
coupon_receive_event(index, value) {
|
||||
// 参数处理
|
||||
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,
|
||||
});
|
||||
// 优惠券组件领取事件
|
||||
coupon_receive_back_event() {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 登录校验
|
||||
var user = app.globalData.get_user_info(this, 'coupon_receive_event');
|
||||
let user = app.globalData.get_user_info(this, 'coupon_receive_back_event');
|
||||
if (user != false) {
|
||||
var temp_list = this.plugins_coupon_data.data;
|
||||
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({
|
||||
'plugins_coupon_data.data': 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'));
|
||||
},
|
||||
});
|
||||
let res = uni.getStorageSync('cache_plugins_coupon_receive_key') || null;
|
||||
if(res != null) {
|
||||
this.coupon_receive_handle(res);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 优惠劵领取事件
|
||||
coupon_receive_event(e) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
// 登录校验
|
||||
let user = app.globalData.get_user_info(this, 'coupon_receive_event', e);
|
||||
if (user != false) {
|
||||
this.coupon_receive_handle(e.currentTarget.dataset);
|
||||
}
|
||||
},
|
||||
|
||||
// 优惠券领取处理
|
||||
coupon_receive_handle(params) {
|
||||
let index = params.index;
|
||||
let value = params.value;
|
||||
let temp_list = this.plugins_coupon_data.data;
|
||||
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({
|
||||
'plugins_coupon_data.data': temp_list,
|
||||
});
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data, this, 'coupon_receive_handle', params)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 购买记录提示处理
|
||||
plugins_salerecords_tips_handle() {
|
||||
// 销毁之前的任务
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
</view>
|
||||
<view class="card-type">
|
||||
<!-- 按钮状态 0-领取,1-已领取,2-已抢完,3-去使用,4-已使用,5-已过期 -->
|
||||
<view v-if="propStatusType == 0" class="card-btn dis-inline-block cr-white" @tap="receive">{{ propStatusOperableName || this.$t('coupon-card.coupon-card.m9316y') }}</view>
|
||||
<view v-if="propStatusType == 0" class="card-btn dis-inline-block cr-white" @tap="receive_event">{{ propStatusOperableName || this.$t('coupon-card.coupon-card.m9316y') }}</view>
|
||||
<view v-else-if="propStatusType == 1" class="card-btn dis-inline-block cr-red br-red received">{{ propStatusOperableName || this.$t('coupon-card.coupon-card.m9316y') }}</view>
|
||||
<view v-else-if="propStatusType == 2" class="card-btn dis-inline-block cr-white robbed">{{ propStatusOperableName || this.$t('coupon-card.coupon-card.m9316y') }}</view>
|
||||
<view v-else-if="propStatusType == 3" :data-value="home_page_url" @tap="url_event" class="cp">
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
<view v-else-if="propStatusType == 5" class="card-image pa top-0 right-0">
|
||||
<image class="image" :src="coupon_static_url + 'coupon-expire.png'" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<view v-else @tap="receive">{{$t('coupon-card.coupon-card.j318xx')}}</view>
|
||||
<view v-else @tap="receive_event">{{$t('coupon-card.coupon-card.j318xx')}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-circle-top" :style="{ background: `${propBg}` }"></view>
|
||||
|
|
@ -136,13 +136,19 @@
|
|||
// 符号
|
||||
currency_symbol: app.globalData.currency_symbol(),
|
||||
// 首页地址
|
||||
home_page_url: tabbar_pages[0],
|
||||
home_page_url: tabbar_pages[0],
|
||||
// 缓存key
|
||||
cache_key: 'cache_plugins_coupon_receive_key',
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 领取
|
||||
receive(e) {
|
||||
this.$emit('call-back', this.propIndex, this.propData.id);
|
||||
receive_event(e) {
|
||||
uni.setStorageSync(this.cache_key, {
|
||||
index: this.propIndex,
|
||||
value: this.propData.id
|
||||
});
|
||||
this.$emit('call-back');
|
||||
},
|
||||
|
||||
// url事件
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<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>
|
||||
<component-coupon-card :propData="data" :propStatusType="data.status_type" :propStatusOperableName="data.status_operable_name" propIndex="0" propIsProgress @call-back="coupon_receive_back_event"></component-coupon-card>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
|
|
@ -144,55 +144,51 @@
|
|||
});
|
||||
},
|
||||
// 优惠劵领取事件
|
||||
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['status_type'] == 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);
|
||||
coupon_receive_back_event() {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
// 缓存
|
||||
let res = uni.getStorageSync('cache_plugins_coupon_receive_key') || null;
|
||||
if(res != null) {
|
||||
// 登录校验
|
||||
let user = app.globalData.get_user_info(this, 'coupon_receive_back_event');
|
||||
if (user != false) {
|
||||
let index = res.index;
|
||||
let value = res.value;
|
||||
let data = this.data;
|
||||
if (data['status_type'] == 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_back_event')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<!-- 优惠劵列表 -->
|
||||
<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>
|
||||
<component-coupon-card :propData="item" :propStatusType="item.status_type" :propStatusOperableName="item.status_operable_name" :propIndex="index" propIsProgress @call-back="coupon_receive_back_event"></component-coupon-card>
|
||||
</block>
|
||||
</view>
|
||||
<block v-else>
|
||||
|
|
@ -163,55 +163,51 @@
|
|||
});
|
||||
},
|
||||
// 优惠劵领取事件
|
||||
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]['status_type'] == 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);
|
||||
coupon_receive_back_event() {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
// 缓存
|
||||
let res = uni.getStorageSync('cache_plugins_coupon_receive_key') || null;
|
||||
if(res != null) {
|
||||
// 登录校验
|
||||
let user = app.globalData.get_user_info(this, 'coupon_receive_back_event');
|
||||
if (user != false) {
|
||||
let index = res.index;
|
||||
let value = res.value;
|
||||
let temp_list = this.data_list;
|
||||
if (temp_list[index]['status_type'] == 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_back_event')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<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>
|
||||
<component-coupon-card :propData="item" :propStatusType="item.status_type" :propStatusOperableName="item.status_operable_name" :propIndex="index" propIsProgress @call-back="coupon_receive_back_event"></component-coupon-card>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 结尾 -->
|
||||
|
|
@ -162,54 +162,50 @@
|
|||
},
|
||||
|
||||
// 优惠劵领取事件
|
||||
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]['status_type'] == 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);
|
||||
coupon_receive_back_event() {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
// 缓存
|
||||
let res = uni.getStorageSync('cache_plugins_coupon_receive_key') || null;
|
||||
if(res != null) {
|
||||
// 登录校验
|
||||
let user = app.globalData.get_user_info(this, 'coupon_receive_back_event');
|
||||
if (user != false) {
|
||||
let index = res.index;
|
||||
let value = res.value;
|
||||
let temp_list = this.data_list;
|
||||
if (temp_list[index]['status_type'] == 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_back_event')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue