许成详 6 年之前
父節點
當前提交
7943814cae

+ 2
- 2
config/index.js 查看文件

24
     proxyTable: {
24
     proxyTable: {
25
       '/api': {
25
       '/api': {
26
         // target: 'https://dp.huiju360.com.cn/hj_operations',
26
         // target: 'https://dp.huiju360.com.cn/hj_operations',
27
-        target: 'http://192.168.0.62:8080', //wf
28
-        // target: 'http://192.168.0.11:8080', //ys
27
+        // target: 'http://192.168.0.62:8080', //wf
28
+        target: 'http://192.168.0.11:8080', //ys
29
         // target: 'http://dev.ycjcjy.com', //zys
29
         // target: 'http://dev.ycjcjy.com', //zys
30
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
30
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
31
         // pathRewrite: {
31
         // pathRewrite: {

+ 4
- 0
src/common/css/reset.css 查看文件

69
 
69
 
70
 .van-picker{
70
 .van-picker{
71
 	z-index: 101;
71
 	z-index: 101;
72
+}
73
+
74
+.van-dialog__message{
75
+	text-align: center;
72
 }
76
 }

+ 69
- 9
src/module/user/placeOrderForCourse/index.vue 查看文件

12
                     <span>精品课程名称</span>
12
                     <span>精品课程名称</span>
13
                   </div>
13
                   </div>
14
                 </div>
14
                 </div>
15
-                <span>满手</span>
15
+                <span>{{courseDetail.CourseName}}</span>
16
               </li>
16
               </li>
17
               <li class="flex-h">
17
               <li class="flex-h">
18
                 <div class="flex-item">
18
                 <div class="flex-item">
20
                     <span>预计开班时间</span>
20
                     <span>预计开班时间</span>
21
                   </div>
21
                   </div>
22
                 </div>
22
                 </div>
23
-                <span>满手</span>
23
+                <span>{{returnDate(courseDetail.BeginDate)}}</span>
24
               </li>
24
               </li>
25
               <li class="flex-h">
25
               <li class="flex-h">
26
                 <div class="flex-item">
26
                 <div class="flex-item">
28
                     <span>时间描述</span>
28
                     <span>时间描述</span>
29
                   </div>
29
                   </div>
30
                 </div>
30
                 </div>
31
-                <span>满手</span>
31
+                <span v-if="courseTimeList.length">{{returnCourseTime(courseTimeList[0].BeginDate,courseTimeList[0].EndDate)}}</span>
32
               </li>
32
               </li>
33
               <li class="flex-h">
33
               <li class="flex-h">
34
                 <div class="flex-item">
34
                 <div class="flex-item">
36
                     <span>地点</span>
36
                     <span>地点</span>
37
                   </div>
37
                   </div>
38
                 </div>
38
                 </div>
39
-                <span>满手</span>
39
+                <!-- <span>{{courseDetail.CaseInfo.CaseAddress}}</span> -->
40
               </li>
40
               </li>
41
               <li class="flex-h">
41
               <li class="flex-h">
42
                 <div class="flex-item">
42
                 <div class="flex-item">
44
                     <span>价格</span>
44
                     <span>价格</span>
45
                   </div>
45
                   </div>
46
                 </div>
46
                 </div>
47
-                <span>满手</span>
47
+                <span>¥{{courseDetail.Price}}</span>
48
               </li>
48
               </li>
49
             </ul>
49
             </ul>
50
             <div class="selectTicket">
50
             <div class="selectTicket">
91
     <div class="flex-h">
91
     <div class="flex-h">
92
       <div class="flex-item">
92
       <div class="flex-item">
93
         <div>
93
         <div>
94
-          <span>总计¥<em>109</em>.00</span>
94
+          <span>总计¥<em>{{courseDetail.Price}}</em></span>
95
         </div>
95
         </div>
96
       </div>
96
       </div>
97
-      <router-link :to="{name: '', query: {}}">确认订单</router-link>
97
+      <a @click="placeOrder">确认订单</a>
98
     </div>
98
     </div>
99
     <div class="layer" :class="{'show': showLayer}"> 
99
     <div class="layer" :class="{'show': showLayer}"> 
100
       <div>
100
       <div>
112
 </template>
112
 </template>
113
 
113
 
114
 <script>
114
 <script>
115
+import { mapState, createNamespacedHelpers } from 'vuex'
116
+const { mapActions: mapProjectActions, mapState: mapProjectState } = createNamespacedHelpers('majorProjects')
115
 
117
 
116
 export default {
118
 export default {
117
   name: '',
119
   name: '',
118
   data () {
120
   data () {
119
     return {
121
     return {
120
       agreementOff: false, // 是否同意协议
122
       agreementOff: false, // 是否同意协议
123
+      courseTimeList: [],
121
       postData: {
124
       postData: {
122
         CouponId: '',
125
         CouponId: '',
123
         CouponName: '',
126
         CouponName: '',
138
       }],
141
       }],
139
     }
142
     }
140
   },
143
   },
141
-  computed: {},
142
-  created () { },
144
+  computed: {
145
+    ...mapState({
146
+      orgid: x => x.app.orgId,
147
+      fiveA: x => x.index.fiveA,
148
+      banner: x => x.index.banner,
149
+      message: x => x.index.message,
150
+      project: x => x.index.project,
151
+      cms: x => x.index.cms,
152
+      user: x => x.userCenter.userInfo
153
+    }),
154
+    ...mapProjectState({
155
+      courseDetail: x => x.courseDetail
156
+    }),
157
+  },
158
+  created () {
159
+    this.getCourseDetailInfo({ id: this.$route.query.id }).then((res) => {
160
+      var arr = res.CourseDetail
161
+      this.courseTimeList = arr.sort(function (a, b) { return new Date(a.BeginDate).getTime() > new Date(b.BeginDate).getTime() ? 1 : -1 })
162
+    })
163
+  },
143
   methods: {
164
   methods: {
165
+    placeOrder () { // 下单
166
+      if(!this.agreementOff){
167
+        this.$toast('请先阅读服务协议并同意')
168
+        return false
169
+      }
170
+      this.placeOrderForCourse({
171
+        order: {
172
+          CourseId: this.courseDetail.CourseId,
173
+          CaseId: this.courseDetail.CaseId,
174
+          CustomerId: this.user.CustomerId,
175
+          Price: this.courseDetail.Price
176
+        },
177
+        coupons: []
178
+      }).then((res) => {
179
+        // console.log(JSON.stringify(res))
180
+        this.$dialog.alert({
181
+          message: '下单成功!'
182
+        }).then(() => {
183
+          // this.$router.push({name: 'majorProjects'})
184
+          window.history.go(-2)
185
+        })
186
+      })
187
+    },
188
+    ...mapProjectActions([
189
+      'getCourseDetailInfo',
190
+      'placeOrderForCourse',
191
+    ]),
192
+    returnCourseTime (val, endVal) { // 返回课时时间
193
+      val = new Date(val)
194
+      endVal = new Date(endVal)
195
+      return this.returnNum(val.getMonth() + 1) + '/' + this.returnNum(val.getDate()) + ' 周' + '日一二三四五六'.split('')[new Date(val).getDay()] + ' ' + this.returnNum(val.getHours()) + ':' + this.returnNum(val.getMinutes()) + '~' + this.returnNum(endVal.getHours()) + ':' + this.returnNum(endVal.getMinutes())
196
+    },
197
+    returnNum (val) {
198
+      return val > 9 ? val : '0' + val
199
+    },
200
+    returnDate (val) {
201
+      val = new Date(val)
202
+      return this.returnNum(val.getMonth() + 1) + '月' + this.returnNum(val.getDate()) + '日'
203
+    },
144
     onConfirm (value, index) {
204
     onConfirm (value, index) {
145
       this.postData.CouponId = value.id
205
       this.postData.CouponId = value.id
146
       this.postData.CouponName = value.value
206
       this.postData.CouponName = value.value

+ 1
- 1
src/module/user/placeOrderForCourse/page.scss 查看文件

70
             }
70
             }
71
           }
71
           }
72
           >*{
72
           >*{
73
-            line-height: .32rem;
73
+            line-height: .26rem;
74
             font-size: .13rem;
74
             font-size: .13rem;
75
             margin-left: .1rem;
75
             margin-left: .1rem;
76
           }
76
           }

+ 16
- 1
src/store/majorProjects/majorProjects.js 查看文件

17
     }
17
     }
18
   },
18
   },
