修改组件

This commit is contained in:
zpc 2025-03-24 03:32:00 +08:00
parent eed6c2d980
commit c3fba3bfd2
5 changed files with 1337 additions and 1290 deletions

View File

@ -96,7 +96,8 @@ class ConfigManager {
static getGoodType() {
let goodType = this.get('good_type');
if (goodType != null) {
return goodType.map(item => {
// goodType数组过滤只保留is_show=1的项目
return goodType.filter(item => item.is_show === 1).map(item => {
return {
id: item.value,
title: item.name
@ -106,6 +107,18 @@ class ConfigManager {
return [];
}
/**
* 获取指定盒子类型
* @param {Number} type 盒子类型
* @returns {Object} 盒子类型对象
*/
static getGoodTypeFind(type) {
let goodType = this.get('good_type');
if (goodType != null) {
return goodType.find(item => item.value == type);
}
}
/**
* 刷新配置数据
* @returns {Promise} 返回刷新完成的Promise

View File

@ -51,7 +51,7 @@
<view class="price">
<template v-if="pageData.goods.type != 5">¥</template>
<text>{{ orderData.goods.price }}</text>
<template v-if="pageData.goods.type == 5">积分</template>
<template v-if="pageData.goods.type == 5">{{currencyName2}}</template>
</view>
<view class="num">×{{ orderData.goods.prize_num }}</view>
@ -73,27 +73,13 @@
</view>
</view>
</template>
<view v-if="pageData.goods.type == 5" class="pay-type">
<view class="title">
使用积分抵扣
{{ orderData.use_score }} <text style="color: #676767; font-size: 16rpx;">
(剩余:{{ orderData.score }})</text>
</view>
<view class="icon">
<image v-if="true" :src="$img1('common/check_act.png')" lazy-load></image>
<image v-else :src="$img1('common/check.png')" lazy-load></image>
</view>
</view>
<view v-if="pageData.goods.type == 6 && !getBtnXianShi()"> </view>
<template v-else>
<view class="pay-type" @click="changePayMethod('useIntegral')">
<view class="pay-type" v-if="pay_currency" @click="changePayMethod('useIntegral')">
<view class="title flex align-center">
使用{{currencyName}}抵扣¥{{ orderData.use_integral_money }}
<text style="color: #676767; font-size: 16rpx; margin-left: 10rpx;">(剩余:{{orderData.integral}})</text>
使用{{ currencyName }}{{deduction_name}}¥{{ orderData.use_integral_money }}
<text
style="color: #676767; font-size: 16rpx; margin-left: 10rpx;">(剩余:{{ orderData.integral }})</text>
</view>
<view class="icon">
@ -102,9 +88,9 @@
</view>
</view>
<view class="pay-type" @click="changePayMethod('useMoney')">
<view class="pay-type" v-if="pay_balance" @click="changePayMethod('useMoney')">
<view class="title flex align-center">
使用{{balanceName}}抵扣¥{{ orderData.use_money }}
使用{{ balanceName }}{{deduction_name}}¥{{ orderData.use_money }}
<text style="color: #676767; font-size: 16rpx; margin-left: 10rpx;">
(剩余:{{ orderData.money }})</text>
</view>
@ -114,14 +100,27 @@
<image v-else :src="$img1('common/check.png')" lazy-load></image>
</view>
</view>
<view class="pay-type" v-if="pay_currency2" @click="changePayMethod('useMoney2')">
<view class="title flex align-center">
使用{{ currencyName2 }}{{deduction_name}}¥{{ (orderData.use_score/100).toFixed(2) }} <text style="color: #676767; font-size: 16rpx; margin-left: 10rpx;">
(剩余:{{ orderData.score }})</text>
</view>
<view class="icon">
<image v-if="useMoney2" :src="$img1('common/check_act.png')" lazy-load></image>
<image v-else :src="$img1('common/check.png')" lazy-load></image>
</view>
</view>
</template>
<view class="rule">
<scroll-view class="rule-inner" scroll-y>
<rich-text :nodes="sendRuleData"></rich-text>
</scroll-view>
</view>
<view class="agree" @click="$emit('toggle-agree')">
<view class="icon">
<image v-if="isAgree" :src="$img1('common/check_act.png')" lazy-load></image>
@ -142,7 +141,7 @@
<view class="pay-btn" @click="$emit('confirm')">
<text>确认支付</text>
<text>{{
pageData.goods.type == 5 ? ` ${orderData.use_score}积分` : ` ¥${orderData.price}`
pageData.goods.type == 5 ? ` ${(orderData.use_score/100).toFixed(2)}积分` : ` ¥${orderData.price}`
}}</text>
</view>
</view>
@ -168,6 +167,11 @@ export default {
type: Boolean,
default: true
},
//使2
useMoney2: {
type: Boolean,
default: true
},
// 使
useIntegral: {
type: Boolean,
@ -195,39 +199,81 @@ export default {
}
},
data() {
//pageData.goods.type
return {
currencyName: '',
balanceName: ''
currencyName2:'',
balanceName: '',
pay_balance: 1,
pay_coupon: 1,
pay_currency: 1,
pay_currency2: 1,
pay_wechat: 1,
is_deduction: 1,
deduction_name:''
}
},
created() {
//
this.currencyName = this.$config.getAppSetting('currency1_name') || '积分';
this.currencyName = this.$config.getAppSetting('currency1_name') || '货币';
this.currencyName2 = this.$config.getAppSetting('currency2_name') || '积分';
this.balanceName = this.$config.getAppSetting('balance_name') || '余额';
let goodType = this.$config.getGoodTypeFind(this.pageData.goods.type);
//
this.pay_balance = goodType.pay_balance;
//
this.pay_coupon = goodType.pay_coupon;
//
this.pay_currency = goodType.pay_currency;
//2
this.pay_currency2 = goodType.pay_currency2;
//
this.pay_wechat = goodType.pay_wechat;
//
this.is_deduction=goodType.is_deduction;
if(this.is_deduction==1){
this.deduction_name='抵扣';
}else{
this.deduction_name='支付';
}
},
methods: {
/**
* 打开弹窗
*/
open() {
this.$refs.popup.open();
},
/**
* 关闭弹窗
*/
close() {
this.$refs.popup.close();
},
/**
* 切换支付方式
* @param {String} method 支付方式
*/
changePayMethod(method) {
if(this.is_deduction==0){
//
let availablePayMethods = 0;
if(this.pay_balance) availablePayMethods++;
if(this.pay_currency) availablePayMethods++;
if(this.pay_currency2) availablePayMethods++;
//
if(availablePayMethods <= 1) {
return;
}
}
this.$emit('change-pay', method);
},
/**
* 检查按钮是否显示
*/
@ -448,4 +494,4 @@ export default {
}
}
}
</style>
</style>

View File

@ -108,19 +108,7 @@
<image v-else :src="$img1('common/check.png')" lazy-load></image>
</view>
</view>
<!-- <view class="pay-type" @click="changePay('useMoney')">
<view class="" style="width: 100%; color: white;">
星钻支付¥
{{ orderData.goods.price }} (剩余:{{ orderData.money }})
</view>
<view class="icon">
<image v-if="useMoney" :src="$img1('common/check_act.png')" lazy-load></image>
<image v-else :src="$img1('common/check.png')" lazy-load></image>
</view>
</view> -->
</view>
<view class="rule">

File diff suppressed because it is too large Load Diff