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

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