yuantianjiao 6 years ago
parent
commit
8dc2294d9c

+ 3
- 2
config/index.js View File

@@ -12,8 +12,9 @@ module.exports = {
12 12
     proxyTable: {
13 13
       '/api': {
14 14
         // target: 'https://dp.huiju360.com.cn/hj_operations',
15
-        target: 'http://192.168.0.62:8080', //wf
16
-        // target: 'http://192.168.0.11:8088', //zys
15
+        // target: 'http://192.168.0.62:8080', //wf
16
+        target: 'http://192.168.0.11', //ys
17
+        // target: 'http://dev.ycjcjy.com/', //frp
17 18
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
18 19
         // pathRewrite: {
19 20
         //   '^/api': 'api'

+ 2
- 1
config/prod.env.js View File

@@ -1,4 +1,5 @@
1 1
 'use strict'
2 2
 module.exports = {
3
-  NODE_ENV: '"production"'
3
+  NODE_ENV: '"production"',
4
+  TEST_ENV: '"' + process.env.TEST_ENV + '"'
4 5
 }

+ 2
- 1
package.json View File

@@ -11,7 +11,8 @@
11 11
     "e2e": "node test/e2e/runner.js",
12 12
     "test": "npm run unit && npm run e2e",
13 13
     "lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
14
-    "build": "node build/build.js"
14
+    "build": "cross-env TEST_ENV=production node build/build.js",
15
+    "buildtest": "cross-env TEST_ENV=test node build/build.js"
15 16
   },
16 17
   "dependencies": {
17 18
     "@antv/g2": "^3.2.7",

+ 0
- 216
src/pages/system/newOrder/monthOrder/index.vue View File

@@ -1,216 +0,0 @@
1
-<template>
2
-  <div class="subPage">
3
-    <div class="system-table-search">
4
-      <div class="flex-h">
5
-        <div class="flex-item flex-h">
6
-          <el-button size="mini" type="success" @click='addMajorProjects'>新增</el-button>
7
-        </div>
8
-        <ul>
9
-          <li>
10
-            <span>选择案场:</span>
11
-            <el-select v-model="tableSearch.caseId" placeholder="请选择">
12
-              <el-option
13
-              value=""
14
-              >
15
-              </el-option>
16
-              <el-option
17
-                v-for="item in caseList"
18
-                :key="item.CaseId"
19
-                :label="item.CaseName"
20
-                :value="item.CaseId">
21
-              </el-option>
22
-            </el-select>
23
-          </li>
24
-        </ul>
25
-        <el-button
26
-          size="mini"
27
-          type="primary" @click="search">搜索</el-button>
28
-      </div>
29
-      <div class="moreFilter"></div>
30
-    </div>
31
-    <div class="system-table-box">
32
-      <el-table
33
-        :data="tableData"
34
-        stripe
35
-        style="width: 100%">
36
-        <el-table-column
37
-          prop="Name"
38
-          label="案场">
39
-        </el-table-column>
40
-        <el-table-column
41
-          prop="Title"
42
-          label="月份">
43
-        </el-table-column>
44
-        <el-table-column
45
-          prop="CaseName"
46
-          label="规定次数">
47
-        </el-table-column>
48
-        <el-table-column
49
-          prop="CreateDate"
50
-          label="实际次数">
51
-        </el-table-column>
52
-        <el-table-column
53
-          prop="CreateDate"
54
-          label="超出次数">
55
-        </el-table-column>
56
-        <el-table-column
57
-          prop="CreateDate"
58
-          label="剩余次数">
59
-        </el-table-column>
60
-        <el-table-column label="操作" width="450">
61
-          <template slot-scope="scope">
62
-            <el-button
63
-              size="mini"
64
-              type="primary"
65
-              @click="deleteItem(scope.$index, scope.row)">导出Excel</el-button>
66
-          </template>
67
-        </el-table-column>
68
-      </el-table>
69
-    </div>
70
-    <el-pagination
71
-      @current-change="handleCurrentChange"
72
-      :current-page.sync="postData.currentPage"
73
-      :page-size="postData.pageSize"
74
-      layout="prev, pager, next, jumper"
75
-      :total="postData.total">
76
-    </el-pagination>
77
-  </div>
78
-</template>
79
-
80
-<script>
81
-import { mapState, mapActions } from 'vuex'
82
-
83
-export default {
84
-  name: '',
85
-  data () {
86
-    return {
87
-      postData: {
88
-        currentPage: 1, // 当前页码
89
-        pageSize: 10,
90
-        total: 0,
91
-      },
92
-      tableSearch: { // 表格搜索条件
93
-        key: '', // 搜索关键字
94
-        caseId: '', // 案场id
95
-      },
96
-      tableData: []
97
-    }
98
-  },
99
-  computed: {
100
-    ...mapState({
101
-      OrgId: x => x.app.user.OrgId,
102
-      caseList: x => x.app.cases.list,
103
-      defaultCaseId: x => x.app.cases.default
104
-    })
105
-  },
106
-  components: {
107
-    // tableSearch,
108
-  },
109
-  created () {
110
-    this.updateSystemInfo().then(() => {
111
-      // this.tableSearch.caseId = this.defaultCaseId
112
-      this.getList()
113
-    })
114
-  },
115
-  methods: {
116
-    ...mapActions(['updateSystemInfo']),
117
-    handleCurrentChange (val) {
118
-      this.postData.currentPage = val
119
-      this.getList()
120
-    },
121
-    showItem (index, row) { // 前台显示
122
-      this.editIsAllCourse(row)
123
-    },
124
-    editItem (index, row) { // 编辑
125
-      console.log(index, row)
126
-      this.$router.push({ name: 'editIndexCase', query: { id: row.CmsCaseId } })
127
-    },
128
-    // copyItemUrl (index, row) { // 复制专题链接
129
-    //   console.log(index, row)
130
-    //   window.clipboardData.setData('Text', row.Title)
131
-    // },
132
-    deleteItem (index, row) { // 删除
133
-      console.log(index, row)
134
-      this.$confirm('确认删除此项目专题?', '提示', {
135
-        confirmButtonText: '确定',
136
-        cancelButtonText: '取消',
137
-        type: 'warning'
138
-      }).then(() => {
139
-        this.deleteInfo(row.CmsCaseId)
140
-      }).catch(() => {
141
-        this.$message({
142
-          type: 'info',
143
-          message: '已取消删除'
144
-        })
145
-      })
146
-    },
147
-    searchList (key) { // 搜索列表
148
-      this.tableSearch.key = key
149
-      this.getList()
150
-    },
151
-    addMajorProjects () {
152
-      this.$router.push({ name: 'addIndexCase' })
153
-    },
154
-    getList () {
155
-      this.tableData = []
156
-      this.$ajax(this.$api.cms.case.url, {
157
-        method: this.$api.cms.case.method,
158
-        queryData: {
159
-          page: this.postData.currentPage,
160
-          pagesize: this.postData.pageSize,
161
-          caseid: this.tableSearch.caseId,
162
-          name: this.tableSearch.key
163
-        }
164
-      }).then(res => {
165
-        for (let i = 0; i < res.list.length; i++) {
166
-          res.list[i].CreateDate = this.toolClass.dateFormat(res.list[i].CreateDate)
167
-        }
168
-        this.tableData = res.list
169
-        this.postData.total = res.pagenum
170
-        this.postData.currentPage = res.page
171
-      }).catch(msg => {
172
-
173
-      })
174
-    },
175
-    deleteInfo (id) {
176
-      this.$ajax(this.$api.cms.deleteCase.url, {
177
-        method: this.$api.cms.deleteCase.method,
178
-        urlData: {
179
-          id: id
180
-        }
181
-      }).then(res => {
182
-        this.$message({
183
-          type: 'success',
184
-          message: '删除成功!'
185
-        })
186
-        this.getList()
187
-      }).catch(msg => {
188
-
189
-      })
190
-    },
191
-    editIsAllCourse (data) {
192
-      console.log(data)
193
-      let api = data.Status === 1 ? this.$api.cms.caseHide : this.$api.cms.caseShow
194
-      this.$ajax(api.url, {
195
-        method: api.method,
196
-        urlData: {
197
-          id: data.CmsCaseId
198
-        }
199
-      }).then(res => {
200
-        this.$message({
201
-          message: '编辑成功',
202
-          type: 'success',
203
-          duration: 1000
204
-        })
205
-        this.getList()
206
-      }).catch(msg => {
207
-
208
-      })
209
-    },
210
-  }
211
-}
212
-</script>
213
-
214
-<!-- Add "scoped" attribute to limit CSS to this component only -->
215
-<style lang="scss" scoped>
216
-</style>

+ 91
- 41
src/pages/system/newOrder/newOrderList/index.vue View File

@@ -5,6 +5,22 @@
5 5
         <div class="flex-item flex-h">
6 6
           <el-button size="mini" type="danger">营业</el-button>
7 7
         </div>
8
+        <ul>
9
+          <li>
10
+            <!-- <span>选择案场:</span> -->
11
+            <el-select v-model="CaseId" placeholder="请选择">
12
+              <el-option
13
+                v-for="item in cases"
14
+                :key="item.CaseId"
15
+                :label="item.CaseName"
16
+                :value="item.CaseId">
17
+              </el-option>
18
+            </el-select>
19
+          </li>
20
+        </ul>
21
+        <el-button
22
+          size="mini"
23
+          type="primary" @click="GetOrdersList({ caseid: CaseId })">搜索</el-button>
8 24
       </div>
9 25
       <div class="moreFilter"></div>
10 26
     </div>
@@ -14,47 +30,39 @@
14 30
           <div style="padding:25px 20px 5px;border-bottom:2px solid #cccccc;">
15 31
             <i class="iconfont icon-yinchenglogo" style="font-size:70px;color:red;position: relative;bottom: 20px;margin-right:10px;"></i>
16 32
             <div style="display:inline-block;">
17
-              <span style="display:block;font-size:20px;font-weight:700;">A区域1号桌</span>
18
-              <span style="display:block;margin-top:10px">下单时间:21:30:39</span>
19
-              <span style="display:block;margin-top:10px">已等待:<span style="color:red;font-weight:700;">30:29</span></span>
33
+              <span style="display:block;font-size:20px;font-weight:700;">{{item.AreaName}}</span>
34
+              <span style="display:block;margin-top:10px">下单时间:{{toolClass.dateFormat(item.CreateDate)}}</span>
35
+              <span style="display:block;margin-top:10px">已等待:<span style="color:red;font-weight:700;">{{leftTimes[item.OrdersId]}}</span></span>
20 36
             </div>
21 37
           </div>
22
-          <div style="padding:10px 20px 5px;border-bottom:1px solid #cccccc;">
23
-            <div>卡布奇诺</div>
24
-            <div style="margin-top:8px;">
25
-              <span style="display:inline-block;width:75%;text-align:left;color:#cccccc">热</span>
26
-              <span style="display:inline-block;width:20%;text-align:right">x 1</span>
27
-            </div>
28
-            <div style="margin-top:8px;">
29
-              <span style="display:inline-block;width:75%;text-align:left;color:#cccccc">冷</span>
30
-              <span style="display:inline-block;width:20%;text-align:right">x 2</span>
38
+          <div style="padding:10px 20px 5px;border-bottom:1px solid #cccccc;" v-for='(item1,index1) in item.Goods' :key='index1'>
39
+            <div style="display:flex;justify-content: space-between;align-items: center;"><span>{{item1.GoodsName}}</span><span style="display:inline-block;width:20%;text-align:right" v-if='!item1.SpecName'>x {{item1.Number}}</span></div>
40
+            <div style="margin-top:8px;" v-if='item1.SpecName'>
41
+              <span style="display:inline-block;width:75%;text-align:left;color:#cccccc">{{item1.SpecName}}</span>
42
+              <span style="display:inline-block;width:20%;text-align:right">x {{item1.Number}}</span>
31 43
             </div>
32 44
           </div>
33
-          <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:请赶快制作</div>
34
-          <div style="padding:10px 20px;">下单人:xxxxx</div>
45
+          <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:{{item.Remark}}</div>
46
+          <div style="padding:10px 20px;">下单人:{{item.UserName}}</div>
35 47
         </div>
36 48
         <div class="print-area" :class="'item' + index" style="width:180px;">
37 49
           <div style="padding:25px 20px 5px;border-bottom:2px solid #cccccc;">
38 50
             <div style="display:inline-block;">
39 51
               <img class="topIcon" style="display:block;width:60%;margin:0 0 20px 10px;" src="http://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/upload/111101940020.png" alt="">
40
-              <span style="display:block;font-size:20px;font-weight:700;"> <img width='25px' height="25px" src="http://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/upload/111101940020.png" alt=""> A区域1号桌</span>
41
-              <span style="display:block;margin-top:10px;font-size:12px;">下单时间:21:30:39</span>
42
-              <span style="display:block;margin-top:10px;font-size:12px;">已等待:<span style="color:red;font-weight:700;">30:29</span></span>
52
+              <span style="display:block;font-size:20px;font-weight:700;"> <img width='25px' height="25px" src="http://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/upload/111101940020.png" alt=""> {{item.AreaName}}</span>
53
+              <span style="display:block;margin-top:10px;font-size:12px;">下单时间:{{toolClass.dateFormat(item.CreateDate)}}</span>
54
+              <span style="display:block;margin-top:10px;font-size:12px;">已等待:<span style="color:red;font-weight:700;">{{leftTimes[item.OrdersId]}}</span></span>
43 55
             </div>
44 56
           </div>
45
-          <div style="padding:10px 20px 5px;border-bottom:1px solid #cccccc;">
46
-            <div>卡布奇诺</div>
47
-            <div style="margin-top:8px;">
48
-              <span style="display:inline-block;width:75%;text-align:left;color:#cccccc;font-size:12px;">热</span>
49
-              <span style="display:inline-block;width:20%;text-align:right;font-size:12px;">x 1</span>
50
-            </div>
51
-            <div style="margin-top:8px;">
52
-              <span style="display:inline-block;width:75%;text-align:left;color:#cccccc;font-size:12px;">冷</span>
53
-              <span style="display:inline-block;width:20%;text-align:right;font-size:12px;">x 2</span>
57
+          <div style="padding:10px 20px 5px;border-bottom:1px solid #cccccc;" v-for='(item1,index1) in item.Goods' :key='index1'>
58
+            <div style="display:flex;justify-content: space-between;align-items: center;"><span>{{item1.GoodsName}}</span><span style="display:inline-block;width:20%;text-align:right" v-if='!item1.SpecName'>x {{item1.Number}}</span></div>
59
+            <div style="margin-top:8px;" v-if='item1.SpecName'>
60
+              <span style="display:inline-block;width:75%;text-align:left;color:#cccccc;font-size:12px;">{{item1.SpecName}}</span>
61
+              <span style="display:inline-block;width:20%;text-align:right;font-size:12px;">x {{item1.Number}}</span>
54 62
             </div>
55 63
           </div>
56
-          <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:请赶快制作</div>
57
-          <div style="padding:10px 20px;">下单人:xxxxx</div>
64
+          <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:{{item.Remark}}</div>
65
+          <div style="padding:10px 20px;">下单人:{{item.UserName}}</div>
58 66
         </div>
59 67
         <div class="btns">
60 68
           <span @click="cancel">取消</span>
@@ -66,13 +74,14 @@
66 74
 </template>
67 75
 
68 76
 <script>
69
-import { createNamespacedHelpers, mapState } from 'vuex'
77
+import { createNamespacedHelpers, mapState, mapActions } from 'vuex'
70 78
 
71 79
 import { getLodop } from '@/util/LodopFuncs'
72 80
 
81
+import { formatTimeBySeconds } from '@/util/util'
82
+
73 83
 const { mapState: mapOrderState, mapActions: mapOrderActions } = createNamespacedHelpers('goodsorder')
74 84
 
75
-const baseUrl = process.env.NODE_ENV === 'development' ? 'ws://192.168.0.148:8078/admin' : 'ws://cdkj.ycjcjy.com/admin' // 'ws://cdkj.ycjcjy.com/admin'
76 85
 var LODOP
77 86
 export default {
78 87
   name: '',
@@ -85,32 +94,66 @@ export default {
85 94
         pagesize: 10, // 请求数据量
86 95
       },
87 96
       currentList: [],
88
-      list: [1]
97
+      leftTimes: {},
89 98
     }
90 99
   },
91
-  components: {
100
+  computed: {
92 101
     ...mapOrderState({
93
-      orders: x => x.ordersList
102
+      list: x => (x.ordersList || {}).list || [],
94 103
     }),
95 104
     ...mapState({
96 105
       cases: x => x.app.cases.list,
97
-      defaultCaseId: x => x.app.cases.default
98
-    })
106
+      defaultCaseId: x => x.app.cases.default,
107
+      userInfo: x => x.app.user
108
+    }),
109
+    CaseId: {
110
+      get () {
111
+        return this.caseid || this.defaultCaseId
112
+      },
113
+      set (val) {
114
+        this.caseid = val
115
+      }
116
+    }
99 117
   },
100
-  mounted () {
101
-    this.GetOrdersList()
118
+  created () {
119
+    this.updateSystemInfo().then(() => {
120
+      this.initWebSocket()
121
+      this.GetOrdersList({ caseid: this.CaseId }).then(() => {
122
+        setInterval(() => {
123
+          const now = (new Date()).valueOf()
124
+          this.leftTimes = this.list.reduce((acc, it) => {
125
+            const showDT = now - ((new Date(it.CreateDate)).valueOf())
126
+
127
+            return { ...acc, [`${it.OrdersId}`]: formatTimeBySeconds(showDT) }
128
+          }, {})
129
+        }, 1000)
130
+      })
131
+    })
102 132
   },
103 133
   methods: {
134
+    timeOut (c) {
135
+      let cTime = new Date(c).valueOf()
136
+      let time = new Date().valueOf()
137
+      let s = parseInt((time - cTime) / 1000)
138
+      let m = parseInt(s / 60)
139
+      s = s - m * 60
140
+      m = m < 10 ? '0' + m : m
141
+      s = s < 10 ? '0' + s : s
142
+      return `${m} : ${s}`
143
+    },
104 144
     ...mapOrderActions([
105 145
       'GetOrdersList',
106 146
     ]),
147
+    ...mapActions([
148
+      'updateSystemInfo'
149
+    ]),
107 150
     submit (cl) {
108 151
       this.$confirm('确定完成此饮品?', '提示', {
109 152
         confirmButtonText: '确定',
110 153
         cancelButtonText: '取消',
111 154
         type: 'warning'
112 155
       }).then((res) => {
113
-        // this.printPdf(cl)
156
+        this.printPdf(cl)
114 157
       }).catch((res) => {
115 158
         this.$message({
116 159
           type: 'info',
@@ -143,18 +186,25 @@ export default {
143 186
         })
144 187
       })
145 188
     },
146
-    initWebSocket (code) {
147
-      const wsuri = `${baseUrl}/websocket/${code}`
189
+    initWebSocket () {
190
+      console.log(this.user)
191
+      let caseid = this.defaultCaseId
192
+      let id = this.userInfo.UserId
193
+      // const wsuri = `${window.location.origin.replace('http', 'ws')}/api/common/MQ/websocket/${caseid}/${id}`
194
+      const wsuri = `ws://192.168.0.11/api/guest/MQ/websocket/${caseid}/${id}`
148 195
       try {
149 196
         this.websock = new WebSocket(wsuri)
150 197
       } catch (e) {
151 198
         console.log(e)
152 199
       }
200
+      this.websock.onopen = console.log
153 201
       this.websock.onmessage = this.websocketonmessage
154
-      this.websock.onclose = this.websocketclose
202
+      this.websock.onclose = console.log
155 203
     },
156 204
     websocketonmessage (e) {
205
+      console.log(e)
157 206
       // const redata = JSON.parse(e.data)
207
+      this.list = JSON.parse(e.data).data.refreshOnlineGoodsOrders
158 208
     }
159 209
   }
160 210
 }

+ 0
- 1
src/pages/system/page.js View File

@@ -79,7 +79,6 @@ import frontEndUserList from './dataStatistics/frontEndUserList/index' // 课程
79 79
 
80 80
 import newOrder from './newOrder/index' // 商品订单系统
81 81
 import newOrderList from './newOrder/newOrderList/index' // 新订单列表
82
-import monthOrder from './newOrder/monthOrder/index' // 月订单列表
83 82
 
84 83
 import cardAndCouponManager from './cardAndCouponManager/index' // 卡券管理
85 84
 import cardList from './cardAndCouponManager/cardManager/index' // 卡列表

+ 8
- 0
src/util/util.js View File

@@ -27,4 +27,12 @@ const toolClass = {
27 27
 
28 28
 }
29 29
 
30
+export function formatTimeBySeconds (ms) {
31
+  const hs = ms / 3600000 | 0
32
+  const min = (ms - (hs * 3600000)) / 60000 | 0
33
+  const sec = (ms - (hs * 3600000) - (min * 60000)) / 1000 | 0
34
+
35
+  return hs > 0 ? `${hs}:${min}:${sec}` : `${min}:${sec}`
36
+}
37
+
30 38
 export default toolClass