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

493 lines
9.9 KiB

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