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

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