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

View File

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

View File

@ -228,6 +228,14 @@
number: 0, number: 0,
payStatus: this.$store.getters.globalData.yue_pay_status 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_close: false,
pay_order_id: '', pay_order_id: '',
@ -393,6 +401,7 @@
let that = this; let that = this;
getUserInfo().then(res => { getUserInfo().then(res => {
that.payMode[2].number = res.data.now_money; that.payMode[2].number = res.data.now_money;
that.payMode[3].number = res.data.integral;
that.$set(that, 'payMode', that.payMode); that.$set(that, 'payMode', that.payMode);
}) })
}, },