選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

refundPage.vue 12KB

2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <view class="oderPage">
  3. <view class="content">
  4. <text class="title">卡上余额(元)</text>
  5. <view class="">
  6. <text style="font-size: 30rpx;">¥</text>{{state.hasData.cardBalance? state.hasData.cardBalance / 100:state.hasData.cardBalance}}
  7. </view>
  8. </view>
  9. <view class="from">
  10. <view class="from_item">
  11. <text>退费类型:</text>
  12. <u-radio-group v-model="radiovalue1">
  13. <u-radio :customStyle="{marginBottom: '8px'}" activeColor="#2CE242"
  14. v-for="(item, index) in radiolist1" :key="index" :label="item.disabled" :name="item.name"
  15. @change="radioChange">
  16. {{item.name}}
  17. </u-radio>
  18. </u-radio-group>
  19. </view>
  20. <view v-if="flag">
  21. <view class="from_item" >
  22. <text>联系人姓名:</text>
  23. <input type="text" name="" id="" placeholder="请输入联系人姓名" v-model="state.hasData.customerName">
  24. </view>
  25. <view class="from_item" v-if="state.isShow">
  26. <text>开户行:</text>
  27. <!-- <input type="text" name="" placeholder="请输入开户行" v-model="state.bankType"> -->
  28. <picker @change="bindPickerChange" :value="state.index" :range="state.array">
  29. <view class="uni-input">{{state.index==-1?"请选择":state.array[state.index]}}</view>
  30. </picker>
  31. </view>
  32. <view class="from_item" v-if="state.isShow">
  33. <text>开户行支行:</text>
  34. <input type="number" placeholder="开户行支行" v-model="state.branchName">
  35. </view>
  36. <view class="from_item" v-if="state.isShow">
  37. <text>退费银行卡号:</text>
  38. <input type="number" placeholder="请输入银行卡号" v-model="state.bankCardId">
  39. </view>
  40. <view class="from_item" v-if="state.isShow">
  41. <text>开户行地址:</text>
  42. <picker mode="region" @change="choiceAddress" >
  43. <view>{{state.addressShow}}</view>
  44. </picker>
  45. </view>
  46. <u-form-item label="手机号" class="phoneBox" >
  47. <u-input placeholder='请输入手机号' type="number" v-model="state.tel" />
  48. <u-button type="success" size="mini" @click="getCode" v-if="waitTime==0">获取验证码</u-button>
  49. <text class="agreen" v-else>{{waitTime}}后重试</text>
  50. </u-form-item>
  51. <u-form-item label="验证码" >
  52. <u-input placeholder='请输入验证码' type="number" v-model="state.newMobileCode" class="code" />
  53. </u-form-item>
  54. <view class="from_item">
  55. <text>退款方式:</text>
  56. <u-radio-group v-model="radiovalue2">
  57. <u-radio :customStyle="{marginBottom: '8px'}" activeColor="#2CE242"
  58. v-for="(item, index) in radiolist2" :key="index" :label="item.disabled" :name="item.name"
  59. @change="radioChange2">
  60. {{item.name}}
  61. </u-radio>
  62. </u-radio-group>
  63. </view>
  64. <view class="from_item">
  65. <text>用户类型:</text>
  66. <u-radio-group v-model="radiovalue3">
  67. <u-radio :customStyle="{marginBottom: '8px'}" activeColor="#2CE242"
  68. v-for="(item, index) in radiolist3" :key="index" :label="item.disabled" :name="item.name"
  69. @change="radioChange3">
  70. {{item.name}}
  71. </u-radio>
  72. </u-radio-group>
  73. </view>
  74. </view>
  75. </view>
  76. <button class="submit" @click="sure()">确认退费</button>
  77. </view>
  78. </template>
  79. <script setup lang="ts">
  80. import {ref,reactive} from "vue";
  81. import { checkStr, msg } from "@/utils/utils";
  82. import {navTo} from "@/utils/utils";
  83. import {queryRefund,queryCardFreeExit,queryRefundApply,sendCode} from "@/utils/network/api.js";
  84. import {onLoad} from "@dcloudio/uni-app";
  85. import {request} from "@/utils/network/request.js";
  86. import {stringToJson} from "@/utils/network/encryption";
  87. // 单选数据列表
  88. const radiolist1 = reactive([{
  89. name: '卡退费',
  90. disabled: false
  91. },
  92. {
  93. name: '余额补领',
  94. disabled: false
  95. },
  96. ], )
  97. const radiolist2 = reactive([{
  98. name: '银行卡',
  99. disabled: false
  100. },
  101. {
  102. name: '现金',
  103. disabled: false
  104. },
  105. ], )
  106. const radiolist3 = reactive([{
  107. name: '个人',
  108. disabled: false
  109. },
  110. {
  111. name: '单位',
  112. disabled: false
  113. },
  114. ], )
  115. const state = reactive({
  116. name:'',
  117. phone:"",
  118. bank:"",
  119. vehicleId:"", //车牌号
  120. hasData:{}, //通过车牌查出来的数据
  121. address:"", //地址
  122. addressShow:"请选择开户行地址", //展示的地址
  123. tel:"",
  124. newMobileCode:"",
  125. bankType:"", //开户行
  126. branchName:"", //开户行支行
  127. refoundMethod:1, //退款方式 1:银行卡 2现金
  128. array: ['贵阳银行股份有限公司', '中国工商银行股份有限公司', '中国建设银行股份有限公司', '中国银行股份有限公司','中国农业银行股份有限公司','中国交通银行股份有限公司',
  129. '兴业银行股份有限公司','平安银行股份有限公司','中国邮政储蓄银行股份有限公司','中国光大银行股份有限公司','贵州银行股份有限公司','中国民生银行股份有限公司',
  130. '招商银行股份有限公司','.农村信用社联合社','农村商业银行'],
  131. index: -1,
  132. cusType:1, //用户类型 1-个人 2-单位
  133. bankCardId:"", //银行卡号
  134. isShow:true, //是否展示银行卡那些
  135. });
  136. // 单选默认数据
  137. const radiovalue1 = ref('卡退费')
  138. let flag = ref(true)
  139. // 单选
  140. const radioChange = (n) => {
  141. console.log('radioChange', n);
  142. if (n == '卡退费') {
  143. flag.value = true
  144. console.log(flag.value);
  145. } else {
  146. flag.value = false
  147. console.log(flag.value);
  148. }
  149. }
  150. // 单选默认数据
  151. const radiovalue2 = ref('银行卡')
  152. let refundType = ref(true)
  153. const radioChange2 = (n) => {
  154. console.log('radioChange', n);
  155. if (n == '银行卡') {
  156. refundType.value = true
  157. state.refoundMethod=1
  158. state.isShow=true;
  159. console.log(refundType.value);
  160. } else {
  161. refundType.value = false
  162. state.refoundMethod=2
  163. state.isShow=false;
  164. state.bankType="";
  165. state.branchName="";
  166. state.bankCardId="";
  167. state.address="";
  168. console.log(refundType.value);
  169. }
  170. }
  171. // 退款方式
  172. const radiovalue3 = ref('个人')
  173. let refundType3 = ref(true)
  174. const radioChange3 = (n) => {
  175. console.log('radioChange', n);
  176. if (n == '个人') {
  177. refundType3.value = true
  178. state.cusType=1
  179. console.log(refundType.value);
  180. } else {
  181. refundType3.value = false
  182. state.cusType=2
  183. console.log(refundType.value);
  184. }
  185. }
  186. /*视图进入后操作*/
  187. onLoad((option) => {
  188. state.vehicleId = option.vehicleId
  189. queryRefundAction();
  190. });
  191. const sure=()=>{
  192. // 卡退费
  193. if(flag.value){
  194. // 银行卡才需要做这些判断
  195. if(refundType.value){
  196. if(state.array[state.index]=='请选择'){
  197. msg("请输入开户行!");
  198. return;
  199. }
  200. if(!state.branchName){
  201. msg("请输入开户行支行!");
  202. return;
  203. }
  204. if(state.addressShow=="请选择开户行地址"){
  205. msg("请选择开户行地址!");
  206. return;
  207. }
  208. if(!state.bankCardId){
  209. msg("请输入银行卡号!");
  210. return;
  211. }
  212. }
  213. if (!checkStr(state.tel, "mobile")) {
  214. msg("请输入正确的手机号!");
  215. return;
  216. }
  217. if(!state.newMobileCode){
  218. msg("请输入验证码!");
  219. return;
  220. }
  221. cardFree();
  222. }else{
  223. // 余额退费
  224. balanceReclaiming();
  225. }
  226. }
  227. //储值卡注销退费查询接口
  228. const queryRefundAction = () => {
  229. var data = {
  230. vehicleId: state.vehicleId
  231. };
  232. const options = {
  233. type: 2,
  234. data: data,
  235. method: "POST",
  236. showLoading: true,
  237. };
  238. request(queryRefund, options).then((res) => {
  239. const data = stringToJson(res.bizContent);
  240. console.log("data",data)
  241. // 有无数据卡数据
  242. if(data.hasData){
  243. state.hasData=data.data[0]
  244. }
  245. });
  246. }
  247. // 卡退费
  248. const cardFree=()=>{
  249. var data = {
  250. orderId: state.hasData.orderId, //退费信息编号
  251. bankType: state.bankType, //开户行
  252. province: state.address[0], //开户行所在的省
  253. sell: state.address[1], //开户行所在的市
  254. cusName: state.hasData.customerName, //开户人名称
  255. bankCardId: state.bankCardId, //银行卡号
  256. cusTel: state.tel, //联系方式
  257. cusType: state.cusType, //用户类型
  258. operateType: state.refoundMethod, //退款方式 1:银行卡 2现金
  259. branchName: state.branchName, //开户行支行名称
  260. code: state.newMobileCode, //验证码
  261. };
  262. const options = {
  263. type: 2,
  264. data: data,
  265. method: "POST",
  266. showLoading: true,
  267. };
  268. console.log("options",options)
  269. request(queryCardFreeExit, options).then((res) => {
  270. const data = stringToJson(res.bizContent);
  271. console.log("data",data)
  272. navTo(`/subpackage/after-sale/refundPage-result`)
  273. });
  274. }
  275. // 余额补领
  276. const balanceReclaiming=()=>{
  277. var data = {
  278. orderId: state.hasData.orderId, //退费信息编号
  279. // orderId: "2a0cc6aca04548a7ac42ee1606eac4f8", //退费信息编号
  280. };
  281. const options = {
  282. type: 2,
  283. data: data,
  284. method: "POST",
  285. showLoading: true,
  286. };
  287. request(queryRefundApply, options).then((res) => {
  288. const data = stringToJson(res.bizContent);
  289. console.log("data",data)
  290. navTo(`/subpackage/after-sale/refundPage-result`)
  291. });
  292. }
  293. function choiceAddress(e){
  294. console.log("e",e.detail.value)
  295. state.address=e.detail.value;
  296. state.addressShow=state.address[0]+"-"+state.address[1]+"-"+state.address[2]
  297. }
  298. const getCode = () => {
  299. console.log(123);
  300. if (state.tel) {
  301. sendCodeApi()
  302. codeInterval()
  303. } else {
  304. uni.showToast({
  305. title: '请输入手机号',
  306. icon: 'none'
  307. });
  308. }
  309. }
  310. // 发送验证码
  311. const sendCodeApi = (type) => {
  312. //参数说明
  313. let options = {
  314. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  315. data: {
  316. mobile: state.tel
  317. }, //请求参数
  318. method: "POST", //提交方式(默认POST)
  319. showLoading: true, //是否显示加载中(默认显示)
  320. };
  321. //调用方式
  322. request(sendCode, options)
  323. .then((res) => {
  324. let data = stringToJson(res.bizContent)
  325. console.log(data, "#################");
  326. if (data.info == "成功.") {
  327. console.log('######################CCCCCCCCCCCCCCCCC');
  328. }
  329. })
  330. .catch((err) => {
  331. console.log(err);
  332. });
  333. }
  334. let waitTime = ref(0)
  335. //倒计时函数
  336. const codeInterval = () => {
  337. waitTime.value = 60
  338. let timer = setInterval(() => {
  339. if (waitTime.value == 1) {
  340. clearInterval(timer)
  341. }
  342. waitTime.value -= 1
  343. }, 1000)
  344. }
  345. function bindPickerChange(e){
  346. state.index = e.detail.value
  347. }
  348. </script>
  349. <style>
  350. page {
  351. width: 100%;
  352. height: 100%;
  353. display: flex;
  354. flex-direction: column;
  355. background-color: #F3F3F3;
  356. }
  357. </style>
  358. <style lang="scss" scoped>
  359. ::v-deep .u-icon__icon{
  360. top: -4px !important;
  361. }
  362. .oderPage {
  363. flex: 1;
  364. width: 100%;
  365. .content {
  366. display: flex;
  367. flex-direction: column;
  368. /* justify-content: center; */
  369. align-items: center;
  370. width: 750rpx;
  371. // height: 266rpx;
  372. background-color: #fff;
  373. margin-bottom: 30rpx;
  374. padding: 75rpx 0;
  375. .title {
  376. font-size: 28rpx;
  377. font-family: Microsoft YaHei UI;
  378. font-weight: 400;
  379. color: #717171;
  380. margin-bottom: 40rpx;
  381. }
  382. view {
  383. font-size: 40rpx;
  384. font-family: Microsoft YaHei UI;
  385. font-weight: 400;
  386. color: #2A2A2A;
  387. font-weight: bold;
  388. }
  389. }
  390. .from {
  391. background-color: #fff;
  392. padding: 0 30rpx;
  393. .from_item {
  394. display: flex;
  395. flex-wrap: nowrap;
  396. justify-content: space-between;
  397. padding: 20rpx 0;
  398. border-bottom: #DCDCDC 1px solid;
  399. align-items: center;
  400. font-size: 28rpx;
  401. font-family: Microsoft YaHei;
  402. font-weight: 400;
  403. color: #666666;
  404. input {
  405. text-align: right;
  406. }
  407. }
  408. }
  409. }
  410. .submit {
  411. background: linear-gradient(to left, #43A1E0 0%, #13E7C1 100%);
  412. width: 670rpx;
  413. height: 80rpx;
  414. line-height: 80rpx;
  415. font-size: 32rpx;
  416. color: #fff;
  417. border-radius: 100rpx;
  418. z-index: 999;
  419. // position: fixed;
  420. // bottom: 60rpx;
  421. // left: 50%;
  422. // transform: translate(-50%);
  423. margin: 30rpx auto;
  424. }
  425. ::v-deep .u-form-item--right__content__slot {
  426. display: flex;
  427. justify-content: space-between;
  428. .btn {
  429. flex: 1;
  430. background: transparent;
  431. font-size: 30rpx;
  432. color: #15E5C1;
  433. z-index: 999;
  434. }
  435. }
  436. .agreen{
  437. color: rgb(25, 190, 197);
  438. }
  439. ::v-deep .code>view{
  440. text-align: right !important;
  441. }
  442. ::v-deep .code{
  443. width: 100% !important;
  444. }
  445. </style>