优惠券领取失败错误修复

master
gongfuxiang 2025-08-26 21:30:51 +08:00
parent 5d0abf9bdd
commit c92b4c27a1
5 changed files with 204 additions and 198 deletions

View File

@ -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() {
//

View File

@ -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

View File

@ -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'));
},
});
}
}
}
},

View File

@ -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'));
},
});
}
}
}
},

View File

@ -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'));
},
});
}
}
}
},