diff --git a/CoreCms.Net.Configuration/SystemSettingConstVars.cs b/CoreCms.Net.Configuration/SystemSettingConstVars.cs index 33b64be3..1da5d9f2 100644 --- a/CoreCms.Net.Configuration/SystemSettingConstVars.cs +++ b/CoreCms.Net.Configuration/SystemSettingConstVars.cs @@ -727,5 +727,31 @@ namespace CoreCms.Net.Configuration + /// + /// 同城配送2公里内 + /// + public static readonly string IntraCityServiceBy2KM = "intraCityServiceBy2KM"; + + /// + /// 同城配送5公里内 + /// + public static readonly string IntraCityServiceBy5KM = "intraCityServiceBy5KM"; + + /// + /// 同城配送10公里内 + /// + public static readonly string IntraCityServiceBy10KM = "intraCityServiceBy10KM"; + + /// + /// 同城配送15公里内 + /// + public static readonly string IntraCityServiceBy15KM = "intraCityServiceBy15KM"; + + /// + /// 同城配送20公里内 + /// + public static readonly string IntraCityServiceBy20KM = "intraCityServiceBy20KM"; + + } } \ No newline at end of file diff --git a/CoreCms.Net.Configuration/SystemSettingDictionary.cs b/CoreCms.Net.Configuration/SystemSettingDictionary.cs index 804c2396..dc91a2d5 100644 --- a/CoreCms.Net.Configuration/SystemSettingDictionary.cs +++ b/CoreCms.Net.Configuration/SystemSettingDictionary.cs @@ -211,6 +211,14 @@ namespace CoreCms.Net.Configuration di.Add(SystemSettingConstVars.SmsTplForCommon, new DictionaryKeyValues() { sKey = "通用类型", sValue = "欢迎您访问我们的微信小程序,有问题请联系客服。" }); + //自提运费设置 + di.Add(SystemSettingConstVars.IntraCityServiceBy2KM, new DictionaryKeyValues() { sKey = "2公里内", sValue = "0" }); + di.Add(SystemSettingConstVars.IntraCityServiceBy5KM, new DictionaryKeyValues() { sKey = "5公里内", sValue = "0" }); + di.Add(SystemSettingConstVars.IntraCityServiceBy10KM, new DictionaryKeyValues() { sKey = "10公里内", sValue = "0" }); + di.Add(SystemSettingConstVars.IntraCityServiceBy15KM, new DictionaryKeyValues() { sKey = "15公里内", sValue = "0" }); + di.Add(SystemSettingConstVars.IntraCityServiceBy20KM, new DictionaryKeyValues() { sKey = "20公里内", sValue = "0" }); + + return di; } diff --git a/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs b/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs index 419ba493..b9c4065b 100644 --- a/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs +++ b/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs @@ -11,8 +11,8 @@ using System.Threading.Tasks; using CoreCms.Net.Configuration; using CoreCms.Net.Model.Entities; -using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Model.ViewModels.DTO; +using CoreCms.Net.Model.ViewModels.UI; namespace CoreCms.Net.IServices { @@ -76,7 +76,6 @@ namespace CoreCms.Net.IServices Task GetCartDtoData(int userId, int[] ids = null, int type = 1, int objectId = 0); - /// /// 获取处理后的购物车信息 /// @@ -86,13 +85,12 @@ namespace CoreCms.Net.IServices /// 收货地址id /// 消费的积分 /// 优惠券码 - /// 是否免运费 /// 关联上面的是否免运费/1=快递配送(要去算运费)生成订单记录快递方式,2=同城配送/3=门店自提(不需要计算运费)生成订单记录门店自提信息 + /// 用户收货地址 /// 关联非普通订单营销类型序列 /// Task GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point, - string couponCode, bool freeFreight = false, - int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int objectId = 0); + string couponCode, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int userShipId = 0, int objectId = 0); /// @@ -100,9 +98,8 @@ namespace CoreCms.Net.IServices /// /// 购物车信息 /// 收货地址id - /// 是否包邮,默认false /// - bool CartFreight(CartDto cartDto, int areaId, bool freeFreight = false); + bool CartFreight(CartDto cartDto, int areaId); /// diff --git a/CoreCms.Net.Model/Entities/User/CoreCmsUserShip.cs b/CoreCms.Net.Model/Entities/User/CoreCmsUserShip.cs index 687af4f7..d91cca29 100644 --- a/CoreCms.Net.Model/Entities/User/CoreCmsUserShip.cs +++ b/CoreCms.Net.Model/Entities/User/CoreCmsUserShip.cs @@ -3,88 +3,113 @@ * ProjectName: 核心内容管理系统 * Web: https://www.corecms.net * Author: 大灰灰 - * Email: jianweie@163.com - * CreateTime: 2021-06-08 22:14:59 + * Email: jianweie@163.com + * CreateTime: 2022/2/11 22:59:40 * Description: 暂无 -***********************************************************************/ -using SqlSugar; -using System.ComponentModel.DataAnnotations; + ***********************************************************************/ -namespace CoreCms.Net.Model.Entities +using System; +using System.ComponentModel.DataAnnotations; +using SqlSugar; + +namespace CoreCms.Net.Model.Entities; + +/// +/// 用户地址表 +/// +public partial class CoreCmsUserShip { /// - /// 用户地址表 + /// 序列 /// - [SugarTable("CoreCmsUserShip",TableDescription = "用户地址表")] - public partial class CoreCmsUserShip - { - /// - /// 用户地址表 - /// - public CoreCmsUserShip() - { - } + [Display(Name = "序列")] + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + [Required(ErrorMessage = "请输入{0}")] + public int id { get; set; } - /// - /// 序列 - /// - [Display(Name = "序列")] - [SugarColumn(ColumnDescription = "序列", IsPrimaryKey = true, IsIdentity = true)] - [Required(ErrorMessage = "请输入{0}")] - public System.Int32 id { get; set; } - /// - /// 用户id 关联user.id - /// - [Display(Name = "用户id 关联user.id")] - [SugarColumn(ColumnDescription = "用户id 关联user.id")] - [Required(ErrorMessage = "请输入{0}")] - public System.Int32 userId { get; set; } - /// - /// 收货地区ID - /// - [Display(Name = "收货地区ID")] - [SugarColumn(ColumnDescription = "收货地区ID")] - [Required(ErrorMessage = "请输入{0}")] - public System.Int32 areaId { get; set; } - /// - /// 收货详细地址 - /// - [Display(Name = "收货详细地址")] - [SugarColumn(ColumnDescription = "收货详细地址", IsNullable = true)] - [StringLength(200, ErrorMessage = "【{0}】不能超过{1}字符长度")] - public System.String address { get; set; } - /// - /// 收货人姓名 - /// - [Display(Name = "收货人姓名")] - [SugarColumn(ColumnDescription = "收货人姓名", IsNullable = true)] - [StringLength(50, ErrorMessage = "【{0}】不能超过{1}字符长度")] - public System.String name { get; set; } - /// - /// 收货电话 - /// - [Display(Name = "收货电话")] - [SugarColumn(ColumnDescription = "收货电话", IsNullable = true)] - [StringLength(50, ErrorMessage = "【{0}】不能超过{1}字符长度")] - public System.String mobile { get; set; } - /// - /// 是否默认 - /// - [Display(Name = "是否默认")] - [SugarColumn(ColumnDescription = "是否默认")] - [Required(ErrorMessage = "请输入{0}")] - public System.Boolean isDefault { get; set; } - /// - /// 创建时间 - /// - [Display(Name = "创建时间")] - [SugarColumn(ColumnDescription = "创建时间", IsNullable = true)] - public System.DateTime? createTime { get; set; } - /// - /// 更新时间 - /// - [Display(Name = "更新时间")] - [SugarColumn(ColumnDescription = "更新时间", IsNullable = true)] - public System.DateTime? updateTime { get; set; } - } + + /// + /// 用户id 关联user.id + /// + [Display(Name = "用户id 关联user.id")] + [Required(ErrorMessage = "请输入{0}")] + public int userId { get; set; } + + + /// + /// 收货地区ID + /// + [Display(Name = "收货地区ID")] + [Required(ErrorMessage = "请输入{0}")] + public int areaId { get; set; } + + + /// + /// 收货详细地址 + /// + [Display(Name = "收货详细地址")] + [StringLength(200, ErrorMessage = "{0}不能超过{1}字")] + public string address { get; set; } + + + /// + /// 收货人姓名 + /// + [Display(Name = "收货人姓名")] + [StringLength(50, ErrorMessage = "{0}不能超过{1}字")] + public string name { get; set; } + + + /// + /// 收货电话 + /// + [Display(Name = "收货电话")] + [StringLength(50, ErrorMessage = "{0}不能超过{1}字")] + public string mobile { get; set; } + + + /// + /// 是否默认 + /// + [Display(Name = "是否默认")] + [Required(ErrorMessage = "请输入{0}")] + public bool isDefault { get; set; } + + + /// + /// 创建时间 + /// + [Display(Name = "创建时间")] + public DateTime? createTime { get; set; } + + + /// + /// 更新时间 + /// + [Display(Name = "更新时间")] + public DateTime? updateTime { get; set; } + + + /// + /// 经度 + /// + [Display(Name = "经度")] + [StringLength(50, ErrorMessage = "{0}不能超过{1}字")] + public string longitude { get; set; } + + + /// + /// 纬度 + /// + [Display(Name = "纬度")] + [StringLength(50, ErrorMessage = "{0}不能超过{1}字")] + public string latitude { get; set; } + + + /// + /// 街道 + /// + [Display(Name = "街道")] + [StringLength(50, ErrorMessage = "{0}不能超过{1}字")] + public string street { get; set; } } \ No newline at end of file diff --git a/CoreCms.Net.Model/FromBody/FMCart.cs b/CoreCms.Net.Model/FromBody/FMCart.cs index d5373c55..1c13be0b 100644 --- a/CoreCms.Net.Model/FromBody/FMCart.cs +++ b/CoreCms.Net.Model/FromBody/FMCart.cs @@ -86,6 +86,11 @@ namespace CoreCms.Net.Model.FromBody /// public int receiptType { get; set; } = 1; + /// + /// 用户收货地址 + /// + public int userShipId { get; set; } = 0; + /// /// 关联非普通订单对象序列 diff --git a/CoreCms.Net.Model/ViewModels/DTO/UserDto.cs b/CoreCms.Net.Model/ViewModels/DTO/UserDto.cs index 27d45325..9d153076 100644 --- a/CoreCms.Net.Model/ViewModels/DTO/UserDto.cs +++ b/CoreCms.Net.Model/ViewModels/DTO/UserDto.cs @@ -49,6 +49,10 @@ namespace CoreCms.Net.Model.ViewModels.DTO public int isDefault { get; set; } = 2; public string mobile { get; set; } public string name { get; set; } + public string longitude { get; set; } + public string latitude { get; set; } + public string street { get; set; } + } /// diff --git a/CoreCms.Net.Repository/User/CoreCmsUserShipRepository.cs b/CoreCms.Net.Repository/User/CoreCmsUserShipRepository.cs index 02edc975..f348a306 100644 --- a/CoreCms.Net.Repository/User/CoreCmsUserShipRepository.cs +++ b/CoreCms.Net.Repository/User/CoreCmsUserShipRepository.cs @@ -79,6 +79,11 @@ namespace CoreCms.Net.Repository //oldModel.createTime = entity.createTime; oldModel.updateTime = entity.updateTime; + oldModel.longitude = entity.longitude; + oldModel.latitude = entity.latitude; + oldModel.street = entity.street; + + if (oldModel.isDefault) { await DbClient.Updateable().SetColumns(p => p.isDefault == false).Where(p => p.userId == entity.userId).ExecuteCommandAsync(); diff --git a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs index eb96d110..12c7d47d 100644 --- a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs +++ b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs @@ -19,8 +19,8 @@ using CoreCms.Net.IServices; using CoreCms.Net.Loging; using CoreCms.Net.Model.Entities; using CoreCms.Net.Model.Entities.Expression; -using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Model.ViewModels.DTO; +using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Utility.Extensions; using CoreCms.Net.Utility.Helper; using Microsoft.Extensions.DependencyInjection; @@ -55,7 +55,8 @@ namespace CoreCms.Net.Services private readonly ICoreCmsGoodsServices _goodsServices; private readonly ICoreCmsGoodsCategoryServices _goodsCategoryServices; private readonly ICoreCmsSolitaireServices _solitaireServices; - + private readonly ICoreCmsUserShipServices _userShipServices; + private readonly ICoreCmsStoreServices _storeServices; public CoreCmsCartServices( ICoreCmsCartRepository dal @@ -68,7 +69,7 @@ namespace CoreCms.Net.Services , ICoreCmsUserServices userServices , ICoreCmsSettingServices settingServices , ICoreCmsProductsServices productsServices - , ICoreCmsPinTuanGoodsServices pinTuanGoodsServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsGoodsServices goodsServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsPromotionResultServices promotionResultServices, ICoreCmsPinTuanRecordServices pinTuanRecordServices, ICoreCmsSolitaireServices solitaireServices) + , ICoreCmsPinTuanGoodsServices pinTuanGoodsServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsGoodsServices goodsServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsPromotionResultServices promotionResultServices, ICoreCmsPinTuanRecordServices pinTuanRecordServices, ICoreCmsSolitaireServices solitaireServices, ICoreCmsUserShipServices userShipServices, ICoreCmsStoreServices storeServices) { this._dal = dal; base.BaseDal = dal; @@ -89,6 +90,8 @@ namespace CoreCms.Net.Services _promotionResultServices = promotionResultServices; _pinTuanRecordServices = pinTuanRecordServices; _solitaireServices = solitaireServices; + _userShipServices = userShipServices; + _storeServices = storeServices; } #region 设置购物车商品数量==================================================== @@ -162,6 +165,7 @@ namespace CoreCms.Net.Services #endregion #region 添加单个货品到购物车 + /// /// 添加单个货品到购物车 /// @@ -514,7 +518,6 @@ namespace CoreCms.Net.Services return solitaireInfo; } break; - break; default: jm.msg = GlobalErrorCodeVars.Code10000; @@ -541,11 +544,11 @@ namespace CoreCms.Net.Services /// 收货地址id /// 消费的积分 /// 优惠券码 - /// 是否免运费 /// 关联上面的是否免运费/1=快递配送(要去算运费)生成订单记录快递方式 2=门店自提(不需要计算运费)生成订单记录门店自提信息 + /// 用户收货地址 /// 关联非普通订单营销类型序列 /// - public async Task GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point, string couponCode, bool freeFreight = false, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int objectId = 0) + public async Task GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point, string couponCode, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int userShipId = 0, int objectId = 0) { var jm = new WebApiCallBack() { methodDescription = "获取处理后的购物车信息" }; var cartDto = new CartDto(); //必须初始化 @@ -583,17 +586,26 @@ namespace CoreCms.Net.Services } //门店订单,强制无运费 - if (deliveryType == (int)GlobalEnumVars.OrderReceiptType.IntraCityService || deliveryType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery) + if (deliveryType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery) { - freeFreight = true; + cartDto.costFreight = 0; } - //运费判断 - if (CartFreight(cartDto, areaId, freeFreight) == false) + else if (deliveryType == (int)GlobalEnumVars.OrderReceiptType.Logistics) { - jm.data = cartDto; - jm.msg = "运费判断"; - return jm; + // 运费判断 + if (CartFreight(cartDto, areaId) == false) + { + jm.data = cartDto; + jm.msg = "运费判断"; + return jm; + } } + else if (deliveryType == (int)GlobalEnumVars.OrderReceiptType.IntraCityService) + { + await CartFreightByIntraCityService(cartDto, userShipId); + } + + //接下来算订单促销金额,有些模式不需要计算促销信息,这里就增加判断 if (orderType == (int)GlobalEnumVars.OrderType.Common) { @@ -651,17 +663,83 @@ namespace CoreCms.Net.Services /// /// 购物车信息 /// 收货地址id - /// 是否包邮,默认false /// - public bool CartFreight(CartDto cartDto, int areaId, bool freeFreight = false) + public bool CartFreight(CartDto cartDto, int areaId) { - if (freeFreight == false) + if (areaId > 0) { - if (areaId > 0) + cartDto.costFreight = _shipServices.GetShipCost(areaId, cartDto.weight, cartDto.goodsAmount); + cartDto.amount = Math.Round(cartDto.amount + cartDto.costFreight, 2); + } + return true; + } + + #endregion + + + #region 根据经纬度算运费 + + /// + /// 根据经纬度算运费 + /// + /// 购物车信息 + /// 用户地址信息 + /// + public async Task CartFreightByIntraCityService(CartDto cartDto, int userShipId) + { + if (userShipId > 0) + { + var userShip = await _userShipServices.QueryByClauseAsync(p => p.id == userShipId); + if (userShip == null) { - cartDto.costFreight = _shipServices.GetShipCost(areaId, cartDto.weight, cartDto.goodsAmount); - cartDto.amount = Math.Round(cartDto.amount + cartDto.costFreight, 2); + return true; } + var store = await _storeServices.QueryByClauseAsync(p => p.isDefault == true); + if (store == null) + { + return true; + } + + if (string.IsNullOrEmpty(userShip.longitude) || string.IsNullOrEmpty(userShip.latitude) || string.IsNullOrEmpty(store.longitude) || string.IsNullOrEmpty(store.latitude)) + { + return true; + } + + //第一种调用方法 + var result = MapHelper.GetDistance(Convert.ToDouble(userShip.latitude.Trim()), Convert.ToDouble(userShip.longitude.Trim()), Convert.ToDouble(store.latitude.Trim()), Convert.ToDouble(store.longitude.Trim())); + + var allConfigs = await _settingServices.GetConfigDictionaries(); + var intraCityServiceBy2Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy2KM).ObjectToDecimal(0); + var intraCityServiceBy5Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy5KM).ObjectToDecimal(0); + var intraCityServiceBy10Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy10KM).ObjectToDecimal(0); + var intraCityServiceBy15Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy15KM).ObjectToDecimal(0); + var intraCityServiceBy20Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy20KM).ObjectToDecimal(0); + + if (0 <= result && result <= 2) + { + cartDto.costFreight = intraCityServiceBy2Km; + } + else if (result > 2 && result <= 5) + { + cartDto.costFreight = intraCityServiceBy5Km; + } + else if (result > 5 && result <= 10) + { + cartDto.costFreight = intraCityServiceBy5Km; + } + else if (result > 10 && result <= 15) + { + cartDto.costFreight = intraCityServiceBy5Km; + } + else if (result > 15 && result <= 20) + { + cartDto.costFreight = intraCityServiceBy5Km; + } + else + { + cartDto.costFreight = 0; + } + cartDto.amount = Math.Round(cartDto.amount + cartDto.costFreight, 2); } return true; } @@ -760,7 +838,6 @@ namespace CoreCms.Net.Services #endregion - #region 根据提交的数据判断哪些购物券可以使用 /// /// 根据提交的数据判断哪些购物券可以使用 diff --git a/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs b/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs index 6d5cd882..c043b0c4 100644 --- a/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs +++ b/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs @@ -231,7 +231,7 @@ namespace CoreCms.Net.Services //通过购物车生成订单信息和订单明细信息 List orderItems; var ids = CommonHelper.StringToIntArray(cartIds); - var orderRes = await FormatOrder(order, userId, ids, areaId, point, couponCode, false, receiptType, objectId); + var orderRes = await FormatOrder(order, userId, ids, areaId, point, couponCode, ushipId, receiptType, objectId); if (!orderRes.status) { return orderRes; @@ -487,17 +487,16 @@ namespace CoreCms.Net.Services /// 收货地区 /// 使用积分 /// 使用优惠券 - /// 是否包邮 + /// /// 收货方式,1快递物流,2同城配送,3门店自提 /// 团队明细 /// 返回订单明细信息 private async Task FormatOrder(CoreCmsOrder order, int userId, int[] cartIds, int areaId, int point, - string couponCode, bool freeFreight = false, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int groupId = 0) + string couponCode, int userShipId = 0, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int groupId = 0) { var res = new WebApiCallBack() { methodDescription = "生成订单信息及明细信息" }; - var cartModel = await _cartServices.GetCartInfos(userId, cartIds, order.orderType, areaId, point, couponCode, - freeFreight, deliveryType, groupId); + var cartModel = await _cartServices.GetCartInfos(userId, cartIds, order.orderType, areaId, point, couponCode, deliveryType, userShipId, groupId); if (!cartModel.status) { return cartModel; diff --git a/CoreCms.Net.Uni-App/CoreShop/pages.json b/CoreCms.Net.Uni-App/CoreShop/pages.json index 8681a5df..112c8503 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages.json +++ b/CoreCms.Net.Uni-App/CoreShop/pages.json @@ -257,20 +257,20 @@ "navigationBarTitleText": "打赏" } }, - { - "path": "pages/activity/solitaire/list/list", - "style": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "接龙" - } - }, - { - "path": "pages/activity/solitaire/solitaireDetails/solitaireDetails", - "style": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "接龙详情" - } - }, + { + "path": "pages/activity/solitaire/list/list", + "style": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "接龙" + } + }, + { + "path": "pages/activity/solitaire/solitaireDetails/solitaireDetails", + "style": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "接龙详情" + } + }, { "path": "pages/template", "style": { @@ -375,6 +375,13 @@ "navigationBarTitleText": "修改地址" } }, + { + "path": "address/map/map", + "style": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "选取街道" + } + }, { "path": "setting/index/index", "style": { diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/goods/goodDetails/goodDetails.vue b/CoreCms.Net.Uni-App/CoreShop/pages/goods/goodDetails/goodDetails.vue index 738c7cc5..5a6a897f 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/goods/goodDetails/goodDetails.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/goods/goodDetails/goodDetails.vue @@ -12,7 +12,7 @@ - + @@ -435,7 +435,8 @@ commonQuestion: [], delivery: [], service: [], - } + }, + autoplay: true } }, onLoad(options) { @@ -587,6 +588,12 @@ let info = res.data; let products = res.data.product; _this.goodsInfo = info; + + if (_this.goodsInfo.album && _this.goodsInfo.video) { + _this.goodsInfo.album.unshift(_this.goodsInfo.video); + _this.autoplay = false; + } + _this.isfav = res.data.isFav; _this.product = _this.spesClassHandle(products); @@ -611,6 +618,12 @@ let info = res.data; let products = res.data.product; _this.goodsInfo = info; + + if (_this.goodsInfo.album && _this.goodsInfo.video) { + _this.goodsInfo.album.unshift(_this.goodsInfo.video); + _this.autoplay = false; + } + _this.isfav = res.data.isFav; _this.product = _this.spesClassHandle(products); diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/member/address/index/index.vue b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/index/index.vue index 04007afd..7fc39309 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/member/address/index/index.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/index/index.vue @@ -38,6 +38,33 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -65,6 +92,9 @@ mobile: '', address: '', isDefault: 2, + longitude: '', + latitude: '', + street: '' }, region: ['湖南省', '怀化市', '鹤城区'], areaId: 0, @@ -132,7 +162,6 @@ //this.pickerValue = this.region[0] + " " + this.region[1] + " " + this.region[2]; //this.init(); } - console.log(this.pickerList); }, computed: {}, onReady() { @@ -140,7 +169,6 @@ }, methods: { onConfirm(e) { - console.log(e); let provinceName = e[0].label; let cityName = e[1].label; let countyName = e[2].label; @@ -150,7 +178,6 @@ cityName: cityName, countyName: countyName } - //let regionName = [provinceName, cityName, countyName]; this.$u.api.getAreaId(data).then(res => { if (res.status) { this.areaId = res.data; @@ -180,6 +207,9 @@ this.pickerValue = this.region[0] + " " + this.region[1] + " " + this.region[2] this.form.address = res.data.address; this.form.isDefault = res.data.isDefault; + this.form.longitude = res.data.longitude; + this.form.latitude = res.data.latitude; + this.form.street = res.data.street; if (res.data.isDefault) { this.checked = true; this.isDefault = 1; @@ -235,8 +265,14 @@ } else if (this.areaId <= 0) { this.$u.toast('请选择地区信息') return false - } else if (!this.form.address) { - this.$u.toast('请输入收货地址详细信息') + } else if (!this.form.street) { + this.$u.toast('请选择街道') + return false + } else if (!this.form.latitude) { + this.$u.toast('请选择街道获取纬度') + return false + } else if (!this.form.longitude) { + this.$u.toast('请选择街道获取经度') return false } let data = { @@ -244,7 +280,10 @@ address: this.form.address, mobile: this.form.mobile, isDefault: this.form.isDefault, - areaId: this.areaId + areaId: this.areaId, + longitude: this.form.longitude, + latitude: this.form.latitude, + street: this.form.street, } if (this.id && this.id != 0) { //编辑存储 @@ -324,8 +363,16 @@ init() { this.getFullPath(this.areaId, this.province); this.pickerIndex = [this.provinceKey, this.cityKey, this.areaKey]; - console.log(this.pickerIndex); }, + toMap() { + if (!this.pickerValue) { + this.$u.toast('请先获取省市区信息'); + return false; + } else { + this.$u.route('/pages/member/address/map/map', { pickerValue: this.pickerValue, }); + } + } + }, } diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/member/address/list/list.vue b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/list/list.vue index a88552cf..d05de635 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/member/address/list/list.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/list/list.vue @@ -21,7 +21,7 @@ - {{item.areaName + item.address}} + {{item.areaName }} {{item.street}} {{item.address}} @@ -30,13 +30,11 @@ - - - - - - + + + 新增收货地址 + diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/member/address/map/map.scss b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/map/map.scss new file mode 100644 index 00000000..1cc89818 --- /dev/null +++ b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/map/map.scss @@ -0,0 +1,21 @@ +.controls-location { height: 30px; width: 30px; position: absolute; } +.server-place { position: fixed; left: 0; top: 0; height: 100vh; width: 100%; background: #ffffff; z-index: 999; + .map-tools { position: fixed; width: 100%; bottom: 30rpx; left: 0; display: flex; justify-content: center; align-items: center; flex-direction: column; + .my-location { width: 90%; margin: 0 auto; height: 120rpx; box-shadow: 0px 3px 20px rgba(0, 0, 0, 0.2); background: #fff; border-radius: 20rpx; display: flex; justify-content: flex-start; align-items: center; overflow: hidden; + .left { background: #3384ff; height: 120rpx; width: 120rpx; } + .right { margin-left: 20rpx; color: #111; display: flex; justify-content: center; align-items: flex-start; flex-direction: column; + .title { font-size: 28rpx; font-weight: bold; } + .text { font-size: 26rpx; width: 500rpx; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #3384FF; margin-top: 10rpx; } + } + } + + .start-place { width: 85%; margin: 0 auto; margin: 0 auto; margin-top: 20rpx; box-shadow: 0px 3px 20px rgba(0, 0, 0, 0.2); background: #fff; border-radius: 20rpx; padding: 20rpx; + .place { display: flex; justify-content: flex-start; align-items: center; + .title { font-size: 28rpx; font-weight: bold; color: #111; } + .text { font-size: 28rpx; color: #3384FF; font-weight: bold; width: 450rpx; display: inline-block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } + } + .tip { font-size: 22rpx; color: #666; margin-top: 15rpx; } + .sure { margin-top: 15rpx; color: #FFFFFF; background: #212121; font-weight: blod; font-size: 32rpx; } + } + } +} \ No newline at end of file diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/member/address/map/map.vue b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/map/map.vue new file mode 100644 index 00000000..d4c531fd --- /dev/null +++ b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/map/map.vue @@ -0,0 +1,292 @@ + + + + + diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/member/address/map/qqmap-wx-jssdk.min.js b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/map/qqmap-wx-jssdk.min.js new file mode 100644 index 00000000..8fa1477c --- /dev/null +++ b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/map/qqmap-wx-jssdk.min.js @@ -0,0 +1 @@ +var ERROR_CONF = { KEY_ERR: 311, KEY_ERR_MSG: 'key格式错误', PARAM_ERR: 310, PARAM_ERR_MSG: '请求参数信息有误', SYSTEM_ERR: 600, SYSTEM_ERR_MSG: '系统错误', WX_ERR_CODE: 1000, WX_OK_CODE: 200 }; var BASE_URL = 'https://apis.map.qq.com/ws/'; var URL_SEARCH = BASE_URL + 'place/v1/search'; var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; var URL_CITY_LIST = BASE_URL + 'district/v1/list'; var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; var URL_DISTANCE = BASE_URL + 'distance/v1/'; var URL_DIRECTION = BASE_URL + 'direction/v1/'; var MODE = { driving: 'driving', transit: 'transit' }; var EARTH_RADIUS = 6378136.49; var Utils = { safeAdd(x, y) { var lsw = (x & 0xffff) + (y & 0xffff); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xffff) }, bitRotateLeft(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)) }, md5cmn(q, a, b, x, s, t) { return this.safeAdd(this.bitRotateLeft(this.safeAdd(this.safeAdd(a, q), this.safeAdd(x, t)), s), b) }, md5ff(a, b, c, d, x, s, t) { return this.md5cmn((b & c) | (~b & d), a, b, x, s, t) }, md5gg(a, b, c, d, x, s, t) { return this.md5cmn((b & d) | (c & ~d), a, b, x, s, t) }, md5hh(a, b, c, d, x, s, t) { return this.md5cmn(b ^ c ^ d, a, b, x, s, t) }, md5ii(a, b, c, d, x, s, t) { return this.md5cmn(c ^ (b | ~d), a, b, x, s, t) }, binlMD5(x, len) { x[len >> 5] |= 0x80 << (len % 32); x[((len + 64) >>> 9 << 4) + 14] = len; var i; var olda; var oldb; var oldc; var oldd; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for (i = 0; i < x.length; i += 16) { olda = a; oldb = b; oldc = c; oldd = d; a = this.md5ff(a, b, c, d, x[i], 7, -680876936); d = this.md5ff(d, a, b, c, x[i + 1], 12, -389564586); c = this.md5ff(c, d, a, b, x[i + 2], 17, 606105819); b = this.md5ff(b, c, d, a, x[i + 3], 22, -1044525330); a = this.md5ff(a, b, c, d, x[i + 4], 7, -176418897); d = this.md5ff(d, a, b, c, x[i + 5], 12, 1200080426); c = this.md5ff(c, d, a, b, x[i + 6], 17, -1473231341); b = this.md5ff(b, c, d, a, x[i + 7], 22, -45705983); a = this.md5ff(a, b, c, d, x[i + 8], 7, 1770035416); d = this.md5ff(d, a, b, c, x[i + 9], 12, -1958414417); c = this.md5ff(c, d, a, b, x[i + 10], 17, -42063); b = this.md5ff(b, c, d, a, x[i + 11], 22, -1990404162); a = this.md5ff(a, b, c, d, x[i + 12], 7, 1804603682); d = this.md5ff(d, a, b, c, x[i + 13], 12, -40341101); c = this.md5ff(c, d, a, b, x[i + 14], 17, -1502002290); b = this.md5ff(b, c, d, a, x[i + 15], 22, 1236535329); a = this.md5gg(a, b, c, d, x[i + 1], 5, -165796510); d = this.md5gg(d, a, b, c, x[i + 6], 9, -1069501632); c = this.md5gg(c, d, a, b, x[i + 11], 14, 643717713); b = this.md5gg(b, c, d, a, x[i], 20, -373897302); a = this.md5gg(a, b, c, d, x[i + 5], 5, -701558691); d = this.md5gg(d, a, b, c, x[i + 10], 9, 38016083); c = this.md5gg(c, d, a, b, x[i + 15], 14, -660478335); b = this.md5gg(b, c, d, a, x[i + 4], 20, -405537848); a = this.md5gg(a, b, c, d, x[i + 9], 5, 568446438); d = this.md5gg(d, a, b, c, x[i + 14], 9, -1019803690); c = this.md5gg(c, d, a, b, x[i + 3], 14, -187363961); b = this.md5gg(b, c, d, a, x[i + 8], 20, 1163531501); a = this.md5gg(a, b, c, d, x[i + 13], 5, -1444681467); d = this.md5gg(d, a, b, c, x[i + 2], 9, -51403784); c = this.md5gg(c, d, a, b, x[i + 7], 14, 1735328473); b = this.md5gg(b, c, d, a, x[i + 12], 20, -1926607734); a = this.md5hh(a, b, c, d, x[i + 5], 4, -378558); d = this.md5hh(d, a, b, c, x[i + 8], 11, -2022574463); c = this.md5hh(c, d, a, b, x[i + 11], 16, 1839030562); b = this.md5hh(b, c, d, a, x[i + 14], 23, -35309556); a = this.md5hh(a, b, c, d, x[i + 1], 4, -1530992060); d = this.md5hh(d, a, b, c, x[i + 4], 11, 1272893353); c = this.md5hh(c, d, a, b, x[i + 7], 16, -155497632); b = this.md5hh(b, c, d, a, x[i + 10], 23, -1094730640); a = this.md5hh(a, b, c, d, x[i + 13], 4, 681279174); d = this.md5hh(d, a, b, c, x[i], 11, -358537222); c = this.md5hh(c, d, a, b, x[i + 3], 16, -722521979); b = this.md5hh(b, c, d, a, x[i + 6], 23, 76029189); a = this.md5hh(a, b, c, d, x[i + 9], 4, -640364487); d = this.md5hh(d, a, b, c, x[i + 12], 11, -421815835); c = this.md5hh(c, d, a, b, x[i + 15], 16, 530742520); b = this.md5hh(b, c, d, a, x[i + 2], 23, -995338651); a = this.md5ii(a, b, c, d, x[i], 6, -198630844); d = this.md5ii(d, a, b, c, x[i + 7], 10, 1126891415); c = this.md5ii(c, d, a, b, x[i + 14], 15, -1416354905); b = this.md5ii(b, c, d, a, x[i + 5], 21, -57434055); a = this.md5ii(a, b, c, d, x[i + 12], 6, 1700485571); d = this.md5ii(d, a, b, c, x[i + 3], 10, -1894986606); c = this.md5ii(c, d, a, b, x[i + 10], 15, -1051523); b = this.md5ii(b, c, d, a, x[i + 1], 21, -2054922799); a = this.md5ii(a, b, c, d, x[i + 8], 6, 1873313359); d = this.md5ii(d, a, b, c, x[i + 15], 10, -30611744); c = this.md5ii(c, d, a, b, x[i + 6], 15, -1560198380); b = this.md5ii(b, c, d, a, x[i + 13], 21, 1309151649); a = this.md5ii(a, b, c, d, x[i + 4], 6, -145523070); d = this.md5ii(d, a, b, c, x[i + 11], 10, -1120210379); c = this.md5ii(c, d, a, b, x[i + 2], 15, 718787259); b = this.md5ii(b, c, d, a, x[i + 9], 21, -343485551); a = this.safeAdd(a, olda); b = this.safeAdd(b, oldb); c = this.safeAdd(c, oldc); d = this.safeAdd(d, oldd) } return [a, b, c, d] }, binl2rstr(input) { var i; var output = ''; var length32 = input.length * 32; for (i = 0; i < length32; i += 8) { output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff) } return output }, rstr2binl(input) { var i; var output = []; output[(input.length >> 2) - 1] = undefined; for (i = 0; i < output.length; i += 1) { output[i] = 0 } var length8 = input.length * 8; for (i = 0; i < length8; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32) } return output }, rstrMD5(s) { return this.binl2rstr(this.binlMD5(this.rstr2binl(s), s.length * 8)) }, rstrHMACMD5(key, data) { var i; var bkey = this.rstr2binl(key); var ipad = []; var opad = []; var hash; ipad[15] = opad[15] = undefined; if (bkey.length > 16) { bkey = this.binlMD5(bkey, key.length * 8) } for (i = 0; i < 16; i += 1) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5c5c5c5c } hash = this.binlMD5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8); return this.binl2rstr(this.binlMD5(opad.concat(hash), 512 + 128)) }, rstr2hex(input) { var hexTab = '0123456789abcdef'; var output = ''; var x; var i; for (i = 0; i < input.length; i += 1) { x = input.charCodeAt(i); output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f) } return output }, str2rstrUTF8(input) { return unescape(encodeURIComponent(input)) }, rawMD5(s) { return this.rstrMD5(this.str2rstrUTF8(s)) }, hexMD5(s) { return this.rstr2hex(this.rawMD5(s)) }, rawHMACMD5(k, d) { return this.rstrHMACMD5(this.str2rstrUTF8(k), str2rstrUTF8(d)) }, hexHMACMD5(k, d) { return this.rstr2hex(this.rawHMACMD5(k, d)) }, md5(string, key, raw) { if (!key) { if (!raw) { return this.hexMD5(string) } return this.rawMD5(string) } if (!raw) { return this.hexHMACMD5(key, string) } return this.rawHMACMD5(key, string) }, getSig(requestParam, sk, feature, mode) { var sig = null; var requestArr = []; Object.keys(requestParam).sort().forEach(function (key) { requestArr.push(key + '=' + requestParam[key]) }); if (feature == 'search') { sig = '/ws/place/v1/search?' + requestArr.join('&') + sk } if (feature == 'suggest') { sig = '/ws/place/v1/suggestion?' + requestArr.join('&') + sk } if (feature == 'reverseGeocoder') { sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk } if (feature == 'geocoder') { sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk } if (feature == 'getCityList') { sig = '/ws/district/v1/list?' + requestArr.join('&') + sk } if (feature == 'getDistrictByCityId') { sig = '/ws/district/v1/getchildren?' + requestArr.join('&') + sk } if (feature == 'calculateDistance') { sig = '/ws/distance/v1/?' + requestArr.join('&') + sk } if (feature == 'direction') { sig = '/ws/direction/v1/' + mode + '?' + requestArr.join('&') + sk } sig = this.md5(sig); return sig }, location2query(data) { if (typeof data == 'string') { return data } var query = ''; for (var i = 0; i < data.length; i++) { var d = data[i]; if (!!query) { query += ';' } if (d.location) { query = query + d.location.lat + ',' + d.location.lng } if (d.latitude && d.longitude) { query = query + d.latitude + ',' + d.longitude } } return query }, rad(d) { return d * Math.PI / 180.0 }, getEndLocation(location) { var to = location.split(';'); var endLocation = []; for (var i = 0; i < to.length; i++) { endLocation.push({ lat: parseFloat(to[i].split(',')[0]), lng: parseFloat(to[i].split(',')[1]) }) } return endLocation }, getDistance(latFrom, lngFrom, latTo, lngTo) { var radLatFrom = this.rad(latFrom); var radLatTo = this.rad(latTo); var a = radLatFrom - radLatTo; var b = this.rad(lngFrom) - this.rad(lngTo); var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(radLatTo) * Math.pow(Math.sin(b / 2), 2))); distance = distance * EARTH_RADIUS; distance = Math.round(distance * 10000) / 10000; return parseFloat(distance.toFixed(0)) }, getWXLocation(success, fail, complete) { wx.getLocation({ type: 'gcj02', success: success, fail: fail, complete: complete }) }, getLocationParam(location) { if (typeof location == 'string') { var locationArr = location.split(','); if (locationArr.length === 2) { location = { latitude: location.split(',')[0], longitude: location.split(',')[1] } } else { location = {} } } return location }, polyfillParam(param) { param.success = param.success || function () { }; param.fail = param.fail || function () { }; param.complete = param.complete || function () { } }, checkParamKeyEmpty(param, key) { if (!param[key]) { var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key + '参数格式有误'); param.fail(errconf); param.complete(errconf); return true } return false }, checkKeyword(param) { return !this.checkParamKeyEmpty(param, 'keyword') }, checkLocation(param) { var location = this.getLocationParam(param.location); if (!location || !location.latitude || !location.longitude) { var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误'); param.fail(errconf); param.complete(errconf); return false } return true }, buildErrorConfig(errCode, errMsg) { return { status: errCode, message: errMsg } }, handleData(param, data, feature) { if (feature == 'search') { var searchResult = data.data; var searchSimplify = []; for (var i = 0; i < searchResult.length; i++) { searchSimplify.push({ id: searchResult[i].id || null, title: searchResult[i].title || null, latitude: searchResult[i].location && searchResult[i].location.lat || null, longitude: searchResult[i].location && searchResult[i].location.lng || null, address: searchResult[i].address || null, category: searchResult[i].category || null, tel: searchResult[i].tel || null, adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null, city: searchResult[i].ad_info && searchResult[i].ad_info.city || null, district: searchResult[i].ad_info && searchResult[i].ad_info.district || null, province: searchResult[i].ad_info && searchResult[i].ad_info.province || null }) } param.success(data, { searchResult: searchResult, searchSimplify: searchSimplify }) } else if (feature == 'suggest') { var suggestResult = data.data; var suggestSimplify = []; for (var i = 0; i < suggestResult.length; i++) { suggestSimplify.push({ adcode: suggestResult[i].adcode || null, address: suggestResult[i].address || null, category: suggestResult[i].category || null, city: suggestResult[i].city || null, district: suggestResult[i].district || null, id: suggestResult[i].id || null, latitude: suggestResult[i].location && suggestResult[i].location.lat || null, longitude: suggestResult[i].location && suggestResult[i].location.lng || null, province: suggestResult[i].province || null, title: suggestResult[i].title || null, type: suggestResult[i].type || null }) } param.success(data, { suggestResult: suggestResult, suggestSimplify: suggestSimplify }) } else if (feature == 'reverseGeocoder') { var reverseGeocoderResult = data.result; var reverseGeocoderSimplify = { address: reverseGeocoderResult.address || null, latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null, longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null, adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null, city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null, district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null, nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null, province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null, street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null, street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null, recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null, rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null }; if (reverseGeocoderResult.pois) { var pois = reverseGeocoderResult.pois; var poisSimplify = []; for (var i = 0; i < pois.length; i++) { poisSimplify.push({ id: pois[i].id || null, title: pois[i].title || null, latitude: pois[i].location && pois[i].location.lat || null, longitude: pois[i].location && pois[i].location.lng || null, address: pois[i].address || null, category: pois[i].category || null, adcode: pois[i].ad_info && pois[i].ad_info.adcode || null, city: pois[i].ad_info && pois[i].ad_info.city || null, district: pois[i].ad_info && pois[i].ad_info.district || null, province: pois[i].ad_info && pois[i].ad_info.province || null }) } param.success(data, { reverseGeocoderResult: reverseGeocoderResult, reverseGeocoderSimplify: reverseGeocoderSimplify, pois: pois, poisSimplify: poisSimplify }) } else { param.success(data, { reverseGeocoderResult: reverseGeocoderResult, reverseGeocoderSimplify: reverseGeocoderSimplify }) } } else if (feature == 'geocoder') { var geocoderResult = data.result; var geocoderSimplify = { title: geocoderResult.title || null, latitude: geocoderResult.location && geocoderResult.location.lat || null, longitude: geocoderResult.location && geocoderResult.location.lng || null, adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null, province: geocoderResult.address_components && geocoderResult.address_components.province || null, city: geocoderResult.address_components && geocoderResult.address_components.city || null, district: geocoderResult.address_components && geocoderResult.address_components.district || null, street: geocoderResult.address_components && geocoderResult.address_components.street || null, street_number: geocoderResult.address_components && geocoderResult.address_components.street_number || null, level: geocoderResult.level || null }; param.success(data, { geocoderResult: geocoderResult, geocoderSimplify: geocoderSimplify }) } else if (feature == 'getCityList') { var provinceResult = data.result[0]; var cityResult = data.result[1]; var districtResult = data.result[2]; param.success(data, { provinceResult: provinceResult, cityResult: cityResult, districtResult: districtResult }) } else if (feature == 'getDistrictByCityId') { var districtByCity = data.result[0]; param.success(data, districtByCity) } else if (feature == 'calculateDistance') { var calculateDistanceResult = data.result.elements; var distance = []; for (var i = 0; i < calculateDistanceResult.length; i++) { distance.push(calculateDistanceResult[i].distance) } param.success(data, { calculateDistanceResult: calculateDistanceResult, distance: distance }) } else if (feature == 'direction') { var direction = data.result.routes; param.success(data, direction) } else { param.success(data) } }, buildWxRequestConfig(param, options, feature) { var that = this; options.header = { "content-type": "application/json" }; options.method = 'GET'; options.success = function (res) { var data = res.data; if (data.status === 0) { that.handleData(param, data, feature) } else { param.fail(data) } }; options.fail = function (res) { res.statusCode = ERROR_CONF.WX_ERR_CODE; param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) }; options.complete = function (res) { var statusCode = +res.statusCode; switch (statusCode) { case ERROR_CONF.WX_ERR_CODE: { param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); break } case ERROR_CONF.WX_OK_CODE: { var data = res.data; if (data.status === 0) { param.complete(data) } else { param.complete(that.buildErrorConfig(data.status, data.message)) } break } default: { param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)) } } }; return options }, locationProcess(param, locationsuccess, locationfail, locationcomplete) { var that = this; locationfail = locationfail || function (res) { res.statusCode = ERROR_CONF.WX_ERR_CODE; param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) }; locationcomplete = locationcomplete || function (res) { if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) } }; if (!param.location) { that.getWXLocation(locationsuccess, locationfail, locationcomplete) } else if (that.checkLocation(param)) { var location = Utils.getLocationParam(param.location); locationsuccess(location) } } }; class QQMapWX { constructor(options) { if (!options.key) { throw Error('key值不能为空') } this.key = options.key }; search(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (!Utils.checkKeyword(options)) { return } var requestParam = { keyword: options.keyword, orderby: options.orderby || '_distance', page_size: options.page_size || 10, page_index: options.page_index || 1, output: 'json', key: that.key }; if (options.address_format) { requestParam.address_format = options.address_format } if (options.filter) { requestParam.filter = options.filter } var distance = options.distance || "1000"; var auto_extend = options.auto_extend || 1; var region = null; var rectangle = null; if (options.region) { region = options.region } if (options.rectangle) { rectangle = options.rectangle } var locationsuccess = function (result) { if (region && !rectangle) { requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," + result.longitude + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } else if (rectangle && !region) { requestParam.boundary = "rectangle(" + rectangle + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } else { requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SEARCH, data: requestParam }, 'search')) }; Utils.locationProcess(options, locationsuccess) }; getSuggestion(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (!Utils.checkKeyword(options)) { return } var requestParam = { keyword: options.keyword, region: options.region || '全国', region_fix: options.region_fix || 0, policy: options.policy || 0, page_size: options.page_size || 10, page_index: options.page_index || 1, get_subpois: options.get_subpois || 0, output: 'json', key: that.key }; if (options.address_format) { requestParam.address_format = options.address_format } if (options.filter) { requestParam.filter = options.filter } if (options.location) { var locationsuccess = function (result) { requestParam.location = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SUGGESTION, data: requestParam }, "suggest")) }; Utils.locationProcess(options, locationsuccess) } else { if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SUGGESTION, data: requestParam }, "suggest")) } }; reverseGeocoder(options) { var that = this; options = options || {}; Utils.polyfillParam(options); var requestParam = { coord_type: options.coord_type || 5, get_poi: options.get_poi || 0, output: 'json', key: that.key }; if (options.poi_options) { requestParam.poi_options = options.poi_options } var locationsuccess = function (result) { requestParam.location = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'reverseGeocoder') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_GET_GEOCODER, data: requestParam }, 'reverseGeocoder')) }; Utils.locationProcess(options, locationsuccess) }; geocoder(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'address')) { return } var requestParam = { address: options.address, output: 'json', key: that.key }; if (options.region) { requestParam.region = options.region } if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'geocoder') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_GET_GEOCODER, data: requestParam }, 'geocoder')) }; getCityList(options) { var that = this; options = options || {}; Utils.polyfillParam(options); var requestParam = { output: 'json', key: that.key }; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'getCityList') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_CITY_LIST, data: requestParam }, 'getCityList')) }; getDistrictByCityId(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'id')) { return } var requestParam = { id: options.id || '', output: 'json', key: that.key }; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'getDistrictByCityId') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_AREA_LIST, data: requestParam }, 'getDistrictByCityId')) }; calculateDistance(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'to')) { return } var requestParam = { mode: options.mode || 'walking', to: Utils.location2query(options.to), output: 'json', key: that.key }; if (options.from) { options.location = options.from } if (requestParam.mode == 'straight') { var locationsuccess = function (result) { var locationTo = Utils.getEndLocation(requestParam.to); var data = { message: "query ok", result: { elements: [] }, status: 0 }; for (var i = 0; i < locationTo.length; i++) { data.result.elements.push({ distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i].lat, locationTo[i].lng), duration: 0, from: { lat: result.latitude, lng: result.longitude }, to: { lat: locationTo[i].lat, lng: locationTo[i].lng } }) } var calculateResult = data.result.elements; var distanceResult = []; for (var i = 0; i < calculateResult.length; i++) { distanceResult.push(calculateResult[i].distance) } return options.success(data, { calculateResult: calculateResult, distanceResult: distanceResult }) }; Utils.locationProcess(options, locationsuccess) } else { var locationsuccess = function (result) { requestParam.from = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'calculateDistance') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_DISTANCE, data: requestParam }, 'calculateDistance')) }; Utils.locationProcess(options, locationsuccess) } }; direction(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'to')) { return } var requestParam = { output: 'json', key: that.key }; if (typeof options.to == 'string') { requestParam.to = options.to } else { requestParam.to = options.to.latitude + ',' + options.to.longitude } var SET_URL_DIRECTION = null; options.mode = options.mode || MODE.driving; SET_URL_DIRECTION = URL_DIRECTION + options.mode; if (options.from) { options.location = options.from } if (options.mode == MODE.driving) { if (options.from_poi) { requestParam.from_poi = options.from_poi } if (options.heading) { requestParam.heading = options.heading } if (options.speed) { requestParam.speed = options.speed } if (options.accuracy) { requestParam.accuracy = options.accuracy } if (options.road_type) { requestParam.road_type = options.road_type } if (options.to_poi) { requestParam.to_poi = options.to_poi } if (options.from_track) { requestParam.from_track = options.from_track } if (options.waypoints) { requestParam.waypoints = options.waypoints } if (options.policy) { requestParam.policy = options.policy } if (options.plate_number) { requestParam.plate_number = options.plate_number } } if (options.mode == MODE.transit) { if (options.departure_time) { requestParam.departure_time = options.departure_time } if (options.policy) { requestParam.policy = options.policy } } var locationsuccess = function (result) { requestParam.from = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'direction', options.mode) } wx.request(Utils.buildWxRequestConfig(options, { url: SET_URL_DIRECTION, data: requestParam }, 'direction')) }; Utils.locationProcess(options, locationsuccess) } }; module.exports = QQMapWX; \ No newline at end of file diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/placeOrder/index/index.vue b/CoreCms.Net.Uni-App/CoreShop/pages/placeOrder/index/index.vue index 125d480b..daa93b63 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/placeOrder/index/index.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/placeOrder/index/index.vue @@ -30,7 +30,7 @@ {{ userShip.mobile || ''}} - {{ userShip.areaName || ''}} {{userShip.address || ''}} + {{ userShip.areaName || ''}} {{userShip.street || ''}} {{userShip.address || ''}} @@ -65,7 +65,7 @@ {{store.mobile|| ''}} - {{store.address|| ''}} + {{store.address|| ''}} @@ -263,6 +263,7 @@ receiptType: 1, // 订单类型 1快递物流发货订单,2同城配送,3是门店自提订单 params: { ids: 0, // 传递过来的购物车id + userShipId: 0, areaId: 0, // 收货地址id couponCode: '', // 优惠券码列表(string)多张逗号分隔 point: 0,// 抵扣积分额 @@ -352,6 +353,7 @@ let userShip = this.$db.get('addressUserShip', true); if (userShip) { this.userShip = userShip; + this.params.userShipId = userShip.id; this.params.areaId = userShip.areaId; this.$db.del('addressUserShip', true); } @@ -370,6 +372,7 @@ let userShip = this.$store.state.userShip; if (userShip) { this.userShip = userShip; + this.params.userShipId = userShip.id; this.params.areaId = userShip.areaId; } let userInvoice = this.$store.state.invoice; @@ -445,6 +448,7 @@ this.$u.api.userDefaultShip().then(res => { if (res.status && res.data && Object.keys(res.data).length) { this.userShip = res.data + this.params.userShipId = this.userShip.id; this.params.areaId = this.userShip.areaId this.storePick.name = res.data.name; diff --git a/CoreCms.Net.Utility/Helper/MapHelper.cs b/CoreCms.Net.Utility/Helper/MapHelper.cs new file mode 100644 index 00000000..af0a41eb --- /dev/null +++ b/CoreCms.Net.Utility/Helper/MapHelper.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoreCms.Net.Utility.Helper +{ + /// + /// 通过地图上的两个坐标计算距离(C#版本) + /// Add by 成长的小猪(Jason.Song) on 2017/11/01 + /// http://blog.csdn.net/jasonsong2008 + /// + public class MapHelper + { + /// + /// 地球半径 + /// + private const double EarthRadius = 6378.137; + + + /// + /// 经纬度转化成弧度 + /// Add by 成长的小猪(Jason.Song) on 2017/11/01 + /// http://blog.csdn.net/jasonsong2008 + /// + /// + /// + private static double Rad(double d) + { + return d * Math.PI / 180d; + } + + + /// + /// 计算两个坐标点之间的距离 + /// Add by 成长的小猪(Jason.Song) on 2017/11/01 + /// http://blog.csdn.net/jasonsong2008 + /// + /// 第一个坐标的纬度 + /// 第一个坐标的经度 + /// 第二个坐标的纬度 + /// 第二个坐标的经度 + /// 返回两点之间的距离,单位:公里/千米 + public static double GetDistance(double firstLatitude, double firstLongitude, double secondLatitude, double secondLongitude) + { + var firstRadLat = Rad(firstLatitude); + var firstRadLng = Rad(firstLongitude); + var secondRadLat = Rad(secondLatitude); + var secondRadLng = Rad(secondLongitude); + + + var a = firstRadLat - secondRadLat; + var b = firstRadLng - secondRadLng; + var cal = 2 * Math.Asin(Math.Sqrt(Math.Pow(Math.Sin(a / 2), 2) + Math.Cos(firstRadLat) + * Math.Cos(secondRadLat) * Math.Pow(Math.Sin(b / 2), 2))) * EarthRadius; + var result = Math.Round(cal * 10000) / 10000; + return result; + } + + + /// + /// 计算两个坐标点之间的距离 + /// Add by 成长的小猪(Jason.Song) on 2017/11/01 + /// http://blog.csdn.net/jasonsong2008 + /// + /// 第一个坐标点的(纬度,经度) + /// 第二个坐标点的(纬度,经度) + /// 返回两点之间的距离,单位:公里/千米 + public static double GetPointDistance(string firstPoint, string secondPoint) + { + var firstArray = firstPoint.Split(','); + var secondArray = secondPoint.Split(','); + var firstLatitude = Convert.ToDouble(firstArray[0].Trim()); + var firstLongitude = Convert.ToDouble(firstArray[1].Trim()); + var secondLatitude = Convert.ToDouble(secondArray[0].Trim()); + var secondLongitude = Convert.ToDouble(secondArray[1].Trim()); + return GetDistance(firstLatitude, firstLongitude, secondLatitude, secondLongitude); + } + + + } +} diff --git a/CoreCms.Net.Web.Admin/Doc.xml b/CoreCms.Net.Web.Admin/Doc.xml index 8ee391fe..1fe60dda 100644 --- a/CoreCms.Net.Web.Admin/Doc.xml +++ b/CoreCms.Net.Web.Admin/Doc.xml @@ -554,7 +554,7 @@ 后端常用方法 - + 构造函数 @@ -783,6 +783,24 @@ + + + 自定义交易组件上传图片(Url交换) + + + + + + 自定义交易组件上传图片(Url交换) + + + + + + 自定义交易组件上传图片(Url交换单张) + + + 分销商表 diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/create.html b/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/create.html index b79933f2..aa790d9a 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/create.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/create.html @@ -160,8 +160,9 @@
- +
+
支持常用视频播放格式。
@@ -1229,6 +1230,28 @@ } }); + //视频上传 + var uploadInst = upload.render({ + elem: '#upVideoBtn' + , accept: 'video' + , url: layui.setter.apiUrl + 'Api/Tools/UploadFiles' + , before: function (obj) { + obj.preview(function (index, file, result) { + layer.msg('上传中', { icon: 16, shade: 0.4 }); + }); + } + , done: function (res) { + layer.closeAll('loading'); //关闭加载层 + if (res.code > 0) { + return layer.msg('上传失败'); + } + layer.msg('上传成功'); + $("#videoInput").val(res.data.fileUrl); + } + , error: function () { + } + }); + //提交操作 //监听提交 form.on('submit(LAY-app-CoreCmsGoods-createForm-submit)', diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html b/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html index 87738107..a2455d15 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html @@ -155,8 +155,9 @@
- +
+
支持常用视频播放格式。
@@ -1333,6 +1334,28 @@ } }); + //视频上传 + var uploadInst = upload.render({ + elem: '#upVideoBtn' + , accept: 'video' + , url: layui.setter.apiUrl + 'Api/Tools/UploadFiles' + , before: function (obj) { + obj.preview(function (index, file, result) { + layer.msg('上传中', { icon: 16, shade: 0.4 }); + }); + } + , done: function (res) { + layer.closeAll('loading'); //关闭加载层 + if (res.code > 0) { + return layer.msg('上传失败'); + } + layer.msg('上传成功'); + $("#videoInput").val(res.data.fileUrl); + } + , error: function () { + } + }); + form.on('submit(LAY-app-CoreCmsGoods-editForm-submit)', function (data) { var field = data.field; //获取提交的字段 diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html index e06e8fa4..1664139c 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html @@ -388,6 +388,46 @@ 先分销后代理:指先计算是否三级分销满足,满足则只计算三级分级分销,如果不满足再继续执行代理分佣逻辑。
+ +
+ 同城配送运费设置 +
+
+ +
+ +
+
2公里以内
+
+
+ +
+ +
+
2-5公里以内
+
+
+ +
+ +
+
5-10公里以内
+
+
+ +
+ +
+
10-15公里以内
+
+
+ +
+ +
+
15-20公里以内
+
+
diff --git a/CoreCms.Net.Web.WebApi/Controllers/CartController.cs b/CoreCms.Net.Web.WebApi/Controllers/CartController.cs index d44236e0..435b770b 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/CartController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/CartController.cs @@ -11,13 +11,13 @@ using CoreCms.Net.Auth.HttpContextUser; using CoreCms.Net.IServices; using CoreCms.Net.Model.FromBody; -using CoreCms.Net.Model.ViewModels.UI; -using CoreCms.Net.Model.ViewModels.DTO; using CoreCms.Net.Utility.Helper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; using CoreCms.Net.Configuration; +using CoreCms.Net.Model.ViewModels.DTO; +using CoreCms.Net.Model.ViewModels.UI; namespace CoreCms.Net.Web.WebApi.Controllers { @@ -73,10 +73,9 @@ namespace CoreCms.Net.Web.WebApi.Controllers public async Task GetList([FromBody] FMCartGetList entity) { var ids = CommonHelper.StringToIntArray(entity.ids); - //判断免费运费 - var freeFreight = entity.receiptType != 1; + //获取数据 - var jm = await _cartServices.GetCartInfos(_user.ID, ids, entity.type, entity.areaId, entity.point, entity.couponCode, freeFreight, entity.receiptType, entity.objectId); + var jm = await _cartServices.GetCartInfos(_user.ID, ids, entity.type, entity.areaId, entity.point, entity.couponCode, entity.receiptType, entity.userShipId, entity.objectId); return jm; } @@ -139,5 +138,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers } #endregion 根据提交的数据判断哪些购物券可以使用================================================== + } } \ No newline at end of file diff --git a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs index 2a41e13f..28d9df23 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs @@ -26,8 +26,8 @@ using CoreCms.Net.Loging; using CoreCms.Net.Model.Entities; using CoreCms.Net.Model.Entities.Expression; using CoreCms.Net.Model.FromBody; -using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Model.ViewModels.DTO; +using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Utility.Extensions; using CoreCms.Net.Utility.Helper; using CoreCms.Net.WeChat.Service.Enums; @@ -85,12 +85,14 @@ namespace CoreCms.Net.Web.WebApi.Controllers private readonly ICoreCmsStoreServices _storeServices; private readonly ICoreCmsCouponServices _couponServices; private readonly ICoreCmsOrderServices _orderServices; - private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; private readonly WeChatOptions _weChatOptions; + private readonly AsyncLock _mutex = new AsyncLock(); + + /// /// 构造函数 /// @@ -235,7 +237,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers } } } - //注意:生产环境下SessionKey属于敏感信息,不能进行传输! //return new JsonResult(new { success = true, msg = "OK", sessionAuthId = sessionBag.Key, sessionKey = sessionBag.SessionKey, data = jsonResult, sessionBag = sessionBag }); jm.status = true; @@ -271,6 +272,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers jm.msg = "用户信息获取失败"; return jm; } + var decodedEntity = EncryptHelper.DecodeUserInfoBySessionId(userInfo.sessionKey, entity.encryptedData, entity.iv); var token = string.Empty; var userWxId = entity.sessionAuthId; @@ -355,15 +357,16 @@ namespace CoreCms.Net.Web.WebApi.Controllers jm.msg = "请输入合法的手机号码"; return jm; } - if (entity.code == "login") - { - var shave = await _userServices.ExistsAsync(p => p.mobile == entity.mobile && p.userWx > 0); - if (shave) - { - jm.msg = "手机号码已被绑定,请更换"; - return jm; - } - } + //此验证貌似没意义。 + //if (entity.code == "login") + //{ + // var shave = await _userServices.ExistsAsync(p => p.mobile == entity.mobile && p.userWx > 0); + // if (shave) + // { + // jm.msg = "手机号码已被绑定,请更换"; + // return jm; + // } + //} jm = await _smsServices.DoSendSms(entity.code, entity.mobile); return jm; } @@ -378,7 +381,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers [HttpPost] public async Task SmsLogin([FromBody] FMWxAccountCreate entity) { - var jm = await _userServices.SmsLogin(entity, 2, entity.platform); + var jm = await _userServices.SmsLogin(entity, (int)GlobalEnumVars.LoginType.Sms, entity.platform); return jm; } @@ -428,7 +431,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers return jm; } - #endregion #region 用户短信注册并返回jwt token(弃用)====================================================== @@ -525,8 +527,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers var log = new CoreCmsUserLog(); log.userId = id; log.state = (int)GlobalEnumVars.UserLogTypes.注册; - log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? - _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1"; + log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1"; log.createTime = DateTime.Now; log.parameters = GlobalEnumVars.UserLogTypes.注册.ToString(); await _userLogServices.InsertAsync(log); @@ -602,7 +603,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers /// /// 统一分享url处理 /// 新的分享,不管是二维码,还是地址,都走这个 - /// page 场景值 1店铺首页,2商品详情页,3拼团详情页,4邀请好友(店铺页面,params里需要传store),5文章页面,6参团页面,7自定义页面,8智能表单,9团购,10秒杀,11代理 + /// page 场景值 1店铺首页,2商品详情页,3拼团详情页,4邀请好友(店铺页面,params里需要传store),5文章页面,6参团页面,7自定义页面,8智能表单,9团购,10秒杀,11代理,12接龙 /// url:前端地址 /// params:参数,根据场景值不一样而内容不一样 /// 1 @@ -727,7 +728,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers } #endregion - #region 获取用户信息 /// /// 获取用户信息 @@ -988,6 +988,12 @@ namespace CoreCms.Net.Web.WebApi.Controllers userShip.address = entity.address; userShip.mobile = entity.mobile; userShip.updateTime = DateTime.Now; + + userShip.longitude = entity.longitude; + userShip.latitude = entity.latitude; + userShip.street = entity.street; + + var ship = await _userShipServices.UpdateAsync(userShip); jm.status = true; jm.data = ship; @@ -1008,6 +1014,11 @@ namespace CoreCms.Net.Web.WebApi.Controllers userShip.address = entity.address; userShip.mobile = entity.mobile; userShip.createTime = DateTime.Now; + + userShip.longitude = entity.longitude; + userShip.latitude = entity.latitude; + userShip.street = entity.street; + var ship = await _userShipServices.InsertAsync(userShip); jm.status = true; jm.data = ship; @@ -1104,7 +1115,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers //生成支付单,并发起支付 jm = await _billPaymentsServices.Pay(entity.ids, entity.payment_code, _user.ID, entity.payment_type, entity.@params); - + //NLogUtil.WriteFileLog(NLog.LogLevel.Error, LogType.RedisMessageQueue, "支付",JsonConvert.SerializeObject(jm)); return jm; } @@ -1259,7 +1270,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers [Authorize] public async Task GetBankCardsOrganization([FromBody] FMStringId entity) { - var jm = await _userBankCardServices.BankCardsOrganization(entity.id); + var jm =await _userBankCardServices.BankCardsOrganization(entity.id); return jm; } @@ -1316,9 +1327,9 @@ namespace CoreCms.Net.Web.WebApi.Controllers if (!string.IsNullOrEmpty(entity.propsDate)) { - if (entity.propsDate.Contains("-")) + if (entity.propsDate.Contains("至")) { - var dts = entity.propsDate.Split("-"); + var dts = entity.propsDate.Split("至"); if (dts.Length == 2) { var dt = dts[0].ObjectToDate(DateTime.Now); @@ -1558,7 +1569,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers { var jm = new WebApiCallBack(); - jm.status = await _goodsBrowsingServices.DeleteAsync(p => p.userId == _user.ID && p.goodsId == entity.id); + jm.status = await _goodsBrowsingServices.DeleteAsync(p => p.userId == _user.ID && p.id == entity.id); jm.msg = jm.status ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; return jm; @@ -1725,7 +1736,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers #endregion - #region 获取我的上级邀请人 /// /// 获取我的上级邀请人 @@ -1740,8 +1750,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers #endregion - - #region 获取我的下级用户数量 /// /// 获取我的下级用户数量 @@ -1776,8 +1784,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers #endregion - - #region 获取用户推荐列表 /// /// 获取用户推荐列表 @@ -1926,8 +1932,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers foreach (var item in orders) { item.service = services.Find(p => p.id == item.servicesId); - item.statusStr = - EnumHelper.GetEnumDescriptionByValue(item.status); + item.statusStr = EnumHelper.GetEnumDescriptionByValue(item.status); } } diff --git a/CoreCms.Net.Web.WebApi/Doc.xml b/CoreCms.Net.Web.WebApi/Doc.xml index fca3c305..8320e63e 100644 --- a/CoreCms.Net.Web.WebApi/Doc.xml +++ b/CoreCms.Net.Web.WebApi/Doc.xml @@ -954,7 +954,7 @@ 统一分享url处理 新的分享,不管是二维码,还是地址,都走这个 - page 场景值 1店铺首页,2商品详情页,3拼团详情页,4邀请好友(店铺页面,params里需要传store),5文章页面,6参团页面,7自定义页面,8智能表单,9团购,10秒杀,11代理 + page 场景值 1店铺首页,2商品详情页,3拼团详情页,4邀请好友(店铺页面,params里需要传store),5文章页面,6参团页面,7自定义页面,8智能表单,9团购,10秒杀,11代理,12接龙 url:前端地址 params:参数,根据场景值不一样而内容不一样 1 diff --git a/数据库/MySql/20220212/coreshop20220212完整脚本.rar b/数据库/MySql/20220212/coreshop20220212完整脚本.rar new file mode 100644 index 00000000..b899cbe1 Binary files /dev/null and b/数据库/MySql/20220212/coreshop20220212完整脚本.rar differ diff --git a/数据库/MySql/20220212/升级脚本.sql b/数据库/MySql/20220212/升级脚本.sql new file mode 100644 index 00000000..1bd56c15 --- /dev/null +++ b/数据库/MySql/20220212/升级脚本.sql @@ -0,0 +1,3 @@ +ALTER TABLE CoreCmsUserShip ADD COLUMN latitude VARCHAR(50) DEFAULT NULL COMMENT '纬度' AFTER updateTime; +ALTER TABLE CoreCmsUserShip ADD COLUMN longitude VARCHAR(50) DEFAULT NULL COMMENT '经度' AFTER latitude; +ALTER TABLE CoreCmsUserShip ADD COLUMN street VARCHAR(50) DEFAULT NULL COMMENT '街道' AFTER longitude; \ No newline at end of file diff --git a/数据库/MySql/数据库更新日志.txt b/数据库/MySql/数据库更新日志.txt index 80e50efa..ec45fa33 100644 --- a/数据库/MySql/数据库更新日志.txt +++ b/数据库/MySql/数据库更新日志.txt @@ -1,3 +1,6 @@ +2022-02-12 +【新增】表【CoreCmsUserShip】增加【精度longitude】【纬度latitude】【街道street】三字段。 + 2022-02-11 【新增】增加【CoreCmsAgentOrderDetails】表,实现代理佣金订单详情列表功能,精确到具体商品明细。 【新增】增加【CoreCmsDistributionOrderDetails】表,实现三级佣金订单详情列表功能,精确到具体商品明细。 diff --git a/数据库/SqlServer/20220212/202202112250完整数据库.rar b/数据库/SqlServer/20220212/202202112250完整数据库.rar new file mode 100644 index 00000000..a1f7127f Binary files /dev/null and b/数据库/SqlServer/20220212/202202112250完整数据库.rar differ diff --git a/数据库/SqlServer/20220212/升级脚本.sql b/数据库/SqlServer/20220212/升级脚本.sql new file mode 100644 index 00000000..575afc41 --- /dev/null +++ b/数据库/SqlServer/20220212/升级脚本.sql @@ -0,0 +1,13 @@ +ALTER TABLE [dbo].[CoreCmsUserShip] + ADD [longitude] NVARCHAR (50) NULL, + [latitude] NVARCHAR (50) NULL, + [street] NVARCHAR (50) NULL; + +GO +EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'纬度', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CoreCmsUserShip', @level2type = N'COLUMN', @level2name = N'latitude'; + +GO +EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'经度', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CoreCmsUserShip', @level2type = N'COLUMN', @level2name = N'longitude'; + +GO +EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'街道', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CoreCmsUserShip', @level2type = N'COLUMN', @level2name = N'street'; diff --git a/数据库/SqlServer/数据库更新日志.txt b/数据库/SqlServer/数据库更新日志.txt index 03ad75d3..d897ac2b 100644 --- a/数据库/SqlServer/数据库更新日志.txt +++ b/数据库/SqlServer/数据库更新日志.txt @@ -1,3 +1,6 @@ +2022-02-12 +【新增】表【CoreCmsUserShip】增加【精度longitude】【纬度latitude】【街道street】三字段。 + 2022-02-11 【新增】增加【CoreCmsAgentOrderDetails】表,实现代理佣金订单详情列表功能,精确到具体商品明细。 【新增】增加【CoreCmsDistributionOrderDetails】表,实现三级佣金订单详情列表功能,精确到具体商品明细。