添加 类别商品列表页,添加title text

wechat_user_type
Ge Hao 8 years ago
parent 040adac01a
commit c59e69d11c
  1. 3
      app.json
  2. 3
      pages/address/address.json
  3. 3
      pages/cart/cart.json
  4. 19
      pages/category/category.js
  5. 3
      pages/category/category.json
  6. 0
      pages/category/category.wxml
  7. 0
      pages/category/category.wxss
  8. 16
      pages/index/index.js
  9. 3
      pages/index/index.json
  10. 5
      pages/index/index.wxml
  11. 3
      pages/mine/mine.json
  12. 17
      utils/product.js

@ -4,7 +4,8 @@
"pages/show_product/show_product",
"pages/address/address",
"pages/cart/cart",
"pages/mine/mine"
"pages/mine/mine",
"pages/category/category"
],
"window":{
"backgroundTextStyle":"light",

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "收货地址"
}

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "购物车"
}

@ -0,0 +1,19 @@
const product = require('../../utils/product.js')
Page({
data: {
items: []
},
onLoad: function(params) {
var that = this
product.getCategories(params.type).then(function(result) {
var data = getApp().store.sync(result.data)
that.setData({'items': data})
wx.setStorage({
key:`cate_${params.type}`,
data:data
})
})
}
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "分类"
}

@ -2,13 +2,13 @@ const product = require('../../utils/product.js')
Page({
data: {
categories: [2,6,7],
categories: [2,7,9],
items: [],
slides: [],
navs: [{icon: "../../images/1.png", name: "资产"},
{icon: "../../images/1.png", name: "直销"},
{icon: "../../images/1.png", name: "严选"},
{icon: "../../images/1.png", name: "包装"}]
navs: [{icon: "../../images/1.png", name: "资产", key: '1'},
{icon: "../../images/1.png", name: "直销", key: '2'},
{icon: "../../images/1.png", name: "严选", key: '3'},
{icon: "../../images/1.png", name: "包装", key: '4'}]
},
bindShowProduct: function (e) {
@ -17,6 +17,12 @@ Page({
})
},
catchTapCategory: function (e) {
wx.navigateTo({
url: `../category/category?type=${e.currentTarget.dataset.type}`
})
},
onLoad: function() {
var that = this

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "商城首页"
}

@ -12,7 +12,7 @@
<view class="navs">
<block wx:for-items="{{navs}}">
<view class="nav-item" catchtap="catchTapCategory" data-type="{{item.name}}">
<view class="nav-item" catchtap="catchTapCategory" data-type="{{item.key}}">
<image src="{{item.icon}}" class="nav-image"/>
<text>{{item.name}}</text>
</view>
@ -26,7 +26,7 @@
<view>
<view class="category-title">
<view class="icon"><image src="../../images/1.png"></image></view>
<view><text class="name">新品上市</text></view>
<view><text class="name">{{category}}</text></view>
</view>
<block wx:for="{{items}}" wx:for-item="item">
<view wx:if="{{category === item['category-id']}}">
@ -37,7 +37,6 @@
<view class="item-right">
<view class="title"><text> {{item.name}} </text></view>
<view class="desc"><text> {{item.desc || '私人稻田精品礼盒'}} </text></view>
<!--<text class="price"> ¥{{item.price}} </text>-->
<view class="buy-now"><text class="inline">立即购买</text></view>
</view>
</view>

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "我的资料"
}

@ -35,7 +35,18 @@ function postBilling (data) {
})
})
}
function getCategories (data) {
return new Promise((resolve, reject) => {
wx.request({
url: `${API_URL}/products?category=${data}`,
header: { 'Content-Type': 'application/json'},
success: resolve,
fail: reject
})
})
}
module.exports = {
getProducts () {
@ -48,5 +59,9 @@ module.exports = {
postBilling (data) {
return postBilling(data)
},
getCategories (data) {
return getCategories(data)
}
}

Loading…
Cancel
Save