yangming 5 лет назад
Родитель
Сommit
4dc0bb11a0

+ 9 - 4
mallApp/package-lock.json

@@ -5161,7 +5161,8 @@
         "ansi-regex": {
           "version": "2.1.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "aproba": {
           "version": "1.2.0",
@@ -5585,7 +5586,8 @@
         "safe-buffer": {
           "version": "5.1.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "safer-buffer": {
           "version": "2.1.2",
@@ -5641,6 +5643,7 @@
           "version": "3.0.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "ansi-regex": "^2.0.0"
           }
@@ -5684,12 +5687,14 @@
         "wrappy": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "yallist": {
           "version": "3.1.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         }
       }
     },

+ 16 - 2
mallApp/src/api/px-class/index.js

@@ -1,7 +1,21 @@
 import https from '@/plugins/luch-request_0.0.7/request'
 /** *
- * 门店列表 b
+ * 培训班列表 开单列表 b  px-apply/add
  */
 export const pxClassList = data => {
-	return https.get('/px-class/list', data)
+    return https.get('/px-class/list', data)
+}
+
+/** *
+ * 新增培训班报名(下单) b  px-apply/wx-pay
+ */
+export const pxApplyAdd = data => {
+    return https.get('/px-apply/add', data)
+}
+
+/** *
+ * 课程下单微信支付 b  
+ */
+export const pxApplyWxPay = data => {
+    return https.get('/px-apply/wx-pay', data)
 }

+ 223 - 231
mallApp/src/pages.json

