zqf 5 ヶ月 前
コミット
9287b7a52d

+ 24 - 0
src/api/food.js

@@ -53,3 +53,27 @@ export const changeCard = (data) => {
     data,
   });
 };
+
+export const createOrder = (data) => {
+  return request({
+    url: "/wechat/delivery/order/createOrder",
+    method: "POST",
+    data,
+  });
+};
+
+export const getOrderList = (data) => {
+  return request({
+    url: "/wechat/delivery/order/orderList",
+    method: "GET",
+    data,
+  });
+};
+
+export const getOrderDetail = (data) => {
+  return request({
+    url: "/wechat/delivery/order/orderDetail",
+    method: "GET",
+    data,
+  });
+};

+ 9 - 0
src/api/login.js

@@ -0,0 +1,9 @@
+import { request } from "@/utils/request.js";
+
+export const onLoginByWxMini = (data) => {
+  return request({
+    url: "/website/web/doLoginByWxMini",
+    method: "POST",
+    data,
+  });
+};

+ 1 - 1
src/pages.json

@@ -89,7 +89,7 @@
       "path": "pages/labour/index",
       "style": {
         "navigationStyle": "custom",
-        "navigationBarTitleText": "境外旅游"
+        "navigationBarTitleText": "出国劳务"
       }
     },
     {

+ 2 - 2
src/pages/food/restaurant-foods/index.vue

@@ -51,8 +51,8 @@
 
 <script setup>
 import { computed, getCurrentInstance, onMounted } from "vue";
-import { FoodItem } from "./comps/FoodItem.vue";
-import { ShoppingCartBar } from "./comps/ShoppingCartBar.vue";
+import FoodItem from "./comps/FoodItem.vue";
+// import ShoppingCartBar from "./comps/ShoppingCartBar.vue";
 import useSystemInfo from "@/hooks/useSystemInfo";
 import {
   getRestaurantsDetail,

+ 2 - 2
src/pages/food/restaurant/index.vue

@@ -27,8 +27,8 @@
 
 <script setup>
 import { getFoodTypes, getRestaurants } from "@/api/food";
-import { RestaurantItem } from "./comps/RestaurantItem.vue";
-import { Types } from "./comps/Typs.vue";
+import RestaurantItem from "./comps/RestaurantItem.vue";
+import Types from "./comps/Typs.vue";
 import { reactive } from "vue";
 
 const foodTypes = ref([]);

+ 1 - 1
src/pages/food/submit-order-address-list/index.vue

@@ -19,7 +19,7 @@
 </template>
 
 <script setup>
-import { BottomSafeWrapper } from "@/components/bottom-safe-wrapper/index.vue";
+import BottomSafeWrapper from "@/components/bottom-safe-wrapper/index.vue";
 
 function handleToEdit() {
   uni.navigateTo({

+ 32 - 3
src/pages/food/submit-order/index.vue

@@ -70,7 +70,7 @@
       <view class="bottom-wrapper">
         <text class="price">合计: ¥15</text>
         <view style="width: 150px">
-          <up-button text="去结算" color="#fd9a00"></up-button>
+          <up-button text="去结算" @click="settlement" color="#fd9a00"></up-button>
         </view>
       </view>
     </BottomSafeWrapper>
@@ -78,11 +78,36 @@
 </template>
 
 <script setup>
-import { ref } from "vue";
-import { BottomSafeWrapper } from "@/components/bottom-safe-wrapper/index.vue";
+import { reactive, ref } from "vue";
+import { createOrder } from "@/api/food";
+
+import BottomSafeWrapper from "@/components/bottom-safe-wrapper/index.vue";
 
 const remark = ref("");
 
+const param = reactive({
+  deliveryOrderDto:{
+    shopName: "黄焖鸡德州店",
+    deliveryAddress:"",
+    deliveryPhone:"",
+    deliveryRemark:"",
+    tableware:1,
+    orderAmount:100,
+    payAmount:"100",
+    packCharge:10,
+    deliveryFee:5
+  },
+  deliveryOrderItemsDtoList:[{
+    foodName:"羊肉泡馍",
+    price:30,
+    number:2
+  },{
+    foodName:"鸡蛋灌饼",
+    price:5,
+    number:5
+  }]
+})
+
 /**
  * To the address list page
  */
@@ -105,6 +130,10 @@ function handleToRemark() {
     },
   });
 }
+
+async function settlement() {
+ const { data } = await createOrder(param)
+}
 </script>
 
 <style lang="scss">

+ 4 - 4
src/pages/home/comps/Menu.vue

@@ -23,14 +23,14 @@ function handleToFood() {
 }
 
 function handleToTravel() {
-  uni.navigateTo({
-    url: "/pages/food/restaurant/index",
+  uni.switchTab({
+    url: "/pages/travel/index",
   });
 }
 
 function handleToLabour() {
-  uni.navigateTo({
-    url: "/pages/food/restaurant/index",
+  uni.switchTab({
+    url: "/pages/labour/index",
   });
 }
 </script>

+ 2 - 2
src/pages/home/index.vue

@@ -10,8 +10,8 @@
       </swiper-item>
     </swiper>
     <SizedBox height="20" />
-    <!-- <Menu /> -->
-    <!-- <SizedBox height="20" /> -->
+    <Menu />
+    <SizedBox height="20" />
     <HotProjects v-if="hotPojectList.length" :data="hotPojectList" />
     <SizedBox height="20" />
     <HotDestination

+ 20 - 15
src/pages/index/login.vue

@@ -15,22 +15,27 @@
 </template>
 
 <script setup>
-function getPhoneNumber(e) {
+import { onLoginByWxMini } from "@/api/login";
+
+async function getPhoneNumber(e) {
   console.log(e.detail.code);
-  if (e.detail.errMsg === 'getPhoneNumber:ok') {
-    wx.request({
-      url: `${import.meta.env.VITE_API_BASE_URL}/xxx`, // 后端接口地址
-      method: 'POST',
-      data: {
-        code: e.detail.code,
-      },
-      success: function (res) {
-        console.log('手机号:', res.data.phoneNumber);
-      },
-    });
-  } else {
-    console.error('获取手机号失败');
-  }
+  const { data } = await onLoginByWxMini({code: e.detail.code});
+  // 登录成功后跳转首页
+
+  // if (e.detail.errMsg === 'getPhoneNumber:ok') {
+  //   wx.request({
+  //     url: `${import.meta.env.VITE_API_BASE_URL}/xxx`, // 后端接口地址
+  //     method: 'POST',
+  //     data: {
+  //       code: e.detail.code,
+  //     },
+  //     success: function (res) {
+  //       console.log('手机号:', res.data.phoneNumber);
+  //     },
+  //   });
+  // } else {
+  //   console.error('获取手机号失败');
+  // }
 }
 </script>
 

+ 8 - 1
src/pages/profile/order/order-list/index.vue

@@ -30,7 +30,9 @@
 
 <script setup>
 import { reactive } from "vue";
-import { Cell } from "./comps/Cell.vue";
+import Cell from "./comps/Cell.vue";
+import { getOrderList } from "@/api/food";
+
 
 const tabList = reactive([
   {
@@ -43,6 +45,11 @@ const tabList = reactive([
     name: "已完成",
   },
 ]);
+
+onLoad(() => {
+  getOrderList({pageNum: 1, pageSize: 10})
+})
+
 </script>
 
 <style lang="scss">