diff --git a/packageA/pages/details_serviceCard/details_serviceCard.js b/packageA/pages/details_serviceCard/details_serviceCard.js index ac80b52..6875601 100644 --- a/packageA/pages/details_serviceCard/details_serviceCard.js +++ b/packageA/pages/details_serviceCard/details_serviceCard.js @@ -676,6 +676,25 @@ Page({ //秒杀活动和拼团活动要重新计算一下 for (const it of list) { + + var card=null; + await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + store_id + "/" + it.card_id, {}).then(res => { + if(res.data.code==0 && res.data.data){ + card = res.data.data; + } + }) + + if(card && card.storageId){ + let the_c_key=it.pickup_keyid; + if (card.storageId.indexOf(the_c_key)==-1) { + getApp().confirmBox(it.service_name + "的门店不可售"); + th.setData({ paying: 0 }); + flag = false; + return false; + } + } + + if ([1,2].includes(it.prom_type)) { let act_details = null; let redis_num = 0; diff --git a/packageA/pages/profile/profile.js b/packageA/pages/profile/profile.js index d376715..86f3a58 100644 --- a/packageA/pages/profile/profile.js +++ b/packageA/pages/profile/profile.js @@ -1051,7 +1051,7 @@ Page({ if (e.data.code == 0) { app.globalData.user_id = e.data.data.user_id; } else { - return app.showWarning("授权登入失败!" + e.data.msg); + return ut.m_toast("授权登入失败!" + e.data.msg); } getApp().globalData.login_back = 1; wx.setStorageSync("userinfo", e.data.data); diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 2af423a..e25de68 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -2708,6 +2708,9 @@ Page({ item_map.monthlbtitle = get_data.monthlbtitle; } + //优惠促销新增的不包邮模板 + item_map.no_ex_id=rule.no_ex_id; + //-- 单赠品和多赠品 -- if (get_data.gift_id || parseInt(get_data.zp_mode) == 1) { item_map.zp_by = rule.zp_by; @@ -2855,7 +2858,12 @@ Page({ if (ord_goods[j].prom_type == 3 && ord_goods[j].prom_id == item_map.prom_id) { ord_goods[j].is_xz_yh = ord_goods[j].is_xz_yh ? ord_goods[j].is_xz_yh : item_map.is_xz_yh; ord_goods[j].is_past = item_map.is_past; - if (ord_goods[j].is_gift) continue; //赠品不平摊 + + if (ord_goods[j].is_gift){ + //赠品要看赠品本身包不包邮 + if(!item_map.zp_by) ord_goods[j].is_past =0; + continue; //赠品不平摊 + } // ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir; // ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir; @@ -2883,6 +2891,38 @@ Page({ if (fd_map_gd.account_yu != undefined) ord_goods[j].account_yu = fd_map_gd.account_yu; } + //优惠促销包邮,但是又不包邮模板的时候 + if(ord_goods[j].is_past && item_map.no_ex_id>0){ + + let by_mb=null; + let by_mb_url="/api/weshop/areaFeemail/getAreaGoods"; + let by_mb_res= await getApp().request.promiseGet(by_mb_url, { + data:{ + store_id:os.stoid, + id:item_map.no_ex_id + } + }) + + if(by_mb_res && by_mb_res.data.code==0 && by_mb_res.data.data && by_mb_res.data.data.length){ + by_mb=by_mb_res.data.data[0]; + + //如果是不包邮区域的话 + if (by_mb.region_list && th.check_by_area(by_mb.region_list)) { + ord_goods[j].is_past =0; + } + //如果是不包邮商品的时候 + else if (by_mb.goods_list) { + var no_goods_arr = by_mb.goods_list.split(","); + if (no_goods_arr.includes(ord_goods[j].goods_id+"")){ + ord_goods[j].is_past =0; + } + } + + } + + } + + } } } @@ -3581,7 +3621,7 @@ Page({ //累积商品重量 每种商品的重量 * 数量 goods_weight += item[j]['weight'] * item[j]['goods_num']; - if (back_data && back_data.is_by_all && !back_data.no_free_goods) { + if (back_data && back_data.is_by_all && !back_data.no_free_goods && item[j].is_post_temp) { cut_good_weight += item[j]['weight'] * item[j]['goods_num']; if (back_data.weight_free > 0) { out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; diff --git a/packageE/pages/togoin/togoin.js b/packageE/pages/togoin/togoin.js index 265671c..dce08a5 100644 --- a/packageE/pages/togoin/togoin.js +++ b/packageE/pages/togoin/togoin.js @@ -414,7 +414,13 @@ Page({ if (e.data.code == 0) { app.globalData.user_id = e.data.data.user_id; } else { - return app.showWarning("授权登入失败!" + e.data.msg); + + wx.showToast({ + title: "授权登入失败!" + e.data.msg, + icon: 'none', + duration: 2000 + }); + return false; } getApp().globalData.login_back = 1; wx.setStorageSync("userinfo", e.data.data); diff --git a/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js b/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js index 88e8af1..e62d873 100644 --- a/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js +++ b/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js @@ -73,9 +73,13 @@ Page({ share_goods_img:'', //礼包的分享图 giftImageCover:null, canvasHidden:true, - is_receive:1, //是否已经领取 + is_receive:0, //是否已经领取 screenWidth: 0, islogin:false, + + + record_list:null, //月包列表点击跳转过来的记录 + }, onLoad: function (options) { @@ -126,13 +130,41 @@ Page({ } + let user_id= d.user_id || 0; + //判断是不是当前的, 同时未开始的也叫未领取 + let is_cur_list=0; + if(options.record_list_id==options.cur_record_list_id){ + is_cur_list=1; + } + + let recode_sn=options.recode_sn + let url="/api/weshop/marketing/marketingMonthgiftbagRecordList/pageUseMmonthgiftbagRecordList"; + let rq={ + store_id:os.stoid, + user_id:user_id, + order_sn:recode_sn, + id:options.record_list_id + } + getApp().request.promiseGet(url, { + data:rq + }).then(res => { + if(ut.ajax_ok(res)){ + let ite=res.data.data.pageData[0] + th.setData({ + record_list:ite, + is_receive:ite.is_receive //用RecordList的领取状态来确定data中is_receive + }) + } + }) + + this.setData({ isBuy: options.isBuy, getGiftID: options.lbId, orderSn: options.orderSn, flag: options.flag, // 如果从商品详情页的促销处点击专享礼包跳转到此页,则flag为1 record_list_id:options.record_list_id, - is_receive:options.is_receive + is_cur_list:is_cur_list }) if (options.lbId) th.data.lbId = options.lbId; //-- 获取分享人的ID -- diff --git a/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.wxml b/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.wxml index c1ccd4b..2304d2e 100644 --- a/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.wxml +++ b/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.wxml @@ -1,5 +1,7 @@ + + @@ -101,21 +103,25 @@ {{item.couponName}} - + + + + + 已核销 + + + 未核销 + + + + {{"数量:"+item.num}} - - - 已核销 - - - 未核销 - - + @@ -153,8 +159,21 @@ + + + + + 未领取 + 未核销 + 已过期 + 部分核销 + 已全部核销 + + + + - + @@ -179,7 +198,7 @@ - + @@ -104,6 +107,8 @@ diff --git a/packageE/pages/user/monthgiftbag/my_giftpackinfo/filter.wxs b/packageE/pages/user/monthgiftbag/my_giftpackinfo/filter.wxs new file mode 100644 index 0000000..4d44c64 --- /dev/null +++ b/packageE/pages/user/monthgiftbag/my_giftpackinfo/filter.wxs @@ -0,0 +1,26 @@ +function lb_type(ty){ + switch(ty){ + case 1: return '未领取'; + case 2: return '未核销'; + case 3: return '部分核销'; + case 4: return '已过期'; + case 5: return '已全部核销'; + } +} + + +function lb_type_color(ty){ + switch(ty){ + case 1: return 'no_rev'; + case 2: return 'no_hx'; + case 3: return 'bf_hx'; + case 4: return 'gq'; + case 5: return 'qb_hx'; + } +} + + +module.exports = { + lb_type: lb_type, + lb_type_color:lb_type_color +} diff --git a/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.js b/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.js new file mode 100644 index 0000000..7a476d4 --- /dev/null +++ b/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.js @@ -0,0 +1,1085 @@ +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +var ut = require("../../../../../utils/util.js"); +var com = require("../public/buy_com.js"); +const i = require("../../../../../utils/util.js"); + + +Page({ + data: { + url: a.url, //接口网址 + iurl: a.imghost, //图片前缀网址 + isBuy: 0, + getGiftID: '', //礼包id + giftImage: '', + giftTitle: '', + giftDate: '', + giftPrice: '', + giftIntegral: '', + giftPosPrice: '', + giftQty: '', + giftRemark: '', + giftType: '', + actTitle: '', + getUrl: '', + wareCard: [], + code: "", //核销码 + c_state: "0", //判断是否已经使用, 0正常 1已使用 2已过期 + is_lb: 0, //是否有礼包 + default_color: null, + first_leader: e.globalData.first_leader || 0, // 推荐人ID + + + new_user: 0, //新用户 + + sto_sele_name_1: '', + share_goods_img: '', //礼包的分享图 + giftImageCover: null, + canvasHidden: true, + is_receive: 0, + screenWidth: 0, + monthgiftbag: {}, + record: null, + + }, + + onLoad: function (options) { + //定义第一次进入 + this.data.fir_in = 1; + var th = this; + + var th = this; + this.setData({ + getUserID: d.user_id, + getStorageID: a.stoid, + }) + + if (!options.id && options.scene) { + var gid_str = decodeURIComponent(options.scene); + gid_str = gid_str.split("_"); + options.id = gid_str[0]; + options.first_leader = gid_str[1]; + } + + this.setData({ + params: options, + }) + + //-- 获取分享人的ID -- + var first_leader = options.first_leader || getApp().globalData.first_leader; + if (first_leader) { + this.setData({ + first_leader, + }) + //-- user_id代过来免登录 -- + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + getApp().globalData.guide_pick_id = res.data.data.pickup_id + } + }) + } + + th.close(); + + getApp().getConfig2(function (e) { + var json_d = JSON.parse(e.switch_list); + th.setData({ + bconfig: e, + sys_switch: json_d, + is_retail_price: json_d.is_retail_price || 0 + }); + }) + // com.get_sto(th,os) + //获取用户设备信息,屏幕宽度 + wx.getSystemInfo({ + success: res => { + th.setData({ + screenWidth: res.screenWidth + }) + } + }); + }, + + logTab() { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + }, + + getList2: async function (e) { + let th = this; + let user_id = getApp().globalData.user_id || 0; + + + await getApp().request.promiseGet("/api/weshop/marketing/marketingMonthgiftbagRecord/page", { + data: { + store_id: os.stoid, + user_id: user_id, + order_sn: this.data.params.order_sn, + isdetail: 1 + } + }).then(res1 => { + if (ut.ajax_ok(res1)) { + + + var arr2 = res1.data.data.pageData; + + for (let j = 0; j < arr2.length; j++) { + + arr2[j].is_detail = 0; + if (arr2[j].detaillist) { + arr2[j].is_detail = 1; + } else { + continue; + } + + + arr2[j].lbType = 0; + if (arr2[j].detaillist.iswarelbtype) { + arr2[j].lbType = 1; + } + //---获取日期的时间戳--- + var t_endtime = arr2[j].detaillist.endTime; + t_endtime = t_endtime.replace(/-/g, '/'); + var t_date = new Date(t_endtime) / 1000; + var t_now = ut.gettimestamp(); + + var t_starttime = arr2[j].detaillist.starTime; + t_starttime = t_starttime.replace(/-/g, '/'); + var t_sdate = new Date(t_starttime) / 1000; + + arr2[j].c_state = 0 + if (arr2[j].detaillist.goodsUseState) + arr2[j].c_state = 1 + else if (t_date <= t_now) + arr2[j].c_state = 2 + else if (t_sdate > t_now) + arr2[j].c_state = -1 + } + + th.setData({ + record: arr2[0] + }) + } + }) + + + getApp().request.get('/api/weshop/marketing/marketingMonthgiftbagForm/page', { + isShowLoading: true, + data: { + store_id: a.stoid, //商家ID + page: 1, + pageSize: 10, + id: th.data.params.id + }, + success: function (res) { + if (res.data.code == 0) { + + // var arr1 = th.data.wareCard; + var arr2 = res.data.data.pageData; + for (let j = 0; j < arr2.length; j++) { + // arr2[j].starTime1=Date.parse(new Date(arr2[j].begindate.replace(/-/g, "/")))/1000 + arr2[j].starTime1 = arr2[j].begindate + arr2[j].starTime = i.formatTime(arr2[j].begindate, "yyyy-MM-dd hh:mm:ss"); + arr2[j].endTime = i.formatTime(arr2[j].enddate, "yyyy-MM-dd hh:mm:ss"); + arr2[j].giftPosPrice = arr2[j].oldPrice + arr2[j].payMoney = arr2[j].lbPrice + arr2[j].payIntegral = arr2[j].exchangeIntegral + arr2[j].giftQty = arr2[j].buynum + arr2[j].cover_img = arr2[j].imageurl + arr2[j].giftTitle = arr2[j].act_name + arr2[j].virtualsales = arr2[j].virtualSales + arr2[j].lbnum = arr2[j].lbNum + } + if (arr2.length > 0) { + var monthgiftbag = arr2[0]; + var ismore = 0; + // if (arr3.length == res.data.data.total) ismore = 1 + var isStart = 0; + if (monthgiftbag) { + var start = monthgiftbag.begindate; + let remark = monthgiftbag.remark.replace(/\ { + if (res.data.code == 0) { + getApp().globalData.guide_pick_id = res.data.data.pickup_id; + } + th.data.is_geted_guide_pick = 1; + func(); + }) + }, + + + + //显示核销码 + code_show: function (e) { + var th = this; + //--获取成功的时候-- + var no = th.data.code; + var qc_com = th.selectComponent("#qc_com"); //组件的id + var obj = { + val: no, + content: "请将二维码展示给核销员,收货更快捷" + }; + qc_com.open(obj) + }, + + //获取核销码 + getcode: function (e) { + var th = this; + let codeId = e.currentTarget.dataset.codeid; + let orderSn = e.currentTarget.dataset.ordersn; + var json = { + "storeId": a.stoid, + "orderSn": orderSn, + } + if (codeId && codeId !== "") { + json.id = codeId + } + var data = JSON.stringify(json); + var url = th.data.url + "/api/weshop/marketing/gift/goods/verify/code/get"; //预约接口地址 + getApp().request.json_post(url, json, + function (res) { + if (res.data.code == 0) { + th.setData({ + code: res.data.data + }) + th.code_show(); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }, + function (res) { + + }, + "put" + ) + + }, + //界面跳转 + goto: function (e) { + var th = this; + var url = e.currentTarget.dataset.url; + getApp().goto(url); + }, + //图片失败,默认图片 + bind_bnerr2: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/giftbag/gift01.png"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + + //图片失败,默认图片 + bind_bnerr: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = this.data.iurl + "miniapp/images/big_back.jpg"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + //this.setData({ giftImage: this.data.iurl + "/miniapp/images/giftbag/gift01.png"}); + + }, + + //关闭导航 + close: function () { + var th = this; + var nav_b = th.selectComponent("#nav_b"); //组件的id + nav_b.close_box(); + nav_b.set_name("礼包", "/packageE/pages/user/monthgiftbag/monthgiftbag"); + }, + + //--- 分享设置 -- + onShareAppMessage: function (e) { + getApp().globalData.no_clear = 1; + + var ee = this; + var curPage = this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + + pagePath += "?isBuy=1" + "&id=" + this.data.sele_g.id + "&first_leader=" + this.data.getUserID; + console.log('分享路径'); + console.log(pagePath); + // if (this.data.isBuy == 0) { + // pagePath += "&orderSn=" + this.data.orderSn; + // } else { + // pagePath += "&lbId=" + this.data.getGiftID; + // } + // console.log('pagePath', pagePath); + var img = ee.data.iurl + (ee.data.sele_g.cover_img ? ee.data.sele_g.cover_img : ee.data.giftImage); + + return { + title: "礼包详情", + path: pagePath, + imageUrl: img, + } + }, + + /** + * 用户分享朋友圈 + */ + onShareTimeline() { + getApp().globalData.no_clear = 1; + + var ee = this; + var pagePath = "&isBuy=1" + "&id=" + this.data.sele_g.id + "&first_leader=" + this.data.getUserID; + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; + + var img = ee.data.iurl + (ee.data.sele_g.cover_img ? ee.data.sele_g.cover_img : ee.data.giftImage); + + return { + title: "礼包详情", + query: 'first_leader=' + user_id + pagePath, + imageUrl: img, + } + }, + + //--- 设置一下默认库存的数量 ---- + set_def_storage(ee) { + var that = this, th = this; + that.data.fir_def_store = ee; + + that.setData({ + def_pick_store: ee, + sto_sele_name: ee.pickup_name, + sto_sele_id: ee.pickup_id, + sto_sele_distr: ee.distr_type + }) + }, + // 选择门店 + choice_store: function (ee) { + this.setData({ + keyword: '' + }) + + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/packageE/pages/togoin/togoin', + }) + return false; + } + + var th = this; + var ind = ee.currentTarget.dataset.ind; + var bconfig = th.data.bconfig; + + //如果开启了,则不在选择门店 + if (this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) { + return false; + } + // if (!th.data.only_pk && !th.data.def_pickpu_list) { + // getApp().confirmBox("门店库存不足", null, 25000, !1); + // return false; + // } + + if (th.data.only_pk && !th.data.only_pk.length) { + getApp().confirmBox("门店库存不足", null, 25000, !1); + return false; + } + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) { + getApp().confirmBox("门店库存不足", null, 25000, !1); + return false; + } + + + if (bconfig && bconfig.is_sort_storage) { + wx.getLocation({ + type: 'gcj02', + success: function (res) { + + th.data.lat = res.latitude; + th.data.lon = res.longitude; + th.data.is_get_local_ok = 1; + th.setData({ + is_gps: 1 + }); + //th.onShow(); + com.get_sto(th, os); + }, + fail: function (res) { + //th.onShow(); + th.data.is_get_local_ok = 1; + com.get_sto(th, os); + if (res.errCode == 2) { + th.setData({ + is_gps: 0 + }); + if (th.data.is_gps == 0) { + getApp().confirmBox("请开启GPS定位", null, 25000, !1); + } + } else { + th.setData({ + is_gps: "3" + }); + } + + } + }) + } else { + th.data.is_get_local_ok = 1; + com.get_sto(th, os); + } + + if (ind != undefined && ind != null) { + this.setData({ + open_ind_store: ind, + store: 1, + openSpecModal: !1, + openSpecModal_pt: !1, + openSpecModal_flash_normal: !1, + }) + } else { + this.setData({ + store: 1, + openSpecModal: !1, + openSpecModal_pt: !1, + openSpecModal_flash_normal: !1 + + }) + } + }, + //关闭选择门店 + close_popup: function (e) { + var th = this; + this.setData({ + store: 0, + choice_sort_store: 0, + sort_store: 0, + fir_pick_index: 0, + sec_pick_index: 0 + }) + + var openindstore = this.data.open_ind_store; + if (openindstore == 1) { + th.setData({ + openSpecModal: !0, + openSpecModal_ind: openindstore, + }); + } else if (openindstore == 2) { + th.setData({ + openSpecModal: !0, + openSpecModal_ind: openindstore, + }); + } else if (openindstore == 4) { //4就是拼团 + th.setData({ + openSpecModal_pt: 1, //打开拼团购买界面 + store: 0, //关闭门店 + choice_sort_store: 0, //关闭门店2级 + sort_store: 0, //关闭门店2级 + }); + } else { + th.setData({ + store: 0, + choice_sort_store: 0, + sort_store: 0 + }) + } + + + }, + + //选择更多门店 + more_store: function () { + this.setData({ + sort_store: 1 + }); + }, + // 返回按钮 + returns: function () { + this.setData({ + sort_store: 0, + choice_sort_store: 0 + }); + }, + //---选择分类门店--- + choice_sort_store: function (e) { + var index = e.currentTarget.dataset.index; + var region_name = e.currentTarget.dataset.region; + var item = this.data.all_sto[index]; + this.setData({ + region_name: region_name, + sort_store: 0, + choice_sort_store: 1, + sec_i: index, + sec_sto: item, + sec_pick_index: 0 + }); + }, + + choose_for_store_fir: function (e) { + var index_c = e.currentTarget.dataset.ind; + var th = this; + th.setData({ + fir_pick_index: index_c + }) + + }, + + //确定def_pick为选择的门店 + sure_pick: function (e) { + var th = this; + var item = null; + var openindstore = th.data.open_ind_store; + + if (th.data.choice_sort_store == 0) { + var index = th.data.fir_pick_index; + if (th.data.is_show_sto_cat == 1) { + item = th.data.def_pickpu_list[index]; + } else { + item = th.data.only_pk ? th.data.only_pk[index] : null; //当没有门店分类的时候 + } + + } else { + var index = th.data.sec_pick_index; + item = th.data.sec_sto.s_arr[index]; + } + + if (!item) return false; + + if (!th.data.sele_g) return false; + + th.setData({ + def_pick_store: item, + sto_sele_name: item.pickup_name, + sto_sele_id: item.pickup_id, + sto_sele_distr: item.distr_type, + store: 0, + choice_sort_store: 0, + fir_pick_index: 0, + openSpecModal: !0, + }); + + + }, + //---点击二级之后的选择--- + choose_for_store: function (e) { + var index_c = e.currentTarget.dataset.ind; + var th = this; + th.setData({ + sec_pick_index: index_c, + fir_pick_index: index_c + }) + + }, + //把选择的门店设置成默认的门店def_pick + set_def_pick: function (e) { + var th = this; + var item = null; + if (th.data.choice_sort_store == 0) { + var index = th.data.fir_pick_index; + if (th.data.is_show_sto_cat == 1) { + item = th.data.def_pickpu_list[index]; + } else { + item = th.data.only_pk ? th.data.only_pk[index] : null; //当没有门店分类的时候 + } + } else { + var index = th.data.sec_pick_index; + item = th.data.sec_sto.s_arr[index]; + } + + if (!item) return false; + + th.setData({ + def_pick_store: item, + sto_sele_name: item.pickup_name, + sto_sele_id: item.pickup_id, + sto_sele_distr: item.distr_type, + store: 0, + choice_sort_store: 0, + openSpecModal: !0, + }); + + var user_id = getApp().globalData.user_id; + var def_pickup_id = item.pickup_id; + getApp().request.put('/api/weshop/users/update', { + data: { + user_id: user_id, + def_pickup_id: def_pickup_id + }, + success: function (res) { + if (res.data.code == 0) { + if (th.data.choice_sort_store == 0) th.setData({ + fir_pick_index: 0 + }); + getApp().globalData.pk_store = item; + } else { + getApp().my_warnning("设置默认门店地址失败", 0, th) + } + + } + }); + + + }, + closeSpecModal: function () { + this.setData({ openSpecModal: 0 }); + }, + + buy_libao: function () { + com.buy_libao(this) + }, + + + clickShare() { + // if (!getApp().globalData.user_id) { + // getApp().goto("/packageE/pages/togoin/togoin"); + // return false; + // } + this.setData({ + share_hidden: true, + }); + }, + + send() { + this.setData({ + share_hidden: false, + }); + }, + + cancel() { + this.setData({ + share_hidden: false, + }); + }, + + + //--定义的保存图片方法,分享团--- + saveImageToPhotosAlbum: function () { + //--先判断会员状态-- + // var user_info = getApp().globalData.userInfo; + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + // //getApp().my_warnning("请先登录",0,this); + // wx.navigateTo({url: '/packageE/pages/togoin/togoin',}) + // return false; + // } + + if (this.data.share_hidden) { + this.setData({ share_hidden: false, }); + } + + wx.showLoading({ title: '生成中...', }) + var that = this, th = that; + //设置画板显示,才能开始绘图 + that.setData({ + canvasHidden: false + }) + + var app = getApp(); + var unit = that.data.screenWidth / 750 * 1.35; //基础单位, + var scene = th.data.sele_g.id + ""; + + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; + if (user_id > 0) { + scene += "_" + user_id; + } + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo"; + + // 读取文件成功则OK-- + wx.getImageInfo({ + src: path3, + success: function (res) { + th.get_goods_temp(function () { + var vpath = res.path; + var context = wx.createCanvasContext('share'); + // let share_goods_img = th.params.cover_img + th.drawPoster(context, unit, th.data.share_goods_img, vpath, 0); + + //把画板内容绘制成图片,并回调 画板图片路径 + context.draw(false, function () { + setTimeout(function () { + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: 750, + height: 1217, + destWidth: 1.2 * 750 * 750 / that.data.screenWidth, + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth, + canvasId: 'share', + success: function (res) { + + that.setData({ + shareImgPath: res.tempFilePath, + canvasHidden: true + }) + + if (!res.tempFilePath) { + wx.showModal({ + title: '提示', + content: '图片绘制中,请稍后重试', + showCancel: false + }) + return false; + } + + that.setData({ + showPoster: true, + }); + wx.hideLoading(); + } + }) + }, 800) + + }); + }) + }, + fail: function (res) { + console.log(res); + wx.hideLoading(); + + } + }); + }, + + //-- 小程序绘制海报 -- + drawPoster(context, unit, img, vpath, type) { + // 1.灰色背景 + context.setFillStyle('#f2f1f6'); + context.rect(0, 0, 554 * unit, 899 * unit); + context.fill(); + + // 2.商城名称 + let shopName = this.data.sto_sele_name_1; + context.setTextAlign('center'); + context.setFontSize(26 * unit); + context.setFillStyle('black'); + context.fillText(shopName, 277 * unit, 60 * unit); + + // 3.推荐来源 + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; + context.setTextAlign('center'); + context.setFontSize(22 * unit); + context.setFillStyle('#96959a'); + context.fillText(fromText, 277 * unit, 105 * unit); + + // 4.海报背景 + context.setFillStyle('white'); + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); + + // 5.商品图片 + // 图片的x坐标 + let bg_x = 37 * unit + // 图片的y坐标 + let bg_y = 157 * unit + // 图片宽度 + let bg_w = 480 * unit + // 图片高度 + let bg_h = 474 * unit + // 图片圆角 + let bg_r = 4 + // 绘制海报背景图片圆角 + context.save() + context.beginPath() + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) + context.clip() + context.drawImage(img, bg_x, bg_y, bg_w, bg_h); + context.restore(); + + // 6.强烈推荐 + let src = ''; + context.beginPath(); + if (type == 0) { // 普通 + src = '/images/share/q_tj.png'; + context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit); + context.setFontSize(16 * unit) + context.setFillStyle("white") + context.setTextAlign('left'); + context.fillText('强烈推荐', 64 * unit, 668 * unit); + } + + + let price = this.data.sele_g.payMoney; + let giftIntegral = this.data.sele_g.payIntegral; + context.setFontSize(32 * unit); + context.setFillStyle('#DE1117'); + + var price_txt = ""; + if (price || giftIntegral) { + if (price) { + price_txt = '¥' + price; + if (giftIntegral) { + if (this.data.sele_g.money_type > 0) { + price_txt += '+'; + } else { + price_txt += '或'; + } + } + } + if (giftIntegral) price_txt += giftIntegral + '积分'; + } else { + price_txt = "免费领取"; + } + + context.fillText(price_txt, 54 * unit, 735 * unit); + + + var wp = 62 * unit; + var hp = 765 * unit + this.draw_pos_price(context, wp, hp, this.giftPosPrice, unit); + + // 8.商品标题 + context.setFontSize(20 * unit); + context.setFillStyle('#898989'); + getApp().draw_Text(context, this.data.giftTitle, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1); + + // 9.小程序码 + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); + context.setFontSize(16 * unit); + context.setFillStyle('#777'); + context.fillText('长按识别二维码', 378 * unit, 810 * unit); + + // 10.竖线 + context.beginPath(); + context.setFillStyle('#eee'); + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); + context.fill(); + }, + + + //---市场价划掉--- + draw_pos_price(context, w, h, market_price, unit) { + + if (!this.is_retail_price) return false; + + context.setFillStyle("gray") + context.setFontSize(22 * unit) + var pri0 = "¥" + market_price.toFixed(2); + context.fillText(pri0, w, h); + + var c_h = h - 6; + context.setStrokeStyle('gray'); + context.setLineWidth(1 * unit); + context.moveTo(w - 5, c_h); + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); + context.stroke(); + + }, + + //--获取商品图片的本地缓存,回调写法-- + get_goods_temp: function (tt) { + var ee = this; + if (ee.data.share_goods_img) { + tt(); + return false; + } + var img_url = ee.data.iurl + (ee.data.sele_g.cover_img ? ee.data.sele_g.cover_img : ee.data.giftImage); + + //获取商品是分享图信息 + wx.getImageInfo({ + src: img_url, + success: function (res) { + //res.path是网络图片的本地地址 + ee.data.share_goods_img = res.path; + tt(); + }, + fail: function (res) { + //获取默认空白图 + wx.getImageInfo({ + src: ee.data.iurl + '/miniapp/images/default_g_img.gif', + success: function (res) { + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 + tt(); + } + }) + } + }); + }, + + closePoster() { + this.setData({ + showPoster: false, + }); + }, + // 保存图片到手机 + savePic() { + getApp().savePic(this); + }, + // 预览海报 + previewPoster() { + getApp().globalData.no_clear = 1; + wx.previewImage({ + current: this.data.shareImgPath, // 当前显示图片的http链接 + urls: [this.data.shareImgPath],// 需要预览的图片http链接列表 + }); + }, + + //-- 获取每个月的内容 -- + async get_record_list() { + let th = this; + let user_id = getApp().globalData.user_id || 0; + let url = "/api/weshop/marketing/marketingMonthgiftbagRecordList/pageUseMmonthgiftbagRecordList"; + await getApp().request.promiseGet(url, { + data: { + store_id: os.stoid, + user_id: user_id, + order_sn: this.data.params.order_sn, + pageSize: 50 + } + }).then(res => { + if (ut.ajax_ok(res)) { + + let list = res.data.data.pageData; + th.setData({ + wareCard: list + }) + } + + }) + + }, + + getGift(e) { + var that = this; + if (that.data.islogin) { + return + } + that.setData({ + islogin: true + }) + + var record_list_id = e.currentTarget.dataset.record_list_id; + var index = e.currentTarget.dataset.index; + + var json = { + "id": record_list_id,// "记录Id", + "storeId": that.data.getStorageID, //商家Id + "userId": that.data.getUserID, //用户ID + }; + // var url ="/api/weshop/marketing/buy/receive/gift/record/insert"; + // var url ="/api/weshop/marketing/marketingMonthgiftbagRecord/createOrder"; + var url = "/api/weshop/marketing/marketingMonthgiftbagRecord/recordReceive"; + getApp().request.json_post(url, json, + function (res) { + console.log('领取礼包'); + console.log(res); + if (res.data.code == 0 && res.data.data) { + + var txt = "record.is_receive"; + that.setData({ + [txt]: 1 + }) + getApp().my_warnning("领取成功!", 1, that); + + that.get_record_list();//重新刷新每个月的数据 + + } else { + that.setData({ submit: 0 }) + getApp().my_warnning(res.data.msg, 0, that); + } + that.setData({ + islogin: false + }) + }, + function (res) { + that.setData({ submit: 0 }) + } + ) + }, + + + //不销毁界面跳转 + navigateTo: function (e) { + + var url = e.currentTarget.dataset.url; + let item = this.data.record; + let is_back = item.is_back; + let cur_record_list_id=item.record_list_id; + + //用于判断是不是当前的recode_list_id + url+="&cur_record_list_id="+cur_record_list_id; + url+="&recode_sn="+this.data.params.order_sn; + + + + if (is_back == 1) { + wx.showToast({ + title: '该礼包已退款', + icon: 'none', + duration: 2000 + }) + } else { + getApp().goto(url); + } + }, + + + + + +}); \ No newline at end of file diff --git a/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.json b/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.json new file mode 100644 index 0000000..dffdf6a --- /dev/null +++ b/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.json @@ -0,0 +1,12 @@ +{ + "navigationBarTitleText": "礼包详情", + "usingComponents": { + "warn": "/components/long_warn/long_warn", + "my_confirm": "/components/my_confirm/my_confirm", + "qr_code": "/components/qr_code/qr_code", + "nav_b": "/components/nav_b/nav_b", + "share": "/components/share/share", + "com_top_nav": "/components/com_top_nav/com_top_nav" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.wxml b/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.wxml new file mode 100644 index 0000000..b0b3785 --- /dev/null +++ b/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.wxml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + {{monthgiftbag.act_name}} + + + + + ¥{{monthgiftbag.lbPrice}}+{{monthgiftbag.payIntegral}} 积分 + + + + ¥{{monthgiftbag.lbPrice}} + + + / + + + {{monthgiftbag.payIntegral}} 积分 + + + + + + + {{monthgiftbag.oldPrice?'零售价:':''}}{{monthgiftbag.oldPrice+"元"}} + + + + + + + 礼包内容 + + + + + + + + + + + {{item.lbtitle}} + + + + {{m_filter.lb_type(item.lbstate)}} + + + + + {{"零售价:"+item.oldprice}} + + + + + + + + {{item.giftbag_monthnum}} > + + + + + + + + + + + + 活动说明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.wxss b/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.wxss new file mode 100644 index 0000000..01485a7 --- /dev/null +++ b/packageE/pages/user/monthgiftbag/my_giftpackinfo/my_giftpackinfo.wxss @@ -0,0 +1,296 @@ +@charset "UTF-8"; +@import '../giftpackbuy/goodsInfo.wxss'; + +page{ + color: #313131; +} + + +.box.data-v-3a5b7e36 { + -webkit-align-content: center; + align-content: center; + background-color: #e85f93; +} + +.box_top.data-v-3a5b7e36 { + width: 100%; +} + +.box_top image.data-v-3a5b7e36 { + width: 100%; + max-height: 540rpx; +} + +.box_title.data-v-3a5b7e36 { + margin: 20rpx 20rpx 20rpx 20rpx; + padding:30rpx 34rpx 32rpx; + background-color: #fff; + border-radius: 10rpx; +} + +.top_title.data-v-3a5b7e36 { + font-size: 30rpx; + margin-bottom: 10rpx; + position: relative; +} + +.top_time.data-v-3a5b7e36 { + font-size: 27rpx; + color: #b9b5b5; +} + +.top_price.data-v-3a5b7e36 { + font-size: 30rpx;color: #d61b30;margin-bottom: 5rpx; + position: relative;line-height: normal;margin-top: 25rpx; +} + +.top_foot.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; +} + +.top_foot_price.data-v-3a5b7e36 { + font-size: 22rpx; + color: #b9b5b5; + width: 50%; + text-decoration: line-through; +} + +.top_foot_qty.data-v-3a5b7e36 { + font-size: 22rpx; + color: #b9b5b5; + width: 50%; + -webkit-align-content: flex-end; + align-content: flex-end; + text-align: right; +} + +.box_ware.data-v-3a5b7e36 { + margin: 10rpx 20rpx 20rpx 20rpx; + padding: 35rpx; + background-color: #fff; + border-radius:15rpx; +} + +.box_ware_title.data-v-3a5b7e36 { + font-size: 30rpx; + margin: 5rpx 0rpx 30rpx 0rpx; + font-weight: bolder; +} + +.box_ware_box.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; + margin: 10rpx 0rpx 25rpx 0rpx; +} + +/* .box_ware_img.data-v-3a5b7e36 { + width: 30%; + height: 180rpx; + border: #999999 solid 1rpx; +} */ + +.box_ware_img image.data-v-3a5b7e36 { + /* width: 185rpx; + height: 190rpx; *//* background-color: rgba(138, 138, 138, 0.63); */ + border: 2rpx solid #fafaf9; + border-radius: 4rpx; + width: 150rpx; + height: 150rpx; + background-color: #f8f8f8; +} + +.box_ware_item.data-v-3a5b7e36 { + width: 80%; + margin-left: 28rpx; + position: relative; +} + +.box_ware_item_title.data-v-3a5b7e36 { + font-size: 24rpx; + word-break: break-all; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + line-height: 32rpx; +} + +.box_ware_count.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; +} + +.box_ware_item_price.data-v-3a5b7e36 { + font-size: 24rpx; + color: #b9b5b5; + position: absolute; + bottom: 60rpx; + left: 0; +} + +.box_ware_item_qty.data-v-3a5b7e36 { + font-size: 22rpx; + position: absolute; + bottom: 0rpx; + left: 0; +} + +.box_ware_code.data-v-3a5b7e36 { + position: absolute; + right: 0rpx; + bottom: 0rpx; +} + +.box_ware_code image.data-v-3a5b7e36 { + width: 50rpx; + height: 50rpx; +} + +.box_ware_code text.data-v-3a5b7e36 { + font-size: 20rpx; +} + +.foot_box.data-v-3a5b7e36 { + margin: 10rpx 20rpx 50rpx 20rpx; + padding: 35rpx; + background-color: #fff; + border-radius: 16rpx; +} + +.foot_box_title.data-v-3a5b7e36 { + font-size: 30rpx; + margin-bottom: 30rpx; + font-weight: bolder; color: #313131; +} + +.foot_box_remark.data-v-3a5b7e36 { + font-size: 27rpx; + line-height: 40rpx; +} + +.foot_empty.data-v-3a5b7e36 { + height: 90rpx; +} + +.foot_button.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; + margin: 20rpx 0rpx 0rpx 0rpx; + padding: 34rpx 0rpx 41rpx; + background: #fff; + text-align: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + position: fixed; + bottom: 0; + left: 0; + width: 100%; +} + +.foot_button_left.data-v-3a5b7e36 { + background: #e4010c; + color: #fff; + width: 250rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 15rpx; + margin-right: 20rpx; +} + +.foot_button_right.data-v-3a5b7e36 { + background: #ffbb42; + color: #fff; + width: 250rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +.foot_button_buy.data-v-3a5b7e36 { + background: #e4010c; + color: #fff; + width: 400rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +.foot_button_intalge.data-v-3a5b7e36 { + background: #ffbb42; + color: #fff; + width: 420rpx; + height: 70rpx; + font-size: 26rpx; + + border-radius: 40rpx; + display: flex; + align-items: center; + justify-content: center; + font-weight: bolder; +} + +page.data-v-3a5b7e36 { + background-color: #e85f93; +} + +.foot_box_remark.data-v-3a5b7e36 ._img { + width: 100%; +} + +.foot_box_remark.data-v-3a5b7e36 .img { + line-height: 0; +} +.overdue.data-v-3a5b7e36{ + background-color: rgb(153,153,153); +} + +.foot_button_intalge.data-v-3a5b7e36.gray{ background-color: #aaa; } + +.xc-share-frame { + position: absolute; right:0; top: -10rpx; +} + + +.fs34{ + font-size: 34rpx; +} +.fs46{ + font-size: 46rpx; +} + + +.month_btn{ + width: 165rpx;height: 54rpx; + background-color: #f85c97; + border-radius: 54rpx; color: #fff; +} +.sw_state_btn{ + width: 115rpx; height: 34rpx;font-size: 23rpx;color: #fff;border-radius: 17rpx; margin-top: 10rpx; +} + + +.sw_state_btn.no_rev { + background-color:#7ecef4 +} +.sw_state_btn.no_hx { + background-color:#ff0000 +} +.sw_state_btn.bf_hx { + background-color:#ffbb42 +} +.sw_state_btn.gq { + background-color:#898989 +} +.sw_state_btn.qb_hx { + background-color:#ffbb42; width: 150rpx; +} \ No newline at end of file diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index e8bb280..d2fd592 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -1001,6 +1001,8 @@ Page({ continue; } + carr[i].sto_list=good.storageId; + if (item.prom_type == 0 && !item.is_integral_normal && !item.is_pd_normal ) { var prom = null; var now = ut.gettimestamp(); @@ -1114,10 +1116,12 @@ Page({ //------如果没有找到----- if (find == 0) { var pikname = ''; + var keyid=''; //找到门店名称 for (var k = 0; k < th.data.allsto.length; k++) { if (pcid == th.data.allsto[k].pickup_id) { pikname = th.data.allsto[k].pickup_name; + keyid = th.data.allsto[k].keyid; break; } } @@ -1127,7 +1131,8 @@ Page({ pid: pcid, pname: pikname, goods: narr, - selected: 0 + selected: 0, + keyid: keyid, }; arr.push(ie); } @@ -4109,6 +4114,17 @@ Page({ } }); + //-- 服务卡项的可售情况 -- + var sto_list=i_arr[j].sto_list; + if(sto_list){ + let the_c_key=this.data.service_data[i].keyid + if (sto_list.indexOf(the_c_key)==-1) { + getApp().confirmBox(i_arr[j].service_name + "的门店不可售"); + th.clear_checkouting(); + return false; + } + } + //判断秒杀的指定门店 if( [1,2].includes(i_arr[j].prom_type) && i_arr[j].prom && i_arr[j].prom.pick_up_lists && i_arr[j].selected){ var idx0=i_arr[j].prom.pick_up_lists.findIndex(function (e){ diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index e86fa1a..6761f41 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -3157,7 +3157,24 @@ Page({ var pt_act=null; //-- 拼团活动的优化 -- for (const it of list) { - + + var card=null; + await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + store_id + "/" + it.card_id, {}).then(res => { + if(res.data.code==0 && res.data.data){ + card = res.data.data; + } + }) + + if(card && card.storageId){ + let the_c_key=it.pickup_keyid; + if (card.storageId.indexOf(the_c_key)==-1) { + getApp().confirmBox(it.service_name + "的门店不可售"); + th.setData({ paying: 0 }); + flag = false; + return false; + } + } + //秒杀 if ([1,2].includes(it.prom_type)) { let act_details = null;