Procházet zdrojové kódy

调整会员信息

zhengbingbing %!s(int64=5) %!d(string=před) roky
rodič
revize
ff074da225

+ 6 - 1
代码/System.IRepositories/ICus_VIPInfoRepository.cs

@@ -1,13 +1,18 @@
1
-using System;
1
+using SqlSugar;
2
+using System;
2 3
 using System.Collections.Generic;
3 4
 using System.Common;
5
+using System.Linq.Expressions;
4 6
 using System.Model;
5 7
 using System.Text;
8
+using System.Threading.Tasks;
6 9
 
7 10
 namespace System.IRepositories
8 11
 {
9 12
     public interface ICus_VipInfoRepository : IRepository<T_Cus_VipInfo>
10 13
     {
14
+        Task<PageData<V_Cus_VipInfo>> GetListViewByPage(List<IConditionalModel> conModels, MyPageModel pagemodel, string orderby);
15
+        Task<V_Cus_VipInfo> GetSingleV(Expression<Func<V_Cus_VipInfo, bool>> whereExpression);
11 16
     }
12 17
    
13 18
 }

+ 4 - 5
代码/System.Model/T_Cus_VipInfo.cs

@@ -24,7 +24,6 @@ namespace System.Model
24 24
         private string _f_nickname;
25 25
         private string _f_address;
26 26
         private string _f_address1;
27
-        private DateTime _f_regtime;
28 27
         /// <summary>
29 28
         /// id标识,自增
30 29
         /// </summary>
@@ -140,7 +139,7 @@ namespace System.Model
140 139
         /// <summary>
141 140
         /// 添加时间
142 141
         /// </summary>
143
-        public DateTime F_CreateOn { get; set; }
142
+        public DateTime? F_CreateOn { get; set; }
144 143
         /// <summary>
145 144
         /// 添加工号
146 145
         /// </summary>
@@ -149,7 +148,7 @@ namespace System.Model
149 148
         /// <summary>
150 149
         /// 最后一次修改时间
151 150
         /// </summary>
152
-        public DateTime F_LastModifyOn { get; set; }
151
+        public DateTime? F_LastModifyOn { get; set; }
153 152
         /// <summary>
154 153
         /// 最后一次修改工号
155 154
         /// </summary>
@@ -157,7 +156,7 @@ namespace System.Model
157 156
         /// <summary>
158 157
         /// 删除时间
159 158
         /// </summary>
160
-        public DateTime F_DeleteOn { get; set; }
159
+        public DateTime? F_DeleteOn { get; set; }
161 160
         /// <summary>
162 161
         /// 删除工号
163 162
         /// </summary>
@@ -165,7 +164,7 @@ namespace System.Model
165 164
         /// <summary>
166 165
 		/// 年龄
167 166
         /// </summary>				
168
-        public int F_Age { get; set; }
167
+        public int? F_Age { get; set; }
169 168
         /// <summary>
170 169
         /// 手机号1
171 170
         /// </summary>				

+ 171 - 0
代码/System.Model/V_Cus_VipInfo.cs

