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

482 lines
9.7 KiB

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