许成详 6 years ago
parent
commit
cc939c8071

+ 4
- 0
src/common/css/reset.css View File

65
 
65
 
66
 .van-toast div{
66
 .van-toast div{
67
 	color: white;
67
 	color: white;
68
+}
69
+
70
+.van-picker{
71
+	z-index: 101;
68
 }
72
 }

+ 104
- 0
src/components/calcMenu/index.vue View File

1
+<template>
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>
31
+                  </div>
32
+                </li>
33
+              </ul>
34
+            </div>
35
+          </div>
36
+        </div>
37
+      </div>
38
+    </div>
39
+  </div>
40
+</template>
41
+
42
+<script>
43
+
44
+export default {
45
+  name: '',
46
+  props: ['show', 'data'],
47
+  data () {
48
+    return {
49
+
50
+    }
51
+  },
52
+  computed: {
53
+
54
+  },
55
+  components: {
56
+
57
+  },
58
+  created () {
59
+
60
+  },
61
+  methods: {
62
+    add (item) { // 增加
63
+      this.calc(item, true)
64
+    },
65
+    subtract (item) { // 减
66
+      this.calc(item, false)
67
+    },
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)
96
+    },
97
+  }
98
+}
99
+</script>
100
+
101
+<!-- Add "scoped" attribute to limit CSS to this component only -->
102
+<style lang="scss" scoped>
103
+@import "page.scss";
104
+</style>

+ 152
- 0
src/components/calcMenu/page.scss View File

1
+.calcMenu{
2
+  width: 100%;
3
+  position: absolute;
4
+  left: 0;
5
+  bottom: 0;
6
+  top: 0;
7
+  background: rgba(0, 0, 0, .5);
8
+  z-index: 500;
9
+  display: none;
10
+  &.show{
11
+    display: block;
12
+  }
13
+  &>div{
14
+    width: 100%;
15
+    border-top-left-radius: .1rem;
16
+    border-top-right-radius: .1rem;
17
+    background: #fff;
18
+    position: absolute;
19
+    left: 0;
20
+    bottom: 0;
21
+    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{
69
+        width: 100%;
70
+        position: relative;
71
+        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;
83
+            color: #666;
84
+            margin-left: .05rem;
85
+          }
86
+        }
87
+      }
88
+      .list{
89
+        &>div.flex-item{
90
+          margin: 0 .1rem;
91
+          &>div{
92
+            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
+                  }
122
+                }
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
+                  }
132
+                }
133
+                &>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;
143
+                  }
144
+                }
145
+              }
146
+            }
147
+          }
148
+        }
149
+      }
150
+    }
151
+  }
152
+}

+ 86
- 0
src/components/orderItem/index.vue View File

1
+<template>
2
+  <div class="orderItem flex-h">
3
+    <div class="img">
4
+      <a>
5
+        <img src="" class="centerLabel cover" alt="">
6
+      </a>
7
+    </div>
8
+    <div class="content flex-item flex-v">
9
+      <div class="flex-item">
10
+        <div>
11
+          <span>{{data.name}}</span>
12
+        </div>
13
+      </div>
14
+      <div class="flex-h">
15
+        <div class="flex-item">
16
+          <div>
17
+            <span>¥{{data.price}}</span>
18
+          </div>
19
+        </div>
20
+        <i class="iconfont icon-jian" @click="subtract" v-if="!data.spec.length && data.status === 1"></i>
21
+        <input v-if="!data.spec.length && data.status === 1" type="tel" @input="input" v-model="defaultNum">
22
+        <i class="iconfont icon-jia" :class="{'active': defaultNum > 0}" @click="add" v-if="!data.spec.length && data.status === 1"></i>
23
+        <a v-if="data.spec.length && data.status === 1" @click="selectSpec">选规格</a>
24
+        <span v-if="data.status !== 1">已售罄</span>
25
+      </div>
26
+    </div>
27
+  </div>
28
+</template>
29
+
30
+<script>
31
+
32
+export default {
33
+  name: '',
34
+  props: ['data'],
35
+  data () {
36
+    return {
37
+      defaultNum: 0,
38
+    }
39
+  },
40
+  computed: {
41
+
42
+  },
43
+  components: {
44
+
45
+  },
46
+  created () {
47
+
48
+  },
49
+  methods: {
50
+    add () { // 增加
51
+      this.defaultNum += 1
52
+      this.select()
53
+    },
54
+    subtract () { // 减少
55
+      if (this.defaultNum > 0) this.defaultNum -= 1; this.select()
56
+    },
57
+    input () { // 输入
58
+      if (Number(this.defaultNum)) {
59
+        this.select()
60
+      } else {
61
+
62
+      }
63
+    },
64
+    select () { // 返回数据
65
+      this.$emit('returnData', {
66
+        name: this.data.name,
67
+        id: this.data.id,
68
+        specId: null,
69
+        specName: null,
70
+        num: null,
71
+        defaultNum: Number(this.defaultNum),
72
+        price: null,
73
+        defaultPrice: this.data.price,
74
+      })
75
+    },
76
+    selectSpec () { // 选规格
77
+      this.$emit('selectSpec', this.data)
78
+    },
79
+  }
80
+}
81
+</script>
82
+
83
+<!-- Add "scoped" attribute to limit CSS to this component only -->
84
+<style lang="scss" scoped>
85
+@import "page.scss";
86
+</style>

