支付失败的回调

parent 47b6983d
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
<!-- 类别选择 --> <!-- 类别选择 -->
<scroll-view class="scroll-x" scroll-x="true" @scroll="scroll"> <scroll-view class="scroll-x" scroll-x="true" @scroll="scroll">
<view class="foodCard" v-for="(item, index) in topDiscountedProducts" :key="index"> <view class="foodCard" v-for="(item, index) in topDiscountedProducts" :key="index">
<image class="test5" src="../../static/index/test5.png" mode="widthFix" /> <view class="test5">
<image class="img1" :src="imgUrl + item.pic" />
<image class="img2" src="../../static/index/icon-tab.png" />
</view>
<view class="content"> <view class="content">
<text class="title">{{ item.prodName }}</text> <text class="title">{{ item.prodName }}</text>
<view class="labelBox"> <view class="labelBox">
...@@ -26,8 +29,8 @@ ...@@ -26,8 +29,8 @@
<text class="text2">{{ item.oriPrice }}</text> <text class="text2">{{ item.oriPrice }}</text>
<view class="btn"> <view class="btn">
<!-- <text class="text3">仅剩余5张</text> --> <!-- <text class="text3">仅剩余5张</text> -->
<text class="text3"></text> <text class="text3">立即抢购</text>
<image class="qiang" src="../../static/index/qiang.png" mode="widthFix" /> <!-- <image class="qiang" src="../../static/index/qiang.png" mode="widthFix" /> -->
</view> </view>
</view> </view>
</view> </view>
...@@ -95,6 +98,7 @@ import Position from '../../components/index/Position.vue'; ...@@ -95,6 +98,7 @@ import Position from '../../components/index/Position.vue';
import Sort from '../../components/index/Sort.vue'; import Sort from '../../components/index/Sort.vue';
import { getByParentId, merchantList, prodSpecial } from '../../api/index'; import { getByParentId, merchantList, prodSpecial } from '../../api/index';
const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']); const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']);
const active = ref(null); const active = ref(null);
const categoryData = ref([]); const categoryData = ref([]);
...@@ -103,32 +107,38 @@ const rotate2 = ref(false); ...@@ -103,32 +107,38 @@ const rotate2 = ref(false);
const rotate3 = ref(false); const rotate3 = ref(false);
const categoryId = ref(null); const categoryId = ref(null);
const topDiscountedProducts = ref([]); const topDiscountedProducts = ref([]);
const params = ref({
current: 1,
size: 10,
// lon,
// lat,
lon: 106.68650025025502,
lat: 26.567192352601154,
});
const pics = ref(null); const pics = ref(null);
const paramsId = {
parentId: null,
};
onLoad((option) => { onLoad((option) => {
const { parentId, pic } = option; const { parentId, pic } = option;
categoryId.value = parentId; categoryId.value = parentId;
pics.value = pic; pics.value = pic;
query(parentId); query(parentId);
prodSpecialFn(); prodSpecialFn();
getByParentIdData();
}); });
onMounted(() => { onMounted(() => {
getMerchantList(); getLocationFn().then((res) => {
}); const { lat, lon } = res;
// 根据父级分类id查询子分类列表 getMerchantList(lat, lon);
const getByParentIdData = () => {
getByParentId(paramsId).then((res) => {
categoryData.value = res.data;
}); });
}; });
// categoryId参数来源
const foodCategory = (categoryId) => {
console.log('categoryId', categoryId);
params.value.categoryIds = [categoryId];
};
// 根据父级分类id查询子分类列表 // 根据父级分类id查询子分类列表
const query = (parentId) => { const query = (parentId) => {
getByParentId(parentId).then((res) => { getByParentId(parentId).then((res) => {
console.log('打印res', res); categoryData.value = res.data;
}); });
}; };
const prodSpecialFn = () => { const prodSpecialFn = () => {
...@@ -186,11 +196,12 @@ const getMerchantList = () => { ...@@ -186,11 +196,12 @@ const getMerchantList = () => {
const data = { const data = {
current: 1, current: 1,
size: 10, size: 10,
// lon,
// lat,
lon: 106.68650025025502, lon: 106.68650025025502,
lat: 26.567192352601154, lat: 26.567192352601154,
}; };
merchantList(data).then((res) => { merchantList(data).then((res) => {
console.log('商家列表', res);
res.data.content.forEach((item) => { res.data.content.forEach((item) => {
item.shopLogo = import.meta.env.VITE_APP_IMG_URL + item.shopLogo; item.shopLogo = import.meta.env.VITE_APP_IMG_URL + item.shopLogo;
if (item.evaluationVos.length > 0) { if (item.evaluationVos.length > 0) {
...@@ -204,6 +215,21 @@ const getMerchantList = () => { ...@@ -204,6 +215,21 @@ const getMerchantList = () => {
cardData.value = res.data.content; cardData.value = res.data.content;
}); });
}; };
function getLocationFn() {
return new Promise((resolve, reject) => {
xma.getLocation({
type: 'wgs84',
isHighAccuracy: true,
success: function (res) {
// 经纬度
resolve({ lat: res.latitude, lon: res.longitude });
},
fail: function (err) {
return err;
},
});
});
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -244,6 +270,22 @@ page { ...@@ -244,6 +270,22 @@ page {
overflow: hidden; overflow: hidden;
.test5 { .test5 {
width: 100%; width: 100%;
height: 168 * 2rpx;
position: relative;
.img1 {
width: 100%;
height: 168 * 2rpx;
position: absolute;
top: 0;
left: 0;
}
.img2 {
width: 100%;
position: absolute;
left: 0;
bottom: 0;
height: 56rpx;
}
} }
.content { .content {
display: flex; display: flex;
...@@ -307,7 +349,8 @@ page { ...@@ -307,7 +349,8 @@ page {
border-radius: 10rpx; border-radius: 10rpx;
background: #fcdbdb; background: #fcdbdb;
box-sizing: border-box; box-sizing: border-box;
margin-left: 66rpx; margin-left: auto;
margin-right: 20rpx;
.text3 { .text3 {
font-size: 20rpx; font-size: 20rpx;
color: #fa5151; color: #fa5151;
......
...@@ -186,7 +186,7 @@ onShow(() => { ...@@ -186,7 +186,7 @@ onShow(() => {
case '1': case '1':
xma.showToast({ xma.showToast({
title: '支付失败', title: '支付失败',
icon: 'success', icon: 'error',
duration: 2000, duration: 2000,
}); });
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment