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

509 lines
10 KiB

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