From 3f641219cd68a97c8c8f9f011152a5763d2bba77 Mon Sep 17 00:00:00 2001
From: weipengfei <2187978347@qq.com>
Date: Mon, 6 May 2024 17:58:41 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/orderCanclePopup.vue | 61 ++++++
pages/index/index.vue | 6 +-
pages/login/login.vue | 95 +++++----
pages/my/my.vue | 10 +-
pagesOrder/detail/detail.vue | 118 +++++------
pagesOrder/order/component/good.vue | 7 +-
pagesOrder/order/order.vue | 33 ++-
pagesOrder/settle/settle.vue | 1 -
store/user.js | 29 +--
.../dist/dev/mp-weixin/pages/index/index.js | 85 ++++----
.../dist/dev/mp-weixin/pages/index/index.wxml | 2 +-
.../dist/dev/mp-weixin/pages/login/login.js | 73 ++++---
.../dist/dev/mp-weixin/pages/login/login.json | 2 +-
.../dist/dev/mp-weixin/pages/login/login.wxml | 2 +-
unpackage/dist/dev/mp-weixin/pages/my/my.js | 13 +-
unpackage/dist/dev/mp-weixin/pages/my/my.wxml | 2 +-
.../dev/mp-weixin/pagesOrder/detail/detail.js | 195 ++++++++++--------
.../mp-weixin/pagesOrder/detail/detail.json | 2 +-
.../mp-weixin/pagesOrder/detail/detail.wxml | 2 +-
.../mp-weixin/pagesOrder/detail/detail.wxss | 17 --
.../pagesOrder/order/component/good.js | 34 +--
.../pagesOrder/order/component/good.wxml | 2 +-
.../dev/mp-weixin/pagesOrder/order/order.js | 61 ++++--
.../dev/mp-weixin/pagesOrder/order/order.json | 3 +-
.../dev/mp-weixin/pagesOrder/order/order.wxml | 2 +-
.../dev/mp-weixin/project.private.config.json | 4 +-
26 files changed, 518 insertions(+), 343 deletions(-)
create mode 100644 components/orderCanclePopup.vue
diff --git a/components/orderCanclePopup.vue b/components/orderCanclePopup.vue
new file mode 100644
index 0000000..09d1473
--- /dev/null
+++ b/components/orderCanclePopup.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 5f05f5c..c185b6a 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -7,7 +7,7 @@
-
+
@@ -217,6 +217,7 @@
const changeOrder = (order) => {
console.log('排序', order);
where.value.order = order;
+ getGoodList();
}
const where = ref({
@@ -236,6 +237,8 @@
if(leftActive.value=='') class_all = topActive.value;
if(topActive.value=='') class_all = '';
if(class_all) class_id = ""; //只能带其中一个
+ if (loadmore) where.value.page_no++;
+ else where.value.page_no=1;
goodListApi({
...where.value,
class_all: class_all,
@@ -249,6 +252,7 @@
// 商品列表触底
const loadMoreGood = () => {
console.log('触底了');
+ getGoodList(true);
}
const goodClassList = ref([]); // 一级分类
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 3200376..5816357 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -1,24 +1,23 @@
-
-
+
+
+
+
+
+
欢迎登录惠农批发
- 微信快捷登录
+ 微信快捷登录
- 使用短信验证登录
+ 使用短信验证登录
@@ -26,7 +25,8 @@
-
+
@@ -34,14 +34,14 @@
-
+
-
+
{{tips}}
@@ -60,7 +60,7 @@
-
+
@@ -70,20 +70,20 @@
import { userLoginApi, userLoginWeixinApi, getMobileByMnpApi } from "@/api/user.js";
import useUserStore from "@/store/user.js"
import bindPhone from "@/components/bindPhone.vue"
-
-
-
- const navToIndex = ()=>{
- if(!userStore.userInfo.supplier) uni.reLaunch({
+
+
+
+ const navToIndex = () => {
+ if (!userStore.userInfo.supplier) uni.reLaunch({
url: '/pages/index/index'
})
else uni.$u.toast('功能开发中')
}
const userStore = useUserStore(); //使用pinia进行状态管理
- if(userStore.userInfo&&userStore.userInfo.mobile){
+ if (userStore.userInfo && userStore.userInfo.mobile) {
navToIndex();
- }else {
+ } else {
userStore.setToken('');
userStore.setUserInfo({});
}
@@ -101,11 +101,11 @@
success: (res) => {
userLoginWeixinApi({
code: res.code
- }).then(res=>{
+ }).then(res => {
uni.hideLoading();
userStore.setToken(res.data.token);
userStore.setUserInfo(res.data);
- if(!res.data.mobile) { //未绑定手机号
+ if (!res.data.mobile) { //未绑定手机号
return showBind.value = true;
}
navToIndex();
@@ -121,54 +121,53 @@
const showBind = ref(false); //是否显示绑定手机号弹窗
const getPhoneNumber = (e) => {
console.log("===", e);
- if(e.detail?.errMsg=='getPhoneNumber:ok') {
+ if (e.detail?.errMsg == 'getPhoneNumber:ok') {
getMobileByMnpApi({
code: e.detail.code
- }).then(res=>{
+ }).then(res => {
navToIndex();
})
- }
- else {
+ } else {
console.log("用户拒绝授权");
return uni.$u.toast('您拒绝了授权');
}
}
-
+
const loginForm = ref({
phone: '15366662222',
code: ''
})
- const isPhone = ()=>{ //检验手机号是否正确
- loginForm.value.phone = loginForm.value.phone.replace(/\s*/g,""); //去除空格
+ const isPhone = () => { //检验手机号是否正确
+ loginForm.value.phone = loginForm.value.phone.replace(/\s*/g, ""); //去除空格
return !/^1[3456789]\d{9}$/.test(loginForm.value.phone);
}
- const codeLogin = ()=>{
+ const codeLogin = () => {
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
// 验证码登录
- if(isPhone()) return uni.$u.toast('请输入正确的手机号码');
+ if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
console.log('登录');
userLoginApi({
account: '17811111111',
password: '1111',
terminal: 3,
scene: 1
- }).then(res=>{
+ }).then(res => {
console.log(res);
})
}
-
+
const tips = ref('');
const seconds = ref(60);
const uCodeRef = ref(null);
-
+
const codeChange = (text) => {
tips.value = text;
};
-
+
const getCode = () => {
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
if (uCodeRef.value.canGetCode) {
- if(isPhone()) return uni.$u.toast('请输入正确的手机号码');
+ if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
// 模拟向后端请求验证码
uni.showLoading({
title: '正在获取验证码',
@@ -184,16 +183,14 @@
uni.$u.toast('倒计时结束后再发送');
}
};
-
+
// 微信小程序无法拦截原生返回按钮,所以使用自定义导航拦截返回
- const navBack = ()=>{
- if(showWeixin.value==false) {
+ const navBack = () => {
+ if (showWeixin.value == false) {
showWeixin.value = true;
return true;
- }
- else uni.navigateBack();
+ } else uni.navigateBack();
}
-
\ No newline at end of file
diff --git a/pagesOrder/order/component/good.vue b/pagesOrder/order/component/good.vue
index 294fdc6..ba78298 100644
--- a/pagesOrder/order/component/good.vue
+++ b/pagesOrder/order/component/good.vue
@@ -26,7 +26,7 @@
共 {{datas.goods_count}} 件商品, 总金额 ¥{{datas.total}}
- 取消订单
+ 取消订单
立即支付
@@ -66,6 +66,11 @@
url: `/pagesOrder/detail/detail?type=${props.datas.paid}&id=${props.datas.id}`
})
}
+
+ const emit = defineEmits(['cancleOrder']);
+ const cancleOrder = ()=>{
+ emit('cancleOrder', props.datas)
+ }