换ubuntu
This commit is contained in:
@@ -1,110 +1,110 @@
|
||||
// pages/product/product.js'
|
||||
import { request } from "../../utils/bin"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
array: ['20粒', '30粒', '50粒', '100粒'],
|
||||
userid:0
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
console.log(options)
|
||||
request({
|
||||
url: "Goods/goodsInfo",
|
||||
data: {
|
||||
id: options.shopid
|
||||
}
|
||||
}).then((res) => {
|
||||
// console.log(res)
|
||||
this.setData({
|
||||
info: res.data.result,
|
||||
shopid:options.shopid,
|
||||
})
|
||||
// console.log(this.data.type, 150)
|
||||
})
|
||||
request({
|
||||
url:"User/validateOpenid"
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
this.setData({
|
||||
userid:res.data.data.user_id
|
||||
})
|
||||
})
|
||||
},
|
||||
// goshop() {
|
||||
|
||||
// },
|
||||
bindPickerChange(e) {
|
||||
console.log(e.detail.value)
|
||||
request({
|
||||
url: "Cart/addCart",
|
||||
data: {
|
||||
goods_id: this.data.shopid,
|
||||
goods_num: 1,
|
||||
goods_spec:"",
|
||||
user_id:this.data.userid
|
||||
},
|
||||
name:"session_id"
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
wx.switchTab({
|
||||
url: '/pages/shopping/shopping'
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {
|
||||
|
||||
}
|
||||
// pages/product/product.js'
|
||||
import { request } from "../../utils/bin"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
array: ['20粒', '30粒', '50粒', '100粒'],
|
||||
userid:0
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
console.log(options)
|
||||
request({
|
||||
url: "Goods/goodsInfo",
|
||||
data: {
|
||||
id: options.shopid
|
||||
}
|
||||
}).then((res) => {
|
||||
// console.log(res)
|
||||
this.setData({
|
||||
info: res.data.result,
|
||||
shopid:options.shopid,
|
||||
})
|
||||
// console.log(this.data.type, 150)
|
||||
})
|
||||
request({
|
||||
url:"User/validateOpenid"
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
this.setData({
|
||||
userid:res.data.data.user_id
|
||||
})
|
||||
})
|
||||
},
|
||||
// goshop() {
|
||||
|
||||
// },
|
||||
bindPickerChange(e) {
|
||||
console.log(e.detail.value)
|
||||
request({
|
||||
url: "Cart/addCart",
|
||||
data: {
|
||||
goods_id: this.data.shopid,
|
||||
goods_num: 1,
|
||||
goods_spec:"",
|
||||
user_id:this.data.userid
|
||||
},
|
||||
name:"session_id"
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
wx.switchTab({
|
||||
url: '/pages/shopping/shopping'
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -1,37 +1,37 @@
|
||||
.box{
|
||||
border-top: 1rpx solid #eaeaea;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.swiper{
|
||||
margin-top: 109rpx;
|
||||
width: 389rpx;
|
||||
height: 657rpx;
|
||||
.image{
|
||||
width: 389rpx;
|
||||
height: 549rpx;
|
||||
background-color: #000;
|
||||
}
|
||||
}
|
||||
.title{
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
margin-bottom: 34rpx;
|
||||
width: 540rpx;
|
||||
}
|
||||
.menery{
|
||||
font-size: 34rpx;
|
||||
color: #666;
|
||||
margin-bottom: 70rpx;
|
||||
}
|
||||
.add{
|
||||
width: 308rpx;
|
||||
height: 98rpx;
|
||||
background-color: #50CA80;
|
||||
border-radius: 49rpx;
|
||||
line-height: 98rpx;
|
||||
font-size: 34rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
.box{
|
||||
border-top: 1rpx solid #eaeaea;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.swiper{
|
||||
margin-top: 109rpx;
|
||||
width: 389rpx;
|
||||
height: 657rpx;
|
||||
.image{
|
||||
width: 389rpx;
|
||||
height: 549rpx;
|
||||
background-color: #000;
|
||||
}
|
||||
}
|
||||
.title{
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
margin-bottom: 34rpx;
|
||||
width: 540rpx;
|
||||
}
|
||||
.menery{
|
||||
font-size: 34rpx;
|
||||
color: #666;
|
||||
margin-bottom: 70rpx;
|
||||
}
|
||||
.add{
|
||||
width: 308rpx;
|
||||
height: 98rpx;
|
||||
background-color: #50CA80;
|
||||
border-radius: 49rpx;
|
||||
line-height: 98rpx;
|
||||
font-size: 34rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,24 @@
|
||||
<view class="box">
|
||||
<swiper indicator-dots="{{true}}" circular="{{true}}" autoplay="{{true}}" interval="{{2000}}" class="swiper">
|
||||
<block wx:for="{{info.gallery}}">
|
||||
<swiper-item>
|
||||
<image class="image" src="{{item.image_url}}"> </image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
<!-- <block>
|
||||
<swiper-item>
|
||||
<image class="image"> </image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
<block>
|
||||
<swiper-item>
|
||||
<image class="image"> </image>
|
||||
</swiper-item>
|
||||
</block> -->
|
||||
</swiper>
|
||||
<text class="title">{{info.goods.goods_name}}</text>
|
||||
<text class="menery">$ {{info.goods.shop_price}}</text>
|
||||
<picker bindchange="bindPickerChange" value="{{item.item_id?item.item_id:0}}" range="{{info.goods.goods_spec_list?info.goods.goods_spec_list:['默认规格']}}">
|
||||
<view class="add">加入购物车</view>
|
||||
</picker>
|
||||
<view class="box">
|
||||
<swiper indicator-dots="{{true}}" circular="{{true}}" autoplay="{{true}}" interval="{{2000}}" class="swiper">
|
||||
<block wx:for="{{info.gallery}}">
|
||||
<swiper-item>
|
||||
<image class="image" src="{{item.image_url}}"> </image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
<!-- <block>
|
||||
<swiper-item>
|
||||
<image class="image"> </image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
<block>
|
||||
<swiper-item>
|
||||
<image class="image"> </image>
|
||||
</swiper-item>
|
||||
</block> -->
|
||||
</swiper>
|
||||
<text class="title">{{info.goods.goods_name}}</text>
|
||||
<text class="menery">$ {{info.goods.shop_price}}</text>
|
||||
<picker bindchange="bindPickerChange" value="{{item.item_id?item.item_id:0}}" range="{{info.goods.goods_spec_list?info.goods.goods_spec_list:['默认规格']}}">
|
||||
<view class="add">加入购物车</view>
|
||||
</picker>
|
||||
</view>
|
||||
@@ -1 +1 @@
|
||||
.box{border-top:1rpx solid #eaeaea;display:flex;flex-direction:column;align-items:center}.box .swiper{margin-top:109rpx;width:389rpx;height:657rpx}.box .swiper .image{width:389rpx;height:549rpx;background-color:#000}.box .title{font-size:32rpx;color:#333;margin-bottom:34rpx;width:540rpx}.box .menery{font-size:34rpx;color:#666;margin-bottom:70rpx}.box .add{width:308rpx;height:98rpx;background-color:#50CA80;border-radius:49rpx;line-height:98rpx;font-size:34rpx;color:#fff;text-align:center}
|
||||
.box{border-top:1rpx solid #eaeaea;display:flex;flex-direction:column;align-items:center}.box .swiper{margin-top:109rpx;width:389rpx;height:657rpx}.box .swiper .image{width:389rpx;height:549rpx;background-color:#000}.box .title{font-size:32rpx;color:#333;margin-bottom:34rpx;width:540rpx}.box .menery{font-size:34rpx;color:#666;margin-bottom:70rpx}.box .add{width:308rpx;height:98rpx;background-color:#50CA80;border-radius:49rpx;line-height:98rpx;font-size:34rpx;color:#fff;text-align:center}
|
||||
|
||||
Reference in New Issue
Block a user