上传代码

This commit is contained in:
2025-08-18 14:20:34 +08:00
commit 527fd07910
2408 changed files with 427370 additions and 0 deletions

View File

@ -0,0 +1,129 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const API_api = require("../../API/api.js");
if (!Array) {
const _easycom_uni_collapse_item2 = common_vendor.resolveComponent("uni-collapse-item");
_easycom_uni_collapse_item2();
}
const _easycom_uni_collapse_item = () => "../../uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.js";
if (!Math) {
_easycom_uni_collapse_item();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "orderSettlement",
setup(__props) {
const address = common_vendor.ref("哈尔滨华德学院二公寓");
const { safeAreaInsets } = common_vendor.index.getSystemInfoSync();
const buyerMessage = common_vendor.ref("");
const totalAmount = common_vendor.ref();
const getMerchantIdFromUrl = () => {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
if (currentPage && currentPage.options && currentPage.options.totalAmount) {
let value = currentPage.options.totalAmount;
if (typeof value === "string" && value.trim() !== "") {
totalAmount.value = Number(value);
if (isNaN(totalAmount.value)) {
console.error("Failed to parse totalAmount as a number:", value);
} else {
console.log(`totalAmount received: ${totalAmount.value}`);
common_vendor.index.setStorageSync("totalAmount", totalAmount.value);
}
} else {
console.error("totalAmount is not a valid string:", value);
}
} else {
console.error("Could not retrieve totalAmount from URL.");
}
};
common_vendor.onMounted(() => {
getMerchantIdFromUrl();
});
common_vendor.watch(totalAmount, (newValue) => {
common_vendor.index.$emit("totalAmountChanged", newValue);
});
const business = common_vendor.ref([]);
const loadCartItems = () => {
const storedCartItems = common_vendor.index.getStorageSync("cartItems");
if (storedCartItems) {
business.value = storedCartItems;
console.log(business.value);
}
business.value.forEach((item) => {
console.log(`dishesImage: ${item.dishesImage}, dishesName: ${item.dishesName}, dishesId: ${item.id},quantity:${item.quantity}`);
});
};
common_vendor.onMounted(() => {
loadCartItems();
});
common_vendor.ref(common_vendor.index.getStorageSync("totalAmount"));
const Code = () => {
const data = {
businessId: 1830063677349658600,
// notes: "",
// orderDetailAddRequest: [
// {
// attributeNames: "小份",
// dishesId: 82,
// quantity: 1
// }
// ],
notes: buyerMessage.value,
orderDetailAddRequest: business.value.map((item) => ({
attributeNames: "小份",
// 假设attributeNames是一个可选属性
dishesId: item.id,
quantity: item.quantity
})),
payMethod: 0,
phone: "13613639360",
pickupMethod: 0,
pickupTime: "",
totalPrice: 13.99,
userName: "用户名称"
};
common_vendor.index.request({
url: API_api.apiImageUrl + "/api/orders/add",
method: "POST",
data,
header: {
"cookie": common_vendor.index.getStorageSync("cookie") || ""
},
success(res) {
console.log("Success:", res.data);
common_vendor.index.setStorageSync("orderInfo", res.data);
common_vendor.index.navigateTo({
url: "/pages/orderSettlement/orderSettlement"
});
},
fail() {
console.error("Error:", "请求失败");
}
});
};
return (_ctx, _cache) => {
var _a;
return {
a: common_vendor.t(address.value),
b: common_vendor.f(business.value, (item, index, i0) => {
return {
a: item.dishesImage,
b: common_vendor.t(item.dishesName),
c: common_vendor.t(item.dishesPrice),
d: index
};
}),
c: common_vendor.t(totalAmount.value),
d: buyerMessage.value,
e: common_vendor.o(($event) => buyerMessage.value = $event.detail.value),
f: common_vendor.p({
title: "费用明细"
}),
g: common_vendor.t(totalAmount.value),
h: common_vendor.o(Code),
i: ((_a = common_vendor.unref(safeAreaInsets)) == null ? void 0 : _a.bottom) + "px"
};
};
}
});
wx.createPage(_sfc_main);

View File

@ -0,0 +1,7 @@
{
"navigationBarTitleText": "订单结算",
"enablePullDownRefresh": false,
"usingComponents": {
"uni-collapse-item": "../../uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item"
}
}

View File

