addGoods.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="container">
  3. <!-- 输入框区域 -->
  4. <view class="search">
  5. <img src="../../static/images/repairsImg/search.png" />
  6. <input type="text" placeholder="请输入搜索内容" v-model="searchValue" />
  7. </view>
  8. <!-- 耗材区域 -->
  9. <view class="body">
  10. <view class="body_left">
  11. <view class="left_item" :class="{ active: activeIndex === index }" v-for="(item, index) in list" :key="index" @click="handleChange(index)">{{ item }}</view>
  12. </view>
  13. <view class="body_right">
  14. <view class="right_item" :class="{ active: activeIndex2 === index2 }" v-for="(ele, index2) in List2" :key="index2" @click="handleChange2(index2)">{{ ele }}</view>
  15. </view>
  16. </view>
  17. <!-- 备注区域 -->
  18. <view class="notes" v-if="activeIndex === 4">
  19. <view class="notes_title">备注</view>
  20. <view class="notes_textarea">
  21. <textarea placeholder-style="color:#CCCCCC" placeholder="请输入您的备注" maxlength="150" @input="handleInput"></textarea>
  22. <view class="notes_num">{{ textLength }}/150</view>
  23. </view>
  24. </view>
  25. <view class="notes2" v-else></view>
  26. <view class="btn" @click="handleAffirm">确认</view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. // 搜索框绑定数据
  34. searchValue: '',
  35. // 输入框当前输入数据的长度
  36. textLength: 0,
  37. // 左边数组的索引
  38. activeIndex: 0,
  39. // 左边数组
  40. list: ['水电', '木工类', '行政楼', '泥工类', '其他'],
  41. // 右边数组的索引
  42. activeIndex2: 0,
  43. // 右边数组
  44. List2: ['下水道', '安全指示牌', '消费应急灯', '排水管道', '吊顶', '风扇', '没电']
  45. }
  46. },
  47. methods: {
  48. // 确认按钮回调
  49. handleAffirm() {
  50. // console.log(this.List2[this.activeIndex2])
  51. uni.$emit('addConsumable', {
  52. data: this.List2[this.activeIndex2]
  53. })
  54. uni.navigateBack(1)
  55. },
  56. // 左边数组切换回调
  57. handleChange(index) {
  58. this.activeIndex = index
  59. },
  60. // 右边数组切换回调
  61. handleChange2(index) {
  62. this.activeIndex2 = index
  63. },
  64. // 输入框输入值变化回调
  65. handleInput(e) {
  66. // console.log(e.detail.value.length)
  67. this.textLength = e.detail.value.length
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .container {
  74. display: flex;
  75. flex-direction: column;
  76. width: 100vw;
  77. height: 100vh;
  78. overflow-y: auto;
  79. .search {
  80. display: flex;
  81. align-items: center;
  82. margin: 30rpx auto 30rpx;
  83. width: 690rpx;
  84. height: 80rpx;
  85. border-radius: 4rpx;
  86. background-color: #f2f2f2;
  87. img {
  88. margin: 0 20rpx;
  89. width: 40rpx;
  90. height: 40rpx;
  91. }
  92. input {
  93. flex: 1;
  94. padding: 10rpx;
  95. }
  96. }
  97. .body {
  98. display: flex;
  99. height: 686rpx;
  100. border-top: 1rpx solid #e5e5e5;
  101. .body_left {
  102. box-sizing: border-box;
  103. padding: 30rpx;
  104. width: 199rpx;
  105. border-right: 1rpx solid #cccccc;
  106. overflow-y: auto;
  107. .left_item {
  108. height: 80rpx;
  109. font-size: 28rpx;
  110. font-weight: bold;
  111. }
  112. .active {
  113. color: #6fb6b8;
  114. }
  115. }
  116. .body_right {
  117. flex: 1;
  118. box-sizing: border-box;
  119. padding: 35rpx 30rpx;
  120. overflow-y: auto;
  121. .right_item {
  122. float: left;
  123. box-sizing: border-box;
  124. padding: 10rpx 30rpx;
  125. margin: 0 20rpx 37rpx 0;
  126. height: 50rpx;
  127. line-height: 30rpx;
  128. text-align: center;
  129. color: #808080;
  130. font-size: 28rpx;
  131. border-radius: 53rpx;
  132. background-color: #e6e6e6;
  133. overflow: hidden;
  134. white-space: nowrap;
  135. text-overflow: ellipsis;
  136. }
  137. .active {
  138. color: #fff;
  139. background-color: #6fb6b8;
  140. }
  141. }
  142. }
  143. .notes {
  144. box-sizing: border-box;
  145. padding: 0 30rpx;
  146. border-top: 1rpx solid #e5e5e5;
  147. .notes_title {
  148. display: flex;
  149. align-items: center;
  150. height: 88rpx;
  151. font-size: 32rpx;
  152. font-weight: bold;
  153. }
  154. .notes_textarea {
  155. position: relative;
  156. height: 284rpx;
  157. border: 1rpx solid #e5e5e5;
  158. textarea {
  159. box-sizing: border-box;
  160. padding: 16rpx 20rpx 75rpx;
  161. width: 100%;
  162. font-size: 32rpx;
  163. }
  164. .notes_num {
  165. position: absolute;
  166. right: 20rpx;
  167. bottom: 14rpx;
  168. color: #a6a6a6;
  169. font-size: 32rpx;
  170. }
  171. }
  172. }
  173. .notes2 {
  174. height: 150rpx;
  175. }
  176. .btn {
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. margin: 55rpx auto 65rpx;
  181. width: 690rpx;
  182. height: 100rpx;
  183. color: #fff;
  184. font-size: 32rpx;
  185. border-radius: 12rpx;
  186. background-color: #6fb6b8;
  187. }
  188. }
  189. </style>