diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 4ad281d..eea6664 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -25,287 +25,6 @@ const { } = require("../../../utils/common.js"); Page({ - data: { - start_stop: 2, //秒杀开始 结束 的控制(1正在进行,2即将开始) - color_type: 0, //线条控制 - color_type_one: 0, - color_type_two: 1, - is_no_plus: 1, - is_share_text:1, - gid: "", - stoid: o.stoid, - url: o.url, - resourceUrl: o.h5_url, //公众号那边的图片文件域名 - iurl: o.imghost, - defaultAvatar: o.resourceUrl + "/static/images/user68.jpg", - userbuynum:0,//用户组合购购买的次数 - data: null, - content: "", //商品详情 - comments: null, //商品评论 - c_curr_p: 1, //评论分页 - com_num: 0, //评论人数 - gallery: null, //图片滚动 - is_collect: 0, - collect_id: 0, - cartGoodsNum: 0, - specSelect: 0, - optionItemId: 0, - goodsInputNum: 1, - openSpecModal: !1, - openSpecModal_pt: !1, //拼单的弹起, - openPromModal: !1, - activeCategoryId: 0, - supportPageScroll: !1, - prom_type4:0, //积分购是否开始 - address: { - address: "", - district: 0 - }, - shipping: "", - shippingCost: 0, - enterAddressPage: !1, - categories: [{ - name: "商品", - id: 0 - }, { - name: "详情", - id: 1 - }, { - name: "评价", - id: 2 - }], - activeCategoryId2: 0, - categories2: [{ - name: "商品详情", - id: 0 - }, { - name: "规格参数", - id: 1 - }], - activeCategoryId3: 1, - categories3: [{ - name: "全部", - id: 1, - num: 0 - }, - { - name: "有图", - id: 5, - num: 0 - }, - - { - name: "好评", - id: 2, - num: 0 - }, { - name: "中评", - id: 3, - num: 0 - }, { - name: "差评", - id: 4, - num: 0 - }, - ], - - select: { - price: 0, - stock: 0, - specName: "", - activity: null - }, - - //已选的商品(属性) - sele_g_spec_name: '', - sele_g_id: '', - sele_g: null, - //门店相关 - ismend: 0, - is_sec_mend: 0, - sto_sele_name: "", //选中的门店名称 - sto_sele_id: "", //选中的门店id - sto_sele_distr: "", //选择的门店的配送方式 - is_show_sto_cat: 1, //是否显示门店分类 - only_pk: null, - all_sto: null, - sec_sto: null, //选择了的门店分类 - pickpu_list: null, //读出的所有门店list - def_pickpu_list: null, //一开始5个门店list - sec_pick_index: 0, //第二级门店选择ID - fir_pick_index: 0, //第一级门店选择ID - all_pick_list: null, //所有的门店先记录起来 - //同一条形码的所有商品 - sku_g: null, - sku_g_pt: null, //---拼单的普通购买--- - //联系电话 - mobile: '', - //分类,品牌,国别名称 - cat_name: '', - brand_name: '', - nation_name: '', - - //商品的活动类型 0普通 1秒杀 2团购 3优惠 4 积分购 6拼单 - prom_type: 0, - prom_time_text: "", - prom_price: null, - prom_buy_limit: 0, - djs: null, - prom_st: 0, - prom_r_null: 0, - prom_end_time: null, - prom_start_time: null, - prom_act: null, - pd_xx: 0, - is_normal: 0, //是否普通购买 - teamgroup: null, //有多少人开团 - grounp_tatal: 0, //有几个人开团 - timer: [], - - //商品的购买次数 - prom_buy_num: -1, - g_buy_num: null, - prom_goods_num: 0, //活动商品数量 - prom_buy_num: 0, //活动商品购买数量 - prom_redis_num: 0, //活动商品redis数量 - - //拼单的规则显示 - is_show_gz: 0, - //会员自己的购买的拼单商品的情况 - user_order_pt_state: 0, - //购买的订单 - buy_order: null, - //1加入购物车 2立即购买 - openSpecModal_ind: 0, - - //---计时器开关---- - is_timer: 1, - isshow: 0, - bconfig: null, //基础配置 - - fir_comments: null, //详情页上的评价 - fir_quan: null, //详情页上的券 - quan_list: null, //券列表 - - coupon: 0, - //会员分享的头像 - share_head: "", - share_goods_img: "", - - //----------视频图片data参数--------- - current: 0, //图片计数 - swiperCurrent: 0, //轮播的下标 - hiddenn: 0, //控制轮播计数显示 - - currentTab: 0, // 选择器控制参数 - mapurl: "", - mapurl_f_img: "", - videopicture: 0, //视频图片的控制 - - video: 0, //视频图片切换器 - index: 0, - noon: 0, //开始视频的隐藏 - - screenWidth: 0, - canvasHidden: 1, - - //--推荐-- - store_config: null, - is_show_pl: 0, //是否品类 - is_show_pp: 0, //是否品牌 - is_show_gb: 0, //是否国别 - is_closecoupon: 0, - - //是否点赞中 - iszaning: 0, - - select_store: 0, //选择更多 - index: 1, - more_store: 0, //选择门店 - sort_store: 0, //门店分类 - choice_sort_store: 0, //选择分类门店 - new_user: 0, //新用户 - - def_pick_store: null, // 默认的门店 - fir_def_store: null, //客户默认的门店的 - lat: null, //维度 - lon: null, //经度 - - is_get_local_ok: 0, //获取坐标是否完成 - region_name: "门店分类", //区域的名字 - is_gps: 1, - open_ind_store: 0, //哪里打开的门店列表的控制属性 - default_store: {}, //创建添加默认门店地址的对象 - - comments_no_more: 0, - get_c: 0, //获取评价是不是成 - is_collect_load: 0, //是不是处理 - is_newsales_rules: 0, //是否开启最新的门店规则,此时会新读门店,当点击选择门店时会触发读取线下库存 - sales_rules: 1, //默认是线上销售 - - wait_for_user_store: null, - prom_goods: null, //商品优惠列表 - order_prom: null, //订单优惠 - collocationGoods: null, //搭配购 - - poster: null, //自定义海报 - share_b_img: '', //自定义分享的背景 - - showPoster: false, - hui_condition: null, - sto_sele_name_1: '', //分享的门店名称 - fir_goods: null, - - share_hidden: false, - all_activity_list: null, //所有活动的列表 - - hiddenCS: true, - - is_retail_price: 0, - is_no_new:1, - base_nor:0, - base_nor_prom_type:0, - base_nor_prom_id:0, - base_nor_goods_id:0, - user_pre_buynum:0, //用户优惠促销参与次数 - keyword:'', //门店搜索 - sec_i:-1,//选中分类门店 下标 - showFold:true - }, - - //------初始化加载---------- - onLoad: function (t) { - var ee = this, - that = ee, - th = ee, - gid = t.goods_id, - first_leader = t.first_leader, - - room_id = t.room_id, - room_user_share = t.room_user_share, //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id - prom_type = t.prom_type || 0, - prom_id = t.prom_id || 0; //活动ID - - var share_openid = t.share_openid; - - console.log("gd onload-- 3 --"); - console.log(t); - - //群id - if(t && t.groupchat_id && !t.groupchat_id!='undefined' && !t.groupchat_id!='null'){ - getApp().globalData.groupchat_id=t.groupchat_id - } - - - self = this; - - //检查测肤 - getApp().check_skin_face(t, 0, gid); - - //-- 自定义海报 -- - getApp().request.promiseGet("/api/weshop/goods/poster/page", { -======= ->>>>>>> 33b100b85758e70b0abfa89ba1e4bf25e025e03d data: { start_stop: 2, //秒杀开始 结束 的控制(1正在进行,2即将开始) color_type: 0, //线条控制 @@ -3536,84 +3255,6 @@ Page({ return e.s_time < ut.gettimestamp() && e.prom_type == 7; }) -<<<<<<< HEAD - } - }else{ //分类下搜索 - let sec_i=this.data.sec_i - let all_sto = this.data.all_sto - let old_all_sto = this.data.old_all_sto - if (!old_all_sto) { - this.setData({ - old_all_sto:JSON.parse(JSON.stringify(all_sto)) - }) - } - let sec_sto= this.data.sec_sto - let sec_arr = this.data.old_all_sto[sec_i].s_arr - let keyword = this.data.keyword - let text='sec_sto.s_arr' - if (keyword) { - let arr=sec_arr.filter( item =>{ - let i = item.pickup_name.indexOf(keyword) - if (i > -1) { - return true - }else{ - return false - } - }) - if (arr && arr.length>0) { - this.setData({ - [text]:arr - }) - }else{ - wx.showToast({ - title: '没有搜索到门店', - icon: 'none', - duration: 2000 - }) - } - }else{ - if(this.data.old_all_sto){ - this.setData({ - [text]: this.data.old_all_sto[sec_i].s_arr - }) - }else{ - this.setData({ - [text]: all_sto[sec_i].s_arr - }) - } - } - - - } - }, - - //------------处理门店--------------- - deal_pickup(e) { - var th = this; - if (!th.data.sele_g) return false - - var g_distr_type = th.data.sele_g.distr_type; - wx.hideLoading(); - - //单总量超出10个的时候,同时门店有分类 - if (e.data.data.total > 10 && e.his_cate_num) { - getApp().request.get("/api/weshop/storagecategory/page", { - data: { - store_id: o.stoid, - pageSize: 1000, - orderField: "sort", - orderType: 'asc', - }, - success: function (ee) { - if (ee.data.code == 0) { - var check_all_cate = 0; - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) { - for (let i in ee.data.data.pageData) { - let item = ee.data.data.pageData[i]; - if (item.is_show == 1) { - check_all_cate = 1; - break -======= //-- 组合购要在面前计算 --,计算完之后,再来计算check_is_youhui -- if (arr3 && arr3.length > 0) { //获取活动信息 @@ -3660,7 +3301,6 @@ Page({ prom_type: this.data.base_nor_prom_type, prom_id: this.data.base_nor_prom_id, }) ->>>>>>> 33b100b85758e70b0abfa89ba1e4bf25e025e03d } var user_id = getApp().globalData.user_id; @@ -6230,263 +5870,6 @@ Page({ return false; } -<<<<<<< HEAD - }); - }); - }, - fail: function (res) { - console.log(res); - wx.hideLoading(); - - } - }); - }, - - - // ----视频图片---- - // 图片计数器 - swiperChange: function (e) { - var that = this; - if (e.detail.current > 0) { - that.setData({ - hiddenn: 1, - videopicture: 1, - }) - } else { - that.setData({ - hiddenn: 0, - videopicture: 0, - }) - } - if (e.detail.source == 'touch') { - that.setData({ - current: e.detail.current - }) - } - }, - - /*---视频相关--*/ - videopicture: function (e) { - var vipi = e.currentTarget.dataset.vipi; - this.setData({ - videopicture: vipi, - swiperCurrent: vipi, - noon: 0, - current: 1 - }); - }, - - videoPlay: function (e) { - var _index = e.currentTarget.id - this.setData({ - _index: _index, - noon: 1 - }) - - setTimeout(function () { - //将点击视频进行播放 - var videoContext = wx.createVideoContext(_index) - videoContext.play(); - }, 500) - - }, - - //加载更多是靠这个函数 - onReachBottom: function () { - if (this.data.activeCategoryId == 2) { - if (!this.data.comments_no_more) this.requestComments_new(); - } - - var goods_list = this.selectComponent("#goods_list"); //组件的id - if (goods_list) goods_list.get_list(); - }, - - //--获取头像的本地缓存,回调写法-- - get_head_temp: function (tt, func) { - var ee = this; - if (ee.data.share_head) { - tt(func); - return false; - } - //---获取分享图片的本地地址,头像和商品图片---- - var path2 = getApp().globalData.userInfo.head_pic; - if (path2 == "") { - ee.data.share_head = "../../../images/share/hui_hear_pic.png"; - tt(func); - } else { - path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); - path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); - wx.getImageInfo({ - src: path2, - success: function (res) { - //res.path是网络图片的本地地址 - ee.data.share_head = res.path; - tt(func); - }, - fail: function (res) { - ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的 - tt(func); - } - }); - } - }, - //--获取商品图片的本地缓存,回调写法-- - get_goods_temp: function (tt) { - var ee = this; - if (ee.data.share_goods_img) { - tt(); - return false; - } - - var img_url = ee.data.data.original_img; - if ((this.data.prom_type == 1 || this.data.prom_type == 6) && this.data.prom_act.share_imgurl) { - img_url = this.data.iurl + this.data.prom_act.share_imgurl; - } - - //获取商品是分享图信息 - 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(); - } - }) - } - }); - }, - - //--外侧评价的点击效果--- - clik_evaluate: function (e) { - var val = e.currentTarget.dataset.val; - this.setData({ - activeCategoryId: 2, - activeCategoryId3: val, - comments: null - }); - this.requestComments_new(); - }, - - //--跳转到商品详情页面-- - go_goods: function (e) { - var gid = e.currentTarget.dataset.gid; - var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid; - getApp().goto(url); - }, - - //--跳转到支付尾款界面-- - go_pay_wk: function () { - var url = "/pages/cart/cart_wk/cart_wk?order_id=" + this.data.wk_order_id; - getApp().goto(url); - }, - - pop_err_img: function (e) { - var txt = e.currentTarget.dataset.errorimg; - var ob = {}; - ob[txt] = this.data.iurl + "/miniapp/images/default_g_img.gif"; - this.setData(ob); - }, - - //--调用更新阶梯团的接口-- - update_jiti: function (id) { - var th = this; - //--更新阶梯团-- - getApp().request.put("/api/weshop/teamgroup/updateTeamOrder/" + os.stoid + "/" + id, { - success: function (ee) { - //--等于0是要去支付尾款,接口调用失败,就要去查看参团详情-- - if (ee.data.code == 0) { - th.setData({ - user_order_pt_state: 3, - }); - } else if (ee.data.code == -1) { - th.setData({ - user_order_pt_state: 2, - }); - } - } - }) - }, - // 选择门店 - choice_store: function (ee) { - var th = this; - var ind = ee.currentTarget.dataset.ind; - var bconfig = th.data.bconfig; - 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; - } - - - //如果开启了,则不在选择门店 - 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 && !th.data.change) { - // getApp().confirmBox("门店库存不足", null, 25000, !1); - wx.showToast({ - title: '门店库存不足', - icon: 'none', - }); - return false; - } - th.data.change = 0; - - if (th.data.only_pk && !th.data.only_pk.length) { - // getApp().confirmBox("门店库存不足", null, 25000, !1); - wx.showToast({ - title: '门店库存不足', - icon: 'none', - }); - return false; - } - if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) { - // getApp().confirmBox("门店库存不足", null, 25000, !1); - wx.showToast({ - title: '门店库存不足', - icon: 'none', - }); - return false; - } - - //如果开启了,则不在选择门店 - if (th.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) { - 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(); - th.get_sto(th.data.is_normal); - }, - fail: function (res) { -======= if (this.data.share_hidden) { this.setData({ share_hidden: false, @@ -6516,7 +5899,6 @@ Page({ that.setData({ canvasHidden: false }) ->>>>>>> 33b100b85758e70b0abfa89ba1e4bf25e025e03d var app = getApp(); var unit = that.data.screenWidth / 750 * 1.35; //基础单位,