登录前置

This commit is contained in:
wangzimeng 2025-11-24 13:41:38 +08:00
parent 5619fa3411
commit 715101f18e
12 changed files with 1316 additions and 1118 deletions

View File

@ -21,6 +21,12 @@
// "group": "商城" // "group": "商城"
// } // }
// }, // },
{
"path": "pages/index/login",
"style": {
"navigationBarTitleText": "登录"
}
},
{ {
"path": "pages/index/category", "path": "pages/index/category",
"style": { "style": {
@ -56,12 +62,7 @@
} }
}, },
{
"path": "pages/index/login",
"style": {
"navigationBarTitleText": "登录"
}
},
{ {
"path": "pages/index/search", "path": "pages/index/search",
"style": { "style": {
@ -86,8 +87,7 @@
} }
} }
], ],
"subPackages": [ "subPackages": [{
{
"root": "pages/goods", "root": "pages/goods",
"pages": [{ "pages": [{
"path": "index", "path": "index",

View File

@ -26,7 +26,8 @@
</view> --> </view> -->
<view v-if="serviceIcon" class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center" <view v-if="serviceIcon" class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
style="margin-left: 12rpx;" @tap="backHome"> style="margin-left: 12rpx;" @tap="backHome">
<image class="item-icon" src="https://mall.jiangxiaoxian.hschool.com.cn/backHome.png" mode="aspectFit"> <image class="item-icon" src="https://mall.jiangxiaoxian.hschool.com.cn/backHome.png"
mode="aspectFit">
</image> </image>
<view class="item-title">首页</view> <view class="item-title">首页</view>
</view> </view>
@ -60,8 +61,9 @@
</button> </button>
</view> </view>
<view style="margin: 0 auto;position: absolute;bottom: -90rpx;width: 100%;text-align: center;"> <view style="margin: 0 auto;position: absolute;bottom: -90rpx;width: 100%;text-align: center;">
<image style="width: 50rpx;height: 50rpx;" src="https://mall.jiangxiaoxian.hschool.com.cn/registerCancel.png" <image style="width: 50rpx;height: 50rpx;"
mode="aspectFill" @click="showLogin = false"></image> src="https://mall.jiangxiaoxian.hschool.com.cn/registerCancel.png" mode="aspectFill"
@click="showLogin = false"></image>
</view> </view>
</su-popup> </su-popup>
</template> </template>
@ -161,6 +163,7 @@
} }
const goodShare = ref(false) const goodShare = ref(false)
function shareGoods() { function shareGoods() {
console.log('shareGoods'); console.log('shareGoods');
showShareModal(); showShareModal();
@ -182,7 +185,10 @@
// //
function toLogin() { function toLogin() {
console.log('toLogin——打开登录的弹框', showLogin.value); console.log('toLogin——打开登录的弹框', showLogin.value);
showLogin.value = true; // showLogin.value = true;
uni.reLaunch({
url: '/pages/index/login'
});
console.log('showLogin', showLogin.value); console.log('showLogin', showLogin.value);
} }
// //
@ -244,10 +250,10 @@
if (code === 1) { if (code === 1) {
resolve(true); resolve(true);
showLogin.value = false; showLogin.value = false;
if(goodShare.value == true) { if (goodShare.value == true) {
shareGoods(); shareGoods();
} }
if(chatPhone.value == true) { if (chatPhone.value == true) {
getInfoUser(); getInfoUser();
} }
} }
@ -263,9 +269,9 @@
// //
function getInfoUser() { function getInfoUser() {
userApi.profile().then(res=> { userApi.profile().then(res => {
if (res.code == 1){ if (res.code == 1) {
console.log('获取个人信息:',res.data); console.log('获取个人信息:', res.data);
userInfo.value = res.data; userInfo.value = res.data;
console.log('联系平台客服', userInfo.value.platform_contact_number); console.log('联系平台客服', userInfo.value.platform_contact_number);
onChat(); onChat();
@ -275,8 +281,9 @@
// //
const chatPhone = ref(false); const chatPhone = ref(false);
function onChat() { function onChat() {
if(isLogin.value == true) { if (isLogin.value == true) {
chatPhone.value = false; chatPhone.value = false;
console.log('联系平台客服', userInfo.value.platform_contact_number); console.log('联系平台客服', userInfo.value.platform_contact_number);
wx.makePhoneCall({ wx.makePhoneCall({
@ -289,7 +296,7 @@
console.log("拨打电话失败", err) console.log("拨打电话失败", err)
} }
}) })
}else { } else {
chatPhone.value = true; chatPhone.value = true;
toLogin(); toLogin();
} }
@ -382,5 +389,4 @@
// margin: 0 auto; // margin: 0 auto;
} }
} }
</style> </style>

View File

@ -26,7 +26,8 @@
{{ state.selectedSkuPrice.original_price || state.goodsInfo.original_price }} {{ state.selectedSkuPrice.original_price || state.goodsInfo.original_price }}
</view> </view>
</view> </view>
<view v-else style="font-size: 42rpx;font-weight: 500;line-height: 30rpx;color: #ff3000;" @click.stop="toLogin">登录查看价格</view> <view v-else style="font-size: 42rpx;font-weight: 500;line-height: 30rpx;color: #ff3000;"
@click.stop="toLogin">登录查看价格</view>
<view class="sales-text"> <view class="sales-text">
{{ formatSales(state.goodsInfo.sales_show_type, state.goodsInfo.sales) }} {{ formatSales(state.goodsInfo.sales_show_type, state.goodsInfo.sales) }}
</view> </view>
@ -95,8 +96,8 @@
@close="state.showActivityModel = false" /> @close="state.showActivityModel = false" />
</block> </block>
<su-popup :show="showLogin == true" type="center" round="10" <su-popup :show="showLogin == true" type="center" round="10" @close="showLogin = false"
@close="showLogin = false" @open="showLogin = true"> @open="showLogin = true">
<view class="popup"> <view class="popup">
<button class="texbut" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"> <button class="texbut" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
@ -105,8 +106,9 @@
</button> </button>
</view> </view>
<view style="margin: 0 auto;position: absolute;bottom: -90rpx;width: 100%;text-align: center;"> <view style="margin: 0 auto;position: absolute;bottom: -90rpx;width: 100%;text-align: center;">
<image style="width: 50rpx;height: 50rpx;" src="https://mall.jiangxiaoxian.hschool.com.cn/registerCancel.png" <image style="width: 50rpx;height: 50rpx;"
mode="aspectFill" @click="showLogin = false"></image> src="https://mall.jiangxiaoxian.hschool.com.cn/registerCancel.png" mode="aspectFill"
@click="showLogin = false"></image>
</view> </view>
</su-popup> </su-popup>
@ -173,7 +175,10 @@
// //
function toLogin() { function toLogin() {
console.log('toLogin——打开登录的弹框', showLogin.value); console.log('toLogin——打开登录的弹框', showLogin.value);
showLogin.value = true; // showLogin.value = true;
uni.reLaunch({
url: '/pages/index/login'
});
console.log('showLogin', showLogin.value); console.log('showLogin', showLogin.value);
} }
// //
@ -334,7 +339,6 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.detail-card { .detail-card {
background-color: #ffff; background-color: #ffff;
margin: 14rpx 20rpx; margin: 14rpx 20rpx;
@ -539,5 +543,4 @@
// margin: 0 auto; // margin: 0 auto;
} }
} }
</style> </style>

View File

@ -84,14 +84,14 @@
<view v-for="(a, b) in e.children" :id="'second_' + a.id"> <view v-for="(a, b) in e.children" :id="'second_' + a.id">
<view class="title-box ss-flex ss-col-center ss-row-between ss-p-b-30"> <view class="title-box ss-flex ss-col-center ss-row-between ss-p-b-30">
<view class="title-text">{{ a.name }}</view> <view class="title-text">{{ a.name }}</view>
<button class="ss-reset-button more-btn" @click="toSecondCate(c, '0')"> <button class="ss-reset-button more-btn" @click="toSecondCate(a, '0')">
查看更多 查看更多
<text class="cicon-forward"></text> <text class="cicon-forward"></text>
</button> </button>
</view> </view>
<view class="goods-item-box ss-flex ss-flex-wrap ss-p-b-20"> <view class="goods-item-box ss-flex ss-flex-wrap ss-p-b-20">
<view class="goods-item" v-for="(f, q) in a.children" :key="f.id" <view class="goods-item" v-for="(f, q) in a.children" :key="f.id"
@click="toSecondCate(e, q)" v-if="a.children.length > 0"> @click="toSecondCate(a, q)" v-if="a.children.length > 0">
<view> <view>
<image class="goods-img" :src="f.image" mode="aspectFill"> <image class="goods-img" :src="f.image" mode="aspectFill">
</image> </image>
@ -669,16 +669,25 @@
// //
function toSecondCate(e, index) { function toSecondCate(e, index) {
console.log('列表数据'); console.log('列表数据', e.children);
console.log('查看更多e:', e.id, e.name, index); console.log('查看更多e:', e.id, e.name, index);
// clog // clog
if (e.children.length != 0) { // index'0'""ID
// indexID
if (index === '0' && e.children && e.children.length > 0) {
// ""ID
uni.navigateTo({
url: '/pages/goods/list?categoryId=' + e.id + '&name=' + e.name
})
} else if (typeof index === 'number' && e.children && e.children.length > 0) {
// ID
const thirdId = e.children[index].id; const thirdId = e.children[index].id;
console.log('查看更多-thirdId:', thirdId); console.log('点击三级分类-thirdId:', thirdId);
uni.navigateTo({ uni.navigateTo({
url: '/pages/goods/list?categoryId=' + thirdId + '&name=' + e.name url: '/pages/goods/list?categoryId=' + thirdId + '&name=' + e.name
}) })
} else { } else {
// ID
uni.navigateTo({ uni.navigateTo({
url: '/pages/goods/list?categoryId=' + e.id + '&name=' + e.name url: '/pages/goods/list?categoryId=' + e.id + '&name=' + e.name
}) })

View File

@ -15,8 +15,8 @@
</view> </view>
</view> </view>
</view> </view>
<su-popup :show="showLogin == true" type="center" round="10" <su-popup :show="showLogin == true" type="center" round="10" @close="showLogin = false"
@close="showLogin = false" @open="showLogin = true"> @open="showLogin = true">
<view class="popup"> <view class="popup">
<button class="texbut" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"> <button class="texbut" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
@ -55,8 +55,11 @@
// //
function toLogin() { function toLogin() {
console.log('toLogin——打开登录的弹框', showLogin.value); console.log('toLogin——打开登录的弹框', showLogin.value);
showLogin.value = true; uni.reLaunch({
console.log('showLogin', showLogin.value); url: '/pages/index/login'
});
// showLogin.value = true;
// console.log('showLogin', showLogin.value);
} }
// //
function closeLogin() { function closeLogin() {
@ -121,7 +124,6 @@
resolve(false); resolve(false);
}); });
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,39 +1,239 @@
<template> <template>
<!-- 空登陆页 --> <!-- 空登陆页 -->
<view></view> <view class="app-container">
<view class="header">
<image src="https://mall.jiangxiaoxian.hschool.com.cn/loginLogo.jpg" mode=""></image>
<view class="headerText" style="margin-top: 30rpx;">登录中团小管家</view>
</view>
<view class="input-box">
<input class="accountBox" v-model="loginForm.account" placeholder="账号" placeholder-style="color:#3d3d3d" />
<input class="passBox" v-model="loginForm.password" :password="true" input="safe-password" placeholder="密码"
placeholder-style="color:#3d3d3d"></input>
<!-- <view class="accountBox">
<input class="" v-model="loginForm.accountNum" type="number" placeholder="账号"></input>
</view> -->
<!-- <view class="passBox">
<uni-easyinput v-model="loginForm.password" :password="true"
input="safe-password" placeholder="密码"></uni-easyinput>
</view> -->
</view>
<view class="wxButton">
<button class="login-style" @click="tologin()">
<view class="text">
立即登录
</view>
</button>
</view>
</view>
</template> </template>
<script setup> <script setup>
import { isEmpty } from 'lodash'; import {
isEmpty
} from 'lodash';
import sheep from '@/sheep'; import sheep from '@/sheep';
import { onLoad, onShow } from '@dcloudio/uni-app'; import {
onLoad,
onShow
} from '@dcloudio/uni-app';
import {
computed,
ref,
reactive
} from 'vue';
onLoad(async (options) => { // onLoad(async (options) => {
// #ifdef H5 // // #ifdef H5
let event = ''; // let event = '';
if (options.login_code) { // if (options.login_code) {
event = 'login'; // event = 'login';
const { code } = await sheep.$platform.useProvider().login(options.login_code); // const {
if (code === 1) { // code
sheep.$store('user').getInfo(); // } = await sheep.$platform.useProvider().login(options.login_code);
} // if (code === 1) {
} // sheep.$store('user').getInfo();
if (options.bind_code) { // }
event = 'bind'; // }
const { code } = await sheep.$platform.useProvider().bind(options.bind_code); // if (options.bind_code) {
} // event = 'bind';
// const {
// code
// } = await sheep.$platform.useProvider().bind(options.bind_code);
// }
// H5 // // H5
let returnUrl = uni.getStorageSync('returnUrl'); // let returnUrl = uni.getStorageSync('returnUrl');
if (returnUrl) { // if (returnUrl) {
uni.removeStorage('returnUrl'); // uni.removeStorage('returnUrl');
location.replace(returnUrl); // location.replace(returnUrl);
} else { // } else {
// uni.switchTab({
// url: '/',
// });
// }
// // #endif
// });
const loginForm = ref({
account: '',
password: '',
})
const isLogin = computed(() => sheep.$store('user').isLogin);
function tologin() {
console.log('dengl1', loginForm.value, isLogin.value);
sheep.$api.app.account(loginForm.value).then((res) => {
console.log('res-login:', res)
if (res.code == 1) {
uni.switchTab({ uni.switchTab({
url: '/', url: '/pages/index/category'
}); })
}
})
} }
// #endif onLoad(() => {
}); console.log('dengl1', isLogin.value);
if (isLogin.value == true) {
uni.switchTab({
url: '/pages/index/category'
})
}
})
</script> </script>
<style lang="scss" scoped>
.app-container {
height: 100%;
min-height: 100vh;
/* 确保最小高度为100vh */
padding: 40rpx;
display: flex;
flex-direction: column;
align-items: center;
// justify-content: center;
/* 垂直居中内容 */
background-image: url('https://mall.jiangxiaoxian.hschool.com.cn/loginPageBack.png');
background-size: 100% 100%;
overflow: hidden;
box-sizing: border-box;
position: relative;
.header {
width: 100%;
height: 450rpx;
display: flex;
flex-direction: column;
align-items: left;
justify-content: flex-end;
padding-left: 40rpx;
margin-bottom: 100rpx;
image {
width: 140rpx;
height: 140rpx;
border-radius: 30rpx;
}
.headerText {
margin-top: 30rpx;
color: #323232;
font-size: 48rpx;
font-weight: bold;
line-height: 67rpx;
}
}
.input-box {
margin: 0 auto;
.accountBox {
padding: 0 30rpx;
width: 570rpx;
height: 110rpx;
border-radius: 163rpx;
border: 2rpx solid #323232;
color: #3d3d3d;
font-size: 32rpx;
line-height: 45rpx;
font-weight: bold;
background-color: #fff;
}
.passBox {
margin-top: 30rpx;
padding: 0 30rpx;
width: 570rpx;
height: 110rpx;
border-radius: 163rpx;
border: 2rpx solid #323232;
color: #3d3d3d;
font-size: 32rpx;
line-height: 45rpx;
font-weight: bold;
background-color: #fff;
}
}
.wxButton {
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 670rpx;
margin-top: 60rpx;
.login-style {
background-color: #FEC136;
font-size: 32rpx;
color: #323232;
margin: 20rpx;
border-radius: 100rpx;
width: 100%;
font-weight: bold;
}
image {
position: absolute;
top: 15rpx;
left: 20rpx;
width: 60rpx;
height: 60rpx;
margin-left: 30rpx
}
.text {}
}
.bottom {
display: flex;
font-size: small;
align-items: center;
color: #b1b1b1;
.xieyi {
color: #5de198;
margin: 0 6rpx;
}
}
}
</style>

View File

@ -37,7 +37,7 @@
</view> </view>
</view> </view>
<view class="info-name fs-36 weight8 flexD" v-else> <view class="info-name fs-36 weight8 flexD" v-else>
<view style="font-weight: 800;" @click="toLogin">登录/注册</view> <view style="font-weight: 800;">登录/注册</view>
</view> </view>
<!-- <view class="fs-28 weight4" style="margin-top: 30rpx;">会员到期时间 <!-- <view class="fs-28 weight4" style="margin-top: 30rpx;">会员到期时间
剩余{{ userInfo.all_mobile_num ? userInfo.all_mobile_num : 0 }} 剩余{{ userInfo.all_mobile_num ? userInfo.all_mobile_num : 0 }}
@ -63,11 +63,13 @@
</view> </view>
<view class="myOrder-second"> <view class="myOrder-second">
<view class="pendingBox" @click="toPage('/pages/order/list?type=1')"> <view class="pendingBox" @click="toPage('/pages/order/list?type=1')">
<image class="pendImg" src="https://mall.jiangxiaoxian.hschool.com.cn/pendPay.png"></image> <image class="pendImg" src="https://mall.jiangxiaoxian.hschool.com.cn/pendPay.png">
</image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待支付</view> <view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待支付</view>
</view> </view>
<view class="pendingBox" @click="toPage('/pages/order/list?type=2')"> <view class="pendingBox" @click="toPage('/pages/order/list?type=2')">
<image class="pendImg" src="https://mall.jiangxiaoxian.hschool.com.cn/shipment.png"></image> <image class="pendImg" src="https://mall.jiangxiaoxian.hschool.com.cn/shipment.png">
</image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待发货</view> <view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待发货</view>
</view> </view>
<view class="pendingBox" @click="toPage('/pages/order/list?type=3')"> <view class="pendingBox" @click="toPage('/pages/order/list?type=3')">
@ -76,7 +78,8 @@
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待收货</view> <view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待收货</view>
</view> </view>
<view class="pendingBox" @click="toPage('/pages/order/list?type=4')"> <view class="pendingBox" @click="toPage('/pages/order/list?type=4')">
<image class="pendImg" src="https://mall.jiangxiaoxian.hschool.com.cn/completed.png"></image> <image class="pendImg" src="https://mall.jiangxiaoxian.hschool.com.cn/completed.png">
</image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">已完成</view> <view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">已完成</view>
</view> </view>
</view> </view>
@ -97,7 +100,8 @@
</view> </view>
<view class="line-row" style="margin: 40rpx 0;"></view> <view class="line-row" style="margin: 40rpx 0;"></view>
<!-- 关于我们 --> <!-- 关于我们 -->
<view class="fabuBox" @click="toPage(`/pages/public/richtext?id=`+ appInfo.about_us.id + '&title='+ appInfo.about_us.title)"> <view class="fabuBox"
@click="toPage(`/pages/public/richtext?id=`+ appInfo.about_us.id + '&title='+ appInfo.about_us.title)">
<view class="flex align-items"> <view class="flex align-items">
<image style="width: 36rpx;height: 36rpx;margin-right: 20rpx;" <image style="width: 36rpx;height: 36rpx;margin-right: 20rpx;"
src="https://mall.jiangxiaoxian.hschool.com.cn/aboutUs.png"></image> src="https://mall.jiangxiaoxian.hschool.com.cn/aboutUs.png"></image>
@ -290,7 +294,10 @@
// //
function toLogin() { function toLogin() {
console.log('toLogin', showLogin.value); console.log('toLogin', showLogin.value);
showLogin.value = true; // showLogin.value = true;
uni.reLaunch({
url: '/pages/index/login'
});
console.log('showLogin', showLogin.value); console.log('showLogin', showLogin.value);
} }
// //
@ -433,12 +440,19 @@
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确认退出账号?', content: '确认退出账号?',
success: async function (res) { success: async function(res) {
if (res.confirm) { if (res.confirm) {
const result = await sheep.$store('user').logout(); const result = await sheep.$store('user').logout();
if (result) { if (result) {
sheep.$router.go('/pages/index/user'); // sheep.$router.go('/pages/index/user');
// uni.navigateTo({
// url: '/pages/index/login'
// })
uni.reLaunch({
url: '/pages/index/login'
});
} }
} }
}, },
}); });

View File

@ -4,6 +4,12 @@ import {
} from '@/sheep/config'; } from '@/sheep/config';
export default { export default {
account: (data) =>
request({
url: 'user.user/accountLogin',
method: 'POST',
data,
}),
// 系统初始化 // 系统初始化
init: (templateId) => init: (templateId) =>
request({ request({

View File

@ -16,6 +16,8 @@ import rent from "./rent"
import school from "./school" import school from "./school"
import home from "./home" import home from "./home"
import staff from "./staff" import staff from "./staff"
import loginApi from './login'
export default { export default {
activity, activity,
@ -36,5 +38,6 @@ export default {
school, school,
home, home,
staff, staff,
loginApi
} }

View File

@ -10,4 +10,11 @@ export default {
}), }),
)}`, )}`,
account: (data) =>
request({
url: 'user.user/accountLogin',
method: 'POST',
data,
}),
}; };

View File

@ -2,32 +2,19 @@
<template> <template>
<view class="ss-goods-wrap"> <view class="ss-goods-wrap">
<!-- xs卡片横向紧凑型一行放两个图片左内容右边 --> <!-- xs卡片横向紧凑型一行放两个图片左内容右边 -->
<view <view v-if="size === 'xs'" class="xs-goods-card ss-flex ss-col-stretch" :style="[elStyles]" @tap="onClick">
v-if="size === 'xs'"
class="xs-goods-card ss-flex ss-col-stretch"
:style="[elStyles]"
@tap="onClick"
>
<view v-if="tagStyle.show" class="tag-icon-box"> <view v-if="tagStyle.show" class="tag-icon-box">
<image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src)"></image> <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src)"></image>
</view> </view>
<image class="xs-img-box" :src="sheep.$url.cdn(data.image)" mode="aspectFit"></image> <image class="xs-img-box" :src="sheep.$url.cdn(data.image)" mode="aspectFit"></image>
<view <view v-if="goodsFields.title?.show || goodsFields.price?.show"
v-if="goodsFields.title?.show || goodsFields.price?.show" class="xs-goods-content ss-flex-col ss-row-around">
class="xs-goods-content ss-flex-col ss-row-around" <view v-if="goodsFields.title?.show" class="xs-goods-title ss-line-1"
> :style="[{ color: titleColor, width: titleWidth ? titleWidth + 'rpx' : '' }]">
<view
v-if="goodsFields.title?.show"
class="xs-goods-title ss-line-1"
:style="[{ color: titleColor, width: titleWidth ? titleWidth + 'rpx' : '' }]"
>
{{ data.title }} {{ data.title }}
</view> </view>
<view <view v-if="goodsFields.price?.show && isLogin == true" class="xs-goods-price font-OPPOSANS"
v-if="goodsFields.price?.show && isLogin == true" :style="[{ color: goodsFields.price.color }]">
class="xs-goods-price font-OPPOSANS"
:style="[{ color: goodsFields.price.color }]"
>
<text class="price-unit ss-font-24">{{ priceUnit }}</text> <text class="price-unit ss-font-24">{{ priceUnit }}</text>
{{ isArray(data.price) ? data.price[0] : data.price }} {{ isArray(data.price) ? data.price[0] : data.price }}
</view> </view>
@ -42,19 +29,13 @@
</view> </view>
<image class="sm-img-box" :src="sheep.$url.cdn(data.image)" mode="aspectFill"></image> <image class="sm-img-box" :src="sheep.$url.cdn(data.image)" mode="aspectFill"></image>
<view <view v-if="goodsFields.title?.show || goodsFields.price?.show" class="sm-goods-content"
v-if="goodsFields.title?.show || goodsFields.price?.show" :style="[{ color: titleColor, width: titleWidth ? titleWidth + 'rpx' : '' }]">
class="sm-goods-content"
:style="[{ color: titleColor, width: titleWidth ? titleWidth + 'rpx' : '' }]"
>
<view v-if="goodsFields.title?.show" class="sm-goods-title ss-line-1 ss-m-b-16"> <view v-if="goodsFields.title?.show" class="sm-goods-title ss-line-1 ss-m-b-16">
{{ data.title }} {{ data.title }}
</view> </view>
<view <view v-if="goodsFields.price?.show && isLogin == true" class="sm-goods-price font-OPPOSANS"
v-if="goodsFields.price?.show && isLogin == true" :style="[{ color: goodsFields.price.color }]">
class="sm-goods-price font-OPPOSANS"
:style="[{ color: goodsFields.price.color }]"
>
<text class="price-unit ss-font-24">{{ priceUnit }}</text> <text class="price-unit ss-font-24">{{ priceUnit }}</text>
{{ isArray(data.price) ? data.price[0] : data.price }} {{ isArray(data.price) ? data.price[0] : data.price }}
</view> </view>
@ -67,64 +48,37 @@
<view v-if="tagStyle.show" class="tag-icon-box"> <view v-if="tagStyle.show" class="tag-icon-box">
<image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src)"></image> <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src)"></image>
</view> </view>
<image <image v-if="data.image_wh" class="md-img-box" :src="sheep.$url.cdn(data.image)" mode="widthFix" />
v-if="data.image_wh" <image v-else class="md-img-box" :src="sheep.$url.cdn(data.image)"
class="md-img-box" :style="[{ height: defaultImgWidth * 2 + 'rpx' }]" mode="aspectFill" />
:src="sheep.$url.cdn(data.image)" <view class="md-goods-content ss-flex-col ss-row-around ss-p-b-20 ss-p-t-20 ss-p-x-16" :id="elId">
mode="widthFix" <view v-if="goodsFields.title?.show" class="md-goods-title ss-line-1"
/> :style="[{ color: titleColor, width: titleWidth ? titleWidth + 'rpx' : '' }]">
<image
v-else
class="md-img-box"
:src="sheep.$url.cdn(data.image)"
:style="[{ height: defaultImgWidth * 2 + 'rpx' }]"
mode="aspectFill"
/>
<view
class="md-goods-content ss-flex-col ss-row-around ss-p-b-20 ss-p-t-20 ss-p-x-16"
:id="elId"
>
<view
v-if="goodsFields.title?.show"
class="md-goods-title ss-line-1"
:style="[{ color: titleColor, width: titleWidth ? titleWidth + 'rpx' : '' }]"
>
{{ data.title }} {{ data.title }}
</view> </view>
<view <view v-if="goodsFields.subtitle?.show" class="md-goods-subtitle ss-m-t-16 ss-line-1"
v-if="goodsFields.subtitle?.show" :style="[{ color: subTitleColor, background: subTitleBackground }]">
class="md-goods-subtitle ss-m-t-16 ss-line-1"
:style="[{ color: subTitleColor, background: subTitleBackground }]"
>
{{ data.subtitle }} {{ data.subtitle }}
</view> </view>
<slot name="activity"> <slot name="activity">
<view v-if="data.promos?.length" class="tag-box ss-flex-wrap ss-flex ss-col-center"> <view v-if="data.promos?.length" class="tag-box ss-flex-wrap ss-flex ss-col-center">
<view <view class="activity-tag ss-m-r-10 ss-m-t-16" v-for="item in data.promos" :key="item.id">
class="activity-tag ss-m-r-10 ss-m-t-16"
v-for="item in data.promos"
:key="item.id"
>
{{ item.title }} {{ item.title }}
</view> </view>
</view> </view>
</slot> </slot>
<view class="ss-flex ss-col-bottom"> <view class="ss-flex ss-col-bottom">
<view <view v-if="goodsFields.price?.show && isLogin == true"
v-if="goodsFields.price?.show && isLogin == true"
class="md-goods-price ss-m-t-16 font-OPPOSANS ss-m-r-10" class="md-goods-price ss-m-t-16 font-OPPOSANS ss-m-r-10"
:style="[{ color: goodsFields.price.color }]" :style="[{ color: goodsFields.price.color }]">
>
<text class="price-unit ss-font-24">{{ priceUnit }}</text> <text class="price-unit ss-font-24">{{ priceUnit }}</text>
{{ isArray(data.price) ? data.price[0] : data.price }} {{ isArray(data.price) ? data.price[0] : data.price }}
</view> </view>
<view class="goods-price" v-if="isLogin == false" @click.stop="toLogin">登录查看价格</view> <view class="goods-price" v-if="isLogin == false" @click.stop="toLogin">登录查看价格</view>
<view <view v-if="goodsFields.original_price?.show && data.original_price > 0 && isLogin == true"
v-if="goodsFields.original_price?.show && data.original_price > 0 && isLogin == true"
class="goods-origin-price ss-m-t-16 font-OPPOSANS ss-flex" class="goods-origin-price ss-m-t-16 font-OPPOSANS ss-flex"
:style="[{ color: originPriceColor }]" :style="[{ color: originPriceColor }]">
>
<text class="price-unit ss-font-20">{{ priceUnit }}</text> <text class="price-unit ss-font-20">{{ priceUnit }}</text>
<view class="ss-m-l-8">{{ data.original_price }}</view> <view class="ss-m-l-8">{{ data.original_price }}</view>
</view> </view>
@ -139,12 +93,7 @@
</view> </view>
<!-- lg卡片横向型一行放一个图片左内容右边 --> <!-- lg卡片横向型一行放一个图片左内容右边 -->
<view <view v-if="size === 'lg'" class="lg-goods-card ss-flex ss-col-stretch" :style="[elStyles]" @tap="onClick">
v-if="size === 'lg'"
class="lg-goods-card ss-flex ss-col-stretch"
:style="[elStyles]"
@tap="onClick"
>
<view v-if="tagStyle.show" class="tag-icon-box"> <view v-if="tagStyle.show" class="tag-icon-box">
<image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src)"></image> <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src)"></image>
</view> </view>
@ -155,18 +104,12 @@
<image class="lg-img-box" :src="sheep.$url.cdn(data.image)" mode="aspectFill"></image> <image class="lg-img-box" :src="sheep.$url.cdn(data.image)" mode="aspectFill"></image>
<view class="lg-goods-content ss-flex-1 ss-flex-col ss-row-between ss-p-b-10 ss-p-t-20"> <view class="lg-goods-content ss-flex-1 ss-flex-col ss-row-between ss-p-b-10 ss-p-t-20">
<view> <view>
<view <view v-if="goodsFields.title?.show" class="lg-goods-title ss-line-2"
v-if="goodsFields.title?.show" :style="[{ color: titleColor }]">
class="lg-goods-title ss-line-2"
:style="[{ color: titleColor }]"
>
{{ data.title }} {{ data.title }}
</view> </view>
<view <view v-if="goodsFields.subtitle?.show" class="lg-goods-subtitle ss-m-t-10 ss-line-1"
v-if="goodsFields.subtitle?.show" :style="[{ color: subTitleColor, background: subTitleBackground }]">
class="lg-goods-subtitle ss-m-t-10 ss-line-1"
:style="[{ color: subTitleColor, background: subTitleBackground }]"
>
{{ data.subtitle }} {{ data.subtitle }}
</view> </view>
</view> </view>
@ -179,20 +122,16 @@
</view> </view>
</slot> </slot>
<view class="ss-flex ss-col-bottom ss-m-t-10"> <view class="ss-flex ss-col-bottom ss-m-t-10">
<view <view v-if="goodsFields.price?.show && isLogin == true"
v-if="goodsFields.price?.show && isLogin == true"
class="lg-goods-price ss-m-r-12 ss-flex ss-col-bottom font-OPPOSANS" class="lg-goods-price ss-m-r-12 ss-flex ss-col-bottom font-OPPOSANS"
:style="[{ color: goodsFields.price.color }]" :style="[{ color: goodsFields.price.color }]">
>
<text class="ss-font-24">{{ priceUnit }}</text> <text class="ss-font-24">{{ priceUnit }}</text>
{{ isArray(data.price) ? data.price[0] : data.price }} {{ isArray(data.price) ? data.price[0] : data.price }}
</view> </view>
<view class="goods-price" v-if="isLogin == false" @click.stop="toLogin">登录查看价格</view> <view class="goods-price" v-if="isLogin == false" @click.stop="toLogin">登录查看价格</view>
<view <view v-if="goodsFields.original_price?.show && data.original_price > 0 && isLogin == true"
v-if="goodsFields.original_price?.show && data.original_price > 0 && isLogin == true"
class="goods-origin-price ss-flex ss-col-bottom font-OPPOSANS" class="goods-origin-price ss-flex ss-col-bottom font-OPPOSANS"
:style="[{ color: originPriceColor }]" :style="[{ color: originPriceColor }]">
>
<text class="price-unit ss-font-20">{{ priceUnit }}</text> <text class="price-unit ss-font-20">{{ priceUnit }}</text>
<view class="ss-m-l-8">{{ data.original_price }}</view> <view class="ss-m-l-8">{{ data.original_price }}</view>
</view> </view>
@ -218,29 +157,19 @@
<view class="sl-goods-content"> <view class="sl-goods-content">
<view> <view>
<view <view v-if="goodsFields.title?.show" class="sl-goods-title ss-line-1"
v-if="goodsFields.title?.show" :style="[{ color: titleColor }]">
class="sl-goods-title ss-line-1"
:style="[{ color: titleColor }]"
>
{{ data.title }} {{ data.title }}
</view> </view>
<view <view v-if="goodsFields.subtitle?.show" class="sl-goods-subtitle ss-m-t-16"
v-if="goodsFields.subtitle?.show" :style="[{ color: subTitleColor, background: subTitleBackground }]">
class="sl-goods-subtitle ss-m-t-16"
:style="[{ color: subTitleColor, background: subTitleBackground }]"
>
{{ data.subtitle }} {{ data.subtitle }}
</view> </view>
</view> </view>
<view> <view>
<slot name="activity"> <slot name="activity">
<view v-if="data.promos?.length" class="tag-box ss-flex ss-col-center ss-flex-wrap"> <view v-if="data.promos?.length" class="tag-box ss-flex ss-col-center ss-flex-wrap">
<view <view class="activity-tag ss-m-r-10 ss-m-t-16" v-for="item in data.promos" :key="item.id">
class="activity-tag ss-m-r-10 ss-m-t-16"
v-for="item in data.promos"
:key="item.id"
>
{{ item.title }} {{ item.title }}
</view> </view>
</view> </view>
@ -251,16 +180,14 @@
{{ isArray(data.price) ? data.price[0] : data.price }} {{ isArray(data.price) ? data.price[0] : data.price }}
</view> </view>
<view class="goods-price" v-if="isLogin == false" @click.stop="toLogin">登录查看价格</view> <view class="goods-price" v-if="isLogin == false" @click.stop="toLogin">登录查看价格</view>
<view <view v-if="goodsFields.original_price?.show && data.original_price > 0 && isLogin == true"
v-if="goodsFields.original_price?.show && data.original_price > 0 && isLogin == true"
class="goods-origin-price ss-m-t-16 font-OPPOSANS ss-flex" class="goods-origin-price ss-m-t-16 font-OPPOSANS ss-flex"
:style="[{ color: originPriceColor }]" :style="[{ color: originPriceColor }]">
>
<text class="price-unit ss-font-20">{{ priceUnit }}</text> <text class="price-unit ss-font-20">{{ priceUnit }}</text>
<view class="ss-m-l-8">{{ data.original_price }}</view> <view class="ss-m-l-8">{{ data.original_price }}</view>
</view> </view>
</view> </view>
<view class="ss-m-t-16 ss-flex ss-flex-wrap" > <view class="ss-m-t-16 ss-flex ss-flex-wrap">
<view class="sales-text" style="text-align: left;">{{ salesAndStock }}</view> <view class="sales-text" style="text-align: left;">{{ salesAndStock }}</view>
</view> </view>
</view> </view>
@ -272,8 +199,7 @@
</view> </view>
</view> </view>
<su-popup :show="showLogin == true" type="center" round="10" <su-popup :show="showLogin == true" type="center" round="10" @close="showLogin = false" @open="showLogin = true">
@close="showLogin = false" @open="showLogin = true">
<view class="popup"> <view class="popup">
<button class="texbut" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"> <button class="texbut" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
@ -282,8 +208,9 @@
</button> </button>
</view> </view>
<view style="margin: 0 auto;position: absolute;bottom: -90rpx;width: 100%;text-align: center;"> <view style="margin: 0 auto;position: absolute;bottom: -90rpx;width: 100%;text-align: center;">
<image style="width: 50rpx;height: 50rpx;" src="https://mall.jiangxiaoxian.hschool.com.cn/registerCancel.png" <image style="width: 50rpx;height: 50rpx;"
mode="aspectFill" @click="showLogin = false"></image> src="https://mall.jiangxiaoxian.hschool.com.cn/registerCancel.png" mode="aspectFill"
@click="showLogin = false"></image>
</view> </view>
</su-popup> </su-popup>
</template> </template>
@ -317,11 +244,24 @@
* @event {Function()} click - 点击卡片 * @event {Function()} click - 点击卡片
* *
*/ */
import { computed, ref, reactive, getCurrentInstance, onMounted, nextTick } from 'vue'; import {
computed,
ref,
reactive,
getCurrentInstance,
onMounted,
nextTick
} from 'vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
import { formatSales } from '@/sheep/hooks/useGoods'; import {
import { formatStock } from '@/sheep/hooks/useGoods'; formatSales
import { isArray } from 'lodash'; } from '@/sheep/hooks/useGoods';
import {
formatStock
} from '@/sheep/hooks/useGoods';
import {
isArray
} from 'lodash';
import third from '@/sheep/api/third'; import third from '@/sheep/api/third';
// //
@ -331,7 +271,7 @@
const props = defineProps({ const props = defineProps({
goodsFields: { goodsFields: {
type: [Array, Object], type: [Array, Object],
default() { default () {
return { return {
title: { title: {
show: true, show: true,
@ -453,7 +393,9 @@
}; };
// //
const { proxy } = getCurrentInstance(); const {
proxy
} = getCurrentInstance();
const elId = `sheep_${Math.ceil(Math.random() * 10e5).toString(36)}`; const elId = `sheep_${Math.ceil(Math.random() * 10e5).toString(36)}`;
function getGoodsPriceCardWH() { function getGoodsPriceCardWH() {
@ -493,7 +435,10 @@
// //
function toLogin() { function toLogin() {
console.log('toLogin——打开登录的弹框', showLogin.value); console.log('toLogin——打开登录的弹框', showLogin.value);
showLogin.value = true; // showLogin.value = true;
uni.reLaunch({
url: '/pages/index/login'
});
console.log('showLogin', showLogin.value); console.log('showLogin', showLogin.value);
} }
// //
@ -559,7 +504,6 @@
resolve(false); resolve(false);
}); });
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -81,8 +81,9 @@
</button> </button>
</view> </view>
<view style="margin: 0 auto;position: absolute;bottom: -90rpx;width: 100%;text-align: center;"> <view style="margin: 0 auto;position: absolute;bottom: -90rpx;width: 100%;text-align: center;">
<image style="width: 50rpx;height: 50rpx;" src="https://mall.jiangxiaoxian.hschool.com.cn/registerCancel.png" <image style="width: 50rpx;height: 50rpx;"
mode="aspectFill" @click="showLogin = false"></image> src="https://mall.jiangxiaoxian.hschool.com.cn/registerCancel.png" mode="aspectFill"
@click="showLogin = false"></image>
</view> </view>
</su-popup> </su-popup>
</template> </template>
@ -135,7 +136,10 @@
// //
function toLogin() { function toLogin() {
console.log('toLogin——打开登录的弹框', showLogin.value); console.log('toLogin——打开登录的弹框', showLogin.value);
showLogin.value = true; // showLogin.value = true;
uni.reLaunch({
url: '/pages/index/login'
});
console.log('showLogin', showLogin.value); console.log('showLogin', showLogin.value);
} }
// //