修改文件

This commit is contained in:
2025-09-04 17:04:21 +08:00
parent ff5e4af2d4
commit 55205f6e4d
11 changed files with 641 additions and 540 deletions

View File

@ -8,14 +8,14 @@
<u-icon name="arrow-right" size="28" class="right-icon"></u-icon>
</navigator>
</view>
<view class="u-m-t-8 u-line-1">
<!-- <view class="u-m-t-8 u-line-1">
<navigator class="u-flex " url="/bundle/pages/address/address?type=1" hover-class="none">
<u-icon name="map" size="32"></u-icon>
<view class="u-line-1">
{{userAddress || '请选择收货地址'}}
</view>
</navigator>
</view>
</view> -->
</view>
<view>
<u-button shape="circle" :hair-line="false" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '36rpx'}" @click="signin">签到</u-button>
@ -53,7 +53,14 @@
</view>
<!-- 下单 -->
<view class="order u-flex u-row-center bg-white">
<view class="order u-flex u-row-center bg-white" @click="toStore">
<view>
<view class="reserve">预约下单</view>
<view class="desc">极速送达更便捷</view>
</view>
<view>
<u-image :src="cloudPath + 'img/home_image1.png'" width="204" height="204"></u-image>
</view>
<!-- <view class="bg-white u-text-center">
<navigator url="/pages/store/store?type=1" hover-class="none">
<view class="text-default xxl">预约下单</view>
@ -63,7 +70,7 @@
</view>
</navigator>
</view> -->
<view class="u-text-center">
<!-- <view class="u-text-center">
<navigator url="/pages/store/store?type=2" hover-class="none">
<view class="text-default xxl">现在点单</view>
<view class="xs text-999">预约下单更便捷</view>
@ -71,7 +78,7 @@
<u-image :src="cloudPath + 'img/icon_order.png'" width="132" height="133" mode="aspectFit"></u-image>
</view>
</navigator>
</view>
</view> -->
</view>
<!-- 活动图 -->
@ -157,6 +164,12 @@
uni.navigateTo({
url: '/pages/signin/signin'
})
},
toStore() {
uni.navigateTo({
url: '/pages/store/store'
})
}
},
computed: {
@ -200,9 +213,31 @@
.order {
margin: 30rpx 20rpx;
height: 300rpx;
justify-content: center;
align-items: center;
& > view {
border-radius: 16rpx;
padding: 40rpx 86rpx;
}
.reserve {
font-weight: 500;
font-size: 44rpx;
color: #254062;
line-height: 26rpx;
font-weight: 500;
margin-bottom: 34rpx;
}
.desc {
font-weight: 400;
font-size: 22rpx;
color: #999999;
line-height: 26rpx;
text-align: center;
font-style: normal;
text-transform: none;
}
}
}

View File

