This commit is contained in:
2025-03-12 10:55:40 +08:00
parent ef66c81ca7
commit b8a44a2716
14 changed files with 5483 additions and 4698 deletions

View File

@@ -1,220 +1,236 @@
<template><page-meta <template>
<page-meta
:page-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"
></page-meta> ></page-meta>
<view class="about"> <view class="about">
<view class="content"> <view class="content">
<view class="qrcode"> <view class="qrcode">
<image src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/app_download.png" @longtap="save"></image> <image
<text class="tip">扫码体验uni-app</text> src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/app_download.png"
</view> @longtap="save"
<view class="desc"> ></image>
<text class="code">uni-app</text> <text class="tip">扫码体验uni-app</text>
是一个使用 <text class="code">Vue.js</text> 开发跨平台应用的前端框架 </view>
</view> <view class="desc">
<view class="source"> <text class="code">uni-app</text>
<view class="title">本示例源码获取方式</view> 是一个使用 <text class="code">Vue.js</text> 开发跨平台应用的前端框架
<view class="source-list"> </view>
<view class="source-cell"> <view class="source">
<text space="nbsp">1. </text> <view class="title">本示例源码获取方式</view>
<text>下载 HBuilderX新建 uni-app 项目时选择 <text class="code">Hello uni-app</text> 模板</text> <view class="source-list">
</view> <view class="source-cell">
<view class="source-cell"> <text space="nbsp">1. </text>
<text space="nbsp">2. </text> <text
<u-link class="link" :href="'https://github.com/dcloudio/hello-uniapp'" :text="'https://github.com/dcloudio/hello-uniapp'"></u-link> >下载 HBuilderX新建 uni-app 项目时选择
</view> <text class="code">Hello uni-app</text> 模板</text
</view> >
</view> </view>
<!-- #ifdef APP-PLUS --> <view class="source-cell">
<button type="primary" @click="share">分享</button> <text space="nbsp">2. </text>
<!-- #endif --> <u-link
</view> class="link"
<!-- #ifdef APP-PLUS --> :href="'https://github.com/dcloudio/hello-uniapp'"
<view class="version"> :text="'https://github.com/dcloudio/hello-uniapp'"
当前版本{{version}} ></u-link>
</view> </view>
<!-- #endif --> </view>
</view> </view>
<!-- #ifdef APP-PLUS -->
<button type="primary" @click="share">分享</button>
<!-- #endif -->
</view>
<!-- #ifdef APP-PLUS -->
<view class="version"> 当前版本{{ version }} </view>
<!-- #endif -->
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
providerList: [], providerList: [],
version: '' version: "",
} };
}, },
onLoad() { onLoad() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.version = plus.runtime.version; this.version = plus.runtime.version;
uni.getProvider({ uni.getProvider({
service: 'share', service: "share",
success: (result) => { success: (result) => {
const data = []; const data = [];
for (let i = 0; i < result.provider.length; i++) { for (let i = 0; i < result.provider.length; i++) {
switch (result.provider[i]) { switch (result.provider[i]) {
case 'weixin': case "weixin":
data.push({ data.push({
name: '分享到微信好友', name: "分享到微信好友",
id: 'weixin' id: "weixin",
}); });
data.push({ data.push({
name: '分享到微信朋友圈', name: "分享到微信朋友圈",
id: 'weixin', id: "weixin",
type: 'WXSceneTimeline' type: "WXSceneTimeline",
}); });
break; break;
case 'qq': case "qq":
data.push({ data.push({
name: '分享到QQ', name: "分享到QQ",
id: 'qq' id: "qq",
}); });
break; break;
default: default:
break; break;
} }
} }
this.providerList = data; this.providerList = data;
}, },
fail: (error) => { fail: (error) => {
console.log('获取分享通道失败' + JSON.stringify(error)); console.log("获取分享通道失败" + JSON.stringify(error));
} },
}); });
// #endif // #endif
}, },
methods: { methods: {
// #ifdef APP-PLUS // #ifdef APP-PLUS
save() { save() {
uni.showActionSheet({ uni.showActionSheet({
itemList: ['保存图片到相册'], itemList: ["保存图片到相册"],
success: () => { success: () => {
plus.gallery.save('https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/app_download.png', function() { plus.gallery.save(
uni.showToast({ "https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/app_download.png",
title: '保存成功', function () {
icon: 'none' uni.showToast({
}); title: "保存成功",
}, function() { icon: "none",
uni.showToast({ });
title: '保存失败,请重试!', },
icon: 'none' function () {
}); uni.showToast({
}); title: "保存失败,请重试!",
} icon: "none",
}); });
}, }
share(e) { );
if (this.providerList.length === 0) { },
uni.showModal({ });
title: '当前环境无分享渠道!', },
showCancel: false share(e) {
}); if (this.providerList.length === 0) {
return; uni.showModal({
} title: "当前环境无分享渠道!",
let itemList = this.providerList.map(function(value) { showCancel: false,
return value.name; });
}) return;
uni.showActionSheet({ }
itemList: itemList, let itemList = this.providerList.map(function (value) {
success: (res) => { return value.name;
let provider = this.providerList[res.tapIndex].id; });
uni.share({ uni.showActionSheet({
provider: provider, itemList: itemList,
scene: this.providerList[res.tapIndex].type && this.providerList[res.tapIndex].type === 'WXSceneTimeline' ? success: (res) => {
'WXSceneTimeline' : "WXSceneSession", let provider = this.providerList[res.tapIndex].id;
type: (provider === "qq") ? 1 : 0, uni.share({
title: '欢迎体验uni-app', provider: provider,
summary: 'uni-app 是一个使用 Vue.js 开发跨平台应用的前端框架', scene:
imageUrl: 'https://web-assets.dcloud.net.cn/unidoc/zh/8.jpg', this.providerList[res.tapIndex].type &&
href: "https://m3w.cn/uniapp", this.providerList[res.tapIndex].type === "WXSceneTimeline"
success: (res) => { ? "WXSceneTimeline"
console.log("success:" + JSON.stringify(res)); : "WXSceneSession",
}, type: provider === "qq" ? 1 : 0,
fail: (e) => { title: "欢迎体验uni-app",
uni.showModal({ summary: "uni-app 是一个使用 Vue.js 开发跨平台应用的前端框架",
content: e.errMsg, imageUrl: "https://web-assets.dcloud.net.cn/unidoc/zh/8.jpg",
showCancel: false href: "https://m3w.cn/uniapp",
}) success: (res) => {
} console.log("success:" + JSON.stringify(res));
}); },
} fail: (e) => {
}) uni.showModal({
} content: e.errMsg,
// #endif showCancel: false,
} });
} },
});
},
});
},
// #endif
},
};
</script> </script>
<style> <style>
page, page,
view { view {
display: flex; display: flex;
} }
page { page {
min-height: 100%; min-height: 100%;
background-color: #FFFFFF; background-color: #ffffff;
} }
image { image {
width: 360rpx; width: 360rpx;
height: 360rpx; height: 360rpx;
} }
.about { .about {
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
} }
.content { .content {
flex: 1; flex: 1;
padding: 30rpx; padding: 30rpx;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }
.qrcode { .qrcode {
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
} }
.qrcode .tip { .qrcode .tip {
margin-top: 20rpx; margin-top: 20rpx;
} }
.desc { .desc {
margin-top: 30rpx; margin-top: 30rpx;
display: block; display: block;
} }
.code { .code {
color: #e96900; color: #e96900;
background-color: #f8f8f8; background-color: #f8f8f8;
} }
button { button {
width: 100%; width: 100%;
margin-top: 40rpx; margin-top: 40rpx;
} }
.version { .version {
height: 80rpx; height: 80rpx;
line-height: 80rpx; line-height: 80rpx;
justify-content: center; justify-content: center;
color: #ccc; color: #ccc;
} }
.source { .source {
margin-top: 30rpx; margin-top: 30rpx;
flex-direction: column; flex-direction: column;
} }
.source-list { .source-list {
flex-direction: column; flex-direction: column;
} }
.link { .link {
color: #007AFF; color: #007aff;
} }
</style> </style>

View File

@@ -1,90 +1,88 @@
<template><page-meta <template>
<page-meta
:page-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"
></page-meta> ></page-meta>
<view class=" commonPage commonPageBox bg" @click="navigateTo"> <view class="commonPage commonPageBox bg" @click="navigateTo">
<view class="">{{ content }}</view> <view class="">{{ content }}</view>
<public-module></public-module> <public-module></public-module>
<!-- <z-nav-bar title="设置" bgColor="#3AB3AE" fontColor="#fff"></z-nav-bar> --> <!-- <z-nav-bar title="设置" bgColor="#3AB3AE" fontColor="#fff"></z-nav-bar> -->
<view class="contentBox commonPageContentBox"></view>
<view class="contentBox commonPageContentBox"></view> <!-- 右上角跳过按钮 -->
<!-- 右上角跳过按钮 --> <!-- <view class="passbtn" @click.stop="launchApp">跳过</view> -->
<!-- <view class="passbtn" @click.stop="launchApp">跳过</view> --> </view>
</view>
</template> </template>
<script> <script>
export default { export default {
data() {
data() { return {
return { content: "",
content: '', totalTime: 10,
totalTime: 10, clock: null,
clock: null };
}; },
}, onLoad() {
onLoad() { this.getData();
this.getData() },
}, onHide() {
onHide() { clearInterval(this.clock);
clearInterval(this.clock); },
}, methods: {
methods: { navigateTo() {
navigateTo() { // clearInterval(this.clock);
// clearInterval(this.clock); },
}, getData() {
getData() { this.clock = setInterval(() => {
this.clock = setInterval(() => { this.totalTime--;
this.totalTime--; this.content = this.totalTime + "s后跳转";
this.content = this.totalTime + 's后跳转'; // if (this.totalTime == 0) {
// if (this.totalTime == 0) { // this.launchApp()
// this.launchApp() // }
// } }, 1000);
}, 1000); console.log(this.clock);
console.log(this.clock); },
}, launchApp() {
launchApp() { //跳过引导页,储存本地值,下次进入直接跳过
//跳过引导页,储存本地值,下次进入直接跳过 // clearInterval(this.clock);
// clearInterval(this.clock); // this.$mRouter.push('/pages/index/index')
// this.$mRouter.push('/pages/index/index') uni.switchTab({
uni.switchTab({ url: "/pages/homePage/index/index",
url: "/pages/homePage/index/index", success: function () {
success: function() { let page = getCurrentPages()[0];
let page = getCurrentPages()[0]; console.log(page);
console.log(page); page.$vm.requestAll();
page.$vm.requestAll(); },
}, });
}); },
} },
} };
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "@/static/customicons.css"; @import "@/static/customicons.css";
@import "@/style/common.scss"; @import "@/style/common.scss";
.bg {
}
// .passbtn {
.bg {} // width: 130rpx;
// height: 60rpx;
// .passbtn { // line-height: 60rpx;
// width: 130rpx; // position: fixed;
// height: 60rpx; // z-index: 999;
// line-height: 60rpx; // bottom: 50rpx;
// position: fixed; // right: 50rpx;
// z-index: 999; // color: #838892;
// bottom: 50rpx; // text-align: center;
// right: 50rpx; // border-width: 1rpx;
// color: #838892; // border-color: rgba(0, 0, 0, 0.5);
// text-align: center; // border-style: solid;
// border-width: 1rpx; // border-radius: 30rpx;
// border-color: rgba(0, 0, 0, 0.5); // font-size: 28rpx;
// border-style: solid; // padding-left: 25rpx;
// border-radius: 30rpx; // padding-right: 25rpx;
// font-size: 28rpx; // }
// padding-left: 25rpx;
// padding-right: 25rpx;
// }
</style> </style>

View File

@@ -1,12 +1,13 @@
<template><page-meta <template>
<page-meta
:page-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"
></page-meta> ></page-meta>
<view class="container"> <view class="container">
<!-- 公共组件-每个页面必须引入 --> <!-- 公共组件-每个页面必须引入 -->
<public-module></public-module> <public-module></public-module>
<z-nav-bar title="说明" bgColor="#3AB3AE" fontColor="#fff"></z-nav-bar> <z-nav-bar title="说明" bgColor="#3AB3AE" fontColor="#fff"></z-nav-bar>
<!-- <view <!-- <view
class="contentBox" class="contentBox"
v-if="prescriptDetail.content && prescriptDetail.type == 0" v-if="prescriptDetail.content && prescriptDetail.type == 0"
> >
@@ -18,128 +19,121 @@
</view> </view>
</view> --> </view> -->
<view class="fullscreen-webview"> <view class="fullscreen-webview">
<web-view :src="urlPath"> </web-view> <web-view :src="urlPath"> </web-view>
</view> </view>
</view>
</view>
</template> </template>
<script> <script>
export default {
export default { data() {
return {
data() { playData: {},
return { urlPath: "",
playData: {}, title: "",
urlPath: '', id: null,
title: '', indicatorDots: true,
id: null, autoplay: true,
indicatorDots: true, interval: 5000,
autoplay: true, duration: 500,
interval: 5000, };
duration: 500, },
}; onLoad(options) {
}, if (options.type == 1) {
onLoad(options) { this.urlPath = "https://zmzm.taihumed.com/agreement.html";
if (options.type == 1) { this.title = "用户协议";
this.urlPath = 'https://zmzm.taihumed.com/agreement.html' } else if (options.type == 2) {
this.title = '用户协议' this.urlPath = "https://zmzm.taihumed.com/privacy.html";
} else if (options.type == 2) { this.title = "隐私策略";
this.urlPath = 'https://zmzm.taihumed.com/privacy.html' }
this.title = '隐私策略' },
} onShow() {},
}, methods: {
onShow() { // 放大图片
previewImage(url) {
}, console.log(url);
methods: { uni.previewImage({
// 放大图片 urls: [url],
previewImage(url) { longPressActions: {
console.log(url); itemList: ["很抱歉,暂不支持保存图片到本地"],
uni.previewImage({ success: function (res) {
urls: [url], // console.log(res,'+++++')
longPressActions: { },
itemList: ["很抱歉,暂不支持保存图片到本地"], },
success: function(res) { });
// console.log(res,'+++++') },
}, // 方剂详情
}, },
}); };
},
// 方剂详情
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.contentBox { .contentBox {
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
.contentBoxwebwiew { .contentBoxwebwiew {
height: 100%; height: 100%;
// .webwiew{ // .webwiew{
// height: 100%; // height: 100%;
// } // }
} }
.fullscreen-webview { .fullscreen-webview {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
} }
.mb-10 { .mb-10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
.content { .content {
font-size: 28rpx; font-size: 28rpx;
} }
.swiper-item { .swiper-item {
image { image {
margin: 0 auto; margin: 0 auto;
height: 250rpx; height: 250rpx;
} }
} }
.uni-margin-wrap { .uni-margin-wrap {
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding-top: 20rpx; padding-top: 20rpx;
background-color: #fff; background-color: #fff;
} }
.container { .container {
padding: 10rpx; padding: 10rpx;
// background-color: #fff; // background-color: #fff;
.item { .item {
// color: #666; // color: #666;
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
line-height: 46rpx; line-height: 46rpx;
} }
.title-center { .title-center {
text-align: center; text-align: center;
font-size: 32rpx; font-size: 32rpx;
font-weight: 700 !important; font-weight: 700 !important;
} }
} }
.flexbox { .flexbox {
display: flex; display: flex;
} }
/deep/ .uni-section-header__decoration.line { /deep/ .uni-section-header__decoration.line {
background-color: #18bc37; background-color: #18bc37;
} }
</style> </style>

View File

@@ -1,7 +1,8 @@
<template><page-meta <template>
:page-font-size="$baseFontSize() + 'px'" <page-meta
:root-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
></page-meta> :root-font-size="$baseFontSize() + 'px'"
></page-meta>
<view v-if="show"> <view v-if="show">
<swiper <swiper
class="guide_pages_swiper" class="guide_pages_swiper"
@@ -131,86 +132,81 @@
</template> </template>
<script> <script>
import { import { mapState, mapMutations } from "vuex";
mapState,
mapMutations
} from "vuex";
export default { export default {
data() { data() {
return { return {
title:"融儒、医、美、文为一体", title: "融儒、医、美、文为一体",
// title:"融儒、释、道、医、美、文为一体", // title:"融儒、释、道、医、美、文为一体",
screenHeight: 667, screenHeight: 667,
show: false, show: false,
protocolShow: false, protocolShow: false,
DisagreeProtocolShow: false, DisagreeProtocolShow: false,
}; };
}, },
onReady() { onReady() {
// this.show = false; // this.show = false;
if (uni.getStorageSync("guidePages") != 2) {
let systemInfo = uni.getSystemInfoSync();
this.screenHeight = systemInfo.screenHeight;
this.show = true;
// this.protocolShow = true;
}
if (uni.getStorageSync("guidePages") != 2) { // else {
let systemInfo = uni.getSystemInfoSync(); // uni.switchTab({
this.screenHeight = systemInfo.screenHeight; // // url: "/pages/advertisement/index/index",
this.show = true; // url: "/pages/homePage/index/index",
// this.protocolShow = true; // success: function() {
} // let page = getCurrentPages()[0];
// console.log(page);
// page.$vm.requestAll();
// else { // },
// uni.switchTab({ // });
// // url: "/pages/advertisement/index/index", // }
// url: "/pages/homePage/index/index", },
// success: function() { methods: {
// let page = getCurrentPages()[0]; openDetail(type) {
// console.log(page); console.log("type at line 152:", type);
// page.$vm.requestAll(); uni.navigateTo({
// }, url: "/pages/advertisement/index/detail?type=" + type,
// }); });
// } },
}, quit() {
methods: { if (uni.getSystemInfoSync().platform === "ios") {
openDetail(type) { plus.runtime.launchApplication({
console.log('type at line 152:', type) action: "QUIT",
uni.navigateTo({ });
url: "/pages/advertisement/index/detail?type=" + type, } else {
}); plus.runtime.quit();
}, }
quit() { },
if (uni.getSystemInfoSync().platform === "ios") { onSee() {
plus.runtime.launchApplication({ this.protocolShow = true;
action: "QUIT" this.DisagreeProtocolShow = false;
}); },
} else { onDisagree() {
plus.runtime.quit(); this.protocolShow = false;
} this.DisagreeProtocolShow = true;
}, },
onSee() { close() {
this.protocolShow = true; this.protocolShow = false;
this.DisagreeProtocolShow = false; },
}, onClose() {
onDisagree() { uni.setStorageSync("guidePages", 2);
this.protocolShow = false; this.show = false;
this.DisagreeProtocolShow = true; this.protocolShow = false;
}, uni.redirectTo({
close() { url: "/pages/user/login/login",
this.protocolShow = false; });
}, },
onClose() { },
uni.setStorageSync("guidePages", 2);
this.show = false;
this.protocolShow = false;
uni.redirectTo({
url: "/pages/user/login/login",
});
},
},
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
@import '@/style/mixin.scss'; @import "@/style/mixin.scss";
.guide_pages_swiper { .guide_pages_swiper {
position: fixed; position: fixed;
top: 0; top: 0;

View File

@@ -1,90 +1,88 @@
<template><page-meta <template>
<page-meta
:page-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"
></page-meta> ></page-meta>
<view class=" commonPage commonPageBox bg" @click="navigateTo"> <view class="commonPage commonPageBox bg" @click="navigateTo">
<view class="">{{ content }}</view> <view class="">{{ content }}</view>
<public-module></public-module> <public-module></public-module>
<!-- <z-nav-bar title="设置" bgColor="#3AB3AE" fontColor="#fff"></z-nav-bar> --> <!-- <z-nav-bar title="设置" bgColor="#3AB3AE" fontColor="#fff"></z-nav-bar> -->
<view class="contentBox commonPageContentBox"></view>
<view class="contentBox commonPageContentBox"></view> <!-- 右上角跳过按钮 -->
<!-- 右上角跳过按钮 --> <!-- <view class="passbtn" @click.stop="launchApp">跳过</view> -->
<!-- <view class="passbtn" @click.stop="launchApp">跳过</view> --> </view>
</view>
</template> </template>
<script> <script>
export default { export default {
data() {
data() { return {
return { content: "",
content: '', totalTime: 10,
totalTime: 10, clock: null,
clock: null };
}; },
}, onLoad() {
onLoad() { this.getData();
this.getData() },
}, onHide() {
onHide() { clearInterval(this.clock);
clearInterval(this.clock); },
}, methods: {
methods: { navigateTo() {
navigateTo() { // clearInterval(this.clock);
// clearInterval(this.clock); },
}, getData() {
getData() { this.clock = setInterval(() => {
this.clock = setInterval(() => { this.totalTime--;
this.totalTime--; this.content = this.totalTime + "s后跳转";
this.content = this.totalTime + 's后跳转'; // if (this.totalTime == 0) {
// if (this.totalTime == 0) { // this.launchApp()
// this.launchApp() // }
// } }, 1000);
}, 1000); console.log(this.clock);
console.log(this.clock); },
}, launchApp() {
launchApp() { //跳过引导页,储存本地值,下次进入直接跳过
//跳过引导页,储存本地值,下次进入直接跳过 // clearInterval(this.clock);
// clearInterval(this.clock); // this.$mRouter.push('/pages/index/index')
// this.$mRouter.push('/pages/index/index') uni.switchTab({
uni.switchTab({ url: "/pages/homePage/index/index",
url: "/pages/homePage/index/index", success: function () {
success: function() { let page = getCurrentPages()[0];
let page = getCurrentPages()[0]; console.log(page);
console.log(page); page.$vm.requestAll();
page.$vm.requestAll(); },
}, });
}); },
} },
} };
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "@/static/customicons.css"; @import "@/static/customicons.css";
@import "@/style/common.scss"; @import "@/style/common.scss";
.bg {
}
// .passbtn {
.bg {} // width: 130rpx;
// height: 60rpx;
// .passbtn { // line-height: 60rpx;
// width: 130rpx; // position: fixed;
// height: 60rpx; // z-index: 999;
// line-height: 60rpx; // bottom: 50rpx;
// position: fixed; // right: 50rpx;
// z-index: 999; // color: #838892;
// bottom: 50rpx; // text-align: center;
// right: 50rpx; // border-width: 1rpx;
// color: #838892; // border-color: rgba(0, 0, 0, 0.5);
// text-align: center; // border-style: solid;
// border-width: 1rpx; // border-radius: 30rpx;
// border-color: rgba(0, 0, 0, 0.5); // font-size: 28rpx;
// border-style: solid; // padding-left: 25rpx;
// border-radius: 30rpx; // padding-right: 25rpx;
// font-size: 28rpx; // }
// padding-left: 25rpx;
// padding-right: 25rpx;
// }
</style> </style>

View File

@@ -1,403 +1,414 @@
<template><page-meta <template>
<page-meta
:page-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"
></page-meta> ></page-meta>
<view class=""> <view class="">
<view class="shopHeader"> <view class="shopHeader">
<!-- 顶部导航栏 --> <!-- 顶部导航栏 -->
<z-nav-bar title="健康超市"></z-nav-bar> <z-nav-bar title="健康超市"></z-nav-bar>
<!-- 搜索 --> <!-- 搜索 -->
<!-- <view class="search" @click="goSearch()"> <!-- <view class="search" @click="goSearch()">
<u-search placeholder="请输入需4545要的商品" v-model="keyword" :show-action="false"></u-search> <u-search placeholder="请输入需4545要的商品" v-model="keyword" :show-action="false"></u-search>
</view> --> </view> -->
</view> </view>
<!-- 主盒子 --> <!-- 主盒子 -->
<view class="indexBox"> <view class="indexBox">
<!-- 轮播图 --> <!-- 轮播图 -->
<view class="swiper_box"> <view class="swiper_box">
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000"> <swiper
<swiper-item v-for="(item,index) in swiperlist" :key="index"> :indicator-dots="true"
<view class="swiper-item"> :autoplay="true"
<image :src="item.image" mode="widthFix " class="swiperImg"></image> :interval="3000"
</view> :duration="1000"
</swiper-item> >
</swiper> <swiper-item v-for="(item, index) in swiperlist" :key="index">
</view> <view class="swiper-item">
<!-- 分类 --> <image
<view class="head_line"> :src="item.image"
<b></b> mode="widthFix "
<text>商品分类</text> class="swiperImg"
</view> ></image>
<view class="classfy"> </view>
<view v-for="(item,index) in gridArr" :key="index" @click='toClassify(item.catId,index)'> </swiper-item>
<!-- <u-icon v-if="item.icon" :name="item.icon" :size="46"></u-icon> --> </swiper>
<image :src="item.icon"></image> </view>
<text class="grid-text">{{item.name}}</text> <!-- 分类 -->
</view> <view class="head_line">
<br clear="both"> <b></b>
</view> <text>商品分类</text>
<!-- 商品展示 --> </view>
<view class="head_line"> <view class="classfy">
<b></b> <view
<text>限时秒杀</text> v-for="(item, index) in gridArr"
<i @click="onShopMore('Sale')">查看更多 ></i> :key="index"
</view> @click="toClassify(item.catId, index)"
<!-- 限时秒杀 --> >
<view class="limited"> <!-- <u-icon v-if="item.icon" :name="item.icon" :size="46"></u-icon> -->
<view class="limitedSymbol"> <image :src="item.icon"></image>
<image src="../../static/icon/shopping_xsh.png"></image> <text class="grid-text">{{ item.name }}</text>
</view> </view>
<view class="limitedScrollBox"> <br clear="both" />
<u-scroll-list indicatorActiveColor="#27b386"> </view>
<view class="limitedItem" v-for="(item,index) in seckillList" :key="index" <!-- 商品展示 -->
@click="goDetail(item.prodInfo.productId)"> <view class="head_line">
<image :src="item.prodInfo.productImages" mode=""></image> <b></b>
<text class="biaoti">{{item.prodInfo.productName}}</text> <text>限时秒杀</text>
<text class="xian">{{item.seckillPrice}}</text> <i @click="onShopMore('Sale')">查看更多 ></i>
<text class="yuan">{{item.prodInfo.price}}</text> </view>
</view> <!-- 限时秒杀 -->
</u-scroll-list> <view class="limited">
</view> <view class="limitedSymbol">
</view> <image src="../../static/icon/shopping_xsh.png"></image>
<!-- 商品展示 --> </view>
<view class="head_line"> <view class="limitedScrollBox">
<b></b> <u-scroll-list indicatorActiveColor="#27b386">
<text>精选商品</text> <view
<i @click="onShopMore('Hot')">查看更多 ></i> class="limitedItem"
</view> v-for="(item, index) in seckillList"
<view class="goods"> :key="index"
<view class="goodsItem" v-for="(item,index) in goodsList" :key="item.productId" @click="goDetail(item.prodInfo.productId)"
@click="goDetail(item.productId)"> >
<image :src="item.productImages" mode="" class="goodsImg"></image> <image :src="item.prodInfo.productImages" mode=""></image>
<view class="goodsContent"> <text class="biaoti">{{ item.prodInfo.productName }}</text>
<view class="goodsName"> <text class="xian">{{ item.seckillPrice }}</text>
{{item.productName}} <text class="yuan">{{ item.prodInfo.price }}</text>
</view> </view>
<view class="goodsPrice"> </u-scroll-list>
{{item.price}} </view>
</view> </view>
</view> <!-- 商品展示 -->
</view> <view class="head_line">
<br clear="both"> <b></b>
</view> <text>精选商品</text>
<view style="height: 30rpx;"></view> <i @click="onShopMore('Hot')">查看更多 ></i>
<!-- 公共组件-每个页面必须引入 --> </view>
<public-module></public-module> <view class="goods">
<music-play :playData="playData"></music-play> <view
</view> class="goodsItem"
</view> v-for="(item, index) in goodsList"
:key="item.productId"
@click="goDetail(item.productId)"
>
<image :src="item.productImages" mode="" class="goodsImg"></image>
<view class="goodsContent">
<view class="goodsName">
{{ item.productName }}
</view>
<view class="goodsPrice"> {{ item.price }} </view>
</view>
</view>
<br clear="both" />
</view>
<view style="height: 30rpx"></view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<music-play :playData="playData"></music-play>
</view>
</view>
</template> </template>
<script> <script>
import musicPlay from '@/components/music.vue' import musicPlay from "@/components/music.vue";
import { import { mapState } from "vuex";
mapState export default {
} from 'vuex'; data() {
export default { return {
data() { playData: {},
return { keyword: "", // 搜索索引值
playData:{}, // 轮播图数据
keyword: '', // 搜索索引值 swiperlist: [
// 轮播图数据 {
swiperlist: [{ image: "../../static/icon/home_ban_1.jpg",
image: '../../static/icon/home_ban_1.jpg', },
}, {
{ image: "../../static/icon//home_ban_2.jpg",
image: '../../static/icon//home_ban_2.jpg', },
}, {
{ image: "../../static/icon//home_ban_3.jpg",
image: '../../static/icon//home_ban_3.jpg', },
} ],
], totalCount: 4,
totalCount: 4, pageSize: 1,
pageSize: 1, totalPage: 4,
totalPage: 4, currPage: 1,
currPage: 1, limit: 4,
limit: 4, page: 1,
page: 1, istop: 1, // 是否是精选商品
istop: 1, // 是否是精选商品 // 秒杀列表
// 秒杀列表 seckillList: [],
seckillList: [], // 商品列表
// 商品列表 goodsList: [],
goodsList: [], // 分类数据
// 分类数据 gridArr: [
gridArr: [{ {
icon: "list-dot", icon: "list-dot",
name: '更多' name: "更多",
}], },
} ],
}, };
computed: { },
...mapState(['userInfo']), computed: {
}, ...mapState(["userInfo"]),
components: { },
musicPlay components: {
}, musicPlay,
onLoad() { },
// 获取分类 onLoad() {
this.$http // 获取分类
.post('book/shopcategory/getOneLevel') this.$http.post("book/shopcategory/getOneLevel").then((res) => {
.then(res => { // 用一个空数组去接分类数据
// 用一个空数组去接分类数据 let arr = [];
let arr = [] if (res.list.length >= 5) {
if (res.list.length >= 5) { for (let i in res.list) {
for (let i in res.list) { if (i < 5) {
if (i < 5) { arr.push({
arr.push({ icon:
icon: "../../static/icon/shop_bar_" + (Number(i) + Number(1)) + ".png", "../../static/icon/shop_bar_" +
name: res.list[i].name, (Number(i) + Number(1)) +
catId: res.list[i].catId ".png",
}) name: res.list[i].name,
} catId: res.list[i].catId,
} });
arr.push({ }
icon: "../../static/icon/shop_bar_more.png", }
name: '更多' arr.push({
}) icon: "../../static/icon/shop_bar_more.png",
this.gridArr = arr name: "更多",
} });
}) this.gridArr = arr;
}
});
// 获取限时秒杀 // 获取限时秒杀
this.$http this.$http.get(`book/shopseckill/getSeckillProd`).then((res) => {
.get(`book/shopseckill/getSeckillProd`) this.seckillList = res.list;
.then(res => { console.log(this.seckillList);
this.seckillList = res.list });
console.log(this.seckillList)
})
// 获取精选商品 // 获取精选商品
this.$http this.$http
.post(`book/shopproduct/appGetList?limit=${this.limit}&page=${this.page}&istop=${this.istop}`) .post(
.then( `book/shopproduct/appGetList?limit=${this.limit}&page=${this.page}&istop=${this.istop}`
res => { )
this.goodsList = res.page.list .then((res) => {
}) this.goodsList = res.page.list;
});
},
methods: {
// 跳转详情页
goDetail(id) {
uni.navigateTo({
url: "./commodityDetail?id=" + id,
});
},
}, // 跳转分类页
methods: { toClassify(catId, index) {
// 跳转详情页 if (catId) {
goDetail(id) { uni.navigateTo({
uni.navigateTo({ url: `./classify?type=${index}`,
url: './commodityDetail?id=' + id });
}); } else {
}, uni.navigateTo({
url: "./classifyAll",
});
}
},
// 跳转分类 // 跳转搜索
toClassify(catId, index) { goSearch() {
if (catId) { uni.navigateTo({
uni.navigateTo({ url: "./commoditySearch",
url: `./classify?type=${index}` });
}) },
} else {
uni.navigateTo({
url: './classifyAll'
})
}
},
// 跳转搜索 // 列表跳
goSearch() { onShopMore(e) {
uni.navigateTo({ uni.navigateTo({
url: './commoditySearch' url: "./bookShopType?type=" + e,
}) });
}, },
},
// 列表跳页 };
onShopMore(e) {
uni.navigateTo({
url: './bookShopType?type=' + e
});
},
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.shopHeader { .shopHeader {
position: relative; position: relative;
top: 0; top: 0;
left: 0; left: 0;
} }
.search { .search {
padding: 10rpx; padding: 10rpx;
background-color: #fff; background-color: #fff;
margin: 10rpx 0; margin: 10rpx 0;
}
} .swiper_box {
margin-top: 20rpx;
padding: 0 20rpx;
.swiper_box { .swiper-item {
margin-top: 20rpx; width: 100%;
padding: 0 20rpx; height: 100%;
border-radius: 20rpx;
.swiper-item { .swiperImg {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 20rpx; border-radius: 20rpx;
}
}
}
.swiperImg { .classfy {
width: 100%; margin: 0 10rpx;
height: 100%; border-radius: 30rpx;
border-radius: 20rpx;
}
}
}
.classfy { view {
margin: 0 10rpx; float: left;
border-radius: 30rpx; width: 16.6%;
text-align: center;
view { image {
float: left; width: 100rpx;
width: 16.6%; height: 100rpx;
text-align: center; margin: 0 auto;
}
image { .grid-text {
width: 100rpx; font-size: 25rpx;
height: 100rpx; margin-top: 4rpx;
margin: 0 auto; }
} }
}
.grid-text { .head_line {
font-size: 25rpx; margin: 30rpx 0 30rpx 0;
margin-top: 4rpx; padding: 10rpx;
}
} b {
display: inline-block;
width: 12rpx;
height: 40rpx;
background-color: #54a966;
vertical-align: bottom;
margin: 0 20rpx 0 0;
}
text {
font-size: 32rpx;
font-weight: bold;
}
} i {
float: right;
font-style: normal;
color: #8b8a91;
font-size: 24rpx;
margin: 15rpx 35rpx 0 0;
}
}
.head_line { .limited {
margin: 30rpx 0 30rpx 0; width: 100%;
padding: 10rpx; height: auto;
padding: 20rpx 10rpx 10rpx 10rpx;
display: flex;
align-items: center;
background-color: #fff;
margin-top: 10rpx;
b { .limitedSymbol {
display: inline-block; width: 22%;
width: 12rpx; height: 300rpx;
height: 40rpx; border-right: 1px solid #eee;
background-color: #54a966; vertical-align: middle;
vertical-align: bottom;
margin: 0 20rpx 0 0;
}
text { image {
font-size: 32rpx; width: 120rpx;
font-weight: bold; height: 120rpx;
} margin: 45px auto 0 auto;
}
}
i { .limitedScrollBox {
float: right; width: 76%;
font-style: normal; padding: 0 10rpx;
color: #8b8a91; }
font-size: 24rpx;
margin: 15rpx 35rpx 0 0;
}
}
.limited { .limitedItem {
width: 100%; width: 200rpx;
height: auto; text-align: center;
padding: 20rpx 10rpx 10rpx 10rpx;
display: flex;
align-items: center;
background-color: #fff;
margin-top: 10rpx;
.limitedSymbol { image {
width: 22%; width: 150upx;
height: 300rpx; height: 200upx;
border-right: 1px solid #eee; margin: 15rpx auto 20rpx auto;
vertical-align: middle; }
image { text {
width: 120rpx; font-size: 20rpx;
height: 120rpx; display: block;
margin: 45px auto 0 auto; }
}
}
.limitedScrollBox { .biaoti {
width: 76%; font-size: 30rpx;
padding: 0 10rpx; margin: 10rpx 0 10rpx 0;
} font-weight: bold;
}
.limitedItem { .xian {
width: 200rpx; font-size: 32rpx;
text-align: center; color: #bf0c0c;
font-weight: bold;
}
image { .yuan {
width: 150upx; text-decoration: line-through;
height: 200upx; color: #c1c1c1;
margin: 15rpx auto 20rpx auto; }
} }
}
text { .goods {
font-size: 20rpx; width: 100%;
display: block;
}
.biaoti { .goodsItem {
font-size: 30rpx; display: inline-block;
margin: 10rpx 0 10rpx 0; width: 46%;
font-weight: bold; border-radius: 20rpx;
} padding: 25rpx 25rpx 20rpx 25rpx;
margin: 0 20rpx 20rpx 20rpx;
background-color: #fff;
border: 1px solid #eee;
.xian { .goodsImg {
font-size: 32rpx; width: 98%;
color: #bf0c0c; height: 380rpx;
font-weight: bold; border-radius: 10rpx;
} }
.yuan { .goodsContent {
text-decoration: line-through; .goodsName {
color: #c1c1c1; margin-top: 10rpx;
font-size: 30rpx;
font-weight: bold;
}
} .goodsPrice {
} font-size: 30rpx;
} margin: 5rpx 0 0 3rpx;
color: #bf0c0c;
font-weight: bold;
}
}
}
.goods { .goodsItem:nth-child(2n) {
width: 100%; margin-left: 0;
}
}
.goodsItem {
display: inline-block;
width: 46%;
border-radius: 20rpx;
padding: 25rpx 25rpx 20rpx 25rpx;
margin: 0 20rpx 20rpx 20rpx;
background-color: #fff;
border: 1px solid #eee;
.goodsImg {
width: 98%;
height: 380rpx;
border-radius: 10rpx;
}
.goodsContent {
.goodsName {
margin-top: 10rpx;
font-size: 30rpx;
font-weight: bold;
}
.goodsPrice {
font-size: 30rpx;
margin: 5rpx 0 0 3rpx;
color: #bf0c0c;
font-weight: bold;
}
}
}
.goodsItem:nth-child(2n) {
margin-left: 0;
}
}
</style> </style>

View File

@@ -1,333 +1,359 @@
<template><page-meta <template>
<page-meta
:page-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"
></page-meta> ></page-meta>
<view> <view>
<z-nav-bar :title="title"></z-nav-bar> <z-nav-bar :title="title"></z-nav-bar>
<view class="shop_list"> <view class="shop_list">
<view class="sl_tioa" v-for="(item,index) in shopList" @click="onShopJump(item)"> <view
<image :src="item.productImages"></image> class="sl_tioa"
<view class="sl_cont"> v-for="(item, index) in shopList"
<view class="sl_tit"> @click="onShopJump(item)"
<text class="bok_name"> >
{{item.productName}} <image :src="item.productImages"></image>
<span v-if="item.productStock==0" style="color: #aaa;font-size:26rpx;">无货</span> <view class="sl_cont">
</text> <view class="sl_tit">
</view> <text class="bok_name">
<view class="sl_ric"> {{ item.productName }}
{{item.price}} <span
</view> v-if="item.productStock == 0"
<view class="sl_del" v-if="shopScreen.type == 'Sale'"> style="color: #aaa; font-size: 26rpx"
{{item.oldprice}} >无货</span
</view> >
<view class="sl_gou" v-if="item.productStock>0" @click.stop="addShopCar(item)"> </text>
<u-icon name="shopping-cart" :size="26" color="#eba00b"></u-icon> </view>
</view> <view class="sl_ric"> {{ item.price }} </view>
</view> <view class="sl_del" v-if="shopScreen.type == 'Sale'">
<br clear="both"> {{ item.oldprice }}
</view> </view>
<view style="height: 1px;"></view> <view
</view> class="sl_gou"
v-if="item.productStock > 0"
@click.stop="addShopCar(item)"
>
<u-icon name="shopping-cart" :size="26" color="#eba00b"></u-icon>
</view>
</view>
<br clear="both" />
</view>
<view style="height: 1px"></view>
</view>
<view>
<view v-if="status == 0" style="text-align: center">
<u-loading-icon style="display: inline-block"></u-loading-icon>
<font
style="
vertical-align: super;
margin-left: 10px;
font-size: 26rpx;
color: #909399;
"
>努力加载中</font
>
</view>
<view v-if="status == 1">
<u-divider text="全部加载完成"></u-divider>
</view>
</view>
<view> <view style="padding-bottom: 20rpx">
<view v-if="status==0" style="text-align: center;"> <u-back-top
<u-loading-icon style="display: inline-block;"></u-loading-icon> :scroll-top="scrollTop"
<font style='vertical-align: super;margin-left: 10px;font-size: 26rpx;color: #909399;'>努力加载中</font> bottom="60"
</view> :customStyle="bgiStyle"
<view v-if="status==1"> :iconStyle="iconStyle"
<u-divider text="全部加载完成"></u-divider> ></u-back-top>
</view> </view>
</view> <music-play :playData="playData"></music-play>
</view>
<view style="padding-bottom: 20rpx;">
<u-back-top :scroll-top="scrollTop" bottom="60" :customStyle='bgiStyle' :iconStyle="iconStyle"></u-back-top>
</view>
<music-play :playData="playData"></music-play>
</view>
</template> </template>
<script> <script>
import musicPlay from '@/components/music.vue' import musicPlay from "@/components/music.vue";
import $http from '@/config/requestConfig.js'; import $http from "@/config/requestConfig.js";
import { import { mapState } from "vuex";
mapState export default {
} from 'vuex'; data() {
export default { return {
data() { playData: {},
return { scrollTop: 0,
playData:{}, status: 3,
scrollTop: 0, shopScreen: {
status: 3, type: "",
shopScreen: { page: 1, //当前页码数
type: '', limit: 5, //单页数据数量
page: 1, //当前页码数 },
limit: 5, //单页数据数量 productInfo: {},
}, totalPage: 0,
productInfo: {}, totalCount: 0,
totalPage: 0, shopList: [],
totalCount: 0, bgiStyle: {
shopList: [], background: "#2ab58833",
bgiStyle: { },
background: '#2ab58833' iconStyle: {
}, fontSize: "40rpx",
iconStyle: { fontWeight: "bold",
fontSize: '40rpx', color: "#54a966",
fontWeight: 'bold', },
color: '#54a966', urList: "",
}, title: "",
urList: '', };
title: '', },
}
},
// 返回顶部 // 返回顶部
onPageScroll(e) { onPageScroll(e) {
this.scrollTop = e.scrollTop; this.scrollTop = e.scrollTop;
}, },
// 下拉刷新 // 下拉刷新
onReachBottom() { onReachBottom() {
this.status = 0 this.status = 0;
if (this.shopScreen.page < this.totalPage) { if (this.shopScreen.page < this.totalPage) {
this.shopScreen.page = this.shopScreen.page + 1 this.shopScreen.page = this.shopScreen.page + 1;
setTimeout(() => { setTimeout(() => {
if (this.shopScreen.type == 'Hot') { if (this.shopScreen.type == "Hot") {
this.$http this.$http
.post(this.urList + '?page=' + this.shopScreen.page + '&limit=' + this.shopScreen .post(
.limit) this.urList +
.then(res => { "?page=" +
this.totalPage = res.page.totalPage this.shopScreen.page +
this.totalCount = res.page.totalCount "&limit=" +
for (let i in res.page.list) { this.shopScreen.limit
this.shopList.push(res.page.list[i]) )
} .then((res) => {
}); this.totalPage = res.page.totalPage;
} this.totalCount = res.page.totalCount;
}, 1000) for (let i in res.page.list) {
} else { this.shopList.push(res.page.list[i]);
this.status = 1 }
} });
}, }
}, 1000);
} else {
this.status = 1;
}
},
//第一次加载 //第一次加载
onLoad(e) { onLoad(e) {
this.shopScreen.type = e.type this.shopScreen.type = e.type;
if (this.shopScreen.type == 'Sale') { if (this.shopScreen.type == "Sale") {
this.urList = 'book/shopseckill/getSeckillProd' this.urList = "book/shopseckill/getSeckillProd";
this.title = '限时秒杀' this.title = "限时秒杀";
} else if (this.shopScreen.type == 'Hot') { } else if (this.shopScreen.type == "Hot") {
this.urList = 'book/shopproduct/appGetList' this.urList = "book/shopproduct/appGetList";
this.title = '精选商品' this.title = "精选商品";
} }
this.getData(); this.getData();
}, },
//页面显示 //页面显示
onShow() { onShow() {
// this.getData(); // this.getData();
}, },
// 下拉刷新 // 下拉刷新
onPullDownRefresh() { onPullDownRefresh() {
this.getData() this.getData();
uni.stopPullDownRefresh() uni.stopPullDownRefresh();
}, },
computed: { computed: {
...mapState(['userInfo']), ...mapState(["userInfo"]),
}, },
components: { components: {
musicPlay musicPlay,
}, },
//方法 //方法
methods: { methods: {
// 获取列表数据 // 获取列表数据
getData() { getData() {
console.log(this.urList) console.log(this.urList);
this.shopList = [] this.shopList = [];
if (this.shopScreen.type == 'Hot') { if (this.shopScreen.type == "Hot") {
this.$http this.$http
.post(this.urList + '?page=' + this.shopScreen.page + '&limit=' + this.shopScreen.limit) .post(
.then(res => { this.urList +
this.shopList = res.page.list "?page=" +
this.totalPage = res.page.totalPage this.shopScreen.page +
this.status = 3 "&limit=" +
}); this.shopScreen.limit
} else if (this.shopScreen.type == 'Sale') { )
this.$http .then((res) => {
.get(this.urList) this.shopList = res.page.list;
.then(res => { this.totalPage = res.page.totalPage;
let arr = [] this.status = 3;
for (let i in res.list) { });
arr.push({ } else if (this.shopScreen.type == "Sale") {
productImages: res.list[i].prodInfo.productImages, this.$http.get(this.urList).then((res) => {
productName: res.list[i].prodInfo.productName, let arr = [];
price: res.list[i].seckillPrice, for (let i in res.list) {
oldprice: res.list[i].prodInfo.price, arr.push({
productId: res.list[i].prodInfo.productId, productImages: res.list[i].prodInfo.productImages,
}) productName: res.list[i].prodInfo.productName,
} price: res.list[i].seckillPrice,
this.shopList = arr oldprice: res.list[i].prodInfo.price,
this.status = 3 productId: res.list[i].prodInfo.productId,
}); });
} }
this.shopList = arr;
this.status = 3;
});
}
},
}, // 加入购物车
addShopCar(e) {
this.$http
.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`)
.then((res) => {
this.cartList = res.cartList;
// 统计商品信息
let data = {
userId: this.userInfo.id,
productId: e.productId,
productAmount: 1,
price: e.price,
};
console.log(e);
// 判断列表是否为空
if (this.cartList.length > 0) {
let flag = "";
let shagnpin = {};
// 循环购物车列表
flag = this.cartList.some((item, index) => {
if (item.productId == data.productId) {
shagnpin = item;
shagnpin.productAmount = item.productAmount + 1;
return true;
}
});
if (flag) {
// 已在购物车中添加
$http
.request({
url: "book/ordercart/update",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: shagnpin,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.code == 0) {
uni.showToast({
title: "加入购物车成功",
duration: 1000,
});
}
});
} else {
// 加入购物车
$http
.request({
url: "book/ordercart/save",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.code == 0) {
uni.showToast({
title: "加入购物车成功",
duration: 1000,
});
}
});
}
} else {
// 购物车列表为空时直接加入购物车
$http
.request({
url: "book/ordercart/save",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.code == 0) {
uni.showToast({
title: "加入购物车成功",
duration: 1000,
});
}
});
}
});
},
// 加入购物车 // 商品内容跳转
addShopCar(e) { onShopJump(e) {
this.$http uni.navigateTo({
.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`) url: "./commodityDetail?id=" + e.productId,
.then(res => { });
this.cartList = res.cartList },
// 统计商品信息 },
let data = { };
"userId": this.userInfo.id,
"productId": e.productId,
"productAmount": 1,
"price": e.price
}
console.log(e)
// 判断列表是否为空
if (this.cartList.length > 0) {
let flag = ''
let shagnpin = {}
// 循环购物车列表
flag = this.cartList.some((item, index) => {
if (item.productId == data.productId) {
shagnpin = item
shagnpin.productAmount = item.productAmount + 1
return true
}
})
if (flag) {
// 已在购物车中添加
$http.request({
url: "book/ordercart/update",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: shagnpin,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
uni.showToast({
title: '加入购物车成功',
duration: 1000,
});
}
})
} else {
// 加入购物车
$http.request({
url: "book/ordercart/save",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
uni.showToast({
title: '加入购物车成功',
duration: 1000,
});
}
})
}
} else {
// 购物车列表为空时直接加入购物车
$http.request({
url: "book/ordercart/save",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
uni.showToast({
title: '加入购物车成功',
duration: 1000,
});
}
})
}
})
},
// 商品内容跳转
onShopJump(e) {
uni.navigateTo({
url: './commodityDetail?id=' + e.productId
});
}
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/style/mixin.scss'; @import "@/style/mixin.scss";
.shop_list {
margin: 30rpx;
.sl_tioa {
box-shadow: 0 0px 10px 1px #d3d1d133;
background-color: #fff;
padding: 25rpx;
margin: 0 0 20rpx 0;
border-radius: 15rpx;
position: relative;
image {
width: 160upx;
height: 240upx;
float: left;
margin-right: 20rpx;
}
.shop_list { .sl_cont {
margin: 30rpx; float: left;
.sl_tioa { .sl_tit {
box-shadow: 0 0px 10px 1px #d3d1d133; max-width: 420rpx;
background-color: #fff; font-size: 30rpx;
padding: 25rpx; }
margin: 0 0 20rpx 0;
border-radius: 15rpx;
position: relative;
image { .sl_ric {
width: 160upx; color: #bf0c0c;
height: 240upx; font-weight: bold;
float: left; margin-top: 50rpx;
margin-right: 20rpx; }
}
.sl_cont { .sl_del {
float: left; text-decoration: line-through;
color: #c1c1c1;
font-size: 30rpx;
margin-left: 10rpx;
}
.sl_gou {
.sl_tit { background-color: #fbf6ec;
max-width: 420rpx; border-radius: 50rpx;
font-size: 30rpx; padding: 5rpx;
} position: absolute;
right: 50rpx;
.sl_ric { bottom: 40rpx;
color: #bf0c0c; }
font-weight: bold; }
margin-top: 50rpx; }
} }
.sl_del {
text-decoration: line-through;
color: #c1c1c1;
font-size: 30rpx;
margin-left: 10rpx;
}
.sl_gou {
background-color: #fbf6ec;
border-radius: 50rpx;
padding: 5rpx;
position: absolute;
right: 50rpx;
bottom: 40rpx;
}
}
}
}
</style> </style>

View File

@@ -1,458 +1,523 @@
<template><page-meta <template>
<page-meta
:page-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"
></page-meta> ></page-meta>
<view class=""> <view class="">
<z-nav-bar title="健康超市"></z-nav-bar> <z-nav-bar title="健康超市"></z-nav-bar>
<!-- 一级分类 --> <!-- 一级分类 -->
<view class="oneBox"> <view class="oneBox">
<view class="oneLevel"> <view class="oneLevel">
<u-tabs :scrollable="false" :current="current" lineWidth="42" :inactiveStyle="{fontSize:'32rpx'}" <u-tabs
:list="oneLevel" @click="getTowLevel" lineColor="#54a966" :scrollable="false"
:activeStyle="{color: '#303133',fontWeight: 'bold', transform: 'scale(1.01)'}"></u-tabs> :current="current"
</view> lineWidth="42"
</view> :inactiveStyle="{ fontSize: '32rpx' }"
<!-- <view class="search_box" @click="onPageJump('../peanut/searchFor')"> :list="oneLevel"
@click="getTowLevel"
lineColor="#54a966"
:activeStyle="{
color: '#303133',
fontWeight: 'bold',
transform: 'scale(1.01)',
}"
></u-tabs>
</view>
</view>
<!-- <view class="search_box" @click="onPageJump('../peanut/searchFor')">
<text class="icon_search"></text> <text class="icon_search"></text>
<text class="prompt">搜索...</text> <text class="prompt">搜索...</text>
</view> --> </view> -->
<!-- 二级分类商品 --> <!-- 二级分类商品 -->
<view class="twoBox" style=""> <view class="twoBox" style="">
<!-- <u-sticky> --> <!-- <u-sticky> -->
<u-tabs v-if="utabs" :list="towLevel" :current = "0" :inactiveStyle="{fontSize:'28rpx'}" lineWidth="40" @click="getCategoryList" <u-tabs
:activeStyle="{transform: 'scale(1.01)'}"></u-tabs> v-if="utabs"
<!-- </u-sticky> --> :list="towLevel"
</view> :current="0"
<view class="classfyBody"> :inactiveStyle="{ fontSize: '28rpx' }"
<!-- 二级分类商品 --> lineWidth="40"
<view class="towLevel" v-if="towLevel.length > 0"> @click="getCategoryList"
<view class="towLevelContent" v-if="commodityList && commodityList.length > 0"> :activeStyle="{ transform: 'scale(1.01)' }"
<view class="commodityItem" v-for="(item,index) in commodityList" :key="index" ></u-tabs>
@click.stop="toDetail(item.productId)"> <!-- </u-sticky> -->
<view class="box"> </view>
<image :src="item.productImages" mode=""></image> <view class="classfyBody">
<view class="commodityContent"> <!-- 二级分类商品 -->
<view class="commodityTitle"> <view class="towLevel" v-if="towLevel.length > 0">
{{item.productName}} <view
<span v-if="item.productStock==0" style="color: #aaa;font-size:26rpx;">暂无库存</span> class="towLevelContent"
</view> v-if="commodityList && commodityList.length > 0"
<view class="commodityPrice"> >
<text class="price" v-if="item.price"> <view
<b style="font-size: 40rpx;">{{item.price}}</b> class="commodityItem"
<span class="priceTag" v-if="item.activityPrice">原价{{item.activityPrice}}</span> v-for="(item, index) in commodityList"
</text> :key="index"
<text class="SoldNumber" v-if="item.sumSales">已售<span>{{item.sumSales}}</span></text> @click.stop="toDetail(item.productId)"
<!-- <text class="icon" @click.stop="addShopCar(item)" v-if="item.productStock"> >
<view class="box">
<image :src="item.productImages" mode=""></image>
<view class="commodityContent">
<view class="commodityTitle">
{{ item.productName }}
<span
v-if="item.productStock == 0"
style="color: #aaa; font-size: 26rpx"
>暂无库存</span
>
</view>
<view class="commodityPrice">
<text class="price" v-if="item.price"
>
<b style="font-size: 40rpx">{{ item.price }}</b>
<span class="priceTag" v-if="item.activityPrice"
>原价{{ item.activityPrice }}</span
>
</text>
<text class="SoldNumber" v-if="item.sumSales"
>已售<span>{{ item.sumSales }}</span
></text
>
<!-- <text class="icon" @click.stop="addShopCar(item)" v-if="item.productStock">
<u-icon name="shopping-cart" :size="26" color="#eba00b"></u-icon> <u-icon name="shopping-cart" :size="26" color="#eba00b"></u-icon>
</text> --> </text> -->
<view class="publierInfo" v-if="item.author && item.publisher"> <view
<span class="c999 f24">{{item.author}}</span><span class="c999 f24">/ {{item.publisher}}</span> class="publierInfo"
</view> v-if="item.author && item.publisher"
</view> >
</view> <span class="c999 f24">{{ item.author }}</span
</view> ><span class="c999 f24">/ {{ item.publisher }}</span>
</view> </view>
</view> </view>
<view v-else style="text-align: center;font-size: 30rpx;color: #888;margin: 20rpx 0 0 0;flex: 1;"> </view>
暂无商品 </view>
</view> </view>
</view> </view>
<view v-else style="text-align: center;font-size:30rpx;color: #888;margin: 50rpx 0 0 0;"> <view
暂无分类 v-else
</view> style="
</view> text-align: center;
<view> font-size: 30rpx;
<u-back-top :scroll-top="scrollTop" bottom="60" :customStyle='bgiStyle' :iconStyle="iconStyle"></u-back-top> color: #888;
</view> margin: 20rpx 0 0 0;
<music-play :playData="playData"></music-play> flex: 1;
</view> "
>
暂无商品
</view>
</view>
<view
v-else
style="
text-align: center;
font-size: 30rpx;
color: #888;
margin: 50rpx 0 0 0;
"
>
暂无分类
</view>
</view>
<view>
<u-back-top
:scroll-top="scrollTop"
bottom="60"
:customStyle="bgiStyle"
:iconStyle="iconStyle"
></u-back-top>
</view>
<music-play :playData="playData"></music-play>
</view>
</template> </template>
<script> <script>
import musicPlay from '@/components/music.vue' import musicPlay from "@/components/music.vue";
import $http from '@/config/requestConfig.js'; import $http from "@/config/requestConfig.js";
import { import { mapState } from "vuex";
mapState export default {
} from 'vuex'; data() {
export default { return {
data() { playData: {},
return { highlight: "", // 高亮下标
playData:{}, current: 0,
highlight: '', // 高亮下标 twocurrent: 0,
current: 0, oneLevel: [],
twocurrent:0, towLevel: [],
oneLevel: [], commodityList: [], // 商品列表
towLevel: [], utabs: false,
commodityList: [] ,// 商品列表 bgiStyle: {
utabs:false, background: "#2ab58833",
bgiStyle: { },
background: '#2ab58833' iconStyle: {
}, fontSize: "40rpx",
iconStyle: { fontWeight: "bold",
fontSize: '40rpx', color: "#54a966",
fontWeight: 'bold', },
color: '#54a966', scrollTop: 0,
}, };
scrollTop: 0, },
} // contentButtonClick(e) {
}, // console.log(e)
// contentButtonClick(e) { // },
// console.log(e) // onLoad(e) {
// }, // //获取一级分类
// onLoad(e) { // this.$http
// //获取一级分类 // .post('book/shopcategory/getOneLevel')
// this.$http // .then(res => {
// .post('book/shopcategory/getOneLevel') // this.oneLevel = res.list
// .then(res => { // this.current = e.type
// this.oneLevel = res.list // this.getTowLevel(this.oneLevel[e.type])
// this.current = e.type // })
// this.getTowLevel(this.oneLevel[e.type]) // },
// }) //页面显示
// }, onShow() {
//页面显示 this.getOneLevel();
onShow() { },
this.getOneLevel() computed: {
}, ...mapState(["userInfo"]),
computed: { },
...mapState(['userInfo']), mounted() {
}, setTimeout(() => {
mounted () { // 解决vant-tab组件官方问题底部条位置错误
setTimeout(() => { // 解决vant-tab组件官方问题底部条位置错误 this.utabs = true;
this.utabs = true }, 200);
}, 200) },
}, components: {
components: { musicPlay,
musicPlay },
}, methods: {
methods: { onPageScroll(e) {
onPageScroll(e) { this.scrollTop = e.scrollTop;
this.scrollTop = e.scrollTop; },
}, // 跳转
// 跳转 onPageJump(url) {
onPageJump(url) { uni.navigateTo({
uni.navigateTo({ url: url,
url: url });
}); },
}, // 获取一级分类
// 获取一级分类 getOneLevel() {
getOneLevel() { this.$http.post("book/shopcategory/getOneLevel").then((res) => {
this.$http //console.log(res,'一级分类')
.post('book/shopcategory/getOneLevel') this.oneLevel = res.list;
.then(res => { // this.current = e.type
//console.log(res,'一级分类') this.getTowLevel(this.oneLevel[0]);
this.oneLevel = res.list });
// this.current = e.type },
this.getTowLevel(this.oneLevel[0]) // 点击一级分类
}) getTowLevel(e) {
}, this.utabs = false;
// 点击一级分类 // this.twocurrent = 0;
getTowLevel(e) { uni.showLoading();
this.utabs = false this.$http
// this.twocurrent = 0; .post(`book/shopcategory/getTwoLevel?catId=${e.catId}`)
uni.showLoading() .then((res) => {
this.$http //console.log(res,'二级分类')
.post(`book/shopcategory/getTwoLevel?catId=${e.catId}`) this.towLevel = res.list;
.then(res => { if (this.towLevel == "") {
//console.log(res,'二级分类') this.commodityList = [];
this.towLevel = res.list } else {
if (this.towLevel == '') { let newo = {
this.commodityList = [] catId: 0,
} else { name: "全部",
let newo = { parentCid: e.catId,
catId:0, };
name:'全部', this.towLevel.splice(0, 0, newo);
parentCid:e.catId // this.getCategoryList(res.list[0])
} // console.log(this.towLevel, 'towLevel')
this.towLevel.splice(0,0,newo) this.getCategoryList(res.list[0]);
// this.getCategoryList(res.list[0]) }
// console.log(this.towLevel, 'towLevel') uni.hideLoading();
this.getCategoryList(res.list[0]) this.utabs = true;
} uni.stopPullDownRefresh();
uni.hideLoading() });
this.utabs = true },
uni.stopPullDownRefresh();
})
},
// 点击二级分类 // 点击二级分类
getCategoryList(e) { getCategoryList(e) {
// console.log(e) // console.log(e)
// return false // return false
// this.highlight = index // this.highlight = index
this.$http this.$http
.post('book/shopproduct/appGetCategoryList', { .post("book/shopproduct/appGetCategoryList", {
'catId': e.catId catId: e.catId,
}) })
.then(res => { .then((res) => {
// console.log(res,'二级分类') // console.log(res,'二级分类')
this.commodityList = res.list this.commodityList = res.list;
}) });
}, },
// 加入购物车 // 加入购物车
addShopCar(e) { addShopCar(e) {
this.$http this.$http
.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`) .post(`book/ordercart/getCartList?userId=${this.userInfo.id}`)
.then(res => { .then((res) => {
// 获得用户的购物车列表信息 // 获得用户的购物车列表信息
this.cartList = res.cartList this.cartList = res.cartList;
// 统计商品信息 // 统计商品信息
let data = { let data = {
"userId": this.userInfo.id, userId: this.userInfo.id,
"productId": e.productId, productId: e.productId,
"productAmount": 1, productAmount: 1,
"price": e.price price: e.price,
} };
// 判断列表是否为空 // 判断列表是否为空
if (this.cartList.length > 0) { if (this.cartList.length > 0) {
let flag = '' let flag = "";
let shagnpin = {} let shagnpin = {};
// 循环购物车列表 // 循环购物车列表
flag = this.cartList.some((item, index) => { flag = this.cartList.some((item, index) => {
if (item.productId == data.productId) { if (item.productId == data.productId) {
shagnpin = item shagnpin = item;
shagnpin.productAmount = item.productAmount + 1 shagnpin.productAmount = item.productAmount + 1;
return true return true;
} }
}) });
if (flag) { if (flag) {
// 已在购物车中添加 // 已在购物车中添加
$http.request({ $http
url: "book/ordercart/update", .request({
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 url: "book/ordercart/update",
data: shagnpin, method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
header: { //默认 无 说明:请求头 data: shagnpin,
'Content-Type': 'application/json' header: {
} //默认 无 说明:请求头
}).then(res => { "Content-Type": "application/json",
if (res.code == 0) { },
uni.showToast({ })
title: '加入购物车成功', .then((res) => {
duration: 1000, if (res.code == 0) {
}); uni.showToast({
} title: "加入购物车成功",
}) duration: 1000,
} else { });
// 加入购物车 }
$http.request({ });
url: "book/ordercart/save", } else {
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 // 加入购物车
data, $http
header: { //默认 无 说明:请求头 .request({
'Content-Type': 'application/json' url: "book/ordercart/save",
}, method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
}).then(res => { data,
if (res.code == 0) { header: {
uni.showToast({ //默认 无 说明:请求头
title: '加入购物车成功', "Content-Type": "application/json",
duration: 1000, },
}); })
} .then((res) => {
}) if (res.code == 0) {
} uni.showToast({
title: "加入购物车成功",
} else { duration: 1000,
// 购物车列表为空时直接加入购物车 });
$http.request({ }
url: "book/ordercart/save", });
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 }
data, } else {
header: { //默认 无 说明:请求头 // 购物车列表为空时直接加入购物车
'Content-Type': 'application/json' $http
}, .request({
}).then(res => { url: "book/ordercart/save",
if (res.code == 0) { method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
uni.showToast({ data,
title: '加入购物车成功', header: {
duration: 1000, //默认 无 说明:请求头
}); "Content-Type": "application/json",
} },
}) })
} .then((res) => {
}) if (res.code == 0) {
}, uni.showToast({
// 商品内容跳转 title: "加入购物车成功",
toDetail(id) { duration: 1000,
uni.navigateTo({ });
url: `./commodityDetail?id=${id}` }
}) });
} }
}, });
onPullDownRefresh(){ },
// console.log('refresh'); // 商品内容跳转
this.commodityList = [] toDetail(id) {
this.getOneLevel() uni.navigateTo({
} url: `./commodityDetail?id=${id}`,
} });
},
},
onPullDownRefresh() {
// console.log('refresh');
this.commodityList = [];
this.getOneLevel();
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.publierInfo { .publierInfo {
display: inline-block; display: inline-block;
background-color: #f1f1f1; background-color: #f1f1f1;
flex-direction: row; flex-direction: row;
border-radius: 10px; border-radius: 10px;
vertical-align: middle; vertical-align: middle;
padding: 0 12rpx; padding: 0 12rpx;
line-height: 32rpx; line-height: 32rpx;
} }
.c999 { .c999 {
color: #999; color: #999;
} }
.f24 { .f24 {
font-size: 24rpx; font-size: 24rpx;
} }
.search_box { .search_box {
width: 90%; width: 90%;
height: 64upx; height: 64upx;
background-color: #fff; background-color: #fff;
border-radius: 32upx; border-radius: 32upx;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0upx 40upx; padding: 0upx 40upx;
position: relative; position: relative;
margin: 30rpx 0 15rpx -46%; margin: 30rpx 0 15rpx -46%;
left: 50%; left: 50%;
box-shadow: 0 0px 10px 1px #54a96633; box-shadow: 0 0px 10px 1px #54a96633;
.prompt { .prompt {
color: #cccccc; color: #cccccc;
}
} .icon_search {
background-image: url("@/static/icon/map_ic_search.png");
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
width: 29upx;
height: 28upx;
margin-right: 20upx;
}
}
.icon_search { .oneBox {
background-image: url('@/static/icon/map_ic_search.png'); margin: 10rpx auto;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
width: 29upx;
height: 28upx;
margin-right: 20upx;
}
}
.oneBox { .oneLevel {
margin: 10rpx auto; }
}
.oneLevel {} .twoBox {
} width: 95%;
margin: 0 auto;
}
.twoBox { .classfyBody {
width: 95%; margin: 5rpx auto;
margin: 0 auto; // width: 100%;
} height: 100%;
.classfyBody { .towLevel {
margin: 5rpx auto; width: 100%;
// width: 100%; height: 100%;
height: 100%; display: flex;
.towLevelTitle {
width: 28%;
height: auto;
text-align: center;
.titleItem {
font-size: 35rpx;
padding: 20rpx 10rpx;
}
.towLevel { .active {
width: 100%; background-color: #fff;
height: 100%; border-left: solid 10rpx #eba00b;
display: flex; font-weight: bold;
}
}
.towLevelTitle { .towLevelContent {
width: 28%; display: flex;
height: auto; flex-wrap: wrap;
text-align: center; padding: 10rpx 20rpx;
width: 100%;
align-items: stretch;
// align-content:center;
align-content: start;
.commodityItem {
width: 50%;
// background-color: #fff;
padding: 10rpx;
.titleItem { .box {
font-size: 35rpx; background-color: #fff;
padding: 20rpx 10rpx; padding: 10rpx;
} border-radius: 20rpx !important;
overflow: hidden;
box-shadow: 0 0px 10px 1px #54a96633;
}
.active { .commodityTitle {
background-color: #fff; font-size: 32rpx;
border-left: solid 10rpx #eba00b; margin: 20rpx 0 10rpx 0;
font-weight: bold; }
}
}
.towLevelContent { image {
display: flex; width: 100%;
flex-wrap: wrap; border-radius: 10rpx;
padding: 10rpx 20rpx; height: 300rpx;
width: 100%; margin-right: 20rpx;
align-items: stretch; }
// align-content:center;
align-content:start;
.commodityItem {
width: 50%;
// background-color: #fff;
padding: 10rpx;
.box { .commodityContent {
background-color: #fff; flex: 1;
padding: 10rpx; font-size: 16px;
border-radius: 20rpx !important;
overflow: hidden;
box-shadow: 0 0px 10px 1px #54a96633;
}
.commodityTitle { display: flex;
font-size: 32rpx; flex-direction: column;
margin: 20rpx 0 10rpx 0; justify-content: space-between;
}
image { .commodityPrice {
width: 100%; width: 100%;
border-radius: 10rpx; position: relative;
height: 300rpx; margin: 0 0 3rpx 0;
margin-right: 20rpx;
}
.commodityContent { .price {
flex: 1; vertical-align: middle;
font-size: 16px; color: #ffa200;
display: flex; .priceTag {
flex-direction: column; flex-direction: row;
justify-content: space-between; color: #999;
display: inline-block;
zoom: 0.8;
margin-left: 6rpx;
margin-bottom: 6px;
}
}
.commodityPrice { .SoldNumber {
width: 100%; font-size: 24rpx;
position: relative; color: #999;
margin: 0 0 3rpx 0; float: right;
margin-top: 16rpx;
}
.price { .icon {
vertical-align: middle; background-color: #fbf6ec;
color: #ffa200; border-radius: 50rpx;
padding: 5rpx;
.priceTag { position: absolute;
flex-direction: row; right: 0;
color: #999; bottom: -20rpx;
display: inline-block; }
zoom: .8; }
margin-left: 6rpx; }
margin-bottom: 6px; }
} }
} }
}
.SoldNumber {
font-size: 24rpx;
color: #999;
float: right;
margin-top: 16rpx;
}
.icon {
background-color: #fbf6ec;
border-radius: 50rpx;
padding: 5rpx;
position: absolute;
right: 0;
bottom: -20rpx;
}
}
}
}
}
}
}
</style> </style>

View File

@@ -1,81 +1,80 @@
<template><page-meta <template>
<page-meta
:page-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
:root-font-size="$baseFontSize() + 'px'" :root-font-size="$baseFontSize() + 'px'"
></page-meta> ></page-meta>
<view> <view>
<z-nav-bar title="全部分类"></z-nav-bar> <z-nav-bar title="全部分类"></z-nav-bar>
<view class="oneLevel"> <view class="oneLevel">
<view class="oneItem" v-for="(item,index) in oneLevel" @click="getTowLevel(index)"> <view
<image :src="item.icon"></image> class="oneItem"
<text>{{item.name}}</text> v-for="(item, index) in oneLevel"
</view> @click="getTowLevel(index)"
</view> >
<music-play :playData="playData"></music-play> <image :src="item.icon"></image>
</view> <text>{{ item.name }}</text>
</view>
</view>
<music-play :playData="playData"></music-play>
</view>
</template> </template>
<script> <script>
import musicPlay from '@/components/music.vue' import musicPlay from "@/components/music.vue";
export default { export default {
data() { data() {
return { return {
playData:{}, playData: {},
oneLevel: [], oneLevel: [],
} };
}, },
onLoad(e) { onLoad(e) {
this.$http this.$http.post("book/shopcategory/getOneLevel").then((res) => {
.post('book/shopcategory/getOneLevel') let arr = [];
.then(res => { for (let i in res.list) {
let arr = [] arr.push({
for (let i in res.list) { icon:
arr.push({ "../../static/icon/shop_bar_" + (Number(i) + Number(1)) + ".png",
icon: "../../static/icon/shop_bar_" + (Number(i) + Number(1)) + ".png", name: res.list[i].name,
name: res.list[i].name, catId: res.list[i].catId,
catId: res.list[i].catId });
}) }
} this.oneLevel = arr;
this.oneLevel = arr });
}) },
}, components: {
components: { musicPlay,
musicPlay },
}, methods: {
methods: { // 点击分类跳转
// 点击分类跳转 getTowLevel(e) {
getTowLevel(e) { uni.navigateTo({
uni.navigateTo({ url: `./classify?type=${e}`,
url: `./classify?type=${e}` });
}) },
}, },
};
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.oneLevel { .oneLevel {
margin: 10rpx 0 0 0;
margin: 10rpx 0 0 0; .oneItem {
display: inline-block;
width: 20%;
text-align: center;
margin: 30rpx 0 0 0;
image {
width: 100rpx;
height: 100rpx;
margin: 0 auto;
}
.oneItem { text {
display: inline-block; font-size: 30rpx;
width: 20%; }
text-align: center; }
margin: 30rpx 0 0 0; }
image {
width: 100rpx;
height: 100rpx;
margin: 0 auto;
}
text {
font-size: 30rpx;
}
}
}
</style> </style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,8 @@
<template><page-meta <template>
:page-font-size="$baseFontSize() + 'px'" <page-meta
:root-font-size="$baseFontSize() + 'px'" :page-font-size="$baseFontSize() + 'px'"
></page-meta> :root-font-size="$baseFontSize() + 'px'"
></page-meta>
<view class=""> <view class="">
<!-- 公共组件-每个页面必须引入 --> <!-- 公共组件-每个页面必须引入 -->
<public-module></public-module> <public-module></public-module>
@@ -262,10 +263,15 @@
type="success" type="success"
></u-tag> ></u-tag>
</view> </view>
<view class="orderReal" style=" width: 100%; <view
display: flex; class="orderReal"
align-items: center; style="
justify-content: space-between;"> width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
"
>
<span style="color: #666; margin-right: 10rpx; float: left" <span style="color: #666; margin-right: 10rpx; float: left"
>创建时间 : >创建时间 :
</span> </span>
@@ -1108,7 +1114,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/style/mixin.scss"; @import "@/style/mixin.scss";
@import "@/style/common.scss"; @import "@/style/common.scss";
view,uni-view { view,
uni-view {
font-size: 28rpx; font-size: 28rpx;
} }
.expresslist { .expresslist {

File diff suppressed because it is too large Load Diff

View File

@@ -88,7 +88,17 @@
</image> </image>
<view class="normal_box"> <view class="normal_box">
<view class="normal_box_top" style="justify-content: space-between"> <view class="normal_box_top" style="justify-content: space-between">
<view class="curriulum_title">{{ v.productName }} </view> <view
class="curriulum_title"
style="width: calc(100% - 160rpx); font-size: 14px"
>{{ v.productName }}
</view>
<u-number-box
:min="1"
:input-width="30"
v-model="orderNumber"
button-size="20"
></u-number-box>
</view> </view>
<view> <view>
@@ -97,16 +107,16 @@
v.isVipPrice == 1 && v.vipPrice != 0 && v.vipPrice != null v.isVipPrice == 1 && v.vipPrice != 0 && v.vipPrice != null
" "
> >
<text style="color: #e97512; font-size: 12px; font-weight: bold" <text style="color: #e97512; font-size: 14px; font-weight: bold"
>¥{{ v.vipPrice.toFixed(2) }}</text >¥{{ v.vipPrice.toFixed(2) }}</text
> >
<text style="color: #fa2d12; font-size: 10px; margin-left: 4px" <text style="color: #fa2d12; font-size: 12px; margin-left: 4px"
>VIP到手价</text >VIP到手价</text
> >
<text <text
style=" style="
color: #8a8a8a; color: #8a8a8a;
font-size: 10px; font-size: 12px;
margin-left: 4px; margin-left: 4px;
font-weight: bold; font-weight: bold;
text-decoration: line-through; text-decoration: line-through;
@@ -116,16 +126,16 @@
</text> </text>
<text v-else-if="v.activityPrice && v.activityPrice > 0"> <text v-else-if="v.activityPrice && v.activityPrice > 0">
<text style="color: #e97512; font-size: 12px; font-weight: bold" <text style="color: #e97512; font-size: 14px; font-weight: bold"
>¥{{ v.activityPrice.toFixed(2) }}</text >¥{{ v.activityPrice.toFixed(2) }}</text
> >
<text style="color: #613804; font-size: 10px; margin-left: 4px" <text style="color: #613804; font-size: 12px; margin-left: 4px"
>活动价</text >活动价</text
> >
<text <text
style=" style="
color: #8a8a8a; color: #8a8a8a;
font-size: 10px; font-size: 12px;
margin-left: 4px; margin-left: 4px;
font-weight: bold; font-weight: bold;
text-decoration: line-through; text-decoration: line-through;
@@ -134,25 +144,9 @@
> >
</text> </text>
<text v-else style="font-size: 12px" <text v-else style="font-size: 14px"
>¥{{ Number(v.price).toFixed(2) }}</text >¥{{ Number(v.price).toFixed(2) }}</text
> >
<!-- <u-number-box v-model="orderNumber" style="float: right">
<view slot="minus" class="minus">
<u-icon name="minus" size="12"></u-icon>
</view>
<text
slot="input"
style="width: auto; text-align: center; border: none"
class="input"
>{{ orderNumber }}</text
>
<view slot="plus" class="plus">
<u-icon name="plus" color="#FFFFFF" size="12"></u-icon>
</view>
</u-number-box> -->
<u-number-box :min="1" v-model="orderNumber" ></u-number-box>
</view> </view>
</view> </view>
</view> </view>
@@ -941,7 +935,12 @@ export default {
this.jfNumberShow = this.jfNumber.toFixed(2); this.jfNumberShow = this.jfNumber.toFixed(2);
} }
this.actualPayment = this.totalPrice - this.jfNumber -this.districtAmount -this.vipPrice + this.freightNum; this.actualPayment =Number(
this.totalPrice -
this.jfNumber -
this.districtAmount -
this.vipPrice +
this.freightNum).toFixed(2);
if (this.actualPayment == 0) { if (this.actualPayment == 0) {
this.isDefaultCurrency = true; this.isDefaultCurrency = true;
@@ -1200,23 +1199,23 @@ export default {
} }
if (that.jfNumber == 0 || that.jfNumber == null) { if (that.jfNumber == 0 || that.jfNumber == null) {
that.jfNumberShow = "0.00"; that.jfNumberShow = "0.00";
that.actualPayment = that.totalPrice; that.actualPayment = that.totalPrice.toFixed(2);
} else { } else {
that.jfNumberShow = that.jfNumber.toFixed(2); that.jfNumberShow = that.jfNumber.toFixed(2);
that.actualPayment = that.totalPrice - that.jfNumber; that.actualPayment = Number(that.totalPrice - that.jfNumber).toFixed(2);
} }
that.actualPayment = that.actualPayment =Number(
that.actualPayment + that.actualPayment +
that.freightNum - that.freightNum -
that.districtAmount - that.districtAmount -
that.vipPrice; that.vipPrice).toFixed(2);
} else { } else {
that.actualPayment = that.actualPayment =Number(
that.totalPrice + that.totalPrice +
that.freightNum - that.freightNum -
couponAmount - couponAmount -
that.districtAmount - that.districtAmount -
that.vipPrice; that.vipPrice).toFixed(2);
} }
if (this.actualPayment == 0 && !this.isShowAddress) { if (this.actualPayment == 0 && !this.isShowAddress) {
@@ -1314,12 +1313,13 @@ export default {
couponId: null, //优惠券Id couponId: null, //优惠券Id
// isSend: this.isSend, // isSend: this.isSend,
couponName: "", //优惠券名称 couponName: "", //优惠券名称
districtMoney: 0, //优惠金额 vipDiscountAmount: this.vipPrice, //折扣金额
districtMoney: this.districtAmount, //折扣金额
productList: this.goodsDataList.map((e) => { productList: this.goodsDataList.map((e) => {
return { return {
productId: e.productId, productId: e.productId,
quantity: 1, quantity: this.orderNumber,
}; };
}), //订单列表商品 }), //订单列表商品
orderType: "order", //订单类型 orderType: "order", //订单类型