Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

upload-card.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. <template>
  2. <view class="upload-box">
  3. <view class="head-tips">
  4. 检测到您的ETC卡中还剩余额<text>100.00</text>元,我们将于<text>14</text>个工作日争议期后退回到您的银行卡中,这里将收集您的收款信,具体金额可能会出现增多或减少得情况,敬请谅解!
  5. </view>
  6. <view class="upload-card" @click="upload()">
  7. <view class="card-left">
  8. <view class="item1"> ETC卡剪段照片 </view>
  9. <view class="item2"> ETC卡剪段并上传照片 </view>
  10. <view class="item3"> 拍摄示例 </view>
  11. </view>
  12. <image :src="`${$imgUrl}ETC1.png`" mode="" v-if="!form.imageUrl"></image>
  13. <image :src="form.imageUrl" mode="" v-else></image>
  14. </view>
  15. <u-form :model="form" ref="myForm" :error-type="errorType">
  16. <view class="from">
  17. <u-form-item prop="state">
  18. <view class="from_item">
  19. <text><text style="color: red"></text>是否寄回设备:</text>
  20. <u-radio-group v-model="form.state">
  21. <u-radio :customStyle="{ marginBottom: '8px' }" activeColor="#2CE242"
  22. v-for="(item, index) in radiolist1" :key="index" :label="item.disabled"
  23. :name="item.name" @change="radioChange">
  24. {{ item.name }}
  25. </u-radio>
  26. </u-radio-group>
  27. </view>
  28. </u-form-item>
  29. <u-form-item prop="logisticsname" v-if="form.state=='寄回'">
  30. <view class="from_item">
  31. <text><text style="color: red">*</text>物流公司:</text>
  32. <view style="display: flex" @click="showPicker(1)">
  33. <u-input v-model="form.logisticsname" class="input" disabled placeholder="请选择" />
  34. <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
  35. </view>
  36. </view>
  37. </u-form-item>
  38. <u-form-item prop="logisticsNum" v-if="form.state=='寄回'">
  39. <view class="from_item">
  40. <text><text style="color: red">*</text>物流单号:</text>
  41. <u-input v-model="form.logisticsNum" class="input" />
  42. </view>
  43. </u-form-item>
  44. <view class="title"> 请输入退费信息 </view>
  45. <u-form-item prop="username">
  46. <view class="from_item">
  47. <text style="color: #777777"><text style="color: red">*</text>联系人姓名:</text>
  48. <u-input v-model="form.username" class="input" />
  49. </view>
  50. </u-form-item>
  51. <u-form-item prop="phone">
  52. <view class="from_item">
  53. <text style="color: #777777"><text style="color: red">*</text>手机号:</text>
  54. <u-input v-model="form.phone" class="input" />
  55. </view>
  56. </u-form-item>
  57. <u-form-item prop="bank">
  58. <view class="from_item">
  59. <text style="color: #777777"><text style="color: red">*</text>开户行:</text>
  60. <u-input v-model="form.bank" class="input" />
  61. </view>
  62. </u-form-item>
  63. <u-form-item prop="bankcardid">
  64. <view class="from_item">
  65. <text style="color: #777777"><text style="color: red">*</text>退费银行卡号:</text>
  66. <u-input v-model="form.bankcardid" class="input" />
  67. </view>
  68. </u-form-item>
  69. <view class="title"> 请填写注销原因 </view>
  70. <u-form-item prop="remark">
  71. <view class="from_item">
  72. <text><text style="color: red"></text>注销原因:</text>
  73. <view style="display: flex" @click="showPicker(2)">
  74. <u-input v-model="form.remark" class="input" disabled placeholder="请选择" />
  75. <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
  76. </view>
  77. </view>
  78. </u-form-item>
  79. </view>
  80. </u-form>
  81. <button class="submit" @click="toPage()">寄回,不收费</button>
  82. <!-- 选择弹窗 -->
  83. <view>
  84. <!-- 物流 -->
  85. <u-select v-model="show" mode="single-column" :list="list" @confirm="confirm"></u-select>
  86. <!-- 原因 -->
  87. <u-select v-model="show2" mode="single-column" :list="list2" @confirm="confirm2"></u-select>
  88. </view>
  89. </view>
  90. </template>
  91. <script lang="ts" setup>
  92. import {
  93. reactive,
  94. ref
  95. } from "vue";
  96. import {
  97. onLoad,
  98. onShow,
  99. onReady
  100. } from "@dcloudio/uni-app";
  101. import {
  102. navTo,
  103. checkStr
  104. } from "@/utils/utils";
  105. import {
  106. request
  107. } from "../../utils/network/request.js";
  108. import {
  109. getLogistics,
  110. CardSignCancellation
  111. } from "../../utils/network/api.js";
  112. import {
  113. stringToJson
  114. } from "../../utils/network/encryption.js";
  115. // 表单数据
  116. const form = reactive({
  117. imageUrl: "",
  118. logisticsname: "",
  119. logisticsNum: "",
  120. state: "",
  121. username: "",
  122. phone: "",
  123. bank: "",
  124. bankcardid: "",
  125. remark: "",
  126. });
  127. const list = reactive([]); //物流数据
  128. const list2 = reactive([{
  129. //原因
  130. value: "原因1",
  131. label: "原因1",
  132. },
  133. {
  134. value: "原因1",
  135. label: "原因1",
  136. },
  137. {
  138. value: "原因1",
  139. label: "原因1",
  140. },
  141. ]);
  142. const rules = {
  143. // logisticsname: [{
  144. // required: true,
  145. // message: "请选择",
  146. // trigger: ["change", "blur"],
  147. // }, ],
  148. logisticsNum: [{
  149. required: true,
  150. message: "请输入",
  151. trigger: ["change", "blur"],
  152. }, ],
  153. state: [{
  154. required: true,
  155. message: "请输入",
  156. trigger: ["change", "blur"],
  157. }, ],
  158. username: [{
  159. required: true,
  160. message: "请输入",
  161. trigger: ["change", "blur"],
  162. }, ],
  163. bank: [{
  164. required: true,
  165. message: "请输入",
  166. trigger: ["change", "blur"],
  167. }, ],
  168. bankcardid: [{
  169. required: true,
  170. message: "请输入",
  171. trigger: ["change", "blur"],
  172. }, ],
  173. // remark: [{
  174. // required: true,
  175. // message: "请选择",
  176. // trigger: ["change", "blur"],
  177. // }, ],
  178. phone: [{
  179. required: true,
  180. message: "请输入手机号",
  181. trigger: ["change", "blur"],
  182. },
  183. {
  184. // 自定义验证函数,见上说明
  185. validator: (rule, value, callback) => {
  186. // 上面有说,返回true表示校验通过,返回false表示不通过
  187. console.log(checkStr(value, "mobile"), "0011");
  188. return checkStr(value, "mobile");
  189. },
  190. message: "手机号码不正确",
  191. trigger: ["change", "blur"],
  192. },
  193. ],
  194. };
  195. // 验证提示类型(toast要版本为1.3.5才支持)
  196. const errorType = ["border-bottom", "toast"];
  197. // 设置验证规则
  198. const myForm = ref(null);
  199. onReady(() => {
  200. myForm.value.setRules(rules);
  201. });
  202. onLoad(() => {
  203. getexpresslist();
  204. });
  205. const getexpresslist = () => {
  206. //参数说明
  207. let options = {
  208. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  209. data: {
  210. // opId: getItem("openId"),
  211. // source: "WECHAT",
  212. // tabIndex: "0",
  213. }, //请求参数
  214. method: "POST", //提交方式(默认POST)
  215. showLoading: true, //是否显示加载中(默认显示)
  216. };
  217. //调用方式
  218. request(getLogistics, options)
  219. .then((res) => {
  220. // stringToJson(res.bizContent)
  221. stringToJson(res.bizContent).forEach((item) => {
  222. list.push({
  223. value: item,
  224. label: item,
  225. });
  226. });
  227. })
  228. .catch((err) => {
  229. console.log(err);
  230. });
  231. };
  232. // 卡签注销
  233. const logoff = (offtype) => {
  234. //参数说明
  235. let options = {
  236. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  237. data: {
  238. cardId: '', //卡号
  239. obuId: "", //签号
  240. serviceType: "1", //注销类型 1-卡注销,2-签注销,3-卡签注销
  241. operation: offtype, //注销方式 1-有卡注销,2-无卡注销
  242. orderId: '20230225155521777646302', //订单编号
  243. ReasonCancellation: ''
  244. }, //请求参数
  245. method: "POST", //提交方式(默认POST)
  246. showLoading: true, //是否显示加载中(默认显示)
  247. };
  248. //调用方式
  249. request(CardSignCancellation, options)
  250. .then((res) => {
  251. stringToJson(res.bizContent)
  252. if (stringToJson(res.statusCode) == 0) {
  253. navTo("/after-sale/ETC-log-off/log-off-result");
  254. }
  255. })
  256. .catch((err) => {
  257. console.log(err);
  258. });
  259. }
  260. // 单选数据列表
  261. const radiolist1 = reactive([{
  262. name: "寄回",
  263. disabled: false,
  264. },
  265. {
  266. name: "不寄回",
  267. disabled: false,
  268. },
  269. ]);
  270. // 单选
  271. const radioChange = (n) => {
  272. console.log('radioChange', n);
  273. // if (n == '卡退费') {
  274. // flag.value = true
  275. // console.log(flag.value);
  276. // } else {
  277. // flag.value = false
  278. // console.log(flag.value);
  279. // }
  280. }
  281. const upload = () => {
  282. uni.chooseImage({
  283. count: 1, //只能选取一张照片
  284. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  285. sourceType: ["camera", "album"], //从相册选择
  286. success: function(res) {
  287. console.log(res);
  288. // pathToBase64(res.tempFilePaths[0]).then(path => {
  289. form.imageUrl = res.tempFilePaths[0];
  290. // }).catch(error => {
  291. // })
  292. },
  293. });
  294. };
  295. const show = ref(false);
  296. const show2 = ref(false);
  297. const showPicker = function(type) {
  298. if (type == 1) {
  299. show.value = true;
  300. console.log(show.value);
  301. } else {
  302. show2.value = true;
  303. console.log(show2.value);
  304. }
  305. };
  306. // 选择物流
  307. const confirm = (e) => {
  308. console.log(e);
  309. form.logisticsname = e[0].value;
  310. };
  311. const confirm2 = (e) => {
  312. console.log(e);
  313. form.remark = e[0].value;
  314. };
  315. const toPage = () => {
  316. myForm.value.validate((valid) => {
  317. console.log(valid);
  318. if (valid) {
  319. console.log("验证通过", form);
  320. wx.showModal({
  321. confirmText: "寄回",
  322. cancelText: "不寄回",
  323. success: function(res) {
  324. if (res.confirm) {
  325. console.log("用户点击确定");
  326. logoff(2)
  327. // navTo("/after-sale/ETC-log-off/log-off-result");
  328. } else if (res.cancel) {
  329. console.log("用户点击取消");
  330. navTo("/after-sale/ETC-log-off/etc-log-off-pay");
  331. }
  332. },
  333. });
  334. } else {
  335. console.log("验证未通过");
  336. }
  337. });
  338. };
  339. </script>
  340. <style>
  341. page {
  342. width: 100%;
  343. height: 100%;
  344. background-color: #ffffff;
  345. }
  346. </style>
  347. <style lang="scss" scoped>
  348. .upload-box {
  349. // width: 100%;
  350. padding: 30rpx;
  351. .head-tips {
  352. text-indent: 2rem;
  353. font-size: 26rpx;
  354. font-family: Microsoft YaHei;
  355. font-weight: 400;
  356. color: #666666;
  357. line-height: 50rpx;
  358. margin-bottom: 45rpx;
  359. text {
  360. color: #ff8000;
  361. }
  362. }
  363. .upload-card {
  364. margin-bottom: 70rpx;
  365. height: 260rpx;
  366. background: #ffffff;
  367. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  368. border-radius: 20rpx;
  369. padding: 30rpx;
  370. display: flex;
  371. justify-content: space-between;
  372. .card-left {
  373. .item1 {
  374. font-size: 34rpx;
  375. font-family: Microsoft YaHei;
  376. font-weight: 400;
  377. color: #000000;
  378. margin-bottom: 30rpx;
  379. }
  380. .item2 {
  381. font-size: 24rpx;
  382. font-family: Microsoft YaHei;
  383. font-weight: 400;
  384. color: #999999;
  385. margin-bottom: 30rpx;
  386. }
  387. .item3 {
  388. width: 110rpx;
  389. height: 40rpx;
  390. background: #ecfbf8;
  391. /* opacity: 0.2; */
  392. border-radius: 6rpx;
  393. font-size: 20rpx;
  394. font-family: Microsoft YaHei;
  395. font-weight: 400;
  396. text-align: center;
  397. line-height: 40rpx;
  398. color: #0a8f8a;
  399. }
  400. }
  401. image {
  402. width: 295rpx;
  403. height: 188rpx;
  404. }
  405. }
  406. .from {
  407. background-color: #fff;
  408. margin-top: 30rpx;
  409. // padding: 0 30rpx;
  410. ::v-deep .u-form-item {
  411. padding: 0;
  412. line-height: normal;
  413. .u-form-item__message {
  414. margin-bottom: 12rpx;
  415. }
  416. }
  417. .title {
  418. font-size: 30rpx;
  419. font-family: Microsoft YaHei;
  420. font-weight: 400;
  421. color: #000000;
  422. margin: 38rpx 0;
  423. }
  424. .from_item {
  425. display: flex;
  426. flex-wrap: nowrap;
  427. justify-content: space-between;
  428. align-items: center;
  429. height: 80rpx;
  430. border-bottom: 1rpx solid #dcdcdc;
  431. ::v-deep .input {
  432. text-align: right;
  433. flex: 1;
  434. input {
  435. text-align: right;
  436. }
  437. }
  438. }
  439. .from_item1 {
  440. display: flex;
  441. flex-wrap: nowrap;
  442. flex-direction: column;
  443. justify-content: space-between;
  444. padding: 30rpx;
  445. border-bottom: #dcdcdc 1px solid;
  446. input {
  447. text-align: right;
  448. }
  449. .textarea {
  450. background-color: #f1f1f1;
  451. width: 100%;
  452. border-radius: 20rpx;
  453. margin-top: 10rpx;
  454. text-indent: 1rem;
  455. height: 180rpx;
  456. padding: 20rpx;
  457. box-sizing: border-box;
  458. }
  459. }
  460. }
  461. .submit {
  462. height: 80rpx;
  463. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  464. border-radius: 40rpx;
  465. font-size: 32rpx;
  466. font-family: Microsoft YaHei;
  467. font-weight: 400;
  468. color: #ffffff;
  469. line-height: 80rpx;
  470. margin: 60rpx auto;
  471. }
  472. }
  473. </style>