Commit 9a62367331d025dca2de8b9c71d3d3b5a7aa5cc1

Authored by WXD-SEASON\season
1 parent ec885448

11

pages/goods/goodsInfo/goodsInfo.js
... ... @@ -25,287 +25,6 @@ const {
25 25 } = require("../../../utils/common.js");
26 26  
27 27 Page({
28   - data: {
29   - start_stop: 2, //秒杀开始 结束 的控制(1正在进行,2即将开始)
30   - color_type: 0, //线条控制
31   - color_type_one: 0,
32   - color_type_two: 1,
33   - is_no_plus: 1,
34   - is_share_text:1,
35   - gid: "",
36   - stoid: o.stoid,
37   - url: o.url,
38   - resourceUrl: o.h5_url, //公众号那边的图片文件域名
39   - iurl: o.imghost,
40   - defaultAvatar: o.resourceUrl + "/static/images/user68.jpg",
41   - userbuynum:0,//用户组合购购买的次数
42   - data: null,
43   - content: "", //商品详情
44   - comments: null, //商品评论
45   - c_curr_p: 1, //评论分页
46   - com_num: 0, //评论人数
47   - gallery: null, //图片滚动
48   - is_collect: 0,
49   - collect_id: 0,
50   - cartGoodsNum: 0,
51   - specSelect: 0,
52   - optionItemId: 0,
53   - goodsInputNum: 1,
54   - openSpecModal: !1,
55   - openSpecModal_pt: !1, //拼单的弹起,
56   - openPromModal: !1,
57   - activeCategoryId: 0,
58   - supportPageScroll: !1,
59   - prom_type4:0, //积分购是否开始
60   - address: {
61   - address: "",
62   - district: 0
63   - },
64   - shipping: "",
65   - shippingCost: 0,
66   - enterAddressPage: !1,
67   - categories: [{
68   - name: "商品",
69   - id: 0
70   - }, {
71   - name: "详情",
72   - id: 1
73   - }, {
74   - name: "评价",
75   - id: 2
76   - }],
77   - activeCategoryId2: 0,
78   - categories2: [{
79   - name: "商品详情",
80   - id: 0
81   - }, {
82   - name: "规格参数",
83   - id: 1
84   - }],
85   - activeCategoryId3: 1,
86   - categories3: [{
87   - name: "全部",
88   - id: 1,
89   - num: 0
90   - },
91   - {
92   - name: "有图",
93   - id: 5,
94   - num: 0
95   - },
96   -
97   - {
98   - name: "好评",
99   - id: 2,
100   - num: 0
101   - }, {
102   - name: "中评",
103   - id: 3,
104   - num: 0
105   - }, {
106   - name: "差评",
107   - id: 4,
108   - num: 0
109   - },
110   - ],
111   -
112   - select: {
113   - price: 0,
114   - stock: 0,
115   - specName: "",
116   - activity: null
117   - },
118   -
119   - //已选的商品(属性)
120   - sele_g_spec_name: '',
121   - sele_g_id: '',
122   - sele_g: null,
123   - //门店相关
124   - ismend: 0,
125   - is_sec_mend: 0,
126   - sto_sele_name: "", //选中的门店名称
127   - sto_sele_id: "", //选中的门店id
128   - sto_sele_distr: "", //选择的门店的配送方式
129   - is_show_sto_cat: 1, //是否显示门店分类
130   - only_pk: null,
131   - all_sto: null,
132   - sec_sto: null, //选择了的门店分类
133   - pickpu_list: null, //读出的所有门店list
134   - def_pickpu_list: null, //一开始5个门店list
135   - sec_pick_index: 0, //第二级门店选择ID
136   - fir_pick_index: 0, //第一级门店选择ID
137   - all_pick_list: null, //所有的门店先记录起来
138   - //同一条形码的所有商品
139   - sku_g: null,
140   - sku_g_pt: null, //---拼单的普通购买---
141   - //联系电话
142   - mobile: '',
143   - //分类,品牌,国别名称
144   - cat_name: '',
145   - brand_name: '',
146   - nation_name: '',
147   -
148   - //商品的活动类型 0普通 1秒杀 2团购 3优惠 4 积分购 6拼单
149   - prom_type: 0,
150   - prom_time_text: "",
151   - prom_price: null,
152   - prom_buy_limit: 0,
153   - djs: null,
154   - prom_st: 0,
155   - prom_r_null: 0,
156   - prom_end_time: null,
157   - prom_start_time: null,
158   - prom_act: null,
159   - pd_xx: 0,
160   - is_normal: 0, //是否普通购买
161   - teamgroup: null, //有多少人开团
162   - grounp_tatal: 0, //有几个人开团
163   - timer: [],
164   -
165   - //商品的购买次数
166   - prom_buy_num: -1,
167   - g_buy_num: null,
168   - prom_goods_num: 0, //活动商品数量
169   - prom_buy_num: 0, //活动商品购买数量
170   - prom_redis_num: 0, //活动商品redis数量
171   -
172   - //拼单的规则显示
173   - is_show_gz: 0,
174   - //会员自己的购买的拼单商品的情况
175   - user_order_pt_state: 0,
176   - //购买的订单
177   - buy_order: null,
178   - //1加入购物车 2立即购买
179   - openSpecModal_ind: 0,
180   -
181   - //---计时器开关----
182   - is_timer: 1,
183   - isshow: 0,
184   - bconfig: null, //基础配置
185   -
186   - fir_comments: null, //详情页上的评价
187   - fir_quan: null, //详情页上的券
188   - quan_list: null, //券列表
189   -
190   - coupon: 0,
191   - //会员分享的头像
192   - share_head: "",
193   - share_goods_img: "",
194   -
195   - //----------视频图片data参数---------
196   - current: 0, //图片计数
197   - swiperCurrent: 0, //轮播的下标
198   - hiddenn: 0, //控制轮播计数显示
199   -
200   - currentTab: 0, // 选择器控制参数
201   - mapurl: "",
202   - mapurl_f_img: "",
203   - videopicture: 0, //视频图片的控制
204   -
205   - video: 0, //视频图片切换器
206   - index: 0,
207   - noon: 0, //开始视频的隐藏
208   -
209   - screenWidth: 0,
210   - canvasHidden: 1,
211   -
212   - //--推荐--
213   - store_config: null,
214   - is_show_pl: 0, //是否品类
215   - is_show_pp: 0, //是否品牌
216   - is_show_gb: 0, //是否国别
217   - is_closecoupon: 0,
218   -
219   - //是否点赞中
220   - iszaning: 0,
221   -
222   - select_store: 0, //选择更多
223   - index: 1,
224   - more_store: 0, //选择门店
225   - sort_store: 0, //门店分类
226   - choice_sort_store: 0, //选择分类门店
227   - new_user: 0, //新用户
228   -
229   - def_pick_store: null, // 默认的门店
230   - fir_def_store: null, //客户默认的门店的
231   - lat: null, //维度
232   - lon: null, //经度
233   -
234   - is_get_local_ok: 0, //获取坐标是否完成
235   - region_name: "门店分类", //区域的名字
236   - is_gps: 1,
237   - open_ind_store: 0, //哪里打开的门店列表的控制属性
238   - default_store: {}, //创建添加默认门店地址的对象
239   -
240   - comments_no_more: 0,
241   - get_c: 0, //获取评价是不是成
242   - is_collect_load: 0, //是不是处理
243   - is_newsales_rules: 0, //是否开启最新的门店规则,此时会新读门店,当点击选择门店时会触发读取线下库存
244   - sales_rules: 1, //默认是线上销售
245   -
246   - wait_for_user_store: null,
247   - prom_goods: null, //商品优惠列表
248   - order_prom: null, //订单优惠
249   - collocationGoods: null, //搭配购
250   -
251   - poster: null, //自定义海报
252   - share_b_img: '', //自定义分享的背景
253   -
254   - showPoster: false,
255   - hui_condition: null,
256   - sto_sele_name_1: '', //分享的门店名称
257   - fir_goods: null,
258   -
259   - share_hidden: false,
260   - all_activity_list: null, //所有活动的列表
261   -
262   - hiddenCS: true,
263   -
264   - is_retail_price: 0,
265   - is_no_new:1,
266   - base_nor:0,
267   - base_nor_prom_type:0,
268   - base_nor_prom_id:0,
269   - base_nor_goods_id:0,
270   - user_pre_buynum:0, //用户优惠促销参与次数
271   - keyword:'', //门店搜索
272   - sec_i:-1,//选中分类门店 下标
273   - showFold:true
274   - },
275   -
276   - //------初始化加载----------
277   - onLoad: function (t) {
278   - var ee = this,
279   - that = ee,
280   - th = ee,
281   - gid = t.goods_id,
282   - first_leader = t.first_leader,
283   -
284   - room_id = t.room_id,
285   - room_user_share = t.room_user_share, //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
286   - prom_type = t.prom_type || 0,
287   - prom_id = t.prom_id || 0; //活动ID
288   -
289   - var share_openid = t.share_openid;
290   -
291   - console.log("gd onload-- 3 --");
292   - console.log(t);
293   -
294   - //群id
295   - if(t && t.groupchat_id && !t.groupchat_id!='undefined' && !t.groupchat_id!='null'){
296   - getApp().globalData.groupchat_id=t.groupchat_id
297   - }
298   -
299   -
300   - self = this;
301   -
302   - //检查测肤
303   - getApp().check_skin_face(t, 0, gid);
304   -
305   - //-- 自定义海报 --
306   - getApp().request.promiseGet("/api/weshop/goods/poster/page", {
307   -=======
308   ->>>>>>> 33b100b85758e70b0abfa89ba1e4bf25e025e03d
309 28 data: {
310 29 start_stop: 2, //秒杀开始 结束 的控制(1正在进行,2即将开始)
311 30 color_type: 0, //线条控制
... ... @@ -3536,84 +3255,6 @@ Page({
3536 3255 return e.s_time < ut.gettimestamp() && e.prom_type == 7;
3537 3256 })
3538 3257  
3539   -<<<<<<< HEAD
3540   - }
3541   - }else{ //分类下搜索
3542   - let sec_i=this.data.sec_i
3543   - let all_sto = this.data.all_sto
3544   - let old_all_sto = this.data.old_all_sto
3545   - if (!old_all_sto) {
3546   - this.setData({
3547   - old_all_sto:JSON.parse(JSON.stringify(all_sto))
3548   - })
3549   - }
3550   - let sec_sto= this.data.sec_sto
3551   - let sec_arr = this.data.old_all_sto[sec_i].s_arr
3552   - let keyword = this.data.keyword
3553   - let text='sec_sto.s_arr'
3554   - if (keyword) {
3555   - let arr=sec_arr.filter( item =>{
3556   - let i = item.pickup_name.indexOf(keyword)
3557   - if (i > -1) {
3558   - return true
3559   - }else{
3560   - return false
3561   - }
3562   - })
3563   - if (arr && arr.length>0) {
3564   - this.setData({
3565   - [text]:arr
3566   - })
3567   - }else{
3568   - wx.showToast({
3569   - title: '没有搜索到门店',
3570   - icon: 'none',
3571   - duration: 2000
3572   - })
3573   - }
3574   - }else{
3575   - if(this.data.old_all_sto){
3576   - this.setData({
3577   - [text]: this.data.old_all_sto[sec_i].s_arr
3578   - })
3579   - }else{
3580   - this.setData({
3581   - [text]: all_sto[sec_i].s_arr
3582   - })
3583   - }
3584   - }
3585   -
3586   -
3587   - }
3588   - },
3589   -
3590   - //------------处理门店---------------
3591   - deal_pickup(e) {
3592   - var th = this;
3593   - if (!th.data.sele_g) return false
3594   -
3595   - var g_distr_type = th.data.sele_g.distr_type;
3596   - wx.hideLoading();
3597   -
3598   - //单总量超出10个的时候,同时门店有分类
3599   - if (e.data.data.total > 10 && e.his_cate_num) {
3600   - getApp().request.get("/api/weshop/storagecategory/page", {
3601   - data: {
3602   - store_id: o.stoid,
3603   - pageSize: 1000,
3604   - orderField: "sort",
3605   - orderType: 'asc',
3606   - },
3607   - success: function (ee) {
3608   - if (ee.data.code == 0) {
3609   - var check_all_cate = 0;
3610   - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
3611   - for (let i in ee.data.data.pageData) {
3612   - let item = ee.data.data.pageData[i];
3613   - if (item.is_show == 1) {
3614   - check_all_cate = 1;
3615   - break
3616   -=======
3617 3258 //-- 组合购要在面前计算 --,计算完之后,再来计算check_is_youhui --
3618 3259 if (arr3 && arr3.length > 0) {
3619 3260 //获取活动信息
... ... @@ -3660,7 +3301,6 @@ Page({
3660 3301 prom_type: this.data.base_nor_prom_type,
3661 3302 prom_id: this.data.base_nor_prom_id,
3662 3303 })
3663   ->>>>>>> 33b100b85758e70b0abfa89ba1e4bf25e025e03d
3664 3304 }
3665 3305  
3666 3306 var user_id = getApp().globalData.user_id;
... ... @@ -6230,263 +5870,6 @@ Page({
6230 5870 return false;
6231 5871 }
6232 5872  
6233   -<<<<<<< HEAD
6234   - });
6235   - });
6236   - },
6237   - fail: function (res) {
6238   - console.log(res);
6239   - wx.hideLoading();
6240   -
6241   - }
6242   - });
6243   - },
6244   -
6245   -
6246   - // ----视频图片----
6247   - // 图片计数器
6248   - swiperChange: function (e) {
6249   - var that = this;
6250   - if (e.detail.current > 0) {
6251   - that.setData({
6252   - hiddenn: 1,
6253   - videopicture: 1,
6254   - })
6255   - } else {
6256   - that.setData({
6257   - hiddenn: 0,
6258   - videopicture: 0,
6259   - })
6260   - }
6261   - if (e.detail.source == 'touch') {
6262   - that.setData({
6263   - current: e.detail.current
6264   - })
6265   - }
6266   - },
6267   -
6268   - /*---视频相关--*/
6269   - videopicture: function (e) {
6270   - var vipi = e.currentTarget.dataset.vipi;
6271   - this.setData({
6272   - videopicture: vipi,
6273   - swiperCurrent: vipi,
6274   - noon: 0,
6275   - current: 1
6276   - });
6277   - },
6278   -
6279   - videoPlay: function (e) {
6280   - var _index = e.currentTarget.id
6281   - this.setData({
6282   - _index: _index,
6283   - noon: 1
6284   - })
6285   -
6286   - setTimeout(function () {
6287   - //将点击视频进行播放
6288   - var videoContext = wx.createVideoContext(_index)
6289   - videoContext.play();
6290   - }, 500)
6291   -
6292   - },
6293   -
6294   - //加载更多是靠这个函数
6295   - onReachBottom: function () {
6296   - if (this.data.activeCategoryId == 2) {
6297   - if (!this.data.comments_no_more) this.requestComments_new();
6298   - }
6299   -
6300   - var goods_list = this.selectComponent("#goods_list"); //组件的id
6301   - if (goods_list) goods_list.get_list();
6302   - },
6303   -
6304   - //--获取头像的本地缓存,回调写法--
6305   - get_head_temp: function (tt, func) {
6306   - var ee = this;
6307   - if (ee.data.share_head) {
6308   - tt(func);
6309   - return false;
6310   - }
6311   - //---获取分享图片的本地地址,头像和商品图片----
6312   - var path2 = getApp().globalData.userInfo.head_pic;
6313   - if (path2 == "") {
6314   - ee.data.share_head = "../../../images/share/hui_hear_pic.png";
6315   - tt(func);
6316   - } else {
6317   - path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
6318   - path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
6319   - wx.getImageInfo({
6320   - src: path2,
6321   - success: function (res) {
6322   - //res.path是网络图片的本地地址
6323   - ee.data.share_head = res.path;
6324   - tt(func);
6325   - },
6326   - fail: function (res) {
6327   - ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
6328   - tt(func);
6329   - }
6330   - });
6331   - }
6332   - },
6333   - //--获取商品图片的本地缓存,回调写法--
6334   - get_goods_temp: function (tt) {
6335   - var ee = this;
6336   - if (ee.data.share_goods_img) {
6337   - tt();
6338   - return false;
6339   - }
6340   -
6341   - var img_url = ee.data.data.original_img;
6342   - if ((this.data.prom_type == 1 || this.data.prom_type == 6) && this.data.prom_act.share_imgurl) {
6343   - img_url = this.data.iurl + this.data.prom_act.share_imgurl;
6344   - }
6345   -
6346   - //获取商品是分享图信息
6347   - wx.getImageInfo({
6348   - src: img_url,
6349   - success: function (res) {
6350   - //res.path是网络图片的本地地址
6351   - ee.data.share_goods_img = res.path;
6352   - tt();
6353   - },
6354   - fail: function (res) {
6355   - //获取默认空白图
6356   - wx.getImageInfo({
6357   - src: ee.data.iurl + '/miniapp/images/default_g_img.gif',
6358   - success: function (res) {
6359   - ee.data.share_goods_img = res.path; //分享的图片不能用网络的
6360   - tt();
6361   - }
6362   - })
6363   - }
6364   - });
6365   - },
6366   -
6367   - //--外侧评价的点击效果---
6368   - clik_evaluate: function (e) {
6369   - var val = e.currentTarget.dataset.val;
6370   - this.setData({
6371   - activeCategoryId: 2,
6372   - activeCategoryId3: val,
6373   - comments: null
6374   - });
6375   - this.requestComments_new();
6376   - },
6377   -
6378   - //--跳转到商品详情页面--
6379   - go_goods: function (e) {
6380   - var gid = e.currentTarget.dataset.gid;
6381   - var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid;
6382   - getApp().goto(url);
6383   - },
6384   -
6385   - //--跳转到支付尾款界面--
6386   - go_pay_wk: function () {
6387   - var url = "/pages/cart/cart_wk/cart_wk?order_id=" + this.data.wk_order_id;
6388   - getApp().goto(url);
6389   - },
6390   -
6391   - pop_err_img: function (e) {
6392   - var txt = e.currentTarget.dataset.errorimg;
6393   - var ob = {};
6394   - ob[txt] = this.data.iurl + "/miniapp/images/default_g_img.gif";
6395   - this.setData(ob);
6396   - },
6397   -
6398   - //--调用更新阶梯团的接口--
6399   - update_jiti: function (id) {
6400   - var th = this;
6401   - //--更新阶梯团--
6402   - getApp().request.put("/api/weshop/teamgroup/updateTeamOrder/" + os.stoid + "/" + id, {
6403   - success: function (ee) {
6404   - //--等于0是要去支付尾款,接口调用失败,就要去查看参团详情--
6405   - if (ee.data.code == 0) {
6406   - th.setData({
6407   - user_order_pt_state: 3,
6408   - });
6409   - } else if (ee.data.code == -1) {
6410   - th.setData({
6411   - user_order_pt_state: 2,
6412   - });
6413   - }
6414   - }
6415   - })
6416   - },
6417   - // 选择门店
6418   - choice_store: function (ee) {
6419   - var th = this;
6420   - var ind = ee.currentTarget.dataset.ind;
6421   - var bconfig = th.data.bconfig;
6422   - this.setData({
6423   - keyword:''
6424   - })
6425   - //--先判断会员状态--
6426   - var user_info = getApp().globalData.userInfo;
6427   - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
6428   - wx.navigateTo({
6429   - url: '/packageE/pages/togoin/togoin',
6430   - })
6431   - return false;
6432   - }
6433   -
6434   -
6435   - //如果开启了,则不在选择门店
6436   - if (this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) {
6437   - return false;
6438   - }
6439   -
6440   - if (!th.data.only_pk && !th.data.def_pickpu_list && !th.data.change) {
6441   - // getApp().confirmBox("门店库存不足", null, 25000, !1);
6442   - wx.showToast({
6443   - title: '门店库存不足',
6444   - icon: 'none',
6445   - });
6446   - return false;
6447   - }
6448   - th.data.change = 0;
6449   -
6450   - if (th.data.only_pk && !th.data.only_pk.length) {
6451   - // getApp().confirmBox("门店库存不足", null, 25000, !1);
6452   - wx.showToast({
6453   - title: '门店库存不足',
6454   - icon: 'none',
6455   - });
6456   - return false;
6457   - }
6458   - if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) {
6459   - // getApp().confirmBox("门店库存不足", null, 25000, !1);
6460   - wx.showToast({
6461   - title: '门店库存不足',
6462   - icon: 'none',
6463   - });
6464   - return false;
6465   - }
6466   -
6467   - //如果开启了,则不在选择门店
6468   - if (th.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) {
6469   - return false;
6470   - }
6471   -
6472   -
6473   -
6474   - if (bconfig && bconfig.is_sort_storage) {
6475   - wx.getLocation({
6476   - type: 'gcj02',
6477   - success: function (res) {
6478   -
6479   - th.data.lat = res.latitude;
6480   - th.data.lon = res.longitude;
6481   - th.data.is_get_local_ok = 1;
6482   - th.setData({
6483   - is_gps: 1
6484   - });
6485   - //th.onShow();
6486   - th.get_sto(th.data.is_normal);
6487   - },
6488   - fail: function (res) {
6489   -=======
6490 5873 if (this.data.share_hidden) {
6491 5874 this.setData({
6492 5875 share_hidden: false,
... ... @@ -6516,7 +5899,6 @@ Page({
6516 5899 that.setData({
6517 5900 canvasHidden: false
6518 5901 })
6519   ->>>>>>> 33b100b85758e70b0abfa89ba1e4bf25e025e03d
6520 5902  
6521 5903 var app = getApp();
6522 5904 var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
... ...