This commit is contained in:
2019-12-19 14:30:34 +08:00
10 changed files with 127 additions and 80 deletions

View File

@@ -1,66 +1,79 @@
// pages/classify/classify.js
import { request } from "../../utils/bin"
Page({
/**
* 页面的初始数据
*/
data: {
/**
* 页面的初始数据
*/
data: {
type: []
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
request({
url: "Goods/goodsCategoryList",
data: {
parent_id: 2
}
}).then((res) => {
// console.log(res)
this.setData({
type: res.data.result
})
console.log(this.data.type, 150)
})
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
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 () {
}
}
})

View File

@@ -1,4 +1,4 @@
<view class="box">
<navigation></navigation>
<list></list>
<navigation types="{{type}}"></navigation>
<list ></list>
</view>

View File

@@ -1,4 +1,5 @@
// pages/product/product.js
// pages/product/product.js'
import { request } from "../../utils/bin"
Page({
/**
@@ -12,15 +13,40 @@ Page({
* 生命周期函数--监听页面加载
*/
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)
})
},
// goshop() {
// },
bindPickerChange(e) {
wx.switchTab({
url: '/pages/shopping/shopping'
})
console.log(e.detail.value)
request({
url: "Cart/addCart",
data: {
goods_id: this.data.shopid,
goods_num: 1,
goods_spec:e.detail.value
}
}).then((res)=>{
console.log(res)
wx.switchTab({
url: '/pages/shopping/shopping'
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成

View File

@@ -1,6 +1,11 @@
<view class="box">
<swiper indicator-dots="{{true}}" circular="{{true}}" autoplay="{{true}}" interval="{{2000}}" class="swiper">
<block>
<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>
@@ -9,16 +14,11 @@
<swiper-item>
<image class="image"> </image>
</swiper-item>
</block>
<block>
<swiper-item>
<image class="image"> </image>
</swiper-item>
</block>
</block> -->
</swiper>
<text class="title">产品名称产品名称产品名称</text>
<text class="menery">$140,000</text>
<picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
<view class="add" >加入购物车</view>
<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>