支付

parent 25d4166a
...@@ -94,3 +94,11 @@ export function receiveCoupon(data) { ...@@ -94,3 +94,11 @@ export function receiveCoupon(data) {
data, data,
}); });
} }
// 列表顶部优惠商品
export function prodSpecial(data) {
return request({
url: `/sgyrdd/prod/special`,
method: 'GET',
data,
});
}
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
</Search> </Search>
<!-- 类别选择 --> <!-- 类别选择 -->
<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 5" :key="index"> <view class="foodCard" v-for="(item, index) in topDiscountedProducts" :key="index">
<image class="test5" src="../../static/index/test5.png" mode="widthFix" /> <image class="test5" src="../../static/index/test5.png" mode="widthFix" />
<view class="content"> <view class="content">
<text class="title">【热销】贵阳火神烧烤单人畅吃</text> <text class="title">{{ item.prodName }}</text>
<view class="labelBox"> <view class="labelBox">
<view class="item" v-for="(item, index) in 4" :key="index">30天有效</view> <view class="item" v-for="(item, index) in 4" :key="index">30天有效</view>
</view> </view>
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
<text class="text">¥39.9</text> <text class="text">¥39.9</text>
<text class="text2">¥58</text> <text class="text2">¥58</text>
<view class="btn"> <view class="btn">
<text class="text3">仅剩余5张</text> <!-- <text class="text3">仅剩余5张</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>
...@@ -87,20 +88,22 @@ import Search from '../../components/index/Search.vue'; ...@@ -87,20 +88,22 @@ import Search from '../../components/index/Search.vue';
import Classification from '../../components/index/Classification.vue'; import Classification from '../../components/index/Classification.vue';
import Position from '../../components/index/Position.vue'; import Position from '../../components/index/Position.vue';
import Sort from '../../components/index/Sort.vue'; import Sort from '../../components/index/Sort.vue';
import { getByParentId, merchantList } from '../../api/index'; import { getByParentId, merchantList, prodSpecial } from '../../api/index';
const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']); const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']);
const active = ref(null); const active = ref(null);
const rotate = ref(false); const rotate = ref(false);
const rotate2 = ref(false); const rotate2 = ref(false);
const rotate3 = ref(false); const rotate3 = ref(false);
const parentIds = ref(null); const categoryId = ref(null);
const topDiscountedProducts = ref([]);
const pics = ref(null); const pics = ref(null);
onLoad((option) => { onLoad((option) => {
const { parentId, pic } = option; const { parentId, pic } = option;
parentIds.value = parentId; categoryId.value = parentId;
pics.value = pic; pics.value = pic;
query(parentId); query(parentId);
prodSpecialFn();
}); });
onMounted(() => { onMounted(() => {
getMerchantList(); getMerchantList();
...@@ -111,6 +114,22 @@ const query = (parentId) => { ...@@ -111,6 +114,22 @@ const query = (parentId) => {
console.log('打印res', res); console.log('打印res', res);
}); });
}; };
const prodSpecialFn = () => {
prodSpecial({ categoryId: categoryId.value }).then((res) => {
res.data.data = res.data.data
.map((el) => {
if (el.labels) {
el.labels = el.labels.split(',');
}
return el;
})
.filter((it) => {
return it.it && it !== '';
});
topDiscountedProducts.value = res.data;
});
};
// onLoad(option) { // onLoad(option) {
// //option为object类型,会序列化上个页面传递的参数 // //option为object类型,会序列化上个页面传递的参数
// console.log(option.id); //打印出上个页面传递的参数。 // console.log(option.id); //打印出上个页面传递的参数。
......
...@@ -182,14 +182,21 @@ onShow(() => { ...@@ -182,14 +182,21 @@ onShow(() => {
if (outTradeNos.value) { if (outTradeNos.value) {
// 查询订单状态决定是否支付 // 查询订单状态决定是否支付
getOrderDetail({ orderNumber: outTradeNos.value }).then((res) => { getOrderDetail({ orderNumber: outTradeNos.value }).then((res) => {
if (orderDetail.value.status === '2' || orderDetail.value.status === '3') { switch (orderDetail.value.status) {
xma.redirectTo({ case '1':
url: `/pages/shop/paymentSuccessful?outTradeNos=${outTradeNos.value}`, xma.showToast({
title: '支付失败',
icon: 'success',
duration: 2000,
}); });
} else { break;
case '2' || '3':
xma.redirectTo({ xma.redirectTo({
url: `/pages/shop/paymentSuccessful?outTradeNos=${outTradeNos.value}`, url: `/pages/shop/paymentSuccessful?outTradeNos=${outTradeNos.value}`,
}); });
break;
default:
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