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

apply-ex-goods-step1.vue 5.7KB

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