@@ -0,0 +1,171 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Text;
4
+
5
+namespace System.Model
6
+{
7
+    public class V_Cus_VipInfo
8
+    {
9
+        #region Model
10
+        /// <summary>
11
+        /// id标识,自增
12
+        /// </summary>
13
+        public int F_ID { get; set; }
14
+        /// <summary>
15
+        /// 会员编号
16
+        /// </summary>
17
+        public string F_VIPCode { get; set; }
18
+        /// <summary>
19
+        /// 姓名
20
+        /// </summary>
21
+        public string F_Name { get; set; }
22
+        /// <summary>
23
+        /// 生日
24
+        /// </summary>
25
+        public DateTime? F_Birthday { get; set; }
26
+        public string Birthday { get; set; }
27
+        /// <summary>
28
+        /// 固定电话
29
+        /// </summary>
30
+        public string F_Phone { get; set; }
31
+        /// <summary>
32
+        /// 性别
33
+        /// </summary>
34
+        public string F_Sex { get; set; }
35
+        /// <summary>
36
+        /// 标签
37
+        /// </summary>
38
+        public string F_Label { get; set; }
39
+        /// <summary>
40
+        /// 推荐人
41
+        /// </summary>
42
+        public string F_Recommender { get; set; }
43
+        /// <summary>
44
+        /// 状态:0禁用 1启用 2删除
45
+        /// </summary>
46
+        public int F_State { get; set; }
47
+        /// <summary>
48
+        /// 备注
49
+        /// </summary>
50
+        public string F_Note { get; set; }
51
+        /// <summary>
52
+        /// 所在城市
53
+        /// </summary>
54
+        public string F_City { get; set; }
55
+        /// <summary>
56
+        /// 微信昵称
57
+        /// </summary>
58
+        public string F_Nickname { get; set; }
59
+        /// <summary>
60
+        /// 地址
61
+        /// </summary>
62
+        public string F_Address { get; set; }
63
+        /// <summary>
64
+        /// 地址备用
65
+        /// </summary>
66
+        public string F_Address1 { get; set; }
67
+        /// <summary>
68
+        /// 添加时间
69
+        /// </summary>
70
+        public DateTime? F_CreateOn { get; set; }
71
+        /// <summary>
72
+        /// 添加工号
73
+        /// </summary>
74
+        public string F_CreateBy { get; set; }
75
+
76
+        /// <summary>
77
+        /// 最后一次修改时间
78
+        /// </summary>
79
+        public DateTime? F_LastModifyOn { get; set; }
80
+        /// <summary>
81
+        /// 最后一次修改工号
82
+        /// </summary>
83
+        public string F_LastModifyBy { get; set; }
84
+        /// <summary>
85
+        /// 删除时间
86
+        /// </summary>
87
+        public DateTime? F_DeleteOn { get; set; }
88
+        /// <summary>
89
+        /// 删除工号
90
+        /// </summary>
91
+        public string F_DeleteBy { get; set; }
92
+        /// <summary>
93
+		/// 年龄
94
+        /// </summary>				
95
+        public int? F_Age { get; set; }
96
+        /// <summary>
97
+        /// 手机号1
98
+        /// </summary>				
99
+        public string F_Mobile { get; set; }
100
+        /// <summary>
101
+        /// 手机号2
102
+        /// </summary>				
103
+        public string F_Mobile1 { get; set; }
104
+        /// <summary>
105
+        /// 省
106
+        /// </summary>				
107
+        public string F_Province { get; set; }
108
+        /// <summary>
109
+        /// 县、区
110
+        /// </summary>				
111
+        public string F_Area { get; set; }
112
+        /// <summary>
113
+        /// 乡镇
114
+        /// </summary>				
115
+        public string F_Town { get; set; }
116
+        /// <summary>
117
+        /// 邮编
118
+        /// </summary>				
119
+        public string F_Postcode { get; set; }
120
+        /// <summary>
121
+        /// 鞋码
122
+        /// </summary>				
123
+        public int? F_ShoeSize { get; set; }
124
+        /// <summary>
125
+        /// 会员积分
126
+        /// </summary>				
127
+        public decimal? F_Score { get; set; }
128
+        /// <summary>
129
+        /// 累计消费金额
130
+        /// </summary>				
131
+        public decimal? F_Money { get; set; }
132
+        /// <summary>
133
+        /// 累计积分
134
+        /// </summary>				
135
+        public decimal? F_TotalScore { get; set; }
136
+        /// <summary>
137
+        /// 销售负责人
138
+        /// </summary>				
139
+        public string F_Saleperson { get; set; }
140
+        /// <summary>
141
+        /// 联系频次
142
+        /// </summary>				
143
+        public string F_Contact { get; set; }
144
+        /// <summary>
145
+        /// 会员类型
146
+        /// </summary>				
147
+        public string F_Type { get; set; }
148
+        //备用地址
149
+        /// <summary>
150
+		/// 备用省份
151
+        /// </summary>				
152
+        public string F_Province1 { get; set; }
153
+        /// <summary>
154
+        /// 备用城市
155
+        /// </summary>				
156
+        public string F_City1 { get; set; }
157
+        /// <summary>
158
+        /// 备用县区
159
+        /// </summary>				
160
+        public string F_Area1 { get; set; }
161
+        /// <summary>
162
+        /// 备用乡镇
163
+        /// </summary>				
164
+        public string F_Town1 { get; set; }
165
+        /// <summary>
166
+        /// 备用邮编
167
+        /// </summary>				
168
+        public string F_Postcode1 { get; set; }
169
+        #endregion Model
170
+    }
171
+}

+ 30 - 1
代码/System.Repositories/Cus_VIPInfoRepository.cs

@@ -1,14 +1,43 @@
1
-using System;
1
+using SqlSugar;
2
+using System;
2 3
 using System.Collections.Generic;
3 4
 using System.Common;
4 5
 using System.IRepositories;
6
+using System.Linq.Expressions;
5 7
 using System.Model;
6 8
 using System.Text;
9
+using System.Threading.Tasks;
7 10
 
8 11
 namespace System.Repositories
