123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <Base-dialog
- title="申请提现"
- :disabledBtn="disabledBtn"
- :isShow.sync="isShow"
- @submit="submitForm"
- @close="close"
- >
- <el-form :inline="true" :model="form" :rules="rules" ref="form">
- <el-form-item label="提现金额:" prop="cash">
- <el-input
- @input="formatNum(form.cash, 'cash')"
- v-model.Number="form.cash"
- placeholder="请输入提现金额"
- >
- </el-input>
- </el-form-item>
- </el-form>
- <div class="step-box">
- <el-steps :active="active" align-center>
- <el-step title="微信账号授权"></el-step>
- <el-step title="提现申请"></el-step>
- <el-step title="提现审核"></el-step>
- <el-step title="提现申请成功"></el-step>
- </el-steps>
- <div class="step-code-box" v-if="active == 1">
- <vue-qr :text="wxCodeUrl" :size="200"></vue-qr>
- </div>
- </div>
- <div class="withd-tips">
- 提现注意事项:
- <p>1.当佣金被结算时有一定的冻结期,被解冻的佣金方可提现</p>
- <p>2.微信打款当日单笔金额1元至200元,当日最多1000元</p>
- <p>3.通常在1-3个工作日内可到账</p>
- </div>
- </Base-dialog>
- </template>
- <script>
- import vueQr from "vue-qr";
- import { getWxCodeUrl } from "@/api/salesman/commission";
- import { checkBindGzh, withdrawal } from "@/api/salesman/user";
- export default {
- props: {
- dialogVisible: {
- type: Boolean,
- default: false,
- },
- disabledBtn: {
- type: Boolean,
- default: false,
- },
- cash: {
- type: Number,
- default: 0,
- },
- },
- data() {
- var checkMoney = (rule, value, callback) => {
- if (!value || value < 1 || value > 200) {
- callback(new Error("提现金额需在1至200元之间"));
- } else {
- callback();
- }
- };
- return {
- msgTitle: [
- { label: "学习拍照异常", value: 1 },
- {
- label: "学习拍照太黑无法识别人像,请确保拍照光线充足并拍到全脸",
- value: 2,
- },
- {
- label: "学习拍照太模糊无法识别人像,请确保拍照光线充足并拍到全脸",
- value: 3,
- },
- {
- label: "学习拍照人像不全无法识别,请确保拍照光线充足并拍到全脸",
- value: 4,
- },
- ],
- form: {
- cash: 0,
- },
- rules: {
- cash: [{ required: true, validator: checkMoney, trigger: "blur" }],
- },
- reverse: true,
- activities: [
- {
- content: "活动按期开始",
- },
- {
- content: "通过审核",
- },
- {
- content: "创建成功",
- },
- ],
- active: 2,
- wxCodeUrl: "",
- };
- },
- methods: {
- submitForm() {
- this.$refs.form.validate(async (valid) => {
- if (valid) {
- if (this.active == 1) {
- await this.checkBindGzh();
- if (this.active == 1) {
- this.$message.warning("请先微信授权");
- return;
- }
- }
- withdrawal(this.form).then((res) => {
- if (res.code == 200) {
- this.$message.success("提现申请成功");
- this.isShow = false;
- this.$emit("getSellerInfo");
- }
- });
- } else {
- return false;
- }
- });
- },
- uploadText(msg) {
- this.formData.cheating_reason = msg;
- },
- close() {
- this.isShow = false;
- this.$refs.form.clearValidate();
- },
- checkBindGzh() {
- return checkBindGzh().then((res) => {
- this.active = res.data ? 2 : 1;
- if (this.active == 1) {
- this.getWxCodeUrl();
- }
- return Promise.resolve();
- });
- },
- formatNum(val, key) {
- let temp = val.toString();
- temp = temp.replace(/。/g, ".");
- temp = temp.replace(/[^\d.]/g, "");
- temp = temp.replace(/^\./g, "");
- temp = temp.replace(/\.{2,}/g, "");
- temp = temp.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
- temp = temp.replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
- this.form[key] = temp;
- },
- getWxCodeUrl() {
- getWxCodeUrl().then((res) => {
- this.wxCodeUrl = res.data;
- });
- },
- },
- computed: {
- isShow: {
- get() {
- return this.dialogVisible;
- },
- set(val) {
- this.$emit("update:dialogVisible", false);
- },
- },
- },
- created() {
- this.checkBindGzh();
- },
- components: {
- vueQr,
- },
- watch: {
- dialogVisible(val) {
- if (val) {
- this.form.cash = this.cash >= 200 ? 200 : this.cash || 0;
- }
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .input-suffix {
- display: flex;
- align-items: center;
- }
- .withd-tips {
- margin-top: 30px;
- line-height: 10px;
- color: #999;
- }
- .step-box {
- margin-top: 20px;
- .step-code-box {
- width: 200px;
- margin: 20px auto 0;
- }
- }
- </style>
|