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

330 lines
8.8 KiB

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