Commit b39715b5fa5d2092875ed7677bc361c43b6dfbbe

Authored by yvan.ni
1 parent 0eb0c93d

小程序修改

packageA/pages/my_service2/appment_main.js
@@ -3,6 +3,8 @@ var e = getApp(), @@ -3,6 +3,8 @@ var e = getApp(),
3 os = a, 3 os = a,
4 t = e.request, 4 t = e.request,
5 d = e.globalData; 5 d = e.globalData;
  6 + var ut = require("../../../utils/util.js");
  7 +
6 Page({ 8 Page({
7 /** 9 /**
8 * 页面的初始数据 10 * 页面的初始数据
@@ -11,21 +13,17 @@ Page({ @@ -11,21 +13,17 @@ Page({
11 inurl: a.url, //接口网址 13 inurl: a.url, //接口网址
12 iurl: a.imghost, //服务器网址 14 iurl: a.imghost, //服务器网址
13 store: 0, //是否显示服务门店列表 15 store: 0, //是否显示服务门店列表
14 - beautician: 0, //是否显示美容师列表  
15 - beautician_name: "", //选中的美容师名称  
16 - beauticianID: "", //美容师id  
17 - bea_index: "", //美容师列表下标 16 +
18 placeholder: "填写备注", //备注为空的placeholder 17 placeholder: "填写备注", //备注为空的placeholder
19 store_list: [], //门店列表 18 store_list: [], //门店列表
20 - beautician_list: [], //美容师列表  
21 - store_name: "", //选择的服务门店 19 +
  20 + store_name: "", //选择的服务门店
22 fir_pick_index: 0, //选择的门店下标 21 fir_pick_index: 0, //选择的门店下标
23 curpage: 1, //当前分页数 22 curpage: 1, //当前分页数
24 pageSize: 8, //页大小 23 pageSize: 8, //页大小
25 total: 0, 24 total: 0,
26 ismore: 0, //是否加载完毕 25 ismore: 0, //是否加载完毕
27 - itemId: "", //服务id  
28 - project_id: "", //项目id 26 +
29 isScroll: true, //scroll-y是否可以滑动 27 isScroll: true, //scroll-y是否可以滑动
30 key_word: "", //是否按门店文字查询 28 key_word: "", //是否按门店文字查询
31 is_service_read: 0, //是否调用过门店接口 29 is_service_read: 0, //是否调用过门店接口
@@ -34,8 +32,7 @@ Page({ @@ -34,8 +32,7 @@ Page({
34 remarks: "", //备注 32 remarks: "", //备注
35 storageId: "", //线下门店id 33 storageId: "", //线下门店id
36 url: "/packageA/pages/my_service/appment_main", //本页面地址路径用于选择时间页面跳转回来 34 url: "/packageA/pages/my_service/appment_main", //本页面地址路径用于选择时间页面跳转回来
37 - buyType: "", //项目类型  
38 - time: "", //选择预约时间 35 +
39 tment_count: "", //可预约人数 36 tment_count: "", //可预约人数
40 lat: "", //纬度坐标 37 lat: "", //纬度坐标
41 lon: "", //经度坐标 38 lon: "", //经度坐标
@@ -44,19 +41,19 @@ Page({ @@ -44,19 +41,19 @@ Page({
44 is_sub: 0, //判断是否重复提交 41 is_sub: 0, //判断是否重复提交
45 is_textea: 1, //备注是否是可输入 42 is_textea: 1, //备注是否是可输入
46 43
47 - // 拖拽参数  
48 - writePosition: [], //默认定位参数  
49 - writesize: [0, 0],// X Y 定位  
50 - window: [0, 0], //屏幕尺寸  
51 - write: [0, 0], //定位参数  
52 - scrolltop: 0,//据顶部距离  
53 - v:{},  
54 -  
55 - project: ['项目1', '项目2', '项目3', '项目4', '项目5', '项目6', '项目7'],  
56 - md: [{name:'美导1',time:'08:30-22:00'},{name:'美导2',time:'09:30-18:00'},],  
57 - timeList: [],  
58 - deltaX: 0,  
59 - col_arr:[], 44 + write: [0, 0], //定位参数
  45 + scrolltop: 0,//据顶部距离
  46 + v:{},
  47 +
  48 + //project: ['项目1', '项目2', '项目3', '项目4', '项目5', '项目6', '项目7'],
  49 + //md: [{name:'美导1',time:'08:30-22:00'},{name:'美导2',time:'09:30-18:00'},],
  50 + timeList: [],
  51 + deltaX: 0,
  52 + col_arr:[],
  53 + wp:[],
  54 + datet:null,
  55 + s_top:0,
  56 +
60 }, 57 },
61 //控制备注输入 58 //控制备注输入
62 check_text: function() { 59 check_text: function() {
@@ -67,6 +64,7 @@ Page({ @@ -67,6 +64,7 @@ Page({
67 beautician: 0 64 beautician: 0
68 }) 65 })
69 }, 66 },
  67 +
70 onclickstore: function() { 68 onclickstore: function() {
71 var th = this; 69 var th = this;
72 var store = th.data.store; 70 var store = th.data.store;
@@ -85,6 +83,8 @@ Page({ @@ -85,6 +83,8 @@ Page({
85 wx.showLoading({ 83 wx.showLoading({
86 title: '加载中', 84 title: '加载中',
87 }) 85 })
  86 +
  87 + //获取门店
88 th.query_store(); 88 th.query_store();
89 } 89 }
90 } 90 }
@@ -96,104 +96,81 @@ Page({ @@ -96,104 +96,81 @@ Page({
96 remarks: remarks 96 remarks: remarks
97 }) 97 })
98 }, 98 },
99 - //提交成功及发送模版代码 99 +
  100 +
  101 + //单个预约的提交成功及发送模版代码
100 success: function() { 102 success: function() {
  103 + wx.showLoading({ title: '加载中', });
101 var th = this; 104 var th = this;
102 var store = th.data.store_name; //门店名称 105 var store = th.data.store_name; //门店名称
103 - var bea_name = th.data.beautician_name; //美容师名称  
104 - var time = th.data.time; //预约时间  
105 - var is_sub = th.data.is_sub; //是否重复提交  
106 - var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/insert"; //接口路径  
107 - var serviceId = th.data.itemId; //服务id  
108 - var beauticianID = th.data.beauticianID; //美容师id  
109 - var buyType = th.data.buyType; //服务项目类型  
110 - var storeId = a.stoid; //商家id  
111 - var storageId = th.data.storageId; //门店id  
112 - var userId = th.data.options.userid; //用户id  
113 - var remarks = th.data.remarks; //用户备注  
114 - var project_id = th.data.project_id; //项目id  
115 - var validay = th.data.validay;  
116 - var json = {  
117 - "arrangeTime": time + ":00",  
118 - "beauticianId": beauticianID,  
119 - "buyType": buyType,  
120 - "effectiveDay": "",  
121 - "number": "",  
122 - "projectId": project_id,  
123 - "remark": remarks,  
124 - "serviceId": serviceId,  
125 - "states": 0,  
126 - "storageId": storageId,  
127 - "storeId": storeId,  
128 - "userId": userId,  
129 - "validay": validay,  
130 - "isxz": 1  
131 -  
132 - }  
133 - var data = JSON.stringify(json); 106 + var datet = th.data.datet; //预约时间
  107 + //接口路径
  108 + var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/batchinsert";
  109 + var req_arr={
  110 + "storageId": th.data.storageId,
  111 + "storeId": a.stoid,
  112 + "userId": getApp().globalData.userInfo.user_id,
  113 + "remark": '',
  114 + "isxz": 1,
  115 + "states": 0,
  116 + "list":[]
  117 + };
  118 + for(var i in this.data.v){
  119 + for(var j in this.data.v[i]){
  120 + var item=this.data.v[i][j];
  121 + var md=this.data.md[i];
  122 + var tn=this.data.timeArr[j];
  123 + var json = {
  124 + "arrangeTime":datet+' '+ tn + ":00",
  125 + "beauticianId":encodeURIComponent(md.staffid) ,
  126 + "buyType": item.BuyType,
  127 + //"effectiveDay": "",
  128 + //"number": "",
  129 + "projectId": item.ProjectID,
  130 + "serviceId": item.ServiceID,
  131 + "validay": item.Validay,
  132 + }
  133 + req_arr.list.push(json);
  134 + }
  135 + }
  136 + console.log(req_arr);
  137 + //return false;
  138 + var js_data = JSON.stringify(req_arr);
134 wx.request({ 139 wx.request({
135 url: url, 140 url: url,
136 - data: json, 141 + data: js_data,
137 method: 'post', 142 method: 'post',
138 header: { 143 header: {
139 'content-type': 'application/json' 144 'content-type': 'application/json'
140 }, // 设置请求的 header 145 }, // 设置请求的 header
141 success: function(res) { 146 success: function(res) {
142 - th.setData({  
143 - is_sub: 0  
144 - }) 147 + th.setData({ is_sub: 0})
145 wx.hideLoading(); 148 wx.hideLoading();
146 if (res.data.code == 0) { 149 if (res.data.code == 0) {
147 - getApp().my_warnning("预约成功", 1, th);  
148 - // var store_name = th.data.store_name; //预约门店  
149 - var number = res.data.data.Number;  
150 - // var temp_url = "/api/wx/open/app/user/sendSubscribeMsg"; //模版接口  
151 - //var userinfo = getApp().globalData.userInfo;  
152 - //var name = d.userInfo.nickname;  
153 - // var json = {  
154 - // // "formId": formid,  
155 - // "keyWord": [{  
156 - // "keyword": res.data.data.ServiceName  
157 - // },  
158 - // {  
159 - // "keyword": time.substring(0, 16)  
160 - // }, {  
161 - // "keyword": res.data.data.BeauticianName  
162 - // }, {  
163 - // "keyword": res.data.data.StorageName  
164 - // }, {  
165 - // "keyword": res.data.data.Address  
166 - // }  
167 - // ],  
168 - // "page": "/packageA/pages/my_service/tment_details?number=" + number+"&userid="+th.data.options.userid,  
169 - // "storeId": a.stoid,  
170 - // "typeId": "1011",  
171 - // "userId": th.data.options.userid  
172 - // };  
173 - // var data = JSON.stringify(json);  
174 - // //调用发送预约成功模版接口  
175 - // wx.request({  
176 - // url: th.data.inurl + temp_url,  
177 - // data: data,  
178 - // method: 'post',  
179 - // header: {  
180 - // 'content-type': 'application/json'  
181 - // }, // 设置请求的 header  
182 - // success: function(data) {}  
183 - // })  
184 -  
185 - wx.redirectTo({  
186 - url: "/packageA/pages/my_service/tment_details?number=" + number+"&userid="+th.data.options.userid,  
187 - });  
188 - 150 + getApp().my_warnning("预约成功", 1, th);
  151 +
  152 + if(res.data.data.length>1){
  153 + var number = res.data.data[0].Number;
  154 + wx.redirectTo({
  155 + url: "/packageA/pages/my_service/tment_order_list?number=" + number+"&userid="+th.data.options.userid,
  156 + });
  157 +
  158 + }else{
  159 + var number = res.data.data[0].Number;
  160 + wx.redirectTo({
  161 + url: "/packageA/pages/my_service/tment_details?number=" + number+"&userid="+th.data.options.userid,
  162 + });
  163 + }
  164 +
189 } else { 165 } else {
190 getApp().my_warnning(res.data.msg, 0, th); 166 getApp().my_warnning(res.data.msg, 0, th);
191 th.settime(); 167 th.settime();
192 } 168 }
193 } 169 }
194 }) 170 })
195 -  
196 }, 171 },
  172 +
  173 +
197 //定时显示texteat 174 //定时显示texteat
198 settime: function() { 175 settime: function() {
199 var th = this; 176 var th = this;
@@ -203,141 +180,59 @@ Page({ @@ -203,141 +180,59 @@ Page({
203 }) 180 })
204 }, 2000); 181 }, 2000);
205 }, 182 },
206 - //提交预约 183 +
  184 +
  185 + //-- 提交预约 --
207 sub_success: function(e) { 186 sub_success: function(e) {
208 var th = this; 187 var th = this;
209 - var temp_url = th.data.inurl + "/api/wx/weappSendlist/page"; 188 + //和推送消息有关系
  189 + var temp_url = th.data.inurl + "/api/wx/weappSendlist/page";
210 var template_id = ""; 190 var template_id = "";
211 - if (th.data.is_sub == 1) {  
212 - return false;  
213 - }  
214 - var store = th.data.store_name; //门店名称  
215 - var bea_name = th.data.beautician_name; //美容师名称  
216 - var time = th.data.time; //预约时间  
217 - var is_sub = th.data.is_sub; //是否重复提交  
218 - th.setData({  
219 - is_textea: 0,  
220 - is_sub: 1  
221 - }) 191 +
  192 + //门店名称
  193 + var store = th.data.store_name;
222 //提交预约前的判断 194 //提交预约前的判断
223 if (store == "") { 195 if (store == "") {
224 - getApp().my_warnning("请选择服务门店", 0, th);  
225 - th.setData({  
226 - is_sub: 0  
227 - })  
228 - th.settime();  
229 - return false;  
230 - } else if (bea_name == "") {  
231 - getApp().my_warnning("请选择美容师", 0, th);  
232 - th.setData({  
233 - is_sub: 0  
234 - })  
235 - th.settime();  
236 - return false;  
237 - } else if (time == undefined || time == '') {  
238 - getApp().my_warnning("请选择预约时间", 0, th);  
239 - th.setData({  
240 - is_sub: 0  
241 - })  
242 - th.settime();  
243 - return false;  
244 - } else {  
245 - var version ="";  
246 - //判断微信版本是否达到预约成功订阅的要求  
247 - wx.getSystemInfo({  
248 - success(res) {  
249 - version = res.version;  
250 - }  
251 - })  
252 - wx.showLoading({  
253 - title: '加载中',  
254 - })  
255 -  
256 - th.success();  
257 - // if (th.ver(version, '7.0.4') >= 0) {  
258 - // //获取模版id  
259 - // getApp().request.promiseGet(temp_url, {  
260 - // data: {  
261 - // store_id: a.stoid,  
262 - // typeid: "1011"  
263 - // }  
264 - // }).then(res => {  
265 - // if (res.data.code == 0 && res.data.data.pageData.length > 0) {  
266 - // template_id = res.data.data.pageData[0].template_id;  
267 - // // //授权订阅  
268 - // wx.requestSubscribeMessage({  
269 - // tmplIds: [template_id],  
270 - // success(res) {  
271 - // th.success();  
272 - // },  
273 - // fail(res) {  
274 - // th.success();  
275 - // }  
276 - // })  
277 - // } else {  
278 - // th.success();  
279 - // }  
280 - // })  
281 - // } else {  
282 - // // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示  
283 - // wx.showModal({  
284 - // title: '提示',  
285 - // content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'  
286 - // })  
287 - // th.setData({  
288 - // is_sub: 0  
289 - // })  
290 - // }  
291 -  
292 - }  
293 - },  
294 - //版本判断  
295 - ver:function(v1,v2){  
296 - v1 = v1.split('.')  
297 - v2 = v2.split('.')  
298 - var num1 = "" ;  
299 - var num2 = "";  
300 - var len = Math.max(v1.length, v2.length)  
301 -  
302 - while (v1.length < len) {  
303 - v1.push('0')  
304 - }  
305 - while (v2.length < len) {  
306 - v2.push('0')  
307 - }  
308 -  
309 - for (let i = 0; i < len; i++) {  
310 - num1 = parseInt(v1[i])  
311 - num2 = parseInt(v2[i])  
312 -  
313 - if (num1 > num2) {  
314 - return 1  
315 - } else if (num1 < num2) {  
316 - return -1  
317 - }  
318 - }  
319 - return 0  
320 - },  
321 - goto: function(e) {  
322 - var th = this;  
323 - th.setData({  
324 - beautician: 0,  
325 - is_textea: 0  
326 - })  
327 - if (th.data.store_name == "") {  
328 - getApp().my_warnning("请选择服务门店", 0, th);  
329 - th.settime();  
330 - } else if (th.data.beautician_name == "") {  
331 - getApp().my_warnning("请选择美容师", 0, th);  
332 - th.settime();  
333 - } else {  
334 - th.setData({  
335 - is_textea: 1  
336 - })  
337 - var url = e.currentTarget.dataset.url;  
338 - getApp().goto(url);  
339 - } 196 + getApp().my_warnning("请选择服务门店", 0, th);
  197 + return false;
  198 + }
  199 +
  200 + if(Object.keys(th.data.v).length === 0){
  201 + getApp().my_warnning("请选择美导和预约时间", 0, th);
  202 + return false;
  203 + }
  204 +
  205 + if(th.data.is_sub) return false;
  206 + th.setData({ is_sub: 1});
  207 +
  208 +
  209 + //获取模版id
  210 + getApp().request.get(temp_url, {
  211 + data: {
  212 + store_id: a.stoid,
  213 + typeid: "1011"
  214 + },
  215 + success:function(res){
  216 + if (res.data.code == 0 && res.data.data.pageData.length > 0) {
  217 + template_id = res.data.data.pageData[0].template_id;
  218 + // //授权订阅
  219 + wx.requestSubscribeMessage({
  220 + tmplIds: [template_id],
  221 + success(res) {
  222 + th.success();
  223 + },
  224 + fail(res) {
  225 + th.success();
  226 + }
  227 + })
  228 + } else {
  229 + th.success();
  230 + }
  231 + }
  232 + })
  233 +
340 }, 234 },
  235 +
341 //点击选择门店 236 //点击选择门店
342 choose_for_store: function(e) { 237 choose_for_store: function(e) {
343 var th = this; 238 var th = this;
@@ -355,6 +250,7 @@ Page({ @@ -355,6 +250,7 @@ Page({
355 }) 250 })
356 } 251 }
357 }, 252 },
  253 +
358 //确认选择门店 254 //确认选择门店
359 choice_store: function() { 255 choice_store: function() {
360 var th = this; 256 var th = this;
@@ -367,8 +263,49 @@ Page({ @@ -367,8 +263,49 @@ Page({
367 storageId: Id, 263 storageId: Id,
368 is_textea: 1 264 is_textea: 1
369 }) 265 })
  266 +
  267 + th.get_project_guide();
  268 +
  269 + },
  270 +
  271 + //获取美导和项目
  272 + get_project_guide(){
  273 + var th=this,user=getApp().globalData.userInfo;
  274 + var req={
  275 + storeId:os.stoid,
  276 + userId:user.user_id,
  277 + StorageId:encodeURIComponent(this.data.storageId),
  278 + }
  279 + getApp().request.get("/api/weshop/marketing/reservation/sm/pageNew",{
  280 + data:req,
  281 + success:function(res){
  282 + if(ut.ajax_ok(res)){
  283 + th.setData({project:res.data.data.pageData})
  284 + }
  285 + }
  286 + })
  287 +
  288 + req.SeekTime=this.data.datet;
  289 + getApp().request.get("/api/weshop/marketing/reservation/listStaffAndTime",{
  290 + data:req,
  291 + success:function(res){
  292 + if(ut.ajax_ok2(res)){
  293 + th.setData({v:{},col_arr:[]})
  294 + //-- 有些时间是全部没有的 --
  295 + th.setTimeShow(res.data.data)
  296 + }
  297 + }
  298 + })
  299 +
  300 + //获取第一个元素的位置
  301 + setTimeout(function(){
  302 + th.queryMultipleNodes();
  303 + },1000)
  304 +
370 }, 305 },
371 - onReachBottom: function() { 306 +
  307 +
  308 + onGetBottom: function() {
372 var th = this; 309 var th = this;
373 if (this.data.total <= th.data.pageSize) return; 310 if (this.data.total <= th.data.pageSize) return;
374 if (this.data.ismore) return; 311 if (this.data.ismore) return;
@@ -378,6 +315,7 @@ Page({ @@ -378,6 +315,7 @@ Page({
378 }) 315 })
379 th.query_store(); 316 th.query_store();
380 }, 317 },
  318 +
381 //分页查询门店信息 319 //分页查询门店信息
382 query_store: function() { 320 query_store: function() {
383 var th = this; 321 var th = this;
@@ -385,14 +323,13 @@ Page({ @@ -385,14 +323,13 @@ Page({
385 is_textea: 0 323 is_textea: 0
386 }) 324 })
387 var itemId = th.data.itemId; //服务id 325 var itemId = th.data.itemId; //服务id
388 - var url = "/api/weshop/marketing/reservation/storage/pagenew"; 326 + var url = "/api/weshop/marketing/reservation/storage/pageAll";
389 var key_word = th.data.key_word; 327 var key_word = th.data.key_word;
390 key_word = key_word.replace(/\s+/g, ""); 328 key_word = key_word.replace(/\s+/g, "");
391 getApp().request.promiseGet(url, { 329 getApp().request.promiseGet(url, {
392 data: { 330 data: {
393 - userId: th.data.options.userid, 331 + userId: getApp().globalData.user_id,
394 storeId: a.stoid, 332 storeId: a.stoid,
395 - serviceId: itemId,  
396 latitude: th.data.lat, 333 latitude: th.data.lat,
397 longitude: th.data.lon, 334 longitude: th.data.lon,
398 page: th.data.curpage, 335 page: th.data.curpage,
@@ -534,8 +471,9 @@ Page({ @@ -534,8 +471,9 @@ Page({
534 th.setData({ 471 th.setData({
535 is_textea: 1 472 is_textea: 1
536 }) 473 })
537 - console.log('optionsxxx===>', this.data.options);  
538 - // console.log('1-->', "/pages/user/my_service/cosmetology_list?userid=" + th.data.options.userid + 'storageId=' + storageId + '&' + 'itemId=' + itemId + '&' + "projectId=" + project_id); 474 +
  475 + console.log('optionsxxx===>', this.data.options);
  476 + // console.log('1-->', "/pages/user/my_service/cosmetology_list?userid=" + th.data.options.userid + 'storageId=' + storageId + '&' + 'itemId=' + itemId + '&' + "projectId=" + project_id);
539 wx.navigateTo({ 477 wx.navigateTo({
540 url: "/packageA/pages/my_service/cosmetology_list?userid=" + this.data.options.userid + '&storageId=' + storageId + '&itemId=' + itemId + "&projectId=" + project_id 478 url: "/packageA/pages/my_service/cosmetology_list?userid=" + this.data.options.userid + '&storageId=' + storageId + '&itemId=' + itemId + "&projectId=" + project_id
541 }); 479 });
@@ -546,15 +484,30 @@ Page({ @@ -546,15 +484,30 @@ Page({
546 * 生命周期函数--监听页面加载 484 * 生命周期函数--监听页面加载
547 */ 485 */
548 onLoad: function(options) { 486 onLoad: function(options) {
  487 +
  488 +
  489 + // 如果数值位数为1,则补0
  490 + function appendZero(obj) {
  491 + if (obj < 10) {
  492 + return "0" + "" + obj;
  493 + } else {
  494 + return obj;
  495 + }
  496 + };
549 497
550 this.getTimeList(23, 30); 498 this.getTimeList(23, 30);
551 var th = this; 499 var th = this;
  500 + var now_date = new Date();
  501 + var md = now_date.getFullYear()+"-"+appendZero(now_date.getMonth() + 1) + "-" + appendZero(now_date.getDate());
  502 +
552 th.setData({ 503 th.setData({
553 - options, 504 + options,
554 itemId: options.service_id, 505 itemId: options.service_id,
555 buyType: options.BuyType, 506 buyType: options.BuyType,
556 project_id: options.ProjectID, 507 project_id: options.ProjectID,
557 - validay: options.Validay 508 + validay: options.Validay,
  509 + datet:md,
  510 + nowDate:md
558 }); 511 });
559 wx.getLocation({ 512 wx.getLocation({
560 type: 'gcj02', 513 type: 'gcj02',
@@ -584,87 +537,30 @@ Page({ @@ -584,87 +537,30 @@ Page({
584 th.data.is_get_local_ok = 1; 537 th.data.is_get_local_ok = 1;
585 } 538 }
586 }); 539 });
587 -  
588 - // 获取当前默认导购信息及归属门店信息  
589 - if(options.firstleader) {  
590 - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+a.stoid+"/"+options.firstleader,{}).then(res=>{  
591 - if(res.data.code==0){  
592 - getApp().globalData.guide_id=res.data.data.id;  
593 -  
594 - getApp().request.promiseGet('/api/weshop/shoppingGuide/geIdStaffInfo', {  
595 - data: {  
596 - store_id: a.stoid,  
597 - guide_id: e.globalData.guide_id,  
598 - UserCode: th.data.options.usercode,  
599 - }  
600 - }).then(res => {  
601 - console.log('res==>', a.stoid, e.globalData.guide_id, th.data.options.usercode);  
602 - if(res.data.data.Tech) {  
603 -  
604 - var data={  
605 - store_name: res.data.data.StorageName,  
606 - beautician_name: res.data.data.StaffName,  
607 - beauticianID: res.data.data.StaffId,  
608 - StorageId: res.data.data.StorageId,  
609 - }  
610 - th.check_firleader(data);  
611 - }  
612 - });  
613 -  
614 -  
615 - };  
616 - });  
617 - };  
618 -  
619 - 540 +
  541 + //--先判断会员状态--
  542 + var user_info = getApp().globalData.userInfo;
  543 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  544 + wx.navigateTo({
  545 + url: '/pages/togoin/togoin',
  546 + })
  547 + return false;
  548 + }
620 }, 549 },
621 - //查询剩下可预约人数  
622 - query_more: function() {  
623 - var th = this;  
624 - var url = "/api/weshop/marketing/reservation/can/reservation/countnew";  
625 - var beauticianID = th.data.beauticianID; //美容师id  
626 - var projectID = th.data.itemId; //服务id  
627 - var seekTime = th.data.time; //预约日期  
628 - var storageId = th.data.storageId; //门店id  
629 - var storeId = a.stoid; //商家id  
630 - getApp().request.promiseGet(url, {  
631 - data: {  
632 - beauticianId: beauticianID,  
633 - seekTime: seekTime,  
634 - serviceId: projectID,  
635 - storageId: storageId,  
636 - storeId: storeId  
637 - }  
638 - }).then(res => {  
639 - if (res.data.code == 0) {  
640 - var tment_count = res.data.data.CanReservation;  
641 - th.setData({  
642 - tment_count: tment_count  
643 - })  
644 - } else {  
645 - getApp().my_warnning(res.data.msg, 0, th);  
646 - th.settime();  
647 - }  
648 - }) 550 +
649 551
650 - },  
651 /** 552 /**
652 * 生命周期函数--监听页面显示 553 * 生命周期函数--监听页面显示
653 */ 554 */
654 onShow: function() { 555 onShow: function() {
655 var th = this; 556 var th = this;
656 - var seekTime = th.data.time; //预约日期  
657 - if (seekTime != "") {  
658 - th.query_more();  
659 - }  
660 th.setData({ 557 th.setData({
661 - time: th.data.time.substring(0, 16),  
662 is_textea: 1 558 is_textea: 1
663 }) 559 })
664 - th.query_project();  
665 -  
666 - th.queryMultipleNodes(); 560 +
667 }, 561 },
  562 +
  563 +
668 //获取单个服务项目信息 564 //获取单个服务项目信息
669 query_project: function() { 565 query_project: function() {
670 var th = this; 566 var th = this;
@@ -687,81 +583,17 @@ Page({ @@ -687,81 +583,17 @@ Page({
687 } 583 }
688 }) 584 })
689 }, 585 },
690 - //关闭导航  
691 - // close: function() {  
692 - // var th = this;  
693 - // var nav_b = th.selectComponent("#nav_b"); //组件的id  
694 - // nav_b.close_box();  
695 - // }  
696 -  
697 - //判断分享的导购是不是有门店,是不是该门店下又该会员  
698 - check_firleader(data){  
699 - var th=this;  
700 - var itemId = this.data.itemId; //服务id  
701 - var url = "/api/weshop/marketing/reservation/storage/pagenew";  
702 - var key_word = data.store_name;  
703 - key_word = key_word.replace(/\s+/g, "");  
704 - getApp().request.promiseGet(url, {  
705 - data: {  
706 - userId: th.data.options.userid,  
707 - storeId: os.stoid,  
708 - serviceId: itemId,  
709 - latitude: th.data.lat,  
710 - longitude: th.data.lon,  
711 - page: 1,  
712 - pageSize: 1000,  
713 - keyWord: key_word  
714 - }  
715 - }).then(res => {  
716 - //-- 如果是门店的话 --  
717 - if (res.data.code == 0 && res.data.data && res.data.data.pageData) {  
718 - var store_data=null;  
719 - for(var i in res.data.data.pageData){  
720 - var it=res.data.data.pageData[i];  
721 - if(it.Id==data.StorageId){  
722 - store_data={  
723 - store_name: data.store_name,  
724 - StorageId: data.StorageId,  
725 - };  
726 - break;  
727 - }  
728 - }  
729 - if(!store_data) return false;  
730 - th.setData(store_data)  
731 -  
732 - }else{  
733 - return false;  
734 - }  
735 -  
736 - //导购接口地址  
737 - var url = "/api/weshop/marketing/reservation/staff/pagenew";  
738 - return getApp().request.promiseGet(url, {  
739 - isShowLoading:1,  
740 - data: {  
741 - storeId: os.stoid,  
742 - userId: th.data.options.userid,  
743 - serviceId: itemId,  
744 - storageId: data.StorageId  
745 - }  
746 - })  
747 - }).then(res=>{  
748 - if (res && res.data && res.data.code == 0) {  
749 - var beautician_list=res.data.data;  
750 - for(var i in beautician_list){  
751 - var item=beautician_list[i];  
752 - if(item.staffid==data.beauticianID){  
753 - th.setData({  
754 - beautician_name:data.beautician_name,  
755 - beauticianID:data.beauticianID,  
756 - })  
757 - break;  
758 - }  
759 - }  
760 -  
761 - }  
762 - })  
763 - },  
764 - 586 +
  587 +
  588 +
  589 + //开始拖拽项目列表
  590 + touchmove1: function (e) {
  591 + var that = this;
  592 + var position = [e.touches[0].pageX-15, e.touches[0].pageY-that.data.s_top];
  593 + that.setData({
  594 + wp: position
  595 + });
  596 + },
765 597
766 //开始拖拽 598 //开始拖拽
767 touchmove: function (e) { 599 touchmove: function (e) {
@@ -772,37 +604,41 @@ Page({ @@ -772,37 +604,41 @@ Page({
772 write: position 604 write: position
773 }); 605 });
774 }, 606 },
775 - touchend:function(e){ 607 +
  608 + touchend:function(e){
776 var that = this,th=that; 609 var that = this,th=that;
777 if(!that.data.copy_btn) return false; 610 if(!that.data.copy_btn) return false;
778 var position =th.data.write; 611 var position =th.data.write;
779 var arr=th.data.col_arr; 612 var arr=th.data.col_arr;
780 for(var i=0;i<this.data.md.length;i++){//i是列 613 for(var i=0;i<this.data.md.length;i++){//i是列
781 var item=this.data.md[i]; 614 var item=this.data.md[i];
782 - var nd=new Date();  
783 - var d_str=nd.getFullYear()+"-"+(nd.getMonth()+1)+"-"+nd.getDate()+" ";  
784 - var d_arr=item.time.split("-");  
785 - var t1=new Date(d_str+d_arr[0])  
786 - var t2=d_arr.length>1?new Date(d_str+d_arr[1]):0;  
787 - 615 +
788 for(var j=0; j<this.data.timeArr.length;j++){//j是行 616 for(var j=0; j<this.data.timeArr.length;j++){//j是行
789 if(arr.indexOf(j)!=-1) continue; 617 if(arr.indexOf(j)!=-1) continue;
790 - var tn=new Date(d_str+this.data.timeArr[j]);  
791 - //小于开始时间  
792 - if(tn<t1) continue;  
793 - //大于结束时间  
794 - if(tn>t2 && t2>0) continue; 618 + var tn=this.data.timeArr[j];
  619 +
795 //如果坐标在网格内 620 //如果坐标在网格内
796 if( position[0]>th.data.f_x+i*th.data.f_width && position[0]<th.data.f_x+ (i+1)*th.data.f_width && 621 if( position[0]>th.data.f_x+i*th.data.f_width && position[0]<th.data.f_x+ (i+1)*th.data.f_width &&
797 position[1]>th.data.f_y +j*th.data.f_hei && position[1]<th.data.f_y+(j+1)*th.data.f_hei){ 622 position[1]>th.data.f_y +j*th.data.f_hei && position[1]<th.data.f_y+(j+1)*th.data.f_hei){
798 -  
799 - var txt="v["+i+"]["+j+"]";  
800 - arr.push(j);  
801 - th.setData({  
802 - [txt]: th.data.projectName,  
803 - col_arr:arr  
804 - });  
805 - break; 623 +
  624 + for(var i in item.listtime){
  625 +
  626 + //判断一下有没有在时间内,可以不可以预约
  627 + if(tn==item.listtime[i].stime && item.listtime[i].iskyy){
  628 + th.checK_is_can_yy(item,tn,function(){
  629 + var txt="v["+i+"]["+j+"]";
  630 + arr.push(j);
  631 + th.setData({
  632 + [txt]: th.data.sele_project,
  633 + col_arr:arr
  634 + });
  635 +
  636 + })
  637 + return true
  638 + }
  639 + }
  640 +
  641 +
806 } 642 }
807 643
808 } 644 }
@@ -810,21 +646,175 @@ Page({ @@ -810,21 +646,175 @@ Page({
810 th.setData({copy_btn:0}) 646 th.setData({copy_btn:0})
811 }, 647 },
812 648
  649 + //-- 点击空格选择 --
  650 + sele_tab:function(e){
  651 + if(!this.data.sele_project){
  652 + wx.showToast({
  653 + title: "请选择要预约的项目",
  654 + icon: 'none',
  655 + duration: 2000
  656 + })
  657 + return false;
  658 + }
  659 +
  660 + var th=this;
  661 + var arr=this.data.col_arr;
  662 + var i=e.currentTarget.dataset.index;
  663 + var j=e.currentTarget.dataset.subindex;
  664 +
  665 + var item=this.data.md[i]; //获得美导
  666 + var tn=this.data.timeArr[j]; //获得时间
  667 +
  668 + //查看时间段能不能预约
  669 + if(!item.listtime[j].iskyy){
  670 + wx.showToast({
  671 + title: "该时间不可以预约",
  672 + icon: 'none',
  673 + duration: 2000
  674 + })
  675 + return false;
  676 + }
  677 + //查看时间有没有被预约了
  678 + if(this.data.v && this.data.v[i] && this.data.v[i][j]){
  679 + wx.showToast({
  680 + title: "该时间已被预约",
  681 + icon: 'none',
  682 + duration: 2000
  683 + })
  684 + return false;
  685 + }
  686 +
  687 + if(!item.listtime[j].itemids){
  688 + wx.showToast({
  689 + title: "该时间不可预约该项目",
  690 + icon: 'none',
  691 + duration: 1500
  692 + })
  693 + return false;
  694 + }
  695 +
  696 + var project_arr=item.listtime[j].itemids.split(',');
  697 +
  698 + if(project_arr.indexOf(this.data.sele_project.ServiceID)==-1){
  699 + wx.showToast({
  700 + title: "该时间不可预约该项目",
  701 + icon: 'none',
  702 + duration: 1500
  703 + })
  704 + return false;
  705 + }
  706 +
  707 +
  708 +
  709 +
  710 + //同一美导同一项目,不能选择两次,只能留一个
  711 + if(this.data.v[i]){
  712 + for(var sj in this.data.v[i]){
  713 + if(this.data.v[i][sj] && this.data.v[i][sj].ProjectID==this.data.sele_project.ProjectID){
  714 + wx.showModal({
  715 + title: "您已经预约了同一个项目和导购,要修改吗?",
  716 + success: function (res) {
  717 + if (res.cancel) {
  718 + //点击取消,默认隐藏弹框
  719 + } else {
  720 + th.checK_is_can_yy(item,tn,function(){
  721 + delete th.data.v[i][sj];
  722 + th.data.v[i][j]=th.data.sele_project;
  723 + var ind=arr.indexOf(sj);
  724 + arr.splice(ind, 1),
  725 + arr.push(j),
  726 + th.setData({
  727 + v: th.data.v,
  728 + col_arr:arr
  729 + });
  730 + })
  731 +
  732 + }
  733 + },
  734 +
  735 + });
  736 + return false;
  737 + }
  738 + }
  739 + }
  740 +
  741 + th.checK_is_can_yy(item,tn,function(){
  742 +
  743 + var txt="v["+i+"]["+j+"]";
  744 + arr.push(j);
  745 + th.setData({
  746 + [txt]: th.data.sele_project,
  747 + col_arr:arr
  748 + });
  749 + });
  750 + },
813 751
  752 + //删除响应的预约
814 close_this:function (e){ 753 close_this:function (e){
815 var txt=e.currentTarget.dataset.txt; 754 var txt=e.currentTarget.dataset.txt;
816 var sindex=parseInt(e.currentTarget.dataset.sindex); 755 var sindex=parseInt(e.currentTarget.dataset.sindex);
817 - var arr=this.data.col_arr;  
818 - var ind=arr.indexOf(sindex); 756 + var arr=this.data.col_arr;
  757 + var ind=arr.indexOf(sindex);
819 arr.splice(ind,1) 758 arr.splice(ind,1)
820 this.setData({[txt]:null,col_arr:arr}) 759 this.setData({[txt]:null,col_arr:arr})
821 }, 760 },
822 761
823 - onPageScroll(e) {  
824 - // console.log('滚动距离', e);  
825 - this.data.scrolltop = e.scrollTop;  
826 - },  
827 - 762 + //计算滚蛋的距离
  763 + onPageScroll(e) { this.data.scrolltop = e.scrollTop;},
  764 +
  765 + //确认有没有预约
  766 + checK_is_can_yy(item,tn,back){
  767 + var th=this;
  768 + var req={
  769 + beauticianId:encodeURIComponent(item.staffid),
  770 + seekTime:this.data.datet+" "+tn+":00",
  771 + serviceId:encodeURIComponent(this.data.sele_project.ServiceID),
  772 + storageId:encodeURIComponent(this.data.storageId),
  773 + storeId:os.stoid
  774 + }
  775 + getApp().request.get("/api/weshop/marketing/reservation/can/reservation/countnew",{
  776 + data:req,
  777 + success:function(res){
  778 + th.setData({copy_btn:0});
  779 + if(res.data.code==0){
  780 + if(!th.data.v){ back(); return false; }
  781 +
  782 + var arr = Object.keys(th.data.v);
  783 + if(arr.length==0){ back(); return false; }
  784 +
  785 + var num=0;
  786 + for(var i in th.data.v){
  787 + if(!th.data.v[i]) continue;
  788 + for(var j in th.data.v[i]){
  789 + if(th.data.v[i][j] && th.data.v[i][j].ProjectID==th.data.sele_project.ProjectID){
  790 + num++;
  791 + }
  792 + }
  793 + }
  794 +
  795 + if(!num){ back(); return false; }
  796 +
  797 + //如果已经超出次数的时候,就不能预约了
  798 + if(num>=parseInt(res.data.data.CanReservation) ){
  799 + wx.showToast({
  800 + title: "已经超出可预约次数",
  801 + icon: 'none',
  802 + duration: 2000
  803 + })
  804 + return false;
  805 + }
  806 + back();
  807 +
  808 + }else{
  809 + wx.showToast({
  810 + title: res.data.msg,
  811 + icon: 'none',
  812 + duration: 2000
  813 + })
  814 + }
  815 + }
  816 + })
  817 + },
828 818
829 //声明节点查询的方法 819 //声明节点查询的方法
830 queryMultipleNodes: function() { 820 queryMultipleNodes: function() {
@@ -838,11 +828,16 @@ Page({ @@ -838,11 +828,16 @@ Page({
838 th.data.f_y=res[0].top; 828 th.data.f_y=res[0].top;
839 th.data.f_hei=res[0].height; 829 th.data.f_hei=res[0].height;
840 th.data.f_width=res[0].width; 830 th.data.f_width=res[0].width;
841 -  
842 }) 831 })
  832 +
843 }, 833 },
844 834
  835 + /*--
845 getcopy(e) { 836 getcopy(e) {
  837 +
  838 + },--*/
  839 + //项目元素点击后的效果
  840 + getName(e) {
846 var that=this; 841 var that=this;
847 console.log('e', e); 842 console.log('e', e);
848 var x=e.currentTarget.dataset.offsetLeft; 843 var x=e.currentTarget.dataset.offsetLeft;
@@ -850,52 +845,73 @@ Page({ @@ -850,52 +845,73 @@ Page({
850 var position = [x, y]; 845 var position = [x, y];
851 that.setData({ 846 that.setData({
852 write: position,copy_btn:1 847 write: position,copy_btn:1
853 - });  
854 -  
855 - },  
856 -  
857 - getName(e) {  
858 - // console.log('e1', e);  
859 - let name = e.currentTarget.dataset.name; 848 + });
  849 + // console.log('e1', e);
  850 + let index = e.currentTarget.dataset.index;
  851 + let name = this.data.project[index];
  852 +
  853 +
860 this.setData({ 854 this.setData({
861 - projectName: name, 855 + sele_project: name,prj_index:index
862 }); 856 });
863 }, 857 },
  858 +
  859 + //-- 项目列表长按 --
  860 + setmove1(){
  861 + this.setData({move1:1});
  862 + },
864 863
865 -  
866 - // 生成时间段  
867 - getTimeList(hours,step) {  
868 - var minutes=60; 864 + //-- 生成时间段 --
  865 + getTimeList(hours,step) {
  866 + var minutes=60;
869 var timeArr = []; 867 var timeArr = [];
870 hours = hours; 868 hours = hours;
871 step = step; 869 step = step;
  870 +
  871 + // 如果数值位数为1,则补0
  872 + function appendZero(obj) {
  873 + if (obj < 10) {
  874 + return "0" + "" + obj;
  875 + } else {
  876 + return obj;
  877 + }
  878 + };
  879 +
  880 + var now_date=new Date();
  881 + var md = now_date.getFullYear()+"-"+appendZero(now_date.getMonth() + 1) + "-" + appendZero(now_date.getDate());
872 882
873 - for(var i = 8; i < hours; i++){  
874 - var str = '';  
875 - if(i < 10) {  
876 - str = 0 + '' + i;  
877 - } else {  
878 - str = '' + i;  
879 - };  
880 -  
881 - for(var j = 0; j < minutes; j++) {  
882 - if(j % step == 0){  
883 - var s = j < 10 ? ':' + 0 + '' + j : ':' + j;  
884 - s = str + s;  
885 - timeArr.push(s);  
886 - };  
887 - };  
888 - };  
889 -  
890 - // console.log('timeArr', timeArr);  
891 - this.setData({  
892 - timeArr,  
893 - }); 883 + for(var i = 8; i < hours; i++){
  884 + var str = '';
  885 + if(i < 10) {
  886 + str = 0 + '' + i;
  887 + } else {
  888 + str = '' + i;
  889 + };
  890 +
  891 + for(var j = 0; j < minutes; j++) {
  892 + if(j % step == 0){
  893 + var s = ':' + appendZero(j);
  894 + s = str + s;
  895 + //-- 不是当天 --
  896 + if(this.data.datet && this.data.datet!=md){
  897 + timeArr.push(s);
  898 + }else{
  899 + var d1=md+" "+s;
  900 + var date1=new Date(d1);
  901 + //必须是大于
  902 + if(date1.getTime()>now_date.getTime()){
  903 + timeArr.push(s);
  904 + }
  905 + }
  906 +
  907 + };
  908 + };
  909 + };
  910 +
  911 + this.setData({timeArr,});
894 912
895 }, 913 },
896 -  
897 -  
898 - 914 +
899 scroll(e) { 915 scroll(e) {
900 // console.log('e', e.detail.deltaX); 916 // console.log('e', e.detail.deltaX);
901 let deltaX = e.detail.deltaX; 917 let deltaX = e.detail.deltaX;
@@ -904,8 +920,100 @@ Page({ @@ -904,8 +920,100 @@ Page({
904 // }; 920 // };
905 this.data.deltaX = -deltaX; 921 this.data.deltaX = -deltaX;
906 }, 922 },
907 - 923 +
  924 + pickerTap:function() {
  925 + var date = new Date();
  926 + var monthDay = ['今天','明天'];
  927 + // 月-日
  928 + for (var i = 2; i <= 14; i++) {
  929 + var date1 = new Date(date);
  930 + date1.setDate(date.getDate() + i);
  931 + var md = (date1.getFullYear()+"-"+date1.getMonth() + 1) + "-" + date1.getDate();
  932 + monthDay.push(md);
  933 + }
  934 + this.setData(monthDay);
  935 + },
  936 +
  937 +
  938 + //-- 选择时间的时候 --
  939 + bindDateChenge: function(e) {
  940 + var th=this;
  941 + var nd=new Date(this.data.nowDate);
  942 + var nd1=new Date(e.detail.value);
  943 + if(nd1.getTime()<nd.getTime()){
  944 + wx.showToast({
  945 + title: "选择的日期不能小于今天",
  946 + icon: 'none',
  947 + duration: 2000
  948 + })
  949 + return false;
  950 + }
  951 +
  952 + this.setData({
  953 + datet: e.detail.value
  954 + });
  955 + this.getTimeList(23, 30);
  956 + //当时间变化的时候
  957 + if(this.data.storageId){
  958 + var req={
  959 + storeId:os.stoid,
  960 + userId:getApp().globalData.userInfo.user_id,
  961 + StorageId:encodeURIComponent(this.data.storageId),
  962 + }
  963 + req.SeekTime=this.data.datet;
  964 + getApp().request.get("/api/weshop/marketing/reservation/listStaffAndTime",{
  965 + data:req,
  966 + success:function(res){
  967 + if(ut.ajax_ok2(res)){
  968 + th.setData({v:{},col_arr:[]})
  969 + //-- 有些时间是全部没有的 --
  970 + th.setTimeShow(res.data.data)
  971 + }
  972 + }
  973 + })
  974 + }
  975 + },
908 976
909 -  
910 - 977 + onPageScroll: function(e) {
  978 + this.data.s_top=e.scrollTop;
  979 + },
  980 +
  981 + //-- 时间段有些不显示,出来的时间和显示的对应 --
  982 + setTimeShow:function(data){
  983 + // 如果数值位数为1,则补0
  984 + function appendZero(obj) {
  985 + if (obj < 10) {
  986 + return "0" + "" + obj;
  987 + } else {
  988 + return obj;
  989 + }
  990 + };
  991 +
  992 + var now_date=new Date();
  993 + var md = now_date.getFullYear()+"-"+appendZero(now_date.getMonth() + 1)+ "-" + appendZero(now_date.getDate());
  994 +
  995 + if(this.data.datet && this.data.datet!=md){
  996 + this.setData({md:data});
  997 + return false;
  998 + }
  999 +
  1000 + for(var i in data){
  1001 + var ti_time_arr=data[i].listtime;
  1002 + var arr=[];
  1003 + for(var j in ti_time_arr){
  1004 + var d1=md+" "+ti_time_arr[j].stime;
  1005 + var date1=new Date(d1);
  1006 + //必须是大于
  1007 + if(date1.getTime()>now_date.getTime()){
  1008 + arr.push(ti_time_arr[j]);
  1009 + }
  1010 + }
  1011 + data[i].listtime=arr;
  1012 + }
  1013 + this.setData({md:data});
  1014 +
  1015 + },
  1016 +
  1017 +
  1018 +
911 }) 1019 })
912 \ No newline at end of file 1020 \ No newline at end of file
packageA/pages/my_service2/appment_main.wxml
1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs> 1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs>
2 <wxs module="fil" src="g_filter.wxs"></wxs> 2 <wxs module="fil" src="g_filter.wxs"></wxs>
3 3
4 -<!-- <view class="btn-container">  
5 - <navigator class="btn" url="/pages/user/my_service/tment_order_list">  
6 - <view>我的预约</view>  
7 - </navigator>  
8 - <form report-submit='true' bindtap="sub_success">  
9 - <button form-type="submit" class="btn">  
10 - <view>提交预约</view>  
11 - </button>  
12 - </form>  
13 - </view> -->  
14 -  
15 -<view class="card" bindlongtap="getcopy">  
16 - <view class="t-c c-c7">  
17 - <text class="iconfont icon-sandian"></text> 4 +
  5 +<!-- 项目的拖动 -->
  6 +<view wx:if="{{!store && project}}" class="card" catchtouchmove='true' style="left:{{wp[0]}}px;top:{{wp[1]}}px;">
  7 + <view class="cp_btn t-c c-c7" bindtouchend="touchend1" bindtouchmove="touchmove1" catch:touchmove1 style="padding: 15rpx 0;" >
  8 + <text class="iconfont icon-sandian" style="font-size: 40rpx;"></text>
18 </view> 9 </view>
19 - <block wx:for="{{project}}">  
20 - <view class="t-c pd20" hover-class="hover" bindtouchmove="touchmove" bindtouchend="touchend" catch:touchmove data-name="{{item}}" bindlongtap="getName">  
21 - <text class="iconfont icon-meirong fs40"></text>  
22 - <view class="fs24">{{item}}</view>  
23 - </view> 10 + <view style="overflow-y: auto; max-height:600rpx;">
  11 + <block wx:for="{{project}}">
  12 + <view class="t-c pd20 {{prj_index==index?'hover':''}}" data-index="{{index}}" catchtap="getName">
  13 + <text class="iconfont icon-meirong fs40"></text>
  14 + <view class="fs24">{{item.ServiceName}}</view>
  15 + </view>
  16 +
24 </block> 17 </block>
  18 + </view>
25 </view> 19 </view>
26 20
27 <image class="main" src="{{iurl}}/miniapp/images/yyservice/main.png"></image> 21 <image class="main" src="{{iurl}}/miniapp/images/yyservice/main.png"></image>
28 -  
29 <view class="pdb100"> 22 <view class="pdb100">
30 - <!-- 选择门店 --> 23 +
  24 + <!-- 选择日期 -->
  25 + <picker class='pi' mode="date" value='{{datet}}' start="2019-1-1" bindchange='bindDateChenge'>
  26 + <view class="flex-vertical pdv20 jc-center">
  27 + <!-- 门店 -->
  28 + <view class="flex-vertical-between head fs30">
  29 + <view>日</view>
  30 + <view>期</view>
  31 + </view>
  32 +
  33 + <view class="flex-vertical-between fs26 select">
  34 + <view class="{{datet==''?'color':''}} value ellipsis-1">{{datet==""?'选择日期':datet}}</view>
  35 + <view class="angle">∟</view>
  36 + </view>
  37 +
  38 + </view>
  39 + </picker>
  40 + <!-- 选择门店 -->
31 <view class="flex-vertical pdv20 jc-center"> 41 <view class="flex-vertical pdv20 jc-center">
32 <!-- 门店 --> 42 <!-- 门店 -->
33 <view class="flex-vertical-between head fs30"> 43 <view class="flex-vertical-between head fs30">
@@ -40,8 +50,11 @@ @@ -40,8 +50,11 @@
40 <view class="{{store_name==''?'color':''}} value ellipsis-1">{{store_name==""?'选择服务门店':store_name}}</view> 50 <view class="{{store_name==''?'color':''}} value ellipsis-1">{{store_name==""?'选择服务门店':store_name}}</view>
41 <view class="angle">∟</view> 51 <view class="angle">∟</view>
42 </view> 52 </view>
43 - </view>  
44 - <view class="table flex fs26" style="width: 100%;height: 100%;"> 53 + </view>
  54 +
  55 +
  56 + <!-- 拖入的田框,主内容 -->
  57 + <view wx:if="{{md}}" class="table flex fs26" style="width: 100%;height: auto; overflow: hidden; margin-bottom: 10rpx;">
45 <view class="left t-c"> 58 <view class="left t-c">
46 <view class="td pr" style="width: 120rpx"> 59 <view class="td pr" style="width: 120rpx">
47 <view class="time-box" bindtap="pickTime"><view class="time">时间</view></view> 60 <view class="time-box" bindtap="pickTime"><view class="time">时间</view></view>
@@ -56,89 +69,21 @@ @@ -56,89 +69,21 @@
56 <view class="td" wx:for="{{timeArr.length}}"></view> 69 <view class="td" wx:for="{{timeArr.length}}"></view>
57 </view> --> 70 </view> -->
58 <view wx:for="{{md}}"> 71 <view wx:for="{{md}}">
59 - <view class="td bg-pink">{{item.name}}</view> 72 + <view class="td bg-pink">{{item.StaffName}}</view>
60 <!-- <view class="td content_view {{v[0][0]?'121':''}}">{{v[0][0]}}</view> --> 73 <!-- <view class="td content_view {{v[0][0]?'121':''}}">{{v[0][0]}}</view> -->
61 <block wx:for="{{timeArr.length}}" wx:for-item="subitem" wx:for-index="subindex"> 74 <block wx:for="{{timeArr.length}}" wx:for-item="subitem" wx:for-index="subindex">
62 - <view class="td content_view {{v[index][subindex] && v[index][subindex]? 'active':''}} {{filters.in_arr(subindex,col_arr) || fil.is_no_time(item,subindex,timeArr) ?'notactive':''}}">  
63 - {{v[index][subindex]?v[index][subindex]:''}}  
64 - <text wx:if="{{v[index][subindex]}}" catchtap="close_this" data-txt="v[{{index}}][{{subindex}}]" data-sindex="{{subindex}}" class="close_this">×</text> 75 + <view bindtap="sele_tab" data-index="{{index}}" data-subindex="{{subindex}}"
  76 + class="td content_view {{v[index][subindex] && v[index][subindex]? 'active':''}} {{fil.is_no_time(item,subindex,timeArr,sele_project) ?'notactive':''}}">
  77 + <!-- 当项目是当前选中的项目的时候 -->
  78 + <block wx:if="{{v[index][subindex] && v[index][subindex].ProjectID==sele_project.ProjectID}}">
  79 + <text>{{v[index][subindex]?v[index][subindex].ServiceName:''}}</text>
  80 + <text catchtap="close_this" data-txt="v[{{index}}][{{subindex}}]" data-sindex="{{subindex}}" class="close_this">×</text>
  81 + </block>
65 </view> 82 </view>
66 </block> 83 </block>
67 </view> 84 </view>
68 </view> 85 </view>
69 - </scroll-view>  
70 -  
71 -  
72 -  
73 -  
74 -  
75 - <!-- 选择美容师 -->  
76 - <!-- <view class="flex-vertical mabot"> -->  
77 - <!-- 门店 -->  
78 - <!-- <view class="flex-vertical-between head fs30">  
79 - <view>美</view>  
80 - <view>容</view>  
81 - <view>师</view>  
82 - </view> -->  
83 -  
84 - <!-- 选择美容师 -->  
85 - <!-- <view class="rel fs26"> -->  
86 - <!-- <view class="flex-vertical-between Cosmetology" bindtap="query_beautician">  
87 - <view class="{{beautician_name==''?'color':''}} value ellipsis-1">{{beautician_name==''?'选择美容师':beautician_name}}</view>  
88 - <view class="angle">∟</view>  
89 - </view> -->  
90 - <!-- 美容师下拉列表 -->  
91 - <!-- <view class="beauticians abs" wx:if="{{beautician}}"> -->  
92 - <!-- 到时候要做判断如果是index==循环的最后一个则把下边线去掉:(beaclone去掉的css) -->  
93 - <!-- <view class="beautician flex-vertical fs26" wx:for="{{beautician_list}}" bindtap="choice_beautician" data-baaindex="{{key}}" wx:for-index="key">  
94 - <view class="StaffName ellipsis-1">{{item.StaffName}}</view>  
95 - </view>  
96 - <view>  
97 - </view>  
98 - </view> -->  
99 - <!-- </view> -->  
100 - <!-- <view class="flex-center users" bindtap="nav_bea">  
101 - <image class="user" src="{{iurl}}/miniapp/images/yyservice/user.png"></image>  
102 - </view> -->  
103 - <!-- </view> -->  
104 -  
105 - <!-- 选择时间 -->  
106 - <!-- <view class="flex-vertical mabot"> -->  
107 - <!-- 门店 -->  
108 - <!-- <view class="head fs30">  
109 - <view>预约时间</view>  
110 - </view> -->  
111 -  
112 - <!-- 选择时间 -->  
113 - <!-- <view class="flex-vertical-between fs26 select" data-url="/packageA/pages/my_service/beauty_deta?url={{url}}&StorageId={{StorageId}}&BeauticianID={{beauticianID}}&itemId={{itemId}}&modify=0&projectId={{project_id}}" bindtap="goto">  
114 - <view class="{{time==''?'color':''}}">{{time==""?'选择时间':time}}</view>  
115 - <view class="angle angler">∟</view>  
116 - </view> -->  
117 - <!-- </view> -->  
118 -  
119 - <!-- 备注 -->  
120 - <!-- <view class="flex Remarks"> -->  
121 - <!-- 门店 -->  
122 - <!-- <view class="flex-space-between head fs30">  
123 - <view>备</view>  
124 - <view>注</view>  
125 - </view>  
126 - <view class="flex fs26">  
127 - <block wx:if="{{is_textea==1}}">  
128 - <textarea class="textarea" placeholder="{{remarks==''?'填写备注':remarks}}" placeholder-class="fs26 color" value="{{remarks}}" bindinput="input_remarks" maxlength="100">  
129 - </textarea>  
130 - </block>  
131 - <block wx:else>  
132 - <view class="textarea {{remarks==''?'color':''}}" bindtap="check_text">{{remarks==''?'填写备注':remarks}}  
133 - </view>  
134 - </block>  
135 - </view> -->  
136 - <!-- </view>  
137 - <view wx:if="{{tment_count!=''}}" class="notes flex-level-right fs24 color">  
138 - <view>注:剩余可预约人数{{tment_count}}人</view>  
139 - </view> -->  
140 -  
141 - 86 + </scroll-view>
142 </view> 87 </view>
143 </view> 88 </view>
144 89
@@ -146,9 +91,10 @@ @@ -146,9 +91,10 @@
146 <navigator class="appment flex-center" url="/pages/user/my_service/tment_order_list"> 91 <navigator class="appment flex-center" url="/pages/user/my_service/tment_order_list">
147 <view>我的预约</view> 92 <view>我的预约</view>
148 </navigator> 93 </navigator>
149 - <form report-submit='true' bindtap="sub_success">  
150 - <button form-type="submit" class="sub_appment flex-center">帮你预约</button>  
151 - </form> 94 + <form report-submit='true' bindtap="sub_success">
  95 + <button wx:if="{{is_sub}}" class="sub_appment flex-center">预约中..</button>
  96 + <button wx:else form-type="submit" class="sub_appment flex-center">帮你预约</button>
  97 + </form>
152 </view> 98 </view>
153 99
154 100
@@ -165,7 +111,7 @@ @@ -165,7 +111,7 @@
165 </view> 111 </view>
166 </view> 112 </view>
167 <!-- 选择门店 --> 113 <!-- 选择门店 -->
168 - <scroll-view class="stores" scroll-y="{{isScroll}}" enable-back-to-top="true" bindscrolltolower="onReachBottom"> 114 + <scroll-view class="stores" scroll-y="{{isScroll}}" enable-back-to-top="true" bindscrolltolower="onGetBottom">
169 <view class="store flex-vertical" wx:for="{{store_list}}" bindtap="choose_for_store" data-ind="{{index}}"> 115 <view class="store flex-vertical" wx:for="{{store_list}}" bindtap="choose_for_store" data-ind="{{index}}">
170 <block wx:if="{{index==fir_pick_index}}"> 116 <block wx:if="{{index==fir_pick_index}}">
171 <icon class="icon" type="success" color="red" size="20"></icon> 117 <icon class="icon" type="success" color="red" size="20"></icon>
@@ -206,8 +152,9 @@ @@ -206,8 +152,9 @@
206 152
207 <!-- 制作一个圆球导航 --> 153 <!-- 制作一个圆球导航 -->
208 <!-- <nav_b id="nav_b"></nav_b> --> 154 <!-- <nav_b id="nav_b"></nav_b> -->
209 - 155 +<!--
210 <view class="copy" wx:if="{{copy_btn}}" style="position:absolute;left:{{write[0]}}px;top:{{write[1]}}px;"> 156 <view class="copy" wx:if="{{copy_btn}}" style="position:absolute;left:{{write[0]}}px;top:{{write[1]}}px;">
211 <text class="iconfont icon-meirong fs40"></text> 157 <text class="iconfont icon-meirong fs40"></text>
212 - <view class="fs24">{{projectName}}</view>  
213 -</view>  
214 \ No newline at end of file 158 \ No newline at end of file
  159 + <view class="fs24">{{sele_project.ServiceName}}</view>
  160 +</view>-->
  161 +
packageA/pages/my_service2/appment_main.wxss
1 page, 1 page,
2 .area { 2 .area {
3 width: 100%; 3 width: 100%;
4 - height: 100%; 4 + height: 100%;
  5 + position: relative;
5 } 6 }
6 7
7 -  
8 -  
9 -  
10 /* .container { 8 /* .container {
11 border-top: 7rpx solid rgb(245, 245, 245); 9 border-top: 7rpx solid rgb(245, 245, 245);
12 justify-content: baseline; 10 justify-content: baseline;
@@ -188,7 +186,7 @@ button { @@ -188,7 +186,7 @@ button {
188 } 186 }
189 187
190 .storeList { 188 .storeList {
191 - z-index: 5; 189 + z-index: 1500;
192 left: 0rpx; 190 left: 0rpx;
193 border-top-left-radius: 25rpx; 191 border-top-left-radius: 25rpx;
194 border-top-right-radius: 25rpx; 192 border-top-right-radius: 25rpx;
@@ -301,7 +299,8 @@ button { @@ -301,7 +299,8 @@ button {
301 .table { 299 .table {
302 background-color: white; 300 background-color: white;
303 /* border-top: 2rpx solid rgba(218, 217, 217, 1); 301 /* border-top: 2rpx solid rgba(218, 217, 217, 1);
304 - border-left: 2rpx solid rgba(218, 217, 217, 1); */ 302 + border-left: 2rpx solid rgba(218, 217, 217, 1); */
  303 + width: 100%;height: auto; overflow: hidden; margin-bottom: 20rpx;
305 } 304 }
306 .blue { 305 .blue {
307 background: rgba(241, 252, 255, 1); 306 background: rgba(241, 252, 255, 1);
@@ -339,17 +338,17 @@ button { @@ -339,17 +338,17 @@ button {
339 338
340 .card { 339 .card {
341 position: fixed; 340 position: fixed;
342 - width: 110rpx;  
343 - top: 50%; 341 + width: 130rpx;
  342 + /* top: 50%; */
344 right: 0; 343 right: 0;
345 /* min-height: 400rpx; */ 344 /* min-height: 400rpx; */
346 - max-height: 700rpx;  
347 - overflow-y: auto;  
348 - transform: translateY(-50%); 345 + /* max-height: 700rpx; */
  346 + /* transform: translateY(-50%); */
349 background-color: white; 347 background-color: white;
350 border-radius: 10rpx; 348 border-radius: 10rpx;
351 box-shadow: -2px 0px 6px #aaa; 349 box-shadow: -2px 0px 6px #aaa;
352 - z-index: 1000; 350 + z-index: 1000;
  351 + top:160rpx
353 } 352 }
354 353
355 .icon-meirong { 354 .icon-meirong {
@@ -443,3 +442,6 @@ button { @@ -443,3 +442,6 @@ button {
443 } 442 }
444 443
445 444
  445 +
  446 +
  447 +
packageA/pages/my_service2/g_filter.wxs
1 var g_filters = { 1 var g_filters = {
2 - is_no_time:function(item,subindex,timeArr){ 2 + is_no_time:function(item,subindex,timeArr,sele_project){
  3 + if(!sele_project || !sele_project.ServiceID) return false;
3 var t_time=timeArr[subindex]; 4 var t_time=timeArr[subindex];
4 - var time_arr=item.time.split("-");  
5 -  
6 - var t_date=getDate();  
7 - var t_date_str=t_date.getFullYear()+"-"+(t_date.getMonth() + 1)+"-"+t_date.getDate()+" "  
8 -  
9 - var this_time =t_date_str+t_time.substring(0, 19);  
10 - var reg = getRegExp("-", "g");  
11 - this_time = this_time.replace(reg, '/');  
12 - var t1 = getDate(this_time);  
13 -  
14 - var fmt1 =t_date_str+time_arr[0].substring(0, 19);  
15 - var reg = getRegExp("-", "g");  
16 - var fmt2 = fmt1.replace(reg, '/');  
17 - var t2 = getDate(fmt2);  
18 -  
19 - if(t1<t2) return true;  
20 - if(time_arr.length>1){  
21 - var ft1 =t_date_str+time_arr[1].substring(0, 19);  
22 - var reg = getRegExp("-", "g");  
23 - var ft2 = ft1.replace(reg, '/');  
24 - var t3 = getDate(ft2);  
25 - if(t1>t3) return true;  
26 - }  
27 - return false; 5 + var time_arr=item.listtime;
  6 +
  7 + for(var i=0;i<time_arr.length;i++){
  8 + if(t_time==time_arr[i].stime && time_arr[i].iskyy==true){
  9 + //如果没有项目的话
  10 + if(time_arr[i].itemids){
  11 + var project_arr=time_arr[i].itemids.split(',');
  12 + //如果没有相应的项目的话
  13 + if(project_arr && project_arr.indexOf(sele_project.ServiceID)!=-1) return false;
  14 +
  15 + }
  16 + }
  17 + }
  18 +
  19 + return true;
28 }, 20 },
29 21
30 } 22 }
pages/cart/cart2/cart2.js
@@ -226,8 +226,10 @@ Page({ @@ -226,8 +226,10 @@ Page({
226 getApp().getConfig2(function (ee) { 226 getApp().getConfig2(function (ee) {
227 var json_d = JSON.parse(ee.switch_list); 227 var json_d = JSON.parse(ee.switch_list);
228 th.data.json_d=json_d; 228 th.data.json_d=json_d;
229 - th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
230 - th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch}); 229 + th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  230 + var is_default_logistics=json_d.is_default_logistics;
  231 +
  232 + th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch,is_default_logistics:is_default_logistics});
231 233
232 var rank_switch=json_d.rank_switch; 234 var rank_switch=json_d.rank_switch;
233 var max_price=-1; 235 var max_price=-1;
@@ -279,8 +281,15 @@ Page({ @@ -279,8 +281,15 @@ Page({
279 //-------------------获取物流--------------- 281 //-------------------获取物流---------------
280 get_wuliu(func) { 282 get_wuliu(func) {
281 var th = this; 283 var th = this;
282 - to.getwuliu(function (e) {  
283 - th.setData({ wu_arr: e }) 284 + to.getwuliu(function (e) {
  285 + //系统是是否开启了默认的物流
  286 + if(th.data.is_default_logistics){
  287 + //如果第一个不是开启默认,说明要让用户自己选
  288 + if(!e[0].is_default){
  289 + th.setData({is_default_logistics:0});
  290 + }
  291 + }
  292 + th.setData({ wu_arr: e })
284 typeof func == "function" && func(); 293 typeof func == "function" && func();
285 }) 294 })
286 }, 295 },
@@ -1627,6 +1636,10 @@ Page({ @@ -1627,6 +1636,10 @@ Page({
1627 1636
1628 total_m= parseFloat( total_m)+ parseFloat( th.data.formData.shipping_price); 1637 total_m= parseFloat( total_m)+ parseFloat( th.data.formData.shipping_price);
1629 order_m = parseFloat(order_m)+ parseFloat( th.data.formData.shipping_price); 1638 order_m = parseFloat(order_m)+ parseFloat( th.data.formData.shipping_price);
  1639 +
  1640 + total_m=total_m.toFixed(2);
  1641 + order_m=order_m.toFixed(2);
  1642 +
1630 var atxt= "formData.total_amount"; 1643 var atxt= "formData.total_amount";
1631 th.setData({ [atxt]: total_m, }) 1644 th.setData({ [atxt]: total_m, })
1632 1645
@@ -1675,6 +1688,10 @@ Page({ @@ -1675,6 +1688,10 @@ Page({
1675 total_m= parseFloat( total_m)+ parseFloat( th.data.formData.shipping_price); 1688 total_m= parseFloat( total_m)+ parseFloat( th.data.formData.shipping_price);
1676 order_m = parseFloat(order_m)+ parseFloat( th.data.formData.shipping_price); 1689 order_m = parseFloat(order_m)+ parseFloat( th.data.formData.shipping_price);
1677 var atxt= "formData.total_amount"; 1690 var atxt= "formData.total_amount";
  1691 +
  1692 + total_m=total_m.toFixed(2);
  1693 + order_m=order_m.toFixed(2);
  1694 +
1678 th.setData({ [atxt]: total_m, }) 1695 th.setData({ [atxt]: total_m, })
1679 1696
1680 var txt = "formData.user_money"; 1697 var txt = "formData.user_money";
@@ -1871,7 +1888,10 @@ Page({ @@ -1871,7 +1888,10 @@ Page({
1871 1888
1872 //积分购,先要带is_integral_normal=1 1889 //积分购,先要带is_integral_normal=1
1873 if(gg.is_integral_normal) goods.is_integral_normal=1; 1890 if(gg.is_integral_normal) goods.is_integral_normal=1;
1874 - 1891 +
  1892 + //先要带is_pd_normal=1
  1893 + if(gg.is_pd_normal) goods.is_pd_normal=1;
  1894 +
1875 //如果不立即购买或者秒杀,如果是线下库存购买的时候 1895 //如果不立即购买或者秒杀,如果是线下库存购买的时候
1876 if(goods.prom_type!=1 && goods.prom_type!=6 && th.data.sales_rules==2){ 1896 if(goods.prom_type!=1 && goods.prom_type!=6 && th.data.sales_rules==2){
1877 var isok=1; 1897 var isok=1;
pages/cart/cart2/cart2.wxml
@@ -4,13 +4,35 @@ @@ -4,13 +4,35 @@
4 4
5 <form bindsubmit="submitForm"> 5 <form bindsubmit="submitForm">
6 <view class="container"> 6 <view class="container">
7 - <view class="tab-container">  
8 - <view class="tab-wrapper">  
9 - <block wx:for="{{tabs}}">  
10 - <view class="tab {{currentTabIndex == index ? 'active':''}}" data-t='{{!index ? 1:0}}' data-ind="0" data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" bindtap="clickTab" style="display:{{item.distr_t==1 ? 'none':(item.distr_t==2 ? 'none':'')}};">{{item}}</view>  
11 - </block> 7 +
  8 + <!-- 立即购买的时候 -->
  9 + <block wx:if="{{is_b_now==1}}">
  10 + <view class="tab-container">
  11 + <view class="tab-wrapper">
  12 + <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}"
  13 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
  14 +
  15 + <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}"
  16 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view>
  17 +
  18 + </view>
12 </view> 19 </view>
13 - </view> 20 + </block>
  21 + <!-- 购物购买只有一单的时候 -->
  22 + <block wx:if="{{is_b_now==0 && cartlist.length==1}}">
  23 + <view class="tab-container">
  24 + <view class="tab-wrapper">
  25 + <view hidden="{{cartlist[0].distr_t==2}}" bindtap='setexptype_w' data-ind="0" data-t='1' class="tab {{cartlist[0].exp_type == 1? 'active':''}}"
  26 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
  27 +
  28 + <view hidden="{{cartlist[0].distr_t==1}}" bindtap='setexptype_w' data-ind="0" data-t='0' class="tab {{cartlist[0].exp_type== 0 ? 'active':''}}"
  29 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view>
  30 +
  31 + </view>
  32 + </view>
  33 + </block>
  34 +
  35 +
14 <!--要进行判断地址是否显示----> 36 <!--要进行判断地址是否显示---->
15 <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'> 37 <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'>
16 <!---默认地址显示------> 38 <!---默认地址显示------>
@@ -45,7 +67,7 @@ @@ -45,7 +67,7 @@
45 </view> --> 67 </view> -->
46 </view> 68 </view>
47 69
48 - <!---------------------购物车进来,有可能多单----------------------> 70 + <!-- -------------------购物车进来,有可能多单-------------------- -->
49 <block wx:if="{{is_b_now==0}}"> 71 <block wx:if="{{is_b_now==0}}">
50 <!-- <view class="xc-border main-top"></view> --> 72 <!-- <view class="xc-border main-top"></view> -->
51 <view wx:for="{{cartlist}}" wx:for-index="pidx"> 73 <view wx:for="{{cartlist}}" wx:for-index="pidx">
@@ -124,63 +146,61 @@ @@ -124,63 +146,61 @@
124 <icon color="#f23030" size="16" type="info"></icon> 146 <icon color="#f23030" size="16" type="info"></icon>
125 {{order.store_prom}} 147 {{order.store_prom}}
126 </view> 148 </view>
127 -  
128 - <view class="use-item flex-space-between" wx:if="{{item.exp_type==0}}">  
129 - <!-- <view class="flex-vertical"> -->  
130 - <!-- <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' style="padding-right:26rpx;display:none"> -->  
131 - <!-- <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' style="padding-right:26rpx;display:{{item.distr_t==2?'none':'flex;align-items: center'}};"> --> 149 +
  150 + <view class="use-item flex-space-between" wx:if="{{cartlist.length>1}}">
  151 + <view class="flex-vertical" >
  152 + <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type'
  153 + style="padding-right:26rpx;display:{{item.distr_t==2?'none':'flex;align-items: center'}};">
132 <!-- <icon bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==1?'red':'gray'}}" size="16" type="success"></icon> --> 154 <!-- <icon bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==1?'red':'gray'}}" size="16" type="success"></icon> -->
133 -  
134 -  
135 -  
136 - <!-- <block wx:if="{{item.exp_type==1}}"> 155 +
  156 + <block wx:if="{{item.exp_type==1}}">
137 <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> 157 <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> -->
138 - <!-- <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> -->  
139 - <!-- </block> -->  
140 - <!-- <block wx:else> 158 + <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon>
  159 + </block>
  160 + <block wx:else>
141 <view class="circle xc-hookts on"></view> 161 <view class="circle xc-hookts on"></view>
142 - </block> -->  
143 - <!-- <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">门店自提</view> -->  
144 - <!-- </view> -->  
145 -  
146 - <!-- <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w" style="display:none;"> -->  
147 - <!-- <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w" style="display:{{item.distr_t==1?'none':'flex;align-items: center'}};"> --> 162 + </block>
  163 + <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">门店自提</view>
  164 + </view>
  165 +
  166 + <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w" style="display:{{item.distr_t==1?'none':'flex;align-items: center'}};">
148 <!-- <icon bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==0?'red':'gray'}}" size="16" type="success"></icon> --> 167 <!-- <icon bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==0?'red':'gray'}}" size="16" type="success"></icon> -->
149 - <!-- <block wx:if="{{item.exp_type==0}}"> 168 + <block wx:if="{{item.exp_type==0}}">
150 <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> 169 <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> -->
151 - <!-- <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> 170 + <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon>
152 </block> 171 </block>
153 <block wx:else> 172 <block wx:else>
154 <view class="circle xc-hookts on"></view> 173 <view class="circle xc-hookts on"></view>
155 </block> 174 </block>
156 - 175 +
157 <view bindtap='setexptype_w' data-t='0' data-ind="{{pidx}}" data-txt='cartlist[{{pidx}}].exp_type' data-wl_txt='cartlist[{{pidx}}].wind' 176 <view bindtap='setexptype_w' data-t='0' data-ind="{{pidx}}" data-txt='cartlist[{{pidx}}].exp_type' data-wl_txt='cartlist[{{pidx}}].wind'
158 class="yu_er">快递邮寄</view> 177 class="yu_er">快递邮寄</view>
159 - </view> -->  
160 - <view>配送方式</view>  
161 - <block wx:if="{{item.exp_type==0}}">  
162 - <!-- 点击显示物流选择 -->  
163 - <view class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;">  
164 - <view>{{wu_arr[item.wind].name}}</view>  
165 - <view class="xc-right"></view>  
166 - </view>  
167 - </block> 178 + </view>
168 </view> 179 </view>
169 - <!-- <block wx:if="{{item.exp_type==0}}"> -->  
170 - <!-- 点击显示物流选择 -->  
171 - <!-- <view class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;"> 180 + <!-- 当是物流很多单的时候 -->
  181 +
  182 + <!-- 点击显示物流选择,如果是默认使用的情况不成立 -->
  183 + <view wx:if="{{!is_default_logistics}}" class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;">
  184 + <view>{{wu_arr[item.wind].name}}</view>
  185 + <view class="xc-right"></view>
  186 + </view>
  187 +
  188 + </view>
  189 +
  190 + <!-- 当是物流,只有一单的时候 -->
  191 + <block wx:else >
  192 + <view class="use-item flex-space-between" wx:if="{{item.exp_type==0 && !is_default_logistics}}">
  193 + <view class="flex jc_sb" style="width: 100%; padding: 0 13rpx;">
  194 + <view>选择物流</view>
  195 + <view class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;">
172 <view>{{wu_arr[item.wind].name}}</view> 196 <view>{{wu_arr[item.wind].name}}</view>
173 <view class="xc-right"></view> 197 <view class="xc-right"></view>
174 </view> 198 </view>
175 - </block> -->  
176 - <!-- </view> -->  
177 -  
178 - <!-- <view bindtap="express_name" class="use-item" hidden='{{item.exp_type==1}}'>  
179 - <view>选择物流:</view> -->  
180 - <!-- <picker bindchange="bindPickerChange_w" data-txt='cartlist[{{pidx}}].wind' value="{{item.wind}}" range="{{wu_arr}}" range-key="name">  
181 - <view >{{wu_arr[item.wind].name}}</view>  
182 - </picker> -->  
183 - <!-- </view> --> 199 + </view>
  200 + </view>
  201 + </block>
  202 +
  203 +
184 </view> 204 </view>
185 205
186 <!-- 留言 --> 206 <!-- 留言 -->
@@ -211,7 +231,7 @@ @@ -211,7 +231,7 @@
211 231
212 </view> 232 </view>
213 233
214 - <!-----使用余额------> 234 + <!-- ---使用余额---- -->
215 <view class="set-mes bdr_t-14" wx:if="{{yuer>0}}"> 235 <view class="set-mes bdr_t-14" wx:if="{{yuer>0}}">
216 <view class="use-item" bindtap='set_js_useyuer'> 236 <view class="use-item" bindtap='set_js_useyuer'>
217 <icon color="{{js_use_money?'red':'gray'}}" size="16" type="success"></icon> 237 <icon color="{{js_use_money?'red':'gray'}}" size="16" type="success"></icon>
@@ -221,7 +241,7 @@ @@ -221,7 +241,7 @@
221 241
222 </block> 242 </block>
223 243
224 - <!------立即购买--------> 244 + <!-- ----立即购买------ -->
225 <!-- <view class="xc-border xc-border"></view> --> 245 <!-- <view class="xc-border xc-border"></view> -->
226 <block wx:if="{{is_b_now==1}}"> 246 <block wx:if="{{is_b_now==1}}">
227 <view class="use-item bfff bdr_t-14 mgt20"> 247 <view class="use-item bfff bdr_t-14 mgt20">
@@ -247,7 +267,7 @@ @@ -247,7 +267,7 @@
247 </view> 267 </view>
248 </view> 268 </view>
249 269
250 - <!-----商品名称规格------> 270 + <!-- ---商品名称规格---- -->
251 <view class="order-num flex-space-between"> 271 <view class="order-num flex-space-between">
252 <view class="co-red">¥<text class="fs36">{{filters.toFix(bn_goods.shop_price,2)}}</text></view> 272 <view class="co-red">¥<text class="fs36">{{filters.toFix(bn_goods.shop_price,2)}}</text></view>
253 <view class="goods-num">x{{bn_goods.buynum}}</view> 273 <view class="goods-num">x{{bn_goods.buynum}}</view>
@@ -270,7 +290,7 @@ @@ -270,7 +290,7 @@
270 <block><text>{{filters.show_gui_ge(buy_now_gift_goods.goods_spec,buy_now_gift_goods.goods_color)}}</text></block> 290 <block><text>{{filters.show_gui_ge(buy_now_gift_goods.goods_spec,buy_now_gift_goods.goods_color)}}</text></block>
271 </view> 291 </view>
272 </view> 292 </view>
273 - <!-----商品名称规格------> 293 + <!-- ---商品名称规格---- -->
274 <view class="order-num flex-space-between"> 294 <view class="order-num flex-space-between">
275 <view class="co-red">¥<text class="fs36">0</text></view> 295 <view class="co-red">¥<text class="fs36">0</text></view>
276 <view class="goods-num">x{{buy_now_gift_goods.buynum}}</view> 296 <view class="goods-num">x{{buy_now_gift_goods.buynum}}</view>
@@ -293,7 +313,7 @@ @@ -293,7 +313,7 @@
293 <block><text>{{filters.show_gui_ge(item.goods_spec,item.goods_color)}}</text></block> 313 <block><text>{{filters.show_gui_ge(item.goods_spec,item.goods_color)}}</text></block>
294 </view> 314 </view>
295 </view> 315 </view>
296 - <!-----商品名称规格------> 316 + <!-- ---商品名称规格---- -->
297 <view class="order-num flex-space-between"> 317 <view class="order-num flex-space-between">
298 <view class="co-red">¥<text class="fs36">{{item.price}}</text></view> 318 <view class="co-red">¥<text class="fs36">{{item.price}}</text></view>
299 <view class="goods-num">x{{item.goods_num}}</view> 319 <view class="goods-num">x{{item.goods_num}}</view>
@@ -342,24 +362,14 @@ @@ -342,24 +362,14 @@
342 </view> 362 </view>
343 </view> 363 </view>
344 364
345 - <view class="use-item flex-space-between">  
346 - <view class="flex">  
347 - <!-- <view bindtap='setexptype' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' style="padding-right:26rpx;display:{{bn_t_exp_t==2?'none':'flex;align-items:center;'}};">  
348 - <icon color="{{bn_exp_type==1?'red':'gray'}}" size="16" type="success"></icon>  
349 - <view class="yu_er">门店自提</view>  
350 - </view> -->  
351 - <!-- <view bindtap='setexptype' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' style="display:{{bn_t_exp_t==1?'none':'flex;align-items:center;'}};">  
352 - <icon color="{{bn_exp_type==0?'red':'gray'}}" size="16" type="success"></icon>  
353 - <view class="yu_er">快递邮寄</view>  
354 - </view> -->  
355 - <view>配送方式</view>  
356 - </view>  
357 - <block wx:if="{{bn_exp_type==0}}">  
358 - <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index'>  
359 - <view class="logistics-name">{{wu_arr[index].name}}</view>  
360 - <view class="xc-right"></view> 365 + <view class="xc-coupon-frame" wx:if="{{bn_exp_type==0 && !is_default_logistics}}">
  366 + <view class="flex-space-between" style="padding: 20rpx 25rpx; font-size: 30rpx;">
  367 + <view>选择物流</view>
  368 + <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 12rpx;">
  369 + <view class="logistics-name">{{wu_arr[index].name}}</view>
  370 + <view class="xc-right"></view>
361 </view> 371 </view>
362 - </block> 372 + </view>
363 </view> 373 </view>
364 </view> 374 </view>
365 <!-- 留言 --> 375 <!-- 留言 -->
pages/cart/cart2_inte/cart2_inte.js
@@ -93,8 +93,9 @@ Page({ @@ -93,8 +93,9 @@ Page({
93 getApp().getConfig2(function (ee) { 93 getApp().getConfig2(function (ee) {
94 var json_d = JSON.parse(ee.switch_list); 94 var json_d = JSON.parse(ee.switch_list);
95 th.data.json_d=json_d; 95 th.data.json_d=json_d;
96 - th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
97 - th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch}); 96 + th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  97 + var is_default_logistics=json_d.is_default_logistics;
  98 + th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch,is_default_logistics:is_default_logistics});
98 99
99 var rank_switch=json_d.rank_switch; 100 var rank_switch=json_d.rank_switch;
100 var max_price=-1; 101 var max_price=-1;
@@ -204,8 +205,14 @@ Page({ @@ -204,8 +205,14 @@ Page({
204 get_wuliu(func) { 205 get_wuliu(func) {
205 var th = this; 206 var th = this;
206 to.getwuliu(function (e) { 207 to.getwuliu(function (e) {
207 - th.setData({ wu_arr: e })  
208 - typeof func == "function" && func(); 208 + if(th.data.is_default_logistics){
  209 + //如果第一个不是开启默认,说明要让用户自己选
  210 + if(!e[0].is_default){
  211 + th.setData({is_default_logistics:0});
  212 + }
  213 + }
  214 + th.setData({ wu_arr: e })
  215 + typeof func == "function" && func();
209 }) 216 })
210 }, 217 },
211 //------获取会员信息-----先获取用户信息,在进行下一步--- 218 //------获取会员信息-----先获取用户信息,在进行下一步---
pages/cart/cart2_inte/cart2_inte.wxml
@@ -4,6 +4,19 @@ @@ -4,6 +4,19 @@
4 4
5 <form bindsubmit="submitForm"> 5 <form bindsubmit="submitForm">
6 <view class="container"> 6 <view class="container">
  7 +
  8 + <view class="tab-container">
  9 + <view class="tab-wrapper">
  10 + <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}"
  11 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
  12 +
  13 + <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}"
  14 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view>
  15 +
  16 + </view>
  17 + </view>
  18 +
  19 +
7 <!--要进行判断地址是否显示----> 20 <!--要进行判断地址是否显示---->
8 <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'> 21 <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'>
9 <!---默认地址显示------> 22 <!---默认地址显示------>
@@ -90,24 +103,18 @@ @@ -90,24 +103,18 @@
90 </view> 103 </view>
91 </view> 104 </view>
92 105
93 - <view class="use-item flex-space-between">  
94 - <view class="flex">  
95 - <view bindtap='setexptype' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' style="padding-right:26rpx;display:{{bn_t_exp_t==2?'none':'flex;align-items:center;'}};">  
96 - <icon color="{{bn_exp_type==1?'red':'gray'}}" size="16" type="success"></icon>  
97 - <view class="yu_er">门店自提</view>  
98 - </view>  
99 - <view bindtap='setexptype' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' style="display:{{bn_t_exp_t==1?'none':'flex;align-items:center;'}};">  
100 - <icon color="{{bn_exp_type==0?'red':'gray'}}" size="16" type="success"></icon>  
101 - <view class="yu_er">快递邮寄</view>  
102 - </view>  
103 - </view>  
104 - <block wx:if="{{bn_exp_type==0}}">  
105 - <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index'>  
106 - <view class="logistics-name">{{wu_arr[index].name}}</view>  
107 - <view class="xc-right"></view> 106 +
  107 +
  108 + <block wx:if="{{bn_exp_type==0 && !is_default_logistics}}">
  109 + <view class="use-item flex-space-between">
  110 + <view>选择物流</view>
  111 + <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;">
  112 + <view class="logistics-name">{{wu_arr[index].name}}</view>
  113 + <view class="xc-right"></view>
  114 + </view>
108 </view> 115 </view>
109 </block> 116 </block>
110 - </view> 117 +
111 </view> 118 </view>
112 119
113 <view class="coupon-mes flex-vertical"> 120 <view class="coupon-mes flex-vertical">
pages/cart/cart2_inte/cart2_inte.wxss
@@ -252,7 +252,7 @@ margin:auto; */ @@ -252,7 +252,7 @@ margin:auto; */
252 } 252 }
253 253
254 .btn-wrap { 254 .btn-wrap {
255 - height: 94rpx; 255 + height: 100rpx;
256 box-sizing: border-box; 256 box-sizing: border-box;
257 display: flex; 257 display: flex;
258 justify-content: space-between; 258 justify-content: space-between;
@@ -262,7 +262,8 @@ margin:auto; */ @@ -262,7 +262,8 @@ margin:auto; */
262 bottom: 0; 262 bottom: 0;
263 left: 0; 263 left: 0;
264 width: 100%; 264 width: 100%;
265 - padding: 0 30rpx; 265 + padding: 0 30rpx;
  266 + font-size: 30rpx;
266 } 267 }
267 268
268 .tips-btn { 269 .tips-btn {
@@ -958,3 +959,28 @@ margin-left: 20rpx; @@ -958,3 +959,28 @@ margin-left: 20rpx;
958 top:36rpx 959 top:36rpx
959 } 960 }
960 961
  962 +
  963 +.tab-container {
  964 + font-size: 28rpx;
  965 + margin-top: 20rpx;
  966 + display: flex;
  967 +}
  968 +
  969 +.tab-wrapper {
  970 + background-color: #ccc;
  971 + display: flex;
  972 + border-radius: 40rpx;
  973 + overflow: hidden;
  974 +}
  975 +
  976 +.tab {
  977 + padding: 20rpx 30rpx;
  978 +
  979 +}
  980 +
  981 +
  982 +.tab.active {
  983 + background-color: white;
  984 + border-radius: 40rpx;
  985 +}
  986 +
pages/cart/cart2_pt/cart2_pt.js
@@ -95,8 +95,12 @@ Page({ @@ -95,8 +95,12 @@ Page({
95 var th = this; 95 var th = this;
96 console.log("getwuliu4545"); 96 console.log("getwuliu4545");
97 to.getwuliu(function (e) { 97 to.getwuliu(function (e) {
98 - console.log("ws");  
99 - console.log(e); 98 + if (th.data.is_default_logistics) {
  99 + //如果第一个不是开启默认,说明要让用户自己选
  100 + if (!e[0].is_default) {
  101 + th.setData({ is_default_logistics: 0 });
  102 + }
  103 + }
100 th.setData({ wu_arr: e }) 104 th.setData({ wu_arr: e })
101 typeof func == "function" && func(); 105 typeof func == "function" && func();
102 }) 106 })
@@ -277,80 +281,81 @@ Page({ @@ -277,80 +281,81 @@ Page({
277 }, 281 },
278 282
279 //----------子页返回父页触发---------- 283 //----------子页返回父页触发----------
280 - onShow: function() {  
281 - var th=this;  
282 - if (th.data.isclose==0){  
283 - wx.navigateTo({  
284 - url: "/pages/index/index/index"  
285 - })  
286 - }else{  
287 - this.getuser_addr(function(ie){  
288 - //更换地址回来要重新调用计算价钱的接口  
289 - th.setData({user_addr: ie });  
290 - if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){  
291 - th.setData({add_back:1});  
292 - if(this.data.bn_goods) th.calculatePrice2();  
293 - }  
294 - })  
295 - //--更新默认地址--,看一下是不是跳到地址页面  
296 - if(!getApp().globalData.is_cart_old){  
297 - this.update_code();  
298 - }else{  
299 - getApp().globalData.is_cart_old=0;  
300 - }  
301 - }  
302 -  
303 -  
304 - //先获取是否有关闭使用优惠券  
305 - getApp().getConfig2(function (ee) {  
306 - var json_d = JSON.parse(ee.switch_list);  
307 - th.data.json_d=json_d;  
308 - th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
309 - th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch});  
310 -  
311 - var rank_switch=json_d.rank_switch;  
312 - var max_price=-1;  
313 - var show_card=null;  
314 - var name="";  
315 - //如果有开等级卡的时候,  
316 - //因为都是调接口,要返回在计算  
317 - if(rank_switch==2){  
318 - //-- 获取所有的等级卡, --  
319 - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,  
320 - {}).then(res => {  
321 - if(res.data.code==0){  
322 - var plusCard = res.data.data;  
323 - //-- 循环判断,拿到最贵的那张卡 --  
324 - for(var ih in plusCard){  
325 - if(plusCard[ih].IsStopBuy == true){ continue; }  
326 - if(max_price<0){  
327 - max_price=plusCard[ih].CardFee;  
328 - name='card'+plusCard[ih]['CorrPrice'];  
329 - show_card=plusCard[ih];  
330 - }else{  
331 - if(max_price<plusCard[ih].CardFee){  
332 - max_price=plusCard[ih].CardFee;  
333 - name='card'+plusCard[ih]['CorrPrice'];  
334 - show_card=plusCard[ih];  
335 - }  
336 - }  
337 - }  
338 -  
339 - if(show_card){  
340 - name=name.toLowerCase();  
341 - th.setData({card_name:name,show_card:show_card})  
342 - }  
343 - }  
344 - //-----先获取物流,再获取用户信息,再展示页面-----  
345 - th.get_wuliu(th.get_info(th.show_page));  
346 - })  
347 - }else{  
348 - //-----先获取物流,再获取用户信息,再展示页面-----  
349 - th.get_wuliu(th.get_info(th.show_page));  
350 - }  
351 - },1)  
352 -  
353 - 284 + onShow: function () {
  285 + var th = this;
  286 + if (th.data.isclose == 0) {
  287 + wx.navigateTo({
  288 + url: "/pages/index/index/index"
  289 + })
  290 + } else {
  291 + this.getuser_addr(function (ie) {
  292 + //更换地址回来要重新调用计算价钱的接口
  293 + th.setData({ user_addr: ie });
  294 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  295 + th.setData({ add_back: 1 });
  296 + if (this.data.bn_goods) th.calculatePrice2();
  297 + }
  298 + })
  299 + //--更新默认地址--,看一下是不是跳到地址页面
  300 + if (!getApp().globalData.is_cart_old) {
  301 + this.update_code();
  302 + } else {
  303 + getApp().globalData.is_cart_old = 0;
  304 + }
  305 + }
  306 +
  307 +
  308 + //先获取是否有关闭使用优惠券
  309 + getApp().getConfig2(function (ee) {
  310 + var json_d = JSON.parse(ee.switch_list);
  311 + th.data.json_d = json_d;
  312 + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  313 + var is_default_logistics = json_d.is_default_logistics;
  314 +
  315 + th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });
  316 +
  317 + var rank_switch = json_d.rank_switch;
  318 + var max_price = -1;
  319 + var show_card = null;
  320 + var name = "";
  321 + //如果有开等级卡的时候,
  322 + //因为都是调接口,要返回在计算
  323 + if (rank_switch == 2) {
  324 + //-- 获取所有的等级卡, --
  325 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
  326 + {}).then(res => {
  327 + if (res.data.code == 0) {
  328 + var plusCard = res.data.data;
  329 + //-- 循环判断,拿到最贵的那张卡 --
  330 + for (var ih in plusCard) {
  331 + if (plusCard[ih].IsStopBuy == true) { continue; }
  332 + if (max_price < 0) {
  333 + max_price = plusCard[ih].CardFee;
  334 + name = 'card' + plusCard[ih]['CorrPrice'];
  335 + show_card = plusCard[ih];
  336 + } else {
  337 + if (max_price < plusCard[ih].CardFee) {
  338 + max_price = plusCard[ih].CardFee;
  339 + name = 'card' + plusCard[ih]['CorrPrice'];
  340 + show_card = plusCard[ih];
  341 + }
  342 + }
  343 + }
  344 +
  345 + if (show_card) {
  346 + name = name.toLowerCase();
  347 + th.setData({ card_name: name, show_card: show_card })
  348 + }
  349 + }
  350 + //-----先获取物流,再获取用户信息,再展示页面-----
  351 + th.get_wuliu(th.get_info(th.show_page));
  352 + })
  353 + } else {
  354 + //-----先获取物流,再获取用户信息,再展示页面-----
  355 + th.get_wuliu(th.get_info(th.show_page));
  356 + }
  357 + }, 1)
  358 +
354 }, 359 },
355 //---------------检查是否有收货地址------------------- 360 //---------------检查是否有收货地址-------------------
356 checkAddressList: function() { 361 checkAddressList: function() {
@@ -783,6 +788,7 @@ Page({ @@ -783,6 +788,7 @@ Page({
783 if (item == null) return o_shipping_price; 788 if (item == null) return o_shipping_price;
784 var fw_price = 0, fp_price=0; 789 var fw_price = 0, fp_price=0;
785 item=item.config; 790 item=item.config;
  791 + if (item == null) return o_shipping_price;
786 //------按重量---------- 792 //------按重量----------
787 if (goods_weight>0) { 793 if (goods_weight>0) {
788 fw_price =parseFloat(item['money']); 794 fw_price =parseFloat(item['money']);
pages/cart/cart2_pt/cart2_pt.wxml
1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs> 1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs>
2 <form bindsubmit="submitForm"> 2 <form bindsubmit="submitForm">
3 <view class="container"> 3 <view class="container">
  4 +
  5 + <view class="tab-container" wx:if="{{kt_type!=3 || is_normal==1}}">
  6 + <view class="tab-wrapper">
  7 + <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}"
  8 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
  9 +
  10 + <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}"
  11 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view>
  12 +
  13 + </view>
  14 + </view>
  15 +
  16 +
4 <!--要进行判断地址是否显示----> 17 <!--要进行判断地址是否显示---->
5 <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{bn_exp_type==1 || kt_type==3}}'> 18 <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{bn_exp_type==1 || kt_type==3}}'>
6 <!---默认地址显示------> 19 <!---默认地址显示------>
@@ -79,35 +92,14 @@ @@ -79,35 +92,14 @@
79 </view> 92 </view>
80 93
81 <!--阶梯团是不显示的--> 94 <!--阶梯团是不显示的-->
82 - <view class="use-item flex-space-between" wx:if="{{kt_type!=3 || is_normal==1}}">  
83 - <view class="flex-vertical">  
84 - <view bindtap='setexptype' data-t='1' style="padding-right:26rpx;display:{{bn_t_exp_t==2?'none':'flex;align-items:center;'}}">  
85 - <!-- <icon color="{{bn_exp_type==1?'red':'gray'}}" size="16" type="success"></icon> -->  
86 - <block wx:if="{{bn_exp_type==1}}">  
87 -  
88 - <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon>  
89 - </block>  
90 - <block wx:else>  
91 - <view class="circle xc-hookts on"></view>  
92 - </block>  
93 - <view class="yu_er">门店自提</view>  
94 - </view>  
95 - <view class="{{bn_t_exp_t==2?'':'xc-left'}}" bindtap='setexptype' data-t='0' style="display:{{bn_t_exp_t==1?'none':'flex;align-items:center;'}}">  
96 - <!-- <icon color="{{bn_exp_type==0?'red':'gray'}}" size="16" type="success"></icon> -->  
97 - <block wx:if="{{bn_exp_type==0}}">  
98 -  
99 - <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon>  
100 - </block>  
101 - <block wx:else>  
102 - <view class="circle xc-hookts on"></view>  
103 - </block>  
104 - <view class="yu_er">快递邮寄</view>  
105 - </view>  
106 - </view>  
107 - <block wx:if="{{bn_exp_type==0}}">  
108 - <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index'><view class="logistics-name">{{wu_arr[index].name}}</view><view class="xc-right"></view></view>  
109 - </block>  
110 - </view> 95 + <block wx:if="{{bn_exp_type==0 && !is_default_logistics}}">
  96 + <view class="use-item flex-space-between" wx:if="{{kt_type!=3 || is_normal==1}}">
  97 + <view>选择物流</view>
  98 + <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;">
  99 + <view class="logistics-name">{{wu_arr[index].name}}</view><view class="xc-right"></view>
  100 + </view>
  101 + </view>
  102 + </block>
111 103
112 <!--阶梯团是不显示的 104 <!--阶梯团是不显示的
113 <block wx:if="{{kt_type!=3 || is_normal==1 }}"> 105 <block wx:if="{{kt_type!=3 || is_normal==1 }}">
pages/cart/cart2_pt/cart2_pt.wxss
@@ -957,3 +957,27 @@ margin-left: 20rpx; @@ -957,3 +957,27 @@ margin-left: 20rpx;
957 top:36rpx 957 top:36rpx
958 } 958 }
959 959
  960 +
  961 +.tab-container {
  962 + font-size: 28rpx;
  963 + margin-top: 20rpx;
  964 + display: flex;
  965 +}
  966 +
  967 +.tab-wrapper {
  968 + background-color: #ccc;
  969 + display: flex;
  970 + border-radius: 40rpx;
  971 + overflow: hidden;
  972 +}
  973 +
  974 +.tab {
  975 + padding: 20rpx 30rpx;
  976 +
  977 +}
  978 +
  979 +
  980 +.tab.active {
  981 + background-color: white;
  982 + border-radius: 40rpx;
  983 +}
pages/cart/cart_wk/cart_wk.js
@@ -13,12 +13,13 @@ Page({ @@ -13,12 +13,13 @@ Page({
13 order: null, //订单所有字段 13 order: null, //订单所有字段
14 user_addr: null, //会员地址 14 user_addr: null, //会员地址
15 pickup: null, //门店 15 pickup: null, //门店
16 - goods:null, //商品 16 + goods: null, //商品
17 /*------------------------*/ 17 /*------------------------*/
18 userinfo: null, //获取会员 18 userinfo: null, //获取会员
19 /*----------物流选择--------*/ 19 /*----------物流选择--------*/
20 wu_arr: null, 20 wu_arr: null,
21 index: 0, 21 index: 0,
  22 + is_express:0,
22 //申请提现的金额 23 //申请提现的金额
23 txmon: 0, 24 txmon: 0,
24 yuer: 0, 25 yuer: 0,
@@ -33,8 +34,8 @@ Page({ @@ -33,8 +34,8 @@ Page({
33 exp_price: 0, 34 exp_price: 0,
34 enterAddressPage: 0, //进入地址页面 35 enterAddressPage: 0, //进入地址页面
35 36
36 - allpice:0,  
37 - show_pay_type:0, 37 + allpice: 0,
  38 + show_pay_type: 0,
38 39
39 teamgroup: null, 40 teamgroup: null,
40 }, 41 },
@@ -42,11 +43,11 @@ Page({ @@ -42,11 +43,11 @@ Page({
42 /** 43 /**
43 * 生命周期函数--监听页面加载 44 * 生命周期函数--监听页面加载
44 */ 45 */
45 - onLoad: function(options) { 46 + onLoad: function (options) {
46 47
47 //清空is_pick_up 48 //清空is_pick_up
48 getApp().request.put("/api/weshop/useraddress/updatePickUp", { 49 getApp().request.put("/api/weshop/useraddress/updatePickUp", {
49 - data: {user_id: getApp().globalData.user_id, is_pickup: 0}, 50 + data: { user_id: getApp().globalData.user_id, is_pickup: 0 },
50 success: function (s) { 51 success: function (s) {
51 } 52 }
52 }); 53 });
@@ -54,105 +55,111 @@ Page({ @@ -54,105 +55,111 @@ Page({
54 var th = this; 55 var th = this;
55 this.data.order_id = options.order_id; 56 this.data.order_id = options.order_id;
56 //--初始化-- 57 //--初始化--
57 - getApp().getConfig2(function (e){ 58 + getApp().getConfig2(function (e) {
58 var json_d = JSON.parse(e.switch_list); 59 var json_d = JSON.parse(e.switch_list);
59 - th.data.json_d=json_d; 60 + th.data.json_d = json_d;
  61 + var is_default_logistics = json_d.is_default_logistics;
  62 + th.setData({is_default_logistics:is_default_logistics});
  63 +
60 th.get_wuliu(th.get_info(th.show_page)); 64 th.get_wuliu(th.get_info(th.show_page));
61 - },1) 65 + }, 1)
62 66
63 }, 67 },
64 /** 68 /**
65 * 生命周期函数--监听页面显示 69 * 生命周期函数--监听页面显示
66 */ 70 */
67 - onShow: function() { 71 + onShow: function () {
68 var th = this; 72 var th = this;
69 if (th.data.isclose == 0) { 73 if (th.data.isclose == 0) {
70 wx.navigateTo({ 74 wx.navigateTo({
71 url: "/pages/index/index/index" 75 url: "/pages/index/index/index"
72 }) 76 })
73 - }  
74 - th.getuser_addr(function(addr) {  
75 - if(addr==null || addr==undefined || addr.length==0) {  
76 - th.setData({ user_addr: null, enterAddressPage: 1,});  
77 - }else { 77 + }
  78 + th.getuser_addr(function (addr) {
  79 + if (addr == null || addr == undefined || addr.length == 0) {
  80 + th.setData({ user_addr: null, enterAddressPage: 1, });
  81 + } else {
78 th.setData({ 82 th.setData({
79 user_addr: addr, enterAddressPage: 0, 83 user_addr: addr, enterAddressPage: 0,
80 }); 84 });
81 } 85 }
82 86
83 - if (th.data.exp_type == 0 && th.data.goods){  
84 - th.calculate_wuliu();  
85 - }  
86 - })  
87 - 87 + if (th.data.exp_type == 0 && th.data.goods) {
  88 + th.calculate_wuliu();
  89 + }
  90 + })
  91 +
88 }, 92 },
89 /** 93 /**
90 * 用户点击右上角分享 94 * 用户点击右上角分享
91 */ 95 */
92 - onShareAppMessage: function() {}, 96 + onShareAppMessage: function () { },
93 //---------------获取物流--------------- 97 //---------------获取物流---------------
94 get_wuliu(func) { 98 get_wuliu(func) {
95 var th = this, 99 var th = this,
96 - to = getApp();  
97 - to.getwuliu(function(e) {  
98 - th.setData({  
99 - wu_arr: e  
100 - }) 100 + to = getApp();
  101 + to.getwuliu(function (e) {
  102 + //如果第一个不是开启默认,说明要让用户自己选
  103 + if (!e[0].is_default) {
  104 + th.setData({ is_default_logistics: 0 });
  105 + }
  106 +
  107 + th.setData({ wu_arr: e })
101 typeof func == "function" && func(); 108 typeof func == "function" && func();
102 }) 109 })
103 }, 110 },
104 //------获取会员信息-----先获取用户信息,在进行下一步--- 111 //------获取会员信息-----先获取用户信息,在进行下一步---
105 - get_info: function(func) {  
106 - var user_id = t.globalData.user_id, 112 + get_info: function (func) {
  113 + var user_id = t.globalData.user_id,
107 to = getApp(); 114 to = getApp();
108 - to.auth.get_u(func); 115 + to.auth.get_u(func);
109 }, 116 },
110 117
111 //------获取会员收货地址----- 118 //------获取会员收货地址-----
112 - getuser_addr: function(func) {  
113 - var to = getApp(), 119 + getuser_addr: function (func) {
  120 + var to = getApp(),
114 a = to.request; 121 a = to.request;
115 122
116 - a.get("/api/weshop/useraddress/page", {  
117 - data: {  
118 - user_id: to.globalData.user_id,  
119 - store_id: oo.stoid,  
120 - pageSize: 600  
121 - },  
122 - success: function(su) {  
123 - var user_addr = su.data.data.pageData;  
124 - var item = null;  
125 - var def_item = null;  
126 - for (var i = 0; i < user_addr.length; i++) {  
127 - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }  
128 - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }  
129 - }  
130 -  
131 - if (item == null) item = def_item;  
132 - if (item == null) item = user_addr[0];  
133 - if (item == undefined) item = null;  
134 - func(item); 123 + a.get("/api/weshop/useraddress/page", {
  124 + data: {
  125 + user_id: to.globalData.user_id,
  126 + store_id: oo.stoid,
  127 + pageSize: 600
  128 + },
  129 + success: function (su) {
  130 + var user_addr = su.data.data.pageData;
  131 + var item = null;
  132 + var def_item = null;
  133 + for (var i = 0; i < user_addr.length; i++) {
  134 + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }
  135 + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }
135 } 136 }
136 - });  
137 - 137 +
  138 + if (item == null) item = def_item;
  139 + if (item == null) item = user_addr[0];
  140 + if (item == undefined) item = null;
  141 + func(item);
  142 + }
  143 + });
  144 +
138 }, 145 },
139 146
140 //----------------展示页面,是再获取用户信息之后-------------- 147 //----------------展示页面,是再获取用户信息之后--------------
141 - show_page: function() { 148 + show_page: function () {
142 var th = this, 149 var th = this,
143 to = getApp(); 150 to = getApp();
144 th.setData({ 151 th.setData({
145 userinfo: to.globalData.userInfo, 152 userinfo: to.globalData.userInfo,
146 }); 153 });
147 //选获取地址 154 //选获取地址
148 - th.getuser_addr(function(addr) { 155 + th.getuser_addr(function (addr) {
149 156
150 - if(addr==null || addr==undefined || addr.length==0) {  
151 - th.setData({ 157 + if (addr == null || addr == undefined || addr.length == 0) {
  158 + th.setData({
152 enterAddressPage: 1, 159 enterAddressPage: 1,
153 }); 160 });
154 161
155 - }else { 162 + } else {
156 th.setData({ 163 th.setData({
157 user_addr: addr, enterAddressPage: 0, 164 user_addr: addr, enterAddressPage: 0,
158 }); 165 });
@@ -167,7 +174,7 @@ Page({ @@ -167,7 +174,7 @@ Page({
167 store_id: oo.stoid, 174 store_id: oo.stoid,
168 status: 0 175 status: 0
169 }, 176 },
170 - success: function(su) { 177 + success: function (su) {
171 console.log("withdrawals"); 178 console.log("withdrawals");
172 if (su.data.code == 0) { 179 if (su.data.code == 0) {
173 var yuer = parseFloat(th.data.userinfo.user_money - 180 var yuer = parseFloat(th.data.userinfo.user_money -
@@ -189,8 +196,8 @@ Page({ @@ -189,8 +196,8 @@ Page({
189 pickup = null, 196 pickup = null,
190 distr_type = 0, 197 distr_type = 0,
191 exp_type = 0, 198 exp_type = 0,
192 - teamgroup=null,  
193 - th=this; 199 + teamgroup = null,
  200 + th = this;
194 //---获取订单--- 201 //---获取订单---
195 await getApp().request.promiseGet("/api/weshop/order/get/" + oo.stoid + "/" + ord, {}).then(res => { 202 await getApp().request.promiseGet("/api/weshop/order/get/" + oo.stoid + "/" + ord, {}).then(res => {
196 order = res.data.data; 203 order = res.data.data;
@@ -219,22 +226,22 @@ Page({ @@ -219,22 +226,22 @@ Page({
219 226
220 //---获取尾款价格--- 227 //---获取尾款价格---
221 await getApp().request.promiseGet("/api/weshop/teamgroup/page", { 228 await getApp().request.promiseGet("/api/weshop/teamgroup/page", {
222 - data:{store_id:oo.stoid,team_id:order.pt_prom_id,listno:order.pt_listno} 229 + data: { store_id: oo.stoid, team_id: order.pt_prom_id, listno: order.pt_listno }
223 }).then(res => { 230 }).then(res => {
224 teamgroup = res.data.data.pageData[0]; 231 teamgroup = res.data.data.pageData[0];
225 }); 232 });
226 233
227 - var jsarr=JSON.parse(teamgroup.jt_json);  
228 - var count=teamgroup.jt_ct_num; 234 + var jsarr = JSON.parse(teamgroup.jt_json);
  235 + var count = teamgroup.jt_ct_num;
229 //要计算尾款的价钱 236 //要计算尾款的价钱
230 - var price=0;  
231 - jsarr.forEach(function(value,index){  
232 - if(count>=value['rynum']) price=value['price']; 237 + var price = 0;
  238 + jsarr.forEach(function (value, index) {
  239 + if (count >= value['rynum']) price = value['price'];
233 }) 240 })
234 - var tail_money =(price*order_goods.goods_num-order['order_amount']-order['user_money']).toFixed(2); 241 + var tail_money = (price * order_goods.goods_num - order['order_amount'] - order['user_money']).toFixed(2);
235 242
236 tail_money = parseFloat(tail_money); 243 tail_money = parseFloat(tail_money);
237 - order.tail_money=tail_money; 244 + order.tail_money = tail_money;
238 245
239 //--判断物流-- 246 //--判断物流--
240 if (goods.distr_type) 247 if (goods.distr_type)
@@ -246,7 +253,7 @@ Page({ @@ -246,7 +253,7 @@ Page({
246 case 0: 253 case 0:
247 exp_type = 1; 254 exp_type = 1;
248 //-- 系统后台有设置要默认的 -- 255 //-- 系统后台有设置要默认的 --
249 - if(th.data.json_d.pickupway && th.data.json_d.pickupway==1) exp_type=0; 256 + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) exp_type = 0;
250 break; //自选 257 break; //自选
251 case 1: 258 case 1:
252 exp_type = 1; 259 exp_type = 1;
@@ -263,14 +270,14 @@ Page({ @@ -263,14 +270,14 @@ Page({
263 distr_type: distr_type, 270 distr_type: distr_type,
264 pickup: pickup, 271 pickup: pickup,
265 exp_type: exp_type, 272 exp_type: exp_type,
266 - goods:goods,  
267 - teamgroup:teamgroup 273 + goods: goods,
  274 + teamgroup: teamgroup
268 }); 275 });
269 276
270 //--计算物流-- 277 //--计算物流--
271 - if(exp_type==0){ 278 + if (exp_type == 0) {
272 th.calculate_wuliu(); 279 th.calculate_wuliu();
273 - }else{ 280 + } else {
274 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; 281 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money;
275 allpice = allpice.toFixed(2); 282 allpice = allpice.toFixed(2);
276 th.setData({ exp_price: 0, allpice: allpice }) 283 th.setData({ exp_price: 0, allpice: allpice })
@@ -278,17 +285,17 @@ Page({ @@ -278,17 +285,17 @@ Page({
278 }, 285 },
279 286
280 //--图片失败,默认图片-- 287 //--图片失败,默认图片--
281 - bind_bnerr: function(e) { 288 + bind_bnerr: function (e) {
282 var _errImg = e.target.dataset.errorimg; 289 var _errImg = e.target.dataset.errorimg;
283 var _errObj = {}; 290 var _errObj = {};
284 - _errObj[_errImg] = this.data.imgUrl+ "/miniapp/images/del/logo.jpg"; 291 + _errObj[_errImg] = this.data.imgUrl + "/miniapp/images/del/logo.jpg";
285 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; 292 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
286 }, 293 },
287 294
288 //-------------------获取物流--------------- 295 //-------------------获取物流---------------
289 get_wuliu(func) { 296 get_wuliu(func) {
290 - var th = this,to = getApp();  
291 - to.getwuliu(function(e) { 297 + var th = this, to = getApp();
  298 + to.getwuliu(function (e) {
292 th.setData({ 299 th.setData({
293 wu_arr: e 300 wu_arr: e
294 }) 301 })
@@ -297,8 +304,8 @@ Page({ @@ -297,8 +304,8 @@ Page({
297 }, 304 },
298 305
299 //--------点击选择---------- 306 //--------点击选择----------
300 - set_wuliu: function(e) {  
301 - var type = e.currentTarget.dataset.type,th=this; 307 + set_wuliu: function (e) {
  308 + var type = e.currentTarget.dataset.type, th = this;
302 this.setData({ 309 this.setData({
303 exp_type: type 310 exp_type: type
304 }); 311 });
@@ -307,12 +314,12 @@ Page({ @@ -307,12 +314,12 @@ Page({
307 314
308 //--计算物流的值-- 315 //--计算物流的值--
309 if (type == 0) { 316 if (type == 0) {
310 - th.calculate_wuliu();  
311 - }else{  
312 - var allpice= parseFloat(th.data.order.order_amount)  
313 - + parseFloat(th.data.order.user_money)  
314 - +parseFloat(th.data.order.tail_money);  
315 - allpice=allpice.toFixed(2); 317 + th.calculate_wuliu();
  318 + } else {
  319 + var allpice = parseFloat(th.data.order.order_amount)
  320 + + parseFloat(th.data.order.user_money)
  321 + + parseFloat(th.data.order.tail_money);
  322 + allpice = allpice.toFixed(2);
316 this.setData({ 323 this.setData({
317 allpice: allpice, exp_price: 0, 324 allpice: allpice, exp_price: 0,
318 }); 325 });
@@ -320,104 +327,104 @@ Page({ @@ -320,104 +327,104 @@ Page({
320 }, 327 },
321 328
322 //关闭支付 329 //关闭支付
323 - close_show_pay:function(){  
324 - this.setData({show_pay_type:0}); 330 + close_show_pay: function () {
  331 + this.setData({ show_pay_type: 0 });
325 }, 332 },
326 //--弹起支付框-- 333 //--弹起支付框--
327 - to_pay(){  
328 - //--物流支付时要有地址--  
329 - if (this.data.exp_type == 0 && this.data.user_addr == null) {  
330 - return getApp().my_warnning("请选择收货地址", 0, this);  
331 - } 334 + to_pay() {
  335 + //--物流支付时要有地址--
  336 + if (this.data.exp_type == 0 && this.data.user_addr == null) {
  337 + return getApp().my_warnning("请选择收货地址", 0, this);
  338 + }
332 339
333 - this.setData({show_pay_type:1}); 340 + this.setData({ show_pay_type: 1 });
334 }, 341 },
335 342
336 //选择支付方式 343 //选择支付方式
337 - set_pay_type:function(e){  
338 - var type=e.currentTarget.dataset.type;  
339 - this.to_pay_type(type); 344 + set_pay_type: function (e) {
  345 + var type = e.currentTarget.dataset.type;
  346 + this.to_pay_type(type);
340 }, 347 },
341 348
342 //--立即支付-- 349 //--立即支付--
343 - to_pay_type: function(ind) {  
344 - var th=this; 350 + to_pay_type: function (ind) {
  351 + var th = this;
345 352
346 - //--物流支付时要有地址--  
347 - if (th.data.exp_type == 0 && th.data.user_addr==null){  
348 - return getApp().my_warnning("请选择收货地址",0,th);  
349 - } 353 + //--物流支付时要有地址--
  354 + if (th.data.exp_type == 0 && th.data.user_addr == null) {
  355 + return getApp().my_warnning("请选择收货地址", 0, th);
  356 + }
350 357
351 - //---支付参数--  
352 - var dd = {  
353 - order_sn: th.data.order.order_sn,  
354 - order_id: th.data.order.order_id,  
355 - store_id: oo.stoid,  
356 - exp_type:th.data.exp_type,  
357 - user_id:t.globalData.user_id,  
358 - listno:th.data.order.pt_listno,  
359 - prom_id:th.data.order.pt_prom_id,  
360 - tail_pay_type:ind,//0微信支付 1余额支付  
361 - };  
362 -  
363 - if(th.data.exp_type==0){  
364 - var index=th.data.index;  
365 - dd.shipping_code=th.data.wu_arr[index].code;  
366 - dd.shipping_name=th.data.wu_arr[index].name;  
367 - dd.shipping_price=parseFloat(th.data.exp_price);  
368 - dd.addressid=th.data.user_addr.address_id;  
369 - } 358 + //---支付参数--
  359 + var dd = {
  360 + order_sn: th.data.order.order_sn,
  361 + order_id: th.data.order.order_id,
  362 + store_id: oo.stoid,
  363 + exp_type: th.data.exp_type,
  364 + user_id: t.globalData.user_id,
  365 + listno: th.data.order.pt_listno,
  366 + prom_id: th.data.order.pt_prom_id,
  367 + tail_pay_type: ind,//0微信支付 1余额支付
  368 + };
  369 +
  370 + if (th.data.exp_type == 0) {
  371 + var index = th.data.index;
  372 + dd.shipping_code = th.data.wu_arr[index].code;
  373 + dd.shipping_name = th.data.wu_arr[index].name;
  374 + dd.shipping_price = parseFloat(th.data.exp_price);
  375 + dd.addressid = th.data.user_addr.address_id;
  376 + }
370 377
371 - var arr=[];  
372 - arr.push(dd);  
373 - console.log(JSON.stringify(arr));  
374 - wx.request({  
375 - url: oo.url + '/api/weshop/order/pay/payTuanWk',  
376 - data: JSON.stringify(arr),  
377 - method: 'POST',  
378 - header: {  
379 - 'content-type': 'application/json'  
380 - },// 设置请求的 header  
381 - success: function (t) {  
382 -  
383 - //---用微信支付---  
384 - if(dd.tail_pay_type==0){  
385 - var n=t.data.data;  
386 - th.weixinPay(n,  
387 - function () {  
388 - var allmoney=th.data.allpice;  
389 - th.jumpPaymentPage(th.data.order.order_sn,allmoney);  
390 - },function () {  
391 - getApp().my_warnning("支付失败",0,th); 378 + var arr = [];
  379 + arr.push(dd);
  380 + console.log(JSON.stringify(arr));
  381 + wx.request({
  382 + url: oo.url + '/api/weshop/order/pay/payTuanWk',
  383 + data: JSON.stringify(arr),
  384 + method: 'POST',
  385 + header: {
  386 + 'content-type': 'application/json'
  387 + },// 设置请求的 header
  388 + success: function (t) {
  389 +
  390 + //---用微信支付---
  391 + if (dd.tail_pay_type == 0) {
  392 + var n = t.data.data;
  393 + th.weixinPay(n,
  394 + function () {
  395 + var allmoney = th.data.allpice;
  396 + th.jumpPaymentPage(th.data.order.order_sn, allmoney);
  397 + }, function () {
  398 + getApp().my_warnning("支付失败", 0, th);
  399 + })
  400 + } else {
  401 + if (t.data.code == 0) {
  402 + //---用余额支付---
  403 + getApp().my_warnning("支付成功", 1, th);
  404 + setTimeout(function () {
  405 + th.setData({ isclose: 0 });
  406 + wx.redirectTo({
  407 + url: "/pages/user/order_list/order_list"
392 }) 408 })
393 - }else {  
394 - if(t.data.code==0){  
395 - //---用余额支付---  
396 - getApp().my_warnning("支付成功",1,th);  
397 - setTimeout(function () {  
398 - th.setData({ isclose: 0 });  
399 - wx.redirectTo({  
400 - url: "/pages/user/order_list/order_list"  
401 - })  
402 - }, 1000)  
403 - }else{  
404 - getApp().my_warnning(t.data.msg,1,th);  
405 - } 409 + }, 1000)
  410 + } else {
  411 + getApp().my_warnning(t.data.msg, 1, th);
406 } 412 }
407 } 413 }
408 - }); 414 + }
  415 + });
409 }, 416 },
410 417
411 //----计算物流的钱---- 418 //----计算物流的钱----
412 calculate_wuliu() { 419 calculate_wuliu() {
413 - var to=getApp(),th=this;  
414 - to.getConfig2(function(ee) {  
415 - to.getwuliuprice(function(rs) { 420 + var to = getApp(), th = this;
  421 + to.getConfig2(function (ee) {
  422 + to.getwuliuprice(function (rs) {
416 var o_shipping_price = 0, 423 var o_shipping_price = 0,
417 goods_weight = -1, 424 goods_weight = -1,
418 goods_piece = -1, 425 goods_piece = -1,
419 - good=th.data.goods;  
420 - //-----------当地址不为空,且是物流时,计算物流费用---------- 426 + good = th.data.goods;
  427 + //-----------当地址不为空,且是物流时,计算物流费用----------
421 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { 428 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) {
422 switch (good['exp_sum_type']) { 429 switch (good['exp_sum_type']) {
423 case 1: 430 case 1:
@@ -435,52 +442,53 @@ Page({ @@ -435,52 +442,53 @@ Page({
435 goods_piece += th.data.order.order_goods['goods_num']; 442 goods_piece += th.data.order.order_goods['goods_num'];
436 break; 443 break;
437 } 444 }
438 - var code = th.data.wu_arr[th.data.index].code;  
439 - var freight_free = ee.freight_free; //全场满多少包邮  
440 - //--全部金额--  
441 - var allpice=th.data.order.order_amount+th.data.order.user_money+th.data.order.pt_tail_money;  
442 - var shipping_price =  
443 - th.calculatewuliu(code, o_shipping_price, goods_weight, 445 + var code = th.data.wu_arr[th.data.index].code;
  446 + var freight_free = ee.freight_free; //全场满多少包邮
  447 + //--全部金额--
  448 + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money;
  449 + var shipping_price =
  450 + th.calculatewuliu(code, o_shipping_price, goods_weight,
444 goods_piece, th.data.user_addr, freight_free, allpice, rs); 451 goods_piece, th.data.user_addr, freight_free, allpice, rs);
445 - var exp_price = parseFloat(shipping_price).toFixed(2);  
446 - allpice=parseFloat(exp_price)+parseFloat(allpice);  
447 - allpice=allpice.toFixed(2);  
448 -  
449 - exp_price = parseFloat(exp_price);  
450 - th.setData({ exp_price: exp_price,allpice:allpice })  
451 - }else {  
452 - var allpice=th.data.order.order_amount+th.data.order.user_money+th.data.order.tail_money;  
453 - allpice=allpice.toFixed(2);  
454 - th.setData({ exp_price: 0,allpice:allpice }) 452 + var exp_price = parseFloat(shipping_price).toFixed(2);
  453 + allpice = parseFloat(exp_price) + parseFloat(allpice);
  454 + allpice = allpice.toFixed(2);
  455 +
  456 + exp_price = parseFloat(exp_price);
  457 + th.setData({ exp_price: exp_price, allpice: allpice })
  458 + } else {
  459 + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money;
  460 + allpice = allpice.toFixed(2);
  461 + th.setData({ exp_price: 0, allpice: allpice })
455 } 462 }
456 }); 463 });
457 }); 464 });
458 }, 465 },
459 466
460 //----------------计算物流--------------- 467 //----------------计算物流---------------
461 - calculatewuliu:function(code, o_shipping_price, goods_weight,  
462 - goods_piece,user_addr, freight_free, o_price, rs){  
463 - var price =0,th=this;  
464 - price +=parseFloat(o_shipping_price); 468 + calculatewuliu: function (code, o_shipping_price, goods_weight,
  469 + goods_piece, user_addr, freight_free, o_price, rs) {
  470 + var price = 0, th = this;
  471 + price += parseFloat(o_shipping_price);
465 //如果是包邮 472 //如果是包邮
466 - if (freight_free > 0 && o_price > freight_free){ return 0;}  
467 - if (user_addr==null) { return 0; } 473 + if (freight_free > 0 && o_price > freight_free) { return 0; }
  474 + if (user_addr == null) { return 0; }
468 //计算物流的config item; 475 //计算物流的config item;
469 - var item=null; 476 + var item = null;
470 //先根据 镇 县 区找计算的config 477 //先根据 镇 县 区找计算的config
471 - item = th.get_wuliu_config(user_addr.district,code,rs);  
472 - if (item==null) item = th.get_wuliu_config(user_addr.city, code, rs);  
473 - if (item==null) item = th.get_wuliu_config(user_addr.province, code, rs);  
474 - if (item == null) item = th.get_wuliu_default(code,rs); 478 + item = th.get_wuliu_config(user_addr.district, code, rs);
  479 + if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs);
  480 + if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs);
  481 + if (item == null) item = th.get_wuliu_default(code, rs);
  482 + if (item == null) return o_shipping_price;
  483 + var fw_price = 0, fp_price = 0;
  484 + item = item.config;
475 if (item == null) return o_shipping_price; 485 if (item == null) return o_shipping_price;
476 - var fw_price = 0, fp_price=0;  
477 - item=item.config;  
478 //------按重量---------- 486 //------按重量----------
479 - if (goods_weight>0) {  
480 - fw_price =parseFloat(item['money']);  
481 - if (goods_weight > item['first_weight']){ 487 + if (goods_weight > 0) {
  488 + fw_price = parseFloat(item['money']);
  489 + if (goods_weight > item['first_weight']) {
482 var fw = goods_weight - item['first_weight']; 490 var fw = goods_weight - item['first_weight'];
483 - var n = Math.ceil(fw/item['second_weight']) 491 + var n = Math.ceil(fw / item['second_weight'])
484 fw_price = fw_price + n * parseFloat(item['add_money']); 492 fw_price = fw_price + n * parseFloat(item['add_money']);
485 } 493 }
486 } 494 }
@@ -493,89 +501,130 @@ Page({ @@ -493,89 +501,130 @@ Page({
493 fp_price = fp_price + m * parseFloat(item['add_piecemoney']); 501 fp_price = fp_price + m * parseFloat(item['add_piecemoney']);
494 } 502 }
495 } 503 }
496 - var rspice =parseFloat(price + fw_price + fp_price); 504 + var rspice = parseFloat(price + fw_price + fp_price);
497 return rspice; 505 return rspice;
498 }, 506 },
499 //------------循环获取config----------- 507 //------------循环获取config-----------
500 - get_wuliu_config:function(region_id,code,rs){  
501 - var item=null,rslist = rs.pageData;  
502 - for (var i = 0; i < rslist.length;i++){  
503 - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];} 508 + get_wuliu_config: function (region_id, code, rs) {
  509 + var item = null, rslist = rs.pageData;
  510 + for (var i = 0; i < rslist.length; i++) {
  511 + if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; }
504 } 512 }
505 return item; 513 return item;
506 }, 514 },
507 515
508 //---------------检查是否有收货地址------------------- 516 //---------------检查是否有收货地址-------------------
509 - checkAddressList: function() { 517 + checkAddressList: function () {
510 var t = this; 518 var t = this;
511 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 519 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
512 title: "请先填写或选择收货地址~", 520 title: "请先填写或选择收货地址~",
513 - success: function(a) { 521 + success: function (a) {
514 a.confirm ? t.enterAddressPage() : wx.navigateBack(); 522 a.confirm ? t.enterAddressPage() : wx.navigateBack();
515 }, 523 },
516 - fail: function() { 524 + fail: function () {
517 wx.navigateBack(); 525 wx.navigateBack();
518 } 526 }
519 }), !1); 527 }), !1);
520 }, 528 },
521 529
522 //--进入收货地址的编辑页面-- 530 //--进入收货地址的编辑页面--
523 - enterAddressPage: function() {  
524 - getApp().globalData.is_cart_old=1;  
525 - this.data.enterAddressPage =1, wx.navigateTo({ 531 + enterAddressPage: function () {
  532 + getApp().globalData.is_cart_old = 1;
  533 + this.data.enterAddressPage = 1, wx.navigateTo({
526 url: "/pages/user/address_list/address_list?is_back=1" 534 url: "/pages/user/address_list/address_list?is_back=1"
527 }); 535 });
528 }, 536 },
529 - 537 +
530 //------------循环获取config----------- 538 //------------循环获取config-----------
531 - get_wuliu_config:function(region_id,code,rs){  
532 - var item=null,rslist = rs.pageData;  
533 - for (var i = 0; i < rslist.length;i++){  
534 - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];} 539 + get_wuliu_config: function (region_id, code, rs) {
  540 + var item = null, rslist = rs.pageData;
  541 + for (var i = 0; i < rslist.length; i++) {
  542 + if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; }
535 } 543 }
536 return item; 544 return item;
537 }, 545 },
538 //-------循环获取config,code default------- 546 //-------循环获取config,code default-------
539 get_wuliu_default: function (code, rs) { 547 get_wuliu_default: function (code, rs) {
540 - var item = null, rslist=rs.pageData; 548 + var item = null, rslist = rs.pageData;
541 for (var i = 0; i < rslist.length; i++) { 549 for (var i = 0; i < rslist.length; i++) {
542 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; } 550 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }
543 } 551 }
544 return item; 552 return item;
545 }, 553 },
546 - 554 +
547 //-------获取物流选项------- 555 //-------获取物流选项-------
548 - bindPickerChange:function(e){  
549 - var ind = e.detail.value;  
550 - this.setData({ index: ind }); 556 + bindPickerChange: function (e) {
  557 + var ind = e.detail.value;
  558 + this.setData({ index: ind });
551 }, 559 },
552 560
553 //------支付成功页面-------- 561 //------支付成功页面--------
554 - jumpPaymentPage: function(order_sn,order_amount) { 562 + jumpPaymentPage: function (order_sn, order_amount) {
555 wx.setStorageSync("order:order_list:update", !0), wx.redirectTo({ 563 wx.setStorageSync("order:order_list:update", !0), wx.redirectTo({
556 url: "/pages/payment/pay_success/pay_success?order_sn=" + order_sn + "&type=1", 564 url: "/pages/payment/pay_success/pay_success?order_sn=" + order_sn + "&type=1",
557 }); 565 });
558 }, 566 },
559 567
560 //------调起支付框-------- 568 //------调起支付框--------
561 - weixinPay: function(n, success,fail) {  
562 - if(!n) return false;  
563 - var th=this; 569 + weixinPay: function (n, success, fail) {
  570 + if (!n) return false;
  571 + var th = this;
564 wx.requestPayment({ 572 wx.requestPayment({
565 timeStamp: String(n.timeStamp), 573 timeStamp: String(n.timeStamp),
566 nonceStr: n.nonceStr, 574 nonceStr: n.nonceStr,
567 package: n.packageValue, 575 package: n.packageValue,
568 signType: n.signType, 576 signType: n.signType,
569 paySign: n.paySign, 577 paySign: n.paySign,
570 - success: function(n) {  
571 - console.log(n), getApp().showSuccess("支付成功!");  
572 - "function" == typeof success && success(); 578 + success: function (n) {
  579 + console.log(n), getApp().showSuccess("支付成功!");
  580 + "function" == typeof success && success();
573 }, 581 },
574 - fail: function(n) {  
575 - console.log(n), "requestPayment:fail" == n.errMsg ? getApp().my_warnning("支付失败",0,th) : "requestPayment:fail cancel" == n.errMsg ? getApp().my_warnning("您已取消支付",0,th) : getApp().my_warnning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length),0,th),  
576 - "function" == typeof fail && fail(); 582 + fail: function (n) {
  583 + console.log(n), "requestPayment:fail" == n.errMsg ? getApp().my_warnning("支付失败", 0, th) : "requestPayment:fail cancel" == n.errMsg ? getApp().my_warnning("您已取消支付", 0, th) : getApp().my_warnning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length), 0, th),
  584 + "function" == typeof fail && fail();
577 } 585 }
578 }); 586 });
579 - } 587 + },
  588 +
  589 +
  590 + //// 开启物流的弹窗
  591 + show_wu_arr: function (e) {
  592 + this.setData({ open_express: 1 });
  593 + },
  594 +
  595 + // 关闭物流的弹窗
  596 + close_express: function () {
  597 + this.setData({ open_express: 0 });
  598 + },
  599 + // 选择物流
  600 + click_express_name: function (e) {
  601 + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
  602 + var index = e.currentTarget.dataset.idxe;
  603 + var ob = { is_express: index, is_shipping_code: shippingcode, index: index };
  604 + this.setData(ob);
  605 + },
  606 +
  607 + //点击确定物流
  608 + determine_expres: function (e) {
  609 + this.setData({ open_express: 0 });
  610 + this.calculatePrice2();
  611 + },
  612 + //设置默认物流
  613 + select_default_logistics: function () {
  614 + var th = this;
  615 + var is_shipping_code = this.data.is_shipping_code
  616 + getApp().request.put("/api/weshop/users/update", {
  617 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
  618 + success: function (rse) {
  619 + if (rse.data.code == 0) {
  620 + getApp().globalData.userInfo.def_exp_code = is_shipping_code;
  621 + th.setData({ open_express: 0 });
  622 + //----计算此时购物车的价格----
  623 + if (th.data.is_b_now == 1) th.calculatePrice2();
  624 + else th.calculatePrice();
  625 + }
  626 + }
  627 + })
  628 + },
580 629
581 }) 630 })
582 \ No newline at end of file 631 \ No newline at end of file
pages/cart/cart_wk/cart_wk.wxml
1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs> 1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs>
  2 +
  3 + <!-- 先选择配送方式,2021.7修改 -->
  4 + <view class="tab-container" wx:if="{{kt_type!=3 || is_normal==1}}">
  5 + <view class="tab-wrapper">
  6 + <view hidden="{{distr_type==2}}" bindtap='set_wuliu' data-type='1' class="tab {{exp_type == 1? 'active':''}}"
  7 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
  8 +
  9 + <view hidden="{{distr_type==1}}" bindtap='set_wuliu' data-type='0' class="tab {{exp_type== 0 ? 'active':''}}"
  10 + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view>
  11 +
  12 + </view>
  13 + </view>
  14 +
  15 +
2 <!----要进行判断地址是否显示----> 16 <!----要进行判断地址是否显示---->
3 <view bindtap="enterAddressPage" class="user-mes mgt20" 17 <view bindtap="enterAddressPage" class="user-mes mgt20"
4 hidden='{{exp_type==1 }}'> 18 hidden='{{exp_type==1 }}'>
@@ -24,10 +38,10 @@ @@ -24,10 +38,10 @@
24 <!-- <view class="border-img"><image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/tt.png"></image></view> --> 38 <!-- <view class="border-img"><image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/tt.png"></image></view> -->
25 </view> 39 </view>
26 40
27 -<!--头部--> 41 +<!--头部门店显示-->
28 <view class='top bdr_t-14 flex'> 42 <view class='top bdr_t-14 flex'>
29 <image class="t_img" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'></image> 43 <image class="t_img" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'></image>
30 - <view class='t_wz'>美得得超市{{pickup.pickup_name}}</view> 44 + <view class='t_wz'>{{pickup.pickup_name}}</view>
31 </view> 45 </view>
32 46
33 <!--商品图片显示--> 47 <!--商品图片显示-->
@@ -49,8 +63,7 @@ @@ -49,8 +63,7 @@
49 63
50 <!--取货方式--> 64 <!--取货方式-->
51 65
52 -<view class='quhou bdr_b-14'>  
53 - 66 +<!-- <view class='quhou bdr_b-14'>
54 <view bindtap="set_wuliu" data-type="1" class='qu_fs' wx:if="{{distr_type==0 || distr_type==1}}"> 67 <view bindtap="set_wuliu" data-type="1" class='qu_fs' wx:if="{{distr_type==0 || distr_type==1}}">
55 <image wx:if="{{exp_type==0}}" src='{{imgUrl}}/miniapp/images/kon.png'></image> 68 <image wx:if="{{exp_type==0}}" src='{{imgUrl}}/miniapp/images/kon.png'></image>
56 <image wx:if="{{exp_type==1}}" src='{{imgUrl}}/miniapp/images/dd.png'></image> 69 <image wx:if="{{exp_type==1}}" src='{{imgUrl}}/miniapp/images/dd.png'></image>
@@ -62,13 +75,13 @@ @@ -62,13 +75,13 @@
62 <image wx:if="{{exp_type==1}}" src='{{imgUrl}}/miniapp/images/kon.png'></image> 75 <image wx:if="{{exp_type==1}}" src='{{imgUrl}}/miniapp/images/kon.png'></image>
63 <text class='qu_wz'>快递邮寄</text> 76 <text class='qu_wz'>快递邮寄</text>
64 </view> 77 </view>
  78 +</view> -->
65 79
66 -</view>  
67 -<view class="use-item bdr_b-14" wx:if='{{exp_type==0}}'>  
68 - <view>使用物流:</view>  
69 - <picker bindchange="bindPickerChange" value="{{index}}" range="{{wu_arr}}" range-key="name">  
70 - <view >{{wu_arr[index].name}}</view>  
71 - </picker> 80 +<view class="use-item bdr_b-14 jc_sb" wx:if='{{exp_type==0 && !is_default_logistics}}'>
  81 + <view>选择物流:</view>
  82 + <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;">
  83 + <view class="logistics-name">{{wu_arr[index].name}}</view><view class="xc-right"></view>
  84 + </view>
72 </view> 85 </view>
73 86
74 <!--成团人数--> 87 <!--成团人数-->
@@ -125,4 +138,49 @@ @@ -125,4 +138,49 @@
125 </view> 138 </view>
126 </block> 139 </block>
127 140
128 -<warn id="warn"></warn>  
129 \ No newline at end of file 141 \ No newline at end of file
  142 +<warn id="warn"></warn>
  143 +
  144 +<!----弹起选择物流名的列表---->
  145 +<view wx:if='{{open_express==1}}' >
  146 + <view class="cover-layer flex-center " bindtap='close_express'>
  147 + </view>
  148 +
  149 + <view class="cx-popup radius {{open_express==1?'up' : 'down'}}" >
  150 + <view class="tops flex">
  151 + <view class="top-content fs32">
  152 + <view>
  153 + 选择物流名字
  154 + </view>
  155 + </view>
  156 + <view class="close-frame" bindtap='close_express' >
  157 + <view class="xc-close-express">×</view>
  158 + </view>
  159 + </view>
  160 + <view class="express_list">
  161 + <view wx:for="{{wu_arr}}" wx:for-item="express_list" wx:for-index="idx">
  162 + <view class="express_list_frame" bindtap="click_express_name"
  163 + data-shippingcode="{{express_list.shipping_code}}"
  164 + data-name="{{express_list.name}}" data-idxe="{{idx}}">
  165 +
  166 + <block wx:if="{{is_express==idx}}">
  167 + <view class="circle white xc-hook fs20 red-b"><text>Γ</text></view>
  168 + </block>
  169 + <block wx:else>
  170 + <view class="circle xc-hooks"></view>
  171 + </block>
  172 + <view class="fs30">{{express_list.name}}</view>
  173 +
  174 + </view>
  175 + </view>
  176 + </view>
  177 + <view class="flex click-buttem" >
  178 + <view class="xc-determine flex-center" bindtap="determine_expres">
  179 + <view class="flex-vertical t-c">确定</view>
  180 + </view>
  181 + <view class="xc-confirms flex-center" bindtap="select_default_logistics">
  182 + <view class="flex-vertical t-c">设为默认</view>
  183 + </view>
  184 + </view>
  185 +
  186 + </view >
  187 +</view>
pages/cart/cart_wk/cart_wk.wxss
  1 +page{ color: #333;}
1 .bdr_t-14 { 2 .bdr_t-14 {
2 border-top-left-radius: 14rpx; 3 border-top-left-radius: 14rpx;
3 border-top-right-radius: 14rpx; 4 border-top-right-radius: 14rpx;
@@ -329,5 +330,184 @@ page { @@ -329,5 +330,184 @@ page {
329 .anniu_view>view{width: 50%; border-right:1rpx solid #ededed;} 330 .anniu_view>view{width: 50%; border-right:1rpx solid #ededed;}
330 331
331 332
  333 +.tab-container {
  334 + font-size: 28rpx;
  335 + margin-top: 20rpx;
  336 + display: flex;
  337 +}
  338 +
  339 +.tab-wrapper {
  340 + background-color: #ccc;
  341 + display: flex;
  342 + border-radius: 40rpx;
  343 + overflow: hidden;
  344 +}
  345 +
  346 +.tab {
  347 + padding: 20rpx 30rpx;
  348 +
  349 +}
  350 +
  351 +
  352 +.tab.active {
  353 + background-color: white;
  354 + border-radius: 40rpx;
  355 +}
  356 +
  357 +.xc-right{
  358 + width:20rpx;
  359 + height:20rpx;
  360 + border-top:2rpx solid #666;
  361 + border-right:2rpx solid #666;
  362 + transform:rotate(45deg);
  363 + display:inline-block;
  364 +}
  365 +
  366 +
  367 +/* 自定义弹出窗口 */
  368 +.cx-popup{
  369 + width:100%;
  370 + height:880rpx;
  371 + background: #fff;
  372 + z-index: 35;
  373 + border-top-left-radius: 20rpx;
  374 + border-top-right-radius: 20rpx;
  375 + position:fixed;
  376 + bottom:0;
  377 + left: 0;
  378 + /* padding-bottom: 25rpx; */
  379 +}
  380 +
  381 +.cx-popup .top{
  382 + width:95%;
  383 + height:100rpx;
  384 + border-bottom:3rpx solid #ddd;
  385 + margin: auto;
  386 + margin-top: 30rpx;
  387 +
  388 +}
  389 +.xc-top-content{
  390 + width: 93%;
  391 + height:85rpx;
  392 + padding-top: 30rpx;
  393 + font-size: 34rpx;
  394 + font-weight: 600;
  395 +
  396 +}
  397 +
  398 +.xc-close{
  399 + width: 37rpx;
  400 +height: 37rpx;
  401 +border-radius: 50%;
  402 +border: 3rpx solid #333;
  403 +text-align: center;
  404 +line-height: 34rpx;
  405 +font-size: 29rpx;
  406 +color: #333;
  407 +
  408 +}
  409 +
  410 +.xc-confirm {
  411 + width: 50%;
  412 + border-radius: 50rpx;
  413 + height: 80rpx;
  414 + margin:0 auto;
  415 + background:#d60021;
  416 + color:#fff;
  417 + font-size:28rpx;
  418 + margin-top: 28rpx;
  419 +}
  420 +
  421 +.up{ animation: up .7s; }
  422 +.down{ animation: down 1s; }
  423 +@keyframes up { 0% { transform: translateY(550rpx); } 100% { transform: translateY(0); } }
  424 +@keyframes down { 0% { transform: translateY(0); } 100% { transform: translateY(550rpx); } }
  425 +
  426 +
  427 +.xc-close-express{
  428 + width: 40rpx;
  429 +height: 40rpx;
  430 +border-radius: 50%;
  431 +border: 3rpx solid #333;
  432 +text-align: center;
  433 +font-size:32rpx;
  434 +line-height: 38rpx;
  435 +color: #333;
  436 +margin-top: 5rpx;
  437 +}
  438 +.cx-popup .tops{
  439 + width: 100%;
  440 +height: 145rpx;
  441 +border-bottom: 3rpx solid #eee;
  442 +
  443 +}
  444 +.top-content {
  445 + width: 82%;
  446 +padding-top: 33px;
  447 +height: 100%;
  448 +padding-left: 40rpx;
  449 +}
  450 +.close-frame{
  451 + margin-top: 30rpx;
  452 +
  453 +}
  454 +
  455 +.xc-hook {
  456 +width: 33rpx;
  457 +height: 33rpx;
  458 +transform: rotate(-135deg);
  459 +line-height: 35rpx;
  460 +text-align: center;
  461 +margin-right: 20rpx
  462 +
  463 +
  464 +}
  465 +.xc-hooks {
  466 +width: 30rpx;
  467 +height: 30rpx;
  468 +border: 1rpx solid #999;
  469 +margin-right: 20rpx;
  470 +}
  471 +.express_list_frame{
  472 + display: flex;
  473 +height: 80rpx;
  474 +align-items: center;
  475 +padding-left: 40rpx;
  476 +border-bottom: 1rpx solid #eee;
  477 +
  478 +}
  479 +.express_list{
  480 + width: 100%;
  481 + height: 65%;
  482 + overflow-y: auto;
  483 + margin-bottom: 40rpx;
  484 +
  485 +}
  486 +.xc-confirms {
  487 + box-sizing: border-box;
  488 + width: 40%;
  489 + border-radius: 50rpx;
  490 + height: 80rpx;
  491 + margin:0 auto;
  492 + font-size:28rpx;
  493 + background: #fff;
  494 + color: #333;
  495 + border: 2rpx solid #333;
  496 +}
332 497
  498 +.determine-frame{
  499 + width: 100%;
  500 + height: 130rpx;
  501 +
  502 +}
  503 +.xc-determine{
  504 + height: 80rpx;
  505 + width: 40%;
  506 + border-radius: 50rpx;
  507 +background: #d60021;
  508 +color: #fff;
  509 +font-size: 28rpx;
  510 +margin: 0 auto;
  511 +
  512 +}
333 513
pages/goods/goodsInfo/buy_integral.wxml
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 59
60 <!--商品的属性项目--> 60 <!--商品的属性项目-->
61 <view class="xc-goods-attribute"> 61 <view class="xc-goods-attribute">
62 - <view hidden="{{ismend==1}}" class="spec-name">商品属性</view> 62 + <view hidden="{{ismend==1}}" class="spec-name">商品规格</view>
63 <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;"> 63 <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;">
64 <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g"> 64 <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g">
65 {{item.gg}} 65 {{item.gg}}
pages/goods/goodsInfo/buy_integral_normal.wxml
@@ -60,9 +60,9 @@ @@ -60,9 +60,9 @@
60 60
61 <!--商品的属性项目--> 61 <!--商品的属性项目-->
62 <view class="xc-goods-attribute"> 62 <view class="xc-goods-attribute">
63 - <view hidden="{{ismend==1}}" class="spec-name">商品属性</view> 63 + <view hidden="{{ismend==1}}" class="spec-name">商品规格</view>
64 <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;"> 64 <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;">
65 - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g"> 65 + <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-nor="1" data-gid='{{item.goods_id}}' wx:for="{{sku_g_pt}}" wx:key="sku_g">
66 {{item.gg}} 66 {{item.gg}}
67 </view> 67 </view>
68 </view> 68 </view>
@@ -78,6 +78,20 @@ @@ -78,6 +78,20 @@
78 </view> 78 </view>
79 </view> 79 </view>
80 80
  81 +
  82 + <!-- 提示再买多少优惠 -->
  83 + <view style="margin-top: 35rpx;color:#333;font-size:28rpx;" wx:if="{{hui_condition}}">
  84 + 再买{{hui_condition.need}}
  85 + <text wx:if="{{hui_condition.money}}">,免{{hui_condition.money}}元</text>
  86 + <text wx:if="{{hui_condition.sale}}">,打{{hui_condition.sale}}折</text>
  87 + <text wx:if="{{hui_condition.past==1}}">,包邮</text>
  88 + <text wx:if="{{hui_condition.intValue>0}}">,送{{hui_condition.intValue}}积分</text>
  89 + <text wx:if="{{hui_condition.couponId>0}}">,送优惠券</text>
  90 + <text wx:if="{{hui_condition.gift_id>0}}">,送赠品</text>
  91 + <text wx:if="{{hui_condition.lb_id>0}}">,送礼包</text>
  92 + </view>
  93 +
  94 +
81 <!-- 按钮部分 --> 95 <!-- 按钮部分 -->
82 <view class="spec-cart-btns"> 96 <view class="spec-cart-btns">
83 97
pages/goods/goodsInfo/buy_pt.wxml
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 </view> 74 </view>
75 <!----商品的属性项目----> 75 <!----商品的属性项目---->
76 <view> 76 <view>
77 - <view hidden="{{ismend==1}}" class="spec-name">商品属性</view> 77 + <view hidden="{{ismend==1}}" class="spec-name">商品规格</view>
78 <block wx:if="{{is_normal==0}}"> 78 <block wx:if="{{is_normal==0}}">
79 <view hidden="{{ismend==1}}" class="flex"> 79 <view hidden="{{ismend==1}}" class="flex">
80 <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g">{{item.gg}} 80 <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g">{{item.gg}}
@@ -84,8 +84,8 @@ @@ -84,8 +84,8 @@
84 84
85 <block wx:else> 85 <block wx:else>
86 <view hidden="{{ismend==1}}" class="flex"> 86 <view hidden="{{ismend==1}}" class="flex">
87 - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g">{{item.gg}}  
88 - </view> 87 + <view class="spec_bt {{sele_g.goods_id==item.goods_id?'act':''}}"
  88 + bindtap="sele_spec" data-nor="1" data-gid='{{item.goods_id}}' wx:for="{{sku_g_pt}}" wx:key="sku_g">{{item.gg}}</view>
89 </view> 89 </view>
90 </block> 90 </block>
91 <view class="clear"></view> 91 <view class="clear"></view>
@@ -107,11 +107,25 @@ @@ -107,11 +107,25 @@
107 <view class="b_num" hidden="{{ismend==1}}" style="margin-top: 20rpx"> 107 <view class="b_num" hidden="{{ismend==1}}" style="margin-top: 20rpx">
108 <view>购买数量</view> 108 <view>购买数量</view>
109 <view class="count"> 109 <view class="count">
110 - <view bindtap="{{goodsInputNum <= 1 ? '':'subCartNum_inte'}}" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view> 110 + <view bindtap="{{goodsInputNum <= 1 ? '':'subCartNum'}}" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view>
111 <input bindblur="inputCartNum" class="xc-val-fream" type="number" value="{{goodsInputNum}}"></input> 111 <input bindblur="inputCartNum" class="xc-val-fream" type="number" value="{{goodsInputNum}}"></input>
112 <view bindtap="addCartNum" class="add">+</view> 112 <view bindtap="addCartNum" class="add">+</view>
113 </view> 113 </view>
114 </view> 114 </view>
  115 +
  116 +
  117 + <!-- 提示再买多少优惠 -->
  118 + <view style="margin-top: 35rpx;color:#333;font-size:28rpx;" wx:if="{{hui_condition && is_normal==1}}">
  119 + 再买{{hui_condition.need}}
  120 + <text wx:if="{{hui_condition.money}}">,免{{hui_condition.money}}元</text>
  121 + <text wx:if="{{hui_condition.sale}}">,打{{hui_condition.sale}}折</text>
  122 + <text wx:if="{{hui_condition.past==1}}">,包邮</text>
  123 + <text wx:if="{{hui_condition.intValue>0}}">,送{{hui_condition.intValue}}积分</text>
  124 + <text wx:if="{{hui_condition.couponId>0}}">,送优惠券</text>
  125 + <text wx:if="{{hui_condition.gift_id>0}}">,送赠品</text>
  126 + <text wx:if="{{hui_condition.lb_id>0}}">,送礼包</text>
  127 + </view>
  128 +
115 129
116 <view class="clear"></view> 130 <view class="clear"></view>
117 <!---当选取门店的时候会显示门店的选项----> 131 <!---当选取门店的时候会显示门店的选项---->
pages/goods/goodsInfo/goodsInfo.js
@@ -779,24 +779,16 @@ Page({ @@ -779,24 +779,16 @@ Page({
779 ee.check_is_youhui(ee.data.gid); 779 ee.check_is_youhui(ee.data.gid);
780 780
781 t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); 781 t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
782 - var txt = (t.data.data.shop_price / t.data.data.market_price * 10).toFixed(2).toString();  
783 -  
784 -  
785 - if(txt != 0) {  
786 - if(txt.indexOf('.') != -1) {  
787 - var arrtxt = txt.split('.');  
788 - if(arrtxt[1].length == 1 && arrtxt[1][0] == 0) {  
789 - txt = txt.slice(0,-2);  
790 - };  
791 -  
792 - if(arrtxt[1].length == 2 && arrtxt[1][1] == 0) {  
793 - txt = txt.slice(0,-1);  
794 - };  
795 - };  
796 - } else {  
797 - txt = 0;  
798 - }  
799 - 782 +
  783 + var cur_price=t.data.data.shop_price;
  784 + if(getApp().globalData.userInfo && getApp().globalData.userInfo.card_field){
  785 + var cfile=getApp().globalData.userInfo.card_field;
  786 + if(t.data.data[cfile]){
  787 + cur_price=t.data.data[cfile];
  788 + }
  789 + }
  790 + var txt =(cur_price / t.data.data.market_price * 10).toFixed(2).toString();
  791 + txt=parseFloat(txt);
800 792
801 t.data.data['disc'] = txt; 793 t.data.data['disc'] = txt;
802 794
@@ -1262,9 +1254,9 @@ Page({ @@ -1262,9 +1254,9 @@ Page({
1262 1254
1263 //如果是积分够,is_integral_normal就要有积分购普通购买字段 1255 //如果是积分够,is_integral_normal就要有积分购普通购买字段
1264 if(o.prom_type==4){ 1256 if(o.prom_type==4){
1265 - newd.is_integral_normal=1; 1257 + newd.is_integral_normal=1;
1266 } 1258 }
1267 - 1259 +
1268 //如果有线下取价 1260 //如果有线下取价
1269 if(o.offline_price){ 1261 if(o.offline_price){
1270 newd.offline_price=o.offline_price; 1262 newd.offline_price=o.offline_price;
@@ -1504,14 +1496,32 @@ Page({ @@ -1504,14 +1496,32 @@ Page({
1504 // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, { 1496 // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, {
1505 // action: "buy_now" 1497 // action: "buy_now"
1506 // }), 1498 // }),
1507 - s.set_b_now(e); 1499 +
1508 if(e.prom_type==4){ 1500 if(e.prom_type==4){
  1501 + s.set_b_now(e);
1509 var url="/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id; 1502 var url="/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id;
1510 getApp().goto(url); 1503 getApp().goto(url);
1511 }else{ 1504 }else{
1512 - wx.redirectTo({  
1513 - url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,  
1514 - }); 1505 + //要判断积分购的普通购买有没有参加优惠活动
  1506 + if(e.is_integral_normal==1){
  1507 + this.check_nor_promgood(e.goods_id,function(res){
  1508 + if(res && res.cat_id){
  1509 + e.prom_type=3;
  1510 + e.prom_id=res.cat_id
  1511 + }
  1512 + s.set_b_now(e);
  1513 + wx.redirectTo({
  1514 + url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
  1515 + });
  1516 +
  1517 + })
  1518 + }else{
  1519 + s.set_b_now(e);
  1520 + wx.redirectTo({
  1521 + url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
  1522 + });
  1523 + }
  1524 +
1515 } 1525 }
1516 }, 1526 },
1517 1527
@@ -1700,6 +1710,13 @@ Page({ @@ -1700,6 +1710,13 @@ Page({
1700 closeSpecModal: function() { 1710 closeSpecModal: function() {
1701 if(this.data.openSpecModal_pt && this.data.is_normal){ 1711 if(this.data.openSpecModal_pt && this.data.is_normal){
1702 this.get_sto(); 1712 this.get_sto();
  1713 + this.setData({
  1714 + sele_g:this.data.data,
  1715 + gid:this.data.data.goods_id
  1716 + })
  1717 +
  1718 + this.sele_spec_chech_activity();
  1719 +
1703 } 1720 }
1704 1721
1705 this.setData({ 1722 this.setData({
@@ -2088,7 +2105,8 @@ Page({ @@ -2088,7 +2105,8 @@ Page({
2088 more_spec:gd.more_spec, 2105 more_spec:gd.more_spec,
2089 isonsale: 1, 2106 isonsale: 1,
2090 is_on_sale: 1, 2107 is_on_sale: 1,
2091 - pageSize:500 2108 + pageSize:500,
  2109 + orderField: 'sort'
2092 } 2110 }
2093 }).then(res => { 2111 }).then(res => {
2094 var e = res; 2112 var e = res;
@@ -2102,25 +2120,48 @@ Page({ @@ -2102,25 +2120,48 @@ Page({
2102 for (var i = 0; i < arrdata.length; i++) { 2120 for (var i = 0; i < arrdata.length; i++) {
2103 var goodsinfo=arrdata[i],prom=null; 2121 var goodsinfo=arrdata[i],prom=null;
2104 if (goodsinfo.goods_id != g_id) { 2122 if (goodsinfo.goods_id != g_id) {
2105 - if(goodsinfo.prom_type==1){  
2106 - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+goodsinfo.prom_id,{  
2107 - }).then(res=>{  
2108 - if(res.data.code==0) prom=res.data.data;  
2109 - })  
2110 - }  
2111 - if(goodsinfo.prom_type==6){  
2112 - await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+goodsinfo.prom_id,{  
2113 - }).then(res=>{  
2114 - if(res.data.code==0) prom=res.data.data;  
2115 - })  
2116 - } 2123 +
  2124 + switch(goodsinfo.prom_type){
  2125 + case 1:
  2126 + await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+goodsinfo.prom_id,{
  2127 + }).then(res=>{
  2128 + if(res.data.code==0) prom=res.data.data;
  2129 + })
  2130 +
  2131 + break;
  2132 + case 6:
  2133 + await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+goodsinfo.prom_id,{
  2134 + }).then(res=>{
  2135 + if(res.data.code==0) prom=res.data.data;
  2136 + })
  2137 +
  2138 + break;
  2139 + case 2:
  2140 + await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/"+os.stoid+"/"+goodsinfo.goods_id+"/"+goodsinfo.prom_id,{
  2141 + }).then(res=>{
  2142 + if(res.data.code==0) prom=res.data.data;
  2143 + })
  2144 + break;
  2145 + case 4:
  2146 + await getApp().request.promiseGet("/api/weshop/integralbuy/getActInfo/"+os.stoid+"/"+goodsinfo.goods_id+"/"+goodsinfo.prom_id,{
  2147 + }).then(res=>{
  2148 + if(res.data.code==0) prom=res.data.data;
  2149 + })
  2150 + break
  2151 +
  2152 + }
  2153 +
  2154 +
2117 } 2155 }
2118 //---如果有活动,不算在一起--- 2156 //---如果有活动,不算在一起---
2119 if(prom){ 2157 if(prom){
2120 - if(prom.is_end==0 && prom.end_time>now && prom.start_time<now){  
2121 - continue;  
2122 - } 2158 + if(goodsinfo.prom_type==1 || goodsinfo.prom_type==6){
  2159 + if(prom.is_end==0 && prom.end_time>now && prom.start_time<now) continue;
  2160 + }else{
  2161 + continue;
  2162 + }
2123 } 2163 }
  2164 +
2124 2165
2125 var item = arrdata[i],gg = ""; 2166 var item = arrdata[i],gg = "";
2126 if(item.goods_spec=="null" || item.goods_spec==null) item.goods_spec=""; 2167 if(item.goods_spec=="null" || item.goods_spec==null) item.goods_spec="";
@@ -2168,7 +2209,13 @@ Page({ @@ -2168,7 +2209,13 @@ Page({
2168 sele_spec: function(e) { 2209 sele_spec: function(e) {
2169 var that=this,ee=this,th=this; 2210 var that=this,ee=this,th=this;
2170 var gid = e.currentTarget.dataset.gid; 2211 var gid = e.currentTarget.dataset.gid;
  2212 + var nor=e.currentTarget.dataset.nor;
  2213 +
2171 var sku_g = this.data.sku_g; 2214 var sku_g = this.data.sku_g;
  2215 + if(nor){
  2216 + sku_g = this.data.sku_g_pt;
  2217 + }
  2218 +
2172 var item = null; 2219 var item = null;
2173 for (var i in sku_g) { 2220 for (var i in sku_g) {
2174 if (sku_g[i].goods_id == gid) { 2221 if (sku_g[i].goods_id == gid) {
@@ -2180,12 +2227,13 @@ Page({ @@ -2180,12 +2227,13 @@ Page({
2180 sele_g: item, 2227 sele_g: item,
2181 gid: gid 2228 gid: gid
2182 }); 2229 });
  2230 +
  2231 +
2183 2232
2184 - that.check_is_youhui(gid)  
2185 - 2233 + that.check_is_youhui(gid,that.data.is_normal);
  2234 +
2186 var ty=0; 2235 var ty=0;
2187 -  
2188 - this.get_sto(); 2236 + this.get_sto(that.data.is_normal);
2189 2237
2190 2238
2191 //默认门店要拿下门店库存 2239 //默认门店要拿下门店库存
@@ -2241,6 +2289,16 @@ Page({ @@ -2241,6 +2289,16 @@ Page({
2241 } 2289 }
2242 }) 2290 })
2243 } 2291 }
  2292 +
  2293 + if(goodsinfo.prom_type==4){
  2294 + await getApp().request.promiseGet("/api/weshop/integralbuy/getActInfo/"+os.stoid+"/"+goodsinfo.goods_id+"/"+goodsinfo.prom_id,{
  2295 + }).then(res=>{
  2296 + if(res.data.code==0){
  2297 + prom=res.data.data;
  2298 + }
  2299 + })
  2300 + }
  2301 +
2244 //----------如果有活动,并且在进行中,就不计算线下库存--------------- 2302 //----------如果有活动,并且在进行中,就不计算线下库存---------------
2245 var now=ut.gettimestamp(); 2303 var now=ut.gettimestamp();
2246 if(prom){ 2304 if(prom){
@@ -3334,7 +3392,8 @@ Page({ @@ -3334,7 +3392,8 @@ Page({
3334 openSpecModal_pt: 1 3392 openSpecModal_pt: 1
3335 }); 3393 });
3336 }); 3394 });
3337 - } 3395 + }
  3396 + th.check_is_youhui(th.data.gid,1);
3338 } else { 3397 } else {
3339 3398
3340 //拼单商品从这里进,先判断有没有买过商品, 3399 //拼单商品从这里进,先判断有没有买过商品,
@@ -3560,8 +3619,19 @@ Page({ @@ -3560,8 +3619,19 @@ Page({
3560 newd['pick_name'] = th.data.sto_sele_name; 3619 newd['pick_name'] = th.data.sto_sele_name;
3561 newd['pick_dis'] = th.data.sto_sele_distr; 3620 newd['pick_dis'] = th.data.sto_sele_distr;
3562 newd['is_normal'] = th.data.is_normal; 3621 newd['is_normal'] = th.data.is_normal;
3563 -  
3564 - th.buyNow_pt(newd); 3622 +
  3623 + if(newd['is_normal']){
  3624 + newd['is_pd_normal']=1;
  3625 + //判断一下有没有全局优惠活动
  3626 + th.check_nor_promgood(newd.goods_id,function(e){
  3627 + if(e && e.act_id){
  3628 + newd['prom_type']=3;
  3629 + newd['prom_id']=e.act_id;
  3630 + }
  3631 + th.buyNow(newd)
  3632 + })
  3633 + }
  3634 + else th.buyNow_pt(newd);
3565 }) 3635 })
3566 }, 3636 },
3567 //----------立即购买_pt----------- 3637 //----------立即购买_pt-----------
@@ -4025,7 +4095,7 @@ Page({ @@ -4025,7 +4095,7 @@ Page({
4025 //---市场价划掉--- 4095 //---市场价划掉---
4026 context.setFillStyle("gray") 4096 context.setFillStyle("gray")
4027 context.setFontSize(22 * unit) 4097 context.setFontSize(22 * unit)
4028 - context.fillText("¥" + th.data.data.market_price, 426 * unit, 213 * unit); 4098 + context.fillText("¥" + th.data.data.market_price.toFixed(2), 426 * unit, 213 * unit);
4029 context.setStrokeStyle('gray'); 4099 context.setStrokeStyle('gray');
4030 context.setLineWidth(1 * unit); 4100 context.setLineWidth(1 * unit);
4031 context.moveTo(426 * unit, 206 * unit); 4101 context.moveTo(426 * unit, 206 * unit);
@@ -5058,33 +5128,53 @@ Page({ @@ -5058,33 +5128,53 @@ Page({
5058 }, 5128 },
5059 5129
5060 //---检查有没有优惠活动--- 5130 //---检查有没有优惠活动---
5061 - check_is_youhui:function(gid){  
5062 - var th=this;  
5063 - //调用接口判断订单优惠,  
5064 - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+gid+"/0", {}).then(res => {  
5065 - if(res.data.code==0){  
5066 - var r_data=res.data.data;  
5067 - var max=0,min=0;  
5068 - if(r_data.collocationList){  
5069 - for(var i in r_data.collocationList){  
5070 - if(max==0) max=r_data.collocationList[i].price;  
5071 - if(min==0) min=r_data.collocationList[i].price;  
5072 -  
5073 - if(max<parseFloat(r_data.collocationList[i].price)) max=r_data.collocationList[i].price;  
5074 - if(min>parseFloat(r_data.collocationList[i].price)) min=r_data.collocationList[i].price;  
5075 - }  
5076 - r_data.collocationPromList.max=(max+th.data.data.shop_price).toFixed(2);  
5077 - r_data.collocationPromList.min=(min+th.data.data.shop_price).toFixed(2);  
5078 - }  
5079 - th.setData({  
5080 - order_prom:r_data.promOrder,  
5081 - collocationGoods:r_data.collocationPromList,  
5082 - prom_goods:r_data.promGoodsLists,  
5083 - }) 5131 + check_is_youhui:function(gid,is_nor){
  5132 + var th=this;
  5133 + //如果是普通购买的时候,要进行调用
  5134 + if(is_nor){
  5135 + getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid+"/"+gid, {
  5136 + success:function(res){
  5137 + if(res.data.code==0){
  5138 + var r_data=res.data.data;
  5139 + th.setData({
  5140 + prom_goods:r_data.promGoodsLists,
  5141 + })
  5142 + th.is_show_more_buy();
  5143 + }
  5144 + },
  5145 + })
5084 5146
5085 - th.is_show_more_buy();  
5086 - }  
5087 - }) 5147 + }else{
  5148 + //调用接口判断订单优惠,
  5149 + getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+gid+"/0", {
  5150 + success:function(res){
  5151 + if(res.data.code==0){
  5152 + var r_data=res.data.data;
  5153 + var max=0,min=0;
  5154 + if(r_data.collocationList){
  5155 + for(var i in r_data.collocationList){
  5156 + if(max==0) max=r_data.collocationList[i].price;
  5157 + if(min==0) min=r_data.collocationList[i].price;
  5158 +
  5159 + if(max<parseFloat(r_data.collocationList[i].price)) max=r_data.collocationList[i].price;
  5160 + if(min>parseFloat(r_data.collocationList[i].price)) min=r_data.collocationList[i].price;
  5161 + }
  5162 + r_data.collocationPromList.max=(max+th.data.data.shop_price).toFixed(2);
  5163 + r_data.collocationPromList.min=(min+th.data.data.shop_price).toFixed(2);
  5164 + }
  5165 + th.setData({
  5166 + order_prom:r_data.promOrder,
  5167 + collocationGoods:r_data.collocationPromList,
  5168 + prom_goods:r_data.promGoodsLists,
  5169 + })
  5170 + th.is_show_more_buy();
  5171 + }
  5172 + }
  5173 +
  5174 + })
  5175 + }
  5176 +
  5177 +
5088 }, 5178 },
5089 5179
5090 closePoster() { 5180 closePoster() {
@@ -5212,13 +5302,13 @@ Page({ @@ -5212,13 +5302,13 @@ Page({
5212 if(item.prom_type==1){ 5302 if(item.prom_type==1){
5213 if(item.condition>this.data.goodsInputNum) { 5303 if(item.condition>this.data.goodsInputNum) {
5214 con=item; 5304 con=item;
5215 - con.need=(item.condition-this.data.goodsInputNum)+"件"; 5305 + con.need=(item.condition-this.data.goodsInputNum).toFixed(2)+"件";
5216 break; 5306 break;
5217 } 5307 }
5218 }else{ 5308 }else{
5219 if(item.condition>all_price){ 5309 if(item.condition>all_price){
5220 con=item; 5310 con=item;
5221 - con.need=(item.condition-all_price)+"元"; 5311 + con.need=(item.condition-all_price).toFixed(2)+"元";
5222 break; 5312 break;
5223 } 5313 }
5224 } 5314 }
@@ -5235,8 +5325,20 @@ Page({ @@ -5235,8 +5325,20 @@ Page({
5235 }, 5325 },
5236 //-- 积分购普通购买 -- 5326 //-- 积分购普通购买 --
5237 go_pay_integral_normal:function(){ 5327 go_pay_integral_normal:function(){
5238 - this.get_sto(1)  
5239 - this.setData({openSpecModal_inte_normal:1}); 5328 + var th=this;
  5329 + if (th.data.sku_g_pt) {
  5330 + this.get_sto(1)
  5331 + this.setData({openSpecModal_inte_normal:1});
  5332 + }else{
  5333 + th.get_sto(1);
  5334 + th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function() {
  5335 + th.setData({
  5336 + is_normal: 1,
  5337 + openSpecModal_inte_normal:1
  5338 + });
  5339 + });
  5340 + }
  5341 + this.check_is_youhui(th.data.gid,1);
5240 }, 5342 },
5241 5343
5242 closeSpecModal_inte:function(){ 5344 closeSpecModal_inte:function(){
@@ -5244,6 +5346,14 @@ Page({ @@ -5244,6 +5346,14 @@ Page({
5244 } , 5346 } ,
5245 closeSpecModal_inte_normal:function(){ 5347 closeSpecModal_inte_normal:function(){
5246 this.setData({openSpecModal_inte_normal:0}); 5348 this.setData({openSpecModal_inte_normal:0});
  5349 + //要进行还原
  5350 + this.get_sto();
  5351 + this.setData({
  5352 + sele_g:this.data.data,
  5353 + gid:this.data.data.goods_id
  5354 + })
  5355 +
  5356 + this.sele_spec_chech_activity();
5247 }, 5357 },
5248 5358
5249 addCart_inte:function(t){ 5359 addCart_inte:function(t){
@@ -5288,4 +5398,19 @@ Page({ @@ -5288,4 +5398,19 @@ Page({
5288 }); 5398 });
5289 }, 5399 },
5290 5400
  5401 + //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动
  5402 + check_nor_promgood(goods_id,back){
  5403 + getApp().request.get("/api/weshop/goods/getGoodsPromNormal/"+os.stoid+"/"+goods_id,{
  5404 + success:function(res){
  5405 + if(res.data.code==0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length>0){
  5406 + var obj={
  5407 + act_id:res.data.data.promGoodsLists[0].prom_id,
  5408 + }
  5409 + back(obj);
  5410 + }else{
  5411 + back(0)
  5412 + }
  5413 + }
  5414 + })
  5415 + }
5291 }); 5416 });
pages/goods/goodsInfo/goodsInfo.wxml
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 <view class="flex fs35 xc-qtsign">¥</view> 93 <view class="flex fs35 xc-qtsign">¥</view>
94 <view class="fs50 val">{{prom_price}}</view> 94 <view class="fs50 val">{{prom_price}}</view>
95 </view> 95 </view>
96 - <view class="word-line fs20 xc-qtunit-price">零售价¥{{data.market_price}}</view> 96 + <view class="word-line fs20 xc-qtunit-price">零售价¥{{filters.toFix(data.market_price,2)}}</view>
97 </view> 97 </view>
98 <view class="abs white xc-nanber"> 98 <view class="abs white xc-nanber">
99 <text class="fs22">已拼{{prom_act.buy_num}}件</text> 99 <text class="fs22">已拼{{prom_act.buy_num}}件</text>
@@ -249,7 +249,7 @@ @@ -249,7 +249,7 @@
249 <text class="rel_txt" wx:if="{{prom_integral && prom_price}}">+</text> 249 <text class="rel_txt" wx:if="{{prom_integral && prom_price}}">+</text>
250 <text class="rel_txt" wx:if="{{prom_price}}" >{{filters.toFix(prom_price,2)}}元</text> 250 <text class="rel_txt" wx:if="{{prom_price}}" >{{filters.toFix(prom_price,2)}}元</text>
251 <text class="rel_txt" wx:if="{{!prom_integral && !prom_price}}">0积分</text> 251 <text class="rel_txt" wx:if="{{!prom_integral && !prom_price}}">0积分</text>
252 - <text class="rel_txt fs22" decode="{{true}}" space="{{true}}" style="color: #999; text-decoration: line-through;">&nbsp;&nbsp;&nbsp;零售价:¥{{data.market_price}}</text> 252 + <text class="rel_txt fs22" decode="{{true}}" space="{{true}}" style="color: #999; text-decoration: line-through;">&nbsp;&nbsp;&nbsp;零售价:¥{{filters.toFix(data.market_price,2)}}</text>
253 </view> 253 </view>
254 254
255 <!-- 这个是分享按钮 --> 255 <!-- 这个是分享按钮 -->
@@ -297,12 +297,12 @@ @@ -297,12 +297,12 @@
297 </view> 297 </view>
298 <text class="rel yuan">¥</text>{{filters.toFix(data[card_field],2)}} 298 <text class="rel yuan">¥</text>{{filters.toFix(data[card_field],2)}}
299 <view class='yj' style="top:35rpx"> 299 <view class='yj' style="top:35rpx">
300 - <text>零售价:¥{{data.market_price}}</text> 300 + <text>零售价:¥{{filters.toFix(data.market_price,2)}}</text>
301 </view> 301 </view>
302 </block> 302 </block>
303 <block wx:else> 303 <block wx:else>
304 <text class="yuan">¥</text>{{filters.toFix(data.shop_price,2)}} 304 <text class="yuan">¥</text>{{filters.toFix(data.shop_price,2)}}
305 - <view class='yj'><text>零售价:¥{{data.market_price}}</text></view> 305 + <view class='yj'><text>零售价:¥{{filters.toFix(data.market_price,2)}}</text></view>
306 </block> 306 </block>
307 </view> 307 </view>
308 308
@@ -398,7 +398,7 @@ @@ -398,7 +398,7 @@
398 <view class="flex jc_sb"> 398 <view class="flex jc_sb">
399 <view class="flex" style="align-items: baseline;"> 399 <view class="flex" style="align-items: baseline;">
400 <view class="flex xc-price-frame"><text class="fs30">¥</text>{{prom_price}}</view> 400 <view class="flex xc-price-frame"><text class="fs30">¥</text>{{prom_price}}</view>
401 - <view class="word-line fs24">零售价¥{{data.market_price}}</view> 401 + <view class="word-line fs24">零售价¥{{filters.toFix(data.market_price,2)}}</view>
402 </view> 402 </view>
403 403
404 <!-- 这个是分享按钮 --> 404 <!-- 这个是分享按钮 -->
pages/team/team_show/team_show.wxml
@@ -242,7 +242,7 @@ @@ -242,7 +242,7 @@
242 </view> 242 </view>
243 <!-- 商品的属性项目 --> 243 <!-- 商品的属性项目 -->
244 <view> 244 <view>
245 - <view hidden="{{ismend==1}}" class="spec-name">商品属性</view> 245 + <view hidden="{{ismend==1}}" class="spec-name">商品规格</view>
246 <block> 246 <block>
247 <view hidden="{{ismend==1}}" class="flex"> 247 <view hidden="{{ismend==1}}" class="flex">
248 <view class="spec_bt act" >{{goods.gg}} 248 <view class="spec_bt act" >{{goods.gg}}