From 7a0b33a5f2e0ba589bf35a1b8d896700a21f94a4 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 30 四月 2026 16:00:55 +0800
Subject: [PATCH] 支付宝支付dddadd
---
small-program/pages/index/index.vue | 117 ++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 77 insertions(+), 40 deletions(-)
diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index 1b2f032..3dd218b 100644
--- a/small-program/pages/index/index.vue
+++ b/small-program/pages/index/index.vue
@@ -1,6 +1,6 @@
<template>
<view class="index-page">
- <view class="top-gradient-bg" :style="{ backgroundImage: 'url(' + backgroundImage + ')' }"></view>
+ <image class="top-gradient-bg" src="/static/image/bg_home@2x.png" mode="aspectFill"></image>
<view class="top-hero">
<view :style="{ height: statusbarHeight + 'px' }"></view>
<view class="hero-bar" :style="{ height: navHeight + 'px' }">
@@ -18,7 +18,7 @@
<view class="banner-card hero-banner">
<swiper class="banner-swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="500" :circular="true" :indicator-color="'rgba(255, 255, 255, 0.5)'" :indicator-active-color="'#ffffff'">
- <swiper-item v-for="(item, index) in bannerList" :key="index">
+ <swiper-item v-for="(item, index) in bannerList" :key="index" @click="jumpBannerDetail(item)">
<image class="banner-image" :src="item.imgurlFull" mode="aspectFill"></image>
</swiper-item>
</swiper>
@@ -52,7 +52,7 @@
<view class="recommend-list">
<template v-if="pointList.length > 0">
- <view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goStoragePage(item)">
+ <view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goShopDetails(item)">
<view class="point-thumb">
<image class="point-thumb-image" :src="item.coverImg" mode="widthFix"></image>
</view>
@@ -84,6 +84,7 @@
</view>
<view class="toast-btn" @click="handleLocation">寮�鍚畾浣�</view>
</view>
+ <auth-login :show="showLogin" @close="showLogin = false"></auth-login>
<custom-tabbar></custom-tabbar>
</view>
</template>
@@ -98,19 +99,19 @@
CustomTabbar
},
computed: {
- ...mapState(['navHeight', 'statusbarHeight', 'address', 'latitude', 'cityId', 'longitude']),
+ ...mapState(['navHeight', 'statusbarHeight', 'address', 'latitude', 'cityId', 'longitude', 'token']),
currentAddress() {
return this.address && this.address !== '瀹氫綅涓�' ? this.address : '鑾峰彇瀹氫綅'
}
},
data() {
return {
- backgroundImage: require('@/static/image/bg_home@2x.png'),
bannerList: [],
pointList: [],
- page: 1,
- ingOrder:null,
- isRequest: true
+ ingOrder: null,
+ showLogin: false,
+ pendingNavigate: null,
+ lastLocationAuth: null
}
},
async onLoad() {
@@ -123,32 +124,76 @@
onShow() {
this.ingOrder =null
this.getIngorder()
+ this.checkLocationAuth()
},
- onReachBottom() {
- if (this.cityId && this.latitude && this.longitude) {
- this.getNearbyShopList()
+ watch: {
+ token(newToken) {
+ if (newToken && this.pendingNavigate) {
+ const fn = this.pendingNavigate
+ this.pendingNavigate = null
+ this.showLogin = false
+ fn()
+ }
}
},
methods: {
- jumpOrderDetail(id){
- uni.navigateTo({
- url:'/pages/delivery-order-detail/delivery-order-detail?userType=0&id='+id
+ async checkLocationAuth() {
+ const _this = this
+ uni.getSetting({
+ success(res) {
+ const authLocation = res.authSetting['scope.userLocation']
+ if (_this.lastLocationAuth !== null && _this.lastLocationAuth !== authLocation) {
+ if (authLocation) {
+ _this.positioning()
+ }
+ }
+ _this.lastLocationAuth = authLocation
+ }
})
},
- async getIngorder(){
+ async getIngorder() {
var that =this
let res = await that.$u.api.getActiveOrderTip()
if (res && res.code === 200) {
this.ingOrder = res.data
}
},
+ jumpBannerDetail(item) {
+ if(!item.content || item.content =='' || item.type==0){
+ return
+ }
+ if (item.type == 1) {
+ uni.navigateTo({
+ url: '/shop/pages/article-details/article-details?id=' + item.id
+ })
+ } else if(item.type == 2) {
+ uni.navigateTo({
+ url: '/shop/pages/webview/webview?url=' + item.content
+ })
+ }
+ },
+ jumpOrderDetail(id){
+ uni.navigateTo({
+ url:'/pages/delivery-order-detail/delivery-order-detail?userType=0&id='+id
+ })
+ },
jumpOrderList(status){
+ if (!this.token) {
+ this.pendingNavigate = () => this.jumpOrderList(status)
+ this.showLogin = true
+ return
+ }
uni.setStorageSync("orderStatus",status)
uni.switchTab({
url: '/pages/itinerary/itinerary'
})
},
jumpxiadan() {
+ if (!this.token) {
+ this.pendingNavigate = () => this.jumpxiadan()
+ this.showLogin = true
+ return
+ }
if (!this.cityId) return uni.showToast({
title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
icon: 'none'
@@ -164,10 +209,9 @@
}
},
async getNearbyShopList() {
- if (!this.isRequest) return;
const res = await this.$u.api.getNearbyShopList({
- capacity: 10,
- page: this.page,
+ capacity: 5,
+ page: 1,
model: {
latitude: this.latitude,
longitude: this.longitude,
@@ -177,10 +221,6 @@
})
if (res.code === 200) {
this.pointList = res.data.records || []
- this.page++
- if (res.data.total <= this.pointList.length) {
- this.isRequest = false
- }
}
},
jumpJC() {
@@ -207,45 +247,36 @@
uni.chooseLocation({
type: 'gcj02',
success: async function(addr) {
+ console.log(addr, '==================uniapp閫夋嫨浣嶇疆鎴愬姛');
if (addr.errMsg === 'chooseLocation:ok' && addr.latitude) {
const locParam = { latitude: addr.latitude, longitude: addr.longitude };
- // uni.setStorageSync('address', locParam);
-
- var myAmapFun = new amapFile.AMapWX({ key: 'e4d46c87adf151dca20060317592b1b6' });
+ var myAmapFun = new amapFile.AMapWX({ key: that.$gaodeMapKey });
myAmapFun.getRegeo({
location: addr.longitude + ',' + addr.latitude,
success: async function(data) {
console.log(data, '==================閫夋嫨鍦板潃閫嗚В鏋�');
let info = data[0];
locParam.province = info.province;
- locParam.city = (info.regeocodeData.addressComponent.city && typeof info.regeocodeData.addressComponent.city === 'string')
- ? info.regeocodeData.addressComponent.city
- : info.regeocodeData.addressComponent.province;
- var ta = info.name || '鍦板潃鑾峰彇澶辫触';
+ locParam.adcode = info.regeocodeData.addressComponent.adcode
+ var ta = addr.name || '鍦板潃鑾峰彇澶辫触';
locParam.address = ta
- const resCity = await that.$u.api.getCityByName({ cityName: locParam.city })
+ const resCity = await that.$u.api.getCityByName({ code: locParam.adcode })
if (resCity.code === 200 && resCity.data) {
locParam.cityId = resCity.data.id
that.$store.commit('setPosition', locParam)
- that.page = 1
that.pointList = []
- that.isRequest = true
that.getNearbyShopList()
} else {
that.$store.commit('setPosition', locParam)
that.$store.commit('clearCityId')
- that.page = 1
that.pointList = []
- that.isRequest = true
}
},
fail: function(err) {
console.error('鑾峰彇浣嶇疆澶辫触===========', err);
that.$store.commit('setPosition', locParam)
- that.page = 1
that.pointList = []
- that.isRequest = true
- // that.getNearbyShopList()
+ that.getNearbyShopList()
}
});
}
@@ -264,23 +295,24 @@
isHighAccuracy: true,
success: function (addr) {
const locParam = { latitude: addr.latitude, longitude: addr.longitude };
- var myAmapFun = new amapFile.AMapWX({ key: 'f2e6c0bfcac14c27b4f0d6d0d5b9d7d' });
+ var myAmapFun = new amapFile.AMapWX({ key: that.$gaodeMapKey });
myAmapFun.getRegeo({
location: addr.longitude + ',' + addr.latitude,
success: async function(data) {
console.log(data, '==================鑾峰彇鍦板潃');
let info = data[0];
locParam.province = info.province;
- locParam.city = info.city;
+ locParam.adcode = info.regeocodeData.addressComponent.adcode;
locParam.area = info.district;
locParam.street = info.street;
var ta = info.name || '鍦板潃鑾峰彇澶辫触';
locParam.address = ta
- const resCity = await that.$u.api.getCityByName({ cityName: locParam.city })
+ const resCity = await that.$u.api.getCityByName({ code: locParam.adcode })
if (resCity.code === 200) {
locParam.cityId = resCity.data.id
}
that.$store.commit('setPosition', locParam)
+ that.getNearbyShopList()
that.$isResolve()
},
fail: (err) => {
@@ -290,6 +322,11 @@
}
});
},
+ goShopDetails(item){
+ uni.navigateTo({
+ url: '/pages/storage-point-detail/storage-point-detail?id='+item.id
+ })
+ },
goStoragePage() {
if (!this.cityId) return uni.showToast({
title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
--
Gitblit v1.9.3