apply_vehicle.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view class="info_inner">
  5. <view class="input_box">
  6. <view class="label"><text> * </text>姓名:</view>
  7. <view class="box">
  8. {{user.name}}
  9. </view>
  10. </view>
  11. <view class="input_box">
  12. <view class="label"><text> * </text>单位:</view>
  13. <view class="box">
  14. </view>
  15. </view>
  16. <view class="input_box">
  17. <view class="label"><text> * </text>用车日期:</view>
  18. <view class="box">
  19. <uni-datetime-picker v-model="datetimerange" type="datetimerange" rangeSeparator="至" />
  20. </view>
  21. </view>
  22. </view>
  23. <view class="info_list">
  24. <view class="info_item" v-for="(item,index) in list" :key="index">
  25. <view class="del" v-if="index > 0" @click="del_item(index)">
  26. <uni-icons type="clear" size="24" color="#666"></uni-icons>
  27. </view>
  28. <view class="input_box">
  29. <view class="label"><text> * </text>用车明细(单选):</view>
  30. <view class="box" @click="change_mingxi(index)">
  31. {{item.array_text_mingxi}}
  32. </view>
  33. </view>
  34. <view class="input_box">
  35. <view class="label"><text> * </text>用车数量:</view>
  36. <view class="box">
  37. <input type="number" v-model="item.num" />
  38. </view>
  39. </view>
  40. <view class="input_box">
  41. <view class="label">申请事由:</view>
  42. <view class="box">
  43. <textarea v-model="item.inner" auto-height placeholder="请输入申请事由" />
  44. </view>
  45. </view>
  46. </view>
  47. <view class="add_item" @click="add_item()">
  48. +
  49. </view>
  50. </view>
  51. <view class="btn" @click="tijiao()">提交</view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. user: {},
  60. // 时间范围
  61. datetimerange: [],
  62. // 用车单数组
  63. list: [{
  64. array_text_mingxi: "",
  65. num: 1,
  66. inner: ""
  67. }],
  68. array_mingxi: ['下方', '回收', '转运'],
  69. array_text_mingxi: ""
  70. };
  71. },
  72. onLoad() {
  73. this.user = uni.getStorageSync('user')
  74. },
  75. watch: {
  76. datetimerange(newval) {
  77. console.log("范围选:", this.datetimerange);
  78. },
  79. },
  80. methods: {
  81. change_mingxi(index) {
  82. uni.showActionSheet({
  83. itemList: this.array_mingxi,
  84. success: (res) => {
  85. console.log(res)
  86. // 当前显示的名称
  87. this.list[index].array_text_mingxi = this.array_mingxi[res.tapIndex]
  88. },
  89. })
  90. },
  91. add_item() {
  92. console.log('+++')
  93. this.list.push({
  94. array_text_mingxi: "",
  95. num: 1,
  96. inner: ""
  97. })
  98. },
  99. del_item(index){
  100. this.list.splice(index,1)
  101. },
  102. tijiao(){
  103. console.log(this.list)
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss">
  109. .content {
  110. background-color: #F2FAF7;
  111. padding-bottom: 80rpx;
  112. .info_inner {
  113. background-color: #FFFFFF;
  114. box-sizing: border-box;
  115. padding: 25rpx;
  116. }
  117. .info_list {
  118. .info_item {
  119. margin-top: 20rpx;
  120. background-color: #FFFFFF;
  121. box-sizing: border-box;
  122. padding: 25rpx;
  123. position: relative;
  124. .del{
  125. position: absolute;
  126. top: 20rpx;
  127. right: 20rpx;
  128. }
  129. }
  130. .add_item {
  131. margin: 0 auto;
  132. margin-top: 50rpx;
  133. width: 80rpx;
  134. height: 80rpx;
  135. border-radius: 50%;
  136. border: 4rpx solid #009fe8;
  137. color: #009fe8;
  138. font-size: 80rpx;
  139. text-align: center;
  140. line-height: 70rpx;
  141. }
  142. }
  143. .input_box {
  144. margin-bottom: 20rpx;
  145. font-size: 32rpx;
  146. .label {
  147. min-height: 80rpx;
  148. line-height: 80rpx;
  149. color: #6C6F74;
  150. text {
  151. color: red;
  152. }
  153. }
  154. .box {
  155. width: 700rpx;
  156. min-height: 90rpx;
  157. line-height: 90rpx;
  158. background: #FFFFFF;
  159. border-radius: 8rpx;
  160. border: 2rpx solid #E9EBF2;
  161. box-sizing: border-box;
  162. padding: 0 25rpx;
  163. input {
  164. height: 90rpx;
  165. }
  166. textarea {
  167. min-height: 160rpx;
  168. width: 650rpx;
  169. box-sizing: border-box;
  170. padding: 20rpx 0;
  171. }
  172. /deep/.uni-date-editor--x {
  173. .uniui-clear {
  174. display: none;
  175. }
  176. .uniui-calendar {
  177. display: none;
  178. }
  179. }
  180. /deep/.uni-date-x--border {
  181. box-sizing: border-box;
  182. border-radius: 4px;
  183. border: none;
  184. }
  185. /deep/.uni-date-x {
  186. padding: 0;
  187. }
  188. }
  189. }
  190. }
  191. .btn {
  192. width: 700rpx;
  193. margin: 0 auto;
  194. margin-top: 80rpx;
  195. background-color: #009FE8;
  196. box-sizing: border-box;
  197. padding: 25rpx 0;
  198. color: #FFFFFF;
  199. text-align: center;
  200. }
  201. </style>