search.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <view class="box">
  3. <view class="padding-t-20">
  4. <view class="alertItemTitle">
  5. 职业类型
  6. </view>
  7. <view class="flex alertTypeBox">
  8. <view class="alertTypeItem" @click="search.work_type_id=ltt.id" :key='inde'
  9. v-for="(ltt,inde) in workTypeList" :class="{action:search.work_type_id==ltt.id}">
  10. <text>
  11. {{ltt.title}}
  12. </text>
  13. </view>
  14. </view>
  15. <view class="alertItemTitle">
  16. 价格类型
  17. </view>
  18. <view class="flex alertTypeBox">
  19. <view class="alertTypeItem" :class="{action:search.timetype===''}" @click="search.timetype=''">
  20. <text>
  21. </text>
  22. </view>
  23. <view class="alertTypeItem" :class="{action:search.timetype==='hour'}" @click="search.timetype='hour'">
  24. <text>
  25. 小时
  26. </text>
  27. </view>
  28. <view class="alertTypeItem" :class="{action:search.timetype==='day'}" @click="search.timetype='day'">
  29. <text>
  30. 每天
  31. </text>
  32. </view>
  33. <view class="alertTypeItem" :class="{action:search.timetype==='month'}"
  34. @click="search.timetype='month'">
  35. <text>
  36. 每月
  37. </text>
  38. </view>
  39. </view>
  40. <view class="alertItemTitle" v-if="search.timetype!==''">
  41. 最低价格
  42. </view>
  43. <input v-if="search.timetype!==''" v-model="search.servicePrice" class="minMoney" type="number"
  44. placeholder-class="placeholderText" placeholder="自定义最低价格">
  45. <view class="alertItemTitle">
  46. 服务区域
  47. </view>
  48. <view class="flex alertTypeBox">
  49. <view class="alertTypeItem" :class="{action:search.is_china===''}" @click="search.is_china=''">
  50. <text>
  51. 全部
  52. </text>
  53. </view>
  54. <view class="alertTypeItem" :class="{action:search.is_china===1}" @click="search.is_china=1">
  55. <text>
  56. 国内
  57. </text>
  58. </view>
  59. <view class="alertTypeItem" :class="{action:search.is_china===0}" @click="search.is_china=0">
  60. <text>
  61. 国外
  62. </text>
  63. </view>
  64. </view>
  65. <view v-if="search.is_china===1" class="alertItemTitle">
  66. 区域选择
  67. </view>
  68. <view v-if="search.is_china===1" class="right">
  69. <view class="citylist">
  70. <view class="">
  71. <view class="flex margin-b-20" v-for="(item,ind) in search.service_area" :key="ind">
  72. <view>
  73. {{item.province+item.city+item.district}}
  74. <text class="margin-l-10 del" @click="search.service_area.splice(ind,1)">
  75. 删除
  76. </text>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="flex">
  81. <pickerAddress class="buttom" @change="onCityClick">选择地区</pickerAddress>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="flex alertButtomBox">
  87. <view class="cancel" @click="cancelSearch">
  88. 清空选择
  89. </view>
  90. <view class="confirm" @click="confirmSearch">
  91. 确定
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
  98. import {
  99. getUserWorkTypeList
  100. } from '@/api/model.js';
  101. export default {
  102. components: {
  103. pickerAddress
  104. },
  105. props: {
  106. isCom: {
  107. type: Boolean,
  108. default: false
  109. }
  110. },
  111. data() {
  112. return {
  113. workTypeList: [],
  114. search: {
  115. timetype: '', //hour,month,day
  116. servicePrice: '',
  117. work_type_id: '',
  118. service_area: [],
  119. is_china: '',
  120. }
  121. };
  122. },
  123. onReady() {
  124. this.init()
  125. },
  126. methods: {
  127. init() {
  128. const that = this;
  129. getUserWorkTypeList().then(
  130. (res) => {
  131. that.workTypeList = res.data.list
  132. }
  133. ).catch(
  134. (res) => {
  135. console.log(res);
  136. }
  137. )
  138. },
  139. onCityClick({
  140. data
  141. }) {
  142. let address = {};
  143. address.province = data[0];
  144. address.city = data[1];
  145. address.district = data[2];
  146. this.search.service_area.push(address)
  147. },
  148. confirmSearch() {
  149. const search = this.search
  150. const address =search.service_area.map(
  151. (item) => {
  152. return `${item.province},${item.city},${item.district}`
  153. }
  154. )
  155. uni.navigateTo({
  156. url:`/pages/index/listModel?type=2&timetype=${search.timetype}&servicePrice=${search.servicePrice}&work_type_id=${search.work_type_id}&service_area=${address.join('-')}&is_china=${search.is_china}`,
  157. })
  158. },
  159. cancelSearch() {
  160. this.$emit('init')
  161. this.search = {
  162. servicePrice: '',
  163. work_type_id: '',
  164. timetype: '',
  165. service_area: [],
  166. is_china: '',
  167. }
  168. }
  169. }
  170. };
  171. </script>
  172. <style lang="scss" scoped>
  173. .box {
  174. line-height: 1;
  175. background-color: #FFF;
  176. padding: 20rpx 0 30rpx;
  177. border-radius: 20rpx 20rpx 0 0;
  178. min-height: 100vh;
  179. .right {
  180. color: $font-color-light;
  181. font-size: $font-base;
  182. flex-grow: 1;
  183. justify-content: flex-end;
  184. padding: 20rpx;
  185. .timetype {
  186. width: 100%;
  187. justify-content: flex-end;
  188. }
  189. .citylist {
  190. .del {
  191. font-size: $font-sm;
  192. border-radius: 10rpx;
  193. background-color: #eee;
  194. line-height: 1;
  195. padding: 5rpx 15rpx;
  196. }
  197. }
  198. .img {
  199. width: 26rpx;
  200. }
  201. .buttom {
  202. border-radius: 10rpx;
  203. line-height: 1;
  204. padding: 10rpx 20rpx;
  205. background-color: #eee;
  206. }
  207. }
  208. .alertTitle {
  209. font-weight: bold;
  210. font-size: 32rpx;
  211. flex-grow: 1;
  212. text-align: center;
  213. }
  214. .alertClose {
  215. width: 40rpx;
  216. height: 40rpx;
  217. }
  218. .alertItemTitle {
  219. font-size: 28rpx;
  220. padding-left: 20rpx;
  221. font-weight: bold;
  222. }
  223. .minMoney {
  224. margin: 20rpx;
  225. font-size: 24rpx;
  226. border-bottom: 1px solid #e9e9e9;
  227. }
  228. .placeholderText {
  229. font-size: 24rpx;
  230. }
  231. .alertTypeBox {
  232. flex-wrap: wrap;
  233. justify-content: flex-start;
  234. padding: 0 20rpx 10rpx;
  235. margin-top: 20rpx;
  236. .alertTypeItem {
  237. font-size: 24rpx;
  238. padding: 10rpx 20rpx;
  239. background-color: #eee;
  240. border-radius: 10rpx;
  241. margin-bottom: 14rpx;
  242. margin-right: 14rpx;
  243. &.action {
  244. background-color: #fee7e4;
  245. color: #F86859;
  246. }
  247. }
  248. }
  249. .moneyTitle {
  250. font-size: 28rpx;
  251. }
  252. .alertButtomBox {
  253. color: #FFF;
  254. border-top: 1px solid #e3e3e3;
  255. position: fixed;
  256. bottom: 0;
  257. left: 0;
  258. right: 0;
  259. .confirm {
  260. background-color: #F86859;
  261. }
  262. .cancel {
  263. background-color: orange;
  264. }
  265. .cancel,
  266. .confirm {
  267. height: 70rpx;
  268. line-height: 70rpx;
  269. text-align: center;
  270. width: 375rpx;
  271. font-size: 28rpx;
  272. }
  273. }
  274. }
  275. .topSearch {
  276. position: sticky;
  277. top: 0;
  278. background-color: #FFF;
  279. padding-right: 100rpx;
  280. height: 80rpx;
  281. .itemBox {
  282. padding-left: 30rpx;
  283. align-items: center;
  284. .itemTip {
  285. background-color: #FFF;
  286. position: fixed;
  287. right: 0;
  288. top: 0;
  289. align-items: center;
  290. height: 80rpx;
  291. padding: 0 30rpx;
  292. }
  293. .typeTtem {
  294. flex-shrink: 0;
  295. height: 80rpx;
  296. align-items: center;
  297. margin-right: 30rpx;
  298. &.action {
  299. color: #F86859;
  300. border-bottom: 1px solid #F86859;
  301. }
  302. }
  303. }
  304. }
  305. </style>