+ 74
- 0
src/components/orderItem/page.scss View File

1
+.orderItem{
2
+  .img{
3
+    width: .72rem;
4
+    position: relative;
5
+    overflow: hidden;
6
+    margin: 0 .1rem;
7
+    a{
8
+      width: 100%;
9
+      display: block;
10
+      padding-bottom: 100%;
11
+      background: #eee;
12
+      border-radius: .04rem;
13
+      position: relative;
14
+      overflow: hidden;
15
+    }
16
+  }
17
+  &>.flex-item{
18
+    margin-right: .15rem;
19
+    &>div.flex-item{
20
+      &>div{
21
+        width: 100%;
22
+        position: relative;
23
+        overflow: hidden;
24
+        span{
25
+          width: 100%;
26
+          display: block;
27
+          line-height: .22rem;
28
+          font-size: .13rem;
29
+          overflow: hidden;
30
+          white-space: nowrap;
31
+          text-overflow: ellipsis;
32
+        }
33
+      }
34
+    }
35
+    &>div.flex-h{
36
+      &>div{
37
+        &>div{
38
+          span{
39
+            width: 100%;
40
+            line-height: .2rem;
41
+            font-size: .11rem;
42
+          }
43
+        }
44
+      }
45
+      i{
46
+        font-size: .18rem;
47
+        line-height: .2rem;
48
+        color: #ccc;
49
+        &.active{
50
+          color: red;
51
+        }
52
+      }
53
+      input{
54
+        width: .4rem;
55
+        line-height: .18rem;
56
+        text-align: center;
57
+        margin: 0 .05rem;
58
+      }
59
+      a{
60
+        display: inline-block;
61
+        line-height: .2rem;
62
+        font-size: .11rem;
63
+        padding: 0 .15rem;
64
+        border-radius: .2rem;
65
+        background: #fc6243;
66
+        color: #fff;
67
+      }
68
+      &>span{
69
+        font-size: .13rem;
70
+        color: #666;
71
+      }
72
+    }
73
+  }
74
+}

+ 115
- 0
src/components/orderPopup/index.vue View File

1
+<template>
2
+  <div class="orderPopup" :class="{'show':show}">
3
+    <div class="centerLabel" v-if="data !== null">
4
+      <div class="top">
5
+        <span>{{data.name}}</span>
6
+        <i class="iconfont icon-guanbi" @click="close"></i>
7
+      </div>
8
+      <div class="content flex-h">
9
+        <div class="flex-item">
10
+          <div>
11
+            <span>规格:</span>
12
+            <ul>
13
+              <li v-for="(item,index) in data.spec" :class="{'active': index === activeIndex, 'grey': item.status !== 1}" :key="index" @click="selectItem(item, index)">{{item.value}}</li>
14
+            </ul>
15
+          </div>
16
+        </div>
17
+      </div>
18
+      <div class="bottom flex-h">
19
+        <div class="flex-item">
20
+          <div>
21
+            <span>¥{{price * num}}</span>
22
+          </div>
23
+        </div>
24
+        <i class="iconfont icon-jian" @click="subtract"></i>
25
+        <input type="tel" v-model="num">
26
+        <i class="iconfont icon-jia" @click="add"></i>
27
+        <a @click="sure">确定</a>
28
+      </div>
29
+      <!-- <a class="sure">确定</a> -->
30
+    </div>
31
+  </div>
32
+</template>
33
+
34
+<script>
35
+
36
+export default {
37
+  name: '',
38
+  props: ['show', 'data'],
39
+  data () {
40
+    return {
41
+      activeIndex: '',
42
+      price: 0,
43
+      num: 1,
44
+      specId: '',
45
+      specName: '',
46
+    }
47
+  },
48
+  computed: {
49
+
50
+  },
51
+  components: {
52
+
53
+  },
54
+  created () {
55
+
56
+  },
57
+  methods: {
58
+    sure () { // 确定
59
+      if (this.activeIndex === '' || this.price === 0 || this.num < 1) {
60
+        return false
61
+      }
62
+      this.$emit('returnData', {
63
+        name: this.data.name,
64
+        id: this.data.id,
65
+        specId: this.specId,
66
+        specName: this.specName,
67
+        num: this.num,
68
+        defaultNum: null,
69
+        price: this.price,
70
+        defaultPrice: null,
71
+      })
72
+      this.close()
73
+    },
74
+    subtract () { // 减
75
+      if (this.num > 1) {
76
+        this.num -= 1
77
+      }
78
+    },
79
+    add () { // 加
80
+      this.num += 1
81
+    },
82
+    selectItem (item, index) { // 选择规格
83
+      if (item.status === 1) {
84
+        if (this.activeIndex === index) {
85
+          this.activeIndex = ''
86
+          this.price = 0
87
+          this.specId = ''
88
+          this.specName = ''
89
+        } else {
90
+          this.activeIndex = index
91
+          this.price = item.price
92
+          this.specId = item.id
93
+          this.specName = item.value
94
+        }
95
+      }
96
+    },
97
+    close () { // 关闭弹窗
98
+      this.$emit('closePopup')
99
+      this.resetData()
100
+    },
101
+    resetData () { // 重置状态
102
+      this.activeIndex = ''
103
+      this.price = 0
104
+      this.num = 1
105
+      this.specName = ''
106
+      this.specId = ''
107
+    },
108
+  }
109
+}
110
+</script>
111
+
112
+<!-- Add "scoped" attribute to limit CSS to this component only -->
113
+<style lang="scss" scoped>
114
+@import "page.scss";
115
+</style>

