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.

upload-card.vue 12KB

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