前端小程序

这个提交包含在:
可乐加冰
2026-09-14 17:24:53 +08:00
父节点 bb69a43a0f
当前提交 019630f12c
共有 2629 个文件被更改,包括 403657 次插入 和 0 次删除

查看文件

@@ -0,0 +1,8 @@
<template>
<!-- 缺省页 -->
<shopro-empty :image="$IMG_URL + '/imgs/empty/template_empty.png'" tipText="404,页面走丢了~" btnText="去首页逛逛" @click="$Router.pushTab('/pages/index/index')"></shopro-empty>
</template>
<script></script>
<style></style>

查看文件

@@ -0,0 +1,55 @@
<!-- 客服兼容 -->
<template>
<view class="chat-template-box" v-if="showChat">
<Chat v-if="isShoproChat"></Chat>
<Wm v-if="!isShoproChat" :options="kefuOptions"></Wm>
</view>
</template>
<script>
import {
mapMutations,
mapActions,
mapState,
mapGetters
} from "vuex";
import Chat from "./shopro/index.vue";
import Wm from "./wm/index.vue";
export default {
components: {
Chat,
Wm
},
data() {
return {
isShoproChat: false,
kefuOptions: null,
showChat: false
};
},
computed: {
...mapGetters(["initAddons", "initChat"])
},
onLoad(options) {
this.kefuOptions = options;
//判断客服;
if (this.initChat && this.initChat.type === "shopro") {
this.isShoproChat = true;
} else {
if (this.initAddons.length && this.initAddons.includes("kefu")) {
this.isShoproChat = false;
}
}
this.showChat = true;
},
methods: {}
};
</script>
<style lang="scss">
.chat-template-box {
height: 100%;
width: 100%;
overflow: hidden;
}
</style>

查看文件

@@ -0,0 +1,161 @@
/**
* shopro
* 聊天配置,socket服务相关,心跳检测和重连
*/
/**
* socket
* @param {Object} config - 初始化配置对象
* @param {Number} wait = [10000] - 心跳频率
*/
import {
BASE_URL
} from '@/env.js'
const service = BASE_URL.split('://')[1].split(':')[0];
export default class Socket {
constructor(initData, callback) {
let {
ping,
is_ssl,
gateway_port,
ssl_type
} = initData;
let url = `${is_ssl?'wss':'ws'}://${service}:${gateway_port}/`
if (is_ssl && ssl_type === 'reverse_proxy') {
url = `wss://${service}/websocket/`
}
this.config = {
url: url,
session_id: uni.getStorageSync('chatSessionId'),
token: uni.getStorageSync('token'),
identify: 'user'
};
this.callback = callback; //onmsg回调
this.timeoutObj = null; //心跳检测定时器对象
this.lockReconnect = false; //检测次数锁
this.isClose = false; //链接断开
this.timer = null; // 检测定时器
this.limit = 0; //检测次数,默认最大12
this.timout = ping;
uni.setStorageSync('isSocketOpen', false)
this.init()
}
// 初始化
async init() {
await this.connect();
}
// 连接
async connect() {
if (!uni.getStorageSync('isSocketOpen')) {
let [error, res] = await uni.connectSocket({
url: `${this.config.url}?identify=${this.config.identify}&token=${this.config.token}&session_id=${this.config.session_id}`
});
if (res.errMsg === 'connectSocket:ok') {
this.initEventHandle();
}
}
}
// 发送消息
async send(msg = "") {
if (uni.getStorageSync('isSocketOpen')) {
let [error, res] = await uni.sendSocketMessage({
data: msg
});
return Promise.resolve(res);
}
}
// 监听消息
onMsg() {
uni.onSocketMessage(res => {
if (res.code === 1 && res.type === 'init') {
this.config.session_id = res.data.session_id;
}
this.callback(res)
});
}
// 关闭连接
close() {
uni.closeSocket();
uni.removeStorage({
key: 'isSocketOpen',
success: (res) => {
console.log('移除isSocketOpensuccess');
}
});
clearTimeout(this.timer);
clearTimeout(this.timeoutObj);
}
//心跳检测
start() {
clearTimeout(this.timeoutObj);
this.timeoutObj = setTimeout(() => {
let obj = {
type: 'ping'
};
let objStr = JSON.stringify(obj)
uni.sendSocketMessage({
data: objStr,
});
this.start()
}, this.timout)
}
// 监听事件集
initEventHandle() {
// 监听打开
uni.onSocketOpen(res => {
uni.setStorageSync('isSocketOpen', true)
console.log('连接成功!');
this.lockReconnect = true;
this.isClose = false;
this.start()
});
// 监听消息
this.onMsg()
// 监听错误
uni.onSocketError(err => {
console.log('连接错误', err);
uni.closeSocket();
});
// 监听关闭
uni.onSocketClose(res => {
console.log('关闭链接');
this.isClose = true;
if (uni.getStorageSync('isSocketOpen')) {
this.lockReconnect = false
this.reconnect()
}
});
}
// 重连
reconnect() {
if (this.lockReconnect) return;
clearTimeout(this.timer)
if (this.limit < 12) {
this.timer = setTimeout(() => {
console.log('重连中', this.limit);
this.init();
this.reconnect()
}, 5000);
this.limit += 1
}
}
}