+ 139
- 0
src/components/orderPopup/page.scss View File

1
+.orderPopup{
2
+  width: 100%;
3
+  position: absolute;
4
+  left: 0;
5
+  bottom: 0;
6
+  top: 0;
7
+  background: rgba(0, 0, 0, .5);
8
+  z-index: 500;
9
+  display: none;
10
+  &.show{
11
+    display: block;
12
+  }
13
+  &>.centerLabel{
14
+    width: 3.35rem;
15
+    background: #fff;
16
+    border-radius: .08rem;
17
+    overflow: hidden;
18
+    .top{
19
+      width: 100%;
20
+      position: relative;
21
+      overflow: hidden;
22
+      margin: .1rem auto 0;
23
+      span{
24
+        width: 100%;
25
+        display: block;
26
+        line-height: .28rem;
27
+        text-align: center;
28
+        font-size: .17rem;
29
+      }
30
+      i{
31
+        display: inline-block;
32
+        position: absolute;
33
+        top: 50%;
34
+        transform: translateY(-50%);
35
+        -webkit-transform: translateY(-50%);
36
+        right: .1rem;
37
+        font-size: .2rem;
38
+        color: #999;
39
+      }
40
+    }
41
+    .content{
42
+      width: 100%;
43
+      position: relative;
44
+      overflow: hidden;
45
+      &>div{
46
+        margin: 0 .2rem;
47
+        &>div{
48
+          width: 100%;
49
+          position: relative;
50
+          overflow: hidden;
51
+          &>span{
52
+            width: 100%;
53
+            display: block;
54
+            line-height: .26rem;
55
+            font-size: .14rem;
56
+            color: #666;
57
+            margin: .24rem auto 0;
58
+          }
59
+          ul{
60
+            font-size: 0;
61
+            li{
62
+              display: inline-block;
63
+              line-height: .32rem;
64
+              padding: 0 .15rem;
65
+              font-size: .14rem;
66
+              color: #666;
67
+              border: .01rem solid #eee;
68
+              border-radius: .04rem;
69
+              margin: .1rem .1rem 0 0;
70
+              &.active{
71
+                color: #fc6243;
72
+                border-color: #fc6243;
73
+              }
74
+              &.grey{
75
+                color: #ccc;
76
+                border-color: #eee;
77
+                border-style: dashed;
78
+              }
79
+            }
80
+          }
81
+        }
82
+      }
83
+    }
84
+    .bottom{
85
+      background: #f2f2f2;
86
+      margin-top: .3rem;
87
+      align-items: center;
88
+      &>div{
89
+        &>div{
90
+          width: 100%;
91
+          position: relative;
92
+          overflow: hidden;
93
+          span{
94
+            width: 100%;
95
+            display: block;
96
+            text-indent: .2rem;
97
+            line-height: .5rem;
98
+            font-size: .15rem;
99
+            color: #fc6243;
100
+          }
101
+        }
102
+      }
103
+      i{
104
+        font-size: .2rem;
105
+        color: #fc6243;
106
+        margin-left: .1rem;
107
+        &:last-child{
108
+          margin-right: .2rem;
109
+        }
110
+      }
111
+      input{
112
+        width: .3rem;
113
+        background: none;
114
+        line-height: .2rem;
115
+        font-size: .13rem;
116
+        text-align: center;
117
+        margin-left: .1rem;
118
+      }
119
+      a{
120
+        display: inline-block;
121
+        line-height: .5rem;
122
+        background: #fc6243;
123
+        color: #fff;
124
+        font-size: .15rem;
125
+        padding: 0 .3rem;
126
+        margin-left: .3rem;
127
+      }
128
+    }
129
+    .sure{
130
+      width: 100%;
131
+      display: block;
132
+      line-height: .5rem;
133
+      text-align: center;
134
+      background: #fc6243;
135
+      color: #fff;
136
+      font-size: .15rem;
137
+    }
138
+  }
139
+}

+ 48
- 15
src/module/user/mainPage/coffeeIndex/index.vue View File

2
   <div class="mainPage flex-v">
2
   <div class="mainPage flex-v">
3
     <div class="top flex-h">
3
     <div class="top flex-h">
4
       <i class="iconfont icon-dingwei"></i>
