├── .gitignore ├── app.js ├── app.json ├── app.wxss ├── component ├── count-down-list │ ├── count-down-list.js │ ├── count-down-list.json │ ├── count-down-list.wxml │ └── count-down-list.wxss ├── index-type-data │ ├── index-type-data.js │ ├── index-type-data.json │ ├── index-type-data.wxml │ └── index-type-data.wxss └── show-empty-data │ ├── show-empty-data.js │ ├── show-empty-data.json │ ├── show-empty-data.wxml │ └── show-empty-data.wxss ├── config └── api.js ├── image ├── mall开源情况.png ├── 分类.png ├── 我的.png ├── 订单管理.png ├── 购物车.png └── 首页.png ├── lib └── wxParse │ ├── html2json.js │ ├── htmlparser.js │ ├── showdown.js │ ├── wxDiscode.js │ ├── wxParse.js │ ├── wxParse.wxml │ └── wxParse.wxss ├── pages ├── auth │ ├── login │ │ ├── login.js │ │ ├── login.json │ │ ├── login.wxml │ │ └── login.wxss │ ├── mobile │ │ ├── mobile.js │ │ ├── mobile.json │ │ ├── mobile.wxml │ │ └── mobile.wxss │ ├── register │ │ ├── register.js │ │ ├── register.json │ │ ├── register.wxml │ │ └── register.wxss │ └── reset │ │ ├── reset.js │ │ ├── reset.json │ │ ├── reset.wxml │ │ └── reset.wxss ├── cart │ ├── cart.js │ ├── cart.json │ ├── cart.wxml │ └── cart.wxss ├── catalog │ ├── catalog.js │ ├── catalog.json │ ├── catalog.wxml │ └── catalog.wxss ├── category │ ├── category.js │ ├── category.json │ ├── category.wxml │ └── category.wxss ├── customer │ ├── add │ │ ├── add.js │ │ ├── add.json │ │ ├── add.wxml │ │ └── add.wxss │ ├── addwh │ │ ├── addwh.js │ │ ├── addwh.json │ │ ├── addwh.wxml │ │ └── addwh.wxss │ ├── auth │ │ ├── auth.js │ │ ├── auth.json │ │ ├── auth.wxml │ │ └── auth.wxss │ ├── cuslist │ │ ├── cuslist.js │ │ ├── cuslist.json │ │ ├── cuslist.wxml │ │ └── cuslist.wxss │ └── zcuslist │ │ ├── zcuslist.js │ │ ├── zcuslist.json │ │ ├── zcuslist.wxml │ │ └── zcuslist.wxss ├── goods │ ├── goods.js │ ├── goods.json │ ├── goods.wxml │ └── goods.wxss ├── index │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── logs │ ├── logs.js │ ├── logs.json │ ├── logs.wxml │ └── logs.wxss ├── pay │ ├── pay.js │ ├── pay.json │ ├── pay.wxml │ └── pay.wxss ├── payResult │ ├── payResult.js │ ├── payResult.json │ ├── payResult.wxml │ └── payResult.wxss ├── search │ ├── search.js │ ├── search.json │ ├── search.wxml │ └── search.wxss ├── shopping │ ├── checkout │ │ ├── checkout.js │ │ ├── checkout.json │ │ ├── checkout.wxml │ │ └── checkout.wxss │ └── selCoupon │ │ ├── selCoupon.js │ │ ├── selCoupon.json │ │ ├── selCoupon.wxml │ │ └── selCoupon.wxss ├── spike │ ├── spike.js │ ├── spike.json │ ├── spike.wxml │ └── spike.wxss └── ucenter │ ├── address │ ├── address.js │ ├── address.json │ ├── address.wxml │ └── address.wxss │ ├── addressAdd │ ├── addressAdd.js │ ├── addressAdd.json │ ├── addressAdd.wxml │ └── addressAdd.wxss │ ├── feedback │ ├── feedback.js │ ├── feedback.json │ ├── feedback.wxml │ └── feedback.wxss │ ├── index │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss │ ├── order │ ├── order.js │ ├── order.json │ ├── order.wxml │ └── order.wxss │ ├── orderDetail │ ├── orderDetail.js │ ├── orderDetail.json │ ├── orderDetail.wxml │ └── orderDetail.wxss │ └── return │ ├── return.js │ ├── return.json │ ├── return.wxml │ └── return.wxss ├── project.config.json ├── readme.md ├── services ├── pay.js └── user.js ├── sitemap.json ├── static └── images │ ├── Group@2x.png │ ├── address-bg-bd.png │ ├── address_right.png │ ├── allorder.png │ ├── checkbox.png │ ├── clear_input.png │ ├── coupon_bky.png │ ├── coupon_gq.png │ ├── coupon_ksy.png │ ├── coupon_ysy.png │ ├── cus_ywh.png │ ├── del-address.png │ ├── detail_back.png │ ├── detail_kefu.png │ ├── go.png │ ├── ic_menu_choice_nor.png │ ├── ic_menu_choice_pressed.png │ ├── ic_menu_me_nor.png │ ├── ic_menu_me_pressed.png │ ├── ic_menu_shoping_nor.png │ ├── ic_menu_shoping_pressed.png │ ├── ic_menu_sort_nor.png │ ├── ic_menu_sort_pressed.png │ ├── ic_menu_topic_nor.png │ ├── ic_menu_topic_pressed.png │ ├── icon_add.png │ ├── icon_collect.png │ ├── icon_collect_checked.png │ ├── icon_cus.png │ ├── icon_error.png │ ├── icon_go_more.png │ ├── icon_home.png │ ├── icon_ipone.png │ ├── icon_jl.png │ ├── icon_rz.png │ ├── icon_wx.png │ ├── icon_xz.png │ ├── icon_zkh.png │ ├── logo40.png │ ├── my_course_empty.png │ ├── selnum.png │ ├── tu1@2x.png │ ├── tu2@2x.png │ ├── wxpay.png │ └── xsmune.png └── utils └── util.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var util = require('./utils/util.js'); 2 | var api = require('./config/api.js'); 3 | var user = require('./services/user.js'); 4 | 5 | App({ 6 | onLaunch: function (options) { 7 | // if (options.scene!="1008"){ 8 | // wx.removeStorageSync('userId'); 9 | // } 10 | //获取用户的登录信息 11 | user.checkLogin().then(res => { 12 | console.log('app login') 13 | this.globalData.userInfo = wx.getStorageSync('userInfo'); 14 | this.globalData.token = wx.getStorageSync('token'); 15 | }).catch(() => { 16 | wx.removeStorageSync('userInfo'); 17 | wx.removeStorageSync('token'); 18 | }); 19 | console.log("全局onLaunch options==" + JSON.stringify(options)) 20 | let q = decodeURIComponent(options.query.q) 21 | if (q) { 22 | this.globalData.goodId = util.getQueryString(q, 'id'); 23 | this.globalData.userId = util.getQueryString(q, 'userId'); 24 | console.log("全局onLaunch onload goodId=" + this.globalData.goodId) 25 | console.log("全局onLaunch onload userId=" + this.globalData.userId) 26 | } 27 | 28 | }, 29 | 30 | globalData: { 31 | userInfo: { 32 | nickName: 'Hi,游客', 33 | userName: '点击登录', 34 | avatarUrl: 'https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/150547696d798c.png' 35 | }, 36 | goodId:0, 37 | userId:0, 38 | token: '', 39 | userCoupon: 'NO_USE_COUPON',//默认不适用优惠券 40 | courseCouponCode: {},//购买课程的时候优惠券信息 41 | } 42 | }) -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index", 4 | "pages/catalog/catalog", 5 | "pages/ucenter/address/address", 6 | "pages/ucenter/addressAdd/addressAdd", 7 | "pages/ucenter/order/order", 8 | "pages/ucenter/return/return", 9 | "pages/ucenter/orderDetail/orderDetail", 10 | "pages/ucenter/feedback/feedback", 11 | "pages/auth/login/login", 12 | "pages/auth/register/register", 13 | "pages/auth/reset/reset", 14 | "pages/pay/pay", 15 | "pages/payResult/payResult", 16 | "pages/ucenter/index/index", 17 | "pages/search/search", 18 | "pages/category/category", 19 | "pages/cart/cart", 20 | "pages/shopping/checkout/checkout", 21 | "pages/goods/goods", 22 | "pages/auth/mobile/mobile", 23 | "pages/shopping/selCoupon/selCoupon", 24 | "pages/customer/auth/auth", 25 | "pages/customer/zcuslist/zcuslist", 26 | "pages/spike/spike" 27 | ], 28 | "window": { 29 | "backgroundTextStyle": "dark", 30 | "navigationBarBackgroundColor": "#fff", 31 | "navigationBarTitleText": "TPshop", 32 | "navigationBarTitleText": "TP商城", 33 | "navigationBarTextStyle": "black", 34 | "enablePullDownRefresh": true 35 | }, 36 | "tabBar": { 37 | "backgroundColor": "#fafafa", 38 | "borderStyle": "white", 39 | "selectedColor": "#b4282d", 40 | "color": "#666", 41 | "list": [ 42 | { 43 | "pagePath": "pages/index/index", 44 | "iconPath": "static/images/ic_menu_choice_nor.png", 45 | "selectedIconPath": "static/images/ic_menu_choice_pressed.png", 46 | "text": "首页" 47 | }, 48 | { 49 | "pagePath": "pages/catalog/catalog", 50 | "iconPath": "static/images/ic_menu_sort_nor.png", 51 | "selectedIconPath": "static/images/ic_menu_sort_pressed.png", 52 | "text": "分类" 53 | }, 54 | 55 | 56 | 57 | 58 | 59 | { 60 | "pagePath": "pages/cart/cart", 61 | "iconPath": "static/images/ic_menu_shoping_nor.png", 62 | "selectedIconPath": "static/images/ic_menu_shoping_pressed.png", 63 | "text": "购物车" 64 | }, 65 | { 66 | "pagePath": "pages/ucenter/index/index", 67 | "iconPath": "static/images/ic_menu_me_nor.png", 68 | "selectedIconPath": "static/images/ic_menu_me_pressed.png", 69 | "text": "我的" 70 | } 71 | ] 72 | }, 73 | "networkTimeout": { 74 | "request": 10000, 75 | "downloadFile": 10000 76 | }, 77 | "debug": true, 78 | "sitemapLocation": "sitemap.json" 79 | } -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | box-sizing: border-box; 4 | background-color: #f4f4f4; 5 | font-family: PingFangSC-Light,helvetica,'Heiti SC'; 6 | } 7 | 8 | ::-webkit-scrollbar{ 9 | display: none; 10 | } 11 | 12 | view,image,text,navigator{ 13 | box-sizing: border-box; 14 | padding:0; 15 | margin:0; 16 | 17 | } 18 | 19 | view,text{ 20 | font-family: PingFangSC-Light,helvetica,'Heiti SC'; 21 | font-size: 29rpx; 22 | color: #333; 23 | } 24 | 25 | button::after { 26 | display: none; 27 | } 28 | 29 | .display-none { 30 | display: none !important; 31 | } 32 | ::-webkit-scrollbar { 33 | width: 5px; 34 | background-color: #f5f5f5; 35 | } 36 | 37 | ::-webkit-scrollbar-thumb { 38 | background-color: #999; 39 | } 40 | 41 | .empty-view{ 42 | margin-top: 50%; 43 | height: 100%; 44 | width: 100%; 45 | display: flex; 46 | flex-direction: column; 47 | align-items: center; 48 | justify-content: center; 49 | } 50 | 51 | .empty-view .icon{ 52 | height: 120rpx; 53 | width: 120rpx; 54 | margin-bottom: 10rpx; 55 | } 56 | 57 | .empty-view .text{ 58 | width: auto; 59 | font-size: 28rpx; 60 | line-height: 35rpx; 61 | color: #999; 62 | } 63 | -------------------------------------------------------------------------------- /component/count-down-list/count-down-list.js: -------------------------------------------------------------------------------- 1 | // component/count-down-list/count-down-list.js 2 | Component({ 3 | /** 4 | * 组件的属性列表 5 | */ 6 | properties: { 7 | endTime:{ 8 | type: Number, 9 | value: 0, 10 | observer: function(){ 11 | this.countDown() 12 | } 13 | }, 14 | ntype: { 15 | type: Number, 16 | value: 0 17 | } 18 | }, 19 | 20 | /** 21 | * 组件的初始数据 22 | */ 23 | data: { 24 | model:{ 25 | day:'00', 26 | hou: '00', 27 | min: '00', 28 | sec: '00' 29 | }, 30 | timedown:null 31 | }, 32 | ready(){ 33 | // this.countDown() 34 | }, 35 | /** 36 | * 组件的方法列表 37 | */ 38 | methods: { 39 | timeFormat(param) {//小于10的格式化函数 40 | return param < 10 ? '0' + param : param; 41 | }, 42 | countDown() {//倒计时函数 43 | // 获取当前时间,同时得到活动结束时间数组 44 | let newTime = new Date().getTime(); 45 | // 对结束时间进行处理渲染到页面 46 | let endTime = this.properties.endTime; 47 | let obj = null; 48 | // 如果活动未结束,对时间进行处理 49 | if (endTime - newTime > 0) { 50 | let time =(endTime - newTime) / 1000; 51 | // 获取天、时、分、秒 52 | let day = parseInt(time / (60 * 60 * 24)); 53 | let hou = parseInt(time % (60 * 60 * 24) / 3600); 54 | let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); 55 | let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); 56 | obj = { 57 | day: this.timeFormat(day), 58 | hou: this.timeFormat(hou), 59 | min: this.timeFormat(min), 60 | sec: this.timeFormat(sec) 61 | } 62 | } else {//活动已结束,全部设置为'00' 63 | obj = { 64 | day: '00', 65 | hou: '00', 66 | min: '00', 67 | sec: '00' 68 | } 69 | clearTimeout(this.data.timedown) 70 | var e = { 71 | success: true 72 | } 73 | this.triggerEvent('downEnd', e, ''); 74 | return false; 75 | } 76 | // 渲染,然后每隔一秒执行一次倒计时函数 77 | this.setData({ model: obj }) 78 | this.data.timedown = setTimeout(this.countDown.bind(this), 1000); 79 | } 80 | } 81 | }) 82 | -------------------------------------------------------------------------------- /component/count-down-list/count-down-list.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /component/count-down-list/count-down-list.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 剩余 4 | 5 | {{model.hou}} : 6 | {{model.min}} : 7 | {{model.sec}} 8 | 9 | 10 | 11 | 12 | 13 | 14 | {{model.hou}} : 15 | {{model.min}} : 16 | {{model.sec}} 17 | 18 | 19 | 20 | 21 | 剩余 22 | 23 | {{model.hou}} : 24 | {{model.min}} : 25 | {{model.sec}} 26 | 27 | -------------------------------------------------------------------------------- /component/count-down-list/count-down-list.wxss: -------------------------------------------------------------------------------- 1 | /* component/count-down-list/count-down-list.wxss */ 2 | .tui-conutdown-box{ 3 | display: inline-block; 4 | font-size: 13px; 5 | } 6 | .tui-countdown-content_n{ 7 | width: 200rpx; 8 | display: flex; 9 | flex-direction: column; 10 | justify-content: center; 11 | align-items:flex-end; 12 | } 13 | .tui-countdown-content_n label{ 14 | width: 100%; 15 | text-align: center; 16 | margin-bottom: 6rpx; 17 | } 18 | .tui-countdown-content_n .timebox{ 19 | width: 100%; 20 | margin: 0 auto; 21 | display: flex; 22 | flex-flow: row nowrap; 23 | justify-content: center; 24 | } 25 | .tui-conutdown-box_n{ 26 | display: inline-block; 27 | font-size: 10px; 28 | height: 40rpx; 29 | line-height: 40rpx; 30 | width: 40rpx; 31 | background: #000; 32 | color: #fff; 33 | text-align: center; 34 | border-radius: 10rpx; 35 | } 36 | .tui-conutdown-box_nn{ 37 | display: inline-block; 38 | font-size: 15px; 39 | } 40 | -------------------------------------------------------------------------------- /component/index-type-data/index-type-data.js: -------------------------------------------------------------------------------- 1 | // component/index-type-data/index-type-data.js 2 | Component({ 3 | /** 4 | * 组件的属性列表 5 | */ 6 | properties: { 7 | name: String, 8 | type:Number, 9 | data: Array, 10 | }, 11 | 12 | /** 13 | * 组件的初始数据 14 | */ 15 | data: { 16 | 17 | }, 18 | 19 | /** 20 | * 组件的方法列表 21 | */ 22 | methods: { 23 | 24 | /** 25 | * 团转到首页 26 | */ 27 | gotoDetail: function (e) { 28 | var id = e.currentTarget.dataset.id 29 | wx.navigateTo({ 30 | url: '../../pages/goods/goods?id=' + id + '&type=' + this.properties.type 31 | }) 32 | } 33 | 34 | } 35 | }) 36 | -------------------------------------------------------------------------------- /component/index-type-data/index-type-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /component/index-type-data/index-type-data.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{name}} 6 | {{name}}购更实惠 7 | 8 | 更多 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | ¥{{type==1?item.group_price:item.retail_price}} 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /component/index-type-data/index-type-data.wxss: -------------------------------------------------------------------------------- 1 | /* component/show-index-data/show-index-data.wxss */ 2 | .recom-section{ 3 | width: 100%; 4 | background: #FFFFFF; 5 | } 6 | .recom-section .cont{ 7 | width: 94%; 8 | margin: 0 auto; 9 | } 10 | .recom-section .h{ 11 | flex: 1; 12 | height: 100rpx; 13 | display: flex; 14 | flex-flow: row nowrap; 15 | justify-content: space-between; 16 | align-items: center; 17 | } 18 | .recom-section .h .title{ 19 | color: #1A1A1A; 20 | font-size: 16px; 21 | margin-left: 20rpx; 22 | } 23 | .recom-section .h .title .desc{ 24 | color: #aaaaaa; 25 | font-size: 22rpx; 26 | margin-left: 20rpx; 27 | } 28 | .recom-section .h .more{ 29 | width: 100rpx; 30 | height: 50rpx; 31 | line-height: 50rpx; 32 | border: 1px solid #1A1A1A; 33 | color: #1A1A1A; 34 | font-size: 26rpx; 35 | border-radius: 30rpx; 36 | text-align: center; 37 | margin-right: 20rpx; 38 | } 39 | .recom-section .b{ 40 | flex: 1; 41 | display: flex; 42 | flex-flow: row nowrap; 43 | justify-content: space-between; 44 | align-items: center; 45 | } 46 | .pro-box{ 47 | width: 710rpx; 48 | display: flex; 49 | flex-flow: row nowrap; 50 | justify-content: flex-start; 51 | align-items: center; 52 | } 53 | .pro-box .li{ 54 | width: 223.3rpx; 55 | height: 303rpx; 56 | margin-left: 20rpx; 57 | display: flex; 58 | flex-direction: column; 59 | justify-content: flex-start; 60 | position: relative; 61 | } 62 | .pro-box .li .flotel{ 63 | width: 223.3rpx; 64 | height: 30rpx; 65 | position: absolute; 66 | top: 0; 67 | left: 0; 68 | } 69 | .pro-box .li .flotel .bqel{ 70 | height: 100%; 71 | width: 223.3rpx; 72 | display: flex; 73 | flex-flow: row nowrap; 74 | justify-content: center; 75 | align-items: center; 76 | } 77 | .lael{ 78 | width: 60rpx; 79 | height: 100%; 80 | text-align: center; 81 | border-bottom-left-radius: 10rpx; 82 | border-bottom-right-radius: 10rpx; 83 | background: #36b5fa; 84 | color: #fff; 85 | font-size: 10px; 86 | margin-left: 10rpx; 87 | } 88 | .lael:nth-child(1){ 89 | margin-left: 0; 90 | } 91 | .pro-box .li:nth-child(1){ 92 | margin-left: 0; 93 | } 94 | .pro-box .li .prourl{ 95 | width: 223.3rpx; 96 | height: 223.3rpx; 97 | background: #CCCCCC; 98 | } 99 | .pro-box .li .pricebox{ 100 | width: 223.3rpx; 101 | height: 80rpx; 102 | display: flex; 103 | flex-flow: row nowrap; 104 | justify-content: center; 105 | align-items: center; 106 | } 107 | .pro-box .li .pricebox .pprice{ 108 | margin-left: 20rpx; 109 | height: 40rpx; 110 | line-height: 40rpx; 111 | width: 80rpx; 112 | background: #fc5a67; 113 | color: #FFFFFF; 114 | font-size: 12px; 115 | border-bottom-left-radius: 20rpx; 116 | border-bottom-right-radius: 20rpx; 117 | border-top-right-radius: 20rpx; 118 | text-align: center; 119 | } -------------------------------------------------------------------------------- /component/show-empty-data/show-empty-data.js: -------------------------------------------------------------------------------- 1 | // component/show-empty-data/show-empty-data.js 2 | Component({ 3 | /** 4 | * 组件的属性列表 5 | */ 6 | properties: { 7 | showType: { 8 | type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型) 9 | value: '', // 属性初始值(可选),如果未指定则会根据类型选择一个 10 | observer: '_courseChange' 11 | }, 12 | }, 13 | 14 | /** 15 | * 组件的初始数据 16 | */ 17 | data: { 18 | 19 | }, 20 | 21 | /** 22 | * 组件的方法列表 23 | */ 24 | methods: { 25 | 26 | /** 27 | * 团转到首页 28 | */ 29 | gotoHome: function (event) { 30 | wx.reLaunch({ 31 | url: '../index/index' 32 | }) 33 | } 34 | 35 | } 36 | }) 37 | -------------------------------------------------------------------------------- /component/show-empty-data/show-empty-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /component/show-empty-data/show-empty-data.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 您还没有优惠券~ 6 | 7 | -------------------------------------------------------------------------------- /component/show-empty-data/show-empty-data.wxss: -------------------------------------------------------------------------------- 1 | /* component/show-empty-data/show-empty-data.wxss */ 2 | 3 | .no-course { 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | width: 100%; 8 | height: 100%; 9 | } 10 | 11 | .no-course .img { 12 | margin-top: 116rpx; 13 | width: 597rpx; 14 | height: 467rpx; 15 | margin-bottom: 60rpx; 16 | } 17 | 18 | .no-course .desc{ 19 | font-size: 30rpx; 20 | line-height: 40rpx; 21 | color: #333; 22 | font-weight: bold; 23 | } 24 | 25 | .no-course .btn { 26 | display: flex; 27 | background-color: #fff; 28 | border: 1rpx solid #d2d2d2; 29 | font-size: 28rpx; 30 | border-radius: 30rpx; 31 | width: 200rpx; 32 | height: 60rpx; 33 | justify-content: center; 34 | align-items: center; 35 | color: #333; 36 | margin-top: 20rpx; 37 | } 38 | -------------------------------------------------------------------------------- /config/api.js: -------------------------------------------------------------------------------- 1 | //var NewApiRootUrl = 'https://shop.51shop.ink/demo/api/'; 2 | var MallApiRootUrl = 'http://81.70.0.224:8085/'; 3 | //var MallApiRootUrl = 'http://127.0.0.1:8085/'; 4 | var SearchApiRootUrl = 'http://81.70.0.224:8081/'; 5 | module.exports = { 6 | //首页数据接口 7 | IndexUrlBanner: MallApiRootUrl + 'home/content', //首页轮播广告 8 | IndexUrlHotGoods: MallApiRootUrl + 'home/hotProductList', //首页人气商品列表 9 | GoodsCount: MallApiRootUrl + 'home/goodsCount', //统计商品总数 10 | 11 | //分类页数据接口 12 | CatalogList: MallApiRootUrl + 'product/categoryTreeList', //分类目录全部分类数据接口 13 | //CatalogCurrent: NewApiRootUrl + 'catalog/index', //分类目录全部分类数据接口 14 | GoodsCategory: MallApiRootUrl + 'product/search', //获得具体分类下的产品数据 15 | //GoodsCategory: NewApiRootUrl + 'goods/category', //获得具体分类数据 16 | 17 | //微信登录 18 | AuthLoginByWeixin: MallApiRootUrl + 'wx/login_by_weixin', //微信登录 19 | 20 | //商品信息详情页 21 | GoodsDetail: MallApiRootUrl + 'product/detail/', //获得商品的详情 22 | 23 | //GoodsDetail: NewApiRootUrl + 'goods/detail', //获得商品的详情 24 | //Login: NewApiRootUrl + 'auth/login', //账号登录 25 | //CouponList: MallApiRootUrl + '/member/coupon/list', // 获取用户优惠券列表 26 | //CouponList: NewApiRootUrl + 'coupon/list', // 优惠券列表 27 | //GoodsCouponList: MallApiRootUrl + '/member/coupon/listByProduct/', // 根据当前商品获取优惠券列表 28 | //GoodsCouponList: NewApiRootUrl + 'coupon/listByGoods', // 商品优惠券列表 29 | //TakeMerCoupon: MallApiRootUrl + '/member/coupon/add/',//用户主动领取指定优惠卷 30 | //TakeMerCoupon: NewApiRootUrl + 'coupon/getMerCoupon.do',//用户主动领取商户优惠卷 31 | //CouponListByMer: NewApiRootUrl +'coupon/listMer.do',//获取商户优惠劵列表 32 | //ValidCouponList: NewApiRootUrl + 'coupon/getValidCouponList.do',//选择优惠卷列表 33 | //GoodsRelated: NewApiRootUrl + 'goods/related', //商品详情页的关联商品(相关推荐) 34 | 35 | 36 | //BrandList: NewApiRootUrl + 'brand/list', //品牌列表 37 | //BrandDetail: NewApiRootUrl + 'brand/detail', //品牌详情 38 | 39 | //购物车页面相关 40 | CartList: MallApiRootUrl + 'cart/list', //获取购物车的数据 41 | CartAdd: MallApiRootUrl + 'cart/add', // 添加商品到购物车 42 | CartDelete: MallApiRootUrl + 'cart/delete', // 删除购物车的商品 43 | CartList: MallApiRootUrl + 'cart/list', //获取购物车列表的数据 44 | CartAdd: MallApiRootUrl + 'cart/add', // 添加商品到购物车 45 | CartDelete: MallApiRootUrl + 'cart/delete', // 删除购物车的商品 46 | CartUpdate: MallApiRootUrl + 'cart/update/attr', // 修改购物车中商品的规格 47 | CartUpdateQuantity: MallApiRootUrl + 'cart/update/quantity', //修改购物车中商品数量 48 | //BuyAdd: NewApiRootUrl + 'buy/add', // 直接购买 49 | 50 | //下单页面 51 | CartCheckout: MallApiRootUrl + 'order/generateConfirmOrder', // 根据购物车信息生成订单信息(下单) 52 | //BuyCheckout: NewApiRootUrl + 'buy/checkout', // 付款前信息确认 53 | OrderSubmit: MallApiRootUrl + 'order/generateOrder', // 提交订单 54 | //NewApiRootUrl + 'pay/prepay', //获取微信统一下单prepay_id 55 | 56 | //搜索页面相关 57 | SearchResult: SearchApiRootUrl + 'esProduct/search/simple', //搜索结果 58 | GoodsList: MallApiRootUrl + 'home/newProductList', //获得商品列表 59 | //GoodsList: NewApiRootUrl + 'goods/list', //获得商品列表 60 | //SearchResult: NewApiRootUrl + 'search/result', //搜索数据 61 | 62 | //地址管理相关接口 63 | AddressList: MallApiRootUrl + 'member/address/list', //收货地址列表 64 | AddressDetail: MallApiRootUrl + 'member/address/', //收货地址详情 65 | AddressSave: MallApiRootUrl + 'member/address/add', //保存收货地址 66 | AddressDelete: MallApiRootUrl + 'member/address/delete/', //保存收货地址 67 | AddressUpdate: MallApiRootUrl + 'member/address/update/', // 更新地址 68 | 69 | //订单管理相关页面 70 | OrderList: MallApiRootUrl + 'order/list', //订单列表 71 | //OrderList: NewApiRootUrl + 'order/list', //订单列表 72 | OrderDetail: MallApiRootUrl + 'order/detail/', //根据id获取订单详情 73 | //OrderDetail: NewApiRootUrl + 'order/detail', //订单详情 74 | OrderCancel: MallApiRootUrl + 'order/cancelUserOrder', //用户取消订单 75 | //OrderCancel: NewApiRootUrl + 'order/cancelOrder', //取消订单 76 | OrderConfirm: MallApiRootUrl + 'order/confirmReceiveOrder', //用户确认收货 77 | //OrderConfirm: NewApiRootUrl + 'order/confirmOrder', //确认收货 78 | 79 | //意见反馈 80 | FeedbackAdd: MallApiRootUrl + 'feedback/add', //添加反馈 81 | 82 | //注册账户相关 83 | /* SmsCode: NewApiRootUrl + 'sendRegisterCode', //发送短信 84 | BindMobile: NewApiRootUrl + 'inviteReg', //fx注册 85 | //Login: NewApiRootUrl + 'auth/login', //账号登录 86 | //Register: NewApiRootUrl + 'auth/register', //注册*/ 87 | 88 | //订单支付 89 | //OrderQuery: NewApiRootUrl + 'pay/query', //确认支付 90 | //OrderSuccess: NewApiRootUrl + 'order/updateSuccess', //支付成功 91 | 92 | /* WhSave: NewApiRootUrl + 'upkeep/save.do', //维护历史保存 93 | WhUpdate: NewApiRootUrl + 'upkeep/update.do', //维护历史修改 94 | QueryObject: NewApiRootUrl + 'upkeep/queryObject.do', // 95 | BirthdayList: NewApiRootUrl + 'user/getBirthdayList', //生日列表 96 | Holiday: NewApiRootUrl + 'user/getHoliday', //节假日提醒 97 | CreateCode: NewApiRootUrl + 'auth/createCode', 98 | UserInfoById: NewApiRootUrl + 'user/getUserInfoById.do', //获取实名认证信息 99 | UpkeepUpdate: NewApiRootUrl + 'upkeep/update.do', //编辑维护历史 100 | SetFid: NewApiRootUrl + 'mlsuser/setFid', //mlsuser/setFid*/ 101 | } -------------------------------------------------------------------------------- /image/mall开源情况.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/image/mall开源情况.png -------------------------------------------------------------------------------- /image/分类.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/image/分类.png -------------------------------------------------------------------------------- /image/我的.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/image/我的.png -------------------------------------------------------------------------------- /image/订单管理.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/image/订单管理.png -------------------------------------------------------------------------------- /image/购物车.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/image/购物车.png -------------------------------------------------------------------------------- /image/首页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/image/首页.png -------------------------------------------------------------------------------- /lib/wxParse/wxParse.js: -------------------------------------------------------------------------------- 1 | /** 2 | * author: Di (微信小程序开发工程师) 3 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) 4 | * 垂直微信小程序开发交流社区 5 | * 6 | * github地址: https://github.com/icindy/wxParse 7 | * 8 | * for: 微信小程序富文本解析 9 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 10 | */ 11 | 12 | /** 13 | * utils函数引入 14 | **/ 15 | import showdown from 'showdown.js'; 16 | import HtmlToJson from 'html2json.js'; 17 | /** 18 | * 配置及公有属性 19 | **/ 20 | /** 21 | * 主函数入口区 22 | **/ 23 | function wxParse(bindName = 'wxParseData', type='html', data='
数据不能为空
', target,imagePadding) { 24 | var that = target; 25 | var transData = {};//存放转化后的数据 26 | if (type == 'html') { 27 | transData = HtmlToJson.html2json(data, bindName); 28 | console.log(JSON.stringify(transData, ' ', ' ')); 29 | } else if (type == 'md' || type == 'markdown') { 30 | var converter = new showdown.Converter(); 31 | var html = converter.makeHtml(data); 32 | transData = HtmlToJson.html2json(html, bindName); 33 | console.log(JSON.stringify(transData, ' ', ' ')); 34 | } 35 | transData.view = {}; 36 | transData.view.imagePadding = 0; 37 | if(typeof(imagePadding) != 'undefined'){ 38 | transData.view.imagePadding = imagePadding 39 | } 40 | var bindData = {}; 41 | bindData[bindName] = transData; 42 | that.setData(bindData) 43 | that.wxParseImgLoad = wxParseImgLoad; 44 | that.wxParseImgTap = wxParseImgTap; 45 | } 46 | // 图片点击事件 47 | function wxParseImgTap(e) { 48 | var that = this; 49 | var nowImgUrl = e.target.dataset.src; 50 | var tagFrom = e.target.dataset.from; 51 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) { 52 | wx.previewImage({ 53 | current: nowImgUrl, // 当前显示图片的http链接 54 | urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表 55 | }) 56 | } 57 | } 58 | 59 | /** 60 | * 图片视觉宽高计算函数区 61 | **/ 62 | function wxParseImgLoad(e) { 63 | var that = this; 64 | var tagFrom = e.target.dataset.from; 65 | var idx = e.target.dataset.idx; 66 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) { 67 | calMoreImageInfo(e, idx, that, tagFrom) 68 | } 69 | } 70 | // 假循环获取计算图片视觉最佳宽高 71 | function calMoreImageInfo(e, idx, that, bindName) { 72 | var temData = that.data[bindName]; 73 | if (temData.images.length == 0) { 74 | return; 75 | } 76 | var temImages = temData.images; 77 | //因为无法获取view宽度 需要自定义padding进行计算,稍后处理 78 | var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName); 79 | temImages[idx].width = recal.imageWidth; 80 | temImages[idx].height = recal.imageheight; 81 | temData.images = temImages; 82 | var bindData = {}; 83 | bindData[bindName] = temData; 84 | that.setData(bindData); 85 | } 86 | 87 | // 计算视觉优先的图片宽高 88 | function wxAutoImageCal(originalWidth, originalHeight,that,bindName) { 89 | //获取图片的原始长宽 90 | var windowWidth = 0, windowHeight = 0; 91 | var autoWidth = 0, autoHeight = 0; 92 | var results = {}; 93 | wx.getSystemInfo({ 94 | success: function (res) { 95 | var padding = that.data[bindName].view.imagePadding; 96 | windowWidth = res.windowWidth-2*padding; 97 | windowHeight = res.windowHeight; 98 | //判断按照那种方式进行缩放 99 | if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候 100 | autoWidth = windowWidth; 101 | autoHeight = (autoWidth * originalHeight) / originalWidth; 102 | results.imageWidth = autoWidth; 103 | results.imageheight = autoHeight; 104 | } else {//否则展示原来的数据 105 | results.imageWidth = originalWidth; 106 | results.imageheight = originalHeight; 107 | } 108 | } 109 | }) 110 | return results; 111 | } 112 | 113 | function wxParseTemArray(temArrayName,bindNameReg,total,that){ 114 | var array = []; 115 | var temData = that.data; 116 | var obj = null; 117 | for(var i = 0; i < total; i++){ 118 | var simArr = temData[bindNameReg+i].nodes; 119 | array.push(simArr); 120 | } 121 | 122 | temArrayName = temArrayName || 'wxParseTemArray'; 123 | obj = JSON.parse('{"'+ temArrayName +'":""}'); 124 | obj[temArrayName] = array; 125 | that.setData(obj); 126 | } 127 | 128 | /** 129 | * 配置emojis 130 | * 131 | */ 132 | 133 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){ 134 | HtmlToJson.emojisInit(reg,baseSrc,emojis); 135 | } 136 | 137 | module.exports = { 138 | wxParse: wxParse, 139 | wxParseTemArray:wxParseTemArray, 140 | emojisInit:emojisInit 141 | } 142 | 143 | 144 | -------------------------------------------------------------------------------- /lib/wxParse/wxParse.wxss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * author: Di (微信小程序开发工程师) 4 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) 5 | * 垂直微信小程序开发交流社区 6 | * 7 | * github地址: https://github.com/icindy/wxParse 8 | * 9 | * for: 微信小程序富文本解析 10 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 11 | */ 12 | 13 | .wxParse{ 14 | margin: 0 5px; 15 | font-family: Helvetica,sans-serif; 16 | font-size: 28rpx; 17 | color: #666; 18 | line-height: 1.8; 19 | } 20 | view{ 21 | word-break:break-all; 22 | overflow:hidden; 23 | } 24 | 25 | .wxParse-inline{ 26 | display: inline; 27 | margin: 0; 28 | padding: 0; 29 | } 30 | /*//标题 */ 31 | .wxParse-div{margin: 0;padding: 0;} 32 | .wxParse-h1{ font-size:2em; margin: .67em 0 } 33 | .wxParse-h2{ font-size:1.5em; margin: .75em 0 } 34 | .wxParse-h3{ font-size:1.17em; margin: .83em 0 } 35 | .wxParse-h4{ margin: 1.12em 0} 36 | .wxParse-h5 { font-size:.83em; margin: 1.5em 0 } 37 | .wxParse-h6{ font-size:.75em; margin: 1.67em 0 } 38 | 39 | .wxParse-h1 { 40 | font-size: 18px; 41 | font-weight: 400; 42 | margin-bottom: .9em; 43 | } 44 | .wxParse-h2 { 45 | font-size: 16px; 46 | font-weight: 400; 47 | margin-bottom: .34em; 48 | } 49 | .wxParse-h3 { 50 | font-weight: 400; 51 | font-size: 15px; 52 | margin-bottom: .34em; 53 | } 54 | .wxParse-h4 { 55 | font-weight: 400; 56 | font-size: 14px; 57 | margin-bottom: .24em; 58 | } 59 | .wxParse-h5 { 60 | font-weight: 400; 61 | font-size: 13px; 62 | margin-bottom: .14em; 63 | } 64 | .wxParse-h6 { 65 | font-weight: 400; 66 | font-size: 12px; 67 | margin-bottom: .04em; 68 | } 69 | 70 | .wxParse-h1, .wxParse-h2, .wxParse-h3, .wxParse-h4, .wxParse-h5, .wxParse-h6, .wxParse-b, .wxParse-strong { font-weight: bolder } 71 | 72 | .wxParse-i,.wxParse-cite,.wxParse-em,.wxParse-var,.wxParse-address{font-style:italic} 73 | .wxParse-pre,.wxParse-tt,.wxParse-code,.wxParse-kbd,.wxParse-samp{font-family:monospace} 74 | .wxParse-pre{white-space:pre} 75 | .wxParse-big{font-size:1.17em} 76 | .wxParse-small,.wxParse-sub,.wxParse-sup{font-size:.83em} 77 | .wxParse-sub{vertical-align:sub} 78 | .wxParse-sup{vertical-align:super} 79 | .wxParse-s,.wxParse-strike,.wxParse-del{text-decoration:line-through} 80 | /*wxparse-自定义个性化的css样式*/ 81 | /*增加video的css样式*/ 82 | .wxParse-strong,wxParse-s{display: inline} 83 | .wxParse-a{ 84 | color: deepskyblue; 85 | word-break:break-all; 86 | overflow:auto; 87 | } 88 | 89 | .wxParse-video{ 90 | text-align: center; 91 | margin: 10px 0; 92 | } 93 | 94 | .wxParse-video-video{ 95 | width:100%; 96 | } 97 | 98 | .wxParse-img{ 99 | background-color: #efefef; 100 | overflow: hidden; 101 | width:40px; 102 | height: 40px; 103 | } 104 | 105 | .wxParse-blockquote { 106 | margin: 0; 107 | padding:10px 0 10px 5px; 108 | font-family:Courier, Calibri,"宋体"; 109 | background:#f5f5f5; 110 | border-left: 3px solid #dbdbdb; 111 | } 112 | 113 | .wxParse-code,.wxParse-wxxxcode-style{ 114 | display: inline; 115 | background:#f5f5f5; 116 | } 117 | .wxParse-ul{ 118 | margin: 20rpx 10rpx; 119 | } 120 | 121 | .wxParse-li,.wxParse-li-inner{ 122 | display: flex; 123 | align-items: baseline; 124 | margin: 10rpx 0; 125 | } 126 | .wxParse-li-text{ 127 | 128 | align-items: center; 129 | line-height: 20px; 130 | } 131 | 132 | .wxParse-li-circle{ 133 | display: inline-flex; 134 | width: 5px; 135 | height: 5px; 136 | background-color: #333; 137 | margin-right: 5px; 138 | } 139 | 140 | .wxParse-li-square{ 141 | display: inline-flex; 142 | width: 10rpx; 143 | height: 10rpx; 144 | background-color: #333; 145 | margin-right: 5px; 146 | } 147 | .wxParse-li-ring{ 148 | display: inline-flex; 149 | width: 10rpx; 150 | height: 10rpx; 151 | border: 2rpx solid #333; 152 | border-radius: 50%; 153 | background-color: #fff; 154 | margin-right: 5px; 155 | } 156 | 157 | /*.wxParse-table{ 158 | width: 100%; 159 | height: 400px; 160 | } 161 | .wxParse-thead,.wxParse-tfoot,.wxParse-tr{ 162 | display: flex; 163 | flex-direction: row; 164 | } 165 | .wxParse-th,.wxParse-td{ 166 | display: flex; 167 | width: 580px; 168 | overflow: auto; 169 | }*/ 170 | 171 | .wxParse-u { 172 | text-decoration: underline; 173 | } 174 | .wxParse-hide{ 175 | display: none; 176 | } 177 | .WxEmojiView{ 178 | align-items: center; 179 | } 180 | .wxEmoji{ 181 | width: 16px; 182 | height:16px; 183 | } 184 | .wxParse-tr{ 185 | display: flex; 186 | border-right:1px solid #e0e0e0; 187 | border-bottom:1px solid #e0e0e0; 188 | } 189 | .wxParse-th, 190 | .wxParse-td{ 191 | flex:1; 192 | padding:5px; 193 | font-size:28rpx; 194 | border-left:1px solid #e0e0e0; 195 | word-break: break-all; 196 | } 197 | .wxParse-td:last{ 198 | border-top:1px solid #e0e0e0; 199 | } 200 | .wxParse-th{ 201 | background:#f0f0f0; 202 | border-top:1px solid #e0e0e0; 203 | } 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /pages/auth/login/login.js: -------------------------------------------------------------------------------- 1 | var api = require('../../../config/api.js'); 2 | var app = getApp(); 3 | Page({ 4 | data: { 5 | username: '', 6 | password: '', 7 | code: '', 8 | loginErrorCount: 0 9 | }, 10 | onLoad: function (options) { 11 | // 页面初始化 options为页面跳转所带来的参数 12 | // 页面渲染完成 13 | 14 | }, 15 | onReady: function () { 16 | 17 | }, 18 | onShow: function () { 19 | // 页面显示 20 | }, 21 | onHide: function () { 22 | // 页面隐藏 23 | 24 | }, 25 | onUnload: function () { 26 | // 页面关闭 27 | 28 | }, 29 | startLogin: function () { 30 | var that = this; 31 | 32 | if (that.data.password.length < 1 || that.data.username.length < 1) { 33 | wx.showModal({ 34 | title: '错误信息', 35 | content: '请输入用户名和密码', 36 | showCancel: false 37 | }); 38 | return false; 39 | } 40 | 41 | wx.request({ 42 | url: api.Login, 43 | data: { 44 | username: that.data.username, 45 | password: that.data.password 46 | }, 47 | method: 'POST', 48 | header: { 49 | 'content-type': 'application/json' 50 | }, 51 | success: function (res) { 52 | if(res.data.code == 200){ 53 | that.setData({ 54 | 'loginErrorCount': 0 55 | }); 56 | wx.setStorage({ 57 | key:"token", 58 | data: res.data.data.token, 59 | success: function(){ 60 | wx.switchTab({ 61 | url: '/pages/ucenter/index/index' 62 | }); 63 | } 64 | }); 65 | } 66 | } 67 | }); 68 | }, 69 | bindUsernameInput: function (e) { 70 | 71 | this.setData({ 72 | username: e.detail.value 73 | }); 74 | }, 75 | bindPasswordInput: function (e) { 76 | 77 | this.setData({ 78 | password: e.detail.value 79 | }); 80 | }, 81 | bindCodeInput: function (e) { 82 | 83 | this.setData({ 84 | code: e.detail.value 85 | }); 86 | }, 87 | clearInput: function (e) { 88 | switch (e.currentTarget.id) { 89 | case 'clear-username': 90 | this.setData({ 91 | username: '' 92 | }); 93 | break; 94 | case 'clear-password': 95 | this.setData({ 96 | password: '' 97 | }); 98 | break; 99 | case 'clear-code': 100 | this.setData({ 101 | code: '' 102 | }); 103 | break; 104 | } 105 | } 106 | }) -------------------------------------------------------------------------------- /pages/auth/login/login.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/auth/login/login.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 注册账号 26 | 忘记密码 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /pages/auth/login/login.wxss: -------------------------------------------------------------------------------- 1 | .form-box{ 2 | width: 100%; 3 | height: auto; 4 | overflow: hidden; 5 | padding: 0 40rpx; 6 | margin-top: 96rpx; 7 | background: #fff; 8 | } 9 | 10 | .form-item{ 11 | position: relative; 12 | background: #fff; 13 | height: 96rpx; 14 | border-bottom: 1px solid #d9d9d9; 15 | } 16 | 17 | .form-item .username, .form-item .password, .form-item .code{ 18 | position: absolute; 19 | top: 26rpx; 20 | left: 0; 21 | display: block; 22 | width: 100%; 23 | height: 44rpx; 24 | background: #fff; 25 | color: #333; 26 | font-size: 30rpx; 27 | } 28 | 29 | .form-item-code{ 30 | margin-top:32rpx; 31 | height: auto; 32 | overflow: hidden; 33 | width: 100%; 34 | } 35 | 36 | .form-item-code .form-item{ 37 | float: left; 38 | width: 350rpx; 39 | } 40 | 41 | .form-item-code .code-img{ 42 | float: right; 43 | margin-top: 4rpx; 44 | height: 88rpx; 45 | width: 236rpx; 46 | } 47 | 48 | .form-item .clear{ 49 | position: absolute; 50 | top: 26rpx; 51 | right: 18rpx; 52 | z-index: 2; 53 | display: block; 54 | background: #fff; 55 | height: 44rpx; 56 | width: 44rpx; 57 | } 58 | 59 | .login-btn{ 60 | margin: 60rpx 0 40rpx 0; 61 | height: 96rpx; 62 | line-height: 96rpx; 63 | color: #fff; 64 | font-size: 30rpx; 65 | width: 100%; 66 | background: #b4282d; 67 | border-radius: 6rpx; 68 | } 69 | 70 | .form-item-text{ 71 | height: 35rpx; 72 | width: 100%; 73 | } 74 | 75 | .form-item-text .register{ 76 | display: block; 77 | height: 34rpx; 78 | float: left; 79 | font-size: 28rpx; 80 | color: #999; 81 | } 82 | 83 | .form-item-text .reset{ 84 | display: block; 85 | height: 34rpx; 86 | float: right; 87 | font-size: 28rpx; 88 | color: #999; 89 | } -------------------------------------------------------------------------------- /pages/auth/mobile/mobile.js: -------------------------------------------------------------------------------- 1 | var api = require('../../../config/api.js'); 2 | var util = require('../../../utils/util.js'); 3 | var app = getApp() 4 | 5 | Page({ 6 | data: { 7 | mobile: '', 8 | userInfo: { 9 | avatarUrl: '', 10 | nickName: '' 11 | }, 12 | disableGetMobileCode: false, 13 | disableSubmitMobileCode: true, 14 | getCodeButtonText: '获取验证码' 15 | }, 16 | 17 | onShow: function () { 18 | }, 19 | 20 | onLoad: function () { 21 | 22 | 23 | }, 24 | 25 | bindCheckMobile: function (mobile) { 26 | if (!mobile) { 27 | wx.showModal({ 28 | title: '错误', 29 | content: '请输入手机号码' 30 | }); 31 | return false 32 | } 33 | if (!mobile.match(/^1[3-9][0-9]\d{8}$/)) { 34 | wx.showModal({ 35 | title: '错误', 36 | content: '手机号格式不正确,仅支持国内手机号码' 37 | }); 38 | return false 39 | } 40 | return true 41 | }, 42 | 43 | bindGetPassCode: function (e) { 44 | var that = this 45 | that.setData({disableGetMobileCode: true}) 46 | }, 47 | 48 | bindInputMobile: function (e) { 49 | this.setData({ 50 | mobile: e.detail.value, 51 | }) 52 | }, 53 | 54 | countDownPassCode: function () { 55 | if (!this.bindCheckMobile(this.data.mobile)) { 56 | return 57 | } 58 | util.request(api.SmsCode, { mobile: this.data.mobile}, 'POST') 59 | .then(function (res) { 60 | if (res.data.code == 200) { 61 | wx.showToast({ 62 | title: '发送成功', 63 | icon: 'success', 64 | duration: 1000 65 | }) 66 | var pages = getCurrentPages() 67 | var i = 60; 68 | var intervalId = setInterval(function () { 69 | i-- 70 | if (i <= 0) { 71 | pages[pages.length - 1].setData({ 72 | disableGetMobileCode: false, 73 | disableSubmitMobileCode: false, 74 | getCodeButtonText: '获取验证码' 75 | }) 76 | clearInterval(intervalId) 77 | } else { 78 | pages[pages.length - 1].setData({ 79 | getCodeButtonText: i, 80 | disableGetMobileCode: true, 81 | disableSubmitMobileCode: false 82 | }) 83 | } 84 | }, 1000); 85 | } 86 | }); 87 | 88 | }, 89 | 90 | bindLoginMobilecode: function (e) { 91 | var mobile = this.data.mobile; 92 | if (!this.bindCheckMobile(mobile)) { 93 | return 94 | } 95 | if (!(e.detail.value.code && e.detail.value.code.length === 6)) { 96 | return 97 | } 98 | wx.showToast({ 99 | title: '操作中...', 100 | icon: 'loading', 101 | duration: 5000 102 | }) 103 | const param={} 104 | param.mobile = mobile 105 | param.captcha = e.detail.value.code 106 | param.inviteCode = 1 107 | util.request(api.BindMobile, param, 'POST','application/x-www-form-urlencoded') 108 | .then(function (res) { 109 | if (res.data.code == 200) { 110 | wx.showModal({ 111 | title: '提示', 112 | content: '操作成功', 113 | showCancel: false 114 | }) 115 | wx.switchTab({ 116 | url: '/pages/ucenter/index/index' 117 | }); 118 | } else { 119 | wx.showModal({ 120 | title: '提示', 121 | content: '验证码错误', 122 | showCancel: false 123 | }) 124 | } 125 | }) 126 | } 127 | }) -------------------------------------------------------------------------------- /pages/auth/mobile/mobile.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/auth/mobile/mobile.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 13 |
14 | 15 | 16 |
17 |
18 | -------------------------------------------------------------------------------- /pages/auth/mobile/mobile.wxss: -------------------------------------------------------------------------------- 1 | .userinfo { 2 | display: flex; 3 | flex-direction: column; 4 | align-items: center; 5 | padding-bottom: 25rpx; 6 | /* background: linear-gradient(to bottom, #b4285e 0%, #dd4407 100%); */ 7 | background: #ffffff; 8 | } 9 | 10 | .userinfo-avatar { 11 | width: 100rpx; 12 | height: 100rpx; 13 | border-radius: 50%; 14 | margin-top: 20rpx; 15 | margin-bottom: 25rpx; 16 | } 17 | 18 | .userinfo-nickname { 19 | color: #000000; 20 | font-size: 28rpx; 21 | line-height: 40rpx; 22 | } 23 | 24 | .separate { 25 | height: 18rpx; 26 | background-color: #f2f2f2; 27 | } 28 | 29 | .zichan { 30 | display: flex; 31 | flex-direction: column; 32 | } 33 | 34 | .zichan .first-line { 35 | display: flex; 36 | flex-direction: row; 37 | justify-content: space-between; 38 | font-size: 27rpx; 39 | margin-left: 20rpx; 40 | margin-top: 20rpx; 41 | margin-bottom: 20rpx; 42 | } 43 | 44 | .zichan .second-line { 45 | padding-top: 15rpx; 46 | padding-bottom: 15rpx; 47 | border-top: 1rpx solid #F6F6F6; 48 | border-bottom: 1rpx solid #F6F6F6; 49 | height: max-content; 50 | } 51 | 52 | .long-view { 53 | display: flex; 54 | flex-direction: row; 55 | width: 1850rpx; 56 | } 57 | 58 | .zichan .second-line .item { 59 | width: 560rpx; 60 | height: 264rpx; 61 | margin-left: 20rpx; 62 | } 63 | 64 | .zichan .second-line .item .image{ 65 | height: 264rpx; 66 | } 67 | 68 | .zichan .second-line .desc { 69 | position: relative; 70 | top: -262rpx; 71 | left: 0; 72 | width: 560rpx; 73 | height: 264rpx; 74 | background-color: rgba(0,0,0,0.3); 75 | border-radius: 5px; 76 | text-align: center; 77 | color: #fff; 78 | display: flex; 79 | flex-direction: column; 80 | justify-content: center; 81 | font-size: 25rpx; 82 | } 83 | 84 | .desc-line { 85 | margin-top: 5rpx; 86 | margin-bottom: 5rpx; 87 | } 88 | 89 | .desc-line.asset-count { 90 | font-size: 32rpx; 91 | color: #FFC800; 92 | } 93 | 94 | .slide-img { 95 | border-radius: 5px; 96 | width: 560rpx; 97 | height: 264rpx; 98 | } 99 | 100 | /*.zichan .third-line { 101 | display: flex; 102 | flex-direction: row; 103 | justify-content: space-between; 104 | font-size: 27rpx; 105 | margin-left: 20rpx; 106 | margin-top: 20rpx; 107 | margin-bottom: 20rpx; 108 | }*/ 109 | 110 | /* 绑定手机号的两个form */ 111 | .login-title { 112 | margin: 20rpx 0 35rpx; 113 | text-align: center; 114 | font-size: 30rpx; 115 | } 116 | 117 | .login { 118 | font-size: 32rpx; 119 | display: flex; 120 | flex-direction: column; 121 | align-items: center; 122 | /* margin-top:100rpx; */ 123 | } 124 | 125 | .login .first-line { 126 | height: 80rpx; 127 | border: 1rpx solid rgb(217, 217, 217); 128 | border-radius: 5px; 129 | width: 600rpx; 130 | margin-bottom: 20rpx; 131 | } 132 | 133 | .login .first-line input { 134 | padding-left: 20rpx; 135 | height: 80rpx; 136 | } 137 | 138 | .login .second-line { 139 | height: 80rpx; 140 | display: flex; 141 | width: 600rpx; 142 | margin-bottom: 50rpx; 143 | } 144 | 145 | .login .second-line input { 146 | height: 80rpx; 147 | width: 350rpx; 148 | margin-right: 20rpx; 149 | border: 1rpx solid rgb(217, 217, 217); 150 | padding-left: 20rpx; 151 | border-radius: 5px; 152 | } 153 | 154 | .login .second-line button { 155 | text-align: center; 156 | height: 84rpx; 157 | line-height: 84rpx; 158 | width: 250rpx; 159 | font-size: 30rpx; 160 | background-color:#b4282d; 161 | color:#ffffff; 162 | } 163 | 164 | .login .password-second-line { 165 | height: 80rpx; 166 | display: flex; 167 | width: 600rpx; 168 | margin-bottom: 50rpx; 169 | } 170 | 171 | .login .password-second-line input { 172 | height: 80rpx; 173 | width: 600rpx; 174 | border: 1rpx solid rgb(217, 217, 217); 175 | padding-left: 20rpx; 176 | border-radius: 5px; 177 | } 178 | 179 | .third-line { 180 | margin-left: auto; 181 | margin-right: auto; 182 | width: 600rpx; 183 | } 184 | 185 | .third-line button { 186 | height: 80rpx; 187 | font-size: 32rpx; 188 | background-color: #FFC800; 189 | } 190 | 191 | .login-type { 192 | width: 600rpx; 193 | margin: 60rpx auto 0 auto; 194 | padding: 20rpx 0 20rpx; 195 | font-size: 32rpx; 196 | text-align: right; 197 | text-decoration: underline; 198 | } 199 | 200 | /*************/ 201 | 202 | .profile-button-container { 203 | display: flex; 204 | flex-wrap: wrap; 205 | margin-top: 10rpx; 206 | margin-bottom: 10rpx; 207 | } 208 | 209 | .profile-button { 210 | display: flex; 211 | flex-direction: column; 212 | align-items: center; 213 | justify-content: center; 214 | width: 188rpx; 215 | height: 130rpx; 216 | } 217 | 218 | .profile-button image { 219 | width: 36rpx; 220 | height: 36rpx; 221 | } 222 | 223 | .profile-button text { 224 | font-size: 25rpx; 225 | } -------------------------------------------------------------------------------- /pages/auth/register/register.js: -------------------------------------------------------------------------------- 1 | var api = require('../../../config/api.js'); 2 | var app = getApp(); 3 | Page({ 4 | data: { 5 | username: '', 6 | password: '', 7 | confirmPassword: '', 8 | code: '', 9 | loginErrorCount: 0 10 | }, 11 | onLoad: function (options) { 12 | // 页面初始化 options为页面跳转所带来的参数 13 | // 页面渲染完成 14 | 15 | }, 16 | onReady: function () { 17 | 18 | }, 19 | onShow: function () { 20 | // 页面显示 21 | 22 | }, 23 | onHide: function () { 24 | // 页面隐藏 25 | 26 | }, 27 | onUnload: function () { 28 | // 页面关闭 29 | 30 | }, 31 | startRegister: function () { 32 | var that = this; 33 | 34 | if (that.data.password.length < 3 || that.data.username.length < 3) { 35 | wx.showModal({ 36 | title: '错误信息', 37 | content: '用户名和密码不得少于3位', 38 | showCancel: false 39 | }); 40 | return false; 41 | } 42 | 43 | if (that.data.password != that.data.confirmPassword) { 44 | wx.showModal({ 45 | title: '错误信息', 46 | content: '确认密码不一致', 47 | showCancel: false 48 | }); 49 | return false; 50 | } 51 | 52 | wx.request({ 53 | url: api.Register, 54 | data: { 55 | username: that.data.username, 56 | password: that.data.password 57 | }, 58 | method: 'POST', 59 | header: { 60 | 'content-type': 'application/json' 61 | }, 62 | success: function (res) { 63 | if (res.data.code == 200) { 64 | that.setData({ 65 | 'loginErrorCount': 0 66 | }); 67 | wx.setStorage({ 68 | key: "token", 69 | data: res.data.data.token, 70 | success: function () { 71 | wx.switchTab({ 72 | url: '/pages/ucenter/index/index' 73 | }); 74 | } 75 | }); 76 | 77 | } 78 | console.log(res.data.data.token) 79 | } 80 | }); 81 | }, 82 | bindUsernameInput: function (e) { 83 | 84 | this.setData({ 85 | username: e.detail.value 86 | }); 87 | }, 88 | bindPasswordInput: function (e) { 89 | 90 | this.setData({ 91 | password: e.detail.value 92 | }); 93 | }, 94 | bindConfirmPasswordInput: function (e) { 95 | 96 | this.setData({ 97 | confirmPassword: e.detail.value 98 | }); 99 | }, 100 | bindCodeInput: function (e) { 101 | 102 | this.setData({ 103 | code: e.detail.value 104 | }); 105 | }, 106 | clearInput: function (e) { 107 | switch (e.currentTarget.id) { 108 | case 'clear-username': 109 | this.setData({ 110 | username: '' 111 | }); 112 | break; 113 | case 'clear-password': 114 | this.setData({ 115 | password: '' 116 | }); 117 | break; 118 | case 'clear-confirm-password': 119 | this.setData({ 120 | confirmPassword: '' 121 | }); 122 | break; 123 | case 'clear-code': 124 | this.setData({ 125 | code: '' 126 | }); 127 | break; 128 | } 129 | } 130 | }) -------------------------------------------------------------------------------- /pages/auth/register/register.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/auth/register/register.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /pages/auth/register/register.wxss: -------------------------------------------------------------------------------- 1 | .form-box{ 2 | width: 100%; 3 | height: auto; 4 | overflow: hidden; 5 | padding: 0 40rpx; 6 | margin-top: 96rpx; 7 | background: #fff; 8 | } 9 | 10 | .form-item{ 11 | position: relative; 12 | background: #fff; 13 | height: 96rpx; 14 | border-bottom: 1px solid #d9d9d9; 15 | } 16 | 17 | .form-item .username, .form-item .password, .form-item .code{ 18 | position: absolute; 19 | top: 26rpx; 20 | left: 0; 21 | display: block; 22 | width: 100%; 23 | height: 44rpx; 24 | background: #fff; 25 | color: #333; 26 | font-size: 30rpx; 27 | } 28 | 29 | .form-item-code{ 30 | margin-top:32rpx; 31 | height: auto; 32 | overflow: hidden; 33 | width: 100%; 34 | } 35 | 36 | .form-item-code .form-item{ 37 | float: left; 38 | width: 350rpx; 39 | } 40 | 41 | .form-item-code .code-img{ 42 | float: right; 43 | margin-top: 4rpx; 44 | height: 88rpx; 45 | width: 236rpx; 46 | } 47 | 48 | .form-item .clear{ 49 | position: absolute; 50 | top: 26rpx; 51 | right: 18rpx; 52 | z-index: 2; 53 | display: block; 54 | background: #fff; 55 | height: 44rpx; 56 | width: 44rpx; 57 | } 58 | 59 | .login-btn{ 60 | margin: 60rpx 0 40rpx 0; 61 | height: 96rpx; 62 | line-height: 96rpx; 63 | color: #fff; 64 | font-size: 30rpx; 65 | width: 100%; 66 | background: #b4282d; 67 | border-radius: 6rpx; 68 | } 69 | 70 | .form-item-text{ 71 | height: 35rpx; 72 | width: 100%; 73 | } 74 | 75 | .form-item-text .register{ 76 | display: block; 77 | height: 34rpx; 78 | float: left; 79 | font-size: 28rpx; 80 | color: #999; 81 | } 82 | 83 | .form-item-text .reset{ 84 | display: block; 85 | height: 34rpx; 86 | float: right; 87 | font-size: 28rpx; 88 | color: #999; 89 | } -------------------------------------------------------------------------------- /pages/auth/reset/reset.js: -------------------------------------------------------------------------------- 1 | var app = getApp(); 2 | Page({ 3 | data: { 4 | username: '', 5 | code: '' 6 | }, 7 | onLoad: function (options) { 8 | // 页面初始化 options为页面跳转所带来的参数 9 | // 页面渲染完成 10 | 11 | }, 12 | onReady: function () { 13 | 14 | }, 15 | onShow: function () { 16 | // 页面显示 17 | 18 | }, 19 | onHide: function () { 20 | // 页面隐藏 21 | 22 | }, 23 | onUnload: function () { 24 | // 页面关闭 25 | 26 | }, 27 | startLogin: function(){ 28 | var that = this; 29 | }, 30 | bindUsernameInput: function(e){ 31 | 32 | this.setData({ 33 | username: e.detail.value 34 | }); 35 | }, 36 | bindCodeInput: function(e){ 37 | 38 | this.setData({ 39 | code: e.detail.value 40 | }); 41 | }, 42 | clearInput: function(e){ 43 | switch (e.currentTarget.id){ 44 | case 'clear-username': 45 | this.setData({ 46 | username: '' 47 | }); 48 | break; 49 | case 'clear-code': 50 | this.setData({ 51 | code: '' 52 | }); 53 | break; 54 | } 55 | } 56 | }) -------------------------------------------------------------------------------- /pages/auth/reset/reset.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/auth/reset/reset.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /pages/auth/reset/reset.wxss: -------------------------------------------------------------------------------- 1 | .form-box{ 2 | width: 100%; 3 | height: auto; 4 | overflow: hidden; 5 | padding: 0 40rpx; 6 | margin-top: 96rpx; 7 | background: #fff; 8 | } 9 | 10 | .form-item{ 11 | position: relative; 12 | background: #fff; 13 | height: 96rpx; 14 | border-bottom: 1px solid #d9d9d9; 15 | } 16 | 17 | .form-item .username, .form-item .code{ 18 | position: absolute; 19 | top: 26rpx; 20 | left: 0; 21 | display: block; 22 | width: 100%; 23 | height: 44rpx; 24 | background: #fff; 25 | color: #333; 26 | font-size: 30rpx; 27 | } 28 | 29 | .form-item-code{ 30 | margin-top:32rpx; 31 | height: auto; 32 | overflow: hidden; 33 | width: 100%; 34 | } 35 | 36 | .form-item-code .form-item{ 37 | float: left; 38 | width: 350rpx; 39 | } 40 | 41 | .form-item-code .code-img{ 42 | float: right; 43 | margin-top: 4rpx; 44 | height: 88rpx; 45 | width: 236rpx; 46 | } 47 | 48 | .form-item .clear{ 49 | position: absolute; 50 | top: 26rpx; 51 | right: 18rpx; 52 | z-index: 2; 53 | display: block; 54 | background: #fff; 55 | height: 44rpx; 56 | width: 44rpx; 57 | } 58 | 59 | .login-btn{ 60 | margin: 60rpx 0 40rpx 0; 61 | height: 96rpx; 62 | line-height: 96rpx; 63 | color: #fff; 64 | font-size: 30rpx; 65 | width: 100%; 66 | background: #b4282d; 67 | border-radius: 6rpx; 68 | } 69 | -------------------------------------------------------------------------------- /pages/cart/cart.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "购物车", 3 | "enablePullDownRefresh": false 4 | } -------------------------------------------------------------------------------- /pages/cart/cart.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 购物车空空如也~ 6 | 7 | 8 | 去逛逛 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | {{item.productName}} 23 | x{{item.quantity}} 24 | 25 | {{ isEditCart ? '已选择:' : ''}}{{item.productSubTitle||''}} 26 | 27 | ¥{{item.price}} 28 | 29 | - 30 | 31 | + 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 全选({{cartTotal.checkedGoodsCount}}) 42 | {{!isEditCart ? '¥'+cartTotal.checkedGoodsAmount : ''}} 43 | {{!isEditCart ? '编辑' : '完成'}} 44 | 删除所选 45 | 下单 46 | 47 | 48 | -------------------------------------------------------------------------------- /pages/catalog/catalog.js: -------------------------------------------------------------------------------- 1 | var util = require('../../utils/util.js'); 2 | var api = require('../../config/api.js'); 3 | 4 | Page({ 5 | data: { 6 | navList: [], //一级分类列表 7 | currentCategory: [], //二级分类 8 | currentInfo: {}, //分类项相关信息 9 | goodsCount: 0 //商品总数 10 | }, 11 | //页面初始化 12 | onLoad: function (options) { 13 | //调用函数,请求数据 14 | this.getCatalog(); 15 | }, 16 | //获取分类页面相关数据 17 | getCatalog: function () { 18 | let that = this; 19 | wx.showLoading({ 20 | title: '加载中...', 21 | }); 22 | //分类列表 23 | util.request(api.CatalogList).then(function (res) { 24 | console.log(res); 25 | that.setData({ 26 | navList: res.data, 27 | // 此处 child为 data数组中 某元素的值 需要加上index,此处默认展示第一个 28 | currentCategory: res.data[0].children, //二级分类信息 29 | currentInfo: res.data[0] //一级分类具体信息 30 | }); 31 | wx.hideLoading(); 32 | }); 33 | //获取商品总数 34 | util.request(api.GoodsCount).then(function (res) { 35 | that.setData({ 36 | goodsCount: res.data 37 | }); 38 | }); 39 | }, 40 | //根据一级分类获取其对应的二级分类 41 | getCurrentCategory: function (id) { 42 | console.log("getCurrentCategory" + id) 43 | // 不请求接口 因为该数据在getCatalog已经请求获取了 44 | let that = this; 45 | that.setData({ 46 | // id 从 1开始 因此我们需要减1 47 | currentCategory: this.data.navList[id - 1].children, //根据用户点击选择的一级分类获取其二级分类内容 48 | currentInfo: this.data.navList[id - 1] //用户所选的一级分类具体信息 49 | }); 50 | }, 51 | onReady: function () { 52 | // 页面渲染完成 53 | }, 54 | onShow: function () { 55 | // 页面显示 56 | }, 57 | onHide: function () { 58 | // 页面隐藏 59 | }, 60 | onUnload: function () { 61 | // 页面关闭 62 | }, 63 | //点击切换不同的一级分类 64 | switchCate: function (event) { 65 | var that = this; 66 | var currentTarget = event.currentTarget; 67 | if (this.data.currentCategory.id == event.currentTarget.dataset.id) { 68 | return false; 69 | } 70 | //调用自定义函数 71 | this.getCurrentCategory(event.currentTarget.dataset.id); 72 | } 73 | }) -------------------------------------------------------------------------------- /pages/catalog/catalog.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "分类", 3 | "enablePullDownRefresh":false 4 | } -------------------------------------------------------------------------------- /pages/catalog/catalog.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 商品搜索, 共{{goodsCount}}款好物 7 | 8 | 9 | 10 | 11 | 12 | 13 | {{item.name}} 14 | 15 | 16 | 19 | 20 | 21 | {{currentInfo.name}}分类 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | {{item.name}} 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /pages/catalog/catalog.wxss: -------------------------------------------------------------------------------- 1 | page { 2 | height: 100%; 3 | } 4 | 5 | .container { 6 | background: #f9f9f9; 7 | height: 100%; 8 | width: 100%; 9 | display: flex; 10 | flex-direction: column; 11 | } 12 | 13 | .search { 14 | height: 88rpx; 15 | width: 100%; 16 | padding: 0 30rpx; 17 | background: #fff; 18 | display: flex; 19 | align-items: center; 20 | } 21 | 22 | .search .input { 23 | width: 710rpx; 24 | height: 56rpx; 25 | background: #ededed; 26 | border-radius: 30rpx; 27 | display: flex; 28 | align-items: center; 29 | justify-content: center; 30 | } 31 | 32 | .search .icon { 33 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/search2-2fb94833aa.png) center no-repeat; 34 | background-size: 100%; 35 | width: 28rpx; 36 | height: 28rpx; 37 | } 38 | 39 | .search .txt { 40 | height: 42rpx; 41 | line-height: 42rpx; 42 | color: #666; 43 | padding-left: 10rpx; 44 | font-size: 30rpx; 45 | } 46 | 47 | .catalog { 48 | flex: 1; 49 | width: 100%; 50 | background: #fff; 51 | display: flex; 52 | border-top: 1px solid #fafafa; 53 | } 54 | 55 | .catalog .nav { 56 | width: 162rpx; 57 | height: 100%; 58 | } 59 | 60 | .catalog .nav .item { 61 | text-align: center; 62 | line-height: 90rpx; 63 | width: 162rpx; 64 | height: 90rpx; 65 | color: #333; 66 | font-size: 28rpx; 67 | border-left: 6rpx solid #fff; 68 | } 69 | 70 | .catalog .nav .item.active { 71 | color: #ab2b2b; 72 | font-size: 36rpx; 73 | border-left: 6rpx solid #ab2b2b; 74 | } 75 | 76 | .catalog .cate { 77 | border-left: 1px solid #fafafa; 78 | flex: 1; 79 | height: 100%; 80 | padding: 0 30rpx 0 30rpx; 81 | } 82 | 83 | .banner { 84 | display: block; 85 | height: 222rpx; 86 | width: 100%; 87 | position: relative; 88 | } 89 | 90 | .banner .image { 91 | position: absolute; 92 | top: 30rpx; 93 | left: 0; 94 | border-radius: 4rpx; 95 | height: 192rpx; 96 | width: 100%; 97 | } 98 | 99 | .banner .txt { 100 | position: absolute; 101 | top: 30rpx; 102 | text-align: center; 103 | color: #fff; 104 | font-size: 28rpx; 105 | left: 0; 106 | height: 192rpx; 107 | line-height: 192rpx; 108 | width: 100%; 109 | } 110 | 111 | .catalog .hd { 112 | height: 108rpx; 113 | width: 100%; 114 | display: flex; 115 | justify-content: center; 116 | align-items: center; 117 | } 118 | 119 | .catalog .hd .txt { 120 | font-size: 24rpx; 121 | text-align: center; 122 | color: #333; 123 | padding: 0 10rpx; 124 | width: auto; 125 | } 126 | 127 | .catalog .hd .line { 128 | width: 40rpx; 129 | height: 1px; 130 | background: #d9d9d9; 131 | } 132 | 133 | .catalog .bd { 134 | height: auto; 135 | width: 100%; 136 | overflow: hidden; 137 | } 138 | 139 | .catalog .bd .item { 140 | display: block; 141 | float: left; 142 | height: 216rpx; 143 | width: 144rpx; 144 | margin-right: 34rpx; 145 | } 146 | 147 | .catalog .bd .item.last { 148 | margin-right: 0; 149 | } 150 | 151 | .catalog .bd .item .icon { 152 | height: 144rpx; 153 | width: 144rpx; 154 | } 155 | 156 | .catalog .bd .item .txt { 157 | display: block; 158 | text-align: center; 159 | font-size: 24rpx; 160 | color: #333; 161 | height: 72rpx; 162 | width: 144rpx; 163 | } 164 | .empty-view{ 165 | background: #ffffff; 166 | } 167 | -------------------------------------------------------------------------------- /pages/category/category.js: -------------------------------------------------------------------------------- 1 | var util = require('../../utils/util.js'); 2 | var api = require('../../config/api.js'); 3 | 4 | Page({ 5 | data: { 6 | goodsList: [], //该分类下的商品列表 7 | id: 0, //分类id 8 | scrollLeft: 0, 9 | scrollTop: 0, 10 | scrollHeight: 0, 11 | page: 1, //当前页页码 12 | size: 10, //每页商品数 13 | loadmoreText: '正在加载更多数据', 14 | nomoreText: '全部加载完成', 15 | nomore: false, 16 | totalPages: 1 //总页数 17 | }, 18 | onLoad: function (options) { 19 | // 页面初始化 options为页面跳转所带来的参数 20 | var that = this; 21 | if (options.id) { 22 | that.setData({ 23 | id: parseInt(options.id) //从跳转参数中获取到分类id 24 | }); 25 | } 26 | wx.getSystemInfo({ 27 | success: function (res) { 28 | that.setData({ 29 | scrollHeight: res.windowHeight 30 | }); 31 | } 32 | }); 33 | //获取后台数据 34 | this.getGoodsList(); 35 | }, 36 | onReady: function () { 37 | // 页面渲染完成 38 | }, 39 | onShow: function () { 40 | // 页面显示 41 | console.log(1); 42 | }, 43 | onHide: function () { 44 | // 页面隐藏 45 | }, 46 | //页面上拉触底事件的处理函数 47 | onReachBottom: function () { 48 | console.log("下一页") 49 | this.getGoodsList() 50 | }, 51 | //根据分类获取分类商品列表 52 | getGoodsList: function () { 53 | var that = this; 54 | if (that.data.totalPages <= that.data.page - 1) { 55 | that.setData({ 56 | nomore: true 57 | }) 58 | return; 59 | } 60 | //请求接口,获取数据 61 | util.request(api.GoodsCategory, { 62 | productCategoryId: this.data.id, 63 | pageSize: that.data.size 64 | }) 65 | .then(function (res) { 66 | if (res.code === 200) { 67 | that.setData({ 68 | goodsList: res.data.list, //当前分类id下的商品 69 | page: res.data.pageNum + 1, //默认显示第一页,后台数据页码从0开始,所以要加1 70 | totalPages: res.data.totalPage //总页数 71 | }); 72 | } 73 | }); 74 | }, 75 | onUnload: function () { 76 | // 页面关闭 77 | }, 78 | }) -------------------------------------------------------------------------------- /pages/category/category.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "分类", 3 | "enablePullDownRefresh": false 4 | } -------------------------------------------------------------------------------- /pages/category/category.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{goodsList.productCategoryName}} 6 | 7 | 8 | 9 | 10 | 11 | {{iitem.name}} 12 | ¥{{iitem.price}} 13 | 14 | 15 | 16 | 17 | 18 | {{nomoreText}} 19 | 20 | 21 | 22 | {{loadmoreText}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 无产品数据 30 | 31 | -------------------------------------------------------------------------------- /pages/customer/add/add.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "新增客户" 3 | } -------------------------------------------------------------------------------- /pages/customer/add/add.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | {{customer.birthday?customer.birthday:'客户生日'}} 33 | 34 | 35 | 36 | 46 | 47 |