作者 wangxuyu

换电脑前上传

... ... @@ -45,16 +45,16 @@ Page({
statestatus: 0,
groupList: [],
yesno: false,
stock:0,
is_vip:0,
string:'',
stock: 0,
is_vip: 0,
string: '',
gggPrice: null
},
//进入评论详情
go_comment_detail(e){
go_comment_detail(e) {
var id = e.currentTarget.dataset.id
wx.navigateTo({
url: '../user_comment_detail/user_comment_detail?id='+id,
url: '../user_comment_detail/user_comment_detail?id=' + id,
})
},
//进入基本参数
... ... @@ -79,7 +79,7 @@ Page({
})
wx.pageScrollTo({
scrollTop: 0,
duration:0
duration: 0
})
this.fetchGoods()
},
... ... @@ -145,7 +145,7 @@ Page({
let listAll = t.data.goods.attr.attr_sku;
let list = listAll[e.currentTarget.dataset.parent].item;
let x = e.currentTarget.dataset.index;
let stock=t.data.stock
let stock = t.data.stock
// 当前点击Id
let nowId = e.currentTarget.dataset.gid;
//当前点击value
... ... @@ -224,7 +224,7 @@ Page({
string = sys_attrprice[i].sku_values
}
}
if(that.data.is_vip==1){
if (that.data.is_vip == 1) {
gggPrice = vip_skuid_price
} else {
gggPrice = old_skuid_price
... ... @@ -238,7 +238,7 @@ Page({
vip_skuid_price: vip_skuid_price,
skuid_arr: new_arr,
ids: new_arr_item,
stock:stock,
stock: stock,
string: string,
gggPrice: gggPrice
});
... ... @@ -280,13 +280,13 @@ Page({
}
},
//渲染是不是会员
fetchUser(){
fetchUser() {
let url = '/wxapp/user/index'
let that=this
app.post(url).then(res=>{
if(res.code==1){
let that = this
app.post(url).then(res => {
if (res.code == 1) {
that.setData({
is_vip:res.data.user.is_vip
is_vip: res.data.user.is_vip
})
that.fetchGoods()
}
... ... @@ -300,7 +300,7 @@ Page({
id: this.data.id
};
let that = this
let stock=null
let stock = null
let string = null
app.post(url, params).then(r => {
console.log(r);
... ... @@ -336,13 +336,13 @@ Page({
old_skuid_price = sys_attrprice[i].old_price
vip_skuid_price = sys_attrprice[i].vip_price
stock = sys_attrprice[i].stock
string =sys_attrprice[i].sku_values
string = sys_attrprice[i].sku_values
}
}
var gggPrice = null
if(that.data.is_vip==1){
if (that.data.is_vip == 1) {
gggPrice = vip_skuid_price
}else{
} else {
gggPrice = old_skuid_price
}
r.data.comment.forEach(function(ele, index) {
... ... @@ -354,7 +354,7 @@ Page({
ele.create_time = app.timeFormate(ele.create_time, 'YYMMDD');
});
console.log(r.data.vips.cashback_price)
r.data.vips.cashback_price +='0'
r.data.vips.cashback_price += '0'
r.data.vips.cashback_price = r.data.vips.cashback_price.substr(0, 4)
var zuihoujiage = ''
if (that.data.is_vip == 1) {
... ... @@ -471,7 +471,7 @@ Page({
skuid: that.data.skuid,
num: that.data.num
}
if(that.data.stock>0){
if (that.data.stock > 0) {
if (that.data.num <= e.currentTarget.dataset.limit || e.currentTarget.dataset.limit == 0) {
app.post(url, params).then(r => {
if (r.code == 1) {
... ... @@ -494,11 +494,11 @@ Page({
})
return;
}
}else{
} else {
console.log(454545)
wx.showToast({
title: '已经售罄',
icon:'none'
icon: 'none'
})
}
} else {
... ... @@ -511,8 +511,8 @@ Page({
},
hide_masks() {
var that = this
var minimum=that.data.goods.minimum_price
var pp=that.data.gPrice
var minimum = that.data.goods.minimum_price
var pp = that.data.gPrice
console.log(pp)
pp = Math.round(pp)
console.log(pp)
... ... @@ -524,7 +524,7 @@ Page({
});
var str = ''
str = that.data.id_arr.join(',');
if(gPrice>=minimum){
if (gPrice >= minimum) {
if (that.data.stock > 0) {
if (that.data.goods.info.limit_numer == that.data.num || that.data.goods.info.limit_numer == 0) {
if (that.data.id_arr.length > 1) {
... ... @@ -553,10 +553,10 @@ Page({
})
return;
}
}else{
} else {
wx.showToast({
title: '商品实付'+minimum+'元起送',
icon:'none'
title: '商品实付' + minimum + '元起送',
icon: 'none'
})
}
} else {
... ...
const a = getApp();
Page({
... ... @@ -12,9 +11,9 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
console.log(options)
if (options.share_id){
if (options.share_id) {
this.setData({
share_id: options.share_id
})
... ... @@ -23,13 +22,14 @@ Page({
},
// getSessionKey
getKey() {
let url = '/wxapp/public/getSessionKey',t = this;
let url = '/wxapp/public/getSessionKey',
t = this;
wx.login({
success: function (res) {
success: function(res) {
let params = {
code: res.code
};
a.post(url,params,true).then(r=>{
a.post(url, params, true).then(r => {
t.setData({
sessionKey: r.data.session_key,
openId: r.data.openid,
... ... @@ -40,30 +40,31 @@ Page({
wx.setStorageSync('unionid', r.data.unionid);
})
},
fail: function (res) { },
complete: function (res) { },
fail: function(res) {},
complete: function(res) {},
})
},
getUserInfo(e) {
let url = '/wxapp/public/login',params = {
let url = '/wxapp/public/login',
params = {
session_key: this.data.sessionKey,
encrypted_data: e.detail.encryptedData,
iv: e.detail.iv,
fromUserId: this.data.share_id ? this.data.share_id:'0'
fromUserId: this.data.share_id ? this.data.share_id : '0'
};
a.post(url,params).then(r=>{
a.post(url, params).then(r => {
console.log(r)
if(r.code==1){
if (r.code == 1) {
wx.setStorageSync('token', r.data.token);
a.globalData.user_id = r.data.user_id
console.log(r.data);
wx.switchTab({
url: '/pages/index/index'
})
}else{
} else {
wx.showToast({
title: '网络错误',
icon:'none'
icon: 'none'
})
}
})
... ... @@ -73,49 +74,49 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...