├── .history
├── README_20180708232731.md
├── README_20180824165335.md
├── README_20180824165511.md
├── README_20180824165712.md
├── README_20180830163747.md
├── READNE_20180824160946.md
├── READNE_20180824160956.md
├── READNE_20180824163012.md
├── READNE_20180824163912.md
└── READNE_20180824164107.md
├── README.md
├── app.js
├── app.json
├── app.wxss
├── images
├── Shopping.png
├── add_to cart.png
├── already_shipped.png
├── birthday.png
├── choice_n.png
├── choice_y.png
├── completed.png
├── delete.png
├── edit.png
├── festival.png
├── home_page_n.png
├── home_page_y.png
├── my_n.png
├── my_order.png
├── my_y.png
├── party.png
├── pending_delivery.png
├── pending_payment.png
├── return.png
├── shopping_cart_return.png
├── shopping_select.png
├── triangle.png
├── triangle_2.png
└── wedding.png
├── lib
└── weui.wxss
├── pages
├── addressAdd
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── addressList
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── bindPhone
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── cart
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── coupon
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── details
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── index
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── list
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── order
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── orderDetails
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
└── user
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── project.config.json
├── screenshot
├── 1.png
├── 10.png
├── 11.png
├── 2.png
├── 3.png
├── 4.png
├── 5.png
├── 6.png
├── 7.png
├── 8.png
├── 9.png
├── wx.png
└── zfb.jpg
└── utils
└── util.js
/.history/README_20180708232731.md:
--------------------------------------------------------------------------------
1 | # 微信小程序商城
2 | 微信小程序商城,微信小程序微店,长期维护版本,欢迎大家踊跃提交贡献代码;
3 |
4 | ## 参与开发
5 |
6 | 更多项目请关注 [https://github.com/EastWorld](https://github.com/EastWorld)。
7 |
8 | - 产品设计 & UI [@blackjeffer](https://github.com/orgs/EastWorld/people/blackjeffer)
9 | - 小程序开发 [@jiulonggithub](https://github.com/orgs/EastWorld/people/jiulonggithub)
10 | - 接口及后台支持 [@gooking](https://github.com/gooking)
11 |
12 | 期待您的加入~ ,欢迎大家踊跃提交代码。
13 |
14 | 开发问题欢迎一起交流 : QQ交流群:479413914
15 |
16 | ## 扫码体验
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | ## 最新功能
27 |
28 | - 新增商品砍价功能,扫码上面第一个二维码,第一个商品详情可体验砍价;
29 | - 分享商品给好友,好友下单后可获得积分、现金返现;
30 | - 可修改订单默认30分钟未支付被关闭的时间;
31 |
32 | ## 使用说明
33 |
34 | > [申请商城后台账号](https://www.it120.cc/info/wxapp/115)
35 | >
36 | > 选择使用商城模块
37 | > > 在 API 列表中选择使用以下API模块:
38 | >
39 | > > >系统参数设置: 用于配置商城名称;
40 | >
41 | > > > 小程序用户注册接口:实现用户注册;
42 | >
43 | > > > 小程序登录接口:实现用户自动登录;
44 | >
45 | > > > App Banner管理接口: 设置商城首页轮播图片
46 | >
47 | > > > 在线支付接口:完成小程序在线支付;
48 | >
49 | > > > 商品类别接口;
50 | >
51 | > > > 商城商品管理接口;
52 | >
53 | > > > 商城订单管理接口;
54 | >
55 | > > > 用户收货地址接口;
56 | >
57 | > > > 优惠券接口;
58 | >
59 | > > > 平台公告模块
60 | >
61 | > > > 积分模块【签到送积分】
62 | >
63 | > 修改源码中 app.js 文件
64 | > > > globalData:{
65 | > userInfo:null,
66 | > subDomain:"mall"
67 | >}
68 | > >
69 | > > > subDomain 中的 mall 为上面您注册开通的域名
70 | >
71 | > [设置小程序合法服务器域名](https://www.it120.cc/info/wxapp/116)
72 | >
73 | > 重启您的小程序开发工具,完成
74 |
75 | ## 常见问题
76 |
77 | - [如何修改小程序商城的标题?](https://www.it120.cc/info/faq/778)
78 | - [“无法登录”的错误?](https://www.it120.cc/info/faq/391)
79 | - [小程序提示“无法登录”的错误?](https://www.it120.cc/info/faq/392)
80 | - [如何发布自己的商品?](https://www.it120.cc/info/faq/436)
81 | - [如何给Banner增加链接,点击打开某个商品?](https://www.it120.cc/info/faq/437)
82 | - [获取我的accesstoken,以便我在其他系统使用](https://www.it120.cc/info/faq/763)
83 | - 工厂后台设置 appid、secret、微信支付商户号和秘钥时候的 token 怎么填?
84 | > 不要填!
85 | >
86 | > 不要填!
87 | >
88 | > 不要填!
89 | >
90 | > 重要的事情说三遍,这个小程序用不到,是给服务号使用的,所以大家空着不要填
91 | - 微信支付时候,提示 50000 错误,不能获取到预支付id
92 | > 这个错误是无法获取到微信支付的预支付信息
93 | > - 可能是你没有在后台配置您的微信支付商户号和秘钥,或者配置错误
94 | >
95 | > - 可能是你配置的微信支付不是当前小程序申请的(微信支付目前无法跨小程序调用)
96 | >
97 | > - 确保微信开发工具上面登录的 APPID 和你在后台配置的 APPID 是同一个
98 | - 能否帮我免费添加功能?
99 | > 可以!
100 | >
101 | >
102 | >
103 | > - 点击页面顶部的 Star ,关注后,项目有最新动态 github 会提醒您,不错过重要更新;
104 | > - 点击页面顶部的 Fork, 将您需要增加的功能完成 小程序 端界面的调整,然后在 github 上请求将您的代码合并到 EastWorld;
105 | > - 您的代码合并请求审核通过后,我们将会为您完善配套的后台功能;
106 | > - 开源项目离不开您的支持和代码共享,我们一起把 EastWorld 项目长期维护下去;
107 | - [如何使用在线客服功能?](https://www.it120.cc/info/faq/867)
108 | - 下单的时候没有地方填写收货地址?
109 | > 1、添加一个“物流模板”,只有需要快递的商品才会提示用户填写收货地址
110 | >
111 | > 2、发布商品的时候,选择刚才添加的“物流模板”
112 | >
113 | > 3、重新下单,将会需要用户输入收货地址
114 | - 后台设置appid和secret的时候提示不正确?
115 | > 1、请确认您填写的appid和secret是否正确
116 | >
117 | > 2、输入的时候确保没有空格(复制的时候可能会多复制了空格)
118 | >
119 | > 3、在微信后台设置服务器IP地址白名单(106.14.43.122)
120 | - 如何使用退款功能?
121 | > 1、后台支持针对订单指定退款多少金额;
122 | >
123 | > 2、可选择退款至用户可用余额或者按照用户支付原路退还第三方或者银行卡;
124 | >
125 | > 3、如果选用原路退还,需要在商户号和秘钥设置的地方上传您的微信支付证书文件(PK12格式文件)
126 | - 如何设置满多少包邮?
127 | > 1、后台系统设置 --> 系统参数,增加系统参数;
128 | >
129 | > 2、参数名 free_shipping_for_purchases (注意不要有空格)
130 | >
131 | > 3、参数值填写您希望的买满金额即可
132 | - [“规格与尺寸”怎么玩](https://www.it120.cc/info/faq/1208)
133 | - [如何设置用户提现手续费](https://www.it120.cc/info/faq/1589)
134 | - [商品如何显示视频?](https://www.it120.cc/info/faq/1802)
135 | - [货到付款、积分赠送规则设置](https://www.it120.cc/notice/22)
136 | - [小程序如何使用“模板消息”给用户推送消息](https://www.it120.cc/info/faq/2823)
137 | - 如何修改或者关闭订单超过30分钟未付款自动关闭?
138 | > 1、创建订单接口增加 expireMinutes 参数;
139 | >
140 | > 2、代表多少分钟未支付自动关闭本订单,传0不自动关闭订单;
141 |
142 |
143 | ## 如何升级到最新版
144 |
145 | - 小程序程序的修改和您后台的数据是独立的,所以不用担心您会丢失数据
146 | - 先把你开发工具下的现有版本程序备份
147 | - 下载最新版的程序,直接覆盖您本地的程序
148 | - 用开发工具修改域名 mall 为你自己的域名
149 | - 开发工具里面上传代码提交微信审核
150 | - 审核通过后,小程序后台去发布新版本即可
151 | - 用户无需重新扫码,关闭小程序重新打开就是新版本了
152 |
--------------------------------------------------------------------------------
/.history/README_20180824165335.md:
--------------------------------------------------------------------------------
1 | # 微信小程序实现移动端商城
2 |
3 | ## 说明
4 | ```
5 | > 如有问题或者遇到坑请直接在 Issues 中提,或者可以加我的QQ 212181324
6 |
7 | > 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
8 |
9 | > 部署详解:http://blog.csdn.net/qq_28027903/article/details/77929618
10 |
11 | > 此项目会一直持续更新 后期会使用node提供服务
12 | ```
13 |
14 | ### 项目截图:
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | ## 项目布局
29 | ```
30 | |-- images // 公共图片
31 | |-- lib // 公共文件
32 | |-- pages // 页面
33 | | |-- index // 首页
34 | | |-- list // 商品列表
35 | | |-- details // 商品详情
36 | | |-- user // 个人中心
37 | | |-- order // 我的订单
38 | | |-- coupon // 优惠券
39 | | |-- cart // 购物车
40 | | |-- addressList // 我的地址
41 | | |-- addressAdd // 添加地址
42 | |-- README.md // 说明
43 | ```
44 |
45 | ## 开发环境:
46 | 调试基础库 2.0.4
47 |
48 | ## 支持作者
49 | ```
50 | > 你的支持将是作者最大的动力(蚂蚁再小也是肉😁)
51 | ```
52 |
53 |
54 |
--------------------------------------------------------------------------------
/.history/README_20180824165511.md:
--------------------------------------------------------------------------------
1 | # 微信小程序实现移动端商城
2 |
3 | ## 说明
4 | ```
5 | > 如有问题或者遇到坑请直接在 Issues 中提,或者可以加我的QQ 212181324
6 |
7 | > 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
8 |
9 | > 部署详解:http://blog.csdn.net/qq_28027903/article/details/77929618
10 |
11 | > 此项目会一直持续更新 后期会使用node提供服务
12 | ```
13 |
14 | ### 项目截图:
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | ## 项目布局
29 | ```
30 | |-- images // 公共图片
31 | |-- lib // 公共文件
32 | |-- pages // 页面
33 | | |-- index // 首页
34 | | |-- list // 商品列表
35 | | |-- details // 商品详情
36 | | |-- user // 个人中心
37 | | |-- order // 我的订单
38 | | |-- coupon // 优惠券
39 | | |-- cart // 购物车
40 | | |-- addressList // 我的地址
41 | | |-- addressAdd // 添加地址
42 | |-- README.md // 说明
43 | ```
44 |
45 | ## 开发环境:
46 | 调试基础库 2.0.4
47 |
48 | ## 支持作者
49 | ```
50 | > 你的支持将是作者最大的动力(蚂蚁再小也是肉😁)
51 | ```
52 |
53 |
54 |
--------------------------------------------------------------------------------
/.history/README_20180824165712.md:
--------------------------------------------------------------------------------
1 | # 微信小程序实现移动端商城
2 |
3 | ## 说明
4 | ```
5 | > 如有问题或者遇到坑请直接在 Issues 中提,或者可以加我的QQ 212181324
6 |
7 | > 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
8 |
9 | > 部署详解:http://blog.csdn.net/qq_28027903/article/details/77929618
10 |
11 | > 此项目会一直持续更新 后期会使用node提供服务
12 | ```
13 |
14 | ### 项目截图:
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | ## 项目布局
29 | ```
30 | |-- images // 公共图片
31 | |-- lib // 公共文件
32 | |-- pages // 页面
33 | | |-- index // 首页
34 | | |-- list // 商品列表
35 | | |-- details // 商品详情
36 | | |-- user // 个人中心
37 | | |-- order // 我的订单
38 | | |-- coupon // 优惠券
39 | | |-- cart // 购物车
40 | | |-- addressList // 我的地址
41 | | |-- addressAdd // 添加地址
42 | |-- README.md // 说明
43 | ```
44 |
45 | ## 开发环境:
46 | 调试基础库 2.0.4
47 |
48 | ## 支持作者
49 | ```
50 | > 你的支持将是作者最大的动力(蚂蚁再小也是肉😁)
51 | ```
52 |
53 |
54 |
--------------------------------------------------------------------------------
/.history/README_20180830163747.md:
--------------------------------------------------------------------------------
1 | # 微信小程序实现移动端商城
2 |
3 | ## 说明
4 | ```
5 | > 如有问题或者遇到坑请直接在 Issues 中提,或者可以加我的QQ 212181324
6 |
7 | > 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
8 |
9 | > 博客地址:https://blog.csdn.net/qq_28027903/article/details/82109408
10 |
11 | > 服务端:https://github.com/FZliweiliang/wechat-app-mall-server(正在开发中)
12 |
13 | > 此项目会一直持续更新 后期会使用node提供服务
14 |
15 | > 提示小程序大于2M可以把screenshot文件夹删除
16 | ```
17 |
18 | ### 项目截图:
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | ## 项目布局
33 | ```
34 | |-- images // 公共图片
35 | |-- lib // 公共文件
36 | |-- pages // 页面
37 | | |-- index // 首页
38 | | |-- list // 商品列表
39 | | |-- details // 商品详情
40 | | |-- user // 个人中心
41 | | |-- order // 我的订单
42 | | |-- coupon // 优惠券
43 | | |-- cart // 购物车
44 | | |-- addressList // 我的地址
45 | | |-- addressAdd // 添加地址
46 | |-- README.md // 说明
47 | ```
48 |
49 | ## 开发环境:
50 | 调试基础库 2.0.4
51 |
52 | ## 支持作者
53 | ```
54 | > 你的支持将是作者最大的动力(蚂蚁再小也是肉😁)
55 | ```
56 |
57 |
58 |
--------------------------------------------------------------------------------
/.history/READNE_20180824160946.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/.history/READNE_20180824160946.md
--------------------------------------------------------------------------------
/.history/READNE_20180824160956.md:
--------------------------------------------------------------------------------
1 | # 微信小程序实现移动端商城
2 | ### 项目说明:
3 | 微信小程序:实现一个移动端商城
4 |
5 | [数据来源:环球小镇(微信公众号:环球小镇),特此感谢]
6 |
7 | ### 目录结构:
8 | - images — 存放项目图片
9 | - pages — 存放项目页面相关文件
10 | - style — 存放独立wxss样式文件,可import引入
11 | - utils — 存放utils文件,可require引入
12 |
13 | ### 项目截图:
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | ### 开发环境:
26 | 微信web开发者工具 v0.9.092300
27 |
28 | ### 项目地址:
29 | https://github.com/liuxuanqiang/wechat-weapp-mall
30 |
--------------------------------------------------------------------------------
/.history/READNE_20180824163012.md:
--------------------------------------------------------------------------------
1 | # 微信小程序实现移动端商城
2 |
3 | ## 说明
4 | ```
5 | > 如有问题或者遇到坑请直接在 Issues 中提,或者可以加我的QQ 474782977
6 |
7 | > 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
8 |
9 | > 部署详解:http://blog.csdn.net/qq_28027903/article/details/77929618
10 | ```
11 |
12 | ### 项目截图:
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | ## 项目布局
27 | ```
28 | |-- server // node源码目录
29 | | |-- app.js // 启动文件
30 | | |-- api.js // api服务文件
31 | | |-- db.js // MongoDB文件
32 | |-- src // 静态源码目录
33 | | |-- components // 组件
34 | | |-- assets // 公共静态文件、图片
35 | | |-- page // 所有页面
36 | | |-- lib // 引用的插件
37 | | |-- ApiSetting.js // 接口合集
38 | | |-- http.js // http请求封装
39 | | |-- router // 路由配置
40 | | |-- index.js // 路由集合文件
41 | | |-- page // 页面
42 | | |-- Hello.vue // 页面文件
43 | | |-- store // vuex的状态管理
44 | | |-- index.js // 引用vuex,创建store
45 | | |-- App.vue // 页面入口文件
46 | | |-- main.js // 程序入口文件,加载各种公共组件
47 | |-- .babelrc // ES6语法编译配置
48 | |-- .editorconfig // 代码编写规格
49 | |-- .gitignore // 忽略的文件
50 | |-- index.html // 入口html文件
51 | |-- package.json // 项目及工具的依赖配置文件
52 | |-- webpack.config.js // webpack 配置文件
53 | |-- README.md // 说明
54 | ```
55 |
56 | ### 开发环境:
57 | 调试基础库 2.0.4
58 |
--------------------------------------------------------------------------------
/.history/READNE_20180824163912.md:
--------------------------------------------------------------------------------
1 | # 微信小程序实现移动端商城
2 |
3 | ## 说明
4 | ```
5 | > 如有问题或者遇到坑请直接在 Issues 中提,或者可以加我的QQ 474782977
6 |
7 | > 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
8 |
9 | > 部署详解:http://blog.csdn.net/qq_28027903/article/details/77929618
10 | ```
11 |
12 | ### 项目截图:
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | ## 项目布局
27 | ```
28 | |-- images // 公共图片
29 | |-- lib // 公共文件
30 | |-- pages // 页面
31 | | |-- index // 首页
32 | | |-- list // 商品列表
33 | | |-- details // 商品详情
34 | | |-- user // 个人中心
35 | | |-- order // 我的订单
36 | | |-- coupon // 优惠券
37 | | |-- cart // 购物车
38 | | |-- addressList // 我的地址
39 | | |-- addressAdd // 添加地址
40 | |-- README.md // 说明
41 | ```
42 |
43 | ## 开发环境:
44 | 调试基础库 2.0.4
45 |
46 | ## 支持作者
47 | ```
48 | 你的支持将是作者最大的动力(蚂蚁再小也是肉😁)
49 | ```
50 |
51 |
52 |
--------------------------------------------------------------------------------
/.history/READNE_20180824164107.md:
--------------------------------------------------------------------------------
1 | # 微信小程序实现移动端商城
2 |
3 | ## 说明
4 | ```
5 | > 如有问题或者遇到坑请直接在 Issues 中提,或者可以加我的QQ 212181324
6 |
7 | > 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
8 |
9 | > 部署详解:http://blog.csdn.net/qq_28027903/article/details/77929618
10 |
11 | > 此项目会一直持续更新 后期会使用node提供服务
12 | ```
13 |
14 | ### 项目截图:
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | ## 项目布局
29 | ```
30 | |-- images // 公共图片
31 | |-- lib // 公共文件
32 | |-- pages // 页面
33 | | |-- index // 首页
34 | | |-- list // 商品列表
35 | | |-- details // 商品详情
36 | | |-- user // 个人中心
37 | | |-- order // 我的订单
38 | | |-- coupon // 优惠券
39 | | |-- cart // 购物车
40 | | |-- addressList // 我的地址
41 | | |-- addressAdd // 添加地址
42 | |-- README.md // 说明
43 | ```
44 |
45 | ## 开发环境:
46 | 调试基础库 2.0.4
47 |
48 | ## 支持作者
49 | ```
50 | > 你的支持将是作者最大的动力(蚂蚁再小也是肉😁)
51 | ```
52 |
53 |
54 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 微信小程序实现移动端商城
2 |
3 | ## 说明
4 | ```
5 |
6 | > 如果对您有帮助,您可以点右上角 "Star&fork" 支持一下 谢谢! ^_^
7 |
8 | > 博客地址:https://juejin.im/post/5b836d056fb9a019f671320f
9 |
10 | > 配置HTTPS:https://juejin.im/post/5b88b58151882542db3bedf7
11 |
12 | > 服务端:https://github.com/FZliweiliang/wechat-app-mall-server
13 |
14 | > 提示小程序大于2M可以把screenshot文件夹删除
15 | ```
16 |
17 | ### 项目截图:
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | ## 项目布局
32 | ```
33 | |-- images // 公共图片
34 | |-- lib // 公共文件
35 | |-- pages // 页面
36 | | |-- index // 首页
37 | | |-- list // 商品列表
38 | | |-- details // 商品详情
39 | | |-- user // 个人中心
40 | | |-- order // 我的订单
41 | | |-- coupon // 优惠券
42 | | |-- cart // 购物车
43 | | |-- addressList // 我的地址
44 | | |-- addressAdd // 添加地址
45 | |-- README.md // 说明
46 | ```
47 |
48 | ## 开发环境:
49 | 调试基础库 2.0.4
50 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | // 展示本地存储能力
5 | var logs = wx.getStorageSync('logs') || []
6 | logs.unshift(Date.now())
7 | wx.setStorageSync('logs', logs)
8 | // 登录
9 | wx.login({
10 | success: res => {
11 | // 发送 res.code 到后台换取 openId, sessionKey, unionId
12 | this.http('v1/wx/getUser', { code:res.code}).then(res=>{
13 | const app = getApp()
14 | app.globalData.openid = res.data.openid
15 | app.globalData.userInfo = res.data
16 | if (!res.data.mobile) {
17 | wx.reLaunch({
18 | url: "/pages/bindPhone/index"
19 | });
20 | }
21 | })
22 | }
23 | })
24 | // 获取用户信息
25 | wx.getSetting({
26 | success: res => {
27 | if (res.authSetting['scope.userInfo']) {
28 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
29 | wx.getUserInfo({
30 | success: res => {
31 | // 可以将 res 发送给后台解码出 unionId
32 | this.globalData.userInfo = res.userInfo
33 | console.log(res.userInfo)
34 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
35 | // 所以此处加入 callback 以防止这种情况
36 | if (this.userInfoReadyCallback) {
37 | this.userInfoReadyCallback(res)
38 | }
39 | }
40 | })
41 | }
42 | }
43 | })
44 |
45 | },
46 | http: function (url, data='', method="GET") { //封装http请求
47 | const apiUrl = 'https://wx.yogalt.com/api/' //请求域名
48 | console.log(this.globalData)
49 | const currency = {
50 | openid: this.globalData.openid
51 | }
52 | return new Promise((resolve, reject) => {
53 | wx.request({
54 | url: apiUrl + url,
55 | data: Object.assign(currency,data),
56 | method: method,
57 | success: function (res) {
58 | if(res.data.code != 200){
59 | wx.showModal({
60 | title: '提示',
61 | content: res.data.message,
62 | success: function (res) {
63 | if (res.confirm) {
64 | console.log('用户点击确定')
65 | } else if (res.cancel) {
66 | console.log('用户点击取消')
67 | }
68 | }
69 | })
70 | }
71 | resolve(res.data)
72 | },
73 | fail: function (res) {
74 | reject(res);
75 | },
76 | complete: function () {
77 | console.log('complete');
78 | }
79 | })
80 | })
81 | },
82 | globalData: {
83 | userInfo: null,
84 | openid:null
85 | }
86 | })
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/list/index",
5 | "pages/cart/index",
6 | "pages/user/index",
7 | "pages/details/index",
8 | "pages/bindPhone/index",
9 | "pages/coupon/index",
10 | "pages/order/index",
11 | "pages/addressList/index",
12 | "pages/addressAdd/index",
13 | "pages/orderDetails/index"
14 | ],
15 | "window": {
16 | "backgroundTextStyle": "light",
17 | "navigationBarBackgroundColor": "#fff",
18 | "navigationBarTitleText": "WeChat",
19 | "navigationBarTextStyle": "black"
20 | },
21 | "tabBar": {
22 | "backgroundColor": "#fff",
23 | "borderStyle": "#D2D2D2",
24 | "color": "#333",
25 | "selectedColor": "#ff5f19",
26 | "list": [
27 | {
28 | "selectedIconPath": "images/home_page_n.png",
29 | "iconPath": "images/home_page_y.png",
30 | "pagePath": "pages/index/index",
31 | "text": "首页"
32 | },
33 | {
34 | "selectedIconPath": "images/Shopping.png",
35 | "iconPath": "images/shopping_select.png",
36 | "pagePath": "pages/cart/index",
37 | "text": "购物车"
38 | },
39 | {
40 | "selectedIconPath": "images/my_y.png",
41 | "iconPath": "images/my_n.png",
42 | "pagePath": "pages/user/index",
43 | "text": "我的"
44 | }
45 | ]
46 | }
47 | }
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | @import "/lib/weui.wxss";
3 | .container {
4 | height: 100%;
5 | }
6 | image{
7 | width: 100%;
8 | }
--------------------------------------------------------------------------------
/images/Shopping.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/Shopping.png
--------------------------------------------------------------------------------
/images/add_to cart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/add_to cart.png
--------------------------------------------------------------------------------
/images/already_shipped.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/already_shipped.png
--------------------------------------------------------------------------------
/images/birthday.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/birthday.png
--------------------------------------------------------------------------------
/images/choice_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/choice_n.png
--------------------------------------------------------------------------------
/images/choice_y.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/choice_y.png
--------------------------------------------------------------------------------
/images/completed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/completed.png
--------------------------------------------------------------------------------
/images/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/delete.png
--------------------------------------------------------------------------------
/images/edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/edit.png
--------------------------------------------------------------------------------
/images/festival.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/festival.png
--------------------------------------------------------------------------------
/images/home_page_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/home_page_n.png
--------------------------------------------------------------------------------
/images/home_page_y.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/home_page_y.png
--------------------------------------------------------------------------------
/images/my_n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/my_n.png
--------------------------------------------------------------------------------
/images/my_order.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/my_order.png
--------------------------------------------------------------------------------
/images/my_y.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/my_y.png
--------------------------------------------------------------------------------
/images/party.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/party.png
--------------------------------------------------------------------------------
/images/pending_delivery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/pending_delivery.png
--------------------------------------------------------------------------------
/images/pending_payment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/pending_payment.png
--------------------------------------------------------------------------------
/images/return.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/return.png
--------------------------------------------------------------------------------
/images/shopping_cart_return.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/shopping_cart_return.png
--------------------------------------------------------------------------------
/images/shopping_select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/shopping_select.png
--------------------------------------------------------------------------------
/images/triangle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/triangle.png
--------------------------------------------------------------------------------
/images/triangle_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/triangle_2.png
--------------------------------------------------------------------------------
/images/wedding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/images/wedding.png
--------------------------------------------------------------------------------
/lib/weui.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * weui.js v1.1.0 (https://github.com/weui/weui-wxss)
3 | * Copyright 2016, wechat ui team
4 | * MIT license
5 | */
6 | page {
7 | line-height: 1.6;
8 | font-family: -apple-system-font, "Helvetica Neue", sans-serif;
9 | }
10 | icon {
11 | vertical-align: middle;
12 | }
13 | .weui-cells {
14 | position: relative;
15 | margin-top: 1.17647059em;
16 | background-color: #FFFFFF;
17 | line-height: 1.41176471;
18 | font-size: 17px;
19 | }
20 | .weui-cells:before {
21 | content: " ";
22 | position: absolute;
23 | left: 0;
24 | top: 0;
25 | right: 0;
26 | height: 1px;
27 | border-top: 1rpx solid #D9D9D9;
28 | color: #D9D9D9;
29 | }
30 | .weui-cells:after {
31 | content: " ";
32 | position: absolute;
33 | left: 0;
34 | bottom: 0;
35 | right: 0;
36 | height: 1px;
37 | border-bottom: 1rpx solid #D9D9D9;
38 | color: #D9D9D9;
39 | }
40 | .weui-cells__title {
41 | margin-top: .77em;
42 | margin-bottom: .3em;
43 | padding-left: 15px;
44 | padding-right: 15px;
45 | color: #999999;
46 | font-size: 14px;
47 | }
48 | .weui-cells_after-title {
49 | margin-top: 0;
50 | }
51 | .weui-cells__tips {
52 | margin-top: .3em;
53 | color: #999999;
54 | padding-left: 15px;
55 | padding-right: 15px;
56 | font-size: 14px;
57 | }
58 | .weui-cell {
59 | padding: 10px 15px;
60 | position: relative;
61 | display: -webkit-box;
62 | display: -webkit-flex;
63 | display: flex;
64 | -webkit-box-align: center;
65 | -webkit-align-items: center;
66 | align-items: center;
67 | }
68 | .weui-cell:before {
69 | content: " ";
70 | position: absolute;
71 | left: 0;
72 | top: 0;
73 | right: 0;
74 | height: 1px;
75 | border-top: 1rpx solid #D9D9D9;
76 | color: #D9D9D9;
77 | left: 15px;
78 | }
79 | .weui-cell:first-child:before {
80 | display: none;
81 | }
82 | .weui-cell_active {
83 | background-color: #ECECEC;
84 | }
85 | .weui-cell_primary {
86 | -webkit-box-align: start;
87 | -webkit-align-items: flex-start;
88 | align-items: flex-start;
89 | }
90 | .weui-cell__bd {
91 | -webkit-box-flex: 1;
92 | -webkit-flex: 1;
93 | flex: 1;
94 | }
95 | .weui-cell__ft {
96 | text-align: right;
97 | color: #999999;
98 | }
99 | .weui-cell_access {
100 | color: inherit;
101 | }
102 | .weui-cell__ft_in-access {
103 | padding-right: 13px;
104 | position: relative;
105 | }
106 | .weui-cell__ft_in-access:after {
107 | content: " ";
108 | display: inline-block;
109 | height: 6px;
110 | width: 6px;
111 | border-width: 2px 2px 0 0;
112 | border-color: #C8C8CD;
113 | border-style: solid;
114 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
115 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
116 | position: relative;
117 | top: -2px;
118 | position: absolute;
119 | top: 50%;
120 | margin-top: -4px;
121 | right: 2px;
122 | }
123 | .weui-cell_link {
124 | color: #586C94;
125 | font-size: 14px;
126 | }
127 | .weui-cell_link:active {
128 | background-color: #ECECEC;
129 | }
130 | .weui-cell_link:first-child:before {
131 | display: block;
132 | }
133 | .weui-icon-radio {
134 | margin-left: 3.2px;
135 | margin-right: 3.2px;
136 | }
137 | .weui-icon-checkbox_circle,
138 | .weui-icon-checkbox_success {
139 | margin-left: 4.6px;
140 | margin-right: 4.6px;
141 | }
142 | .weui-check__label:active {
143 | background-color: #ECECEC;
144 | }
145 | .weui-check {
146 | position: absolute;
147 | left: -9999px;
148 | }
149 | .weui-check__hd_in-checkbox {
150 | padding-right: 0.35em;
151 | }
152 | .weui-cell__ft_in-radio {
153 | padding-left: 0.35em;
154 | }
155 | .weui-cell_input {
156 | padding-top: 0;
157 | padding-bottom: 0;
158 | }
159 | .weui-label {
160 | width: 105px;
161 | word-wrap: break-word;
162 | word-break: break-all;
163 | }
164 | .weui-input {
165 | height: 2.58823529em;
166 | min-height: 2.58823529em;
167 | line-height: 2.58823529em;
168 | }
169 | .weui-toptips {
170 | position: fixed;
171 | -webkit-transform: translateZ(0);
172 | transform: translateZ(0);
173 | top: 0;
174 | left: 0;
175 | right: 0;
176 | padding: 5px;
177 | font-size: 14px;
178 | text-align: center;
179 | color: #FFFFFF;
180 | z-index: 5000;
181 | word-wrap: break-word;
182 | word-break: break-all;
183 | }
184 | .weui-toptips_warn {
185 | background-color: #E64340;
186 | }
187 | .weui-textarea {
188 | display: block;
189 | width: 100%;
190 | }
191 | .weui-textarea-counter {
192 | color: #B2B2B2;
193 | text-align: right;
194 | }
195 | .weui-textarea-counter_warn {
196 | color: #E64340;
197 | }
198 | .weui-cell_warn {
199 | color: #E64340;
200 | }
201 | .weui-form-preview {
202 | position: relative;
203 | background-color: #FFFFFF;
204 | }
205 | .weui-form-preview:before {
206 | content: " ";
207 | position: absolute;
208 | left: 0;
209 | top: 0;
210 | right: 0;
211 | height: 1px;
212 | border-top: 1rpx solid #D9D9D9;
213 | color: #D9D9D9;
214 | }
215 | .weui-form-preview:after {
216 | content: " ";
217 | position: absolute;
218 | left: 0;
219 | bottom: 0;
220 | right: 0;
221 | height: 1px;
222 | border-bottom: 1rpx solid #D9D9D9;
223 | color: #D9D9D9;
224 | }
225 | .weui-form-preview__value {
226 | font-size: 14px;
227 | }
228 | .weui-form-preview__value_in-hd {
229 | font-size: 26px;
230 | }
231 | .weui-form-preview__hd {
232 | position: relative;
233 | padding: 10px 15px;
234 | text-align: right;
235 | line-height: 2.5em;
236 | }
237 | .weui-form-preview__hd:after {
238 | content: " ";
239 | position: absolute;
240 | left: 0;
241 | bottom: 0;
242 | right: 0;
243 | height: 1px;
244 | border-bottom: 1rpx solid #D9D9D9;
245 | color: #D9D9D9;
246 | left: 15px;
247 | }
248 | .weui-form-preview__bd {
249 | padding: 10px 15px;
250 | font-size: .9em;
251 | text-align: right;
252 | color: #999999;
253 | line-height: 2;
254 | }
255 | .weui-form-preview__ft {
256 | position: relative;
257 | line-height: 50px;
258 | display: -webkit-box;
259 | display: -webkit-flex;
260 | display: flex;
261 | }
262 | .weui-form-preview__ft:after {
263 | content: " ";
264 | position: absolute;
265 | left: 0;
266 | top: 0;
267 | right: 0;
268 | height: 1px;
269 | border-top: 1rpx solid #D5D5D6;
270 | color: #D5D5D6;
271 | }
272 | .weui-form-preview__item {
273 | overflow: hidden;
274 | }
275 | .weui-form-preview__label {
276 | float: left;
277 | margin-right: 1em;
278 | min-width: 4em;
279 | color: #999999;
280 | text-align: justify;
281 | text-align-last: justify;
282 | }
283 | .weui-form-preview__value {
284 | display: block;
285 | overflow: hidden;
286 | word-break: normal;
287 | word-wrap: break-word;
288 | }
289 | .weui-form-preview__btn {
290 | position: relative;
291 | display: block;
292 | -webkit-box-flex: 1;
293 | -webkit-flex: 1;
294 | flex: 1;
295 | color: #3CC51F;
296 | text-align: center;
297 | }
298 | .weui-form-preview__btn:after {
299 | content: " ";
300 | position: absolute;
301 | left: 0;
302 | top: 0;
303 | width: 1px;
304 | bottom: 0;
305 | border-left: 1rpx solid #D5D5D6;
306 | color: #D5D5D6;
307 | }
308 | .weui-form-preview__btn:first-child:after {
309 | display: none;
310 | }
311 | .weui-form-preview__btn_active {
312 | background-color: #EEEEEE;
313 | }
314 | .weui-form-preview__btn_default {
315 | color: #999999;
316 | }
317 | .weui-form-preview__btn_primary {
318 | color: #0BB20C;
319 | }
320 | .weui-cell_select {
321 | padding: 0;
322 | }
323 | .weui-select {
324 | position: relative;
325 | padding-left: 15px;
326 | padding-right: 30px;
327 | height: 2.58823529em;
328 | min-height: 2.58823529em;
329 | line-height: 2.58823529em;
330 | border-right: 1rpx solid #D9D9D9;
331 | }
332 | .weui-select:before {
333 | content: " ";
334 | display: inline-block;
335 | height: 6px;
336 | width: 6px;
337 | border-width: 2px 2px 0 0;
338 | border-color: #C8C8CD;
339 | border-style: solid;
340 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
341 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
342 | position: relative;
343 | top: -2px;
344 | position: absolute;
345 | top: 50%;
346 | right: 15px;
347 | margin-top: -4px;
348 | }
349 | .weui-select_in-select-after {
350 | padding-left: 0;
351 | }
352 | .weui-cell__hd_in-select-after,
353 | .weui-cell__bd_in-select-before {
354 | padding-left: 15px;
355 | }
356 | .weui-cell_vcode {
357 | padding-right: 0;
358 | }
359 | .weui-vcode-img {
360 | margin-left: 5px;
361 | height: 2.58823529em;
362 | vertical-align: middle;
363 | }
364 | .weui-vcode-btn {
365 | display: inline-block;
366 | height: 2.58823529em;
367 | margin-left: 5px;
368 | padding: 0 0.6em 0 0.7em;
369 | border-left: 1px solid #E5E5E5;
370 | line-height: 2.58823529em;
371 | vertical-align: middle;
372 | font-size: 17px;
373 | color: #3CC51F;
374 | white-space: nowrap;
375 | }
376 | .weui-vcode-btn:active {
377 | color: #52a341;
378 | }
379 | .weui-cell_switch {
380 | padding-top: 6px;
381 | padding-bottom: 6px;
382 | }
383 | .weui-uploader__hd {
384 | display: -webkit-box;
385 | display: -webkit-flex;
386 | display: flex;
387 | padding-bottom: 10px;
388 | -webkit-box-align: center;
389 | -webkit-align-items: center;
390 | align-items: center;
391 | }
392 | .weui-uploader__title {
393 | -webkit-box-flex: 1;
394 | -webkit-flex: 1;
395 | flex: 1;
396 | }
397 | .weui-uploader__info {
398 | color: #B2B2B2;
399 | }
400 | .weui-uploader__bd {
401 | margin-bottom: -4px;
402 | margin-right: -9px;
403 | overflow: hidden;
404 | }
405 | .weui-uploader__file {
406 | float: left;
407 | margin-right: 9px;
408 | margin-bottom: 9px;
409 | }
410 | .weui-uploader__img {
411 | display: block;
412 | width: 79px;
413 | height: 79px;
414 | }
415 | .weui-uploader__file_status {
416 | position: relative;
417 | }
418 | .weui-uploader__file_status:before {
419 | content: " ";
420 | position: absolute;
421 | top: 0;
422 | right: 0;
423 | bottom: 0;
424 | left: 0;
425 | background-color: rgba(0, 0, 0, 0.5);
426 | }
427 | .weui-uploader__file-content {
428 | position: absolute;
429 | top: 50%;
430 | left: 50%;
431 | -webkit-transform: translate(-50%, -50%);
432 | transform: translate(-50%, -50%);
433 | color: #FFFFFF;
434 | }
435 | .weui-uploader__input-box {
436 | float: left;
437 | position: relative;
438 | margin-right: 9px;
439 | margin-bottom: 9px;
440 | width: 77px;
441 | height: 77px;
442 | border: 1px solid #D9D9D9;
443 | }
444 | .weui-uploader__input-box:before,
445 | .weui-uploader__input-box:after {
446 | content: " ";
447 | position: absolute;
448 | top: 50%;
449 | left: 50%;
450 | -webkit-transform: translate(-50%, -50%);
451 | transform: translate(-50%, -50%);
452 | background-color: #D9D9D9;
453 | }
454 | .weui-uploader__input-box:before {
455 | width: 2px;
456 | height: 39.5px;
457 | }
458 | .weui-uploader__input-box:after {
459 | width: 39.5px;
460 | height: 2px;
461 | }
462 | .weui-uploader__input-box:active {
463 | border-color: #999999;
464 | }
465 | .weui-uploader__input-box:active:before,
466 | .weui-uploader__input-box:active:after {
467 | background-color: #999999;
468 | }
469 | .weui-uploader__input {
470 | position: absolute;
471 | z-index: 1;
472 | top: 0;
473 | left: 0;
474 | width: 100%;
475 | height: 100%;
476 | opacity: 0;
477 | }
478 | .weui-article {
479 | padding: 20px 15px;
480 | font-size: 15px;
481 | }
482 | .weui-article__section {
483 | margin-bottom: 1.5em;
484 | }
485 | .weui-article__h1 {
486 | font-size: 18px;
487 | font-weight: 400;
488 | margin-bottom: .9em;
489 | }
490 | .weui-article__h2 {
491 | font-size: 16px;
492 | font-weight: 400;
493 | margin-bottom: .34em;
494 | }
495 | .weui-article__h3 {
496 | font-weight: 400;
497 | font-size: 15px;
498 | margin-bottom: .34em;
499 | }
500 | .weui-article__p {
501 | margin: 0 0 .8em;
502 | }
503 | .weui-msg {
504 | padding-top: 36px;
505 | text-align: center;
506 | }
507 | .weui-msg__link {
508 | display: inline;
509 | color: #586C94;
510 | }
511 | .weui-msg__icon-area {
512 | margin-bottom: 30px;
513 | }
514 | .weui-msg__text-area {
515 | margin-bottom: 25px;
516 | padding: 0 20px;
517 | }
518 | .weui-msg__title {
519 | margin-bottom: 5px;
520 | font-weight: 400;
521 | font-size: 20px;
522 | }
523 | .weui-msg__desc {
524 | font-size: 14px;
525 | color: #999999;
526 | }
527 | .weui-msg__opr-area {
528 | margin-bottom: 25px;
529 | }
530 | .weui-msg__extra-area {
531 | margin-bottom: 15px;
532 | font-size: 14px;
533 | color: #999999;
534 | }
535 | @media screen and (min-height: 438px) {
536 | .weui-msg__extra-area {
537 | position: fixed;
538 | left: 0;
539 | bottom: 0;
540 | width: 100%;
541 | text-align: center;
542 | }
543 | }
544 | .weui-flex {
545 | display: -webkit-box;
546 | display: -webkit-flex;
547 | display: flex;
548 | }
549 | .weui-flex__item {
550 | -webkit-box-flex: 1;
551 | -webkit-flex: 1;
552 | flex: 1;
553 | }
554 | .weui-btn {
555 | margin-top: 15px;
556 | }
557 | .weui-btn:first-child {
558 | margin-top: 0;
559 | }
560 | .weui-btn-area {
561 | margin: 1.17647059em 15px 0.3em;
562 | }
563 | .weui-agree {
564 | display: block;
565 | padding: .5em 15px;
566 | font-size: 13px;
567 | }
568 | .weui-agree__text {
569 | color: #999999;
570 | }
571 | .weui-agree__link {
572 | display: inline;
573 | color: #586C94;
574 | }
575 | .weui-agree__checkbox {
576 | position: absolute;
577 | left: -9999px;
578 | }
579 | .weui-agree__checkbox-icon {
580 | position: relative;
581 | top: 2px;
582 | display: inline-block;
583 | border: 1px solid #D1D1D1;
584 | background-color: #FFFFFF;
585 | border-radius: 3px;
586 | width: 11px;
587 | height: 11px;
588 | }
589 | .weui-agree__checkbox-icon-check {
590 | position: absolute;
591 | top: 1px;
592 | left: 1px;
593 | }
594 | .weui-footer {
595 | color: #999999;
596 | font-size: 14px;
597 | text-align: center;
598 | }
599 | .weui-footer_fixed-bottom {
600 | position: fixed;
601 | bottom: .52em;
602 | left: 0;
603 | right: 0;
604 | }
605 | .weui-footer__links {
606 | font-size: 0;
607 | }
608 | .weui-footer__link {
609 | display: inline-block;
610 | vertical-align: top;
611 | margin: 0 .62em;
612 | position: relative;
613 | font-size: 14px;
614 | color: #586C94;
615 | }
616 | .weui-footer__link:before {
617 | content: " ";
618 | position: absolute;
619 | left: 0;
620 | top: 0;
621 | width: 1px;
622 | bottom: 0;
623 | border-left: 1rpx solid #C7C7C7;
624 | color: #C7C7C7;
625 | left: -0.65em;
626 | top: .36em;
627 | bottom: .36em;
628 | }
629 | .weui-footer__link:first-child:before {
630 | display: none;
631 | }
632 | .weui-footer__text {
633 | padding: 0 .34em;
634 | font-size: 12px;
635 | }
636 | .weui-grids {
637 | border-top: 1rpx solid #D9D9D9;
638 | border-left: 1rpx solid #D9D9D9;
639 | overflow: hidden;
640 | }
641 | .weui-grid {
642 | position: relative;
643 | float: left;
644 | padding: 20px 10px;
645 | width: 33.33333333%;
646 | box-sizing: border-box;
647 | border-right: 1rpx solid #D9D9D9;
648 | border-bottom: 1rpx solid #D9D9D9;
649 | }
650 | .weui-grid_active {
651 | background-color: #ECECEC;
652 | }
653 | .weui-grid__icon {
654 | display: block;
655 | width: 28px;
656 | height: 28px;
657 | margin: 0 auto;
658 | }
659 | .weui-grid__label {
660 | margin-top: 5px;
661 | display: block;
662 | text-align: center;
663 | color: #000000;
664 | font-size: 14px;
665 | white-space: nowrap;
666 | text-overflow: ellipsis;
667 | overflow: hidden;
668 | }
669 | .weui-loading {
670 | margin: 0 5px;
671 | width: 20px;
672 | height: 20px;
673 | display: inline-block;
674 | vertical-align: middle;
675 | -webkit-animation: weuiLoading 1s steps(12, end) infinite;
676 | animation: weuiLoading 1s steps(12, end) infinite;
677 | background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;
678 | background-size: 100%;
679 | }
680 | @-webkit-keyframes weuiLoading {
681 | 0% {
682 | -webkit-transform: rotate3d(0, 0, 1, 0deg);
683 | transform: rotate3d(0, 0, 1, 0deg);
684 | }
685 | 100% {
686 | -webkit-transform: rotate3d(0, 0, 1, 360deg);
687 | transform: rotate3d(0, 0, 1, 360deg);
688 | }
689 | }
690 | @keyframes weuiLoading {
691 | 0% {
692 | -webkit-transform: rotate3d(0, 0, 1, 0deg);
693 | transform: rotate3d(0, 0, 1, 0deg);
694 | }
695 | 100% {
696 | -webkit-transform: rotate3d(0, 0, 1, 360deg);
697 | transform: rotate3d(0, 0, 1, 360deg);
698 | }
699 | }
700 | .weui-badge {
701 | display: inline-block;
702 | padding: .15em .4em;
703 | min-width: 8px;
704 | border-radius: 18px;
705 | background-color: #F43530;
706 | color: #FFFFFF;
707 | line-height: 1.2;
708 | text-align: center;
709 | font-size: 12px;
710 | vertical-align: middle;
711 | }
712 | .weui-badge_dot {
713 | padding: .4em;
714 | min-width: 0;
715 | }
716 | .weui-loadmore {
717 | width: 65%;
718 | margin: 1.5em auto;
719 | line-height: 1.6em;
720 | font-size: 14px;
721 | text-align: center;
722 | }
723 | .weui-loadmore__tips {
724 | display: inline-block;
725 | vertical-align: middle;
726 | }
727 | .weui-loadmore_line {
728 | border-top: 1px solid #E5E5E5;
729 | margin-top: 2.4em;
730 | }
731 | .weui-loadmore__tips_in-line {
732 | position: relative;
733 | top: -0.9em;
734 | padding: 0 .55em;
735 | background-color: #FFFFFF;
736 | color: #999999;
737 | }
738 | .weui-loadmore__tips_in-dot {
739 | position: relative;
740 | padding: 0 .16em;
741 | width: 4px;
742 | height: 1.6em;
743 | }
744 | .weui-loadmore__tips_in-dot:before {
745 | content: " ";
746 | position: absolute;
747 | top: 50%;
748 | left: 50%;
749 | margin-top: -1px;
750 | margin-left: -2px;
751 | width: 4px;
752 | height: 4px;
753 | border-radius: 50%;
754 | background-color: #E5E5E5;
755 | }
756 | .weui-panel {
757 | background-color: #FFFFFF;
758 | margin-top: 10px;
759 | position: relative;
760 | overflow: hidden;
761 | }
762 | .weui-panel:first-child {
763 | margin-top: 0;
764 | }
765 | .weui-panel:before {
766 | content: " ";
767 | position: absolute;
768 | left: 0;
769 | top: 0;
770 | right: 0;
771 | height: 1px;
772 | border-top: 1rpx solid #E5E5E5;
773 | color: #E5E5E5;
774 | }
775 | .weui-panel:after {
776 | content: " ";
777 | position: absolute;
778 | left: 0;
779 | bottom: 0;
780 | right: 0;
781 | height: 1px;
782 | border-bottom: 1rpx solid #E5E5E5;
783 | color: #E5E5E5;
784 | }
785 | .weui-panel__hd {
786 | padding: 14px 15px 10px;
787 | color: #999999;
788 | font-size: 13px;
789 | position: relative;
790 | }
791 | .weui-panel__hd:after {
792 | content: " ";
793 | position: absolute;
794 | left: 0;
795 | bottom: 0;
796 | right: 0;
797 | height: 1px;
798 | border-bottom: 1rpx solid #E5E5E5;
799 | color: #E5E5E5;
800 | left: 15px;
801 | }
802 | .weui-media-box {
803 | padding: 15px;
804 | position: relative;
805 | }
806 | .weui-media-box:before {
807 | content: " ";
808 | position: absolute;
809 | left: 0;
810 | top: 0;
811 | right: 0;
812 | height: 1px;
813 | border-top: 1rpx solid #E5E5E5;
814 | color: #E5E5E5;
815 | left: 15px;
816 | }
817 | .weui-media-box:first-child:before {
818 | display: none;
819 | }
820 | .weui-media-box__title {
821 | font-weight: 400;
822 | font-size: 17px;
823 | width: auto;
824 | overflow: hidden;
825 | text-overflow: ellipsis;
826 | white-space: nowrap;
827 | word-wrap: normal;
828 | word-wrap: break-word;
829 | word-break: break-all;
830 | }
831 | .weui-media-box__desc {
832 | color: #999999;
833 | font-size: 13px;
834 | line-height: 1.2;
835 | overflow: hidden;
836 | text-overflow: ellipsis;
837 | display: -webkit-box;
838 | -webkit-box-orient: vertical;
839 | -webkit-line-clamp: 2;
840 | }
841 | .weui-media-box__info {
842 | margin-top: 15px;
843 | padding-bottom: 5px;
844 | font-size: 13px;
845 | color: #CECECE;
846 | line-height: 1em;
847 | list-style: none;
848 | overflow: hidden;
849 | }
850 | .weui-media-box__info__meta {
851 | float: left;
852 | padding-right: 1em;
853 | }
854 | .weui-media-box__info__meta_extra {
855 | padding-left: 1em;
856 | border-left: 1px solid #CECECE;
857 | }
858 | .weui-media-box__title_in-text {
859 | margin-bottom: 8px;
860 | }
861 | .weui-media-box_appmsg {
862 | display: -webkit-box;
863 | display: -webkit-flex;
864 | display: flex;
865 | -webkit-box-align: center;
866 | -webkit-align-items: center;
867 | align-items: center;
868 | }
869 | .weui-media-box__thumb {
870 | width: 100%;
871 | height: 100%;
872 | vertical-align: top;
873 | }
874 | .weui-media-box__hd_in-appmsg {
875 | margin-right: .8em;
876 | width: 60px;
877 | height: 60px;
878 | line-height: 60px;
879 | text-align: center;
880 | }
881 | .weui-media-box__bd_in-appmsg {
882 | -webkit-box-flex: 1;
883 | -webkit-flex: 1;
884 | flex: 1;
885 | min-width: 0;
886 | }
887 | .weui-media-box_small-appmsg {
888 | padding: 0;
889 | }
890 | .weui-cells_in-small-appmsg {
891 | margin-top: 0;
892 | }
893 | .weui-cells_in-small-appmsg:before {
894 | display: none;
895 | }
896 | .weui-progress {
897 | display: -webkit-box;
898 | display: -webkit-flex;
899 | display: flex;
900 | -webkit-box-align: center;
901 | -webkit-align-items: center;
902 | align-items: center;
903 | }
904 | .weui-progress__bar {
905 | -webkit-box-flex: 1;
906 | -webkit-flex: 1;
907 | flex: 1;
908 | }
909 | .weui-progress__opr {
910 | margin-left: 15px;
911 | font-size: 0;
912 | }
913 | .weui-navbar {
914 | display: -webkit-box;
915 | display: -webkit-flex;
916 | display: flex;
917 | position: absolute;
918 | z-index: 500;
919 | top: 0;
920 | width: 100%;
921 | border-bottom: 1rpx solid #CCCCCC;
922 | }
923 | .weui-navbar__item {
924 | position: relative;
925 | display: block;
926 | -webkit-box-flex: 1;
927 | -webkit-flex: 1;
928 | flex: 1;
929 | padding: 13px 0;
930 | text-align: center;
931 | font-size: 0;
932 | }
933 | .weui-navbar__item.weui-bar__item_on {
934 | color: #1AAD19;
935 | }
936 | .weui-navbar__slider {
937 | position: absolute;
938 | content: " ";
939 | left: 0;
940 | bottom: 0;
941 | width: 6em;
942 | height: 3px;
943 | background-color: #1AAD19;
944 | -webkit-transition: -webkit-transform .3s;
945 | transition: -webkit-transform .3s;
946 | transition: transform .3s;
947 | transition: transform .3s, -webkit-transform .3s;
948 | }
949 | .weui-navbar__title {
950 | display: inline-block;
951 | font-size: 15px;
952 | max-width: 8em;
953 | width: auto;
954 | overflow: hidden;
955 | text-overflow: ellipsis;
956 | white-space: nowrap;
957 | word-wrap: normal;
958 | }
959 | .weui-tab {
960 | position: relative;
961 | height: 100%;
962 | }
963 | .weui-tab__panel {
964 | box-sizing: border-box;
965 | height: 100%;
966 | padding-top: 50px;
967 | overflow: auto;
968 | -webkit-overflow-scrolling: touch;
969 | }
970 | .weui-search-bar {
971 | position: relative;
972 | padding: 8px 10px;
973 | display: -webkit-box;
974 | display: -webkit-flex;
975 | display: flex;
976 | box-sizing: border-box;
977 | background-color: #EFEFF4;
978 | border-top: 1rpx solid #D7D6DC;
979 | border-bottom: 1rpx solid #D7D6DC;
980 | }
981 | .weui-icon-search {
982 | margin-right: 8px;
983 | font-size: inherit;
984 | }
985 | .weui-icon-search_in-box {
986 | position: absolute;
987 | left: 10px;
988 | top: 7px;
989 | }
990 | .weui-search-bar__text {
991 | display: inline-block;
992 | font-size: 14px;
993 | vertical-align: middle;
994 | }
995 | .weui-search-bar__form {
996 | position: relative;
997 | -webkit-box-flex: 1;
998 | -webkit-flex: auto;
999 | flex: auto;
1000 | border-radius: 5px;
1001 | background: #FFFFFF;
1002 | border: 1rpx solid #E6E6EA;
1003 | }
1004 | .weui-search-bar__box {
1005 | position: relative;
1006 | padding-left: 30px;
1007 | padding-right: 30px;
1008 | width: 100%;
1009 | box-sizing: border-box;
1010 | z-index: 1;
1011 | }
1012 | .weui-search-bar__input {
1013 | height: 28px;
1014 | line-height: 28px;
1015 | font-size: 14px;
1016 | }
1017 | .weui-icon-clear {
1018 | position: absolute;
1019 | top: 0;
1020 | right: 0;
1021 | padding: 7px 8px;
1022 | font-size: 0;
1023 | }
1024 | .weui-search-bar__label {
1025 | position: absolute;
1026 | top: 0;
1027 | right: 0;
1028 | bottom: 0;
1029 | left: 0;
1030 | z-index: 2;
1031 | border-radius: 3px;
1032 | text-align: center;
1033 | color: #9B9B9B;
1034 | background: #FFFFFF;
1035 | line-height: 28px;
1036 | }
1037 | .weui-search-bar__cancel-btn {
1038 | margin-left: 10px;
1039 | line-height: 28px;
1040 | color: #09BB07;
1041 | white-space: nowrap;
1042 | }
1043 |
--------------------------------------------------------------------------------
/pages/addressAdd/index.js:
--------------------------------------------------------------------------------
1 | // pages/addressAdd/index.js
2 | const app = getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | region: ['广东省', '广州市', '海珠区'],
10 | customItem: '全部',
11 | name:'',
12 | mobile:'',
13 | detailed:'',
14 | addressIs:true,
15 | _id:null
16 | },
17 | bindRegionChange: function (e) {
18 | console.log('picker发送选择改变,携带值为', e.detail.value)
19 | console.log(e.detail.value)
20 | this.setData({
21 | region: e.detail.value
22 | })
23 | },
24 | bindKeyName: function (e) {
25 | this.setData({
26 | name: e.detail.value
27 | })
28 | },
29 | bindKeyMobile: function (e) {
30 | this.setData({
31 | mobile: e.detail.value
32 | })
33 | },
34 | bindKeyDetailed: function (e) {
35 | this.setData({
36 | detailed: e.detail.value
37 | })
38 | },
39 | submitFun: function () {
40 | if (this.data.addressIs){ //添加
41 | app.http('v1/user/addCity', {
42 | name: this.data.name,
43 | mobile: this.data.mobile,
44 | detailed: this.data.detailed,
45 | city: this.data.region
46 | }, 'POST')
47 | .then(res => {
48 | if (res.code == 200) {
49 | wx.navigateBack({
50 | delta: 1
51 | })
52 | }
53 | })
54 | }else{
55 | app.http('v1/user/editCity', {
56 | name: this.data.name,
57 | mobile: this.data.mobile,
58 | detailed: this.data.detailed,
59 | city: this.data.region,
60 | id: this.data._id
61 | }, 'POST')
62 | .then(res => {
63 | if (res.code == 200) {
64 | wx.navigateBack({
65 | delta: 1
66 | })
67 | }
68 | })
69 | }
70 | },
71 | /**
72 | * 生命周期函数--监听页面加载
73 | */
74 | onLoad: function (options) {
75 | if (options.id){
76 | this.setData({
77 | region: options.city.split(','),
78 | name: options.name,
79 | mobile: options.mobile,
80 | detailed: options.detailed,
81 | _id: options.id,
82 | addressIs:false
83 | })
84 | }
85 | },
86 |
87 | /**
88 | * 生命周期函数--监听页面初次渲染完成
89 | */
90 | onReady: function () {
91 |
92 | },
93 |
94 | /**
95 | * 生命周期函数--监听页面显示
96 | */
97 | onShow: function () {
98 |
99 | },
100 |
101 | /**
102 | * 生命周期函数--监听页面隐藏
103 | */
104 | onHide: function () {
105 |
106 | },
107 |
108 | /**
109 | * 生命周期函数--监听页面卸载
110 | */
111 | onUnload: function () {
112 |
113 | },
114 |
115 | /**
116 | * 页面相关事件处理函数--监听用户下拉动作
117 | */
118 | onPullDownRefresh: function () {
119 |
120 | },
121 |
122 | /**
123 | * 页面上拉触底事件的处理函数
124 | */
125 | onReachBottom: function () {
126 |
127 | },
128 |
129 | /**
130 | * 用户点击右上角分享
131 | */
132 | onShareAppMessage: function () {
133 |
134 | }
135 | })
--------------------------------------------------------------------------------
/pages/addressAdd/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "新增地址"
3 | }
--------------------------------------------------------------------------------
/pages/addressAdd/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 | 联系人
12 |
13 |
14 |
15 | 手机号
16 |
17 |
18 |
19 | 地区
20 |
21 |
22 | {{region[0]}} {{region[1]}} {{region[2]}}
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | 详细地址
31 |
32 |
33 |
34 | 保存
35 |
--------------------------------------------------------------------------------
/pages/addressAdd/index.wxss:
--------------------------------------------------------------------------------
1 | .main{
2 |
3 | height: 100vh;
4 | background: #e8e9e8;
5 | }
6 | .item{
7 | display: flex;
8 | border-bottom: 1px solid #d8d8d8;
9 | line-height: 40px;
10 | padding: 15px 0 0 0;
11 |
12 | }
13 | .data{
14 | background: #fff;
15 | padding: 0 20px;
16 | }
17 | .item text {
18 | flex: 0 1 25%;
19 | font-size: 14px;
20 | color: #333333;
21 | }
22 |
23 | .item input{
24 | flex: 1 1 auto;
25 | font-size: 16px;
26 | color: #333333;
27 | line-height: 40px;
28 | height: 40px;
29 | }
30 |
31 | .item .code{
32 | flex: 0 1 25%;
33 | font-size: 12px;
34 | color:#ff5f19;
35 | border-left: 1px solid #d8d8d8;
36 | text-align: center;
37 | height: 24px;
38 | margin: 8px 0;
39 | line-height: 24px;
40 | }
41 |
42 | .item .icon{
43 | flex: 0 1 10%;
44 | text-align: right;
45 | }
46 |
47 | .item picker{
48 | flex: 1 1 auto;
49 | font-size:16px;
50 | }
51 |
52 | .item .icon image{
53 | width:8px;
54 | height:15px;
55 | }
56 |
57 | .text{
58 | font-size: 12px;
59 | color: #999999;
60 | background: #fff;
61 | padding: 10px 20px;
62 | }
63 |
64 | .btn{
65 | line-height: 46px;
66 | background: #E5E5E5;
67 | font-size: 18px;
68 | color: #FFFFFF;
69 | text-align:center;
70 | margin:50px 30px;
71 | border-radius:2px;
72 | }
73 | .active{
74 | background:#ff5f19;
75 | }
--------------------------------------------------------------------------------
/pages/addressList/index.js:
--------------------------------------------------------------------------------
1 | // pages/addressList/index.js
2 | const app = getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | list:[],
10 | id:'',
11 | state:null,
12 | },
13 |
14 | /**
15 | * 生命周期函数--监听页面加载
16 | */
17 | defaultFun:function(data){
18 | app.http('v1/user/defaultCity', {
19 | id: data.currentTarget.dataset.item._id
20 | }, 'POST')
21 | .then(res => {
22 | app.globalData.userInfo.address = res.data
23 | this.setData({
24 | id: res.data._id
25 | })
26 | if (this.data.state == 1){
27 | wx.navigateBack({
28 | delta: 1
29 | })
30 | }
31 | })
32 | },
33 | onLoad: function (options) {
34 | this.setData({
35 | id: app.globalData.userInfo.address._id,
36 | state: options ? options.type:null
37 | })
38 | },
39 |
40 | /**
41 | * 生命周期函数--监听页面初次渲染完成
42 | */
43 | onReady: function () {
44 |
45 | },
46 |
47 | /**
48 | * 生命周期函数--监听页面显示
49 | */
50 | onShow: function () {
51 | app.http('v1/user/cityList', {
52 | openid: app.globalData.openid
53 | })
54 | .then(res => {
55 | this.setData({
56 | list: res.data
57 | })
58 | })
59 | },
60 |
61 | /**
62 | * 生命周期函数--监听页面隐藏
63 | */
64 | onHide: function () {
65 |
66 | },
67 |
68 | /**
69 | * 生命周期函数--监听页面卸载
70 | */
71 | onUnload: function () {
72 |
73 | },
74 |
75 | /**
76 | * 页面相关事件处理函数--监听用户下拉动作
77 | */
78 | onPullDownRefresh: function () {
79 |
80 | },
81 |
82 | /**
83 | * 页面上拉触底事件的处理函数
84 | */
85 | onReachBottom: function () {
86 |
87 | },
88 |
89 | /**
90 | * 用户点击右上角分享
91 | */
92 | onShareAppMessage: function () {
93 |
94 | }
95 | })
--------------------------------------------------------------------------------
/pages/addressList/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "我的地址"
3 | }
--------------------------------------------------------------------------------
/pages/addressList/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{item.mobile}} {{item.name}} 收
7 | {{item.city[0]}} {{item.city[1]}} {{item.city[2]}} {{item.detailed}}
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 新增收货地址
23 |
24 |
--------------------------------------------------------------------------------
/pages/addressList/index.wxss:
--------------------------------------------------------------------------------
1 | .list .item{
2 | display: flex;
3 | margin: 0 18px;
4 | border-bottom: 1px solid #dedede;
5 | padding: 15px 0;
6 | align-items: center;
7 | height: 98px;
8 | }
9 | .item .left{
10 | flex: 1 0 80%;
11 | font-size: 14px;
12 | }
13 | .item .edit,.choice{
14 | flex: 1 0 10%;
15 | text-align: center;
16 | }
17 | .item .edit image{
18 | width: 20px;
19 | height: 20px;
20 | }
21 | .item .choice image{
22 | width: 20px;
23 | height: 20px;
24 | }
25 |
26 | .btn{
27 | height: 8vh;
28 | line-height: 8vh;
29 | text-align: center;
30 | background:#ff5f19;
31 | font-size: 14px;
32 | color: #fff;
33 | }
--------------------------------------------------------------------------------
/pages/bindPhone/index.js:
--------------------------------------------------------------------------------
1 | // pages/bindPhone/index.js
2 |
3 | const app = getApp()
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | code:'',
11 | mobile:''
12 | },
13 | bindKeyInput: function (e) {
14 | this.setData({
15 | mobile: e.detail.value
16 | })
17 | },
18 | bindKeyCode:function(e){
19 | this.setData({
20 | code: e.detail.value
21 | })
22 | },
23 | submitFun:function(){
24 | app.http('v1/user/bindMobile', {
25 | code: this.data.code,
26 | mobile: this.data.mobile,
27 | openid: getApp().globalData.openid
28 | },'POST')
29 | .then(res => {
30 | if (res.code == 200) {
31 | wx.reLaunch({
32 | url: "/pages/index/index"
33 | });
34 | }
35 | })
36 | },
37 | /**
38 | * 生命周期函数--监听页面加载
39 | */
40 | onLoad: function (options) {
41 |
42 | },
43 |
44 | /**
45 | * 生命周期函数--监听页面初次渲染完成
46 | */
47 | onReady: function () {
48 |
49 | },
50 |
51 | /**
52 | * 生命周期函数--监听页面显示
53 | */
54 | onShow: function () {
55 |
56 | },
57 |
58 | /**
59 | * 生命周期函数--监听页面隐藏
60 | */
61 | onHide: function () {
62 |
63 | },
64 |
65 | /**
66 | * 生命周期函数--监听页面卸载
67 | */
68 | onUnload: function () {
69 |
70 | },
71 |
72 | /**
73 | * 页面相关事件处理函数--监听用户下拉动作
74 | */
75 | onPullDownRefresh: function () {
76 |
77 | },
78 |
79 | /**
80 | * 页面上拉触底事件的处理函数
81 | */
82 | onReachBottom: function () {
83 |
84 | },
85 |
86 | /**
87 | * 用户点击右上角分享
88 | */
89 | onShareAppMessage: function () {
90 |
91 | }
92 | })
--------------------------------------------------------------------------------
/pages/bindPhone/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "绑定手机"
3 | }
--------------------------------------------------------------------------------
/pages/bindPhone/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 手机号
5 |
6 |
7 | 获取验证码
8 |
9 |
10 |
11 | 验证码
12 |
13 |
14 |
15 | 根据国家政策,首次注册的用户需完成绑定手机号操作,下次
16 | 进入可直接通过微信授权自动登录。
17 |
18 |
19 |
20 | 保存
21 |
--------------------------------------------------------------------------------
/pages/bindPhone/index.wxss:
--------------------------------------------------------------------------------
1 | .main{
2 |
3 | height: 100vh;
4 | background: #e8e9e8;
5 | }
6 | .item{
7 | display: flex;
8 | border-bottom: 1px solid #d8d8d8;
9 | line-height: 40px;
10 | padding: 15px 0 0 0;
11 |
12 | }
13 | .data{
14 | background: #fff;
15 | padding: 0 20px;
16 | }
17 | .item text {
18 | flex: 0 1 25%;
19 | font-size: 14px;
20 | color: #333333;
21 | }
22 |
23 | .item input{
24 | flex: 1 1 auto;
25 | font-size: 16px;
26 | color: #333333;
27 | line-height: 40px;
28 | height: 40px;
29 | }
30 |
31 | .item .code{
32 | flex: 0 1 25%;
33 | font-size: 12px;
34 | color:#ff5f19;
35 | border-left: 1px solid #d8d8d8;
36 | text-align: center;
37 | height: 24px;
38 | margin: 8px 0;
39 | line-height: 24px;
40 | }
41 |
42 | .text{
43 | font-size: 12px;
44 | color: #999999;
45 | background: #fff;
46 | padding: 10px 20px;
47 | }
48 |
49 | .btn{
50 | line-height: 46px;
51 | background: #E5E5E5;
52 | font-size: 18px;
53 | color: #FFFFFF;
54 | text-align:center;
55 | margin:50px 30px;
56 | border-radius:2px;
57 | }
58 | .active{
59 | background:#ff5f19;
60 | }
--------------------------------------------------------------------------------
/pages/cart/index.js:
--------------------------------------------------------------------------------
1 | const app = getApp()
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | total:false, //是否全选
9 | totalPrice:0, //总价
10 | list:[],
11 | isEdit:false
12 | },
13 | totalPrice(){//计算总价
14 | let that = this
15 | let price = 0
16 | for(let i=0;i{
36 | if (this.data.total) {
37 | v.select = true
38 | } else {
39 | v.select = false
40 | }
41 | })
42 | this.setData({
43 | list: this.data.list,
44 | total: this.data.total
45 | })
46 |
47 | this.totalPrice()
48 | },
49 | labelFun(e){//单选
50 | let that = this
51 | let num = 0
52 | for (let i = 0; i < that.data.list.length;i++){
53 | if (that.data.list[i].id == e.currentTarget.dataset.id){
54 | if (!that.data.list[i].select){
55 | that.data.list[i].select = true
56 | }else{
57 | that.data.list[i].select = !that.data.list[i].select
58 | }
59 | that.setData({
60 | list: that.data.list
61 | })
62 | }
63 |
64 | if (that.data.list[i].select){
65 | num++
66 | if (num == that.data.list.length){
67 | that.setData({
68 | total: true
69 | })
70 | }else{
71 | that.setData({
72 | total: false
73 | })
74 | }
75 | }
76 | }
77 | this.totalPrice()
78 | },
79 | editFun(){ //编辑
80 | this.setData({
81 | isEdit: !this.data.isEdit
82 | })
83 |
84 | if (!this.data.isEdit){
85 | console.log(this.data.list)
86 | app.http('v1/order/editCart',{list:this.data.list},"POST")
87 | .then(res=>{
88 | console.log(res)
89 | })
90 | }
91 | },
92 | plusFun(item){ //增加商品数量
93 | this.data.list.map((v,k)=>{
94 | if (v.id == item.target.dataset.item.id){
95 | this.data.list[k].num++
96 | }
97 | })
98 |
99 | this.setData({
100 | list: this.data.list
101 | })
102 |
103 | this.totalPrice()
104 | },
105 | reduceFun(item) { //减少商品数量
106 | this.data.list.map((v, k) => {
107 | if (v.id == item.target.dataset.item.id) {
108 | if (this.data.list[k].num > 1){
109 | this.data.list[k].num--
110 | }
111 | }
112 | })
113 | this.setData({
114 | list: this.data.list
115 | })
116 |
117 | this.totalPrice()
118 | },
119 | delItemFun(item){ //删除单商品
120 |
121 | let id = item.target?item.target.dataset.item.id:item.id
122 |
123 | this.data.list.map((v, k) => {
124 | if (v.id == id) {
125 | this.data.list.splice(k,1)
126 | }
127 | })
128 |
129 | this.setData({
130 | list: this.data.list
131 | })
132 |
133 | this.totalPrice()
134 | },
135 | delFun(){ //选中删除
136 | let list = []
137 |
138 | this.data.list.map((v, k) => {
139 | if (!v.select){
140 | list.push(v)
141 | }
142 | })
143 |
144 | this.setData({
145 | list: list
146 | })
147 |
148 | this.totalPrice()
149 |
150 | },
151 | closeFun:function(){
152 | let list = []
153 | let listTotal = []
154 | this.data.list.map((v, k) => {
155 | if (v.select) {
156 | list.push(v)
157 | }else{
158 | listTotal.push(v)
159 | }
160 | })
161 | app.http('v1/order/set', { goods: list},"POST").then(res=>{
162 | if(res.code == 200){
163 | app.http('v1/order/editCart', { list: listTotal }, "POST")
164 | .then(res => {
165 | console.log(res)
166 | })
167 | wx.navigateTo({
168 | url: "/pages/orderDetails/index?id=" + res.data._id
169 | });
170 | }
171 | })
172 |
173 | },
174 | /**
175 | * 生命周期函数--监听页面加载
176 | */
177 | onLoad: function (options) {
178 |
179 | },
180 |
181 | /**
182 | * 生命周期函数--监听页面初次渲染完成
183 | */
184 | onReady: function () {
185 |
186 | },
187 |
188 | /**
189 | * 生命周期函数--监听页面显示
190 | */
191 | onShow: function () {
192 | app.http('v1/order/cartList').then(res=>{
193 | console.log(res.data)
194 | let list = []
195 | res.data.map((v, k)=>{
196 | list.push({
197 | img:v.img,
198 | num:v.num,
199 | price:v.price,
200 | spec:v.spec,
201 | title:v.title,
202 | id:v.id,
203 | select:false
204 | })
205 | })
206 | this.setData({
207 | list: list,
208 | total:false,
209 | totalPrice: 0,
210 | })
211 | })
212 | },
213 |
214 | /**
215 | * 生命周期函数--监听页面隐藏
216 | */
217 | onHide: function () {
218 |
219 | },
220 |
221 | /**
222 | * 生命周期函数--监听页面卸载
223 | */
224 | onUnload: function () {
225 |
226 | },
227 |
228 | /**
229 | * 页面相关事件处理函数--监听用户下拉动作
230 | */
231 | onPullDownRefresh: function () {
232 |
233 | },
234 |
235 | /**
236 | * 页面上拉触底事件的处理函数
237 | */
238 | onReachBottom: function () {
239 |
240 | },
241 |
242 | /**
243 | * 用户点击右上角分享
244 | */
245 | onShareAppMessage: function () {
246 |
247 | }
248 | })
--------------------------------------------------------------------------------
/pages/cart/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "购物车",
3 | "disableScroll": true
4 | }
--------------------------------------------------------------------------------
/pages/cart/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 深圳
8 | 编辑
9 | 完成
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | {{item.title}}
21 | {{item.spec}}
22 |
23 | ¥{{item.price}}
24 | x{{item.num}}
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | -
39 |
40 | +
41 |
42 | {{item.spec}}
43 |
44 | ¥{{item.price}}
45 |
46 |
47 |
48 |
49 | 删除
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | 全选
61 |
62 |
63 | 合计:¥{{totalPrice}}
64 | 不含运费
65 |
66 |
67 |
68 | 结算
69 |
70 |
71 | 删除
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/pages/cart/index.wxss:
--------------------------------------------------------------------------------
1 | /* pages/cart/index.wxss */
2 | .top{
3 | display: flex;
4 | line-height: 44px;
5 | border-top: 1px solid #EDEDED;
6 | border-bottom: 1px solid #EDEDED;
7 | font-size: 14px;
8 | padding: 0 16px;
9 | align-items: center;
10 | }
11 |
12 | .top .city{
13 | padding-left: 30px;
14 | color: #999;
15 | }
16 |
17 | .top .edit-btn{
18 | color: #6EA1F5;
19 | flex-grow: 1;
20 | display: flex;
21 | justify-content: flex-end;
22 | }
23 |
24 | .label{
25 | width: 20px;
26 | height:20px;
27 | }
28 |
29 | .label image {
30 | display: block;
31 | width: 20px;
32 | height: 20px;
33 | }
34 |
35 | .list .item{
36 | display: flex;
37 | border-bottom: 1px solid #EDEDED;
38 | padding: 0 16px;
39 | height: 118px;
40 | align-items: center;
41 | }
42 |
43 | .list .label{
44 | flex: 0 0 auto;
45 | padding:10px 0;
46 | }
47 |
48 | .list .content{
49 | flex-grow: 1;
50 | display:flex;
51 | }
52 |
53 | .list .content image{
54 | flex: 0 0 auto;
55 | height: 94px;
56 | width: 94px;
57 | padding:10px;
58 | }
59 |
60 | .list .content .text{
61 | flex-grow: 1;
62 | font-size: 14px;
63 | }
64 |
65 | .list .content .title{
66 | height: 44px;
67 | overflow: hidden;
68 | }
69 |
70 | .list .content .spec{
71 | font-size: 12px;
72 | color: #333333;
73 | overflow: hidden;
74 | text-overflow: ellipsis;
75 | display: -webkit-box;
76 | line-height: 24px;
77 | max-height: 24px;
78 | -webkit-line-clamp: 1;
79 | -webkit-box-orient: vertical;
80 | }
81 |
82 | .list .content .price{
83 | display: flex;
84 | font-size: 14px;
85 | padding-top:10px;
86 | }
87 |
88 | .list .content .price text:nth-child(1){
89 | color: #ff5f19;
90 | flex: 1 0 50%;
91 | }
92 |
93 | .list .content .price text:nth-child(2){
94 | color: #999999;
95 | flex: 1 0 50%;
96 | text-align: right;
97 | }
98 |
99 | .bottom{
100 | display: flex;
101 | font-size: 14px;
102 | }
103 |
104 | .bottom .left{
105 | display: flex;
106 | flex: 1 0 70%;
107 | align-items: center;
108 | }
109 |
110 | .bottom .left .text{
111 | display: flex;
112 | flex: 0 0 50%;
113 |
114 | }
115 |
116 | .bottom .left .total-price{
117 | flex: 0 0 50%;
118 | color: #333333;
119 | text-align: right;
120 | }
121 |
122 | .bottom .right{
123 | flex: 1 0 30%;
124 | background: #ff5f19;
125 | font-size: 17px;
126 | color: #FFFFFF;
127 | text-align: center;
128 | line-height: 10vh;
129 | }
130 |
131 | .edit{
132 | padding-right: 0px !important;
133 | }
134 |
135 | .edit .title{
136 | display: flex;
137 | width: 70%;
138 | line-height: 32px;
139 | text-align: center;
140 | border: 1px solid #D5D5D5;
141 | height: 32px !important;
142 | margin: 5px 0;
143 | }
144 |
145 | .edit .title input {
146 | flex: 1 0 33.333%;
147 | border-left: 1px solid #D5D5D5;
148 | border-right: 1px solid #D5D5D5;
149 | height: 32px;
150 | }
151 |
152 | .edit .title text {
153 | flex: 1 0 33.333%;
154 | height: 32px;
155 | font-size: 18px;
156 | }
157 |
158 | .edit .del-btn{
159 | line-height:118px;
160 | width: 65px;
161 | background: #ff5f19;
162 | font-size: 14px;
163 | color: #fff;
164 | text-align: center;
165 | }
166 |
167 | .prohibit{
168 | background: #E5E5E5 !important;
169 | }
170 |
--------------------------------------------------------------------------------
/pages/coupon/index.js:
--------------------------------------------------------------------------------
1 | // pages/coupon/index.js
2 | const app = getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | tabIndex:1,
10 | list:[],
11 | },
12 | tabFun(e){
13 | this.getList(e.currentTarget.dataset.index)
14 | this.setData({
15 | tabIndex: e.currentTarget.dataset.index
16 | })
17 | },
18 | /**
19 | * 生命周期函数--监听页面加载
20 | */
21 | getList:function(id){
22 | app.http('v1/user/couponList', {
23 | state: id
24 | }, "get")
25 | .then(res => {
26 | this.setData({
27 | list:res.data
28 | })
29 | })
30 | },
31 | onLoad: function (options) {
32 | this.getList(this.data.tabIndex)
33 | app.http('/v1/user/getCoupon',{
34 | id:"5b9b235f53b9af1484cbd54f"
35 | },'POST').then(res=>{
36 |
37 | })
38 | },
39 |
40 | /**
41 | * 生命周期函数--监听页面初次渲染完成
42 | */
43 | onReady: function () {
44 |
45 | },
46 |
47 | /**
48 | * 生命周期函数--监听页面显示
49 | */
50 | onShow: function () {
51 |
52 | },
53 |
54 | /**
55 | * 生命周期函数--监听页面隐藏
56 | */
57 | onHide: function () {
58 |
59 | },
60 |
61 | /**
62 | * 生命周期函数--监听页面卸载
63 | */
64 | onUnload: function () {
65 |
66 | },
67 |
68 | /**
69 | * 页面相关事件处理函数--监听用户下拉动作
70 | */
71 | onPullDownRefresh: function () {
72 |
73 | },
74 |
75 | /**
76 | * 页面上拉触底事件的处理函数
77 | */
78 | onReachBottom: function () {
79 |
80 | },
81 |
82 | /**
83 | * 用户点击右上角分享
84 | */
85 | onShareAppMessage: function () {
86 |
87 | }
88 | })
--------------------------------------------------------------------------------
/pages/coupon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "优惠券"
3 | }
--------------------------------------------------------------------------------
/pages/coupon/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 未使用
5 |
6 |
7 | 已使用
8 |
9 |
10 | 已过期
11 |
12 |
13 |
14 |
15 |
16 | ¥{{item.money}}
17 |
18 |
19 | {{item.name}}
20 | 满{{item.condition}}元可用,特价商品除外
21 |
22 | 未过期
23 | {{item.effective[0]}}-{{item.effective[1]}}
24 |
25 |
26 | 已使用
27 |
28 |
29 | 已过期
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/pages/coupon/index.wxss:
--------------------------------------------------------------------------------
1 | .tab{
2 | height: 7vh;
3 | display: flex;
4 | line-height: 7vh;
5 | }
6 |
7 | .tab view{
8 | flex: 1 0 auto;
9 | font-size: 14px;
10 | color: #333333;
11 | text-align: center;
12 | }
13 | .tab .active{
14 | color: #ff5f19;
15 | border-bottom: 1px solid #ff5f19;
16 | padding-bottom:1.8vh;
17 | }
18 | .list{
19 | height: 93vh;
20 | }
21 |
22 | .item{
23 | display: flex;
24 | border: 1px solid #C5B558;
25 | height: 120px;
26 | margin: 10px 10px 0 10px;
27 | }
28 |
29 | .item .left{
30 | flex: 0 1 25%;
31 | text-align: center;
32 | line-height: 50px;
33 | font-size: 36px;
34 | margin: 32px 0;
35 | color: #ff5f19;
36 | border-right: 2px dashed #C5B558;
37 | }
38 | .item .left text{
39 | font-size: 20px;
40 | color: #ff5f19;
41 | }
42 |
43 | .item .right{
44 | flex: 1 1 auto;
45 | font-size: 12px;
46 | color: #999999;
47 | margin-top: 32px;
48 | margin-left: 25px;
49 | }
50 |
51 | .item .right text{
52 | color: #ff5f19;
53 | }
--------------------------------------------------------------------------------
/pages/details/index.js:
--------------------------------------------------------------------------------
1 | // pages/details/index.js
2 | const app = getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | imgUrls: [
10 | 'https://wx.yogalt.com/file/images/img1.jpeg',
11 | 'https://wx.yogalt.com/file/images/img2.jpeg',
12 | 'https://wx.yogalt.com/file/images/img3.jpeg'
13 | ],
14 | indicatorDots: true,
15 | autoplay: true,
16 | interval: 5000,
17 | duration: 1000,
18 | tabIs:true,
19 | specIs:false,
20 | data:null
21 | },
22 | tabFun(e){
23 | console.log(e)
24 | if (e.currentTarget.dataset.state == 1){
25 | this.setData({
26 | tabIs:true
27 | })
28 | }else{
29 | this.setData({
30 | tabIs: false
31 | })
32 | }
33 | },
34 | goShopCar: function () {
35 | wx.reLaunch({
36 | url: "/pages/cart/index"
37 | });
38 | },
39 | specFun(){
40 | this.setData({
41 | specIs: !this.data.specIs
42 | })
43 | },
44 | addCart(){
45 | app.http('v1/order/addCart', {
46 | id: this.data.data._id,
47 | num: 1,
48 | spec:['asdasasd'],
49 | title: this.data.data.title,
50 | img: this.data.data.img,
51 | price: this.data.data.price
52 | },"POST",)
53 | .then(res=>{
54 | console.log(res)
55 | if(res.code == 200){
56 | wx.showToast({
57 | title: '已加入购物车',
58 | icon: 'success',
59 | duration: 2000
60 | })
61 | }
62 | })
63 | },
64 | /**
65 | * 生命周期函数--监听页面加载
66 | */
67 | onLoad: function (options) {
68 | app.http('v1/home/getItem', { id: options.id})
69 | .then(res=>{
70 | this.setData({
71 | data: res.data
72 | })
73 | })
74 | },
75 |
76 | /**
77 | * 生命周期函数--监听页面初次渲染完成
78 | */
79 | onReady: function () {
80 |
81 | },
82 |
83 | /**
84 | * 生命周期函数--监听页面显示
85 | */
86 | onShow: function () {
87 |
88 | },
89 |
90 | /**
91 | * 生命周期函数--监听页面隐藏
92 | */
93 | onHide: function () {
94 |
95 | },
96 |
97 | /**
98 | * 生命周期函数--监听页面卸载
99 | */
100 | onUnload: function () {
101 |
102 | },
103 |
104 | /**
105 | * 页面相关事件处理函数--监听用户下拉动作
106 | */
107 | onPullDownRefresh: function () {
108 |
109 | },
110 |
111 | /**
112 | * 页面上拉触底事件的处理函数
113 | */
114 | onReachBottom: function () {
115 |
116 | },
117 |
118 | /**
119 | * 用户点击右上角分享
120 | */
121 | onShareAppMessage: function () {
122 |
123 | }
124 | })
--------------------------------------------------------------------------------
/pages/details/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "商品详情"
3 | }
--------------------------------------------------------------------------------
/pages/details/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | {{data.title}}
17 |
18 | {{data.spec}}
19 |
20 |
21 |
22 | ¥
23 | {{data.price}}
24 |
25 |
26 |
27 | 运费:免运费
28 |
29 |
30 | 销量:3424
31 |
32 |
33 |
36 |
37 |
38 | 产品详情
39 |
40 |
41 | 售后保障
42 |
43 |
44 |
45 | 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情 产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情产品详情
46 |
47 |
48 | 售后保障
49 |
50 |
51 |
52 |
53 |
54 | 购物车
55 |
56 |
57 |
58 | 加入购物车
59 |
60 |
61 | 立即购买
62 |
63 |
64 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/pages/details/index.wxss:
--------------------------------------------------------------------------------
1 | swiper{
2 | width: 100%;
3 | height: 60vh;
4 | }
5 | .title{
6 | font-size: 15px;
7 | color: #333333;
8 | padding: 8px 12px 4px 12px;
9 | }
10 | .price{
11 | font-size: 20px;
12 | color: #ff5f19;
13 | padding: 0 12px;
14 | border-bottom: 1px solid #dedede;
15 | }
16 | .price text{
17 | font-size: 14px;
18 | }
19 |
20 | .spec{
21 | font-size: 14px;
22 | color: #333333;
23 | }
24 |
25 | .bottom{
26 | height: 8vh;
27 | overflow: hidden;
28 | display: flex;
29 |
30 | }
31 |
32 | .bottom .btn{
33 | flex: 1 0 45%;
34 | text-align: center;
35 | font-size: 14px;
36 | color: #fff;
37 | background: #ff5f19;
38 | line-height: 8vh;
39 | }
40 |
41 | .bottom .icon{
42 | flex: 1 0 10%;
43 | font-size: 10px;
44 | text-align: center;
45 | }
46 | .bottom .icon image{
47 | padding-top: 5px;
48 | }
49 | .bottom .icon text{
50 | display: block;
51 | color: #666666;
52 | }
53 |
54 | .freight{
55 | display: flex;
56 | line-height: 35px;
57 | font-size: 12px;
58 | color: #666666;
59 | border-bottom: 2px solid #dedede;
60 | padding:0 12px;
61 | }
62 | .freight view{
63 | flex: 1 0 50%;
64 | }
65 |
66 | .freight .right{
67 | text-align: right;
68 | }
69 |
70 | .choice{
71 | line-height: 35px;
72 | padding: 0 12px;
73 | font-size: 12px;
74 | color: #333333;
75 | border-bottom: 2px solid #dedede;
76 | }
77 |
78 | .tab{
79 | display: flex;
80 | }
81 |
82 | .tab view{
83 | flex:1 0 50%;
84 | text-align: center;
85 | font-size: 13px;
86 | color: #333333;
87 | line-height: 40px;
88 | border-bottom: 1px solid #dedede;
89 | }
90 | .tab-acitve{
91 | color: #ff5f19;
92 | border-bottom: 1px solid #ff5f19;
93 | padding-bottom:11px;
94 | }
95 |
96 | .popup{
97 | position: fixed;
98 | z-index: 10;
99 | width: 100%;
100 | height: 100vh;
101 | top: 0;
102 | background: rgba(0, 0, 0, 0.5);
103 | }
104 |
105 | .popup .content{
106 | height: 48vh;
107 | background: #fff;
108 | }
109 |
110 | .popup .btn{
111 | height: 8vh;
112 | background: #ff5f19;
113 | font-size: 18px;
114 | color: #FFFFFF;
115 | text-align: center;
116 | line-height: 8vh;
117 | }
118 | .popup .text{
119 | flex: 1 1 auto;
120 | padding: 10px 0 0 8px;
121 | }
122 | .popup .text view{
123 | font-size: 17px;
124 | color: #ff5f19;
125 | }
126 |
127 | .popup .title{
128 | margin-top: 30vh;
129 | height: 14vh;
130 | display: flex;
131 | border-bottom: 1px solid #dedede;
132 | padding:0 10px;
133 | background: #fff;
134 | }
135 |
136 | .popup .title .img{
137 | flex: 0 1 auto;
138 | width: 84px;
139 | height: 84px;
140 | margin-top:-15px;
141 | }
142 | .popup .title .img image{
143 | height: 84px;
144 | width: 84px;
145 | }
146 |
147 | .popup .title .icon{
148 | flex: 0 0 auto;
149 | width: 22px;
150 | height: 22px;
151 | padding-top: 10px;
152 | }
153 | .popup .title .icon image{
154 | width: 22px;
155 | height: 22px;
156 | }
157 | .popup .content .item {
158 | padding: 0 15px;
159 | }
160 | .popup .content .item text{
161 | font-size: 14px;
162 | color: #333333;
163 | }
164 | .popup .content .item .list{
165 | display: flex;
166 | flex-wrap:wrap;
167 | margin-top: 10px;
168 | }
169 | .popup .content .item .list view{
170 | flex: 0 1 auto;
171 | font-size: 12px;
172 | color: #333333;
173 | line-height: 28px;
174 | padding: 0 15px;
175 | border: 1px solid #979797;
176 | border-radius: 2px;
177 | margin-right: 10px;
178 | margin-bottom: 10px;
179 | }
180 |
181 | .active{
182 | border-color: #ff5f19 !important;
183 | color: #ff5f19 !important;
184 | }
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp()
4 |
5 | Page({
6 | data: {
7 | motto: 'Hello World',
8 | userInfo: {},
9 | hasUserInfo: false,
10 | canIUse: wx.canIUse('button.open-type.getUserInfo'),
11 | imgUrls: null,
12 | baseUrl:"https://wx.yogalt.com/",
13 | indicatorDots: true,
14 | autoplay: true,
15 | interval: 5000,
16 | duration: 1000,
17 | list:[],
18 | page:1
19 | },
20 | //事件处理函数
21 | bindViewTap: function() {
22 | wx.navigateTo({
23 | url: '../logs/logs'
24 | })
25 | },
26 | addCart(data) {
27 | let item = data.currentTarget.dataset.item
28 | app.http('v1/order/addCart', {
29 | id: item._id,
30 | num: 1,
31 | spec: ['asdasasd'],
32 | title: item.title,
33 | img: item.img,
34 | price: item.price
35 | }, "POST")
36 | .then(res => {
37 | console.log(res)
38 | if (res.code == 200) {
39 | wx.showToast({
40 | title: '已加入购物车',
41 | icon: 'success',
42 | duration: 500
43 | })
44 | }
45 | })
46 | },
47 | imgsc:function(e){
48 | wx.chooseImage({
49 | count: 1, // 默认9
50 | sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
51 | sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
52 | success: function (res) {
53 | // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
54 | var tempFilePaths = res.tempFilePaths;
55 | wx.uploadFile({
56 | url: 'https://wx.yogalt.com/api/v1/admin/uploadBanner', //此处换上你的接口地址
57 | filePath: tempFilePaths[0],
58 | name: 'inputFile',
59 | header: {
60 | "Content-Type": "multipart/form-data",
61 | 'accept': 'application/json',
62 | },
63 | formData: {
64 | href:'www.baidu.com', //跳转地址
65 | name:'大蛋糕', //名称
66 | is_hide:true, //是否显示
67 | effective:'2018-09-14,2019-09-14', //有效期
68 | },
69 | success: function (res) {
70 | var data = res.data;
71 | console.log('data');
72 | },
73 | fail: function (res) {
74 | console.log('fail');
75 |
76 | },
77 | })
78 | }
79 | })
80 | },
81 | lower:function(e){
82 | console.log(e)
83 | this.getList()
84 | },
85 | getList: function(){
86 | app.http('v1/home/getHotList', { page: this.data.page})
87 | .then(res => {
88 | if (res.code == 200 && res.data.list.length > 0) {
89 | this.data.page++
90 | let list = this.data.list
91 | for (let i = 0; i < res.data.list.length; i++) {
92 | list.push(res.data.list[i])
93 | }
94 | this.setData({
95 | list: list,
96 | page: this.data.page
97 | })
98 | console.log(this.data)
99 | }
100 | })
101 | },
102 | onLoad: function () {
103 | let app = getApp()
104 | this.getList()
105 |
106 | app.http('v1/home/bannerList')
107 | .then(res=>{
108 | this.setData({
109 | imgUrls: res.data
110 | })
111 | })
112 | // app.http('v1/admin/addCoupon',{
113 | // name:'节日蛋糕满200减50',
114 | // money:50,
115 | // effective: ['2018-09-10', '2018-09-10'],
116 | // category:'5b8f45f2afb7c17788e11994',
117 | // category_name:'节日',
118 | // condition: 200
119 | // },"POST")
120 | // .then(res => {
121 | // console.log(res)
122 | // })
123 |
124 | // wx.request({
125 | // url: 'https://wx.yogalt.com/api/v1/admin/getClassList',
126 | // success: (res) => {
127 | // console.log(res.data)
128 | // }
129 | // })
130 |
131 | // wx.request({
132 | // url: 'https://wx.yogalt.com/api/v1/admin/addClass',
133 | // method: 'POST',
134 | // data: {
135 | // cate_name: 'party',
136 | // cate_order: 4,
137 | // },
138 | // header: {
139 | // 'X-Requested-With': 'XMLHttpRequest',
140 | // 'Content-Type': 'application/x-www-form-urlencoded'
141 | // },
142 | // success: (res) => {
143 | // console.log(res.data)
144 | // }
145 | // })
146 |
147 | // wx.request({
148 | // url: 'https://wx.yogalt.com/api/v1/admin/addItem',
149 | // method:'POST',
150 | // data:{
151 | // title:"中秋节大蛋糕",
152 | // img:"https://wx.yogalt.com/file/images/img1.jpeg",
153 | // spec:"1221123",
154 | // price:'990.2',
155 | // num:999,
156 | // content:'我是情人节大蛋糕',
157 | // html: '哈哈哈哈或',
158 | // category:"5b8f45f2afb7c17788e11994|节日",
159 | // is_hot:true
160 | // },
161 | // header:{
162 | // 'X-Requested-With': 'XMLHttpRequest',
163 | // 'Content-Type': 'application/x-www-form-urlencoded'
164 | // },
165 | // success: (res) => {
166 | // console.log(res.data)
167 | // }
168 | // })
169 |
170 | if (app.globalData.userInfo) {
171 | this.setData({
172 | userInfo: app.globalData.userInfo,
173 | hasUserInfo: true
174 | })
175 | } else if (this.data.canIUse){
176 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
177 | // 所以此处加入 callback 以防止这种情况
178 | app.userInfoReadyCallback = res => {
179 | this.setData({
180 | userInfo: res.userInfo,
181 | hasUserInfo: true
182 | })
183 | }
184 | } else {
185 | // 在没有 open-type=getUserInfo 版本的兼容处理
186 | wx.getUserInfo({
187 | success: res => {
188 | app.globalData.userInfo = res.userInfo
189 | this.setData({
190 | userInfo: res.userInfo,
191 | hasUserInfo: true
192 | })
193 | }
194 | })
195 | }
196 | },
197 | changeIndicatorDots: function (e) {
198 | this.setData({
199 | indicatorDots: !this.data.indicatorDots
200 | })
201 | },
202 | changeAutoplay: function (e) {
203 | this.setData({
204 | autoplay: !this.data.autoplay
205 | })
206 | },
207 | intervalChange: function (e) {
208 | this.setData({
209 | interval: e.detail.value
210 | })
211 | },
212 | durationChange: function (e) {
213 | this.setData({
214 | duration: e.detail.value
215 | })
216 | },
217 | getUserInfo: function(e) {
218 | app.globalData.userInfo = e.detail.userInfo
219 | this.setData({
220 | userInfo: e.detail.userInfo,
221 | hasUserInfo: true
222 | })
223 | }
224 | })
225 |
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "首页",
3 | "enablePullDownRefresh":true,
4 | "backgroundTextStyle":"dark"
5 | }
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | 生日
19 |
20 |
21 |
22 | 节日
23 |
24 |
25 |
26 | 婚礼
27 |
28 |
29 |
30 | party
31 |
32 |
33 |
37 |
42 |
43 | 猜你喜欢
44 | Lovely
45 |
46 |
47 |
48 |
49 |
50 | {{item.title}}.
51 |
52 |
53 | ¥{{item.price}}
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .container{
3 | width: 100%;
4 | height: 100vh;
5 | }
6 | swiper{
7 | width: 100%;
8 | height: 220px;
9 | }
10 | .img{
11 | border-top: 1px solid #EDEDED;
12 | border-bottom: 1px solid #EDEDED;
13 | }
14 | .img image{
15 | display: block;
16 | border-bottom: 1px solid #EDEDED;
17 | }d5e7f5d5e7f5d5e7f5d5e7f5
18 | .title{
19 | padding: 10px 0;
20 | }
21 |
22 | .title text{
23 | display: block;
24 | width: 100%;
25 | text-align: center;
26 | color: #333;
27 | }
28 |
29 | .title .cn{
30 | font-size: 16px;
31 | }
32 | .title .en{
33 | font-size: 12px;
34 | }
35 |
36 | .icon{
37 | border-top:2px solid #EDEDED;
38 | border-bottom:2px solid #EDEDED;
39 | display: flex;
40 | padding: 12px 0;
41 | }
42 | .icon image{
43 | display: block;
44 | width: 30px;
45 | height: 30px;
46 | margin: 0 auto;
47 | padding-top: 10px;
48 | }
49 | .icon text{
50 | display: block;
51 | text-align: center;
52 | width: 100%;
53 | font-size: 14px;
54 | color: #333;
55 | padding-top: 10px;
56 | }
57 | .icon navigator{
58 | flex: 1 0 25%;
59 | }
60 |
61 | .list{
62 | border-top:1px solid #EDEDED;
63 | display: flex;
64 | justify-content: space-between;
65 | flex-wrap:wrap;
66 | box-sizing: content-box;
67 | }
68 | .list .item{
69 | flex:0 1 50%;
70 | /* border-bottom:1px solid #EDEDED; */
71 | padding-top: 15px;
72 | }
73 | .list .item:nth-child(odd){
74 | /* border-right:1px solid #EDEDED; */
75 | margin-right: -1px;
76 | }
77 |
78 | .list .item .text{
79 | display: block;
80 | font-size: 12px;
81 | line-height: 22px;
82 | margin:0 10px;
83 | }
84 |
85 | .list .item .product{
86 | display: block;
87 | width: 160px;
88 | height: 160px;
89 | margin: 0 auto;
90 | }
91 | .price{
92 | display: flex;
93 | margin:0 10px;
94 | justify-content:space-between;
95 | }
96 |
97 | .price text{
98 | font-size: 16px;
99 | color: #ff5f19;
100 | }
101 |
102 | .price image{
103 | display: block;
104 | width: 20px;
105 | height: 20px;
106 | padding-top: 2px;
107 | }
108 |
--------------------------------------------------------------------------------
/pages/list/index.js:
--------------------------------------------------------------------------------
1 | // pages/list/index.js
2 | const app = getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | list: [],
10 | sortActive:0,
11 | sortState: true,
12 | price:false,
13 | flavor:false,
14 | mount:false,
15 | page:1
16 | },
17 | addCart(data) {
18 | let item = data.currentTarget.dataset.item
19 | app.http('v1/order/addCart', {
20 | id: item._id,
21 | num: 1,
22 | spec: ['asdasasd'],
23 | title: item.title,
24 | img: item.img,
25 | price: item.price
26 | }, "POST")
27 | .then(res => {
28 | console.log(res)
29 | if (res.code == 200) {
30 | wx.showToast({
31 | title: '已加入购物车',
32 | icon: 'success',
33 | duration: 500
34 | })
35 | }
36 | })
37 | },
38 | sortFun(data) {
39 | this.setData({
40 | sortActive: data.currentTarget.dataset.data,
41 | })
42 |
43 | if (data.currentTarget.dataset.data == 1){
44 | this.setData({
45 | price: this.price = !this.price
46 | })
47 |
48 | } else if (data.currentTarget.dataset.data == 2){
49 | this.setData({
50 | flavor: this.flavor = !this.flavor
51 | })
52 |
53 | } else if (data.currentTarget.dataset.data == 3) {
54 | this.setData({
55 | mount: this.mount = !this.mount
56 | })
57 |
58 | }
59 | },
60 | getList:function(data){
61 | app.http('v1/home/getList', {
62 | page: this.data.page,
63 | category: data.id
64 | })
65 | .then(res => {
66 | if (res.code == 200 && res.data.list.length > 0) {
67 | this.data.page++
68 | let list = this.data.list
69 | for (let i = 0; i < res.data.list.length; i++) {
70 | list.push(res.data.list[i])
71 | }
72 | this.setData({
73 | list: list,
74 | page: this.data.page
75 | })
76 | console.log(this.data)
77 | }
78 | })
79 | },
80 | /**
81 | * 生命周期函数--监听页面加载
82 | */
83 | onLoad: function (e) {
84 | wx.setNavigationBarTitle({
85 | title: e.title//页面标题为路由参数
86 | })
87 | console.log(e)
88 | this.getList(e)
89 | },
90 |
91 | /**
92 | * 生命周期函数--监听页面初次渲染完成
93 | */
94 | onReady: function () {
95 |
96 | },
97 |
98 | /**
99 | * 生命周期函数--监听页面显示
100 | */
101 | onShow: function () {
102 |
103 | },
104 |
105 | /**
106 | * 生命周期函数--监听页面隐藏
107 | */
108 | onHide: function () {
109 |
110 | },
111 |
112 | /**
113 | * 生命周期函数--监听页面卸载
114 | */
115 | onUnload: function () {
116 |
117 | },
118 |
119 | /**
120 | * 页面相关事件处理函数--监听用户下拉动作
121 | */
122 | onPullDownRefresh: function () {
123 |
124 | },
125 |
126 | /**
127 | * 页面上拉触底事件的处理函数
128 | */
129 | onReachBottom: function () {
130 |
131 | },
132 |
133 | /**
134 | * 用户点击右上角分享
135 | */
136 | onShareAppMessage: function () {
137 |
138 | }
139 | })
--------------------------------------------------------------------------------
/pages/list/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "列表",
3 | "disableScroll":true
4 | }
--------------------------------------------------------------------------------
/pages/list/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 价格
5 |
6 | 口味
7 |
8 | 销量
9 |
10 |
11 |
12 |
13 |
14 |
15 | {{item.title}}.
16 |
17 |
18 | ¥{{item.price}}
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/pages/list/index.wxss:
--------------------------------------------------------------------------------
1 | .list{
2 | display: flex;
3 | justify-content: space-between;
4 | flex-wrap:wrap;
5 | box-sizing: content-box;
6 | margin-bottom: 40px;
7 | background: #fff;
8 | }
9 | .list .item{
10 | flex:0 1 50%;
11 | /* border-bottom:1px solid #EDEDED; */
12 | padding-top: 15px;
13 | }
14 | .list .item:nth-child(odd){
15 | /* border-right:1px solid #EDEDED; */
16 | margin-right: -1px;
17 | }
18 |
19 | .list .item .text{
20 | display: block;
21 | font-size: 12px;
22 | line-height: 22px;
23 | margin:0 10px;
24 | }
25 |
26 | .list .item .product{
27 | display: block;
28 | width: 160px;
29 | height: 160px;
30 | margin: 0 auto;
31 | }
32 |
33 | .price{
34 | display: flex;
35 | margin:0 10px;
36 | justify-content:space-between;
37 | }
38 |
39 | .price text{
40 | font-size: 16px;
41 | color: #ff5f19;
42 | }
43 |
44 | .price image{
45 | width: 20px;
46 | height: 20px;
47 | padding-top: 2px;
48 | }
49 |
50 | .sort{
51 | display: flex;
52 | height: 40px;
53 | line-height: 40px;
54 | }
55 |
56 | .sort .item{
57 | text-align: center;
58 | flex: 1 0 33%;
59 | font-size: 14px;
60 | color:#333;
61 | border-top:2px solid #EDEDED;
62 | border-bottom:2px solid #EDEDED;
63 | display: inline-flex;
64 | align-items:center;
65 | justify-content:center;
66 | }
67 |
68 | .sort .active{
69 | border-bottom:1px solid #000;
70 | line-height:38px;
71 | }
72 |
73 | .sort .item-active{
74 | transform:rotate(180deg);
75 | }
76 |
77 | .sort .item image {
78 | width: 10px;
79 | height: 12px;
80 | padding-left:5px;
81 | }
--------------------------------------------------------------------------------
/pages/order/index.js:
--------------------------------------------------------------------------------
1 | // pages/coupon/index.js
2 | const app = getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | tabIndex: 1,
10 | list: []
11 | },
12 | tabFun(e) {
13 | this.setData({
14 | tabIndex: e.currentTarget.dataset.index
15 | })
16 | this.getList()
17 | },
18 | getList(){
19 | app.http('/v1/order/list', { state: this.data.tabIndex }).then(res => {
20 | this.setData({list:res.data})
21 | })
22 | },
23 | /**
24 | * 生命周期函数--监听页面加载
25 | */
26 | onLoad: function (options) {
27 | this.setData({
28 | tabIndex: options.type||1
29 | })
30 | this.getList()
31 | },
32 |
33 | /**
34 | * 生命周期函数--监听页面初次渲染完成
35 | */
36 | onReady: function () {
37 |
38 | },
39 |
40 | /**
41 | * 生命周期函数--监听页面显示
42 | */
43 | onShow: function () {
44 |
45 | },
46 |
47 | /**
48 | * 生命周期函数--监听页面隐藏
49 | */
50 | onHide: function () {
51 |
52 | },
53 |
54 | /**
55 | * 生命周期函数--监听页面卸载
56 | */
57 | onUnload: function () {
58 |
59 | },
60 |
61 | /**
62 | * 页面相关事件处理函数--监听用户下拉动作
63 | */
64 | onPullDownRefresh: function () {
65 |
66 | },
67 |
68 | /**
69 | * 页面上拉触底事件的处理函数
70 | */
71 | onReachBottom: function () {
72 |
73 | },
74 |
75 | /**
76 | * 用户点击右上角分享
77 | */
78 | onShareAppMessage: function () {
79 |
80 | }
81 | })
--------------------------------------------------------------------------------
/pages/order/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "我的订单"
3 | }
--------------------------------------------------------------------------------
/pages/order/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 待付款
5 |
6 |
7 | 待发货
8 |
9 |
10 | 已发货
11 |
12 |
13 | 已完成
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 共{{item.goods.length}}件商品
22 | {{item.creat_date}}
23 |
24 | ¥{{item.totalPrice}}
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/pages/order/index.wxss:
--------------------------------------------------------------------------------
1 |
2 | .main{
3 | height: 100vh;
4 | }
5 |
6 | .tab{
7 | height: 7vh;
8 | display: flex;
9 | line-height: 7vh;
10 | }
11 |
12 | .tab view{
13 | flex: 1 0 auto;
14 | font-size: 14px;
15 | color: #333333;
16 | text-align: center;
17 | }
18 | .tab .active{
19 | color: #ff5f19;
20 | border-bottom: 1px solid #ff5f19;
21 | padding-bottom:1.8vh;
22 | }
23 |
24 | .list{
25 | height: 93vh;
26 | }
27 |
28 | .list .item{
29 | display: flex;
30 | border-bottom: 1px solid #EDEDED;
31 | padding: 0 16px;
32 | height: 95px;
33 | align-items: center;
34 | }
35 |
36 | .list .label{
37 | flex: 0 0 auto;
38 | padding:10px 0;
39 | }
40 |
41 | .list .content{
42 | flex-grow: 1;
43 | display:flex;
44 | }
45 |
46 | .list .content image{
47 | flex: 0 0 auto;
48 | height: 76px;
49 | width: 76px;
50 | padding-right:10px;
51 | }
52 |
53 | .list .content .text{
54 | flex-grow: 1;
55 | font-size: 14px;
56 | }
57 |
58 | .list .content .title{
59 | overflow: hidden;
60 | }
61 |
62 | .list .content .spec{
63 | font-size: 12px;
64 | color: #333333;
65 | overflow: hidden;
66 | text-overflow: ellipsis;
67 | display: -webkit-box;
68 | line-height: 24px;
69 | max-height: 24px;
70 | -webkit-line-clamp: 1;
71 | -webkit-box-orient: vertical;
72 | }
73 |
74 | .list .content .price{
75 | display: flex;
76 | font-size: 16px;
77 | }
78 |
79 | .list .content .price text:nth-child(1){
80 | color: #ff5f19;
81 | flex: 1 0 50%;
82 | }
83 |
84 | .list .content .price text:nth-child(2){
85 | color: #999999;
86 | flex: 1 0 50%;
87 | text-align: right;
88 | }
89 |
--------------------------------------------------------------------------------
/pages/orderDetails/index.js:
--------------------------------------------------------------------------------
1 | // pages/orderDetails/index.js
2 | const app = getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | list: [{ //商品列表
10 | id: 2,
11 | img: 'https://wx.yogalt.com/file/images/img1.jpeg',
12 | name: "榴恋草莓蛋糕-2磅188元/138元/4磅298元(深圳)",
13 | spec: "2磅,+19.9元得水果(中盒)…",
14 | price: 999.00,
15 | num: 2,
16 | select: false,
17 | },
18 | {
19 | id: 3,
20 | img: 'https://wx.yogalt.com/file/images/img1.jpeg',
21 | name: "榴恋草莓蛋糕-2磅188元/138元/4磅298元(深圳)",
22 | spec: "2磅,+19.9元得水果(中盒)…",
23 | price: 999.01,
24 | num: 1,
25 | select: false
26 | }],
27 | address:null,
28 | data:null
29 | },
30 |
31 | /**
32 | * 生命周期函数--监听页面加载
33 | */
34 | onLoad: function (options) {
35 |
36 | console.log(options)
37 | app.http('v1/order/get', { id: options.id},"POST").then(res=>{
38 | console.log(res)
39 | if(res.code == 200){
40 | this.setData({data:res.data})
41 | }
42 | })
43 | },
44 |
45 | /**
46 | * 生命周期函数--监听页面初次渲染完成
47 | */
48 | onReady: function () {
49 |
50 | },
51 |
52 | /**
53 | * 生命周期函数--监听页面显示
54 | */
55 | onShow: function () {
56 | this.setData({
57 | address: app.globalData.userInfo.address
58 | })
59 | },
60 |
61 | /**
62 | * 生命周期函数--监听页面隐藏
63 | */
64 | onHide: function () {
65 |
66 | },
67 |
68 | /**
69 | * 生命周期函数--监听页面卸载
70 | */
71 | onUnload: function () {
72 |
73 | },
74 |
75 | /**
76 | * 页面相关事件处理函数--监听用户下拉动作
77 | */
78 | onPullDownRefresh: function () {
79 |
80 | },
81 |
82 | /**
83 | * 页面上拉触底事件的处理函数
84 | */
85 | onReachBottom: function () {
86 |
87 | },
88 |
89 | /**
90 | * 用户点击右上角分享
91 | */
92 | onShareAppMessage: function () {
93 |
94 | }
95 | })
--------------------------------------------------------------------------------
/pages/orderDetails/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "订单"
3 | }
--------------------------------------------------------------------------------
/pages/orderDetails/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 购物清单
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | {{item.title}}
14 |
15 | ¥{{item.price}}
16 | x{{item.num}}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 收货地址
25 |
26 |
27 |
28 |
29 | {{address.mobile}} {{address.name}} 收
30 | {{address.city[0]}} {{address.city[1]}} {{address.city[2]}} {{address.detailed}}
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | 发票信息
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | 优惠券
47 |
48 |
49 | 满200减50优惠券
50 |
51 |
52 |
53 |
54 |
55 | 商品价格
56 |
57 |
58 |
59 |
60 | 原价
61 |
62 |
63 | {{data.costPrice}}
64 |
65 |
66 |
67 |
68 | 运费
69 |
70 |
71 | {{data.freight}}
72 |
73 |
74 |
75 |
76 | 优惠
77 |
78 |
79 | {{data.costPrice - data.totalPrice}}
80 |
81 |
82 |
83 |
84 | 总价
85 |
86 |
87 | {{data.totalPrice}}
88 |
89 |
90 |
91 |
92 | 支付
93 |
94 |
--------------------------------------------------------------------------------
/pages/orderDetails/index.wxss:
--------------------------------------------------------------------------------
1 | .title{
2 | display: flex;
3 | line-height: 40px;
4 | border-bottom: 1px solid #dedede;
5 | background: #fff;
6 | padding: 0 16px;
7 | }
8 |
9 | .title .left{
10 | flex: 1 0 50%;
11 | font-size: 14px;
12 | color: #333333;
13 | }
14 |
15 | .title .right{
16 | flex: 1 0 50%;
17 | display: flex;
18 | justify-content: flex-end;
19 | align-items: center;
20 | }
21 |
22 | .title image{
23 | width: 8px;
24 | height: 15px;
25 | }
26 |
27 | .title text{
28 | font-size: 12px;
29 | color: #999999;
30 | padding-right: 10px;
31 | }
32 |
33 | .list .item1{
34 | display: flex;
35 | border-bottom: 1px solid #EDEDED;
36 | padding: 0 16px;
37 | height: 95px;
38 | align-items: center;
39 | }
40 |
41 | .list .label{
42 | flex: 0 0 auto;
43 | padding:10px 0;
44 | }
45 |
46 | .list .content{
47 | flex-grow: 1;
48 | display:flex;
49 | }
50 |
51 | .list .content image{
52 | flex: 0 0 auto;
53 | height:76px;
54 | width:76px;
55 | padding-right:10px;
56 | }
57 |
58 | .list .content .text{
59 | flex-grow: 1;
60 | font-size: 14px;
61 | }
62 |
63 | .list .content .name{
64 | height: 44px;
65 | overflow: hidden;
66 | }
67 |
68 | .list .content .spec{
69 | font-size: 12px;
70 | color: #333333;
71 | overflow: hidden;
72 | text-overflow: ellipsis;
73 | display: -webkit-box;
74 | line-height: 24px;
75 | max-height: 24px;
76 | -webkit-line-clamp: 1;
77 | -webkit-box-orient: vertical;
78 | }
79 |
80 | .list .content .price1{
81 | display: flex;
82 | font-size: 14px;
83 | padding-top:10px;
84 | }
85 |
86 | .list .content .price1 text:nth-child(1){
87 | color: #ff5f19;
88 | flex: 1 0 50%;
89 | }
90 |
91 | .list .content .price1 text:nth-child(2){
92 | color: #999999;
93 | flex: 1 0 50%;
94 | text-align: right;
95 | }
96 |
97 | .address{
98 | display: flex;
99 | margin: 0 18px;
100 | align-items: center;
101 | height: 98px;
102 | }
103 | .address .left{
104 | flex: 1 0 80%;
105 | font-size: 14px;
106 | }
107 | .address .edit,.choice{
108 | flex: 1 0 10%;
109 | text-align: right;
110 | }
111 | .address .edit image{
112 | width: 20px;
113 | height: 20px;
114 | }
115 | .address .choice image{
116 | width: 20px;
117 | height: 20px;
118 | }
119 | .price{
120 | margin: 0 16px;
121 | padding: 0;
122 | }
123 | .price text{
124 | font-size: 14px;
125 | color:#ff5f19;
126 | }
127 |
128 | .btn{
129 | height: 8vh;
130 | line-height: 8vh;
131 | text-align: center;
132 | background:#ff5f19;
133 | font-size: 14px;
134 | color: #fff;
135 | }
--------------------------------------------------------------------------------
/pages/user/index.js:
--------------------------------------------------------------------------------
1 | // pages/user/index.js
2 | const app = getApp()
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 |
10 | },
11 |
12 | /**
13 | * 生命周期函数--监听页面加载
14 | */
15 | onLoad: function (options) {
16 |
17 |
18 | },
19 |
20 | /**
21 | * 生命周期函数--监听页面初次渲染完成
22 | */
23 | onReady: function () {
24 |
25 | },
26 |
27 | /**
28 | * 生命周期函数--监听页面显示
29 | */
30 | onShow: function () {
31 |
32 | },
33 |
34 | /**
35 | * 生命周期函数--监听页面隐藏
36 | */
37 | onHide: function () {
38 |
39 | },
40 |
41 | /**
42 | * 生命周期函数--监听页面卸载
43 | */
44 | onUnload: function () {
45 |
46 | },
47 |
48 | /**
49 | * 页面相关事件处理函数--监听用户下拉动作
50 | */
51 | onPullDownRefresh: function () {
52 |
53 | },
54 |
55 | /**
56 | * 页面上拉触底事件的处理函数
57 | */
58 | onReachBottom: function () {
59 |
60 | },
61 |
62 | /**
63 | * 用户点击右上角分享
64 | */
65 | onShareAppMessage: function () {
66 |
67 | }
68 | })
--------------------------------------------------------------------------------
/pages/user/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "我的"
3 | }
--------------------------------------------------------------------------------
/pages/user/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
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 | 已发货
31 |
32 |
33 |
34 | 已完成
35 |
36 |
37 |
38 |
39 | 我的优惠券
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 地址管理
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/pages/user/index.wxss:
--------------------------------------------------------------------------------
1 | .top{
2 | height: 40vh;
3 | border-bottom: 3px solid #dedede;
4 | background: #fff;
5 | display: flex;
6 | justify-content: center;
7 | align-items: center;
8 | }
9 | .top .img{
10 | width: 80px;
11 | height: 80px;
12 | overflow: hidden;
13 | border-radius: 50%;
14 | }
15 |
16 | .top .text{
17 | text-align: center;
18 | font-size: 14px;
19 | color: #333333;
20 | }
21 | .item{
22 | display: flex;
23 | line-height: 40px;
24 | border-bottom: 1px solid #dedede;
25 | background: #fff;
26 | padding: 0 16px;
27 | }
28 |
29 | .item .left{
30 | flex: 1 0 50%;
31 | font-size: 14px;
32 | color: #333333;
33 | }
34 |
35 | .item .right{
36 | flex: 1 0 50%;
37 | display: flex;
38 | justify-content: flex-end;
39 | align-items: center;
40 | }
41 |
42 | .item image{
43 | width: 8px;
44 | height: 15px;
45 | }
46 |
47 | .item text{
48 | font-size: 12px;
49 | color: #999999;
50 | padding-right: 10px;
51 | }
52 |
53 | .icon{
54 | border-bottom:1px solid #EDEDED;
55 | display: flex;
56 | padding: 12px 0;
57 | }
58 | .icon image{
59 | display: block;
60 | width: 30px;
61 | height: 30px;
62 | margin: 0 auto;
63 | padding-top: 10px;
64 | }
65 | .icon text{
66 | display: block;
67 | text-align: center;
68 | width: 100%;
69 | font-size: 14px;
70 | color: #333;
71 | padding-top: 10px;
72 | }
73 | .icon navigator{
74 | flex: 1 0 25%;
75 | }
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true
12 | },
13 | "compileType": "miniprogram",
14 | "libVersion": "2.0.4",
15 | "appid": "wx990a52ed22a14656",
16 | "projectname": "yoga%E9%93%BA",
17 | "isGameTourist": false,
18 | "condition": {
19 | "search": {
20 | "current": -1,
21 | "list": []
22 | },
23 | "conversation": {
24 | "current": -1,
25 | "list": []
26 | },
27 | "game": {
28 | "currentL": -1,
29 | "list": []
30 | },
31 | "miniprogram": {
32 | "current": -1,
33 | "list": []
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/screenshot/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/1.png
--------------------------------------------------------------------------------
/screenshot/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/10.png
--------------------------------------------------------------------------------
/screenshot/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/11.png
--------------------------------------------------------------------------------
/screenshot/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/2.png
--------------------------------------------------------------------------------
/screenshot/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/3.png
--------------------------------------------------------------------------------
/screenshot/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/4.png
--------------------------------------------------------------------------------
/screenshot/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/5.png
--------------------------------------------------------------------------------
/screenshot/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/6.png
--------------------------------------------------------------------------------
/screenshot/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/7.png
--------------------------------------------------------------------------------
/screenshot/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/8.png
--------------------------------------------------------------------------------
/screenshot/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/9.png
--------------------------------------------------------------------------------
/screenshot/wx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/wx.png
--------------------------------------------------------------------------------
/screenshot/zfb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FZliweiliang/wechat-app-mall/0d79219c5eb0b0cfc10aa971491d805781f16acc/screenshot/zfb.jpg
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | const formatTime = date => {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = n => {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }
16 |
17 | module.exports = {
18 | formatTime: formatTime
19 | }
20 |
--------------------------------------------------------------------------------