商城类、订单类uniapp模板,多角色
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.

412 lines
8.2 KiB

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