9 12
 {
10 13
     public class Cus_VipInfoRepository : BaseRepository<T_Cus_VipInfo>, ICus_VipInfoRepository
11 14
     {
15
+        public async Task<PageData<V_Cus_VipInfo>> GetListViewByPage(List<IConditionalModel> conModels, MyPageModel pagemodel, string orderby)
16
+        {
17
+            var list = await Db.SqlQueryable<V_Cus_VipInfo>("select * from T_Cus_VipInfo with(nolock)").Where(conModels).OrderBy(orderby).ToPageListAsync(pagemodel.PageIndex, pagemodel.PageSize, pagemodel.PageCount);
18
+            var newlist = new List<V_Cus_VipInfo>();
19
+            foreach (var item in list)
20
+            {
21
+                var newmodel = item;
22
+                if (item.F_Birthday != null)
23
+                    newmodel.Birthday = item.F_Birthday.Value.ToString("yyyy-MM-dd");
24
+
25
+                newlist.Add(newmodel);
26
+            }
27
+            PageData<V_Cus_VipInfo> pd = new PageData<V_Cus_VipInfo>();
28
+            pd.Rows = newlist;
29
+            pd.Totals = pagemodel.PageCount;
30
+            return pd;
31
+        }
32
+
33
+        public async Task<V_Cus_VipInfo> GetSingleV(Expression<Func<V_Cus_VipInfo, bool>> whereExpression)
34
+        {
35
+            var model= await Db.SqlQueryable<V_Cus_VipInfo>("select * from T_Cus_VipInfo with(nolock)").Where(whereExpression).SingleAsync();
36
+            if(model.F_Birthday!=null)
37
+                model.Birthday=model.F_Birthday.Value.ToString("yyyy-MM-dd");
38
+            return model;
39
+            //return CurrentDb.GetSingle(whereExpression);
40
+        }
12 41
     }
13 42
     
14 43
 }

+ 11 - 8
代码/TVShoppingCallCenter_ZLJ/Controllers/Customer/VIPInfoController.cs

@@ -114,7 +114,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
114 114
             }
115 115
             #endregion
116 116
             int recordCount = 0;
117
-            var list = await _cus_vip_infoRepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount });
117
+            var list = await _cus_vip_infoRepository.GetListViewByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount }, "F_CreateOn desc");
118 118
             var obj = new
119 119
             {
120 120
                 state = "success",
@@ -136,7 +136,9 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
136 136
             if (id <= 0)
137 137
                 return Error("参数错误");
138 138
 
139
-            var model = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == id);
139
+            var model = await _cus_vip_infoRepository.GetSingleV(x => x.F_ID == id && x.F_State == (int)EnumDelState.Enabled);
140
+            var newmodel = new V_Cus_VipInfo();
141
+
140 142
             if (model == null)
141 143
             {
142 144
                 return Error("获取失败");
@@ -155,7 +157,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
155 157
             if (string.IsNullOrEmpty(input.name))
156 158
                 return Error("请输入名字");
157 159
             if (string.IsNullOrEmpty(input.phone))
158
-                return Error("请输入手机号");
160
+                return Error("请输入联系方式");
159 161
 
160 162
             var model = new T_Cus_VipInfo();
161 163
             model.F_VIPCode = input.vipcode;//会员卡号
@@ -165,14 +167,11 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
165 167
             model.F_Recommender = input.recommender;
166 168
             model.F_Sex = input.sex;
167 169
             model.F_Label = input.label;
168
-            model.F_State = 1;
169 170
             model.F_Note = input.note;
170 171
             model.F_City = input.city;
171 172
             model.F_Nickname = input.nickname;
172 173
             model.F_Address = input.address;
173 174
             model.F_Address1 = input.address1;
174
-            model.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
175
-            model.F_CreateOn = DateTime.Now;
176 175
             model.F_Age = input.age;
177 176
             model.F_Mobile = input.mobile;
178 177
             model.F_Mobile1 = input.mobile1;
@@ -193,6 +192,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
193 192
             model.F_Contact = input.contact;
194 193
             model.F_Type = input.type;
195 194
 
195
+            model.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value; //"8000";
196
+            model.F_CreateOn = DateTime.Now;
197
+            model.F_State = (int)EnumDelState.Enabled;
198
+
196 199
             if (await _cus_vip_infoRepository.GetCount(x => x.F_VIPCode == model.F_VIPCode && x.F_Name == input.name) > 0)
197 200
             {
198 201
                 return Error("添加失败,存在相同会员信息");
@@ -217,9 +220,9 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
217 220
             if (string.IsNullOrEmpty(input.name))
218 221
                 return Error("请输入名字");
219 222
             if (string.IsNullOrEmpty(input.phone))
220
-                return Error("请输入手机号");
223
+                return Error("请输入联系方式");
221 224
 
222
-            var model = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == input.id);
225
+            var model = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == input.id && x.F_State == (int)EnumDelState.Enabled);
223 226
             if (model == null)
224 227
                 return Error("操作失败");
225 228
             //model.F_VIPCode = input.vipcode;//会员卡号