酒店桌布为微信小程序
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.

445 lines
8.9 KiB

9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
  1. <template>
  2. <view class="page">
  3. <navbar/>
  4. <view class="search">
  5. <view @click="showSelectArea" class="left-area">
  6. <image src="@/static/image/home/address-icon.png"></image>
  7. <view class="area">{{ area }}</view>
  8. <image src="@/static/image/home/arrow-icon.png" mode="aspectFit"></image>
  9. <view class="parting-line">|</view>
  10. </view>
  11. <view class="center-area">
  12. <image
  13. style="margin-right: 20rpx;"
  14. src="@/static/image/home/search-icon.png"></image>
  15. <input v-model="queryParams.title"
  16. placeholder="桌布租赁" />
  17. </view>
  18. <!-- <view class="right-area">
  19. <view @click="searchAddress" class="search-button">
  20. 搜索
  21. </view>
  22. </view> -->
  23. </view>
  24. <view class="swipe">
  25. <uv-swiper
  26. :list="bannerList"
  27. indicator
  28. height="320rpx"
  29. keyName="pic"></uv-swiper>
  30. </view>
  31. <!-- 水洗店 -->
  32. <view class="userShop"
  33. v-if="userShop">
  34. <view class="list">
  35. <view class="item"
  36. v-for="(item, index) in 4"
  37. :key="index">
  38. <view class="">
  39. <view class="">
  40. 我的客户
  41. </view>
  42. <view class="num">
  43. {{ 30 }}
  44. </view>
  45. </view>
  46. <view class="">
  47. <image :src="`/static/image/home/${index}.png`" mode=""></image>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 酒店 -->
  53. <view class="user"
  54. v-else>
  55. <uv-notice-bar
  56. fontSize="28rpx"
  57. :text="notice"></uv-notice-bar>
  58. <view class="shop">
  59. <image
  60. class="image"
  61. src="https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg"
  62. mode=""></image>
  63. <view class="shopInfo">
  64. <view class="title">
  65. HOUS水洗店
  66. </view>
  67. <view class="tags">
  68. <view class="tag">
  69. 桌布水洗
  70. </view>
  71. <view class="tag">
  72. 桌布租赁
  73. </view>
  74. </view>
  75. <view class="time">
  76. 9:00-18:00
  77. </view>
  78. <view class="address">
  79. 长沙市天心区桂花坪街道231号
  80. </view>
  81. </view>
  82. <view class="btns">
  83. <view class="btn"
  84. @click="$utils.navigateTo('/pages_order/auth/wxUserInfo')">
  85. 我要水洗
  86. </view>
  87. </view>
  88. <view class="tips">
  89. 关联门店主信门店
  90. </view>
  91. </view>
  92. <view class="productList">
  93. <productList :productList="productList.records"/>
  94. </view>
  95. </view>
  96. <!-- <selectArea ref="selectArea" @close="closeAreaPro" @select="selectArea"></selectArea> -->
  97. <PrivacyAgreementPoup/>
  98. <tabber select="0"/>
  99. </view>
  100. </template>
  101. <script>
  102. import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
  103. import Position from '@/utils/position.js'
  104. import tabber from '@/components/base/tabbar.vue'
  105. import productList from '@/components/user/productList.vue'
  106. import { mapGetters } from 'vuex'
  107. // import selectArea from '../../components/selectArea.vue';
  108. export default {
  109. components : {
  110. tabber,
  111. productList,
  112. PrivacyAgreementPoup,
  113. },
  114. data() {
  115. return {
  116. area: '长沙',
  117. notice : '长沙市刘师傅在服务过程中客户投诉“服务过程中有不文明的行为”.....',
  118. queryParams: {
  119. pageNo: 1,
  120. pageSize: 10,
  121. title: '',
  122. },
  123. bannerList: [],
  124. productList: {
  125. records : [],
  126. total : 0,
  127. },
  128. }
  129. },
  130. onShow() {
  131. this.getGoodsPage()
  132. this.noticeList()
  133. this.banner()
  134. },
  135. // 下拉刷新
  136. onPullDownRefresh(){
  137. this.getGoodsPage()
  138. this.noticeList()
  139. this.banner()
  140. },
  141. //滚动到屏幕底部
  142. onReachBottom() {
  143. if(this.queryParams.pageSize < this.productList.total){
  144. this.queryParams.pageSize += 10
  145. this.getGoodsPage()
  146. }
  147. },
  148. computed : {
  149. ...mapGetters(['userShop']),
  150. },
  151. methods: {
  152. banner(){
  153. this.$api('bannerList', res => {
  154. if(res.code == 200){
  155. this.bannerList = res.result
  156. }
  157. })
  158. },
  159. noticeList(){
  160. this.$api('noticeList', res => {
  161. if(res.code == 200){
  162. this.notice = res.result.content
  163. }
  164. })
  165. },
  166. getGoodsPage(){
  167. this.$api('goodsPage', this.queryParams, res => {
  168. uni.stopPullDownRefresh()
  169. if(res.code == 200){
  170. this.productList = res.result
  171. }
  172. })
  173. },
  174. //显示选择地区
  175. showSelectArea() {
  176. // this.$refs.selectArea.open()
  177. },
  178. //搜索地址
  179. searchAddress() {
  180. Position.getLocation(res => {
  181. Position.selectAddress(res.longitude, res.latitude, success => {
  182. let address = this.extractProvinceAndCity(success)
  183. this.queryParams.title = address.city
  184. })
  185. })
  186. },
  187. //提取用户选择的地址信息(省市县信息)
  188. extractProvinceAndCity(res) { //提取用户选择的地址信息(省市)
  189. if (!res.address && res.name) { //用户直接选择城市的逻辑
  190. return {
  191. province: '',
  192. city: res.name
  193. };
  194. }
  195. if (res.address) { //用户选择了详细地址,要从详细地址中提取出省市县信息
  196. // 使用正则表达式匹配省市县
  197. const regex = /(?<province>[\u4e00-\u9fa5]+?省)(?<city>[\u4e00-\u9fa5]+?(?:市|自治州|盟|地区))/;
  198. const match = res.address.match(regex);
  199. if (match) { // 如果匹配成功,则返回省和市的信息
  200. return {
  201. province: match.groups.province,
  202. city: match.groups.city
  203. };
  204. }
  205. }
  206. return { //用户没选择地址就点了确定按钮
  207. province: '',
  208. city: ''
  209. }
  210. },
  211. }
  212. }
  213. </script>
  214. <style scoped lang="scss">
  215. .search {
  216. height: 82rpx;
  217. width: 710rpx;
  218. background: #FFFFFF;
  219. margin: 20rpx auto;
  220. border-radius: 41rpx;
  221. box-sizing: border-box;
  222. padding: 0 15rpx;
  223. display: flex;
  224. align-items: center;
  225. // justify-content: space-between;
  226. .left-area,
  227. .center-area {
  228. display: flex;
  229. align-items: center;
  230. }
  231. .left-area {
  232. max-width: 160rpx;
  233. image {
  234. flex-shrink: 0;
  235. width: 26rpx;
  236. height: 26rpx;
  237. }
  238. .area {
  239. font-size: 24rpx;
  240. display: -webkit-box;
  241. -webkit-line-clamp: 2;
  242. /* 限制显示两行 */
  243. -webkit-box-orient: vertical;
  244. overflow: hidden;
  245. text-overflow: ellipsis;
  246. color: #292929;
  247. }
  248. .parting-line {
  249. flex-shrink: 0;
  250. font-size: 26rpx;
  251. color: #ccc;
  252. margin: 0rpx 5rpx;
  253. }
  254. }
  255. .center-area {
  256. display: flex;
  257. flex-wrap: nowrap;
  258. align-items: center;
  259. width: calc(100% - 290rpx);
  260. margin-left: 30rpx;
  261. image {
  262. width: 26rpx;
  263. height: 26rpx;
  264. }
  265. .van-field {
  266. background-color: transparent;
  267. box-sizing: border-box;
  268. height: 82rpx;
  269. line-height: 82rpx;
  270. width: calc(100% - 30rpx);
  271. padding: 0rpx 10rpx 0rpx 0rpx;
  272. input {
  273. height: 82rpx;
  274. font-size: 60rpx;
  275. }
  276. }
  277. }
  278. .right-area {
  279. .search-button {
  280. background: #60BDA2;
  281. height: 60rpx;
  282. width: 130rpx;
  283. font-size: 26rpx;
  284. border-radius: 35rpx;
  285. color: white;
  286. display: flex;
  287. align-items: center;
  288. justify-content: center;
  289. }
  290. }
  291. }
  292. .swipe{
  293. overflow: hidden;
  294. border-radius: 20rpx;
  295. margin: 20rpx;
  296. }
  297. .page{
  298. & /deep/ .uv-icon__icon{
  299. font-size: 30rpx !important;
  300. }
  301. // 水洗店
  302. .userShop{
  303. .list{
  304. display: flex;
  305. flex-wrap: wrap;
  306. .item{
  307. display: flex;
  308. justify-content: center;
  309. align-items: center;
  310. width: 330rpx;
  311. margin: 20rpx;
  312. padding: 30rpx 0;
  313. color: #FFFFFF;
  314. line-height: 50rpx;
  315. border-radius: 20rpx;
  316. font-size: 28rpx;
  317. .num{
  318. font-size: 38rpx;
  319. font-weight: 900;
  320. }
  321. image{
  322. width: 110rpx;
  323. height: 110rpx;
  324. margin-left: 20rpx;
  325. }
  326. &:nth-child(1){
  327. background: #F07A77;
  328. }
  329. &:nth-child(2){
  330. background: #F48B4E;
  331. }
  332. &:nth-child(3){
  333. background: #6487E1;
  334. }
  335. &:nth-child(4){
  336. background: #61B7E6;
  337. }
  338. }
  339. }
  340. }
  341. // 酒店
  342. .user{
  343. padding: 20rpx;
  344. .shop{
  345. position: relative;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. background-color: #fff;
  350. margin-top: 20rpx;
  351. border-radius: 20rpx;
  352. padding: 20rpx;
  353. overflow: hidden;
  354. .image{
  355. width: 180rpx;
  356. height: 180rpx;
  357. margin-right: 20rpx;
  358. border-radius: 20rpx;
  359. }
  360. .shopInfo{
  361. font-size: 22rpx;
  362. .title{
  363. font-size: 30rpx;
  364. }
  365. .tags{
  366. display: flex;
  367. .tag{
  368. padding: 4rpx 6rpx;
  369. border: 1rpx solid #FFAC6E;
  370. color: #FFAC6E;
  371. margin-right: 10rpx;
  372. margin-top: 10rpx;
  373. font-size: 18rpx;
  374. }
  375. }
  376. .time{
  377. margin-top: 10rpx;
  378. display: flex;
  379. }
  380. .address{
  381. margin-top: 10rpx;
  382. display: flex;
  383. }
  384. }
  385. .btns{
  386. margin-left: auto;
  387. display: flex;
  388. align-items: center;
  389. justify-content: center;
  390. .btn{
  391. background-color: $uni-color;
  392. color: #fff;
  393. box-shadow: 0 0 5rpx 5rpx #FFAC6E;
  394. padding: 10rpx 20rpx;
  395. flex-shrink: 0;
  396. border-radius: 35rpx;
  397. }
  398. }
  399. .tips{
  400. position: absolute;
  401. top: 0;
  402. right: 0;
  403. font-size: 24rpx;
  404. color: #FFAC6E;
  405. background-color: #FEF5EE;
  406. padding: 10rpx 20rpx;
  407. border-radius: 10rpx;
  408. }
  409. }
  410. }
  411. }
  412. </style>