From 6878ac04c91297e6c4ca894ffcf1055f449a2de4 Mon Sep 17 00:00:00 2001
From: sfmind <130201237@qq.com>
Date: Mon, 5 Dec 2022 21:51:39 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E3=80=81=E7=BB=93?=
=?UTF-8?q?=E7=AE=97=E5=92=8C=E8=AE=A2=E5=8D=95=E5=88=9D=E5=A7=8B=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-ui-app/api/cart.js | 5 +
yudao-ui-app/api/order.js | 4 +
.../yd-address-select/yd-address-select.vue | 106 +++++++++
.../components/yd-banner/yd-banner.vue | 2 +-
.../yd-cart-product/yd-cart-product.vue | 116 ++++++++++
.../yd-order-product/yd-order-product.vue | 100 ++++++++
.../yd-product-more/yd-product-more.vue | 2 +-
yudao-ui-app/pages.json | 18 ++
yudao-ui-app/pages/cart/cart.vue | 199 ++++++++++++++--
yudao-ui-app/pages/checkout/checkout.vue | 219 ++++++++++++++++++
yudao-ui-app/pages/index/index.vue | 2 +-
yudao-ui-app/pages/order/order.vue | 91 ++++++++
yudao-ui-app/pages/profile/profile.vue | 7 +-
yudao-ui-app/pages/setting/setting.vue | 62 +++++
yudao-ui-app/pages/user/user.vue | 75 ++++--
yudao-ui-app/store/index.js | 4 +-
yudao-ui-app/store/mudules/cart.js | 28 +++
17 files changed, 994 insertions(+), 46 deletions(-)
create mode 100644 yudao-ui-app/api/cart.js
create mode 100644 yudao-ui-app/api/order.js
create mode 100644 yudao-ui-app/components/yd-address-select/yd-address-select.vue
create mode 100644 yudao-ui-app/components/yd-cart-product/yd-cart-product.vue
create mode 100644 yudao-ui-app/components/yd-order-product/yd-order-product.vue
create mode 100644 yudao-ui-app/pages/checkout/checkout.vue
create mode 100644 yudao-ui-app/pages/order/order.vue
create mode 100644 yudao-ui-app/pages/setting/setting.vue
create mode 100644 yudao-ui-app/store/mudules/cart.js
diff --git a/yudao-ui-app/api/cart.js b/yudao-ui-app/api/cart.js
new file mode 100644
index 000000000..c7d0a0091
--- /dev/null
+++ b/yudao-ui-app/api/cart.js
@@ -0,0 +1,5 @@
+const { http } = uni.$u
+
+//获取购物车数据
+export const getCartProductDetail = () => http.get('/trade/cart/get-detail')
+
diff --git a/yudao-ui-app/api/order.js b/yudao-ui-app/api/order.js
new file mode 100644
index 000000000..4e3a100ad
--- /dev/null
+++ b/yudao-ui-app/api/order.js
@@ -0,0 +1,4 @@
+const { http } = uni.$u
+
+//获得订单交易分页
+export const getOrderPageData = params => http.get('/trade/order/page', { params })
diff --git a/yudao-ui-app/components/yd-address-select/yd-address-select.vue b/yudao-ui-app/components/yd-address-select/yd-address-select.vue
new file mode 100644
index 000000000..795dcad18
--- /dev/null
+++ b/yudao-ui-app/components/yd-address-select/yd-address-select.vue
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+ 默认
+
+
+
+
+
+
+
+ {{ address.name }}
+ {{ address.mobile }}
+
+
+
+
+
+
+
+
+
diff --git a/yudao-ui-app/components/yd-banner/yd-banner.vue b/yudao-ui-app/components/yd-banner/yd-banner.vue
index cef660699..6f6d38145 100644
--- a/yudao-ui-app/components/yd-banner/yd-banner.vue
+++ b/yudao-ui-app/components/yd-banner/yd-banner.vue
@@ -11,7 +11,7 @@
* 广告滚动图
*/
export default {
- name: 'mkt-banner',
+ name: 'yd-banner',
components: {},
props: {
keyName: {
diff --git a/yudao-ui-app/components/yd-cart-product/yd-cart-product.vue b/yudao-ui-app/components/yd-cart-product/yd-cart-product.vue
new file mode 100644
index 000000000..c6cc674b8
--- /dev/null
+++ b/yudao-ui-app/components/yd-cart-product/yd-cart-product.vue
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yudao-ui-app/components/yd-order-product/yd-order-product.vue b/yudao-ui-app/components/yd-order-product/yd-order-product.vue
new file mode 100644
index 000000000..6e662baec
--- /dev/null
+++ b/yudao-ui-app/components/yd-order-product/yd-order-product.vue
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 共 {{ item.productCount }} 件 小计:
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yudao-ui-app/components/yd-product-more/yd-product-more.vue b/yudao-ui-app/components/yd-product-more/yd-product-more.vue
index c5f637721..e908cade8 100644
--- a/yudao-ui-app/components/yd-product-more/yd-product-more.vue
+++ b/yudao-ui-app/components/yd-product-more/yd-product-more.vue
@@ -32,7 +32,7 @@
diff --git a/yudao-ui-app/pages/checkout/checkout.vue b/yudao-ui-app/pages/checkout/checkout.vue
new file mode 100644
index 000000000..97e18bba3
--- /dev/null
+++ b/yudao-ui-app/pages/checkout/checkout.vue
@@ -0,0 +1,219 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 运费
+
+
+
+
+
+ 优惠券
+
+ {{ item.couponTag }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 合计:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yudao-ui-app/pages/index/index.vue b/yudao-ui-app/pages/index/index.vue
index 202a7e72a..cf455ceb3 100644
--- a/yudao-ui-app/pages/index/index.vue
+++ b/yudao-ui-app/pages/index/index.vue
@@ -8,7 +8,7 @@
-
+
diff --git a/yudao-ui-app/pages/order/order.vue b/yudao-ui-app/pages/order/order.vue
new file mode 100644
index 000000000..9b23c9867
--- /dev/null
+++ b/yudao-ui-app/pages/order/order.vue
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+ {{ item.orderNo }}
+ {{ item.orderStatus }}
+
+
+
+
+
+
+
+
+
diff --git a/yudao-ui-app/pages/profile/profile.vue b/yudao-ui-app/pages/profile/profile.vue
index 28dd56bc2..0ada1e327 100644
--- a/yudao-ui-app/pages/profile/profile.vue
+++ b/yudao-ui-app/pages/profile/profile.vue
@@ -4,14 +4,14 @@
头像:
-
+
昵称:
-
+
@@ -41,8 +41,7 @@ export default {
mobile: ''
},
avatarFiles: [],
- tempName: '',
- borderStyle: 'none'
+ tempName: ''
}
},
computed: {
diff --git a/yudao-ui-app/pages/setting/setting.vue b/yudao-ui-app/pages/setting/setting.vue
new file mode 100644
index 000000000..33cf94352
--- /dev/null
+++ b/yudao-ui-app/pages/setting/setting.vue
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yudao-ui-app/pages/user/user.vue b/yudao-ui-app/pages/user/user.vue
index e3577bead..b72c522e5 100644
--- a/yudao-ui-app/pages/user/user.vue
+++ b/yudao-ui-app/pages/user/user.vue
@@ -1,9 +1,15 @@
@@ -58,11 +61,12 @@
export default {
data() {
return {
+ orderPage: '/pages/order/order',
orderStatusList: [
- { icon: 'rmb-circle', title: '待支付' },
- { icon: 'car', title: '代发货' },
- { icon: 'order', title: '待收货' },
- { icon: 'integral', title: '已完成' }
+ { icon: 'red-packet', title: '待付款', state: '0' },
+ { icon: 'car', title: '待发货', state:'20' },
+ { icon: 'order', title: '待收货', state: '30' },
+ { icon: 'integral', title: '已完成', state: '40' }
],
statList: [
{ value: '0', title: '我的收藏' },
@@ -77,9 +81,13 @@ export default {
}
},
methods: {
- loginOrJump(pageUrl) {
+ pageRouter(pageUrl, param) {
if (!this.hasLogin) {
uni.$u.route('/pages/login/social')
+ } else if (pageUrl === this.orderPage) {
+ uni.$u.route(this.orderPage, {
+ status: param
+ });
} else {
uni.$u.route(pageUrl)
}
@@ -110,17 +118,38 @@ export default {
diff --git a/yudao-ui-app/store/index.js b/yudao-ui-app/store/index.js
index e46138835..b33c258e9 100644
--- a/yudao-ui-app/store/index.js
+++ b/yudao-ui-app/store/index.js
@@ -1,6 +1,7 @@
import Vue from 'vue'
import Vuex from 'vuex'
import user from './mudules/user'
+import cart from './mudules/cart'
import getters from './getters'
Vue.use(Vuex) // vue的插件机制
@@ -8,7 +9,8 @@ Vue.use(Vuex) // vue的插件机制
// Vuex.Store 构造器选项
const store = new Vuex.Store({
modules: {
- user
+ user,
+ cart
},
getters
})
diff --git a/yudao-ui-app/store/mudules/cart.js b/yudao-ui-app/store/mudules/cart.js
new file mode 100644
index 000000000..1efbf8211
--- /dev/null
+++ b/yudao-ui-app/store/mudules/cart.js
@@ -0,0 +1,28 @@
+import { getCartDetail } from '@/api/cart'
+
+const cart = {
+ state: {
+ cartCount: 0
+ },
+ mutations: {
+ //记录购物车商品数量
+ SET_CART_COUNT(state, data) {
+ const arr = data.length || []
+ state.cartNumber = arr.length
+ }
+ },
+ actions: {
+ //获取购物车数据
+ CartProductDetail({ state, commit }) {
+ return getCartDetail()
+ .then(res => {
+ commit('SET_CART_COUNT', res.data)
+ return Promise.resolve(res)
+ })
+ .catch(err => {
+ return Promise.reject(err)
+ })
+ }
+ }
+}
+export default cart