├── .eslintrc.js
├── README.md
├── api
└── api.js
├── app.js
├── app.json
├── app.wxss
├── image
├── active_fenlei.png
├── active_gouwuche.png
├── active_mine.png
├── active_shouye.png
├── add.png
├── buy.png
├── cry.png
├── delete.png
├── fenlei.png
├── go.png
├── goche.png
├── gouwuche.png
├── mine.png
└── shouye.png
├── image_show
├── 个人中心.PNG
├── 分类.PNG
├── 购物车.PNG
└── 首页.PNG
├── pages
├── address
│ ├── address.js
│ ├── address.json
│ ├── address.wxml
│ └── address.wxss
├── cart
│ ├── cart.js
│ ├── cart.json
│ ├── cart.wxml
│ └── cart.wxss
├── classic
│ ├── classic.js
│ ├── classic.json
│ ├── classic.wxml
│ └── classic.wxss
├── detail
│ ├── detail.js
│ ├── detail.json
│ ├── detail.wxml
│ └── detail.wxss
├── fail
│ ├── fail.js
│ ├── fail.json
│ ├── fail.wxml
│ └── fail.wxss
├── index
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── list
│ ├── list.js
│ ├── list.json
│ ├── list.wxml
│ └── list.wxss
├── logs
│ ├── logs.js
│ ├── logs.json
│ ├── logs.wxml
│ └── logs.wxss
├── mine
│ ├── mine.js
│ ├── mine.json
│ ├── mine.wxml
│ └── mine.wxss
├── newAddress
│ ├── newAddress.js
│ ├── newAddress.json
│ ├── newAddress.wxml
│ └── newAddress.wxss
└── orders
│ ├── orders.js
│ ├── orders.json
│ ├── orders.wxml
│ └── orders.wxss
├── project.config.json
├── project.private.config.json
├── sitemap.json
└── utils
├── area.js
├── request.js
├── util.js
└── weui.wxss
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Eslint config file
3 | * Documentation: https://eslint.org/docs/user-guide/configuring/
4 | * Install the Eslint extension before using this feature.
5 | */
6 | module.exports = {
7 | env: {
8 | es6: true,
9 | browser: true,
10 | node: true,
11 | },
12 | ecmaFeatures: {
13 | modules: true,
14 | },
15 | parserOptions: {
16 | ecmaVersion: 2018,
17 | sourceType: 'module',
18 | },
19 | globals: {
20 | wx: true,
21 | App: true,
22 | Page: true,
23 | getCurrentPages: true,
24 | getApp: true,
25 | Component: true,
26 | requirePlugin: true,
27 | requireMiniProgram: true,
28 | },
29 | // extends: 'eslint:recommended',
30 | rules: {},
31 | }
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | **零食商城购物微信小程序**
2 | ***
3 | ### 功能一览
4 | + 首页
5 | + 分类
6 | + 购物车(缓存)
7 | + 个人中心
8 | + 商品详情
9 | + 加购付款(实现单选全选多选)
10 | + 订单管理(分页)
11 | + 地址管理
12 | ***
13 | ### 实现效果
14 | 
15 | 
16 | 
17 | 
18 | ***
19 | ### 运行
20 | 接口仍有效。下载微信微信开发者工具并导入项目即可运行。
21 |
--------------------------------------------------------------------------------
/api/api.js:
--------------------------------------------------------------------------------
1 | import request from "../utils/request.js"
2 |
3 | // 获取队伍信息
4 | // 0-GET
5 | // 1-POST
6 | // 2-PUT
7 | // 3-DELETE
8 |
9 | export function getBanner() {
10 | return request('/banner/1', {}, {
11 | prompt: false
12 | }, 0, 0);
13 | }
14 |
15 | export function getThemeInfo(theme_id) {
16 | return request('/theme/' + theme_id, {
17 | ids: theme_id
18 | }, {
19 | prompt: false
20 | }, 0, 0);
21 | }
22 |
23 | export function getItems() {
24 | return request('/product/recent', {}, {
25 | prompt: false
26 | }, 0, 0);
27 | }
28 |
29 | export function getDetail(id) {
30 | return request('/product/' + id, {}, {
31 | prompt: false
32 | }, 0, 0);
33 | }
34 |
35 | export function getClass() {
36 | return request('/category/all', {}, {
37 | prompt: false
38 | }, 0, 0);
39 | }
40 |
41 | export function getClassDetail(class_id) {
42 | return request('/product/by_category', {
43 | id : class_id
44 | }, {
45 | prompt: false
46 | }, 0, 0);
47 | }
48 |
49 | export function setOrder(products) {
50 | return request('/order', {
51 | products : products,
52 | }, {
53 | prompt: false
54 | }, 1, 1);
55 | }
56 |
57 | export function verify(token) {
58 | return request('/token/verify', {
59 | token: token
60 | }, {
61 | prompt: false
62 | }, 1, 1);
63 | }
64 |
65 | export function getOrderDetail(order_id) {
66 | return request('/order/' + order_id, {}, {
67 | prompt: false
68 | }, 0, 0);
69 | }
70 |
71 | export function getAllOrders(data) {
72 | return request('/order/by_user', {data:data}, {
73 | prompt: false
74 | }, 0, 1);
75 | }
76 |
77 | export function payment(id) {
78 | return request('/pay/pre_orde', {id:id}, {
79 | prompt: false
80 | }, 1, 1);
81 | }
82 |
83 |
84 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | // app.js
2 | const app = getApp();
3 | App({
4 | onLaunch() {
5 | wx.getStorage({
6 | key: 'token',
7 | success: (res) => {
8 | this.globalData.token = res.data
9 | console.log(this.globalData.token)
10 | }
11 | })
12 | },
13 | // is_login() {
14 | // return Boolean(this.globalData.token)
15 | // },
16 | post(url,data,header){
17 | //统一的post请求方法,返回promise
18 | let localData=this.globalData
19 | let m_header=header||{};
20 | // m_header['Authorization']='Bearer '+localData.token
21 | m_header['Content-Type']='application/x-www-form-urlencoded'
22 | console.log('url:',url)
23 | console.log('data',data)
24 | if(url=='/api2/auth/login/wechat-code'){
25 | m_header ={'Content-Type':'application/x-www-form-urlencoded'}
26 | }
27 | console.log('header',m_header)
28 | return new Promise((resolve,reject)=>{
29 | wx.request({
30 | url: localData.base_URL+url,
31 | method:'POST',
32 | header:m_header,
33 | data:data,
34 | success:e=>resolve(e),
35 | fail:err=>reject(err)
36 | })
37 | })
38 | },
39 |
40 | globalData: {
41 | //存储必要的用户信息
42 | userInfo: null,
43 | base_URL: 'https://hanmashanghu.qiaomai365.com/api/v1',
44 | token: ''
45 | }
46 | })
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/logs/logs",
5 | "pages/mine/mine",
6 | "pages/cart/cart",
7 | "pages/classic/classic",
8 | "pages/list/list",
9 | "pages/detail/detail",
10 | "pages/orders/orders",
11 | "pages/address/address",
12 | "pages/newAddress/newAddress",
13 | "pages/fail/fail"
14 |
15 | ],
16 | "window": {
17 | "backgroundTextStyle": "light",
18 | "navigationBarBackgroundColor": "#0ea47a",
19 | "navigationBarTitleText": "购物商城",
20 | "navigationBarTextStyle": "white"
21 | },
22 | "tabBar": {
23 | "color": "#a9b7b7",
24 | "selectedColor": "#127780",
25 | "borderStyle": "white",
26 | "list": [
27 | {
28 | "pagePath": "pages/index/index",
29 | "text": "首页",
30 | "iconPath": "/image/shouye.png",
31 | "selectedIconPath": "/image/active_shouye.png"
32 | },
33 | {
34 | "pagePath": "pages/classic/classic",
35 | "text": "分类",
36 | "iconPath": "/image/fenlei.png",
37 | "selectedIconPath": "/image/active_fenlei.png"
38 | },
39 | {
40 | "pagePath": "pages/cart/cart",
41 | "text": "购物车",
42 | "iconPath": "/image/gouwuche.png",
43 | "selectedIconPath": "/image/active_gouwuche.png"
44 | },
45 | {
46 | "pagePath": "pages/mine/mine",
47 | "text": "我的",
48 | "iconPath": "/image/mine.png",
49 | "selectedIconPath": "/image/active_mine.png"
50 | }
51 | ]
52 | },
53 | "style": "v2",
54 | "sitemapLocation": "sitemap.json"
55 | }
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/image/active_fenlei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/active_fenlei.png
--------------------------------------------------------------------------------
/image/active_gouwuche.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/active_gouwuche.png
--------------------------------------------------------------------------------
/image/active_mine.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/active_mine.png
--------------------------------------------------------------------------------
/image/active_shouye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/active_shouye.png
--------------------------------------------------------------------------------
/image/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/add.png
--------------------------------------------------------------------------------
/image/buy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/buy.png
--------------------------------------------------------------------------------
/image/cry.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/cry.png
--------------------------------------------------------------------------------
/image/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/delete.png
--------------------------------------------------------------------------------
/image/fenlei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/fenlei.png
--------------------------------------------------------------------------------
/image/go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/go.png
--------------------------------------------------------------------------------
/image/goche.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/goche.png
--------------------------------------------------------------------------------
/image/gouwuche.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/gouwuche.png
--------------------------------------------------------------------------------
/image/mine.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/mine.png
--------------------------------------------------------------------------------
/image/shouye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image/shouye.png
--------------------------------------------------------------------------------
/image_show/个人中心.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image_show/个人中心.PNG
--------------------------------------------------------------------------------
/image_show/分类.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image_show/分类.PNG
--------------------------------------------------------------------------------
/image_show/购物车.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image_show/购物车.PNG
--------------------------------------------------------------------------------
/image_show/首页.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YetSen-26/snacksShopTest/6ecfa023472d6b87cd55d7a1d392c0e7b4889840/image_show/首页.PNG
--------------------------------------------------------------------------------
/pages/address/address.js:
--------------------------------------------------------------------------------
1 | Page({
2 |
3 |
4 |
5 | /**
6 |
7 | * 页面的初始数据
8 |
9 | */
10 |
11 | data: {
12 |
13 | addressList: []
14 |
15 | },
16 |
17 | /**
18 |
19 | * 生命周期函数--监听页面加载
20 |
21 | */
22 |
23 | onLoad: function (options) {
24 |
25 | var arr = wx.getStorageSync('addressList') || [];
26 |
27 | console.info("缓存数据:" + arr);
28 |
29 | // 更新数据
30 |
31 | this.setData({
32 |
33 | addressList: arr
34 |
35 | });
36 |
37 | },
38 |
39 |
40 |
41 | /**
42 |
43 | * 生命周期函数--监听页面显示
44 |
45 | */
46 |
47 | onShow: function () {
48 |
49 | this.onLoad();
50 |
51 | },
52 |
53 | addAddress: function () {
54 |
55 | wx.navigateTo({
56 | url: '../newAddress/newAddress'
57 | });
58 |
59 |
60 | },
61 |
62 | /* 删除item */
63 |
64 | delAddress: function (e) {
65 |
66 | this.data.addressList.splice(e.target.id.substring(3), 1);
67 |
68 | // 更新data数据对象
69 |
70 | if (this.data.addressList.length > 0) {
71 |
72 | this.setData({
73 |
74 | addressList: this.data.addressList
75 |
76 | })
77 |
78 | wx.setStorageSync('addressList', this.data.addressList);
79 |
80 | } else {
81 |
82 | this.setData({
83 |
84 | addressList: this.data.addressList
85 |
86 | })
87 |
88 | wx.setStorageSync('addressList', []);
89 |
90 | }
91 |
92 | },
93 |
94 | selectAddress: function (e) {
95 | var index = e.currentTarget.dataset.index;
96 | wx.setStorageSync('address', this.data.addressList[index])
97 | console.log(wx.getStorageSync('address'))
98 | wx.redirectTo({
99 | url: '../mine/mine',
100 | })
101 | }
102 |
103 | })
--------------------------------------------------------------------------------
/pages/address/address.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/address/address.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{item.consignee}}
8 |
9 | {{item.mobile}}
10 |
11 |
12 |
13 |
14 |
15 | {{item.address}}
16 |
17 |
18 |
19 |
20 |
21 | {{item.transportDay}}
22 |
23 | 删除
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | 新增地址
39 |
40 |
41 |
--------------------------------------------------------------------------------
/pages/address/address.wxss:
--------------------------------------------------------------------------------
1 | page {
2 |
3 | display: flex;
4 |
5 | flex-direction: column;
6 |
7 | height: 100%;
8 |
9 | }
10 |
11 | .product-name-wrap {
12 |
13 | margin: 0px 10px;
14 |
15 | font-size: 14px;
16 |
17 | color: #404040;
18 |
19 | height: 120rpx;
20 |
21 | }
22 |
23 | .ui-list-item-info {
24 |
25 | margin: 5px 0px;
26 |
27 | }
28 |
29 | .ui-list-item-address {
30 |
31 | color: #585c64;
32 |
33 | }
34 |
35 | .ui-list-item-time {
36 |
37 | margin: 5px 0px;
38 |
39 | }
40 |
41 | .ui-list-item-del {
42 |
43 | position: absolute;
44 |
45 | right: 10px;
46 |
47 | color: #585c64;
48 |
49 | }
50 |
51 | /* 分割线 */
52 |
53 | .separate {
54 |
55 | margin: 5px 0px;
56 |
57 | height: 2rpx;
58 |
59 | background-color: #f2f2f2;
60 |
61 | }
62 |
63 | .add-address {
64 |
65 | margin: 0 auto;
66 |
67 | margin-top: 30px;
68 |
69 | width: 150px;
70 |
71 | height: 35px;
72 |
73 | border: 1px #000 solid;
74 |
75 | line-height: 35px;
76 |
77 | text-align: center;
78 |
79 | color: #000;
80 |
81 | border-radius: 5rpx;
82 |
83 | display: block;
84 |
85 | }
86 |
87 | .add-img {
88 | padding-top: 10rpx;
89 | margin-right: 15rpx;
90 |
91 | width: 15px;
92 |
93 | height: 15px;
94 |
95 | }
96 |
97 | .add-address text {
98 | position: relative;
99 | top: -5rpx;
100 | }
--------------------------------------------------------------------------------
/pages/cart/cart.js:
--------------------------------------------------------------------------------
1 | // pages/cart/cart.js
2 | const {
3 | setOrder,
4 | verify
5 | } = require('../../api/api.js');
6 | const {
7 | login
8 | } = require('../mine/mine.js')
9 | const app = getApp();
10 |
11 | Page({
12 |
13 | /**
14 | * 页面的初始数据
15 | */
16 | data: {
17 | carts: [], //数据
18 | iscart: false,
19 | hidden: null,
20 | isAllSelect: false,
21 | totalMoney: 0,
22 | order_id: 0
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面加载
27 | */
28 | onLoad(options) {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面初次渲染完成
34 | */
35 | onReady() {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面显示
41 | */
42 | onShow() {
43 | var arr = wx.getStorageSync('cart') || [];
44 | // console.log("缓存数据:", arr);
45 | if (arr.length > 0) {
46 | // 更新数据
47 | this.setData({
48 | carts: arr,
49 | iscart: true,
50 | hidden: false
51 | });
52 | // console.log("新缓存数据:", this.data.carts);
53 | } else {
54 | this.setData({
55 | iscart: false,
56 | hidden: true,
57 | });
58 | // console.info("缓存数据:啥也没有");
59 | }
60 | },
61 |
62 | //勾选事件处理函数
63 | switchSelect: function (e) {
64 | // 获取item项的id,和数组的下标值
65 | var Allprice = 0,
66 | i = 0;
67 | let id = e.target.dataset.id,
68 | index = parseInt(e.target.dataset.index);
69 | this.data.carts[index].isSelect = !this.data.carts[index].isSelect; //价钱统计
70 | if (this.data.carts[index].isSelect) {
71 | this.data.totalMoney = this.data.totalMoney + (this.data.carts[index].price * this.data.carts[index].count);
72 | } else {
73 | this.data.totalMoney = this.data.totalMoney - (this.data.carts[index].price * this.data.carts[index].count);
74 | }
75 | //是否全选判断
76 | for (i = 0; i < this.data.carts.length; i++) {
77 | Allprice = Allprice + (this.data.carts[index].price * this.data.carts[index].count);
78 | // console.log(this.data.carts[i].isSelect);
79 | }
80 | if (Allprice == this.data.totalMoney) {
81 | this.data.isAllSelect = true;
82 | } else {
83 | this.data.isAllSelect = false;
84 | }
85 | this.setData({
86 | carts: this.data.carts,
87 | totalMoney: this.data.totalMoney,
88 | isAllSelect: this.data.isAllSelect,
89 | })
90 | },
91 |
92 | allSelect: function (e) {
93 | //处理全选逻辑
94 | let i = 0;
95 | if (!this.data.isAllSelect) {
96 | this.data.totalMoney = 0;
97 | for (i = 0; i < this.data.carts.length; i++) {
98 | this.data.carts[i].isSelect = true;
99 | this.data.totalMoney = this.data.totalMoney + (this.data.carts[i].price * this.data.carts[i].count);
100 | }
101 | } else {
102 | for (i = 0; i < this.data.carts.length; i++) {
103 | this.data.carts[i].isSelect = false;
104 | }
105 | this.data.totalMoney = 0;
106 | }
107 | this.setData({
108 | carts: this.data.carts,
109 | isAllSelect: !this.data.isAllSelect,
110 | totalMoney: this.data.totalMoney,
111 | })
112 | },
113 |
114 | /* 减数 */
115 | delCount: function (e) {
116 | var index = e.target.dataset.index;
117 | // console.log("count--");
118 | var count = this.data.carts[index].count; // 商品总数量-1
119 | if (count > 1) {
120 | this.data.carts[index].count--;
121 | }
122 | // 将数值与状态写回
123 | this.setData({
124 | carts: this.data.carts
125 | });
126 | // console.log("carts:" + this.data.carts);
127 | this.priceCount();
128 | },
129 | /* 加数 */
130 | addCount: function (e) {
131 | var index = e.target.dataset.index;
132 | // console.log("count++");
133 | var count = this.data.carts[index].count; // 商品总数量+1
134 | if (count < 10) {
135 | this.data.carts[index].count++;
136 | }
137 | // 将数值与状态写回
138 | this.setData({
139 | carts: this.data.carts
140 | });
141 | // console.log("carts:" + this.data.carts);
142 | this.priceCount();
143 | },
144 | priceCount: function (e) {
145 | this.data.totalMoney = 0;
146 | for (var i = 0; i < this.data.carts.length; i++) {
147 | if (this.data.carts[i].isSelect == true) {
148 | this.data.totalMoney = this.data.totalMoney + (this.data.carts[i].price * this.data.carts[i].count);
149 | }
150 |
151 | }
152 | this.setData({
153 | totalMoney: this.data.totalMoney,
154 | })
155 | },
156 | /* 删除item */
157 | delGoods: function (e) {
158 | this.data.carts.splice(e.target.id.substring(3), 1); // 更新data数据对象
159 | if (this.data.carts.length > 0) {
160 | this.setData({
161 | carts: this.data.carts
162 | })
163 | wx.setStorageSync('cart', this.data.carts);
164 | this.priceCount();
165 | } else {
166 | this.setData({
167 | cart: this.data.carts,
168 | iscart: false,
169 | hidden: true,
170 | })
171 | wx.setStorageSync('cart', []);
172 | }
173 | },
174 |
175 | goBuy: function (e) {
176 | var newProducts = [];
177 | const that = this;
178 | this.data.carts.forEach(item => {
179 | if (item.isSelect == true) {
180 |
181 | newProducts.push({
182 | product_id: item.id,
183 | count: item.count,
184 | })
185 | // 删除选中进入订单的商品
186 | }
187 | newProducts.forEach(item_selected => {
188 | var index = this.data.carts.indexOf(item_selected);
189 | this.data.carts.splice(index, 1);
190 | })
191 | })
192 | console.log(newProducts);
193 | if (this.data.carts.length > 0) {
194 | this.setData({
195 | carts: this.data.carts
196 | })
197 | wx.setStorageSync('cart', this.data.carts);
198 | this.priceCount();
199 | } else {
200 | this.setData({
201 | cart: this.data.carts,
202 | iscart: false,
203 | hidden: true,
204 | })
205 | wx.setStorageSync('cart', []);
206 | }
207 |
208 |
209 | // console.log("app.globalData.token: ", app.globalData.token);
210 | let token = app.globalData.token.token;
211 | // console.log("token: ", token);
212 |
213 | verify(token).then(res => {
214 | if (res.data.isValid == true) {
215 | console.log("2", newProducts)
216 | } else {
217 | // console.log(res.data.isValid)
218 | const that = this;
219 | let gbdata = app.globalData;
220 | wx.login({
221 | success: function (res) {
222 | let code = res.code;
223 | // console.log(res.code)
224 | getApp().post('/token/user', {
225 | code: code
226 | }).then((e) => {
227 | try {
228 | wx.setStorageSync('token', e.data);
229 | // console.log(wx.getStorageSync('token'))
230 | } catch (e) {
231 | // console.log('setTokenErr', e)
232 | }
233 | gbdata.token = e.data;
234 | let isLogined = true;
235 | that.setData({
236 | isLogined
237 | })
238 | wx.setStorageSync('isLogined', isLogined);
239 | // console.log(wx.getStorageSync('isLogined'))
240 | wx.showToast({
241 | title: '登陆成功',
242 | icon: 'success'
243 | })
244 | })
245 | }
246 | })
247 | }
248 | })
249 | wx.request({
250 | url: 'https://hanmashanghu.qiaomai365.com/api/v1/order',
251 | method: 'POST',
252 | header: {
253 | //修改
254 | 'content-type': 'application/json',
255 | 'token': token
256 | },
257 | data: {
258 | products: newProducts
259 | },
260 | success: res => {
261 | var order_id = res.data.data.order_id;
262 | wx.setStorageSync('data', res.data.data)
263 | console.log(res.data.data)
264 | wx.setStorageSync('order_id', order_id)
265 | wx.navigateTo({
266 | url: '/pages/orders/orders?order_id=' + wx.getStorageSync('order_id')
267 | })
268 | console.log(wx.getStorageSync('order_id'))
269 | }
270 | })
271 |
272 | // console.log(res.data.isValid)
273 |
274 | },
275 | })
--------------------------------------------------------------------------------
/pages/cart/cart.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/cart/cart.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 购物车空空如也
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | {{item.name}}
24 | ¥{{item.price}}
25 |
26 | -
27 | {{item.count}}
28 | +
29 |
30 |
31 |
32 |
33 |
34 |
49 |
50 |
--------------------------------------------------------------------------------
/pages/cart/cart.wxss:
--------------------------------------------------------------------------------
1 |
2 | page{
3 | background-color: #ffffff;
4 | font-family: "Helvetica Neue","Hiragino Sans GB","Microsoft YaHei","\9ED1\4F53",Arial,sans-serif;
5 | font-size: 32rpx;
6 | }
7 | .navigator-hover{
8 | background: none;
9 | }
10 |
11 | .J-shopping-cart-empty{
12 | margin: 0;
13 | padding: 0;
14 | border: 0;
15 | font: inherit;
16 | font-size: 100%;
17 | vertical-align: baseline;
18 | }
19 | .shopping-cart-empty {
20 | height: 250px;
21 | padding-top: 3.2rem;
22 | padding-bottom: 1.6rem;
23 | background-color: #fff;
24 | text-align: center;
25 | position: relative;
26 | }
27 | .shopping-cart-empty .bg{
28 | position: absolute;
29 | width: 16rem;
30 | height: 6rem;
31 | left: 50%;
32 | background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAm0AAAEXAQMAAADFlOHHAAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMAFRtOKdMAAArmSURBVHja5ZxNiBzHFcf/b2pcvUSt6UkOoYWG7RUE5+LgXtvIIzTsrGXIIST3HAxuWSbxYSEjCI4CiqY2MrIPSywiQhRyiHwLIQdBgiNwcMpswDYoiQkEBDa4iME5ug0JjM1oKofdmf6q7Z7proAgfezp+fXrV69evffqA/jfX5es0tjEKs57xSrusmv1W5VVXIDLNnET9rFFmiMDbhG3hUnLIi52JLP4rWILFnHrFNvEXXJuw7Fnw3Lgo2Ovv1LsomevvzrCRWiLRmoLHJE9M5miBWmtS7C7YGQNF6+7IBK2VCcvuaCr1hr2LeUC16zh3hZt4K49s0Mb+KY13Ajc5jAb2cWF4MDIIq6F2l12VrjTBauN83Thlp/BUXHQBJyjuuD4X4XeFMwI2Fg4hNzr3zvA0dToPTQTRYE/FQmuk//D/XcA/qE2RljjmBn6+o9E4u76ud+O6U+0nunPzcLhogHnyUS6osV8ovXMrLth7F6UJqeykI5U4dcdwDG6L6bFugmH0UI6gy4uA951o3ATdIxut7/AeQbTUqSnZuHgOsrwS2+B6wEQy+GCCYArJhxftEC/gDt+I6IbOyYrkQBTJpyzaAEF5Aa1429E9MaO0U8CQ+OAyuZNR0XckR+rABYbXRG9Oef2C7jObxT94xkzbmj2bBTP/9sr4FxEJFwjjuIjHOVc+z13FVwgKjxbny+Pi2iS9PGWNnWcEQOwvRxu5IkEp7XJYiImlsdNEw80/tyoREkCOVM6EjeW8BR8AHBmSWumW1hALo0bAOPJQdQ6FghuN8T1QXqGHgCagGaGJiYgWgHH4kD0ADgCQ2XAsVVwPpxX35YdAD08OkNTXA/e4DPVARBoLdE14jYwXhq3HrmHuLg4Zh3gQkfHy+J6ko84gLUjSh0EhEHOII/EuTgj2MgB4AJg94yGEl7KKdVlisTAgOvgLOjOHLfVM46QocrjHEViasQ9BsxxjgqmJqdzRuRwvhvR7l0j7kXgJjvAzXDf4FNGCPIurO9HjPaM49WLwAdMAJ1vaOnsGUb8AXgeN/KjDmubxit8/xDn6Fu47BpGIY9kHqe6kcvco3DPMAFwwFN9Q79gOs7hSIZRnx+J+4AkwOFMMDGNkbNBDsdEqMKWCcfEi4e4QN+Hp6CMxpnFOQil4v5RuJskgSu/FtAwRj88FdgemMMJIVnfiHsMuAMJ+hgIYnPUxnMexcVJEsw4OIuzoDtQcK7iUQ2sG2PAHM5Hh4nEpFrpRjoDFkKhx7RWwMTQx8BEdpwNhMviRC08/XRP8BEU+qTfAwyRXgxAZnFnpc8mSUyawa1HrkJ0+DXD4pdOAYyyeXyoQuY6qZZJ8hjpDX6oMDrAmWqxYwBb2USlG0aMJ8mGl8Ip59WPJEYHXzM0mMnjEnDezDqUULJW4suOpWpfiilPHErnmVxYXwF0J4s7IVjK7E6mcaQ1EGIAMG2y4V7R4bsnQVcTszshnFRePZ4CfQT3x+Ycyy2aYicAPkpsoCuPp52jOggG9MwY3vFiR3GmBzH6vKFHZ5DNt0aFWD/pEkWPSnHGpMLg01Sano6Djb26qsQQsl1kkktPlRSQRFBZOKAsTpfVwiRTVTiWwXmzsqclJsvjfABalZdoguVxPcCZVVR8nPKv7aZ8Sg8Yq4qXY1pdElrgHF31LQhEuXRuyu+P43KcDzwry9+X4DpMiyrcuPyR8CA2PPB9w6rpK9fR26UPjOGnyihV9VdnWPHEfpyE1NVza5VPyGFcTFuPviqeINGyOd1HgG8Rx+ziOFKG8sDhXMB9cHH+A40LrePaFnGRXekiu9Jt28XJBxonrOLIPs7iFD3BqnTs/wpnuWWVXTO+bNejeMIqDhO7uOHstzZx9Gx1yCNtvhAstuoR+cAYotdTRgzXM0S1NaNC1oPPisrT92riOhihqLxJzZn9lrOrcsUJAHinJo6Tlmwre+8K8EJdHK6Afy8bsOsmOMB9N5tH7gMvPFJTdwBO/DRbUbgA7DxSX7rHH/4wj3u+gXQPf+vnKo97uL50d9/fmFjCtQD84vXt9RzuK/Wlo9/tCCeHe6K+dOw77yJToTwv8MTp2jj+lxvZkvSmwOknRV3c8V+eznrkTYEfzOrhGHDi9Z1s7XlTVFUYynCP79z7Q6aWtClwmcmauC9orXUeN4Kqh9Na6/vb2Y9VUDWX4zD9n3kCkqRKCtI0ybdkyAbgofS3jWMSNXN+BuBnWmdqjs9OqG5ow7TWWuvfp+9dWmdgXr1xVuvZrXwixxn4cXuBAWMtlwtLNJJ0lW461nCCrmJkLbsh8cV9iyE1tTc+shhSs9b2vkUckXjLYoROgnaFvcIaCRLSIk6SUBZXM0pmDCFrF18cDOg9a7hL6wh+ZU+6YApvVtBdULcTB/+Gd25UcIx1k6POAMfORfncsz7Oh/d0Hjeuvf6a+2BP5XA0qY1jPtipHI4pWMUJkjUdNPPBToWF8pP0pFVcoOri6LU8TkIN6vUUtga6dbuQRqu4npdhLui1PC7GRVUvDKI90PXbhQLPUPbs4bYQ1NwiQnug6/ligAs0wOnYgEsnM2IVHAqRey+JLYGS1eAG3EuGl/vrmdXIwxVwPzHc7A9FKtWiSbS88kxTzOHZV1KpVqBWwJlKPOHFWQo3iyI0ukYjTYtUyFFR2AwXRfvsb3PdDRGOmuLYYtqeJthsOA6rEVuUzTyJ4b1mODlyeKqqNGsWYZEMO/Muy6Zw4qa4/vo8IPWuYdgwOiXhD+buzuXUtH7MRDBJcJ5qioOn5uri7ErUcJKGobXImDmLo3YznINklS0PRMQbSieTVYhsig2nfJdnVQpGKllxzxRCVr6PsjL+iJPyAwNC2i99emtagetjUVphAFC+UOafVeKlcCQAlK0NYfpqxSIe9JKyFwkBlG0GbNFu1ZjcS7l2IcsHWo5dUVHpcFM4KVE6adKGVGeqcGOxPG57dr48THBJr4CLvivLm9ZNrVaLBFC2CdVF+NXcvorCIyndnhe8FLeG7qAig3VTLX9BOBU4v08flPfCVOj5JJzSTS5rWHvHKd/NnJ5M2oIjynA+vD23POlKr3kcgMsyXBfO6/2Ktsi8vVVayuiCuFoFx6MKnCdWki4sw4Wg4ytMXbrg/bJdqBtgaysE4y5aftlE5wZaq+G4W1a42EDr2yvgOFqdMm8boeWDVsCx0gWd2+BdSVgBVzoubqPdnS6PYxWnFWyjvfnyWyvgytfCSjy0iQsr4MqHPQH3FJ5bPnZ8WVXg1k7h3PK4P6EKd2EV3KQi8MXac/j6CllBFc4/hz/D0kXAl54WL1nEdaW0hmNAV473LOJC0bW2orMFbAjYxJ2yiOPA19JzAGFj3Pn0EpRpM1wbeCqN+2tj3NMpHL1sA7fQGGt4REcb+Htqp1bTA0TawI9TuKanpXDgWgrXamgpDLiWik55w5NmSNBLqS3MvOk5ODG1U7hW01N6gt1HUjiGhpZCn7mpAYCh5qqARLxXUgEUiaaTbjTJ4ppOCQYipS+JTsPFsTRh6XCPCQwbbX0IrmUibwU1biTeNB3o44ojmISdywWCGaxNgnIAt1Bz0YfRJRwK+SDiaFccVmLsXPsKsHhYz/kRjEev1MXdxFFnttS5Nvdsqg7+2zZVB39fwN5pXXC3pcVT3cCjyKLqwDdCi6oDC32LqgMLO549Guim80eLONyj2CbuLqxeO3Zxz9vFnbaL+7Jd3Lpd3Ar52X8BXSURa9qZGGgAAAAASUVORK5CYII=);
33 | -webkit-transform: translateX(-50%);
34 | transform: translateX(-50%);
35 | background-size: 100%;
36 | top: 0;
37 | }
38 | .shopping-cart-empty image{
39 | width: 300rpx;
40 | height: 300rpx;
41 | left: 120rpx;
42 | position: relative;
43 | right: 200rpx;
44 | margin: 0 0 60rpx 0;
45 | }
46 | .empty-text {
47 | font-size: 35rpx;
48 | color: rgba(34, 34, 34, 0.384);
49 | position: relative;
50 | right: 150rpx;
51 | line-height: 70rpx;
52 | font-weight: 400;
53 | }
54 |
55 | /* /////////以上为无内容的购物车预设///////// */
56 | .cart-box{
57 | padding-bottom: 100rpx;
58 | }
59 | .cart-list{
60 | position: relative;
61 | padding: 20rpx 20rpx 20rpx 285rpx;
62 | height: 185rpx;
63 | border-bottom: 1rpx solid #e9e9e9;
64 | }
65 | .cart-list .cart-pro-select{
66 | position: absolute;
67 | left: 20rpx;
68 | top: 90rpx;
69 | width: 45rpx;
70 | height: 45rpx;
71 | }
72 |
73 | .cart-list .cart-thumb{
74 | position: absolute;
75 | top: 20rpx;
76 | left: 85rpx;
77 | width: 185rpx;
78 | height: 185rpx;
79 | }
80 | .cart-list .cart-pro-name{
81 | display: inline-block;
82 | width: 300rpx;
83 | height: 105rpx;
84 | line-height: 50rpx;
85 | overflow: hidden;
86 | }
87 | .cart-list .cart-pro-price{
88 | display: inline-block;
89 | float: right;
90 | height: 105rpx;
91 | line-height: 50rpx;
92 | }
93 | .cart-list .cart-count-box{
94 | position: absolute;
95 | left: 285;
96 | bottom: 20rpx;
97 | width: 250rpx;
98 | height: 80rpx;
99 | }
100 | .cart-list .cart-count-box text{
101 | display: inline-block;
102 | line-height: 80rpx;
103 | text-align: center;
104 | }
105 | .cart-count-down,.cart-count-add{
106 | font-size: 44rpx;
107 | width: 50rpx;
108 | height: 100%;
109 | }
110 | .cart-count-num{
111 | width: 150rpx;
112 | }
113 | .cart-del{
114 | position: absolute;
115 | right: 20rpx;
116 | bottom: 20rpx;
117 | width: 80rpx;
118 | height: 80rpx;
119 | line-height: 80rpx;
120 | text-align: center;
121 | font-size: 44rpx;
122 | }
123 | .cart-footer{
124 | position: fixed;
125 | bottom: 0;
126 | left: 0;
127 | width: 100%;
128 | height: 90rpx;
129 | line-height: 90rpx;
130 | padding:0 100rpx 0 80rpx;
131 | box-sizing: border-box;
132 | background: #AB956D;
133 | color: #fff;
134 | }
135 | .total-select{
136 | position: absolute;
137 | left: 20rpx;
138 | top: 25rpx;
139 | width: 45rpx;
140 | height: 45rpx;
141 | }
142 | .order-icon{
143 | position: absolute;
144 | right: 40rpx;
145 | top: 25rpx;
146 | width: 45rpx;
147 | height: 45rpx;
148 | }
149 | .order-icon image,.order-icon navigator{
150 | display: block;
151 | width: 45rpx;
152 | height: 45rpx;
153 | }
154 | .cart-toatl-price{
155 | float: right;
156 | width: 120rpx;
157 | }
158 |
159 | .cart-no-data{
160 | padding:40rpx 0;
161 | color: #999;
162 | text-align: center;
163 | }
--------------------------------------------------------------------------------
/pages/classic/classic.js:
--------------------------------------------------------------------------------
1 | const app = getApp()
2 | const {
3 | getClass,
4 | getClassDetail
5 | } = require('../../api/api.js');
6 | Page({
7 |
8 | /**
9 | * 页面的初始数据
10 | */
11 | data: {
12 | detail: [{}],
13 | classs: []
14 |
15 | },
16 |
17 | /**
18 | * 生命周期函数--监听页面加载
19 | */
20 | onLoad() {
21 | const that = this;
22 | // async function get() {
23 | // let detail;
24 | // await getClass().then(res => {
25 | // console.log(res.data.data)
26 | // detail=res.data.data
27 | // that.setData({
28 | // detail
29 | // })
30 | // console.log(222,detail)
31 | // })
32 | // console.log(112,this.detail)
33 | // for (var i = 0; i < this.data.detail.legth; i++) {
34 | // getClassDetail(that.data.detail[i].id).then(res => {
35 | // console.log(res.data.data)
36 | // })
37 | // }
38 | // }
39 | // get();
40 | var classs = [];
41 | let detail;
42 | getClass().then(res => {
43 | detail = res.data.data
44 | // console.log(detail)
45 | for (var i = 0; i < detail.length; i++) {
46 | getClassDetail(detail[i].id).then(res => {
47 | classs.push(res.data.data)
48 | that.setData({
49 | detail,
50 | classs
51 | })
52 | })
53 | console.log(classs)
54 | }
55 | })
56 |
57 | },
58 | switchTab(e) {
59 | const self = this;
60 | this.setData({
61 | isScroll: true
62 | });
63 | setTimeout(function () {
64 | self.setData({
65 | toView: 's' + e.target.dataset.id,
66 | curIndex: e.target.dataset.index
67 | });
68 | }, 0);
69 | setTimeout(function () {
70 | self.setData({
71 | isScroll: false
72 | });
73 | }, 1);
74 | },
75 |
76 | /**
77 | * 生命周期函数--监听页面初次渲染完成
78 | */
79 | onReady() {
80 |
81 | },
82 |
83 | /**
84 | * 生命周期函数--监听页面显示
85 | */
86 | onShow() {
87 |
88 | },
89 |
90 | /**
91 | * 生命周期函数--监听页面隐藏
92 | */
93 | onHide() {
94 |
95 | },
96 |
97 | /**
98 | * 生命周期函数--监听页面卸载
99 | */
100 | onUnload() {
101 |
102 | },
103 |
104 | /**
105 | * 页面相关事件处理函数--监听用户下拉动作
106 | */
107 | onPullDownRefresh() {
108 |
109 | },
110 |
111 | /**
112 | * 页面上拉触底事件的处理函数
113 | */
114 | onReachBottom() {
115 |
116 | },
117 |
118 | /**
119 | * 用户点击右上角分享
120 | */
121 | onShareAppMessage() {
122 |
123 | }
124 | })
--------------------------------------------------------------------------------
/pages/classic/classic.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/classic/classic.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{item.name}}
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | {{item.name}}
16 |
17 |
18 |
19 |
20 |
21 | {{val.name}}
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/pages/classic/classic.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #ffffff;
3 | font-family: "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", "\9ED1\4F53", Arial, sans-serif;
4 | font-size: 32rpx;
5 | }
6 |
7 | .navigator-hover {
8 | background: none;
9 | }
10 |
11 |
12 | page,
13 | .main {
14 | height: 100%;
15 | }
16 |
17 | .categroy-left {
18 | float: left;
19 | width: 150rpx;
20 | height: 100%;
21 | border-right: 1px solid #ddd;
22 | box-sizing: border-box;
23 | }
24 |
25 | .categroy-left .cate-list {
26 | height: 90rpx;
27 | line-height: 90rpx;
28 | text-align: center;
29 | border-left: 3px solid #fff;
30 | }
31 |
32 | .categroy-left .cate-list.on {
33 | color: #AB956D;
34 | border-color: #AB956D;
35 | }
36 |
37 | .categroy-right {
38 | float: right;
39 | width: 600rpx;
40 | height: 100%;
41 | overflow: hidden;
42 |
43 | }
44 |
45 | .cate-box {
46 | height: 100%;
47 | padding: 40rpx;
48 | box-sizing: border-box;
49 | }
50 |
51 | .cate-box .cate-banner image {
52 | display: block;
53 | width: 100%;
54 | height: 190rpx;
55 | }
56 |
57 | .cate-title {
58 | position: relative;
59 | height: 30rpx;
60 | line-height: 30rpx;
61 | padding: 30rpx 0 55rpx;
62 | text-align: center;
63 | color: #AB956D;
64 | font-size: 28rpx;
65 | }
66 |
67 | .cate-title::before {
68 | position: absolute;
69 | left: 130rpx;
70 | top: 43rpx;
71 | content: '';
72 | width: 70rpx;
73 | height: 4rpx;
74 | background: #AB956D;
75 | }
76 |
77 | .cate-title::after {
78 | position: absolute;
79 | right: 130rpx;
80 | top: 43rpx;
81 | content: '';
82 | width: 70rpx;
83 | height: 4rpx;
84 | background: #AB956D;
85 | }
86 |
87 | .product-list {
88 | display: inline-block;
89 | width: 160rpx;
90 | height: 160rpx;
91 | text-align: center;
92 | margin: 0 20rpx 0rpx 0;
93 | font-size: 24rpx;
94 | }
95 |
96 | .product-list image {
97 | width: 80rpx;
98 | height: 80rpx;
99 | margin-bottom: 20rpx;
100 | }
101 |
102 | .product-list:nth-child(3n) {
103 | margin-right: 0;
104 | }
105 |
106 | .classname{
107 | display: -webkit-box;
108 | height: 80rpx;
109 | }
--------------------------------------------------------------------------------
/pages/detail/detail.js:
--------------------------------------------------------------------------------
1 | const {
2 | getDetail
3 | } = require('../../api/api.js');
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | num: 1,
11 | totalNum: 0,
12 | hasCarts: false,
13 | curIndex: 0,
14 | show: false,
15 | scaleCart: false,
16 | item: [],
17 | isClick: true
18 | },
19 | addCount() {
20 | let num = this.data.num;
21 | num++;
22 | console.log("stock : ",this.data.item.stock);
23 | if (num < this.data.item.stock) {
24 | this.setData({
25 | num: num
26 | })
27 | }
28 | },
29 | unaddCount() {
30 | let num = this.data.num;
31 | num--;
32 | if (num > 0) {
33 | this.setData({
34 | num: num
35 | })
36 | }
37 | },
38 | bindTap(e) {
39 | const index = parseInt(e.currentTarget.dataset.index);
40 | this.setData({
41 | curIndex: index
42 | })
43 | },
44 | // 节流函数
45 | throttle() {
46 | if (this.data.isClick) {
47 | this.setData({
48 | isClick: false
49 | });
50 | setTimeout(() => {
51 | this.setData({
52 | isClick: true
53 | })
54 | }, 600);
55 | } else {
56 | return;
57 | }
58 | },
59 | addCart(e) {
60 | var goods = this.data.item;
61 | goods.isSelect = false;
62 | var count = this.data.num;
63 | var title = this.data.item.name;
64 | if (title.length > 10) {
65 | goods.title = title.substring(0, 10) + '...';
66 | }
67 | var arr = wx.getStorageSync('cart') || [];
68 | console.log("cart_arr,{} : ", arr);
69 | if (arr.length > 0) {
70 | for (var j in arr) {
71 | // 判断购物车内的item的id,和事件传递过来的id,是否相等
72 | if (arr[j].id == this.data.item.id) {
73 | // 相等的话,给count+1(即再次添加入购物车,数量+1)
74 | arr[j].count = arr[j].count + count;
75 | // 最后,把购物车数据,存放入缓存
76 | try {
77 | wx.setStorageSync('cart', arr)
78 | } catch (e) {
79 | console.log(e)
80 | }
81 | return;
82 | }
83 | }
84 | arr.push(goods);
85 | arr[arr.length - 1].count = count;
86 | }else{
87 | arr.push(goods);
88 | arr[0].count = count;
89 | }
90 | try {
91 | wx.setStorageSync('cart', arr);
92 | } catch (e) {
93 | console.log(e)
94 | }
95 | },
96 |
97 | addToCart() {
98 | const self = this;
99 | const num = this.data.num;
100 | let total = this.data.totalNum;
101 | // 节流/////////////////
102 | this.throttle()
103 | // 动效////////////////////////////////////
104 | self.setData({
105 | show: true
106 | })
107 | setTimeout(function () {
108 | self.setData({
109 | show: false,
110 | scaleCart: true
111 | })
112 | setTimeout(function () {
113 | self.setData({
114 | scaleCart: false,
115 | hasCarts: true,
116 | totalNum: num + total
117 | })
118 | }, 200)
119 | }, 300)
120 | ///////////////////////////////////
121 |
122 | // 加购
123 | this.addCart();
124 | },
125 | /**
126 | * 生命周期函数--监听页面加载
127 | */
128 | onLoad(options) {
129 | const that = this;
130 | let product_id = options.product_id;
131 | getDetail(product_id).then(res => {
132 | console.log(res.data.data)
133 | that.setData({
134 | item: res.data.data
135 | })
136 | })
137 | },
138 |
139 | /**
140 | * 生命周期函数--监听页面初次渲染完成
141 | */
142 | onReady() {
143 |
144 | },
145 |
146 | /**
147 | * 生命周期函数--监听页面显示
148 | */
149 | onShow() {
150 |
151 | },
152 |
153 | /**
154 | * 生命周期函数--监听页面隐藏
155 | */
156 | onHide() {
157 |
158 | },
159 |
160 | /**
161 | * 生命周期函数--监听页面卸载
162 | */
163 | onUnload() {
164 |
165 | },
166 |
167 | /**
168 | * 页面相关事件处理函数--监听用户下拉动作
169 | */
170 | onPullDownRefresh() {
171 |
172 | },
173 |
174 | /**
175 | * 页面上拉触底事件的处理函数
176 | */
177 | onReachBottom() {
178 |
179 | },
180 |
181 | /**
182 | * 用户点击右上角分享
183 | */
184 | onShareAppMessage() {
185 |
186 | }
187 | })
--------------------------------------------------------------------------------
/pages/detail/detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/detail/detail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{totalNum}}
9 |
10 |
11 |
12 |
13 | -
14 | 数量 {{num}}
15 | +
16 | 加入购物车
17 |
18 |
19 |
20 | {{item.stock > 0 ? "有货" : "无货"}}
21 | {{item.name}}
22 | ¥ {{item.price}}
23 |
24 |
25 | 商品详情
26 | 产品参数
27 | 售后保障
28 |
29 | {{item.detail}}
30 | {{item.parameter}}
31 | {{item.service}}
32 |
33 |
34 |
--------------------------------------------------------------------------------
/pages/detail/detail.wxss:
--------------------------------------------------------------------------------
1 |
2 |
3 | page{
4 | background-color: #ffffff;
5 | font-family: "Helvetica Neue","Hiragino Sans GB","Microsoft YaHei","\9ED1\4F53",Arial,sans-serif;
6 | font-size: 32rpx;
7 | }
8 | .navigator-hover{
9 | background: none;
10 | }
11 |
12 | .item-box{
13 | position: relative;
14 | padding: 40rpx 45rpx;
15 | text-align: center;
16 | color: #454552;
17 | border-bottom: 30rpx solid #ededed;
18 | }
19 | .item-box .item-thumb{
20 | width: 300rpx;
21 | height: 300rpx;
22 | margin: 35rpx 0 125rpx;
23 | }
24 |
25 | .to-carts-icon{
26 | position: absolute;
27 | right: 70rpx;
28 | top: 70rpx;
29 | width: 15rpx;
30 | height: 15rpx;
31 | border-radius: 50%;
32 | opacity: .6;
33 | -webkit-animation: to_cart .3s ease-out;
34 | animation: to_cart .3s ease-out;
35 | }
36 | @-webkit-keyframes to_cart {
37 | 0%{
38 | right:100rpx;
39 | top:530rpx;
40 | -webkit-transform: scale(4);
41 | }
42 | /*60%{
43 | top: 20rpx;
44 | }*/
45 | }
46 | @keyframes to_cart {
47 | 0%{
48 | right:100rpx;
49 | top:530rpx;
50 | transform: scale(4);
51 | }
52 | /*60%{
53 | top: 20rpx;
54 | }*/
55 | }
56 | .carts-icon{
57 | position: absolute;
58 | right: 40rpx;
59 | top: 40rpx;
60 | width: 75rpx;
61 | height: 75rpx;
62 | }
63 | .carts-icon image{
64 | width: 100%;
65 | height: 100%;
66 | }
67 | .carts-icon.on{
68 | -webkit-animation: to_cart_scale .3s ease;
69 | animation: to_cart_scale .3s ease;
70 | }
71 | @-webkit-keyframes to_cart_scale {
72 | 50%{
73 | -webkit-transform: scale(1.2);
74 | }
75 | }
76 | @keyframes to_cart_scale {
77 | 50%{
78 | transform: scale(1.2);
79 | }
80 | }
81 | .carts-icon-num{
82 | position: absolute;
83 | left: -15rpx;
84 | width: 40rpx;
85 | height: 40rpx;
86 | line-height: 40rpx;
87 | border-radius: 50%;
88 | background: #AB956D;
89 | color: #fff;
90 | font-size: 24rpx;
91 | }
92 | .item-box .item-operation{
93 | position: relative;
94 | width: 100%;
95 | height: 100rpx;
96 | line-height: 100rpx;
97 | padding: 0 50rpx;
98 | margin-bottom: 60rpx;
99 | box-sizing: border-box;
100 | border-radius: 50rpx;
101 | background: #AB956D;
102 | color: #fff;
103 | font-size: 28rpx;
104 | }
105 | .item-operation text{
106 | display: inline-block;
107 | height: 100rpx;
108 | }
109 | .item-operation-num{
110 | width: 100rpx;
111 | margin-left: 20rpx;
112 | }
113 |
114 | item-operation-unadd{
115 | width: 80rpx;
116 | }
117 | .item-operation-add{
118 | width: 80rpx;
119 | margin-right: 20rpx;
120 | }
121 | .item-to-cart{
122 | width: 210rpx;
123 | padding-right: 75rpx;
124 | }
125 | .item-cart-img{
126 | position: absolute;
127 | right: 50rpx;
128 | top: 28rpx;
129 | width: 45rpx;
130 | height: 45rpx;
131 | }
132 |
133 | .item-stock{
134 | font-size: 28rpx;
135 | margin-bottom: 20rpx;
136 | }
137 | .item-title{
138 | font-size: 40rpx;
139 | margin-bottom: 30rpx;
140 | }
141 | .item-price{
142 | font-size: 40rpx;
143 | }
144 | .item-tab-nav{
145 | display: inline-block;
146 | width: 33.33%;
147 | height: 90rpx;
148 | line-height: 90rpx;
149 | border-bottom: 1rpx solid #ededed;
150 | box-sizing: border-box;
151 | text-align: center;
152 | color: #c7c7cb;
153 | }
154 | .item-tab-nav.on{
155 | color: #bcaa8a;
156 | border-bottom: 5rpx solid #bcaa8a;
157 | }
158 | .goods-content{
159 | padding: 40rpx;
160 | }
--------------------------------------------------------------------------------
/pages/fail/fail.js:
--------------------------------------------------------------------------------
1 | // pages/fail/fail.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad(options) {
15 |
16 | },
17 | toOrderDetail() {
18 | wx.navigateBack({
19 | delta: 1,
20 | success: (res) => {},
21 | fail: (res) => {},
22 | complete: (res) => {},
23 | })
24 | },
25 | /**
26 | * 生命周期函数--监听页面初次渲染完成
27 | */
28 | onReady() {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面显示
34 | */
35 | onShow() {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面隐藏
41 | */
42 | onHide() {
43 |
44 | },
45 |
46 | /**
47 | * 生命周期函数--监听页面卸载
48 | */
49 | onUnload() {
50 |
51 | },
52 |
53 | /**
54 | * 页面相关事件处理函数--监听用户下拉动作
55 | */
56 | onPullDownRefresh() {
57 |
58 | },
59 |
60 | /**
61 | * 页面上拉触底事件的处理函数
62 | */
63 | onReachBottom() {
64 |
65 | },
66 |
67 | /**
68 | * 用户点击右上角分享
69 | */
70 | onShareAppMessage() {
71 |
72 | }
73 | })
--------------------------------------------------------------------------------
/pages/fail/fail.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/fail/fail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | 支付失败
7 | 请稍后再进行尝试
8 |
9 |
12 |
--------------------------------------------------------------------------------
/pages/fail/fail.wxss:
--------------------------------------------------------------------------------
1 | .first{
2 | width: 100%;
3 | height: 100%;
4 | }
5 |
6 | .header {
7 | margin: 90rpx 0 90rpx 50rpx;
8 | border-bottom: 1px solid #ccc;
9 | text-align: center;
10 | width: 650rpx;
11 | height: 300rpx;
12 | line-height: 450rpx;
13 | }
14 |
15 | .header image {
16 | width: 200rpx;
17 | height: 200rpx;
18 | }
19 |
20 | .content {
21 | margin-left: 50rpx;
22 | margin-bottom: 90rpx;
23 | }
24 |
25 | .content text {
26 | display: block;
27 | color: #9d9d9d;
28 | margin-top: 40rpx;
29 | }
30 |
31 | .bottom {
32 | border-radius: 80rpx;
33 | margin: 70rpx 50rpx;
34 | font-size: 35rpx;
35 | }
36 |
37 | .header-new{
38 | position: relative;
39 | height: 160rpx;
40 | line-height: 100rpx;
41 | padding:30rpx 30rpx 30rpx 150rpx;
42 | box-sizing: border-box;
43 | background: #AB956D;
44 | font-size: 28rpx;
45 | color: #fff;
46 | }
47 | .header-new .thumb{
48 | position: absolute;
49 | left: 30rpx;
50 | top: 30rpx;
51 | width: 100rpx;
52 | height: 100rpx;
53 | border-radius: 50%;
54 | }
55 | .header-new .about{
56 | float: right;
57 | }
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | // index.js
2 |
3 | const {
4 | getBanner, getThemeInfo, getItems
5 | } = require('../../api/api.js');
6 |
7 | // 获取应用实例
8 | const app = getApp()
9 |
10 | Page({
11 | data: {
12 | id: 1,
13 | nae: "",
14 | decription: "",
15 | crate_time: "",
16 | upate_time: "",
17 | items: [{
18 | key_word: "6",
19 | type: 1,
20 | create_time: "1970-01-01 08:00:00",
21 | update_time: "1970-01-01 08:00:00",
22 | img: {
23 | name: "",
24 | url: "/images/banner-4a.png",
25 | create_time: "1970-01-01 08:00:00",
26 | update_time: "1970-01-01 08:00:00"
27 | }
28 | }],
29 | swiperCurrent: " ",
30 | theme_1:[
31 | {}
32 | ],
33 | theme_2:[{}],
34 | theme_3:[{}],
35 | products:[{}],
36 | },
37 | swiperChange: function (e) { //指示图标
38 | this.setData({
39 | swiperCurrent: e.detail.current
40 | })
41 | },
42 | onLoad: function () {
43 | const that = this;
44 | //获得轮播图列表
45 | getBanner().then(res => {
46 | // console.log(res.data.data.items)
47 | that.setData({
48 | items: res.data.data.items
49 | })
50 | })
51 |
52 | // 获得首页推荐图片1
53 | getThemeInfo(1).then(res => {
54 | // console.log(res.data.data)
55 | that.setData({
56 | theme_1: res.data.data
57 | })
58 | })
59 |
60 | getThemeInfo(2).then(res => {
61 | // console.log(res.data.data)
62 | that.setData({
63 | theme_2: res.data.data
64 | })
65 | })
66 |
67 | getThemeInfo(3).then(res => {
68 | // console.log(res.data.data)
69 | that.setData({
70 | theme_3: res.data.data
71 | })
72 | })
73 |
74 | // 获得首页商品
75 | getItems().then(res => {
76 | console.log(res.data.data)
77 | that.setData({
78 | products: res.data.data
79 | })
80 | })
81 | },
82 | })
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 精选主题
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | 最近新品
45 |
46 |
47 |
48 |
49 |
50 | {{item.name}}
51 | {{item.price}}
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../../pages/list/list.wxss';
2 |
3 | /* 轮播图 */
4 | .swiperContainer {
5 | margin-top: 15rpx;
6 | bottom: 8rpx;
7 | position: relative;
8 | margin-bottom: 12rpx;
9 | }
10 |
11 | .imageContainer {
12 | width: 100%;
13 | margin-top: 10rpx;
14 | height: 350rpx;
15 | }
16 |
17 | .turnItem {
18 | height: 340rpx;
19 | }
20 |
21 | .itemImg {
22 | position: absolute;
23 | width: 99%;
24 | height: 300rpx;
25 | margin-top: 20rpx;
26 | border-radius: 15rpx;
27 | }
28 |
29 | .imgActive {
30 | opacity: 1;
31 | height: 340rpx;
32 | margin-top: 0rpx;
33 | transition: all .2s ease-in 0s;
34 | }
35 |
36 | /* 指示点修饰 */
37 | .dots {
38 | position: absolute;
39 | left: 0;
40 | right: 0;
41 | bottom: 25rpx;
42 | display: flex;
43 | justify-content: center;
44 | }
45 |
46 | .dot {
47 | margin: 0 8rpx;
48 | width: 18rpx;
49 | height: 18rpx;
50 | background-color: rgb(233, 255, 247);
51 | border-radius: 8rpx;
52 | transition: all .5s;
53 | }
54 |
55 | .dot.active {
56 | width: 24rpx;
57 | background: #15eda3;
58 | }
59 |
60 | /* 轮播图到这里结束 */
61 |
62 | /* 精选 */
63 | .select-title{
64 | width: 100%;
65 | padding: 0 0 30rpx 0;
66 | height: 30rpx;
67 | color: #127780;
68 | text-align: center;
69 | }
70 | .newest-title {
71 | width: 100%;
72 | padding: 30rpx 0 0rpx 0;
73 | height: 40rpx;
74 | color: #127780;
75 | text-align: center;
76 | }
77 | .newest-title text,
78 | .select-title text{
79 | font-family:Arial, Helvetica, sans-serif;
80 | font-weight:normal;
81 | }
82 | .select-top-small {
83 | width: 375rpx;
84 | height: 375rpx;
85 | float: left;
86 | }
87 | .select-bottom,
88 | .select-top {
89 | width: 100%;
90 | height: 375rpx;
91 | }
92 | .select-top-small image,
93 | .select-bottom image,
94 | .select-top-small navigator,
95 | .select-bottom navigator {
96 | display: block;
97 | width: 100%;
98 | height: 100%;
99 | }
100 |
101 | /* 精选结束 */
--------------------------------------------------------------------------------
/pages/list/list.js:
--------------------------------------------------------------------------------
1 | const {
2 | getBanner,
3 | getThemeInfo
4 | } = require('../../api/api.js');
5 |
6 | // 获取应用实例
7 | const app = getApp()
8 |
9 | Page({
10 |
11 | /**
12 | * 页面的初始数据
13 | */
14 | data: {
15 | products: [],
16 | pic: ""
17 | },
18 |
19 | /**
20 | * 生命周期函数--监听页面加载
21 | */
22 | onLoad: function (options) {
23 | const that = this;
24 | let item = options.item
25 |
26 | getThemeInfo(item).then(res => {
27 | that.setData({
28 | products: res.data.data.products,
29 | pic: res.data.data.head_img.url
30 | })
31 | })
32 | },
33 | /**
34 | * 生命周期函数--监听页面初次渲染完成
35 | */
36 | onReady() {
37 |
38 | },
39 |
40 | /**
41 | * 生命周期函数--监听页面显示
42 | */
43 | onShow() {
44 |
45 | },
46 |
47 | /**
48 | * 生命周期函数--监听页面隐藏
49 | */
50 | onHide() {
51 |
52 | },
53 |
54 | /**
55 | * 生命周期函数--监听页面卸载
56 | */
57 | onUnload() {
58 |
59 | },
60 |
61 | /**
62 | * 页面相关事件处理函数--监听用户下拉动作
63 | */
64 | onPullDownRefresh() {
65 |
66 | },
67 |
68 | /**
69 | * 页面上拉触底事件的处理函数
70 | */
71 | onReachBottom() {
72 |
73 | },
74 |
75 | /**
76 | * 用户点击右上角分享
77 | */
78 | onShareAppMessage() {
79 |
80 | }
81 | })
--------------------------------------------------------------------------------
/pages/list/list.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/list/list.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {{item.name}}
11 | {{item.price}}
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/pages/list/list.wxss:
--------------------------------------------------------------------------------
1 | .banner image{
2 | width: 100%;
3 | height: 400rpx;
4 | }
5 | .list-box{
6 | padding: 30rpx 20rpx;
7 | }
8 | .newest-list{
9 | display: inline-block;
10 | width: 347rpx;
11 | height: 347rpx;
12 | margin:0 15rpx 10rpx 0;
13 | border-radius: 10px;
14 | text-align: center;
15 | background: #f5f6f5;
16 | }
17 | .newest-list:nth-child(2n){
18 | margin-right: 0;
19 | }
20 | .newest-list image{
21 | width: 180rpx;
22 | height: 180rpx;
23 | margin: 30rpx 0 20rpx;
24 | }
25 | .newest-list .newest-text{
26 | font-size: 32rpx;
27 | line-height: 45rpx;
28 | }
29 |
30 | page{
31 | background-color: #ffffff;
32 | font-family: "Helvetica Neue","Hiragino Sans GB","Microsoft YaHei","\9ED1\4F53",Arial,sans-serif;
33 | font-size: 32rpx;
34 | }
35 | .navigator-hover{
36 | background: none;
37 | }
--------------------------------------------------------------------------------
/pages/logs/logs.js:
--------------------------------------------------------------------------------
1 | // logs.js
2 | const util = require('../../utils/util.js')
3 |
4 | Page({
5 | data: {
6 | logs: []
7 | },
8 | onLoad() {
9 | this.setData({
10 | logs: (wx.getStorageSync('logs') || []).map(log => {
11 | return {
12 | date: util.formatTime(new Date(log)),
13 | timeStamp: log
14 | }
15 | })
16 | })
17 | }
18 | })
19 |
--------------------------------------------------------------------------------
/pages/logs/logs.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "查看启动日志",
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/pages/logs/logs.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{index + 1}}. {{log.date}}
5 |
6 |
7 |
--------------------------------------------------------------------------------
/pages/logs/logs.wxss:
--------------------------------------------------------------------------------
1 | .log-list {
2 | display: flex;
3 | flex-direction: column;
4 | padding: 40rpx;
5 | }
6 | .log-item {
7 | margin: 10rpx;
8 | }
9 |
--------------------------------------------------------------------------------
/pages/mine/mine.js:
--------------------------------------------------------------------------------
1 | // pages/mine/mine.js
2 | const app = getApp();
3 | const {
4 | getAllOrders,
5 | verify
6 | } = require('../../api/api.js');
7 | Page({
8 | data: {
9 | isLogined: false,
10 | avatarUrl: "",
11 | nickName: "", //用户昵称
12 | hasAddress: false,
13 | address: {},
14 | orders: [],
15 | page: 1, // 设置加载的第几次,默认是第一次
16 | size: 8, // 每次加载的数据条数
17 | total: null, //返回数据的个数(可以传空)
18 | searchLoading: true, //"上拉加载"的变量,默认false,隐藏
19 | searchLoadingComplete: false, //“没有数据”的变量,默认false,隐藏
20 | scrollHeight:1000
21 |
22 | },
23 | onLoad() {
24 | let res = wx.getSystemInfoSync();
25 |
26 | let boxHeight = res.windowHeight;
27 |
28 | this.data.scrollHeight = boxHeight;
29 |
30 | this.setData({
31 | isLogined: wx.getStorageSync("isLogined") ? true : false
32 | });
33 | wx.getStorage({
34 | key: 'nickName',
35 | success(res) {
36 | this.setData({
37 | nickName: res.data
38 | })
39 | }
40 | })
41 | wx.getStorage({
42 | key: 'avatarUrl',
43 | success(res) {
44 | this.setData({
45 | avatarUrl: res.data
46 | })
47 | }
48 | })
49 | wx.getStorage({
50 | key: 'address',
51 | success(res) {
52 | this.setData({
53 | address: res.data,
54 | hasAddress: true
55 | })
56 | }
57 | })
58 | let nickName = wx.getStorageSync('nickName'),
59 | avatarUrl = wx.getStorageSync('avatarUrl'),
60 | address = wx.getStorageSync('address'),
61 | hasAddress = wx.getStorageSync('hasAddress');
62 | console.log(wx.getStorageSync('hasAddress'))
63 | this.setData({
64 | nickName,
65 | avatarUrl,
66 | address,
67 | hasAddress
68 | })
69 | let token = app.globalData.token.token;
70 | verify(token).then(res => {
71 | console.log(token)
72 | if (res.data.isValid == true) {
73 |
74 | getAllOrders(1, 8).then(res => {
75 | this.setData({
76 | orders: res.data.data.data.data
77 | })
78 | console.log(res.data.data.data.data)
79 | })
80 | } else {
81 | console.log(res.data.isValid)
82 | const that = this;
83 | let gbdata = app.globalData;
84 | wx.login({
85 | success: function (res) {
86 | let code = res.code;
87 | // console.log(res.code)
88 | getApp().post('/token/user', {
89 | code: code
90 | }).then((e) => {
91 | try {
92 | wx.setStorageSync('token', e.data);
93 | // console.log(wx.getStorageSync('token'))
94 | } catch (e) {
95 | // console.log('setTokenErr', e)
96 | }
97 | gbdata.token = e.data;
98 | let isLogined = true;
99 | that.setData({
100 | isLogined
101 | })
102 | wx.setStorageSync('isLogined', isLogined);
103 | // console.log(wx.getStorageSync('isLogined'))
104 | wx.showToast({
105 | title: '登陆成功',
106 | icon: 'success'
107 | })
108 | })
109 | }
110 | })
111 | getAllOrders(1, 8).then(res => {
112 | this.setData({
113 | orders: res.data.data.orders
114 | })
115 | console.log(res.data.data.data)
116 | })
117 | }
118 | })
119 | },
120 | login: function () {
121 | const that = this;
122 | let gbdata = app.globalData;
123 | wx.login({
124 | success: function (res) {
125 | let code = res.code;
126 | console.log(res.code)
127 | getApp().post('/token/user', {
128 | code: code
129 | }).then((e) => {
130 | try {
131 | wx.setStorageSync('token', e.data);
132 | console.log(wx.getStorageSync('token'))
133 | } catch (e) {
134 | console.log('setTokenErr', e)
135 | }
136 | gbdata.token = e.data;
137 | let isLogined = true;
138 | that.setData({
139 | isLogined
140 | })
141 | wx.setStorageSync('isLogined', isLogined);
142 | console.log(wx.getStorageSync('isLogined'))
143 | wx.showToast({
144 | title: '登陆成功',
145 | icon: 'success'
146 | })
147 | })
148 | }
149 | })
150 | this.getUserProfile();
151 | },
152 | getUserProfile() {
153 | wx.getUserProfile({
154 | desc: '登录', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
155 | success: (res) => {
156 | this.setData({
157 | nickName: res.userInfo.nickName,
158 | avatarUrl: res.userInfo.avatarUrl
159 | })
160 | wx.setStorage({ //数据缓存方法
161 | key: 'nickName', //关键字,本地缓存中指定的key
162 | data: res.userInfo.nickName, //缓存微信用户公开信息,
163 | success: function () { //缓存成功后,输出提示
164 | console.log('写入nickName缓存成功')
165 | },
166 | fail: function () { //缓存失败后的提示
167 | console.log('写入nickName发生错误')
168 | }
169 | })
170 | wx.setStorage({ //数据缓存方法
171 | key: 'avatarUrl', //关键字,本地缓存中指定的key
172 | data: res.userInfo.avatarUrl, //缓存微信用户公开信息,
173 | success: function () { //缓存成功后,输出提示
174 | console.log('写入avatarUrl缓存成功')
175 | },
176 | fail: function () { //缓存失败后的提示
177 | console.log('写入avatarUrl发生错误')
178 | }
179 | })
180 | }
181 | })
182 |
183 | },
184 | payOrders() {
185 | wx.navigateTo({
186 | url: '../fail/fail'
187 | })
188 | },
189 | onPullDownRefresh: function () {
190 | wx.showNavigationBarLoading() //在标题栏中显示加载
191 |
192 | //模拟加载
193 | setTimeout(function () {
194 | // complete
195 | wx.hideNavigationBarLoading() //完成停止加载
196 | wx.stopPullDownRefresh() //停止下拉刷新
197 | }, 1500);
198 | },
199 | searchScrollLower: function () {
200 | let that = this;
201 | if (that.data.searchLoading && !that.data.searchLoadingComplete) {
202 | that.setData({
203 | page: that.data.page + 1, //每次触发上拉事件,把page+1
204 | isFromSearch: false //触发到上拉事件,把isFromSearch设为为false
205 | });
206 | that.informationQuery();
207 | }
208 | },
209 |
210 | informationQuery() {
211 | const params = {
212 | page: this.data.page,
213 | size: this.data.size
214 | }
215 | console.log(params);
216 | getAllOrders({data: params}).then(res => {
217 | if (res.data.data.data.data.length > 0) {
218 | let searchList = [];
219 | //如果isFromSearch是true从data中取出数据,否则先从原来的数据继续添加
220 | searchList = this.data.orders.concat(res.data.data.data.data)
221 | this.setData({
222 | orders: searchList, //获取数据数组
223 | searchLoading: true //把"上拉加载"的变量设为false,显示
224 | });
225 | //没有数据了,把“没有数据”显示,把“上拉加载”隐藏
226 | } else {
227 | this.setData({
228 | searchLoadingComplete: true, //把“没有数据”设为true,显示
229 | searchLoading: false //把"上拉加载"的变量设为false,隐藏
230 | });
231 | }
232 | })
233 | },
234 |
235 | })
--------------------------------------------------------------------------------
/pages/mine/mine.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "enablePullDownRefresh": true,
4 | "backgroundColor": "#AB956D"
5 | }
--------------------------------------------------------------------------------
/pages/mine/mine.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 | 申请获取以下权限
8 | 获得你的公开信息(昵称,头像等)
9 |
10 |
13 |
14 |
15 |
16 |
21 |
22 |
23 |
24 | 地址管理
25 |
26 |
27 | {{address.consignee}}
28 | {{address.mobile}}
29 | {{address.address}}
30 |
31 |
32 |
33 | 我的订单
34 |
35 |
36 | 订单编号:{{item.order_no}}
37 |
38 |
39 | {{item.snap_name}}
40 | {{item.total_count}}
41 | 未付款
42 |
43 |
47 |
48 | 正在载入更多...
49 | 已加载全部
50 |
51 |
52 |
--------------------------------------------------------------------------------
/pages/mine/mine.wxss:
--------------------------------------------------------------------------------
1 |
2 | .first{
3 | width: 100%;
4 | height: 100%;
5 | }
6 |
7 | .header {
8 | margin: 90rpx 0 90rpx 50rpx;
9 | border-bottom: 1px solid #ccc;
10 | text-align: center;
11 | width: 650rpx;
12 | height: 300rpx;
13 | line-height: 450rpx;
14 | }
15 |
16 | .header image {
17 | width: 200rpx;
18 | height: 200rpx;
19 | }
20 |
21 | .content {
22 | margin-left: 50rpx;
23 | margin-bottom: 90rpx;
24 | }
25 |
26 | .content text {
27 | display: block;
28 | color: #9d9d9d;
29 | margin-top: 40rpx;
30 | }
31 |
32 | .bottom {
33 | border-radius: 80rpx;
34 | margin: 70rpx 50rpx;
35 | font-size: 35rpx;
36 | }
37 |
38 | .header-new{
39 | position: relative;
40 | height: 160rpx;
41 | line-height: 100rpx;
42 | padding:30rpx 30rpx 30rpx 150rpx;
43 | box-sizing: border-box;
44 | background: #AB956D;
45 | font-size: 28rpx;
46 | color: #fff;
47 | }
48 | .header-new .thumb{
49 | position: absolute;
50 | left: 30rpx;
51 | top: 30rpx;
52 | width: 100rpx;
53 | height: 100rpx;
54 | border-radius: 50%;
55 | }
56 | .header-new .about{
57 | float: right;
58 | }
59 |
60 | .address-box{
61 | border-bottom: 20rpx solid #ededed;
62 | color: #999;
63 | line-height: 90rpx;
64 | font-size: 28rpx;
65 | }
66 | .address-box .address-manage{
67 | position: relative;
68 | height: 90rpx;
69 | border-bottom: 1rpx solid #e9e9e9;
70 | text-align: center;
71 | }
72 | .address-box .address-manage::after{
73 | position: absolute;
74 | right: 30rpx;
75 | top: 34rpx;
76 | content: '';
77 | width: 16rpx;
78 | height: 16rpx;
79 | border-top: 4rpx solid #7f7f7f;
80 | border-right: 4rpx solid #7f7f7f;
81 | -webkit-transform: rotate(45deg);
82 | transform: rotate(45deg);
83 | }
84 | .address-box .address-list{
85 | padding-left: 30rpx;
86 | }
87 | .address-box .address-list view{
88 | height: 90rpx;
89 | border-bottom: 1rpx solid #e9e9e9;
90 | }
91 | .address-box .address-list view:last-child{
92 | border-bottom: 0;
93 | }
94 |
95 | .orders-box{
96 | color: #999;
97 | font-size: 28rpx;
98 | }
99 | .orders{
100 | height: 90rpx;
101 | line-height: 90rpx;
102 | border-bottom: 1rpx solid #e9e9e9;
103 | text-align: center;
104 | }
105 | .orders-list{
106 | padding-left: 30rpx;
107 | border-bottom: 20rpx solid #ededed;
108 | }
109 | .orders-list:last-child{
110 | border-bottom: 0;
111 | }
112 | .orders-number{
113 | height: 90rpx;
114 | line-height: 90rpx;
115 | border-bottom: 1rpx solid #e9e9e9;
116 | }
117 | .orders-detail{
118 | position: relative;
119 | height: 120rpx;
120 | padding: 35rpx 20rpx 35rpx 170rpx;
121 | border-bottom: 1rpx solid #e9e9e9;
122 | }
123 | .orders-detail image{
124 | position: absolute;
125 | left: 0;
126 | top: 20rpx;
127 | width: 150rpx;
128 | height: 150rpx;
129 | }
130 | .orders-detail view{
131 | line-height: 60rpx;
132 | }
133 | .orders-detail .orders-status{
134 | position: absolute;
135 | right: 20rpx;
136 | top: 35rpx;
137 | height: 120rpx;
138 | line-height: 120rpx;
139 | color: #b42f2d;
140 | }
141 | .orders-footer{
142 | height: 60rpx;
143 | line-height: 60rpx;
144 | color: #2f2f2f;
145 | padding:15rpx 30rpx 15rpx 0;
146 | }
147 | .orders-footer .orders-btn{
148 | float: right;
149 | width: 170rpx;
150 | height: 60rpx;
151 | line-height:60rpx;
152 | border-radius: 6rpx;
153 | background: #b42f2d;
154 | color: #fff;
155 | }
156 |
157 | /* 加载更多样式 */
158 | .loading{
159 | padding: 10rpx;
160 | text-align: center;
161 | display:flex;
162 | justify-content: center;
163 | align-items: center;
164 | color: #999999;
165 | }
166 | .loadingIcon{
167 | width: 40rpx;
168 | height: 40rpx;
169 | }
170 | .loading.complete:before{
171 | display: none;
172 | }
173 |
174 |
--------------------------------------------------------------------------------
/pages/newAddress/newAddress.js:
--------------------------------------------------------------------------------
1 | var area = require('../../utils/area.js');
2 |
3 | var areaInfo = []; //所有省市区县数据
4 |
5 | var provinces = []; //省
6 |
7 | var provinceNames = []; //省名称
8 |
9 | var citys = []; //城市
10 |
11 | var cityNames = []; //城市名称
12 |
13 | var countys = []; //区县
14 |
15 | var countyNames = []; //区县名称
16 |
17 | var value = [0, 0, 0]; //数据位置下标
18 |
19 | var addressList = null;
20 |
21 | Page({
22 |
23 |
24 |
25 | /**
26 |
27 | * 页面的初始数据
28 |
29 | */
30 |
31 | data: {
32 |
33 | transportValues: ["收货时间不限", "周六日/节假日收货", "周一至周五收货"],
34 |
35 | transportIndex: 0,
36 |
37 | provinceIndex: 0, //省份
38 |
39 | cityIndex: 0, //城市
40 |
41 | countyIndex: 0, //区县
42 |
43 | },
44 |
45 |
46 |
47 |
48 |
49 | /**
50 |
51 | * 生命周期函数--监听页面加载
52 |
53 | */
54 |
55 | onLoad: function(options) {
56 |
57 |
58 |
59 | },
60 |
61 |
62 |
63 | /**
64 |
65 | * 生命周期函数--监听页面显示
66 |
67 | */
68 |
69 | onShow: function() {
70 |
71 | var that = this;
72 |
73 | area.getAreaInfo(function(arr) {
74 |
75 | areaInfo = arr;
76 |
77 | //获取省份数据
78 |
79 | that.getProvinceData();
80 |
81 | });
82 |
83 | },
84 |
85 | // 获取省份数据
86 |
87 | getProvinceData: function() {
88 |
89 | var that = this;
90 |
91 | var s;
92 |
93 | provinces = [];
94 |
95 | provinceNames = [];
96 |
97 | var num = 0;
98 |
99 | for (var i = 0; i < areaInfo.length; i++) {
100 |
101 | s = areaInfo[i];
102 |
103 | if (s.di == "00" && s.xian == "00") {
104 |
105 | provinces[num] = s;
106 |
107 | provinceNames[num] = s.name;
108 |
109 | num++;
110 |
111 | }
112 |
113 | }
114 |
115 | that.setData({
116 |
117 | provinceNames: provinceNames
118 |
119 | })
120 |
121 |
122 |
123 | that.getCityArr();
124 |
125 | that.getCountyInfo();
126 |
127 | },
128 |
129 |
130 |
131 | // 获取城市数据
132 |
133 | getCityArr: function(count = 0) {
134 |
135 | var c;
136 |
137 | citys = [];
138 |
139 | cityNames = [];
140 |
141 | var num = 0;
142 |
143 | for (var i = 0; i < areaInfo.length; i++) {
144 |
145 | c = areaInfo[i];
146 |
147 | if (c.xian == "00" && c.sheng == provinces[count].sheng && c.di != "00") {
148 |
149 | citys[num] = c;
150 |
151 | cityNames[num] = c.name;
152 |
153 | num++;
154 |
155 | }
156 |
157 | }
158 |
159 | if (citys.length == 0) {
160 |
161 | citys[0] = {
162 |
163 | name: ''
164 |
165 | };
166 |
167 | cityNames[0] = {
168 |
169 | name: ''
170 |
171 | };
172 |
173 | }
174 |
175 | var that = this;
176 |
177 | that.setData({
178 |
179 | citys: citys,
180 |
181 | cityNames: cityNames
182 |
183 | })
184 |
185 | console.log('cityNames:' + cityNames);
186 |
187 | that.getCountyInfo(count, 0);
188 |
189 | },
190 |
191 |
192 |
193 | // 获取区县数据
194 |
195 | getCountyInfo: function(column0 = 0, column1 = 0) {
196 |
197 | var c;
198 |
199 | countys = [];
200 |
201 | countyNames = [];
202 |
203 | var num = 0;
204 |
205 | for (var i = 0; i < areaInfo.length; i++) {
206 |
207 | c = areaInfo[i];
208 |
209 | if (c.xian != "00" && c.sheng == provinces[column0].sheng && c.di == citys[column1].di) {
210 |
211 | countys[num] = c;
212 |
213 | countyNames[num] = c.name;
214 |
215 | num++;
216 |
217 | }
218 |
219 | }
220 |
221 | if (countys.length == 0) {
222 |
223 | countys[0] = {
224 |
225 | name: ''
226 |
227 | };
228 |
229 | countyNames[0] = {
230 |
231 | name: ''
232 |
233 | };
234 |
235 | }
236 |
237 | console.log('countyNames:' + countyNames);
238 |
239 | var that = this;
240 |
241 | // value = [column0, column1, 0];
242 |
243 |
244 |
245 | that.setData({
246 |
247 | countys: countys,
248 |
249 | countyNames: countyNames,
250 |
251 | // value: value,
252 |
253 | })
254 |
255 | },
256 |
257 |
258 |
259 | bindTransportDayChange: function(e) {
260 |
261 | console.log('picker country 发生选择改变,携带值为', e.detail.value);
262 |
263 | this.setData({
264 |
265 | transportIndex: e.detail.value
266 |
267 | })
268 |
269 | },
270 |
271 |
272 |
273 | bindProvinceNameChange: function(e) {
274 |
275 | var that = this;
276 |
277 | console.log('picker province 发生选择改变,携带值为', e.detail.value);
278 |
279 | var val = e.detail.value
280 |
281 | that.getCityArr(val); //获取地级市数据
282 |
283 | that.getCountyInfo(val, 0); //获取区县数据
284 |
285 |
286 |
287 | value = [val, 0, 0];
288 |
289 | this.setData({
290 |
291 | provinceIndex: e.detail.value,
292 |
293 | cityIndex: 0,
294 |
295 | countyIndex: 0,
296 |
297 | value: value
298 |
299 | })
300 |
301 |
302 |
303 | },
304 |
305 |
306 |
307 | bindCityNameChange: function(e) {
308 |
309 | var that = this;
310 |
311 | console.log('picker city 发生选择改变,携带值为', e.detail.value);
312 |
313 |
314 |
315 | var val = e.detail.value
316 |
317 | that.getCountyInfo(value[0], val); //获取区县数据
318 |
319 | value = [value[0], val, 0];
320 |
321 | this.setData({
322 |
323 | cityIndex: e.detail.value,
324 |
325 | countyIndex: 0,
326 |
327 | value: value
328 |
329 | })
330 |
331 | },
332 |
333 |
334 |
335 | bindCountyNameChange: function(e) {
336 |
337 | var that = this;
338 |
339 | console.log('picker county 发生选择改变,携带值为', e.detail.value);
340 |
341 | this.setData({
342 |
343 | countyIndex: e.detail.value
344 |
345 | })
346 |
347 | },
348 |
349 |
350 |
351 | saveAddress: function(e) {
352 |
353 | var consignee = e.detail.value.consignee;
354 |
355 | var mobile = e.detail.value.mobile;
356 |
357 | var transportDay = e.detail.value.transportDay;
358 |
359 | var provinceName = e.detail.value.provinceName;
360 |
361 | var cityName = e.detail.value.cityName;
362 |
363 | var countyName = e.detail.value.countyName;
364 |
365 | var address = e.detail.value.address;
366 |
367 |
368 |
369 | console.log(transportDay + "," + provinceName + "," + cityName + "," + countyName + "," + address); //输出该文本
370 |
371 |
372 |
373 | var arr = wx.getStorageSync('addressList') || [];
374 |
375 | console.log("arr,{}", arr);
376 |
377 | addressList = {
378 |
379 | consignee: consignee,
380 |
381 | mobile: mobile,
382 |
383 | address: provinceName + cityName + countyName+address,
384 |
385 | transportDay: transportDay
386 |
387 | }
388 |
389 | arr.push(addressList);
390 |
391 | wx.setStorageSync('addressList', arr);
392 | wx.setStorageSync('hasAddress', true);
393 | wx.navigateBack({
394 | // delta: 1
395 | });
396 |
397 | }
398 |
399 | })
400 |
--------------------------------------------------------------------------------
/pages/newAddress/newAddress.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/newAddress/newAddress.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/pages/newAddress/newAddress.wxss:
--------------------------------------------------------------------------------
1 | @import '../../utils/weui.wxss';
2 |
3 |
4 |
5 | .weui-cells:before{
6 |
7 | top:0;
8 |
9 | border-top:1rpx solid white;
10 |
11 | }
12 |
13 | .weui-cell{
14 |
15 | line-height: 3.5rem;
16 |
17 | }
18 |
19 | .weui-cells:after{
20 |
21 | bottom:0;border-bottom:1rpx solid white
22 |
23 | }
24 |
25 |
26 |
27 | .weui-btn{
28 |
29 | width: 80%;
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/pages/orders/orders.js:
--------------------------------------------------------------------------------
1 | // pages/orders/orders.js
2 | const {
3 | getOrderDetail,
4 | payment
5 | } = require('../../api/api.js');
6 | const app = getApp();
7 |
8 | Page({
9 |
10 | /**
11 | * 页面的初始数据
12 | */
13 | data: {
14 | address: {},
15 | hasAddress: false,
16 | total: 0,
17 | orders: [],
18 | id: {},
19 | data: []
20 | },
21 |
22 | /**
23 | * 生命周期函数--监听页面加载
24 | */
25 | onLoad(options) {
26 | const that = this;
27 | let hasAddress = wx.getStorageSync('hasAddress'),
28 | address = wx.getStorageSync('address')
29 | that.setData({
30 | hasAddress,
31 | address
32 | })
33 | let order_id = options.order_id;
34 | this.data.id = order_id
35 | console.log(this.data.id);
36 | getOrderDetail(order_id).then(res => {
37 | const that = this;
38 | that.setData({
39 | orders: res.data.data.snap_items,
40 | total: res.data.data.total_price
41 | })
42 | })
43 | },
44 |
45 | toPay() {
46 | console.log(this.data.id)
47 | // payment(this.data.id).then(res => {
48 | // console.log(res.data)
49 | // })
50 | wx.request({
51 | url: 'https://hanmashanghu.qiaomai365.com/api/v1/pay/pre_order',
52 | method: 'POST',
53 | header: {
54 | //修改
55 | 'content-type': 'application/json',
56 | 'token': app.globalData.token.token
57 | },
58 | data: {
59 | id: this.data.id
60 | },
61 | success: res => {
62 | const that = this;
63 | that.setData({
64 | data: res.data
65 | })
66 | }
67 |
68 | })
69 | wx.requestPayment({
70 | timeStamp: this.data.data.timeStamp,
71 | nonceStr: this.data.data.nonceStr,
72 | package: this.data.data.package,
73 | signType: this.data.data.signType,
74 | paySign: this.data.data.paySign,
75 | success (res) {console.log(res) },
76 | fail (res) {wx.navigateTo({
77 | url: '../fail/fail',
78 | })}
79 | })
80 | },
81 |
82 | /**
83 | * 生命周期函数--监听页面初次渲染完成
84 | */
85 | onReady() {
86 |
87 | },
88 |
89 | /**
90 | * 生命周期函数--监听页面显示
91 | */
92 | onShow() {
93 |
94 | },
95 |
96 | /**
97 | * 生命周期函数--监听页面隐藏
98 | */
99 | onHide() {
100 |
101 | },
102 |
103 | /**
104 | * 生命周期函数--监听页面卸载
105 | */
106 | onUnload() {
107 |
108 | },
109 |
110 | /**
111 | * 页面相关事件处理函数--监听用户下拉动作
112 | */
113 | onPullDownRefresh() {
114 |
115 | },
116 |
117 | /**
118 | * 页面上拉触底事件的处理函数
119 | */
120 | onReachBottom() {
121 |
122 | },
123 |
124 | /**
125 | * 用户点击右上角分享
126 | */
127 | onShareAppMessage() {
128 |
129 | }
130 | })
--------------------------------------------------------------------------------
/pages/orders/orders.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/orders/orders.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 收货人: {{address.consignee}}
5 | 电话: {{address.mobile}}
6 | {{address.address}}
7 |
8 | 添加收货地址
9 |
10 |
11 |
12 |
13 |
14 | {{item.name}}
15 | ¥{{item.totalPrice}}
16 | ×{{item.count}}
17 |
18 |
19 |
20 |
24 |
--------------------------------------------------------------------------------
/pages/orders/orders.wxss:
--------------------------------------------------------------------------------
1 |
2 |
3 | page{
4 | background-color: #ffffff;
5 | font-family: "Helvetica Neue","Hiragino Sans GB","Microsoft YaHei","\9ED1\4F53",Arial,sans-serif;
6 | font-size: 32rpx;
7 | }
8 | .navigator-hover{
9 | background: none;
10 | }
11 |
12 | .orders-address{
13 | position: relative;
14 | padding: 20rpx 50rpx 20rpx 35rpx;
15 | font-size: 14px;
16 | line-height: 25px;
17 | border-bottom: 20rpx solid #ededed;
18 | color: #adadad;
19 | }
20 | .orders-address::after{
21 | position: absolute;
22 | right: 30rpx;
23 | top: 60rpx;
24 | content: '';
25 | width: 8px;
26 | height: 8px;
27 | border-top: 4rpx solid #7f7f7f;
28 | border-right: 4rpx solid #7f7f7f;
29 | -webkit-transform: rotate(45deg);
30 | transform: rotate(45deg);
31 | }
32 | .orders-address-name{
33 | display: inline-block;
34 | width: 300rpx;
35 | }
36 |
37 | .orders-no-address{
38 | position: relative;
39 | height: 90rpx;
40 | line-height: 90rpx;
41 | color: #adadad;
42 | border-bottom: 20rpx solid #ededed;
43 | text-align: center;
44 | }
45 | .orders-no-address::after{
46 | position: absolute;
47 | right: 30rpx;
48 | top: 34rpx;
49 | content: '';
50 | width: 16rpx;
51 | height: 16rpx;
52 | border-top: 4rpx solid #7f7f7f;
53 | border-right: 4rpx solid #7f7f7f;
54 | -webkit-transform: rotate(45deg);
55 | transform: rotate(45deg);
56 | }
57 |
58 | .orders-box{
59 | padding-bottom: 105rpx;
60 | }
61 | .orders-list{
62 | position: relative;
63 | padding:20rpx 20rpx 20rpx 220rpx;
64 | height: 180rpx;
65 | border-bottom: 1rpx solid #ededed;
66 | }
67 | .orders-thumb{
68 | position: absolute;
69 | top: 20rpx;
70 | left: 20rpx;
71 | width: 180rpx;
72 | height: 180rpx;
73 | }
74 | .orders-list view{
75 | line-height: 60rpx;
76 | }
77 |
78 | .orders-footer{
79 | position: fixed;
80 | bottom: 0;
81 | left: 0;
82 | width: 100%;
83 | height: 95rpx;
84 | line-height: 95rpx;
85 | border-top: 1rpx solid #ededed;
86 | }
87 | .orders-footer .orders-footer-total{
88 | display: inline-block;
89 | width: 510rpx;
90 | padding-left: 30rpx;
91 | box-sizing: border-box;
92 | color: #a55350;
93 | }
94 | .orders-footer .orders-footer-btn{
95 | display: inline-block;
96 | width: 240rpx;
97 | text-align: center;
98 | color: #fff;
99 | background: #AB956D;
100 | }
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3 | "packOptions": {
4 | "ignore": [],
5 | "include": []
6 | },
7 | "setting": {
8 | "bundle": false,
9 | "userConfirmedBundleSwitch": false,
10 | "urlCheck": true,
11 | "scopeDataCheck": false,
12 | "coverView": true,
13 | "es6": true,
14 | "postcss": true,
15 | "compileHotReLoad": false,
16 | "lazyloadPlaceholderEnable": false,
17 | "preloadBackgroundData": false,
18 | "minified": true,
19 | "autoAudits": false,
20 | "newFeature": false,
21 | "uglifyFileName": false,
22 | "uploadWithSourceMap": true,
23 | "useIsolateContext": true,
24 | "nodeModules": false,
25 | "enhance": true,
26 | "useMultiFrameRuntime": true,
27 | "useApiHook": true,
28 | "useApiHostProcess": true,
29 | "showShadowRootInWxmlPanel": true,
30 | "packNpmManually": false,
31 | "enableEngineNative": false,
32 | "packNpmRelationList": [],
33 | "minifyWXSS": true,
34 | "showES6CompileOption": false,
35 | "minifyWXML": true,
36 | "useStaticServer": true,
37 | "checkInvalidKey": true,
38 | "babelSetting": {
39 | "ignore": [],
40 | "disablePlugins": [],
41 | "outputPath": ""
42 | },
43 | "disableUseStrict": false,
44 | "useCompilerPlugins": false
45 | },
46 | "compileType": "miniprogram",
47 | "libVersion": "2.19.4",
48 | "appid": "wx3e2f018123732318",
49 | "projectname": "miniprogram-92",
50 | "condition": {},
51 | "editorSetting": {
52 | "tabIndent": "insertSpaces",
53 | "tabSize": 2
54 | }
55 | }
--------------------------------------------------------------------------------
/project.private.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "projectname": "snacksShopTest",
3 | "setting": {
4 | "compileHotReLoad": true,
5 | "urlCheck": false
6 | },
7 | "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
8 | "condition": {
9 | "miniprogram": {
10 | "list": [
11 | {
12 | "name": "",
13 | "pathName": "pages/index/index",
14 | "query": "",
15 | "launchMode": "default",
16 | "scene": null
17 | },
18 | {
19 | "name": "",
20 | "pathName": "pages/list/list",
21 | "query": "item=1",
22 | "launchMode": "default",
23 | "scene": null
24 | },
25 | {
26 | "name": "",
27 | "pathName": "pages/detail/detail",
28 | "query": "product_id=1",
29 | "launchMode": "default",
30 | "scene": null
31 | },
32 | {
33 | "name": "",
34 | "pathName": "pages/classic/classic",
35 | "query": "",
36 | "launchMode": "default",
37 | "scene": null
38 | },
39 | {
40 | "name": "",
41 | "pathName": "pages/cart/cart",
42 | "query": "",
43 | "launchMode": "default",
44 | "scene": null
45 | },
46 | {
47 | "name": "",
48 | "pathName": "pages/mine/mine",
49 | "query": "",
50 | "launchMode": "default",
51 | "scene": null
52 | },
53 | {
54 | "name": "",
55 | "pathName": "pages/orders/orders",
56 | "query": "",
57 | "launchMode": "default",
58 | "scene": null
59 | },
60 | {
61 | "name": "",
62 | "pathName": "pages/address/address",
63 | "query": "",
64 | "launchMode": "default",
65 | "scene": null
66 | },
67 | {
68 | "name": "",
69 | "pathName": "pages/newAddress/newAddress",
70 | "query": "",
71 | "launchMode": "default",
72 | "scene": null
73 | },
74 | {
75 | "name": "",
76 | "pathName": "pages/fail/fail",
77 | "query": "",
78 | "launchMode": "default",
79 | "scene": null
80 | }
81 | ]
82 | }
83 | },
84 | "libVersion": "2.25.0"
85 | }
--------------------------------------------------------------------------------
/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/utils/request.js:
--------------------------------------------------------------------------------
1 | const app = getApp()
2 | const method = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD', 'TRACE', 'CONNECT'];
3 | const content_type = ['application/json', 'application/x-www-form-urlencoded']
4 | function prompt(e = {}, op, reject, resolve) {
5 | let title = e.message || '错误 !';
6 | if (!title) return;
7 | let icon = 'success';
8 | if (e.code !== 0) {
9 | icon = 'none';
10 | reject(title, e.data)
11 | } else if (resolve) resolve(e.data);
12 | if (op.prompt !== false) wx.showToast({
13 | title,
14 | icon,
15 | duration: 2000
16 | })
17 | }
18 |
19 | export default (url = '', data={}, op = {}, type = 0, content = 0) => {
20 | if (op.loading !== false) wx.showNavigationBarLoading();
21 | try{
22 | return new Promise((resolve, reject) => {
23 | wx.request({
24 | data,
25 | url: 'https://hanmashanghu.qiaomai365.com/api/v1' + url,
26 | method: method[type],
27 | header: {
28 | //修改
29 | // 'content-type': content_type[content],
30 | 'token': app.globalData.token.token,
31 | // 'Authorization' : 'Bearer '+ app.globalData.token
32 | },
33 | success: (v) => prompt(v.data, op, reject, resolve(v)),
34 | // success:v=>resolve(v),
35 | fail: (e) => prompt(e, op, reject),
36 | complete() {
37 | if (op.loading !== false) wx.hideNavigationBarLoading()
38 | }
39 | })
40 | }).catch(()=>{})
41 | }catch(err){
42 | console.log(err);
43 | }
44 | }
--------------------------------------------------------------------------------
/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
19 | }
20 |
--------------------------------------------------------------------------------
/utils/weui.wxss:
--------------------------------------------------------------------------------
1 | /*!
2 | * WeUI v1.1.1 (https://github.com/weui/weui-wxss)
3 | * Copyright 2017 Tencent, Inc.
4 | * Licensed under the MIT license
5 | */
6 | page{line-height:1.6;font-family:-apple-system-font,Helvetica Neue,sans-serif}icon{vertical-align:middle}.weui-cells{position:relative;margin-top:1.17647059em;background-color:#fff;line-height:1.41176471;font-size:17px}.weui-cells:before{top:0;border-top:1rpx solid #d9d9d9}.weui-cells:after,.weui-cells:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#d9d9d9}.weui-cells:after{bottom:0;border-bottom:1rpx solid #d9d9d9}.weui-cells__title{margin-top:.77em;margin-bottom:.3em;padding-left:15px;padding-right:15px;color:#999;font-size:14px}.weui-cells_after-title{margin-top:0}.weui-cells__tips{margin-top:.3em;color:#999;padding-left:15px;padding-right:15px;font-size:14px}.weui-cell{padding:10px 15px;position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-cell:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #d9d9d9;color:#d9d9d9;left:15px}.weui-cell:first-child:before{display:none}.weui-cell_active{background-color:#ececec}.weui-cell_primary{-webkit-box-align:start;-webkit-align-items:flex-start;align-items:flex-start}.weui-cell__bd{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-cell__ft{text-align:right;color:#999}.weui-cell_access{color:inherit}.weui-cell__ft_in-access{padding-right:13px;position:relative}.weui-cell__ft_in-access:after{content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8cd;border-style:solid;-webkit-transform:matrix(.71,.71,-.71,.71,0,0);transform:matrix(.71,.71,-.71,.71,0,0);position:relative;top:-2px;position:absolute;top:50%;margin-top:-4px;right:2px}.weui-cell_link{color:#586c94;font-size:14px}.weui-cell_link:active{background-color:#ececec}.weui-cell_link:first-child:before{display:block}.weui-icon-radio{margin-left:3.2px;margin-right:3.2px}.weui-icon-checkbox_circle,.weui-icon-checkbox_success{margin-left:4.6px;margin-right:4.6px}.weui-check__label:active{background-color:#ececec}.weui-check{position:absolute;left:-9999px}.weui-check__hd_in-checkbox{padding-right:.35em}.weui-cell__ft_in-radio{padding-left:.35em}.weui-cell_input{padding-top:0;padding-bottom:0}.weui-label{width:105px;word-wrap:break-word;word-break:break-all}.weui-input{height:2.58823529em;min-height:2.58823529em;line-height:2.58823529em}.weui-toptips{position:fixed;-webkit-transform:translateZ(0);transform:translateZ(0);top:0;left:0;right:0;padding:5px;font-size:14px;text-align:center;color:#fff;z-index:5000;word-wrap:break-word;word-break:break-all}.weui-toptips_warn{background-color:#e64340}.weui-textarea{display:block;width:100%}.weui-textarea-counter{color:#b2b2b2;text-align:right}.weui-cell_warn,.weui-textarea-counter_warn{color:#e64340}.weui-form-preview{position:relative;background-color:#fff}.weui-form-preview:before{top:0;border-top:1rpx solid #d9d9d9}.weui-form-preview:after,.weui-form-preview:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#d9d9d9}.weui-form-preview:after{bottom:0;border-bottom:1rpx solid #d9d9d9}.weui-form-preview__value{font-size:14px}.weui-form-preview__value_in-hd{font-size:26px}.weui-form-preview__hd{position:relative;padding:10px 15px;text-align:right;line-height:2.5em}.weui-form-preview__hd:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid #d9d9d9;color:#d9d9d9;left:15px}.weui-form-preview__bd{padding:10px 15px;font-size:.9em;text-align:right;color:#999;line-height:2}.weui-form-preview__ft{position:relative;line-height:50px;display:-webkit-box;display:-webkit-flex;display:flex}.weui-form-preview__ft:after{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #d5d5d6;color:#d5d5d6}.weui-form-preview__item{overflow:hidden}.weui-form-preview__label{float:left;margin-right:1em;min-width:4em;color:#999;text-align:justify;text-align-last:justify}.weui-form-preview__value{display:block;overflow:hidden;word-break:normal;word-wrap:break-word}.weui-form-preview__btn{position:relative;display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;color:#3cc51f;text-align:center}.weui-form-preview__btn:after{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #d5d5d6;color:#d5d5d6}.weui-form-preview__btn:first-child:after{display:none}.weui-form-preview__btn_active{background-color:#eee}.weui-form-preview__btn_default{color:#999}.weui-form-preview__btn_primary{color:#0bb20c}.weui-cell_select{padding:0}.weui-select{position:relative;padding-left:15px;padding-right:30px;height:2.58823529em;min-height:2.58823529em;line-height:2.58823529em;border-right:1rpx solid #d9d9d9}.weui-select:before{content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8cd;border-style:solid;-webkit-transform:matrix(.71,.71,-.71,.71,0,0);transform:matrix(.71,.71,-.71,.71,0,0);position:relative;top:-2px;position:absolute;top:50%;right:15px;margin-top:-4px}.weui-select_in-select-after{padding-left:0}.weui-cell__bd_in-select-before,.weui-cell__hd_in-select-after{padding-left:15px}.weui-cell_vcode{padding-right:0}.weui-vcode-btn,.weui-vcode-img{margin-left:5px;height:2.58823529em;vertical-align:middle}.weui-vcode-btn{display:inline-block;padding:0 .6em 0 .7em;border-left:1px solid #e5e5e5;line-height:2.58823529em;font-size:17px;color:#3cc51f;white-space:nowrap}.weui-vcode-btn:active{color:#52a341}.weui-cell_switch{padding-top:6px;padding-bottom:6px}.weui-uploader__hd{display:-webkit-box;display:-webkit-flex;display:flex;padding-bottom:10px;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-uploader__title{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-uploader__info{color:#b2b2b2}.weui-uploader__bd{margin-bottom:-4px;margin-right:-9px;overflow:hidden}.weui-uploader__file{float:left;margin-right:9px;margin-bottom:9px}.weui-uploader__img{display:block;width:79px;height:79px}.weui-uploader__file_status{position:relative}.weui-uploader__file_status:before{content:" ";position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,.5)}.weui-uploader__file-content{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);color:#fff}.weui-uploader__input-box{float:left;position:relative;margin-right:9px;margin-bottom:9px;width:77px;height:77px;border:1px solid #d9d9d9}.weui-uploader__input-box:after,.weui-uploader__input-box:before{content:" ";position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background-color:#d9d9d9}.weui-uploader__input-box:before{width:2px;height:39.5px}.weui-uploader__input-box:after{width:39.5px;height:2px}.weui-uploader__input-box:active{border-color:#999}.weui-uploader__input-box:active:after,.weui-uploader__input-box:active:before{background-color:#999}.weui-uploader__input{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;opacity:0}.weui-article{padding:20px 15px;font-size:15px}.weui-article__section{margin-bottom:1.5em}.weui-article__h1{font-size:18px;font-weight:400;margin-bottom:.9em}.weui-article__h2{font-size:16px;font-weight:400;margin-bottom:.34em}.weui-article__h3{font-weight:400;font-size:15px;margin-bottom:.34em}.weui-article__p{margin:0 0 .8em}.weui-msg{padding-top:36px;text-align:center}.weui-msg__link{display:inline;color:#586c94}.weui-msg__icon-area{margin-bottom:30px}.weui-msg__text-area{margin-bottom:25px;padding:0 20px}.weui-msg__title{margin-bottom:5px;font-weight:400;font-size:20px}.weui-msg__desc{font-size:14px;color:#999}.weui-msg__opr-area{margin-bottom:25px}.weui-msg__extra-area{margin-bottom:15px;font-size:14px;color:#999}@media screen and (min-height:438px){.weui-msg__extra-area{position:fixed;left:0;bottom:0;width:100%;text-align:center}}.weui-flex{display:-webkit-box;display:-webkit-flex;display:flex}.weui-flex__item{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-btn{margin-top:15px}.weui-btn:first-child{margin-top:0}.weui-btn-area{margin:1.17647059em 15px .3em}.weui-agree{display:block;padding:.5em 15px;font-size:13px}.weui-agree__text{color:#999}.weui-agree__link{display:inline;color:#586c94}.weui-agree__checkbox{position:absolute;left:-9999px}.weui-agree__checkbox-icon{position:relative;top:2px;display:inline-block;border:1px solid #d1d1d1;background-color:#fff;border-radius:3px;width:11px;height:11px}.weui-agree__checkbox-icon-check{position:absolute;top:1px;left:1px}.weui-footer{color:#999;font-size:14px;text-align:center}.weui-footer_fixed-bottom{position:fixed;bottom:.52em;left:0;right:0}.weui-footer__links{font-size:0}.weui-footer__link{display:inline-block;vertical-align:top;margin:0 .62em;position:relative;font-size:14px;color:#586c94}.weui-footer__link:before{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #c7c7c7;color:#c7c7c7;left:-.65em;top:.36em;bottom:.36em}.weui-footer__link:first-child:before{display:none}.weui-footer__text{padding:0 .34em;font-size:12px}.weui-grids{border-top:1rpx solid #d9d9d9;border-left:1rpx solid #d9d9d9;overflow:hidden}.weui-grid{position:relative;float:left;padding:20px 10px;width:33.33333333%;box-sizing:border-box;border-right:1rpx solid #d9d9d9;border-bottom:1rpx solid #d9d9d9}.weui-grid_active{background-color:#ececec}.weui-grid__icon{display:block;width:28px;height:28px;margin:0 auto}.weui-grid__label{margin-top:5px;display:block;text-align:center;color:#000;font-size:14px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.weui-loading{margin:0 5px;width:20px;height:20px;display:inline-block;vertical-align:middle;-webkit-animation:a 1s steps(12) infinite;animation:a 1s steps(12) infinite;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;background-size:100%}.weui-loading.weui-loading_transparent{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect xmlns='http://www.w3.org/2000/svg' width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.56)' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.5)' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.43)' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.38)' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.32)' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.28)' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.25)' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.2)' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.17)' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.14)' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.1)' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.03)' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E")}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.weui-badge{display:inline-block;padding:.15em .4em;min-width:8px;border-radius:18px;background-color:#e64340;color:#fff;line-height:1.2;text-align:center;font-size:12px;vertical-align:middle}.weui-badge_dot{padding:.4em;min-width:0}.weui-loadmore{width:65%;margin:1.5em auto;line-height:1.6em;font-size:14px;text-align:center}.weui-loadmore__tips{display:inline-block;vertical-align:middle}.weui-loadmore_line{border-top:1px solid #e5e5e5;margin-top:2.4em}.weui-loadmore__tips_in-line{position:relative;top:-.9em;padding:0 .55em;background-color:#fff;color:#999}.weui-loadmore__tips_in-dot{position:relative;padding:0 .16em;width:4px;height:1.6em}.weui-loadmore__tips_in-dot:before{content:" ";position:absolute;top:50%;left:50%;margin-top:-1px;margin-left:-2px;width:4px;height:4px;border-radius:50%;background-color:#e5e5e5}.weui-panel{background-color:#fff;margin-top:10px;position:relative;overflow:hidden}.weui-panel:first-child{margin-top:0}.weui-panel:before{top:0;border-top:1rpx solid #e5e5e5}.weui-panel:after,.weui-panel:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#e5e5e5}.weui-panel:after{bottom:0;border-bottom:1rpx solid #e5e5e5}.weui-panel__hd{padding:14px 15px 10px;color:#999;font-size:13px;position:relative}.weui-panel__hd:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid #e5e5e5;color:#e5e5e5;left:15px}.weui-media-box{padding:15px;position:relative}.weui-media-box:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #e5e5e5;color:#e5e5e5;left:15px}.weui-media-box:first-child:before{display:none}.weui-media-box__title{font-weight:400;font-size:17px;width:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap:normal;word-wrap:break-word;word-break:break-all}.weui-media-box__desc{color:#999;font-size:13px;line-height:1.2;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.weui-media-box__info{margin-top:15px;padding-bottom:5px;font-size:13px;color:#cecece;line-height:1em;list-style:none;overflow:hidden}.weui-media-box__info__meta{float:left;padding-right:1em}.weui-media-box__info__meta_extra{padding-left:1em;border-left:1px solid #cecece}.weui-media-box__title_in-text{margin-bottom:8px}.weui-media-box_appmsg{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-media-box__thumb{width:100%;height:100%;vertical-align:top}.weui-media-box__hd_in-appmsg{margin-right:.8em;width:60px;height:60px;line-height:60px;text-align:center}.weui-media-box__bd_in-appmsg{-webkit-box-flex:1;-webkit-flex:1;flex:1;min-width:0}.weui-media-box_small-appmsg{padding:0}.weui-cells_in-small-appmsg{margin-top:0}.weui-cells_in-small-appmsg:before{display:none}.weui-progress{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-progress__bar{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-progress__opr{margin-left:15px;font-size:0}.weui-navbar{display:-webkit-box;display:-webkit-flex;display:flex;position:absolute;z-index:500;top:0;width:100%;border-bottom:1rpx solid #ccc}.weui-navbar__item{position:relative;display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;padding:13px 0;text-align:center;font-size:0}.weui-navbar__item.weui-bar__item_on{color:#1aad19}.weui-navbar__slider{position:absolute;content:" ";left:0;bottom:0;width:6em;height:3px;background-color:#1aad19;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.weui-navbar__title{display:inline-block;font-size:15px;max-width:8em;width:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap:normal}.weui-tab{position:relative;height:100%}.weui-tab__panel{box-sizing:border-box;height:100%;padding-top:50px;overflow:auto;-webkit-overflow-scrolling:touch}.weui-search-bar{position:relative;padding:8px 10px;display:-webkit-box;display:-webkit-flex;display:flex;box-sizing:border-box;background-color:#efeff4;border-top:1rpx solid #d7d6dc;border-bottom:1rpx solid #d7d6dc}.weui-icon-search{margin-right:8px;font-size:inherit}.weui-icon-search_in-box{position:absolute;left:10px;top:7px}.weui-search-bar__text{display:inline-block;font-size:14px;vertical-align:middle}.weui-search-bar__form{position:relative;-webkit-box-flex:1;-webkit-flex:auto;flex:auto;border-radius:5px;background:#fff;border:1rpx solid #e6e6ea}.weui-search-bar__box{position:relative;padding-left:30px;padding-right:30px;width:100%;box-sizing:border-box;z-index:1}.weui-search-bar__input{height:28px;line-height:28px;font-size:14px}.weui-icon-clear{position:absolute;top:0;right:0;padding:7px 8px;font-size:0}.weui-search-bar__label{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;border-radius:3px;text-align:center;color:#9b9b9b;background:#fff;line-height:28px}.weui-search-bar__cancel-btn{margin-left:10px;line-height:28px;color:#09bb07;white-space:nowrap}
--------------------------------------------------------------------------------