diff --git a/CoreCms.Net.IRepository/Cart/ICoreCmsCartRepository.cs b/CoreCms.Net.IRepository/Cart/ICoreCmsCartRepository.cs
index c96a1555..d014f08b 100644
--- a/CoreCms.Net.IRepository/Cart/ICoreCmsCartRepository.cs
+++ b/CoreCms.Net.IRepository/Cart/ICoreCmsCartRepository.cs
@@ -23,5 +23,12 @@ namespace CoreCms.Net.IRepository
///
///
Task GetCountAsync(int userId);
+
+ ///
+ /// 获取购物车商品总价格
+ ///
+ ///
+ Task GetMoneyAsync(int userId);
+
}
}
\ No newline at end of file
diff --git a/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs b/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs
index b9c4065b..0bcae6a7 100644
--- a/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs
+++ b/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs
@@ -127,6 +127,11 @@ namespace CoreCms.Net.IServices
///
Task GetCountAsync(int userId);
+ ///
+ /// 获取购物车商品总价格
+ ///
+ ///
+ Task GetMoneyAsync(int userId);
///
/// 根据提交的数据判断哪些购物券可以使用
diff --git a/CoreCms.Net.Repository/Cart/CoreCmsCartRepository.cs b/CoreCms.Net.Repository/Cart/CoreCmsCartRepository.cs
index 9341a99b..2c84b2ed 100644
--- a/CoreCms.Net.Repository/Cart/CoreCmsCartRepository.cs
+++ b/CoreCms.Net.Repository/Cart/CoreCmsCartRepository.cs
@@ -35,19 +35,45 @@ namespace CoreCms.Net.Repository
///
public async Task GetCountAsync(int userId)
{
- var count = DbClient.Queryable((cart, products, goods) =>
+ var count = await DbClient.Queryable((cart, products, goods) =>
new object[]
{
JoinType.Inner, cart.productId == products.id,
JoinType.Inner, products.goodsId == goods.id
})
- .Where((cart, products, goods) => cart.type == (int) GlobalEnumVars.OrderType.Common)
- .Select((cart, products, goods) => new {cart.id, cart.userId, goodId = goods.id})
+ .Where((cart, products, goods) => cart.type == (int)GlobalEnumVars.OrderType.Common)
+ .Select((cart, products, goods) => new { cart.id, cart.userId, goodId = goods.id })
.MergeTable()
.CountAsync(p => p.userId == userId);
- return await count;
+ return count;
}
#endregion
+
+
+ #region 获取购物车商品总价格
+
+ ///
+ /// 获取购物车商品总价格
+ ///
+ ///
+ public async Task GetMoneyAsync(int userId)
+ {
+ var count = await DbClient.Queryable((cart, products, goods) =>
+ new object[]
+ {
+ JoinType.Inner, cart.productId == products.id,
+ JoinType.Inner, products.goodsId == goods.id
+ })
+ .Where((cart, products, goods) => cart.type == (int)GlobalEnumVars.OrderType.Common && cart.userId == userId)
+ .Select((cart, products, goods) => new { cart.nums, products.price, sunMoney = cart.nums * products.price })
+ .MergeTable()
+ .SumAsync(p => p.sunMoney);
+ return count;
+ }
+
+ #endregion
+
+
}
}
\ No newline at end of file
diff --git a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
index c860321d..4ef96a0d 100644
--- a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
+++ b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
@@ -854,6 +854,18 @@ namespace CoreCms.Net.Services
#endregion
+ #region 获取购物车商品总价格
+ ///
+ /// 获取购物车商品总价格
+ ///
+ ///
+ public async Task GetMoneyAsync(int userId)
+ {
+ return await _dal.GetMoneyAsync(userId);
+ }
+
+ #endregion
+
#region 根据提交的数据判断哪些购物券可以使用
///
/// 根据提交的数据判断哪些购物券可以使用
diff --git a/CoreCms.Net.Uni-App/CoreCms.Net.Uni-App.csproj b/CoreCms.Net.Uni-App/CoreCms.Net.Uni-App.csproj
index 286d16f9..10238537 100644
--- a/CoreCms.Net.Uni-App/CoreCms.Net.Uni-App.csproj
+++ b/CoreCms.Net.Uni-App/CoreCms.Net.Uni-App.csproj
@@ -16,6 +16,10 @@
+
+
+
+
diff --git a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/common/request/http.api.js b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/common/request/http.api.js
index 1503b042..462fd715 100644
--- a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/common/request/http.api.js
+++ b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/common/request/http.api.js
@@ -71,6 +71,8 @@ const install = (Vue, vm) => {
let setCartNum = (params, config = {}) => http.post('/Api/Cart/SetCartNum', params, { custom: { methodName: 'cart.setnums', needToken: true } });
// 获取购物车数量
let getCartNum = (params, config = {}) => http.post('/Api/User/GetCartNumber', params, { custom: { methodName: 'cart.getnumber', needToken: true } });
+ // 获取购物车数量和商品总价格
+ let getCartNumAndMoney = (params, config = {}) => http.post('/Api/User/GetCartNumberAndMoney', params, { custom: { methodName: 'cart.getnumber', needToken: true } });
// 根据购物车已有数据获取能够使用的优惠券
let getCartCoupon = (params, config = {}) => http.post('/Api/Cart/GetCartAvailableCoupon', params, { custom: { methodName: 'cart.getCartCoupon', needToken: true } });
@@ -443,6 +445,7 @@ const install = (Vue, vm) => {
cartList,
setCartNum,
getCartNum,
+ getCartNumAndMoney,
getCartCoupon,
userShip,
userDefaultShip,
diff --git a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages.json b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages.json
index 3eee2e1e..ecb73bfc 100644
--- a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages.json
+++ b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages.json
@@ -56,10 +56,10 @@
"name": "template",
"pages": [
{
- "path": "empty/empty",
+ "path": "index/index",
"style": {
"navigationBarTextStyle": "black",
- "navigationBarTitleText": "空模板架构页"
+ "navigationBarTitleText": "模板首页"
}
},
{
@@ -68,6 +68,20 @@
"navigationBarTextStyle": "black",
"navigationBarTitleText": "助农农产品首页"
}
+ },
+ {
+ "path": "diancan/index/index",
+ "style": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "点餐首页"
+ }
+ },
+ {
+ "path": "diancan/list/list",
+ "style": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "点餐列表"
+ }
}
]
},
@@ -251,19 +265,6 @@
}
]
},
- {
- "root": "pages/reward",
- "name": "reward",
- "pages": [
- {
- "path": "reward",
- "style": {
- "navigationBarTextStyle": "black",
- "navigationBarTitleText": "打赏"
- }
- }
- ]
- },
{
"root": "pages/storeMap",
"name": "storeMap",
@@ -892,7 +893,6 @@
},
{
"pagePath": "pages/index/member/member",
- //"pagePath": "pages/login/loginByAccount/loginByAccount",
"text": "我的",
"iconPath": "static/images/indexMenus/index04.png",
"selectedIconPath": "static/images/indexMenus/index04_1.png"
diff --git a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/index/default/default.vue b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/index/default/default.vue
index e5376c7c..07b64fd5 100644
--- a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/index/default/default.vue
+++ b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/index/default/default.vue
@@ -90,7 +90,7 @@
imgTap() {
this.modalShow = false;
uni.navigateTo({
- url: "/pages/reward/reward"
+ url: "/pages/template/index/index"
});
},
closeTap() {
diff --git a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/reward/reward.vue b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/reward/reward.vue
deleted file mode 100644
index d4760fed..00000000
--- a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/reward/reward.vue
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/diancan/index/index.vue b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/diancan/index/index.vue
new file mode 100644
index 00000000..4dc2c8ff
--- /dev/null
+++ b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/diancan/index/index.vue
@@ -0,0 +1,190 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 门店自取
+ 下单免排队
+
+
+
+ 外卖
+ 无需接触 送喜到家
+
+
+
+
+
+
+
+
+ 喜茶百货
+
+ 灵感商品 立即选购
+
+
+
+
+ 企业团餐
+
+ 50份起送
+
+
+
+
+
+
+ 我的积分
+ 63
+
+
+ 可兑换喜茶劵和丰富灵感周边
+
+
+
+
+ 会员码
+
+
+
+
+
+
+
+
+ 奈雪的茶商城
+
+ 优质茶礼盒,网红零食
+
+
+
+
+
+
+
+
+ 买茶送包
+
+
+
+
+
+
+ 会员劵包
+
+
+
+
+
+
+
+
+
+
+
+ "梅"你不行 | 霸气杨梅清爽回归
+
+
+
+
+
+
+
+
+
+
diff --git a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/diancan/list/list.scss b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/diancan/list/list.scss
new file mode 100644
index 00000000..dc53c9d1
--- /dev/null
+++ b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/diancan/list/list.scss
@@ -0,0 +1,90 @@
+.main { width: 100%; height: 100%; /*position: relative;*/ display: flex; flex-direction: column; }
+
+.nav { width: 100%; height: 212rpx; flex-shrink: 0; display: flex; flex-direction: column;
+ .header { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 20rpx; background-color: #ffffff; height: 140rpx;
+ .left { flex: 1; display: flex; flex-direction: column;
+ .store-name { display: flex; justify-content: flex-start; align-items: center; font-size: 32rpx; margin-bottom: 10rpx;
+ .iconfont { margin-left: 10rpx; line-height: 100%; }
+ }
+ .store-location { display: flex; justify-content: flex-start; align-items: center; color: #919293; font-size: 24rpx;
+ .iconfont { vertical-align: middle; display: table-cell; color: #ADB838; line-height: 100%; }
+ }
+ }
+ .right { background-color: #F5F5F5; border-radius: 38rpx; display: flex; align-items: center; font-size: 24rpx; padding: 0 38rpx; color: #919293;
+ .dinein, .takeout { position: relative; display: flex; align-items: center;
+ &.active { padding: 14rpx 38rpx; color: #ffffff; background-color: #E8EACF; border-radius: 38rpx; }
+ }
+ .takeout { margin-left: 20rpx; height: 100%; flex: 1; padding: 14rpx 0; }
+ .dinein.active { margin-left: -38rpx; }
+ .takeout.active { margin-right: -38rpx; }
+ }
+ }
+ .coupon { flex: 1; width: 100%; background-color: #E8EACF; font-size: 28rpx; color: #ADB838; padding: 0 20rpx; display: flex; align-items: center; overflow: hidden;
+ .title { flex: 1; margin-left: 10rpx; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
+ .iconfont { line-height: 100%; }
+ }
+}
+ .content { flex: 1; overflow: hidden; width: 100%; display: flex;
+ .menus { width: 200rpx; height: 100%; overflow: hidden; background-color: #F5F5F5;
+ .wrapper { width: 100%; height: 100%;
+ .menu { display: flex; align-items: center; justify-content: flex-start; padding: 30rpx 20rpx; font-size: 26rpx; color: #919293; position: relative;
+ &:nth-last-child(1) { margin-bottom: 130rpx; }
+ &.current { background-color: #ffffff; color: #5A5B5C; }
+ .dot { position: absolute; width: 34rpx; height: 34rpx; line-height: 34rpx; font-size: 22rpx; background-color: #ADB838; color: #ffffff; top: 16rpx; right: 10rpx; border-radius: 100%; text-align: center; }
+ }
+ }
+ }
+
+ .goods { flex: 1; height: 100%; overflow: hidden; background-color: #ffffff;
+ .wrapper { width: 100%; height: 100%; padding: 20rpx;
+ .ads { height: calc(300 / 550 * 510rpx);
+ image { width: 100%; height: 100%; border-radius: 8rpx; }
+ }
+ .list { width: 100%; font-size: 28rpx; padding-bottom: 30rpx;
+ .category { width: 100%;
+ .title { padding: 30rpx 0; display: flex; align-items: center; color: #5A5B5C;
+ .icon { width: 38rpx; height: 38rpx; margin-left: 10rpx; }
+ }
+ }
+ .items { display: flex; flex-direction: column; padding-bottom: -30rpx;
+ .good { display: flex; align-items: center; margin-bottom: 30rpx;
+ .image { width: 160rpx; height: 160rpx; margin-right: 20rpx; border-radius: 8rpx; }
+ .right { flex: 1; height: 160rpx; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding-right: 14rpx;
+ .name { font-size: 28rpx; margin-bottom: 10rpx; }
+ .tips { width: 100%; height: 40rpx; line-height: 40rpx; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 24rpx; color: #919293; margin-bottom: 10rpx; }
+ .price_and_action { width: 100%; display: flex; justify-content: space-between; align-items: center;
+ .price { font-size: 28rpx; font-weight: 600; }
+ .btn-group { display: flex; justify-content: space-between; align-items: center; position: relative;
+ .btn { padding: 0 20rpx; box-sizing: border-box; font-size: 24rpx; height: 44rpx; line-height: 44rpx;
+ &.property_btn { border-radius: 24rpx; }
+ &.add_btn,
+ &.reduce_btn { padding: 0; width: 44rpx; border-radius: 44rpx; }
+ }
+ .dot { position: absolute; background-color: #ffffff; border: 1px solid #ADB838; color: #ADB838; font-size: 24rpx; width: 36rpx; height: 36rpx; line-height: 36rpx; text-align: center; border-radius: 100%; right: -12rpx; top: -10rpx; }
+ .number { width: 44rpx; height: 44rpx; line-height: 44rpx; text-align: center; }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+.cart-box { position: absolute; bottom: 30rpx; left: 30rpx; right: 30rpx; height: 96rpx; border-radius: 48rpx; box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2); background-color: #FFFFFF; display: flex; align-items: center; justify-content: space-between; z-index: 10;
+ .cart-img { width: 96rpx; height: 96rpx; position: relative; margin-top: -48rpx; }
+ .pay-btn { height: 100%; padding: 0 30rpx; color: #FFFFFF; border-radius: 0 50rpx 50rpx 0; display: flex; align-items: center; font-size: 28rpx; }
+ .mark { padding-left: 46rpx; margin-right: 30rpx; position: relative;
+ .tag { background-color: #FAB714; color: #ffffff; display: flex; justify-content: center; align-items: center; font-size: 24rpx; position: absolute; right: -10rpx; top: -50rpx; border-radius: 100%; padding: 4rpx; width: 40rpx; height: 40rpx; opacity: .9; }
+ }
+ .price { flex: 1; color: #5A5B5C; }
+}
+
+
+
+.text-color-base { color: #5A5B5C; }
+text-color-assist { color: #919293; }
+.overflow-hidden { overflow: hidden !important; }
+.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
\ No newline at end of file
diff --git a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/diancan/list/list.vue b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/diancan/list/list.vue
new file mode 100644
index 00000000..488edcb7
--- /dev/null
+++ b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/diancan/list/list.vue
@@ -0,0 +1,387 @@
+
+
+
+
+
+
+
+
+ "霸气mini卡"超级购券活动,赶紧去购买
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ good.name }}
+ {{ good.brief }}
+
+ ¥{{ good.price }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{cartNums}}
+
+ ¥{{cartMoney}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/empty/empty.vue b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/empty/empty.vue
deleted file mode 100644
index 22684c18..00000000
--- a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/empty/empty.vue
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
- CoreShop - Net开源商城系统
-
-
-
- 按钮组件演示
-
-
- 跳转coreshop官网:www.coreshop.cn
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/index/index.vue b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/index/index.vue
new file mode 100644
index 00000000..a4eea006
--- /dev/null
+++ b/CoreCms.Net.Uni-App/CoreShopProfessional-UniApp/pages/template/index/index.vue
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+ 此分包模块用于展示不同的首页模板,将持续增加
+
+
+
+ 农产品助农平台
+
+
+ 仿点餐模块
+
+
+
+
+
+
+
+
diff --git a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs
index e69e57e0..4b4ddf85 100644
--- a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs
+++ b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs
@@ -37,6 +37,7 @@ using CoreCms.Net.WeChat.Service.Models;
using CoreCms.Net.WeChat.Service.Options;
using CoreCms.Net.WeChat.Service.Utilities;
using DotLiquid.Util;
+using Essensoft.Paylink.Alipay.Domain;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
@@ -273,7 +274,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
{
jm.msg = "当前请求太频繁_请稍后再试";
}
-
+
return jm;
}
#endregion
@@ -888,6 +889,31 @@ namespace CoreCms.Net.Web.WebApi.Controllers
}
#endregion
+ #region 获取购物车商品数量
+ ///
+ /// 获取购物车商品数量
+ ///
+ ///
+ [HttpPost]
+ [Authorize]
+ public async Task GetCartNumberAndMoney()
+ {
+ var jm = new WebApiCallBack();
+
+ var count = await _cartServices.GetCountAsync(_user.ID);
+ var money = await _cartServices.GetMoneyAsync(_user.ID);
+ jm.status = true;
+ jm.msg = jm.status ? GlobalConstVars.GetDataSuccess : GlobalConstVars.GetDataFailure;
+ jm.data = new
+ {
+ count,
+ money
+ };
+
+ return jm;
+ }
+ #endregion
+
#region 商品取消/添加收藏
///
/// 商品取消/添加收藏