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.

apply-ex-goods-step1.vue 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <!-- <navBar title="补办ETC卡"></navBar> -->
  3. <view class="oderPage">
  4. <u-form :model="form" ref="myForm" :error-type="errorType">
  5. <view class="from">
  6. <u-form-item prop="operation">
  7. <view class="from_item">
  8. <text><text style="color: red;">*</text>注销方式:</text>
  9. <u-radio-group v-model="form.operation">
  10. <u-radio :customStyle="{marginBottom: '8px'}" activeColor="#2CE242"
  11. v-for="(item, index) in radiolist1" :key="index" :label="item.name" :name="item.name"
  12. @change="radioChange">
  13. {{item.disabled}}
  14. </u-radio>
  15. </u-radio-group>
  16. </view>
  17. </u-form-item>
  18. <u-form-item prop="applyType">
  19. <view class="from_item">
  20. <text><text style="color: red;">*</text>申请类型:</text>
  21. <view style="display: flex;" @click="showPicker">
  22. <u-input v-model="applyType" class="input" disabled placeholder="请选择" />
  23. <u-icon name="arrow-right" style="margin-left: 10px;display: flex;"></u-icon>
  24. </view>
  25. </view>
  26. </u-form-item>
  27. </view>
  28. </u-form>
  29. <button class="submit" @click="submit">下一步</button>
  30. <!-- 自提网点弹窗 -->
  31. <view>
  32. <u-picker mode="selector" v-model="show" :range="columns" range-key="label" @confirm="confirm"></u-picker>
  33. </view>
  34. </view>
  35. </template>
  36. <script setup lang="ts">
  37. import {
  38. checkStr,
  39. navTo
  40. } from "@/utils/utils.ts"
  41. import {
  42. ref,
  43. reactive
  44. } from "vue";
  45. import {
  46. orderExchangeApply
  47. } from "@/utils/network/api.js"
  48. import {
  49. request
  50. } from "@/utils/network/request";
  51. import {
  52. stringToJson
  53. } from "@/utils/network/encryption";
  54. import {
  55. getItem,
  56. StorageKeys
  57. } from "@/utils/storage";
  58. import {
  59. onReady
  60. } from "@dcloudio/uni-app";
  61. import {
  62. onLoad
  63. } from "@dcloudio/uni-app";
  64. // 表单数据
  65. const form = reactive({
  66. orderId: '',
  67. applyType: '',
  68. operation: ''
  69. })
  70. //接受通过该id查询订单详情
  71. const oldId = ref('')
  72. const applyType = ref('')
  73. //选择器数据
  74. const columns = [{
  75. label: '换货-换卡',
  76. // 其他属性值
  77. id: 'CARD '
  78. },
  79. {
  80. label: '换货-换签',
  81. // 其他属性值
  82. id: 'OBU'
  83. },
  84. {
  85. label: '换货-换卡签',
  86. // 其他属性值
  87. id: 'ALL'
  88. },
  89. // {
  90. // label: '换卡签-换卡',
  91. // // 其他属性值
  92. // id: 'EXCHANGE_CARD'
  93. // },
  94. // {
  95. // label: '换卡签-换签',
  96. // // 其他属性值
  97. // id: 'EXCHANGE_OBU'
  98. // },
  99. // {
  100. // label: '换卡签-换卡签',
  101. // // 其他属性值
  102. // id: 'EXCHANGE_ALL'
  103. // },
  104. ]
  105. // 验证规则
  106. const rules = {
  107. // applyType: [{
  108. // required: true,
  109. // message: '请选择申请类型',
  110. // trigger: ['change', 'blur'],
  111. // }],
  112. // operation: [{
  113. // required: true,
  114. // message: '请选择注销方式',
  115. // trigger: ['change', 'blur'],
  116. // }]
  117. }
  118. // 验证提示类型(toast要版本为1.3.5才支持)
  119. const errorType = ['message', 'border-bottom', 'toast']
  120. // 设置验证规则
  121. const myForm = ref(null)
  122. onReady(() => {
  123. myForm.value.setRules(rules)
  124. })
  125. // 单选数据列表
  126. const radiolist1 = reactive([{
  127. name: 1,
  128. disabled: '有卡注销'
  129. },
  130. {
  131. name: 2,
  132. disabled: '无卡注销'
  133. },
  134. ])
  135. let show = ref(false)
  136. // 打开地区先择器
  137. const showPicker = function () {
  138. show.value = true
  139. }
  140. // 确定地区
  141. const confirm = (e) => {
  142. console.log(e);
  143. form.applyType = columns[e].id
  144. applyType.value = columns[e].label
  145. }
  146. // 单选
  147. const radioChange = (n) => {
  148. console.log('radioChange', n);
  149. console.log(form);
  150. }
  151. // 提交
  152. const submit = () => {
  153. if (form.operation && form.applyType) {
  154. console.log('验证通过', form);
  155. navTo(`/subpackage/orders/apply-ex-goods?orderId=${oldId.value}&id=8822ca31f88e448eb534767ba4d01eb9`) //测试用
  156. // const options = {
  157. // type: 2,
  158. // data: form,
  159. // method: "POST",
  160. // showLoading: true,
  161. // };
  162. // request(orderExchangeApply, options).then((res) => {
  163. // const data = stringToJson(res.bizContent);
  164. // console.log(data);
  165. // // navTo(`/orders/apply-ex-goods?orderId=${oldId.value}&id=${data.id}`)
  166. // });
  167. } else if (!form.applyType) {
  168. uni.showToast({
  169. title: "请选择申请类型",
  170. icon: "none"
  171. })
  172. } else {
  173. uni.showToast({
  174. title: "请选择注销类",
  175. icon: "none"
  176. })
  177. }
  178. // myForm.value.validate((valid) => {
  179. // console.log(valid);
  180. // if (valid) {
  181. // } else {
  182. // console.log('验证未通过');
  183. // }
  184. // })
  185. }
  186. onLoad((option) => {
  187. form.orderId = option.orderId
  188. oldId.value = option.id
  189. console.log(form);
  190. });
  191. </script>
  192. <style>
  193. page {
  194. width: 100%;
  195. height: 100%;
  196. display: flex;
  197. flex-direction: column;
  198. background-color: #F3F3F3;
  199. }
  200. </style>
  201. <style lang="scss" scoped>
  202. .oderPage {
  203. flex: 1;
  204. width: 100%;
  205. .from {
  206. background-color: #fff;
  207. margin-top: 20rpx;
  208. ::v-deep .u-form-item {
  209. padding: 0;
  210. line-height: normal;
  211. .u-form-item__message {
  212. margin-bottom: 12rpx
  213. }
  214. }
  215. .from_item {
  216. display: flex;
  217. flex-wrap: nowrap;
  218. justify-content: space-between;
  219. padding: 0 30rpx;
  220. // border-bottom: #DCDCDC 1px solid;
  221. align-items: center;
  222. height: 80rpx;
  223. ::v-deep .input {
  224. text-align: right;
  225. flex: 1;
  226. background: transparent;
  227. input {
  228. text-align: right;
  229. }
  230. }
  231. }
  232. .from_item1 {
  233. display: flex;
  234. flex-wrap: nowrap;
  235. flex-direction: column;
  236. justify-content: space-between;
  237. padding: 30rpx;
  238. border-bottom: #DCDCDC 1px solid;
  239. input {
  240. text-align: right;
  241. }
  242. .textarea {
  243. background-color: #F1F1F1;
  244. width: 100%;
  245. border-radius: 20rpx;
  246. margin-top: 10rpx;
  247. text-indent: 1rem;
  248. height: 180rpx;
  249. padding: 20rpx;
  250. box-sizing: border-box;
  251. }
  252. }
  253. }
  254. }
  255. .submit {
  256. background: linear-gradient(to left, #43A1E0 0%, #13E7C1 100%);
  257. width: 670rpx;
  258. height: 80rpx;
  259. color: #fff;
  260. border-radius: 100rpx;
  261. margin: 26px auto;
  262. font-size: 32rpx;
  263. }
  264. </style>