作者 wangxuyu

换电脑前上传

@@ -45,16 +45,16 @@ Page({ @@ -45,16 +45,16 @@ Page({
45 statestatus: 0, 45 statestatus: 0,
46 groupList: [], 46 groupList: [],
47 yesno: false, 47 yesno: false,
48 - stock:0,  
49 - is_vip:0,  
50 - string:'', 48 + stock: 0,
  49 + is_vip: 0,
  50 + string: '',
51 gggPrice: null 51 gggPrice: null
52 }, 52 },
53 //进入评论详情 53 //进入评论详情
54 - go_comment_detail(e){ 54 + go_comment_detail(e) {
55 var id = e.currentTarget.dataset.id 55 var id = e.currentTarget.dataset.id
56 wx.navigateTo({ 56 wx.navigateTo({
57 - url: '../user_comment_detail/user_comment_detail?id='+id, 57 + url: '../user_comment_detail/user_comment_detail?id=' + id,
58 }) 58 })
59 }, 59 },
60 //进入基本参数 60 //进入基本参数
@@ -79,7 +79,7 @@ Page({ @@ -79,7 +79,7 @@ Page({
79 }) 79 })
80 wx.pageScrollTo({ 80 wx.pageScrollTo({
81 scrollTop: 0, 81 scrollTop: 0,
82 - duration:0 82 + duration: 0
83 }) 83 })
84 this.fetchGoods() 84 this.fetchGoods()
85 }, 85 },
@@ -145,7 +145,7 @@ Page({ @@ -145,7 +145,7 @@ Page({
145 let listAll = t.data.goods.attr.attr_sku; 145 let listAll = t.data.goods.attr.attr_sku;
146 let list = listAll[e.currentTarget.dataset.parent].item; 146 let list = listAll[e.currentTarget.dataset.parent].item;
147 let x = e.currentTarget.dataset.index; 147 let x = e.currentTarget.dataset.index;
148 - let stock=t.data.stock 148 + let stock = t.data.stock
149 // 当前点击Id 149 // 当前点击Id
150 let nowId = e.currentTarget.dataset.gid; 150 let nowId = e.currentTarget.dataset.gid;
151 //当前点击value 151 //当前点击value
@@ -224,7 +224,7 @@ Page({ @@ -224,7 +224,7 @@ Page({
224 string = sys_attrprice[i].sku_values 224 string = sys_attrprice[i].sku_values
225 } 225 }
226 } 226 }
227 - if(that.data.is_vip==1){ 227 + if (that.data.is_vip == 1) {
228 gggPrice = vip_skuid_price 228 gggPrice = vip_skuid_price
229 } else { 229 } else {
230 gggPrice = old_skuid_price 230 gggPrice = old_skuid_price
@@ -238,7 +238,7 @@ Page({ @@ -238,7 +238,7 @@ Page({
238 vip_skuid_price: vip_skuid_price, 238 vip_skuid_price: vip_skuid_price,
239 skuid_arr: new_arr, 239 skuid_arr: new_arr,
240 ids: new_arr_item, 240 ids: new_arr_item,
241 - stock:stock, 241 + stock: stock,
242 string: string, 242 string: string,
243 gggPrice: gggPrice 243 gggPrice: gggPrice
244 }); 244 });
@@ -280,13 +280,13 @@ Page({ @@ -280,13 +280,13 @@ Page({
280 } 280 }
281 }, 281 },
282 //渲染是不是会员 282 //渲染是不是会员
283 - fetchUser(){ 283 + fetchUser() {
284 let url = '/wxapp/user/index' 284 let url = '/wxapp/user/index'
285 - let that=this  
286 - app.post(url).then(res=>{  
287 - if(res.code==1){ 285 + let that = this
  286 + app.post(url).then(res => {
  287 + if (res.code == 1) {
288 that.setData({ 288 that.setData({
289 - is_vip:res.data.user.is_vip 289 + is_vip: res.data.user.is_vip
290 }) 290 })
291 that.fetchGoods() 291 that.fetchGoods()
292 } 292 }
@@ -300,7 +300,7 @@ Page({ @@ -300,7 +300,7 @@ Page({
300 id: this.data.id 300 id: this.data.id
301 }; 301 };
302 let that = this 302 let that = this
303 - let stock=null 303 + let stock = null
304 let string = null 304 let string = null
305 app.post(url, params).then(r => { 305 app.post(url, params).then(r => {
306 console.log(r); 306 console.log(r);
@@ -336,13 +336,13 @@ Page({ @@ -336,13 +336,13 @@ Page({
336 old_skuid_price = sys_attrprice[i].old_price 336 old_skuid_price = sys_attrprice[i].old_price
337 vip_skuid_price = sys_attrprice[i].vip_price 337 vip_skuid_price = sys_attrprice[i].vip_price
338 stock = sys_attrprice[i].stock 338 stock = sys_attrprice[i].stock
339 - string =sys_attrprice[i].sku_values 339 + string = sys_attrprice[i].sku_values
340 } 340 }
341 } 341 }
342 var gggPrice = null 342 var gggPrice = null
343 - if(that.data.is_vip==1){ 343 + if (that.data.is_vip == 1) {
344 gggPrice = vip_skuid_price 344 gggPrice = vip_skuid_price
345 - }else{ 345 + } else {
346 gggPrice = old_skuid_price 346 gggPrice = old_skuid_price
347 } 347 }
348 r.data.comment.forEach(function(ele, index) { 348 r.data.comment.forEach(function(ele, index) {
@@ -354,7 +354,7 @@ Page({ @@ -354,7 +354,7 @@ Page({
354 ele.create_time = app.timeFormate(ele.create_time, 'YYMMDD'); 354 ele.create_time = app.timeFormate(ele.create_time, 'YYMMDD');
355 }); 355 });
356 console.log(r.data.vips.cashback_price) 356 console.log(r.data.vips.cashback_price)
357 - r.data.vips.cashback_price +='0' 357 + r.data.vips.cashback_price += '0'
358 r.data.vips.cashback_price = r.data.vips.cashback_price.substr(0, 4) 358 r.data.vips.cashback_price = r.data.vips.cashback_price.substr(0, 4)
359 var zuihoujiage = '' 359 var zuihoujiage = ''
360 if (that.data.is_vip == 1) { 360 if (that.data.is_vip == 1) {
@@ -471,7 +471,7 @@ Page({ @@ -471,7 +471,7 @@ Page({
471 skuid: that.data.skuid, 471 skuid: that.data.skuid,
472 num: that.data.num 472 num: that.data.num
473 } 473 }
474 - if(that.data.stock>0){ 474 + if (that.data.stock > 0) {
475 if (that.data.num <= e.currentTarget.dataset.limit || e.currentTarget.dataset.limit == 0) { 475 if (that.data.num <= e.currentTarget.dataset.limit || e.currentTarget.dataset.limit == 0) {
476 app.post(url, params).then(r => { 476 app.post(url, params).then(r => {
477 if (r.code == 1) { 477 if (r.code == 1) {
@@ -494,11 +494,11 @@ Page({ @@ -494,11 +494,11 @@ Page({
494 }) 494 })
495 return; 495 return;
496 } 496 }
497 - }else{ 497 + } else {
498 console.log(454545) 498 console.log(454545)
499 wx.showToast({ 499 wx.showToast({
500 title: '已经售罄', 500 title: '已经售罄',
501 - icon:'none' 501 + icon: 'none'
502 }) 502 })
503 } 503 }
504 } else { 504 } else {
@@ -511,8 +511,8 @@ Page({ @@ -511,8 +511,8 @@ Page({
511 }, 511 },
512 hide_masks() { 512 hide_masks() {
513 var that = this 513 var that = this
514 - var minimum=that.data.goods.minimum_price  
515 - var pp=that.data.gPrice 514 + var minimum = that.data.goods.minimum_price
  515 + var pp = that.data.gPrice
516 console.log(pp) 516 console.log(pp)
517 pp = Math.round(pp) 517 pp = Math.round(pp)
518 console.log(pp) 518 console.log(pp)
@@ -524,7 +524,7 @@ Page({ @@ -524,7 +524,7 @@ Page({
524 }); 524 });
525 var str = '' 525 var str = ''
526 str = that.data.id_arr.join(','); 526 str = that.data.id_arr.join(',');
527 - if(gPrice>=minimum){ 527 + if (gPrice >= minimum) {
528 if (that.data.stock > 0) { 528 if (that.data.stock > 0) {
529 if (that.data.goods.info.limit_numer == that.data.num || that.data.goods.info.limit_numer == 0) { 529 if (that.data.goods.info.limit_numer == that.data.num || that.data.goods.info.limit_numer == 0) {
530 if (that.data.id_arr.length > 1) { 530 if (that.data.id_arr.length > 1) {
@@ -553,10 +553,10 @@ Page({ @@ -553,10 +553,10 @@ Page({
553 }) 553 })
554 return; 554 return;
555 } 555 }
556 - }else{ 556 + } else {
557 wx.showToast({ 557 wx.showToast({
558 - title: '商品实付'+minimum+'元起送',  
559 - icon:'none' 558 + title: '商品实付' + minimum + '元起送',
  559 + icon: 'none'
560 }) 560 })
561 } 561 }
562 } else { 562 } else {
1 -  
2 const a = getApp(); 1 const a = getApp();
3 Page({ 2 Page({
4 3
@@ -12,9 +11,9 @@ Page({ @@ -12,9 +11,9 @@ Page({
12 /** 11 /**
13 * 生命周期函数--监听页面加载 12 * 生命周期函数--监听页面加载
14 */ 13 */
15 - onLoad: function (options) { 14 + onLoad: function(options) {
16 console.log(options) 15 console.log(options)
17 - if (options.share_id){ 16 + if (options.share_id) {
18 this.setData({ 17 this.setData({
19 share_id: options.share_id 18 share_id: options.share_id
20 }) 19 })
@@ -23,13 +22,14 @@ Page({ @@ -23,13 +22,14 @@ Page({
23 }, 22 },
24 // getSessionKey 23 // getSessionKey
25 getKey() { 24 getKey() {
26 - let url = '/wxapp/public/getSessionKey',t = this; 25 + let url = '/wxapp/public/getSessionKey',
  26 + t = this;
27 wx.login({ 27 wx.login({
28 - success: function (res) { 28 + success: function(res) {
29 let params = { 29 let params = {
30 code: res.code 30 code: res.code
31 }; 31 };
32 - a.post(url,params,true).then(r=>{ 32 + a.post(url, params, true).then(r => {
33 t.setData({ 33 t.setData({
34 sessionKey: r.data.session_key, 34 sessionKey: r.data.session_key,
35 openId: r.data.openid, 35 openId: r.data.openid,
@@ -40,30 +40,31 @@ Page({ @@ -40,30 +40,31 @@ Page({
40 wx.setStorageSync('unionid', r.data.unionid); 40 wx.setStorageSync('unionid', r.data.unionid);
41 }) 41 })
42 }, 42 },
43 - fail: function (res) { },  
44 - complete: function (res) { }, 43 + fail: function(res) {},
  44 + complete: function(res) {},
45 }) 45 })
46 }, 46 },
47 getUserInfo(e) { 47 getUserInfo(e) {
48 - let url = '/wxapp/public/login',params = { 48 + let url = '/wxapp/public/login',
  49 + params = {
49 session_key: this.data.sessionKey, 50 session_key: this.data.sessionKey,
50 encrypted_data: e.detail.encryptedData, 51 encrypted_data: e.detail.encryptedData,
51 iv: e.detail.iv, 52 iv: e.detail.iv,
52 - fromUserId: this.data.share_id ? this.data.share_id:'0' 53 + fromUserId: this.data.share_id ? this.data.share_id : '0'
53 }; 54 };
54 - a.post(url,params).then(r=>{ 55 + a.post(url, params).then(r => {
55 console.log(r) 56 console.log(r)
56 - if(r.code==1){ 57 + if (r.code == 1) {
57 wx.setStorageSync('token', r.data.token); 58 wx.setStorageSync('token', r.data.token);
58 a.globalData.user_id = r.data.user_id 59 a.globalData.user_id = r.data.user_id
59 console.log(r.data); 60 console.log(r.data);
60 wx.switchTab({ 61 wx.switchTab({
61 url: '/pages/index/index' 62 url: '/pages/index/index'
62 }) 63 })
63 - }else{ 64 + } else {
64 wx.showToast({ 65 wx.showToast({
65 title: '网络错误', 66 title: '网络错误',
66 - icon:'none' 67 + icon: 'none'
67 }) 68 })
68 } 69 }
69 }) 70 })
@@ -73,49 +74,49 @@ Page({ @@ -73,49 +74,49 @@ Page({
73 /** 74 /**
74 * 生命周期函数--监听页面初次渲染完成 75 * 生命周期函数--监听页面初次渲染完成
75 */ 76 */
76 - onReady: function () { 77 + onReady: function() {
77 78
78 }, 79 },
79 80
80 /** 81 /**
81 * 生命周期函数--监听页面显示 82 * 生命周期函数--监听页面显示
82 */ 83 */
83 - onShow: function () { 84 + onShow: function() {
84 85
85 }, 86 },
86 87
87 /** 88 /**
88 * 生命周期函数--监听页面隐藏 89 * 生命周期函数--监听页面隐藏
89 */ 90 */
90 - onHide: function () { 91 + onHide: function() {
91 92
92 }, 93 },
93 94
94 /** 95 /**
95 * 生命周期函数--监听页面卸载 96 * 生命周期函数--监听页面卸载
96 */ 97 */
97 - onUnload: function () { 98 + onUnload: function() {
98 99
99 }, 100 },
100 101
101 /** 102 /**
102 * 页面相关事件处理函数--监听用户下拉动作 103 * 页面相关事件处理函数--监听用户下拉动作
103 */ 104 */
104 - onPullDownRefresh: function () { 105 + onPullDownRefresh: function() {
105 106
106 }, 107 },
107 108
108 /** 109 /**
109 * 页面上拉触底事件的处理函数 110 * 页面上拉触底事件的处理函数
110 */ 111 */
111 - onReachBottom: function () { 112 + onReachBottom: function() {
112 113
113 }, 114 },
114 115
115 /** 116 /**
116 * 用户点击右上角分享 117 * 用户点击右上角分享
117 */ 118 */
118 - onShareAppMessage: function () { 119 + onShareAppMessage: function() {
119 120
120 } 121 }
121 }) 122 })