支付页面

parent 6d615a40
......@@ -4,7 +4,7 @@
<view class="top">
<!-- 搜索 -->
<Search>
<image class="food" src="../../static/index/skimg.png" mode="widthFix" />
<image class="food" :src="pics" mode="widthFix" />
</Search>
<!-- 类别选择 -->
<scroll-view class="scroll-x" scroll-x="true" @scroll="scroll">
......@@ -94,8 +94,12 @@ const active = ref(null);
const rotate = ref(false);
const rotate2 = ref(false);
const rotate3 = ref(false);
const parentIds = ref(null);
const pics = ref(null);
onLoad((option) => {
const { parentId } = option;
const { parentId, pic } = option;
parentIds.value = parentId;
pics.value = pic;
query(parentId);
});
onMounted(() => {
......
......@@ -9,7 +9,7 @@
<view class="classification">
<view class="classification-top">
<view
@tap="jingang(item.categoryId)"
@tap="jingang(item.categoryId, item.pic)"
class="choice"
v-for="(item, index) in classificationT"
:key="index"
......@@ -20,7 +20,7 @@
</view>
<view class="classification-bottom">
<view
@tap="jingang(item.categoryId)"
@tap="jingang(item.categoryId, item.pic)"
class="choice"
v-for="(item, index) in classificationB"
:key="index"
......@@ -366,7 +366,7 @@ const choice = (index, categoryId) => {
getMerchantList();
};
// 金刚区分类选择
const jingang = (id) => {
const jingang = (id, pic) => {
// switch (index) {
// case 0:
// xma.navigateTo({
......@@ -380,7 +380,7 @@ const jingang = (id) => {
// xma.navigateTo({});
// }
xma.navigateTo({
url: '/pages/index/foodClassification?parentId=' + id,
url: `/pages/index/foodClassification?parentId=${id}&pic=${pic}&page=index`,
});
};
const locationFiltering = () => {
......
......@@ -5,9 +5,18 @@
<!-- 使用状态 -->
<view class="status">
<view class="status-box">
<wd-icon name="check-outline" size="26px" color="#333"
v-if="orderDetail.status == 5 || orderDetail.status == 7"></wd-icon>
<wd-icon name="close-outline" size="26px" color="#333" v-if="orderDetail.status == 6"></wd-icon>
<wd-icon
name="check-outline"
size="26px"
color="#333"
v-if="orderDetail.status == 5 || orderDetail.status == 7"
></wd-icon>
<wd-icon
name="close-outline"
size="26px"
color="#333"
v-if="orderDetail.status == 6"
></wd-icon>
<view class="status-text">{{ statusList[orderDetail.status] }}</view>
</view>
<view class="detail" v-if="orderDetail.status == 3">
......@@ -55,10 +64,13 @@
<text class="title1" v-if="orderDetail.status != 2 || orderDetail.status != 3">
券码信息
</text>
<text :class="orderDetail.status == 5 || orderDetail.status == 6 || orderDetail.status == 7
? 'linethrough'
: 'phone'
">
<text
:class="
orderDetail.status == 5 || orderDetail.status == 6 || orderDetail.status == 7
? 'linethrough'
: 'phone'
"
>
{{ orderDetail.orderNumber.slice(6) }}
</text>
</view>
......@@ -253,7 +265,6 @@ const getDetail = async () => {
}
getProductDetail(orderDetail.value.orderItems[0].prodId);
getShopMailDetail(orderDetail.value.shopId);
};
/**
......
......@@ -162,6 +162,7 @@
<script setup>
import Header from '@/pages/order/components/Header/index.vue';
import { groupBuyConfirm, groupBuyUpdate, groupBuyCreate } from '@/api/confirmOrder';
import { getOrderDetail } from '@/api/order';
const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const selectType = ref('TENPAY');
const prodId = ref(null);
......@@ -170,12 +171,29 @@ const showpopup = ref(false);
const orderInfo = ref({});
const activeCouponInfo = ref({});
const activeCouponId = ref('');
const outTradeNos = ref(null);
// 商品优惠券
const productCoupons = ref([]);
onLoad((options) => {
const { prodId, skuId } = options;
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) {
const { value } = evt.detail;
selectType.value = value;
......@@ -239,11 +257,12 @@ function submitOrder() {
};
groupBuyCreate(params).then((res) => {
if (res.code === 0) {
const { paymentUrl, merchantNo } = res.data.result;
// window.location.href = paymentUrl;
window.open(paymentUrl);
const { paymentUrl, outTradeNo } = res.data.result;
console.log('merchantNo', outTradeNo);
outTradeNos.value = outTradeNo;
window.location.href = paymentUrl;
// window.open(paymentUrl);
// plus.runtime.openURL(paymentUrl);
console.log('merchantNo', merchantNo);
}
});
// xma.redirectTo({
......
......@@ -6,20 +6,19 @@
<!-- 使用状态 -->
<view class="status">
<view class="status-text">购买成功!</view>
<view class="detail">查看订单详情</view>
<view class="detail" @click="jumpPage">查看订单详情</view>
</view>
<!-- 券码信息 -->
<view class="info">
<view class="box">
<text class="title">酸汤鱼双人套餐</text>
<text class="code">0115 8156 9126</text>
<text class="title">{{ orderDetail.orderItems[0].prodName }}</text>
<text class="code">{{ orderDetail.orderNumber }}</text>
</view>
<view class="rectangle-with-semicircles"></view>
<view class="qrcode line">
<!-- 二维码 -->
<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>
</view>
</view>
......@@ -30,6 +29,65 @@
<script setup>
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>
<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