Compare commits

..

2 Commits

Author SHA1 Message Date
zmj 0a8c7b0504 add 2024-06-22 19:58:02 +08:00
zmj 4b1c909d5e add 2024-06-22 19:48:52 +08:00
3 changed files with 878 additions and 884 deletions

View File

@ -1,5 +1,5 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.share-btn { .share-btn {
display: flex; display: flex;
align-items: center; align-items: center;
position: fixed; position: fixed;
@ -15,7 +15,7 @@
color: #030303; color: #030303;
} }
} }
} }
</style> </style>
<template> <template>
<view class="content"> <view class="content">
@ -23,16 +23,20 @@
<template #left> <template #left>
<view class="store-info"> <view class="store-info">
<view style="display: flex;font-size: 30rpx;font-weight: bold;"> <view style="display: flex;font-size: 30rpx;font-weight: bold;">
<text v-if="userStore.userInfo.user_ship==1 || shareInfo.store_id" <text v-if="userStore.userInfo.user_ship == 1 || shareInfo.store_id"
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{(shareInfo.real_name||( userStore.userInfo.real_name|| userStore.userInfo.nickname)) + '的供销个人门店' }}</text> style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{
(shareInfo.real_name || (
userStore.userInfo.real_name || userStore.userInfo.nickname)) + '的供销个人门店' }}</text>
<text v-else <text v-else
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{STORE_INFO.store_name}}</text> style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{
STORE_INFO.store_name }}</text>
<up-icon name="arrow-right"></up-icon> <up-icon name="arrow-right"></up-icon>
</view> </view>
</view> </view>
</template> </template>
</up-navbar> </up-navbar>
<view class="share-btn" :style="{height:btns.height + 'px',top:btns.top + 'px',left:(btns.left - 40) + 'px'}"> <view class="share-btn"
:style="{ height: btns.height + 'px', top: btns.top + 'px', left: (btns.left - 40) + 'px' }">
<up-button icon="share-square" openType="share" plain size="large" loadingSize="100" /> <up-button icon="share-square" openType="share" plain size="large" loadingSize="100" />
</view> </view>
@ -55,34 +59,34 @@
<text>个人中心</text> <text>个人中心</text>
</view> </view>
</view> </view>
<view class='headScoll' ref='headscroll' :style="{height:isScroll?'0':'200rpx'}"> <view class='headScoll' ref='headscroll' :style="{ height: isScroll ? '0' : '200rpx' }">
<scroll-view class="head-view" scroll-x @scrolltolower="getgoodClassList(0)"> <scroll-view class="head-view" scroll-x @scrolltolower="getgoodClassList(0)">
<view class="list"> <view class="list">
<view class="item" :class="{'item-active': topActive===item.id}" <view class="item" :class="{ 'item-active': topActive === item.id }"
v-for="(item, index) in goodClassList" :key="index" @click="changeOne(item, index)"> v-for="(item, index) in goodClassList" :key="index" @click="changeOne(item, index)">
<view class="c-img"><up-image height="100rpx" width="100rpx" :src="item.pic"></up-image></view> <view class="c-img"><up-image height="100rpx" width="100rpx" :src="item.pic"></up-image></view>
<view class="c-text u-line-1">{{item.name}}</view> <view class="c-text u-line-1">{{ item.name }}</view>
</view> </view>
<view class="item" style="width: 80rpx;height: 20rpx;"> <view class="item" style="width: 80rpx;height: 20rpx;">
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view class="r-btn" @click="show=1"> <view class="r-btn" @click="show = 1">
<view></view> <view></view>
<view></view> <view></view>
<up-icon name="list"></up-icon> <up-icon name="list"></up-icon>
</view> </view>
</view> </view>
<viewPopup nav v-if="show===1" @close="show=0"> <viewPopup nav v-if="show === 1" @close="show = 0">
<view class="cateOne"> <view class="cateOne">
<view class="head-title">全部分类</view> <view class="head-title">全部分类</view>
<scroll-view scroll-y style="height: 600rpx;"> <scroll-view scroll-y style="height: 600rpx;">
<view class="list"> <view class="list">
<view class="item" :class="{'item-active': topActive===item.id}" <view class="item" :class="{ 'item-active': topActive === item.id }"
v-for="(item, index) in goodClassList" :key="index" @click="changeOne(item, index)"> v-for="(item, index) in goodClassList" :key="index" @click="changeOne(item, index)">
<view class="c-img"><up-image height="100rpx" width="100rpx" :src="item.pic"></up-image> <view class="c-img"><up-image height="100rpx" width="100rpx" :src="item.pic"></up-image>
</view> </view>
<view class="c-text u-line-1">{{item.name}}</view> <view class="c-text u-line-1">{{ item.name }}</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@ -90,8 +94,8 @@
</viewPopup> </viewPopup>
<view class="scroll-box"> <view class="scroll-box">
<scroll-view class="left" scroll-y @scrolltolower="getgoodClassList(topActive)"> <scroll-view class="left" scroll-y @scrolltolower="getgoodClassList(topActive)">
<view class="item u-line-1" :class="{'item-active': leftActive===item.id}" <view class="item u-line-1" :class="{ 'item-active': leftActive === item.id }"
v-for="(item, index) in goodClassTow" :key="index" @click="changeTwo(item, index)">{{item.name}} v-for="(item, index) in goodClassTow" :key="index" @click="changeTwo(item, index)">{{ item.name }}
</view> </view>
<view style="width: 100%;height: 450rpx;"></view> <view style="width: 100%;height: 450rpx;"></view>
</scroll-view> </scroll-view>
@ -99,63 +103,62 @@
<view class="classify"> <view class="classify">
<scroll-view style="height: 90rpx;" scroll-x @scrolltolower="getgoodClassList(leftActive)"> <scroll-view style="height: 90rpx;" scroll-x @scrolltolower="getgoodClassList(leftActive)">
<view class="classify-list"> <view class="classify-list">
<view class="classify-list-item u-line-1" :class="{'item-active': rightActive===item.id}" <view class="classify-list-item u-line-1" :class="{ 'item-active': rightActive === item.id }"
v-for="(item, index) in goodClassThree" :key="index" @click="changeThree(item, index)"> v-for="(item, index) in goodClassThree" :key="index" @click="changeThree(item, index)">
{{item.name}} {{ item.name }}
</view> </view>
<view style="width: 70rpx;flex-shrink: 0;"></view> <view style="width: 70rpx;flex-shrink: 0;"></view>
</view> </view>
</scroll-view> </scroll-view>
<view class="done" @click="show=2"> <view class="done" @click="show = 2">
<up-icon name="arrow-down"></up-icon> <up-icon name="arrow-down"></up-icon>
</view> </view>
<view class="order-by"> <view class="order-by">
<view class="item" :class="{'order-active': where.order==''}" @click="changeOrder('')">综合</view> <view class="item" :class="{ 'order-active': where.order == '' }" @click="changeOrder('')">综合</view>
<view class="item" :class="{'order-active': where.order=='desc'||where.order=='asc'}" <view class="item" :class="{ 'order-active': where.order == 'desc' || where.order == 'asc' }"
@click="changeOrder(where.order=='asc'?'desc':'asc')">价格</view> @click="changeOrder(where.order == 'asc' ? 'desc' : 'asc')">价格</view>
<view class="item" :class="{'order-active': where.order=='sales'}" <view class="item" :class="{ 'order-active': where.order == 'sales' }"
@click="changeOrder('sales')">销量</view> @click="changeOrder('sales')">销量
</view> </view>
</view> </view>
<viewPopup v-if="show===2" @close="show=0"> </view>
<viewPopup v-if="show === 2" @close="show = 0">
<view class="cateOne"> <view class="cateOne">
<scroll-view scroll-y style="height: 230rpx;" @scrolltolower="getgoodClassList(leftActive)"> <scroll-view scroll-y style="height: 230rpx;" @scrolltolower="getgoodClassList(leftActive)">
<view class="classify-list"> <view class="classify-list">
<view class="classify-list-item u-line-1" <view class="classify-list-item u-line-1"
:class="{'item-active': rightActive===item.id}" :class="{ 'item-active': rightActive === item.id }"
v-for="(item, index) in goodClassThree" :key="index" v-for="(item, index) in goodClassThree" :key="index" @click="changeThree(item, index)">
@click="changeThree(item, index)"> {{ item.name }}
{{item.name}}
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</viewPopup> </viewPopup>
<scroll-view class="list" id='drag_area' style="overscroll-behavior: none;" @scroll="hideHeadView" <scroll-view class="list" id='drag_area' style="overscroll-behavior: none;" @scroll="hideHeadView" scroll-y
scroll-y @scrolltolower="loadMoreGood"> @scrolltolower="loadMoreGood">
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id" <view class="shop-item" v-for="(item, index) in goodList" :key="item.id" @click="openGoodPopup(item)">
@click="openGoodPopup(item)">
<view class="shop-img" <view class="shop-img"
:style="{backgroundImage: `url(${item.image}?x-oss-process=image/format,webp)`}"> :style="{ backgroundImage: `url(${item.image}?x-oss-process=image/format,webp)` }">
</view> </view>
<view class="shop-content"> <view class="shop-content">
<view class="title"> <view class="title">
<view class="name u-line-2">{{item.store_name}}</view> <view class="name u-line-2">{{ item.store_name }}</view>
<view class="tip u-line-1"> <view class="tip u-line-1">
<text>{{item.spec}}</text> <text>{{ item.spec }}</text>
</view> </view>
</view> </view>
<view style="display: flex;" v-if='item.batch>0'> <view style="display: flex;" v-if='item.batch > 0'>
<view>{{item.batch}}{{item.unit_name }}起卖</view> <view style="color: red;">起批量: {{ item.batch }}{{ item.unit_name }}起卖</view>
</view> </view>
<view style="display: flex;align-items: center;" v-if='userStore?.userInfo?.user_ship==1'> <view style="display: flex;align-items: center;" v-if='userStore?.userInfo?.user_ship == 1'>
<text class='price' style="font-size: 24rpx;">会员价</text> <text class='price' style="font-size: 24rpx;">会员价</text>
<text class="price" style="margin-right: 10rpx;">{{item.vip_price}} <text class="price" style="margin-right: 10rpx;">{{ item.vip_price }}
</text> </text>
<text class='price' style="font-size: 24rpx;">/{{item.unit_name}}</text> <text class='price' style="font-size: 24rpx;">/{{ item.unit_name }}</text>
</view> </view>
<view class="price-btn"> <view class="price-btn">
<view class="price" style="font-size: 24rpx;">{{item.price}}/{{item.unit_name}}</view> <view class="price" style="font-size: 24rpx;">{{ item.price }}/{{ item.unit_name }}</view>
<view class="btn"> <view class="btn">
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon> <u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
</view> </view>
@ -170,7 +173,7 @@
<view class="price-info"> <view class="price-info">
<view class="row"> <view class="row">
<view>合计</view> <view>合计</view>
<view class="price">¥<text style="font-size: 36rpx;">{{cartInfo.total_price}}</text></view> <view class="price">¥<text style="font-size: 36rpx;">{{ cartInfo.total_price }}</text></view>
</view> </view>
<!-- <view class="row"> <!-- <view class="row">
<view style="color: #777;">原价 ¥50.00</view> <view style="color: #777;">原价 ¥50.00</view>
@ -178,62 +181,62 @@
</view> --> </view> -->
</view> </view>
<view class="btn"> <view class="btn">
<up-button color="#20b128" :disabled="cartInfo.total_price<500" @click="settleAccounts"> <up-button color="#20b128" :disabled="cartInfo.total_price < 500" @click="settleAccounts">
{{cartInfo.total_price<500?"¥500起订":"结算" }} </up-button> {{ cartInfo.total_price < 500 ? "¥500起订" : "结算" }} </up-button>
</view> </view>
<view class="cart" @click="navTo('/pages/cart/cart')"> <view class="cart" @click="navTo('/pages/cart/cart')">
<image src="@/static/icon/cart.png"></image> <image src="@/static/icon/cart.png"></image>
<view class="badge">{{cartInfo.count}}</view> <view class="badge">{{ cartInfo.count }}</view>
</view> </view>
</view> </view>
<goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup=false" @change="changeGood" /> <goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup = false" @change="changeGood" />
</view> </view>
</template> </template>
<script setup> <script setup>
import { import {
onLoad, onLoad,
onShow, onShow,
onShareAppMessage, onShareAppMessage,
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
import { import {
reactive, reactive,
ref, ref,
onMounted, onMounted,
} from "vue" } from "vue"
import { import {
goodListApi, goodListApi,
goodClassListApi goodClassListApi
} from "@/api/good.js" } from "@/api/good.js"
import { import {
cartCreateApi, cartCreateApi,
cartChangeApi, cartChangeApi,
cartListApi cartListApi
} from "@/api/cart.js"; } from "@/api/cart.js";
import { import {
productLogApi, productLogApi,
userInfoApi, userInfoApi,
getStoreInfo getStoreInfo
} from "@/api/user.js"; } from "@/api/user.js";
import viewPopup from "@/components/viewPopup.vue" import viewPopup from "@/components/viewPopup.vue"
import goodPopup from "@/components/goodPopup.vue" import goodPopup from "@/components/goodPopup.vue"
import useCartStore from "@/store/cart.js" import useCartStore from "@/store/cart.js"
import { import {
getCurrentInstance getCurrentInstance
} from 'vue'; } from 'vue';
import { import {
shopDetailApi shopDetailApi
} from "@/api/multipleShop.js"; } from "@/api/multipleShop.js";
import useUserStore from "@/store/user"; import useUserStore from "@/store/user";
const userStore = useUserStore(); const userStore = useUserStore();
const STORE_INFO = reactive({ const STORE_INFO = reactive({
id: 4, id: 4,
store_name: "农(特)产品直营店" store_name: "农(特)产品直营店"
}) })
const getStoreInfoFn = () => { const getStoreInfoFn = () => {
if (uni.getStorageSync('STORE_INFO').length) { if (uni.getStorageSync('STORE_INFO').length) {
let data = JSON.parse(uni.getStorageSync('STORE_INFO')) let data = JSON.parse(uni.getStorageSync('STORE_INFO'))
for (let key in data) { for (let key in data) {
@ -247,12 +250,12 @@
STORE_INFO[key] = data[key] STORE_INFO[key] = data[key]
} }
}) })
} }
getStoreInfoFn() getStoreInfoFn()
// //
onShareAppMessage(() => { onShareAppMessage(() => {
let shareStr = '?id=' + STORE_INFO.id; let shareStr = '?id=' + STORE_INFO.id;
if (userStore.userInfo.user_ship == 1) { if (userStore.userInfo.user_ship == 1) {
shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo
@ -270,26 +273,26 @@
} }
}; };
return shareInfo; return shareInfo;
}) })
/*商品列表滚动隐藏头部导航 */ /*商品列表滚动隐藏头部导航 */
const targetHeight = ref(0) const targetHeight = ref(0)
let scoHeight = 0 let scoHeight = 0
const isScroll = ref(false) const isScroll = ref(false)
let lastScollTop = 0 let lastScollTop = 0
const hideHeadView = (e) => { const hideHeadView = (e) => {
if (e.detail.scrollTop < 100) return if (e.detail.scrollTop < 100) return
if (e.detail.scrollTop <= 0 || e.detail.scrollTop > targetHeight.value) if (e.detail.scrollTop <= 0 || e.detail.scrollTop > targetHeight.value)
return return
isScroll.value = e.detail.scrollTop > lastScollTop isScroll.value = e.detail.scrollTop > lastScollTop
lastScollTop = e.detail.scrollTop lastScollTop = e.detail.scrollTop
} }
/*商品列表滚动隐藏头部导航结束 */ /*商品列表滚动隐藏头部导航结束 */
const cartStore = useCartStore(); const cartStore = useCartStore();
const show = ref(0); const show = ref(0);
const topActive = ref(0); const topActive = ref(0);
const changeOne = async (item, index) => { const changeOne = async (item, index) => {
topActive.value = item.id; topActive.value = item.id;
show.value = 0; show.value = 0;
goodClassTow.value = item?.children || []; goodClassTow.value = item?.children || [];
@ -298,10 +301,10 @@
rightActive.value = goodClassThree.value[0]?.id || ''; rightActive.value = goodClassThree.value[0]?.id || '';
getGoodList(); getGoodList();
if (!item.isLoading && item.id) getgoodClassList(topActive.value, 2); // , , if (!item.isLoading && item.id) getgoodClassList(topActive.value, 2); // , ,
} }
const leftActive = ref(0); const leftActive = ref(0);
const changeTwo = (item, index) => { const changeTwo = (item, index) => {
isScroll.value = false; isScroll.value = false;
getWXDom(instance) getWXDom(instance)
leftActive.value = item.id; leftActive.value = item.id;
@ -310,16 +313,16 @@
rightActive.value = goodClassThree.value[0]?.id || ''; rightActive.value = goodClassThree.value[0]?.id || '';
getGoodList(); getGoodList();
if (!item.isLoading && item.id) getgoodClassList(leftActive.value, 3); // , , if (!item.isLoading && item.id) getgoodClassList(leftActive.value, 3); // , ,
} }
const rightActive = ref(0); const rightActive = ref(0);
const changeThree = (item, index) => { const changeThree = (item, index) => {
rightActive.value = item.id; rightActive.value = item.id;
show.value = 0; show.value = 0;
getGoodList(); getGoodList();
} }
const addCart = (product_id, cart_num) => { // const addCart = (product_id, cart_num) => { //
cartCreateApi({ cartCreateApi({
cart_num: cart_num, cart_num: cart_num,
is_new: 0, // 01 is_new: 0, // 01
@ -331,33 +334,33 @@
}).catch(err => { }).catch(err => {
uni.$u.toast(err.msg || '添加失败') uni.$u.toast(err.msg || '添加失败')
}) })
} }
const keyword = ref(''); const keyword = ref('');
const searchKeyword = () => { const searchKeyword = () => {
where.value.name = keyword.value; where.value.name = keyword.value;
where.value.store_name = keyword.value; where.value.store_name = keyword.value;
getGoodList(); getGoodList();
} }
const changeOrder = (order) => { const changeOrder = (order) => {
where.value.order = order; where.value.order = order;
getGoodList(); getGoodList();
} }
const where = ref({ const where = ref({
page_no: 1, page_no: 1,
page_size: 15, page_size: 15,
name: '', name: '',
order: '', order: '',
store_name: '', store_name: '',
store_id: STORE_INFO.id store_id: STORE_INFO.id
}) })
const loading = ref(true); const loading = ref(true);
const goodList = ref([]); const goodList = ref([]);
const getGoodList = (loadmore = false) => { const getGoodList = (loadmore = false) => {
loading.value = true; loading.value = true;
let class_id = rightActive.value || leftActive.value || topActive.value || ''; let class_id = rightActive.value || leftActive.value || topActive.value || '';
let class_all = ''; let class_all = '';
@ -382,20 +385,20 @@
// STORE_INFO.value.detailed_address = res.data.store.detailed_address; // STORE_INFO.value.detailed_address = res.data.store.detailed_address;
// } // }
}) })
} }
// //
const loadMoreGood = () => { const loadMoreGood = () => {
getWXDom(instance) getWXDom(instance)
getGoodList(true); getGoodList(true);
} }
const goodClassList = ref([]); // const goodClassList = ref([]); //
const goodClassTow = ref([]); // const goodClassTow = ref([]); //
const goodClassThree = ref([]); // const goodClassThree = ref([]); //
const classMap = new Map(); const classMap = new Map();
const getgoodClassList = (pid = 0, three = 1) => { const getgoodClassList = (pid = 0, three = 1) => {
let page_no = classMap.get(pid) || 1; let page_no = classMap.get(pid) || 1;
goodClassListApi({ goodClassListApi({
pid: pid, pid: pid,
@ -474,9 +477,9 @@
page_no++; page_no++;
classMap.set(pid, page_no); classMap.set(pid, page_no);
}) })
} }
const navTo = (url) => { const navTo = (url) => {
if (!userStore.token || !userStore.userInfo.mobile) return uni.showModal({ if (!userStore.token || !userStore.userInfo.mobile) return uni.showModal({
content: '您需要先登录才可使用该功能, 是否前去登录', content: '您需要先登录才可使用该功能, 是否前去登录',
success: (e) => { success: (e) => {
@ -495,13 +498,13 @@
uni.navigateTo({ uni.navigateTo({
url: url url: url
}) })
} }
// //
const showGoodPopup = ref(false); const showGoodPopup = ref(false);
const goodRef = ref(null); const goodRef = ref(null);
const goodData = ref({}); const goodData = ref({});
const openGoodPopup = (item) => { // / const openGoodPopup = (item) => { // /
goodData.value = item; goodData.value = item;
goodRef.value.setData(item); goodRef.value.setData(item);
showGoodPopup.value = true; showGoodPopup.value = true;
@ -512,8 +515,8 @@
cate_id: item.cate_id, cate_id: item.cate_id,
store_id: STORE_INFO.id store_id: STORE_INFO.id
}); });
}; };
const changeGood = (data) => { // const changeGood = (data) => { //
showGoodPopup.value = false; showGoodPopup.value = false;
if (!userStore.token) return uni.showModal({ if (!userStore.token) return uni.showModal({
content: '您需要先登录才可使用该功能, 是否前去登录', content: '您需要先登录才可使用该功能, 是否前去登录',
@ -532,20 +535,20 @@
}); });
addCart(data.product_id, data.cart_num); addCart(data.product_id, data.cart_num);
} }
// //
const settleAccounts = () => { const settleAccounts = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pagesOrder/settle/settle' url: '/pagesOrder/settle/settle'
}) })
} }
// //
const cartInfo = ref({ const cartInfo = ref({
total_price: '0.00', total_price: '0.00',
count: 0 count: 0
}) })
const getCartList = (res) => { const getCartList = (res) => {
cartListApi({ cartListApi({
page_no: 1, page_no: 1,
page_size: 100, page_size: 100,
@ -556,32 +559,32 @@
} }
cartStore.setCartList(res.data?.lists.map(item => item.id)) cartStore.setCartList(res.data?.lists.map(item => item.id))
}) })
} }
// //
const btns = ref({ const btns = ref({
height: 0, height: 0,
top: 0, top: 0,
bottom: 0, bottom: 0,
left: 0 left: 0
}); });
// //
const shareInfo = ref({ const shareInfo = ref({
uid: '', uid: '',
real_name: '', real_name: '',
store_id: '' store_id: ''
}); });
const getShareInfo = () => { const getShareInfo = () => {
if (uni.getStorageSync('SHARE_INFO')) { if (uni.getStorageSync('SHARE_INFO')) {
shareInfo.value = (uni.getStorageSync('SHARE_INFO')) shareInfo.value = (uni.getStorageSync('SHARE_INFO'))
} }
} }
getShareInfo() getShareInfo()
onLoad(async (opt) => { onLoad(async (opt) => {
where.value.store_id = opt.id || STORE_INFO.id; where.value.store_id = opt.id || STORE_INFO.id;
// id // id
if (opt.id) { if (opt.id) {
@ -603,9 +606,9 @@
// //
btns.value = uni.getMenuButtonBoundingClientRect(); btns.value = uni.getMenuButtonBoundingClientRect();
// #endif // #endif
}) })
onShow(() => { onShow(() => {
// //
if (userStore.token && userStore.userInfo.mobile) { if (userStore.token && userStore.userInfo.mobile) {
userInfoApi().then(res => { userInfoApi().then(res => {
@ -620,11 +623,11 @@
} }
}); });
} }
}); });
let instance; // let instance; //
const getWXDom = () => { const getWXDom = () => {
let query = uni.createSelectorQuery().in(instance).select("#drag_area"); let query = uni.createSelectorQuery().in(instance).select("#drag_area");
query.fields({ query.fields({
size: true, size: true,
@ -635,22 +638,22 @@
targetHeight.value = data.scrollHeight - data.height targetHeight.value = data.scrollHeight - data.height
} }
).exec(); ).exec();
} }
onMounted(() => { onMounted(() => {
instance = getCurrentInstance(); // instance = getCurrentInstance(); //
setTimeout(() => { setTimeout(() => {
getWXDom(instance) getWXDom(instance)
}, 500) }, 500)
}) })
</script> </script>
<style lang="scss"> <style lang="scss">
.content { .content {
background-color: #fff; background-color: #fff;
} }
.navbar { .navbar {
padding: 0 20rpx; padding: 0 20rpx;
display: flex; display: flex;
align-items: center; align-items: center;
@ -671,7 +674,7 @@
width: 40rpx; width: 40rpx;
} }
.badge{ .badge {
position: absolute; position: absolute;
top: -10rpx; top: -10rpx;
right: 0; right: 0;
@ -681,10 +684,11 @@
border-radius: 50rpx; border-radius: 50rpx;
font-size: 18rpx; font-size: 18rpx;
} }
}
}
.head-view { }
}
.head-view {
background-color: #fff; background-color: #fff;
height: 180rpx; height: 180rpx;
width: 750rpx; width: 750rpx;
@ -734,9 +738,9 @@
} }
} }
} }
} }
.r-btn { .r-btn {
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
@ -749,9 +753,9 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: -10rpx 0 60rpx 1rpx rgba(0, 0, 0, 0.3); box-shadow: -10rpx 0 60rpx 1rpx rgba(0, 0, 0, 0.3);
} }
.cateOne { .cateOne {
background-color: #fff; background-color: #fff;
.head-title { .head-title {
@ -834,9 +838,9 @@
background-color: rgba(#20b128, 0.1); background-color: rgba(#20b128, 0.1);
} }
} }
} }
.scroll-box { .scroll-box {
// background-color: red; // background-color: red;
display: flex; display: flex;
@ -1006,9 +1010,9 @@
} }
} }
} }
} }
.fiexd-btn-box { .fiexd-btn-box {
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
height: 140rpx; height: 140rpx;
height: calc(constant(safe-area-inset-bottom) + 140rpx); height: calc(constant(safe-area-inset-bottom) + 140rpx);
@ -1061,16 +1065,16 @@
font-size: 18rpx; font-size: 18rpx;
} }
} }
} }
.headScoll { .headScoll {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
transition: 400ms; transition: 400ms;
} }
.store-info { .store-info {
margin: 0 0 20rpx 20rpx; margin: 0 0 20rpx 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
</style> </style>

View File

@ -9,7 +9,7 @@
<view class="login-box"> <view class="login-box">
<image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png"> <image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png">
</image> </image>
<view class="tips">欢迎登录惠农批发</view> <view class="tips">欢迎登录泸优采</view>
<block v-if="showWeixin"> <block v-if="showWeixin">
<up-transition :show="showWeixin"> <up-transition :show="showWeixin">
<view class="btn"> <view class="btn">
@ -18,7 +18,7 @@
</view> </view>
<view class="btn" v-if="config.ENV=='dev'"> <view class="btn" v-if="config.ENV=='dev'">
<up-button @click="navgo('/pages/login/test')" color="#20B128" size="large"><up-icon <up-button @click="navgo('/pages/login/test')" color="#20B128" size="large"><up-icon
name="weixin-fill" color="#fff" size="28"></up-icon></up-button> name="account-fill" color="#fff" size="28"></up-icon></up-button>
</view> </view>
<!-- <view class="btn"> <!-- <view class="btn">
<up-button @click="officialCode" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff" <up-button @click="officialCode" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"

View File

@ -3,12 +3,13 @@
<view style="text-align: center;"> <view style="text-align: center;">
<image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png"> <image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png">
</image> </image>
<view class="tips">欢迎登录惠农批发</view> <view class="tips">欢迎登录泸优采</view>
</view> </view>
<view class='card'> <view class='card'>
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<text>手机号</text> <up-input v-model="formData.account" placeholder="请输入手机号"></up-input> <text>手机号</text>
<up-input v-model="formData.account" placeholder="请输入手机号"></up-input>
</view> </view>
<view style="margin: 30rpx 0;"> <view style="margin: 30rpx 0;">
</view> </view>
@ -24,18 +25,12 @@
</view> </view>
</view> </view>
</view> </view>
<view class="submit-btn"> <view class="submit-btn">
<up-button @click="submit" color="#20B128" size="large"> <up-button @click="submit" color="#20B128" size="large">
登录</up-button> 登录</up-button>
</view> </view>
</view> </view>
</template> </template>
@ -92,16 +87,11 @@
const submit = () => { const submit = () => {
userLoginApi({ userLoginApi({
account: zh.value, ...formData
"password": "123456",
"terminal": 2,
"scene": 1
}).then(res => { }).then(res => {
getStoreInfo().then(res => { getStoreInfo().then(res => {
uni.setStorageSync("STORE_INFO", JSON.stringify(res.data)) uni.setStorageSync("STORE_INFO", JSON.stringify(res.data))
}) })
uni.setStorageSync('token', res.data.token); uni.setStorageSync('token', res.data.token);
userStore.setToken(res.data.token); userStore.setToken(res.data.token);
console.log(res.data.token) console.log(res.data.token)