您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

refundPage.vue 12KB

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