Browse Source

修改uv popup组件

提取vuex store.js
修改根据经纬度获取信息返回
部分页面完善
master
396316021 1 year ago
parent
commit
fe7e278e5a
  1. 9
      api/address.js
  2. 15
      api/order.js
  3. 28
      main.js
  4. 11
      manifest.json
  5. 49
      pages/Addr/index.vue
  6. 5
      pages/AddrDetail/index.vue
  7. 51
      pages/OrderPage/index.vue
  8. 31
      store.js
  9. 14
      uni_modules/uv-calendar/components/uv-calendar/header.vue
  10. 18
      uni_modules/uv-calendar/components/uv-calendar/month.vue
  11. 17
      uni_modules/uv-popup/components/uv-popup/uv-popup.vue
  12. 2
      utils/functions.js

9
api/address.js

@ -3,17 +3,14 @@ import {host} from "@/config/host";
/**
* 获取地址列表
* @param page
* @param data
* @returns {Promise | Promise<unknown>}
*/
export function getAddressList(page){
export function getAddressList(data){
return request({
url:`${host}/user/address-list`,
method: 'post',
data:{
page: page,
limit: 10
}
data:data
});
}

15
api/order.js

@ -35,4 +35,19 @@ export function getOrderList(data = {
method: 'post',
data:data
})
}
/**
* 匹配宠物店铺服务
* @param data
* @returns {Promise<unknown>}
*/
export function getStoreService(data = {
"address_id":""
}){
return request({
url:"order/store-service",
method: 'post',
data:data
})
}

28
main.js

@ -14,35 +14,9 @@ app.$mount()
// #ifdef VUE3
import uviewPlus from 'uview-plus'
import { createSSRApp } from 'vue'
import { createStore } from 'vuex'
import { title } from '@/config/host.js'
const store = createStore({
state () {
return {
footCheck:'home',
title:title,
userInfo:{},
userExtends:{},
}
},
getters:{
import store from "@/store";
},
mutations: {
footCheck (state,check) {
state.footCheck = check
},
title (state,title) {
state.title = title
},
userInfo (state,userInfo) {
state.userInfo = userInfo
},
userExtends (state,userExtends) {
state.userExtends = userExtends
},
}
})
export function createApp() {
const app = createSSRApp(App)
app.use(uviewPlus)

11
manifest.json

@ -54,7 +54,16 @@
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
"usingComponents" : true,
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
},
"scope.userFuzzyLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"requiredPrivateInfos": ["chooseLocation", "getLocation"]
},
"mp-alipay" : {
"usingComponents" : true

49
pages/Addr/index.vue

@ -53,23 +53,23 @@
</view>
<view class="footer-menu row">
<view class="footer-button col-6">
<MzButton
title="管理"
button-color="#ffffff"
font-color="##262626"
button-width="250rpx"
>
</MzButton>
</view>
<view class="footer-button col-6"
<!-- <view class="footer-button col-6">-->
<!-- <MzButton-->
<!-- title="管理"-->
<!-- button-color="#ffffff"-->
<!-- font-color="##262626"-->
<!-- button-width="250rpx"-->
<!-- >-->
<!-- </MzButton>-->
<!-- </view>-->
<view class="footer-button col-12"
@click="navTo('/pages/AddrDetail/index')">
<MzButton
title="新增地址"
button-color="#4DC3B8"
font-color="#FFFFFF"
button-width="250rpx"
button-width="100%"
style="width:90%;"
>
</MzButton>
</view>
@ -129,6 +129,11 @@
petImage: imghost + '/static/image/pet_avatar1.jpeg',
addrList: [],
type:'',
pages:{
page:1,
limit:10,
},
status:'loadmore',
}
},
onLoad(option) {
@ -226,11 +231,18 @@
url:url
})
},
getAddressList(page = 1){
getAddressList(page).then(data => {
page === 1
? this.addrList = data.data
: this.addrList.push(data.data);
getAddressList(){
if(this.status === 'nomore'){
return false;
}
getAdressList(this.pages).then(res => {
this.addrList.push.apply(this.addrList,res.data)
this.pages.page++;
if(res.data.length === 0){
this.status = 'nomore';
}else{
this.status = 'loadmore';
}
});
},
delAddress(id){
@ -242,6 +254,9 @@
})
}
},
onReachBottom() {
this.getAddressList();
},
onPageScroll(res) {
if (res.scrollTop <= 20) {
uni.$emit('isTop', true);

5
pages/AddrDetail/index.vue

@ -206,6 +206,7 @@
getDetail(id){
getDetail(id).then(data => {
this.address = data.data;
this.address.position = data.data.province+data.data.city+data.data.district;
})
},
selectAddress() {
@ -232,8 +233,10 @@
that.address.province = address.province;
that.address.city = address.city;
that.address.district = address.district;
that.address.position = res.address;
that.address.position = address.province+address.city+address.district;
that.address.info = res.name;
that.address.lat = res.latitude;
that.address.lng = res.longitude;
});
},

