This commit is contained in:
yangtao 2024-04-15 10:02:47 +08:00
parent 1060399bc7
commit bb3e23627a
3 changed files with 44 additions and 7 deletions

View File

@ -9,9 +9,13 @@
<view class="title">
请输入支付密码
</view>
<view class="subTitle" v-show="show_subTitle">
<view class="subTitle" v-show="show_subTitle&&show_integral">
扣除积分{{price*integral_cash_time}}
</view>
<view class="subTitle" v-show="show_subTitle&&!show_integral">
付款{{price}}
</view>
<view class="pswBox">
<view v-for="(item,index) in 6" :key="index" class="content_item">{{password[index] ? '' : ''}}</view>
</view>
@ -32,16 +36,20 @@
</template>
<script>
import { getUserInfo } from '@/api/user.js';
export default {
props:{
show_key:{
type: Boolean,
default: false
},
price:Number,
price:Object,
show_subTitle:{
default:true
},
show_integral:{
default:false
},
mix:{
type: Boolean,
default: false
@ -52,6 +60,7 @@
num:[], //
num1:[1,2,3,4,5,6,7,8,9,10,11,12],//
password:"",
integral_cash_time:1,
}
},
created() {
@ -60,7 +69,16 @@
this.num.splice(9, 0, 10);
this.num.splice(11, 0, 12);
},
mounted() {
this.getInitUser();
},
methods:{
getInitUser(){
getUserInfo().then((res)=>{
console.log(2222,'sb');
this.integral_cash_time=Number(res.data.integral_cash_time);
})
},
//
randomArray(arr){
return arr.sort(() => Math.random() -0.5);

View File

@ -24,7 +24,7 @@
<view class="iconfont icon-xiangyou"></view>
</view>
</view>
<pay :show_key="payShow" :price="totalPrice" :show_subTitle="true" :mix="true" @payFunc="payFunc" @closeFuc="closePay"></pay>
<pay :show_key="payShow" :price="totalPrice" :show_integral="show_integral" :show_subTitle="true" :mix="true" @payFunc="payFunc" @closeFuc="closePay"></pay>
<view class="mask" ref="close" @click='close' v-if="pay_close"></view>
</view>
</template>
@ -36,6 +36,7 @@
integralOrderPay,
presellOrderPay
} from '@/api/order.js';
import { getUserInfo } from '@/api/user.js';
import pay from '@/components/pay/index.vue';
export default {
components: {
@ -78,12 +79,19 @@
payShow:false,
payInfo:{},
number:0,
show_integral:false,
integral_cash_time:1,
};
},
mounted:function(){
mounted() {
this.getInitUser();
},
methods: {
getInitUser(){
getUserInfo().then((res)=>{
this.integral_cash_time=res.data.integral_cash_time;
})
},
closePay(){
this.payShow=false;
},
@ -109,7 +117,8 @@
});
}
let that = this;
let type = ''
let type = '';
that.show_integral=false;
if (paytype == 'wechat') {
// #ifdef H5
type = this.$wechat.isWeixin() ? 'weixin' : 'h5';
@ -124,6 +133,7 @@
type = 'balance';
}else if (paytype == 'integral') {
type = 'integral';
that.show_integral=true;
}else if(paytype == 'alipay'){
// #ifndef MP
type = 'alipay';
@ -136,7 +146,7 @@
title: '请选择要支付的订单'
});
if (paytype == 'balance' && parseFloat(number) < parseFloat(that.totalPrice)) return that.$util.Tips({title: '余额不足!'});
if (paytype == 'integral' && parseFloat(number/100) < parseFloat(that.totalPrice)) return that.$util.Tips({title: '积分不足!'});
if (paytype == 'integral' && parseFloat(number/that.integral_cash_time) < parseFloat(that.totalPrice)) return that.$util.Tips({title: '积分不足!'});
uni.showLoading({
title: '支付中'
});

View File

@ -228,6 +228,14 @@
number: 0,
payStatus: this.$store.getters.globalData.yue_pay_status
},
{
name: "积分兑付",
icon: "haiyuefont haiyue-jifenduihuan",
value: 'integral',
title: '可用积分:',
number: 0,
payStatus: this.$store.getters.globalData.integration_pay_open,
},
],
pay_close: false,
pay_order_id: '',
@ -393,6 +401,7 @@
let that = this;
getUserInfo().then(res => {
that.payMode[2].number = res.data.now_money;
that.payMode[3].number = res.data.integral;
that.$set(that, 'payMode', that.payMode);
})
},