Compare commits
11 Commits
prod
...
ac7af51a92
| Author | SHA1 | Date | |
|---|---|---|---|
| ac7af51a92 | |||
| 75ed724fbb | |||
| b5ecab0a03 | |||
| f75f90d34f | |||
| cf562b28b0 | |||
| 33453ab961 | |||
| 65554b043c | |||
| b3c1ab3b8b | |||
| e1000c6b40 | |||
| a4580bdd1c | |||
| 3a2d704c4f |
3
common/api/apiPrve.js
Normal file
3
common/api/apiPrve.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export const urlAccount = '/account'
|
||||
export const urlProduct = '/product'
|
||||
export const urlOrder = '/order'
|
||||
@@ -1,8 +1,7 @@
|
||||
// 引入 request 文件
|
||||
import request from '@/common/api/request.js'
|
||||
const urlAccount = '/account'
|
||||
const urlProduct = '/product'
|
||||
const urlOrder = '/order'
|
||||
|
||||
import {urlAccount,urlProduct,urlOrder} from '@/common/api/apiPrve.js'
|
||||
|
||||
//获取商品列表数据
|
||||
export const APIproductqueryProduct = (data) => {
|
||||
@@ -46,4 +45,13 @@ export const APIminiAppskuinfo = (data) => {
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
//获取相关推荐商品
|
||||
export const productRelated = (data) => {
|
||||
return request({
|
||||
url: urlProduct + '/user/product/related/'+data.id,
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -7,33 +7,7 @@ export default async (params) => {
|
||||
let token = uni.cache.get("token") || "";
|
||||
const shopId = uni.cache.get("shopId") * 1;
|
||||
const userInfo = uni.cache.get("userInfo") || {};
|
||||
// #ifdef H5
|
||||
token = "1b5e8baf0cc1492a858a208f113d0971";
|
||||
uni.cache.set('userInfo', {
|
||||
"acQrcodeValidTime": "2026-01-13 13:35:59",
|
||||
"alipayOpenId": "",
|
||||
"birthDay": "",
|
||||
"createTime": "2024-03-13 10:56:40",
|
||||
"distributionAmount": 0,
|
||||
"headImg": "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132",
|
||||
"id": "36689",
|
||||
"idCard": "",
|
||||
"isAc": 0,
|
||||
"lastLoginTime": "2025-12-24 11:24:12",
|
||||
"nickName": "微信用户",
|
||||
"password": "",
|
||||
"payPwd": "e10adc3949ba59abbe56e057f20f883e",
|
||||
"phone": "",
|
||||
"realName": "",
|
||||
"sex": null,
|
||||
"status": 1,
|
||||
"updateTime": "2025-12-24 11:22:47",
|
||||
"usePayPwd": 0,
|
||||
"wechatAcOpenId": "",
|
||||
"wechatAcQrcode": "http://weixin.qq.com/q/029s5JtP1xfmJ1g_HDxFco",
|
||||
"wechatOpenId": "or1l86yipGvwyfPhrKIAcQuSfAV8"
|
||||
})
|
||||
// #endif
|
||||
|
||||
let header = {
|
||||
version: uni.conf.version,
|
||||
type: uni.getSystemInfoSync().platform,
|
||||
@@ -60,7 +34,10 @@ export default async (params) => {
|
||||
mask: true,
|
||||
});
|
||||
}
|
||||
|
||||
// #ifdef H5
|
||||
uni.cache.set('token', 'b61c8b0f1c9d47ad924e33c48b496ce6')
|
||||
uni.cache.set('userInfo',{"acQrcodeValidTime":"2025-11-17 17:57:16","alipayOpenId":"","birthDay":"2025-10-17","createTime":"2024-07-06 11:30:16","distributionAmount":0,"headImg":"https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132","id":"36434","idCard":"612401199810058031","isAc":0,"lastLoginTime":"2025-12-25 11:41:15","nickName":"微信用户","password":"","payPwd":"e10adc3949ba59abbe56e057f20f883e","phone":"18049104914","realName":"叶明飞","sex":1,"status":1,"updateTime":"2025-12-25 09:41:58","usePayPwd":0,"wechatAcOpenId":"1111","wechatAcQrcode":"","wechatOpenId":"or1l86yipGvwyfPhrKIAcQuSfAV8"})
|
||||
// #endif
|
||||
return new Promise((resolve, reject) => {
|
||||
const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒
|
||||
uni.request({
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
// const debug = process.env.NODE_ENV == 'development' ? true : false;
|
||||
const debug = false; // false线上 true本地
|
||||
const debug = true; // false线上 true本地
|
||||
let baseUrl = ''
|
||||
let baseUrlwws = ''
|
||||
|
||||
|
||||
|
||||
|
||||
const version = "100";
|
||||
const autoRemoveCache = {
|
||||
count: 100000,
|
||||
size: 100000,
|
||||
};
|
||||
|
||||
function init(){
|
||||
function init() {
|
||||
if (debug) {
|
||||
baseUrl = 'http://192.168.1.42'
|
||||
baseUrlwws = "ws://192.168.1.42:2348";
|
||||
@@ -20,12 +21,12 @@ function init(){
|
||||
baseUrlwws = "wss://czgeatws.sxczgkj.com/wss";
|
||||
}
|
||||
// #ifdef H5
|
||||
|
||||
|
||||
if (debug) {
|
||||
baseUrl = "/api";
|
||||
baseUrl = "/testApi";
|
||||
baseUrlwws = "http://192.168.1.42:2348";
|
||||
} else {
|
||||
baseUrl = "/prodApi";
|
||||
baseUrl = "/prodApi";
|
||||
baseUrlwws = "https://czgeatws.sxczgkj.com/wss";
|
||||
}
|
||||
// #endif
|
||||
@@ -47,7 +48,7 @@ export const changeEnv = (env) => {
|
||||
let baseUrl = "http://192.168.1.42"
|
||||
let baseUrlwws = "ws://192.168.1.42:2348"
|
||||
// #ifdef H5
|
||||
baseUrl = "/api"
|
||||
baseUrl = "/testApi"
|
||||
baseUrlwws = "http://192.168.1.42:2348"
|
||||
// #endif
|
||||
uni.conf = {
|
||||
|
||||
@@ -40,9 +40,19 @@
|
||||
:nowCarts="nowCarts"
|
||||
:limitDiscount="cartStore.limitTimeDiscount"
|
||||
></orderItemVue> -->
|
||||
<orderItemVue :useVipPrice="useVipPrice" v-if="cartStore.allGoods.length" :nowCarts="cartStore.allGoods"
|
||||
<orderItemVue :useVipPrice="useVipPrice" v-if="nowCarts" :nowCarts="nowCarts"
|
||||
:shopInfo="cartStore.shopInfo" :shopUserInfo="cartStore.shopUserInfo"
|
||||
:limitDiscount="cartStore.limitTimeDiscount"></orderItemVue>
|
||||
|
||||
<view class="u-flex u-row-center u-m-t-16 u-font-28">
|
||||
<view class="u-flex u-col-baseline" @click="showAllGoods=!showAllGoods">
|
||||
<text>{{showAllGoods?'收起':'展开'}}</text>
|
||||
<view class="guodu u-m-l-10 u-m-t-2" :class="{rotate:!showAllGoods}">
|
||||
<up-icon name="arrow-down" size="14"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<template v-if="listinfo.id&&listinfo.status=='done'">
|
||||
<view class="cell-item" v-if="is_type != 0">
|
||||
@@ -328,7 +338,9 @@
|
||||
import {
|
||||
BigNumber
|
||||
} from "bignumber.js";
|
||||
|
||||
|
||||
|
||||
const showAllGoods=ref(false)
|
||||
let hasCouponCanUse = ref(false);
|
||||
|
||||
const usePoints = ref(false);
|
||||
@@ -852,6 +864,16 @@
|
||||
await getConsumeDiscount();
|
||||
getDiscountActivity();
|
||||
});
|
||||
|
||||
const nowCarts=computed(()=>{
|
||||
if(cartStore.allGoods.length<=0){
|
||||
return []
|
||||
}
|
||||
if(showAllGoods.value){
|
||||
return cartStore.allGoods
|
||||
}
|
||||
return cartStore.allGoods.slice(0,4)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -1587,4 +1609,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.guodu{
|
||||
transition:all .3s linear;
|
||||
padding-top: 2rpx;
|
||||
}
|
||||
.rotate{
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -148,8 +148,10 @@
|
||||
@click.stop="clickspecifications(item, index, index1)">
|
||||
<text class="t no-wrap" v-if="item.groupType == '1'">选择套餐</text>
|
||||
<text class="t" v-else>选规格</text>
|
||||
<!-- <text class="dot num"
|
||||
v-if="item.cartNumber > 0">{{ ifcartNumber(item) < 99 ? ifcartNumber(item) : '99+' }}</text> -->
|
||||
<text class="dot num"
|
||||
v-if="item.cartNumber > 0">{{ ifcartNumber(item) < 99 ? ifcartNumber(item) : '99+' }}</text>
|
||||
v-if="returnGoodsImCartNum(item)">{{ returnGoodsImCartNum(item) < 99 ? returnGoodsImCartNum(item) : '99+' }}</text>
|
||||
</view>
|
||||
<view class="Controls" v-else>
|
||||
<view class="btn" v-if="item.cartNumber != '0'">
|
||||
@@ -158,7 +160,10 @@
|
||||
<!-- <view class="btnClick"
|
||||
@tap.stop="$u.throttle(() => singleclick(item, '-'), 500)"></view> -->
|
||||
</view>
|
||||
<text class="num">{{ ifcartNumber(item) }}</text>
|
||||
<!-- <text class="num">{{ ifcartNumber(item) }}</text> -->
|
||||
|
||||
<text class="dot num"
|
||||
v-if="returnGoodsImCartNum(item1)">{{ returnGoodsImCartNum(item1) < 99 ? returnGoodsImCartNum(item1) : '99+' }}</text>
|
||||
<view class="btn">
|
||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
||||
<!-- <view class="btnClick"
|
||||
@@ -288,8 +293,11 @@
|
||||
@click.stop="clickspecifications(item1, index, index1)">
|
||||
<text class="t no-wrap" v-if="item1.groupType == '1'">选择套餐</text>
|
||||
<text class="t" v-else>选规格</text>
|
||||
<!-- <text class="dot num"
|
||||
v-if="item1.cartNumber > 0">{{ ifcartNumber(item1) < 99 ? ifcartNumber(item1) : '99+' }}</text> -->
|
||||
|
||||
<text class="dot num"
|
||||
v-if="item1.cartNumber > 0">{{ ifcartNumber(item1) < 99 ? ifcartNumber(item1) : '99+' }}</text>
|
||||
v-if="returnGoodsImCartNum(item1)">{{ returnGoodsImCartNum(item1) < 99 ? returnGoodsImCartNum(item1) : '99+' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="Controls" v-else>
|
||||
@@ -437,9 +445,39 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 推荐搭配 -->
|
||||
<view class="u-m-t-48 u-p-30">
|
||||
<view class="font-bold u-font-32 ">推荐搭配</view>
|
||||
<view class="u-flex recommand-goods">
|
||||
<view class=" item" v-for="(item,index) in 6" :key="index">
|
||||
<up-image width="210rpx" height="210rpx" radius="12rpx"></up-image>
|
||||
<view class="info">
|
||||
<view class="u-line-2 name u-m-t-10 u-font-32 font-500">
|
||||
商品名
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="font-bold">
|
||||
<text class="u-font-24">¥</text>
|
||||
<text class="u-font-32">40</text>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 占位 -->
|
||||
<view style="height: 42rpx;"></view>
|
||||
<view class="shop_bottom">
|
||||
<view class="flex-between">
|
||||
<view class="price price-sku"
|
||||
@@ -536,7 +574,17 @@
|
||||
<Loading :isLoading="!useSocket.isConnected" />
|
||||
<ModalList></ModalList>
|
||||
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
||||
<goodsModal></goodsModal>
|
||||
|
||||
<view
|
||||
v-for="(item,index) in goodsModalList" :key="index"
|
||||
>
|
||||
<goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs" @close="goodsModalClose(index)"
|
||||
@websocketsendMessage="websocketsendMessage"
|
||||
@modalAdd="modalAdd"
|
||||
:GoodsIDInCartNumMap="GoodsIDInCartNumMap"
|
||||
></goodsModal>
|
||||
</view>
|
||||
|
||||
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="updateShowPrveImg">
|
||||
</xbSwiperPreview>
|
||||
<!-- 显示选择人数popup -->
|
||||
@@ -594,7 +642,8 @@
|
||||
productminiApphotsquery,
|
||||
APIgroupquery,
|
||||
APIminiAppinfo,
|
||||
APIminiAppskuinfo
|
||||
APIminiAppskuinfo,
|
||||
productRelated
|
||||
} from '@/common/api/product/product.js';
|
||||
|
||||
import {
|
||||
@@ -700,6 +749,9 @@
|
||||
import {
|
||||
useCartStore
|
||||
} from '@/stores/order.js';
|
||||
import {
|
||||
computed
|
||||
} from 'vue';
|
||||
const cartStore = useCartStore();
|
||||
/**
|
||||
* store本地存储 end
|
||||
@@ -750,6 +802,8 @@
|
||||
/**
|
||||
* 通用数据合集 start
|
||||
*/
|
||||
const showGoodsModal = ref(false)
|
||||
|
||||
// 门店信息
|
||||
const shopInfo = reactive({});
|
||||
Object.assign(shopInfo, uni.cache.get('shopInfo'));
|
||||
@@ -804,6 +858,35 @@
|
||||
|
||||
|
||||
|
||||
|
||||
// 购物车对应的商品数
|
||||
const GoodsIDInCartNumMap = computed(() => {
|
||||
const map = {}
|
||||
for (let cart of cartStore.carts) {
|
||||
if (map[cart.product_id]) {
|
||||
map[cart.product_id] += cart.number * 1
|
||||
} else {
|
||||
map[cart.product_id] = cart.number * 1
|
||||
}
|
||||
|
||||
}
|
||||
return map
|
||||
})
|
||||
|
||||
/**
|
||||
* 返回购物车对应的商品数量
|
||||
*/
|
||||
function returnGoodsImCartNum(goods) {
|
||||
if(!goods){
|
||||
return 0
|
||||
}
|
||||
if (GoodsIDInCartNumMap.value.hasOwnProperty(goods.id)) {
|
||||
GoodsIDInCartNumMap.value[goods.id]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
// 获取商品数据
|
||||
const shopProductList = reactive({
|
||||
hots: [],
|
||||
@@ -1289,6 +1372,15 @@
|
||||
let res = await APIminiAppinfo(item.id);
|
||||
prveImgs(res.images);
|
||||
}
|
||||
|
||||
const goodsModalList=ref([])
|
||||
|
||||
function goodsModalClose(index){
|
||||
goodsModalList.value.splice(index,1)
|
||||
}
|
||||
function modalAdd(item){
|
||||
clickspecifications(item)
|
||||
}
|
||||
|
||||
//获取多规格数据
|
||||
const clickspecifications = async (item, index, indexs, type) => {
|
||||
@@ -1305,7 +1397,10 @@
|
||||
// }
|
||||
|
||||
if (item.isSoldStock == 1 || (item.isSaleTime == 0 && !item.isSaleTimeshow)) {
|
||||
return false;
|
||||
return uni.showToast({
|
||||
title:'商品已下架或不在可售时间内',
|
||||
icon:'none'
|
||||
});
|
||||
}
|
||||
|
||||
shopCartNumber.value = 0;
|
||||
@@ -1350,7 +1445,12 @@
|
||||
.filter(([_, value]) => value.length > 0));
|
||||
// 给默认数量
|
||||
specifications.item.amountcartNumber = 0;
|
||||
showShopsku.value = true;
|
||||
// showShopsku.value = true;
|
||||
goodsModalList.value.push({
|
||||
show:true,
|
||||
goods:specifications.item
|
||||
})
|
||||
// showGoodsModal.value=true
|
||||
};
|
||||
// 判断商品是否在可售时间内
|
||||
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
|
||||
@@ -3211,7 +3311,6 @@
|
||||
border-radius: 20rpx;
|
||||
background: #fff;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 200rpx;
|
||||
|
||||
.positionabsolute {
|
||||
position: absolute;
|
||||
@@ -3246,9 +3345,7 @@
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.shop_sku_box:last-child {
|
||||
padding-bottom: 140rpx;
|
||||
}
|
||||
|
||||
|
||||
.shop_sku_box {
|
||||
padding: 20rpx;
|
||||
@@ -3334,9 +3431,6 @@
|
||||
padding: 30rpx 28rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0rpx -6rpx 14rpx 2rpx rgba(0, 0, 0, 0.1);
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
|
||||
.price {
|
||||
display: flex;
|
||||
@@ -3712,4 +3806,31 @@
|
||||
font-size: 12px;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.recommand-goods {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 24rpx;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
width: 210rpx;
|
||||
|
||||
&:nth-child(3n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.name {
|
||||
height: 84rpx;
|
||||
}
|
||||
|
||||
.info {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -33,11 +33,11 @@ module.exports = defineConfig({
|
||||
],
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
'/testApi': {
|
||||
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
target: 'http://192.168.1.42/', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/api/, '')
|
||||
rewrite: path => path.replace(/^\/testApi/, '')
|
||||
},
|
||||
'/prodApi': {
|
||||
target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
|
||||
Reference in New Issue
Block a user