This commit is contained in:
weipengfei 2024-06-03 16:45:07 +08:00
parent 63a9974b1e
commit ad58f01675
12 changed files with 937 additions and 857 deletions

View File

@ -17,7 +17,9 @@ export const cartDeleteApi = (data)=>{
//购物车-零售列表
export const cartListApi = (data)=>{
return request.get('/order/cart/list', data);
return request.get('/order/cart/list', data, {
noAuth: true
});
}
//购物车-常买记录

View File

@ -2,17 +2,23 @@ import request from '@/utils/request';
// 密码登录
export const userLoginApi = (data)=>{
return request.post('/login/account', data);
return request.post('/login/account', data, {
noAuth: true
});
}
// 微信登录
export const userLoginWeixinApi = (data)=>{
return request.post('/login/mnpLogin', data);
return request.post('/login/mnpLogin', data, {
noAuth: true
});
}
// 微信获取手机号
export const getMobileByMnpApi = (data)=>{
return request.post('/user/User/getMobileByMnp', data);
return request.post('/user/User/getMobileByMnp', data, {
noAuth: true
});
}
// 更新信息

View File

@ -46,7 +46,7 @@
v-model="formData.contact"></up-input>
</view>
<view class="btn">
<up-button text="提交反馈" @click="submit" shape='circle' color="#20B128"></up-button>
<up-button text="提交反馈" @click="submit" :throttleTime="2000" shape='circle' color="#20B128"></up-button>
<view style="display: flex;align-items: center;margin-top: 20rpx;">
<view style="margin: 0 auto; display: flex;" @click="navgo('/pageQuota/feedBack/list')">
反馈记录 <up-icon name="arrow-right"></up-icon>
@ -133,7 +133,7 @@
const uploadFilePromise = (url) => {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: config.HTTP_REQUEST_URL + '/api/upload/image', //
url: config.HTTP_REQUEST_URL + '/api/upload/image',
filePath: url,
name: 'file',
header: {
@ -149,6 +149,10 @@
};
const submit = async () => {
if(formData.content=='') return uni.showToast({title:'请输入反馈内容',icon:'none'})
uni.showLoading({
title: '提交中'
})
formData.images = formData.images.map(item => {
return item.url
})
@ -156,7 +160,7 @@
await addFeedBackApi({
...formData
})
uni.hideLoading()
uni.showToast({
title: '提交成功',
duration: 1500

View File

@ -9,14 +9,6 @@
}
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/index/index",
"style": {
@ -30,6 +22,14 @@
}
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/cart/cart",
"style": {

View File

@ -13,7 +13,7 @@
<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<scroll-view scroll-y @refresherrefresh="refresherrefresh(1)" :refresher-triggered="triggered" refresher-enabled refresher-background="#F6F6F6" style="height: 100%;width: 100%;">
<view class="page-box1" style="padding-top: 60rpx;">
<view class="total">
<view>共计<text style="color: #20B128;">{{cartList.length}}</text></view>
@ -52,7 +52,7 @@
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<scroll-view scroll-y @refresherrefresh="refresherrefresh(2)" :refresher-triggered="triggered" refresher-enabled refresher-background="#F6F6F6" style="height: 100%;width: 100%;">
<view class="page-box1">
<view v-if="frequentlyList.length>0" class="list">
<view class="shop-item" v-for="(item, index) in frequentlyList" :key="index" @click="openGoodPopup(item)">
@ -172,6 +172,7 @@
//
const deleteCartList = () => {
let list = [];
if(!cartList.value.length) return uni.showToast({ title: '请选择商品', icon: 'none' });
cartList.value.forEach(item => {
if (item.check) list.push(item.cart_id);
})
@ -226,6 +227,9 @@
total_price: res.data?.extend.total_price || '0.00',
count: res.data?.count || 0
}
setTimeout(()=>{
triggered.value = false;
}, 300)
})
}
@ -277,9 +281,18 @@
...where.value
}).then(res => {
frequentlyList.value = res.data;
setTimeout(()=>{
triggered.value = false;
}, 300)
})
}
const triggered = ref(false);
const refresherrefresh = (type=1)=>{
triggered.value = true;
if(type==1) getcartList();
if(type==2) getFrequentlyPurchase();
}
onShow(() => {
getcartList();
@ -304,6 +317,7 @@
flex-direction: column;
height: calc(100vh - var(--window-top));
width: 100%;
background-color: #f6f6f6;
}
.swiper-box {
@ -325,7 +339,6 @@
top: var(--window-top);
left: 0;
right: 0;
background-color: #f6f6f6;
z-index: 100;
height: 60rpx;
line-height: 60rpx;

View File

@ -15,7 +15,7 @@
<text>购物车</text>
</view>
<view class="nav-item" @click="navTo('/pagesOrder/order/order?type=0')">
<image src="@/static/tab/ba.png"></image>
<image src="@/static/tab/da.png"></image>
<text>我的订单</text>
</view>
<view class="nav-item" @click="navTo('/pages/my/my')">
@ -26,8 +26,8 @@
<view class='headScoll' ref='headscroll' :style="{height:isScroll?'0':'200rpx'}">
<scroll-view class="head-view" scroll-x @scrolltolower="getgoodClassList(0)">
<view class="list">
<view class="item" :class="{'item-active': topActive===item.id}"
v-for="(item, index) in goodClassList" :key="index" @click="changeOne(item, index)">
<view class="item" :class="{'item-active': topActive===item.id}" 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-text u-line-1">{{item.name}}</view>
</view>
@ -46,8 +46,8 @@
<view class="head-title">全部分类</view>
<scroll-view scroll-y style="height: 600rpx;">
<view class="list">
<view class="item" :class="{'item-active': topActive===item.id}"
v-for="(item, index) in goodClassList" :key="index" @click="changeOne(item, index)">
<view class="item" :class="{'item-active': topActive===item.id}" 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-text u-line-1">{{item.name}}</view>
@ -58,8 +58,8 @@
</viewPopup>
<view class="scroll-box">
<scroll-view class="left" scroll-y @scrolltolower="getgoodClassList(topActive)">
<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}}
<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}}
</view>
<view style="width: 100%;height: 450rpx;"></view>
</scroll-view>
@ -81,28 +81,24 @@
<view class="item" :class="{'order-active': where.order==''}" @click="changeOrder('')">综合</view>
<view class="item" :class="{'order-active': where.order=='desc'||where.order=='asc'}"
@click="changeOrder(where.order=='asc'?'desc':'asc')">价格</view>
<view class="item" :class="{'order-active': where.order=='sales'}"
@click="changeOrder('sales')">销量</view>
<view class="item" :class="{'order-active': where.order=='sales'}" @click="changeOrder('sales')">销量</view>
</view>
</view>
<viewPopup v-if="show===2" @close="show=0">
<view class="cateOne">
<scroll-view scroll-y style="height: 230rpx;" @scrolltolower="getgoodClassList(leftActive)">
<view class="classify-list">
<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)">
<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)">
{{item.name}}
</view>
</view>
</scroll-view>
</view>
</viewPopup>
<scroll-view class="list" id='drag_area' style="overscroll-behavior: none;" @scroll="hideHeadView"
scroll-y @scrolltolower="loadMoreGood">
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id"
@click="openGoodPopup(item)">
<scroll-view class="list" id='drag_area' style="overscroll-behavior: none;" @scroll="hideHeadView" scroll-y
@scrolltolower="loadMoreGood">
<view class="shop-item" v-for="(item, index) in goodList" :key="item.id" @click="openGoodPopup(item)">
<view class="shop-img">
<up-image width="120rpx" height="120rpx" :src="item.imgs"></up-image>
</view>
@ -178,6 +174,9 @@
getCurrentInstance
} from 'vue';
import useUserStore from "@/store/user";
const userStore = useUserStore();
const test = () => {
@ -299,7 +298,7 @@
const goodClassTow = ref([]); //
const goodClassThree = ref([]); //
const classMap = new Map();
const getgoodClassList = (pid = 0, three=0) => {
const getgoodClassList = (pid = 0, three = 0) => {
let page_no = classMap.get(pid) || 1;
console.log(classMap.get(pid));
goodClassListApi({
@ -309,7 +308,7 @@
three: three
}).then(res => {
if (pid == 0) { //
if(!res.data?.lists?.length) return ;
if (!res.data?.lists?.length) return;
res.data?.lists?.unshift({
id: "",
name: "全部",
@ -381,6 +380,21 @@
}
const navTo = (url) => {
if (!userStore.token) return uni.showModal({
content: '您需要先登录才可使用该功能, 是否前去登录',
success: (e) => {
if (e.confirm) {
userStore.setToken('');
userStore.setUserInfo({});
uni.navigateTo({
url: '/pages/login/login'
})
} else {
userStore.setToken('');
userStore.setUserInfo({});
}
}
})
uni.navigateTo({
url: url
})
@ -397,6 +411,21 @@
};
const changeGood = (data) => { //
showGoodPopup.value = false;
if (!userStore.token) return uni.showModal({
content: '您需要先登录才可使用该功能, 是否前去登录',
success: (e) => {
if (e.confirm) {
userStore.setToken('');
userStore.setUserInfo({});
uni.navigateTo({
url: '/pages/login/login'
})
} else {
userStore.setToken('');
userStore.setUserInfo({});
}
}
})
addCart(data.id, data.cart_num);
}
//

View File

@ -46,7 +46,7 @@
<view class="card">
<up-cell-group>
<up-cell title="我的地址" :isLink="true" url="/pagesOrder/addressList/addressList"></up-cell>
<up-cell title="我的余额" :isLink="true" url="/pageQuota/Balance/index"></up-cell>
<!-- <up-cell title="我的余额" :isLink="true" url="/pageQuota/Balance/index"></up-cell> -->
</up-cell-group>
</view>
@ -74,7 +74,7 @@
const userStore = useUserStore();
const userInfo = userStore.userInfo;
const userInfo = ref({});
const orderCount = ref({
no_pay: 0,
@ -102,6 +102,7 @@
}
onShow(() => {
userInfo.value = userStore.userInfo;
getOrderCount();
})
</script>

View File

@ -41,7 +41,15 @@
})
const rules = ref({
real_name: [{ required: true, message: '请输入姓名', trigger: ['blur'] }],
phone: [{ required: true, message: '请输入手机号', trigger: ['blur'] }],
phone: [{ required: true, message: '请输入手机号', trigger: ['blur'] },{
validator: (rule, value, callback) => {
// truefalse
// uni.$u.test.mobile()truefalse
return uni.$u.test.mobile(value);
},
message: '手机号码不正确',
trigger: ['change','blur'],
}],
detail: [{ required: true, message: '请输入地址', trigger: ['blur'] }]
})
const uForm = ref(null);

View File

@ -75,7 +75,7 @@
</view>
<view class="tips">
<view>{{}}</view>
<view>x{{item.nums+item.goods_unit}}</view>
<view>x{{item.nums}}{{item.unit_name}}</view>
</view>
<view class="time">
{{item.msg}}
@ -243,7 +243,7 @@
addressRef.value.setCheck(addressInfo.value.address_id);
})
if (!res.data.paid) {
targetDate = new Date(res.data.create_time).getTime() + 30 * 60 * 1000;
targetDate = new Date(res.data.create_time).getTime() + 10 * 60 * 1000;
//
timer = setInterval(updateCountdown, 1000);
updateCountdown();

BIN
static/tab/da.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -23,9 +23,9 @@ const useUserStore = defineStore("user", () => {
uni.setStorageSync('token', data)
}
// token.value = "18b6683cd772261fd119c813705ee0f1"
// #ifdef H5
token.value = "6429c7999c9cb3935a3db2ccabb8a706"
// token.value = "3bff209b32d1f1c36e293b9f166bfa0b"
// token.value = "95b24dd6d2dda836fe07854b08ba0944"
userInfo.value = {
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",

View File

@ -38,14 +38,31 @@ function baseRequest(url, method, data, {
if (noVerify)
reslove(res.data);
else if (res.data.code == -1) {
if (res.data.msg == "登录超时,请重新登录") {
if (res.data.msg == "登录超时,请重新登录" && !noAuth) {
userStore.setToken('');
userStore.setUserInfo({});
uni.reLaunch({
uni.showModal({
content: '您需要先登录才可使用该功能, 是否前去登录',
success: (e) => {
if (e.confirm) uni.navigateTo({
url: '/pages/login/login'
})
}
})
}
} else if (res.data.code == 0) {
if (res.data.msg == "请求参数缺token" && !noAuth) {
userStore.setToken('');
userStore.setUserInfo({});
uni.showModal({
content: '您需要先登录才可使用该功能, 是否前去登录',
success: (e) => {
if (e.confirm) uni.navigateTo({
url: '/pages/login/login'
})
}
})
}
reject(res.data);
} else if (res.data.code == 1) {
reslove(res.data);