修改页面

This commit is contained in:
2025-08-11 14:06:42 +08:00
parent 462073058e
commit 9c0be00fbd
31 changed files with 1180 additions and 309 deletions

View File

@ -125,6 +125,10 @@
</view>
</view>
</view>
<view class="settle-btn">
<u-button @tap="goSettle" shape="circle" :hair-line="false" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '36rpx'}">去结算</u-button>
</view>
</scroll-view>
</view>
<view class="u-text-center" style="height: 700rpx;line-height: 700rpx;" v-else>
@ -171,6 +175,7 @@
page:1,
status: loadingType.LOADING,
selectIndex: 0,
categoryId: 0,
cateList: [],
goodsList: [],
goods_spec: [],
@ -251,6 +256,21 @@
// 添加到购物车(默认商品数量+1,可以让后端连表查询商品数量字段)
async addCartFun(item) {
console.log("🚀 ~ addCartFun ~ item:", item)
// 限购逻辑
if (item.first_category_id === 1 || item.first_category_id === 2) {
// 统计购物车中同类商品的总数量
const totalNum = this.cartLists
.filter(i => i.first_category_id === item.first_category_id)
.reduce((sum, i) => sum + (i.goods_num || 0), 0);
if (totalNum >= 2) {
this.$toast({ title: '该类商品每人限购2件' });
return;
}
}
const {
code,
data,
@ -285,6 +305,7 @@
// 获取购物车列表数据
getCartListFun() {
// 获取商品的分类ID
getCartList().then((res) => {
if (res.code == 1) {
@ -307,7 +328,7 @@
// // this.cartType = cartType;
this.totalPrice = total_amount
// // this.isShow = true;
// this.getCartNum();
this.getCartNum();
}
});
},
@ -325,6 +346,8 @@
// 去结算
goSettle() {
console.log(this.cartLists)
this.showCart = false
const goods = this.cartLists.map(item => {
return {
item_id: item.item_id,
@ -334,12 +357,12 @@
uni.navigateTo({
url: "/pages/order_now/order_now?data=" +
encodeURIComponent(
JSON.stringify({
goods,
type: "cart",
})
),
encodeURIComponent(
JSON.stringify({
goods,
type: "cart",
})
),
});
},
@ -457,4 +480,7 @@
border-radius: 100%;
}
.settle-btn {
padding: 20rpx;
}
</style>

View File

@ -33,6 +33,8 @@
</template>
<script>
import { getPhone } from '@/api/user'
export default {
name: "mobile-login",
props: {
@ -51,22 +53,37 @@
};
},
methods: {
onGetPhoneNumber(e) {
onGetPhoneNumber(e) {
const code = e.detail.code
if (e.detail.errMsg === "getPhoneNumber:ok") {
// 这里需要解密手机号
this.mobile = 110
uni.showLoading({
title: '获取中',
mask: true
})
getPhone({code}).then(res => {
uni.hideLoading()
if (res.code === 1) {
this.mobile = res.data.phone_info.phoneNumber
} else {
this.$toast({title: res.msg})
return
}
}).catch(err => {
this.$toast({title: '获取手机号失败'})
});
}
},
// 提交数据
handleSubmit(e) {
// const {mobile} = this
// if (!mobile) return this.$toast({
// title: '请授权手机号'
// })
const {mobile} = this
if (!mobile) return this.$toast({
title: '请授权手机号'
})
this.$emit('update', {
mobile: 15005837859
mobile
})
this.showPop = false

View File

@ -4,11 +4,12 @@
:maskCloseAble="false">
<view class="popup-content">
<view class="u-font-xl bold-600">
获取您的昵称和头像
<!-- 获取您的昵称和头像 -->
获取您的信息
</view>
<view class="popup-form">
<form @submit="handleSubmit">
<view class="u-flex u-row-between avatar u-m-t-80">
<view class="u-flex u-row-between avatar u-m-t-80" v-if="infoType === 'all' || infoType === 'avatar'">
<text>头像</text>
<view class="u-flex u-row-between flex1 u-m-l-30">
<button style="border: none;" class="u-flex u-row-between w-full" hover-class="none"
@ -19,7 +20,7 @@
</button>
</view>
</view>
<view class="u-flex u-row-between avatar u-m-t-60">
<view class="u-flex u-row-between avatar u-m-t-60" v-if="infoType === 'all' || infoType === 'nickname'">
<text>昵称</text>
<view class="u-flex u-row-between flex1 u-m-l-30">
<input
@ -55,6 +56,10 @@
value: {
type: Boolean,
required: true
},
infoType: {
type: String,
default: 'all'
}
},
data() {
@ -66,6 +71,8 @@
methods: {
// 头像选择
onChooseAvatar(e) {
console.log("🚀 ~ onChooseAvatar ~ e:", e)
const avatarUrl = e.detail.avatarUrl;
if (!avatarUrl) {
return;
@ -78,6 +85,8 @@
uploadFile(avatarUrl).then((res) => {
uni.hideLoading();
this.avatar = res.url;
console.log("🚀 ~ onChooseAvatar ~ this.avatar:", this.avatar)
}).catch(() => {
uni.hideLoading();
this.$toast({title: "上传失败"});
@ -88,13 +97,13 @@
handleSubmit(e) {
const {nickname} = e.detail.value
const {avatar} = this
if (!avatar) return this.$toast({
title: '请添加头像'
})
// if (!avatar) return this.$toast({
// title: '请添加头像'
// })
if (!nickname) return this.$toast({
title: '请输入昵称'
})
// if (!nickname) return this.$toast({
// title: '请输入昵称'
// })
this.$emit('update', {
avatar,

View File

@ -36,10 +36,11 @@
<view class="sm text-999" v-if="mode === 'confirm'">
<view class="u-line-2" style="color: #1D2129">{{ item.goods_name || item.name }}</view>
<view class="u-m-t-4">周一至周日可用</view>
<view class="row u-m-t-10">
<view class="row-between u-m-t-10">
<view class="primary">
<price-format :price="item.original_price || item.goods_price" :subscriptSize="22" :firstSize="40" :secondSize="32"></price-format>
</view>
<view>x{{ item.goods_num }}</view>
</view>
</view>
<view class="sm text-999" v-if="mode === 'pay'">

View File

@ -5,7 +5,7 @@
v-for="(item, index) in orderList"
:key="index"
:url="'/pages/order_details/order_details?id=' + item.id">
<order-goods :list="item.order_goods" :order_type="item.order_type" :imageRadius="12"
<order-goods :list="item.orderGoods" :order_type="item.order_type" :imageRadius="12"
:orderDesc="item.order_status_desc" :orderStatus="item.order_status"></order-goods>
<view class="u-m-t-26 u-m-b-26 u-p-l-20 u-p-r-20">
<u-line color="#EEE" />
@ -36,7 +36,7 @@
<view v-if="item.order_status > 0 && item.order_status < 4">
<u-button @click.stop="seeDetails(item.id)" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">查看详情</u-button>
</view>
<view v-if="item.order_status == 4">
<view v-if="item.order_status == 4 && ( type == 'delivery' || type == 'finish')">
<u-button @click.stop="toRefund(item.id, item.order_goods)" hover-class="none" :customStyle="{width: '164rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none'}" :hair-line="false" shape="circle">申请退款</u-button>
</view>
</view>