1.支付优化

master
sws 2023-10-11 10:35:38 +08:00
parent 95db162b9b
commit 2cf7e1deb2
8 changed files with 108 additions and 39 deletions

View File

@ -101,10 +101,15 @@
type: [Number, String],
default: 0,
},
// id
// id 0
propPaymentId: {
type: [String, Number],
default: '',
type: [Number, String],
default: 0,
},
// id 0
propDefaultPaymentId: {
type: [Number, String],
default: 0,
},
//
propNavStatusIndex: {
@ -141,7 +146,7 @@
propIsShowPayment(newVal, oldVal) {
if (newVal !== oldVal) {
let bool = true;
if (this.propPaymentList.length < 2) {
if (this.propPaymentList.length === 1) {
bool = false;
this.setData({
payment_id: this.propPaymentList[0].id,
@ -149,12 +154,13 @@
} else {
let self = this;
self.propPaymentList.forEach((item) => {
if (item.id == self.propPaymentId) {
let new_payment_id = Number(self.propPaymentId) === 0 ? self.propDefaultPaymentId : Number(self.propPaymentId);
if (item.id == new_payment_id) {
bool = false;
}
});
this.setData({
payment_id: this.propPaymentId,
payment_id: Number(this.propPaymentId) === 0 ? this.propDefaultPaymentId : Number(this.propPaymentId),
});
}
this.setData({
@ -173,7 +179,7 @@
popup_view_pay_timer: null,
popup_view_pay_data: null,
// id
payment_id: this.propPaymentId || '',
payment_id: Number(this.propPaymentId) === 0 ? this.propDefaultPaymentId : Number(this.propPaymentId),
submit_disabled_status: true,
order_id: 0,
currency_symbol: app.globalData.data.currency_symbol,
@ -212,7 +218,7 @@
this.setData({
is_show_payment_popup: false,
});
this.pay_handle(this.propTempPayValue, this.propPaymentId);
this.pay_handle(this.propTempPayValue, Number(this.propPaymentId) === 0 ? this.propDefaultPaymentId : Number(this.propPaymentId));
this.$emit('close-payment-poupon', false);
},
//
@ -528,7 +534,7 @@
order_id: order_id,
is_to_page: is_to_page,
};
this.$emit('pay-success', newData, this.propTempPayIndex, this.propPaymentId);
this.$emit('pay-success', newData, this.propTempPayIndex, Number(this.propPaymentId) === 0 ? this.propDefaultPaymentId : Number(this.propPaymentId));
if (is_to_page) {
this.to_success_page_event();
}

View File

@ -48,6 +48,8 @@
:prop-temp-pay-value="temp_pay_value"
:prop-temp-pay-index="temp_pay_index"
:prop-pay-price="pay_price"
:prop-payment-id="payment_id"
:prop-default-payment-id="default_payment_id"
:prop-is-show-payment="is_show_payment_popup"
@close-payment-poupon="payment_popup_event_close"
@pay-success="order_item_pay_success_handle"
@ -56,7 +58,6 @@
</template>
<script>
const app = getApp();
import base64 from '@/common/js/lib/base64.js';
import componentPopup from '@/components/popup/popup';
import componentNoData from '@/components/no-data/no-data';
import componentBottomLine from '@/components/bottom-line/bottom-line';
@ -88,7 +89,6 @@
data_bottom_line_status: false,
data_is_loading: 0,
params: null,
payment_id: 0,
nav_status_list: [
{ name: '全部', value: '-1' },
{ name: '待支付', value: '0' },
@ -108,6 +108,7 @@
temp_pay_value: '',
temp_pay_index: 0,
payment_id: 0,
default_payment_id: 0,
is_show_payment_popup: false,
pay_price: 0,
};
@ -227,6 +228,7 @@
this.setData({
payment_list: res.data.data.payment_list || [],
default_payment_id: res.data.data.default_payment_id || 0,
data_list: temp_data_list,
data_total: res.data.data.total,
data_page_total: res.data.data.page_total,
@ -276,8 +278,9 @@
temp_pay_value: e.currentTarget.dataset.value,
temp_pay_index: e.currentTarget.dataset.index,
pay_price: e.currentTarget.dataset.price,
payment_id: e.currentTarget.dataset.payment,
payment_id: e.currentTarget.dataset.payment || 0,
});
console.log(this.payment_id);
},
//

View File

@ -70,6 +70,7 @@
:prop-temp-pay-value="temp_pay_value"
:prop-temp-pay-index="temp_pay_index"
:prop-payment-id="payment_id"
:prop-default-payment-id="default_payment_id"
:prop-pay-price="pay_price"
:propIsRedirectTo="true"
:prop-to-fail-page="to_fail_page"
@ -102,6 +103,7 @@
temp_pay_value: '',
temp_pay_index: 0,
payment_id: 0,
default_payment_id: 0,
is_show_payment_popup: false,
pay_price: 0,
//
@ -153,6 +155,7 @@
this.setData({
data_base: data.base || null,
data_list: data.data || [],
default_payment_id: data.default_payment_id || 0,
data_list_loding_msg: '',
data_list_loding_status: status ? 3 : 0,
data_bottom_line_status: status,

View File

@ -45,6 +45,7 @@
:prop-temp-pay-value="temp_pay_value"
:prop-temp-pay-index="temp_pay_index"
:prop-payment-id="payment_id"
:prop-default-payment-id="default_payment_id"
:prop-is-show-payment="is_show_payment_popup"
:prop-pay-price="pay_price"
@close-payment-poupon="payment_popup_event_close"
@ -76,6 +77,7 @@
temp_pay_value: 0,
temp_pay_index: 0,
payment_id: 0,
default_payment_id: 0,
nav_status_list: [
{
name: '全部',
@ -226,6 +228,7 @@
}
this.setData({
payment_list: res.data.data.payment_list || [],
default_payment_id: res.data.data.default_payment_id || 0,
data_list: temp_data_list,
data_total: res.data.data.total,
data_page_total: res.data.data.page_total,

View File

@ -25,15 +25,45 @@
width: calc(100% / 3 - 24rpx);
height: 140rpx;
line-height: 140rpx;
padding: 18rpx 12rpx;
}
.recharge-price-content {
background: #F5F7F9;
border: 1px solid #F5F7F9;
transition: all 0.3s ease-in-out;
}
.recharge-price-content.active {}
.recharge-price-content.active {
background: rgba(226, 44, 8, 0.06);
color: #E22C08;
border: 1px solid #E22C08;
}
.recharge-price-content .tips {
height: 32rpx;
line-height: 32rpx;
padding: 0 20rpx;
background: #D8D8D8 linear-gradient(107deg, #FC6F31 0%, #E22C08 100%);
border-radius: 16rpx 0 16rpx 0;
top: -16rpx;
}
.form-container .custom-price {
background: #F5F7F9;
}
.form-container input {
height: 104rpx !important;
line-height: 104rpx !important;
height: 80rpx !important;
line-height: 80rpx !important;
}
.circle-poiont {
width: 6px;
height: 6px;
}
.recharge-desc-title,
.recharge-desc-content {
padding-bottom: 16rpx;
}

View File

@ -14,29 +14,40 @@
<!-- 头部背景 -->
<image :src="wallet_static_url + 'rechage-bg.png'" mode="widthFix" class="pa top-0 bg-img wh-auto" />
<view class="pr padding-top-main">
<view class="wallet-price">
<view class="wallet-price cr-white">
<view class="text-size-lg fw-b">账号余额</view>
<view class="margin-top-sm">
<text class="unit">{{ currency_symbol }}</text>
<text class="price fw-b">380</text>
</view>
</view>
<view class="recharge-content bg-white">
<view class="padding-horizontal-sm">选择充值金额</view>
<view class="flex-row flex-warp tc">
<view v-for="(item, index) in data" :key="index" class="recharge-price-list padding-sm" @tap="change_price_event">
<view class="recharge-price-content border-radius-main single-text" :class="select_index === index ? 'active' : ''">
<text class="text-size-md">{{ currency_symbol }}</text>
<text class="text-size-xl">100</text>
<view class="recharge-content bg-white spacing-mt">
<view class="padding-horizontal-sm spacing-mb">选择充值金额</view>
<view class="flex-row flex-warp tc spacing-mb">
<view v-for="(item, index) in data" :key="index" class="recharge-price-list" :data-index="index" :data-value="item.value" @tap="change_price_event">
<view class="recharge-price-content border-radius-main pr" :class="select_index === index ? 'active' : ''">
<view v-if="item.tips" class="tips cr-white dis-inline-block pa left-0 text-size-xss">{{ item.tips }}</view>
<view class="single-text">
<text class="text-size-md">{{ currency_symbol }}</text>
<text class="text-size-xl">{{ item.value }}</text>
</view>
</view>
</view>
</view>
<view class="form-container padding-main">
<view class="form-gorup padding-vertical-main border-radius-main">
<input type="digit" name="money" :value="recharge_money_value || ''" placeholder-class="cr-grey" class="cr-base text-size-xxl" placeholder="请输入充值金额" @input="recharge_money_value_input_event" maxlength="6" />
<view class="form-container padding-top-sm padding-horizontal-sm">
<view class="form-gorup border-radius-main custom-price flex-row align-c">
<view class="margin-right-xxl">其他金额</view>
<input type="digit" name="money" v-model="recharge_money_value" placeholder-class="cr-grey-9" class="cr-base text-size-md flex-1 flex-width" placeholder="请输入充值金额" @input="recharge_money_value_input_event" maxlength="6" />
</view>
<view class="form-gorup form-gorup-submit">
<button class="round cr-white bg-main br-main text-size" type="default" hover-class="none" :disabled="form_submit_disabled_status" @tap="form_submit_event"></button>
<view class="form-gorup form-gorup-submit spacing-mt">
<button class="round cr-white bg-main br-main text-size" type="default" hover-class="none" :disabled="form_submit_disabled_status" @tap="form_submit_event"></button>
</view>
</view>
<view class="recharge-desc padding-top-xxl padding-horizontal-sm">
<view class="recharge-desc-title padding-bottom-sm">充值说明</view>
<view v-for="(item, index) in recharge_desc" :key="index" class="recharge-desc-content cr-grey-9 flex-row align-c">
<text class="dis-inline-block circle bg-main circle-poiont margin-right-sm"></text>
<text class="flex-1 flex-width text-size-xs">{{ item }}</text>
</view>
</view>
</view>
@ -56,6 +67,7 @@
:prop-temp-pay-value="temp_pay_value"
:prop-pay-price="pay_price"
:prop-payment-id="payment_id"
:prop-default-payment-id="default_payment_id"
:propIsRedirectTo="true"
:prop-to-fail-page="to_fail_page"
:prop-is-show-payment="is_show_payment_popup"
@ -83,9 +95,11 @@
data_list_loding_status: 1,
data_list_loding_msg: '',
recharge_money_value: '',
sub_recharge_money_value: '',
form_submit_disabled_status: false,
data: [],
recharge_desc: '',
select_index: null,
//
pay_url: app.globalData.get_request_url('pay', 'recharge', 'wallet'),
@ -95,6 +109,7 @@
is_show_payment_popup: false,
pay_price: 0,
payment_id: 0,
default_payment_id: 0,
//
to_fail_page: '/pages/plugins/wallet/user/user',
};
@ -158,7 +173,8 @@
console.log(data);
this.setData({
data: data.preset_data || [],
payment_id: data.default_payment_id || '',
payment_id: data.default_payment_id || 0,
default_payment_id: data.default_payment_id || 0,
recharge_desc: data.recharge_desc || '',
data_list_loding_msg: '',
data_list_loding_status: 0,
@ -185,19 +201,27 @@
},
//
change_price_event(e) {},
change_price_event(e) {
this.setData({
select_index: e.currentTarget.dataset.index,
sub_recharge_money_value: e.currentTarget.dataset.value,
recharge_money_value: '',
});
console.log(this.recharge_money_value);
},
//
recharge_money_value_input_event(e) {
this.setData({
recharge_money_value: e.detail.value || '',
sub_recharge_money_value: e.detail.value || '',
select_index: null,
});
},
//
form_submit_event(e) {
//
if ((this.recharge_money_value || null) == null) {
if ((this.sub_recharge_money_value || null) == null) {
app.globalData.showToast('请输入充值金额');
return false;
}
@ -212,7 +236,7 @@
url: app.globalData.get_request_url('create', 'recharge', 'wallet'),
method: 'POST',
data: {
money: this.recharge_money_value,
money: this.sub_recharge_money_value,
},
dataType: 'json',
success: (res) => {

View File

@ -57,7 +57,6 @@
*/
.submit-container {
padding: 42rpx 46rpx;
z-index: 0;
}
.submit-container .sub-btn {

View File

@ -109,6 +109,7 @@
:prop-temp-pay-value="temp_pay_value"
:prop-temp-pay-index="temp_pay_index"
:prop-payment-id="payment_id"
:prop-default-payment-id="default_payment_id"
:prop-pay-price="pay_price"
:prop-is-show-payment="is_show_payment_popup"
@close-payment-poupon="payment_popup_event_close"
@ -146,7 +147,6 @@
{ name: '已完成', value: '4' },
{ name: '已失效', value: '5,6' },
],
mult_payment_id: 0,
mult_payment_id_list: [],
order_select_ids: [],
mult_pay_price: [],
@ -167,7 +167,8 @@
payment_list: [],
temp_pay_value: '',
temp_pay_index: 0,
payment_id: '',
payment_id: 0,
default_payment_id: 0,
is_show_payment_popup: false,
};
},
@ -315,7 +316,7 @@
}
this.setData({
payment_list: res.data.data.payment_list || [],
mult_payment_id: res.data.data.default_payment_id || '',
default_payment_id: res.data.data.default_payment_id || 0,
data_list: temp_data_list,
data_total: res.data.data.total,
data_page_total: res.data.data.page_total,
@ -384,7 +385,7 @@
is_show_payment_popup: true,
temp_pay_value: e.currentTarget.dataset.value,
temp_pay_index: e.currentTarget.dataset.index,
payment_id: e.currentTarget.dataset.payment || this.mult_payment_id || '',
payment_id: e.currentTarget.dataset.payment || 0,
pay_price: e.currentTarget.dataset.price,
order_select_ids: [],
});
@ -664,7 +665,7 @@
is_show_payment_popup: true,
temp_pay_value: this.order_select_ids.join(','),
pay_price: Math.round(parseFloat(num) * 100) / 100,
payment_id: this.order_select_ids.length > 1 ? this.mult_payment_id : this.mult_payment_id_list[0],
payment_id: this.order_select_ids.length > 1 ? this.default_payment_id : this.mult_payment_id_list[0],
});
},