修改组件

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,6 +100,19 @@
<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">
@ -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,17 +199,47 @@ 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: {
/**
* 打开弹窗
*/
@ -225,6 +259,18 @@ export default {
* @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);
},

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

View File

@ -70,7 +70,8 @@
</view>
<view>赏品余量</view>
<view class="align-center">
<text>{{ pageData.goods.goodslist_surplus_stock }}</text>/{{ pageData.goods.goodslist_stock }}
<text>{{ pageData.goods.goodslist_surplus_stock }}</text>/{{ pageData.goods.goodslist_stock
}}
</view>
</view>
</view>
@ -130,23 +131,11 @@
</view>
</view>
<order-confirm-popup
ref="buyPop"
v-if="orderData"
:order-data="orderData"
:page-data="pageData"
:use-money="useMoney"
:use-integral="useIntegral"
:coupon-data="couponData"
:is-agree="isAgree"
:send-rule-data="sendRuleData"
:buy-num="buyNum"
@close="close('buyPop')"
@change-pay="changePay"
@toggle-agree="isAgree = !isAgree"
@to-coupon="toCoupon"
@confirm="$c.noDouble1(confirmSubmit, [1, buyNum], choujiangloading)"
></order-confirm-popup>
<order-confirm-popup ref="buyPop" v-if="orderData" :order-data="orderData" :page-data="pageData"
:use-money="useMoney" :use-money2="useMoney2" :use-integral="useIntegral" :coupon-data="couponData"
:is-agree="isAgree" :send-rule-data="sendRuleData" :buy-num="buyNum" @close="close('buyPop')"
@change-pay="changePay" @toggle-agree="isAgree = !isAgree" @to-coupon="toCoupon"
@confirm="$c.noDouble1(confirmSubmit, [1, buyNum], choujiangloading)"></order-confirm-popup>
<buy-notice ref="buyNotice"
@confirm="$c.noDouble(confirmSubmit, [1, buyNum, true], choujiangloading)"></buy-notice>
@ -197,9 +186,9 @@
</template>
<script>
import OrderConfirmPopup from '@/components/order-confirm-popup/order-confirm-popup.vue'
import OrderConfirmPopup from '@/components/order-confirm-popup/order-confirm-popup.vue'
export default {
export default {
components: {
OrderConfirmPopup
},
@ -208,8 +197,7 @@
optData: "",
boxNum: "",
buyNum: 0,
useMoney: true,
useIntegral: true,
// (, )
downOption: {
auto: false,
@ -256,7 +244,13 @@
logList: [],
sendRuleData: "",
choujiangloading: false,
useMoney: true,
useIntegral: true,
useMoney2: true,
};
},
created() {
},
computed: {},
onShareAppMessage() {
@ -415,7 +409,6 @@
changePay(e) {
this[e] = !this[e];
this.confirmSubmit([0, this.buyNum]);
},
@ -433,6 +426,7 @@
if (!this.getBtnXianShi(0)) {
this.useMoney = false;
this.useIntegral = false;
this.useMoney2 = false;
}
this.buyNum = num;
@ -443,6 +437,7 @@
use_money_is: this.useMoney ? 1 : 2,
use_integral_is: this.useIntegral ? 1 : 2,
coupon_id: (this.couponData && this.couponData.id) || "",
use_money2_is: this.useMoney2 ? 1 : 2
};
if (this.pageData.goods.type == 5) {
@ -641,6 +636,10 @@
}
this.pageData = res.data;
let goodType = this.$config.getGoodTypeFind(this.pageData.goods.type);
this.useMoney = goodType.pay_balance == 1 ? true : false;
this.useIntegral = goodType.pay_currency == 1 ? true : false;
this.useMoney2 = goodType.pay_currency2 == 1 ? true : false;
console.log(this.pageData);
}
},
@ -655,6 +654,7 @@
if (xuangou.quanju_xiangou == 0) {
return true;
}
if (type == 0) {
return false;
}
@ -709,11 +709,11 @@
}
},
},
};
};
</script>
<style lang="scss">
.navLeft {
.navLeft {
width: 100%;
position: fixed;
left: 30rpx;
@ -726,9 +726,9 @@
font-size: 50rpx;
color: #ffffff;
}
}
}
.content {
.content {
padding: 0 0 300rpx;
background-color: #ffffff;
@ -1509,5 +1509,5 @@
height: 1624rpx;
}
}
}
}
</style>