diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c1322dc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false \ No newline at end of file diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 0000000..02b915b --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/src/api/user.ts b/src/api/user.ts new file mode 100644 index 0000000..91e5e7f --- /dev/null +++ b/src/api/user.ts @@ -0,0 +1,10 @@ +import { request } from "../utils/request"; + +// 登录 +export const login = (data: object) => request("/login", data, "POST"); + +// 获取用户信息 +export const getUserInfo = () => request("/user/detail", {}, "GET"); + +// 支付订单 +export const payOrder = (data: object) => request("/order/place", data, "POST"); diff --git a/src/app.ts b/src/app.ts index 126d791..1cf7ac7 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,5 +1,4 @@ import { createApp } from "vue"; -import { createPinia } from 'pinia' import "./app.scss"; @@ -9,6 +8,4 @@ const App = createApp({ // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 }); -App.use(createPinia()) - export default App; diff --git a/src/components/Auth.vue b/src/components/Auth.vue new file mode 100644 index 0000000..7fd7604 --- /dev/null +++ b/src/components/Auth.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/src/components/Pay.vue b/src/components/Pay.vue new file mode 100644 index 0000000..e22f0a8 --- /dev/null +++ b/src/components/Pay.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/src/pages/admin/verify/index.config.ts b/src/pages/admin/verify/index.config.ts new file mode 100644 index 0000000..2ff46c7 --- /dev/null +++ b/src/pages/admin/verify/index.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: "订单核销", +}); diff --git a/src/pages/admin/verify/index.vue b/src/pages/admin/verify/index.vue new file mode 100644 index 0000000..c9e1fc7 --- /dev/null +++ b/src/pages/admin/verify/index.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/src/pages/goods/goods_detail/index.config.ts b/src/pages/goods/goods_detail/index.config.ts new file mode 100644 index 0000000..95ee953 --- /dev/null +++ b/src/pages/goods/goods_detail/index.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '商品详情', + navigationStyle: 'custom', + }) \ No newline at end of file diff --git a/src/pages/goods/goods_detail/index.vue b/src/pages/goods/goods_detail/index.vue new file mode 100644 index 0000000..666bc29 --- /dev/null +++ b/src/pages/goods/goods_detail/index.vue @@ -0,0 +1,293 @@ + + + + + diff --git a/src/pages/goods/order_create/index.config.ts b/src/pages/goods/order_create/index.config.ts new file mode 100644 index 0000000..aa32ff5 --- /dev/null +++ b/src/pages/goods/order_create/index.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: "提交订单" +}); diff --git a/src/pages/goods/order_create/index.vue b/src/pages/goods/order_create/index.vue new file mode 100644 index 0000000..d2eac41 --- /dev/null +++ b/src/pages/goods/order_create/index.vue @@ -0,0 +1,183 @@ + + + + + diff --git a/src/pages/goods/order_status/index.config.ts b/src/pages/goods/order_status/index.config.ts new file mode 100644 index 0000000..e098552 --- /dev/null +++ b/src/pages/goods/order_status/index.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: "订单状态", +}); diff --git a/src/pages/goods/order_status/index.vue b/src/pages/goods/order_status/index.vue new file mode 100644 index 0000000..a852c2a --- /dev/null +++ b/src/pages/goods/order_status/index.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/src/pages/users/order_list_detail/index.config.ts b/src/pages/users/order_list_detail/index.config.ts new file mode 100644 index 0000000..a27df08 --- /dev/null +++ b/src/pages/users/order_list_detail/index.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '订单详情' +}) \ No newline at end of file diff --git a/src/pages/users/order_list_detail/index.vue b/src/pages/users/order_list_detail/index.vue new file mode 100644 index 0000000..9462f26 --- /dev/null +++ b/src/pages/users/order_list_detail/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/pages/users/static/user/order_list_top.png b/src/pages/users/static/user/order_list_top.png new file mode 100644 index 0000000..67bfbd7 Binary files /dev/null and b/src/pages/users/static/user/order_list_top.png differ diff --git a/src/static/admin/cancellation-header.png b/src/static/admin/cancellation-header.png new file mode 100644 index 0000000..92c6b0b Binary files /dev/null and b/src/static/admin/cancellation-header.png differ diff --git a/src/static/index/index-title.png b/src/static/index/index-title.png new file mode 100644 index 0000000..6f6d4b7 Binary files /dev/null and b/src/static/index/index-title.png differ diff --git a/src/static/merchantBg.jpg b/src/static/merchantBg.jpg new file mode 100644 index 0000000..b9fe2a0 Binary files /dev/null and b/src/static/merchantBg.jpg differ diff --git a/src/static/tabbar/1-001.png b/src/static/tabbar/1-001.png new file mode 100644 index 0000000..3c9ac39 Binary files /dev/null and b/src/static/tabbar/1-001.png differ diff --git a/src/static/tabbar/1-002.png b/src/static/tabbar/1-002.png new file mode 100644 index 0000000..f05682b Binary files /dev/null and b/src/static/tabbar/1-002.png differ diff --git a/src/static/tabbar/2-001.png b/src/static/tabbar/2-001.png new file mode 100644 index 0000000..4a4ce02 Binary files /dev/null and b/src/static/tabbar/2-001.png differ diff --git a/src/static/tabbar/2-002.png b/src/static/tabbar/2-002.png new file mode 100644 index 0000000..5069750 Binary files /dev/null and b/src/static/tabbar/2-002.png differ diff --git a/src/static/tabbar/3-001.png b/src/static/tabbar/3-001.png new file mode 100644 index 0000000..8637fed Binary files /dev/null and b/src/static/tabbar/3-001.png differ diff --git a/src/static/tabbar/3-002.png b/src/static/tabbar/3-002.png new file mode 100644 index 0000000..5aa6e9c Binary files /dev/null and b/src/static/tabbar/3-002.png differ diff --git a/src/static/tabbar/4-001.png b/src/static/tabbar/4-001.png new file mode 100644 index 0000000..5fb279c Binary files /dev/null and b/src/static/tabbar/4-001.png differ diff --git a/src/static/tabbar/4-002.png b/src/static/tabbar/4-002.png new file mode 100644 index 0000000..e79368c Binary files /dev/null and b/src/static/tabbar/4-002.png differ diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..d14e1d8 --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,29 @@ +// 经纬度计算距离 +export function calculateDistance( + lat1: number, + lon1: number, + lat2: number, + lon2: number +): string { + const R = 6371; // 地球平均半径(单位:千米) + + const dLat = toRadians(lat2 - lat1); + const dLon = toRadians(lon2 - lon1); + + const a = + Math.sin(dLat / 2) * Math.sin(dLat / 2) + + Math.cos(toRadians(lat1)) * + Math.cos(toRadians(lat2)) * + Math.sin(dLon / 2) * + Math.sin(dLon / 2); + + const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); + + const distance = R * c; + return distance.toFixed(2); +} + +// 将角度转换为弧度 +function toRadians(degrees: number): number { + return (degrees * Math.PI) / 180; +} diff --git a/src/utils/request.ts b/src/utils/request.ts new file mode 100644 index 0000000..20386fe --- /dev/null +++ b/src/utils/request.ts @@ -0,0 +1,46 @@ +import Taro from "@tarojs/taro"; + +const BASE_URL = () => { + if (process.env.NODE_ENV === "development") { + return "http://192.168.2.3:9000"; + } else { + return "https://api.imooc.hybrid.lgdsunday.club"; + } +}; + +// interface Res { +// +// } + +type Method = "GET" | "POST" | "PUT" | "DELETE"; + +export const request = ( + url: string, + data: object = {}, + method: Method = "GET" +): Promise => { + return new Promise((resolve, reject) => { + Taro.request({ + url: BASE_URL() + "/app" + url, + data: data, + method: method, + header: { + "content-type": "application/json", + token: Taro.getStorageSync("token"), + }, + success: ({data}) => { + console.log(data); + if (data.code !== 200) + return reject({code: 1, msg: data.msg}); + resolve(data); + }, + fail: () => { + Taro.showToast({ + title: "服务器异常", + icon: "none", + }); + reject({code: 1, msg: "服务器异常"}); + }, + }); + }); +};