学员端小程序
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.

259 lines
6.6 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
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
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="onsubmit">提交</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. [
  95. {lab: '不想学了',id: 1},
  96. {lab: '有事情',id: 2},
  97. {lab: '去别的地方学',id: 3},
  98. ]
  99. ],
  100. codeText: '发送验证码',
  101. }
  102. },
  103. computed: {
  104. isPhone() {
  105. return uni.$u.test.mobile(this.FormData.mobile)
  106. }
  107. },
  108. created() {
  109. this.getdictDataListFn()
  110. },
  111. methods: {
  112. // 提交表单
  113. async onsubmit() {
  114. for(let key in this.FormDataToast) {
  115. if(!this.FormData[key]) {
  116. return this.$u.toast(this.FormDataToast[key])
  117. }
  118. }
  119. if(!this.isBankCardNumber(this.FormData.idCard)) return this.$u.toast('请输入正确的银行卡号')
  120. let obj = Object.assign({},this.FormData)
  121. obj.idCard = obj.idCard.replace(/\s/g, '');
  122. obj.studentId = this.studentId
  123. obj.orderId = this.orderId
  124. obj.feeType = this.info.orderType
  125. const res = await applyOnlineFund(obj)
  126. if(res.code==0) {
  127. this.$u.toast('申请退款成功')
  128. setTimeout(()=>{
  129. this.$goPage('/pages/mineEntry/myOrder/detail/detail?orderId='+this.orderId)
  130. },1500)
  131. }
  132. // console.log(res)
  133. },
  134. changePrice() {
  135. let maxPrice = this.$u.utils.priceTo(this.info.totalAmount)
  136. if(this.FormData.amount*1>maxPrice) {
  137. this.FormData.amount = ''
  138. return this.$u.toast('金额不得超过¥'+maxPrice)
  139. }
  140. },
  141. async getdictDataListFn() {
  142. const {data: res} = await getdictDataList()
  143. this.reasonArr = [ res ]
  144. // console.log(res)
  145. },
  146. confirmReason(val) {
  147. let item = val.value[0]
  148. this.FormData.reasonName = item.label
  149. this.FormData.reasonType = item.value
  150. this.showReason = false
  151. console.log(item)
  152. },
  153. // 基本的校验银行卡规则
  154. isBankCardNumber(cardNumber) {
  155. // 去除空格
  156. cardNumber = cardNumber.replace(/\s/g, '');
  157. // 银行卡号一般为 12-19 位数字
  158. const regex = /^[0-9]{12,19}$/;
  159. return regex.test(cardNumber);
  160. },
  161. // 发送短信验证码
  162. async goSms() {
  163. if (!this.FormData.mobile) return this.$u.toast('请输入手机号');
  164. if (!this.isPhone) return this.$u.toast('手机号格式有误');
  165. if (this.codeOn) return
  166. this.codeOn = true;
  167. let _this = this
  168. getLoginCode({
  169. // codeType: 1,
  170. mobile: this.FormData.mobile,
  171. scene: 1,
  172. }).then(()=>{
  173. // 获取验证码
  174. var time = 60;
  175. var timer = setInterval(() => {
  176. time--;
  177. _this.codeText = time + "秒后重新发送"
  178. if (time == 0) {
  179. clearInterval(timer);
  180. _this.codeText = "获取验证码";
  181. _this.codeOn = false;
  182. }
  183. }, 1000);
  184. }).catch(()=>{
  185. _this.codeOn = false;
  186. })
  187. },
  188. }
  189. }
  190. </script>
  191. <style lang="scss" scoped>
  192. .h1 {
  193. margin: 20rpx 0;
  194. }
  195. .card {
  196. padding: 12rpx 28rpx;
  197. margin-bottom: 24rpx;
  198. .row {
  199. display: flex;
  200. align-items: center;
  201. justify-content: space-between;
  202. height: 80rpx;
  203. line-height: 80rpx;
  204. .lab {
  205. font-size: 28rpx;
  206. color: #333;
  207. font-weight: 500;
  208. width: 152rpx;
  209. }
  210. .val {
  211. flex: 1;
  212. &.tpsBlue {
  213. font-size: 24rpx;
  214. }
  215. .flex-b {
  216. .scan {
  217. width: 44rpx;
  218. height: 44rpx;
  219. }
  220. .code {
  221. flex-shrink: 0;
  222. color: #ADADAD;
  223. &.active {
  224. color: $themC;
  225. }
  226. }
  227. }
  228. }
  229. .icon {
  230. u-icon {
  231. }
  232. }
  233. }
  234. .tpsBlue {
  235. color: $themC;
  236. margin-bottom: 10rpx;
  237. padding-left: 152rpx;
  238. font-size: 24rpx;
  239. }
  240. .tpsHui {
  241. font-size: 24rpx;
  242. color: #ADADAD;
  243. padding: 0rpx 0 16rpx 0;
  244. }
  245. }
  246. .btnBg {
  247. width: 396rpx;
  248. margin: 94rpx auto;
  249. }
  250. </style>