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

refundPage.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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. <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. 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 class="from_item">
  66. <text>用户类型:</text>
  67. <u-radio-group v-model="radiovalue3">
  68. <u-radio :customStyle="{marginBottom: '8px'}" activeColor="#2CE242"
  69. v-for="(item, index) in radiolist3" :key="index" :label="item.disabled" :name="item.name"
  70. @change="radioChange3">
  71. {{item.name}}
  72. </u-radio>
  73. </u-radio-group>
  74. </view> -->
  75. </view>
  76. </view>
  77. <button class="submit" @click="sure()">确认退费</button>
  78. </view>
  79. </template>
  80. <script setup lang="ts">
  81. import { ref, reactive } from "vue";
  82. import { checkStr, msg } from "@/utils/utils";
  83. import { navTo } from "@/utils/utils";
  84. import { queryRefund, queryCardFreeExit, queryRefundApply, sendCode } from "@/utils/network/api.js";
  85. import { onLoad } from "@dcloudio/uni-app";
  86. import { request } from "@/utils/network/request.js";
  87. import { stringToJson } from "@/utils/network/encryption";
  88. // 单选数据列表
  89. const radiolist1 = reactive([{
  90. name: '卡退费',
  91. disabled: false
  92. },
  93. {
  94. name: '余额补领',
  95. disabled: false
  96. },
  97. ])
  98. const radiolist2 = reactive([{
  99. name: '银行卡',
  100. disabled: false
  101. },
  102. // {
  103. // name: '现金',
  104. // disabled: false
  105. // },
  106. ])
  107. const radiolist3 = reactive([{
  108. name: '个人',
  109. disabled: false
  110. },
  111. {
  112. name: '单位',
  113. disabled: false
  114. },
  115. ])
  116. const state = reactive({
  117. name: '',
  118. phone: "",
  119. bank: "",
  120. vehicleId: "", //车牌号
  121. hasData: {}, //通过车牌查出来的数据
  122. address: "", //地址
  123. addressShow: "请选择开户行地址", //展示的地址
  124. tel: "",
  125. newMobileCode: "",
  126. bankType: "", //开户行
  127. branchName: "", //开户行支行
  128. refoundMethod: 1, //退款方式 1:银行卡 2现金
  129. array: ['贵阳银行股份有限公司', '中国工商银行股份有限公司', '中国建设银行股份有限公司', '中国银行股份有限公司', '中国农业银行股份有限公司', '中国交通银行股份有限公司',
  130. '兴业银行股份有限公司', '平安银行股份有限公司', '中国邮政储蓄银行股份有限公司', '中国光大银行股份有限公司', '贵州银行股份有限公司', '中国民生银行股份有限公司',
  131. '招商银行股份有限公司', '.农村信用社联合社', '农村商业银行'],
  132. index: -1,
  133. // cusType: 1, //用户类型 1-个人 2-单位
  134. bankCardId: "", //银行卡号
  135. isShow: true, //是否展示银行卡那些
  136. });
  137. // 单选默认数据
  138. const radiovalue1 = ref('卡退费')
  139. let flag = ref(true)
  140. // 单选
  141. const radioChange = (n) => {
  142. console.log('radioChange', n);
  143. if (n == '卡退费') {
  144. flag.value = true
  145. console.log(flag.value);
  146. } else {
  147. flag.value = false
  148. console.log(flag.value);
  149. }
  150. }
  151. // 单选默认数据
  152. const radiovalue2 = ref('银行卡')
  153. let refundType = ref(true)
  154. const radioChange2 = (n) => {
  155. console.log('radioChange', n);
  156. if (n == '银行卡') {
  157. refundType.value = true
  158. state.refoundMethod = 1
  159. state.isShow = true;
  160. console.log(refundType.value);
  161. } else {
  162. refundType.value = false
  163. state.refoundMethod = 2
  164. state.isShow = false;
  165. state.bankType = "";
  166. state.branchName = "";
  167. state.bankCardId = "";
  168. state.address = "";
  169. console.log(refundType.value);
  170. }
  171. }
  172. // 退款方式
  173. const radiovalue3 = ref('个人')
  174. let refundType3 = ref(true)
  175. const radioChange3 = (n) => {
  176. console.log('radioChange', n);
  177. if (n == '个人') {
  178. refundType3.value = true
  179. state.cusType = 1
  180. console.log(refundType.value);
  181. } else {
  182. refundType3.value = false
  183. state.cusType = 2
  184. console.log(refundType.value);
  185. }
  186. }
  187. /*视图进入后操作*/
  188. onLoad((option) => {
  189. state.vehicleId = option.vehicleId
  190. queryRefundAction();
  191. });
  192. const sure = () => {
  193. // 卡退费
  194. if (flag.value) {
  195. // 银行卡才需要做这些判断
  196. if (refundType.value) {
  197. if (state.array[state.index] == '请选择') {
  198. msg("请输入开户行!");
  199. return;
  200. }
  201. if (!state.branchName) {
  202. msg("请输入开户行支行!");
  203. return;
  204. }
  205. if (state.addressShow == "请选择开户行地址") {
  206. msg("请选择开户行地址!");
  207. return;
  208. }
  209. if (!state.bankCardId) {
  210. msg("请输入银行卡号!");
  211. return;
  212. }
  213. }
  214. if (!checkStr(state.tel, "mobile")) {
  215. msg("请输入正确的手机号!");
  216. return;
  217. }
  218. if (!state.newMobileCode) {
  219. msg("请输入验证码!");
  220. return;
  221. }
  222. cardFree();
  223. } else {
  224. // 余额退费
  225. balanceReclaiming();
  226. }
  227. }
  228. //储值卡注销退费查询接口
  229. const queryRefundAction = () => {
  230. var data = {
  231. vehicleId: state.vehicleId
  232. };
  233. const options = {
  234. type: 2,
  235. data: data,
  236. method: "POST",
  237. showLoading: true,
  238. };
  239. request(queryRefund, options).then((res) => {
  240. const data = stringToJson(res.bizContent);
  241. console.log("data", data)
  242. // 有无数据卡数据
  243. if (data.hasData) {
  244. state.hasData = data.data[0]
  245. }
  246. });
  247. }
  248. // 卡退费
  249. const cardFree = () => {
  250. var data = {
  251. orderId: state.hasData.orderId, //退费信息编号
  252. bankType: state.array[state.index], //开户行
  253. province: state.address[0], //开户行所在的省
  254. sell: state.address[1], //开户行所在的市
  255. cusName: state.hasData.customerName, //开户人名称
  256. bankCardId: state.bankCardId, //银行卡号
  257. cusTel: state.tel, //联系方式
  258. // cusType: state.cusType, //用户类型
  259. operateType: state.refoundMethod, //退款方式 1:银行卡 2现金
  260. branchName: state.branchName, //开户行支行名称
  261. code: state.newMobileCode, //验证码
  262. };
  263. const options = {
  264. type: 2,
  265. data: data,
  266. method: "POST",
  267. showLoading: true,
  268. };
  269. console.log("options", options)
  270. request(queryCardFreeExit, options).then((res) => {
  271. const data = stringToJson(res.bizContent);
  272. console.log("data", data)
  273. navTo(`/subpackage/after-sale/refundPage-result?value=${flag.value}`)
  274. });
  275. }
  276. // 余额补领
  277. const balanceReclaiming = () => {
  278. var data = {
  279. orderId: state.hasData.orderId, //退费信息编号
  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?value=${flag.value}`)
  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. align-items: center;
  369. width: 750rpx;
  370. background-color: #fff;
  371. margin-bottom: 30rpx;
  372. padding: 75rpx 0;
  373. .title {
  374. font-size: 28rpx;
  375. font-family: Microsoft YaHei UI;
  376. font-weight: 400;
  377. color: #717171;
  378. margin-bottom: 40rpx;
  379. }
  380. view {
  381. font-size: 40rpx;
  382. font-family: Microsoft YaHei UI;
  383. font-weight: 400;
  384. color: #2A2A2A;
  385. font-weight: bold;
  386. }
  387. }
  388. .from {
  389. background-color: #fff;
  390. padding: 0 30rpx;
  391. .from_item {
  392. display: flex;
  393. flex-wrap: nowrap;
  394. justify-content: space-between;
  395. padding: 20rpx 0;
  396. border-bottom: #DCDCDC 1px solid;
  397. align-items: center;
  398. font-size: 28rpx;
  399. font-family: Microsoft YaHei;
  400. font-weight: 400;
  401. color: #666666;
  402. input {
  403. text-align: right;
  404. }
  405. }
  406. }
  407. }
  408. .submit {
  409. background: linear-gradient(to left, #43A1E0 0%, #13E7C1 100%);
  410. width: 670rpx;
  411. height: 80rpx;
  412. line-height: 80rpx;
  413. font-size: 32rpx;
  414. color: #fff;
  415. border-radius: 100rpx;
  416. z-index: 999;
  417. margin: 30rpx auto;
  418. }
  419. ::v-deep .u-form-item--right__content__slot {
  420. display: flex;
  421. justify-content: space-between;
  422. .btn {
  423. flex: 1;
  424. background: transparent;
  425. font-size: 30rpx;
  426. color: #15E5C1;
  427. z-index: 999;
  428. }
  429. }
  430. .agreen {
  431. color: rgb(25, 190, 197);
  432. }
  433. ::v-deep .code>view {
  434. text-align: right !important;
  435. }
  436. ::v-deep .code {
  437. width: 100% !important;
  438. }
  439. </style>