19
   actions: {
19
   actions: {
20
+    placeOrderForCourse (context, { order, coupons = [] }) { // 课程下单
21
+      return new Promise((resolve, reject) => {
22
+        Ajax(api.majorProjects.placeCourseOrder.url, {
23
+          method: api.majorProjects.placeCourseOrder.method,
24
+          data: {
25
+            info: window.JSON.stringify(order),
26
+            coupons: window.JSON.stringify(coupons),
27
+          }
28
+        }).then(res => {
29
+          resolve(res)
30
+        }).catch((err) => {
31
+          reject(err)
32
+        })
33
+      })
34
+    },
20
     getProjectInfo (context, { id }) { // 获取课程列表
35
     getProjectInfo (context, { id }) { // 获取课程列表
21
       return new Promise((resolve) => {
36
       return new Promise((resolve) => {
22
         Ajax(api.majorProjects.getCourseList.url, {
37
         Ajax(api.majorProjects.getCourseList.url, {
32
         })
47
         })
33
       })
48
       })
34
     },
49
     },
35
-    getCourseDetailInfo (context, { id }) { // 获取课程列表
50
+    getCourseDetailInfo (context, { id }) { // 获取课程详情
36
       return new Promise((resolve) => {
51
       return new Promise((resolve) => {
37
         Ajax(api.majorProjects.getCourseDetail.url, {
52
         Ajax(api.majorProjects.getCourseDetail.url, {
38
           method: api.majorProjects.getCourseDetail.method,
53
           method: api.majorProjects.getCourseDetail.method,

+ 3
- 1
src/store/userCenter/userCenter.js 查看文件

66
 export default {
66
 export default {
67
   namespaced: true,
67
   namespaced: true,
68
   state: {
68
   state: {
69
-    userInfo: {},
69
+    userInfo: {
70
+      CustomerId: '1',
71
+    },
70
     caseInfo: {}
72
     caseInfo: {}
71
   },
73
   },
72
   mutations: {
74
   mutations: {

+ 3
- 2
src/util/ajax.js 查看文件

1
 import axios from 'axios'
1
 import axios from 'axios'
2
 import qs from 'qs'
2
 import qs from 'qs'
3
 import router from '../module/user/router'
3
 import router from '../module/user/router'
4
+import { Toast } from 'vant'
4
 
5
 
5
 const Axios = axios.create({
6
 const Axios = axios.create({
6
   timeout: 60000,
7
   timeout: 60000,
15
 
16
 
16
 Axios.interceptors.request.use((config) => {
17
 Axios.interceptors.request.use((config) => {
17
   // 处理请求data,若为get请求,拼到url后面,若为post请求,直接添加到body中
18
   // 处理请求data,若为get请求,拼到url后面,若为post请求,直接添加到body中
18
-  config.urlData = {...config.urlData, org: 1}
19
+  config.urlData = {...config.urlData, org: 'MQ'}
19
   let urlData = qs.stringify(config.urlData)
20
   let urlData = qs.stringify(config.urlData)
20
   let queryData = qs.stringify(config.queryData)
21
   let queryData = qs.stringify(config.queryData)
21
   // 判断是通过斜杠传参还是通过query传参
22
   // 判断是通过斜杠传参还是通过query传参
54
       } else if (code === 401) {
55
       } else if (code === 401) {
55
         // reject(code)
56
         // reject(code)
56
       } else {
57
       } else {
57
-        Message({
58
+        Toast({
58
           message: message,
59
           message: message,
59
           type: 'error'
60
           type: 'error'
60
         })
61
         })

+ 4
- 0
src/util/api.js 查看文件

35
       method: 'get',
35
       method: 'get',
36
       url: `${baseUrl}${guest}/course/:id`
36
       url: `${baseUrl}${guest}/course/:id`
37
     },
37
     },
38
+    placeCourseOrder: { // 课程下单
39
+      method: 'post',
40
+      url: `${baseUrl}${wechat}/order/course`
41
+    },
38
   },
42
   },
39
   user: {
43
   user: {
40
     info: { // 获取用户信息
44
     info: { // 获取用户信息