selectTechnical.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <view class="page">
  3. <scroll-view class="scrollList" scroll-y :scroll-into-view="scrollViewId" :style="{height:winHeight+'px'}">
  4. <view class="search-bar">
  5. <view class="search-bar-form">
  6. <view class="search-bar-box">
  7. <!-- <icon class="icon-search-in-box" type="search" size="16"></icon> -->
  8. <input confirm-type="search" class="search-bar-input" placeholder="输入关键词"
  9. placeholder-class="phcolor" :value="inputVal" :focus="inputShowed" @input="inputTyping" />
  10. <view class="icon-clear" v-if="inputVal" @tap="clearInput">
  11. <!-- #ifdef APP-PLUS || MP -->
  12. <icon type="clear" :size="15"></icon>
  13. <!-- #endif -->
  14. <!-- #ifdef H5 -->
  15. <tui-icon name="close-fill" :size="16" color="#bfbfbf"></tui-icon>
  16. <!-- #endif -->
  17. </view>
  18. </view>
  19. <label class="search-bar-label" v-if="!inputShowed" @tap="showInput">
  20. <!-- <icon class="icon-search" type="search" size="16"></icon> -->
  21. <view class="search-bar-text">输入关键词</view>
  22. </label>
  23. </view>
  24. </view>
  25. <view class="tui-list search-result" v-if="inputShowed">
  26. <view class="tui-list-cell" hover-class="tui-list-cell-hover" v-for="(item,index) in searchResult"
  27. :key="index" @tap="selectTechnical" :data-uuid="item" :hover-stay-time='150'>
  28. <view class="tui-list-cell-navigate">
  29. {{item}}
  30. </view>
  31. </view>
  32. </view>
  33. <view v-if="!inputVal">
  34. <view class="tui-list city-list">
  35. <view class="tui-list-cell" hover-class="tui-list-cell-hover" v-for="(item,index) in lists"
  36. :key="index" @tap="selectTechnical" :data-uuid="item.uuid" :hover-stay-time='150'>
  37. <view class="tui-list-cell-navigate">
  38. {{item.title}}
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </scroll-view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. orderid: 0,
  51. lists: [],
  52. titleHeight: 0, // 索引二字距离窗口顶部的高度
  53. indexBarHeight: 0, // 索引表高度
  54. indexBarItemHeight: 0, // 索引表子项的高度
  55. scrollViewId: '', // scroll-view滚动到的子元素的id
  56. winHeight: 0,
  57. inputShowed: false, // 输入框是否显示
  58. inputVal: '', // 搜索框输入的内容
  59. searchResult: [], // 搜索的结果
  60. }
  61. },
  62. onLoad: function(options) {
  63. const _this = this;
  64. _this.orderid = options.id;
  65. _this.$request.post('technical.staff',{orderid:_this.orderid}).then(res => {
  66. _this.lists = res.data;
  67. });
  68. setTimeout(() => {
  69. uni.getSystemInfo({
  70. success: function(res) {
  71. let winHeight = res.windowHeight
  72. let barHeight = winHeight - uni.upx2px(204);
  73. _this.winHeight = winHeight;
  74. _this.indexBarHeight = barHeight;
  75. _this.indexBarItemHeight = barHeight / 25;
  76. _this.titleHeight = uni.upx2px(132);
  77. }
  78. })
  79. }, 50)
  80. },
  81. methods: {
  82. showInput() {
  83. this.inputShowed = true
  84. },
  85. clearInput() {
  86. this.inputVal = "";
  87. this.inputShowed = false;
  88. this.searchResult = [];
  89. uni.hideKeyboard() //强行隐藏键盘
  90. },
  91. inputTyping(e) {
  92. this.inputVal = e.detail.value;
  93. this.searchCity()
  94. },
  95. // 搜索城市
  96. searchCity() {
  97. let result = []
  98. this.lists.forEach((item1, index1) => {
  99. item1.data.forEach((item2, index2) => {
  100. if (item2.keyword.indexOf(this.inputVal.toLocaleUpperCase()) !== -1) {
  101. result.push(item2.cityName)
  102. }
  103. })
  104. })
  105. this.searchResult = result
  106. },
  107. // 选择师傅
  108. selectTechnical(e) {
  109. const _this = this;
  110. let uuid = e.currentTarget.dataset.uuid;
  111. _this.$request.post('order.staff', {
  112. id: _this.orderid,
  113. identity:'technical',
  114. uuid: uuid
  115. }).then(res => {
  116. uni.navigateBack({
  117. delta: 1
  118. })
  119. });
  120. }
  121. },
  122. /**
  123. * 页面相关事件处理函数--监听用户下拉动作
  124. */
  125. onPullDownRefresh: function() {
  126. setTimeout(() => {
  127. uni.stopPullDownRefresh()
  128. }, 200);
  129. },
  130. }
  131. </script>
  132. <style>
  133. page {
  134. height: 100%;
  135. overflow: hidden;
  136. }
  137. .page {
  138. height: 100%;
  139. overflow: hidden;
  140. }
  141. .scrollList {
  142. flex: 1;
  143. }
  144. .search-bar {
  145. display: flex;
  146. align-items: center;
  147. position: relative;
  148. padding: 27rpx 30rpx 35rpx;
  149. background-color: #fff;
  150. }
  151. .search-bar-form {
  152. flex: 1;
  153. position: relative;
  154. border-radius: 32rpx;
  155. background: #f2f5f7;
  156. }
  157. .search-bar-box {
  158. display: flex;
  159. align-items: center;
  160. position: relative;
  161. padding-left: 20rpx;
  162. padding-right: 20rpx;
  163. height: 64rpx;
  164. z-index: 1;
  165. }
  166. .search-bar-input {
  167. line-height: normal;
  168. width: 100%;
  169. padding-left: 20rpx;
  170. font-size: 30rpx;
  171. color: #333;
  172. }
  173. .phcolor {
  174. font-size: 30rpx;
  175. }
  176. .icon-clear {
  177. height: 38rpx;
  178. }
  179. .icon-clear .tui-icon-class {
  180. display: block
  181. }
  182. .search-bar-label {
  183. height: 64rpx;
  184. display: flex;
  185. justify-content: center;
  186. align-items: center;
  187. position: absolute;
  188. top: 0;
  189. right: 0;
  190. bottom: 0;
  191. left: 0;
  192. z-index: 2;
  193. border-radius: 32rpx;
  194. color: #ccc;
  195. background: #f2f5f7;
  196. }
  197. .icon-search {
  198. position: relative;
  199. height: 26rpx;
  200. margin-right: 20rpx;
  201. font-size: inherit;
  202. }
  203. .search-bar-text {
  204. font-size: 30rpx;
  205. line-height: 32rpx;
  206. }
  207. .cancel-btn {
  208. padding-left: 30rpx;
  209. }
  210. .search-result::before {
  211. display: none;
  212. }
  213. .search-result::after {
  214. display: none;
  215. }
  216. .tui-list-cell {
  217. display: flex;
  218. flex-direction: row;
  219. justify-content: space-between;
  220. align-items: center;
  221. width: 100%;
  222. }
  223. .tui-list-cell-hover {
  224. background-color: #eee !important;
  225. }
  226. .tui-list-cell-navigate {
  227. width: 100%;
  228. position: relative;
  229. padding: 30rpx 0 30rpx 30rpx;
  230. font-size: 28rpx;
  231. color: #333;
  232. }
  233. .tui-list-cell-navigate::after {
  234. content: '';
  235. position: absolute;
  236. border-bottom: 1rpx solid #eaeef1;
  237. -webkit-transform: scaleY(0.5);
  238. transform: scaleY(0.5);
  239. bottom: 0;
  240. right: 0;
  241. left: 30rpx;
  242. }
  243. .current-city {
  244. padding: 0 30rpx 30rpx;
  245. background: #fff;
  246. }
  247. .tui-icon-class {
  248. margin-right: 10rpx;
  249. }
  250. .current-city .title {
  251. font-size: 24rpx;
  252. line-height: 24rpx;
  253. color: #999;
  254. }
  255. .city-name {
  256. display: flex;
  257. align-items: center;
  258. margin-top: 17rpx;
  259. font-size: 30rpx;
  260. font-weight: bold;
  261. line-height: 30rpx;
  262. color: #333;
  263. }
  264. .hot-city .title {
  265. height: 48rpx !important;
  266. padding-left: 30rpx;
  267. font-size: 24rpx !important;
  268. line-height: 48rpx !important;
  269. color: #999;
  270. background: #f2f5f7 !important;
  271. }
  272. .city-names {
  273. display: flex;
  274. flex-wrap: wrap;
  275. justify-content: space-between;
  276. align-content: space-between;
  277. width: 630rpx;
  278. padding: 12rpx 90rpx 26rpx 30rpx;
  279. background: #fff;
  280. }
  281. .city-name-item {
  282. display: flex;
  283. justify-content: center;
  284. align-items: center;
  285. width: 140rpx;
  286. height: 56rpx;
  287. margin-top: 16rpx;
  288. /* border: solid 1rpx #ccc; */
  289. border-radius: 28rpx;
  290. font-size: 28rpx;
  291. color: #333;
  292. position: relative;
  293. }
  294. .city-name-item::before {
  295. content: "";
  296. position: absolute;
  297. width: 200%;
  298. height: 200%;
  299. -webkit-transform-origin: 0 0;
  300. transform-origin: 0 0;
  301. -webkit-transform: scale(0.5, 0.5);
  302. transform: scale(0.5, 0.5);
  303. -webkit-box-sizing: border-box;
  304. box-sizing: border-box;
  305. left: 0;
  306. top: 0;
  307. border-radius: 56rpx;
  308. border: 1px solid #ccc;
  309. }
  310. .tap-city {
  311. color: #fff;
  312. background: #5677fc;
  313. /* border: solid 1rpx #5677fc; */
  314. }
  315. .tui-list {
  316. background-color: #fff;
  317. position: relative;
  318. width: 100%;
  319. display: flex;
  320. flex-direction: column;
  321. padding-bottom: env(safe-area-inset-bottom);
  322. }
  323. .tui-list-cell-divider {
  324. height: 48rpx;
  325. padding-left: 30rpx;
  326. font-size: 24rpx;
  327. color: #999;
  328. background: #f2f5f7;
  329. padding: 0 30rpx;
  330. display: flex;
  331. align-items: center;
  332. }
  333. .tui-indexed-list-bar {
  334. display: flex;
  335. flex-direction: column;
  336. align-items: center;
  337. justify-content: flex-start;
  338. z-index: 9999;
  339. position: absolute;
  340. top: 132rpx;
  341. right: 0;
  342. padding-right: 10rpx;
  343. width: 44rpx;
  344. }
  345. .tui-indexed-list-text {
  346. font-size: 22rpx;
  347. white-space: nowrap;
  348. }
  349. .tui-indexed-list-bar.active {
  350. background-color: rgb(200, 200, 200);
  351. }
  352. .tui-indexed-list-alert {
  353. position: absolute;
  354. z-index: 20;
  355. width: 160rpx;
  356. height: 160rpx;
  357. left: 50%;
  358. top: 50%;
  359. margin-left: -80rpx;
  360. margin-top: -80rpx;
  361. border-radius: 80rpx;
  362. text-align: center;
  363. line-height: 160rpx;
  364. font-size: 70rpx;
  365. color: #fff;
  366. background-color: rgba(0, 0, 0, 0.5);
  367. }
  368. </style>