查看文件

@@ -0,0 +1,185 @@
.bg-gradual-purple {
background-image: linear-gradient(180deg, #0A2463 0%, #1E3A8A 40%, #F5F7FA 100%);
color: #ffffff;
}
.bg-white {
background-color: #ffffff;
color: #666666;
}
.round {
border-radius: 5000upx;
}
/* ==================
聊天
==================== */
.cu-avatar {
font-variant: small-caps;
margin: 0;
padding: 0;
display: inline-flex;
text-align: center;
justify-content: center;
align-items: center;
background-color: #ccc;
color: #ffffff;
white-space: nowrap;
position: relative;
width: 64upx;
height: 64upx;
background-size: cover;
background-position: center;
vertical-align: middle;
font-size: 1.5em;
}
.cu-bar {
display: flex;
position: relative;
align-items: center;
min-height: 100upx;
justify-content: space-between;
background-color: #fff;
}
.cu-bar .action {
display: flex;
align-items: center;
height: 100%;
justify-content: center;
max-width: 100%;
}
.cu-bar.foot {
position: fixed;
width: 100%;
bottom: 0;
z-index: 1024;
box-shadow: 0 -1upx 6upx rgba(0, 0, 0, 0.1);
}
.cu-chat {
display: flex;
flex-direction: column;
}
.cu-chat .cu-item {
display: flex;
padding: 30upx 30upx 70upx;
position: relative;
}
.cu-chat .cu-item > .cu-avatar {
width: 80upx;
height: 80upx;
}
.cu-chat .cu-item > .main {
max-width: calc(100% - 260upx);
margin: 0 40upx;
display: flex;
align-items: center;
}
.cu-chat .cu-item > image {
height: 320upx;
}
.cu-chat .cu-item > .main .content {
padding: 20upx;
border-radius: 6upx;
display: inline-flex;
max-width: 100%;
align-items: center;
font-size: 30upx;
position: relative;
min-height: 80upx;
line-height: 40upx;
text-align: left;
}
.cu-chat .cu-item > .main .content:not([class*='bg-']) {
background-color: #ffffff;
color: #333333;
}
.cu-chat .cu-item .date {
position: absolute;
font-size: 24upx;
color: #8799a3;
width: calc(100% - 320upx);
bottom: 20upx;
left: 160upx;
}
.cu-chat .cu-item .action {
padding: 0 30upx;
display: flex;
align-items: center;
}
.cu-chat .cu-item > .main .content::after {
content: '';
top: 27upx;
transform: rotate(45deg);
position: absolute;
z-index: 100;
display: inline-block;
overflow: hidden;
width: 24upx;
height: 24upx;
left: -12upx;
right: initial;
background-color: inherit;
}
.cu-chat .cu-item.self > .main .content::after {
left: auto;
right: -12upx;
}
.cu-chat .cu-item > .main .content::before {
content: '';
top: 30upx;
transform: rotate(45deg);
position: absolute;
z-index: -1;
display: inline-block;
overflow: hidden;
width: 24upx;
height: 24upx;
left: -12upx;
right: initial;
background-color: inherit;
filter: blur(5upx);
opacity: 0.3;
}
.cu-chat .cu-item > .main .content:not([class*='bg-'])::before {
background-color: #333333;
opacity: 0.1;
}
.cu-chat .cu-item.self > .main .content::before {
left: auto;
right: -12upx;
}
.cu-chat .cu-item.self {
justify-content: flex-end;
text-align: right;
}
.cu-chat .cu-info {
display: inline-block;
margin: 20upx auto;
font-size: 24upx;
padding: 8upx 12upx;
background-color: rgba(0, 0, 0, 0.2);
border-radius: 6upx;
color: #ffffff;
max-width: 400upx;
line-height: 1.4;
}

文件差异内容过多而无法显示 加载差异

查看文件

@@ -0,0 +1,131 @@
import {
BASE_URL
} from '@/env.js'
const expression = [{
'title': '[zy]',
'src': '/emoji/1.png'
}, {
'title': '[zm]',
'src': '/emoji/2.png'
}, {
'title': '[jy]',
'src': '/emoji/3.png'
},
{
'title': '[jyb]',
'src': '/emoji/4.png'
}, {
'title': '[bx]',
'src': '/emoji/5.png'
}, {
'title': '[kzn]',
'src': '/emoji/6.png'
},
{
'title': '[gg]',
'src': '/emoji/7.png'
}, {
'title': '[ll]',
'src': '/emoji/8.png'
}, {
'title': '[jyll]',
'src': '/emoji/9.png'
},
{
'title': '[o]',
'src': '/emoji/10.png'
}, {
'title': '[yz]',
'src': '/emoji/11.png'
}, {
'title': '[wx]',
'src': '/emoji/12.png'
},
{
'title': '[zyb]',
'src': '/emoji/13.png'
}, {
'title': '[tp]',
'src': '/emoji/14.png'
}, {
'title': '[wxb]',
'src': '/emoji/15.png'
},
{
'title': '[zyc]',
'src': '/emoji/16.png'
}, {
'title': '[llb]',
'src': '/emoji/17.png'
}, {
'title': '[xm]',
'src': '/emoji/18.png'
},
{
'title': '[qz]',
'src': '/emoji/19.png'
}, {
'title': '[zmb]',
'src': '/emoji/20.png'
}, {
'title': '[kx]',
'src': '/emoji/21.png'
},
{
'title': '[mm]',
'src': '/emoji/22.png'
}, {
'title': '[bz]',
'src': '/emoji/23.png'
}, {
'title': '[bkx]',
'src': '/emoji/24.png'
},
{
'title': '[mg]',
'src': '/emoji/25.png'
}, {
'title': '[pz]',
'src': '/emoji/26.png'
}, {
'title': '[pzb]',
'src': '/emoji/27.png'
},
{
'title': '[wxc]',
'src': '/emoji/28.png'
}, {
'title': '[jyc]',
'src': '/emoji/29.png'
}, {
'title': '[jyd]',
'src': '/emoji/30.png'
},
{
'title': '[dm]',
'src': '/emoji/31.png'
}, {
'title': '[tpb]',
'src': '/emoji/32.png'
}, {
'title': '[tpc]',
'src': '/emoji/33.png'
},
{
'title': '[tpd]',
'src': '/emoji/34.png'
}, {
'title': '[ly]',
'src': '/emoji/35.png'
}, {
'title': '[zyd]',
'src': '/emoji/36.png'
},
];
let service = BASE_URL.split('://')[1].split(':')[0];
export default {
baseURL: service, // dev.7wpp.com 启动workerman服务的域名,无需填写协议和端口
https_switch: false, // 是否启用https协议(默认关,正式版必开,且需要参考文档创建wss服务)
expression
}

文件差异内容过多而无法显示 加载差异

查看文件

@@ -0,0 +1,67 @@
<!-- 常见问题 -->
<template>
<view class="faq-box u-p-30">
<u-collapse event-type="close" :arrow="true" :accordion="true" arrowColor="#333" :headStyle="headStyle" :itemStyle="itemStyle">
<u-collapse-item :title="index + 1 + '、' + item.title" v-for="(item, index) in faqList" :key="index">
<rich-text :nodes="item.content"></rich-text>
</u-collapse-item>
</u-collapse>
<!-- 更多 -->
<u-loadmore v-if="faqList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
</view>
</template>
<script>
export default {
components: {},
data() {
return {
headStyle: {
color: '#1677FF'
},
itemStyle: {
borderBottom: '1rpx solid #EEEEEE',
padding: '20rpx 0'
},
faqList: [],
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1
};
},
computed: {},
onLoad() {
this.getFaqList();
// 触底监听
uni.$on('uOnReachBottom', () => {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getFaqList();
}
});
},
methods: {
// 常见问题列表、
getFaqList() {
let that = this;
that.loadStatus = 'loading';
that.$http('other.faqList', {
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.faqList = [...that.faqList, ...res.data.data];
that.lastPage = res.data.last_page;
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
}
});
}
}
};
</script>
<style lang="scss">
.faq-box{
background-color: #fff;
}
</style>

