支付

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