您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

apply-ex-goods-step1.vue 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. // applyType: [{
  121. // required: true,
  122. // message: '请选择申请类型',
  123. // trigger: ['change', 'blur'],
  124. // }],
  125. // operation: [{
  126. // required: true,
  127. // message: '请选择注销方式',
  128. // trigger: ['change', 'blur'],
  129. // }]
  130. }
  131. // 验证提示类型(toast要版本为1.3.5才支持)
  132. const errorType = ['message', 'border-bottom', 'toast']
  133. // 设置验证规则
  134. const myForm = ref(null)
  135. onReady(() => {
  136. myForm.value.setRules(rules)
  137. })
  138. // 单选数据列表
  139. const radiolist1 = reactive([{
  140. name: 1,
  141. disabled: '有卡注销'
  142. },
  143. {
  144. name: 2,
  145. disabled: '无卡注销'
  146. },
  147. ])
  148. let show = ref(false)
  149. // 打开地区先择器
  150. const showPicker = function () {
  151. show.value = true
  152. }
  153. // 确定地区
  154. const confirm = (e) => {
  155. console.log(e, columns[e].id, columns[e].label);
  156. index.value = e
  157. form.applyType = columns[e].id
  158. applyType.value = columns[e].label
  159. }
  160. // 单选
  161. const radioChange = (n) => {
  162. console.log('radioChange', n);
  163. console.log(form);
  164. }
  165. // 提交
  166. const submit = () => {
  167. if (form.operation && form.applyType) {
  168. console.log('验证通过', form);
  169. navTo(`/subpackage/orders/apply-ex-goods?orderId=${oldId.value}&id=8822ca31f88e448eb534767ba4d01eb9`) //测试用
  170. } else if (!form.applyType) {
  171. uni.showToast({
  172. title: "请选择申请类型",
  173. icon: "none"
  174. })
  175. } else {
  176. uni.showToast({
  177. title: "请选择注销类",
  178. icon: "none"
  179. })
  180. }
  181. }
  182. onLoad((option) => {
  183. form.orderId = option.orderId
  184. oldId.value = option.id
  185. console.log(form);
  186. });
  187. </script>
  188. <style>
  189. page {
  190. width: 100%;
  191. height: 100%;
  192. display: flex;
  193. flex-direction: column;
  194. background-color: #F3F3F3;
  195. }
  196. </style>
  197. <style lang="scss" scoped>
  198. .oderPage {
  199. flex: 1;
  200. width: 100%;
  201. .from {
  202. background-color: #fff;
  203. margin-top: 20rpx;
  204. ::v-deep .u-form-item {
  205. padding: 0;
  206. line-height: normal;
  207. .u-form-item__message {
  208. margin-bottom: 12rpx
  209. }
  210. }
  211. .from_item {
  212. display: flex;
  213. flex-wrap: nowrap;
  214. justify-content: space-between;
  215. padding: 0 30rpx;
  216. // border-bottom: #DCDCDC 1px solid;
  217. align-items: center;
  218. height: 80rpx;
  219. ::v-deep .input {
  220. text-align: right;
  221. flex: 1;
  222. background: transparent;
  223. input {
  224. text-align: right;
  225. }
  226. }
  227. }
  228. .from_item1 {
  229. display: flex;
  230. flex-wrap: nowrap;
  231. flex-direction: column;
  232. justify-content: space-between;
  233. padding: 30rpx;
  234. border-bottom: #DCDCDC 1px solid;
  235. input {
  236. text-align: right;
  237. }
  238. .textarea {
  239. background-color: #F1F1F1;
  240. width: 100%;
  241. border-radius: 20rpx;
  242. margin-top: 10rpx;
  243. text-indent: 1rem;
  244. height: 180rpx;
  245. padding: 20rpx;
  246. box-sizing: border-box;
  247. }
  248. }
  249. }
  250. }
  251. .submit {
  252. background: linear-gradient(to left, #43A1E0 0%, #13E7C1 100%);
  253. width: 670rpx;
  254. height: 80rpx;
  255. color: #fff;
  256. border-radius: 100rpx;
  257. margin: 26px auto;
  258. font-size: 32rpx;
  259. }
  260. </style>