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

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