4
       <i class="iconfont icon-dingwei"></i>
5
-      <span>南京</span>
6
-      <a>请选择</a>
5
+      <span>{{caseInfo.value}}</span>
6
+      <a @click="showSelect = true">请选择</a>
7
       <div class="flex-item">
7
       <div class="flex-item">
8
         <span>Alise您好!</span>
8
         <span>Alise您好!</span>
9
       </div>
9
       </div>
13
         <div class="flex-h">
13
         <div class="flex-h">
14
           <div class="flex-item">
14
           <div class="flex-item">
15
             <ul class="areaList">
15
             <ul class="areaList">
16
-              <li v-for="(item,index) in 10" :key="index">
16
+              <li v-for="(item,index) in list" :key="index">
17
                 <div class="title">
17
                 <div class="title">
18
                   <i class="iconfont icon-yinchenglogo"></i>
18
                   <i class="iconfont icon-yinchenglogo"></i>
19
-                  <span>悦见山区域一</span>
19
+                  <span>{{item.name}}</span>
20
                 </div>
20
                 </div>
21
                 <ul class="subAreaList flex-h">
21
                 <ul class="subAreaList flex-h">
22
-                  <li class="flex-item flex-h" v-for="(subItem,subIndex) in 10" :key="subIndex">
22
+                  <li class="flex-item flex-h" v-for="(subItem,subIndex) in item.list" :key="subIndex">
23
                     <i class="iconfont icon-yinchenglogo"></i>
23
                     <i class="iconfont icon-yinchenglogo"></i>
24
                     <div class="itemNo">
24
                     <div class="itemNo">
25
                       <a>
25
                       <a>
26
-                        <div class="centerLabel" v-html="returnNo(subIndex)"></div>
26
+                        <div class="centerLabel">
27
+                          <i v-if="String(subIndex + 1).length < 2" class="iconfont icon-0"></i>
28
+                          <i class="iconfont" v-for="(numItem,numIndex) in String(subIndex + 1).length" :key="numIndex" :class="'icon-' + String(subIndex + 1).substring(numIndex, numIndex + 1)"></i>
29
+                        </div>
27
                       </a>
30
                       </a>
28
                     </div>
31
                     </div>
29
                     <div class="flex-item">
32
                     <div class="flex-item">
30
                       <div>
33
                       <div>
31
                         <span>案场一号桌</span>
34
                         <span>案场一号桌</span>
32
-                        <a>选择点单</a>
35
+                        <router-link :to="{name: 'placeOrder', query: {}}">选择点单</router-link>
33
                       </div>
36
                       </div>
34
                     </div>
37
                     </div>
35
                   </li>
38
                   </li>
39
+                  <li class="flex-item noData" v-if="item.list.length % 2 != 0"></li>
36
                 </ul>
40
                 </ul>
37
               </li>
41
               </li>
38
             </ul>
42
             </ul>
40
         </div>
44
         </div>
41
       </div>
45
       </div>
42
     </div>
46
     </div>
47
+    <div class="selectCase" :hidden="!showSelect"></div>
48
+    <van-picker :hidden="!showSelect"
49
+      show-toolbar
50
+      title="选择案场"
51
+      :columns="caseList"
52
+      @cancel="showSelect = false"
53
+      @confirm="selectCase"
54
+      value-key="value"
55
+    />
43
   </div>
56
   </div>
44
 </template>
57
 </template>
45
 
58
 
49
   name: '',
62
   name: '',
50
   data () {
63
   data () {
51
     return {
64
     return {
52
-
65
+      caseInfo: {
66
+        value: '案场一',
67
+        id: ''
68
+      },
69
+      showSelect: false,
70
+      caseList: [{
71
+        value: '案场一',
72
+        id: ''
73
+      }, {
74
+        value: '案场二',
75
+        id: ''
76
+      }, {
77
+        value: '案场三',
78
+        id: ''
79
+      }, {
80
+        value: '案场四',
81
+        id: ''
82
+      }],
83
+      list: [{
84
+        name: '案场名称1',
85
+        list: [{}, {}, {}, {}, {}],
86
+      }, {
87
+        name: '案场名称2',
88
+        list: [{}, {}, {}, {}, {}],
89
+      }]
53
     }
90
     }
54
   },
91
   },
55
   computed: {
92
   computed: {
62
 
99
 
63
   },
100
   },
64
   methods: {
101
   methods: {
65
-    returnNo (index) { // 返回桌号
66
-      index = String(index + 1)
67
-      let aHtml = ''
68
-      for (var n = 0; n < index.length; n++) {
69
-        aHtml += '<i class="iconfont icon-' + index.substring(n, n + 1) + '" style="display: inline-block;font-size: .13rem;color: #666;"></i>'
70
-      }
71
-      return index.length > 1 ? aHtml : '<i class="iconfont icon-0" style="display: inline-block;font-size: .13rem;color: #666;"></i>' + aHtml
102
+    selectCase (val) { // 选择案场
103
+      this.caseInfo = val
104
+      this.showSelect = false
72
     },
105
     },
73
   }
106
   }