查看文件

@@ -0,0 +1,217 @@
<!-- 问题反馈 -->
<template>
<u-form :model="model" ref="uForm">
<view class="feedback-wrap u-p-30">
<!-- 选择类型 -->
<u-form-item label-position="top" :border-bottom="false" :labelStyle="labelStyle" label="请选择类型" prop="type"
label-width="150">
<u-radio-group v-model="model.type" width="100%" active-color="#1677FF">
<u-radio shape="circle" v-for="(item, index) in typeList" :key="index"
:name="item.code">{{ item.name }}</u-radio>
</u-radio-group>
</u-form-item>
<!-- 相关描述 -->
<view class="form-item">
<label>
<view class="inp-title">相关描述</view>
<view class="area-box">
<textarea class="inp-area" v-model="model.content" name="message"
placeholder="客官~您对我们的服务还满意吗,请给予我们你的意见我们将做的更好~" placeholder-class="pl-style" />
<view class="img-box">
<u-upload :showProgress="false" @on-uploaded="uploadSuccess" @on-remove="uploadRemove"
:action="`${$API_URL}index/upload`" width="140" height="140" maxCount="9"></u-upload>
</view>
</view>
</label>
</view>
<!-- 联系方式 -->
<view class="form-item">
<label>
<view class="inp-title">联系方式</view>
<input class="inp" v-model="model.phone" name="phone" type="number" placeholder="请输入您的联系电话"
placeholder-class="pl-style" />
</label>
</view>
<!-- 底部按钮 -->
<view class="foot_box u-flex u-row-between u-col-center">
<button class="u-reset-button post-btn" @tap="addFeedback">提交</button>
<!-- <button class="u-reset-button contact-btn" @tap="onService">联系客服</button> -->
</view>
</view>
</u-form>
</template>
<script>
export default {
components: {},
data() {
return {
model: {
type: '',
content: '',
phone: '',
images: []
},
labelStyle: {
'font-size': '30rpx',
'font-weight': '600',
color: '#333'
},
imgList: [], //图片
typeList: [] //类型列表
};
},
computed: {},
onLoad() {
this.getFeedbackType();
},
methods: {
// 跳转客服
onService() {
this.$Router.push('/pages/public/chat/index');
},
// 获取意见分类
getFeedbackType() {
let that = this;
that.$http('other.feedbackType').then(res => {
if (res.code === 1) {
that.typeList = res.data;
}
});
},
// 上传图片成功
uploadSuccess(e) {
this.model.images = [];
e.forEach(item => {
this.model.images.push(item.response.data.url);
});
},
// 移除图片
uploadRemove(index) {
this.model.images.splice(index, 1);
},
// 提交意见
addFeedback() {
let that = this;
that.$http('other.feedbackAdd', that.model, '提交中...').then(res => {
uni.hideKeyboard();
if (res.code === 1) {
that.$u.toast('提交成功');
that.$Router.back();
}
});
}
}
};
</script>
<style lang="scss">
.feedback-wrap {
background: #fff;
}
.form-item {
margin-top: 30rpx;
.inp-title {
font-size: 30rpx;
font-weight: bold;
color: rgba(51, 51, 51, 1);
align-items: center;
margin-bottom: 30rpx;
}
.inp {
width: 690rpx;
height: 84rpx;
background: rgba(249, 250, 251, 1);
border-radius: 20rpx;
padding: 0 30rpx;
font-size: 26rpx;
font-weight: 500;
color: #333;
margin-bottom: 38rpx;
}
.area-inp {
height: 190upx;
padding: 30rpx;
}
.pl-style {
font-size: 26rpx;
color: rgba(177, 179, 199, 1);
}
}
.area-box {
width: 690rpx;
min-height: 306rpx;
background: rgba(249, 250, 251, 1);
border-radius: 20rpx;
padding: 20rpx;
.pl-style {
font-size: 26rpx;
font-weight: 500;
color: rgba(177, 179, 199, 1);
line-height: 50rpx;
}
.inp-area {
font-size: 26rpx;
font-weight: 500;
color: #333;
line-height: 50rpx;
width: 100%;
}
.img-box {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-top: 20rpx;
}
}
// 底部按钮
.foot_box {
height: 100rpx;
width: 100%;
margin-top: 100rpx;
.contact-btn {
width: 340rpx;
line-height: 74rpx;
background: linear-gradient(90deg, rgba(103, 104, 105, 1), rgba(82, 82, 82, 1));
box-shadow: 0px 2rpx 5rpx 0px rgba(102, 103, 104, 0.46);
border-radius: 35rpx;
font-size: 28rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
.post-btn {
width: 340rpx;
line-height: 74rpx;
background: linear-gradient(90deg, #1677FF, #4096FF);
box-shadow: 0px 7rpx 6rpx 0rpx rgba(229, 138, 0, 0.22);
border-radius: 37rpx;
font-size: 28rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
}
</style>

查看文件

@@ -0,0 +1,39 @@
<template>
<view></view>
</template>
<script>
import store from '@/shopro/store';
import { mapMutations, mapActions, mapState } from 'vuex';
export default {
data() {
return {};
},
async onLoad(options) {
// #ifdef H5
// 检测H5登录回调
if (options?.token) {
let that = this;
uni.showLoading({
title: '登录中...'
});
await that.getUserInfo(options.token);
let lastPage = uni.getStorageSync('lastPage');
if (lastPage) {
uni.removeStorageSync('lastPage');
window.location = lastPage;
} else {
uni.switchTab({
url: '/'
});
}
}
// #endif
},
methods: {
...mapActions(['getUserInfo'])
}
};
</script>
<style></style>

查看文件

@@ -0,0 +1,82 @@
<template>
<view class="notice-detail">
<view class="notice-detail__head" v-if="detail.title">
<text class="notice-detail__title">{{ detail.title }}</text>
<text class="notice-detail__meta" v-if="detail.create_time">{{ detail.create_time }}</text>
</view>
<view class="notice-detail__body">
<u-parse v-if="detail.content" :html="detail.content"></u-parse>
<shopro-empty v-else tipText="暂无公告内容"></shopro-empty>
</view>
</view>
</template>
<script>
import { BASE_URL } from '@/env';
export default {
data() {
return {
detail: {}
};
},
onLoad() {
this.$Route.query.id && this.getDetail();
},
methods: {
getDetail() {
uni.showLoading({ title: '加载中...', mask: true });
uni.request({
url: `${BASE_URL}/api/notice/detail`,
method: 'GET',
data: { id: this.$Route.query.id },
complete: () => {
uni.hideLoading();
},
success: res => {
const body = res.data || {};
if (body.code === 1 && body.data && body.data.detail) {
this.detail = body.data.detail;
uni.setNavigationBarTitle({
title: '公告详情'
});
}
}
});
}
}
};
</script>
<style lang="scss">
.notice-detail {
min-height: 100vh;
background: $brand-page-bg;
}
.notice-detail__head {
padding: 32rpx $brand-page-gutter 24rpx;
background: #ffffff;
}
.notice-detail__title {
display: block;
font-size: 34rpx;
font-weight: 700;
color: $brand-text;
line-height: 1.45;
}
.notice-detail__meta {
display: block;
margin-top: 12rpx;
font-size: 24rpx;
color: $brand-text-muted;
}
.notice-detail__body {
margin-top: 16rpx;
padding: 32rpx $brand-page-gutter;
background: #ffffff;
}
</style>

查看文件

@@ -0,0 +1,43 @@
<!-- 富文本 -->
<template>
<view class="rich-wrap">
<view class="content_box"><u-parse :html="richText.content"></u-parse></view>
</view>
</template>
<script>
import Auth from '@/shopro/permission/index.js';
export default {
components: {},
data() {
return {
richText: ''
};
},
computed: {},
onLoad() {
this.$Route.query.id && this.getRichText();
},
methods: {
getRichText() {
this.$http('common.richText', {
id: this.$Route.query.id
}).then(res => {
if (res.code === 1) {
this.richText = res.data;
uni.setNavigationBarTitle({
title: res.data.title
});
}
});
}
}
};
</script>
<style lang="scss">
.content_box {
background: #fff;
padding: 30rpx;
}
</style>

查看文件

@@ -0,0 +1,359 @@
<template>
<view class="search-page">
<!-- 搜索栏 -->
<view class="search-page__head">
<u-search
v-model="searchVal"
:focus="autoFocus"
margin="0"
placeholder="搜索臻选好酒"
height="72"
bg-color="#FFFFFF"
border-color="#EEEEEE"
color="#2C2C2C"
placeholder-color="#999999"
action-text="搜索"
:action-style="searchActionStyle"
:input-style="searchInputStyle"
@search="onSearch"
@custom="onSearch"
@clear="clearSearch"
></u-search>
</view>
<scroll-view scroll-y class="search-page__body">
<!-- 空态引导(无历史时) -->
<view v-if="!historyTag.length" class="search-empty">
<view class="search-empty__icon-wrap">
<u-icon name="search" size="44" color="#1677FF"></u-icon>
</view>
<text class="search-empty__title">发现臻选好酒</text>
<text class="search-empty__desc">输入关键词,或点击下方热门搜索快速查找</text>
</view>
<!-- 热门搜索 -->
<view class="search-section">
<view class="search-section__head">
<view class="search-section__title-wrap">
<u-icon name="tags-fill" size="32" color="#1677FF"></u-icon>
<text class="search-section__title">热门搜索</text>
</view>
</view>
<view class="search-tags">
<button
v-for="(item, index) in hotKeywords"
:key="index"
class="search-tag search-tag--hot u-reset-button"
hover-class="search-tag--pressed"
@tap="onSearch(item)"
>
<text v-if="index < 3" class="search-tag__badge">热</text>
<text class="search-tag__text u-ellipsis-1">{{ item }}</text>
</button>
</view>
</view>
<!-- 快捷分类 -->
<view class="search-section">
<view class="search-section__head">
<view class="search-section__title-wrap">
<u-icon name="grid-fill" size="32" color="#1677FF"></u-icon>
<text class="search-section__title">快捷分类</text>
</view>
</view>
<view class="search-quick">
<view
v-for="(item, index) in quickCategories"
:key="index"
class="search-quick__item"
hover-class="search-quick__item--pressed"
@tap="onQuickSearch(item)"
>
<text class="search-quick__label">{{ item.label }}</text>
<u-icon name="arrow-right" size="24" color="#CCCCCC"></u-icon>
</view>
</view>
</view>
<!-- 搜索历史 -->
<view v-if="historyTag.length" class="search-section">
<view class="search-section__head">
<view class="search-section__title-wrap">
<u-icon name="clock-fill" size="32" color="#999999"></u-icon>
<text class="search-section__title">搜索历史</text>
</view>
<button class="search-section__action u-reset-button" hover-class="search-section__action--pressed" @tap="showModal = true">
<u-icon name="trash" size="28" color="#999999"></u-icon>
<text>清空</text>
</button>
</view>
<view class="search-tags">
<button
v-for="(item, index) in historyTag"
:key="index"
class="search-tag search-tag--history u-reset-button"
hover-class="search-tag--pressed"
@tap="onSearch(item)"
>
<text class="search-tag__text u-ellipsis-1">{{ item }}</text>
</button>
</view>
</view>
<view class="search-page__safe-bottom"></view>
</scroll-view>
<u-modal
ref="uModal"
v-model="showModal"
:show-cancel-button="true"
confirm-color="#1677FF"
cancel-color="#666666"
@confirm="clearSearchHistory"
confirm-text="清除"
cancel-text="取消"
content="是否清除历史搜索记录?"
title="提示"
></u-modal>
</view>
</template>
<script>
const HOT_KEYWORDS = ['雄戈小酒', '礼盒装', '品鉴装', '酱香型', '单瓶装', '商务宴请'];
export default {
data() {
return {
searchVal: '',
historyTag: [],
showModal: false,
autoFocus: true,
hotKeywords: HOT_KEYWORDS,
quickCategories: [
{ label: '雄戈系列', keyword: '雄戈系列' },
{ label: '白酒', keyword: '白酒' },
{ label: '礼盒装', keyword: '礼盒装' },
{ label: '品鉴装', keyword: '品鉴装' },
{ label: '单瓶装', keyword: '单瓶装' },
{ label: '商务宴请', keyword: '商务宴请' }
],
searchActionStyle: {
color: '#1677FF',
fontSize: '28rpx',
fontWeight: '600',
width: '100rpx'
},
searchInputStyle: {
fontSize: '28rpx'
}
};
},
onShow() {
this.historyTag = uni.getStorageSync('searchHistoryArr') ? JSON.parse(uni.getStorageSync('searchHistoryArr')) : [];
},
methods: {
onSearch(keyword) {
const kw = (typeof keyword === 'string' ? keyword : this.searchVal).trim();
if (!kw) {
uni.showToast({ title: '请输入搜索关键词', icon: 'none' });
return;
}
if (!this.historyTag.includes(kw)) {
const next = [kw, ...this.historyTag].slice(0, 10);
this.historyTag = next;
uni.setStorageSync('searchHistoryArr', JSON.stringify(next));
}
this.$Router.push({
path: '/pages/goods/list',
query: { keywords: kw }
});
this.searchVal = '';
},
onQuickSearch(item) {
this.onSearch(item.keyword);
},
clearSearch() {
this.searchVal = '';
},
clearSearchHistory() {
this.historyTag = [];
uni.removeStorageSync('searchHistoryArr');
}
}
};
</script>
<style lang="scss" scoped>
.search-page {
min-height: 100vh;
background: $brand-page-bg;
display: flex;
flex-direction: column;
}
.search-page__head {
padding: $brand-page-gutter;
padding-bottom: 16rpx;
background: $brand-page-bg;
position: sticky;
top: 0;
z-index: 10;
}
.search-page__body {
flex: 1;
height: 0;
padding: 0 $brand-page-gutter;
box-sizing: border-box;
}
.search-page__safe-bottom {
height: calc(env(safe-area-inset-bottom) + 32rpx);
}
.search-empty {
@include brand-card;
padding: 48rpx 32rpx;
margin-bottom: $brand-section-gap;
text-align: center;
}
.search-empty__icon-wrap {
width: 96rpx;
height: 96rpx;
margin: 0 auto 24rpx;
border-radius: 50%;
background: $brand-gold-light;
display: flex;
align-items: center;
justify-content: center;
}
.search-empty__title {
display: block;
font-size: 32rpx;
font-weight: 600;
color: $brand-text;
margin-bottom: 12rpx;
}
.search-empty__desc {
display: block;
font-size: 26rpx;
color: $brand-text-muted;
line-height: 1.5;
}
.search-section {
margin-bottom: $brand-section-gap;
}
.search-section__head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24rpx;
}
.search-section__title-wrap {
display: flex;
align-items: center;
gap: 12rpx;
}
.search-section__title {
font-size: 30rpx;
font-weight: 600;
color: $brand-text;
}
.search-section__action {
display: flex;
align-items: center;
gap: 8rpx;
font-size: 26rpx;
color: $brand-text-muted;
padding: 8rpx 0;
min-height: 64rpx;
}
.search-section__action--pressed {
opacity: 0.65;
}
.search-tags {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
}
.search-tag {
display: inline-flex;
align-items: center;
max-width: 100%;
padding: 0 24rpx;
min-height: 64rpx;
border-radius: 999rpx;
font-size: 26rpx;
line-height: 1.2;
}
.search-tag--hot {
background: $brand-gold-light;
border: 1rpx solid rgba(22, 119, 255, 0.35);
color: $brand-text;
}
.search-tag--history {
background: #FFFFFF;
border: 1rpx solid $brand-border;
color: $brand-text;
box-shadow: $brand-shadow;
}
.search-tag--pressed {
opacity: 0.72;
transform: scale(0.98);
}
.search-tag__badge {
flex-shrink: 0;
margin-right: 8rpx;
padding: 2rpx 10rpx;
border-radius: 8rpx;
font-size: 20rpx;
font-weight: 600;
color: #FFFFFF;
background: linear-gradient(90deg, #1677FF, #4096FF);
}
.search-tag__text {
max-width: 420rpx;
}
.search-quick {
@include brand-card;
overflow: hidden;
}
.search-quick__item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 28rpx 24rpx;
border-bottom: 1rpx solid $brand-border;
&:last-child {
border-bottom: none;
}
}
.search-quick__item--pressed {
background: rgba(245, 239, 228, 0.45);
}
.search-quick__label {
font-size: 28rpx;
color: $brand-text;
}
</style>

查看文件

@@ -0,0 +1,169 @@
<template>
<view class="store-container">
<view class="store-inner-container" v-for="(item,index) in storeList">
<view class="store-image-container">
<image :src="$IMG_URL+item.images" mode="aspectFill"
style="width: 100%;height: 100%;border-radius: 10rpx;"></image>
</view>
<view class="store-title-container"
@tap="chooseLocation(`${item.latitude}`,`${item.longitude}`,`${item.name}`)">
<view class="store-name-container">
{{item.name}}
</view>
<view class="store-name-container"
style="color: #9a9a9a;font-size: 24rpx;font-weight: 550;height: 40rpx;line-height: 40rpx;">
<image :src="$IMG_URL+'/uploads/20230725/ce77a35bae7f0aa1966bbe076294136a.png'"
style="width: 25rpx;height: 25rpx;margin-right: 15rpx;" mode=""></image>{{item.distance}}km
{{item.province_name+item.city_name+item.area_name+item.address}}
</view>
<view class="store-name-container"
style="color: #f00;font-size: 24rpx;font-weight: 550;height: 40rpx;line-height: 40rpx;">
<image :src="$IMG_URL+'/uploads/20230725/86825ad6519e7b66bc7a6f2c1e3ffd1e.png'" mode=""
style="width: 25rpx;height: 25rpx;margin-right: 15rpx;"></image>
{{item.openhours}}
</view>
<view class="store-name-container"
style="font-size: 26rpx;height: 40rpx;line-height: 40rpx;color: royalblue;" @tap.stop="callPhone(`${item.phone}`)">
<image :src="$IMG_URL+'/uploads/20230726/f0fc515cec33ebec52c3121edd795a40.png'" mode=""
style="width: 32rpx;height: 32rpx;margin-right: 15rpx;"></image>
{{item.realname}}({{item.phone}})
<view @tap.stop="copyMobile(`${item.phone}`)"
style="color: #9a9a9a;margin-left: 10rpx;">复制</view>
</view>
</view>
</view>
</view>
</template>
<script>
var that
export default {
data() {
return {
page: 1,
limit: 20,
storeList: []
}
},
created() {
that = this
that.getLocationInfo()
},
onReachBottom() {
that.getList()
},
methods: {
getLocationInfo() {
const that = this
uni.getLocation({
type: "wgs84",
success(res) {
uni.setStorageSync("lat", res.latitude)
uni.setStorageSync("lng", res.longitude)
that.getList()
},
fail(res) { // 拒绝授权
console.log(res);
}
});
},
copyMobile(mobile) {
uni.setClipboardData({
data: mobile
})
},
callPhone(phone){
console.log(phone)
uni.makePhoneCall({
phoneNumber:phone
})
},
chooseLocation(lat, lng, name) {
uni.openLocation({
latitude: Number(lat),
longitude: Number(lng),
name: name,
address: name,
complete(r) {
console.log(r)
}
})
},
getList() {
let param = {
page: this.page,
limit: this.limit,
lat: uni.getStorageSync("lat") || -1,
lng: uni.getStorageSync("lng") || -1
}
this.$http("store.allList", param, "加载中").then(res => {
if (res.code == 1) {
if (res.data.length > 0) {
let old_list = that.storeList
that.storeList = old_list.concat(res.data)
that.page = that.page + 1
}
} else {
uni.showToast({
title: "数据请求失败",
icon: "none"
})
return false
}
})
}
}
}
</script>
<style scoped>
.store-container {
width: 100%;
padding-left: 20rpx;
padding-right: 20rpx;
box-sizing: border-box;
margin-top: 20rpx;
}
.store-inner-container {
width: 100%;
height: 230rpx;
background-color: #fff;
border-radius: 10rpx;
margin-top: 20rpx;
padding: 10rpx;
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
}
.store-image-container {
width: 150rpx;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.store-title-container {
width: calc(100% - 15rpx - 150rpx);
height: 100%;
display: flex;
flex-wrap: wrap;
margin-left: 15rpx;
}
.store-name-container {
width: 100%;
height: 50rpx;
line-height: 50rpx;
text-align: left;
overflow: hidden;
font-size: 32rpx;
font-weight: 550;
display: flex;
align-items: center;
justify-content: flex-start;
}
</style>

查看文件

@@ -0,0 +1,19 @@
<!-- 外链,webview -->
<template>
<view><web-view :src="webviewPath"></web-view></view>
</template>
<script>
export default {
data() {
return {
webviewPath: ''
};
},
onLoad() {
this.webviewPath = this.$Route.query.webviewPath;
}
};
</script>
<style></style>