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;

File diff suppressed because it is too large Load Diff

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

@ -1,5 +1,5 @@
import {
config
config
} from '@/config/app';
import useUserStore from '@/store/user';
@ -7,72 +7,89 @@ import useUserStore from '@/store/user';
const userStore = useUserStore();
function baseRequest(url, method, data, {
noAuth = false,
noVerify = false,
onReLogin = false
noAuth = false,
noVerify = false,
onReLogin = false
}) {
let Url = config.HTTP_REQUEST_URL,
header = config.HEADER;
if (userStore.userInfo) {
header.TOKEN = userStore.token
}
let Url = config.HTTP_REQUEST_URL,
header = config.HEADER;
if (userStore.userInfo) {
header.TOKEN = userStore.token
}
return new Promise((reslove, reject) => {
uni.request({
url: Url + '/api' + url,
method: method || 'GET',
header: {
...header
},
data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {},
success: (res) => {
// console.log(res, 'res')
return new Promise((reslove, reject) => {
uni.request({
url: Url + '/api' + url,
method: method || 'GET',
header: {
...header
},
data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {},
success: (res) => {
// console.log(res, 'res')
if (res.data.show) {
uni.showToast({
title: res.data.msg || '操作成功',
icon: 'none',
})
}
if (noVerify)
reslove(res.data);
else if (res.data.code == -1) {
if (res.data.msg == "登录超时,请重新登录") {
userStore.setToken('');
userStore.setUserInfo({});
uni.reLaunch({
url: '/pages/login/login'
})
}
} else if (res.data.code == 0) {
reject(res.data);
} else if (res.data.code == 1) {
reslove(res.data);
} else if (res.data.code == 200) {
reslove(res.data.data);
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
reject(res.data);
} else if (res.data.code == 501) {
reject(res.data);
} else {
reject(res.data.msg || '请检查网络');
}
},
fail: (message) => {
console.log(message, '错误信息')
uni.showToast({
title: '网络错误',
icon: 'none'
})
reject('请求失败');
}
})
});
if (res.data.show) {
uni.showToast({
title: res.data.msg || '操作成功',
icon: 'none',
})
}
if (noVerify)
reslove(res.data);
else if (res.data.code == -1) {
if (res.data.msg == "登录超时,请重新登录" && !noAuth) {
userStore.setToken('');
userStore.setUserInfo({});
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);
} else if (res.data.code == 200) {
reslove(res.data.data);
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
reject(res.data);
} else if (res.data.code == 501) {
reject(res.data);
} else {
reject(res.data.msg || '请检查网络');
}
},
fail: (message) => {
console.log(message, '错误信息')
uni.showToast({
title: '网络错误',
icon: 'none'
})
reject('请求失败');
}
})
});
}
const syhttp = {};
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
syhttp[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
syhttp[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
});
export default syhttp;