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

438 lines
8.8 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 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. onReachBottom() {
  137. if(this.queryParams.pageSize < this.productList.total){
  138. this.queryParams.pageSize += 10
  139. this.getGoodsPage()
  140. }
  141. },
  142. computed : {
  143. ...mapGetters(['userShop']),
  144. },
  145. methods: {
  146. banner(){
  147. this.$api('bannerList', res => {
  148. if(res.code == 200){
  149. this.bannerList = res.result
  150. }
  151. })
  152. },
  153. noticeList(){
  154. this.$api('noticeList', res => {
  155. if(res.code == 200){
  156. this.notice = res.result.content
  157. }
  158. })
  159. },
  160. getGoodsPage(){
  161. this.$api('goodsPage', this.queryParams, res => {
  162. if(res.code == 200){
  163. this.productList = res.result
  164. }
  165. })
  166. },
  167. //显示选择地区
  168. showSelectArea() {
  169. // this.$refs.selectArea.open()
  170. },
  171. //搜索地址
  172. searchAddress() {
  173. Position.getLocation(res => {
  174. Position.selectAddress(res.longitude, res.latitude, success => {
  175. let address = this.extractProvinceAndCity(success)
  176. this.queryParams.title = address.city
  177. })
  178. })
  179. },
  180. //提取用户选择的地址信息(省市县信息)
  181. extractProvinceAndCity(res) { //提取用户选择的地址信息(省市)
  182. if (!res.address && res.name) { //用户直接选择城市的逻辑
  183. return {
  184. province: '',
  185. city: res.name
  186. };
  187. }
  188. if (res.address) { //用户选择了详细地址,要从详细地址中提取出省市县信息
  189. // 使用正则表达式匹配省市县
  190. const regex = /(?<province>[\u4e00-\u9fa5]+?省)(?<city>[\u4e00-\u9fa5]+?(?:市|自治州|盟|地区))/;
  191. const match = res.address.match(regex);
  192. if (match) { // 如果匹配成功,则返回省和市的信息
  193. return {
  194. province: match.groups.province,
  195. city: match.groups.city
  196. };
  197. }
  198. }
  199. return { //用户没选择地址就点了确定按钮
  200. province: '',
  201. city: ''
  202. }
  203. },
  204. }
  205. }
  206. </script>
  207. <style scoped lang="scss">
  208. .search {
  209. height: 82rpx;
  210. width: 710rpx;
  211. background: #FFFFFF;
  212. margin: 20rpx auto;
  213. border-radius: 41rpx;
  214. box-sizing: border-box;
  215. padding: 0 15rpx;
  216. display: flex;
  217. align-items: center;
  218. // justify-content: space-between;
  219. .left-area,
  220. .center-area {
  221. display: flex;
  222. align-items: center;
  223. }
  224. .left-area {
  225. max-width: 160rpx;
  226. image {
  227. flex-shrink: 0;
  228. width: 26rpx;
  229. height: 26rpx;
  230. }
  231. .area {
  232. font-size: 24rpx;
  233. display: -webkit-box;
  234. -webkit-line-clamp: 2;
  235. /* 限制显示两行 */
  236. -webkit-box-orient: vertical;
  237. overflow: hidden;
  238. text-overflow: ellipsis;
  239. color: #292929;
  240. }
  241. .parting-line {
  242. flex-shrink: 0;
  243. font-size: 26rpx;
  244. color: #ccc;
  245. margin: 0rpx 5rpx;
  246. }
  247. }
  248. .center-area {
  249. display: flex;
  250. flex-wrap: nowrap;
  251. align-items: center;
  252. width: calc(100% - 290rpx);
  253. margin-left: 30rpx;
  254. image {
  255. width: 26rpx;
  256. height: 26rpx;
  257. }
  258. .van-field {
  259. background-color: transparent;
  260. box-sizing: border-box;
  261. height: 82rpx;
  262. line-height: 82rpx;
  263. width: calc(100% - 30rpx);
  264. padding: 0rpx 10rpx 0rpx 0rpx;
  265. input {
  266. height: 82rpx;
  267. font-size: 60rpx;
  268. }
  269. }
  270. }
  271. .right-area {
  272. .search-button {
  273. background: #60BDA2;
  274. height: 60rpx;
  275. width: 130rpx;
  276. font-size: 26rpx;
  277. border-radius: 35rpx;
  278. color: white;
  279. display: flex;
  280. align-items: center;
  281. justify-content: center;
  282. }
  283. }
  284. }
  285. .swipe{
  286. overflow: hidden;
  287. border-radius: 20rpx;
  288. margin: 20rpx;
  289. }
  290. .page{
  291. & /deep/ .uv-icon__icon{
  292. font-size: 30rpx !important;
  293. }
  294. // 水洗店
  295. .userShop{
  296. .list{
  297. display: flex;
  298. flex-wrap: wrap;
  299. .item{
  300. display: flex;
  301. justify-content: center;
  302. align-items: center;
  303. width: 330rpx;
  304. margin: 20rpx;
  305. padding: 30rpx 0;
  306. color: #FFFFFF;
  307. line-height: 50rpx;
  308. border-radius: 20rpx;
  309. font-size: 28rpx;
  310. .num{
  311. font-size: 38rpx;
  312. font-weight: 900;
  313. }
  314. image{
  315. width: 110rpx;
  316. height: 110rpx;
  317. margin-left: 20rpx;
  318. }
  319. &:nth-child(1){
  320. background: #F07A77;
  321. }
  322. &:nth-child(2){
  323. background: #F48B4E;
  324. }
  325. &:nth-child(3){
  326. background: #6487E1;
  327. }
  328. &:nth-child(4){
  329. background: #61B7E6;
  330. }
  331. }
  332. }
  333. }
  334. // 酒店
  335. .user{
  336. padding: 20rpx;
  337. .shop{
  338. position: relative;
  339. display: flex;
  340. align-items: center;
  341. justify-content: center;
  342. background-color: #fff;
  343. margin-top: 20rpx;
  344. border-radius: 20rpx;
  345. padding: 20rpx;
  346. overflow: hidden;
  347. .image{
  348. width: 180rpx;
  349. height: 180rpx;
  350. margin-right: 20rpx;
  351. border-radius: 20rpx;
  352. }
  353. .shopInfo{
  354. font-size: 22rpx;
  355. .title{
  356. font-size: 30rpx;
  357. }
  358. .tags{
  359. display: flex;
  360. .tag{
  361. padding: 4rpx 6rpx;
  362. border: 1rpx solid #FFAC6E;
  363. color: #FFAC6E;
  364. margin-right: 10rpx;
  365. margin-top: 10rpx;
  366. font-size: 18rpx;
  367. }
  368. }
  369. .time{
  370. margin-top: 10rpx;
  371. display: flex;
  372. }
  373. .address{
  374. margin-top: 10rpx;
  375. display: flex;
  376. }
  377. }
  378. .btns{
  379. margin-left: auto;
  380. display: flex;
  381. align-items: center;
  382. justify-content: center;
  383. .btn{
  384. background-color: $uni-color;
  385. color: #fff;
  386. box-shadow: 0 0 5rpx 5rpx #FFAC6E;
  387. padding: 10rpx 20rpx;
  388. flex-shrink: 0;
  389. border-radius: 35rpx;
  390. }
  391. }
  392. .tips{
  393. position: absolute;
  394. top: 0;
  395. right: 0;
  396. font-size: 24rpx;
  397. color: #FFAC6E;
  398. background-color: #FEF5EE;
  399. padding: 10rpx 20rpx;
  400. border-radius: 10rpx;
  401. }
  402. }
  403. }
  404. }
  405. </style>