@ -0,0 +1 @@
<scroll-view scroll-y class="viewport"><view class="viewportCenter"><view class="message"><view class="name1"> zhangxinran </view><view class="phone1"> 12353423242 </view></view><view class="address"><text class="addressNow">{{a}}</text><view class="changeAddress"> 切换 </view></view><view class="car"><view class="goods"><navigator wx:for="{{b}}" wx:for-item="item" wx:key="d" class="item" hover-class="none"><image class="picture" src="{{item.a}}"/><view class="meta"><view class="name">{{item.b}}</view><view class="attrs">{{item.c}}元</view><view class="prices"><view class="money">¥{{c}}</view></view></view></navigator></view><view class="related"><view class="item"><text class="text">订单备注</text><input class="input" cursor-spacing="{{30}}" placeholder="备注" value="{{d}}" bindinput="{{e}}"/></view></view><uni-collapse-item wx:if="{{f}}" u-s="{{['d']}}" u-i="a854c684-0" bind:__l="__l" u-p="{{f}}"><view class="content"><view class="box"><text class="left">基础运费10.23公里)</text><text class="right">16元</text></view><view class="box"><text class="left">优惠券</text><text class="right">-5元</text></view><view class="box"><text class="left">平台打折</text><text class="right">-1.6元</text></view><view class="box"><text class="left">总费用</text><text class="right">14.40元</text></view></view></uni-collapse-item></view></view></scroll-view><view class="toolbar" style="{{'padding-bottom:' + i}}"><view class="total-pay symbol"><text class="number">¥{{g}}</text></view><view bindtap="{{h}}" class="{{['button', 'disabled']}}"> 去下单 </view></view>

View File

@ -0,0 +1,201 @@
.viewport {
height: 100vh;
width: 100%;
background-image: linear-gradient(to bottom, #4095e5 25%, #ffffff 25%);
}
.viewportCenter {
height: 100vh;
width: 90%;
margin: 35% auto;
background-image: linear-gradient(to bottom, #f5f5f5 25%, #fff 25%);
border-radius: 15px;
}
.message {
width: 90%;
height: 10%;
margin: 0 auto;
padding-top: 15px;
padding-bottom: 15px;
}
.name1,.phone1 {
font-size: 35rpx;
display: block;
margin: 10px;
font-weight: 700;
}
.address {
width: 90%;
height: 150rpx;
background-color: #fff;
margin: 0 auto;
border-radius: 10px;
}
.addressNow {
font-size: 40rpx;
font-weight: 700;
line-height: 80px;
padding-left: 20px;
}
.changeAddress {
width: 40px;
height: 30px;
float: right;
margin-top: 25px;
margin-right: 20px;
line-height: 32px;
padding-left: 5px;
border-radius: 10px;
border: 1px solid #7a7a7a;
}
.car {
width: 100%;
height: 100vh;
margin-top: 20px;
}
.goods {
margin: 20rpx;
padding: 0 20rpx;
border-radius: 10rpx;
background-color: #fff;
}
.item {
display: flex;
padding: 30rpx 0;
border-top: 1rpx solid #eee;
}
&:first-child {
border-top: none;
}
.picture {
width: 250rpx;
height: 170rpx;
border-radius: 15rpx;
margin-right: 20rpx;
}
.meta {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
position: relative;
}
.name {
height: 20px;
font-size: 30rpx;
font-weight: 700;
color: #444;
}
.attrs {
line-height: 1.8;
padding: 0 15rpx;
margin-top: 6rpx;
font-size: 24rpx;
align-self: flex-start;
border-radius: 4rpx;
color: #888;
background-color: #f7f7f8;
}
.money {
font-size: 30rpx;
font-weight: 700;
margin-left: 20px;
}
.related {
margin: 20rpx;
padding: 0 20rpx;
border-radius: 10rpx;
background-color: #fff;
}
.item {
display: flex;
justify-content: space-between;
align-items: center;
min-height: 80rpx;
font-size: 26rpx;
color: #333;
}
.input {
flex: 1;
text-align: right;
margin: 20rpx 0;
padding-right: 20rpx;
font-size: 26rpx;
color: #999;
}
.item .text {
width: 125rpx;
}
.picker {
color: #666;
}
.picker::after {
content: '\e6c2';
}
.settlement {
margin: 20rpx;
padding: 0 20rpx;
border-radius: 10rpx;
background-color: #fff;
}
.item {
display: flex;
align-items: center;
justify-content: space-between;
height: 80rpx;
font-size: 26rpx;
color: #333;
}
.danger {
color: #000;
}
.toolbar {
position: fixed;
left: 0;
right: 0;
bottom: calc(var(--window-bottom));
z-index: 1;
background-image: linear-gradient(to right, #525252 70%, #4095e5 70%);
height: 20px;
padding: 0 20rpx;
border-top: 1rpx solid #eaeaea;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: content-box;
margin: 0 auto;
width: 90%;
border-radius: 50rpx;
margin-bottom: 10px;
}
.total-pay {
font-size: 40rpx;
color: #fff;
margin-top:30px;
}
.decimal {
font-size: 75%;
}
.button {
width: 200rpx;
text-align: center;
margin-top: 30px;
font-size: 30rpx;
color: #fff;
font-weight: 700;
}
.box {
padding-top: 5px;
padding-bottom: 5px;
}
.left,.right {
font-size: 30rpx;
}
.right {
float: right;
padding-right: 5px;
font-weight: 700;
}
.left {
padding-left: 5px;
}