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

130 lines
4.2 KiB
Vue

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