shangjia1.1/pages/store/withdraw/credit.vue

135 lines
4.3 KiB
Vue
Raw Normal View History

2024-11-08 14:33:35 +08:00
<template>
2024-11-26 15:28:15 +08:00
<view class="body">
<view class="header">
<view class="container">
<view class="icon">
<u-image v-if="false" height="60" width="60"
src="https://yuledui.oss-cn-qingdao.aliyuncs.com/merch_manage/img/credit_card_icon.png"></u-image>
</view>
<view class="title " @click='showInfo = !showInfo'>
扫码付款 <text style="font-weight:bold;">[金豆抵扣]</text>设置<u-icon name="info-circle
2024-11-08 14:33:35 +08:00
" size="28"></u-icon>
2024-11-26 15:28:15 +08:00
</view>
</view>
</view>
<!-- <view class="payinfo" v-if="showInfo">
2024-11-08 14:33:35 +08:00
<view>开启金豆抵扣后,
<text style="font-weight:bold;">将同时开启随机立减功能;</text></view>
<view style="color:red;">请注意:提现时将扣除订单金豆赠送比例金额</view> -->
2024-11-26 15:28:15 +08:00
<!-- 0.0038平台手续费 -->
<!-- <view style="color:red;">例如:金豆赠送比例为0.01(百分之一),那消费者付款100元后,您将得到100*(1-0.0038)-(0.01*100)=98.62</view>
2024-11-08 14:33:35 +08:00
<view style="color:#999999;">随机立减费用由余乐兑平台方承担,不会从商家提现中扣除</view>
</view> -->
2024-11-26 15:28:15 +08:00
<!-- <view class="content">
2024-11-08 14:33:35 +08:00
<u--form :model="form" ref="uForm">
<u-form-item label="是否开启金豆抵扣" label-width="280" prop="redirect">
<u-switch size='50' v-model="openCreditGive" @change="openCreditGiveChange" slot="right"></u-switch>
</u-form-item>
</u--form>
2024-11-26 15:28:15 +08:00
</view> -->
2024-11-08 14:33:35 +08:00
2024-11-26 15:28:15 +08:00
<view class="content" v-if="openCreditGive">
<u--form :model="form" ref="uForm">
<u-form-item label-width="300" :label-position="labelPosition" label="当前金豆抵扣比例(%):" prop="credit_give">
<u-input :border="border" type="number" placeholder="请输入金豆抵扣比例"
v-model="form.deduction_ratio"></u-input>
</u-form-item>
<u-form-item label-width="300" :label-position="labelPosition" label="输入金豆抵扣比例(%):" prop="credit_give">
<u-input :border="border" type="number" placeholder="请输入金豆抵扣比例"
v-model="form.credit_give"></u-input>
</u-form-item>
<u-form-item label-width="300" :label-position="labelPosition" label="确认金豆抵扣比例(%):" prop="credit_give2">
<u-input :border="border" type="number" placeholder="请再次输入金豆抵扣比例"
v-model="form.credit_give2"></u-input>
</u-form-item>
</u--form>
</view>
2024-11-08 14:33:35 +08:00
2024-11-26 15:28:15 +08:00
<view style="margin-top: 60rpx;">
<u-button :disabled="false" class="button" @click="submit">保存设置</u-button>
</view>
2024-11-08 14:33:35 +08:00
2024-11-26 15:28:15 +08:00
</view>
2024-11-08 14:33:35 +08:00
</template>
<script>
2024-11-26 15:28:15 +08:00
import {
update_deduction
} from '@/utils/api.js'
2024-11-08 14:33:35 +08:00
let that = {}
export default {
data() {
return {
showInfo: false,
form: {
},
2024-11-26 15:28:15 +08:00
bankImgUp: 'http://yuledui.oss-cn-qingdao.aliyuncs.com/merch_manage/img/bank_card_setting/take_photo.png', // 银行卡照片OCR
2024-11-08 14:33:35 +08:00
openCreditGive: true,
border: 'none',
showPayType: false,
labelPosition: 'left',
2024-11-26 15:28:15 +08:00
modifyCreditMoneyEg: function() {
2024-11-08 14:33:35 +08:00
let resNum = parseFloat(parseFloat(that.form.credit_give) * 100).toFixed(2)
if (parseInt(resNum) == resNum) {
resNum = parseInt(resNum)
}
return resNum
},
};
},
2024-11-26 15:28:15 +08:00
onLoad() {
this.init()
2024-11-08 14:33:35 +08:00
},
methods: {
init() {
2024-11-26 15:28:15 +08:00
if (uni.getStorageSync('shopManage').deduction_ratio > 0) {
this.openCreditGive = true
} else {
this.openCreditGive = false
}
this.form.deduction_ratio = uni.getStorageSync('shopManage').deduction_ratio
2024-11-08 14:33:35 +08:00
},
submit() {
2024-11-26 15:28:15 +08:00
var that=this
// if (!that.openCreditGive) {
// that.form.credit_give = 0
// }
// if (that.form.credit_give >= 1) {
2024-11-08 14:33:35 +08:00
// uni.showModal({
// title: '提示',
2024-11-26 15:28:15 +08:00
// content: '抵现比例必须小于1'
2024-11-08 14:33:35 +08:00
// })
// return
// }
2024-11-26 15:28:15 +08:00
if (that.form.credit_give !== that.form.credit_give2) {
2024-11-08 14:33:35 +08:00
uni.showModal({
title: '提示',
2024-11-26 15:28:15 +08:00
content: '两次输入的抵现比例不一致'
2024-11-08 14:33:35 +08:00
})
2024-11-26 15:28:15 +08:00
return
}
update_deduction({
shop_admin_id: uni.getStorageSync('shopManage').shop_admin_id,
deduction_ratio: this.form.credit_give
}).then(res => {
if(res.code==200){
this.$u.toast('修改成功')
}
2024-11-08 14:33:35 +08:00
})
},
openCreditGiveChange(selectValue) {
2024-11-26 15:28:15 +08:00
console.log(selectValue);
2024-11-08 14:33:35 +08:00
},
creditGiveInputChange(inputValue) {
console.log(inputValue)
},
}
}
</script>
<style lang="scss" scoped>
2024-11-26 15:28:15 +08:00
@import "./creditadd.scss";
</style>