74
 }
107
 }

+ 13
- 0
src/module/user/mainPage/coffeeIndex/page.scss View File

81
                 &:nth-child(2n){
81
                 &:nth-child(2n){
82
                   margin-left: .2rem;
82
                   margin-left: .2rem;
83
                 }
83
                 }
84
+                &.noData{
85
+                  box-shadow: none;
86
+                  background: none;
87
+                }
84
                 &>i{
88
                 &>i{
85
                   display: inline-block;
89
                   display: inline-block;
86
                   position: absolute;
90
                   position: absolute;
151
       }
155
       }
152
     }
156
     }
153
   }
157
   }
158
+  .selectCase{
159
+    width: 100%;
160
+    position: absolute;
161
+    left: 0;
162
+    top: 0;
163
+    bottom: 0;
164
+    background: rgba(0, 0, 0, .3);
165
+    z-index: 100;
166
+  }
154
 }
167
 }

+ 336
- 0
src/module/user/placeOrder/index.vue View File

1
+<template>
2
+  <div class="mainPage flex-v">
3
+    <div class="flex-item flex-v">
4
+      <div class="banner">
5
+        <img src="" class="centerLabel cover" alt="">
6
+        <div class="bannerInfo flex-h">
7
+          <div class="flex-item">
8
+            <div>
9
+              <span>项目名称:xxxx</span>
10
+            </div>
11
+          </div>
12
+          <span>xxx您好!</span>
13
+        </div>
14
+      </div>
15
+      <div class="tableInfo flex-h">
16
+        <div class="flex-item">
17
+          <div>
18
+            <span>桌号:案场11号桌</span>
19
+            <span>本月已用:150杯</span>
20
+          </div>
21
+        </div>
22
+        <router-link :to="{name: 'coffeeIndex', query: {}}">返回选择桌号</router-link>
23
+      </div>
24
+      <div class="content flex-item flex-h">
25
+        <div class="slideMenus">
26
+          <div>
27
+            <ul>
28
+              <li v-for="(item,index) in menuList" :key="index" :class="{'active': slideMenusActive == index}" @click="cutMenu(index)">
29
+                <span>{{item.value}}</span>
30
+                <span>{{item.eValue}}</span>
31
+              </li>
32
+            </ul>
33
+          </div>
34
+        </div>
35
+        <div class="flex-item">
36
+          <div>
37
+            <swiper :options="swiperOption" ref="mySwiper">
38
+              <swiper-slide class="swiper-slide" v-for="(item,index) in menuList" :key="index">
39
+                <div class="flex-v">
40
+                  <h4>{{item.value + ' ' + item.eValue}}</h4>
41
+                  <div class="flex-item">
42
+                    <div>
43
+                      <swiper :options="subSwiperOption" ref="mySubSwiper">
44
+                        <swiper-slide class="swiper-slide" v-for="(subItem,subIndex) in item.list" :key="subIndex">
45
+                          <orderItem :data="subItem" @returnData="calcMenus" @selectSpec="selectSpec"></orderItem>
46
+                        </swiper-slide>
47
+                      </swiper>
48
+                    </div>
49
+                  </div>
50
+                </div>
51
+              </swiper-slide>
52
+            </swiper>
53
+          </div>
54
+        </div>
55
+      </div>
56
+      <calcMenu :show="showCalcMenu" :data="settlementList" @returnData="calcMenus"></calcMenu>
57
+    </div>
58
+    <div class="flex-h">
59
+      <div class="flex-item">
60
+        <div>
61
+          <span>总计</span>
62
+          <span>{{totalNum}}</span>
63
+          <span>杯</span>
64
+          <span>共</span>
65
+          <span>{{totalPrice}}</span>
66
+          <span>元</span>
67
+          <i class="iconfont icon-jiantou-up"></i>
68
+        </div>
69
+      </div>
70
+      <a>下单</a>
71
+    </div>
72
+    <orderPopup :show="showPopup" :data="currentSpec" @closePopup="closePopup" @returnData="calcMenus"></orderPopup>
73
+  </div>
74
+</template>
75
+
76
+<script>
77
+import orderItem from '../../../components/orderItem/index'
78
+import orderPopup from '../../../components/orderPopup/index'
79
+import calcMenu from '../../../components/calcMenu/index'
80
+import { swiper, swiperSlide } from 'vue-awesome-swiper'
81
+import 'swiper/dist/css/swiper.css'
82
+
83
+export default {
84
+  name: '',
85
+  data () {
86
+    const _self = this
87
+    return {
88
+      showCalcMenu: true, // 显隐已点菜单弹窗
89
+      currentSpec: null, // 当前选择规格
90
+      showPopup: false, // 显隐选规格弹窗
91
+      totalNum: 0, // 总杯数
92
+      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
+}], // 商品选择清单
130
+      slideMenusActive: 0, // 左侧菜单选中索引值
131
+      menuList: [{ // 商品数据
132
+        value: '咖啡',
133
+        eValue: 'Coffee',
134
+        id: '1',
135
+        status: 1,
136
+        list: [{
137
+          img: '',
138
+          name: '商品名称',
139
+          id: '1-1',
140
+          status: 1,
141
+          spec: [{
142
+            value: '去冰',
143
+            id: '1-1-1',
144
+            num: 0,
145
+            status: 0,
146
+            price: '10',
147
+          }, {
148
+            value: '少冰',
149
+            id: '1-1-2',
150
+            num: 0,
151
+            status: 1,
152
+            price: '15',
153
+          }, {
154
+            value: '正常',
155
+            id: '1-1-3',
156
+            num: 0,
157
+            status: 1,
158
+            price: '20',
159
+          }, {
160
+            value: '多冰',
161
+            id: '1-1-4',
162
+            num: 0,
163
+            status: 1,
164
+            price: '25',
165
+          }],
166
+          price: '100',
167
+        }, {
168
+          img: '',
169
+          name: '商品名称',
170
+          id: '1-2',
171
+          spec: [],
172
+          status: 0,
173
+          price: '100',
174
+        }, {
175
+          img: '',
176
+          name: '商品名称',
177
+          id: '1-3',
178
+          spec: [],
179
+          status: 1,
180
+          price: '100',
181
+        }, {
182
+          img: '',
183
+          name: '商品名称',
184
+          id: '1-4',
185
+          spec: [],
186
+          status: 1,
187
+          price: '100',
188
+        }, {
189
+          img: '',
190
+          name: '商品名称',
191
+          id: '1-5',
192
+          spec: [],
193
+          status: 1,
194
+          price: '100',
195
+        }, {
196
+          img: '',
197
+          name: '商品名称',
198
+          id: '1-6',
199
+          spec: [],
200
+          status: 1,
201
+          price: '100',
202
+        }],
203
+      }, {
204
+        value: '咖啡一',
205
+        eValue: 'Coffee',
206
+        id: '2',
207
+        status: 1,
208
+        list: [],
209
+      }, {
210
+        value: '咖啡二',
211
+        eValue: 'Coffee',
212
+        id: '3',
213
+        status: 1,
214
+        list: [],
215
+      }, {
216
+        value: '咖啡三',
217
+        eValue: 'Coffee',
218
+        id: '4',
219
+        status: 1,
220
+        list: [],
221
+      }, {
222
+        value: '咖啡四',
223
+        eValue: 'Coffee',
224
+        id: '5',
225
+        status: 1,
226
+        list: [],
227
+      }],
228
+      swiperOption: {
229
+        observer: true,
230
+        direction: 'vertical',
231
+        on: {
232
+          transitionEnd () {
233
+            _self.slideMenusActive = this.activeIndex
234
+          },
235
+        }
236
+      },
237
+      subSwiperOption: {
238
+        observer: true,
239
+        direction: 'vertical',
240
+        nested: true,
241
+        slidesPerView: 'auto',
242
+        freeMode: true,
243
+        freeModeMomentumVelocityRatio: 2,
244
+      },
245
+    }
246
+  },
247
+  computed: {
248
+    MySwiper () {
249
+      return this.$refs.mySwiper.swiper
250
+    },
251
+    MySubSwiper () {
252
+      return this.$refs.mySubSwiper.swiper
253
+    },
254
+  },
255
+  components: {
256
+    swiper,
257
+    swiperSlide,
258
+    orderItem,
259
+    orderPopup,
260
+    calcMenu,
261
+  },
262
+  created () { },
263
+  methods: {
264
+    closePopup () { // 关闭规格弹窗
265
+      this.showPopup = false
266
+      this.currentSpec = null
267
+    },
268
+    selectSpec (val) { // 选规格
269
+      this.currentSpec = val
270
+      this.showPopup = true
271
+    },
272
+    cutMenu (index) { // 切换菜单
273
+      this.MySwiper.slideTo(index, 300)
274
+    },
275
+    calcMenus (val) { // 计算清单
276
+      var bool = true, arr = this.settlementList.slice()
277
+      if (val.specId === null) {
278
+        for (var n = 0; n < arr.length; n++) {
279
+          if (arr[n].id === val.id && arr[n].specId === null) {
280
+            bool = false
281
+            arr[n] = val
282
+          }
283
+        }
284
+        if (bool) {
285
+          arr.push(val)
286
+        }
287
+      } else {
288
+        for (var n = 0; n < arr.length; n++) {
289
+          if (arr[n].specId === val.specId) {
290
+            bool = false
291
+            arr[n] = val
292
+          }
293
+        }
294
+        if (bool) {
295
+          arr.push(val)
296
+        }
297
+      }
298
+      for (var n = 0; n < arr.length; n++) {
299
+        if (arr[n].num === 0 || arr[n].defaultNum === 0) {
300
+          arr.splice(n, 1)
301
+        }
302
+      }
303
+      this.settlementList = arr
304
+      // this.$set(this.settlementList, arr)
305
+      console.log(arr.length)
306
+      console.log(this.settlementList.length)
307
+      // console.log(JSON.stringify(this.settlementList))
308
+      this.calcTotalNum()
309
+    },
310
+    calcTotalNum () { // 计算总数量、价格
311
+      var num = 0, price = 0
312
+      if (!this.settlementList.length) {
313
+        this.totalNum = 0
314
+        this.totalPrice = 0
315
+        return
316
+      }
317
+      for (var n = 0; n < this.settlementList.length; n++) {
318
+        if (this.settlementList[n].specId === null) {
319
+          num += this.settlementList[n].defaultNum
320
+          price += this.settlementList[n].defaultPrice * this.settlementList[n].defaultNum
321
+        } else {
322
+          num += this.settlementList[n].num
323
+          price += this.settlementList[n].price * this.settlementList[n].num
324
+        }
325
+      }
326
+      this.totalNum = num
327
+      this.totalPrice = price
328
+    },
329
+  }
330
+}
331
+</script>
332
+
333
+<!-- Add "scoped" attribute to limit CSS to this component only -->
334
+<style lang="scss" scoped>
335
+@import "page.scss";
336
+</style>

