代理处理 首页处理
This commit is contained in:
parent
ede860cec3
commit
6cea5aeb42
|
|
@ -13,7 +13,6 @@ const proxyApi = "/api"
|
||||||
const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||||
const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上
|
const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
const baseUrl = debug ? proxyApi + '/cashierService' : "https://cashier.sxczgkj.cn/cashierService"
|
const baseUrl = debug ? proxyApi + '/cashierService' : "https://cashier.sxczgkj.cn/cashierService"
|
||||||
const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
|
const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ async function request(options) {
|
||||||
environment: 'app',
|
environment: 'app',
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
environment: 'h5',
|
environment: 'H5',
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
environment: 'wx',
|
environment: 'wx',
|
||||||
|
|
@ -57,8 +57,6 @@ async function request(options) {
|
||||||
token: uni.cache.get('token'),
|
token: uni.cache.get('token'),
|
||||||
openId: uni.cache.get('miniAppOpenId'),
|
openId: uni.cache.get('miniAppOpenId'),
|
||||||
id: uni.cache.get('userInfo').id,
|
id: uni.cache.get('userInfo').id,
|
||||||
loginName: "",
|
|
||||||
clientType: ''
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
@ -67,15 +65,6 @@ async function request(options) {
|
||||||
let res = await requestrequest(options);
|
let res = await requestrequest(options);
|
||||||
if (res.code != 0) {
|
if (res.code != 0) {
|
||||||
if (res.code == -4) {
|
if (res.code == -4) {
|
||||||
// uni.showToast({
|
|
||||||
// title: res.message || res.msg,
|
|
||||||
// icon: "none",
|
|
||||||
// success: () => {
|
|
||||||
// // setTimeout(res => {
|
|
||||||
// // store.dispatch("loginEvent"); //获取shapid
|
|
||||||
// // }, 1000)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
} else if (res.code == 482) {
|
} else if (res.code == 482) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
export function request(options) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.request({
|
||||||
|
url: uni.conf.baseUrl + options.url,
|
||||||
|
data: options.data || {},
|
||||||
|
method: options.method,
|
||||||
|
// 设置请求头,添加版本号
|
||||||
|
header: {
|
||||||
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
|
version: uni.conf.version,
|
||||||
|
type: uni.getSystemInfoSync().platform,
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
environment: 'app',
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
environment: 'h5',
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
environment: 'wx',
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-ALIPAY
|
||||||
|
environment: 'alipay',
|
||||||
|
// #endif
|
||||||
|
token: uni.cache.get('token'),
|
||||||
|
openId: uni.cache.get('miniAppOpenId'),
|
||||||
|
id: uni.cache.get('userInfo').id,
|
||||||
|
loginName: "",
|
||||||
|
},
|
||||||
|
success(res) {
|
||||||
|
const data = res.data || res;
|
||||||
|
// 根据项目返回的code判断
|
||||||
|
if (data.code != 0){
|
||||||
|
switch (data.code) {
|
||||||
|
case '200':
|
||||||
|
resolve(data.data);
|
||||||
|
break;
|
||||||
|
case '500':
|
||||||
|
uni.showToast({
|
||||||
|
title: data.message,
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
reject(false);
|
||||||
|
break;
|
||||||
|
case '400':
|
||||||
|
uni.showToast({
|
||||||
|
title: data.message,
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
// 跳转到登录页面等操作
|
||||||
|
reject(false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reject(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
resolve(data.data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
// 失败处理
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -67,28 +67,7 @@
|
||||||
"requiredPrivateInfos": ["getLocation", "onLocationChange", "chooseLocation", "chooseAddress"]
|
"requiredPrivateInfos": ["getLocation", "onLocationChange", "chooseLocation", "chooseAddress"]
|
||||||
},
|
},
|
||||||
"h5": {
|
"h5": {
|
||||||
"devServer": {
|
|
||||||
"https": false,
|
|
||||||
"disableHostCheck": false,
|
|
||||||
"proxy": {
|
|
||||||
"/api": {
|
|
||||||
// "target": "https://wxcashiertest.sxczgkj.cn",
|
|
||||||
// "target" : "https://ky.sxczgkj.cn",
|
|
||||||
"target": "https://cashier.sxczgkj.cn",
|
|
||||||
"ws": false,
|
|
||||||
"changeOrigin": true, //是否跨域
|
|
||||||
"secure": false, // 设置支持https协议的代理
|
|
||||||
"pathRewrite": {
|
|
||||||
"^/api": "" //需要rewrite重写的,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"template": "template.h5.html",
|
|
||||||
"router": {
|
|
||||||
"mode": "history",
|
|
||||||
"base": "/h5/"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"mp-alipay": {
|
"mp-alipay": {
|
||||||
"usingComponents": true
|
"usingComponents": true
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="onecontent flex-between">
|
<view class="onecontent flex-between">
|
||||||
<view class="onecontentleft">
|
<view class="onecontentleft" v-if="bannervo">
|
||||||
现有<text style="color: #FC851E;font-size: 24rpx;">
|
现有<text style="color: #FC851E;font-size: 24rpx;">
|
||||||
{{bannervo.coupons==null?116:bannervo.coupons}}人
|
{{bannervo.coupons==null?116:bannervo.coupons}}人
|
||||||
</text>
|
</text>
|
||||||
已免单
|
已免单
|
||||||
</view>
|
</view>
|
||||||
<view class="onecontentright flex-start">
|
<view class="onecontentright flex-start">
|
||||||
<view class="onecontentrightimage">
|
<view class="onecontentrightimage" v-if="bannervo">
|
||||||
<view class="swiperPanel" @touchstart="startMove" @touchend="endMove">
|
<view class="swiperPanel" @touchstart="startMove" @touchend="endMove">
|
||||||
<view class="swiperItem" v-for="(item, index) in bannervo.counponsInfo" :key="index"
|
<view class="swiperItem" v-for="(item, index) in bannervo.counponsInfo" :key="index"
|
||||||
:style="{transform: itemStyle[index].transform, zIndex: itemStyle[index].zIndex, opacity: itemStyle[index].opacity}">
|
:style="{transform: itemStyle[index].transform, zIndex: itemStyle[index].zIndex, opacity: itemStyle[index].opacity}">
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="fourcontent flex-between">
|
<view class="fourcontent flex-between" v-if="menu">
|
||||||
<view class="fourcontent_item flex-start" v-for="(item,index) in menu" :key="index"
|
<view class="fourcontent_item flex-start" v-for="(item,index) in menu" :key="index"
|
||||||
@click="viewHistorycategoryss(item,index)"
|
@click="viewHistorycategoryss(item,index)"
|
||||||
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
|
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="towcontent flex-between">
|
<view class="towcontent flex-between" v-if="district">
|
||||||
<view class="towcontent_item flex-colum" v-for="(item,index) in district" :key="index"
|
<view class="towcontent_item flex-colum" v-for="(item,index) in district" :key="index"
|
||||||
@click="clickdistrict(item,index)">
|
@click="clickdistrict(item,index)">
|
||||||
<image :src="item.coverImg" mode="aspectFill"></image>
|
<image :src="item.coverImg" mode="aspectFill"></image>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="viewswiper">
|
<view class="viewswiper" v-if="carousel">
|
||||||
<up-swiper :list="carousel" keyName="coverImg" @change="e => current = e.current" indicatorStyle="right: 20px" height='242'>
|
<up-swiper :list="carousel" keyName="coverImg" @change="e => current = e.current" indicatorStyle="right: 20px" height='242'>
|
||||||
<template #indicator>
|
<template #indicator>
|
||||||
<view class="indicator">
|
<view class="indicator">
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="therecontent flex-between">
|
<view class="therecontent flex-between" v-if="salesList">
|
||||||
<view class="therecontent_box_item">
|
<view class="therecontent_box_item">
|
||||||
<view class="therecontent_box_imge flex-between" @click="jrtoday(0)">
|
<view class="therecontent_box_imge flex-between" @click="jrtoday(0)">
|
||||||
<view class="therecontent_box_imge_text">
|
<view class="therecontent_box_imge_text">
|
||||||
|
|
@ -83,9 +83,15 @@
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
salesList: Object,
|
salesList: Object,
|
||||||
todayList: Object
|
todayList: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
name:'',
|
||||||
|
date:'',
|
||||||
|
hotList:[]
|
||||||
|
}) //
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const clickproduct = (item) => {
|
const clickproduct = (item) => {
|
||||||
uni.pro.navigateTo('product/index', {
|
uni.pro.navigateTo('product/index', {
|
||||||
id: item.id
|
id: item.id
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<Nav />
|
<Nav v-if="showindex == 'index'" />
|
||||||
<view class="content">
|
<view class="content" v-if="showindex == 'index'">
|
||||||
<!-- 轮播图 -->
|
<!-- 轮播图 -->
|
||||||
<swipers :carousel='hometoplist.carousel'></swipers>
|
<swipers :carousel='hometoplist.carousel'></swipers>
|
||||||
<!-- 广告 -->
|
<!-- 广告 -->
|
||||||
|
|
@ -100,25 +100,39 @@
|
||||||
<view class="indexboxitemleftthere_countdown flex-between">
|
<view class="indexboxitemleftthere_countdown flex-between">
|
||||||
<text class="indexboxitemleftthere_countdowntext">共省{{item.save}}元</text>
|
<text class="indexboxitemleftthere_countdowntext">共省{{item.save}}元</text>
|
||||||
<view class="indexboxitemleftthere_countdowntexts">
|
<view class="indexboxitemleftthere_countdowntexts">
|
||||||
<!-- <uni-countdown @timeup="updateCity" :show-day="false"
|
<up-count-down
|
||||||
:day="item.end_times.d" :hour="item.end_times.h"
|
:time="item.end_times.d * item.end_times.h * item.end_times.m *item.end_times.s"
|
||||||
:minute="item.end_times.m" :second="item.end_times.s" :indexs='index'
|
format="HH:mm:ss" autoStart millisecond @change="onChange">
|
||||||
color="#FFFFFF" border-color="#00B26A" splitorColor="#FFFFFF"
|
<view class="time">
|
||||||
:font-size="10"></uni-countdown> -->
|
<view class="time__custom">
|
||||||
|
<text
|
||||||
|
class="time__custom__item">{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}</text>
|
||||||
|
</view>
|
||||||
|
<text class="time__doc">:</text>
|
||||||
|
<view class="time__custom">
|
||||||
|
<text
|
||||||
|
class="time__custom__item">{{ timeData.minutes>10?timeData.minutes:'0'+timeData.minutes }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="time__doc">:</text>
|
||||||
|
<view class="time__custom">
|
||||||
|
<text
|
||||||
|
class="time__custom__item">{{ timeData.seconds>10?timeData.seconds:'0'+timeData.seconds }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</up-count-down>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<up-loadmore height='40' :status="formhomelist.status" iconSize='16' fontSize='16' />
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<up-loadmore height='40' :status="form.status" iconSize='16' fontSize='16' />
|
|
||||||
<!-- </scroll-view> -->
|
<!-- </scroll-view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- <indexs v-if="showindex == 'shopIndex'"></indexs> -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -133,6 +147,7 @@
|
||||||
onLoad,
|
onLoad,
|
||||||
onReady,
|
onReady,
|
||||||
onShow,
|
onShow,
|
||||||
|
onReachBottom,
|
||||||
onPageScroll
|
onPageScroll
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
import swipers from './components/swiper.vue' //引入轮播
|
import swipers from './components/swiper.vue' //引入轮播
|
||||||
|
|
@ -159,71 +174,8 @@
|
||||||
isTransparent: false,
|
isTransparent: false,
|
||||||
hasPlaceholder: false //是否要占位符
|
hasPlaceholder: false //是否要占位符
|
||||||
});
|
});
|
||||||
//数据
|
// 显示
|
||||||
const hometoplist = reactive({})
|
const showindex = ref('index')
|
||||||
// 首页抢购数据
|
|
||||||
const form = ref({
|
|
||||||
address: '', //地址
|
|
||||||
type: '', //品类
|
|
||||||
orderBy: '', //1.理我最近 2.销量优先 3.价格优先
|
|
||||||
other: '', //附近1KM 1选中 0不选中
|
|
||||||
page: 1, //页数
|
|
||||||
size: 10, //页容量
|
|
||||||
status: 'loadmore'
|
|
||||||
})
|
|
||||||
const homelist = ref([{
|
|
||||||
endRow: 1,
|
|
||||||
firstPage: 1,
|
|
||||||
hasNextPage: false,
|
|
||||||
hasPreviousPage: false,
|
|
||||||
isFirstPage: true,
|
|
||||||
isLastPage: true,
|
|
||||||
lastPage: 1,
|
|
||||||
list: [{
|
|
||||||
discount: 9,
|
|
||||||
distances: "1.1km",
|
|
||||||
districts: "未央区",
|
|
||||||
endTime: 1739059199999,
|
|
||||||
id: 661,
|
|
||||||
image: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240612/0c07e1f79a244ed498dfe4a70848c479.jpeg",
|
|
||||||
originPrice: 200,
|
|
||||||
proTag: [],
|
|
||||||
productName: "鸡尾酒套餐",
|
|
||||||
realSalesNumber: 0,
|
|
||||||
salePrice: 180,
|
|
||||||
save: 20,
|
|
||||||
shopImage: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240612/6f3618a31d2a4b489215647871ae732e.jpg",
|
|
||||||
shopName: "漫巷咖啡",
|
|
||||||
shopTag: [],
|
|
||||||
}],
|
|
||||||
discount: 9,
|
|
||||||
distances: "1.1km",
|
|
||||||
districts: "未央区",
|
|
||||||
endTime: 1739059199999,
|
|
||||||
id: 661,
|
|
||||||
image: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240612/0c07e1f79a244ed498dfe4a70848c479.jpeg",
|
|
||||||
originPrice: 200,
|
|
||||||
proTag: [],
|
|
||||||
productName: "鸡尾酒套餐",
|
|
||||||
realSalesNumber: 0,
|
|
||||||
salePrice: 180,
|
|
||||||
save: 20,
|
|
||||||
shopImage: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240612/6f3618a31d2a4b489215647871ae732e.jpg",
|
|
||||||
shopName: "漫巷咖啡",
|
|
||||||
shopTag: [],
|
|
||||||
navigateFirstPage: 1,
|
|
||||||
navigateLastPage: 1,
|
|
||||||
navigatePages: 8,
|
|
||||||
navigatepageNums: [1],
|
|
||||||
nextPage: 0,
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
pages: 1,
|
|
||||||
prePage: 0,
|
|
||||||
size: 1,
|
|
||||||
startRow: 1,
|
|
||||||
total: 1,
|
|
||||||
}])
|
|
||||||
//计算广告图片的重合尺寸是位移
|
//计算广告图片的重合尺寸是位移
|
||||||
const getStyle = (e) => {
|
const getStyle = (e) => {
|
||||||
if (e > hometoplist.bannerVO.counponsInfo.length / 2) {
|
if (e > hometoplist.bannerVO.counponsInfo.length / 2) {
|
||||||
|
|
@ -246,22 +198,102 @@
|
||||||
zIndex: 9999,
|
zIndex: 9999,
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}])
|
}])
|
||||||
// 广告数据
|
//数据
|
||||||
|
const hometoplist = reactive({})
|
||||||
|
// 首页上面数据
|
||||||
const hometop = async () => {
|
const hometop = async () => {
|
||||||
// try {
|
try {
|
||||||
let res = await API.homehomePageUp()
|
let res = await API.homehomePageUp()
|
||||||
console.log(res.data)
|
|
||||||
Object.assign(hometoplist, res.data)
|
Object.assign(hometoplist, res.data)
|
||||||
// hometoplist = Object.assign(res.data)
|
|
||||||
if (hometoplist.bannerVO.counponsInfo) {
|
if (hometoplist.bannerVO.counponsInfo) {
|
||||||
hometoplist.bannerVO.counponsInfo.forEach((item, index) => {
|
hometoplist.bannerVO.counponsInfo.forEach((item, index) => {
|
||||||
advertisementStyle.value.push(getStyle(index))
|
advertisementStyle.value.push(getStyle(index))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 计算swiper样式
|
} catch (e) {}
|
||||||
|
|
||||||
// } catch (e) {}
|
|
||||||
}
|
}
|
||||||
|
// 下面初始数据
|
||||||
|
const formhomelist = reactive({ //筛选
|
||||||
|
address: '', //地址
|
||||||
|
type: '', //品类
|
||||||
|
orderBy: '', //1.理我最近 2.销量优先 3.价格优先
|
||||||
|
other: '', //附近1KM 1选中 0不选中
|
||||||
|
page: 1, //页数
|
||||||
|
size: 10, //页容量
|
||||||
|
status: 'loadmore'
|
||||||
|
})
|
||||||
|
// 使用 reactive 创建响应式对象
|
||||||
|
const timeData = ref({});
|
||||||
|
|
||||||
|
// 定义 onChange 方法
|
||||||
|
const onChange = (e) => {
|
||||||
|
timeData.value = e;
|
||||||
|
};
|
||||||
|
const homelist = ref([]) //接收数据
|
||||||
|
const onLoadhome = async () => {
|
||||||
|
try {
|
||||||
|
let res = await API.home(formhomelist)
|
||||||
|
var dates = new Date().getTime();
|
||||||
|
res.data.list.forEach((item, index) => {
|
||||||
|
var leftTime = item.endTime - dates; //计算两日期之间相差的毫秒数
|
||||||
|
if (leftTime >= 0) {
|
||||||
|
let d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
|
||||||
|
let h = Math.floor(leftTime / 1000 / 60 / 60 % 24);
|
||||||
|
let m = Math.floor(leftTime / 1000 / 60 % 60);
|
||||||
|
let s = Math.floor(leftTime / 1000 % 60);
|
||||||
|
item.end_times = {
|
||||||
|
d: d,
|
||||||
|
h: h,
|
||||||
|
m: m,
|
||||||
|
s: s
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
item.end_times = 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (res.data.pages < formhomelist.page) {
|
||||||
|
formhomelist.status = 'nomore'
|
||||||
|
if (form.page == 1 && res.data.list.length == 0) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
formhomelist.status = 'loading';
|
||||||
|
formhomelist.page = ++formhomelist.page;
|
||||||
|
setTimeout(() => {
|
||||||
|
homelist.value = [...homelist.value, ...res.data.list];
|
||||||
|
formhomelist.status = 'loading';
|
||||||
|
if (res.data.pageNum == res.data.pages) {
|
||||||
|
formhomelist.status = 'nomore';
|
||||||
|
} else {
|
||||||
|
formhomelist.status = 'loading';
|
||||||
|
}
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
// /筛选数据处理
|
||||||
|
const init_fn = async () => {
|
||||||
|
homelist.value = []
|
||||||
|
Object.assign(formhomelist, {
|
||||||
|
address: uni.cache.get('getLocationstorage').address, //地址
|
||||||
|
lng: uni.cache.get('getLocationstorage').lng,
|
||||||
|
lat: uni.cache.get('getLocationstorage').lat,
|
||||||
|
type: '', //品类
|
||||||
|
orderBy: 0, //1.理我最近 2.销量优先 3.价格优先
|
||||||
|
other: '', //附近1KM 1选中 0不选中
|
||||||
|
page: 1, //页数
|
||||||
|
size: 10, //页容量
|
||||||
|
status: 'loadmore'
|
||||||
|
})
|
||||||
|
onLoadhome()
|
||||||
|
}
|
||||||
|
const updateCity = async (data) => {
|
||||||
|
console.log(data)
|
||||||
|
// this.list[data].end_times = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 存储每个元素距离顶部的距离
|
// 存储每个元素距离顶部的距离
|
||||||
const elementTop = ref(0);
|
const elementTop = ref(0);
|
||||||
// 存储是否吸顶的状态
|
// 存储是否吸顶的状态
|
||||||
|
|
@ -282,14 +314,70 @@
|
||||||
uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
|
uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
|
||||||
});
|
});
|
||||||
onShow(() => {})
|
onShow(() => {})
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
hometop()
|
// 获取初始定位高度
|
||||||
// 初始化
|
setTimeout(() => {
|
||||||
const query = uni.createSelectorQuery().select('#fourcontent');
|
const query = uni.createSelectorQuery().select('#fourcontent');
|
||||||
query.boundingClientRect((rect) => {
|
query.boundingClientRect((rect) => {
|
||||||
|
console.log(rect.top, 111)
|
||||||
elementTop.value = rect.top - store.height
|
elementTop.value = rect.top - store.height
|
||||||
}).exec();
|
}).exec();
|
||||||
|
}, 500)
|
||||||
|
// 查询是否有无内存
|
||||||
|
if (uni.cache.get('shopId') && uni.cache.get('token')) {
|
||||||
|
showindex.value = 'shopIndex'
|
||||||
|
uni.cache.set('types', 'index');
|
||||||
|
let res = await API.shopUserInfo({
|
||||||
|
"shopId": uni.cache.get('shopId'),
|
||||||
|
"userId": uni.cache.get('userInfo').id,
|
||||||
|
})
|
||||||
|
if (res.code == 0) {
|
||||||
|
shopUserInfo = res.data
|
||||||
|
// uni.cache.set('shopUserInfo', this.shopUserInfo)
|
||||||
|
}
|
||||||
|
if (uni.cache.get('forceUpdate') == 1) {
|
||||||
|
// this.forceUpdate = !this.forceUpdate;
|
||||||
|
}
|
||||||
|
// this.getShopExtend()
|
||||||
|
} else {
|
||||||
|
uni.getLocation({
|
||||||
|
type: 'wgs84',
|
||||||
|
success: async (res) => {
|
||||||
|
// console.log(res)
|
||||||
|
let successres = await API.geocodelocation({
|
||||||
|
lng: res.longitude,
|
||||||
|
lat: res.latitude,
|
||||||
|
})
|
||||||
|
if (successres.code == 0) {
|
||||||
|
let datastorage = {
|
||||||
|
country: successres.data.addressComponent.country, // "中国"
|
||||||
|
province: successres.data.addressComponent
|
||||||
|
.province, //province: "陕西省"
|
||||||
|
address: successres.data.addressComponent.city, //district: "西安市"
|
||||||
|
district: successres.data.addressComponent
|
||||||
|
.district, //district: "未央区"
|
||||||
|
lng: res.longitude,
|
||||||
|
lat: res.latitude,
|
||||||
|
}
|
||||||
|
uni.cache.set('getLocationstorage', datastorage);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: async (err) => {
|
||||||
|
showindex.value = 'index'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
hometop()
|
||||||
|
init_fn()
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
onReachBottom(() => {
|
||||||
|
onLoadhome()
|
||||||
|
})
|
||||||
|
onLoad(() => {
|
||||||
|
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
@ -549,6 +637,40 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 16rpx;
|
font-size: 16rpx;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
|
|
||||||
|
.time {
|
||||||
|
@include flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&__custom {
|
||||||
|
margin-top: 4rpx;
|
||||||
|
width: 22rpx;
|
||||||
|
height: 22rpx;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&__item {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 14rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__doc {
|
||||||
|
color: #fff;
|
||||||
|
padding: 0px 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__item {
|
||||||
|
color: #606266;
|
||||||
|
font-size: 15rpx;
|
||||||
|
margin-right: 4rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,201 @@
|
||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<view class="contentbox" :style="'background:url('+(shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png')+') no-repeat center center / cover' ">
|
||||||
|
<view class="contentboxitem flex-between">
|
||||||
|
<view class="contentboxitemleft flex-colum" @click="scanCodehandle(0)">
|
||||||
|
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xdiancan.png" mode="aspectFill">
|
||||||
|
</image>
|
||||||
|
<text class="contentboxitemlefttextone">点餐</text>
|
||||||
|
<text class="contentboxitemlefttexttow">在线点不排队</text>
|
||||||
|
</view>
|
||||||
|
<view class="contentboxitemright">
|
||||||
|
<view class="contentboxitemright_item flex-between" @click="memberindex('member/memberdetails')">
|
||||||
|
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xvip.png" mode="aspectFill">
|
||||||
|
</image>
|
||||||
|
<view class="contentboxitemright_itembox flex-colum">
|
||||||
|
<text>会员</text>
|
||||||
|
<text>入会享权益</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="contentboxitemright_item flex-between" @click="memberindex('member/index')">
|
||||||
|
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xchong.png"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
<view class="contentboxitemright_itembox flex-colum">
|
||||||
|
<text>充值</text>
|
||||||
|
<text>充值享更多优惠</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
userInfo: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
shopUserInfo: {
|
||||||
|
type: Object,
|
||||||
|
default () {
|
||||||
|
return {
|
||||||
|
amount: '',
|
||||||
|
shopName: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
shopExtend: {
|
||||||
|
type: Object,
|
||||||
|
default () {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.userInfo = uni.cache.get('userInfo');
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
scanCodehandle(i) {
|
||||||
|
setTimeout(()=>{
|
||||||
|
uni.cache.set('forceUpdate',2)
|
||||||
|
},200)
|
||||||
|
uni.scanCode({
|
||||||
|
success: async (res) => {
|
||||||
|
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
|
||||||
|
uni.cache.set('tableCode', tableCode)
|
||||||
|
if (tableCode) {
|
||||||
|
let data = await this.api.productqueryShop({
|
||||||
|
code: uni.cache.get('tableCode'),
|
||||||
|
})
|
||||||
|
console.log()
|
||||||
|
|
||||||
|
if ( data.data.shopTableInfo && !data.data.shopTableInfo.choseCount ) {
|
||||||
|
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
||||||
|
tableCode: tableCode,
|
||||||
|
shopId: data.data.storeInfo.id,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.pro.navigateTo('order_food/order_food', {
|
||||||
|
tableCode: tableCode,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
memberindex(url) {
|
||||||
|
uni.pro.navigateTo(url, {
|
||||||
|
shopId: uni.cache.get('shopId'),
|
||||||
|
type: 'index',
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
getQueryString(url, name) { //解码
|
||||||
|
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||||
|
var r = url.substr(1).match(reg)
|
||||||
|
if (r != null) {
|
||||||
|
return r[2]
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
page {
|
||||||
|
background: #F6F8FA;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
.contentbox {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 1046rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
|
||||||
|
.contentboxitem {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 90%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 50%);
|
||||||
|
padding: 38rpx 0 26rpx 0;
|
||||||
|
background: rgba(255, 255, 255, 0.98);
|
||||||
|
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
|
||||||
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||||
|
|
||||||
|
.contentboxitemleft {
|
||||||
|
width: 50%;
|
||||||
|
border-right: 2rpx solid #623618;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 134rpx;
|
||||||
|
height: 134rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentboxitemlefttextone {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentboxitemlefttexttow {
|
||||||
|
margin-top: 2rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentboxitemright {
|
||||||
|
width: 50%;
|
||||||
|
padding: 0 34rpx;
|
||||||
|
|
||||||
|
.contentboxitemright_item:nth-child(2) {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentboxitemright_item {
|
||||||
|
image {
|
||||||
|
width: 96rpx;
|
||||||
|
height: 96rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentboxitemright_itembox {
|
||||||
|
width: 170rpx;
|
||||||
|
|
||||||
|
text:nth-child(1) {
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
text:nth-child(2) {
|
||||||
|
margin-top: 2rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
import {
|
||||||
|
defineConfig
|
||||||
|
} from 'vite';
|
||||||
|
import uni from '@dcloudio/vite-plugin-uni';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [uni()],
|
||||||
|
server: {
|
||||||
|
hmr: true,
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'https://cashier.sxczgkj.cn',
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: path => path.replace(/^\/api/, ''),
|
||||||
|
secure: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
Loading…
Reference in New Issue