地址布局修改,分类类别修改

This commit is contained in:
yuanteng0011 2024-11-06 08:26:18 +08:00
parent 720638b1a9
commit 4d897090b2
7 changed files with 88 additions and 59 deletions

View File

@ -89,6 +89,12 @@ const radioChange = ( event ) => {
}
.group {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 60rpx;
background-color: #fbc27b;
padding: 11.47rpx 24.38rpx 6.26rpx;
}
@ -113,6 +119,7 @@ const radioChange = ( event ) => {
.list {
margin-top: 30rpx;
margin-bottom: 30rpx;
}
.list-item_1 {
@ -161,6 +168,10 @@ const radioChange = ( event ) => {
}
.section {
position: fixed;
left: 0;
bottom: 0;
right: 0;
margin-top: 202.5rpx;
padding: 18.75rpx 0;
background-color: #fffef8;

View File

@ -186,13 +186,13 @@ const sumprice = ref(88)
const popup = ref(null) //
const addressRealInfo = ref({}) //
const productObject = ref({}) //
const store = userStore() //
// const store = userStore() //
const labelList = ref([]) //
const userInfo = ref({}) //
const userInfo = ref({}) //
const totalAmount = ref(0) //
const orderProduct = ref([
const orderItemList = ref([ //
{
orderId : 0,
// orderId : 0,
goodSnapshot : { },
priceSnapshot: 0, //
quantity: 0,
@ -216,7 +216,7 @@ onLoad((options)=>{
return s
})
totalAmount.value = productObject.value.price //11.4
orderProduct.value[0].goodSnapshot = { // 11.4
orderItemList.value[0].goodSnapshot = { // 11.4
name : productObject.value.name,
type : productObject.value.type,
price : productObject.value.price,
@ -224,9 +224,10 @@ onLoad((options)=>{
festivalOrder : productObject.value.festivalOrder,
reserveDate: productObject.value.reserveDate
}
orderProduct.value[0].priceSnapshot = productObject.value.price
orderProduct.value[0].quantity = 1 //
orderProduct.value[0].itemTotalAmount = orderProduct.value[0].quantity * orderProduct.value[0].priceSnapshot
orderItemList.value[0].priceSnapshot = productObject.value.price
orderItemList.value[0].quantity = 1 //
//for
orderItemList.value[0].itemTotalAmount = orderItemList.value[0].quantity * orderItemList.value[0].priceSnapshot
})
//
const close = () => {
@ -245,41 +246,40 @@ const createOrder = async () => {
console.log('商品对象==>',productObject.value)
console.log('地址对象==>',addressRealInfo.value);
console.log('用户信息==>',userInfo.value);
console.log('订单明细-->',orderItemList.value);
//
const resOrder = await uni.request({
url: baseUrl + '/order/add',
method: 'POST',
data: {
userId: userInfo.value.id,
userName: userInfo.value.userName,
orderNumber: "null", //null
addressSnapshot: {...addressRealInfo.value}, //
contactsSnapshot: {name:"null",phone:"null"},
couponSnapshot: {name:"null",conditionAmount:"null"}, //
totalAmount: totalAmount.value, //
orderStatus: "待支付" //
orderStatus: "待支付" ,//
orderItemList: orderItemList.value
// orderItemList: orderItemList.value.map(item =>({
// goodSnapshot : item.goodSnapshot,
// priceSnapshot : item.priceSnapshot,
// quantity : item.quantity,
// itemTotalAmount: item.itemTotalAmount
// }))
}
})
console.log('订单==>',resOrder);
// ---
if(resOrder.data.code === 1 ) {
orderProduct.value[0].orderId = resOrder.data.data
const resProduct = await uni.request({
url: baseUrl + '/order/add/item',
method: 'POST',
data: JSON.stringify(orderProduct.value) //
})
console.log('订单明细-->',resOrder.data.data);
if(resProduct.data.code === 1) {
uni.navigateTo({
url: '/pages/order/paysuccess/paysuccess'
})
} else {
uni.showToast({
icon: 'error',
title: "登录失败,请重试"
})
return;
}
console.log('后台返回订单响应==>',resOrder);
if(resOrder.data.code === 1) {
uni.navigateTo({
url: '/pages/order/paysuccess/paysuccess'
})
} else {
uni.showToast({
icon: 'error',
title: "购买失败,请求错误"
})
return;
}
}

View File

@ -14,6 +14,7 @@
</view>
<!-- 类别列表 -->
<view class="flex-col justify-start section_3 pos_9">
<scroll-view scroll-y class="scrollable-contentType">
<view class="flex-col group">
<view class="flex-col items-center list-item mt-5"
v-for="(item, index) in sort"
@ -26,6 +27,7 @@
<text class="font_4 mt-3">{{ item.name }}</text>
</view>
</view>
</scroll-view>
</view>
<view class="flex-col justify-start section_4 pos_4">
<view class="flex-col items-start section_5">
@ -139,6 +141,9 @@ const goToProduct = (item) => {
</script>
<style lang="scss" scoped>
.scrollable-contentType {
height: 65vh;
}
.scrollable-content {
height: 56vh;
/* 100px 是头部和底部的高度之和 */

View File

@ -414,6 +414,12 @@ text.data-v-c20b9e4d {
height: 100%;
}
.group.data-v-c20b9e4d {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 60rpx;
background-color: #fbc27b;
padding: 11.47rpx 24.38rpx 6.26rpx;
}
.text.data-v-c20b9e4d {
@ -434,6 +440,7 @@ text.data-v-c20b9e4d {
}
.list.data-v-c20b9e4d {
margin-top: 30rpx;
margin-bottom: 30rpx;
}
.list-item_1.data-v-c20b9e4d {
padding: 26.27rpx 16.8rpx 24.98rpx;
@ -473,6 +480,10 @@ text.data-v-c20b9e4d {
width: 601.88rpx;
}
.section.data-v-c20b9e4d {
position: fixed;
left: 0;
bottom: 0;
right: 0;
margin-top: 202.5rpx;
padding: 18.75rpx 0;
background-color: #fffef8;

View File

@ -1,7 +1,7 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const pages_utils_emitter = require("../../utils/emitter.js");
const store_userStore = require("../../../store/userStore.js");
require("../../../store/userStore.js");
const common_assets = require("../../../common/assets.js");
const api_request = require("../../../api/request.js");
if (!Array) {
@ -25,13 +25,13 @@ const _sfc_main = {
const popup = common_vendor.ref(null);
const addressRealInfo = common_vendor.ref({});
const productObject = common_vendor.ref({});
store_userStore.userStore();
const labelList = common_vendor.ref([]);
const userInfo = common_vendor.ref({});
const totalAmount = common_vendor.ref(0);
const orderProduct = common_vendor.ref([
const orderItemList = common_vendor.ref([
//订单中各种商品的详细信息
{
orderId: 0,
// orderId : 0,
goodSnapshot: {},
priceSnapshot: 0,
//实付金额
@ -55,7 +55,7 @@ const _sfc_main = {
return s;
});
totalAmount.value = productObject.value.price;
orderProduct.value[0].goodSnapshot = {
orderItemList.value[0].goodSnapshot = {
//待优化 11.4
name: productObject.value.name,
type: productObject.value.type,
@ -64,9 +64,9 @@ const _sfc_main = {
festivalOrder: productObject.value.festivalOrder,
reserveDate: productObject.value.reserveDate
};
orderProduct.value[0].priceSnapshot = productObject.value.price;
orderProduct.value[0].quantity = 1;
orderProduct.value[0].itemTotalAmount = orderProduct.value[0].quantity * orderProduct.value[0].priceSnapshot;
orderItemList.value[0].priceSnapshot = productObject.value.price;
orderItemList.value[0].quantity = 1;
orderItemList.value[0].itemTotalAmount = orderItemList.value[0].quantity * orderItemList.value[0].priceSnapshot;
});
const close = () => {
popup.value.close();
@ -78,11 +78,13 @@ const _sfc_main = {
console.log("商品对象==>", productObject.value);
console.log("地址对象==>", addressRealInfo.value);
console.log("用户信息==>", userInfo.value);
console.log("订单明细-->", orderItemList.value);
const resOrder = await common_vendor.index.request({
url: api_request.baseUrl + "/order/add",
method: "POST",
data: {
userId: userInfo.value.id,
userName: userInfo.value.userName,
orderNumber: "null",
//订单编号暂存为null
addressSnapshot: { ...addressRealInfo.value },
@ -92,31 +94,28 @@ const _sfc_main = {
//优惠卷信息快照
totalAmount: totalAmount.value,
//总价
orderStatus: "待支付"
orderStatus: "待支付",
//订单状态
orderItemList: orderItemList.value
// orderItemList: orderItemList.value.map(item =>({
// goodSnapshot : item.goodSnapshot,
// priceSnapshot : item.priceSnapshot,
// quantity : item.quantity,
// itemTotalAmount: item.itemTotalAmount
// }))
}
});
console.log("订单==>", resOrder);
console.log("后台返回订单响应==>", resOrder);
if (resOrder.data.code === 1) {
orderProduct.value[0].orderId = resOrder.data.data;
const resProduct = await common_vendor.index.request({
url: api_request.baseUrl + "/order/add/item",
method: "POST",
data: JSON.stringify(orderProduct.value)
//将数组对象转换为字符串
common_vendor.index.navigateTo({
url: "/pages/order/paysuccess/paysuccess"
});
console.log("订单明细-->", resOrder.data.data);
if (resProduct.data.code === 1) {
common_vendor.index.navigateTo({
url: "/pages/order/paysuccess/paysuccess"
});
} else {
common_vendor.index.showToast({
icon: "error",
title: "登录失败,请重试"
});
return;
}
} else {
common_vendor.index.showToast({
icon: "error",
title: "购买失败,请求错误"
});
return;
}
};
return (_ctx, _cache) => {

View File

@ -1 +1 @@
<view class="flex-row relative page data-v-7e3c386d"><view class="flex-row items-center section pos_8 data-v-7e3c386d"><text class="text data-v-7e3c386d">商品</text><view class="flex-row items-center section_2 ml-15 data-v-7e3c386d"><image class="image data-v-7e3c386d" src="{{a}}"/><input class="text-wrapper ml-3 data-v-7e3c386d" placeholder="请输入内容"/></view></view><view class="flex-col justify-start items-center image-wrapper pos_1 data-v-7e3c386d"><image class="shrink-0 image_2 data-v-7e3c386d" src="{{''}}"/></view><view class="flex-col justify-start section_3 pos_9 data-v-7e3c386d"><view class="flex-col group data-v-7e3c386d"><view wx:for="{{b}}" wx:for-item="item" wx:key="c" class="flex-col items-center list-item mt-5 data-v-7e3c386d" style="{{item.d}}" bindtap="{{item.e}}"><image class="image_3 data-v-7e3c386d" src="{{item.a}}"/><text class="font_4 mt-3 data-v-7e3c386d">{{item.b}}</text></view></view></view><view class="flex-col justify-start section_4 pos_4 data-v-7e3c386d"><view class="flex-col items-start section_5 data-v-7e3c386d"><text class="font_2 data-v-7e3c386d">材料包</text><text class="font_3 text_3 mt-6 data-v-7e3c386d">提供材料自行DIY</text></view></view><view class="flex-col pos_5 data-v-7e3c386d"><scroll-view scroll-y class="scrollable-content data-v-7e3c386d"><view wx:for="{{c}}" wx:for-item="item" wx:key="e" class="flex-row section_9 list-item_2 mt-5 data-v-7e3c386d" bindtap="{{item.f}}"><image class="self-center image_4 data-v-7e3c386d" src="{{item.a}}"/><view style="width:220rpx" class="flex-col items-start self-center group_3 data-v-7e3c386d"><text class="font_2 text_5 data-v-7e3c386d">{{item.b}}</text><text class="font_3 mt-13 data-v-7e3c386d">{{item.c}}</text><text class="font mt-13 data-v-7e3c386d">¥{{item.d}}</text></view><image class="self-start image_5 data-v-7e3c386d" src="{{d}}"/></view></scroll-view></view></view>
<view class="flex-row relative page data-v-7e3c386d"><view class="flex-row items-center section pos_8 data-v-7e3c386d"><text class="text data-v-7e3c386d">商品</text><view class="flex-row items-center section_2 ml-15 data-v-7e3c386d"><image class="image data-v-7e3c386d" src="{{a}}"/><input class="text-wrapper ml-3 data-v-7e3c386d" placeholder="请输入内容"/></view></view><view class="flex-col justify-start items-center image-wrapper pos_1 data-v-7e3c386d"><image class="shrink-0 image_2 data-v-7e3c386d" src="{{''}}"/></view><view class="flex-col justify-start section_3 pos_9 data-v-7e3c386d"><scroll-view scroll-y class="scrollable-contentType data-v-7e3c386d"><view class="flex-col group data-v-7e3c386d"><view wx:for="{{b}}" wx:for-item="item" wx:key="c" class="flex-col items-center list-item mt-5 data-v-7e3c386d" style="{{item.d}}" bindtap="{{item.e}}"><image class="image_3 data-v-7e3c386d" src="{{item.a}}"/><text class="font_4 mt-3 data-v-7e3c386d">{{item.b}}</text></view></view></scroll-view></view><view class="flex-col justify-start section_4 pos_4 data-v-7e3c386d"><view class="flex-col items-start section_5 data-v-7e3c386d"><text class="font_2 data-v-7e3c386d">材料包</text><text class="font_3 text_3 mt-6 data-v-7e3c386d">提供材料自行DIY</text></view></view><view class="flex-col pos_5 data-v-7e3c386d"><scroll-view scroll-y class="scrollable-content data-v-7e3c386d"><view wx:for="{{c}}" wx:for-item="item" wx:key="e" class="flex-row section_9 list-item_2 mt-5 data-v-7e3c386d" bindtap="{{item.f}}"><image class="self-center image_4 data-v-7e3c386d" src="{{item.a}}"/><view style="width:220rpx" class="flex-col items-start self-center group_3 data-v-7e3c386d"><text class="font_2 text_5 data-v-7e3c386d">{{item.b}}</text><text class="font_3 mt-13 data-v-7e3c386d">{{item.c}}</text><text class="font mt-13 data-v-7e3c386d">¥{{item.d}}</text></view><image class="self-start image_5 data-v-7e3c386d" src="{{d}}"/></view></scroll-view></view></view>

View File

@ -401,6 +401,9 @@ text.data-v-7e3c386d {
.mt-100.data-v-7e3c386d {
margin-top: 187.5rpx;
}
.scrollable-contentType.data-v-7e3c386d {
height: 65vh;
}
.scrollable-content.data-v-7e3c386d {
height: 56vh;
/* 100px 是头部和底部的高度之和 */