+ 241
- 0
src/module/user/placeOrder/page.scss View File

1
+.mainPage{
2
+  &>div.flex-item{
3
+    position: relative;
4
+    z-index: 1;
5
+    .banner{
6
+      width: 100%;
7
+      position: relative;
8
+      overflow: hidden;
9
+      padding-bottom: 35%;
10
+      background: #eee;
11
+      img{
12
+        z-index: 1;
13
+      }
14
+      .bannerInfo{
15
+        width: 100%;
16
+        position: absolute;
17
+        left: 0;
18
+        bottom: 0;
19
+        z-index: 2;
20
+        &>div{
21
+          margin-left: .2rem;
22
+          &>div{
23
+            width: 100%;
24
+            font-size: 0;
25
+            white-space: nowrap;
26
+            span{
27
+              overflow: hidden;
28
+              text-overflow: ellipsis;
29
+              white-space: nowrap;
30
+              font-size: .15rem;
31
+              color: #fff;
32
+              line-height: .4rem;
33
+            }
34
+          }
35
+        }
36
+        &>span{
37
+          font-size: .15rem;
38
+          color: #fff;
39
+          line-height: .4rem;
40
+          margin-right: .2rem;
41
+          margin-left: .1rem;
42
+        }
43
+      }
44
+    }
45
+    .tableInfo{
46
+      align-items: center;
47
+      border-bottom: .01rem solid #eee;
48
+      &>div{
49
+        margin-left: .2rem;
50
+        &>div{
51
+          width: 100%;
52
+          position: relative;
53
+          overflow: hidden;
54
+          font-size: 0;
55
+          white-space: nowrap;
56
+          text-overflow: ellipsis;
57
+          span{
58
+            display: inline-block;
59
+            line-height: .4rem;
60
+            font-size: .13rem;
61
+            margin-right: .1rem;
62
+          }
63
+        }
64
+      }
65
+      &>a{
66
+        line-height: .22rem;
67
+        font-size: .13rem;
68
+        color: #fc6243;
69
+        border: .01rem solid #fc6243;
70
+        border-radius: .04rem;
71
+        padding: 0 .05rem;
72
+        margin-right: .2rem;
73
+      }
74
+    }
75
+    .content{
76
+      .slideMenus{
77
+        width: 24%;
78
+        min-width: .9rem;
79
+        position: relative;
80
+        overflow: hidden;
81
+        &>div{
82
+          width: 100%;
83
+          position: absolute;
84
+          left: 0;
85
+          top: 0;
86
+          bottom: 0;
87
+          overflow-y: scroll;
88
+          -webkit-overflow-scrolling: touch;
89
+          transform: translateZ(0);
90
+          -webkit-transform: translateZ(0);
91
+          background: #f7f7f7;
92
+          ul{
93
+            width: 100%;
94
+            overflow: hidden;
95
+            position: relative;
96
+            &>li{
97
+              width: 100%;
98
+              position: relative;
99
+              overflow: hidden;
100
+              padding: .18rem 0;
101
+              &.active{
102
+                background: #fff;
103
+              }
104
+              span{
105
+                width: 100%;
106
+                display: block;
107
+                text-align: center;
108
+                line-height: .22rem;
109
+                font-size: .14rem;
110
+              }
111
+            }
112
+          }
113
+        }
114
+      }
115
+      &>div.flex-item{
116
+        &>div{
117
+          width: 100%;
118
+          position: absolute;
119
+          left: 0;
120
+          top: 0;
121
+          bottom: 0;
122
+          overflow: hidden;
123
+          &>div{
124
+            width: 100%;
125
+            position: absolute;
126
+            left: 0;
127
+            top: 0;
128
+            bottom: 0;
129
+            overflow: hidden;
130
+            &>div{
131
+                &>.swiper-slide{
132
+                  &>div{
133
+                    width: 100%;
134
+                    position: absolute;
135
+                    left: 0;
136
+                    top: 0;
137
+                    bottom: 0;
138
+                    overflow: hidden;
139
+                    &>h4{
140
+                      width: 100%;
141
+                      display: block;
142
+                      line-height: .24rem;
143
+                      font-size: .11rem;
144
+                      text-indent: .1rem;
145
+                      margin-top: .1rem;
146
+                    }
147
+                    &>div{
148
+                      &>div{
149
+                        width: 100%;
150
+                        position: absolute;
151
+                        left: 0;
152
+                        top: 0;
153
+                        bottom: 0;
154
+                        overflow: hidden;
155
+                        &>div{
156
+                          width: 100%;
157
+                          position: absolute;
158
+                          left: 0;
159
+                          top: 0;
160
+                          bottom: 0;
161
+                          .swiper-slide{
162
+                            height: auto !important;
163
+                            padding: .15rem 0;
164
+                            position: relative;
165
+                            &::after{
166
+                              content: '';
167
+                              width: 100%;
168
+                              height: .01rem;
169
+                              background: #eee;
170
+                              position: absolute;
171
+                              left: 0;
172
+                              bottom: 0;
173
+                              z-index: 1;
174
+                            }
175
+                            &::before{
176
+                              content: '';
177
+                              width: .36rem;
178
+                              height: .01rem;
179
+                              background: #fff;
180
+                              position: absolute;
181
+                              left: 0;
182
+                              bottom: 0;
183
+                              z-index: 2;
184
+                            }
185
+                          }
186
+                        }
187
+                      }
188
+                    }
189
+                    .menuItem{
190
+                      width: 100%;
191
+                      position: relative;
192
+                      overflow: hidden;
193
+                    }
194
+                  }
195
+              }
196
+            }
197
+          }
198
+        }
199
+      }
200
+    }
201
+  }
202
+  &>div.flex-h{
203
+    padding: .1rem 0;
204
+    box-shadow: 0 0 .1rem .01rem rgba(0, 0, 0, .05);
205
+    position: relative;
206
+    z-index: 100;
207
+    a{
208
+      line-height: .4rem;
209
+      background: #fc6243;
210
+      color: #fff;
211
+      padding: 0 .5rem;
212
+      border-radius: .4rem;
213
+      font-size: .15rem;
214
+      margin-right: .2rem;
215
+    }
216
+    div{
217
+      font-size: 0;
218
+      white-space: nowrap;
219
+      span{
220
+        display: inline-block;
221
+        line-height: .4rem;
222
+        vertical-align: middle;
223
+        font-size: .13rem;
224
+        margin-left: .05rem;
225
+        &:first-child{
226
+          margin-left: .2rem;
227
+        }
228
+        &:nth-child(2){
229
+          font-size: .18rem;
230
+        }
231
+      }
232
+      i{
233
+        display: inline-block;
234
+        line-height: .4rem;
235
+        vertical-align: middle;
236
+        font-size: .13rem;
237
+        margin-left: .1rem;
238
+      }
239
+    }
240
+  }
241
+}

