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

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