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

488 lines
9.8 KiB

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