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)=>{ 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)=>{ export const userLoginApi = (data)=>{
return request.post('/login/account', data); return request.post('/login/account', data, {
noAuth: true
});
} }
// 微信登录 // 微信登录
export const userLoginWeixinApi = (data)=>{ export const userLoginWeixinApi = (data)=>{
return request.post('/login/mnpLogin', data); return request.post('/login/mnpLogin', data, {
noAuth: true
});
} }
// 微信获取手机号 // 微信获取手机号
export const getMobileByMnpApi = (data)=>{ 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> v-model="formData.contact"></up-input>
</view> </view>
<view class="btn"> <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="display: flex;align-items: center;margin-top: 20rpx;">
<view style="margin: 0 auto; display: flex;" @click="navgo('/pageQuota/feedBack/list')"> <view style="margin: 0 auto; display: flex;" @click="navgo('/pageQuota/feedBack/list')">
反馈记录 <up-icon name="arrow-right"></up-icon> 反馈记录 <up-icon name="arrow-right"></up-icon>
@ -133,7 +133,7 @@
const uploadFilePromise = (url) => { const uploadFilePromise = (url) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let a = uni.uploadFile({ let a = uni.uploadFile({
url: config.HTTP_REQUEST_URL + '/api/upload/image', // url: config.HTTP_REQUEST_URL + '/api/upload/image',
filePath: url, filePath: url,
name: 'file', name: 'file',
header: { header: {
@ -149,6 +149,10 @@
}; };
const submit = async () => { const submit = async () => {
if(formData.content=='') return uni.showToast({title:'请输入反馈内容',icon:'none'})
uni.showLoading({
title: '提交中'
})
formData.images = formData.images.map(item => { formData.images = formData.images.map(item => {
return item.url return item.url
}) })
@ -156,7 +160,7 @@
await addFeedBackApi({ await addFeedBackApi({
...formData ...formData
}) })
uni.hideLoading()
uni.showToast({ uni.showToast({
title: '提交成功', title: '提交成功',
duration: 1500 duration: 1500

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -41,7 +41,15 @@
}) })
const rules = ref({ const rules = ref({
real_name: [{ required: true, message: '请输入姓名', trigger: ['blur'] }], 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'] }] detail: [{ required: true, message: '请输入地址', trigger: ['blur'] }]
}) })
const uForm = ref(null); const uForm = ref(null);

View File

@ -75,7 +75,7 @@
</view> </view>
<view class="tips"> <view class="tips">
<view>{{}}</view> <view>{{}}</view>
<view>x{{item.nums+item.goods_unit}}</view> <view>x{{item.nums}}{{item.unit_name}}</view>
</view> </view>
<view class="time"> <view class="time">
{{item.msg}} {{item.msg}}
@ -243,7 +243,7 @@
addressRef.value.setCheck(addressInfo.value.address_id); addressRef.value.setCheck(addressInfo.value.address_id);
}) })
if (!res.data.paid) { 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); timer = setInterval(updateCountdown, 1000);
updateCountdown(); 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) uni.setStorageSync('token', data)
} }
// token.value = "18b6683cd772261fd119c813705ee0f1"
// #ifdef H5 // #ifdef H5
// token.value = "3bff209b32d1f1c36e293b9f166bfa0b"
token.value = "6429c7999c9cb3935a3db2ccabb8a706"
// token.value = "95b24dd6d2dda836fe07854b08ba0944" // token.value = "95b24dd6d2dda836fe07854b08ba0944"
userInfo.value = { userInfo.value = {
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png", avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",

View File

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