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 6.0KB

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