@@ -1,233 +1,225 @@
 {
-	"pages": [
-		{
-			"path": "pages/home/recent",
-			"style": {
-				"navigationBarTitleText": "最近访问"
-			}
-		},
-		{
-			"path": "pages/home/index",
-			"style": {
-				"navigationBarTitleText": ""
-			}
-		},
-		{
-			"path": "pages/home/category",
-			"style": {
-				"navigationBarTitleText": "分类"
-			}
-		},
-		{
-			"path": "pages/home/shop",
-			"style": {
-				"navigationBarTitleText": "门店"
-			}
-		},
-		{
-			"path": "pages/home/user",
-			"style": {
-				"navigationBarTitleText": "我的"
-			}
-		},
-    {
-			"path": "pages/home/course",
-			"style": {
-				"navigationBarTitleText": "课程"
-			}
-		},
-		{
-			"path": "common/redirect",
-			"style": {
-				"navigationBarTitleText": "加载中..."
-			}
-		},
-		{
-			"path": "common/webview",
-			"style": {
-				"navigationBarBackgroundColor": "#ffffff",
-				"navigationBarTextStyle": "black"
-			}
-		},
-    {
-			"path": "pages/class/index",
-			"style": {
-				"navigationBarBackgroundColor": "#ffffff",
-				"navigationBarTextStyle": "black"
-			}
-		}
-	],
-	"subPackages": [
-		{
-			"root": "pages/user",
-			"pages": [
-				{
-					"path": "register",
-					"style": {
-						"navigationBarTitleText": "注册"
-					}
-				},
-				{
-					"path": "password",
-					"style": {
-						"navigationBarTitleText": "修改密码"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/goods",
-			"pages": [
-				{
-					"path": "detail",
-					"style": {
-						"navigationBarTitleText": "详情"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/pay",
-			"pages": [
-				{
-					"path": "index",
-					"style": {
-						"navigationBarTitleText": ""
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/callback",
-			"pages": [
-				{
-					"path": "index"
-				},
-				{
-					"path": "success",
-					"style": {
-						"navigationBarTitleText": "支付成功"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/coupon",
-			"pages": [
-				{
-					"path": "list",
-					"style": {
-						"navigationBarTitleText": "优惠券",
-						"enablePullDownRefresh": true
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/order",
-			"pages": [
-				{
-					"path": "list",
-					"style": {
-						"navigationBarTitleText": "订单列表",
-						"enablePullDownRefresh": true
-					}
-				},
-				{
-					"path": "detail",
-					"style": {
-						"navigationBarTitleText": "订单列表"
-					}
-				},
-				{
-					"path": "buy",
-					"style": {
-						"navigationBarTitleText": "订单确认"
-					}
-				},
-				{
-					"path": "comment",
-					"style": {
-						"navigationBarTitleText": "评价"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/interest",
-			"pages": [
-				{
-					"path": "invite",
-					"style": {
-						"navigationBarTitleText": "邀请排行",
-						"enablePullDownRefresh": true
-					}
-				},
-				{
-					"path": "level",
-					"style": {
-						"navigationBarTitleText": "会员等级"
-					}
-				}
-			]
-		},
-		{
-			"root": "pages/chat",
-			"pages": [
-				{
-					"path": "index",
-					"style": {
-						"navigationBarTitleText": "客服",
-						"enablePullDownRefresh": true
-					}
-				}
-			]
-		}
-	],
-	"globalStyle": {
-		// #ifdef H5
-		"navigationStyle": "custom",
-		// #endif
-		"navigationBarBackgroundColor": "#fff",
-		"navigationBarTitleText": "花卉宝",
-		"navigationBarTextStyle": "black"
-	},
-	"tabBar": {
-		"color": "#C0C4CC",
-		"selectedColor": "#fa436a",
-		"borderStyle": "black",
-		"backgroundColor": "#ffffff",
-		"list": [
-			{
-				"pagePath": "pages/home/index",
-				"iconPath": "static/images/common/home-no.png",
-				"selectedIconPath": "static/images/common/home-is.png",
-				"text": "首页"
-			},
-			{
-				"pagePath": "pages/home/category",
-				"iconPath": "static/images/common/category-no.png",
-				"selectedIconPath": "static/images/common/category-is.png",
-				"text": "分类"
-			},
-      {
-        "pagePath": "pages/home/course",
-        "iconPath": "static/images/common/icon_class.png",
-        "selectedIconPath": "static/images/common/icon_class_active.png",
-        "text": "课程"
-      },
-			{
-				"pagePath": "pages/home/shop",
-				"iconPath": "static/images/common/shop-no.png",
-				"selectedIconPath": "static/images/common/shop-is.png",
-				"text": "门店"
-			},
-			{
-				"pagePath": "pages/home/user",
-				"iconPath": "static/images/common/user-no.png",
-				"selectedIconPath": "static/images/common/user-is.png",
-				"text": "我的"
-			}
-		]
-	}
+    "pages": [{
+            "path": "pages/home/recent",
+            "style": {
+                "navigationBarTitleText": "最近访问"
+            }
+        },
+        {
+            "path": "pages/home/index",
+            "style": {
+                "navigationBarTitleText": ""
+            }
+        },
+        {
+            "path": "pages/home/category",
+            "style": {
+                "navigationBarTitleText": "分类"
+            }
+        },
+        {
+            "path": "pages/home/shop",
+            "style": {
+                "navigationBarTitleText": "门店"
+            }
+        },
+        {
+            "path": "pages/home/user",
+            "style": {
+                "navigationBarTitleText": "我的"
+            }
+        },
+        {
+            "path": "pages/home/course",
+            "style": {
+                "navigationBarTitleText": "课程"
+            }
+        },
+        {
+            "path": "common/redirect",
+            "style": {
+                "navigationBarTitleText": "加载中..."
+            }
+        },
+        {
+            "path": "common/webview",
+            "style": {
+                "navigationBarBackgroundColor": "#ffffff",
+                "navigationBarTextStyle": "black"
+            }
+        },
+        {
+            "path": "pages/class/index",
+            "style": {
+                "navigationBarBackgroundColor": "#ffffff",
+                "navigationBarTextStyle": "black"
+            }
+        },
+        {
+            "path": "pages/class/paySuccess",
+            "style": {
+                "navigationBarBackgroundColor": "#ffffff",
+                "navigationBarTextStyle": "black"
+            }
+        }
+    ],
+    "subPackages": [{
+            "root": "pages/user",
+            "pages": [{
+                    "path": "register",
+                    "style": {
+                        "navigationBarTitleText": "注册"
+                    }
+                },
+                {
+                    "path": "password",
+                    "style": {
+                        "navigationBarTitleText": "修改密码"
+                    }
+                }
+            ]
+        },
+        {
+            "root": "pages/goods",
+            "pages": [{
+                "path": "detail",
+                "style": {
+                    "navigationBarTitleText": "详情"
+                }
+            }]
+        },
+        {
+            "root": "pages/pay",
+            "pages": [{
+                "path": "index",
+                "style": {
+                    "navigationBarTitleText": ""
+                }
+            }]
+        },
+        {
+            "root": "pages/callback",
+            "pages": [{
+                    "path": "index"
+                },
+                {
+                    "path": "success",
+                    "style": {
+                        "navigationBarTitleText": "支付成功"
+                    }
+                }
+            ]
+        },
+        {
+            "root": "pages/coupon",
+            "pages": [{
+                "path": "list",
+                "style": {
+                    "navigationBarTitleText": "优惠券",
+                    "enablePullDownRefresh": true
+                }
+            }]
+        },
+        {
+            "root": "pages/order",
+            "pages": [{
+                    "path": "list",
+                    "style": {
+                        "navigationBarTitleText": "订单列表",
+                        "enablePullDownRefresh": true
+                    }
+                },
+                {
+                    "path": "detail",
+                    "style": {
+                        "navigationBarTitleText": "订单列表"
+                    }
+                },
+                {
+                    "path": "buy",
+                    "style": {
+                        "navigationBarTitleText": "订单确认"
+                    }
+                },
+                {
+                    "path": "comment",
+                    "style": {
+                        "navigationBarTitleText": "评价"
+                    }
+                }
+            ]
+        },
+        {
+            "root": "pages/interest",
+            "pages": [{
+                    "path": "invite",
+                    "style": {
+                        "navigationBarTitleText": "邀请排行",
+                        "enablePullDownRefresh": true
+                    }
+                },
+                {
+                    "path": "level",
+                    "style": {
+                        "navigationBarTitleText": "会员等级"
+                    }
+                }
+            ]
+        },
+        {
+            "root": "pages/chat",
+            "pages": [{
+                "path": "index",
+                "style": {
+                    "navigationBarTitleText": "客服",
+                    "enablePullDownRefresh": true
+                }
+            }]
+        }
+    ],
+    "globalStyle": {
+        // #ifdef H5
+        "navigationStyle": "custom",
+        // #endif
+        "navigationBarBackgroundColor": "#fff",
+        "navigationBarTitleText": "花卉宝",
+        "navigationBarTextStyle": "black"
+    },
+    "tabBar": {
+        "color": "#C0C4CC",
+        "selectedColor": "#fa436a",
+        "borderStyle": "black",
+        "backgroundColor": "#ffffff",
+        "list": [{
+                "pagePath": "pages/home/index",
+                "iconPath": "static/images/common/home-no.png",
+                "selectedIconPath": "static/images/common/home-is.png",
+                "text": "首页"
+            },
+            {
+                "pagePath": "pages/home/category",
+                "iconPath": "static/images/common/category-no.png",
+                "selectedIconPath": "static/images/common/category-is.png",
+                "text": "分类"
+            },
+            {
+                "pagePath": "pages/home/course",
+                "iconPath": "static/images/common/icon_class.png",
+                "selectedIconPath": "static/images/common/icon_class_active.png",
+                "text": "课程"
+            },
+            {
+                "pagePath": "pages/home/shop",
+                "iconPath": "static/images/common/shop-no.png",
+                "selectedIconPath": "static/images/common/shop-is.png",
+                "text": "门店"
+            },
+            {
+                "pagePath": "pages/home/user",
+                "iconPath": "static/images/common/user-no.png",
+                "selectedIconPath": "static/images/common/user-is.png",
+                "text": "我的"
+            }
+        ]
+    }
 }

+ 70 - 10
mallApp/src/pages/class/index.vue

@@ -13,17 +13,17 @@
     <view class="class_fill">
       <view class="fill_name">
         <text class="nickname">昵称</text>
-        <input type="text" class="inputText" placeholder="请填写昵称" placeholder-style="font-size: 28upx; color: #999;">
-        <view class="generate_btn">点击生成</view>
+        <input type="text" class="inputText" v-model="dataList.form.nickname" placeholder="请填写昵称" placeholder-style="font-size: 28upx; color: #999;">
+        <button class="generate_btn">点击生成</button>
       </view>
       <view class="fill_name">
         <text class="nickname">手机号</text>
-        <input type="text" class="inputText" placeholder="请填写手机号" placeholder-style="font-size: 28upx; color: #999;">
-        <view class="generate_btn">点击生成</view>
+        <input type="text" class="inputText" v-model="dataList.form.mobile"  placeholder="请填写手机号" placeholder-style="font-size: 28upx; color: #999;">
+        <button class="generate_btn" open-type="getPhoneNumber"  @getphonenumber="getWxMobile">点击生成</button>
       </view>
       <view class="fill_name">
         <text class="nickname">姓名</text>
-        <input type="text" class="inputLast" placeholder="请填写姓名" placeholder-style="font-size: 28upx; color: #999;">
+        <input type="text" class="inputLast" v-model="dataList.form.name" placeholder="请填写姓名" placeholder-style="font-size: 28upx; color: #999;">
       </view>
     </view>
     <view class="footer_bar">
@@ -33,28 +33,83 @@
           <text style="font-size: 40upx;padding-left: 10upx;">6800.00</text>
         </text>
       </text>
-      <view class="confirm_btn">确认</view>
+      <view class="confirm_btn" @click="confirm">确认</view>
     </view>
   </view>
 </template>
 
 <script>
+import { pxApplyAdd, pxApplyWxPay } from '@/api/px-class/index'
+import weixinPay from '@/utils/pay/wxPay'
+import { getWxPhone } from "@/api/mini";
 export default{
   data() {
     return {
       dataList: {
         form: {
           classId: '',
-          customId: '',
           name: '',
           mobile: '',
-          payWay: ''
+          nickname: ''
         }
-      }
+      },
+      orderSn: ''
     }
   },
   onLoad(option) {
-    this.dataList.form.classId = option.classId
+    this.dataList.form.classId = option.id
+  },
+  methods: {
+    confirm(){
+      if(this.dataList.form.nickname === ''){
+        this.$msg('请输入昵称')
+        return false
+      }
+      if(this.dataList.form.mobile === ''){
+        this.$msg('手机号不能为空')
+        return false
+      }
+       if (!/^1[34578]\d{9}$/.test(this.dataList.form.mobile)){
+           this.$msg('请输入正确的手机号')
+           return false
+       }
+         if(this.dataList.form.name === ''){
+        this.$msg('请输入姓名')
+        return false
+      }
+      pxApplyAdd(this.dataList.form).then(res=>{
+        pxApplyWxPay({orderSn: res.data.orderSn}).then(res =>{
+          console.log(res)
+          weixinPay(res.data)
+        }).catch(err => {})
+        console.log(this.dataList.form.classId, 'classId')
+        console.log(res, 'res', pxApplyWxPay)
+      }).catch(err => {})
+      
+    },
+    successFn() {
+      uni.navigateTo({
+        url: '/pages/class/paySuccess'
+      })
+    },
+     // 获取微信手机号
+    getWxMobile(e) {
+      console.log(e);
+      if (e.detail.errMsg === "getPhoneNumber:ok") {
+        getWxPhone({
+          iv: e.detail.iv,
+          encryptedData: e.detail.encryptedData
+        }).then(res => {
+          console.log("用户信息", res);
+          uni.showToast({
+            icon: "success"
+          });
+          this.dataList.form.mobile = res.data.mobile;
+        });
+      } else {
+        this.$msg("获取信息失败!");
+      }
+    }
   }
 }
 </script>
@@ -109,19 +164,24 @@ export default{
       }
       &>.inputText{
         width: calc(100% - 300upx);
+        padding: 10upx;
       }
       &>.inputLast{
         width: calc(100% - 150upx);
+        padding: 10upx;
       }
       &>.generate_btn{
         width: 140px;
         height: 50px;
         line-height: 50upx;
+        font-size: 20upx;
         text-align: center;
         background: #3385FF;
         border: 1px solid #3385FF;
+        padding: 0;
         border-radius: 8px;
         color: #fff;
+        border: none;
       }
     }
   }

+ 73 - 0
mallApp/src/pages/class/paySuccess.vue

@@ -0,0 +1,73 @@
+<template>
+  <view class="app-content">
+    <view class="billing_box_bg">
+      <view class="top-view"> </view>
+      <view class="result-view">
+        <view :class="['iconfont', 'iconchenggong']"></view>
+        <view class="result-title">支付成功</view>
+        <view
+          class="close_btn"
+          @click="goClose"
+        >关闭</view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  name: "AppResult",
+  methods: {
+    goClose () {
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.billing_box_bg {
+  position: relative;
+  padding: 60px 30px;
+  display: flex;
+  flex-direction: column;
+  background-color: #f5f5f5;
+  .top-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 299px;
+    background: #3385ff;
+    border-radius: 0px 0px 83px 83px;
+  }
+  .result-view {
+    position: relative;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    padding: 70px;
+    width: 100%;
+    background: #ffffff;
+    border-radius: 20px;
+    z-index: 1;
+    .iconchenggong {
+      font-size: 170px;
+      color: $mainColor1;
+    }
+    .result-title {
+      margin: 50px 0 70px;
+      font-size: 32px;
+    }
+    .close_btn {
+      line-height: 88upx;
+      text-align: center;
+      width: 550upx;
+      height: 88upx;
+      border: 1px solid #dddddd;
+      border-radius: 8px;
+      font-size: 32upx;
+      color: #666;
+    }
+  }
+}
+</style>

+ 1 - 1
mallApp/src/pages/home/recent.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="latest-content_box">
-    <view class="shop-list_box" v-if="!show">
+    <view class="shop-list_box" v-if="show">
       <template v-if="!$util.isEmpty(list)">
         <view
           :key="item.shopId"