洛阳学员端
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.

331 lines
8.8 KiB

8 months ago
6 months ago
6 months ago
8 months ago
8 months ago
8 months 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. ¥ {{ balanceAmount}}
  16. <!-- <u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.amount" @blur="changePrice"></u--input> -->
  17. </view>
  18. </view>
  19. <!-- <view class="tpsHui" v-if="balanceAmount">退款金额不可超过¥ {{ balanceAmount }}</view> -->
  20. </view>
  21. <view class="card">
  22. <view class="h1"><text class="active">收款信息</text></view>
  23. <view class="row">
  24. <view class="lab">持卡人</view>
  25. <view class="val">
  26. <u--input placeholder="请输入" border="none" clearable v-model="FormData.stuName"></u--input>
  27. </view>
  28. </view>
  29. <view class="row">
  30. <view class="lab">手机号</view>
  31. <view class="val">
  32. <view class="flex-b">
  33. <view class="inputBox">
  34. <u--input placeholder="请输入" border="none" type="number" maxlength="11" v-model="FormData.mobile"></u--input>
  35. </view>
  36. <view class="code" @click='goSms' :class="{active: isPhone&&!codeOn}">{{codeText}}</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="row">
  41. <view class="lab" >验证码</view>
  42. <view class="val">
  43. <u--input placeholder="请输入" border="none" type="number" maxlength="11" v-model="FormData.code"></u--input>
  44. </view>
  45. </view>
  46. <view class="row">
  47. <view class="lab">卡号</view>
  48. <view class="val">
  49. <view class="flex-b">
  50. <view class="inputBox">
  51. <u--input placeholder="请输入" border="none" clearable v-model="FormData.idCard"></u--input>
  52. </view>
  53. <!-- <view class="scan" @click="scanningBanksClick">
  54. <image src="@/static/images/userCenter/btn_yinhangkax.png" mode=""></image>
  55. </view> -->
  56. </view>
  57. </view>
  58. </view>
  59. <view class="row">
  60. <view class="lab">开户行</view>
  61. <view class="val">
  62. <u--input placeholder="请输入" border="none" clearable v-model="FormData.bankName"></u--input>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="footerBtn">
  67. <view class="btnBg" @click="applyOnlineFundFn">提交</view>
  68. </view>
  69. <u-picker :show="showReason" :columns="reasonArr" keyName="label" @confirm="confirmReason" @cancel="showReason=false"></u-picker>
  70. </view>
  71. </template>
  72. <script>
  73. import { getdictDataList, refuse_apply, getLoginCode, scanningBanks } from '@/config/api.js'
  74. import { H5_API, WX_API,httpPrefix } from '@/config/site.config.js';
  75. import { chooseImages } from '@/config/utils.js'
  76. const _url = H5_API + WX_API + httpPrefix + 'app/apply-order/scanningBanks.do';
  77. export default {
  78. props: ['info', 'orderId', 'balanceAmount'],
  79. data() {
  80. return {
  81. FormData: {
  82. reasonType: '',
  83. reasonName: '',
  84. mobile: '',
  85. amount: '',
  86. stuName: ''
  87. },
  88. FormDataToast: {
  89. reasonName: '请选择退款原因',
  90. amount: '请输入退款金额',
  91. stuName: '请输入持卡人',
  92. mobile: '请输入手机号',
  93. code: '请输入验证码',
  94. idCard: '请输入卡号',
  95. bankName: '请输入开启行'
  96. },
  97. showReason: false ,
  98. codeOn: false,
  99. reasonArr: [],
  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. console.log('_url')
  111. console.log(_url)
  112. },
  113. methods: {
  114. // 申请退款
  115. applyOnlineFundFn() {
  116. let _this = this
  117. uni.showModal({
  118. title: '确定要提交申请退款吗?',
  119. content: '提交申请后,驾校审核通过即可收到退款~',
  120. success: async ()=> {
  121. _this.onsubmit()
  122. }
  123. })
  124. },
  125. // 提交表单
  126. async onsubmit() {
  127. for(let key in this.FormDataToast) {
  128. if(!this.FormData[key]) {
  129. return this.$u.toast(this.FormDataToast[key])
  130. }
  131. }
  132. if(!this.isBankCardNumber(this.FormData.idCard)) return this.$u.toast('请输入正确的银行卡号')
  133. // obj.studentId = this.studentId
  134. // obj.orderId = this.orderId
  135. // obj.feeType = this.info.orderType
  136. let obj = {
  137. refundAmount: this.balanceAmount,
  138. refundReasonType: this.FormData.reasonType,
  139. bankCardName: this.FormData.bankName,
  140. bankCardNo: this.FormData.idCard,
  141. userName: this.FormData.stuName,
  142. validCode: this.FormData.code,
  143. }
  144. obj.idCard = this.FormData.idCard.replace(/\s/g, '');
  145. console.log('上传信息')
  146. console.log(obj)
  147. const res = await refuse_apply(obj)
  148. if(res.code==0) {
  149. this.$u.toast('申请退款成功')
  150. this.FormData = {
  151. reasonType: '',
  152. reasonName: '',
  153. mobile: '',
  154. amount: '',
  155. stuName: '',
  156. bankName: '',
  157. idCard: '',
  158. code: ''
  159. }
  160. setTimeout(()=>{
  161. this.$goPage('/pages/mineEntry/myOrder/detail/detail?orderId='+this.orderId+'&refundId='+res.data)
  162. },1500)
  163. }
  164. // console.log(res)
  165. },
  166. changePrice() {
  167. let maxPrice = this.$u.utils.priceTo(this.info.totalAmount)
  168. if(this.FormData.amount*1>maxPrice) {
  169. this.FormData.amount = ''
  170. return this.$u.toast('金额不得超过¥'+maxPrice)
  171. }
  172. },
  173. async getdictDataListFn() {
  174. const {data: res} = await getdictDataList()
  175. this.reasonArr = [ res ]
  176. // console.log(res)
  177. },
  178. confirmReason(val) {
  179. let item = val.value[0]
  180. this.FormData.reasonName = item.label
  181. this.FormData.reasonType = item.value
  182. this.showReason = false
  183. console.log(item)
  184. },
  185. // 基本的校验银行卡规则
  186. isBankCardNumber(cardNumber) {
  187. // 去除空格
  188. cardNumber = cardNumber.replace(/\s/g, '');
  189. // 银行卡号一般为 12-19 位数字
  190. const regex = /^[0-9]{10,22}$/;
  191. return regex.test(cardNumber);
  192. },
  193. // 发送短信验证码
  194. async goSms() {
  195. if (!this.FormData.mobile) return this.$u.toast('请输入手机号');
  196. if (!this.isPhone) return this.$u.toast('手机号格式有误');
  197. if (this.codeOn) return
  198. this.codeOn = true;
  199. let _this = this
  200. getLoginCode({
  201. // codeType: 1,
  202. mobile: this.FormData.mobile,
  203. scene: 31,
  204. }).then(()=>{
  205. // 获取验证码
  206. var time = 60;
  207. var timer = setInterval(() => {
  208. time--;
  209. _this.codeText = time + "秒后重新发送"
  210. if (time == 0) {
  211. clearInterval(timer);
  212. _this.codeText = "获取验证码";
  213. _this.codeOn = false;
  214. }
  215. }, 1000);
  216. }).catch(()=>{
  217. _this.codeOn = false;
  218. })
  219. },
  220. async scanningBanksClick() {
  221. // let filePath = await chooseImages(2)
  222. let _this = this
  223. let timer = new Date() * 1
  224. let token = 'Bearer '+ this.$store.state.user.vuex_loginInfo.accessToken
  225. uni.chooseImage({
  226. count: 1, //允许选择的数量
  227. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  228. sourceType: ['album', 'camera'], //从相册选择
  229. success: res => {
  230. // 上传图片到服务器
  231. console.log(res.tempFilePaths[0])
  232. uni.uploadFile({
  233. url: _url,//接口
  234. filePath: res.tempFilePaths[0],//要上传的图片的本地路径
  235. name: 'file',
  236. formData: {
  237. path: 'complain/'+ uni.$u.date(timer, 'yyyy-mm-dd')+'/'+timer + '-'+ 'scanningBanks',
  238. type: 1,
  239. fileSuffix: "png"
  240. },
  241. header: {
  242. Authorization: token,
  243. 'tenant-id': '1704459882232553474'
  244. },
  245. success(res) {
  246. console.log('上传成功')
  247. let res2 = JSON.parse(res.data)
  248. if(res2.code==0) {
  249. }
  250. // _this.imgArr.push(res2.data)
  251. console.log(res2)
  252. uni.hideLoading();
  253. },
  254. complete: (comp)=> {console.log(comp)}
  255. })
  256. }
  257. })
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss" scoped>
  263. .h1 {
  264. margin: 20rpx 0;
  265. }
  266. .card {
  267. padding: 4rpx 20rpx 28rpx 20rpx;
  268. margin-bottom: 24rpx;
  269. .row {
  270. display: flex;
  271. align-items: center;
  272. justify-content: space-between;
  273. height: 80rpx;
  274. line-height: 80rpx;
  275. .lab {
  276. font-size: 28rpx;
  277. color: #333;
  278. font-weight: 500;
  279. width: 152rpx;
  280. }
  281. .val {
  282. flex: 1;
  283. &.tpsBlue {
  284. font-size: 24rpx;
  285. }
  286. .flex-b {
  287. .scan {
  288. width: 44rpx;
  289. height: 44rpx;
  290. }
  291. .code {
  292. flex-shrink: 0;
  293. color: #ADADAD;
  294. &.active {
  295. color: $themC;
  296. }
  297. }
  298. }
  299. }
  300. .icon {
  301. u-icon {
  302. }
  303. }
  304. }
  305. .tpsBlue {
  306. color: $themC;
  307. margin-bottom: 10rpx;
  308. padding-left: 152rpx;
  309. font-size: 24rpx;
  310. }
  311. .tpsHui {
  312. font-size: 24rpx;
  313. color: #ADADAD;
  314. padding: 0rpx 0 16rpx 0;
  315. }
  316. }
  317. </style>