diff --git a/app.json b/app.json index b8a333dcb0c8d3a4f3eab4b944e71fd79353a7fe..e31de736df83a24d05fd162d8be45de220201dad 100644 --- a/app.json +++ b/app.json @@ -3,13 +3,20 @@ "pages/index/index", "pages/category/category", "pages/cart/cart", - "pages/info/info" + "pages/info/info", + "pages/goods/list/index", + "pages/goods/detail/index", + "pages/order/detail/index", + "pages/order/list/index", + "pages/address/add/index", + "pages/address/list/index", + "pages/login/index" ], "window": { "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "Weixin", - "navigationBarTextStyle": "black" + "navigationBarBackgroundColor": "#9C0211", + "navigationBarTitleText": "慕尚花坊", + "navigationBarTextStyle": "white" }, "tabBar": { "color": "#252933", diff --git a/app.wxss b/app.wxss index 777998bc956f12ea3868a4d988bc95be7beef89f..cc93c7c2e537ab93c3c2d116d8c8cfe7065a0d5f 100644 --- a/app.wxss +++ b/app.wxss @@ -1,7 +1,18 @@ /**app.wxss**/ + .container { height: 100%; display: flex; flex-direction: column; box-sizing: border-box; + background-color: #f3f5f7; + padding-bottom: 49px; +} + +.bg-white { + background-color: white; +} + +.img { + width: 100%; } diff --git a/components/filter/index.js b/components/filter/index.js new file mode 100644 index 0000000000000000000000000000000000000000..06bbac28dca4843fc07f7a677d86d9ee790cff18 --- /dev/null +++ b/components/filter/index.js @@ -0,0 +1,82 @@ +Component({ + options: { + multipleSlots: true, + }, + + properties: { + overall: { + type: Number, + value: 1, + observer(overall) { + this.setData({ + overall, + }); + }, + }, + layout: { + type: Number, + value: 1, + observer(layout) { + this.setData({ + layout, + }); + }, + }, + sorts: { + type: String, + value: '', + observer(sorts) { + this.setData({ + sorts, + }); + }, + }, + color: { + type: String, + value: '#FA550F', + }, + }, + + data: { + layout: 1, + overall: 1, + sorts: '', + }, + + methods: { + onChangeShowAction() { + const { layout } = this.data; + const nextLayout = layout === 1 ? 0 : 1; + this.triggerEvent('change', { ...this.properties, layout: nextLayout }); + }, + + handlePriseSort() { + const { sorts } = this.data; + this.triggerEvent('change', { + ...this.properties, + overall: 0, + sorts: sorts === 'desc' ? 'asc' : 'desc', + }); + }, + + open() { + this.triggerEvent('showFilterPopup', { + show: true, + }); + }, + + onOverallAction() { + const { overall } = this.data; + const nextOverall = overall === 1 ? 0 : 1; + const nextData = { + sorts: '', + prices: [], + }; + this.triggerEvent('change', { + ...this.properties, + ...nextData, + overall: nextOverall, + }); + }, + }, +}); diff --git a/components/filter/index.json b/components/filter/index.json new file mode 100644 index 0000000000000000000000000000000000000000..6f503457268340831bcae9bfc45628abc0509eca --- /dev/null +++ b/components/filter/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "@vant/weapp/icon/index" + } +} \ No newline at end of file diff --git a/components/filter/index.wxml b/components/filter/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..5116923cc497b9d41824a8261a805b94c54e5555 --- /dev/null +++ b/components/filter/index.wxml @@ -0,0 +1,36 @@ + + + + + + 综合 + + + 综合 + + + 价格 + + + + + + + 新品 + + + + + + + diff --git a/components/filter/index.wxss b/components/filter/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..e9bd6bd804e3487f275d22b0cf8cfe83a035a167 --- /dev/null +++ b/components/filter/index.wxss @@ -0,0 +1,51 @@ +/* components/filter/index.wxss */ +.filter-wrap { + width: 100%; + height: 88rpx; + display: flex; + justify-content: space-between; + position: relative; + background: #fff; +} + +.filter-right-content { + height: 100%; + flex-basis: 100rpx; + text-align: center; + line-height: 88rpx; +} + +.filter-left-content { + height: 100%; + display: flex; + flex-grow: 2; + flex-flow: row nowrap; + justify-content: space-between; +} + +.filter-left-content .filter-item { + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + font-size: 26rpx; + line-height: 36rpx; + font-weight: 400; + color: rgba(51, 51, 51, 1); +} + +.filter-left-content .filter-item .filter-price { + display: flex; + flex-direction: column; + margin-left: 6rpx; + justify-content: space-between; +} + +.filter-left-content .filter-item .wr-filter { + margin-left: 8rpx; +} + +.filter-left-content .filter-active-item { + color: #fa550f; +} diff --git a/components/goods-card/index.js b/components/goods-card/index.js new file mode 100644 index 0000000000000000000000000000000000000000..442933c151c7a75480f74bf4539d694813dd13f3 --- /dev/null +++ b/components/goods-card/index.js @@ -0,0 +1,22 @@ +// components/goods-card/index.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + item: { + type: Object, + value: {}, + }, + }, + + /** + * 组件的初始数据 + */ + data: {}, + + /** + * 组件的方法列表 + */ + methods: {}, +}); diff --git a/components/goods-card/index.json b/components/goods-card/index.json new file mode 100644 index 0000000000000000000000000000000000000000..e8cfaaf80c404eb97d3cf8b6277ec15f37e6905e --- /dev/null +++ b/components/goods-card/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/goods-card/index.wxml b/components/goods-card/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..d99574434fd4de2a55c0c991964feed7f449f563 --- /dev/null +++ b/components/goods-card/index.wxml @@ -0,0 +1,19 @@ + + + + + + + + {{item.name}} + {{item.floralLanguage}} + + ¥{{item.price}} + ¥{{item.marketPrice}} + + + + + + + diff --git a/components/goods-card/index.wxss b/components/goods-card/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..9acb2ed331890de63629e490d0fe2e4c6df510f7 --- /dev/null +++ b/components/goods-card/index.wxss @@ -0,0 +1,73 @@ +/* components/goods-card/index.wxss */ +.product-item { + display: inline-block; + width: 46.96132597%; + margin: 0 1.51933702% 3.03867403%; + border-radius: 8px; + vertical-align: top; + overflow: hidden; + background-color: #fff; +} + +.navigation { + width: 100%; + height: 100%; + display: block; +} + +.product-item-info { + padding: 8px 10px; + display: flex; + flex-direction: column; +} + +.product-item-info-name { + font-weight: 600; + font-size: 15px; + line-height: 20px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.product-item-info-promo { + padding-top: 4px; + padding-bottom: 3px; + font-size: 12px; + color: #71797f; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.product-item-info-bottom { + margin-top: 8px; + display: flex; +} +.pre { + margin-right: 2px; +} + +.product-item-info-price { + font-size: 15px; + line-height: 24px; + font-weight: bold; +} + +.product-item-info-origin-price { + flex: 1; + font-size: 12px; + line-height: 26px; + color: #71797f; + text-decoration-line: line-through; + margin-left: 6%; +} + +.product-item-info-btn image { + width: 24px; + height: 24px; +} + +.img { + width: 100%; +} diff --git a/modal/category.js b/modal/category.js new file mode 100644 index 0000000000000000000000000000000000000000..2f522d7d0da965134df311b9b0cc141d7efb4d4b --- /dev/null +++ b/modal/category.js @@ -0,0 +1,319 @@ +/** + * @description: 首页分类导航 + * @returns {*} + */ + +export const categorylist = [ + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/flowers1.png', + text: '韩式花束', + }, + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/flowers1.png', + text: '韩式花束', + }, + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/flowers1.png', + text: '韩式花束', + }, + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/flowers1.png', + text: '韩式花束', + }, + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/flowers1.png', + text: '韩式花束', + }, + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/srzf2.png?v122', + text: '生日祝福', + small: true, + }, + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/srzf2.png?v122', + text: '生日祝福', + small: true, + }, + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/srzf2.png?v122', + text: '生日祝福', + small: true, + }, + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/srzf2.png?v122', + text: '生日祝福', + small: true, + }, + { + url: 'https://img02.hua.com//chanpintupian/2022shouye/srzf2.png?v122', + text: '生日祝福', + small: true, + }, +]; + +export const category = [ + { + name: '爱礼精选', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/flowers1.png', + id: 1, + }, + { + name: '鲜花玫瑰', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/forever1.png', + id: 2, + }, + { + name: '永生玫瑰', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/cake1.png', + id: 3, + }, + { + name: '玫瑰珠宝', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/gifts1.png', + id: 4, + }, + { + name: '香水体护', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/chocolate1.png', + id: 5, + }, + { + name: '玫瑰家居', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/srzf2.png?v122', + id: 6, + }, + { + name: '开业花礼', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/bbqh2.png?v122', + id: 7, + }, + { + name: '生日祝福', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/swky2.png?v132', + id: 8, + }, + { + name: '一周一花', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/znjn2.png?v122', + id: 9, + }, + { + name: '网红绿植', + imageUrl: 'https://img02.hua.com//chanpintupian/2022shouye/qytg2.png?v111', + id: 10, + }, +]; + +// export const categoryList = []; +export const getCategoryList = [ + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/cate-1.png', + name: '真情告白', + id: 1, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '浪漫求婚', + id: 2, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '珍贵纪念', + id: 3, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '爱意表达', + id: 4, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-1.png', + name: '爱礼精选', + id: 1, + }, + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '经典永续', + id: 5, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '玫瑰经典', + id: 6, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-2.png', + name: '鲜花玫瑰', + id: 2, + }, + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '玫瑰公仔', + id: 7, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '星座金典', + id: 8, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '玫瑰系列', + id: 9, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '音乐系列', + id: 10, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '经典永续', + id: 11, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-3.png', + name: '永生玫瑰', + id: 3, + }, + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '星座经典', + id: 12, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '爱锁系列', + id: 13, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '玫瑰公仔', + id: 14, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-4.png', + name: '玫瑰珠宝', + id: 4, + }, + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '香水', + id: 15, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '织恋', + id: 16, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '沉爱', + id: 17, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-5.png', + name: '香水体护', + id: 5, + }, + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '香氛蜡烛', + id: 18, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '香氛散香', + id: 19, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '玫瑰礼品', + id: 20, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '香氛挂件', + id: 21, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-6.png', + name: '玫瑰家居', + id: 6, + }, + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '开业花礼', + id: 22, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '会议用花', + id: 23, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-7.png', + name: '开业花礼', + id: 7, + }, + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '送恋人', + id: 24, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '送朋友', + id: 25, + }, + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '送长辈', + id: 26, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-8.png', + name: '生日祝福', + id: 8, + }, + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '一周一花', + id: 27, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-9.png', + name: '一周一花', + id: 9, + }, + { + children: [ + { + imageUrl: 'http://39.98.123.211:8300/images/null', + name: '网红绿植', + id: 28, + }, + ], + imageUrl: 'http://39.98.123.211:8300/images/cate-10.png', + name: '网红绿植', + id: 10, + }, +]; diff --git a/modal/swiper.js b/modal/swiper.js new file mode 100644 index 0000000000000000000000000000000000000000..5458756280b718746b1c5d8fd378ef895d268254 --- /dev/null +++ b/modal/swiper.js @@ -0,0 +1,12 @@ +/** + * @description: 轮播数据 + * @returns {*} + */ +export const backgroundList = [ + 'https://img02.hua.com/zhuanti/valentine/2023/23_valentine_banner_m.jpg', + 'https://img02.hua.com/slider/22_nuandong_banner_m.jpg', + 'https://img02.hua.com/slider/22_birthday.jpg', +]; + +export const banner = + 'https://img02.hua.com/zhuanti/valentine/2023/23_valentine_mbanner_m.png?a1'; diff --git a/pages/address/add/index.js b/pages/address/add/index.js new file mode 100644 index 0000000000000000000000000000000000000000..fa533838794a4f4840b4d25effc0e401456ac6c9 --- /dev/null +++ b/pages/address/add/index.js @@ -0,0 +1,65 @@ +// pages/address/add/index.js +import { areaList } from '@vant/area-data'; +Page({ + /** + * 页面的初始数据 + */ + data: { + radio: '1', + show: false, + areaList, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) {}, + + /** + * 打开popup + */ + onShowPopup() { + this.setData({ show: true }); + }, + /** + * 关闭popup + */ + onClose() { + this.setData({ show: false }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() {}, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/pages/address/add/index.json b/pages/address/add/index.json new file mode 100644 index 0000000000000000000000000000000000000000..a50dbaa5b147092fc3d4a05c029ee126e5cbee59 --- /dev/null +++ b/pages/address/add/index.json @@ -0,0 +1,12 @@ +{ + "usingComponents": { + "van-cell": "@vant/weapp/cell/index", + "van-cell-group": "@vant/weapp/cell-group/index", + "van-field": "@vant/weapp/field/index", + "van-radio": "@vant/weapp/radio/index", + "van-radio-group": "@vant/weapp/radio-group/index", + "van-button": "@vant/weapp/button/index", + "van-popup": "@vant/weapp/popup/index", + "van-area": "@vant/weapp/area/index" + } +} \ No newline at end of file diff --git a/pages/address/add/index.wxml b/pages/address/add/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..910a311f12d5cf915da150c6effbe7223d49883b --- /dev/null +++ b/pages/address/add/index.wxml @@ -0,0 +1,46 @@ + + +
+ + + + + + + + + + 公司 + + + +
+ + 保存 + + + + +
\ No newline at end of file diff --git a/pages/address/add/index.wxss b/pages/address/add/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..95c3d7112b87b3cb0f51a4205e4015b2cecf4b62 --- /dev/null +++ b/pages/address/add/index.wxss @@ -0,0 +1,16 @@ +/* pages/address/add/index.wxss */ + +.address-detail { + height: 100vh; +} +.flex { + display: flex; +} +.form-content { + margin-top: 16px; +} + +.footer-btn { + margin-top: 20px; + padding: 0 30px; +} diff --git a/pages/address/list/index.js b/pages/address/list/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e4725615b4933a126082dc2884f7ceeb562b5d36 --- /dev/null +++ b/pages/address/list/index.js @@ -0,0 +1,66 @@ +// pages/address/list/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/address/list/index.json b/pages/address/list/index.json new file mode 100644 index 0000000000000000000000000000000000000000..d9c985d8fe1e96ab69ead0298b5263845a166a43 --- /dev/null +++ b/pages/address/list/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-icon": "@vant/weapp/icon/index" + } +} \ No newline at end of file diff --git a/pages/address/list/index.wxml b/pages/address/list/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..5fc455a6b9698d75227c749cfd5ff31479746514 --- /dev/null +++ b/pages/address/list/index.wxml @@ -0,0 +1,35 @@ + + + + 我的收货地址 + + + + + 甘肃省甘南藏族自治州碌曲县松日鼎盛大厦0层0号 + + + + + + + 甘肃省甘南藏族自治州碌曲县松日鼎盛大厦0层0号 + + + + + + + + + 新建地址 + + + + diff --git a/pages/address/list/index.wxss b/pages/address/list/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..4654b6b04b338919a3049e1f350aa36be36c9c14 --- /dev/null +++ b/pages/address/list/index.wxss @@ -0,0 +1,93 @@ +/* pages/address/list/index.wxss */ + +.address-list { + height: 100vh; +} + +.flex { + display: flex; +} + +.title { + font-size: 12px; + padding: 12px; + color: #999999; +} + +.address-info { + font-size: 16px; + color: #333; + margin-bottom: 8px; +} + +.user-info { + font-size: 14px; + color: #999; +} +.list-warpper { + background-color: #fff; + padding: 0 12px; +} + +.list-item::after { + content: ''; + position: absolute; + top: 0; + left: 32rpx; + width: 200%; + height: 2rpx; + transform: scale(0.5); + transform-origin: 0 0; + box-sizing: border-box; + border-bottom: #e5e5e5 2rpx solid; + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: rgb(229, 229, 229); +} + +.list-warpper .list-item { + align-items: center; + padding: 20px; + justify-content: space-between; +} + +.list-warpper .list-item:not(:last-child) { + border-bottom: #e5e5e5 2rpx solid; + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: rgb(229, 229, 229); +} + +.tag { + display: inline-block; + font-size: 12px; + padding: 0rpx 8rpx; + background: #f0f1ff; + color: #5a66ff; +} + +.info { + margin-right: 16px; +} + +.footer { + position: fixed; + width: 100%; + left: 0; + bottom: 0; + display: flex; + justify-content: center; + align-items: center; + padding-bottom: env(safe-area-inset-bottom); +} + +.btn { + width: 76%; + line-height: 80rpx; + font-weight: bold; + font-size: 28rpx; + text-align: center; + border-radius: 40rpx; + background-color: #fa4126; + color: #ffffff; +} diff --git a/pages/cart/cart.js b/pages/cart/cart.js index 1a45cefc16b022b2b690197a859d38b4ec1fc1da..3268323ee88af72bec8ddfa4ac64fbe5b237f8b5 100644 --- a/pages/cart/cart.js +++ b/pages/cart/cart.js @@ -1,11 +1,143 @@ -Component({ - pageLifetimes: { - show() { - if (typeof this.getTabBar === 'function' && this.getTabBar()) { - this.getTabBar().setData({ - selected: 2, - }); +import { + findCartList, + deleteCart, + checkCart, + addToCart, + checkAllCart, +} from '../../utils/api'; +Page({ + data: { + checked: true, + price: 0, + list: [], + totalCount: 0, + totalPrice: 0, + isCheckedAll: true, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) {}, + + onShow() { + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + this.getTabBar().setData({ + selected: 2, + }); + } + this.getCartList(); + }, + + /** + * 获取轮播图 + */ + async getCartList() { + const res = await findCartList(); + this.setData({ + list: res.data, + }); + this.computedTotalCount(); + this.computedTotalPrice(); + this.getCheckAllStatus(); + }, + + /** + * 修改选中状态 + */ + async onChangeCheck(event) { + const isChecked = event.detail ? 1 : 0; + const goodsId = event.target.dataset.goodsid; + await checkCart({ + goodsId, + isChecked, + }); + this.getCartList(); + }, + /** + * 修改购物车数量 + */ + async onChangeCount(event) { + console.log(event.detail); + const newCount = event.detail; + const goodsId = event.target.dataset.goodsid; + const originCount = event.target.dataset.count; + const count = newCount - originCount; + + console.log(count, goodsId); + if (count > 0) { + await addToCart({ + goodsId, + count, + }); + this.getCartList(); + } + }, + /** + * 删除购物车 + */ + async handleDelCart(event) { + const goodsId = event.target.dataset.goodsid; + const res = await deleteCart(goodsId); + if (res.code == 200) { + wx.showToast({ title: '删除成功' }); + this.getCartList(); + } + }, + + /** + * 计算购物车总数量 + */ + computedTotalCount() { + let s = 0; + this.data.list.map((item) => { + return (s += item.count); + }); + this.setData({ totalCount: s }); + }, + /** + * 计算购物车商品总价 + */ + computedTotalPrice() { + let s = 0; + const { list } = this.data; + list.forEach((e) => { + if (e.isChecked) { + const n = e.price * e.count; + console.log(n); + s = n + s; + } + }); + this.setData({ totalPrice: s }); + }, + /** + * 判断是不是全选 + */ + + /** + * 全选 + */ + async onChangeCheckAll(event) { + const status = event.detail; + const res = await checkAllCart(status ? 1 : 0); + if (res.code === 200) { + this.setData({ + isCheckedAll: status, + }); + this.getCartList(); + } + }, + + /** + * 获取全选状态 + */ + getCheckAllStatus() { + this.setData({ isCheckedAll: true }); + this.data.list.map((item) => { + if (!item.isChecked) { + this.setData({ isCheckedAll: false }); + return; } - }, + }); }, }); diff --git a/pages/cart/cart.json b/pages/cart/cart.json index 8835af0699ccec004cbe685ef938cd2d63ea7037..9496b034b4a888d1e11a02720a2a668fcc94d135 100644 --- a/pages/cart/cart.json +++ b/pages/cart/cart.json @@ -1,3 +1,10 @@ { - "usingComponents": {} + "usingComponents": { + "van-swipe-cell": "@vant/weapp/swipe-cell/index", + "van-checkbox": "@vant/weapp/checkbox/index", + "van-stepper": "@vant/weapp/stepper/index", + "van-submit-bar": "@vant/weapp/submit-bar/index", + "van-button": "@vant/weapp/button/index", + "van-icon": "@vant/weapp/icon/index" + } } \ No newline at end of file diff --git a/pages/cart/cart.wxml b/pages/cart/cart.wxml index 932f9ee55bff7e3cb0387cb926f81b0b98f6cc9d..b7d5868f5bb2aece27b106ad987ac89056278c81 100644 --- a/pages/cart/cart.wxml +++ b/pages/cart/cart.wxml @@ -1,5 +1,65 @@ - - 购物车 + + + + + + + + + + + + {{item.name}} + + + ¥ + {{item.price}} + + + + + + + + + + + + + 全选 + + + + + 合计: + ¥{{totalPrice}} + + + + 去结算({{totalCount}}) + + + + - diff --git a/pages/cart/cart.wxss b/pages/cart/cart.wxss index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..5debbc887ecc230a61d8f83f6da22c7e07b736eb 100644 --- a/pages/cart/cart.wxss +++ b/pages/cart/cart.wxss @@ -0,0 +1,116 @@ +.goods-wrap { + height: 100vh; +} + +.flex { + display: flex; +} +.cart-wrap { + padding-top: 20px; + padding-bottom: 100px; + background-color: white; +} +.goods-item { + display: flex; + align-items: center; + padding: 0 32rpx 40rpx 0; +} + +.goods-item .left { + width: 56px; + display: flex; + align-items: center; + justify-content: center; +} + +.goods-item .mid { + width: 114px; + height: 125px; +} + +.mid image { + height: 100%; +} + +.goods-item .right { + height: 125px; + flex: 1; + display: flex; + flex-direction: column; + justify-content: space-between; + margin-left: 10px; +} + +.right .title { + flex: 1; + flex-shrink: 0; + font-size: 28rpx; + color: #333; + line-height: 40rpx; + font-weight: 400; + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + word-break: break-word; +} +.buy { + display: flex; + justify-content: space-between; +} + +.price { + display: flex; + /* align-items: flex-end; */ + color: #fa4126; + font-size: 36rpx; +} + +.buy-btn { + display: flex; + align-items: center; +} + +.buy-btn .del { + margin-right: 4px; +} + +.price .symbol { + font-size: 10px; + margin-right: 2px; + margin-top: 8px; +} + +.submit-footer { + position: fixed; + bottom: 56px; + left: 0; + width: 100%; + background-color: white; + padding: 12px 8px; + align-items: center; + justify-content: space-between; + z-index: 10; +} + +.submit-footer .left { + /* flex: 1; */ +} + +.submit-footer .right { + flex: 1; + margin-right: 16px; + align-items: center; + justify-content: flex-end; +} + +.total-wrapper { + color: #323233; + font-size: 13px; +} + +.total-wrapper .total-price { + color: #ee0a24; + font-weight: 500; + font-size: 20px; + margin: 0 4px; +} diff --git a/pages/category/category.js b/pages/category/category.js index f83348aa4b6127da0cebee863e95c0fb378fe494..954635d8a8015e52f53d802095d30c9461f8e928 100644 --- a/pages/category/category.js +++ b/pages/category/category.js @@ -1,11 +1,36 @@ -Component({ - pageLifetimes: { - show() { - if (typeof this.getTabBar === 'function' && this.getTabBar()) { - this.getTabBar().setData({ - selected: 1, - }); - } - }, +import { findCategoryTree } from '../../utils/api'; +Page({ + data: { + list: [], + }, + + onShow() { + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + this.getTabBar().setData({ + selected: 1, + }); + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getCategoryTree(); + }, + + /** + * 分类层级 + */ + async getCategoryTree() { + const res = await findCategoryTree(); + this.setData({ + list: res.data, + }); + }, + onChange() { + wx.navigateTo({ + url: '/pages/goods/list/index', + }); }, }); diff --git a/pages/category/category.json b/pages/category/category.json index 8835af0699ccec004cbe685ef938cd2d63ea7037..99971194c052f0826ecc8ed1d7e983b5f00eab81 100644 --- a/pages/category/category.json +++ b/pages/category/category.json @@ -1,3 +1,6 @@ { - "usingComponents": {} + "navigationBarTitleText": "分类", + "usingComponents": { + "goods-category": "./components/goods-category/index" + } } \ No newline at end of file diff --git a/pages/category/category.wxml b/pages/category/category.wxml index 2a4fdbb7dbab70bdd2789692b3c0bf508d5599c0..5a7e02bbba9112f08a37d68510222011b3ad3c71 100644 --- a/pages/category/category.wxml +++ b/pages/category/category.wxml @@ -1,4 +1,7 @@ - - 分类 + + diff --git a/pages/category/category.wxss b/pages/category/category.wxss index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a78b7db05fc7bd20cf4ca6aa5aad097c4b86e9ba 100644 --- a/pages/category/category.wxss +++ b/pages/category/category.wxss @@ -0,0 +1,9 @@ +.wrap { + height: 100vh; + overflow: hidden; +} + +.goods-category { + background-color: #f6f6f6 !important; + height: 100%; +} diff --git a/pages/category/components/goods-category/index.js b/pages/category/components/goods-category/index.js new file mode 100644 index 0000000000000000000000000000000000000000..0addcfff7c9bd3539699ce71b585d4ce556398b8 --- /dev/null +++ b/pages/category/components/goods-category/index.js @@ -0,0 +1,21 @@ +Component({ + properties: { + category: { + type: Array, + value: [], + }, + }, + data: { + activeKey: 0, + defaultImg: + 'https://img02.hua.com/m/category/Classification/m_category_flowers_use_1-2Girlfriend.png', + }, + methods: { + setActive(activeKey) { + this.setData({ activeKey }); + }, + onClick(e) { + this.setActive(e.currentTarget.dataset.index); + }, + }, +}); diff --git a/pages/category/components/goods-category/index.json b/pages/category/components/goods-category/index.json new file mode 100644 index 0000000000000000000000000000000000000000..e8cfaaf80c404eb97d3cf8b6277ec15f37e6905e --- /dev/null +++ b/pages/category/components/goods-category/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/category/components/goods-category/index.wxml b/pages/category/components/goods-category/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..062286012d085ad5c157424d2e5fe6fb6b3ef875 --- /dev/null +++ b/pages/category/components/goods-category/index.wxml @@ -0,0 +1,29 @@ + + + + + + {{ item.name }} + + + + + + + + {{category[activeKey].name}} + + + + + + + {{item.name}} + + + + diff --git a/pages/category/components/goods-category/index.wxss b/pages/category/components/goods-category/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..f81e5c9630b372cb9ca2d46b970ff6e85ec3878d --- /dev/null +++ b/pages/category/components/goods-category/index.wxss @@ -0,0 +1,115 @@ +.goods-category { + display: flex; +} + +.c-sidebar { + background-color: #f5f5f5; + width: 180rpx; + height: 100vh; +} + +.c-sidebar-item-container { + background-color: white; +} + +.c-sidebar-item { + background-color: white; +} +.c-sidebar-item { + display: flex; + justify-content: center; + text-align: center; + background-color: #f5f5f5; + color: #222427; + padding: 20rpx 0; + font-size: 26rpx; +} + +.c-sidebar-item.active { + position: relative; + background: white; +} + +.c-sidebar-item.active::before { + content: ''; + position: absolute; + width: 6rpx; + height: 48rpx; + background-color: #fa4126; + left: 0; + top: 50%; + transform: translate(0, -50%); + border-radius: 64rpx; + border-top-left-radius: 35px; + border-top-right-radius: 35px; + border-bottom-right-radius: 35px; + border-bottom-left-radius: 35px; +} + +.c-sidebar-item__text { + width: 136rpx; + height: 36rpx; + padding: 8rpx 0; + line-height: 36rpx; + text-align: center; + font-size: 28rpx; + color: #666666; +} + +.c-sidebar-item.active .c-sidebar-item__text { + background-color: white; + border-radius: 36rpx; + color: #fa4126; +} + +.goods-category__right { + height: 100vh; + flex: auto; + position: relative; + overflow: scroll; + -webkit-overflow-scrolling: touch; + background-color: white; + padding: 28rpx 34rpx 0rpx 32rpx; +} + +.goods-category-normal-item-title { + font-size: 28rpx; + font-weight: 500; +} + +.goods-category-normal-item-container { + background-color: #fff; + border-radius: 8rpx; + padding-top: 28rpx; + margin-top: -24rpx; + margin-bottom: 30rpx; + display: flex; + flex-wrap: wrap; +} + +.category-card-item { + display: inline-block; + width: 33.33333333%; + padding: 0.57142857rem 0; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.category-card-item .img-bg { + width: 60px; + height: 60px; + background-color: aliceblue; + border-radius: 50%; +} +.img-bg image { + width: 100%; + height: 100%; +} + +.category-card-item .item-title { + font-size: 24rpx; + color: #666666; + margin-top: 20rpx; +} diff --git a/pages/goods/detail/index.js b/pages/goods/detail/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f89eed0d83c9400cf1eb3788a63a8b403da80aa5 --- /dev/null +++ b/pages/goods/detail/index.js @@ -0,0 +1,85 @@ +// pages/goods/detail/index.js +import { findGoodsDetail, addToCart } from '../../../utils/api'; +Page({ + /** + * 页面的初始数据 + */ + data: { + goods: {}, + show: false, + count: 1, + goodsId: '', + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ goodsId: options.goodsId }); + this.getGoodsDetail(options.goodsId); + }, + + /** + * 商品详情 + */ + async getGoodsDetail(goodsId) { + const res = await findGoodsDetail(goodsId); + this.setData({ + goods: res.data, + }); + }, + + /** + * 事件:加入购物车 + */ + async handleAddCart() { + const { goodsId, count } = this.data; + if (count > 0) { + const res = await addToCart({ + goodsId, + count, + }); + + console.log(res); + + if (res.code === 200) { + wx.showToast({ title: '添加成功' }); + this.setData({ + show: false, + }); + } + } + }, + + /** + * 事件 打开action-sheet + */ + onSHowSheet() { + this.setData({ + show: true, + }); + }, + + /** + * 事件,关闭action-sheet + */ + onClose() { + this.setData({ show: false, count: 1 }); + }, + + /** + * 事件:修改商品数量 + */ + onChangeGoodsCount(event) { + this.setData({ count: event.detail }); + }, + + /** + * 事件:立即购买 + */ + handeGotoBuy() { + wx.navigateTo({ + url: `/pages/order/detail/index?goodsId=${this.data.goodsId}`, + }); + }, +}); diff --git a/pages/goods/detail/index.json b/pages/goods/detail/index.json new file mode 100644 index 0000000000000000000000000000000000000000..c5dd391d3693a32b7f37ab0c71c5a29f5a459c5e --- /dev/null +++ b/pages/goods/detail/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "van-icon": "@vant/weapp/icon/index", + "van-action-sheet": "@vant/weapp/action-sheet/index", + "van-cell": "@vant/weapp/cell/index", + "van-cell-group": "@vant/weapp/cell-group/index", + "van-stepper": "@vant/weapp/stepper/index", + "van-button": "@vant/weapp/button/index" + } +} \ No newline at end of file diff --git a/pages/goods/detail/index.wxml b/pages/goods/detail/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..f337b3f5b866f5305cce4232cdc8428142726bd9 --- /dev/null +++ b/pages/goods/detail/index.wxml @@ -0,0 +1,70 @@ + + + + + + ¥{{goods.price}} + ¥{{goods.marketPrice}} + + + {{goods.name}} + {{goods.floralLanguage}} + + + + + + + + + + + 首页 + + + + + + 购物车 + + + + + + 加入购物车 + 立即购买 + + + + + + + + + + + + + + {{goods.name}} + + + + ¥ + {{goods.price}} + + + + + + + + + + 确定 + + + + diff --git a/pages/goods/detail/index.wxss b/pages/goods/detail/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..3ad883b10109e956411a407fac49cfdade3297a1 --- /dev/null +++ b/pages/goods/detail/index.wxss @@ -0,0 +1,182 @@ +/* pages/goods/detail/index.wxss */ +.goods-detail { + height: 100%; +} + +.banner-img { + width: 100%; + height: 245px; +} +.banner-img .img { + width: 100%; +} + +.content { + margin: 0 20px; + background: white; + padding: 20px; + position: relative; + border-radius: 20px; + top: -40px; +} + +.price { + display: flex; +} + +.price .price-num { + font-size: 18px; + color: #fa4126; + font-weight: bold; +} + +.price .price-origin-num { + font-size: 12px; + color: #b4babf; + margin-left: 4px; + text-decoration: line-through; + margin-top: 6px; +} + +.title { + font-size: 18px; + font-weight: bold; +} + +.desc { + font-size: 12px; + color: #999999; +} + +.detail { + margin: -20px 20px 20px 20px; + background: white; + padding: 20px; + border-radius: 20px; +} + +.footer { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + background-color: #fff; + padding-bottom: env(safe-area-inset-bottom); +} +.flex { + display: flex; +} + +.flex-between { + justify-content: space-between; +} + +.footer-cont { + background-color: #fff; + padding: 16rpx; +} + +.bottom-operate-left { + width: 100%; + justify-content: space-around; +} +.icon-wrap { + flex-direction: column; + align-items: center; + justify-content: center; +} + +.icon-wrap text { + font-size: 10px; + color: #666; +} + +.bar-separately, +.bar-buy { + width: 254rpx; + height: 80rpx; + color: #fff; + display: flex; + align-items: center; + justify-content: center; +} + +.bar-separately { + background: #ffece9; + color: #fa4126; + border-radius: 40rpx 0 0 40rpx; +} + +.bar-buy { + background-color: #fa4126; + border-radius: 0rpx 40rpx 40rpx 0rpx; +} + +.sheet-wrapper { + padding: 16px; +} +.sheet-footer-btn { + padding: 16px; +} + +.goods-item { + display: flex; + align-items: center; + padding: 0 32rpx 40rpx 0; +} + +.goods-item .left { + width: 56px; + display: flex; + align-items: center; + justify-content: center; +} + +.goods-item .mid { + width: 114px; + height: 125px; +} + +.mid image { + height: 100%; +} + +.goods-item .right { + height: 125px; + flex: 1; + display: flex; + flex-direction: column; + justify-content: space-between; + margin-left: 10px; +} + +.right .title { + flex: 1; + flex-shrink: 0; + font-size: 28rpx; + color: #333; + line-height: 40rpx; + font-weight: 400; + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + word-break: break-word; +} + +.buy { + display: flex; + justify-content: space-between; +} + +.price { + display: flex; + /* align-items: flex-end; */ + color: #fa4126; + font-size: 36rpx; +} + +.price .symbol { + font-size: 10px; + margin-right: 2px; + margin-top: 8px; +} diff --git a/pages/goods/list/index.js b/pages/goods/list/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1d4b0e7f5e85c60deb45416f6db637abcf9744b3 --- /dev/null +++ b/pages/goods/list/index.js @@ -0,0 +1,90 @@ +// pages/goods/list/index.js +import { findGoodsList } from '../../../utils/api'; +const initFilters = { + overall: 1, + sorts: '', + layout: 0, +}; + +Page({ + /** + * 页面的初始数据 + */ + data: { + layout: 0, + sorts: '', + overall: 1, + show: false, + page: 1, + limit: 10, + list: [], + }, + + showFilterPopup() { + this.setData({ + show: true, + }); + }, + + showFilterPopupClose() { + this.setData({ + show: false, + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getGoodsList(); + }, + + /** + * 商品列表 + */ + async getGoodsList() { + const params = { + page: this.data.page, + limit: this.data.limit, + }; + const res = await findGoodsList(params); + this.setData({ + list: res.data.records, + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() {}, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/pages/goods/list/index.json b/pages/goods/list/index.json new file mode 100644 index 0000000000000000000000000000000000000000..2fe081419616a1c9520ffee95e365658cbb42222 --- /dev/null +++ b/pages/goods/list/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "filter": "/components/filter/index", + "goods-card": "/components/goods-card/index" + }, + "navigationBarTitleText": "商品列表" +} \ No newline at end of file diff --git a/pages/goods/list/index.wxml b/pages/goods/list/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..1e022035a44a8d28f744b69346f7525da4d1b8f8 --- /dev/null +++ b/pages/goods/list/index.wxml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pages/goods/list/index.wxss b/pages/goods/list/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..8a20ac909d8b7c173042b986ed8a38b794974e91 --- /dev/null +++ b/pages/goods/list/index.wxss @@ -0,0 +1,4 @@ +/* pages/goods/list/index.wxss */ +.goods-list { + margin-top: 12px; +} diff --git a/pages/index/components/goods-list/index.js b/pages/index/components/goods-list/index.js new file mode 100644 index 0000000000000000000000000000000000000000..703e8de79a6853b11001fa33ab4fdb1d3e4d8578 --- /dev/null +++ b/pages/index/components/goods-list/index.js @@ -0,0 +1,26 @@ +// components/goods-list/index.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + title: { + type: String, + value: '标题', + }, + list: { + type: Array, + value: [], + }, + }, + + /** + * 组件的初始数据 + */ + data: {}, + + /** + * 组件的方法列表 + */ + methods: {}, +}); diff --git a/pages/index/components/goods-list/index.json b/pages/index/components/goods-list/index.json new file mode 100644 index 0000000000000000000000000000000000000000..981de64b541773e0c110980c0c0e190bd0006465 --- /dev/null +++ b/pages/index/components/goods-list/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "goods-card": "/components/goods-card/index" + } +} \ No newline at end of file diff --git a/pages/index/components/goods-list/index.wxml b/pages/index/components/goods-list/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..d3996077e696527e27843d516eac02a68495db96 --- /dev/null +++ b/pages/index/components/goods-list/index.wxml @@ -0,0 +1,11 @@ + + + + {{title}} + + + + + 查看更多 + + \ No newline at end of file diff --git a/pages/index/components/goods-list/index.wxss b/pages/index/components/goods-list/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..48375c78d66bee40d58bf9fe0be8f242edf9e94b --- /dev/null +++ b/pages/index/components/goods-list/index.wxss @@ -0,0 +1,34 @@ +/* components/goods-list/index.wxss */ +.product { + margin-top: 24px; + padding-bottom: 12px; +} + +.product-title { + font-size: 19px; + line-height: 26px; + text-align: center; + font-weight: bold; + padding: 0 12px; + color: #232628; +} + +.product-list { + padding: 7px; + margin-top: 12px; +} + +.product-more { + margin: 0 1.51933702%; +} +.product-more-btn { + display: block; + margin: 0 auto; + background: #ffffff; + border-radius: 20px; + height: 40px; + line-height: 40px; + text-align: center; + font-size: 14px; + color: rgba(35, 38, 40, 0.7); +} diff --git a/pages/index/components/procate/index.js b/pages/index/components/procate/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2baedeba32e50f65bfe2de7bd832062446964008 --- /dev/null +++ b/pages/index/components/procate/index.js @@ -0,0 +1,21 @@ +// pages/index/components/procate/index.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + category: { + type: Array, + value: [], + }, + }, + data: { + categoryList: [], + }, + pageLifetimes: { + // 组件所在页面的生命周期函数 + show: function () {}, + hide: function () {}, + resize: function () {}, + }, +}); diff --git a/pages/index/components/procate/index.json b/pages/index/components/procate/index.json new file mode 100644 index 0000000000000000000000000000000000000000..e8cfaaf80c404eb97d3cf8b6277ec15f37e6905e --- /dev/null +++ b/pages/index/components/procate/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/index/components/procate/index.wxml b/pages/index/components/procate/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..f35ffc5189728854eca7b333ebe11cef08f26a09 --- /dev/null +++ b/pages/index/components/procate/index.wxml @@ -0,0 +1,13 @@ + + + + + + {{item.name}} + + + \ No newline at end of file diff --git a/pages/index/components/procate/index.wxss b/pages/index/components/procate/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..e3dfb0caaf925ca58dc1dbc038c8e81f065d0133 --- /dev/null +++ b/pages/index/components/procate/index.wxss @@ -0,0 +1,46 @@ +/* pages/index/components/procate/index.wxss */ +.procate { + display: flex; + align-items: center; + flex-wrap: wrap; + margin: 0 14px; + padding: 10px 0; + border-radius: 8px; +} + +.procate-item { + flex: 1; + min-width: 20%; + max-width: 20%; +} + +.procate-nav { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; +} +.procate-img { + width: 44px; + height: 44px; +} + +.procate-nav text { + margin-top: 4px; + font-size: 12px; + font-weight: 600; +} + +.procate-item.small { + margin-top: 20px; +} +.procate-item.small .procate-img { + width: 19px; + height: 20px; +} + +.procate-item.small text { + font-weight: 400; +} diff --git a/pages/index/index.js b/pages/index/index.js index 99ab7af921f72c9ef3707837b3812dfdc9a03beb..827a679b46185a33b59a45cb9b290498839a2ccd 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,11 +1,102 @@ -Component({ - pageLifetimes: { - show() { - if (typeof this.getTabBar === 'function' && this.getTabBar()) { - this.getTabBar().setData({ - selected: 0, - }); +import { backgroundList, banner } from '../../modal/swiper'; +import { + findBanner, + findCategoryFirstLevel, + findListGoods, + findRecommendGoods, +} from '../../utils/api'; +Page({ + data: { + bannerList: backgroundList, + categoryList: [], + banner: banner, + loveList: [], + recommendList: [], + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getBannerList(); + this.getCategoryFirstLevel(); + this.getListGoods(); + this.getRecommendGoods(); + }, + + /** + * 获取轮播图 + */ + async getBannerList() { + const res = await findBanner(); + this.setData({ + bannerList: res.data, + }); + }, + + /** + * 获取一级分类 + */ + async getCategoryFirstLevel() { + this.categoryList = [1, 2, 3]; + const res = await findCategoryFirstLevel(); + const list = res.data.map((item, index) => { + // 分类前五个和后五个样式不一样,区别处理 + if (index > 4) { + item['small'] = true; } - }, + return item; + }); + + this.setData({ + categoryList: list, + }); + }, + + /** + * 获取猜你喜欢 + */ + async getListGoods() { + const res = await findListGoods(); + this.setData({ + loveList: res.data, + }); + }, + + /** + * 获取人气推荐 + */ + async getRecommendGoods() { + const res = await findRecommendGoods(); + console.log('recommendList', res); + this.setData({ + recommendList: res.data, + }); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + this.getTabBar().setData({ + selected: 0, + }); + } }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, }); diff --git a/pages/index/index.json b/pages/index/index.json index 8a09782c3182ed722a70659d766519412c3b12fc..f2a4ee6eb7ef9465a4799af4a79e120cf3b4e92e 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -1,6 +1,9 @@ { "usingComponents": { "van-button": "@vant/weapp/button/index", - "van-icon": "@vant/weapp/icon/index" - } + "van-icon": "@vant/weapp/icon/index", + "goods-list": "./components/goods-list/index", + "procate": "./components/procate/index" + }, + "navigationBarTitleText": "慕尚花坊" } \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 0fdc399e679e598e1f7c6b2d78549dc26b1e7c3e..cfd839e490d4ecb9d8b05cb510dc8b7b156c8c7a 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,8 +1,30 @@ - 首页 - 按钮 - - - + + + + + + + + + + + + + + + + + + + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3f475657393b742aa66c198c9116c0a7169bdbb8 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -0,0 +1,7 @@ +.festival-banner { + margin-top: 14px; +} + +.swiper-box { + margin-bottom: 12px; +} diff --git a/pages/info/info.wxml b/pages/info/info.wxml index 3e7476f140d005da0f8ded4104c114c294683cac..b210fa9921fab2b40b84fce3579856c9b195a955 100644 --- a/pages/info/info.wxml +++ b/pages/info/info.wxml @@ -35,10 +35,12 @@ 我的功能 - - - 地址管理 - + + + + 地址管理 + + 我的客服 @@ -69,6 +71,6 @@ 尚硅谷技术支持 - + diff --git a/pages/login/index.js b/pages/login/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ecb35756d81a8c0a37d20d958745317ec0d06000 --- /dev/null +++ b/pages/login/index.js @@ -0,0 +1,25 @@ +// pages/login/index.js +import { login } from '../../utils/api'; +Page({ + data: { + userInfo: {}, + hasUserInfo: false, + canIUseGetUserProfile: false, + }, + onLoad() {}, + getUserProfile(e) { + wx.login({ + success: (res) => { + console.log(res.code); + const { code } = res; + login(code).then((res) => { + wx.showToast({ + title: '登陆成功', + }); + wx.setStorageSync('token', res.data.token); + wx.switchTab({ url: '/pages/login/index' }); + }); + }, + }); + }, +}); diff --git a/pages/login/index.json b/pages/login/index.json new file mode 100644 index 0000000000000000000000000000000000000000..8835af0699ccec004cbe685ef938cd2d63ea7037 --- /dev/null +++ b/pages/login/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/login/index.wxml b/pages/login/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..cb2459aa2f64a356e247711ecd154761994baab0 --- /dev/null +++ b/pages/login/index.wxml @@ -0,0 +1,4 @@ + + + 获取头像昵称 + \ No newline at end of file diff --git a/pages/login/index.wxss b/pages/login/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..06818180a47c3c60ef18a22ec816a95b9fb68058 --- /dev/null +++ b/pages/login/index.wxss @@ -0,0 +1 @@ +/* pages/login/index.wxss */ \ No newline at end of file diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bbc615e9b58ba73869edc0739942c67d713ccd1a --- /dev/null +++ b/pages/order/detail/index.js @@ -0,0 +1,50 @@ +// pages/order/index.js +Page({ + /** + * 页面的初始数据 + */ + data: { + price: 0, + }, + + onChangePrice() {}, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) {}, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() {}, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/pages/order/detail/index.json b/pages/order/detail/index.json new file mode 100644 index 0000000000000000000000000000000000000000..c0521903bc83b4f070481913d431d13388dbf0d2 --- /dev/null +++ b/pages/order/detail/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "van-icon": "@vant/weapp/icon/index", + "van-stepper": "@vant/weapp/stepper/index", + "van-checkbox": "@vant/weapp/checkbox/index" + } +} \ No newline at end of file diff --git a/pages/order/detail/index.wxml b/pages/order/detail/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..2514ab8decf7d8540651ae8243e029a8ef5e1d96 --- /dev/null +++ b/pages/order/detail/index.wxml @@ -0,0 +1,72 @@ + + + + + + 添加收货地址 + + + + 甘肃省 甘南藏族自治州 碌曲县 + 松日鼎盛大厦0层0号 + + 测试 + 130839991443 + + + + + + + + + + 配送时间 + 请选择配送时间 + + + + 贺卡备注 +