@ -141,7 +141,10 @@
// 更新新注册的用户信息
async handleSubmitMobile(e) {
console.log("🚀 ~ handleSubmitMobile ~ e:", e)
const wxCode = await getWxCode()
console.log("🚀 ~ handleSubmitMobile ~ wxCode:", wxCode)
console.log("🚀 ~ handleSubmitMobile ~ client:", client)
const res = await accountLogin({ account: e.mobile, code: wxCode, client })
if (res.code == 1) {
this.loginHandle(res.data)

View File

@ -181,8 +181,7 @@
<script>
import { orderBuy, getOrderCoupon, getDelivery } from '@/api/order'
import { prepay, getPayway } from '@/api/app'
import { wxpay, alipay } from '@/utils/pay'
export default {
data() {
return {

View File

@ -2,24 +2,27 @@
<view>
<view class="shop">
<view>
<u-swiper :list="goods.goods_image" name="uri" height="500" border-radius="0" mode="number" indicator-pos="bottomRight"></u-swiper>
<u-swiper :list="goods.goods_image" name="uri" height="500" border-radius="0" mode="number"
indicator-pos="bottomRight"></u-swiper>
</view>
<view class="bg-white mx24 px24 u-m-t-24 u-padding-top-20 u-padding-bottom-20 br24">
<view class="nr">{{ goods.name }}</view>
<view class="mt10 row u-row-between">
<view class="row">
<view class="primary">
<price-format :price="goods.min_price" :subscriptSize="22" :firstSize="34" :secondSize="26"></price-format>
<price-format :price="goods.min_price" :subscriptSize="22" :firstSize="34"
:secondSize="26"></price-format>
</view>
<view class="sale u-text-center primary u-m-l-12">0</view>
<view class="primary u-m-l-12">
<price-format :lineThrough="true" color="#999" :subscriptSize="22" :firstSize="22" :secondSize="22" :price="goods.market_price"></price-format>
<price-format :lineThrough="true" color="#999" :subscriptSize="22" :firstSize="22"
:secondSize="22" :price="goods.market_price"></price-format>
</view>
</view>
<view class="text-999">已售66</view>
</view>
<view class="u-m-t-20 u-m-b-20">
<u-line color="#eee" />
</view>
@ -28,31 +31,30 @@
<text>须知</text>
<text class="text-999 ml20">周一至周日可用</text>
</view>
<view class="row-between mt20">
<view>
<text>保障</text>
<text class="text-999 ml20">随时退 过期自动退</text>
</view>
<view>
<u-button @click="openSpec" hover-class="none"
:customStyle="{width: '116rpx', height: '46rpx', lineHeight: '46rpx', fontSize: '24rpx', backgroundColor: themeColor, color: '#fff', border: 'none', paddingTop: '8rpx'}"
:hair-line="false"
shape="circle">
选规格
<u-button @click="openSpec" hover-class="none"
:customStyle="{ width: '116rpx', height: '46rpx', lineHeight: '46rpx', fontSize: '24rpx', backgroundColor: themeColor, color: '#fff', border: 'none', paddingTop: '8rpx' }"
:hair-line="false" shape="circle">
选规格
</u-button>
</view>
</view>
</view>
</view>
<view class="u-m-t-24">
<view class="u-m-l-48 nr">详情</view>
<view class="bg-white mx24 px24 u-m-t-24 u-p-t-20 u-p-b-20 br24">
<u-image :src="cloudPath + 'img/banner.png'" height="600"></u-image>
</view>
</view>
<view class="u-m-t-24">
<view class="u-m-l-48 nr">购买须知</view>
<view class="bg-white mx24 px24 u-m-t-24 u-p-t-20 u-p-b-20 br24">
@ -60,7 +62,7 @@
</view>
</view>
</view>
<view class="fixed bg-white row-between px48 u-p-t-20 u-p-b-20">
<view class="column u-text-center u-relative" @click="addCartFun">
<view class="row-center">
@ -73,203 +75,208 @@
</view>
</view>
<view class="u-m-l-64 flex1">
<u-button hover-class="none" @click="showSpecFun"
:customStyle="{height: '92rpx', fontSize: '24rpx', backgroundColor: themeColor, color: '#fff', border: 'none', paddingTop: '8rpx'}"
:hair-line="false"
shape="circle">
立即购买
<u-button hover-class="none" @click="showSpecFun"
:customStyle="{ height: '92rpx', fontSize: '24rpx', backgroundColor: themeColor, color: '#fff', border: 'none', paddingTop: '8rpx' }"
:hair-line="false" shape="circle">
立即购买
</u-button>
</view>
</view>
<shop-spec v-model="showSpec" :name="goods.name" :goods="goods" @confirm="confirmSpec" @buynow="onBuy"></shop-spec>
<shop-spec v-model="showSpec" :name="goods.name" :goods="goods" @confirm="confirmSpec"
@buynow="onBuy"></shop-spec>
</view>
</template>
<script>
import {
mapActions,
mapGetters
} from 'vuex';
import {
getGoodsDetail,
getCartList,
addCart,
getPoster,
getCartNum
} from '@/api/store'
import {
toLogin
} from '@/utils/login'
import {
mapActions,
mapGetters
} from 'vuex';
import {
getGoodsDetail,
getCartList,
addCart,
getPoster,
getCartNum
} from '@/api/store'
import {
toLogin
} from '@/utils/login'
export default {
data() {
return {
id: 0,
showSpec: false,
goods: [],
spec: [],
checkedGoods: {},
source: '',
cartLists: [],
totalPrice: 0,
showPopup: false,
export default {
data() {
return {
id: 0,
showSpec: false,
goods: [],
spec: [],
checkedGoods: {},
source: '',
cartLists: [],
totalPrice: 0,
showPopup: false,
}
},
onLoad(options) {
console.log("🚀 ~ onLoad ~ options:", options)
this.id = options.id
this.showPopup = options.showPopup === 'true' ? true : false
this.showSpec = this.showPopup
},
onUnload() {
uni.$emit('refreshCartList');
},
onShow() {
this.getGoodsDetailFun();
this.getCartNum()
this.getCartListFun()
},
methods: {
...mapActions(['getCartNum']),
// 获取商品详情
async getGoodsDetailFun() {
const {
data,
code
} = await getGoodsDetail({
id: this.id
});
if (code == 1) {
this.goods = data
console.log(this.goods.goods_image);
}
},
onLoad(options) {
console.log("🚀 ~ onLoad ~ options:", options)
this.id = options.id
this.showPopup = options.showPopup === 'true' ? true : false
this.showSpec = this.showPopup
},
// 获取购物车列表数据
getCartListFun() {
// 获取商品的分类ID
getCartList().then((res) => {
if (res.code == 1) {
let {
lists,
total_amount
} = res.data;
this.cartLists = lists;
// // let cartType = 0;
onShow() {
this.getGoodsDetailFun();
this.getCartNum()
this.getCartListFun()
},
// // if (lists.length == 0) {
// // cartType = 2;
// // } else {
// // cartType = 1;
// // }
methods: {
...mapActions(['getCartNum']),
// this.cartLists = list;
// console.log(">>>", this.cartLists);
// 获取商品详情
async getGoodsDetailFun() {
const {
data,
code
} = await getGoodsDetail({
id: this.id
});
if (code == 1) {
this.goods = data
console.log(this.goods.goods_image);
// // this.cartType = cartType;
this.totalPrice = total_amount
// // this.isShow = true;
this.getCartNum();
}
},
});
},
// 获取购物车列表数据
getCartListFun() {
// 获取商品的分类ID
getCartList().then((res) => {
if (res.code == 1) {
let {
lists,
total_amount
} = res.data;
this.cartLists = lists;
// // let cartType = 0;
// 将当前的商品添加到购物车里面
addCartFun() {
this.showSpec = true
},
// // if (lists.length == 0) {
// // cartType = 2;
// // } else {
// // cartType = 1;
// // }
// 打开商品规格
openSpec() {
this.showSpec = true
},
// this.cartLists = list;
// console.log(">>>", this.cartLists);
// // this.cartType = cartType;
this.totalPrice = total_amount
// // this.isShow = true;
this.getCartNum();
// 获取选择的商品规格
confirmSpec(data) {
console.log("data>>>", data.spec);
this.spec = data.spec
this.showSpec = false
},
onChangeGoods(e) {
console.log(e);
this.checkedGoods = e.detail;
},
// 选择规格
showSpecFun() {
if (!this.isLogin) return toLogin();
this.showSpec = true;
},
// 购买商品
onBuy(e) {
if (e.type === 'cart') {
let { id, goodsNum } = e.detail
addCart({
item_id: id,
goods_num: goodsNum
}).then(res => {
if (res.code == 0) {
this.$toast({
title: res.msg
});
return;
}
});
},
// 将当前的商品添加到购物车里面
addCartFun() {
this.showSpec = true
},
// 打开商品规格
openSpec() {
this.showSpec = true
},
// 获取选择的商品规格
confirmSpec(data) {
console.log("data>>>", data.spec);
this.spec = data.spec
this.showSpec = false
},
onChangeGoods(e) {
console.log(e);
this.checkedGoods = e.detail;
},
// 选择规格
showSpecFun() {
if (!this.isLogin) return toLogin();
this.showSpec = true;
},
// 购买商品
onBuy(e) {
if (e.type === 'cart') {
// 限购逻辑:套餐和单品内的商品列表,每个都是只能购买两个
if (this.goods.first_category_id == 1 || this.goods.first_category_id == 2) {
console.log("🚀 ~ onBuy ~ this.cartLists:", this.cartLists)
const totalNum = this.cartLists
.filter(i => i.first_category_id === this.goods.first_category_id)
.reduce((sum, i) => sum + (i.goods_num || 0), 0);
if (totalNum >= 2) {
this.$toast({ title: '该类商品每人限购2件' });
return;
} else {
let {id} = e.detail
addCart({
item_id: id,
goods_num: 1
}).then(res => {
this.getCartListFun()
this.getCartListFun()
if (this.showPopup) {
setTimeout(() => {
uni.redirectTo({
url: '/pages/store/store'
});
}
}
} else {
let {id, goodsNum} = e.detail
let goods = [{item_id: id, num: goodsNum}]
const params = {goods}
}, 300);
}
this.showSpec = false
uni.navigateTo({
url: '/pages/order_now/order_now?data=' + encodeURIComponent((JSON.stringify(params)))
})
}
});
} else {
let { id, goodsNum } = e.detail
let goods = [{ item_id: id, num: goodsNum }]
const params = { goods }
this.showSpec = false
uni.navigateTo({
url: '/pages/order_now/order_now?data=' + encodeURIComponent((JSON.stringify(params)))
})
}
},
computed: {
...mapGetters(['cartNum']),
},
}
}
},
computed: {
...mapGetters(['cartNum']),
},
}
</script>
<style lang="scss">
.shop {
padding-bottom: 180rpx;
.sale {
background-color: #FEFBEA;
width: 100rpx;
height: 30rpx;
line-height: 30rpx;
}
}
.fixed {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding-bottom: env(safe-area-inset-bottom);
}
.shop {
padding-bottom: 180rpx;
.number {
background-color: #FF2C3C;
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
border-radius: 100%;
.sale {
background-color: #FEFBEA;
width: 100rpx;
height: 30rpx;
line-height: 30rpx;
}
}
.fixed {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding-bottom: env(safe-area-inset-bottom);
}
.number {
background-color: #FF2C3C;
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
border-radius: 100%;
}
</style>

View File

@ -10,14 +10,14 @@
MEET轻食店
<u-icon name="arrow-right" size="28" class="right-icon u-m-l-4"></u-icon>
</view>
<view class="u-flex u-m-t-8" @click="chooseAddress">
<!-- <view class="u-flex u-m-t-8" @click="chooseAddress">
<u-icon name="map" size="32"></u-icon>
门店地址
</view>
</view> -->
</view>
<view>
<!-- <view>
<u-button shape="circle" :hair-line="false" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '36rpx'}" @click="signin">自取</u-button>
</view>
</view> -->
</view>
<view class="">
<u-alert-tips type="warning" title="当前门店已休息"></u-alert-tips>
@ -37,7 +37,6 @@
keyword: ''
}
},
onLoad() {
this.getCatrgoryFun();
},