+ 6
- 0
src/module/user/router.js View File

7
 import majorProjects from './majorProjects/index' // 项目专题
7
 import majorProjects from './majorProjects/index' // 项目专题
8
 import majorProjectsDetail from './majorProjectsDetail/index' // 项目专题
8
 import majorProjectsDetail from './majorProjectsDetail/index' // 项目专题
9
 import coffeeIndex from './mainPage/coffeeIndex/index' // 城咖啡
9
 import coffeeIndex from './mainPage/coffeeIndex/index' // 城咖啡
10
+import placeOrder from './placeOrder/index' // 城咖啡-点单
10
 import userCenter from './mainPage/userCenter/index' // 个人中心
11
 import userCenter from './mainPage/userCenter/index' // 个人中心
11
 import bindMobile from './bindMobile/bindMobile' // 绑定手机号
12
 import bindMobile from './bindMobile/bindMobile' // 绑定手机号
12
 import lessonOrder from './lessonOrder/index' // 我的订单
13
 import lessonOrder from './lessonOrder/index' // 我的订单
36
       component: userCenter,
37
       component: userCenter,
37
       children: []
38
       children: []
38
     }]
39
     }]
40
+  },{ // 城咖啡-点单
41
+    path: '/placeOrder',
42
+    name: 'placeOrder',
43
+    component: placeOrder,
44
+    children: []
39
   },{ // 项目专题
45
   },{ // 项目专题
40
     path: '/majorProjects',
46
     path: '/majorProjects',
41
     name: 'majorProjects',
47
     name: 'majorProjects',

+ 1
- 1
src/module/user/user.html View File

3
 <head>
3
 <head>
4
   <meta charset="utf-8">
4
   <meta charset="utf-8">
5
   <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" charset="utf-8" />
5
   <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" charset="utf-8" />
6
-  <link rel="stylesheet" href="//at.alicdn.com/t/font_775069_mdkkdwmio2.css">
6
+  <link rel="stylesheet" href="//at.alicdn.com/t/font_775069_w203meltjv9.css">
7
   <title>城的空间</title>
7
   <title>城的空间</title>
8
 </head>
8
 </head>
9
 <body>
9
 <body>