Browse Source

核销页面

15591641157 3 months ago
parent
commit
63c89e09d6

+ 2 - 0
packages/merchant/src/core/libs/requests.ts

@@ -59,6 +59,8 @@ export const refreshToken = (refreshToken: string) =>
  */
 export const scanCodeCheckPaper = (data: { orderNo: string }) =>
   httpPost('/app-api/member/vendorApp/scanCodeCheckPaper', data)
+export const productByOrderNo = (query: any) =>
+  httpGet('/app-api/member/points-order/productByOrderNo', query)
 /**
  * 商家端-获取商家信息
  */

+ 1 - 6
packages/merchant/src/pages/home/index.vue

@@ -59,18 +59,13 @@ const toDesigner = () => {
   uni.navigateTo({ url: '/pages/designer/index' })
 }
 const handleScanning = async () => {
-  console.log('handleScanning')
-
   const { result } = await uni.scanCode({ scanType: ['qrCode'] })
   const { type, options } = qrCodeString2Object(result)
   if (type !== QrCodeBusinessType.InStoreWriteOff) {
     uni.showToast({ title: '不支持此二维码/条码', icon: 'none', duration: 5000 })
     return
   }
-  const { data } = await requestToast(() => scanCodeCheckPaper({ orderNo: options.no }))
-  if (data) {
-    uni.navigateTo({ url: '/pages/home/result/success' })
-  }
+  uni.navigateTo({ url: `/pages/home/result/orderConfirm?orderNo=${options.orderNo}` })
 }
 const handle2Settlement = () => {
   if ((orderAmount.value ?? '') === '') {

+ 82 - 0
packages/merchant/src/pages/home/result/orderConfirm.vue

@@ -0,0 +1,82 @@
+<route lang="yaml">
+style:
+navigationBarTitleText: 确认卷码信息
+navigationBarBackgroundColor: '#fff'
+</route>
+
+<script setup lang="ts">
+import { ref } from 'vue';
+import { productByOrderNo , scanCodeCheckPaper } from "@/core/libs/requests";
+import { qrCodeString2Object, requestToast } from '@designer-hub/app/src/core/utils/common'
+const productInfo = ref({
+  productName: '',
+  productCoverImgUrl: '',
+  productPoints: '',
+  num: 0,
+  price: '',
+});
+const orderNo =ref()
+const query = computed(() => ({ orderNo: orderNo.value}))
+// 获取接口数据
+const getProductByOrderNo = async () => {
+    const response = await productByOrderNo({ orderNo: '241229224706IZ00018' });
+    if (response) {
+      productInfo.value = response.data;
+    }
+};
+const submit = async () =>{
+  const { data } = await requestToast(() => scanCodeCheckPaper({ orderNo: orderNo.value}))
+  if (data) {
+    uni.navigateTo({ url: '/pages/home/result/success' })
+  }
+}
+// 页面加载时调用
+onLoad(async (query) => {
+  orderNo.value = query?.orderNo
+  await getProductByOrderNo();
+});
+
+// 返回上一页
+const navigateBack = () => {
+  uni.navigateBack();
+};
+</script>
+
+<template>
+  <view class="bg-white p-[16px] flex-grow flex flex-col">
+    <!-- 商品信息 -->
+    <view class="flex items-center bg-white p-[16px] shadow-sm rounded-md">
+      <wd-img
+        class="w-[80px] h-[80px] rounded-md mr-[16px]"
+        :src="productInfo.productCoverImgUrl"
+        mode="aspectFill"
+      ></wd-img>
+      <view class="flex-1">
+        <view class="text-lg font-bold mb-[8px]">{{ productInfo.productName }}</view>
+        <view class="text-sm text-gray-500 mb-[8px]">数量: x{{ productInfo.num }}</view>
+        <view class="text-sm text-gray-500">
+          {{ productInfo.productPoints }} 积分
+        </view>
+      </view>
+    </view>
+
+    <div class="w-full mt-auto pb-[20px]">
+      <wd-button block :round="false" @click="submit">
+        <div
+          class="text-center text-white text-base font-normal font-['PingFang_SC'] leading-normal"
+        >
+          确认核销
+        </div>
+      </wd-button>
+    </div>
+  </view>
+</template>
+
+<style scoped lang="scss">
+.image {
+  border-radius: 8px;
+}
+.shadow-sm {
+  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
+}
+</style>

+ 1 - 1
packages/merchant/src/pages/home/result/success.vue

@@ -6,7 +6,7 @@ style:
 <script lang="ts" setup>
 const navigateBack = () => {
   uni.navigateBack({
-    delta: 1,
+    delta: 2,
   })
 }
 </script>