学员端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

274 lines
7.0 KiB

1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
  1. <template>
  2. <view class="form">
  3. <view class="card">
  4. <view class="row" @click="showReason=true">
  5. <view class="lab">退款原因</view>
  6. <mySelect placeholder="请选择" :value="FormData.reasonName" style="flex: 1;"></mySelect>
  7. <view class="icon">
  8. <u-icon name="arrow-right"></u-icon>
  9. </view>
  10. </view>
  11. <!-- <view class="tpsBlue">此操作容易造成您已有学时丢失请谨慎</view> -->
  12. <view class="row">
  13. <view class="lab">退款金额</view>
  14. <view class="val">
  15. <u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.amount" @blur="changePrice"></u--input>
  16. </view>
  17. </view>
  18. <view class="tpsHui">退款金额不可超过¥ {{$u.utils.priceTo(info.totalAmount)}}</view>
  19. </view>
  20. <view class="h1">收款信息</view>
  21. <view class="card">
  22. <view class="row">
  23. <view class="lab">持卡人</view>
  24. <view class="val">
  25. <u--input placeholder="请输入" border="none" clearable v-model="FormData.stuName"></u--input>
  26. </view>
  27. </view>
  28. <view class="row">
  29. <view class="lab">手机号</view>
  30. <view class="val">
  31. <view class="flex-b">
  32. <view class="inputBox">
  33. <u--input placeholder="请输入" border="none" type="number" maxlength="11" v-model="FormData.mobile"></u--input>
  34. </view>
  35. <view class="code" @click='goSms' :class="{active: isPhone&&!codeOn}">{{codeText}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="row">
  40. <view class="lab" >验证码</view>
  41. <view class="val">
  42. <u--input placeholder="请输入" border="none" type="number" maxlength="11" v-model="FormData.code"></u--input>
  43. </view>
  44. </view>
  45. <view class="row">
  46. <view class="lab">卡号</view>
  47. <view class="val">
  48. <view class="flex-b">
  49. <view class="inputBox">
  50. <u--input placeholder="请输入" border="none" clearable v-model="FormData.idCard"></u--input>
  51. </view>
  52. <view class="scan">
  53. <image src="@/static/images/userCenter/btn_yinhangkax.png" mode=""></image>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="row">
  59. <view class="lab">开户行</view>
  60. <view class="val">
  61. <u--input placeholder="请输入" border="none" clearable v-model="FormData.bankName"></u--input>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="btnBg" @click="applyOnlineFundFn">提交</view>
  66. <u-picker :show="showReason" :columns="reasonArr" keyName="label" @confirm="confirmReason" @cancel="showReason=false"></u-picker>
  67. </view>
  68. </template>
  69. <script>
  70. import { getdictDataList, applyOnlineFund, getLoginCode } from '@/config/api.js'
  71. export default {
  72. props: ['info', 'orderId'],
  73. data() {
  74. return {
  75. FormData: {
  76. reasonType: '',
  77. reasonName: '',
  78. mobile: '',
  79. amount: '',
  80. stuName: ''
  81. },
  82. FormDataToast: {
  83. reasonName: '请选择退款原因',
  84. amount: '请输入退款金额',
  85. stuName: '请输入持卡人',
  86. mobile: '请输入手机号',
  87. code: '请输入验证码',
  88. idCard: '请输入卡号',
  89. bankName: '请输入开启行'
  90. },
  91. showReason: false ,
  92. codeOn: false,
  93. reasonArr: [],
  94. codeText: '发送验证码',
  95. }
  96. },
  97. computed: {
  98. isPhone() {
  99. return uni.$u.test.mobile(this.FormData.mobile)
  100. }
  101. },
  102. created() {
  103. this.getdictDataListFn()
  104. },
  105. methods: {
  106. // 申请退款
  107. applyOnlineFundFn() {
  108. let _this = this
  109. uni.showModal({
  110. title: '确定要提交申请退款吗?',
  111. content: '提交申请后,待教练和驾校审核通过即可收到退款~',
  112. success: async ()=> {
  113. _this.onsubmit()
  114. }
  115. })
  116. },
  117. // 提交表单
  118. async onsubmit() {
  119. for(let key in this.FormDataToast) {
  120. if(!this.FormData[key]) {
  121. return this.$u.toast(this.FormDataToast[key])
  122. }
  123. }
  124. if(!this.isBankCardNumber(this.FormData.idCard)) return this.$u.toast('请输入正确的银行卡号')
  125. let obj = Object.assign({},this.FormData)
  126. obj.idCard = obj.idCard.replace(/\s/g, '');
  127. obj.studentId = this.studentId
  128. obj.orderId = this.orderId
  129. obj.feeType = this.info.orderType
  130. const res = await applyOnlineFund(obj)
  131. if(res.code==0) {
  132. this.$u.toast('申请退款成功')
  133. this.FormData = {
  134. reasonType: '',
  135. reasonName: '',
  136. mobile: '',
  137. amount: '',
  138. stuName: '',
  139. bankName: '',
  140. idCard: '',
  141. code: ''
  142. }
  143. setTimeout(()=>{
  144. this.$goPage('/pages/mineEntry/myOrder/detail/detail?orderId='+this.orderId+'&refundId='+res.data)
  145. },1500)
  146. }
  147. // console.log(res)
  148. },
  149. changePrice() {
  150. let maxPrice = this.$u.utils.priceTo(this.info.totalAmount)
  151. if(this.FormData.amount*1>maxPrice) {
  152. this.FormData.amount = ''
  153. return this.$u.toast('金额不得超过¥'+maxPrice)
  154. }
  155. },
  156. async getdictDataListFn() {
  157. const {data: res} = await getdictDataList()
  158. this.reasonArr = [ res ]
  159. // console.log(res)
  160. },
  161. confirmReason(val) {
  162. let item = val.value[0]
  163. this.FormData.reasonName = item.label
  164. this.FormData.reasonType = item.value
  165. this.showReason = false
  166. console.log(item)
  167. },
  168. // 基本的校验银行卡规则
  169. isBankCardNumber(cardNumber) {
  170. // 去除空格
  171. cardNumber = cardNumber.replace(/\s/g, '');
  172. // 银行卡号一般为 12-19 位数字
  173. const regex = /^[0-9]{12,19}$/;
  174. return regex.test(cardNumber);
  175. },
  176. // 发送短信验证码
  177. async goSms() {
  178. if (!this.FormData.mobile) return this.$u.toast('请输入手机号');
  179. if (!this.isPhone) return this.$u.toast('手机号格式有误');
  180. if (this.codeOn) return
  181. this.codeOn = true;
  182. let _this = this
  183. getLoginCode({
  184. // codeType: 1,
  185. mobile: this.FormData.mobile,
  186. scene: 1,
  187. }).then(()=>{
  188. // 获取验证码
  189. var time = 60;
  190. var timer = setInterval(() => {
  191. time--;
  192. _this.codeText = time + "秒后重新发送"
  193. if (time == 0) {
  194. clearInterval(timer);
  195. _this.codeText = "获取验证码";
  196. _this.codeOn = false;
  197. }
  198. }, 1000);
  199. }).catch(()=>{
  200. _this.codeOn = false;
  201. })
  202. },
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. .h1 {
  208. margin: 20rpx 0;
  209. }
  210. .card {
  211. padding: 12rpx 28rpx;
  212. margin-bottom: 24rpx;
  213. .row {
  214. display: flex;
  215. align-items: center;
  216. justify-content: space-between;
  217. height: 80rpx;
  218. line-height: 80rpx;
  219. .lab {
  220. font-size: 28rpx;
  221. color: #333;
  222. font-weight: 500;
  223. width: 152rpx;
  224. }
  225. .val {
  226. flex: 1;
  227. &.tpsBlue {
  228. font-size: 24rpx;
  229. }
  230. .flex-b {
  231. .scan {
  232. width: 44rpx;
  233. height: 44rpx;
  234. }
  235. .code {
  236. flex-shrink: 0;
  237. color: #ADADAD;
  238. &.active {
  239. color: $themC;
  240. }
  241. }
  242. }
  243. }
  244. .icon {
  245. u-icon {
  246. }
  247. }
  248. }
  249. .tpsBlue {
  250. color: $themC;
  251. margin-bottom: 10rpx;
  252. padding-left: 152rpx;
  253. font-size: 24rpx;
  254. }
  255. .tpsHui {
  256. font-size: 24rpx;
  257. color: #ADADAD;
  258. padding: 0rpx 0 16rpx 0;
  259. }
  260. }
  261. .btnBg {
  262. width: 396rpx;
  263. margin: 94rpx auto;
  264. }
  265. </style>