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

478 lines
9.5 KiB

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