许成详 6 лет назад
Родитель
Сommit
eda9bac06d

+ 5
- 0
package-lock.json Просмотреть файл

@@ -5206,6 +5206,11 @@
5206 5206
       "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
5207 5207
       "dev": true
5208 5208
     },
5209
+    "qrcodejs2": {
5210
+      "version": "0.0.2",
5211
+      "resolved": "https://registry.npmjs.org/qrcodejs2/-/qrcodejs2-0.0.2.tgz",
5212
+      "integrity": "sha1-Rlr+Xjnxn6zsuTLBH3oYYQkUauE="
5213
+    },
5209 5214
     "qs": {
5210 5215
       "version": "6.5.1",
5211 5216
       "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",

+ 1
- 0
package.json Просмотреть файл

@@ -11,6 +11,7 @@
11 11
   "dependencies": {
12 12
     "better-scroll": "^1.12.6",
13 13
     "node-sass": "^4.9.3",
14
+    "qrcodejs2": "0.0.2",
14 15
     "sass-loader": "^7.1.0",
15 16
     "swiper": "^4.3.5",
16 17
     "vant": "^1.1.16",

+ 37
- 64
src/components/calcMenu/index.vue Просмотреть файл

@@ -1,37 +1,39 @@
1 1
 <template>
2 2
   <div class="calcMenu" :class="{'show':show}">
3
-    <div>
4
-      <div class="top">
5
-        <i class="iconfont icon-guanbi"></i>
6
-        <span>当前已点菜单</span>
7
-      </div>
8
-      <div class="content">
9
-        <span class="noData" v-if="!data.length">暂未选择任何商品哦~~~快去下单!</span>
10
-        <div class="emptyMenus">
11
-          <a>
12
-            <i class="iconfont icon-qingkong"></i>
13
-            <span>清空已点菜单</span>
14
-          </a>
15
-        </div>
16
-        <div class="list flex-h">
17
-          <div class="flex-item">
18
-            <div>
19
-              <ul>
20
-                <li class="flex-h" v-for="(item,index) in data" :key="index">
21
-                  <span>{{item.name}}</span>
22
-                  <span v-if="item.specName !== null">{{item.specName}}</span>
23
-                  <span>{{item.defaultPrice !== null ? item.defaultPrice : item.price}}元/份</span>
24
-                  <div class="flex-item">
25
-                    <div>
26
-                      <i class="iconfont icon-jian" @click="subtract(item)"></i>
27
-                      <input type="tel" v-if="item.defaultNum !== null" v-model="item.defaultNum">
28
-                      <input type="tel" v-else v-model="item.num">
29
-                      <i class="iconfont icon-jia active" @click="add(item)"></i>
30
-                    </div>
3
+    <div class="centerLabel flex-h">
4
+      <div class="flex-item">
5
+        <div>
6
+          <div class="top">
7
+            <span>确认下单信息</span>
8
+            <span>下单完成后共计使用<em>{{totalNum}}</em>次</span>
9
+          </div>
10
+          <div class="content">
11
+            <span v-if="!data.length">您还没有点单哦~</span>  
12
+            <ul>
13
+              <li class="flex-h" v-for="(item,index) in data" :key="index">
14
+                <span>{{item.name}}</span>
15
+                <span v-if="item.specName !== null">({{item.specName}})</span>
16
+                <div class="flex-item">
17
+                  <div>
18
+                    <span>x{{item.defaultNum === null ? item.num : item.defaultNum}}</span>
31 19
                   </div>
32
-                </li>
33
-              </ul>
20
+                </div>
21
+              </li>
22
+            </ul>
23
+          </div>
24
+          <div class="bottom">
25
+            <div class="flex-h" v-if="data.length">
26
+              <span>备注:</span>
27
+              <div class="flex-item">
28
+                <div>
29
+                  <textarea cols="30" rows="3"></textarea>
30
+                </div>
31
+              </div>
34 32
             </div>
33
+            <ul class="flex-h">
34
+              <li class="flex-item" @click="close">再看看</li>
35
+              <li class="flex-item" @click="placeOrder">下单</li>
36
+            </ul>
35 37
           </div>
36 38
         </div>
37 39
       </div>
@@ -43,7 +45,7 @@
43 45
 
44 46
 export default {
45 47
   name: '',
46
-  props: ['show', 'data'],
48
+  props: ['show', 'data', 'totalNum'],
47 49
   data () {
48 50
     return {
49 51
 
@@ -59,40 +61,11 @@ export default {
59 61
 
60 62
   },
61 63
   methods: {
62
-    add (item) { // 增加
63
-      this.calc(item, true)
64
-    },
65
-    subtract (item) { // 减
66
-      this.calc(item, false)
64
+    close () { // 关闭菜单
65
+      this.$emit('closeCalcMenu')
67 66
     },
68
-    calc (item, bool) { // 增减
69
-      var target = null
70
-      if (item.defaultPrice === null) {
71
-        bool ? item.num += 1 : item.num > 0 ? item.num -= 1 : item.num = 0
72
-        target = {
73
-          name: item.name,
74
-          id: item.id,
75
-          specId: item.specId,
76
-          specName: item.specName,
77
-          num: item.num,
78
-          defaultNum: null,
79
-          price: item.price,
80
-          defaultPrice: null,
81
-        }
82
-      } else {
83
-        bool ? item.num += 1 : item.num > 0 ? item.num -= 1 : item.num = 0
84
-        target = {
85
-          name: item.name,
86
-          id: item.id,
87
-          specId: null,
88
-          specName: null,
89
-          num: null,
90
-          defaultNum: item.defaultNum,
91
-          price: null,
92
-          defaultPrice: item.defaultPrice,
93
-        }
94
-      }
95
-      this.$emit('returnData', target)
67
+    placeOrder () { // 点单
68
+      this.$emit('placeOrder')
96 69
     },
97 70
   }
98 71
 }

+ 112
- 116
src/components/calcMenu/page.scss Просмотреть файл

@@ -11,141 +11,137 @@
11 11
     display: block;
12 12
   }
13 13
   &>div{
14
-    width: 100%;
15
-    border-top-left-radius: .1rem;
16
-    border-top-right-radius: .1rem;
14
+    width: 3.2rem;
15
+    border-radius: .1rem;
17 16
     background: #fff;
18 17
     position: absolute;
19
-    left: 0;
20
-    bottom: 0;
21 18
     overflow: hidden;
22
-    .top{
23
-      width: 100%;
24
-      position: relative;
25
-      overflow: hidden;
26
-      text-align: right;
27
-      padding: .05rem 0;
28
-      border-bottom: .01rem solid #eee;
29
-      i{
30
-        font-size: .2rem;
31
-        color: #666;
32
-        display: inline-block;
33
-        position: absolute;
34
-        right: .1rem;
35
-        top: 50%;
36
-        transform: translateY(-50%);
37
-        -webkit-transform: translateY(-50%);
38
-        z-index: 501;
39
-      }
40
-      span{
41
-        width: 100%;
42
-        display: block;
43
-        line-height: .4rem;
44
-        text-align: center;
45
-        font-size: .15rem;
46
-        color: #666;
47
-        position: relative;
48
-        z-index: 500;
49
-      }
50
-    }
51
-    .content{
52
-      width: 100%;
53
-      max-height: 3rem;
54
-      position: relative;
55
-      overflow-y: scroll;
56
-      -webkit-overflow-scrolling: touch;
57
-      transform: translateZ(0);
58
-      -webkit-transform: translateZ(0);
59
-      padding-bottom: .1rem;
60
-      &>span.noData{
61
-        width: 100%;
62
-        line-height: .4rem;
63
-        text-align: center;
64
-        display: block;
65
-        font-size: .13rem;
66
-        color: #ccc;
67
-      }
68
-      .emptyMenus{
19
+    &>div{
20
+      margin: 0 .2rem;
21
+      &>div{
69 22
         width: 100%;
70 23
         position: relative;
71 24
         overflow: hidden;
72
-        text-align: right;
73
-        a{
74
-          font-size: 0;
75
-          white-space: nowrap;
76
-          display: inline-block;
77
-          margin-right: .1rem;
78
-          margin-top: .1rem;
79
-          &>*{
80
-            line-height: .2rem;
81
-            vertical-align: middle;
82
-            font-size: .13rem;
25
+        .top{
26
+          width: 100%;
27
+          position: relative;
28
+          overflow: hidden;
29
+          margin: .1rem auto 0;
30
+          padding-bottom: .05rem;
31
+          border-bottom: .01rem solid #eee;
32
+          span{
33
+            width: 100%;
34
+            display: block;
35
+            text-align: center;
36
+            font-size: .11rem;
83 37
             color: #666;
84
-            margin-left: .05rem;
38
+            line-height: .22rem;
39
+            &:first-child{
40
+              line-height: .26rem;
41
+              font-size: .15rem;
42
+              color: #333;
43
+            }
44
+            em{
45
+              color: #f1644b;
46
+              font-size: .11rem;
47
+            }
85 48
           }
86 49
         }
87
-      }
88
-      .list{
89
-        &>div.flex-item{
90
-          margin: 0 .1rem;
91
-          &>div{
50
+        .content{
51
+          width: 100%;
52
+          max-height: 2rem;
53
+          position: relative;
54
+          overflow-y: scroll;
55
+          -webkit-overflow-scrolling: touch;
56
+          transform: translateZ(0);
57
+          -webkit-transform: translateZ(0);
58
+          border-bottom: .01rem solid #eee;
59
+          padding-bottom: .1rem;
60
+          &>span{
92 61
             width: 100%;
93
-            position: relative;
94
-            overflow: hidden;
95
-            ul{
96
-              margin: .1rem auto 0;
97
-              li{
98
-                align-items: center;
99
-                padding: .1rem 0;
100
-                span{
101
-                  line-height: .24rem;
102
-                  font-size: .13rem;
103
-                  color: #666;
104
-                  margin-right: .1rem;
105
-                  &:nth-child(1){
106
-                    max-width: 1.5rem;
107
-                    overflow: hidden;
108
-                    white-space: nowrap;
109
-                    text-overflow: ellipsis;
110
-                  }
111
-                  &:nth-child(2),
112
-                  &:nth-child(3){
113
-                    font-size: .11rem;
114
-                    color: #ccc;
115
-                  }
116
-                }
117
-                &>*{
118
-                  margin-right: .05rem;
119
-                  &:last-child{
120
-                    margin-right: 0;
121
-                  }
62
+            display: block;
63
+            line-height: .4rem;
64
+            text-align: center;
65
+            font-size: .15rem;
66
+            color: #ccc;
67
+          }
68
+          ul{
69
+            margin: .1rem auto 0;
70
+            li{
71
+              &>*{
72
+                line-height: .34rem;
73
+                font-size: .14rem;
74
+                &:first-child{
75
+                  width: 30%;
76
+                  text-align: center;
122 77
                 }
123
-                i{
124
-                  font-size: .2rem;
125
-                  color: #ccc;
126
-                  line-height: .24rem;
127
-                  display: inline-block;
128
-                  vertical-align: middle;
129
-                  &.active{
130
-                    color: #fc6243;
131
-                  }
78
+                &:nth-child(2){
79
+                  font-size: .11rem;
80
+                  color: #666;
132 81
                 }
82
+              }
83
+              &>div{
84
+                margin-right: .2rem;
133 85
                 &>div{
134
-                  font-size: 0;
135
-                  text-align: right;
136
-                  white-space: nowrap;
137
-                  input{
138
-                    width: .3rem;
139
-                    text-align: center;
140
-                  }
141
-                  &>*{
142
-                    vertical-align: middle;
86
+                  width: 100%;
87
+                  position: relative;
88
+                  overflow: hidden;
89
+                  span{
90
+                    width: 100%;
91
+                    display: block;
92
+                    text-align: right;
93
+                    font-size: .14rem;
94
+                    color: #666;
143 95
                   }
144 96
                 }
145 97
               }
146 98
             }
147 99
           }
148 100
         }
101
+        .bottom{
102
+          margin: .1rem auto 0;
103
+          &>div.flex-h{
104
+            align-items: flex-start;
105
+            &>span{
106
+              line-height: .2rem;
107
+              font-size: .13rem;
108
+              color: #666;
109
+            }
110
+            &>div{
111
+              &>div{
112
+                width: 100%;
113
+                position: relative;
114
+                overflow: hidden;
115
+                textarea{
116
+                  width: 100%;
117
+                  line-height: .2rem;
118
+                  font-size: .13rem;
119
+                  color: #666;
120
+                }
121
+              }
122
+            }
123
+          }
124
+          ul{
125
+            width: 100%;
126
+            position: relative;
127
+            overflow: hidden;
128
+            margin-bottom: .25rem;
129
+            li{
130
+              line-height: .36rem;
131
+              border: .01rem solid #333;
132
+              padding: 0 .15rem;
133
+              font-size: .15rem;
134
+              border-radius: .04rem;
135
+              text-align: center;
136
+              &:nth-child(1){
137
+                margin-right: .1rem;
138
+              }
139
+              &:nth-child(2){
140
+                margin-left: .1rem;
141
+              }
142
+            }
143
+          }
144
+        }
149 145
       }
150 146
     }
151 147
   }

+ 28
- 0
src/module/user/orderList/index.vue Просмотреть файл

@@ -0,0 +1,28 @@
1
+<template>
2
+  <div class="mainPage flex-v">
3
+    1
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+
9
+export default {
10
+  name: '',
11
+  data () {
12
+    return {
13
+      
14
+    }
15
+  },
16
+  computed: {},
17
+  components: {},
18
+  created () { },
19
+  methods: {
20
+    
21
+  }
22
+}
23
+</script>
24
+
25
+<!-- Add "scoped" attribute to limit CSS to this component only -->
26
+<style lang="scss" scoped>
27
+@import "page.scss";
28
+</style>

+ 3
- 0
src/module/user/orderList/page.scss Просмотреть файл

@@ -0,0 +1,3 @@
1
+.mainPage{
2
+  
3
+}

+ 15
- 44
src/module/user/placeOrder/index.vue Просмотреть файл

@@ -53,7 +53,6 @@
53 53
           </div>
54 54
         </div>
55 55
       </div>
56
-      <calcMenu :show="showCalcMenu" :data="settlementList" @returnData="calcMenus"></calcMenu>
57 56
     </div>
58 57
     <div class="flex-h">
59 58
       <div class="flex-item">
@@ -64,12 +63,13 @@
64 63
           <span>共</span>
65 64
           <span>{{totalPrice}}</span>
66 65
           <span>元</span>
67
-          <i class="iconfont icon-jiantou-up"></i>
66
+          <i class="iconfont" :class="{'icon-jiantou-up': !showCalcMenu,'icon-jiantou-down': showCalcMenu}" @click="showCalcMenu = true"></i>
68 67
         </div>
69 68
       </div>
70
-      <a>下单</a>
69
+      <a @click="showCalcMenu = true">下单</a>
71 70
     </div>
72 71
     <orderPopup :show="showPopup" :data="currentSpec" @closePopup="closePopup" @returnData="calcMenus"></orderPopup>
72
+    <calcMenu :show="showCalcMenu" :totalNum="totalCupNum" :data="settlementList" @returnData="calcMenus" @emptyMenus="emptyMenus" @closeCalcMenu="closeCalcMenu" @placeOrder="placeOrder"></calcMenu>
73 73
   </div>
74 74
 </template>
75 75
 
@@ -85,48 +85,13 @@ export default {
85 85
   data () {
86 86
     const _self = this
87 87
     return {
88
-      showCalcMenu: true, // 显隐已点菜单弹窗
88
+      totalCupNum: 0, // 共计使用杯数
89
+      showCalcMenu: false, // 显隐已点菜单弹窗
89 90
       currentSpec: null, // 当前选择规格
90 91
       showPopup: false, // 显隐选规格弹窗
91 92
       totalNum: 0, // 总杯数
92 93
       totalPrice: 0, // 总价格
93
-      settlementList: [{
94
-    "name": "商品名称",
95
-    "id": "1-1",
96
-    "specId": "1-1-3",
97
-    "specName": "正常",
98
-    "num": 3,
99
-    "defaultNum": null,
100
-    "price": "20",
101
-    "defaultPrice": null
102
-}, {
103
-    "name": "商品名称",
104
-    "id": "1-1",
105
-    "specId": "1-1-4",
106
-    "specName": "多冰",
107
-    "num": 1,
108
-    "defaultNum": null,
109
-    "price": "25",
110
-    "defaultPrice": null
111
-}, {
112
-    "name": "商品名称",
113
-    "id": "1-3",
114
-    "specId": null,
115
-    "specName": null,
116
-    "num": null,
117
-    "defaultNum": 2,
118
-    "price": null,
119
-    "defaultPrice": "100"
120
-}, {
121
-    "name": "商品名称",
122
-    "id": "1-4",
123
-    "specId": null,
124
-    "specName": null,
125
-    "num": null,
126
-    "defaultNum": 3,
127
-    "price": null,
128
-    "defaultPrice": "100"
129
-}], // 商品选择清单
94
+      settlementList: [], // 商品选择清单
130 95
       slideMenusActive: 0, // 左侧菜单选中索引值
131 96
       menuList: [{ // 商品数据
132 97
         value: '咖啡',
@@ -261,6 +226,15 @@ export default {
261 226
   },
262 227
   created () { },
263 228
   methods: {
229
+    placeOrder () { // 下单
230
+      this.$router.push({name: 'orderList', query: {}})
231
+    },
232
+    closeCalcMenu () { // 关闭已选菜单
233
+      this.showCalcMenu = false
234
+    },
235
+    emptyMenus () { // 清空菜单
236
+      this.settlementList = []
237
+    },
264 238
     closePopup () { // 关闭规格弹窗
265 239
       this.showPopup = false
266 240
       this.currentSpec = null
@@ -301,9 +275,6 @@ export default {
301 275
         }
302 276
       }
303 277
       this.settlementList = arr
304
-      // this.$set(this.settlementList, arr)
305
-      console.log(arr.length)
306
-      console.log(this.settlementList.length)
307 278
       // console.log(JSON.stringify(this.settlementList))
308 279
       this.calcTotalNum()
309 280
     },

+ 6
- 0
src/module/user/router.js Просмотреть файл

@@ -8,6 +8,7 @@ import majorProjects from './majorProjects/index' // 项目专题
8 8
 import majorProjectsDetail from './majorProjectsDetail/index' // 项目专题
9 9
 import coffeeIndex from './mainPage/coffeeIndex/index' // 城咖啡
10 10
 import placeOrder from './placeOrder/index' // 城咖啡-点单
11
+import orderList from './orderList/index' // 城咖啡-点单列表
11 12
 import userCenter from './mainPage/userCenter/index' // 个人中心
12 13
 import bindMobile from './bindMobile/bindMobile' // 绑定手机号
13 14
 import lessonOrder from './lessonOrder/index' // 我的订单
@@ -46,6 +47,11 @@ const router = new Router({
46 47
     name: 'placeOrder',
47 48
     component: placeOrder,
48 49
     children: []
50
+  },{ // 城咖啡-点单列表
51
+    path: '/orderList',
52
+    name: 'orderList',
53
+    component: orderList,
54
+    children: []
49 55
   },{ // 项目专题
50 56
     path: '/majorProjects',
51 57
     name: 'majorProjects',