withdDialog.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <Base-dialog
  3. title="申请提现"
  4. :disabledBtn="disabledBtn"
  5. :isShow.sync="isShow"
  6. @submit="submitForm"
  7. @close="close"
  8. >
  9. <el-form :inline="true" :model="form" :rules="rules" ref="form">
  10. <el-form-item label="提现金额:" prop="cash">
  11. <el-input
  12. @input="formatNum(form.cash, 'cash')"
  13. v-model.Number="form.cash"
  14. placeholder="请输入提现金额"
  15. >
  16. </el-input>
  17. </el-form-item>
  18. </el-form>
  19. <div class="step-box">
  20. <el-steps :active="active" align-center>
  21. <el-step title="微信账号授权"></el-step>
  22. <el-step title="提现申请"></el-step>
  23. <el-step title="提现审核"></el-step>
  24. <el-step title="提现申请成功"></el-step>
  25. </el-steps>
  26. <div class="step-code-box" v-if="active == 1">
  27. <vue-qr :text="wxCodeUrl" :size="200"></vue-qr>
  28. </div>
  29. </div>
  30. <div class="withd-tips">
  31. 提现注意事项:
  32. <p>1.当佣金被结算时有一定的冻结期,被解冻的佣金方可提现</p>
  33. <p>2.微信打款当日单笔金额1元至200元,当日最多1000元</p>
  34. <p>3.通常在1-3个工作日内可到账</p>
  35. </div>
  36. </Base-dialog>
  37. </template>
  38. <script>
  39. import vueQr from "vue-qr";
  40. import { getWxCodeUrl } from "@/api/salesman/commission";
  41. import { checkBindGzh, withdrawal } from "@/api/salesman/user";
  42. export default {
  43. props: {
  44. dialogVisible: {
  45. type: Boolean,
  46. default: false,
  47. },
  48. disabledBtn: {
  49. type: Boolean,
  50. default: false,
  51. },
  52. cash: {
  53. type: Number,
  54. default: 0,
  55. },
  56. },
  57. data() {
  58. var checkMoney = (rule, value, callback) => {
  59. if (!value || value < 1 || value > 200) {
  60. callback(new Error("提现金额需在1至200元之间"));
  61. } else {
  62. callback();
  63. }
  64. };
  65. return {
  66. msgTitle: [
  67. { label: "学习拍照异常", value: 1 },
  68. {
  69. label: "学习拍照太黑无法识别人像,请确保拍照光线充足并拍到全脸",
  70. value: 2,
  71. },
  72. {
  73. label: "学习拍照太模糊无法识别人像,请确保拍照光线充足并拍到全脸",
  74. value: 3,
  75. },
  76. {
  77. label: "学习拍照人像不全无法识别,请确保拍照光线充足并拍到全脸",
  78. value: 4,
  79. },
  80. ],
  81. form: {
  82. cash: 0,
  83. },
  84. rules: {
  85. cash: [{ required: true, validator: checkMoney, trigger: "blur" }],
  86. },
  87. reverse: true,
  88. activities: [
  89. {
  90. content: "活动按期开始",
  91. },
  92. {
  93. content: "通过审核",
  94. },
  95. {
  96. content: "创建成功",
  97. },
  98. ],
  99. active: 2,
  100. wxCodeUrl: "",
  101. };
  102. },
  103. methods: {
  104. submitForm() {
  105. this.$refs.form.validate(async (valid) => {
  106. if (valid) {
  107. if (this.active == 1) {
  108. await this.checkBindGzh();
  109. if (this.active == 1) {
  110. this.$message.warning("请先微信授权");
  111. return;
  112. }
  113. }
  114. withdrawal(this.form).then((res) => {
  115. if (res.code == 200) {
  116. this.$message.success("提现申请成功");
  117. this.isShow = false;
  118. this.$emit("getSellerInfo");
  119. }
  120. });
  121. } else {
  122. return false;
  123. }
  124. });
  125. },
  126. uploadText(msg) {
  127. this.formData.cheating_reason = msg;
  128. },
  129. close() {
  130. this.isShow = false;
  131. this.$refs.form.clearValidate();
  132. },
  133. checkBindGzh() {
  134. return checkBindGzh().then((res) => {
  135. this.active = res.data ? 2 : 1;
  136. if (this.active == 1) {
  137. this.getWxCodeUrl();
  138. }
  139. return Promise.resolve();
  140. });
  141. },
  142. formatNum(val, key) {
  143. let temp = val.toString();
  144. temp = temp.replace(/。/g, ".");
  145. temp = temp.replace(/[^\d.]/g, "");
  146. temp = temp.replace(/^\./g, "");
  147. temp = temp.replace(/\.{2,}/g, "");
  148. temp = temp.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
  149. temp = temp.replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
  150. this.form[key] = temp;
  151. },
  152. getWxCodeUrl() {
  153. getWxCodeUrl().then((res) => {
  154. this.wxCodeUrl = res.data;
  155. });
  156. },
  157. },
  158. computed: {
  159. isShow: {
  160. get() {
  161. return this.dialogVisible;
  162. },
  163. set(val) {
  164. this.$emit("update:dialogVisible", false);
  165. },
  166. },
  167. },
  168. created() {
  169. this.checkBindGzh();
  170. },
  171. components: {
  172. vueQr,
  173. },
  174. watch: {
  175. dialogVisible(val) {
  176. if (val) {
  177. this.form.cash = this.cash >= 200 ? 200 : this.cash || 0;
  178. }
  179. },
  180. },
  181. };
  182. </script>
  183. <style lang="less" scoped>
  184. .input-suffix {
  185. display: flex;
  186. align-items: center;
  187. }
  188. .withd-tips {
  189. margin-top: 30px;
  190. line-height: 10px;
  191. color: #999;
  192. }
  193. .step-box {
  194. margin-top: 20px;
  195. .step-code-box {
  196. width: 200px;
  197. margin: 20px auto 0;
  198. }
  199. }
  200. </style>