Commit f4fd33aab752f67d9dcfe71ef5cfa23d3e18f792
1 parent
2aa5a2a2
预售全额
Showing
4 changed files
with
4140 additions
and
0 deletions
packageC/pages/presell/cart/cart2.js
0 → 100644
1 | +var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), | |
2 | + s = require("../../../../utils/util.js"), ut = s, to = getApp(); | |
3 | +var oo = t.globalData.setting, os = oo; | |
4 | +var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
5 | +var util_pay = require("../../../../utils/pay.js"); | |
6 | + | |
7 | + | |
8 | +Page({ | |
9 | + data: { | |
10 | + is_b_now:1, //立即购买 | |
11 | + url: t.globalData.setting.url, | |
12 | + resourceUrl: t.globalData.setting.resourceUrl, | |
13 | + imgUrl: t.globalData.setting.imghost, | |
14 | + goods: null, | |
15 | + order: null, | |
16 | + orderPrices: null, | |
17 | + coupons: null, | |
18 | + coupon: null, | |
19 | + invoiceToggle: !0, | |
20 | + payWithUserMoney: !0, | |
21 | + payWithPoints: !0, | |
22 | + maxWord: 0, | |
23 | + enterAddressPage: !1, | |
24 | + firstEnter: !0, | |
25 | + //页面获取的参数 | |
26 | + param: null, | |
27 | + //提交订单的格式 | |
28 | + formData: { | |
29 | + order_amount: 0,//支付金额 | |
30 | + total_amount: 0,//总价 | |
31 | + all_price: 0,//商品卖的总价 | |
32 | + pay_points: 0,//使用积分 | |
33 | + user_money: 0,//使用余额 | |
34 | + couponCode: "",//使用优惠券(多单就用逗号隔开) | |
35 | + shipping_price: 0,//物流费用 | |
36 | + }, | |
37 | + /*-----------当是购物车结算的时候-------------*/ | |
38 | + cartlist: null, | |
39 | + old_cartlist: null, | |
40 | + cartlist_y: null, //购物车原始列表 | |
41 | + js_use_money: 0, //是否使用余额 | |
42 | + is_all_zt: 1, //是否全部都是自提 | |
43 | + | |
44 | + /*----------------立即购买---------------------*/ | |
45 | + is_b_now: 0, //0是购物车结算 1立即购买 | |
46 | + bn_goods: null, //立即购买时候的调用商品 | |
47 | + bn_use_money: 0,//是否使用余额 | |
48 | + bn_exp_type: 1, //0是物流 1自提 | |
49 | + bn_pick: 0, //选择的门店 | |
50 | + bn_pickname: "", //选择的门店名称 | |
51 | + bn_t_exp_t: 0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流 | |
52 | + | |
53 | + bn_plus_cut_price: 0, //显示等级卡会优惠多少钱 | |
54 | + /*------------------------*/ | |
55 | + user_addr: null,//物流 | |
56 | + userinfo: null, //获取会员 | |
57 | + /*----------物流选择--------*/ | |
58 | + wu_arr: null, | |
59 | + index: 0, | |
60 | + w_sele_index: 0, | |
61 | + | |
62 | + //判断页面是返回回来的还是 首次进入的 | |
63 | + isclose: 1, | |
64 | + //申请提现的金额 | |
65 | + txmon: 0, | |
66 | + yuer: 0, | |
67 | + //提交中,不重复提交 | |
68 | + is_summit_ing: 0, | |
69 | + //--更优惠券抵用有关,立即购买的,如果是购物车,就要把相应的值,写入cartlist数组中-- | |
70 | + ckeck_quan_price: 0, | |
71 | + check_quan_price_list: '', | |
72 | + check_quan_ware_list: '', | |
73 | + | |
74 | + // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid | |
75 | + //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} | |
76 | + using_quan: {}, | |
77 | + open_quan: 0, | |
78 | + //选择的券列表 | |
79 | + selected_quan_list: null, | |
80 | + //选择的券的门店 | |
81 | + selected_quan_pick: null, | |
82 | + is_close_quan: 0, | |
83 | + disabled: 0, | |
84 | + open_express: 0,//控制选择物流名列表 的属性 | |
85 | + | |
86 | + is_express: 0, //选中物流的属性 | |
87 | + expres_name: "", //点击选定 | |
88 | + isopen: 0, //券的说明 | |
89 | + is_coupon: null, //选择券的控制属性 | |
90 | + is_shipping_code: "",//插入用户默认地址 | |
91 | + wu_arr_txt: "", //要更新的物流的字段 | |
92 | + | |
93 | + sales_rules: 1, //默认是显示线上库存 | |
94 | + isget_by_quan: {}, //是否调用了接口获取包邮券 | |
95 | + get_by_quan_list: null, //立即购买的 | |
96 | + get_by_quan_list_cart: {}, //购物车的 | |
97 | + by_quan_list_cart: null, //点击选择的包邮列表 | |
98 | + | |
99 | + //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券 | |
100 | + is_no_by: {}, | |
101 | + is_by: {}, | |
102 | + is_quan_by: {}, | |
103 | + //--购买赠送的商品-- | |
104 | + buy_now_gift_goods: null, | |
105 | + //--订单优惠-- | |
106 | + order_prom: {}, | |
107 | + //-- 购物车优惠活动 -- | |
108 | + prom_goods_map: {}, | |
109 | + //-- order_prom_list -- | |
110 | + order_prom_list_cart: null, | |
111 | + | |
112 | + ispt_goods: 0, //是否平摊至单品,0要平摊 1不平摊 | |
113 | + | |
114 | + rank_switch: 0, //是不是开同等级卡 | |
115 | + show_card: null, //显示的等级卡 | |
116 | + card_name: '', //显示的卡的名称 | |
117 | + card_cut_price: null,//减价多少钱 | |
118 | + | |
119 | + show_submit: 0, //提交按钮变正常显示 | |
120 | + is_get_offline: 1, | |
121 | + | |
122 | + tabs: ['门店自提', '快递邮寄'], | |
123 | + currentTabIndex: 1, | |
124 | + | |
125 | + in_zhact_gdmap:{}, //不同门店参与同一活动的限购 | |
126 | + hid_inp:1, | |
127 | + user_note:{}, | |
128 | + }, | |
129 | + onLoad: function (t) { | |
130 | + wx.setNavigationBarTitle({title: "填写订单",}) | |
131 | + var th = this; | |
132 | + //清理一下,确保最新的系统配置 | |
133 | + getApp().globalData.config2 = null; | |
134 | + //清空is_pick_up | |
135 | + getApp().request.put("/api/weshop/useraddress/updatePickUp", { | |
136 | + data: {user_id: getApp().globalData.user_id, is_pickup: 0}, | |
137 | + success: function (s) { | |
138 | + } | |
139 | + }); | |
140 | + | |
141 | + }, | |
142 | + onUnload: function () { | |
143 | + this.setData({isclose: 1}) | |
144 | + }, | |
145 | + onHide: function () { | |
146 | + this.setData({ | |
147 | + isget_by_quan: {}, | |
148 | + is_no_by: {}, | |
149 | + is_by: {} | |
150 | + }) | |
151 | + }, | |
152 | + | |
153 | + //----------子页返回父页触发---------- | |
154 | + onShow: function () { | |
155 | + var th = this; | |
156 | + th.setData({show_submit: 0}); //让提交先掩藏 | |
157 | + th.data.g_cart_q_time = null; | |
158 | + | |
159 | + if (th.data.isclose == 0) { | |
160 | + wx.navigateTo({ | |
161 | + url: "/pages/index/index/index" | |
162 | + }) | |
163 | + | |
164 | + } else { | |
165 | + this.getuser_addr(function (ie) { | |
166 | + | |
167 | + //地址切换要把包邮券清空 | |
168 | + if (!th.data.user_addr || !ie || th.data.user_addr.address_id != ie.address_id) { | |
169 | + var using_quan = th.data.using_quan; | |
170 | + for (var i in using_quan) { | |
171 | + var item = using_quan[i]; | |
172 | + if (item.isby == 1) { | |
173 | + var ob = {}, txt = "using_quan[" + i + "]"; | |
174 | + ob[txt] = {}; | |
175 | + th.setData(ob); | |
176 | + } | |
177 | + } | |
178 | + th.data.isget_by_quan = {}; | |
179 | + } | |
180 | + | |
181 | + | |
182 | + th.data.prom_goods_map = {}; | |
183 | + th.data.is_summit_ing = 0; | |
184 | + //更换地址回来要重新调用计算价钱的接口 | |
185 | + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { | |
186 | + th.setData({user_addr: ie}); | |
187 | + if (th.data.is_b_now == 1) { | |
188 | + if (th.data.bn_goods) { | |
189 | + th.setData({add_back: 1}); | |
190 | + //th.calculatePrice2(); | |
191 | + } | |
192 | + } else { | |
193 | + if (th.data.cartlist) { | |
194 | + th.setData({add_back: 1}); | |
195 | + //th.calculatePrice(); | |
196 | + } | |
197 | + } | |
198 | + } else { | |
199 | + th.setData({user_addr: ie}); | |
200 | + } | |
201 | + var going = 0; | |
202 | + | |
203 | + }); | |
204 | + var is_card_back = getApp().globalData.is_card_back; | |
205 | + //--更新默认地址--,看一下是不是跳到地址页面,同时也不是购买等级卡返回的,这里很重要,否则会重新更新收货物流公司 | |
206 | + if (!getApp().globalData.is_cart_old && !is_card_back && !getApp().globalData.plus_buy_back) { | |
207 | + this.update_code(); | |
208 | + } else { | |
209 | + getApp().globalData.is_cart_old = 0; | |
210 | + getApp().globalData.plus_buy_back = 0; | |
211 | + } | |
212 | + } | |
213 | + | |
214 | + //先获取是否有关闭使用优惠券 | |
215 | + getApp().getConfig2(function (ee) { | |
216 | + var json_d = JSON.parse(ee.switch_list); | |
217 | + th.data.json_d = json_d; | |
218 | + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | |
219 | + var is_default_logistics = json_d.is_default_logistics; | |
220 | + | |
221 | + th.setData({ | |
222 | + is_close_quan: json_d.is_close_quan, | |
223 | + sales_rules: ee.sales_rules, | |
224 | + rank_switch: json_d.rank_switch, | |
225 | + is_default_logistics: is_default_logistics | |
226 | + }); | |
227 | + | |
228 | + var rank_switch = json_d.rank_switch; | |
229 | + var max_price = -1; | |
230 | + var show_card = null; | |
231 | + var name = ""; | |
232 | + //如果有开等级卡的时候, | |
233 | + //因为都是调接口,要返回在计算 | |
234 | + if (rank_switch == 2) { | |
235 | + //-- 获取所有的等级卡, -- | |
236 | + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, | |
237 | + {}).then(res => { | |
238 | + if (res.data.code == 0) { | |
239 | + var plusCard = res.data.data; | |
240 | + //-- 循环判断,拿到最贵的那张卡 -- | |
241 | + for (var ih in plusCard) { | |
242 | + if (plusCard[ih].IsStopBuy == true) { | |
243 | + continue; | |
244 | + } | |
245 | + if (max_price < 0) { | |
246 | + max_price = plusCard[ih].CardFee; | |
247 | + name = 'card' + plusCard[ih]['CorrPrice']; | |
248 | + show_card = plusCard[ih]; | |
249 | + } else { | |
250 | + if (max_price < plusCard[ih].CardFee) { | |
251 | + max_price = plusCard[ih].CardFee; | |
252 | + name = 'card' + plusCard[ih]['CorrPrice']; | |
253 | + show_card = plusCard[ih]; | |
254 | + } | |
255 | + } | |
256 | + } | |
257 | + | |
258 | + if (show_card) { | |
259 | + name = name.toLowerCase(); | |
260 | + th.setData({card_name: name, show_card: show_card}) | |
261 | + } | |
262 | + } | |
263 | + //-----先获取物流,再获取用户信息,再展示页面----- | |
264 | + th.get_wuliu(th.get_info(th.show_page)); | |
265 | + }) | |
266 | + } else { | |
267 | + //-----先获取物流,再获取用户信息,再展示页面----- | |
268 | + th.get_wuliu(th.get_info(th.show_page)); | |
269 | + } | |
270 | + | |
271 | + }, 1); | |
272 | + | |
273 | + //值在这里换 | |
274 | + getApp().globalData.plus_buy_back = 0; | |
275 | + }, | |
276 | + | |
277 | + //-------------------获取物流--------------- | |
278 | + get_wuliu(func) { | |
279 | + var th = this; | |
280 | + to.getwuliu(function (e) { | |
281 | + //系统是是否开启了默认的物流 | |
282 | + if (th.data.is_default_logistics) { | |
283 | + //如果第一个不是开启默认,说明要让用户自己选 | |
284 | + if (!e[0].is_default) { | |
285 | + th.setData({is_default_logistics: 0}); | |
286 | + } | |
287 | + } | |
288 | + th.setData({wu_arr: e}) | |
289 | + typeof func == "function" && func(); | |
290 | + }) | |
291 | + }, | |
292 | + //------获取会员信息-----先获取用户信息,在进行下一步--- | |
293 | + get_info: function (func) { | |
294 | + var user_id = t.globalData.user_id; | |
295 | + to.auth.get_u(func); | |
296 | + }, | |
297 | + | |
298 | + //------获取会员收货地址----- | |
299 | + getuser_addr: function (func) { | |
300 | + var th = this; | |
301 | + a.get("/api/weshop/useraddress/page", { | |
302 | + data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, | |
303 | + success: function (su) { | |
304 | + /*--- | |
305 | + var user_addr=[ | |
306 | + { 'address_id': 882, 'user_id': 2661, 'consignee': '测试测试测', 'province': 3102, 'city': 3431, 'district': 3466, | |
307 | + 'address': 'ed', 'more_address': '山西-长治市-襄垣县-虎(音si)亭镇', 'mobile': 13012345678,'is_default':1}, | |
308 | + ];---*/ | |
309 | + var item = null; | |
310 | + if (su.data.code == 0 && su.data.data && su.data.data.pageData) { | |
311 | + var user_addr = su.data.data.pageData; | |
312 | + var def_item = null; | |
313 | + for (var i = 0; i < user_addr.length; i++) { | |
314 | + if (user_addr[i]['is_default'] == 1) { | |
315 | + def_item = user_addr[i]; | |
316 | + } | |
317 | + if (user_addr[i]['is_pickup'] == 1) { | |
318 | + item = user_addr[i]; | |
319 | + } | |
320 | + } | |
321 | + | |
322 | + if (item == null) item = def_item; | |
323 | + if (item == null) item = user_addr[0]; | |
324 | + } | |
325 | + | |
326 | + if (item == undefined) item = null; | |
327 | + if (!item) th.setData({user_addr: null}); //地址为空的时候,要清空,因为返回的时候,有缓存 | |
328 | + | |
329 | + func(item); | |
330 | + } | |
331 | + }); | |
332 | + }, | |
333 | + | |
334 | + //----------------展示页面,是再获取用户信息之后-------------- | |
335 | + show_page: function () { | |
336 | + var th = this; | |
337 | + //th.setData({ userinfo: getApp().globalData.userInfo,}); //这个余额被缓存了 | |
338 | + | |
339 | + //会员的信息,要获取最新 | |
340 | + var user = getApp().globalData.userInfo; | |
341 | + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { | |
342 | + data: {r: Math.random()}, | |
343 | + success: function (e) { | |
344 | + getApp().globalData.userInfo = e.data.data; | |
345 | + th.setData({userinfo: e.data.data}); | |
346 | + | |
347 | + //选获取地址 | |
348 | + th.getuser_addr(function (addr) { | |
349 | + th.setData({user_addr: addr}); | |
350 | + //--------------------------立即购买------------------ | |
351 | + //读取门店 | |
352 | + to.get_allsto(function (e) { | |
353 | + th.setData({allsto: e}); | |
354 | + //获取立即购买的商品信息 | |
355 | + th.get_buy_goods(); | |
356 | + }); | |
357 | + | |
358 | + }); | |
359 | + | |
360 | + //获取提现金额 | |
361 | + getApp().request.get("/api/weshop/withdrawals/summoney", { | |
362 | + data: {user_id: to.globalData.user_id, store_id: oo.stoid, status: 0}, | |
363 | + success: function (su) { | |
364 | + if (su.data.code == 0) { | |
365 | + var yuer = parseFloat(th.data.userinfo.user_money - | |
366 | + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); | |
367 | + th.setData({txmon: su.data.data.summoney, yuer: yuer}); | |
368 | + } | |
369 | + } | |
370 | + }); | |
371 | + | |
372 | + }, | |
373 | + }); | |
374 | + | |
375 | + }, | |
376 | + | |
377 | + //-----获取立即购买的商品信息,入口---- | |
378 | + get_buy_goods: function (e) { | |
379 | + var th = this; | |
380 | + th.data.gg = to.get_b_now(); | |
381 | + //--------如果goods_id一样,就是要立即购买----- | |
382 | + getApp().request.get("/api/weshop/goods/get/" + oo.stoid + "/" + th.data.gg.goods_id, { | |
383 | + success: async function (t) { | |
384 | + var gd = t.data.data; | |
385 | + if (!gd) return false; | |
386 | + | |
387 | + t.data.data.original_img = oo.imghost + t.data.data.original_img; | |
388 | + t.data.data['buynum'] = th.data.gg.goods_num; | |
389 | + var distr_t = 0, et = 0 | |
390 | + if (t.data.data.distr_type == 0) { | |
391 | + distr_t = th.data.gg.pick_dis; | |
392 | + } else { | |
393 | + distr_t = t.data.data.distr_type; | |
394 | + } | |
395 | + | |
396 | + switch (distr_t) { | |
397 | + case 0: | |
398 | + et = 1; | |
399 | + //-- 系统后台有设置要默认的 -- | |
400 | + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0; | |
401 | + break; | |
402 | + case 1: | |
403 | + et = 1; | |
404 | + break; | |
405 | + case 2: | |
406 | + et = 0; | |
407 | + break; | |
408 | + } | |
409 | + | |
410 | + | |
411 | + var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
412 | + if (et == 0 && def_exp_code) { | |
413 | + for (var k = 0; k < th.data.wu_arr.length; k++) { | |
414 | + var item = th.data.wu_arr[k]; | |
415 | + if (def_exp_code == item.code) { | |
416 | + m_wind = k; | |
417 | + } | |
418 | + } | |
419 | + } | |
420 | + | |
421 | + if (th.data.bn_goods) { | |
422 | + et = th.data.bn_exp_type; | |
423 | + m_wind = th.data.index; | |
424 | + } | |
425 | + | |
426 | + //---是不是购买等级卡成功的返回---等级卡显示的判断--- | |
427 | + var is_card_back = getApp().globalData.is_card_back; | |
428 | + if (is_card_back) { | |
429 | + th.data.card_name = th.data.userinfo.card_field; | |
430 | + th.data.gg.goods_price = gd[th.data.card_name]; | |
431 | + getApp().globalData.is_card_back = 0; | |
432 | + th.setData({card_cut_price: 0}); | |
433 | + //如果是秒杀的返回 | |
434 | + if (gd.prom_type == 1) gd.prom_type = 0; | |
435 | + } else { | |
436 | + //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格 | |
437 | + //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 -- | |
438 | + if (!th.data.gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && th.data.gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) { | |
439 | + var cut_p = (th.data.gg.goods_price - gd[th.data.card_name]) * th.data.gg.goods_num; | |
440 | + th.setData({card_cut_price: cut_p}); | |
441 | + } | |
442 | + } | |
443 | + | |
444 | + //定义变量 | |
445 | + var gg = th.data.gg,act = null,prelist = null; | |
446 | + var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id; | |
447 | + await getApp().request.promiseGet(url, {}).then(res => { | |
448 | + if (res.data.code == 0) { | |
449 | + act = res.data.data; | |
450 | + } | |
451 | + }) | |
452 | + if (!act) { | |
453 | + wx.showToast({title: "未找到活动", icon: 'none', duration: 3000}); | |
454 | + return false; | |
455 | + } | |
456 | + if (act.is_end==1 ) { | |
457 | + wx.showToast({title:'活动已经结束' , icon: 'none', duration: 3000}); | |
458 | + return false; | |
459 | + } | |
460 | + if( ut.gettimestamp()>act.end_time){ | |
461 | + wx.showToast({title:"活动定金支付时间已过期" , icon: 'none', duration: 3000}); | |
462 | + return false; | |
463 | + } | |
464 | + | |
465 | + var url = "/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + gg.presell_list_id; | |
466 | + await getApp().request.promiseGet(url, {}).then(res => { | |
467 | + if (res.data.code == 0) { | |
468 | + prelist = res.data.data; | |
469 | + } | |
470 | + }) | |
471 | + if (!prelist) { | |
472 | + wx.showToast({title: "未找到商品", icon: 'none', duration: 3000}); | |
473 | + return false; | |
474 | + } | |
475 | + | |
476 | + if(act.is_usecoupon==1){ | |
477 | + th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; | |
478 | + th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; | |
479 | + th.data.check_quan_ware_list = t.data.data.erpwareid + ""; | |
480 | + } | |
481 | + | |
482 | + //这个位置要拿活动的预售价 | |
483 | + t.data.data.shop_price = prelist.presell_money; | |
484 | + th.setData({ | |
485 | + bn_goods: t.data.data, | |
486 | + bn_pickname: gg.pick_name, | |
487 | + bn_exp_type: et, | |
488 | + index: m_wind, | |
489 | + bn_pick: gg.pick_id, | |
490 | + bn_t_exp_t: distr_t, | |
491 | + bn_exp_type: et, | |
492 | + act:act | |
493 | + }); | |
494 | + | |
495 | + //计算价格 | |
496 | + th.calculatePrice2(); | |
497 | + //获取优惠券,如果有券的钱,就调用 | |
498 | + if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); | |
499 | + | |
500 | + | |
501 | + }, | |
502 | + }); | |
503 | + | |
504 | + }, | |
505 | + | |
506 | + //---------------检查是否有收货地址------------------- | |
507 | + checkAddressList: function () { | |
508 | + var t = this; | |
509 | + return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ | |
510 | + title: "请先填写或选择收货地址~", | |
511 | + success: function (a) { | |
512 | + a.confirm ? t.enterAddressPage() : wx.navigateBack(); | |
513 | + }, | |
514 | + fail: function () { | |
515 | + wx.navigateBack(); | |
516 | + } | |
517 | + }), !1); | |
518 | + }, | |
519 | + showInvoice: function () { | |
520 | + this.setData({ | |
521 | + invoiceToggle: !this.data.invoiceToggle | |
522 | + }); | |
523 | + }, | |
524 | + keyUpChangePay1: function (t) { | |
525 | + this.setData({ | |
526 | + payWithUserMoney: !(t.detail.value.length > 0) | |
527 | + }); | |
528 | + }, | |
529 | + keyUpChangePay2: function (t) { | |
530 | + this.setData({ | |
531 | + payWithPoints: !(t.detail.value.length > 0) | |
532 | + }); | |
533 | + }, | |
534 | + keyUpChangeNum: function (t) { | |
535 | + var index = t.currentTarget.dataset.index; | |
536 | + var txt="user_note."+index; | |
537 | + this.setData({ | |
538 | + maxWord: t.detail.value.length, | |
539 | + [txt]: t.detail.value | |
540 | + }); | |
541 | + }, | |
542 | + set_can_num: function () { | |
543 | + var th = this; | |
544 | + //-- 这个地方,循环计算几张优惠券可用-- | |
545 | + for (var iter in th.data.cartlist) { | |
546 | + var num = 0; | |
547 | + var c_item = th.data.cartlist[iter]; | |
548 | + var pkid = c_item.pickup_id; | |
549 | + //-- 普通券 -- | |
550 | + if (c_item.quan_list) { | |
551 | + for (var iter1 in c_item.quan_list) { | |
552 | + //判断是不是其他订单有选用 | |
553 | + var is_other_is_use = th.check_other_use(c_item.quan_list[iter1], pkid); | |
554 | + if (!is_other_is_use) num++; | |
555 | + } | |
556 | + } | |
557 | + //-- 包邮券 -- | |
558 | + var by_quan = th.data.get_by_quan_list_cart[pkid]; | |
559 | + if (by_quan) { | |
560 | + for (var iter2 in by_quan) { | |
561 | + //判断是不是其他订单有选用 | |
562 | + var is_other_is_use = th.check_other_use_by(by_quan[iter2], pkid); | |
563 | + if (!is_other_is_use) num++; | |
564 | + } | |
565 | + } | |
566 | + var set_txt = "cartlist[" + iter + "].can_num"; | |
567 | + th.setData({[set_txt]: num}); | |
568 | + } | |
569 | + }, | |
570 | + | |
571 | + | |
572 | + //---------计算立即购买---------- | |
573 | + calculatePrice2: function () { | |
574 | + var th = this, good = this.data.bn_goods; | |
575 | + | |
576 | + if (!good) return false; | |
577 | + | |
578 | + //搭配的计算要用购物的车计算方法 | |
579 | + if (good.prom_type == 5) { | |
580 | + th.calculatePrice(); | |
581 | + return false; | |
582 | + } | |
583 | + | |
584 | + wx.showLoading({ | |
585 | + title: "处理中." | |
586 | + }) | |
587 | + //-----------计算商品总价-------------- | |
588 | + var allpice = good.shop_price * good.buynum; | |
589 | + var cut_price = 0; | |
590 | + var allpice1 = allpice; | |
591 | + | |
592 | + | |
593 | + if (good.prom_type == 3 && good.prom_price !== null) { | |
594 | + cut_price = allpice - good.prom_price; | |
595 | + } | |
596 | + | |
597 | + allpice = parseFloat(allpice).toFixed(2); | |
598 | + var txt = "formData.all_price"; | |
599 | + th.setData({[txt]: allpice,}); | |
600 | + if (cut_price) { | |
601 | + var c_txt = "formData.cut_price"; | |
602 | + th.setData({[c_txt]: cut_price,}); | |
603 | + | |
604 | + } | |
605 | + | |
606 | + //如果有线下取价的时候 | |
607 | + if (good.is_offline) { | |
608 | + allpice = good.offline_price * good.buynum; | |
609 | + } | |
610 | + | |
611 | + | |
612 | + to.getConfig2(function (ee) { | |
613 | + to.getwuliuprice(async function (rs) { | |
614 | + | |
615 | + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
616 | + | |
617 | + //---如果有选择优惠券的情况下--- | |
618 | + var quan_price = 0, bn_pick = th.data.bn_pick; | |
619 | + var quan_no = null; | |
620 | + if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | |
621 | + quan_no = th.data.using_quan[bn_pick].coupon_no; | |
622 | + | |
623 | + if (quan_no) { | |
624 | + if (th.data.using_quan[bn_pick].isby != 1) { | |
625 | + //---获取优惠券优惠--- | |
626 | + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | |
627 | + data: { | |
628 | + storeId: oo.stoid, | |
629 | + CashRepNo: quan_no, | |
630 | + WaresSum: th.data.ckeck_quan_price, | |
631 | + WareIds: th.data.check_quan_ware_list | |
632 | + } | |
633 | + }).then(res => { | |
634 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
635 | + quan_price = res.data.data[0].WareCashSum; | |
636 | + } | |
637 | + }) | |
638 | + } | |
639 | + } | |
640 | + | |
641 | + //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- | |
642 | + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) { | |
643 | + //看是不是有调用过包邮券 | |
644 | + if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1) { | |
645 | + var condition = allpice - cut_price - quan_price; | |
646 | + //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- | |
647 | + getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { | |
648 | + data: { | |
649 | + store_id: os.stoid, | |
650 | + isuse: 0, | |
651 | + condition: condition, | |
652 | + user_id: getApp().globalData.user_id, | |
653 | + pageSize: 2000 | |
654 | + } | |
655 | + }).then(res => { | |
656 | + if (res.data.code == 0 && res.data.data.total > 0) { | |
657 | + //此时要循环判断包邮的地区,不包邮商品是不是符合 | |
658 | + var arr = [], quanlist = res.data.data.pageData; | |
659 | + quanlist = th.check_is_frozenQuan(quanlist, th.data.frozenQuan, 1); | |
660 | + for (var i in quanlist) { | |
661 | + var item = quanlist[i]; | |
662 | + if (item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域 | |
663 | + if (item.goods_list && th.check_by_goods(item.goods_list)) continue; //如果是不包邮商品 | |
664 | + arr.push(item); | |
665 | + } | |
666 | + if (arr) { | |
667 | + th.setData({get_by_quan_list: arr}); | |
668 | + } | |
669 | + th.data.isget_by_quan[th.data.bn_pick] = 1; | |
670 | + } | |
671 | + }) | |
672 | + } | |
673 | + | |
674 | + switch (good['exp_sum_type']) { | |
675 | + case 1: | |
676 | + //统一运费 | |
677 | + o_shipping_price += good['uniform_exp_sum']; | |
678 | + break; | |
679 | + case 2: | |
680 | + if (goods_weight < 0) goods_weight = 0; | |
681 | + //累积商品重量 每种商品的重量 * 数量 | |
682 | + goods_weight += good['weight'] * good['buynum']; | |
683 | + break; | |
684 | + case 3: | |
685 | + if (goods_piece < 0) goods_piece = 0; | |
686 | + //累积商品数量 | |
687 | + goods_piece += good['buynum']; | |
688 | + break; | |
689 | + } | |
690 | + | |
691 | + var code = ""; | |
692 | + if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | |
693 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
694 | + var no_ex_id = ee.no_ex_id; | |
695 | + th.data.is_no_by[th.data.bn_pick] = 0; | |
696 | + | |
697 | + var no_by_data = null; | |
698 | + var gift_freight_free = freight_free; | |
699 | + | |
700 | + | |
701 | + //有不包邮区域,且不免运费 | |
702 | + if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { | |
703 | + //-----------获取不包邮区域,不包邮商品------- | |
704 | + await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | |
705 | + data: {store_id: os.stoid, id: no_ex_id} | |
706 | + }).then(res => { | |
707 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
708 | + no_by_data = res.data.data[0]; | |
709 | + //如果有设置不包邮区域的时候 | |
710 | + if (res.data.data[0].region_list) { | |
711 | + if (th.check_by_area(res.data.data[0].region_list)) { | |
712 | + freight_free = 0; | |
713 | + th.data.is_no_by[th.data.bn_pick] = 1; | |
714 | + } | |
715 | + } | |
716 | + //如果有设置不包邮商品 | |
717 | + if (res.data.data[0].goods_list && freight_free) { | |
718 | + if (th.check_by_goods(res.data.data[0].goods_list)) { | |
719 | + freight_free = 0; | |
720 | + th.data.is_no_by[th.data.bn_pick] = 1; | |
721 | + } | |
722 | + } | |
723 | + } | |
724 | + }) | |
725 | + } | |
726 | + | |
727 | + th.data.is_by[th.data.bn_pick] = 0; | |
728 | + //--------------开始计算物流------------------ | |
729 | + var shipping_price = | |
730 | + th.calculatewuliu(code, o_shipping_price, goods_weight, | |
731 | + goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); | |
732 | + | |
733 | + //如果有赠品的时候,也要计算赠品的物流费用 | |
734 | + if (th.data.buy_now_gift_goods) { | |
735 | + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, | |
736 | + parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); | |
737 | + } | |
738 | + | |
739 | + if (shipping_price <= 0) { | |
740 | + th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | |
741 | + } | |
742 | + | |
743 | + shipping_price = parseFloat(shipping_price).toFixed(2); | |
744 | + var wl_txt = "formData.shipping_price"; | |
745 | + th.setData({[wl_txt]: shipping_price,}) | |
746 | + | |
747 | + } else { | |
748 | + var wl_txt = "formData.shipping_price"; | |
749 | + th.setData({[wl_txt]: 0,}) | |
750 | + } | |
751 | + | |
752 | + if (quan_no) { | |
753 | + if (th.data.using_quan[bn_pick].isby == 1) { | |
754 | + shipping_price = 0; | |
755 | + var wl_txt = "formData.shipping_price"; | |
756 | + th.setData({[wl_txt]: 0,}) | |
757 | + } | |
758 | + } | |
759 | + //-----------------支付价,优惠券不减物流----------------- | |
760 | + var total_m = (parseFloat(allpice1)).toFixed(2); | |
761 | + var order_m = (parseFloat(allpice - cut_price) - quan_price).toFixed(2); | |
762 | + var coupon_price = quan_price; //优惠券优惠了多少钱 | |
763 | + if (order_m < 0) { | |
764 | + order_m = 0; | |
765 | + coupon_price = parseFloat(order_m).toFixed(2); | |
766 | + } | |
767 | + //--看一下有没有订单优惠-- | |
768 | + var o_condition = parseFloat(order_m); | |
769 | + if (o_condition > 0 && th.data.act.is_useorderyh) { | |
770 | + th.check_is_order_prom(o_condition, function () { | |
771 | + var order_prom_amount = 0; | |
772 | + var order_prom_id = 0; | |
773 | + if (th.data.order_prom[th.data.bn_pick]) { | |
774 | + var ord_prom = th.data.order_prom[th.data.bn_pick]; | |
775 | + order_prom_id = ord_prom['id']; | |
776 | + switch (ord_prom['type']) { | |
777 | + case 0: | |
778 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
779 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
780 | + break; | |
781 | + case 1: | |
782 | + order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
783 | + order_prom_amount = ord_prom['expression']; | |
784 | + break; | |
785 | + } | |
786 | + } | |
787 | + //--订单优惠的显示-- | |
788 | + if (order_prom_id > 0) { | |
789 | + var order_prom_txt1 = "formData.order_prom_id"; | |
790 | + var order_prom_txt2 = "formData.order_prom_amount"; | |
791 | + th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) | |
792 | + } | |
793 | + | |
794 | + total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | |
795 | + order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | |
796 | + | |
797 | + total_m = total_m.toFixed(2); | |
798 | + order_m = order_m.toFixed(2); | |
799 | + | |
800 | + var atxt = "formData.total_amount"; | |
801 | + th.setData({[atxt]: total_m,}) | |
802 | + | |
803 | + var txt = "formData.user_money"; | |
804 | + var txt2 = "formData.order_amount"; | |
805 | + var txt3 = "formData.coupon_price"; | |
806 | + var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); | |
807 | + //--------------如果使用余额--------------------- | |
808 | + if (th.data.bn_use_money == 1) { | |
809 | + if (amoney > order_m) { | |
810 | + order_m = parseFloat(order_m).toFixed(2); | |
811 | + th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) | |
812 | + } else { | |
813 | + order_m = parseFloat(order_m) - parseFloat(amoney); | |
814 | + order_m = order_m.toFixed(2); | |
815 | + th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
816 | + } | |
817 | + } else { | |
818 | + th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
819 | + } | |
820 | + //优惠活动送积分 | |
821 | + if (good.s_intValue) { | |
822 | + txt = "formData.give_integral"; | |
823 | + th.setData({[txt]: good.s_intValue}); | |
824 | + } | |
825 | + //优惠送券 | |
826 | + if (good.s_coupon_id) { | |
827 | + var i_txt = "formData.give_coupon_id"; | |
828 | + //这个是json格式的 | |
829 | + var i_txt1 = "formData.g_coupon_num"; | |
830 | + var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; | |
831 | + ob = JSON.stringify(ob); | |
832 | + th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); | |
833 | + } | |
834 | + //优惠礼包 | |
835 | + if (good.s_libao) { | |
836 | + var l_txt = "formData.give_lb_id"; | |
837 | + //这个是json格式的 | |
838 | + var l_txt1 = "formData.g_lb_num"; | |
839 | + var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; | |
840 | + ob = JSON.stringify(ob); | |
841 | + th.setData({[l_txt]: good.s_libao, [l_txt1]: ob}); | |
842 | + } | |
843 | + }) | |
844 | + } else { | |
845 | + total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | |
846 | + order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | |
847 | + var atxt = "formData.total_amount"; | |
848 | + | |
849 | + total_m = total_m.toFixed(2); | |
850 | + order_m = order_m.toFixed(2); | |
851 | + | |
852 | + th.setData({[atxt]: total_m,}) | |
853 | + | |
854 | + var txt = "formData.user_money"; | |
855 | + var txt2 = "formData.order_amount"; | |
856 | + var txt3 = "formData.coupon_price"; | |
857 | + var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); | |
858 | + //--------------如果使用余额--------------------- | |
859 | + if (th.data.bn_use_money == 1) { | |
860 | + if (amoney > order_m) { | |
861 | + order_m = parseFloat(order_m).toFixed(2); | |
862 | + th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) | |
863 | + } else { | |
864 | + order_m = parseFloat(order_m) - parseFloat(amoney); | |
865 | + order_m = order_m.toFixed(2); | |
866 | + th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
867 | + } | |
868 | + } else { | |
869 | + th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
870 | + } | |
871 | + //优惠活动送积分 | |
872 | + if (good.s_intValue) { | |
873 | + txt = "formData.give_integral"; | |
874 | + th.setData({[txt]: good.s_intValue}); | |
875 | + } | |
876 | + //优惠送券 | |
877 | + if (good.s_coupon_id) { | |
878 | + var i_txt = "formData.give_coupon_id"; | |
879 | + //这个是json格式的 | |
880 | + var i_txt1 = "formData.g_coupon_num"; | |
881 | + var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; | |
882 | + ob = JSON.stringify(ob); | |
883 | + th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); | |
884 | + } | |
885 | + //优惠礼包 | |
886 | + if (good.s_libao) { | |
887 | + var l_txt = "formData.give_lb_id"; | |
888 | + //这个是json格式的 | |
889 | + var l_txt1 = "formData.g_lb_num"; | |
890 | + var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; | |
891 | + ob = JSON.stringify(ob); | |
892 | + th.setData({[l_txt]: good.s_coupon_id, [l_txt1]: ob}); | |
893 | + } | |
894 | + } | |
895 | + | |
896 | + wx.hideLoading(); | |
897 | + | |
898 | + }); | |
899 | + }); | |
900 | + }, | |
901 | + | |
902 | + //--------------------提交订单----------------------- | |
903 | + async submitForm(t){ | |
904 | + var sub_value = t; | |
905 | + | |
906 | + if (this.data.is_summit_ing == 1) return false; //--提交中退出-- | |
907 | + this.data.is_summit_ing = 1; | |
908 | + var th = this, pdata = new Array(); | |
909 | + var ff = true; | |
910 | + th.data.is_b_now = 1; | |
911 | + //------------立即购买------------- | |
912 | + if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { | |
913 | + | |
914 | + if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { | |
915 | + ff = false; | |
916 | + getApp().my_warnning("请选择收货地址", 0, th); | |
917 | + th.data.is_summit_ing = 0; | |
918 | + } | |
919 | + if (!ff) return false; | |
920 | + var addr = th.data.user_addr; | |
921 | + if (th.data.bn_exp_type == 1) addr = null; | |
922 | + | |
923 | + if (th.data.bn_exp_type == 0) | |
924 | + if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { | |
925 | + getApp().my_warnning("读取物流失败", 0, th); | |
926 | + th.data.is_summit_ing = 0; | |
927 | + return false; | |
928 | + } | |
929 | + | |
930 | + var item = { | |
931 | + 'user_id': to.globalData.user_id, | |
932 | + 'consignee': addr == null ? "" : addr.consignee, | |
933 | + 'province': addr == null ? 0 : addr.province, | |
934 | + 'city': addr == null ? 0 : addr.city, | |
935 | + 'district': addr == null ? 0 : addr.district, | |
936 | + 'twon': addr == null ? 0 : addr.twon, | |
937 | + 'address': addr == null ? "" : addr.address, | |
938 | + 'more_address': addr == null ? "" : addr.more_address, | |
939 | + //'mobile': th.data.userinfo.mobile, | |
940 | + 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile, | |
941 | + 'email': '', | |
942 | + 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code, | |
943 | + 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name, | |
944 | + 'invoice_title': '', | |
945 | + 'goods_price': th.data.formData.all_price, //商品总价 | |
946 | + 'shipping_price': th.data.formData.shipping_price, //物流金额 | |
947 | + 'user_money': th.data.formData.user_money, //使用余额 | |
948 | + 'total_amount': th.data.formData.total_amount, //订单总价 | |
949 | + 'order_amount': th.data.formData.order_amount, //应付 | |
950 | + 'user_note': t.detail.value.user_note, //用户备注 | |
951 | + 'store_id': oo.stoid, //商家 | |
952 | + 'pickup_id': th.data.bn_pick, //门店 | |
953 | + 'exp_type': th.data.bn_exp_type, //配送方式 | |
954 | + 'order_goods': new Array(), | |
955 | + }; | |
956 | + //是不是重新提交 | |
957 | + if (th.data.is_continue == 1) item.is_continue = 1; | |
958 | + | |
959 | + //获取立即购买的商品的信息 | |
960 | + var gg = to.get_b_now(); | |
961 | + //--商品的房间号-- | |
962 | + if (gg.room_id && gg.room_id > 0) { | |
963 | + item.room_ids = gg.room_id; | |
964 | + } | |
965 | + | |
966 | + var order_prom_list = {}; | |
967 | + //--判断有没有优惠活动-- | |
968 | + if (th.data.order_prom[item.pickup_id]) { | |
969 | + if (th.data.formData.order_prom_amount > 0) { | |
970 | + order_prom_list.order_prom_id = th.data.formData.order_prom_id; | |
971 | + order_prom_list.order_prom_amount = th.data.formData.order_prom_amount; | |
972 | + } | |
973 | + } | |
974 | + | |
975 | + //--判断优惠活动的提交-- | |
976 | + if (th.data.formData.cut_price > 0 ) { | |
977 | + order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); | |
978 | + var ob = [{ | |
979 | + "prom_id": th.data.bn_goods.prom_id, | |
980 | + "dis": parseFloat(th.data.formData.cut_price).toFixed(2), | |
981 | + "ispt": 0 | |
982 | + }] | |
983 | + order_prom_list.prom_pt_json = JSON.stringify(ob); | |
984 | + } | |
985 | + if (th.data.formData.give_integral > 0) { | |
986 | + order_prom_list.give_integral = th.data.formData.give_integral; | |
987 | + } | |
988 | + if (th.data.formData.give_coupon_id > 0) { | |
989 | + order_prom_list.give_coupon_id = th.data.formData.give_coupon_id; | |
990 | + order_prom_list.g_coupon_num = th.data.formData.g_coupon_num; | |
991 | + } | |
992 | + if (th.data.formData.give_lb_id > 0) { | |
993 | + order_prom_list.give_lb_id = th.data.formData.give_lb_id; | |
994 | + order_prom_list.g_lb_num = th.data.formData.g_lb_num; | |
995 | + } | |
996 | + item.order_prom_list = order_prom_list; | |
997 | + | |
998 | + //组装优惠券的钱 | |
999 | + if (parseFloat(th.data.formData.coupon_price) > 0) { | |
1000 | + item.coupon_price = th.data.formData.coupon_price; | |
1001 | + item.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | |
1002 | + } | |
1003 | + if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].coupon_no && th.data.using_quan[th.data.bn_pick].isby) { | |
1004 | + item.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | |
1005 | + item.coupon_price = 0; | |
1006 | + } | |
1007 | + | |
1008 | + //老会员成为分销下线需要的参数 | |
1009 | + if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { | |
1010 | + //判断一下分享人是不是分享商 | |
1011 | + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => { | |
1012 | + if (res.data.code == 0) { | |
1013 | + var user = res.data.data; | |
1014 | + if (user.is_distribut == 1) { | |
1015 | + item.first_leader = parseInt(getApp().globalData.first_leader); | |
1016 | + } | |
1017 | + } | |
1018 | + }) | |
1019 | + } | |
1020 | + | |
1021 | + var goods = { | |
1022 | + 'goods_id': gg.goods_id, | |
1023 | + 'goods_name': gg.goods_name, | |
1024 | + 'goods_sn': gg.goods_sn, | |
1025 | + 'goods_num': gg.goods_num, | |
1026 | + 'market_price': th.data.bn_goods.market_price, | |
1027 | + 'goods_price': th.data.bn_goods.shop_price, | |
1028 | + 'member_goods_price': th.data.bn_goods.shop_price, | |
1029 | + 'store_id': oo.stoid, | |
1030 | + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型 | |
1031 | + 'prom_id': th.data.bn_goods.prom_id, //促销活动id | |
1032 | + }; | |
1033 | + | |
1034 | + //-- 把导购的信息填入-- | |
1035 | + if (gg.guide_id) { | |
1036 | + goods.guide_id = gg.guide_id; | |
1037 | + goods.guide_type = gg.guide_type; | |
1038 | + //调用接口判断是不是会员 | |
1039 | + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { | |
1040 | + if (res.data.code == 0) { | |
1041 | + goods.guide_name = res.data.data.salesman; | |
1042 | + goods.guide_sn = res.data.data.salesman_no; | |
1043 | + } | |
1044 | + }) | |
1045 | + } | |
1046 | + | |
1047 | + //--商品的房间号-- | |
1048 | + if (gg.room_id && gg.room_id > 0) { | |
1049 | + goods.room_id = gg.room_id; | |
1050 | + } | |
1051 | + | |
1052 | + //积分购,先要带is_integral_normal=1 | |
1053 | + if (gg.is_integral_normal) goods.is_integral_normal = 1; | |
1054 | + | |
1055 | + //先要带is_pd_normal=1 | |
1056 | + if (gg.is_pd_normal) goods.is_pd_normal = 1; | |
1057 | + | |
1058 | + //如果不立即购买或者秒杀,如果是线下库存购买的时候 | |
1059 | + if (goods.prom_type != 1 && goods.prom_type != 6 && th.data.sales_rules == 2) { | |
1060 | + var isok = 1; | |
1061 | + await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { | |
1062 | + isok = res; | |
1063 | + }); | |
1064 | + if (!isok) { | |
1065 | + getApp().confirmBox("商品的门店库存不足"); | |
1066 | + th.data.is_summit_ing = 0; | |
1067 | + return false; | |
1068 | + } | |
1069 | + } | |
1070 | + | |
1071 | + //-- 如果有线下取价的话 -- | |
1072 | + if (th.data.bn_goods.is_offline) { | |
1073 | + item.sum_offline_cut = (th.data.bn_goods.shop_price - th.data.bn_goods.offline_price).toFixed(2); | |
1074 | + goods.offline_cut = item.sum_offline_cut; | |
1075 | + goods.pricing_type = th.data.bn_goods.pricing_type; | |
1076 | + goods.goods_price = th.data.bn_goods.offline_price; | |
1077 | + goods.member_goods_price = th.data.bn_goods.offline_price; | |
1078 | + } | |
1079 | + | |
1080 | + //--- 如果有优惠促销的金额,要把金额先平摊下去 --- | |
1081 | + if (th.data.formData.cut_price > 0 && !th.data.ispt_goods) { | |
1082 | + var g_arr = new Array(); | |
1083 | + g_arr.push(goods); | |
1084 | + var pt_data = { | |
1085 | + 'prom_id': goods.prom_id, | |
1086 | + 'dis': parseFloat(th.data.formData.cut_price), | |
1087 | + 'goods': g_arr, | |
1088 | + } | |
1089 | + | |
1090 | + var pt_res = null; | |
1091 | + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { | |
1092 | + is_json: 1, | |
1093 | + data: pt_data | |
1094 | + }).then(res => { | |
1095 | + if (res.data.code == 0) { | |
1096 | + pt_res = res.data.data; | |
1097 | + } | |
1098 | + }) | |
1099 | + if (pt_res) { | |
1100 | + //平摊赋值 | |
1101 | + goods.account = pt_res[0].fisrt_account; | |
1102 | + goods.account_yu = pt_res[0].fisrt_account_yu; | |
1103 | + item.is_discount_amount = 1; | |
1104 | + } | |
1105 | + } | |
1106 | + | |
1107 | + //--组装优惠券的钱-- | |
1108 | + if (th.data.formData.coupon_price) { | |
1109 | + item.coupon_price = th.data.formData.coupon_price; | |
1110 | + item.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | |
1111 | + goods.quan_num = th.data.formData.coupon_price; | |
1112 | + goods.quan_no = item.coupon_no; | |
1113 | + } | |
1114 | + | |
1115 | + item.order_goods.push(goods); | |
1116 | + | |
1117 | + //--如果有赠品的时候,赠品也要提交--- | |
1118 | + if (th.data.buy_now_gift_goods) { | |
1119 | + var gift_gg = th.data.buy_now_gift_goods; | |
1120 | + var g_goods = { | |
1121 | + 'goods_id': gift_gg.goods_id, | |
1122 | + 'goods_name': gift_gg.goods_name, | |
1123 | + 'goods_sn': gift_gg.goods_sn, | |
1124 | + 'goods_num': gift_gg.buynum, | |
1125 | + 'market_price': gift_gg.market_price, | |
1126 | + 'goods_price': 0, | |
1127 | + 'member_goods_price': 0, | |
1128 | + 'store_id': oo.stoid, | |
1129 | + 'is_gift': 1, | |
1130 | + 'gift_id': gift_gg.gift_id, | |
1131 | + 'prom_id': gift_gg.prom_id, | |
1132 | + }; | |
1133 | + item.order_goods.push(g_goods); | |
1134 | + } | |
1135 | + pdata.push(item); | |
1136 | + | |
1137 | + console.log(pdata); | |
1138 | + } else { | |
1139 | + //---------购物车的结算--------- | |
1140 | + if (th.data.is_all_zt == 0 && th.data.user_addr == null) { | |
1141 | + th.data.is_summit_ing = 0; | |
1142 | + ff = false; | |
1143 | + getApp().confirmBox("请新建收货地址"); | |
1144 | + } | |
1145 | + if (!ff) return false; | |
1146 | + | |
1147 | + var addr = th.data.user_addr; | |
1148 | + if (th.data.is_all_zt == 1) addr = null; | |
1149 | + var val_arr = t.detail.value; | |
1150 | + | |
1151 | + if (th.data.is_all_zt != 1) | |
1152 | + if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { | |
1153 | + th.data.is_summit_ing = 0; | |
1154 | + getApp().confirmBox("读取物流失败"); | |
1155 | + return false; | |
1156 | + } | |
1157 | + | |
1158 | + var order_prom_list_cart = th.data.order_prom_list_cart; | |
1159 | + | |
1160 | + //--组装推送数据-- | |
1161 | + for (var i = 0; i < order_prom_list_cart.length; i++) { | |
1162 | + var t_item = order_prom_list_cart[i]; | |
1163 | + var item = { | |
1164 | + 'user_id': to.globalData.user_id, | |
1165 | + 'consignee': addr == null ? th.data.userinfo.mobile : addr.consignee, | |
1166 | + 'province': addr == null ? 0 : addr.province, | |
1167 | + 'city': addr == null ? 0 : addr.city, | |
1168 | + 'district': addr == null ? 0 : addr.district, | |
1169 | + 'twon': addr == null ? 0 : addr.twon, | |
1170 | + 'address': addr == null ? "" : addr.address, | |
1171 | + 'more_address': addr == null ? "" : addr.more_address, | |
1172 | + 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile, | |
1173 | + 'email': '', | |
1174 | + 'shipping_code': th.data.is_all_zt == 1 ? 0 : th.data.wu_arr[t_item.wind].code, | |
1175 | + 'shipping_name': th.data.is_all_zt == 1 ? '' : th.data.wu_arr[t_item.wind].name, | |
1176 | + 'invoice_title': '', | |
1177 | + 'goods_price': t_item.goods_price, //商品总价 | |
1178 | + 'shipping_price': t_item.shipping_price, //物流金额 | |
1179 | + 'user_money': t_item.user_money, //使用余额 | |
1180 | + 'total_amount': t_item.total_amount, //订单总价 | |
1181 | + 'order_amount': t_item.order_amount, //应付 | |
1182 | + 'user_note': val_arr['user_note_' + t_item.pickup_id], //用户备注 | |
1183 | + 'store_id': oo.stoid, //商家 | |
1184 | + 'pickup_id': t_item.pickup_id, //门店 | |
1185 | + 'exp_type': t_item.exp_type, //配送方式 | |
1186 | + 'order_goods': new Array(), | |
1187 | + }; | |
1188 | + //是不是重新提交 | |
1189 | + if (th.data.is_continue == 1) item.is_continue = 1; | |
1190 | + //----- 如果有线下取价的话 ---- | |
1191 | + if (t_item.is_offline == 1) { | |
1192 | + item.sum_offline_cut = t_item.offline_price.toFixed(2); | |
1193 | + } | |
1194 | + | |
1195 | + //组装优惠券的钱 | |
1196 | + if (t_item.coupon_price) { | |
1197 | + item.coupon_price = t_item.coupon_price; | |
1198 | + item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no; | |
1199 | + } else if (t_item.quan_no) { | |
1200 | + item.coupon_no = t_item.quan_no; | |
1201 | + item.coupon_price = 0; | |
1202 | + } | |
1203 | + | |
1204 | + var order_prom_list = {}; | |
1205 | + //--判断有没有优惠活动-- | |
1206 | + if (t_item.order_prom_amount > 0) { | |
1207 | + order_prom_list.order_prom_id = t_item.order_prom_id; | |
1208 | + order_prom_list.order_prom_amount = t_item.order_prom_amount; | |
1209 | + } | |
1210 | + | |
1211 | + order_prom_list.discount_amount =0; | |
1212 | + //--判断优惠活动的提交-- | |
1213 | + if (t_item.cut_price > 0) { | |
1214 | + order_prom_list.discount_amount += t_item.cut_price; | |
1215 | + order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); | |
1216 | + } | |
1217 | + //--判断组合优惠活动的提交-- | |
1218 | + if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) { | |
1219 | + order_prom_list.discount_amount += t_item.zh_cut_price; | |
1220 | + order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); | |
1221 | + } | |
1222 | + if (t_item.s_intValue > 0) { | |
1223 | + order_prom_list.give_integral = t_item.s_intValue; | |
1224 | + } | |
1225 | + if (t_item.s_coupon_id) { | |
1226 | + order_prom_list.give_coupon_id = t_item.s_coupon_id; | |
1227 | + order_prom_list.g_coupon_num = JSON.stringify(t_item.g_coupon_num); | |
1228 | + } | |
1229 | + if (t_item.s_libao) { | |
1230 | + order_prom_list.give_lb_id = t_item.s_libao; | |
1231 | + order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); | |
1232 | + } | |
1233 | + if (Object.keys(order_prom_list).length > 0){ | |
1234 | + if(order_prom_list.discount_amount) | |
1235 | + order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2); | |
1236 | + if(order_prom_list.order_prom_amount) | |
1237 | + order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); | |
1238 | + item.order_prom_list = order_prom_list; | |
1239 | + } | |
1240 | + | |
1241 | + | |
1242 | + //老会员成为分销下线需要的参数 | |
1243 | + if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { | |
1244 | + //判断一下分享人是不是分享商 | |
1245 | + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => { | |
1246 | + if (res.data.code == 0) { | |
1247 | + var user = res.data.data; | |
1248 | + if (user.is_distribut == 1) { | |
1249 | + item.first_leader = parseInt(getApp().globalData.first_leader); | |
1250 | + } | |
1251 | + } | |
1252 | + }) | |
1253 | + } | |
1254 | + | |
1255 | + | |
1256 | + //房间号的ids | |
1257 | + var room_ids = ""; | |
1258 | + //-------------让商品添加到商品列表-------------------- | |
1259 | + for (var k = 0; k < t_item.goods.length; k++) { | |
1260 | + var g_item = t_item.goods[k]; | |
1261 | + if(g_item.goods_num<=0) continue; | |
1262 | + var goods = { | |
1263 | + 'goods_id': g_item.goods_id, | |
1264 | + 'goods_name': g_item.goods_name, | |
1265 | + 'goods_sn': g_item.goods_sn, | |
1266 | + 'goods_num': g_item.goods_num, | |
1267 | + 'market_price': g_item.market_price, | |
1268 | + 'goods_price': g_item.goods_price, | |
1269 | + 'member_goods_price': g_item.goods_price, | |
1270 | + 'store_id': oo.stoid, | |
1271 | + }; | |
1272 | + | |
1273 | + //-- 线下取价也要写入,组合购的商品不能去线下价格 -- | |
1274 | + if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type!=7) { | |
1275 | + goods.goods_price = g_item.offline_price; | |
1276 | + goods.member_goods_price = g_item.offline_price; | |
1277 | + goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); | |
1278 | + goods.pricing_type = g_item.pricing_type; | |
1279 | + } | |
1280 | + | |
1281 | + //--把券的钱,写入从表--- | |
1282 | + if (t_item.quan_youhui_list && t_item.coupon_price) { | |
1283 | + for (var kk in t_item.quan_youhui_list) { | |
1284 | + var you_item = t_item.quan_youhui_list[kk]; | |
1285 | + if (g_item.prom_type!=7 && g_item.erpwareid == you_item.WareId) { | |
1286 | + goods.quan_num = you_item.WareCashSum; | |
1287 | + goods.quan_no = you_item.CashRepNo; | |
1288 | + } | |
1289 | + } | |
1290 | + } | |
1291 | + | |
1292 | + //--判断活动的类型-- | |
1293 | + switch (g_item.prom_type) { | |
1294 | + case 1: | |
1295 | + goods.prom_type = g_item.prom_type; | |
1296 | + goods.prom_id = g_item.prom_id; | |
1297 | + break; | |
1298 | + case 3: | |
1299 | + goods.prom_type = 3; | |
1300 | + goods.prom_id = g_item.prom_id; | |
1301 | + if (g_item.is_gift) { | |
1302 | + goods.is_gift = g_item.is_gift; | |
1303 | + goods.gift_id = g_item.gift_id; | |
1304 | + } | |
1305 | + break; | |
1306 | + case 5: | |
1307 | + goods.prom_type = 5; | |
1308 | + goods.prom_id = g_item.prom_id; | |
1309 | + if (g_item.is_collocation) { | |
1310 | + goods.is_collocation = g_item.is_collocation; | |
1311 | + } | |
1312 | + break | |
1313 | + case 7: | |
1314 | + goods.prom_type = 7; | |
1315 | + goods.prom_id = g_item.prom_id; | |
1316 | + break | |
1317 | + default: | |
1318 | + goods.prom_type = 0; | |
1319 | + goods.prom_id = 0; | |
1320 | + } | |
1321 | + | |
1322 | + //如果不立即购买或者秒杀,如果是线下库存购买的时候 | |
1323 | + if (goods.prom_type == 0 && th.data.sales_rules == 2) { | |
1324 | + var isok = 1; | |
1325 | + await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { | |
1326 | + isok = res; | |
1327 | + }); | |
1328 | + if (!isok) { | |
1329 | + getApp().confirmBox(goods.goods_name + "的门店库存不足"); | |
1330 | + th.data.is_summit_ing = 0; | |
1331 | + return false; | |
1332 | + } | |
1333 | + } | |
1334 | + | |
1335 | + //把优惠的平摊结果写进去 | |
1336 | + if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account!=undefined)) { | |
1337 | + if (g_item.account >= 0) goods.account = g_item.account; | |
1338 | + if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; | |
1339 | + item.is_discount_amount = 1; | |
1340 | + } | |
1341 | + | |
1342 | + //导购ID | |
1343 | + if (g_item.guide_id) { | |
1344 | + goods.guide_id = g_item.guide_id; | |
1345 | + goods.guide_type = g_item.guide_type; | |
1346 | + //调用接口判断是不是会员 | |
1347 | + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { | |
1348 | + if (res.data.code == 0) { | |
1349 | + goods.guide_name = res.data.data.salesman; | |
1350 | + goods.guide_sn = res.data.data.salesman_no; | |
1351 | + } | |
1352 | + }) | |
1353 | + } | |
1354 | + //如果房间号不为空的时候 | |
1355 | + if (g_item.room_id) { | |
1356 | + goods.room_id = g_item.room_id; | |
1357 | + room_ids += g_item.room_id + ","; | |
1358 | + } | |
1359 | + item.order_goods.push(goods); | |
1360 | + } | |
1361 | + | |
1362 | + //如果房间号不为空的时候 | |
1363 | + if (room_ids != "") item.room_ids = ut.sub_last(room_ids); | |
1364 | + pdata.push(item); | |
1365 | + } | |
1366 | + | |
1367 | + | |
1368 | + } | |
1369 | + | |
1370 | + if (pdata.length == 0) return; | |
1371 | + var str = JSON.stringify(pdata); | |
1372 | + | |
1373 | + wx.showLoading({title: "加载中"}); | |
1374 | + wx.request({ | |
1375 | + url: oo.url + '/api/weshop/order/createWxdOrder', | |
1376 | + data: str, | |
1377 | + method: 'POST', | |
1378 | + header: { | |
1379 | + 'content-type': 'application/json' | |
1380 | + },// 设置请求的 header | |
1381 | + success: function (res) { | |
1382 | + | |
1383 | + | |
1384 | + wx.hideLoading(); | |
1385 | + if (res.statusCode == 200) { | |
1386 | + var data = res.data; | |
1387 | + if (data.code == 0) { | |
1388 | + console.log(th.data.is_b_now); | |
1389 | + //如果是购物车结算,还要删除购物车 | |
1390 | + if (th.data.is_b_now == 0) { | |
1391 | + console.log(th.data.cartlist_y); | |
1392 | + var list = th.data.cartlist_y; | |
1393 | + for (var i = 0; i < list.length; i++) { | |
1394 | + //删除购物车 | |
1395 | + a.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {}); | |
1396 | + } | |
1397 | + } | |
1398 | + var order_amount = 0; | |
1399 | + pdata.forEach(function (em, ind) { | |
1400 | + order_amount += em.order_amount; | |
1401 | + }) | |
1402 | + //要进行判断,如果是用微信支付,就要跳转到支付界面 | |
1403 | + if (order_amount > 0) { | |
1404 | + th.setData({isclose: 0}); | |
1405 | + //void e.jumpToCart4({ | |
1406 | + // order_sn: data.data, | |
1407 | + //}, 1); | |
1408 | + util_pay.pay(data.data, function () { | |
1409 | + //app.my_warnning("支付成功",1,th); | |
1410 | + //setTimeout(function () { | |
1411 | + wx.redirectTo({ | |
1412 | + url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data | |
1413 | + }) | |
1414 | + //},1000) | |
1415 | + | |
1416 | + }, function () { | |
1417 | + //支付失败 | |
1418 | + setTimeout(function () { | |
1419 | + var cps=getCurrentPages(); | |
1420 | + if(cps.length>1){ | |
1421 | + wx.navigateBack({delta: 1}) | |
1422 | + }else{ | |
1423 | + getApp().goto("/pages/index/index/index"); | |
1424 | + } | |
1425 | + | |
1426 | + }, 1000) | |
1427 | + }, oo.stoid); | |
1428 | + | |
1429 | + } else { | |
1430 | + var dd = { | |
1431 | + parent_sn: data.data, | |
1432 | + store_id: oo.stoid, | |
1433 | + type: 2, | |
1434 | + }; | |
1435 | + a.post("/api/weshop/order/pay/createOrder", { | |
1436 | + data: dd, | |
1437 | + success: function (t) { | |
1438 | + //console.log(t); | |
1439 | + if (t.data.code == 0) { | |
1440 | + //app.my_warnning("支付成功",1,th); | |
1441 | + //setTimeout(function () { | |
1442 | + th.setData({isclose: 0}); | |
1443 | + wx.redirectTo({ | |
1444 | + url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, | |
1445 | + }) | |
1446 | + //}, 1000) | |
1447 | + } | |
1448 | + }, | |
1449 | + fail: function () { | |
1450 | + | |
1451 | + } | |
1452 | + }); | |
1453 | + } | |
1454 | + | |
1455 | + } | |
1456 | + else { | |
1457 | + //--内容换行-- | |
1458 | + var msg = data.msg; | |
1459 | + //赠品活动已经取消,无法赠送,是否继续买单? | |
1460 | + if (msg.indexOf("是否继续买单") > 0) { | |
1461 | + wx.showModal({ | |
1462 | + title: "提示", | |
1463 | + content: data.msg, | |
1464 | + cancelText: '取消', | |
1465 | + confirmText: '确定', | |
1466 | + showCancel: true, | |
1467 | + success(res){ | |
1468 | + if (res.cancel) { | |
1469 | + return; | |
1470 | + } else if (res.confirm) { | |
1471 | + th.data.is_continue = 1; | |
1472 | + th.data.is_summit_ing = 0; //是否提交中 | |
1473 | + th.submitForm(sub_value); | |
1474 | + } | |
1475 | + } | |
1476 | + }) | |
1477 | + return; | |
1478 | + } | |
1479 | + if (msg.length > 13) { | |
1480 | + msg = msg.slice(0, 13) + "\r\n" + msg.slice(13); | |
1481 | + } | |
1482 | + getApp().confirmBox(msg); | |
1483 | + th.data.is_summit_ing = 0; //是否提交中 | |
1484 | + } | |
1485 | + } else { | |
1486 | + th.data.is_summit_ing = 0; //是否提交中 | |
1487 | + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); | |
1488 | + } | |
1489 | + }, | |
1490 | + fail: function () { | |
1491 | + th.data.is_summit_ing = 0; | |
1492 | + wx.hideLoading(); | |
1493 | + console.log("index.js wx.request CheckCallUser fail"); | |
1494 | + }, | |
1495 | + complete: function () { | |
1496 | + } | |
1497 | + }) | |
1498 | + | |
1499 | + }, | |
1500 | + //---确认线下门店的数量足不足--- | |
1501 | + async check_store_num(goods_id, pick, goods_num, func){ | |
1502 | + var lock = 0, pick_no, plist, erpwareid; | |
1503 | + //先读取门店的lock | |
1504 | + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | |
1505 | + data: {store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000} | |
1506 | + }).then(res => { | |
1507 | + if (res.data.code == 0 && res.data.data.total > 0) { | |
1508 | + for (var i in res.data.data.pageData) | |
1509 | + lock += res.data.data.pageData[i].outQty; | |
1510 | + } | |
1511 | + }) | |
1512 | + //先获取门店的编号 | |
1513 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { | |
1514 | + data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} | |
1515 | + }).then(res => { | |
1516 | + if (res.data.code == 0) { | |
1517 | + pick_no = res.data.data.pickup_no; | |
1518 | + } | |
1519 | + }) | |
1520 | + //先获取商品的线下库存 | |
1521 | + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { | |
1522 | + data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} | |
1523 | + }).then(res => { | |
1524 | + if (res.data.code == 0) { | |
1525 | + erpwareid = res.data.data.erpwareid; | |
1526 | + } | |
1527 | + }) | |
1528 | + //读取线下的门店库存 | |
1529 | + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | |
1530 | + data: {storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000} | |
1531 | + }).then(res => { | |
1532 | + if (res.data.code == 0) { | |
1533 | + plist = res.data.data.pageData[0]; | |
1534 | + } | |
1535 | + }) | |
1536 | + var isok = 1; | |
1537 | + if (goods_num > plist.CanOutQty - lock) { | |
1538 | + isok = 0; | |
1539 | + } | |
1540 | + func(isok); | |
1541 | + }, | |
1542 | + | |
1543 | + useCoupon: function () { | |
1544 | + if (this.data.order.couponNum <= 0) { | |
1545 | + getApp().my_warnning("无可用优惠券", 0, this); | |
1546 | + return; | |
1547 | + } | |
1548 | + | |
1549 | + var a = { | |
1550 | + lid: this.data.coupon ? this.data.coupon.id : "0" | |
1551 | + }; | |
1552 | + wx.navigateTo({ | |
1553 | + url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a) | |
1554 | + }); | |
1555 | + }, | |
1556 | + enterAddressPage: function () { | |
1557 | + getApp().globalData.is_cart_old = 1; | |
1558 | + this.data.isget_by_quan = {}; | |
1559 | + this.data.enterAddressPage = !0, wx.navigateTo({ | |
1560 | + url: "/pages/user/address_list/address_list" | |
1561 | + }); | |
1562 | + }, | |
1563 | + | |
1564 | + //--------购物车购买时,选择自提和物流----------- | |
1565 | + setexptype_w: function (t) { | |
1566 | + | |
1567 | + var def_exp_code = getApp().globalData.userInfo.def_exp_code, th = this; | |
1568 | + var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt, | |
1569 | + wl_txt = t.currentTarget.dataset.wl_txt, | |
1570 | + ont = t.currentTarget.dataset.ont; | |
1571 | + | |
1572 | + th.setData({[txt]: ty}); | |
1573 | + var iszt = 1; | |
1574 | + | |
1575 | + if (ty == 0) { | |
1576 | + th.setData({is_all_zt: 0}); | |
1577 | + } else { | |
1578 | + for (var i = 0; i < th.data.cartlist.length; i++) { | |
1579 | + var item = th.data.cartlist[i]; | |
1580 | + if (item.exp_type == 0) { | |
1581 | + iszt = 0; | |
1582 | + break; | |
1583 | + } | |
1584 | + } | |
1585 | + | |
1586 | + th.setData({is_all_zt: iszt}); | |
1587 | + | |
1588 | + var ind = t.currentTarget.dataset.ind; | |
1589 | + var c_item = th.data.cartlist[ind]; | |
1590 | + var pickid = c_item.pickup_id; | |
1591 | + | |
1592 | + if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) { | |
1593 | + th.data.using_quan[pickid] = {}; | |
1594 | + th.setData({using_quan: th.data.using_quan}); | |
1595 | + } | |
1596 | + | |
1597 | + | |
1598 | + } | |
1599 | + //判断有没有默认的物流地址值 | |
1600 | + if (def_exp_code != "" && def_exp_code != null && def_exp_code != undefined) { | |
1601 | + var wu_arr = this.data.wu_arr; | |
1602 | + if (wu_arr != null && wu_arr != "") { | |
1603 | + for (var i = 0; i < wu_arr.length; i++) { | |
1604 | + if (wu_arr[i].shipping_code == def_exp_code) { | |
1605 | + var set_txt = "cartlist" | |
1606 | + th.setData({wl_txt: i}); | |
1607 | + } | |
1608 | + } | |
1609 | + } | |
1610 | + } | |
1611 | + //----计算此时购物车的价格---- | |
1612 | + th.calculatePrice(); | |
1613 | + }, | |
1614 | + | |
1615 | + //--------立即购买时,选择自提和物流---------- | |
1616 | + setexptype: function (t) { | |
1617 | + var th = this; | |
1618 | + var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
1619 | + th.setData({bn_exp_type: ty}); | |
1620 | + if (ty == 0) { | |
1621 | + th.setData({is_all_zt: 0}); | |
1622 | + } | |
1623 | + | |
1624 | + //当物流为空的时候。 | |
1625 | + if (ty == 0 && th.data.wu_arr == null) { | |
1626 | + th.data.isget_by_quan = {}; | |
1627 | + return th.get_wuliu(th.calculatePrice2()); | |
1628 | + } | |
1629 | + | |
1630 | + //--自提就要把包邮券清理掉-- | |
1631 | + if (ty == 1) { | |
1632 | + th.data.isget_by_quan = {}; | |
1633 | + if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { | |
1634 | + th.setData({using_quan: {}}); | |
1635 | + } | |
1636 | + } | |
1637 | + | |
1638 | + //判断有没有默认的物流地址值 | |
1639 | + if (def_exp_code != "" && def_exp_code != null && def_exp_code != undefined) { | |
1640 | + var wu_arr = this.data.wu_arr; | |
1641 | + if (wu_arr != null && wu_arr != "") { | |
1642 | + for (var i = 0; i < wu_arr.length; i++) { | |
1643 | + if (wu_arr[i].shipping_code == def_exp_code) { | |
1644 | + th.setData({index: i}); | |
1645 | + } | |
1646 | + } | |
1647 | + } | |
1648 | + } | |
1649 | + th.calculatePrice2() | |
1650 | + | |
1651 | + }, | |
1652 | + | |
1653 | + //--------立即购买时,使用余额-------- | |
1654 | + set_bn_useyuer: function () { | |
1655 | + var th = this; | |
1656 | + th.setData({bn_use_money: !th.data.bn_use_money}); | |
1657 | + th.calculatePrice2(); | |
1658 | + }, | |
1659 | + set_js_useyuer: function () { | |
1660 | + var th = this; | |
1661 | + th.setData({js_use_money: !th.data.js_use_money}); | |
1662 | + th.calculatePrice(); | |
1663 | + }, | |
1664 | + //-------------------计算物流--------------- | |
1665 | + calculatewuliu: function (code, o_shipping_price, goods_weight, | |
1666 | + goods_piece, user_addr, freight_free, o_price, rs) { | |
1667 | + var price = 0, th = this; | |
1668 | + price += parseFloat(o_shipping_price); | |
1669 | + //如果是包邮 | |
1670 | + if (freight_free > 0 && o_price >= freight_free) { | |
1671 | + return 0; | |
1672 | + } | |
1673 | + if (user_addr == null) { | |
1674 | + return 0; | |
1675 | + } | |
1676 | + //计算物流的config item; | |
1677 | + var item = null; | |
1678 | + //先根据 镇 县 区找计算的config | |
1679 | + item = th.get_wuliu_config(user_addr.district, code, rs); | |
1680 | + if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs); | |
1681 | + if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs); | |
1682 | + if (item == null) item = th.get_wuliu_default(code, rs); | |
1683 | + if (item == null) return o_shipping_price; | |
1684 | + var fw_price = 0, fp_price = 0; | |
1685 | + item = item.config; | |
1686 | + if (item == null) return o_shipping_price; | |
1687 | + //------按重量---------- | |
1688 | + if (goods_weight >= 0 && item['money']) { | |
1689 | + fw_price = parseFloat(item['money']); | |
1690 | + if (goods_weight > item['first_weight']) { | |
1691 | + var fw = goods_weight - item['first_weight']; | |
1692 | + var n = Math.ceil(fw / item['second_weight']) | |
1693 | + fw_price = fw_price + n * parseFloat(item['add_money']); | |
1694 | + } | |
1695 | + } | |
1696 | + //------按件数---------- | |
1697 | + if (goods_piece > 0 && item['piecemoney']) { | |
1698 | + fp_price = parseFloat(item['piecemoney']); | |
1699 | + if (goods_piece > item['first_piece']) { | |
1700 | + var fp = goods_piece - item['first_piece']; | |
1701 | + var m = Math.ceil(fp / item['second_piece']) | |
1702 | + fp_price = fp_price + m * parseFloat(item['add_piecemoney']); | |
1703 | + } | |
1704 | + } | |
1705 | + var rspice = parseFloat(price + fw_price + fp_price); | |
1706 | + return rspice; | |
1707 | + }, | |
1708 | + | |
1709 | + //------------循环获取config----------- | |
1710 | + get_wuliu_config: function (region_id, code, rs) { | |
1711 | + var item = null, rslist = rs.pageData; | |
1712 | + for (var i = 0; i < rslist.length; i++) { | |
1713 | + if (rslist[i].code == code && rslist[i].region_id == region_id) { | |
1714 | + item = rslist[i]; | |
1715 | + } | |
1716 | + } | |
1717 | + return item; | |
1718 | + }, | |
1719 | + //-------循环获取config,code default------- | |
1720 | + get_wuliu_default: function (code, rs) { | |
1721 | + var item = null, rslist = rs.pageData; | |
1722 | + for (var i = 0; i < rslist.length; i++) { | |
1723 | + if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { | |
1724 | + item = rslist[i]; | |
1725 | + } | |
1726 | + } | |
1727 | + return item; | |
1728 | + }, | |
1729 | + | |
1730 | + //----------立即购买,选择物流------------- | |
1731 | + bindPickerChange: function (e) { | |
1732 | + var ind = e.detail.value | |
1733 | + this.setData({index: ind}); | |
1734 | + this.calculatePrice2(); | |
1735 | + }, | |
1736 | + //----------购物车结算,选择物流------------- | |
1737 | + bindPickerChange_w: function (e) { | |
1738 | + var ind = e.detail.value, txt = e.currentTarget.dataset.txt; | |
1739 | + this.setData({[txt]: ind}); | |
1740 | + this.calculatePrice(); | |
1741 | + }, | |
1742 | + | |
1743 | + /*----券的所有操作----*/ | |
1744 | + open_coupon_list: function (e) { | |
1745 | + var th = this; | |
1746 | + var pickid = e.currentTarget.dataset.pickid; | |
1747 | + var bn = e.currentTarget.dataset.bn; | |
1748 | + var cindx = e.currentTarget.dataset.cind; | |
1749 | + var get_by_quan_list_cart = th.data.get_by_quan_list_cart[pickid]; | |
1750 | + | |
1751 | + | |
1752 | + if (bn == 1) { | |
1753 | + th.setData({open_quan: 1, selected_quan_pick: pickid, disabled: 1}); | |
1754 | + } else { | |
1755 | + //---多单打开券的时候,就要判断券在其他门店是否有使用--- | |
1756 | + var quanlist = th.data.cartlist[cindx].quan_list; | |
1757 | + var exp_type = th.data.cartlist[cindx].exp_type; | |
1758 | + | |
1759 | + | |
1760 | + //对于在其他门店已经选择了的券 要判断是否显示到界面 | |
1761 | + var t_user = th.data.using_quan[pickid]; | |
1762 | + | |
1763 | + for (var i in quanlist) { | |
1764 | + quanlist[i].is_using = th.check_in_sele(quanlist[i].CashRepNo, pickid); | |
1765 | + if (t_user && quanlist[i].CashRepNo == t_user.coupon_no) | |
1766 | + quanlist[i].show_red = 1; | |
1767 | + else | |
1768 | + quanlist[i].show_red = 0; | |
1769 | + } | |
1770 | + | |
1771 | + if (get_by_quan_list_cart) { | |
1772 | + for (var i in get_by_quan_list_cart) { | |
1773 | + get_by_quan_list_cart[i].is_using = th.check_in_sele(get_by_quan_list_cart[i].no, pickid); | |
1774 | + if (t_user && get_by_quan_list_cart[i].no == t_user.coupon_no) | |
1775 | + get_by_quan_list_cart[i].show_red = 1; | |
1776 | + else | |
1777 | + get_by_quan_list_cart[i].show_red = 0; | |
1778 | + } | |
1779 | + th.setData({by_quan_list_cart: get_by_quan_list_cart}); | |
1780 | + } else { | |
1781 | + th.setData({by_quan_list_cart: null}); | |
1782 | + } | |
1783 | + | |
1784 | + console.log("2222222券的列表", quanlist); | |
1785 | + th.setData({ | |
1786 | + sele_cart_ind: cindx, | |
1787 | + sele_exp_type: exp_type, | |
1788 | + open_quan: 1, | |
1789 | + selected_quan_pick: pickid, | |
1790 | + selected_quan_list: quanlist, | |
1791 | + disabled: 1 | |
1792 | + }); | |
1793 | + } | |
1794 | + }, | |
1795 | + close_coupon: function (e) { | |
1796 | + var th = this; | |
1797 | + th.setData({open_quan: 0, disabled: 0}); | |
1798 | + }, | |
1799 | + | |
1800 | + //---判断券时候在已经选择的列表中--- | |
1801 | + check_in_sele: function (no, pick_id) { | |
1802 | + var th = this; | |
1803 | + if (th.data.using_quan.length <= 0) return false; | |
1804 | + for (var i in th.data.using_quan) { | |
1805 | + //--如果键值等于本身就要跳出-- | |
1806 | + if (parseInt(i) == parseInt(pick_id)) continue; | |
1807 | + var item = th.data.using_quan[i]; | |
1808 | + if (item.coupon_no == no) { | |
1809 | + return true; | |
1810 | + } | |
1811 | + } | |
1812 | + return false; | |
1813 | + }, | |
1814 | + | |
1815 | + /*--点击选择券--*/ | |
1816 | + sele_quan_item: function (e) { | |
1817 | + | |
1818 | + var ind = e.currentTarget.dataset.ind; | |
1819 | + var quan_item = this.data.selected_quan_list[ind]; | |
1820 | + var pickid = this.data.selected_quan_pick; //现在选择的是哪一个门店 | |
1821 | + //--如果券是单品使用的时候-- | |
1822 | + if (quan_item && quan_item.UseObjectType && quan_item.UseObjectType == "20") { | |
1823 | + //---只有多件购买的时候才要计算,//购物车购买和搭配勾的时候--- | |
1824 | + var gg = getApp().get_b_now(); | |
1825 | + if (this.data.is_b_now == 0 || gg.prom_type == 5) { | |
1826 | + var arr = this.data.order_prom_list_cart; | |
1827 | + var t_pk_item = null; | |
1828 | + for (var ii in arr) { | |
1829 | + var ep = arr[ii]; | |
1830 | + if (pickid == ep.pickup_id) { | |
1831 | + t_pk_item = ep; | |
1832 | + break; | |
1833 | + } | |
1834 | + } | |
1835 | + //--寻找券指定的商品-- | |
1836 | + var gd = null; | |
1837 | + if (t_pk_item) { | |
1838 | + var goods = t_pk_item.goods; | |
1839 | + for (var gid in goods) { | |
1840 | + if (quan_item.UseObjectID == goods[gid].erpwareid) { | |
1841 | + gd = goods[gid]; | |
1842 | + } | |
1843 | + } | |
1844 | + } | |
1845 | + if (!gd) { | |
1846 | + getApp().my_warnning("未找到指定商品使用", 0, this, 600); | |
1847 | + return false; | |
1848 | + } | |
1849 | + //计算价格,如果有平摊的实收要计算实收的金额 | |
1850 | + var item_price = gd.goods_price * gd.goods_num; | |
1851 | + //-- 如果有平摊下去,有实收价格的时候,就要用account_fir来计算价格 -- | |
1852 | + if (gd.account_fir != null && gd.account_fir != undefined) { | |
1853 | + item_price = gd.account_fir * gd.goods_num; | |
1854 | + } | |
1855 | + | |
1856 | + if (item_price < parseFloat(quan_item.BuySum)) { | |
1857 | + getApp().my_warnning("该单品金额没有大于等于" + quan_item.BuySum + "元时不能使用优惠券", 0, this, 600); | |
1858 | + return false; | |
1859 | + } | |
1860 | + } | |
1861 | + } | |
1862 | + | |
1863 | + var no_use = e.currentTarget.dataset.no, quanlist = this.data.selected_quan_list; | |
1864 | + //---所有的券的显示红色选择都清理一遍--- | |
1865 | + for (var i in quanlist) { | |
1866 | + quanlist[i].show_red = 0; | |
1867 | + } | |
1868 | + this.setData({selected_quan_list: quanlist}); | |
1869 | + var by_quanlist = this.data.get_by_quan_list; | |
1870 | + if (by_quanlist) { | |
1871 | + //---所有的券的显示红色选择都清理一遍--- | |
1872 | + for (var inb in by_quanlist) { | |
1873 | + by_quanlist[inb].show_red = 0; | |
1874 | + } | |
1875 | + this.setData({get_by_quan_list: by_quanlist}); | |
1876 | + } | |
1877 | + | |
1878 | + var by_cart_list = this.data.by_quan_list_cart; | |
1879 | + if (by_cart_list) { | |
1880 | + //---所有的券的显示红色选择都清理一遍--- | |
1881 | + for (var inc in by_cart_list) { | |
1882 | + by_cart_list[inc].show_red = 0; | |
1883 | + } | |
1884 | + this.setData({by_quan_list_cart: by_cart_list}); | |
1885 | + } | |
1886 | + | |
1887 | + var using_quan = this.data.using_quan; | |
1888 | + var th = this; | |
1889 | + //---如果是不使用优惠券--- | |
1890 | + if (no_use == 1) { | |
1891 | + console.log("有进来吗券", no_use); | |
1892 | + if (using_quan[th.data.selected_quan_pick]) { | |
1893 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 1; | |
1894 | + } | |
1895 | + else { | |
1896 | + using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; | |
1897 | + } | |
1898 | + this.setData({using_quan: using_quan, is_coupon: 2222}); | |
1899 | + return; | |
1900 | + } | |
1901 | + | |
1902 | + | |
1903 | + var txt = "selected_quan_list[" + ind + "].show_red"; | |
1904 | + var obj = {}; | |
1905 | + obj[txt] = 1; | |
1906 | + if (quan_item.show_red) { | |
1907 | + obj[txt] = 0; | |
1908 | + } | |
1909 | + this.setData(obj); | |
1910 | + console.log(this.data.selected_quan_list, "选中的券的下标", quan_item, "数据都在这里", txt); | |
1911 | + if (using_quan[th.data.selected_quan_pick]) { | |
1912 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 0; | |
1913 | + } | |
1914 | + else { | |
1915 | + using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; | |
1916 | + } | |
1917 | + this.setData({using_quan: using_quan}); | |
1918 | + | |
1919 | + }, | |
1920 | + | |
1921 | + | |
1922 | + /*----- 点击选择包邮券 -----*/ | |
1923 | + sele_quan_item_by: function (e) { | |
1924 | + var no_use = e.currentTarget.dataset.no; | |
1925 | + //立即购买的包邮券 | |
1926 | + var by_quanlist = this.data.get_by_quan_list; | |
1927 | + if (by_quanlist) { | |
1928 | + //---所有的券的显示红色选择都清理一遍--- | |
1929 | + for (var ind in by_quanlist) { | |
1930 | + by_quanlist[ind].show_red = 0; | |
1931 | + } | |
1932 | + this.setData({get_by_quan_list: by_quanlist}); | |
1933 | + } | |
1934 | + | |
1935 | + //--购物车过来的包邮券-- | |
1936 | + var by_cart_list = this.data.by_quan_list_cart; | |
1937 | + if (by_cart_list) { | |
1938 | + //---所有的券的显示红色选择都清理一遍--- | |
1939 | + for (var ind in by_cart_list) { | |
1940 | + by_cart_list[ind].show_red = 0; | |
1941 | + } | |
1942 | + this.setData({by_quan_list_cart: by_cart_list}); | |
1943 | + } | |
1944 | + //普通券 | |
1945 | + var quanlist = this.data.selected_quan_list; | |
1946 | + if (quanlist) { | |
1947 | + //---所有的券的显示红色选择都清理一遍--- | |
1948 | + for (var ind in quanlist) { | |
1949 | + quanlist[ind].show_red = 0; | |
1950 | + } | |
1951 | + this.setData({selected_quan_list: quanlist}); | |
1952 | + } | |
1953 | + | |
1954 | + var th = this; | |
1955 | + var using_quan = this.data.using_quan; | |
1956 | + //---如果是不使用优惠券--- | |
1957 | + if (no_use == 1) { | |
1958 | + if (using_quan[th.data.selected_quan_pick]) { | |
1959 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 1; | |
1960 | + } | |
1961 | + else { | |
1962 | + using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; | |
1963 | + } | |
1964 | + this.setData({using_quan: using_quan, is_coupon: 2222}); | |
1965 | + return; | |
1966 | + } | |
1967 | + | |
1968 | + var pickid = th.data.selected_quan_pick; //现在选择的是哪一个门店 | |
1969 | + var ind = e.currentTarget.dataset.ind; | |
1970 | + //--如果是立即购买的部分-- | |
1971 | + var txt = ""; | |
1972 | + var txt1 = ""; | |
1973 | + var quan_item = null; | |
1974 | + if (th.data.is_b_now) { | |
1975 | + quan_item = this.data.get_by_quan_list[ind]; | |
1976 | + txt = "get_by_quan_list[" + ind + "].show_red"; | |
1977 | + var obj = {}; | |
1978 | + obj[txt] = 1; | |
1979 | + this.setData(obj); | |
1980 | + } else { | |
1981 | + txt = "by_quan_list_cart[" + ind + "].show_red"; | |
1982 | + quan_item = th.data.by_quan_list_cart[ind]; | |
1983 | + var obj = {}; | |
1984 | + obj[txt] = 1; | |
1985 | + this.setData(obj); | |
1986 | + th.data.get_by_quan_list_cart[pickid] = JSON.parse(JSON.stringify(th.data.by_quan_list_cart)); //要把选中的弄回数组 | |
1987 | + } | |
1988 | + | |
1989 | + if (using_quan[th.data.selected_quan_pick]) { | |
1990 | + using_quan[th.data.selected_quan_pick].is_nouse_red = 0; | |
1991 | + } | |
1992 | + else { | |
1993 | + using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; | |
1994 | + } | |
1995 | + this.setData({using_quan: using_quan}); | |
1996 | + }, | |
1997 | + | |
1998 | + //--确认使用券--- | |
1999 | + confirm_quan: function () { | |
2000 | + var using_quan = this.data.using_quan; //正在使用中的券列表 | |
2001 | + var pickid = this.data.selected_quan_pick; //选中的门店ID | |
2002 | + var th = this; | |
2003 | + var selected_quan_list = this.data.selected_quan_list; //选择了那个门店的券列表 | |
2004 | + var get_by_quan_list = this.data.get_by_quan_list; //立即购买的包邮券列表 | |
2005 | + var by_quan_list_cart = this.data.by_quan_list_cart; //购物车购买的包邮券列表 | |
2006 | + //选择了的券 | |
2007 | + var sele_quan = null; | |
2008 | + | |
2009 | + //循环普通的券 | |
2010 | + for (var i in selected_quan_list) { | |
2011 | + var item = selected_quan_list[i]; | |
2012 | + if (item.show_red) { | |
2013 | + th.insert_into_using_quan(item, using_quan, pickid); | |
2014 | + return; | |
2015 | + } | |
2016 | + } | |
2017 | + //循环包邮的券,立即购买的 | |
2018 | + for (var i in get_by_quan_list) { | |
2019 | + var item = get_by_quan_list[i]; | |
2020 | + if (item.show_red) { | |
2021 | + if (th.data.is_no_by[pickid] == 1) { | |
2022 | + getApp().my_warnning("已全场不能包邮,不能选择包邮券", 0, th); | |
2023 | + return false; | |
2024 | + } | |
2025 | + if (th.data.is_by[pickid] == 1) { | |
2026 | + getApp().my_warnning("已全场包邮,不能选择包邮券", 0, th); | |
2027 | + return false; | |
2028 | + } | |
2029 | + | |
2030 | + th.insert_into_using_quan(item, using_quan, pickid, 1); | |
2031 | + return; | |
2032 | + } | |
2033 | + } | |
2034 | + | |
2035 | + //循环包邮的券 | |
2036 | + for (var i in by_quan_list_cart) { | |
2037 | + var item = by_quan_list_cart[i]; | |
2038 | + if (item.show_red) { | |
2039 | + if (th.data.is_no_by[pickid] == 1) { | |
2040 | + getApp().my_warnning("已全场不能包邮,不能选择包邮券", 0, th); | |
2041 | + return false; | |
2042 | + } | |
2043 | + if (th.data.is_by[pickid] == 1) { | |
2044 | + getApp().my_warnning("已全场包邮,不能选择包邮券", 0, th); | |
2045 | + return false; | |
2046 | + } | |
2047 | + th.insert_into_using_quan(item, using_quan, pickid, 1); | |
2048 | + return; | |
2049 | + } | |
2050 | + } | |
2051 | + | |
2052 | + //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 | |
2053 | + if (using_quan[pickid]) { | |
2054 | + if (using_quan[pickid].is_nouse_red == 1) { | |
2055 | + using_quan[pickid] = {is_nouse_red: 1}; | |
2056 | + th.setData({using_quan: using_quan}); | |
2057 | + if (th.data.is_b_now == 1) { | |
2058 | + th.calculatePrice2(); | |
2059 | + } else { | |
2060 | + th.calculatePrice(); | |
2061 | + } | |
2062 | + th.setData({open_quan: 0}); | |
2063 | + return; | |
2064 | + } | |
2065 | + } | |
2066 | + }, | |
2067 | + | |
2068 | + //----把券插入之后的操作,同时还要重新计算价格---- | |
2069 | + insert_into_using_quan: function (item, using_quan, pickid, isby) { | |
2070 | + var th = this; | |
2071 | + if (isby == 1) { | |
2072 | + using_quan[pickid] = { | |
2073 | + coupon_no: item.no, | |
2074 | + money: 0, | |
2075 | + is_nouse_red: 0, | |
2076 | + region_list: item.region_list, | |
2077 | + goods_list: item.goods_list | |
2078 | + }; | |
2079 | + using_quan[pickid].isby = 1; | |
2080 | + } else { | |
2081 | + using_quan[pickid] = {coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0}; | |
2082 | + using_quan[pickid].isby = 0; | |
2083 | + } | |
2084 | + this.setData({using_quan: using_quan}); | |
2085 | + th.calculatePrice2(); | |
2086 | + | |
2087 | + th.setData({open_quan: 0}); | |
2088 | + }, | |
2089 | + | |
2090 | + cart_set_err: function (e) { | |
2091 | + var txt = e.currentTarget.dataset.err; | |
2092 | + var ob = {}; | |
2093 | + ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif"; | |
2094 | + this.setData(ob); | |
2095 | + }, | |
2096 | + //--验证是否已经冻结-- | |
2097 | + check_is_frozenQuan: function (quanlist, frozenQuan, isby) { | |
2098 | + console.log("券列表", quanlist); | |
2099 | + if (!quanlist) return null; | |
2100 | + if (!frozenQuan) return quanlist; | |
2101 | + var arr = []; | |
2102 | + for (var i = 0; i < quanlist.length; i++) { | |
2103 | + var item = quanlist[i]; | |
2104 | + var is_find = 0; | |
2105 | + var Q_no = quanlist[i].CashRepNo; | |
2106 | + if (isby) Q_no = quanlist[i].no; | |
2107 | + for (var j = 0; j < frozenQuan.length; j++) { | |
2108 | + var q_no = frozenQuan[j].cashRepNo; | |
2109 | + if (Q_no == q_no) { | |
2110 | + is_find = 1; | |
2111 | + break; | |
2112 | + } | |
2113 | + } | |
2114 | + if (!is_find) arr.push(item); | |
2115 | + } | |
2116 | + return arr; | |
2117 | + }, | |
2118 | + | |
2119 | + //// 开启物流的弹窗 | |
2120 | + show_wu_arr: function (e) { | |
2121 | + var wu_arr_txt = e.currentTarget.dataset.txt; | |
2122 | + var w_sele_index = e.currentTarget.dataset.w_sele_index; | |
2123 | + var is_express = null; | |
2124 | + var ob = {open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1}; | |
2125 | + | |
2126 | + //--如果是多个门店的时候-- | |
2127 | + if (w_sele_index != undefined) { | |
2128 | + is_express = this.data.cartlist[w_sele_index].wind; | |
2129 | + ob['is_express'] = is_express; | |
2130 | + } | |
2131 | + this.setData(ob); | |
2132 | + }, | |
2133 | + // 关闭物流的弹窗 | |
2134 | + close_express: function () { | |
2135 | + this.setData({open_express: 0, disabled: 0}); | |
2136 | + }, | |
2137 | + // 选择物流 | |
2138 | + click_express_name: function (e) { | |
2139 | + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; | |
2140 | + var index = e.currentTarget.dataset.idxe; | |
2141 | + var ob = {is_express: index, is_shipping_code: shippingcode, disabled: 0}; | |
2142 | + ob[this.data.wu_arr_txt] = index; | |
2143 | + this.setData(ob); | |
2144 | + }, | |
2145 | + | |
2146 | + //点击确定物流 | |
2147 | + determine_expres: function (e) { | |
2148 | + this.setData({open_express: 0}); | |
2149 | + if (this.data.is_b_now == 1) | |
2150 | + this.calculatePrice2(); | |
2151 | + else | |
2152 | + this.calculatePrice(); | |
2153 | + }, | |
2154 | + | |
2155 | + //点击打开优惠券使用说明 | |
2156 | + clik_coupons: function (e) { | |
2157 | + var ind = e.currentTarget.dataset.idx; | |
2158 | + var is_open = this.data.selected_quan_list[ind].is_open; | |
2159 | + | |
2160 | + if (is_open == 1) is_open = 0; | |
2161 | + else is_open = 1; | |
2162 | + | |
2163 | + var txt = "selected_quan_list[" + ind + "].is_open" | |
2164 | + var obj = {}; | |
2165 | + obj[txt] = is_open; | |
2166 | + | |
2167 | + this.setData(obj); | |
2168 | + this.setData({disabled: 1}) | |
2169 | + }, | |
2170 | + | |
2171 | + clik_coupons2: function (e) { | |
2172 | + var ind = e.currentTarget.dataset.idx; | |
2173 | + var is_open = this.data.get_by_quan_list[ind].is_open; | |
2174 | + | |
2175 | + if (is_open == 1) is_open = 0; | |
2176 | + else is_open = 1; | |
2177 | + | |
2178 | + var txt = "get_by_quan_list[" + ind + "].is_open" | |
2179 | + var obj = {}; | |
2180 | + obj[txt] = is_open; | |
2181 | + | |
2182 | + this.setData(obj); | |
2183 | + this.setData({disabled: 1}) | |
2184 | + }, | |
2185 | + | |
2186 | + | |
2187 | + //设置默认物流 | |
2188 | + select_default_logistics: function () { | |
2189 | + var th = this; | |
2190 | + var is_shipping_code = this.data.is_shipping_code | |
2191 | + getApp().request.put("/api/weshop/users/update", { | |
2192 | + data: {user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, | |
2193 | + success: function (rse) { | |
2194 | + if (rse.data.code == 0) { | |
2195 | + getApp().globalData.userInfo.def_exp_code = is_shipping_code; | |
2196 | + th.setData({open_express: 0}); | |
2197 | + //----计算此时购物车的价格---- | |
2198 | + if (th.data.is_b_now == 1) th.calculatePrice2(); | |
2199 | + else th.calculatePrice(); | |
2200 | + } | |
2201 | + } | |
2202 | + }) | |
2203 | + }, | |
2204 | + | |
2205 | + //更新下默认,在onshow里面 | |
2206 | + update_code(){ | |
2207 | + var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
2208 | + //--定时器,判断wu_arr不未空-- | |
2209 | + var uii = setInterval(function () { | |
2210 | + if (th.data.wu_arr) { | |
2211 | + clearInterval(uii); | |
2212 | + for (var k = 0; k < th.data.wu_arr.length; k++) { | |
2213 | + var item = th.data.wu_arr[k]; | |
2214 | + if (def_exp_code == item.code) { | |
2215 | + m_wind = k; | |
2216 | + } | |
2217 | + } | |
2218 | + //--如果是立即购买-- | |
2219 | + if (th.data.is_b_now == 1) { | |
2220 | + th.setData({index: m_wind, is_express: m_wind}); | |
2221 | + } else { | |
2222 | + var ui = setInterval(function () { | |
2223 | + if (th.data.cartlist) { | |
2224 | + var c_arr = th.data.cartlist; | |
2225 | + for (var i in c_arr) { | |
2226 | + c_arr[i].wind = m_wind; | |
2227 | + } | |
2228 | + th.setData({cartlist: c_arr, is_express: m_wind}) | |
2229 | + clearInterval(ui); | |
2230 | + } | |
2231 | + }, 500) | |
2232 | + } | |
2233 | + } | |
2234 | + }, 500); | |
2235 | + }, | |
2236 | + //-----获取购物车进来的劵------- | |
2237 | + get_cart_quan: async function (order_prom_list_cart) { | |
2238 | + var th = this; | |
2239 | + var is_xz_yh = 1; | |
2240 | + //等待值的出现 | |
2241 | + //getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { | |
2242 | + //var arr=th.data.order_prom_list_cart; | |
2243 | + var arr = order_prom_list_cart; | |
2244 | + if (!arr) arr = []; | |
2245 | + //如果系统有限制使用优惠券 | |
2246 | + if (th.data.is_close_quan) return false; | |
2247 | + | |
2248 | + //------------开始计算使用优惠券相关------------ | |
2249 | + for (var ind in arr) { | |
2250 | + var ep = arr[ind]; | |
2251 | + var goodlist = ep.goods; | |
2252 | + var pickup_id = ep.pickup_id; | |
2253 | + //--更优惠券抵用有关,立即购买的,如果是购物车,如果有等级价还有考虑等级价的东西 | |
2254 | + //就要把相应的值,写入cartlist数组中-- | |
2255 | + var ckeck_quan_price = 0, | |
2256 | + check_quan_price_list = '', | |
2257 | + check_quan_ware_list = ''; | |
2258 | + | |
2259 | + for (var i in goodlist) { | |
2260 | + var gd = goodlist[i]; | |
2261 | + //--如果是秒杀就跳出,如果是赠品,如果是组合购,如果是限制使用优惠券-- | |
2262 | + if (gd.prom_type == 1 || gd.is_gift || gd.prom_type == 7) { | |
2263 | + continue; | |
2264 | + } | |
2265 | + //如果有限制使用优惠券,就要返回 | |
2266 | + if (gd.prom_type == 3) { | |
2267 | + if (th.data.prom_goods_map[pickup_id][gd.prom_id].is_xz_yh) continue; | |
2268 | + th.data.prom_goods_map[pickup_id][gd.prom_id].coupon_sele = 1; | |
2269 | + } | |
2270 | + is_xz_yh = 0; | |
2271 | + var item_price = gd.goods_price * gd.goods_num; | |
2272 | + //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- | |
2273 | + if (gd.account_fir != null && gd.account_fir != undefined) { | |
2274 | + item_price = gd.account_fir * gd.goods_num; | |
2275 | + } | |
2276 | + ckeck_quan_price += item_price; | |
2277 | + | |
2278 | + //--组装价格list-- | |
2279 | + if (check_quan_price_list) { | |
2280 | + check_quan_price_list += "," + item_price; | |
2281 | + } else { | |
2282 | + check_quan_price_list = item_price; | |
2283 | + } | |
2284 | + //--组装商品的线下erpwareid-- | |
2285 | + if (check_quan_ware_list) { | |
2286 | + check_quan_ware_list += "," + encodeURIComponent(gd['erpwareid']); | |
2287 | + } else { | |
2288 | + check_quan_ware_list = encodeURIComponent(gd['erpwareid']); | |
2289 | + } | |
2290 | + } | |
2291 | + //优惠券优惠的金额要控制到优惠券的选择条件 | |
2292 | + var cut_price = 0; | |
2293 | + for (var i in th.data.prom_goods_map[pickup_id]) { | |
2294 | + var obj = th.data.prom_goods_map[pickup_id][i]; | |
2295 | + if (obj.coupon_sele) { | |
2296 | + cut_price += obj.price - obj.prom_price; | |
2297 | + } | |
2298 | + } | |
2299 | + | |
2300 | + arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; | |
2301 | + arr[ind].check_quan_ware_list = check_quan_ware_list; | |
2302 | + arr[ind].check_quan_price_list = check_quan_price_list; | |
2303 | + | |
2304 | + //是否关闭使用优惠券 | |
2305 | + if (th.data.is_close_quan != 1 && !is_xz_yh) { | |
2306 | + //--调用接口,获取优惠券的列表,3秒钟内控制接口请求-- | |
2307 | + var url = "/api/weshop/couponList/getUseCouponList"; | |
2308 | + await app.request.promiseGet(url, { | |
2309 | + data: { | |
2310 | + storeId: oo.stoid, | |
2311 | + userId: app.globalData.user_id, | |
2312 | + BuySum: ckeck_quan_price, | |
2313 | + WareIds: check_quan_ware_list, | |
2314 | + pageSize: 100 | |
2315 | + } | |
2316 | + }).then(res => { | |
2317 | + if (res.data.code == 0) { | |
2318 | + var quan_list = res.data.data.pageData; | |
2319 | + arr[ind].quan_list = th.check_is_frozenQuan(quan_list, th.data.frozenQuan); | |
2320 | + } | |
2321 | + }) | |
2322 | + } | |
2323 | + } | |
2324 | + | |
2325 | + //如果是搭配购的立即购买的时候 | |
2326 | + if (th.data.is_b_now) { | |
2327 | + if (arr && arr.length > 0) { | |
2328 | + var quanlist = arr[0].quan_list; | |
2329 | + th.setData({selected_quan_list: quanlist, cartlist: arr}) | |
2330 | + } | |
2331 | + } else { | |
2332 | + th.setData({cartlist: arr}) | |
2333 | + th.set_can_num(); | |
2334 | + } | |
2335 | + | |
2336 | + //}) | |
2337 | + }, | |
2338 | + | |
2339 | + //------ 获取立即购买的购物车的劵 -------- | |
2340 | + get_buy_now_quan: function () { | |
2341 | + var quanlist = null, th = this, frozenQuan = null; | |
2342 | + var good = this.data.bn_goods; | |
2343 | + if (good.prom_price) { | |
2344 | + th.data.ckeck_quan_price = good.prom_price; //如果有优惠价,就用优惠价 | |
2345 | + } else if (good.is_offline) { | |
2346 | + th.data.ckeck_quan_price = good.offline_price; //如果有线下取价,就用线下价 | |
2347 | + } | |
2348 | + //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- | |
2349 | + if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) { | |
2350 | + var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; | |
2351 | + var url = "/api/weshop/couponList/getUseCouponList"; | |
2352 | + app.request.promiseGet(url0, {1: 1}).then(res => { | |
2353 | + if (res.data.code == 0) { | |
2354 | + frozenQuan = res.data.data; | |
2355 | + th.data.frozenQuan = frozenQuan; | |
2356 | + } | |
2357 | + app.request.time_limit_get(6, url, { | |
2358 | + data: { | |
2359 | + storeId: oo.stoid, | |
2360 | + userId: app.globalData.user_id, | |
2361 | + BuySum: th.data.ckeck_quan_price, | |
2362 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
2363 | + pageSize: 100 | |
2364 | + }, | |
2365 | + success: function (res) { | |
2366 | + if (res.data.code == 0) { | |
2367 | + quanlist = res.data.data.pageData; | |
2368 | + if (quanlist) { | |
2369 | + quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); | |
2370 | + th.setData({selected_quan_list: quanlist}) | |
2371 | + } | |
2372 | + } | |
2373 | + } | |
2374 | + }) | |
2375 | + }) | |
2376 | + } | |
2377 | + }, | |
2378 | + | |
2379 | + //检查区域是不是包邮 | |
2380 | + check_area: function (arr) { | |
2381 | + var user_addr = this.data.user_addr; | |
2382 | + if (!user_addr) return 0; | |
2383 | + for (var i in arr) { | |
2384 | + var item = arr[i]; | |
2385 | + if (user_addr.twon == item || user_addr.district == item | |
2386 | + || user_addr.city == item || user_addr.province == item) { | |
2387 | + return 0; | |
2388 | + } | |
2389 | + } | |
2390 | + return 1; | |
2391 | + }, | |
2392 | + | |
2393 | + //检查立即购买的商品是不是不包邮 | |
2394 | + check_good: function (arr, goods_id) { | |
2395 | + if (!goods_id) goods_id = this.data.bn_goods.goods_id; | |
2396 | + for (var i in arr) { | |
2397 | + var item = arr[i]; | |
2398 | + if (goods_id == item) return 0; | |
2399 | + } | |
2400 | + return 1; | |
2401 | + }, | |
2402 | + check_by_area: function (region_list) { | |
2403 | + var arr = region_list.split(","); | |
2404 | + var check = this.check_area(arr); | |
2405 | + return !check; | |
2406 | + }, | |
2407 | + check_by_goods: function (goods_list, goods_id) { | |
2408 | + var arr = goods_list.split(","); | |
2409 | + var check = this.check_good(arr, goods_id); | |
2410 | + return !check; | |
2411 | + }, | |
2412 | + //立即购买获取优惠活动的内容 | |
2413 | + buy_now_prom_goods: function (prom_id, arr, func) { | |
2414 | + var price = arr.shop_price * arr.goods_num; | |
2415 | + var prom = null; | |
2416 | + getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + prom_id, {}).then(res => { | |
2417 | + if (res.data.code == 0) { | |
2418 | + prom = res.data.data; | |
2419 | + return getApp().request.promiseGet("/api/weshop/goods/getDiscount", { | |
2420 | + data: { | |
2421 | + price: price, | |
2422 | + prom_id: prom_id, | |
2423 | + goods_num: arr.goods_num, | |
2424 | + user_id: getApp().globalData.user_id, | |
2425 | + is_bz: prom.is_bz | |
2426 | + } | |
2427 | + }) | |
2428 | + } else { | |
2429 | + func(arr); | |
2430 | + } | |
2431 | + }).then(res => { | |
2432 | + if (res.data.code == 0) { | |
2433 | + var get_data = res.data.data; | |
2434 | + arr.is_bz = prom.is_bz; //是不是倍增 | |
2435 | + arr.is_xz_yh = prom.is_xz_yh; //是不是优惠 | |
2436 | + arr.bs = get_data.bs; //是不是倍数 | |
2437 | + arr.is_past = get_data.is_past; //是不是包邮 | |
2438 | + arr.prom_price = get_data.price >= 0 ? get_data.price : price; | |
2439 | + arr.s_intValue = get_data.intValue; | |
2440 | + arr.s_coupon_id = get_data.coupon_id; | |
2441 | + arr.s_coupon_num = get_data.coupon_num; | |
2442 | + //-- 看是不是有赠品 -- | |
2443 | + if (get_data.gift_id) { | |
2444 | + arr.gift_id = get_data.gift_id; | |
2445 | + arr.gift_goods_id = get_data.goods_id; | |
2446 | + arr.gift_goods_name = get_data.goods_name; | |
2447 | + arr.gift_goods_color = get_data.goodsinfo.goods_color; | |
2448 | + arr.gift_goods_spec = get_data.goodsinfo.goods_spec; | |
2449 | + arr.gift_original_img = get_data.goodsinfo.original_img; | |
2450 | + arr.gift_weight = get_data.goodsinfo.weight; | |
2451 | + arr.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; | |
2452 | + arr.gift_uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; | |
2453 | + arr.gift_limit_num = get_data.limit_num; | |
2454 | + arr.gift_storecount = get_data.gift_storecount; | |
2455 | + } | |
2456 | + arr.s_libao = get_data.libao; | |
2457 | + arr.s_lb_num = get_data.lb_num; | |
2458 | + arr.prom_id = prom_id; | |
2459 | + } | |
2460 | + func(arr); | |
2461 | + }) | |
2462 | + }, | |
2463 | + //--检查订单优惠-- | |
2464 | + check_is_order_prom: function (condition, func, pick) { | |
2465 | + var th = this; | |
2466 | + pick = this.data.bn_pick; | |
2467 | + //---获取订单优惠--- | |
2468 | + getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | |
2469 | + data: {store_id: os.stoid, orderAmount: condition} | |
2470 | + }).then(res => { | |
2471 | + if (res.data.code == 0) { | |
2472 | + var data = res.data.data; | |
2473 | + th.data.order_prom[pick] = data; | |
2474 | + } | |
2475 | + func(); | |
2476 | + }) | |
2477 | + }, | |
2478 | + | |
2479 | + //--- 加入优惠活动的映射中,同时要有一个good列表 --- | |
2480 | + add_prom_goods_map: async function (item) { | |
2481 | + var th = this; | |
2482 | + var pickid = item.pick_id; | |
2483 | + var map = th.data.prom_goods_map; | |
2484 | + var obj = map[pickid]; | |
2485 | + | |
2486 | + if (map[pickid]) { | |
2487 | + if (map[pickid][item.prom_id]) { | |
2488 | + var ob = map[pickid][item.prom_id]; | |
2489 | + ob.price += item.goods_price * item.goods_num; | |
2490 | + ob.goods_num += item.goods_num; | |
2491 | + ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); | |
2492 | + | |
2493 | + } else { | |
2494 | + var prom = null; | |
2495 | + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + item.prom_id, {}).then(res => { | |
2496 | + if (res.data.code == 0) { | |
2497 | + prom = res.data.data; | |
2498 | + } | |
2499 | + }) | |
2500 | + var ob = {}; | |
2501 | + ob.prom_id = item.prom_id; | |
2502 | + ob.price = item.goods_price * item.goods_num; | |
2503 | + ob.goods_num = item.goods_num; | |
2504 | + ob.is_bz = prom.is_bz; | |
2505 | + ob.is_xz_yh = prom.is_xz_yh; | |
2506 | + ob.goods = new Array(); | |
2507 | + ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); | |
2508 | + map[pickid][item.prom_id] = ob; | |
2509 | + } | |
2510 | + } else { | |
2511 | + var ob = {}; | |
2512 | + var prom = null; | |
2513 | + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + item.prom_id, {}).then(res => { | |
2514 | + if (res.data.code == 0) { | |
2515 | + prom = res.data.data; | |
2516 | + } | |
2517 | + }) | |
2518 | + ob.prom_id = item.prom_id; | |
2519 | + ob.price = item.goods_price * item.goods_num; | |
2520 | + ob.goods_num = item.goods_num; | |
2521 | + ob.is_bz = prom.is_bz; | |
2522 | + ob.is_xz_yh = prom.is_xz_yh; | |
2523 | + ob.goods = new Array(); | |
2524 | + ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); | |
2525 | + | |
2526 | + var obj = {}; | |
2527 | + obj[item.prom_id] = ob; | |
2528 | + map[pickid] = obj; | |
2529 | + | |
2530 | + } | |
2531 | + }, | |
2532 | + | |
2533 | + //计算立即购买赠品的物流费用 | |
2534 | + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | |
2535 | + var good = this.data.buy_now_gift_goods; | |
2536 | + var goods_weight = -1, goods_piece = -1; | |
2537 | + var gift_shipping_price = 0; | |
2538 | + var th = this; | |
2539 | + switch (good['exp_sum_type']) { | |
2540 | + case 1: | |
2541 | + //统一运费 | |
2542 | + gift_shipping_price += good['uniform_exp_sum']; | |
2543 | + gift_shipping_price += o_shipping_price; | |
2544 | + break; | |
2545 | + case 2: | |
2546 | + if (goods_weight < 0) goods_weight = 0; | |
2547 | + //累积商品重量 每种商品的重量 * 数量 | |
2548 | + goods_weight += good['weight'] * good['buynum']; | |
2549 | + if (goods_weight1 > 0) { | |
2550 | + goods_weight += goods_weight1; | |
2551 | + } | |
2552 | + break; | |
2553 | + case 3: | |
2554 | + if (goods_piece < 0) goods_piece = 0; | |
2555 | + //累积商品数量 | |
2556 | + goods_piece += good['buynum']; | |
2557 | + if (goods_piece1) { | |
2558 | + goods_piece += goods_piece1; | |
2559 | + } | |
2560 | + break; | |
2561 | + } | |
2562 | + | |
2563 | + | |
2564 | + //如果有设置不包邮区域的时候 | |
2565 | + if (no_by_data && no_by_data.region_list) { | |
2566 | + if (th.check_by_area(no_by_data.region_list)) { | |
2567 | + gift_freight_free = 0; | |
2568 | + th.data.is_no_by[th.data.bn_pick] = 1; | |
2569 | + } | |
2570 | + } | |
2571 | + //如果有设置不包邮商品 | |
2572 | + if (no_by_data && no_by_data.goods_list && gift_freight_free) { | |
2573 | + if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { | |
2574 | + gift_freight_free = 0; | |
2575 | + //th.data.is_no_by[th.data.bn_pick]=1; | |
2576 | + } | |
2577 | + } | |
2578 | + | |
2579 | + var t_shipping_price = | |
2580 | + this.calculatewuliu(code, gift_shipping_price, goods_weight, | |
2581 | + goods_piece, user_addr, gift_freight_free, allpice, rs); | |
2582 | + return t_shipping_price; | |
2583 | + | |
2584 | + }, | |
2585 | + | |
2586 | + //从优惠的映射中拿出商品从表的item | |
2587 | + item_map_get_goods: function (goods_id, map) { | |
2588 | + for (var i in map.goods) { | |
2589 | + if (map.goods[i].goods_id == goods_id) return map.goods[i]; | |
2590 | + } | |
2591 | + }, | |
2592 | + //从优惠的映射中拿出商品从表的item | |
2593 | + arr_get_goods: function (goods_id, arr) { | |
2594 | + for (var i in arr) { | |
2595 | + if (arr[i].goods_id == goods_id) return arr[i]; | |
2596 | + } | |
2597 | + }, | |
2598 | + | |
2599 | + //检查是不是有其他门店的订单在选择了券 | |
2600 | + check_other_use: function (iter, pkid) { | |
2601 | + var using = this.data.using_quan; | |
2602 | + var is_use = 0; | |
2603 | + if (using) { | |
2604 | + for (var i in using) { | |
2605 | + if (i == pkid) continue; | |
2606 | + if (iter.CashRepNo == using[i].coupon_no) { | |
2607 | + is_use = 1; | |
2608 | + break; | |
2609 | + } | |
2610 | + } | |
2611 | + } | |
2612 | + return is_use; | |
2613 | + }, | |
2614 | + //检查是不是有其他门店的订单在选择了包邮券 | |
2615 | + check_other_use_by: function (iter, pkid) { | |
2616 | + var using = this.data.using_quan; | |
2617 | + var is_use = 0; | |
2618 | + if (using) { | |
2619 | + for (var i in using) { | |
2620 | + if (i == pkid) continue; | |
2621 | + if (iter.no == using[i].coupon_no) { | |
2622 | + is_use = 1; | |
2623 | + break; | |
2624 | + } | |
2625 | + } | |
2626 | + } | |
2627 | + return is_use; | |
2628 | + }, | |
2629 | + | |
2630 | + //跳转到购买卡 | |
2631 | + buycard: function () { | |
2632 | + getApp().goto("/pages/user/plus/plus"); | |
2633 | + getApp().globalData.plus_buy_back = 1; | |
2634 | + }, | |
2635 | + | |
2636 | + //跳转关闭弹出框的显示 | |
2637 | + close_offline: function () { | |
2638 | + this.setData({is_offline_show: 0}); | |
2639 | + }, | |
2640 | + | |
2641 | + //立即购买显示弹出框 | |
2642 | + bn_pop_offline: function () { | |
2643 | + var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price; | |
2644 | + //是不是线下 | |
2645 | + var is_get_offline = this.data.bn_goods.is_offline; | |
2646 | + this.setData({is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline}); | |
2647 | + }, | |
2648 | + | |
2649 | + //确定使用线下取价 | |
2650 | + sure_offline: function () { | |
2651 | + var bn_goods = this.data.bn_goods; | |
2652 | + if (bn_goods && bn_goods.prom_type == 0) { | |
2653 | + bn_goods.is_offline = 1; | |
2654 | + this.setData({is_offline_show: 0, bn_goods: bn_goods}); | |
2655 | + this.calculatePrice2(); | |
2656 | + } | |
2657 | + //就是购物车结算时的 | |
2658 | + else { | |
2659 | + var index = this.data.pop_offline_index; | |
2660 | + var txt = "cartlist[" + index + "].is_offline"; | |
2661 | + this.setData({[txt]: 1, is_offline_show: 0,}); | |
2662 | + this.data.old_cartlist[index].is_offline = 1; | |
2663 | + this.calculatePrice(); | |
2664 | + } | |
2665 | + }, | |
2666 | + | |
2667 | + | |
2668 | + //取消使用线下取价 | |
2669 | + cancle_offline: function () { | |
2670 | + //判断是不是立即购买 | |
2671 | + var bn_goods = this.data.bn_goods; | |
2672 | + if (bn_goods && bn_goods.prom_type == 0) { | |
2673 | + bn_goods.is_offline = 0; | |
2674 | + this.setData({is_offline_show: 0, bn_goods: bn_goods}); | |
2675 | + this.calculatePrice2(); | |
2676 | + } | |
2677 | + //就是购物车结算时的 | |
2678 | + else { | |
2679 | + var index = this.data.pop_offline_index; | |
2680 | + var txt = "cartlist[" + index + "].is_offline"; | |
2681 | + this.setData({[txt]: 0, is_offline_show: 0,}) | |
2682 | + this.data.old_cartlist[index].is_offline = 0; | |
2683 | + this.calculatePrice(); | |
2684 | + } | |
2685 | + }, | |
2686 | + | |
2687 | + //-- 弹出购物车选择是不是要店铺优惠 -- | |
2688 | + cart_pop_offline: function (e) { | |
2689 | + var index = e.currentTarget.dataset.index; | |
2690 | + var item = this.data.cartlist[index]; | |
2691 | + var off_price = item.offline_price; | |
2692 | + //是不是线下 | |
2693 | + var is_get_offline = item.is_offline; | |
2694 | + this.setData({ | |
2695 | + pop_offline_index: index, | |
2696 | + is_offline_show: 1, | |
2697 | + show_off_price: off_price.toFixed(2), | |
2698 | + is_get_offline: is_get_offline | |
2699 | + }); | |
2700 | + }, | |
2701 | + | |
2702 | + set_hid_inp:function (e) { | |
2703 | + var index = e.currentTarget.dataset.index; | |
2704 | + var txt = "cartlist[" + index + "].focus"; | |
2705 | + this.setData({[txt]:1}) | |
2706 | + }, | |
2707 | + | |
2708 | + clear_hid_inp:function (e) { | |
2709 | + var index = e.currentTarget.dataset.index; | |
2710 | + var txt = "cartlist[" + index + "].focus"; | |
2711 | + this.setData({[txt]:0}) | |
2712 | + }, | |
2713 | + | |
2714 | + | |
2715 | + | |
2716 | +}); | ... | ... |
packageC/pages/presell/cart/cart2.json
0 → 100644
packageC/pages/presell/cart/cart2.wxml
0 → 100644
1 | +<wxs module="filter" src="c_filter.wxs"></wxs> | |
2 | +<wxs src="filter.wxs" module="util"></wxs> | |
3 | +<wxs module="filters" src="../../../../utils/filter.wxs"></wxs> | |
4 | + | |
5 | +<form bindsubmit="submitForm"> | |
6 | + <view class="container"> | |
7 | + | |
8 | + <!-- 立即购买的时候 --> | |
9 | + <view class="tab-container"> | |
10 | + <view class="tab-wrapper"> | |
11 | + <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}" | |
12 | + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> | |
13 | + | |
14 | + <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" | |
15 | + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> | |
16 | + | |
17 | + </view> | |
18 | + </view> | |
19 | + | |
20 | + <!--要进行判断地址是否显示----> | |
21 | + <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{bn_exp_type==1 && is_b_now==1}}'> | |
22 | + <!---默认地址显示------> | |
23 | + <block wx:if="{{user_addr!=null}}"> | |
24 | + <view class="user-contact"> | |
25 | + <text class="bold fs36 pdr20">{{user_addr.consignee}}</text> | |
26 | + <text class="fs28">{{user_addr.mobile}}</text> | |
27 | + </view> | |
28 | + <view class="location"> | |
29 | + <view class="address fs26 pdt20"> | |
30 | + <view class="pos-icon"> | |
31 | + <image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/goodscategory/new_position.png"></image> | |
32 | + </view> | |
33 | + {{user_addr.more_address}}{{' '}}{{user_addr.address}} | |
34 | + </view> | |
35 | + | |
36 | + </view> | |
37 | + <view class="update-logistics"> | |
38 | + <!-- <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/new_position.png"></image> --> | |
39 | + <view class="xc-right"></view> | |
40 | + </view> | |
41 | + </block> | |
42 | + <!---先增地址------> | |
43 | + <block wx:else> | |
44 | + <view class="add_new"> | |
45 | + <image class="addr_jia" src="{{imgUrl}}/miniapp/images/jia.png"></image>添加地址 | |
46 | + </view> | |
47 | + </block> | |
48 | + </view> | |
49 | + | |
50 | + <!-- ----立即购买------ --> | |
51 | + | |
52 | + <view class="use-item bfff bdr_t-14 mgt20"> | |
53 | + <image class="dp" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'> </image> | |
54 | + <view>{{bn_pickname}}</view> | |
55 | + <!-- <view>门店:{{bn_pickname}}</view> --> | |
56 | + </view> | |
57 | + <view class="order-detail"> | |
58 | + <view class="goods-img"> | |
59 | + <image class="wh100 bdr14" src="{{bn_goods.original_img}}" binderror='cart_set_err' data-err="bn_goods.original_img"></image> | |
60 | + </view> | |
61 | + <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{bn_goods.goods_id}}"> | |
62 | + <view class="goods-name ellipsis-2">{{bn_goods.goods_name}}</view> | |
63 | + <!-- 商品属性 --> | |
64 | + <view class="flex-vertical fs28 xc-ash color-gray n_guige"> | |
65 | + <view class="goods-color"> | |
66 | + <block><text>{{filters.show_gui_ge(bn_goods.goods_spec,bn_goods.goods_color)}}</text></block> | |
67 | + </view> | |
68 | + </view> | |
69 | + | |
70 | + <!-- ---商品名称规格---- --> | |
71 | + <view class="order-num flex-space-between"> | |
72 | + <view class="co-red">¥<text class="fs36">{{filters.toFix(bn_goods.shop_price,2)}}</text></view> | |
73 | + <view class="goods-num">x{{bn_goods.buynum}}</view> | |
74 | + </view> | |
75 | + </navigator> | |
76 | + | |
77 | + </view> | |
78 | + <!-- 赠品的显示 --> | |
79 | + <view class="order-detail" wx:if="{{buy_now_gift_goods}}"> | |
80 | + <view class="goods-img" style="position: relative"> | |
81 | + <image src="{{imgUrl}}/miniapp/images/giveaway.png" class="gift_image"></image> | |
82 | + | |
83 | + <image class="wh100 bdr14" src="{{buy_now_gift_goods.original_img}}" binderror='cart_set_err' data-err="buy_now_gift_goods.original_img"></image> | |
84 | + </view> | |
85 | + <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{buy_now_gift_goods.goods_id}}"> | |
86 | + <view class="goods-name ellipsis-2">{{buy_now_gift_goods.goods_name}}</view> | |
87 | + <!-- 商品属性 --> | |
88 | + <view class="flex-vertical fs28 xc-ash color-gray n_guige"> | |
89 | + <view class="goods-color"> | |
90 | + <block><text>{{filters.show_gui_ge(buy_now_gift_goods.goods_spec,buy_now_gift_goods.goods_color)}}</text></block> | |
91 | + </view> | |
92 | + </view> | |
93 | + <!-- ---商品名称规格---- --> | |
94 | + <view class="order-num flex-space-between"> | |
95 | + <view class="co-red">¥<text class="fs36">0</text></view> | |
96 | + <view class="goods-num">x{{buy_now_gift_goods.buynum}}</view> | |
97 | + </view> | |
98 | + </navigator> | |
99 | + </view> | |
100 | + | |
101 | + | |
102 | + <block wx:if="{{collocation_goods}}"> | |
103 | + <!-- 搭配购买的功能实现 --> | |
104 | + <view class="order-detail" wx:for="{{collocation_goods}}"> | |
105 | + <view class="goods-img"> | |
106 | + <image class="wh100 bdr14" src="{{imgUrl+item.original_img}}" binderror='err_img_collocation' data-err="item.original_img"></image> | |
107 | + </view> | |
108 | + <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | |
109 | + <view class="goods-name ellipsis-2">{{item.goods_name}}</view> | |
110 | + <!-- 商品属性 --> | |
111 | + <view class="flex-vertical fs28 xc-ash color-gray n_guige"> | |
112 | + <view class="goods-color"> | |
113 | + <block><text>{{filters.show_gui_ge(item.goods_spec,item.goods_color)}}</text></block> | |
114 | + </view> | |
115 | + </view> | |
116 | + <!-- ---商品名称规格---- --> | |
117 | + <view class="order-num flex-space-between"> | |
118 | + <view class="co-red">¥<text class="fs36">{{item.price}}</text></view> | |
119 | + <view class="goods-num">x{{item.goods_num}}</view> | |
120 | + </view> | |
121 | + </navigator> | |
122 | + </view> | |
123 | + </block> | |
124 | + | |
125 | + <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> | |
126 | + <view class="plus_buy fs28" wx:if="{{card_cut_price>0}}"> | |
127 | + <view class="flex"> | |
128 | + <view class="card_bg ellipsis-1" style="margin-right: 10rpx;"> | |
129 | + <image src="{{imgUrl}}/miniapp/images/plus/dj_icon.png"></ image> | |
130 | + <text class="card_name">{{show_card.CardName}}</text> | |
131 | + </view> | |
132 | + <view>立减 <text style="color:#f23030;">{{filters.toFix(card_cut_price,2) }}</text> 元</view> | |
133 | + </view> | |
134 | + <view> | |
135 | + <text style="color: #999;margin-left: 4rpx;">vip超级会员仅需{{show_card.CardFee}}元</text> | |
136 | + </view> | |
137 | + <!-- 三角形 --> | |
138 | + <view class="car_tri_up"></view> | |
139 | + <!-- 立即开通跳转 --> | |
140 | + <view bindtap="buycard" class="card_op">立即开通</view> | |
141 | + </view> | |
142 | + | |
143 | + | |
144 | + <view class="set-mes bdr_b-14"> | |
145 | + <view wx:if="{{order.store_prom}}"> | |
146 | + <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} | |
147 | + </view> | |
148 | + | |
149 | + <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}"> | |
150 | + <view class="work-frame flex-space-between"> | |
151 | + <view class="work"> | |
152 | + 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用</text> | |
153 | + </view> | |
154 | + <view class="xc-right-frame"> | |
155 | + <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text> | |
156 | + <block wx:else> | |
157 | + <text wx:if="{{using_quan[bn_pick].money}}">¥{{using_quan[bn_pick].money}}元优惠券</text> | |
158 | + <text wx:if="{{using_quan[bn_pick].isby}}">包邮券</text> | |
159 | + </block> | |
160 | + <view class="xc-right"></view> | |
161 | + </view> | |
162 | + </view> | |
163 | + </view> | |
164 | + | |
165 | + <view class="xc-coupon-frame" wx:if="{{bn_exp_type==0 && !is_default_logistics}}"> | |
166 | + <view class="flex-space-between" style="padding: 20rpx 25rpx; font-size: 30rpx;"> | |
167 | + <view>选择物流</view> | |
168 | + <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 12rpx;"> | |
169 | + <view class="logistics-name">{{wu_arr[index].name}}</view> | |
170 | + <view class="xc-right"></view> | |
171 | + </view> | |
172 | + </view> | |
173 | + </view> | |
174 | + </view> | |
175 | + <!-- 留言 --> | |
176 | + <view class="coupon-mes flex-vertical"> | |
177 | + <view>留言</view> | |
178 | + <view class="leave-word"> | |
179 | + <input placeholder-class="fs28" placeholder='给商家留言,最多100字' bindinput="keyUpChangeNum" disabled="{{disabled}}" | |
180 | + class="word-box" maxlength="100" name="user_note"></input> | |
181 | + </view> | |
182 | + </view> | |
183 | + | |
184 | + <!-- 是否参与店铺优惠 --> | |
185 | + <view class="coupon-mes flex-vertical" bindtap="bn_pop_offline" wx:if="{{bn_goods.offline_price}}"> | |
186 | + <view>店铺优惠</view> | |
187 | + <view class="leave-word fs32" style="color: #999;"> | |
188 | + 省{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}元 | |
189 | + </view> | |
190 | + <block wx:if="{{bn_goods.is_offline}}"> | |
191 | + <text style="color: #d7642b;">-¥{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}</text> | |
192 | + </block> | |
193 | + <block wx:else> | |
194 | + <text style="color: #d7642b;">不使用优惠</text> | |
195 | + </block> | |
196 | + <!-- 右边点击 --> | |
197 | + <view class="xc-right" style="margin-right: 12rpx; border-color: #d7642b;"></view> | |
198 | + </view> | |
199 | + <!-----使用余额------> | |
200 | + <view class="set-mes bdr_t-14" wx:if="{{yuer>0}}"> | |
201 | + <view class="use-item" bindtap='set_bn_useyuer'> | |
202 | + <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> | |
203 | + <view class="yu_er">使用余额 :¥{{yuer}} </view> | |
204 | + </view> | |
205 | + </view> | |
206 | + | |
207 | + | |
208 | + <view class="information bdr14"> | |
209 | + <view class="item" wx:if="{{formData.all_price>0}}"> | |
210 | + <view>商品金额</view> | |
211 | + <view class="co-red">¥ {{formData.all_price}}元</view> | |
212 | + </view> | |
213 | + <view class="item" wx:if="{{formData.shipping_price>0}}"> | |
214 | + <view>配送费用</view> | |
215 | + <view class="co-red">¥ {{formData.shipping_price}}元</view> | |
216 | + </view> | |
217 | + <view class="item" wx:if="{{formData.coupon_price>0}}"> | |
218 | + <view>使用优惠券</view> | |
219 | + <view class="co-red">- ¥ {{formData.coupon_price}}元</view> | |
220 | + </view> | |
221 | + <!-- 优惠活动优惠金额 --> | |
222 | + <view class="item" wx:if="{{formData.cut_price>0}}"> | |
223 | + <view>优惠活动</view> | |
224 | + <view class="co-red">- ¥ {{filters.toFix(formData.cut_price,2)}}元</view> | |
225 | + </view> | |
226 | + <!-- 订单优惠优惠金额 --> | |
227 | + <view class="item" wx:if="{{formData.order_prom_amount>0}}"> | |
228 | + <view>订单优惠</view> | |
229 | + <view class="co-red">- ¥ {{filters.toFix(formData.order_prom_amount,2)}}元</view> | |
230 | + </view> | |
231 | + <view class="item" wx:if="{{formData.user_money>0}}"> | |
232 | + <view>使用余额</view> | |
233 | + <view class="co-red">- ¥ {{formData.user_money}}元</view> | |
234 | + </view> | |
235 | + </view> | |
236 | + </view> | |
237 | + | |
238 | + <view class="btn-wrap shadow-1" wx:if="{{show_submit}}"> | |
239 | + <view class="pay-amount"> | |
240 | + <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view> | |
241 | + </view> | |
242 | + <button class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
243 | + </view> | |
244 | +</form> | |
245 | + | |
246 | +<!-- 使用券列表的弹窗 --> | |
247 | +<view wx:if='{{open_quan==1}}'> | |
248 | + <view class="cover-layer flex-center " bindtap='close_coupon'> </view> | |
249 | + <view class="cx-popup {{open_quan==true?'up' : 'down'}}"> | |
250 | + <!-- 最上面 --> | |
251 | + <view class="top flex"> | |
252 | + <view class="xc-top-content t-c"> | |
253 | + <view class="xc-title">优惠券使用</view> | |
254 | + </view> | |
255 | + <view class="xc-close-frame" bindtap='close_coupon'> | |
256 | + <view class="xc-close">×</view> | |
257 | + </view> | |
258 | + </view> | |
259 | + <!-- 使用优惠券和不使用优惠券层--> | |
260 | + <view class="may_use_coupon fs28 flex"> 可使用的优惠券 | |
261 | + <view class=" is_use_coupon flex-vertical" bindtap="sele_quan_item" data-no="1">不使用优惠券 | |
262 | + <block wx:if="{{using_quan[selected_quan_pick].is_nouse_red}}"> | |
263 | + <view class="circle white xc-hooka fs20 red-b sn"><text>Γ</text></view> | |
264 | + </block> | |
265 | + <block wx:else> | |
266 | + <view class="circle xc-hookst ons"></view> | |
267 | + </block> | |
268 | + </view> | |
269 | + </view> | |
270 | + | |
271 | + <!-- 中间券内容显示 --> | |
272 | + <view class="xc-frame flex-level"> | |
273 | + <view class="list-frame"> | |
274 | + <view wx:for="{{selected_quan_list}}" bindtap="sele_quan_item" wx:if="{{!item.is_using}}" data-ind="{{q_index}}" | |
275 | + wx:for-item="item" wx:for-index="q_index"> | |
276 | + <view class="xc-coupon-frame flex-center" data-ind="{{q_index}}"> | |
277 | + <view class="coupon-frame flex rel"> | |
278 | + <!-- 锯齿 --> | |
279 | + <include src="juchi_part.wxml" /> | |
280 | + <!-- 左边 --> | |
281 | + <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center"> | |
282 | + <view class="white xc-money-frames"> | |
283 | + <view class="f_text"><text class="xc-rmb-symbol">¥</text><text class="xc-rmb-val">{{item.Sum}}</text></view> | |
284 | + <view class="coupon-explain t-c" wx:if="{{item.BuySum>0}}">满{{item.BuySum}}元可用</view> | |
285 | + <view class="coupon-explain t-c" wx:else>满0元可用</view> | |
286 | + </view> | |
287 | + </view> | |
288 | + <!-- 右边 --> | |
289 | + <view class="coupon-right flex-center rel"> | |
290 | + <view class="coupon-annotation flex"> | |
291 | + <view class="flex top-frame"> | |
292 | + <view class="frame"> | |
293 | + <view class="coupon-wode ib flex ellipsis-2 "> | |
294 | + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(item.UseObjectType)}}</text> | |
295 | + <block>{{item.Sum}}元优惠券</block> | |
296 | + </view> | |
297 | + <view class="coupon-time">{{filters.replace_time2(item.BeginDate)}}至{{item.ValidDate?filters.replace_time2(item.ValidDate):'不限'}}</view> | |
298 | + </view> | |
299 | + </view> | |
300 | + <block wx:if="{{item.show_red}}"> | |
301 | + <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view> | |
302 | + </block> | |
303 | + <block wx:else> | |
304 | + <view class="circle xc-hooks on"></view> | |
305 | + </block> | |
306 | + </view> | |
307 | + <include src="remark_click_part.wxml" /> | |
308 | + </view> | |
309 | + </view> | |
310 | + </view> | |
311 | + <!-- 打开是说明 --> | |
312 | + <include src="remark_part.wxml" /> | |
313 | + </view> | |
314 | + <!-- 包邮券的显示,立即购买 --> | |
315 | + <block wx:if="{{bn_exp_type==0}}"> | |
316 | + <view wx:for="{{get_by_quan_list}}" bindtap="sele_quan_item_by" wx:if="{{!item.is_using}}" data-ind="{{byq_index}}" | |
317 | + wx:for-item="item" wx:for-index="byq_index"> | |
318 | + <view class="xc-coupon-frame flex-center" data-ind="{{byq_index}}"> | |
319 | + <view class="coupon-frame flex rel"> | |
320 | + <!-- 锯齿 --> | |
321 | + <include src="juchi_part.wxml" /> | |
322 | + <!-- 左边 --> | |
323 | + <view class="coupon-left rel {{filter.setcolor(item.UseObjectType)}} flex-center"> | |
324 | + <view class="white xc-money-frames"> | |
325 | + <view class="f_text"><text class="xc-rmb-val">包邮券</text></view> | |
326 | + <view class="coupon-explain t-c" wx:if="{{item.condition>0}}">满{{item.condition}}元可用</view> | |
327 | + <view class="coupon-explain t-c" wx:else>满0元可用</view> | |
328 | + </view> | |
329 | + </view> | |
330 | + <!-- 右边 --> | |
331 | + <view class="coupon-right flex-center rel"> | |
332 | + <view class="coupon-annotation flex"> | |
333 | + <view class="flex top-frame"> | |
334 | + <view class="frame"> | |
335 | + <view class="coupon-wode ib flex ellipsis-2 "> | |
336 | + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(0)}}</text> | |
337 | + <block>包邮券</block> | |
338 | + </view> | |
339 | + <view class="coupon-time">{{filters.format_time(item.use_start_time)}}至{{item.use_end_time?filters.format_time(item.use_end_time):'不限'}}</view> | |
340 | + </view> | |
341 | + </view> | |
342 | + <block wx:if="{{item.show_red}}"> | |
343 | + <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view> | |
344 | + </block> | |
345 | + <block wx:else> | |
346 | + <view class="circle xc-hooks on"></view> | |
347 | + </block> | |
348 | + </view> | |
349 | + <include src="remark_click_part2.wxml" /> | |
350 | + </view> | |
351 | + </view> | |
352 | + </view> | |
353 | + <!-- 打开是说明 --> | |
354 | + <include src="remark_part.wxml" /> | |
355 | + </view> | |
356 | + </block> | |
357 | + | |
358 | + | |
359 | + | |
360 | + | |
361 | + </view> | |
362 | + </view> | |
363 | + <!-- 最底下确定层--> | |
364 | + <view class="determine-frame"> | |
365 | + <view class="xc-confirm flex-center" bindtap="confirm_quan"> 确定 </view> | |
366 | + </view> | |
367 | + </view> | |
368 | +</view> | |
369 | +<!----弹起选择物流名的列表----> | |
370 | +<view wx:if='{{open_express==1}}'> | |
371 | + <view class="cover-layer flex-center " bindtap='close_express'> | |
372 | + </view> | |
373 | + | |
374 | + <view class="cx-popup radius {{open_express==1?'up' : 'down'}}"> | |
375 | + <view class="tops flex"> | |
376 | + <view class="top-content fs32"> | |
377 | + <view>选择物流名字</view> | |
378 | + </view> | |
379 | + <view class="close-frame" bindtap='close_express'> | |
380 | + <view class="xc-close-express">×</view> | |
381 | + </view> | |
382 | + </view> | |
383 | + <view class="express_list"> | |
384 | + <view wx:for="{{wu_arr}}" wx:for-item="express_list" wx:for-index="idx"> | |
385 | + <view class="express_list_frame" bindtap="click_express_name" data-shippingcode="{{express_list.shipping_code}}" | |
386 | + data-name="{{express_list.name}}" data-idxe="{{idx}}"> | |
387 | + | |
388 | + <block wx:if="{{is_express==idx}}"> | |
389 | + <view class="circle white xc-hook fs20 red-b"><text>Γ</text></view> | |
390 | + </block> | |
391 | + <block wx:else> | |
392 | + <view class="circle xc-hooks"></view> | |
393 | + </block> | |
394 | + <view class="fs30">{{express_list.name}}</view> | |
395 | + | |
396 | + </view> | |
397 | + </view> | |
398 | + </view> | |
399 | + <view class="flex click-buttem"> | |
400 | + <view class="xc-determine flex-center" bindtap="determine_expres"> | |
401 | + <view class="flex-vertical t-c">确定</view> | |
402 | + </view> | |
403 | + <view class="xc-confirms flex-center" bindtap="select_default_logistics"> | |
404 | + <view class="flex-vertical t-c">设为默认</view> | |
405 | + </view> | |
406 | + </view> | |
407 | + | |
408 | + </view> | |
409 | +</view> | |
410 | +<warn id="warn"></warn> | |
411 | +<!-- 是不是使用店铺优惠pop --> | |
412 | +<view class="cover-layer flex ai-center" bindtap="close_offline" wx:if="{{is_offline_show}}"> | |
413 | + <view style="background-color: #fff; width: 540rpx; margin: 0 auto; border-radius: 20rpx;"> | |
414 | + <view class="fs32" style="text-align: center;height: 80rpx; line-height: 80rpx;">店铺优惠</view> | |
415 | + <view class="flex jc_sb ai-center fs28" style="height: 80rpx; width: 400rpx; margin-left: 70rpx;"> | |
416 | + <view catchtap="sure_offline" class="flex ai-center" >优惠¥{{show_off_price}} | |
417 | + <icon style="margin-left: 10rpx;" color="{{is_get_offline?'red':'gray'}}" size="14" type="success" role="img"></icon></view> | |
418 | + <view catchtap="cancle_offline" class="flex ai-center" >不用优惠 | |
419 | + <icon style="margin-left: 10rpx;" color="{{is_get_offline!=1?'red':'gray'}}" size="14" type="success" role="img"></icon> </view> | |
420 | + </view> | |
421 | + </view> | |
422 | +</view> | ... | ... |
packageC/pages/presell/cart/cart2.wxss
0 → 100644
1 | +.bdr_t-14 { | |
2 | + border-top-left-radius: 14rpx; | |
3 | + border-top-right-radius: 14rpx; | |
4 | +} | |
5 | +.bdr_b-14 { | |
6 | + border-bottom-left-radius: 14rpx; | |
7 | + border-bottom-right-radius: 14rpx; | |
8 | +} | |
9 | +.bdr14 { | |
10 | + border-radius: 14rpx; | |
11 | +} | |
12 | +.mgt20 { | |
13 | + margin-top: 20rpx; | |
14 | +} | |
15 | +.shadow { | |
16 | + box-shadow: 0 4rpx 12px #e7e9eb; | |
17 | +} | |
18 | +.shadow-1 { | |
19 | + box-shadow: 16rpx 0px 12px #e7e9eb; | |
20 | +} | |
21 | + | |
22 | + | |
23 | + | |
24 | + | |
25 | +page { | |
26 | + /* background-color: #FAFAFA; */ | |
27 | + background-color: #F0F0F0; | |
28 | + padding: 0 22rpx; | |
29 | + box-sizing: border-box; | |
30 | +} | |
31 | +.container { | |
32 | + background-color: #F0F0F0; | |
33 | + /* padding-top: 28rpx; */ | |
34 | + padding-bottom: 120rpx; | |
35 | +} | |
36 | + | |
37 | +.tab-container { | |
38 | + font-size: 28rpx; | |
39 | + margin-top: 20rpx; | |
40 | + display: flex; | |
41 | +} | |
42 | + | |
43 | +.tab-wrapper { | |
44 | + background-color: #ccc; | |
45 | + display: flex; | |
46 | + border-radius: 40rpx; | |
47 | + overflow: hidden; | |
48 | +} | |
49 | + | |
50 | +.tab { | |
51 | + padding: 20rpx 30rpx; | |
52 | + | |
53 | +} | |
54 | + | |
55 | + | |
56 | +.tab.active { | |
57 | + background-color: white; | |
58 | + border-radius: 40rpx; | |
59 | +} | |
60 | + | |
61 | + | |
62 | +.user-mes { | |
63 | + position: relative; | |
64 | + background-color: #fff; | |
65 | + font-size: 32rpx; | |
66 | + color: #444; | |
67 | + /* margin-top: 28rpx; */ | |
68 | + border-radius: 14rpx; | |
69 | + padding: 20rpx 70rpx 20rpx 20rpx; | |
70 | +} | |
71 | +.user-contact { | |
72 | + /* padding: 24rpx 26rpx; | |
73 | + font-weight: 600; */ | |
74 | +} | |
75 | + | |
76 | +.location { | |
77 | + position: relative; | |
78 | + /* padding: 0 70rpx 24rpx; */ | |
79 | +} | |
80 | + | |
81 | +.pos-icon { | |
82 | + /* position: absolute; */ | |
83 | + /* left: 28rpx; | |
84 | + top: 6rpx; */ | |
85 | + width: 20rpx; | |
86 | + height: 24rpx; | |
87 | + display: inline-block; | |
88 | +} | |
89 | + | |
90 | +.border-img { | |
91 | + width: 100%; | |
92 | + height: 12rpx; | |
93 | +} | |
94 | + | |
95 | +.update-logistics { | |
96 | + position: absolute; | |
97 | + right: 0; | |
98 | + top: 0; | |
99 | + width: 80rpx; | |
100 | + height: 100%; | |
101 | + display: flex; | |
102 | + align-items: center; | |
103 | + justify-content: center; | |
104 | +} | |
105 | + | |
106 | +.arrow-rigth { | |
107 | + width: 32rpx; | |
108 | + height: 32rpx; | |
109 | +} | |
110 | + | |
111 | +.order-meg { | |
112 | + margin-bottom: 20rpx; | |
113 | + font-size: 28rpx; | |
114 | + | |
115 | +} | |
116 | + | |
117 | +.order-detail { | |
118 | + padding: 30rpx 0; | |
119 | + border-bottom: 2rpx solid #eee; | |
120 | + color: #777; | |
121 | + min-height: 190rpx; | |
122 | + background-color: #fff; | |
123 | + | |
124 | +} | |
125 | + | |
126 | +.goods-img { | |
127 | + float: left; | |
128 | + width: 200rpx; | |
129 | + height: 200rpx; | |
130 | + margin: 0 20rpx; | |
131 | +} | |
132 | + | |
133 | +.order-cont { | |
134 | + float: left; | |
135 | + width: 438rpx; | |
136 | +} | |
137 | + | |
138 | +.goods-name { | |
139 | + height: 74rpx; | |
140 | + line-height: 40rpx; | |
141 | + overflow: hidden; | |
142 | + margin-bottom: 16rpx; | |
143 | + font-size: 28rpx; | |
144 | + color: #333; | |
145 | + | |
146 | +} | |
147 | + | |
148 | +.goods-color { | |
149 | + font-size: 24rpx; | |
150 | +} | |
151 | + | |
152 | +.order-num { | |
153 | + margin-top: 25rpx; | |
154 | + font-size: 24rpx; | |
155 | + line-height: 42rpx; | |
156 | +} | |
157 | + | |
158 | +.set-mes{ | |
159 | + background-color: #fff; | |
160 | + /* margin-top: 20rpx; */ | |
161 | +} | |
162 | +.use-item{ | |
163 | + display: flex; | |
164 | + align-items: center; | |
165 | + /* height: 80rpx; */ | |
166 | + /* border-bottom: 1px solid #ddd; */ | |
167 | + font-size: 26rpx; | |
168 | + /* width:95%; | |
169 | +margin:auto; */ | |
170 | + padding: 20rpx; | |
171 | +} | |
172 | +.use-item>view{ | |
173 | + display: flex; | |
174 | + /* margin-right: 12rpx; */ | |
175 | +} | |
176 | +.use-item.bfff{ | |
177 | + background-color: #fff; | |
178 | +} | |
179 | +.use-item .dp{ | |
180 | + display: block; | |
181 | + width: 40rpx; | |
182 | + height: 40rpx; | |
183 | + /* margin-left: -6rpx; */ | |
184 | +} | |
185 | + | |
186 | +.set-item { | |
187 | + justify-content: space-between; | |
188 | + background-color: #fff; | |
189 | +} | |
190 | + | |
191 | +.set-btn { | |
192 | + display: flex; | |
193 | + font-size: 24rpx; | |
194 | +} | |
195 | + | |
196 | +.set-mes input { | |
197 | + width: 380rpx; | |
198 | + height: 50rpx; | |
199 | + line-height: 50rpx; | |
200 | + border: 1px solid #ddd; | |
201 | +} | |
202 | + | |
203 | +.use-btn { | |
204 | + width: 100rpx; | |
205 | + height: 50rpx; | |
206 | + margin-left: 20rpx; | |
207 | + line-height: 50rpx; | |
208 | + text-align: center; | |
209 | + background-color: #f23030; | |
210 | + color: #fff; | |
211 | +} | |
212 | + | |
213 | +.coupon-mes { | |
214 | + /* box-sizing: border-box; */ | |
215 | + /* height:95rpx; */ | |
216 | + padding: 20rpx; | |
217 | + background-color: #fff; | |
218 | + font-size: 30rpx; | |
219 | + /* color: #444; */ | |
220 | + /* width: 100%; */ | |
221 | + border-radius: 14rpx; | |
222 | + margin-top: 20rpx; | |
223 | + margin-bottom: 20rpx; | |
224 | +} | |
225 | + | |
226 | +.coupon-title { | |
227 | + display: flex; | |
228 | + justify-content: space-between; | |
229 | + align-items: center; | |
230 | + height: 92rpx; | |
231 | +} | |
232 | + | |
233 | +.coupon-title>view { | |
234 | + display: flex; | |
235 | +} | |
236 | + | |
237 | +.coupon-num { | |
238 | + height: 36rpx; | |
239 | + margin-left: 20rpx; | |
240 | + padding: 0 16rpx; | |
241 | + line-height: 36rpx; | |
242 | + text-align: center; | |
243 | + background-color: #f23030; | |
244 | + color: #fff; | |
245 | + font-size: 24rpx; | |
246 | +} | |
247 | + | |
248 | +.leave-word { | |
249 | + position: relative; | |
250 | + font-size: 24rpx; | |
251 | + margin-left: 20rpx; | |
252 | + display: flex; | |
253 | + align-items: center; | |
254 | + height: 50rpx; | |
255 | + width: 500rpx; | |
256 | +} | |
257 | + | |
258 | +.word-box { | |
259 | + font-size: 26rpx; | |
260 | + /* width: 600rpx; */ | |
261 | + /* padding: 10rpx; | |
262 | + height: 28rpx; | |
263 | + line-height: 40rpx; */ | |
264 | +} | |
265 | + | |
266 | +.max-word { | |
267 | + position: absolute; | |
268 | + right: 0; | |
269 | + bottom: 0; | |
270 | +} | |
271 | + | |
272 | +.information { | |
273 | + /* padding: 20rpx; */ | |
274 | + background-color: #fff; | |
275 | + /* margin-bottom: 120rpx; */ | |
276 | +} | |
277 | + | |
278 | +.information .item { | |
279 | + display: flex; | |
280 | + justify-content: space-between; | |
281 | + /* height: 60rpx; | |
282 | + line-height: 60rpx; */ | |
283 | + font-size: 24rpx; | |
284 | + /* color: #333; */ | |
285 | + padding: 20rpx; | |
286 | +} | |
287 | + | |
288 | +.btn-wrap { | |
289 | + height: 94rpx; | |
290 | + box-sizing: border-box; | |
291 | + display: flex; | |
292 | + justify-content: space-between; | |
293 | + background-color: white; | |
294 | + align-items: center; | |
295 | + position: fixed; | |
296 | + bottom: 0; | |
297 | + left: 0; | |
298 | + width: 100%; | |
299 | + padding: 0 30rpx; | |
300 | +} | |
301 | + | |
302 | +.tips-btn { | |
303 | + /* float: right; | |
304 | + width: 200rpx; | |
305 | + height: 100rpx; | |
306 | + line-height: 100rpx; | |
307 | + text-align: center; | |
308 | + font-size: 30rpx; | |
309 | + color: #fff; | |
310 | + background-color: #f23030; */ | |
311 | + color: white; | |
312 | + background-color: #FE4445; | |
313 | + height: 72rpx; | |
314 | + line-height: 72rpx; | |
315 | + padding: 0 42rpx; | |
316 | + border-radius: 36rpx; | |
317 | + margin-left: 0; | |
318 | + margin-right: 0; | |
319 | +} | |
320 | + | |
321 | +.pay-amount { | |
322 | + /* float: right; | |
323 | + display: flex; | |
324 | + align-items: center; | |
325 | + height: 100rpx; | |
326 | + font-size: 26rpx; | |
327 | + margin-right: 40rpx; */ | |
328 | +} | |
329 | + | |
330 | +.payable { | |
331 | + color: #444; | |
332 | + /* margin-right: 20rpx; */ | |
333 | +} | |
334 | + | |
335 | +.shipping-modal { | |
336 | + z-index: 20; | |
337 | + position: fixed; | |
338 | + bottom: 0; | |
339 | + left: 0; | |
340 | + right: 0; | |
341 | + overflow-y: hidden; | |
342 | + color: #666666; | |
343 | + background-color: white; | |
344 | +} | |
345 | + | |
346 | +.shipping-nav { | |
347 | + text-align: center; | |
348 | + font-size: 35rpx; | |
349 | + padding-top: 30rpx; | |
350 | +} | |
351 | + | |
352 | +.shipping-list { | |
353 | + padding: 20rpx 30rpx 40rpx; | |
354 | + font-size: 28rpx; | |
355 | +} | |
356 | + | |
357 | +.shipping-item { | |
358 | + display: block; | |
359 | + padding: 20rpx 0; | |
360 | +} | |
361 | + | |
362 | +.shipping-btn { | |
363 | + width: 100%; | |
364 | + color: white; | |
365 | + background-color: #f23030; | |
366 | + line-height: 90rpx; | |
367 | + text-align: center; | |
368 | + font-size: 40rpx; | |
369 | +} | |
370 | + | |
371 | +/*----------nyf新增,地址---------*/ | |
372 | +.add_new{ | |
373 | + height: 90rpx; | |
374 | + display: flex; | |
375 | + align-items: center; | |
376 | + padding: 0 26rpx; | |
377 | +} | |
378 | +.addr_jia{width: 45rpx; height: 45rpx; border: 1rpx solid #ddd; | |
379 | + margin-right: 15rpx;vertical-align: middle;} | |
380 | +.yu_er{ | |
381 | + margin-left: 10rpx; | |
382 | + /* margin-right: 60rpx; */ | |
383 | +} | |
384 | +.wuliu{margin-left: 20rpx;} | |
385 | + | |
386 | + | |
387 | +/*---- 优惠券列表 -----*/ | |
388 | +.xc-coupon-frame{ | |
389 | + width: 100%; | |
390 | + height: 92rpx; | |
391 | + | |
392 | +} | |
393 | +.xc-coupon-frame .work-frame{ | |
394 | + width: 100%; | |
395 | + height: 100%; | |
396 | + border-bottom:3rpx solid #eee; | |
397 | + padding: 0 26rpx; | |
398 | + background-color: white; | |
399 | +} | |
400 | +.xc-right{ | |
401 | + width:12rpx; | |
402 | + height:12rpx; | |
403 | + border-top:2rpx solid #000; | |
404 | + border-right:2rpx solid #000; | |
405 | + transform:rotate(45deg); | |
406 | + display:inline-block; | |
407 | + margin-left: 10rpx; | |
408 | +} | |
409 | + | |
410 | +.xc-coupon-frame .work-frame .work{ font-size: 30rpx; line-height: 92rpx; } | |
411 | +.xc-right-frame{font-size: 30rpx;line-height: 92rpx; margin-right: 10rpx } | |
412 | + | |
413 | +/* 自定义弹出窗口 */ | |
414 | +.cx-popup{ | |
415 | + width:100%; | |
416 | + height:880rpx; | |
417 | + background: #fff; | |
418 | + z-index: 35; | |
419 | + border-top-left-radius: 20rpx; | |
420 | + border-top-right-radius: 20rpx; | |
421 | + position:fixed; | |
422 | + bottom:0; | |
423 | + left: 0; | |
424 | + /* padding-bottom: 25rpx; */ | |
425 | +} | |
426 | + | |
427 | +.cx-popup .top{ | |
428 | + width:95%; | |
429 | + height:100rpx; | |
430 | + border-bottom:3rpx solid #ddd; | |
431 | + margin: auto; | |
432 | + margin-top: 30rpx; | |
433 | + | |
434 | +} | |
435 | +.xc-top-content{ | |
436 | + width: 93%; | |
437 | + height:85rpx; | |
438 | + padding-top: 30rpx; | |
439 | + font-size: 34rpx; | |
440 | + font-weight: 600; | |
441 | + | |
442 | +} | |
443 | + | |
444 | + | |
445 | +.xc-valid-coupon{ | |
446 | + width: 90%; | |
447 | + height:40rpx; | |
448 | + padding-top: 24rpx; | |
449 | + overflow: hidden; | |
450 | +} | |
451 | +.xc-frame{ | |
452 | + width: 100%; | |
453 | + height:60%; | |
454 | +} | |
455 | + | |
456 | +.xc-frame .list-frame{ | |
457 | + width: 95%; | |
458 | + height: 100%; | |
459 | + overflow-y:scroll; | |
460 | + | |
461 | +} | |
462 | +.xc-close-frame{ | |
463 | + margin-top:-10rpx; | |
464 | + | |
465 | +} | |
466 | + | |
467 | +.xc-close{ | |
468 | + width: 37rpx; | |
469 | +height: 37rpx; | |
470 | +border-radius: 50%; | |
471 | +border: 3rpx solid #333; | |
472 | +text-align: center; | |
473 | +line-height: 34rpx; | |
474 | +font-size: 29rpx; | |
475 | +color: #333; | |
476 | + | |
477 | +} | |
478 | +.xc-money{ | |
479 | + color: #af2346; | |
480 | + font-size: 35rpx; | |
481 | +} | |
482 | + | |
483 | +.xc-money-frame{ | |
484 | + margin-left:35rpx; | |
485 | + | |
486 | +} | |
487 | +.xc-coupon-effect{ | |
488 | + width: 99%; | |
489 | + min-height: 100rpx; | |
490 | + border-bottom:3rpx solid #ddd; | |
491 | + | |
492 | + | |
493 | +} | |
494 | +.xc-goods-coupon{ | |
495 | + width: 85%; | |
496 | + height:100%; | |
497 | + | |
498 | +} | |
499 | +.xc-title{ | |
500 | + width:50%; | |
501 | + margin-left:222rpx; | |
502 | + | |
503 | +} | |
504 | +.xc-coupon-money0{ | |
505 | + color: #c91e31; | |
506 | + font-size: 35rpx; | |
507 | + line-height: 40rpx; | |
508 | + | |
509 | +} | |
510 | +.xc-coupon-money{ | |
511 | + color: #c91e31; | |
512 | + font-size: 35rpx; | |
513 | + line-height: 40rpx; | |
514 | + padding-top: 10px; | |
515 | + | |
516 | +} | |
517 | +.xc-coupon-money1{ | |
518 | + color: #444; | |
519 | + font-size: 28rpx; | |
520 | + line-height: 60rpx; | |
521 | + | |
522 | + | |
523 | +} | |
524 | +.xc-coupon-time{ | |
525 | + height: 50rpx; | |
526 | + font-size: 27rpx; | |
527 | + color: #a4a4a4; | |
528 | +} | |
529 | +.xc-coupon-time .time{ | |
530 | + margin-left: 15rpx; | |
531 | + font-size: 27rpx; | |
532 | +} | |
533 | +.xc-coupon-selection{ | |
534 | + height:100%; | |
535 | +} | |
536 | + | |
537 | +.xc-confirm { | |
538 | + width: 50%; | |
539 | + border-radius: 50rpx; | |
540 | + height: 80rpx; | |
541 | + margin:0 auto; | |
542 | + background:#d60021; | |
543 | + color:#fff; | |
544 | + font-size:28rpx; | |
545 | + margin-top: 28rpx; | |
546 | +} | |
547 | + | |
548 | +.up{ animation: up .7s; } | |
549 | +.down{ animation: down 1s; } | |
550 | +@keyframes up { 0% { transform: translateY(550rpx); } 100% { transform: translateY(0); } } | |
551 | +@keyframes down { 0% { transform: translateY(0); } 100% { transform: translateY(550rpx); } } | |
552 | + | |
553 | +.xc-not-Selection{ | |
554 | + width: 40rpx; | |
555 | +height: 40rpx; | |
556 | + background: #eeeeee; | |
557 | +} | |
558 | + | |
559 | + | |
560 | +.xc-close-express{ | |
561 | + width: 40rpx; | |
562 | +height: 40rpx; | |
563 | +border-radius: 50%; | |
564 | +border: 3rpx solid #333; | |
565 | +text-align: center; | |
566 | +font-size:32rpx; | |
567 | +line-height: 38rpx; | |
568 | +color: #333; | |
569 | +margin-top: 5rpx; | |
570 | +} | |
571 | +.cx-popup .tops{ | |
572 | + width: 100%; | |
573 | +height: 145rpx; | |
574 | +border-bottom: 3rpx solid #eee; | |
575 | + | |
576 | +} | |
577 | +.top-content { | |
578 | + width: 82%; | |
579 | +padding-top: 33px; | |
580 | +height: 100%; | |
581 | +padding-left: 40rpx; | |
582 | +} | |
583 | +.close-frame{ | |
584 | + margin-top: 30rpx; | |
585 | + | |
586 | +} | |
587 | + | |
588 | +.xc-hook { | |
589 | +width: 33rpx; | |
590 | +height: 33rpx; | |
591 | +transform: rotate(-135deg); | |
592 | +line-height: 35rpx; | |
593 | +text-align: center; | |
594 | +margin-right: 20rpx | |
595 | + | |
596 | + | |
597 | +} | |
598 | +.xc-hooks { | |
599 | +width: 30rpx; | |
600 | +height: 30rpx; | |
601 | +border: 1rpx solid #999; | |
602 | +margin-right: 20rpx; | |
603 | +} | |
604 | +.express_list_frame{ | |
605 | + display: flex; | |
606 | +height: 80rpx; | |
607 | +align-items: center; | |
608 | +padding-left: 40rpx; | |
609 | +border-bottom: 1rpx solid #eee; | |
610 | + | |
611 | +} | |
612 | +.express_list{ | |
613 | + width: 100%; | |
614 | + height: 65%; | |
615 | + overflow-y: auto; | |
616 | + margin-bottom: 40rpx; | |
617 | + | |
618 | +} | |
619 | +.xc-confirms { | |
620 | + box-sizing: border-box; | |
621 | + width: 40%; | |
622 | + border-radius: 50rpx; | |
623 | + height: 80rpx; | |
624 | + margin:0 auto; | |
625 | + font-size:28rpx; | |
626 | + background: #fff; | |
627 | + color: #333; | |
628 | + border: 2rpx solid #333; | |
629 | +} | |
630 | + | |
631 | + | |
632 | +/* 优惠券的改版样式 */ | |
633 | +.xc-coupon-frame{ | |
634 | + /* width: 710rpx; */ | |
635 | + width: 100%; | |
636 | + height:auto; | |
637 | + margin: 0 auto; | |
638 | + | |
639 | +} | |
640 | +.xc-coupon-frame .coupon-frame{ | |
641 | + width: 100%; | |
642 | + height: 200rpx; | |
643 | + margin-top:10rpx; | |
644 | + border-bottom: 1rpx solid #eee; | |
645 | + | |
646 | +} | |
647 | +.xc-coupon-frame .coupon-frame .coupon-left{ | |
648 | + width: 215rpx; | |
649 | + height:100%; | |
650 | + overflow: hidden; | |
651 | +} | |
652 | +.xc-money-frames{ | |
653 | + width:96%; | |
654 | + margin-top: -10px; | |
655 | +} | |
656 | + | |
657 | +.xc-rmb-symbol{ | |
658 | + font-size:40rpx; | |
659 | + | |
660 | +} | |
661 | + | |
662 | +.xc-rmb-val{ | |
663 | + font-size:60rpx; | |
664 | + | |
665 | +} | |
666 | +.coupon-explain{ | |
667 | + font-size:25rpx; | |
668 | +width:100%; | |
669 | + | |
670 | + | |
671 | +} | |
672 | +.xc-valuer{ | |
673 | + margin-top:39rpx; | |
674 | + margin-left:28rpx; | |
675 | + font-size:25rpx; | |
676 | +} | |
677 | +.coupon-frame .oval{ | |
678 | + width:155rpx; | |
679 | + height:83rpx; | |
680 | + border-radius: 50%; | |
681 | + right:-78rpx; | |
682 | + top:-37rpx; | |
683 | +} | |
684 | +.coupon-right{ | |
685 | + /* width:490rpx; */ | |
686 | + height: 99%; | |
687 | + border-top: 1rpx solid #eaeaea; | |
688 | + /* //border-bottom: 1rpx solid #eaeaea; */ | |
689 | + border-right: 1rpx solid #eaeaea; | |
690 | + flex-grow: 1; | |
691 | +} | |
692 | +.coupon-annotation{ | |
693 | + width: 95%; | |
694 | + height: 100%; | |
695 | + | |
696 | +} | |
697 | +.xc-brand{ | |
698 | + width:100rpx; | |
699 | + height:35rpx; | |
700 | + line-height: 35rpx; | |
701 | + font-size:21rpx; | |
702 | + border-radius:10rpx; position: relative; top:-1px; | |
703 | + margin-right: 8rpx | |
704 | +} | |
705 | +.top-frame{ | |
706 | + width:82%; | |
707 | + height: 75rpx; | |
708 | + margin-top:10rpx; | |
709 | +} | |
710 | +.top-frame .coupon-wode{ | |
711 | + font-size: 25rpx; | |
712 | + margin-left:10rpx; | |
713 | + width:340rpx; | |
714 | + height:88rpx; | |
715 | +} | |
716 | +.coupon-code{ | |
717 | + width:60rpx; | |
718 | + height:60rpx; | |
719 | + margin-top:5rpx; | |
720 | + | |
721 | +} | |
722 | +.frame{ | |
723 | + width: 100% | |
724 | +} | |
725 | +.coupon-time{ | |
726 | + font-size: 23rpx; | |
727 | + line-height:33rpx; | |
728 | + color: #333; | |
729 | +} | |
730 | + | |
731 | +.clik-get{ | |
732 | + width:125rpx; | |
733 | + height:45rpx; | |
734 | + border-radius: 25rpx; | |
735 | + line-height: 45rpx; | |
736 | + font-size:25rpx; | |
737 | + bottom:67rpx; | |
738 | + right:6px; | |
739 | +} | |
740 | + | |
741 | +.code-img{ | |
742 | + margin-left:20rpx; | |
743 | +} | |
744 | +.bottmo-explain{ | |
745 | +top:145rpx; | |
746 | +width:94%; | |
747 | +border-top:1rpx dashed #eee; | |
748 | +padding-top:8rpx; | |
749 | +height:38rpx; | |
750 | +line-height: 51rpx; | |
751 | + | |
752 | +} | |
753 | +.font-word{ | |
754 | + font-size: 22rpx; | |
755 | +} | |
756 | +.circle-size{ | |
757 | + background: #a0a0a0; | |
758 | + width: 27rpx; | |
759 | + height: 27rpx; | |
760 | + margin-top:13rpx; | |
761 | +margin-left:8rpx; | |
762 | +display: flex; | |
763 | + | |
764 | +align-items: center; | |
765 | +} | |
766 | +.xc-jiantou{ | |
767 | + /* width: 9rpx; | |
768 | + height: 9rpx; */ | |
769 | + /* border-top: 2rpx solid #fff; | |
770 | + border-right: 2rpx solid #fff; */ | |
771 | + transform: rotate(-90deg); | |
772 | + color: #fff; | |
773 | + font-size: 15rpx; | |
774 | + /* display:inline-block; | |
775 | + margin-top: 6.5rpx; */ | |
776 | + text-align: center; | |
777 | +width: 24rpx; | |
778 | +} | |
779 | +.xc-buttom{ | |
780 | + box-sizing: border-box; | |
781 | + width:100%; | |
782 | + min-height:76rpx; | |
783 | + height:auto; | |
784 | + line-height:40rpx; | |
785 | + border-left:1rpx solid #eee; | |
786 | + border-right:1rpx solid #eee; | |
787 | + border-bottom:1rpx solid #eee; | |
788 | +/* margin-left: 6rpx; */ | |
789 | +} | |
790 | + | |
791 | +.goods-num{ | |
792 | + font-size: 28rpx; | |
793 | + color: #333; | |
794 | +} | |
795 | + | |
796 | +.explain-coupon{ | |
797 | + font-size:25rpx; | |
798 | + padding: 10rpx 10rpx | |
799 | +} | |
800 | +.circle-frame{ | |
801 | + width: 20rpx; | |
802 | + height: auto; | |
803 | + z-index:1; | |
804 | + left:210rpx; | |
805 | + | |
806 | +} | |
807 | +.circle-sawtooth{ | |
808 | + width: 11rpx; | |
809 | + height: 11rpx; | |
810 | + background: #fff; | |
811 | +} | |
812 | + | |
813 | +.red{background-color: #fe7496;} | |
814 | +.green{ background-color: #22c7c1;} | |
815 | +.blue{background-color:#5e82e3;} | |
816 | +.g_gray{background-color: #aaaaaa} | |
817 | + | |
818 | +.f_text{text-align: center; height:96rpx; } | |
819 | +.xc-hook.sn { | |
820 | + margin-top:12%; | |
821 | +width:45rpx; | |
822 | +height:45rpx; | |
823 | +font-size:28rpx; | |
824 | +line-height:44rpx; | |
825 | + | |
826 | + | |
827 | +} | |
828 | +.xc-hooks.on{ | |
829 | + margin-top:12%; | |
830 | +width:42rpx; | |
831 | +height:42rpx; | |
832 | +} | |
833 | +.may_use_coupon{ | |
834 | + /* width: 95%; */ | |
835 | + /* height: 68rpx; */ | |
836 | + line-height:78rpx; | |
837 | + padding: 0 26rpx; | |
838 | + justify-content: space-between; | |
839 | + align-items: center; | |
840 | +} | |
841 | +.determine-frame{ | |
842 | + width: 100%; | |
843 | + height: 130rpx; | |
844 | + | |
845 | +} | |
846 | +.xc-determine{ | |
847 | + height: 80rpx; | |
848 | + width: 40%; | |
849 | + border-radius: 50rpx; | |
850 | +background: #d60021; | |
851 | +color: #fff; | |
852 | +font-size: 28rpx; | |
853 | +margin: 0 auto; | |
854 | + | |
855 | +} | |
856 | +.click-buttem{ | |
857 | +width: 90%; | |
858 | +margin: auto; | |
859 | +} | |
860 | +.logistics-name{ | |
861 | + margin-right:20rpx; | |
862 | +} | |
863 | +.xc-border{ | |
864 | + border-top:8rpx solid #eee; | |
865 | +width: 100% | |
866 | +} | |
867 | +.main-top{ | |
868 | +margin-top: 20rpx; | |
869 | + | |
870 | +} | |
871 | +.xc-hookts{ | |
872 | +border: 1rpx solid #999; | |
873 | + | |
874 | +} | |
875 | +.xc-hookts.on{ | |
876 | + width:30rpx; | |
877 | +height:30rpx; | |
878 | + | |
879 | +} | |
880 | +.xc-hookt.sn{ | |
881 | + width: 32rpx; | |
882 | +height: 32rpx; | |
883 | +font-size: 28rpx; | |
884 | +line-height: 34rpx; | |
885 | +} | |
886 | +.xc-hookt{ | |
887 | + transform: rotate(-135deg); | |
888 | +text-align: center; | |
889 | + | |
890 | +} | |
891 | +.main-bottom{ | |
892 | + margin-bottom: 20rpx; | |
893 | + | |
894 | +} | |
895 | +.xc-hookst{ | |
896 | + border: 1rpx solid #999; | |
897 | + | |
898 | +} | |
899 | +.xc-hookst.ons{ | |
900 | + width: 42rpx; | |
901 | +height: 42rpx; | |
902 | +margin-left: 20rpx; | |
903 | + | |
904 | +} | |
905 | +.is_use_coupon{ | |
906 | + width: 65%; | |
907 | +justify-content: flex-end; | |
908 | +padding-top: 10rpx; | |
909 | + | |
910 | + | |
911 | +} | |
912 | +.xc-hooka{ | |
913 | + transform: rotate(-135deg); | |
914 | +text-align: center; | |
915 | + | |
916 | +} | |
917 | +.xc-hooka.sn{ | |
918 | + width: 45rpx; | |
919 | +height: 45rpx; | |
920 | +font-size: 28rpx; | |
921 | +line-height: 44rpx; | |
922 | +margin-left: 20rpx; | |
923 | + | |
924 | +} | |
925 | +.color-gray{ | |
926 | + color: #808080; | |
927 | +} | |
928 | +.n_guige{ display: inline-block; background:rgb(236, 236, 236); color: rgb(63,63,63); padding: 3rpx 10rpx; border-radius: 3rpx } | |
929 | +.gift_image{ width: 60rpx; height: 60rpx; position: absolute; top: 0; left: 0} | |
930 | + | |
931 | +.quan_num_show{ padding: 4rpx 6rpx; background-color:#ea5551; color:#fff; border-radius: 6rpx;margin-left:10rpx;font-size:24rpx;} | |
932 | + | |
933 | +.navigator-hover { | |
934 | + background: none; | |
935 | + opacity: 1; | |
936 | +} | |
937 | + | |
938 | + | |
939 | +.plus_buy{ | |
940 | + background-color: #fff; | |
941 | + margin:15rpx 0; | |
942 | + padding: 20rpx; | |
943 | + position: relative; | |
944 | +} | |
945 | + | |
946 | + | |
947 | +.card_bg { | |
948 | + box-sizing: border-box; | |
949 | + padding: 2rpx 10rpx; | |
950 | + height: 28rpx; | |
951 | + border-radius: 26rpx; | |
952 | + font-size: 18rpx; | |
953 | + line-height: 28rpx; | |
954 | + max-width: 210rpx; | |
955 | + background: #333; | |
956 | + color: #fff; | |
957 | + margin-left: 8rpx; | |
958 | + position:relative; | |
959 | + top:7rpx; | |
960 | +} | |
961 | + | |
962 | +.card_bg image { | |
963 | + width: 19rpx; | |
964 | + height: 19rpx; | |
965 | + margin-right: 8rpx; | |
966 | +} | |
967 | + | |
968 | +/* .card_bg .card_name { | |
969 | + max-width: 76rpx; | |
970 | + width: auto; | |
971 | + overflow: hidden; | |
972 | + white-space: nowrap; | |
973 | +} */ | |
974 | + | |
975 | +.card_name { | |
976 | + position: relative; | |
977 | + top: -4rpx; | |
978 | + margin-left: 6px; | |
979 | +} | |
980 | + | |
981 | +.car_tri_up { | |
982 | + width: 0;height: 0; | |
983 | + border-left: 20rpx solid transparent; | |
984 | + border-right: 20rpx solid transparent; | |
985 | + border-bottom: 20rpx solid #fff; | |
986 | + position: absolute; | |
987 | + right: 20rpx; | |
988 | + top:-10rpx | |
989 | +} | |
990 | +.card_op{ | |
991 | + position: absolute; | |
992 | + right: 20rpx; | |
993 | + top:36rpx | |
994 | +} | |
995 | + | ... | ... |