兑换积分商品的全部列表页面实施。地址页面优化与对里面的bug调整。

This commit is contained in:
77 2024-10-31 16:14:58 +08:00
parent 2dd82f6240
commit de5eb74256
7 changed files with 383 additions and 355 deletions

View File

@ -196,9 +196,14 @@
"plugins": {}, "plugins": {},
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading": "requiredComponents",
"usingComponents": {}, "usingComponents": {},
"permission": {}, "permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于选择定位"
}
},
"requiredPrivateInfos": [ "requiredPrivateInfos": [
"chooseAddress" "chooseAddress",
"getLocation"
] ]
}, },
"mp-alipay": { "mp-alipay": {

View File

@ -1,100 +1,48 @@
<!-- 自定义页面支持装修 -->
<template> <template>
<s-layout title="兑换商品列表" :bgStyle="{ color: '#fff' }"> <s-layout title="商品列表" :bgStyle="{ color: '#fff' }">
<view style="margin-top:10px;">
<s-block v-for="(item, index) in state.components" :key="index">
<!-- <s-block-item :type="item.id" :data="item.property" :styles="item.property.style" /> -->
<!-- 营销组件积分商城 --> <!-- 营销组件积分商城 -->
<view class="goods-lg-box"> <s-point-block v-if="item.id === 'PromotionPoint'" :data="item.property" :styles="item.property.style" />
<view class="goods-box" v-for="item in pointList" </s-block>
:key="item.id">
<s-goods-column class="goods-card" size="lg" :data="item"
@tap="sheep.$router.go('/pages/goods/point', { id: item.activityId })">
<!-- 购买按钮 -->
<template v-slot:cart>
<button class="ss-reset-button cart-btn" :style="[buyStyle]">
去兑换
</button>
</template>
</s-goods-column>
</view>
</view> </view>
</s-layout> </s-layout>
</template> </template>
<script setup> <script setup>
import { import { reactive } from 'vue';
computed, import { onLoad, onPageScroll } from '@dcloudio/uni-app';
ref import DiyApi from '@/sheep/api/promotion/diy';
} from 'vue';
import sheep from '@/sheep';
import request from '@/sheep/request';
import {
baseUrl,
apiPath
} from '@/sheep/config';
const pointList = ref([]);
function getList() {
request({
// url: `${baseUrl}${apiPath}/h5/reservation/list`,
url: `${baseUrl}${apiPath}/promotion/point-activity/pointActivityList`,
method: 'GET',
// params: {
// userId: this.memberId,
// },
custom: {
showLoading: false,
},
}).then((res) => {
pointList.value = res.data;
console.log('this.reservationList', this.reservationList)
});
}
getList(); const state = reactive({
name: '',
components: [],
navigationBar: {},
page: {},
});
onLoad(async (options) => {
let id = options.id
// #ifdef MP
//
if (options.scene) {
const sceneParams = decodeURIComponent(options.scene).split('=');
id = sceneParams[1];
}
// #endif
const { code, data } = await DiyApi.getDiyPage(id);
if (code === 0) {
state.name = data.name;
state.components = data.property?.components;
state.navigationBar = data.property?.navigationBar;
state.page = data.property?.page;
}
});
onPageScroll(() => {});
</script> </script>
<style></style>
<style lang="scss" scoped>
.goods-md-wrap {
width: 100%;
}
.goods-list-box {
width: 50%;
box-sizing: border-box;
.left-list {
&:nth-last-child(1) {
margin-bottom: 0 !important;
}
}
.right-list {
&:nth-last-child(1) {
margin-bottom: 0 !important;
}
}
}
.goods-box {
&:nth-last-of-type(1) {
margin-bottom: 0 !important;
}
}
.goods-md-box,
.goods-sl-box,
.goods-lg-box {
position: relative;
.cart-btn {
position: absolute;
bottom: 18rpx;
right: 20rpx;
z-index: 11;
height: 50rpx;
line-height: 50rpx;
padding: 0 20rpx;
border-radius: 25rpx;
font-size: 24rpx;
color: #fff;
}
}
</style>

View File

@ -10,35 +10,50 @@
<view class="store-address line1"> <view class="store-address line1">
{{ item.areaName }}{{ ', ' + item.detailAddress }} {{ item.areaName }}{{ ', ' + item.detailAddress }}
</view> </view>
<view class="store-address line1">
营业时间{{item.openingTime[0] + ":" + item.openingTime[1]}}-{{item.closingTime[0] + ":" + item.closingTime[1]}}
</view>
<view class="status" v-if="item.stat == 0">未营业</view>
<view class="status" v-if="item.stat == 1">营业中</view>
</view> </view>
<view class="row-right ss-flex-col ss-col-center"> <view class="row-right ss-flex-col ss-col-center">
<view> <view>
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<a class="store-phone" :href="'tel:' + item.phone"> <!-- <a class="store-phone" :href="'tel:' + item.phone">
<view class="iconfont"> <view class="iconfont">
<view class="ss-rest-button"> <view class="ss-rest-button">
<text class="_icon-forward" /> <text class="_icon-forward" />
</view> </view>
</view> </view>
</a> </a> -->
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP --> <!-- #ifdef MP -->
<view class="store-phone" @click="call(item.phone)"> <!-- <view class="store-phone" @click="call(item.phone)">
<view class="iconfont"> <view class="iconfont">
<view class="ss-rest-button"> <view class="ss-rest-button">
<text class="_icon-forward" /> <text class="_icon-forward" />
</view> </view>
</view> </view>
</view> </view> -->
<!-- #endif --> <!-- #endif -->
</view> </view>
<view class="store-distance ss-flex ss-row-center" @tap.stop="showMaoLocation(item)"> <view class="store-distance ss-flex ss-row-center">
<text class="addressTxt" v-if="item.distance">距离{{ item.distance.toFixed(2) }}千米</text> <view class="addressTxt" v-if="item.distance==0 || item.distance">
<text class="addressTxt" v-else>查看地图</text> 距离{{ item.distance.toFixed(2) }}km</view>
<view class="iconfont"> <!-- <text class="addressTxt" v-else>查看地图</text> -->
<!-- <view class="iconfont">
<view class="ss-rest-button"> <view class="ss-rest-button">
<text class="_icon-forward" /> <text class="_icon-forward" />
</view> </view>
</view> -->
<view class="tb">
<image @tap.stop="showMaoLocation(item)" style="margin-right:10px;"
src="https://zysc.fjptzykj.com:3000/shangcheng/c7362f85726ef0030b407f1c3749c710ca0caa51fee5cc8ffbb64e11226354a8.png"
class="img"></image>
<image @click="call(item.phone)"
src="https://zysc.fjptzykj.com:3000/shangcheng/535ee6f79e04d4b6e46fcfa59ed052f214ad6ab756c340c0c040e68357f68e9a.png"
class="img"></image>
</view> </view>
</view> </view>
</view> </view>
@ -49,8 +64,13 @@
<script setup> <script setup>
import DeliveryApi from '@/sheep/api/trade/delivery'; import DeliveryApi from '@/sheep/api/trade/delivery';
import { onMounted, reactive } from 'vue'; import {
import { onLoad } from '@dcloudio/uni-app'; onMounted,
reactive
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app';
import sheep from '@/sheep'; import sheep from '@/sheep';
const LONGITUDE = 'user_longitude'; const LONGITUDE = 'user_longitude';
@ -73,9 +93,8 @@
const selfLocation = () => { const selfLocation = () => {
// #ifdef H5 // #ifdef H5
const jsWxSdk = sheep.$platform.useProvider('wechat').jsWxSdk; const jsWxSdk = sheep.$platform.useProvider('wechat').jsWxSdk;
if (jsWxSdk.isWechat()) { if (!!jsWxSdk?.isWechat()) {
jsWxSdk.getLocation((res) => { jsWxSdk.getLocation((res) => {
console.log(res);
state.user_latitude = res.latitude; state.user_latitude = res.latitude;
state.user_longitude = res.longitude; state.user_longitude = res.longitude;
uni.setStorageSync(LATITUDE, res.latitude); uni.setStorageSync(LATITUDE, res.latitude);
@ -87,19 +106,24 @@
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
success: (res) => { success: (res) => {
console.log(res.latitude, "--------经纬度-----");
try { try {
state.user_latitude = res.latitude; state.user_latitude = res.latitude;
state.user_longitude = res.longitude; state.user_longitude = res.longitude;
uni.setStorageSync(LATITUDE, res.latitude); uni.setStorageSync(LATITUDE, res.latitude);
uni.setStorageSync(LONGITUDE, res.longitude); uni.setStorageSync(LONGITUDE, res.longitude);
} catch { } catch {}
}
getList(); getList();
}, },
complete: () => { complete: () => {
getList(); getList();
}, },
fail(error) {
console.log(error, "错误")
}
}); });
console.log("有执行")
// #ifdef H5 // #ifdef H5
} }
// #endif // #endif
@ -148,10 +172,15 @@
return; return;
} }
state.loading = true; state.loading = true;
const { data, code } = await DeliveryApi.getDeliveryPickUpStoreList({ console.log(state.user_latitude, state.user_longitude, "------user_longitude-------")
const data2 = {
latitude: state.user_latitude, latitude: state.user_latitude,
longitude: state.user_longitude, longitude: state.user_longitude,
}); };
const {
data,
code
} = await DeliveryApi.getDeliveryPickUpStoreList(data2);
if (code !== 0) { if (code !== 0) {
return; return;
} }
@ -171,12 +200,22 @@
try { try {
state.user_latitude = uni.getStorageSync(LATITUDE); state.user_latitude = uni.getStorageSync(LATITUDE);
state.user_longitude = uni.getStorageSync(LONGITUDE); state.user_longitude = uni.getStorageSync(LONGITUDE);
console.log(state.user_latitude, state.user_longitude, "user_longitude");
} catch (e) { } catch (e) {
// error // error
} }
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.status {
background: rgba(214, 81, 42);
width: 56px;
text-align: center;
color: white;
border-radius: 3px;
margin-top: 10px;
}
.line1 { .line1 {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -193,18 +232,19 @@
.storeBox { .storeBox {
width: 100%; width: 100%;
background-color: #fff;
padding: 0 30rpx;
} }
.storeBox-box { .storeBox-box {
width: 100%; background-color: #fff;
// width: 100%;
height: auto; height: auto;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 23rpx 0; padding: 23rpx;
justify-content: space-between; justify-content: space-around;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
margin: 10px 10px;
boeder-radius: 10px;
} }
.store-cent { .store-cent {
@ -214,8 +254,22 @@
} }
.store-cent-left { .store-cent-left {
width: 177px; // width: 177px;
// flex: 2; flex: 1;
max-width: 185px;
position: relative;
padding-right: 10px;
&::after {
position: absolute;
content: '';
width: 2px;
height: 100%;
background: rgba(223, 223, 223);
right: 0;
top: 0;
}
} }
.store-img { .store-img {
@ -259,6 +313,24 @@
.store-distance { .store-distance {
font-size: 22rpx; font-size: 22rpx;
color: #e83323; color: #e83323;
flex-wrap: wrap;
.addressTxt {
width: 100%;
text-align: center;
margin-bottom: 10px;
}
.tb {
display: flex;
align-items: center;
justify-content: space-around;
.img {
width: 30px;
height: 30px;
}
}
} }
.iconfont { .iconfont {
@ -266,7 +338,8 @@
} }
.row-right { .row-right {
flex: 2; flex: 1;
margin-left:10px;
//display: flex; //display: flex;
//flex-direction: column; //flex-direction: column;
//align-items: flex-end; //align-items: flex-end;

View File

@ -271,7 +271,7 @@
.swiper { .swiper {
position: relative; position: relative;
top: -353px; top: -288px;
.new-img { .new-img {
width: 90%; width: 90%;
@ -300,7 +300,7 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
width: 100%; width: 100%;
height: 415px; height: 348px;
background-color: #3b5086; background-color: #3b5086;
.picTxt { .picTxt {
@ -351,8 +351,8 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
width: 690rpx; width: 690rpx;
height: 360rpx; height: 144px;
margin: -315px auto 0 auto; margin: -275px auto 0 auto;
border-radius: 23rpx; border-radius: 23rpx;
padding: 22rpx 27rpx; padding: 22rpx 27rpx;
box-sizing: border-box; box-sizing: border-box;
@ -535,7 +535,7 @@
.public_title { .public_title {
color: #282828; color: #282828;
font-size: 30rpx; font-size: 30rpx;
align-items: center;
.icons { .icons {
width: 6rpx; width: 6rpx;
height: 28rpx; height: 28rpx;

View File

@ -9,9 +9,10 @@ const DeliveryApi = {
}); });
}, },
// 获得自提门店列表 // 获得自提门店列表
getDeliveryPickUpStoreList: () => { getDeliveryPickUpStoreList: (data) => {
return request({ return request({
url: `/trade/delivery/pick-up-store/list`, url: `/trade/delivery/pick-up-store/list`,
params:data,
method: 'get', method: 'get',
}); });
}, },

View File

@ -369,7 +369,7 @@
import { import {
PromotionActivityTypeEnum PromotionActivityTypeEnum
} from '@/sheep/util/const'; } from '@/sheep/util/const';
console.log(PromotionActivityTypeEnum,"PromotionActivityTypeEnum")
// //
const props = defineProps({ const props = defineProps({
goodsFields: { goodsFields: {

View File

@ -130,6 +130,7 @@
btnBuy, btnBuy,
activityIds activityIds
} = props.data || {}; } = props.data || {};
const { const {
marginLeft, marginLeft,
marginRight marginRight
@ -217,7 +218,7 @@
for (const activity of activityList) { for (const activity of activityList) {
state.spuList.push(await getSpuDetail(activity.spuId)); state.spuList.push(await getSpuDetail(activity.spuId));
} }
console.log(state.spuList,"state.spuList");
// //
activityList.forEach((activity) => { activityList.forEach((activity) => {
// spu // spu