diff --git a/components/comment/comment.vue b/components/comment/comment.vue index 51ee587..5caa76f 100644 --- a/components/comment/comment.vue +++ b/components/comment/comment.vue @@ -9,7 +9,7 @@ - + {{productReply.nickname}} diff --git a/components/locationOpen/locationOpen.vue b/components/locationOpen/locationOpen.vue new file mode 100644 index 0000000..2bdd138 --- /dev/null +++ b/components/locationOpen/locationOpen.vue @@ -0,0 +1,134 @@ + + + + \ No newline at end of file diff --git a/components/recomGoods/recomGoods.vue b/components/recomGoods/recomGoods.vue index d59b63d..bdeb598 100644 --- a/components/recomGoods/recomGoods.vue +++ b/components/recomGoods/recomGoods.vue @@ -19,7 +19,7 @@ - 够辣 + @@ -54,7 +54,7 @@ - 够辣 + @@ -83,11 +83,13 @@ diff --git a/pages/cart/style.scss b/pages/cart/style.scss index 085cdfb..b712879 100644 --- a/pages/cart/style.scss +++ b/pages/cart/style.scss @@ -109,6 +109,41 @@ page{ .cart{ background: linear-gradient(180deg, #FCEEEF 0%, #f6f6f6 100%); background-repeat: no-repeat; + .empty{ + height:480rpx; + background: linear-gradient( 180deg, #FBF1F1 0%, #FFFFFF 50%); + margin:0rpx 20rpx 0rpx 20rpx; + border-radius: 20rpx; + display: flex; + align-items: center; + justify-content: center; + .empty_cont{ + .empty_cont_img{ + margin: 0 auto; + width: 265rpx; + height: 280rpx; + display: flex; + } + .empty_cont_title{ + font-size: 26rpx; + color: #999999; + text-align: center; + } + .empty_cont_btn{ + margin: 0 auto; + width: 154rpx; + height: 46rpx; + border-radius: 30rpx; + border: 1rpx solid #FF0000; + color: #FF0000; + line-height: 30rpx; + display: flex; + align-items: center; + justify-content: center; + margin-top: 40rpx; + } + } + } .cart_item{ // margin: 0rpx 20rpx 0rpx 20rpx; // border-radius: 25rpx; @@ -162,12 +197,13 @@ page{ } } .cart_shop_cont{ - width: 390rpx; + width: 415rpx; padding-right: 20rpx; .cart_title{ font-size: 27rpx; color: #333333; font-weight: 500; + min-height: 110rpx; .cart_text{ min-height: 65rpx; overflow: hidden; diff --git a/pages/classify/classify.vue b/pages/classify/classify.vue index a787e09..239761d 100644 --- a/pages/classify/classify.vue +++ b/pages/classify/classify.vue @@ -1,56 +1,34 @@ diff --git a/pages/classify/style.scss b/pages/classify/style.scss index 665b50c..f07817c 100644 --- a/pages/classify/style.scss +++ b/pages/classify/style.scss @@ -2,10 +2,11 @@ page{ background-color: #F6F6F6; } .mian{ + background: linear-gradient(180deg, #FCF0F1 0%, #f6f6f6 60%); // 头部样式 .head{ position: fixed; - z-index: 100; + z-index: 88; width: 100%; top: 0; left: 0; @@ -110,6 +111,7 @@ page{ } // 商品区域样式 .cont_view{ + height: 100vh; .head_fixed{ background-color: #f6f6f6; color: #999999; @@ -123,7 +125,6 @@ page{ padding: 13rpx 20rpx 0rpx 20rpx; display: flex; justify-content: space-between; - background: linear-gradient(180deg, #FCF0F1 0%, #f6f6f6 50%); .shop_view_ul{ width: 346rpx; .shop_view_li{ @@ -146,9 +147,9 @@ page{ } } .shop_view_img{ - width: 100%; + // width: 100%; position: relative; - height: 320rpx; + padding: 10rpx 10rpx 0rpx 10rpx; .shop_view_tag{ width: 66rpx; height: 42rpx; @@ -169,15 +170,12 @@ page{ } } .shop_view_img_u{ - width: 300rpx; - position: absolute; - z-index: 1; - left: 20rpx; - top: 20rpx; + width: 100%; .shop_view_img_url{ width: 100%; height: 300rpx; display: block; + border-radius: 20rpx; } } } @@ -189,10 +187,26 @@ page{ color: #000000; min-height: 80rpx; } + .shop_view_cont_title text{ + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + word-break: break-all; + } .shop_view_cont_desc{ color: #666666; font-size: 24rpx; } + .shop_view_cont_desc text{ + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + word-break: break-all; + } .shop_view_cont_tag{ display: flex; flex-wrap: wrap; @@ -236,6 +250,15 @@ page{ } } } + .load_desc{ + font-size: 28rpx; + color: #aaa; + text-align: center; + padding-top: 30rpx; + padding-bottom: 30rpx; + } + + } .price::before { content: '¥'; @@ -255,4 +278,74 @@ page{ margin-left: 5rpx; font-weight: 400; } + .nav_popup{ + padding-bottom:5px; + width: 100%; + position: fixed; + top:0; + z-index:99; + .nav_head{ + border-bottom-left-radius: 20px; + border-bottom-right-radius: 20px; + background: linear-gradient(180deg,#FCF0F1 0%,#FFFFFF 60%); + .nav_head_class{ + margin: 0 10px 0 10px; + height: 50px; + display: flex; + align-items: center; + justify-content: space-between; + .nav_head_name{ + font-size: 28rpx; + color: #333333; + font-weight: 500; + } + .nav_head_class_arrow_box{ + width: 30px; + height: 30px; + border-radius: 50%; + background-color: #EFEFEF; + position: relative; + display: flex; + align-items: center; + justify-content: center; + .nav_head_class_arrow_box_img{ + width: 50rpx; + height: 50rpx; + } + } + } + .nav_popup_list{ + display: flex; + flex-wrap: wrap; + .nav_popup_item{ + background-color: #F0EFF4; + border:1px solid #F0EFF4; + width: 162rpx; + height: 58rpx; + border-radius: 6rpx; + color: #333333; + font-size: 24rpx; + margin-left: 10px; + font-weight: 500; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 15px; + } + .nav_popup_selected{ + border:1px solid #FF6868; + color: #FF6868; + } + } + } + + } + .bcg_popup{ + background-color: rgba(0,0,0,0.4); + width: 100%; + height: 100vh; + position: fixed; + top:0; + z-index:30; + } } \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index f8112e2..2c8b65e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -2,7 +2,7 @@ - {{storeName||'正在获取定位'}} + {{storeName||locationName}} @@ -66,10 +66,9 @@ - - + - + + + diff --git a/pages/sidedish/style.scss b/pages/sidedish/style.scss index ecbceb8..d10cb98 100644 --- a/pages/sidedish/style.scss +++ b/pages/sidedish/style.scss @@ -1,5 +1,5 @@ page{ - background-color: #151517; + // background-color: #151517; } .mian{ .banner{ @@ -11,6 +11,7 @@ page{ background-color: #393333; border-top-left-radius: 30rpx; border-top-right-radius: 30rpx; + margin-top: -60rpx; .class_scroll{ white-space: nowrap; height: 90rpx; @@ -113,6 +114,7 @@ page{ position: absolute; top: 0; left: 0; + z-index: 2; } .content_shop_item_tagImg{ width: 50rpx; @@ -127,6 +129,7 @@ page{ line-height: 44rpx; font-size: 20rpx; color: #FFFFFF; + z-index: 2; } .content_shop_item_imgUrl{ width: 200rpx; @@ -135,6 +138,7 @@ page{ position: absolute; top: 0; left: 0; + z-index: 1; } } .content_shop_item_title{ @@ -197,6 +201,13 @@ page{ } } } + .load_desc{ + font-size: 28rpx; + color: #fef6d8; + text-align: center; + padding-top: 30rpx; + padding-bottom: 30rpx; + } } } @keyframes scaleDr{ diff --git a/server/api.js b/server/api.js index 0ff375a..215e5e4 100644 --- a/server/api.js +++ b/server/api.js @@ -1,40 +1,129 @@ import { request } from '@/utils/http' -//首页楼层接口 +//首页滚动商品 export const frontindex = (data) => { - return request({url:`api/front/index`, method: 'GET',data}); -}; -//首页列表数据 + return request({url:`/api/front/index`,method:'GET',data}); +} +//首页/推荐列表数据 export const frontproduct = (type,data) => { - return request({url:`api/front/product/${type}`, method: 'GET',data}); -}; + return request({url:`/api/front/product/${type}`,method:'GET',data}); +} //商品详情接口 export const frontdetail = (type) => { - return request({url:`api/front/product/detail/${type}`, method: 'GET'}); -}; + return request({url:`/api/front/product/detail/${type}`,method:'GET'}); +} //商品详情评论列表 export const replyproduct = (type) => { - return request({url:`api/front/reply/product/${type}`, method: 'GET'}); -}; + return request({url:`/api/front/reply/product/${type}`,method: 'GET'}); +} //商品评论数量 export const replyconfig = (type) => { - return request({url:`api/front/reply/config/${type}`, method: 'GET'}); -}; - + return request({url:`/api/front/reply/config/${type}`,method:'GET'}); +} export const replylist = (data) => { - return request({url:`api/front/reply/list`, method: 'GET',data}); -}; - + return request({url:`/api/front/reply/list`,method:'GET',data}); +} +//商品规格详情 +export const skudetail = (id) => { + return request({url:`/api/front/product/sku/detail/${id}`,method:'GET'}); +} //详情常见问题 export const frontproblem = (type,data) => { - return request({url:`api/front/problem/${type}`, method: 'GET',data}); -}; - + return request({url:`/api/front/problem/${type}`,method:'GET',data}); +} //获取门店 export const frontstorelist = (data) => { - return request({url:`api/front/store/list`, method: 'POST',data}); -}; - - - - + return request({url:`/api/front/store/list`,method:'POST',data}); +} +//获取分类导航 +export const frontcategory = () =>{ + return request({url:`/api/front/category/top`,method:'GET'}) +} +//获取分类商品 +export const frontproducts = (data) =>{ + return request({url:`/api/front/products`,method:'GET',data}) +} +//获取随心配导航 +export const frontType = (data) =>{ + return request({url:`/api/front/home/setMeal/type`,method:'GET',data}) +} +//帮您配商品 +export const frontHome = (data) =>{ + return request({url:`/api/front/home/floor`,method:'GET',data}) +} +//客户中心/帮助中心分类 +export const helpcategory = () =>{ + return request({url:`/api/front/help/category/list`,method:'GET'}) +} +//客户中心/帮助中心列表 +export const helplist = (cid,data) =>{ + return request({url:`/api/front/help/list/${cid}`,method:'GET',data}) +} +//客户中心/帮助中心详情 +export const helpinfo = (data) =>{ + return request({url:`/api/front/help/info`,method:'GET',data}) +} +//客户中心/帮助中心详情点击解决未解决 +export const helppraise = (data) =>{ + return request({url:`/api/front/help/praise`,method:'GET',data}) +} +//加入购物车 +export const cartsave = (data) => { + return request({url:`/api/front/cart/save`,method:'POST',data}); +} +//购物车列表 +export const cartlist = (data) => { + return request({url:`/api/front/cart/list`,method:'GET',data}); +} +//购物车修改数量 +export const cartnum = (id,number) => { + return request({url:`/api/front/cart/num?id=${id}&number=${number}`,method:'POST',contenttype:'x-www-form-urlencoded'}); +} +//购物车删除 +export const cartdelete = (ids) => { + return request({url:`/api/front/cart/delete?ids=${ids}`,method:'POST',contenttype:'x-www-form-urlencoded'}); +} +//购物车选中接口 +export const optForCart = (data)=>{ + return request({url:`/api/front/cart/optForCart`,method:'POST',data}) +} +//预下单 +export const preorder = (data) => { + return request({url:`/api/front/order/pre/order`,method:'POST',data}); +} +//加载预下单 +export const orderloadpre = (preOrderNo) =>{ + return request({url:`/api/front/order/load/pre/${preOrderNo}`,method:'GET'}) +} +//地址列表 +export const addresslist = (data) => { + return request({url:`/api/front/address/list`,method:'GET',data}); +} +//地址保存 +export const addressedit = (data) => { + return request({url:`/api/front/address/edit`,method:'POST',data}); +} +//地址详情{id} +export const addressdetail = (id) =>{ + return request({url:`/api/front/address/detail/${id}`,method:'GET'}) +} +//地址删除 +export const addressdel = (data) => { + return request({url:`/api/front/address/del`,method:'POST',data}); +} +//设置默认地址 +export const defaultset = (data) => { + return request({url:`/api/front/address/default/set`,method:'POST',data}); +} +//获取默认地址 +export const addressdefault = (data) => { + return request({url:`/api/front/address/default`,method:'GET',data}); +} +//省市区 +export const citylist = (data) => { + return request({url:`/api/front/city/list`,method:'GET',data}); +} +//配送时间 +export const deliverytimes = (data) => { + return request({url:`/api/front/delivery/times`,method:'GET',data}); +} \ No newline at end of file diff --git a/server/config.js b/server/config.js index 1e1507b..088a36e 100644 --- a/server/config.js +++ b/server/config.js @@ -9,7 +9,7 @@ const type = 'dev' * prod生产 */ if(type === 'dev'){ - url = "http://vpwy6w.natappfree.cc/"; + url = "http://xx2qui.natappfree.cc"; } if(type === 'test'){ url = "https://japiuat.3721zh.com/webapp"; diff --git a/shopProDetail/detail/detail.vue b/shopProDetail/detail/detail.vue index 941a857..2eec783 100644 --- a/shopProDetail/detail/detail.vue +++ b/shopProDetail/detail/detail.vue @@ -12,7 +12,7 @@ - + @@ -34,8 +34,8 @@ - - {{productInfo.price}}{{productInfo.otPrice}} + + {{productInfo.price}}{{productInfo.otPrice}} {{productInfo.storeName}} {{productInfo.storeInfo}} @@ -142,7 +142,7 @@ const onSwiperChange=(event)=>{ const previewImage=(i)=>{ uni.previewImage({ current: i, - urls:imglist.value + urls:sliderImages.value }); }; // 判断是否有上一页 @@ -229,6 +229,11 @@ const api_detail=(id)=>{ }) }) } +const onSearch=()=>{ + uni.navigateTo({ + url:`/userserve/SearchProduct/SearchProduct` + }) +} onLoad((options) => { const { id } = options; //初始化时判断是否显示返回按钮 diff --git a/static/Empty/Mask group@2x (1).png b/static/Empty/Mask group@2x (1).png new file mode 100644 index 0000000..12fd182 Binary files /dev/null and b/static/Empty/Mask group@2x (1).png differ diff --git a/static/Empty/Mask group@2x (10).png b/static/Empty/Mask group@2x (10).png new file mode 100644 index 0000000..231473c Binary files /dev/null and b/static/Empty/Mask group@2x (10).png differ diff --git a/static/Empty/Mask group@2x (11).png b/static/Empty/Mask group@2x (11).png new file mode 100644 index 0000000..a4aa6cb Binary files /dev/null and b/static/Empty/Mask group@2x (11).png differ diff --git a/static/Empty/Mask group@2x (12).png b/static/Empty/Mask group@2x (12).png new file mode 100644 index 0000000..1cafcd0 Binary files /dev/null and b/static/Empty/Mask group@2x (12).png differ diff --git a/static/Empty/Mask group@2x (13).png b/static/Empty/Mask group@2x (13).png new file mode 100644 index 0000000..3c5de81 Binary files /dev/null and b/static/Empty/Mask group@2x (13).png differ diff --git a/static/Empty/Mask group@2x (14).png b/static/Empty/Mask group@2x (14).png new file mode 100644 index 0000000..2e72191 Binary files /dev/null and b/static/Empty/Mask group@2x (14).png differ diff --git a/static/Empty/Mask group@2x (15).png b/static/Empty/Mask group@2x (15).png new file mode 100644 index 0000000..c3c99bc Binary files /dev/null and b/static/Empty/Mask group@2x (15).png differ diff --git a/static/Empty/Mask group@2x (16).png b/static/Empty/Mask group@2x (16).png new file mode 100644 index 0000000..b771c23 Binary files /dev/null and b/static/Empty/Mask group@2x (16).png differ diff --git a/static/Empty/Mask group@2x (17).png b/static/Empty/Mask group@2x (17).png new file mode 100644 index 0000000..66e263d Binary files /dev/null and b/static/Empty/Mask group@2x (17).png differ diff --git a/static/Empty/Mask group@2x (2).png b/static/Empty/Mask group@2x (2).png new file mode 100644 index 0000000..bd61ac6 Binary files /dev/null and b/static/Empty/Mask group@2x (2).png differ diff --git a/static/Empty/Mask group@2x (3).png b/static/Empty/Mask group@2x (3).png new file mode 100644 index 0000000..a960475 Binary files /dev/null and b/static/Empty/Mask group@2x (3).png differ diff --git a/static/Empty/Mask group@2x (4).png b/static/Empty/Mask group@2x (4).png new file mode 100644 index 0000000..b662a3c Binary files /dev/null and b/static/Empty/Mask group@2x (4).png differ diff --git a/static/Empty/Mask group@2x (5).png b/static/Empty/Mask group@2x (5).png new file mode 100644 index 0000000..851db6a Binary files /dev/null and b/static/Empty/Mask group@2x (5).png differ diff --git a/static/Empty/Mask group@2x (6).png b/static/Empty/Mask group@2x (6).png new file mode 100644 index 0000000..5f47d57 Binary files /dev/null and b/static/Empty/Mask group@2x (6).png differ diff --git a/static/Empty/Mask group@2x (7).png b/static/Empty/Mask group@2x (7).png new file mode 100644 index 0000000..ffcf092 Binary files /dev/null and b/static/Empty/Mask group@2x (7).png differ diff --git a/static/Empty/Mask group@2x (8).png b/static/Empty/Mask group@2x (8).png new file mode 100644 index 0000000..3af4110 Binary files /dev/null and b/static/Empty/Mask group@2x (8).png differ diff --git a/static/Empty/Mask group@2x (9).png b/static/Empty/Mask group@2x (9).png new file mode 100644 index 0000000..004b60d Binary files /dev/null and b/static/Empty/Mask group@2x (9).png differ diff --git a/static/Empty/Mask group@2x.png b/static/Empty/Mask group@2x.png new file mode 100644 index 0000000..19c478b Binary files /dev/null and b/static/Empty/Mask group@2x.png differ diff --git a/static/Empty/cart.png b/static/Empty/cart.png new file mode 100644 index 0000000..a4aa6cb Binary files /dev/null and b/static/Empty/cart.png differ diff --git a/static/close.png b/static/close.png new file mode 100644 index 0000000..0f122de Binary files /dev/null and b/static/close.png differ diff --git a/static/resolved.png b/static/resolved.png new file mode 100644 index 0000000..668986f Binary files /dev/null and b/static/resolved.png differ diff --git a/static/resolved_arr.png b/static/resolved_arr.png new file mode 100644 index 0000000..816f0b1 Binary files /dev/null and b/static/resolved_arr.png differ diff --git a/static/unsolved.png b/static/unsolved.png new file mode 100644 index 0000000..994b223 Binary files /dev/null and b/static/unsolved.png differ diff --git a/static/unsolved_arr.png b/static/unsolved_arr.png new file mode 100644 index 0000000..c2e2345 Binary files /dev/null and b/static/unsolved_arr.png differ diff --git a/store/counter.js b/store/counter.js index 2709910..e03478e 100644 --- a/store/counter.js +++ b/store/counter.js @@ -12,8 +12,13 @@ export const useCounterStore = defineStore('counter',()=>{ const statusBartop = ref(uni.getMenuButtonBoundingClientRect()['top']); const ButtonWidth = ref(uni.getMenuButtonBoundingClientRect().width); const ButtonHeight = ref(uni.getMenuButtonBoundingClientRect().height) - const storeName = ref('') + const storeName = ref(''); + const storeId = ref(''); const token = ref(uni.getStorageSync('token') || ''); + const latitude = ref(''); + const longitude = ref(''); + const locationName = ref('正在获取定位'); + const locationShow = ref(false); // 设置 Token const setToken = (tokens,uids,phones,nikeNames) => { token.value = tokens; @@ -29,6 +34,7 @@ export const useCounterStore = defineStore('counter',()=>{ }; //以对象的形式return供组件调用 return{ + storeId, storeName, nikeName, key, @@ -42,5 +48,9 @@ export const useCounterStore = defineStore('counter',()=>{ statusHeight, headerHeight, statusBartop, + latitude, + longitude, + locationName, + locationShow } }) \ No newline at end of file diff --git a/userserve/addressEdit/addressEdit.vue b/userserve/addressEdit/addressEdit.vue index af6ceae..c5608cc 100644 --- a/userserve/addressEdit/addressEdit.vue +++ b/userserve/addressEdit/addressEdit.vue @@ -2,26 +2,10 @@ - 地址 - - - - - - - - 门牌号 - - - - - - - - 收货人 + 联系人 - + 先生 @@ -33,12 +17,28 @@ 手机号 - + + + + + + 所在的地区 + + + + + + + + 详细地址 + + + - + 设为默认地址 @@ -51,8 +51,37 @@ - 保存地址 + 保存地址 + 删除地址 + + + 请选择地区 + + {{province_v}} + + - + {{city_v}} + + + - + {{district_v}} + + + 选择省份/地区 + + + {{item.name}} + + + {{item.name}} + + + {{item.name}} + + + + @@ -61,16 +90,224 @@ import { computed,ref,onMounted,onUnmounted,getCurrentInstance,nextTick } from ' import { useCounterStore } from '@/store/counter'; // 引入 Pinia Store import { storeToRefs } from 'pinia';//实现解构付值 import { onLoad,onShow,onPullDownRefresh,onPageScroll,onReachBottom,onReady } from "@dcloudio/uni-app" +import { citylist,addressedit,addressdetail,addressdel } from "@/server/api.js" const counterStore = useCounterStore(); // 使用 Store const { proxy } = getCurrentInstance(); //使用pinia:storeToRefs方法包裹(保持响应式更新,不使用视图无法更新) const {statusHeight,headerHeight,statusBartop } = storeToRefs(counterStore); -const save=()=>{ - uni.navigateBack({ - delta:1 +const cityId = ref(''); +const province = ref('') +const city = ref('') +const district = ref('') +const province_v = ref('') +const city_v = ref('') +const district_v = ref('') +const addressShow = ref(false); +const addressPopup = ref(null); +const hover = ref('1'); +const address_id = ref('1') +const cityData = ref([]); +const citylists = ref([]); +const districtlist = ref([]); +const address_text = ref(''); +const isDefault = ref(1); +const detail = ref(''); +const phone = ref(''); +const realName = ref(''); +const id = ref(''); +const isIos = ref(false); +const edit = ref(false); +const address_isDefault = ref(false); +const isDefaultShow = computed(() => { + return address_isDefault.value?true:false; +}); +const System = () =>{ + const phone = wx.getSystemInfoSync(); + if (phone.platform == 'ios') { + isIos.value = true + } else if (phone.platform == 'android') { + isIos.value = false + } +}; +const api_citylist=()=>{ + return citylist().then(({data}) => { + cityData.value = data; + }).catch(({message}) => { + uni.showModal({ + content:message, + showCancel: false + }) }) } -onLoad((options) => {}); +const OpenAddress=()=>{ + addressShow.value ? addressPopup.value.close():addressPopup.value.open() +} +const changeAddress = (e)=>{ + addressShow.value = e.show; +} +const removeCart=()=>{ + const params = { + id:id.value + } + return addressdel(params).then(({message}) => { + uni.showToast({ + title:message, + icon:'success', + success: () => { + setTimeout(()=>{ + uni.navigateBack({ + delta:1 + }) + },1400) + } + }) + }).catch(({message}) => { + uni.showModal({ + content:message, + showCancel: false + }) + }) +} +const addressClick = (type,item) =>{ + cityId.value = item.cityId; + if(type == 1){ + address_id.value = '2' + hover.value = '1'; + province.value = item.name; + province_v.value = item.name; + citylists.value = item.child; + }else if(type == 2){ + address_id.value = '3' + hover.value = '2'; + city.value = item.name; + city_v.value = item.name; + districtlist.value = item.child + }else{ + hover.value = '3'; + district.value = item.name; + district_v.value = item.name; + OpenAddress(); + } + address_text.value = province.value + city.value + district.value; +} +const switchover = (type) =>{ + if(hover.value == type) return false; + if(type == 1){ + address_id.value = '1' + hover.value = '1'; + }else if(type == 2){ + address_id.value = '2' + hover.value = '2'; + }else{ + address_id.value = '3' + hover.value = '3'; + } +} +const api_addressdetail = () =>{ + return addressdetail(id.value).then(({data}) => { + phone.value = data.phone; + realName.value = data.realName; + province.value = data.province; + city.value = data.city; + district.value = data.district; + detail.value = data.detail; + address_text.value = province.value + city.value + district.value; + }).catch(({message}) => { + uni.showModal({ + content:message, + showCancel: false + }) + }) +} +const save=()=>{ + if(!realName.value){ + uni.showToast({ + title:'联系不能为空!', + icon:'none', + }) + return false + } + if(!phone.value){ + uni.showToast({ + title:'手机号不能为空!', + icon:'none', + }) + return false + } + if(!province.value){ + uni.showToast({ + title:'请选择省!', + icon:'none', + }) + return false + } + if(!city.value){ + uni.showToast({ + title:'请选择市!', + icon:'none', + }) + return false + } + if(!district.value){ + uni.showToast({ + title:'请选择区/县', + icon:'none', + }) + return false + } + + if(!detail.value){ + uni.showToast({ + title:'详细地址不能为空', + icon:'none', + }) + return false + } + const params = { + address: { + city:city.value, + district:district.value, + province:province.value + }, + detail:detail.value, + isDefault:isDefault.value == 1?true:false, + phone:phone.value, + realName:realName.value + } + if(id.value){ + params.id = id.value + } + if(cityId.value){ + params.address.cityId = cityId.value + } + return addressedit(params).then(({message}) => { + uni.showToast({ + title:message, + icon:'success', + success: () => { + setTimeout(()=>{ + uni.navigateBack({ + delta:1 + }) + },1400) + } + }) + }).catch(({message}) => { + uni.showToast({ + title:message, + icon:'none', + }) + }) +} +onLoad((options) => { + const { edits,ids,address_isDefaults } = options; + if(ids){id.value = ids;} + if(address_isDefaults){address_isDefault.value = address_isDefaults} + System(); + api_citylist(); + if(edits){edit.value = edits;api_addressdetail();} + +}); onShow(() => {}); onReady(()=>{}) onPullDownRefresh(()=>{}) diff --git a/userserve/addressEdit/style.scss b/userserve/addressEdit/style.scss index 414e927..5c2fde2 100644 --- a/userserve/addressEdit/style.scss +++ b/userserve/addressEdit/style.scss @@ -20,7 +20,7 @@ page{ height: 95rpx; display: flex; align-items: center; - width: 120rpx; + width: 140rpx; } .adderss_r{ width: 480rpx; @@ -34,6 +34,16 @@ page{ display: flex; align-items: center; } + .adderss_textarea{ + width: 440rpx; + font-size: 28rpx; + margin: 15rpx 0 15rpx 0; + padding: 20rpx; + height: 100rpx; + background-color: #f6f6f6; + border-radius: 10rpx; + } + } .adderss_arr::after{ content: ''; @@ -81,6 +91,9 @@ page{ } } } + .adderss_item:last-child { + border-bottom: none; + } .adderss_default{ display: flex; align-items: center; @@ -109,7 +122,7 @@ page{ left: 0; right: 0; bottom: 0; - z-index: 160; + z-index: 88; background: #FFFFFF; font-size: 30rpx; padding-bottom: env(safe-area-inset-bottom); @@ -124,6 +137,7 @@ page{ width: 100%; height: 85rpx; background-color: #fd3f3f; + border:1rpx solid #fd3f3f; border-radius: 50rpx; color: #fff; display: flex; @@ -132,5 +146,93 @@ page{ font-weight: 500; font-size: 28rpx; } + .footer_border{ + width: 100%; + height: 85rpx; + background-color: #f6f6f6; + border:1rpx solid #D9D9D9; + border-radius: 50rpx; + color: #333333; + display: flex; + align-items: center; + justify-content: center; + font-weight: 500; + font-size: 28rpx; + } + .widths{ + width:48%; + } + } +} +.address_pup{ + background-color: #FFFFFF; + border-top-left-radius: 30rpx; + border-top-right-radius: 30rpx; + .address_head{ + text-align: center; + font-size: 30rpx; + color: #333333; + font-weight: 500; + height: 85rpx; + line-height: 85rpx; + position: relative; + .address_open_close{ + position: absolute; + width: 85rpx; + height: 85rpx; + right: 0rpx; + top: 0rpx; + display: flex; + align-items: center; + justify-content: center; + } + .address_open_close image{ + width: 60rpx; + height: 60rpx; + } + } + .address_cont{ + display: flex; + align-items: center; + padding:20rpx 20rpx 40rpx 20rpx; + border-bottom: 1rpx solid #D9D9D9; + .address_name{ + font-size: 28rpx; + color: #333333; + padding: 10rpx 30rpx 10rpx 30rpx; + border:1rpx solid #f7f8fc; + background-color: #f7f8fc; + border-radius: 8rpx; + } + .address_hover{ + font-size: 28rpx; + color: #ff0f23; + padding: 10rpx 30rpx 10rpx 30rpx; + border:1rpx solid #ff0f23; + background-color: #ffebf1; + border-radius: 8rpx; + } + .address_x{ + color: #c2c4cc; + margin-left: 10rpx; + margin-right: 10rpx; + } + } + .address_select{ + font-size: 30rpx; + font-weight: 500; + color: #333333; + padding: 20rpx; + } + .address_list{ + padding: 0 20rpx 0 20rpx; + height: 700rpx; + overflow-y: auto; + .address_list_item{ + font-size: 30rpx; + color: #333333; + height: 80rpx; + line-height: 80rpx; + } } } \ No newline at end of file diff --git a/userserve/addressList/addressList.vue b/userserve/addressList/addressList.vue index e37b8e0..2b75213 100644 --- a/userserve/addressList/addressList.vue +++ b/userserve/addressList/addressList.vue @@ -1,30 +1,22 @@ \ No newline at end of file diff --git a/userserve/editaddress/style.scss b/userserve/editaddress/style.scss deleted file mode 100644 index d9599b7..0000000 --- a/userserve/editaddress/style.scss +++ /dev/null @@ -1,6 +0,0 @@ -page{ - background-color: #f6f6f6; -} -.main{ - -} \ No newline at end of file diff --git a/userserve/location/location.vue b/userserve/location/location.vue index 48caea1..599dcad 100644 --- a/userserve/location/location.vue +++ b/userserve/location/location.vue @@ -1,6 +1,6 @@ @@ -59,16 +53,68 @@ import { computed,ref,onMounted,onUnmounted,getCurrentInstance,nextTick } from ' import { useCounterStore } from '@/store/counter'; // 引入 Pinia Store import { storeToRefs } from 'pinia';//实现解构付值 import { onLoad,onShow,onPullDownRefresh,onPageScroll,onReachBottom,onReady } from "@dcloudio/uni-app" +import { frontstorelist } from '@/server/api'; const counterStore = useCounterStore(); // 使用 Store const { proxy } = getCurrentInstance(); //使用pinia:storeToRefs方法包裹(保持响应式更新,不使用视图无法更新) -const {statusHeight,headerHeight,statusBartop } = storeToRefs(counterStore); +const {statusHeight,headerHeight,statusBartop,storeName,storeId } = storeToRefs(counterStore); +const pages = ref(0); +const limits = ref(10); +const latitude = ref(''); +const longitude = ref(''); +const list = ref([]); +const decs = ref(''); +//获取经纬度 +const getLocation = () => { + //授权成功,获取位置 + uni.getLocation({ + type: 'gcj02', + success(res){ + latitude.value = res.latitude; + longitude.value = res.latitude; + }, + fail(err){ + console.error('获取位置失败:', err); + }, + complete(){ + api_frontstorelist(); + } + }); +}; +//门店 +const api_frontstorelist=()=>{ + pages.value = pages.value + 1; + decs.value = "—— 加载中... ——"; + const params = { + page:pages.value, + limit:limits.value + } + if(latitude.value && longitude.value){ + params.latitude = latitude.value; + params.longitude = longitude.value + } + return frontstorelist(params).then(({data}) => { + decs.value = '—— 上拉加载更多 ——'; + if(data.list.length < 10){ + decs.value = '—— 更多门店敬请期待 ——'; + } + list.value = list.value.concat(data.list); + }) + .catch(({message}) => { + uni.showModal({ + content:message, + showCancel: false + }) + }) +} const addressList=()=>{ uni.navigateTo({ url:`/userserve/addressList/addressList` }) }; -const addressBack=()=>{ +const addressBack=(item)=>{ + storeName.value = item.name; + storeId.value = item.id; uni.navigateBack({ delta:1 }) @@ -81,11 +127,21 @@ const addressEdit=()=>{ url:`/userserve/addressEdit/addressEdit` }) }; -onLoad((options) => {}); +onLoad((options) => { + getLocation(); +}); onShow(() => {}); onReady(()=>{}) -onPullDownRefresh(()=>{}) -onReachBottom(()=>{}) +onPullDownRefresh(()=>{ + list.value = []; + decs.value = ''; + pages.value = 0; + api_frontstorelist(); + uni.stopPullDownRefresh(); +}) +onReachBottom(()=>{ + api_frontstorelist(); +})