├── .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 |
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 |
17 |
18 |
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 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | {{item.name}}
60 |
61 | 确定
62 |
63 |
64 |
65 | {{item.name}}
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/pages/customer/add/add.wxss:
--------------------------------------------------------------------------------
1 | /* pages/customer/customer.wxss */
2 | page{
3 | height: 100%;
4 | background: #f4f4f4;
5 | }
6 | .add-address .add-form{
7 | background: #fff;
8 | width: 100%;
9 | height: auto;
10 | overflow: hidden;
11 | z-index: 1;
12 | }
13 |
14 | .add-address .form-item{
15 | min-height: 116rpx;
16 | padding-left: 31.25rpx;
17 | border-top: 1px solid #d9d9d9;
18 | display: flex;
19 | align-items: center;
20 | padding-right: 31.25rpx;
21 | }
22 |
23 | .add-address .form-item:nth-child(1){
24 | border-top: none;
25 | }
26 | .form-item .radio{
27 | margin-right: 20rpx;
28 | }
29 |
30 | .add-address .input{
31 | flex: 1;
32 | height: 44rpx;
33 | line-height: 44rpx;
34 | overflow: hidden;
35 | }
36 |
37 | .add-address .input_n{
38 | flex: 1;
39 | line-height: 44rpx;
40 | overflow: hidden;
41 | }
42 |
43 | .add-address .form-default{
44 | border-bottom: 1px solid #d9d9d9;
45 | height: 96rpx;
46 | background: #fafafa;
47 | padding-top: 28rpx;
48 | font-size: 28rpx;
49 | }
50 |
51 | .default-input{
52 | margin: 0 auto;
53 | display: block;
54 | width: 240rpx;
55 | height: 40rpx;
56 | padding-left: 50rpx;
57 | line-height: 40rpx;
58 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 1rpx -448rpx no-repeat;
59 | background-size: 38rpx 486rpx;
60 | font-size: 28rpx;
61 | }
62 |
63 | .default-input.selected{
64 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat;
65 | background-size: 38rpx 486rpx;
66 | }
67 |
68 | .add-address .btns{
69 | position: fixed;
70 | bottom: 0;
71 | left: 0;
72 | overflow: hidden;
73 | display: flex;
74 | height: 100rpx;
75 | width: 100%;
76 | z-index: 300;
77 | }
78 |
79 | .add-address .cannel,.add-address .save{
80 | flex: 1;
81 | height: 100rpx;
82 | text-align: center;
83 | line-height: 100rpx;
84 | font-size: 28rpx;
85 | color: #fff;
86 | border:none;
87 | border-radius: 0;
88 | }
89 |
90 | .add-address .cannel{
91 | background: #e6af58;
92 | }
93 |
94 | .add-address .save{
95 | background: #b4282d;
96 | }
97 |
98 |
99 | .region-select{
100 | width: 100%;
101 | height: 600rpx;
102 | background: #ffffff;
103 | position: fixed;
104 | left:0;
105 | bottom: 0;
106 | z-index: 1000;
107 | }
108 |
109 | .region-select .hd{
110 | height: 108rpx;
111 | width: 100%;
112 | border-bottom: 1px solid #f4f4f4;
113 | padding: 46rpx 30rpx 0 30rpx;
114 | }
115 |
116 | .region-select .region-selected{
117 | float: left;
118 | height: 60rpx;
119 | display: flex;
120 | }
121 |
122 | .region-select .region-selected .item{
123 | max-width: 140rpx;
124 | margin-right: 30rpx;
125 | text-align: left;
126 | line-height: 60rpx;
127 | height: 100%;
128 | color: #333;
129 | font-size: 28rpx;
130 | overflow: hidden;
131 | text-overflow: ellipsis;
132 | white-space: nowrap;
133 | }
134 |
135 | .region-select .region-selected .item.disabled{
136 | color: #999;
137 | }
138 |
139 | .region-select .region-selected .item.selected{
140 | color: #b4282d;
141 | }
142 |
143 | .region-select .done{
144 | float: right;
145 | height: 60rpx;
146 | width: 60rpx;
147 | border: none;
148 | background: #fff;
149 | line-height: 60rpx;
150 | text-align: center;
151 | color: #333;
152 | font-size: 28rpx;
153 | }
154 |
155 | .region-select .done.disabled{
156 | color: #999;
157 | }
158 |
159 |
160 |
161 | .region-select .bd{
162 | height: 492rpx;
163 | width: 100%;
164 | padding: 0 30rpx;
165 | z-index: 600;
166 | }
167 |
168 | .region-select .region-list{
169 | height: auto;
170 | overflow: scroll;
171 | background: #fff;
172 | z-index: 400;
173 |
174 | }
175 |
176 | .region-select .region-list .item{
177 | width: 100%;
178 | height: 104rpx;
179 | line-height: 104rpx;
180 | text-align: left;
181 | color: #333;
182 | font-size: 28rpx;
183 | }
184 |
185 | .region-select .region-list .item.selected{
186 | color: #b4282d;
187 | }
188 |
189 |
190 | .bg-mask{
191 | height: 100%;
192 | width: 100%;
193 | background: rgba(0, 0, 0, 0.4);
194 | position: fixed;
195 | top:0;
196 | left:0;
197 | z-index: 400;
198 | }
199 |
--------------------------------------------------------------------------------
/pages/customer/addwh/addwh.js:
--------------------------------------------------------------------------------
1 | // pages/customer/addwh/addwh.js
2 | var util = require('../../../utils/util.js');
3 | var api = require('../../../config/api.js');
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | fs_array: ['请选择维护状态', '无意向待跟进', '有意向待跟进'],
11 | fs_index:0,
12 | // ly_array: ['请选择来源', '用户购买商品,邮寄给客户', '用户买了 服务性商品后,系统插入','用户自行维护'],
13 | // ly_index:0,
14 | // gift:'',
15 | ctype:'',
16 | giftPrice:'',
17 | place:'',
18 | utime:'',
19 | customerId:0,
20 | id:0,
21 | state:0
22 | },
23 | // bindinputName1(e){
24 | // this.setData({
25 | // gift: e.detail.value
26 | // })
27 | // },
28 | bindinputName2(e) {
29 | this.setData({
30 | ctype: e.detail.value
31 | })
32 | },
33 | bindinputName3(e) {
34 | this.setData({
35 | giftPrice: e.detail.value
36 | })
37 | },
38 | bindinputName4(e) {
39 | this.setData({
40 | place: e.detail.value
41 | })
42 | },
43 | bindDateChange(e) {
44 | this.setData({
45 | utime: e.detail.value
46 | })
47 | },
48 | bindFSChange(e) {
49 | console.log('picker发送选择改变,携带值为', e.detail.value)
50 | this.setData({
51 | fs_index: e.detail.value
52 | })
53 | },
54 | // bindLYChange(e) {
55 | // console.log('picker发送选择改变,携带值为', e.detail.value)
56 | // this.setData({
57 | // ly_index: e.detail.value
58 | // })
59 | // },
60 | saveCustomer() {
61 | let that = this;
62 | if (that.data.fs_index == 0 & that.data.state==2) {
63 | util.showErrorToast('请选择维护状态');
64 | return false;
65 | }
66 | console.log(that.data.id)
67 | var url = that.data.id == 0 ? api.WhSave:api.UpkeepUpdate;
68 | console.log('----000---', url)
69 | util.request(url, {
70 | id: that.data.id,
71 | customerId: that.data.customerId,
72 | ctype: that.data.ctype,
73 | place: that.data.place,
74 | giftPrice: that.data.giftPrice,
75 | utime: that.data.utime,
76 | status: that.data.fs_index
77 | }, 'POST').then(function (res) {
78 | if (res.errno === 0) {
79 | wx.navigateBack({
80 | url: '/pages/customer/whlist/whlist',
81 | })
82 | }
83 | });
84 |
85 | },
86 | getQueryObject() {
87 | let that = this;
88 | util.request(api.QueryObject, { id: that.data.id }, 'POST').then(function (res) {
89 | if (res.errno === 0) {
90 | console.log(res.data);
91 | that.setData({
92 | ctype: res.data.ctype,
93 | place: res.data.place,
94 | giftPrice: res.data.giftPrice,
95 | utime: res.data.utime,
96 | fs_index: res.data.status,
97 | customerId: res.data.customerId
98 | });
99 | wx.hideLoading();
100 | }
101 | });
102 | },
103 | cancelAddress: function () {
104 | this.setData({
105 | fs_index: 0,
106 | ctype: '',
107 | place: '',
108 | giftPrice: '',
109 | utime: ''
110 | });
111 | },
112 |
113 | /**
114 | * 生命周期函数--监听页面加载
115 | */
116 | onLoad: function (options) {
117 | console.log('-------8888-----', options.state)
118 | this.setData({
119 | customerId: options.id ? options.id:0,
120 | id: options.nid ? options.nid:0,
121 | state: options.state
122 | });
123 | if (options.nid){
124 | wx.setNavigationBarTitle({
125 | title: '编辑维护历史'
126 | })
127 | wx.showLoading({
128 | title: '加载中...',
129 | success: function () { }
130 | });
131 | this.getQueryObject();
132 | }
133 | },
134 |
135 | /**
136 | * 生命周期函数--监听页面初次渲染完成
137 | */
138 | onReady: function () {
139 |
140 | },
141 |
142 | /**
143 | * 生命周期函数--监听页面显示
144 | */
145 | onShow: function () {
146 |
147 | },
148 |
149 | /**
150 | * 生命周期函数--监听页面隐藏
151 | */
152 | onHide: function () {
153 |
154 | },
155 |
156 | /**
157 | * 生命周期函数--监听页面卸载
158 | */
159 | onUnload: function () {
160 |
161 | },
162 |
163 | /**
164 | * 页面相关事件处理函数--监听用户下拉动作
165 | */
166 | // onPullDownRefresh: function () {
167 |
168 | // },
169 |
170 | /**
171 | * 页面上拉触底事件的处理函数
172 | */
173 | onReachBottom: function () {
174 |
175 | },
176 |
177 | /**
178 | * 用户点击右上角分享
179 | */
180 | onShareAppMessage: function () {
181 |
182 | }
183 | })
--------------------------------------------------------------------------------
/pages/customer/addwh/addwh.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "新增维护历史"
3 | }
--------------------------------------------------------------------------------
/pages/customer/addwh/addwh.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{utime?utime:'时间'}}
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | {{fs_array[fs_index]}}
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | {{item.name}}
36 |
37 | 确定
38 |
39 |
40 |
41 | {{item.name}}
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/pages/customer/addwh/addwh.wxss:
--------------------------------------------------------------------------------
1 | /* pages/customer/addwh/addwh.wxss */
2 | /* pages/customer/auth/auth.wxss */
3 | page{
4 | height: 100%;
5 | background: #f4f4f4;
6 | }
7 | .add-address .add-form{
8 | background: #fff;
9 | width: 100%;
10 | height: auto;
11 | overflow: hidden;
12 | }
13 |
14 | .add-address .form-item{
15 | height: 116rpx;
16 | padding-left: 31.25rpx;
17 | border-bottom: 1px solid #d9d9d9;
18 | display: flex;
19 | align-items: center;
20 | padding-right: 31.25rpx;
21 | }
22 | .form-item .radio{
23 | margin-right: 20rpx;
24 | }
25 |
26 | .add-address .input{
27 | flex: 1;
28 | height: 44rpx;
29 | line-height: 44rpx;
30 | overflow: hidden;
31 | }
32 |
33 | .add-address .form-default{
34 | border-bottom: 1px solid #d9d9d9;
35 | height: 96rpx;
36 | background: #fafafa;
37 | padding-top: 28rpx;
38 | font-size: 28rpx;
39 | }
40 |
41 | .default-input{
42 | margin: 0 auto;
43 | display: block;
44 | width: 240rpx;
45 | height: 40rpx;
46 | padding-left: 50rpx;
47 | line-height: 40rpx;
48 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 1rpx -448rpx no-repeat;
49 | background-size: 38rpx 486rpx;
50 | font-size: 28rpx;
51 | }
52 |
53 | .default-input.selected{
54 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat;
55 | background-size: 38rpx 486rpx;
56 | }
57 |
58 | .add-address .btns{
59 | position: fixed;
60 | bottom: 0;
61 | left: 0;
62 | overflow: hidden;
63 | display: flex;
64 | height: 100rpx;
65 | width: 100%;
66 | }
67 |
68 | .add-address .cannel,.add-address .save{
69 | flex: 1;
70 | height: 100rpx;
71 | text-align: center;
72 | line-height: 100rpx;
73 | font-size: 28rpx;
74 | color: #fff;
75 | border:none;
76 | border-radius: 0;
77 | }
78 |
79 | .add-address .cannel{
80 | background: #e6af58;
81 | }
82 |
83 | .add-address .save{
84 | background: #b4282d;
85 | }
86 |
87 |
88 | .region-select{
89 | width: 100%;
90 | height: 600rpx;
91 | background: #fff;
92 | position: fixed;
93 | z-index: 10;
94 | left:0;
95 | bottom: 0;
96 | }
97 |
98 | .region-select .hd{
99 | height: 108rpx;
100 | width: 100%;
101 | border-bottom: 1px solid #f4f4f4;
102 | padding: 46rpx 30rpx 0 30rpx;
103 | }
104 |
105 | .region-select .region-selected{
106 | float: left;
107 | height: 60rpx;
108 | display: flex;
109 | }
110 |
111 | .region-select .region-selected .item{
112 | max-width: 140rpx;
113 | margin-right: 30rpx;
114 | text-align: left;
115 | line-height: 60rpx;
116 | height: 100%;
117 | color: #333;
118 | font-size: 28rpx;
119 | overflow: hidden;
120 | text-overflow: ellipsis;
121 | white-space: nowrap;
122 | }
123 |
124 | .region-select .region-selected .item.disabled{
125 | color: #999;
126 | }
127 |
128 | .region-select .region-selected .item.selected{
129 | color: #b4282d;
130 | }
131 |
132 | .region-select .done{
133 | float: right;
134 | height: 60rpx;
135 | width: 60rpx;
136 | border: none;
137 | background: #fff;
138 | line-height: 60rpx;
139 | text-align: center;
140 | color: #333;
141 | font-size: 28rpx;
142 | }
143 |
144 | .region-select .done.disabled{
145 | color: #999;
146 | }
147 |
148 |
149 |
150 | .region-select .bd{
151 | height: 492rpx;
152 | width: 100%;
153 | padding: 0 30rpx;
154 | }
155 |
156 | .region-select .region-list{
157 | height: auto;
158 | overflow: scroll;
159 |
160 | }
161 |
162 | .region-select .region-list .item{
163 | width: 100%;
164 | height: 104rpx;
165 | line-height: 104rpx;
166 | text-align: left;
167 | color: #333;
168 | font-size: 28rpx;
169 | }
170 |
171 | .region-select .region-list .item.selected{
172 | color: #b4282d;
173 | }
174 |
175 |
176 | .bg-mask{
177 | height: 100%;
178 | width: 100%;
179 | background: rgba(0, 0, 0, 0.4);
180 | position: fixed;
181 | top:0;
182 | left:0;
183 | z-index: 8;
184 | }
185 |
--------------------------------------------------------------------------------
/pages/customer/auth/auth.js:
--------------------------------------------------------------------------------
1 | // pages/customer/addwh/addwh.js
2 | var util = require('../../../utils/util.js');
3 | var api = require('../../../config/api.js');
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | items:{
11 | name:'',
12 | amount:'',
13 | },
14 | },
15 | cancelAddress: function () {
16 | const item = this.data.items;
17 | item.name = '';
18 | item.amount = '';
19 | this.setData({
20 | items: item
21 | });
22 | },
23 | bindinputName(e) {
24 | let items = this.data.items;
25 | items.name = e.detail.value;
26 | this.setData({
27 | items: items
28 | });
29 | },
30 | bindinputAmount(e) {
31 | let items = this.data.items;
32 | items.amount = e.detail.value;
33 | this.setData({
34 | items: items
35 | });
36 | },
37 | saveCustomer() {
38 | let that = this;
39 | if (that.data.items.name == '') {
40 | util.showErrorToast('请输入真实姓名');
41 | return false;
42 | }
43 | if (that.data.items.amount == '') {
44 | util.showErrorToast('请输入提现金额');
45 | return false;
46 | }
47 | util.request(api.WithdrawCashes, { name: that.data.items.name, amount: that.data.items.amount }, 'POST', 'application/x-www-form-urlencoded').then(function (res) {
48 | if (res.errno === 0) {
49 | wx.showToast({
50 | title: '提现成功'
51 | });
52 | }else{
53 | util.showErrorToast(res.errmsg);
54 | }
55 | });
56 |
57 | },
58 |
59 | /**
60 | * 生命周期函数--监听页面加载
61 | */
62 | onLoad: function (options) {
63 | },
64 |
65 | /**
66 | * 生命周期函数--监听页面初次渲染完成
67 | */
68 | onReady: function () {
69 |
70 | },
71 |
72 | /**
73 | * 生命周期函数--监听页面显示
74 | */
75 | onShow: function () {
76 |
77 | },
78 |
79 | /**
80 | * 生命周期函数--监听页面隐藏
81 | */
82 | onHide: function () {
83 |
84 | },
85 |
86 | /**
87 | * 生命周期函数--监听页面卸载
88 | */
89 | onUnload: function () {
90 |
91 | },
92 |
93 | /**
94 | * 页面相关事件处理函数--监听用户下拉动作
95 | */
96 | onPullDownRefresh: function () {
97 |
98 | },
99 |
100 | /**
101 | * 页面上拉触底事件的处理函数
102 | */
103 | onReachBottom: function () {
104 |
105 | },
106 |
107 | /**
108 | * 用户点击右上角分享
109 | */
110 | onShareAppMessage: function () {
111 |
112 | }
113 | })
--------------------------------------------------------------------------------
/pages/customer/auth/auth.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "提现"
3 | }
--------------------------------------------------------------------------------
/pages/customer/auth/auth.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/pages/customer/auth/auth.wxss:
--------------------------------------------------------------------------------
1 | /* pages/customer/auth/auth.wxss */
2 | page{
3 | height: 100%;
4 | background: #f4f4f4;
5 | }
6 | .add-address .add-form{
7 | background: #fff;
8 | width: 100%;
9 | height: auto;
10 | overflow: hidden;
11 | }
12 |
13 | .add-address .form-item{
14 | height: 116rpx;
15 | padding-left: 31.25rpx;
16 | border-top: 1px solid #d9d9d9;
17 | display: flex;
18 | align-items: center;
19 | padding-right: 31.25rpx;
20 | }
21 | .add-address .form-item:nth-child(1){
22 | border-top: none;
23 | }
24 | .form-item .radio{
25 | margin-right: 20rpx;
26 | }
27 |
28 | .add-address .input{
29 | flex: 1;
30 | height: 44rpx;
31 | line-height: 44rpx;
32 | overflow: hidden;
33 | }
34 |
35 | .add-address .form-default{
36 | border-bottom: 1px solid #d9d9d9;
37 | height: 96rpx;
38 | background: #fafafa;
39 | padding-top: 28rpx;
40 | font-size: 28rpx;
41 | }
42 |
43 | .default-input{
44 | margin: 0 auto;
45 | display: block;
46 | width: 240rpx;
47 | height: 40rpx;
48 | padding-left: 50rpx;
49 | line-height: 40rpx;
50 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 1rpx -448rpx no-repeat;
51 | background-size: 38rpx 486rpx;
52 | font-size: 28rpx;
53 | }
54 |
55 | .default-input.selected{
56 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat;
57 | background-size: 38rpx 486rpx;
58 | }
59 |
60 | .add-address .btns{
61 | position: fixed;
62 | bottom: 0;
63 | left: 0;
64 | overflow: hidden;
65 | display: flex;
66 | height: 100rpx;
67 | width: 100%;
68 | }
69 |
70 | .add-address .cannel,.add-address .save{
71 | flex: 1;
72 | height: 100rpx;
73 | text-align: center;
74 | line-height: 100rpx;
75 | font-size: 28rpx;
76 | color: #fff;
77 | border:none;
78 | border-radius: 0;
79 | }
80 |
81 | .add-address .cannel{
82 | background: #e6af58;
83 | }
84 |
85 | .add-address .save{
86 | background: #b4282d;
87 | }
88 |
89 |
90 | .region-select{
91 | width: 100%;
92 | height: 600rpx;
93 | background: #fff;
94 | position: fixed;
95 | z-index: 10;
96 | left:0;
97 | bottom: 0;
98 | }
99 |
100 | .region-select .hd{
101 | height: 108rpx;
102 | width: 100%;
103 | border-bottom: 1px solid #f4f4f4;
104 | padding: 46rpx 30rpx 0 30rpx;
105 | }
106 |
107 | .region-select .region-selected{
108 | float: left;
109 | height: 60rpx;
110 | display: flex;
111 | }
112 |
113 | .region-select .region-selected .item{
114 | max-width: 140rpx;
115 | margin-right: 30rpx;
116 | text-align: left;
117 | line-height: 60rpx;
118 | height: 100%;
119 | color: #333;
120 | font-size: 28rpx;
121 | overflow: hidden;
122 | text-overflow: ellipsis;
123 | white-space: nowrap;
124 | }
125 |
126 | .region-select .region-selected .item.disabled{
127 | color: #999;
128 | }
129 |
130 | .region-select .region-selected .item.selected{
131 | color: #b4282d;
132 | }
133 |
134 | .region-select .done{
135 | float: right;
136 | height: 60rpx;
137 | width: 60rpx;
138 | border: none;
139 | background: #fff;
140 | line-height: 60rpx;
141 | text-align: center;
142 | color: #333;
143 | font-size: 28rpx;
144 | }
145 |
146 | .region-select .done.disabled{
147 | color: #999;
148 | }
149 |
150 |
151 |
152 | .region-select .bd{
153 | height: 492rpx;
154 | width: 100%;
155 | padding: 0 30rpx;
156 | }
157 |
158 | .region-select .region-list{
159 | height: auto;
160 | overflow: scroll;
161 |
162 | }
163 |
164 | .region-select .region-list .item{
165 | width: 100%;
166 | height: 104rpx;
167 | line-height: 104rpx;
168 | text-align: left;
169 | color: #333;
170 | font-size: 28rpx;
171 | }
172 |
173 | .region-select .region-list .item.selected{
174 | color: #b4282d;
175 | }
176 |
177 |
178 | .bg-mask{
179 | height: 100%;
180 | width: 100%;
181 | background: rgba(0, 0, 0, 0.4);
182 | position: fixed;
183 | top:0;
184 | left:0;
185 | z-index: 8;
186 | }
187 |
--------------------------------------------------------------------------------
/pages/customer/cuslist/cuslist.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../utils/util.js');
2 | var api = require('../../../config/api.js');
3 |
4 | Page({
5 | data: {
6 | orderList: [],
7 | array: ['请选择类型','客户', '准客户'],
8 | index: 0,
9 | page: 1,
10 | size: 6,
11 | loadmoreText: '正在加载更多数据',
12 | nomoreText: '全部加载完成',
13 | nomore: false,
14 | totalPages: 1,
15 | q: {
16 | uname: '',
17 | customerState: 0,
18 | upkeepState:0
19 | },
20 | customerCount:0,
21 | customerYcount:0,
22 | customerWcount:0
23 | },
24 | onLoad: function (options) {
25 | // wx.showLoading({
26 | // title: '加载中...',
27 | // success: function () {}
28 | // });
29 | // this.getOrderList();
30 | },
31 | /**
32 | * 页面上拉触底事件的处理函数
33 | */
34 | selKhId:function(){
35 | let q = this.data.q;
36 | q.customerState = 1;
37 | q.upkeepState = 0;
38 | this.setData({
39 | q: q
40 | });
41 | this.onKeywordConfirm();
42 | },
43 | selWhId: function () {
44 | let q = this.data.q;
45 | q.upkeepState = 1;
46 | q.customerState = 0;
47 | this.setData({
48 | q: q
49 | });
50 | this.onKeywordConfirm();
51 | },
52 | selWhId1: function () {
53 | let q = this.data.q;
54 | q.upkeepState = 2;
55 | q.customerState = 0;
56 | this.setData({
57 | q: q
58 | });
59 | this.onKeywordConfirm();
60 | },
61 | onReachBottom: function () {
62 | console.log("下一页")
63 | this.getOrderList()
64 | },
65 | onPullDownRefresh() {
66 | // 增加下拉刷新数据的功能
67 | wx.showNavigationBarLoading();
68 | var self = this;
69 | self.setData({
70 | orderList: [],
71 | page: 1,
72 | totalPages: 1
73 | });
74 | self.getOrderList();
75 | },
76 | inputChange(event) {
77 | let q = this.data.q;
78 | q.uname = event.detail.value;
79 | this.setData({
80 | q: q
81 | });
82 | },
83 | clearKeyword(){
84 | let q = this.data.q;
85 | q.uname = '';
86 | this.setData({
87 | q: q
88 | });
89 | },
90 | bindPickerChange(e) {
91 | console.log('picker发送选择改变,携带值为', e.detail.value)
92 | this.setData({
93 | index: e.detail.value
94 | })
95 | },
96 | onKeywordConfirm() {
97 | this.setData({
98 | orderList: [],
99 | page:1,
100 | totalPages:1
101 | })
102 | this.getOrderList();
103 | },
104 | getCount(){
105 | const that=this;
106 | util.request(api.GetCount, { customerState:1}, 'POST').then(function (res) {
107 | if (res.errno === 0) {
108 | that.setData({
109 | customerCount: res.data.customerCount,
110 | customerWcount: res.data.customerWcount,
111 | customerYcount: res.data.customerYcount
112 | });
113 | }
114 | });
115 | },
116 | getOrderList() {
117 | let that = this;
118 | if (that.data.totalPages <= that.data.page - 1) {
119 | that.setData({
120 | nomore: true
121 | })
122 | return;
123 | }
124 | util.request(api.CustomerList, { currentPage: that.data.page, numsPerPage: that.data.size, uname: that.data.q.uname, customerState:1, upkeepState: that.data.q.upkeepState },'POST').then(function (res) {
125 | if (res.errno === 0) {
126 | for (var i = 0; i < res.data.data.length;i++){
127 | if (res.data.data[i].addressVo.detailInfo.length>8){
128 | res.data.data[i].addressVo.detailInfo = res.data.data[i].addressVo.detailInfo.substring(0,8)+"...";
129 | }
130 | }
131 | that.setData({
132 | orderList: that.data.orderList.concat(res.data.data),
133 | page: res.data.currentPage+1,
134 | totalPages: res.data.totalPages
135 | });
136 | wx.hideLoading();
137 | }
138 | wx.hideNavigationBarLoading() //完成停止加载
139 | wx.stopPullDownRefresh() //停止下拉刷新
140 | });
141 | },
142 | onReady: function () {
143 | // 页面渲染完成
144 | },
145 | onShow: function () {
146 | this.setData({
147 | orderList:[],
148 | page:1
149 | });
150 | wx.showLoading({
151 | title: '加载中...',
152 | success: function () { }
153 | });
154 | this.getOrderList();
155 | this.getCount();
156 | },
157 | onHide: function () {
158 | // 页面隐藏
159 | },
160 | onUnload: function () {
161 | // 页面关闭
162 | }
163 | })
--------------------------------------------------------------------------------
/pages/customer/cuslist/cuslist.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "客户管理"
3 | }
--------------------------------------------------------------------------------
/pages/customer/cuslist/cuslist.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
20 |
21 |
22 |
23 | 客户名:{{item.uname?item.uname:''}}
24 | 电话:{{item.mobile?item.mobile:''}}
25 |
26 |
27 | 生日:{{item.birthday?item.birthday:''}}
28 | 性别:{{item.gender==1?'男':'女'}}
29 |
30 |
31 |
32 |
33 | 地址:{{item.addressVo.full_region?item.addressVo.full_region:''}}{{item.addressVo.detailInfo?item.addressVo.detailInfo:''}}
34 |
35 | 编辑
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | {{nomoreText}}
45 |
46 |
47 |
48 | {{loadmoreText}}
49 |
50 |
51 |
52 | 新增客户
53 |
54 |
55 |
56 | 无客户信息
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/pages/customer/zcuslist/zcuslist.js:
--------------------------------------------------------------------------------
1 | var app = getApp();
2 | var util = require('../../../utils/util.js');
3 | var api = require('../../../config/api.js');
4 | var user = require('../../../services/user.js');
5 |
6 | Page({
7 | data: {
8 | id:0,
9 | type:null,
10 | userId:0,
11 | userInfo:{}
12 | },
13 | onLoad: function (options) {
14 | var that = this;
15 | if (options.id) {
16 | that.setData({
17 | id: options.id
18 | });
19 | }
20 | if (options.type) {
21 | that.setData({
22 | type: options.type,
23 | });
24 | }
25 | },
26 | onReady: function () {
27 | // 页面渲染完成
28 | },
29 | onShow: function () {
30 |
31 | },
32 | bindGetUserInfo(e) {
33 | let that=this
34 | let token = wx.getStorageSync('token');
35 | wx.showLoading({
36 | title: '加载中',
37 | })
38 | if (token) {
39 | that.setFid()
40 | return false;
41 | }else{
42 | if (e.detail.userInfo) {
43 | //用户按了允许授权按钮
44 | user.loginByWeixin(e.detail).then(res => {
45 | let userInfo = wx.getStorageSync('userInfo');
46 | that.setData({
47 | userInfo: userInfo.userInfo
48 | });
49 | app.globalData.userInfo = userInfo.userInfo;
50 | app.globalData.token = res.data.openid;
51 | that.setFid()
52 | }).catch((err) => {
53 | console.log(err)
54 | });
55 | } else {
56 | //用户按了拒绝按钮
57 | wx.showModal({
58 | title: '警告通知',
59 | content: '您点击了拒绝授权,将无法正常显示个人信息,点击确定重新获取授权。',
60 | success: function (res) {
61 | if (res.confirm) {
62 | wx.openSetting({
63 | success: (res) => {
64 | if (res.authSetting["scope.userInfo"]) {////如果用户重新同意了授权登录
65 | user.loginByWeixin(e.detail).then(res => {
66 | let userInfo = wx.getStorageSync('userInfo');
67 | that.setData({
68 | userInfo: userInfo.userInfo
69 | });
70 | app.globalData.userInfo = userInfo.userInfo;
71 | app.globalData.token = res.data.openid;
72 | that.setFid()
73 | }).catch((err) => {
74 | console.log(err)
75 | });
76 | }
77 | }
78 | })
79 | }
80 | }
81 | });
82 | }
83 | }
84 | },
85 | setFid: function (){
86 | let that = this
87 | if (that.data.id == -1) {
88 | wx.switchTab({
89 | url: '../../index/index'
90 | })
91 | } else if (that.data.id == -2){
92 | wx.switchTab({
93 | url: '../../ucenter/index/index'
94 | })
95 | }else{
96 | wx.navigateTo({
97 | url: '../../goods/goods?id=' + that.data.id+'&type='+that.data.type
98 | })
99 | }
100 | wx.hideLoading()
101 | },
102 | goUrl: function () {
103 | wx.switchTab({
104 | url: '/pages/index/index',
105 | })
106 | },
107 | onHide: function () {
108 | // 页面隐藏
109 | },
110 | onUnload: function () {
111 | // 页面关闭
112 | }
113 | })
--------------------------------------------------------------------------------
/pages/customer/zcuslist/zcuslist.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "获取权限"
3 | }
--------------------------------------------------------------------------------
/pages/customer/zcuslist/zcuslist.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 以下权限
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/pages/customer/zcuslist/zcuslist.wxss:
--------------------------------------------------------------------------------
1 | .container{
2 | background: #ffffff;
3 | }
4 | .cont{
5 | width: 710rpx;
6 | margin: 0 auto;
7 | }
8 | .selinfo{
9 | height: 120rpx;
10 | display: flex;
11 | flex-direction: row;
12 | justify-content: flex-start;
13 | align-items: center;
14 | }
15 | .selinfo .sel{
16 | height: 60rpx;
17 | width: 60rpx;
18 | }
19 | .selinfo label{
20 | width: 650rpx;
21 | color: #666;
22 | margin-left: 20rpx;
23 | }
24 | .tit{
25 | font-size: 30px;
26 | color: #000000;
27 | margin-bottom: 30rpx;
28 | }
29 | .bottom-btn{
30 | margin-top: 500rpx;
31 | }
32 | .bottom-btn button{
33 | width: 350rpx;
34 | height: 80rpx;
35 | line-height: 80rpx;
36 | text-align: center;
37 | color: #ffffff;
38 | background: #E96900;
39 | margin: 0 auto;
40 | }
41 | .bottom-new{
42 | margin-top: 30rpx;
43 | }
44 | .bottom-new button{
45 | width: 350rpx;
46 | height: 80rpx;
47 | line-height: 80rpx;
48 | text-align: center;
49 | background: none;
50 | margin: 0 auto;
51 | border: 1px solid #999;
52 | color: #333;
53 | }
54 |
--------------------------------------------------------------------------------
/pages/goods/goods.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "商品详情",
3 | "usingComponents": {
4 | "count-down-list": "../../component/count-down-list/count-down-list"
5 | }
6 | }
--------------------------------------------------------------------------------
/pages/goods/goods.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | ¥{{goods.price || '0.00'}}
16 | 原价:¥{{goods.originalPrice || '0.00'}}
17 |
18 | 佣金:¥{{goods.user_brokerage_price || '0.00'}}
19 |
20 |
21 |
22 | {{goods.name || ''}}
23 |
24 | {{goods.subTitle}}
25 |
26 |
27 |
30 |
31 |
32 |
33 |
34 | 请选择规格数量
35 |
36 |
37 |
38 |
39 | 商品参数
40 |
41 |
42 | {{item.name}}
43 | {{item.inputList}}
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | 常见问题
58 |
59 |
60 |
61 |
62 |
63 | {{item.question}}
64 |
65 |
66 | {{item.answer}}
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | 价格:¥{{checkedSpecPrice?checkedSpecPrice:goods.price}}
80 |
81 |
82 |
83 |
84 |
85 | {{vitem.spData}}
86 |
87 |
88 | 数量
89 |
90 | -
91 |
92 | +
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 | 首页
104 |
105 |
106 |
107 |
108 |
109 |
110 | {{cartGoodsCount}}
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | const util = require('../../utils/util.js');
2 | const api = require('../../config/api.js');
3 | const user = require('../../services/user.js');
4 |
5 | //获取应用实例
6 | const app = getApp()
7 | Page({
8 | data: {
9 | newGoods: [],
10 | hotGoods: [],
11 | topics1: {},
12 | topics2: {},
13 | topics3: {},
14 | skill: [],
15 | group: [],
16 | brands: [],
17 | floorGoods: [],
18 | banner: [],
19 | channel: [],
20 | goodsCount: 0
21 | },
22 | onShareAppMessage: function () {
23 | // 小程序分享
24 | return {
25 | title: 'TPShop',
26 | desc: 'TP商城',
27 | title: 'TPShop',
28 | desc: 'TP商城',
29 | path: '/pages/index/index'
30 | }
31 | },
32 | onPullDownRefresh() {
33 | // 增加下拉刷新数据的功能
34 | var self = this;
35 | self.getIndexData();
36 | },
37 | //获取首页展示商品数据
38 | getIndexData: function () {
39 | let that = this;
40 | var data = new Object();
41 | //人气商品推荐
42 | util.request(api.IndexUrlHotGoods, {
43 | pageNum: 1,
44 | pageSize: 6
45 | }).then(function (res) {
46 | console.log(res);
47 | if (res.code === 200) {
48 | data.hotGoods = res.data
49 | that.setData(data);
50 | }
51 | });
52 | //首页轮播广告
53 | util.request(api.IndexUrlBanner).then(function (res) {
54 | console.log(res);
55 | if (res.code === 200) {
56 | data.banner = res.data.advertiseList
57 | that.setData(data);
58 | }
59 | });
60 | //获取商品总数
61 | util.request(api.GoodsCount).then(function (res) {
62 | that.setData({
63 | goodsCount: res.data
64 | });
65 | });
66 | },
67 | onLoad: function (options) {
68 | this.getIndexData();
69 | },
70 | onReady: function () {
71 | // 页面渲染完成
72 | },
73 | onShow: function () {
74 | // 页面显示
75 | },
76 | onHide: function () {
77 | // 页面隐藏
78 | },
79 | onUnload: function () {
80 | // 页面关闭
81 | }
82 | })
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "首页",
3 | "usingComponents": {
4 | "index-type-data": "../../component/index-type-data/index-type-data"
5 | }
6 | }
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 商品搜索, 共{{goodsCount}}款好物
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | {{item.name || ''}}
23 |
24 | ¥{{item.price || '0.00'}}
25 |
26 | ¥{{item.originalPrice}}
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/pages/logs/logs.js:
--------------------------------------------------------------------------------
1 | //logs.js
2 | var util = require('../../utils/util.js')
3 | Page({
4 | data: {
5 | logs: []
6 | },
7 | onLoad: function () {
8 | this.setData({
9 | logs: (wx.getStorageSync('logs') || []).map(function (log) {
10 | return util.formatTime(new Date(log))
11 | })
12 | })
13 | }
14 | })
15 |
--------------------------------------------------------------------------------
/pages/logs/logs.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "查看启动日志"
3 | }
--------------------------------------------------------------------------------
/pages/logs/logs.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{index + 1}}. {{log}}
5 |
6 |
7 |
--------------------------------------------------------------------------------
/pages/logs/logs.wxss:
--------------------------------------------------------------------------------
1 | .log-list {
2 | display: flex;
3 | flex-direction: column;
4 | padding: 40rpx;
5 | }
6 | .log-item {
7 | margin: 10rpx;
8 | }
9 |
--------------------------------------------------------------------------------
/pages/pay/pay.js:
--------------------------------------------------------------------------------
1 | var app = getApp();
2 | var util = require('../../utils/util.js');
3 | var api = require('../../config/api.js');
4 |
5 | Page({
6 | data: {
7 | orderId: 0,
8 | actualPrice: 0.00
9 | },
10 | onLoad: function (options) {
11 | // 页面初始化 options为页面跳转所带来的参数
12 | this.setData({
13 | orderId: options.orderId,
14 | actualPrice: options.actualPrice
15 | })
16 | },
17 | onReady: function () {
18 |
19 | },
20 | onShow: function () {
21 | // 页面显示
22 |
23 | },
24 | onHide: function () {
25 | // 页面隐藏
26 |
27 | },
28 | onUnload: function () {
29 | // 页面关闭
30 |
31 | },
32 | //向服务请求支付参数(未完成)
33 | requestPayParam() {
34 | let that = this;
35 | util.request(api.PayPrepayId, { orderId: that.data.orderId, payType: 1 }).then(function (res) {
36 | if (res.errno === 0) {
37 | let payParam = res.data;
38 | wx.requestPayment({
39 | 'timeStamp': payParam.timeStamp,
40 | 'nonceStr': payParam.nonceStr,
41 | 'package': payParam.package,
42 | 'signType': payParam.signType,
43 | 'paySign': payParam.paySign,
44 | 'success': function (res) {
45 | wx.redirectTo({
46 | url: '/pages/payResult/payResult?status=true&orderId=' + that.data.orderId,
47 | })
48 | },
49 | 'fail': function (res) {
50 | wx.redirectTo({
51 | url: '/pages/payResult/payResult?status=false&orderId=' + that.data.orderId,
52 | })
53 | }
54 | })
55 | }
56 | });
57 | },
58 | startPay() {
59 | this.requestPayParam();
60 | }
61 | })
--------------------------------------------------------------------------------
/pages/pay/pay.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "支付订单",
3 | "enablePullDownRefresh": false
4 | }
--------------------------------------------------------------------------------
/pages/pay/pay.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 订单金额
4 | {{actualPrice}}元
5 |
6 |
7 | 请选择支付方式
8 |
9 |
19 |
20 |
21 |
22 | 微信支付
23 |
24 |
25 |
26 | 小程序只支持微信支付,如需其它支付方式,请在网页版支付
27 |
28 | 确定
29 |
--------------------------------------------------------------------------------
/pages/pay/pay.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | min-height: 100%;
3 | width: 100%;
4 | background: #f4f4f4;
5 | }
6 |
7 | .container{
8 | padding-top: 20rpx;
9 | }
10 |
11 | .total{
12 | height: 104rpx;
13 | background: #fff;
14 | width: 100%;
15 | line-height: 104rpx;
16 | padding-left: 30rpx;
17 | padding-right: 30rpx;
18 | }
19 |
20 | .total .label{
21 | float: left;
22 | }
23 |
24 | .total .txt{
25 | float: right;
26 | }
27 |
28 | .pay-list{
29 | margin-top: 30rpx;
30 | height: auto;
31 | width: 100%;
32 | overflow: hidden;
33 | }
34 | .pay-list .h{
35 | width: 100%;
36 | height: 24rpx;
37 | line-height: 24rpx;
38 | margin-left: 31.25rpx;
39 | margin-bottom: 31.25rpx;
40 | }
41 |
42 | .pay-list .item{
43 | height: 108rpx;
44 | padding-left: 31.25rpx;
45 | background: #fff;
46 | display: flex;
47 | align-items: center;
48 | border-bottom: 1px solid #f4f4f4;
49 | }
50 |
51 | .pay-list .checkbox{
52 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -448rpx no-repeat;
53 | background-size: 38rpx 486rpx;
54 | width: 40rpx;
55 | height: 40rpx;
56 | display: inline-block;
57 | vertical-align: middle;
58 | margin-right: 30rpx;
59 | }
60 |
61 | .pay-list .checkbox.checked{
62 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat;
63 | background-size: 38rpx 486rpx;
64 | }
65 |
66 | .pay-list .icon-alipay{
67 | display: inline-block;
68 | vertical-align: middle;
69 | background-image: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/payMethod-s3c1faebee4-d754da9c65.png);
70 | background-repeat: no-repeat;
71 | background-size: 56.25rpx 189.583rpx;
72 | margin-right: 10.5rpx;
73 | width: 56.25rpx;
74 | height: 56.25rpx;
75 | }
76 |
77 | .pay-list .icon-net{
78 | display: inline-block;
79 | vertical-align: middle;
80 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/payMethod-s3c1faebee4-d754da9c65.png) 0 -66.7rpx no-repeat;
81 | background-size: 56.25rpx 189.583rpx;
82 | margin-right: 10.5rpx;
83 | width: 56.25rpx;
84 | height: 56.25rpx;
85 | }
86 |
87 | .pay-list .icon{
88 | display: inline-block;
89 | vertical-align: middle;
90 | margin-right: 10.5rpx;
91 | width: 56.25rpx;
92 | height: 56.25rpx;
93 | }
94 |
95 | .pay-list .name{
96 | display: inline-block;
97 | vertical-align: middle;
98 | height: 56.25rpx;
99 | line-height: 56.25rpx;
100 | }
101 |
102 | .pay-btn{
103 | position: fixed;
104 | left: 0;
105 | bottom: 0;
106 | height: 100rpx;
107 | width: 100%;
108 | text-align: center;
109 | line-height: 100rpx;
110 | background: #b4282d;
111 | color: #fff;
112 | font-size: 30rpx;
113 | }
114 |
115 | .tips{
116 | height: 40rpx;
117 | width: 100%;
118 | font-size: 24rpx;
119 | color: #999;
120 | line-height: 40rpx;
121 | padding-left: 30rpx;
122 | padding-right: 30rpx;
123 | }
--------------------------------------------------------------------------------
/pages/payResult/payResult.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js');
2 | var api = require('../../config/api.js');
3 | const pay = require('../../services/pay.js');
4 |
5 | var app = getApp();
6 | Page({
7 | data: {
8 | status: false,
9 | orderId: 0
10 | },
11 | onLoad: function (options) {
12 | // 页面初始化 options为页面跳转所带来的参数
13 | this.setData({
14 | orderId: options.orderId || 24,
15 | status: options.status
16 | })
17 | this.updateSuccess()
18 | },
19 | onReady: function () {
20 |
21 | },
22 | onShow: function () {
23 | // 页面显示
24 |
25 | },
26 | onHide: function () {
27 | // 页面隐藏
28 |
29 | },
30 | onUnload: function () {
31 | // 页面关闭
32 |
33 | },
34 |
35 | updateSuccess: function () {
36 | let that = this
37 | util.request(api.OrderQuery, { orderId: this.data.orderId}).then(function (res) {
38 | })
39 | },
40 |
41 | payOrder() {
42 | pay.payOrder(parseInt(this.data.orderId)).then(res => {
43 | this.setData({
44 | status: true
45 | });
46 | }).catch(res => {
47 | util.showErrorToast('支付失败');
48 | });
49 | }
50 | })
--------------------------------------------------------------------------------
/pages/payResult/payResult.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "付款结果",
3 | "navigationBarBackgroundColor": "#fafafa"
4 | }
--------------------------------------------------------------------------------
/pages/payResult/payResult.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 付款成功
5 |
6 | 查看订单
7 | 继续逛
8 |
9 |
10 |
11 | 付款失败
12 |
13 | 请在 1小时 内完成付款
14 | 否则订单将会被系统取消
15 |
16 |
17 | 查看订单
18 | 重新付款
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/pages/payResult/payResult.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | min-height: 100%;
3 | width: 100%;
4 | background: #fff;
5 | }
6 |
7 | .container {
8 | height: 100%;
9 | background: #fff;
10 | }
11 |
12 | .pay-result {
13 | background: #fff;
14 | }
15 |
16 | .pay-result .msg {
17 | text-align: center;
18 | margin: 100rpx auto;
19 | color: #2bab25;
20 | font-size: 36rpx;
21 | }
22 |
23 | .pay-result .btns {
24 | display: flex;
25 | align-items: center;
26 | justify-content: center;
27 | }
28 |
29 | .pay-result .btn {
30 | text-align: center;
31 | height: 80rpx;
32 | margin: 0 20rpx;
33 | width: 200rpx;
34 | line-height: 78rpx;
35 | border: 1px solid #868686;
36 | color: #000000;
37 | border-radius: 5rpx;
38 | }
39 |
40 | .pay-result .error .msg {
41 | color: #b4282d;
42 | margin-bottom: 60rpx;
43 | }
44 |
45 | .pay-result .error .tips {
46 | color: #7f7f7f;
47 | margin-bottom: 70rpx;
48 | }
49 |
50 | .pay-result .error .tips .p {
51 | font-size: 24rpx;
52 | line-height: 42rpx;
53 | text-align: center;
54 | }
55 |
56 | .pay-result .error .tips .p {
57 | line-height: 42rpx;
58 | text-align: center;
59 | }
--------------------------------------------------------------------------------
/pages/search/search.js:
--------------------------------------------------------------------------------
1 | var util = require('../../utils/util.js');
2 | var api = require('../../config/api.js');
3 |
4 | var app = getApp()
5 | Page({
6 | data: {
7 | keyword: '',
8 | searchStatus: false,
9 | goodsList: [],
10 | helpKeyword: [],
11 | historyKeyword: [],
12 | categoryFilter: false,
13 | currentSortType: 'default',
14 | currentSortOrder: '',
15 | filterCategory: [],
16 | defaultKeyword: {},
17 | hotKeyword: [],
18 | page: 1,
19 | size: 10,
20 | currentSortType: 'id',
21 | currentSortOrder: 'desc',
22 | categoryId: 0
23 | },
24 | //事件处理函数
25 | //退出搜索
26 | closeSearch: function () {
27 | wx.navigateBack()
28 | },
29 | //清除关键词
30 | clearKeyword: function () {
31 | this.setData({
32 | keyword: '',
33 | searchStatus: false
34 | });
35 | },
36 | onLoad: function () {
37 |
38 | },
39 | //输入有变
40 | inputChange: function (e) {
41 |
42 | this.setData({
43 | keyword: e.detail.value,
44 | searchStatus: false
45 | });
46 | },
47 | inputFocus: function () {
48 | this.setData({
49 | searchStatus: false,
50 | goodsList: []
51 | });
52 |
53 | if (this.data.keyword) {
54 | this.getHelpKeyword();
55 | }
56 | },
57 | //清除搜索历史
58 | clearHistory: function () {
59 | this.setData({
60 | historyKeyword: []
61 | })
62 |
63 | util.request(api.SearchClearHistory, {}, 'POST')
64 | .then(function (res) {
65 | console.log('清除成功');
66 | });
67 | },
68 | //获取搜索结果商品列表
69 | getGoodsList: function () {
70 | let that = this;
71 | util.request(api.SearchResult, {
72 | keyword: that.data.keyword
73 | }).then(function (res) {
74 | if (res.code === 200) {
75 | that.setData({
76 | searchStatus: true,
77 | categoryFilter: false,
78 | goodsList: res.data.list,
79 | filterCategory: res.data.list.productCategoryName,
80 | page: res.data.pageNum,
81 | size: res.data.pageSize,
82 | });
83 | }
84 |
85 | //重新获取关键词
86 | //that.getSearchKeyword();
87 | });
88 | },
89 | onKeywordTap: function (event) {
90 |
91 | this.getSearchResult(event.target.dataset.keyword);
92 |
93 | },
94 | //获取搜索结果
95 | getSearchResult(keyword) {
96 | this.setData({
97 | keyword: keyword,
98 | page: 1,
99 | categoryId: 0,
100 | goodsList: []
101 | });
102 |
103 | this.getGoodsList();
104 | },
105 | //筛选(可根据需要自行开发实现)
106 | /* openSortFilter: function (event) {
107 | let currentId = event.currentTarget.id;
108 | switch (currentId) {
109 | case 'categoryFilter'://类别
110 | this.setData({
111 | 'categoryFilter': !this.data.categoryFilter,
112 | 'currentSortOrder': 'asc'
113 | });
114 | break;
115 | case 'priceSort'://价格区间
116 | let tmpSortOrder = 'asc';
117 | if (this.data.currentSortOrder == 'asc') {
118 | tmpSortOrder = 'desc';
119 | }
120 | this.setData({
121 | 'currentSortType': 'price',
122 | 'currentSortOrder': tmpSortOrder,
123 | 'categoryFilter': false
124 | });
125 |
126 | this.getGoodsList();
127 | break;
128 | default:
129 | //综合排序
130 | this.setData({
131 | 'currentSortType': 'default',
132 | 'currentSortOrder': 'desc',
133 | 'categoryFilter': false
134 | });
135 | this.getGoodsList();
136 | }
137 | },
138 | //按类别筛选
139 | selectCategory: function (event) {
140 | let currentIndex = event.target.dataset.categoryIndex;
141 | let filterCategory = this.data.filterCategory;
142 | let currentCategory = null;
143 | for (let key in filterCategory) {
144 | if (key == currentIndex) {
145 | filterCategory[key].selected = true;
146 | currentCategory = filterCategory[key];
147 | } else {
148 | filterCategory[key].selected = false;
149 | }
150 | }
151 | this.setData({
152 | 'filterCategory': filterCategory,
153 | 'categoryFilter': false,
154 | categoryId: currentCategory.id,
155 | page: 1,
156 | goodsList: []
157 | });
158 | this.getGoodsList();
159 | },*/
160 | onKeywordConfirm(event) {
161 | this.getSearchResult(event.detail.value);
162 | }
163 | })
--------------------------------------------------------------------------------
/pages/search/search.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "搜索",
3 | "enablePullDownRefresh": false
4 | }
--------------------------------------------------------------------------------
/pages/search/search.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 | 历史记录
15 |
16 |
17 |
18 | {{item}}
19 |
20 |
21 |
22 |
23 | 热门搜索
24 |
25 |
26 | {{item.keyword}}
27 |
28 |
29 |
30 | {{item}}
31 |
32 |
33 |
34 |
35 |
36 |
52 |
53 |
54 |
55 |
56 |
57 | {{iitem.name}}
58 |
59 |
60 | ¥{{iitem.price}}
61 | 原价:¥{{iitem.originalPrice}}
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | 您寻找的商品还未上架
71 |
72 |
--------------------------------------------------------------------------------
/pages/shopping/checkout/checkout.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../utils/util.js');
2 | var api = require('../../../config/api.js');
3 | const pay = require('../../../services/pay.js');
4 |
5 | var app = getApp();
6 |
7 | Page({
8 | data: {
9 | checkedGoodsList: [],
10 | checkedAddress: {}, //所选地址
11 | checkedCoupon: [],
12 | couponList: [],
13 | goodsTotalPrice: 0.00, //商品总价
14 | freightPrice: 0.00, //快递费
15 | couponPrice: 0.00, //优惠券的价格
16 | orderTotalPrice: 0.00, //订单总价
17 | actualPrice: 0.00, //实际需要支付的总价
18 | addressId: 0, //地址id
19 | couponId: 0,
20 | isBuy: false,
21 | buyType: '',
22 | couponIdArr: [],
23 | item: {},
24 | type: null,
25 | activityType: 1 //活动类型
26 | },
27 | onLoad: function (options) {
28 | // 页面初始化 options为页面跳转所带来的参数
29 | if (options.isBuy) {
30 | this.setData({
31 | isBuy: options.isBuy
32 | })
33 | }
34 | if (options.addressId) {
35 | this.setData({
36 | addressId: options.addressId
37 | })
38 | }
39 | if (options.type) {
40 | this.setData({
41 | type: options.type
42 | })
43 | }
44 | if (options.activityType) {
45 | this.setData({
46 | activityType: options.activityType
47 | })
48 | }
49 | this.data.buyType = this.data.isBuy ? 'detailBuy' : 'cart'
50 | //每次重新加载界面,清空数据
51 | app.globalData.userCoupon = 'NO_USE_COUPON'
52 | app.globalData.courseCouponCode = {}
53 | },
54 | //获取订单确认信息
55 | getCheckoutInfo: function () {
56 | let that = this;
57 | var url = api.CartCheckout
58 | let buyType = this.data.isBuy ? 'detailBuy' : 'cart'
59 | var sumPrice = 0
60 | let cartIds = wx.getStorageSync('checkedGoods')
61 | util.request(url, cartIds, "POST").then(function (res) {
62 | if (res.code === 200) {
63 | for (var i = 0; i < res.data.cartPromotionItemList.length; i++) {
64 | sumPrice += res.data.cartPromotionItemList[i].price
65 | }
66 | let checkedAddress = {}
67 | if (res.data.memberReceiveAddressList.length > 0) {
68 | checkedAddress = res.data.memberReceiveAddressList[0]
69 | }
70 | that.setData({
71 | checkedGoodsList: res.data.cartPromotionItemList, //所选下单商品信息
72 | checkedAddress: checkedAddress, //所选地址
73 | freightPrice: res.data.calcAmount.freightAmount, //运费
74 | goodsTotalPrice: res.data.calcAmount.totalAmount, //商品总价
75 | orderTotalPrice: res.data.calcAmount.payAmount //订单总价
76 | });
77 | //设置默认收获地址
78 | if (that.data.checkedAddress) {
79 | let addressId = that.data.checkedAddress.id;
80 | if (addressId) {
81 | that.setData({
82 | addressId: addressId
83 | });
84 | }
85 | } else {
86 | wx.showModal({
87 | title: '',
88 | content: '请添加默认收货地址!',
89 | success: function (res) {
90 | if (res.confirm) {
91 | that.selectAddress();
92 | console.log('用户点击确定')
93 | }
94 | }
95 | })
96 | }
97 | }
98 | wx.hideLoading();
99 | });
100 | },
101 | //选择收货地址
102 | selectAddress() {
103 | wx.navigateTo({
104 | url: '/pages/ucenter/address/address',
105 | })
106 | },
107 | addAddress() {
108 | wx.navigateTo({
109 | url: '/pages/ucenter/addressAdd/addressAdd',
110 | })
111 | },
112 | onReady: function () {
113 | // 页面渲染完成
114 |
115 | },
116 | onShow: function () {
117 | wx.showLoading({
118 | title: '加载中...',
119 | })
120 | this.getCheckoutInfo();
121 | },
122 |
123 | onHide: function () {
124 | // 页面隐藏
125 | },
126 | onUnload: function () {
127 | // 页面关闭
128 | },
129 | //支付订单(去付款)(备注:因后台暂未实现微信支付申请相关功能,故此处提交订单暂时只实现跳转到支付订单确认界面,提交订单数据到后台,处于待付款状态,暂未完成实际的支付功能)
130 | payOrder: function () {
131 | let that = this;
132 | let order = that.data.checkedGoodsList;
133 | let payAmount = that.data.goodsTotalPrice;
134 | if (that.data.addressId <= 0) {
135 | util.showErrorToast('请选择收货地址');
136 | return false;
137 | }
138 | wx.showLoading({
139 | title: '提交中'
140 | })
141 | var param = {}
142 | param.memberReceiveAddressId = that.data.addressId
143 | param.cartIds = wx.getStorageSync('checkedGoods')
144 | util.request(api.OrderSubmit, param, 'POST').then(res => {
145 | //提交订单数据到后台
146 | wx.hideLoading()
147 | if (res.code === 200) {
148 | const orderId = res.data.order.id;
149 | pay.payOrder(parseInt(orderId)).then(res => {
150 | wx.redirectTo({
151 | url: '/pages/payResult/payResult?status=1&orderId=' + orderId
152 | }); //因为微信支付需要向腾讯申请,这个功能没有实现
153 | }).catch(res => {
154 | wx.redirectTo({
155 | url: '/pages/payResult/payResult?status=0&orderId=' + orderId
156 | });
157 | });
158 | } else {
159 | util.showErrorToast('下单失败');
160 | }
161 | });
162 | wx.redirectTo({
163 | url: '/pages/pay/pay?orderId=' + order.id + '&actualPrice=' + payAmount,
164 | })
165 | },
166 | })
--------------------------------------------------------------------------------
/pages/shopping/checkout/checkout.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | }
--------------------------------------------------------------------------------
/pages/shopping/checkout/checkout.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{checkedAddress.name}}
7 | 默认
8 |
9 |
10 | {{checkedAddress.phoneNumber}}
11 | {{checkedAddress.city+checkedAddress.detailAddress}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 还没有收货地址,去添加
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | {{item.productName || ''}}
35 | x{{item.quantity || 1}}
36 |
37 | {{item.productAttr||''}}
38 | ¥{{item.price || '0.00'}}
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | 运费
47 |
48 |
49 | ¥{{freightPrice}}
50 |
51 |
52 |
53 |
54 | 商品合计
55 |
56 |
57 | ¥{{goodsTotalPrice}}
58 |
59 |
60 |
61 |
62 |
63 |
64 | 实付:¥{{orderTotalPrice}}
65 |
66 |
67 |
--------------------------------------------------------------------------------
/pages/shopping/selCoupon/selCoupon.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../utils/util.js');
2 | var api = require('../../../config/api.js');
3 |
4 |
5 |
6 | var app = getApp();
7 |
8 | Page({
9 | data: {
10 | couponList: null,
11 | buyType: ''
12 | },
13 | onLoad: function (options) {
14 | this.data.buyType = options.buyType
15 | // this.loadListData()
16 | var merchantId = options.merid;
17 | var goodsTotalPrice = options.price
18 | this.validCouponList(merchantId, goodsTotalPrice)
19 | },
20 |
21 | // loadListData: function () {
22 | // let that = this;
23 | // util.request(api.GoodsCouponList, { type: this.data.buyType }).then(function (res) {
24 | // if (res.errno === 0) {
25 | // that.setData({
26 | // couponList: res.data
27 | // });
28 | // }
29 | // });
30 | // },
31 | validCouponList: function (merchantId, goodsTotalPrice) {
32 | let that = this;
33 | util.request(api.ValidCouponList, { merchantId: merchantId, goodsTotalPrice: goodsTotalPrice }).then(function (res) {
34 | if (res.errno === 0) {
35 | that.setData({
36 | couponList: res.data
37 | });
38 | }
39 | });
40 | },
41 |
42 | /**
43 | * 点击不使用优惠券
44 | * 返回上一页
45 | */
46 | noUseCoupon: function () {
47 | app.globalData.userCoupon = 'NO_USE_COUPON'
48 | wx.navigateBack({
49 | })
50 | },
51 |
52 | tapCoupon: function (event) {
53 | let item = event.currentTarget.dataset.item
54 | if (item.coupon_status!=1) {
55 | return
56 | }
57 | app.globalData.userCoupon = 'USE_COUPON'
58 | app.globalData.courseCouponCode = item
59 | wx.navigateBack({
60 | })
61 | }
62 | })
--------------------------------------------------------------------------------
/pages/shopping/selCoupon/selCoupon.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "选择优惠券",
3 | "usingComponents": {
4 | "show-empty-data": "../../../component/show-empty-data/show-empty-data"
5 | }
6 | }
--------------------------------------------------------------------------------
/pages/shopping/selCoupon/selCoupon.wxml:
--------------------------------------------------------------------------------
1 |
2 | 使用说明
3 |
4 |
5 | 无优惠卷信息
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{item.name}}
13 | 有效期至{{item.use_end_date}}
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 满¥{{item.min_goods_amount}} 减¥{{item.type_money}}
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/pages/shopping/selCoupon/selCoupon.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | background: #f4f4f4;
3 | min-height: 100%;
4 | }
5 |
6 | .container{
7 | background: #f4f4f4;
8 | min-height: 100%;
9 | padding-top: 30rpx;
10 | }
11 |
12 | .not-use {
13 | margin: 30rpx auto 30rpx;
14 | width: 690rpx;
15 | height: 88rpx;
16 | background-color: #f76a1d;
17 | border-radius: 5rpx;
18 | font-size: 32rpx;
19 | font-weight: normal;
20 | font-stretch: normal;
21 | line-height: 0px;
22 | letter-spacing: 0px;
23 | color: #fff;
24 | display: flex;
25 | justify-content: center;
26 | align-items: center;
27 | }
28 |
29 | .coupon-form{
30 | height: 110rpx;
31 | width: 100%;
32 | background: #fff;
33 | padding-left: 30rpx;
34 | padding-right: 30rpx;
35 | padding-top: 20rpx;
36 | display: flex;
37 | }
38 |
39 | .input-box{
40 | flex: 1;
41 | height: 70rpx;
42 | color: #333;
43 | font-size: 24rpx;
44 | background: #fff;
45 | position: relative;
46 | border: 1px solid rgba(0, 0, 0, 0.15);
47 | border-radius: 4rpx;
48 | margin-right: 30rpx;
49 | }
50 |
51 | .input-box .coupon-sn{
52 | position: absolute;
53 | top: 10rpx;
54 | left: 30rpx;
55 | height: 50rpx;
56 | width: 100%;
57 | color: #000;
58 | line-height: 50rpx;
59 | font-size: 24rpx;
60 | }
61 |
62 | .clear-icon{
63 | position: absolute;
64 | top: 21rpx;
65 | right: 30rpx;
66 | width: 28rpx;
67 | height: 28rpx;
68 | }
69 |
70 | .add-btn{
71 | display: flex;
72 | justify-content: center;
73 | align-items: center;
74 | height: 70rpx;
75 | border:none;
76 | width: 168rpx;
77 | background: #b4282d;
78 | border-radius: 0;
79 | line-height: 70rpx;
80 | color: #fff;
81 | font-size: 28rpx;
82 | }
83 |
84 | .add-btn.disabled{
85 | background: #ccc;
86 | }
87 |
88 | .help{
89 | height: 72rpx;
90 | line-height: 72rpx;
91 | text-align: right;
92 | padding-right: 30rpx;
93 | background: url(https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/15032866437ca8.png) 590rpx center no-repeat;
94 | background-size: 28rpx;
95 | color: #999;
96 | font-size: 24rpx;
97 | }
98 |
99 | .coupon-list{
100 | width: 100%;
101 | height: auto;
102 | overflow: hidden;
103 | padding-left: 30rpx;
104 | padding-right: 30rpx;
105 | }
106 |
107 | .item{
108 | position: relative;
109 | height: 290rpx;
110 | width: 100%;
111 | border-radius: 8rpx;
112 | margin-bottom: 30rpx;
113 | padding-top: 52rpx;
114 | }
115 |
116 | .tag{
117 | height: 32rpx;
118 | background: #A48143;
119 | padding-left: 16rpx;
120 | padding-right: 16rpx;
121 | position: absolute;
122 | left: 20rpx;
123 | color: #fff;
124 | top: 20rpx;
125 | font-size: 20rpx;
126 | text-align: center;
127 | line-height: 32rpx;
128 | }
129 |
130 |
131 | .content{
132 | margin-top: 24rpx;
133 | margin-left: 40rpx;
134 | display: flex;
135 | margin-right: 40rpx;
136 | flex-direction: row;
137 | align-items: center;
138 | }
139 |
140 | .content .left{
141 | flex: 1;
142 | }
143 |
144 | .name{
145 | font-size: 44rpx;
146 | color: #fff;
147 | margin-bottom: 14rpx;
148 | }
149 |
150 | .time{
151 | font-size: 24rpx;
152 | color: rgba(255,255,255, 0.8);
153 | line-height: 30rpx;
154 | }
155 |
156 | .content .right{
157 | width: 162rpx;
158 | display: flex;
159 | justify-content: center;
160 | align-items: center;
161 | }
162 |
163 | .content .right .mid-img {
164 | width: 100rpx;
165 | height: 100rpx;
166 | }
167 |
168 | .condition{
169 | position: absolute;
170 | width: 100%;
171 | bottom: 0;
172 | left:0;
173 | height: 78rpx;
174 | background: rgba(0,0,0,.08);
175 | padding: 24rpx 40rpx;
176 | display: flex;
177 | flex-direction: row;
178 | }
179 |
180 | .condition .txt{
181 | display: block;
182 | height: 30rpx;
183 | flex: 1;
184 | overflow: hidden;
185 | font-size: 24rpx;
186 | line-height: 30rpx;
187 | color: #fff;
188 | }
189 |
190 |
191 | .condition .icon{
192 | margin-left: 30rpx;
193 | width: 24rpx;
194 | height: 24rpx;
195 | }
--------------------------------------------------------------------------------
/pages/spike/spike.js:
--------------------------------------------------------------------------------
1 | // pages/spike/spike.js
2 | var util = require('../../utils/util.js');
3 | var api = require('../../config/api.js');
4 | Page({
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | spikeList: [],
10 | page: 1,
11 | size: 10,
12 | loadmoreText: '正在加载更多数据',
13 | nomoreText: '全部加载完成',
14 | nomore: false,
15 | totalPages: 1
16 | },
17 | onShareAppMessage: function () {
18 | return {
19 | title: '秒杀更优惠',
20 | desc: '秒杀更优惠',
21 | path: 'pages/spike/spike'
22 | }
23 | },
24 | /**
25 | * 生命周期函数--监听页面加载
26 | */
27 | onLoad: function (options) {
28 |
29 | },
30 |
31 | /**
32 | * 生命周期函数--监听页面初次渲染完成
33 | */
34 | onReady: function () {
35 |
36 | },
37 | /**
38 | * 页面上拉触底事件的处理函数
39 | */
40 | onReachBottom: function () {
41 | this.getSpikeList()
42 | },
43 | onPullDownRefresh() {
44 | // 增加下拉刷新数据的功能
45 | wx.showNavigationBarLoading();
46 | var self = this;
47 | self.setData({
48 | spikeList: [],
49 | page: 1,
50 | totalPages: 1
51 | });
52 | self.getSpikeList();
53 | },
54 | goDetail(e) {
55 | console.log("====:", e.target.dataset.id)
56 | var id = e.target.dataset.id
57 | wx.navigateTo({
58 | url: '../goods/goods?id=' + id + '&type=2'
59 | })
60 | },
61 | /**
62 | * 生命周期函数--监听页面显示
63 | */
64 | onShow: function () {
65 | this.getSpikeList()
66 | },
67 | getSpikeList() {
68 | let that = this;
69 | if (that.data.totalPages <= that.data.page - 1) {
70 | that.setData({
71 | nomore: true
72 | })
73 | return;
74 | }
75 | util.request(api.KillList, { page: that.data.page, size: that.data.size }).then(function (res) {
76 | if (res.errno === 0) {
77 | that.setData({
78 | spikeList: that.data.spikeList.concat(res.data.data),
79 | page: res.data.currentPage + 1,
80 | totalPages: res.data.totalPages
81 | });
82 | wx.hideLoading();
83 | }
84 | wx.hideNavigationBarLoading() //完成停止加载
85 | wx.stopPullDownRefresh() //停止下拉刷新
86 | });
87 | },
88 | /**
89 | * 生命周期函数--监听页面隐藏
90 | */
91 | onHide: function () {
92 |
93 | },
94 |
95 | /**
96 | * 生命周期函数--监听页面卸载
97 | */
98 | onUnload: function () {
99 |
100 | },
101 |
102 | /**
103 | * 页面相关事件处理函数--监听用户下拉动作
104 | */
105 | onPullDownRefresh: function () {
106 |
107 | },
108 |
109 | /**
110 | * 页面上拉触底事件的处理函数
111 | */
112 | onReachBottom: function () {
113 |
114 | },
115 |
116 | /**
117 | * 用户点击右上角分享
118 | */
119 | onShareAppMessage: function () {
120 |
121 | }
122 | })
--------------------------------------------------------------------------------
/pages/spike/spike.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "限时秒杀"
3 | }
--------------------------------------------------------------------------------
/pages/spike/spike.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{item.name}}
10 |
11 |
12 |
13 | ¥{{item.retail_price}}
14 | 原价:¥{{item.market_price}}
15 |
16 |
17 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | {{nomoreText}}
28 |
29 |
30 |
31 | {{loadmoreText}}
32 |
33 |
34 |
35 |
36 |
37 | 无订单数据
38 |
39 |
--------------------------------------------------------------------------------
/pages/spike/spike.wxss:
--------------------------------------------------------------------------------
1 | /* pages/spike/spike.wxss */
2 | page{
3 | background: #F5F5F5;
4 | }
5 | .content {
6 | display: flex;
7 | width: 750rpx;
8 | flex-direction: column;
9 | align-items: center;
10 | background: #F5F5F5;
11 | }
12 | .goods .goodinfo{
13 | width: 750rpx;
14 | height: 300rpx;
15 | background: #FFFFFF;
16 | margin-top: 6rpx;
17 | padding: 20rpx 0;
18 | }
19 | .goods .goodinfo .cont{
20 | width: 710rpx;
21 | height: 100%;
22 | margin: 0 auto;
23 | display: flex;
24 | flex-flow: row nowrap;
25 | justify-content: flex-start;
26 | align-items: center;
27 | }
28 | .goods .goodinfo .cont .proimg{
29 | height: 250rpx;
30 | width: 250rpx;
31 | background: #ccc;
32 | }
33 | .proimg image{
34 | height: 100%;
35 | width: 100%;
36 | }
37 | .goods .goodinfo .cont .proinfo{
38 | width: 460rpx;
39 | height: 100%;
40 | display: flex;
41 | flex-direction: column;
42 | justify-content: center;
43 | align-items: flex-start;
44 | }
45 | .goods .goodinfo .cont .proinfo .m{
46 | margin-left: 20rpx;
47 | margin-top: 10rpx;
48 | }
49 | .tit{
50 | font-size: 16px;
51 | color: #000000;
52 | }
53 | .des{
54 | color: #999;
55 | font-size: 13px;
56 | }
57 | .price{
58 | font-size: 18px;
59 | color: #fd585c;
60 | }
61 | .priinfo label{
62 | margin-right: 20rpx;
63 | }
64 | .priinfo .line{
65 | text-decoration:line-through;
66 | color: #999;
67 | margin-left: 20rpx;
68 | }
69 | .goods .goodinfo .cont .proinfo .opt{
70 | display: flex;
71 | flex-flow: row nowrap;
72 | justify-content: flex-start;
73 | align-items: center;
74 | position: relative;
75 | }
76 | .goods .goodinfo .cont .proinfo .opt button{
77 | height: 26px;
78 | line-height: 26px;
79 | border: none;
80 | font-size: 13px;
81 | padding: 0 25rpx;
82 | color: #FFFFFF;
83 | }
84 | .goods .goodinfo .cont .proinfo .opt .qg{
85 | background: #fe5858;
86 | }
87 | .goods .goodinfo .cont .proinfo .opt .sx{
88 | background: #ccc;
89 | }
90 | .stock,.yq{
91 | min-width: 200rpx;
92 | height: 26px;
93 | border-radius: 26upx;
94 | margin-left: 20rpx;
95 | text-align: center;
96 | line-height: 26px;
97 | }
98 | .goods .goodinfo .cont .proinfo .opt .stock{
99 | border: 1px solid #fd5868;
100 | background: #ffe7e7;
101 | color: #fd5868;
102 | }
103 | .goods .goodinfo .cont .proinfo .opt .yq{
104 | border: 1px solid #666;
105 | color: #666;
106 | background: #FFFFFF;
107 | }
--------------------------------------------------------------------------------
/pages/ucenter/address/address.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../utils/util.js');
2 | var api = require('../../../config/api.js');
3 | var app = getApp();
4 |
5 | Page({
6 | data: {
7 | addressList: [],
8 | },
9 | onLoad: function (options) {
10 | // 页面初始化 options为页面跳转所带来的参数
11 | },
12 | onReady: function () {
13 | // 页面渲染完成
14 | },
15 | onShow: function () {
16 | // 页面显示
17 | this.getAddressList();
18 | },
19 | //获取地址列表
20 | getAddressList() {
21 | let that = this;
22 | util.request(api.AddressList).then(function (res) {
23 | if (res.code === 200) {
24 | that.setData({
25 | addressList: res.data
26 | });
27 | }
28 | });
29 | },
30 | //添加地址或修改地址
31 | addressAddOrUpdate(event) {
32 | console.log(event)
33 | wx.navigateTo({
34 | url: '/pages/ucenter/addressAdd/addressAdd?id=' + event.currentTarget.dataset.addressId
35 | })
36 | },
37 | //删除地址
38 | deleteAddress(event) {
39 | console.log(event.target)
40 | let that = this;
41 | wx.showModal({
42 | title: '',
43 | content: '确定要删除地址?',
44 | success: function (res) {
45 | if (res.confirm) {
46 | let addressId = event.target.dataset.addressId;
47 | util.request(api.AddressDelete + addressId, {}, 'POST').then(function (res) {
48 | if (res.code === 200) {
49 | that.getAddressList();
50 | }
51 | });
52 | }
53 | }
54 | })
55 | return false;
56 | },
57 | onHide: function () {
58 | // 页面隐藏
59 | },
60 | onUnload: function () {
61 | // 页面关闭
62 | }
63 | })
--------------------------------------------------------------------------------
/pages/ucenter/address/address.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "地址管理",
3 | "enablePullDownRefresh": false
4 | }
--------------------------------------------------------------------------------
/pages/ucenter/address/address.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{item.userName}}
6 | 默认
7 |
8 |
9 | {{item.phoneNumber}}
10 | {{item.city+item.detailAddress}}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 收货地址在哪里
20 |
21 | 添加
22 |
--------------------------------------------------------------------------------
/pages/ucenter/address/address.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | height: 100%;
3 | width: 100%;
4 | background: #f4f4f4;
5 | }
6 | .empty-view{
7 | margin-top: 0;
8 | }
9 |
10 | .container{
11 | height: 100%;
12 | width: 100%;
13 | }
14 |
15 | .address-list{
16 | padding-left: 31.25rpx;
17 | background: #fff url(https://shop.51shop.ink/statics/icon/address.png) 0 0 repeat-x;
18 | background-size: auto 10.5rpx;
19 | margin-bottom: 90rpx;
20 | padding-bottom: 100rpx;
21 | }
22 |
23 | .address-list .item{
24 | height: 156.55rpx;
25 | align-items: center;
26 | display: flex;
27 | border-top: 1rpx solid #DCD9D9;
28 | }
29 | .address-list .item:nth-child(1){
30 | border-top:none;
31 | }
32 |
33 | .address-list .l{
34 | width: 155rpx;
35 | height: 80rpx;
36 | overflow: hidden;
37 | }
38 |
39 | .address-list .name{
40 | width: 155rpx;
41 | height: 43rpx;
42 | font-size: 29rpx;
43 | color: #333;
44 | margin-bottom: 5.2rpx;
45 | text-overflow: ellipsis;
46 | white-space: nowrap;
47 | overflow: hidden;
48 | }
49 |
50 | .address-list .default{
51 | width: 62.5rpx;
52 | height: 33rpx;
53 | line-height: 28rpx;
54 | text-align: center;
55 | font-size: 20rpx;
56 | color: #b4282d;
57 | border: 1rpx solid #b4282d;
58 | visibility: visible;
59 | }
60 |
61 |
62 | .address-list .c{
63 | flex: 1;
64 | height: auto;
65 | overflow: hidden;
66 | }
67 |
68 | .address-list .mobile{
69 |
70 | height: 29rpx;
71 | font-size: 29rpx;
72 | line-height: 29rpx;
73 | overflow: hidden;
74 | color: #333;
75 | margin-bottom: 6.25rpx;
76 | }
77 |
78 | .address-list .address{
79 | height: 37rpx;
80 | font-size: 25rpx;
81 | line-height: 37rpx;
82 | overflow: hidden;
83 | color: #666;
84 | }
85 |
86 | .address-list .r{
87 | width: 52rpx;
88 | height: auto;
89 | overflow: hidden;
90 | margin-right: 16.5rpx;
91 | }
92 |
93 | .address-list .del{
94 | display: block;
95 | width: 52rpx;
96 | height: 52rpx;
97 | }
98 |
99 | .add-address{
100 | background: #b4282d;
101 | text-align: center;
102 | width: 100%;
103 | height: 99rpx;
104 | line-height: 99rpx;
105 | position: fixed;
106 | border-radius: 0;
107 | border: none;
108 | color: #fff;
109 | font-size: 29rpx;
110 | bottom: 0;
111 | left:0;
112 | }
113 |
114 | .empty-view{
115 | height: 100%;
116 | width: 100%;
117 | display: flex;
118 | flex-direction: column;
119 | align-items: center;
120 | justify-content: center;
121 | }
122 |
123 | .empty-view .icon{
124 | height: 248rpx;
125 | width: 258rpx;
126 | margin-bottom: 10rpx;
127 | }
128 |
129 | .empty-view .text{
130 | width: auto;
131 | font-size: 28rpx;
132 | line-height: 35rpx;
133 | color: #999;
134 | }
--------------------------------------------------------------------------------
/pages/ucenter/addressAdd/addressAdd.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "新增地址"
3 | }
--------------------------------------------------------------------------------
/pages/ucenter/addressAdd/addressAdd.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{region[0]}},{{region[1]}},{{region[2]}}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 设为默认地址
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/pages/ucenter/addressAdd/addressAdd.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | height: 100%;
3 | background: #f4f4f4;
4 | }
5 | .add-address .add-form{
6 | background: #fff;
7 | width: 100%;
8 | height: auto;
9 | overflow: hidden;
10 | }
11 |
12 | .add-address .form-item{
13 | height: 116rpx;
14 | padding-left: 31.25rpx;
15 | border-bottom: 1px solid #d9d9d9;
16 | display: flex;
17 | align-items: center;
18 | padding-right: 31.25rpx;
19 | }
20 |
21 | .add-address .input{
22 | flex: 1;
23 | height: 44rpx;
24 | line-height: 44rpx;
25 | overflow: hidden;
26 | }
27 |
28 | .add-address .form-default{
29 | border-bottom: 1px solid #d9d9d9;
30 | height: 96rpx;
31 | background: #fafafa;
32 | padding-top: 28rpx;
33 | font-size: 28rpx;
34 | }
35 |
36 | .default-input{
37 | margin: 0 auto;
38 | display: block;
39 | width: 240rpx;
40 | height: 40rpx;
41 | padding-left: 50rpx;
42 | line-height: 40rpx;
43 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 1rpx -448rpx no-repeat;
44 | background-size: 38rpx 486rpx;
45 | font-size: 28rpx;
46 | }
47 |
48 | .default-input.selected{
49 | background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat;
50 | background-size: 38rpx 486rpx;
51 | }
52 |
53 | .add-address .btns{
54 | position: fixed;
55 | bottom: 0;
56 | left: 0;
57 | overflow: hidden;
58 | display: flex;
59 | height: 100rpx;
60 | width: 100%;
61 | }
62 |
63 | .add-address .cannel,.add-address .save{
64 | flex: 1;
65 | height: 100rpx;
66 | text-align: center;
67 | line-height: 100rpx;
68 | font-size: 28rpx;
69 | color: #fff;
70 | border:none;
71 | border-radius: 0;
72 | }
73 |
74 | .add-address .cannel{
75 | background: #e6af58;
76 | }
77 |
78 | .add-address .save{
79 | background: #b4282d;
80 | }
81 |
82 |
83 | .region-select{
84 | width: 100%;
85 | height: 600rpx;
86 | background: #fff;
87 | position: fixed;
88 | z-index: 10;
89 | left:0;
90 | bottom: 0;
91 | }
92 |
93 | .region-select .hd{
94 | height: 108rpx;
95 | width: 100%;
96 | border-bottom: 1px solid #f4f4f4;
97 | padding: 46rpx 30rpx 0 30rpx;
98 | }
99 |
100 | .region-select .region-selected{
101 | float: left;
102 | height: 60rpx;
103 | display: flex;
104 | }
105 |
106 | .region-select .region-selected .item{
107 | max-width: 140rpx;
108 | margin-right: 30rpx;
109 | text-align: left;
110 | line-height: 60rpx;
111 | height: 100%;
112 | color: #333;
113 | font-size: 28rpx;
114 | overflow: hidden;
115 | text-overflow: ellipsis;
116 | white-space: nowrap;
117 | }
118 |
119 | .region-select .region-selected .item.disabled{
120 | color: #999;
121 | }
122 |
123 | .region-select .region-selected .item.selected{
124 | color: #b4282d;
125 | }
126 |
127 | .region-select .done{
128 | float: right;
129 | height: 60rpx;
130 | width: 60rpx;
131 | border: none;
132 | background: #fff;
133 | line-height: 60rpx;
134 | text-align: center;
135 | color: #333;
136 | font-size: 28rpx;
137 | }
138 |
139 | .region-select .done.disabled{
140 | color: #999;
141 | }
142 |
143 |
144 |
145 | .region-select .bd{
146 | height: 492rpx;
147 | width: 100%;
148 | padding: 0 30rpx;
149 | }
150 |
151 | .region-select .region-list{
152 | height: auto;
153 | overflow: scroll;
154 |
155 | }
156 |
157 | .region-select .region-list .item{
158 | width: 100%;
159 | height: 104rpx;
160 | line-height: 104rpx;
161 | text-align: left;
162 | color: #333;
163 | font-size: 28rpx;
164 | }
165 |
166 | .region-select .region-list .item.selected{
167 | color: #b4282d;
168 | }
169 |
170 |
171 | .bg-mask{
172 | height: 100%;
173 | width: 100%;
174 | background: rgba(0, 0, 0, 0.4);
175 | position: fixed;
176 | top:0;
177 | left:0;
178 | z-index: 8;
179 | }
180 |
--------------------------------------------------------------------------------
/pages/ucenter/feedback/feedback.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../utils/util.js');
2 | var api = require('../../../config/api.js');
3 |
4 |
5 |
6 | var app = getApp();
7 |
8 | Page({
9 | data: {
10 | array: ['请选择反馈类型', '商品相关', '物流状况', '客户服务', '优惠活动', '功能异常', '产品建议', '其他'],
11 | index: 0,
12 | content: '',
13 | contentLength: 0,
14 | mobile: ''
15 | },
16 | bindPickerChange: function (e) {
17 | this.setData({
18 | index: e.detail.value
19 | });
20 | },
21 | mobileInput: function (e) {
22 | let that = this;
23 | this.setData({
24 | mobile: e.detail.value,
25 | });
26 | console.log(that.data.mobile);
27 | },
28 | contentInput: function (e) {
29 |
30 | let that = this;
31 | this.setData({
32 | contentLength: e.detail.cursor,
33 | content: e.detail.value,
34 | });
35 | console.log(that.data.content);
36 | },
37 | cleanMobile: function () {
38 | let that = this;
39 |
40 | },
41 | sbmitFeedback: function (e) {
42 | let that = this;
43 | if (that.data.index == 0) {
44 | util.showErrorToast('请选择反馈类型');
45 | return false;
46 | }
47 |
48 | if (that.data.content == '') {
49 | util.showErrorToast('请输入反馈内容');
50 | return false;
51 | }
52 |
53 | if (that.data.mobile == '') {
54 | util.showErrorToast('请输入手机号码');
55 | return false;
56 | }
57 | if (!util.validatePhone(that.data.mobile)) {
58 | util.showErrorToast('请输入正确手机号码');
59 | return false;
60 | }
61 | wx.showLoading({
62 | title: '提交中...',
63 | mask: true,
64 | success: function () {
65 |
66 | }
67 | });
68 |
69 | util.request(api.FeedbackAdd, {
70 | tel: that.data.mobile.toString(),
71 | type: that.data.index.toString(),
72 | desc: that.data.content
73 | }, 'POST').then(function (res) {
74 | if (res.code === 200) {
75 | console.log(res.data);
76 |
77 | wx.hideLoading();
78 |
79 | wx.showToast({
80 | title: res.data,
81 | icon: 'success',
82 | duration: 2000,
83 | complete: function () {
84 | console.log('重新加载');
85 | that.setData({
86 | index: 0,
87 | content: '',
88 | contentLength: 0,
89 | mobile: ''
90 | });
91 | }
92 | });
93 | } else {
94 | util.showErrorToast(res.data);
95 | }
96 |
97 | });
98 | },
99 | onLoad: function (options) {},
100 | onReady: function () {
101 |
102 | },
103 | onShow: function () {
104 |
105 | },
106 | onHide: function () {
107 | // 页面隐藏
108 |
109 | },
110 | onUnload: function () {
111 | // 页面关闭
112 | }
113 | })
--------------------------------------------------------------------------------
/pages/ucenter/feedback/feedback.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "意见反馈",
3 | "enablePullDownRefresh": false
4 | }
--------------------------------------------------------------------------------
/pages/ucenter/feedback/feedback.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{array[index]}}
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | {{contentLength}}/500
15 |
16 |
17 | 手机号码
18 |
19 |
20 |
21 |
22 |
23 | 提交
24 |
--------------------------------------------------------------------------------
/pages/ucenter/feedback/feedback.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | background: #f4f4f4;
3 | min-height: 100%;
4 | }
5 |
6 | .container{
7 | background: #f4f4f4;
8 | min-height: 100%;
9 | padding-top: 30rpx;
10 | }
11 |
12 | .fb-type{
13 | height: 104rpx;
14 | width: 100%;
15 | background: #fff;
16 | margin-bottom: 20rpx;
17 | display: flex;
18 | flex-direction: row;
19 | align-items: center;
20 | padding-left: 30rpx;
21 | padding-right: 30rpx;
22 | }
23 |
24 | .fb-type .type-label{
25 | height: 36rpx;
26 | flex: 1;
27 | color: #333;
28 | font-size: 28rpx;
29 | }
30 |
31 | .fb-type .type-icon{
32 | height: 36rpx;
33 | width: 36rpx;
34 | }
35 |
36 | .fb-body{
37 | width: 100%;
38 | background: #fff;
39 | height: 374rpx;
40 | padding: 18rpx 30rpx 64rpx 30rpx;
41 | }
42 |
43 | .fb-body .content{
44 | width: 100%;
45 | height: 100%;
46 | color: #333;
47 | line-height: 40rpx;
48 | font-size: 28rpx;
49 | }
50 |
51 | .fb-body .text-count{
52 | padding-top: 17rpx;
53 | line-height: 30rpx;
54 | float: right;
55 | color: #666;
56 | font-size: 24rpx;
57 | }
58 |
59 | .fb-mobile{
60 | height: 162rpx;
61 | width: 100%;
62 | }
63 |
64 | .fb-mobile .label{
65 | height: 58rpx;
66 | width: 100%;
67 | padding-top: 14rpx;
68 | padding-bottom: 11rpx;
69 | color: #7f7f7f;
70 | font-size: 24rpx;
71 | padding-left: 30rpx;
72 | padding-right: 30rpx;
73 | line-height: 33rpx;
74 | }
75 |
76 | .fb-mobile .mobile-box{
77 | height: 104rpx;
78 | width: 100%;
79 | color: #333;
80 | padding-left: 30rpx;
81 | padding-right: 30rpx;
82 | font-size: 24rpx;
83 | background: #fff;
84 | position: relative;
85 | }
86 |
87 | .fb-mobile .mobile{
88 | position: absolute;
89 | top: 27rpx;
90 | left: 30rpx;
91 | height: 50rpx;
92 | width: 100%;
93 | color: #333;
94 | line-height: 50rpx;
95 | font-size: 24rpx;
96 | }
97 |
98 | .clear-icon{
99 | position: absolute;
100 | top: 43rpx;
101 | right: 30rpx;
102 | width: 28rpx;
103 | height: 28rpx;
104 | }
105 |
106 | .fb-btn{
107 | display: flex;
108 | justify-content: center;
109 | align-items: center;
110 | width: 100%;
111 | height: 98rpx;
112 | line-height: 98rpx;
113 | background: #b4282d;
114 | position: fixed;
115 | bottom: 0;
116 | left: 0;
117 | border-radius: 0;
118 | color: #fff;
119 | font-size: 28rpx;
120 | }
--------------------------------------------------------------------------------
/pages/ucenter/index/index.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../utils/util.js');
2 | var api = require('../../../config/api.js');
3 | var user = require('../../../services/user.js');
4 | var app = getApp();
5 |
6 | Page({
7 | data: {
8 | userInfo: {},
9 | hasMobile: '',
10 | fUser: {},
11 | commission: {
12 | allProfit: 0,
13 | getProfit: 0
14 | },
15 | isshow: false
16 | },
17 | onLoad: function (options) {
18 | // 页面初始化 options为页面跳转所带来的参数
19 | console.log('----dd----', app.globalData)
20 | },
21 | onReady: function () {
22 |
23 | },
24 | onShow: function () {
25 | let userInfo = wx.getStorageSync('userInfo');
26 | let token = wx.getStorageSync('token');
27 | // 页面显示
28 | if (token) {
29 | this.setData({
30 | isshow: true
31 | });
32 | app.globalData.userInfo = userInfo.userInfo;
33 | app.globalData.token = token;
34 | } else {
35 | wx.redirectTo({
36 | url: '../../customer/zcuslist/zcuslist?id=-2'
37 | })
38 | wx.removeStorageSync('userInfo');
39 | }
40 | this.setData({
41 | userInfo: app.globalData.userInfo
42 | });
43 |
44 | },
45 | noLogin() {
46 | console.log('-----*noLogin*******---------', wx.getStorageSync('token'))
47 | if (!wx.getStorageSync('token')) {
48 | console.log("}}}}}}")
49 | wx.showToast({
50 | title: '请先登录~',
51 | icon: 'none',
52 | duration: 2000
53 | })
54 | return false;
55 | }
56 | },
57 | onHide: function () {
58 | // 页面隐藏
59 | },
60 | onUnload: function () {
61 | // 页面关闭
62 | },
63 | onShareAppMessage: function () {
64 | this.noLogin();
65 | return {
66 | title: '邀请好友',
67 | path: 'pages/product/product?id=-1&userId=' + wx.getStorageSync('uId')
68 | }
69 | },
70 | //用户授权登录,获取用户登录信息
71 | bindGetUserInfo(e) {
72 | let token = wx.getStorageSync('token');
73 | if (token) {
74 | return false;
75 | }
76 | if (e.detail.userInfo) {
77 | //用户按了允许授权按钮
78 | user.loginByWeixin(e.detail).then(res => {
79 | let userInfo = wx.getStorageSync('userInfo');
80 | this.setData({
81 | userInfo: userInfo.userInfo,
82 | isshow: true
83 | });
84 | app.globalData.userInfo = userInfo.userInfo;
85 | app.globalData.token = res.data.openid;
86 | }).catch((err) => {
87 | console.log(err)
88 | });
89 | } else {
90 | //用户按了拒绝按钮
91 | wx.showModal({
92 | title: '警告通知',
93 | content: '您点击了拒绝授权,将无法正常显示个人信息,点击确定重新获取授权。',
94 | success: function (res) {
95 | if (res.confirm) {
96 | wx.openSetting({
97 | success: (res) => {
98 | if (res.authSetting["scope.userInfo"]) { ////如果用户重新同意了授权登录
99 | user.loginByWeixin(e.detail).then(res => {
100 | let userInfo = wx.getStorageSync('userInfo');
101 | this.setData({
102 | userInfo: userInfo.userInfo,
103 | isshow: true
104 | });
105 | app.globalData.userInfo = userInfo.userInfo;
106 | app.globalData.token = res.data.openid;
107 | }).catch((err) => {
108 | console.log(err)
109 | });
110 | }
111 | }
112 | })
113 | }
114 | }
115 | });
116 | }
117 | },
118 | //退出登录
119 | exitLogin: function () {
120 | let that = this
121 | wx.showModal({
122 | title: '',
123 | confirmColor: '#b4282d',
124 | content: '退出登录?',
125 | success: function (res) {
126 | console.log("------:", res)
127 | if (res.confirm) {
128 | wx.removeStorageSync('token');
129 | wx.removeStorageSync('userInfo');
130 | wx.removeStorageSync('userId');
131 | app.globalData.userInfo = {}
132 | that.setData({
133 | userInfo: {},
134 | });
135 | wx.switchTab({
136 | url: '/pages/index/index'
137 | });
138 | }
139 | }
140 | })
141 |
142 | }
143 | })
--------------------------------------------------------------------------------
/pages/ucenter/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "我的",
3 | "enablePullDownRefresh": false
4 | }
--------------------------------------------------------------------------------
/pages/ucenter/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 |
15 |
16 | 我的订单
17 |
18 | 查看全部订单
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | 待付款
30 |
31 |
32 |
33 |
34 |
35 |
36 | 待发货
37 |
38 |
39 |
40 |
41 |
42 |
43 | 待收货
44 |
45 |
46 |
47 |
48 |
49 |
50 | 退货/退款
51 |
52 |
53 |
54 |
55 |
56 |
89 | 退出登录
90 |
--------------------------------------------------------------------------------
/pages/ucenter/order/order.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "订单管理"
3 | }
--------------------------------------------------------------------------------
/pages/ucenter/order/order.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 | {{goodsItem.productName}}
30 |
31 |
32 |
33 |
34 |
35 | 共{{goodsItem.productQuantity}}件商品 需付款:¥{{item.payAmount}}
36 |
37 |
38 |
39 | 去付款
40 | 取消订单
41 | 确认收货
42 | 再次购买
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | {{nomoreText}}
52 |
53 |
54 |
55 | {{loadmoreText}}
56 |
57 |
58 |
59 |
60 |
61 | 无订单数据
62 |
63 |
--------------------------------------------------------------------------------
/pages/ucenter/orderDetail/orderDetail.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "订单详情",
3 | "enablePullDownRefresh": false
4 | }
--------------------------------------------------------------------------------
/pages/ucenter/orderDetail/orderDetail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 下单时间:{{orderInfo.createTime}}
5 | 订单编号:{{orderInfo.orderSn}}
6 | 物流公司:{{orderInfo.shipping_name}}
7 | 物流编号:{{orderInfo.shipping_no}}
8 |
9 | 实付:¥{{orderInfo.payAmount}}
10 |
11 |
12 | 取消订单
13 | 去付款
14 |
15 |
16 | 取消订单
17 | 确认收货
18 |
19 |
20 | 取消订单
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | 商品信息
29 | 待付款
30 | 待发货
31 | 待收货
32 | 已完成
33 | 已取消
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | {{item.productName}}
43 | x{{item.productQuantity}}
44 |
45 | {{item.productAttr||''}}
46 | ¥{{item.productPrice}}
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | {{orderInfo.receiverName}}
56 | {{orderInfo.receiverPhone}}
57 |
58 | {{orderInfo.receiverDetailAddress}}
59 |
60 |
61 |
62 | 商品合计:
63 | ¥{{orderInfo.totalAmount}}
64 |
65 |
66 | 运费:
67 | ¥{{orderInfo.freightAmount}}
68 |
69 |
70 |
71 | 实付:
72 | ¥{{orderInfo.payAmount}}
73 |
74 |
75 |
--------------------------------------------------------------------------------
/pages/ucenter/return/return.js:
--------------------------------------------------------------------------------
1 | var util = require('../../../utils/util.js');
2 | var api = require('../../../config/api.js');
3 |
4 | Page({
5 | data: {
6 | orderId: '',
7 | orderList: [],
8 | page: 1,
9 | size: 10,
10 | loadmoreText: '正在加载更多数据',
11 | nomoreText: '全部加载完成',
12 | nomore: false,
13 | totalPages: 1
14 | },
15 | onLoad: function (options) {
16 | // 页面初始化 options为页面跳转所带来的参数
17 | // 页面显示
18 | // 页面初始化 options为页面跳转所带来的参数
19 | this.setData({
20 | orderId: options.id
21 | });
22 | console.log(options)
23 | wx.showLoading({
24 | title: '加载中...',
25 | success: function () {
26 |
27 | }
28 | });
29 | this.getOrderList();
30 | },
31 |
32 | // switchCate: function (event) {
33 | // var currentTarget = event.currentTarget;
34 | // this.setData({
35 | // orderId: currentTarget.dataset.id,
36 | // totalPages: 1,
37 | // page: 1,
38 | // orderList: []
39 | // });
40 | // console.log(this.data.orderId)
41 | // this.getOrderList();
42 | // },
43 |
44 | /**
45 | * 页面上拉触底事件的处理函数
46 | */
47 | onReachBottom: function () {
48 | console.log("下一页")
49 | this.getOrderList()
50 | },
51 |
52 | getOrderList() {
53 | let that = this;
54 |
55 | if (that.data.totalPages <= that.data.page - 1) {
56 | that.setData({
57 | nomore: true
58 | })
59 | return;
60 | }
61 | that.data.orderId = that.data.orderId == -1 ? "" : that.data.orderId;
62 | util.request(api.OrderList, {status: that.data.orderId}).then(function (res) {
63 | if (res.code === 200) {
64 | console.log(res.data);
65 | that.setData({
66 | orderList: res.data.list, //concat(res.data.data)
67 | page: res.data.pageNum + 1,
68 | totalPages: res.data.totalPage
69 | });
70 | wx.hideLoading();
71 | }
72 | });
73 | },
74 | cancelOrder(event) {
75 | console.log('开始取消订单');
76 | let that = this;
77 | let orderIndex = event.currentTarget.dataset.orderIndex;
78 | let order = that.data.orderList[orderIndex];
79 | console.log('可以取消订单的情况');
80 | wx.showModal({
81 | title: '',
82 | content: '确定要取消此订单?',
83 | success: function (res) {
84 | if (res.confirm) {
85 | console.log('用户点击确定');
86 |
87 | util.request(api.OrderCancel, {
88 | orderId: order.id
89 | }).then(function (res) {
90 | console.log(res.code);
91 | if (res.code === 200) {
92 | console.log(res.data);
93 | wx.showModal({
94 | title: '提示',
95 | content: res.data,
96 | showCancel: false,
97 | confirmText: '继续',
98 | success: function (res) {
99 | // util.redirect('/pages/ucenter/order/order');
100 | wx.navigateBack({
101 | url: 'pages/ucenter/order/order',
102 | });
103 | }
104 | });
105 | }
106 | });
107 |
108 | }
109 | }
110 | });
111 | },
112 | onReady: function () {
113 | // 页面渲染完成
114 | },
115 | onShow: function () {
116 |
117 | },
118 | onHide: function () {
119 | // 页面隐藏
120 | },
121 | onUnload: function () {
122 | // 页面关闭
123 | }
124 | })
--------------------------------------------------------------------------------
/pages/ucenter/return/return.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/ucenter/return/return.wxml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 | 商品信息
14 | {{item.order_status_text}}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | {{item.goods_name}}
24 |
25 |
26 |
27 |
28 |
29 | 共{{item.goodsCount}}件商品 需付款:¥{{item.actual_price}}
30 |
31 |
32 |
33 | 退款
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | {{nomoreText}}
43 |
44 |
45 |
46 | {{loadmoreText}}
47 |
48 |
49 |
50 |
51 | 无订单数据
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "setting": {
4 | "urlCheck": false,
5 | "es6": true,
6 | "enhance": false,
7 | "postcss": true,
8 | "preloadBackgroundData": false,
9 | "minified": true,
10 | "newFeature": true,
11 | "coverView": true,
12 | "nodeModules": false,
13 | "autoAudits": false,
14 | "showShadowRootInWxmlPanel": true,
15 | "scopeDataCheck": false,
16 | "uglifyFileName": false,
17 | "checkInvalidKey": true,
18 | "checkSiteMap": true,
19 | "uploadWithSourceMap": true,
20 | "compileHotReLoad": false,
21 | "babelSetting": {
22 | "ignore": [],
23 | "disablePlugins": [],
24 | "outputPath": ""
25 | },
26 | "useIsolateContext": true,
27 | "useCompilerModule": false,
28 | "userConfirmedUseCompilerModuleSwitch": false
29 | },
30 | "compileType": "miniprogram",
31 | "libVersion": "2.11.3",
32 | "appid": "wx5f0d91d15dd7da09",
33 | "projectname": "mall",
34 | "simulatorType": "wechat",
35 | "simulatorPluginLibVersion": {},
36 | "condition": {
37 | "search": {
38 | "current": -1,
39 | "list": []
40 | },
41 | "conversation": {
42 | "current": -1,
43 | "list": []
44 | },
45 | "plugin": {
46 | "current": -1,
47 | "list": []
48 | },
49 | "game": {
50 | "list": []
51 | },
52 | "miniprogram": {
53 | "current": -1,
54 | "list": [
55 | {
56 | "id": 0,
57 | "name": "选择优惠券",
58 | "pathName": "pages/shopping/selCoupon/selCoupon",
59 | "query": "isBuy=false"
60 | },
61 | {
62 | "id": -1,
63 | "name": "订单界面",
64 | "pathName": "pages/shopping/checkout/checkout",
65 | "query": "isBuy=true"
66 | },
67 | {
68 | "id": -1,
69 | "name": "我的优惠券",
70 | "pathName": "pages/ucenter/coupon/coupon",
71 | "query": "isBuy=true"
72 | },
73 | {
74 | "id": -1,
75 | "name": "我的订单",
76 | "pathName": "pages/ucenter/order/order",
77 | "query": ""
78 | }
79 | ]
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # mall-shop
2 | ***
3 | ## 前言
4 |
5 | `mall-shop`项目建造了一个前后端分离的电商小程序项目
6 |
7 | > 本项目前后端分别来源于不同的开源项目,我们的团队也对其进行了相应的修改、结合、完善。当前所实现的商城小程序基本实现了电子商城的基本功能,不足的地方我们也会在之后陆续进行进一步更新完善,也希望该项目能对大家有所帮助。
8 | ## 项目背景说明
9 | `mall-shop`项目起源于我们团队想要尝试做一个前后端分离的电商小程序,在经过相关调研筛选,我们发现了在开源社区具有比较大技术影响力的[mall](https://github.com/macrozheng/mall)项目。
10 |
11 | [mall](https://github.com/macrozheng/mall)项目是一套基于SpringBoot+MyBatis实现的电商系统
12 | 
13 | 该开源项目中只包含有后台和前台管理前端项目,缺少一个C端项目,而在项目的ISSUE里对于该前端项目需求比较大。
14 |
15 | 故而,在本项目的开发实现中,我们的后端采用了[mall](https://github.com/macrozheng/mall)项目。
16 | 前端则采用开源项目[wechat_applet](https://github.com/Run2948/wechat_applet)中的前端小程序部分代码[wx-mall](https://github.com/Run2948/wechat_applet/tree/master/wx-mall),在其基础上进行修改。
17 | 使其与后端整合在一起,实现了一个完整的电商系统。也解决了mall项目的前端需求。
18 |
19 | 在开发实现过程中,由于后端接口缺乏等种种原因,我们的小程序实现了一些商城应有的基本的功能,但是一些比较复杂的功能,例如团购、优惠券、立即购等功能暂未实现,而商城购物最后的支付一步,因微信支付需要向腾讯申请,未能实现。所以目前该项目仅仅作为一个拥有完整前后端的demo,供大家参考。项目中也还存在许多不足之处,也欢迎大家提出批评指正。
20 |
21 | `mall`项目地址:
22 | `wechat_applet`项目地址:
23 | ## 项目介绍
24 | mall-shop项目实现的是一个前后端分离的电商小程序,包括前台商城系统及后台管理系统,后端基于SpringBoot+MyBatis实现,采用Docker容器化部署。
25 | 前台商城小程序系统包含首页门户、商品推荐、商品分类、商品搜索、商品详情展示、购物车、加购&下单等订单流程、个人中心、订单管理、客户服务等模块。
26 | ### 项目相关地址
27 | [码云地址](https://gitee.com/tPrograming/mall-app-web): https://gitee.com/tPrograming/mall-app-web
28 | #### 后端
29 | 后端mall项目地址:https://github.com/TProgram/mall
30 |
31 | 后台管理系统mall-admin-web项目地址:https://github.com/macrozheng/mall-admin-web
32 |
33 |
34 | ## 项目组织架构(前端)
35 | * config
36 | * component
37 | * pages
38 | * utils
39 | * static/images
40 | * services
41 |
42 | ## 项目部署(小程序部署)
43 | - 开发工具:微信开发者工具
44 | - 完成后端程序部署后,下载本项目小程序源码
45 | - 填写APPID、项目名称等,进入小程序开发工具
46 | - 进入之后修改config(配置)文件夹里的api.js文件,把MallApiRootUrl及SearchApiRootUrl替换为自己的后台接口地址即可运行。
47 |
48 | ## 小程序部分页面效果展示
49 | ### 首页:
50 | 
51 | ### 商品分类:
52 | 
53 | ### 购物车
54 | 
55 | ### 个人中心
56 | 
57 | ### 订单管理
58 | 
59 |
--------------------------------------------------------------------------------
/services/pay.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 支付相关服务(未完成)
3 | */
4 |
5 | const util = require('../utils/util.js');
6 | const api = require('../config/api.js');
7 |
8 | /**
9 | * 判断用户是否登录
10 | */
11 | function payOrder(orderId) {
12 | return new Promise(function (resolve, reject) {
13 | util.request(api.PayPrepayId, {
14 | orderId: orderId
15 | }).then((res) => {
16 | console.log(res)
17 | if (res.errno === 0) {
18 | const payParam = res.data;
19 | wx.requestPayment({
20 | 'timeStamp': payParam.timeStamp,
21 | 'nonceStr': payParam.nonceStr,
22 | 'package': payParam.package,
23 | 'signType': payParam.signType,
24 | 'paySign': payParam.paySign,
25 | 'success': function (res) {
26 | resolve(res);
27 | },
28 | 'fail': function (res) {
29 | reject(res);
30 | },
31 | 'complete': function (res) {
32 | reject(res);
33 | }
34 | });
35 | } else {
36 | reject(res);
37 | }
38 | });
39 | });
40 | }
41 |
42 |
43 | module.exports = {
44 | payOrder,
45 | };
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/services/user.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 用户相关服务
3 | */
4 |
5 | const util = require('../utils/util.js');
6 | const api = require('../config/api.js');
7 |
8 |
9 | /**
10 | * 调用微信登录
11 | */
12 | function loginByWeixin(userInfo) {
13 | console.log("-----1----")
14 | console.log(userInfo.userInfo)
15 | let code = null;
16 | return new Promise(function (resolve, reject) {
17 | return util.login().then((res) => {
18 | code = res.code;
19 | return userInfo;
20 | }).then((userInfo) => {
21 | //登录远程服务器
22 | let params={};
23 | params.code=code;
24 | params.avatarUrl = userInfo.userInfo.avatarUrl;
25 | params.city = userInfo.userInfo.city;
26 | params.country = userInfo.userInfo.country;
27 | params.gender = userInfo.userInfo.gender;
28 | params.language = userInfo.userInfo.language;
29 | params.nickName = userInfo.userInfo.nickName;
30 | params.province = userInfo.userInfo.province;
31 | params.promoterId = wx.getStorageSync('userId') || 0;
32 | params.merchantId = wx.getStorageSync('merchantId') || 0;
33 | console.log('-----********---------', JSON.stringify(params))
34 | util.request(api.AuthLoginByWeixin, params, 'POST').then(res => {
35 | console.log('-----********---------', JSON.stringify(res))
36 | if (res.code === 200) {
37 | //存储用户信息
38 | wx.setStorageSync('userInfo', userInfo);
39 | // wx.setStorageSync('token', res.data.userVo.weixin_openid);
40 | wx.setStorageSync('token', res.data.openid);
41 | wx.setStorageSync('isReal', true);
42 | wx.setStorageSync('uId', res.data.userid);
43 | wx.setStorageSync('Authorization', res.data.tokenHead + res.data.token)
44 | console.log('-----#######---------', res.data.userid)
45 | if (wx.getStorageSync('userId')){
46 | wx.removeStorageSync('userId');
47 | // wx.setStorageSync('userId');
48 | }
49 | resolve(res);
50 | } else {
51 | util.showErrorToast(res.message)
52 | reject(res);
53 | }
54 | }).catch((err) => {
55 | reject(err);
56 | });
57 | }).catch((err) => {
58 | reject(err);
59 | })
60 | });
61 | }
62 |
63 | /**
64 | * 判断用户是否登录
65 | */
66 | function checkLogin() {
67 | return new Promise(function (resolve, reject) {
68 | if (wx.getStorageSync('userInfo') && wx.getStorageSync('token')) {
69 |
70 | util.checkSession().then(() => {
71 | resolve(true);
72 | }).catch(() => {
73 | reject(false);
74 | });
75 |
76 | } else {
77 | reject(false);
78 | }
79 | });
80 | }
81 |
82 |
83 | module.exports = {
84 | loginByWeixin,
85 | checkLogin,
86 | };
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/static/images/Group@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/Group@2x.png
--------------------------------------------------------------------------------
/static/images/address-bg-bd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/address-bg-bd.png
--------------------------------------------------------------------------------
/static/images/address_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/address_right.png
--------------------------------------------------------------------------------
/static/images/allorder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/allorder.png
--------------------------------------------------------------------------------
/static/images/checkbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/checkbox.png
--------------------------------------------------------------------------------
/static/images/clear_input.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/clear_input.png
--------------------------------------------------------------------------------
/static/images/coupon_bky.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/coupon_bky.png
--------------------------------------------------------------------------------
/static/images/coupon_gq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/coupon_gq.png
--------------------------------------------------------------------------------
/static/images/coupon_ksy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/coupon_ksy.png
--------------------------------------------------------------------------------
/static/images/coupon_ysy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/coupon_ysy.png
--------------------------------------------------------------------------------
/static/images/cus_ywh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/cus_ywh.png
--------------------------------------------------------------------------------
/static/images/del-address.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/del-address.png
--------------------------------------------------------------------------------
/static/images/detail_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/detail_back.png
--------------------------------------------------------------------------------
/static/images/detail_kefu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/detail_kefu.png
--------------------------------------------------------------------------------
/static/images/go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/go.png
--------------------------------------------------------------------------------
/static/images/ic_menu_choice_nor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_choice_nor.png
--------------------------------------------------------------------------------
/static/images/ic_menu_choice_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_choice_pressed.png
--------------------------------------------------------------------------------
/static/images/ic_menu_me_nor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_me_nor.png
--------------------------------------------------------------------------------
/static/images/ic_menu_me_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_me_pressed.png
--------------------------------------------------------------------------------
/static/images/ic_menu_shoping_nor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_shoping_nor.png
--------------------------------------------------------------------------------
/static/images/ic_menu_shoping_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_shoping_pressed.png
--------------------------------------------------------------------------------
/static/images/ic_menu_sort_nor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_sort_nor.png
--------------------------------------------------------------------------------
/static/images/ic_menu_sort_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_sort_pressed.png
--------------------------------------------------------------------------------
/static/images/ic_menu_topic_nor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_topic_nor.png
--------------------------------------------------------------------------------
/static/images/ic_menu_topic_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/ic_menu_topic_pressed.png
--------------------------------------------------------------------------------
/static/images/icon_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_add.png
--------------------------------------------------------------------------------
/static/images/icon_collect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_collect.png
--------------------------------------------------------------------------------
/static/images/icon_collect_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_collect_checked.png
--------------------------------------------------------------------------------
/static/images/icon_cus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_cus.png
--------------------------------------------------------------------------------
/static/images/icon_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_error.png
--------------------------------------------------------------------------------
/static/images/icon_go_more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_go_more.png
--------------------------------------------------------------------------------
/static/images/icon_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_home.png
--------------------------------------------------------------------------------
/static/images/icon_ipone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_ipone.png
--------------------------------------------------------------------------------
/static/images/icon_jl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_jl.png
--------------------------------------------------------------------------------
/static/images/icon_rz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_rz.png
--------------------------------------------------------------------------------
/static/images/icon_wx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_wx.png
--------------------------------------------------------------------------------
/static/images/icon_xz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_xz.png
--------------------------------------------------------------------------------
/static/images/icon_zkh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/icon_zkh.png
--------------------------------------------------------------------------------
/static/images/logo40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/logo40.png
--------------------------------------------------------------------------------
/static/images/my_course_empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/my_course_empty.png
--------------------------------------------------------------------------------
/static/images/selnum.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/selnum.png
--------------------------------------------------------------------------------
/static/images/tu1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/tu1@2x.png
--------------------------------------------------------------------------------
/static/images/tu2@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/tu2@2x.png
--------------------------------------------------------------------------------
/static/images/wxpay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/wxpay.png
--------------------------------------------------------------------------------
/static/images/xsmune.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TProgram/mall-app-web/afb7710b52118cad818d0c3e33bf1ecac2fb0239/static/images/xsmune.png
--------------------------------------------------------------------------------