51
pages/OrderPage/index.vue

@ -62,27 +62,20 @@
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<view class="order-item row">
<view class="order-item row" @click="showAddServicePopup">
<view class="item-title">
增值服务
</view>
<view class="item-content row col">
<view class="item-content-tag">
<view class="tag-text">
洗澡
</view>
<view class="tag-close">
<image mode="heightFix" class="img" :src="staticImage.tagClose"/>
</view>
</view>
<view class="item-content-tag">
<view class="item-content-tag" v-for="i of 3">
<view class="tag-text">
剪指甲
洗澡{{i}}
</view>
<view class="tag-close">
<image mode="heightFix" class="img" :src="staticImage.tagClose"/>
</view>
</view>
</view>
<view class="item-icon">
<u-icon name="arrow-right"></u-icon>
@ -146,12 +139,12 @@
<view class="order-item pet-page-item row">
<view class="order-item-container row" >
<view class="order-item-col col-4" v-for="(item,index) in [1,2,3]">
<view class="order-item-col col-4" v-for="(item,index) in basicServiceList">
<view class="order-item-content-group">
<view class="count-group-content">
<image mode="heightFix" class="img" :src="staticImage.groupImg"/>
<view class="group-title">专业服务</view>
<view class="group-desc">标准</view>
<image mode="heightFix" class="img" :src="item.logo||staticImage.groupImg"/>
<view class="group-title">{{item.name}}</view>
<view class="group-desc">{{parseFloat(item.price)}}/</view>
<view class="group-checkbox">
<u-radio
:customStyle="{marginBottom: '8px'}"
@ -224,6 +217,9 @@
<view style="padding:30rpx;">
1文字占位文字占位文字占位文字占位文字占位文字占位文字占位 2文字占位文字占位文字占位文字占位文字占位文字占位文
</view>
</uv-popup>
<uv-popup ref="addServicePopup" mode="bottom" closeable safeAreaInsetTop safeAreaInsetBottom>
</uv-popup>
<!-- <RightNav></RightNav> -->
</template>
@ -241,6 +237,7 @@
import {cardDetail} from "@/api/card";
import {getAddressList} from "@/api/address";
import image from "@/config/image";
import {getStoreService} from "@/api/order";
export default {
components: {
HeaderNav,
@ -284,6 +281,12 @@
is_timeout: false,
}],
address:{},
addServiceList:[],
basicServiceList:[],
pages:{
page:1,
limit:10
}
}
},
onLoad(options) {
@ -294,6 +297,18 @@
this.getDefaultAddress();
},
methods: {
showAddServicePopup(){
this.$refs.addServicePopup.open();
},
selectAddService(item){
},
getStoreServiceList(){
getStoreService({address_id: this.address.id}).then(res => {
this.addServiceList = res.data.add_service;
this.basicServiceList = res.data.basic_service;
});
},
getDefaultAddress() {
let cacheAddress = uni.getStorageSync('address');
if (cacheAddress) {
@ -301,14 +316,16 @@
console.log(cacheAddress)
this.address = cacheAddress;
} else {
getAddressList({}).then(res => {
getAddressList(this.pages).then(res => {
res.data.forEach(item => {
if (item.is_default === 1) {
this.address = item;
}
});
})
console.log(this.address)
}
if(this.address.id){
this.getStoreServiceList();
}
},
delTime(index){

31
store.js

@ -0,0 +1,31 @@
import {title} from "@/config/host";
import { createStore } from 'vuex'
const store = createStore({
state () {
return {
footCheck:'home',
title:title,
userInfo:{},
userExtends:{},
}
},
getters:{
},
mutations: {
footCheck (state,check) {
state.footCheck = check
},
title (state,title) {
state.title = title
},
userInfo (state,userInfo) {
state.userInfo = userInfo
},
userExtends (state,userExtends) {
state.userExtends = userExtends
},
}
})
export default store;

14
uni_modules/uv-calendar/components/uv-calendar/header.vue

@ -1,13 +1,6 @@
<template>
<view class="uv-calendar-header uv-border-bottom">
<text
class="uv-calendar-header__title"
v-if="showTitle"
>{{ title }}</text>
<text
class="uv-calendar-header__subtitle"
v-if="showSubtitle"
>{{ subtitle }}</text>
<image :src="staticImage.dateTitle" mode="heightFix" style="height: 40rpx;padding:40rpx 30rpx;"/>
<view class="uv-calendar-header__weekdays">
<text class="uv-calendar-header__weekdays__weekday"></text>
<text class="uv-calendar-header__weekdays__weekday"></text>
@ -23,6 +16,7 @@
<script>
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
import {imghost} from "@/config/host";
export default {
name: 'uv-calendar-header',
mixins: [mpMixin, mixin],
@ -50,7 +44,9 @@
},
data() {
return {
staticImage:{
dateTitle:imghost+'/static/image/date-title.png',
}
}
},
methods: {

18
uni_modules/uv-calendar/components/uv-calendar/month.vue

@ -34,12 +34,15 @@
<script>
// #ifdef APP-NVUE
// nvue
const dom = uni.requireNativePlugin('dom')
const dom = uni.requireNativePlugin('dom')
// #endif
import { colorGradient } from '@/uni_modules/uv-ui-tools/libs/function/colorGradient.js';
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
import dayjs from '@/uni_modules/uv-ui-tools/libs/util/dayjs.js'
import {imghost} from "@/config/host";
export default {
name: 'uv-calendar-month',
emits:['monthSelected','updateMonthTop','change'],
@ -137,7 +140,10 @@
width: 0,
// item
item: {},
selected: []
selected: [],
staticImage:{
selectBack:imghost+'/static/image/select-back.png',
},
}
},
watch: {
@ -185,7 +191,11 @@
style = {}
// dateselected0使dateSameincludes
if (this.selected.some(item => this.dateSame(item, date))) {
style.backgroundColor = this.color
style.backgroundImage = 'url('+this.staticImage.selectBack+')';
style.backgroundRepeat = 'no-repeat';
style.backgroundSize = '100% 60%';
style.backgroundPositionY = 'center';
// style.backgroundColor = this.color
}
if (this.mode === 'single') {
if (date === this.selected[0]) {
@ -239,7 +249,7 @@
style = {}
//
if (this.selected.some(item => this.dateSame(item, date))) {
style.color = '#ffffff'
style.color = this.color
}
if (this.mode === 'range') {
const len = this.selected.length - 1

17
uni_modules/uv-popup/components/uv-popup/uv-popup.vue

@ -43,12 +43,13 @@
hover-class="uv-popup__content__close--hover"
hover-stay-time="150"
>
<uv-icon
name="close"
color="#909399"
size="18"
bold
></uv-icon>
<uv-image mode="widthFix" :src="staticImage.closeIcon" width="40rpx" height="40rpx"></uv-image>
<!-- <uv-icon-->
<!-- name="close"-->
<!-- color="#909399"-->
<!-- size="18"-->
<!-- bold-->
<!-- ></uv-icon>-->
</view>
</view>
</uv-transition>
@ -65,6 +66,7 @@
// #endif
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
import {imghost} from "@/config/host";
/**
* PopUp 弹出层
* @description 弹出层组件为了解决遮罩弹层的问题
@ -203,6 +205,9 @@
},
data() {
return {
staticImage:{
closeIcon:imghost + '/static/image/close-icon.png',
},
ani: [],
showPopup: false,
showTrans: false,

2
utils/functions.js

@ -77,7 +77,7 @@ const api = {
address: details.activedeta.city+details.activedeta.address, //地址参数,例:固定地址,address: '北京市海淀区彩和坊路海淀西大街74号'
success: function(res) {//成功后的回调
console.log(res);
relove(res.result.location)
relove(res.result)
},
fail: function(error) {
console.error(error);

Loading…
Cancel
Save