Commit c549cb5f authored by 彭佳妮(贵阳日报)'s avatar 彭佳妮(贵阳日报)
parents 978d6716 25d4166a
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="top"> <view class="top">
<!-- 搜索 --> <!-- 搜索 -->
<Search> <Search>
<image class="food" src="../../static/index/skimg.png" mode="widthFix" /> <image class="food" :src="pics" mode="widthFix" />
</Search> </Search>
<!-- 类别选择 --> <!-- 类别选择 -->
<scroll-view class="scroll-x" scroll-x="true" @scroll="scroll"> <scroll-view class="scroll-x" scroll-x="true" @scroll="scroll">
...@@ -94,8 +94,12 @@ const active = ref(null); ...@@ -94,8 +94,12 @@ 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 pics = ref(null);
onLoad((option) => { onLoad((option) => {
const { parentId } = option; const { parentId, pic } = option;
parentIds.value = parentId;
pics.value = pic;
query(parentId); query(parentId);
}); });
onMounted(() => { onMounted(() => {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<view class="classification"> <view class="classification">
<view class="classification-top"> <view class="classification-top">
<view <view
@tap="jingang(item.categoryId)" @tap="jingang(item.categoryId, item.pic)"
class="choice" class="choice"
v-for="(item, index) in classificationT" v-for="(item, index) in classificationT"
:key="index" :key="index"
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</view> </view>
<view class="classification-bottom"> <view class="classification-bottom">
<view <view
@tap="jingang(item.categoryId)" @tap="jingang(item.categoryId, item.pic)"
class="choice" class="choice"
v-for="(item, index) in classificationB" v-for="(item, index) in classificationB"
:key="index" :key="index"
...@@ -366,7 +366,7 @@ const choice = (index, categoryId) => { ...@@ -366,7 +366,7 @@ const choice = (index, categoryId) => {
getMerchantList(); getMerchantList();
}; };
// 金刚区分类选择 // 金刚区分类选择
const jingang = (id) => { const jingang = (id, pic) => {
// switch (index) { // switch (index) {
// case 0: // case 0:
// xma.navigateTo({ // xma.navigateTo({
...@@ -380,7 +380,7 @@ const jingang = (id) => { ...@@ -380,7 +380,7 @@ const jingang = (id) => {
// xma.navigateTo({}); // xma.navigateTo({});
// } // }
xma.navigateTo({ xma.navigateTo({
url: '/pages/index/foodClassification?parentId=' + id, url: `/pages/index/foodClassification?parentId=${id}&pic=${pic}&page=index`,
}); });
}; };
const locationFiltering = () => { const locationFiltering = () => {
......
...@@ -162,6 +162,7 @@ ...@@ -162,6 +162,7 @@
<script setup> <script setup>
import Header from '@/pages/order/components/Header/index.vue'; import Header from '@/pages/order/components/Header/index.vue';
import { groupBuyConfirm, groupBuyUpdate, groupBuyCreate } from '@/api/confirmOrder'; import { groupBuyConfirm, groupBuyUpdate, groupBuyCreate } from '@/api/confirmOrder';
import { getOrderDetail } from '@/api/order';
const imgUrl = import.meta.env.VITE_APP_IMG_URL; const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const selectType = ref('TENPAY'); const selectType = ref('TENPAY');
const prodId = ref(null); const prodId = ref(null);
...@@ -170,12 +171,29 @@ const showpopup = ref(false); ...@@ -170,12 +171,29 @@ const showpopup = ref(false);
const orderInfo = ref({}); const orderInfo = ref({});
const activeCouponInfo = ref({}); const activeCouponInfo = ref({});
const activeCouponId = ref(''); const activeCouponId = ref('');
const outTradeNos = ref(null);
// 商品优惠券 // 商品优惠券
const productCoupons = ref([]); const productCoupons = ref([]);
onLoad((options) => { onLoad((options) => {
const { prodId, skuId } = options; const { prodId, skuId } = options;
groupBuyConfirmFn(prodId, skuId); groupBuyConfirmFn(prodId, skuId);
}); });
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}`,
});
} else {
xma.redirectTo({
url: `/pages/shop/paymentSuccessful?outTradeNos=${outTradeNos.value}`,
});
}
});
}
});
function radioChange(evt) { function radioChange(evt) {
const { value } = evt.detail; const { value } = evt.detail;
selectType.value = value; selectType.value = value;
...@@ -239,11 +257,12 @@ function submitOrder() { ...@@ -239,11 +257,12 @@ function submitOrder() {
}; };
groupBuyCreate(params).then((res) => { groupBuyCreate(params).then((res) => {
if (res.code === 0) { if (res.code === 0) {
const { paymentUrl, merchantNo } = res.data.result; const { paymentUrl, outTradeNo } = res.data.result;
// window.location.href = paymentUrl; console.log('merchantNo', outTradeNo);
window.open(paymentUrl); outTradeNos.value = outTradeNo;
window.location.href = paymentUrl;
// window.open(paymentUrl);
// plus.runtime.openURL(paymentUrl); // plus.runtime.openURL(paymentUrl);
console.log('merchantNo', merchantNo);
} }
}); });
// xma.redirectTo({ // xma.redirectTo({
......
...@@ -6,20 +6,19 @@ ...@@ -6,20 +6,19 @@
<!-- 使用状态 --> <!-- 使用状态 -->
<view class="status"> <view class="status">
<view class="status-text">购买成功!</view> <view class="status-text">购买成功!</view>
<view class="detail">查看订单详情</view> <view class="detail" @click="jumpPage">查看订单详情</view>
</view> </view>
<!-- 券码信息 --> <!-- 券码信息 -->
<view class="info"> <view class="info">
<view class="box"> <view class="box">
<text class="title">酸汤鱼双人套餐</text> <text class="title">{{ orderDetail.orderItems[0].prodName }}</text>
<text class="code">0115 8156 9126</text> <text class="code">{{ orderDetail.orderNumber }}</text>
</view> </view>
<view class="rectangle-with-semicircles"></view> <view class="rectangle-with-semicircles"></view>
<view class="qrcode line"> <view class="qrcode line">
<!-- 二维码 --> <!-- 二维码 -->
<view class="qr-box"> <view class="qr-box">
<image src="@/static/order/QR-code.png" class="qr"></image> <image :src="qrcode" class="qr"></image>
<text class="qr-text">请向商家出示此核销码</text> <text class="qr-text">请向商家出示此核销码</text>
</view> </view>
</view> </view>
...@@ -30,6 +29,65 @@ ...@@ -30,6 +29,65 @@
<script setup> <script setup>
import Header from '@/pages/order/components/Header/index.vue'; import Header from '@/pages/order/components/Header/index.vue';
import { getOrderDetail, getShopDetail, getProdDetail } from '@/api/order';
import QRCode from 'qrcode';
/**
* 获取订单详情
*/
const orderDetail = ref();
onLoad((options) => {
const { outTradeNos } = options;
getOrderDetailFn('NEONO-2024080509591318964');
});
function getOrderDetailFn(orderNumber) {
getOrderDetail({ orderNumber }).then((res) => {
orderDetail.value = res.data;
const outTradeNo = res.data.orderNumber;
const indexOfDash = outTradeNo.indexOf('-');
if (indexOfDash !== -1) {
res.data.orderNumber = outTradeNo.substring(indexOfDash + 1);
} else {
console.log(`订单编号 ${outTradeNo} 中没有找到 "-" 符号。`);
}
if (orderDetail.value.status === '2' || orderDetail.value.status === '3') {
codeDetail(orderDetail.value.orderNumber);
}
getProductDetail(orderDetail.value.orderItems[0].prodId);
getShopMailDetail(orderDetail.value.shopId);
});
}
const jumpPage = () => {
xma.navigateTo({
url: `/pages/order/detail?orderNumber=${orderDetail.value.orderItems[0].orderNumber}`,
});
};
const qrcode = ref('');
const codeDetail = (item) => {
const data = {
type: 'write-off',
no: item,
};
QRCode.toDataURL(JSON.stringify(data)).then((img) => {
console.log(img);
qrcode.value = img;
});
};
/**
* 获取商品详情
*/
const prodDetail = ref();
const getProductDetail = async (id) => {
const res = await getProdDetail({ prodId: id });
prodDetail.value = res.data.data;
};
/**
* 获取商铺信息
*/
const shopDetail = ref();
const getShopMailDetail = async (id) => {
const res = await getShopDetail({ shopId: id });
shopDetail.value = res.data.shop;
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
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