赵启卫 2 gadi atpakaļ
vecāks
revīzija
9e631592e2

+ 52 - 1
application/admin/model/study/PlanBuy.php

xqd xqd
@@ -13,6 +13,9 @@ namespace app\admin\model\study;
 
 use traits\ModelTrait;
 use basic\ModelBasic;
+use app\wap\model\special\Special;
+use app\wap\model\special\SpecialBuy;
+use app\wap\model\topic\TestPaperObtain;
 
 /**
  * Class plan 讲师
@@ -20,5 +23,53 @@ use basic\ModelBasic;
  */
 class PlanBuy extends ModelBasic {
     use ModelTrait;
-   
+
+   /**检查专题是否获得
+     * @param $special_id
+     * @param $uid
+     * @return bool
+     * @throws \think\Exception
+     */
+    public static function PayPlan($id, $uid) {
+        //self::where(['uid' => $uid, 'planid' => $id, 'is_del' => 0])->update(['is_del' => 1]);
+        return self::where(['uid' => $uid, 'planid' => $id, 'is_del' => 0])->count() ? true : false;
+    }
+
+    /**获得专题
+     * @param $order_id
+     * @param $uid
+     * @param $plan_id
+     * @param int $type
+     * @return bool
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function setAllBuyPlan($order_id, $uid, $plan_id, $type = 0){
+        if (!$order_id || !$uid || !$plan_id) return false;
+        //如果是专栏,记录专栏下所有专题购买。
+        $plan = Plan::where(['id'=>$plan_id])->find();
+        $planItem = PlanItems::where('pid', $plan['id'])->select();
+        if ($planItem) {
+            foreach ($planItem as $k => $v) {
+                $task_special = Special::PreWhere()->where(['id'=>$v['cid']])->find();
+                if (!$task_special) continue;
+                if ($task_special['is_show'] != 1) continue;
+                SpecialBuy::setBuySpecial($order_id, $uid, $v['cid'], $type, $task_special['validity'], $plan_id);
+                TestPaperObtain::setTestPaper($order_id, $uid, $v['cid'], 2);
+            }
+        }
+        self::setBuyPlan($order_id, $uid, $plan_id, $type);
+    }
+
+    public static function setBuyPlan($order_id, $uid, $plan_id, $type){
+        $data = [
+            'orderid' => $order_id,
+            'uid' => $uid,
+            'planid' => $plan_id,
+            'type' => $type,
+            'add_time' => time(),
+        ];
+        self::set($data);
+    }
 }

+ 75 - 0
application/wap/controller/Studyplan.php

xqd xqd xqd
@@ -16,6 +16,7 @@ use app\admin\model\study\Plan;
 use app\admin\model\study\PlanSteps;
 use app\admin\model\study\PlanItems;
 use app\wap\model\special\Special as SpecialModel;
+use app\wap\model\store\StoreOrder;
 use service\JsonService;
 use think\Url;
 
@@ -42,6 +43,10 @@ class Studyplan extends AuthController{
             $orderList = count($orderList) > 0 ? $orderList->toArray() : [];
             return JsonService::successful($orderList);
         }
+        //微信支付
+        $user_level = !$this->uid ? 0 : $this->userInfo;
+        $this->assign('is_member', isset($user_level['level']) ? $user_level['level'] : 0);
+
         return $this->fetch();
     }
 
@@ -68,10 +73,80 @@ class Studyplan extends AuthController{
             $v['count'] = SpecialModel::numberChapters($v['type'], $v['id']);
             $itemsList[$v['stepsid']][] = $v->toArray();
         }
+
+        //微信支付相关代码
+        $user_level = !$this->uid ? 0 : $this->userInfo;
+        $this->assign('is_member', isset($user_level['level']) ? $user_level['level'] : 0);
+
+
         $this->assign('steps', json_encode($steps));
         $this->assign('itemsList', json_encode($itemsList));
         $this->assign('planinfo', json_encode($planinfo));
         
         return $this->fetch();
     }
+
+    /**
+     * 创建专题支付订单
+     * @param int $special_id 专题id
+     * @param int $pay_type 购买类型 1=礼物,2=普通购买,3=开团或者拼团
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function create_order($special_id, $pay_type_num, $payType, $pinkId = 0, $total_num = 1, $link_pay_uid = 0, $from = 'weixin')
+    {
+        if (!$special_id) return JsonService::fail('缺少购买参数');
+        if ($pay_type_num == -1) return JsonService::fail('选择购买方式');
+        
+        $Plan = Plan::where('is_del', 0)->where('is_show', 1)->find($special_id);
+        if (!$Plan) return JsonService::status('ORDER_ERROR', '购买的学习计划不存在');
+        $order = StoreOrder::createPlanOrder($Plan, $pinkId, $pay_type_num, $this->uid, $payType, $link_pay_uid, $total_num);
+        $orderId = $order['order_id'];
+        $info = compact('orderId');
+        if ($orderId) {
+            $orderInfo = StoreOrder::where('order_id', $orderId)->find();
+            if (!$orderInfo || !isset($orderInfo['paid'])) return JsonService::status('pay_error', '支付订单不存在!');
+            if ($orderInfo['paid']) return JsonService::status('pay_error', '支付已支付!');
+            if (bcsub((float)$orderInfo['pay_price'], 0, 2) <= 0) {
+                if (StoreOrder::jsPayPlanPrice($orderId, $this->uid))
+                    return JsonService::status('success', '支付成功', $info);
+                else
+                    return JsonService::status('pay_error', StoreOrder::getErrorInfo());
+            } else {
+                switch ($payType) {
+                    case 'weixin':
+                        try {
+                            if ($from == 'weixinh5') {
+                                $jsConfig = StoreOrder::h5PlanPay($orderId);
+                            } else {
+                                $jsConfig = StoreOrder::jsPlanPay($orderId);
+                            }
+                        } catch (\Exception $e) {
+                            return JsonService::status('pay_error', $e->getMessage(), $info);
+                        }
+                        $info['jsConfig'] = $jsConfig;
+                        if ($from == 'weixinh5') {
+                            return JsonService::status('wechat_h5_pay', '订单创建成功', $info);
+                        } else {
+                            return JsonService::status('wechat_pay', '订单创建成功', $info);
+                        }
+                        break;
+                    case 'yue':
+                        if (StoreOrder::yuePlanPay($orderId, $this->uid))
+                            return JsonService::status('success', '余额支付成功', $info);
+                        else
+                            return JsonService::status('pay_error', StoreOrder::getErrorInfo());
+                        break;
+                    case 'zhifubao':
+                        $info['pay_price'] = $orderInfo['pay_price'];
+                        $info['orderName'] = '购买学习计划';
+                        return JsonService::status('zhifubao_pay', '订单创建成功', base64_encode(json_encode($info)));
+                        break;
+                }
+            }
+        } else {
+            return JsonService::fail(StoreOrder::getErrorInfo('订单生成失败!'));
+        }
+    }
 }

+ 9 - 0
application/wap/model/merchant/MerchantFlowingWater.php

xqd
@@ -81,6 +81,15 @@ class MerchantFlowingWater extends ModelBasic
                 $title = '购买试卷';
                 $mark = $title . '支付' . floatval($data['pay_price']) . '元';
                 break;
+            case 6://学习计划订单
+                $divide = bcdiv($mer_divide['mer_test_divide'], 100, 2);//百分比
+                if ($divide <= 0) return true;
+                $data['total_price'] = $order['total_price'];
+                $data['pay_price'] = $order['pay_price'];
+                $data['price'] = bcmul($data['total_price'], $divide, 2);
+                $title = '购买学习计划';
+                $mark = $title . '支付' . floatval($data['pay_price']) . '元';
+                break;
         }
 
         Merchant::beginTrans();

+ 224 - 0
application/wap/model/store/StoreOrder.php

xqd xqd
@@ -36,6 +36,9 @@ use app\wap\model\topic\TestPaperObtain;
 use app\wap\model\material\DataDownloadBuy;
 use app\wap\model\merchant\MerchantFlowingWater;
 
+use app\admin\model\study\Plan;
+use app\admin\model\study\PlanBuy;
+
 
 /**订单表
  * Class StoreOrder
@@ -1482,4 +1485,225 @@ class StoreOrder extends ModelBasic
         $data['special_id'] = $data['special']['id'];
         return $data;
     }
+
+    /***学习计划支付相关代码********************************************************************/
+    /**
+     * 创建订单专题订单
+     * @param $special
+     * @param $pinkId
+     * @param $pay_type
+     * @param $uid
+     * @param $payType
+     * @param int $link_pay_uid
+     * @param int $total_num
+     * @return bool|object
+     */
+    public static function createPlanOrder($special, $pinkId, $pay_type, $uid, $payType, $link_pay_uid = 0, $total_num = 1){
+        if (!array_key_exists($payType, self::$payType)) return self::setErrorInfo('选择支付方式有误!');
+        $userInfo = User::getUserData($uid);
+        if (!$userInfo) return self::setErrorInfo('用户不存在!');
+        $total_price = 0;
+        $combination_id = 0;
+                //自己买
+        $total_price = $special->sales;
+        //会员暂时去掉
+        // if (isset($userInfo['level']) && $userInfo['level'] > 0 && $special->member_pay_type == 1 && $special->special > 0) {
+        //     $total_price = $special->member_money;
+        // }
+        
+        $res = PlanBuy::PayPlan($special->id, $uid);
+        if ($res) return self::setErrorInfo('您已获得该学习计划,无需再次购买!');
+        
+        $orderInfo = [
+            'uid' => $uid,
+            'mer_id' => 0,
+            'order_id' => self::getNewOrderId(),
+            'cart_id' => $special->id,
+            'total_num' => $total_num,
+            'total_price' => $total_price,
+            'pay_price' => $total_price,
+            'pay_type' => $payType,
+            'combination_id' => $combination_id,
+            'is_gift' => $pay_type == 1 ? 1 : 0,
+            'pink_time' => 0,
+            'paid' => 0,
+            'pink_id' => $pinkId,
+            'unique' => md5(time() . '' . $uid . $special->id),
+            'cost' => $total_price,
+            'link_pay_uid' => $userInfo['spread_uid'] ? 0 : $link_pay_uid,
+            'spread_uid' => $userInfo['spread_uid'] ? $userInfo['spread_uid'] : 0,
+            'is_del' => 0,
+        ];
+        $order = self::set($orderInfo);
+        if (!$order) return self::setErrorInfo('订单生成失败!');
+        StoreOrderStatus::status($order['id'], 'cache_key_create_order', '订单生成');
+        return $order;
+    }
+    /**
+     * 学习计划微信支付 为 0元时
+     * @param $order_id
+     * @param $uid
+     * @return bool
+     */
+    public static function jsPayPlanPrice($order_id, $uid)
+    {
+        $orderInfo = self::where('uid', $uid)->where('order_id', $order_id)->where('is_del', 0)->find();
+        if (!$orderInfo) return self::setErrorInfo('订单不存在!');
+        if ($orderInfo['paid']) return self::setErrorInfo('该订单已支付!');
+        $userInfo = User::getUserData($uid);
+        self::beginTrans();
+        $res1 = UserBill::expend('购买学习计划', $uid, 'now_money', 'pay_product', $orderInfo['pay_price'], $orderInfo['id'], $userInfo['now_money'], '支付' . floatval($orderInfo['pay_price']) . '元购买学习计划');
+        $res2 = self::payPlanSuccess($order_id);
+        $res = $res1 && $res2;
+        self::checkTrans($res);
+        return $res;
+    }
+
+    /**
+     * //TODO 支付成功后
+     * @param $orderId
+     * @param $notify
+     * @return bool
+     */
+    public static function payPlanSuccess($orderId)
+    {
+        $order = self::where('order_id', $orderId)->where('type', 0)->find();
+        if (!$order) return false;
+        $resPink = true;
+        $res2 = true;
+        $res3 = true;
+        User::bcInc($order['uid'], 'pay_count', 1, 'uid');
+        $res1 = self::where('order_id', $orderId)->where('type', 0)->update(['paid' => 1, 'pay_time' => time()]);
+        if ($res1 && $order['pay_type'] != 'yue') {
+            $res2 = UserBill::expend('购买学习计划', $order['uid'], $order['pay_type'], 'pay_product', $order['pay_price'], $order['id'], 0, '支付' . floatval($order['pay_price']) . '元购买学习计划');
+        }
+        if ($res1) {
+            $res3 = MerchantFlowingWater::setMerchantFlowingWater($order, 6);
+        }
+        if ($order['combination_id'] && $res1 && !$order['refund_status']) {
+            //$resPink = StorePink::createPink($order);//创建拼团
+        } else {
+            if (!$order['is_gift']) {
+                //如果是专栏,记录专栏下所有专题购买。
+                PlanBuy::setAllBuyplan($orderId, $order['uid'], $order['cart_id']);
+                
+                //DataDownloadBuy::setDataDownload($orderId, $order['uid'], $order['cart_id'], 0);
+                try {
+                    //专题返佣
+                    User::backOrderBrokerage($order);
+                } catch (\Throwable $e) {
+                }
+            }
+        }
+        StoreOrderStatus::status($order->id, 'pay_success', '用户付款成功');
+        $site_url = SystemConfigService::get('site_url');
+        try {
+            $wechat_notification_message = SystemConfigService::get('wechat_notification_message');
+            if ($wechat_notification_message == 1) {
+                WechatTemplateService::sendTemplate(WechatUser::where('uid', $order['uid'])->value('openid'), WechatTemplateService::ORDER_PAY_SUCCESS, [
+                    'first' => '亲,您购买的专题已支付成功',
+                    'keyword1' => $orderId,
+                    'keyword2' => $order['pay_price'],
+                    'remark' => '点击查看订单详情'
+                ], $site_url . Url::build('wap/studyplan/index'));
+                WechatTemplateService::sendAdminNoticeTemplate([
+                    'first' => "亲,您有一个新的课程订单",
+                    'keyword1' => $orderId,
+                    'keyword2' => $order['pay_price'],
+                    'remark' => '请及时查看'
+                ]);
+            } else {
+                $data['character_string1']['value'] = $orderId;
+                $data['amount3']['value'] = $order['pay_price'];
+                $data['time2']['value'] = date('Y-m-d H:i:s', time());
+                $data['thing6']['value'] = '您购买的专题已支付成功!';
+                RoutineTemplate::sendOrderSuccess($data, $order['uid'], $site_url . Url::build('wap/studyplan/index'));
+                $dataAdmin['character_string1']['value'] = $orderId;
+                $dataAdmin['amount3']['value'] = $order['pay_price'];
+                $dataAdmin['time2']['value'] = date('Y-m-d H:i:s', time());
+                $dataAdmin['thing6']['value'] = '您有一个新的课程订单!';
+                RoutineTemplate::sendAdminNoticeTemplate($dataAdmin);
+            }
+        } catch (\Throwable $e) {
+        }
+        $res = $res1 && $resPink && $res2 && $res3;
+        return false !== $res;
+    }
+
+    /**
+     * 学习计划微信h5支付
+     * @param $orderId
+     * @param string $field
+     * @return array|string
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function h5PlanPay($orderId, $field = 'order_id')
+    {
+        if (is_string($orderId))
+            $orderInfo = self::where($field, $orderId)->find();
+        else
+            $orderInfo = $orderId;
+        if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
+        if ($orderInfo['paid']) exception('支付已支付!');
+        if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
+        $site_name = SystemConfigService::get('site_name');
+        if (!$site_name) exception('支付参数缺少:请前往后台设置->系统设置-> 填写 网站名称');
+        return WechatService::paymentPrepare(null, $orderInfo['order_id'], $orderInfo['pay_price'], 'plan', self::getSubstrUTf8($site_name . '-专题购买', 30), '', 'MWEB');
+    }
+
+    /**学习计划微信支付
+     * @param $orderId
+     * @param string $field
+     * @return array|string
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function jsPlanPay($orderId, $field = 'order_id')
+    {
+        if (is_string($orderId))
+            $orderInfo = self::where($field, $orderId)->find();
+        else
+            $orderInfo = $orderId;
+        if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
+        if ($orderInfo['paid']) exception('支付已支付!');
+        if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
+        $site_name = SystemConfigService::get('site_name');
+        $openid = WechatUser::uidToOpenid($orderInfo['uid']);
+        return WechatService::jsPay($openid, $orderInfo['order_id'], $orderInfo['pay_price'], 'plan', self::getSubstrUTf8($site_name, 30));
+    }
+
+    /**专题余额支付
+     * @param $order_id
+     * @param $uid
+     * @return bool
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function yuePlanPay($order_id, $uid)
+    {
+        $orderInfo = self::where('uid', $uid)->where('order_id', $order_id)->where('is_del', 0)->find();
+        if (!$orderInfo) return self::setErrorInfo('订单不存在!');
+        if ($orderInfo['paid']) return self::setErrorInfo('该订单已支付!');
+        if ($orderInfo['pay_type'] != 'yue') return self::setErrorInfo('该订单不能使用余额支付!');
+        $userInfo = User::getUserData($uid);
+        if ($userInfo['now_money'] < $orderInfo['pay_price']) return self::setErrorInfo('余额不足' . floatval($orderInfo['pay_price']));
+        self::beginTrans();
+        $res1 = false !== User::bcDec($uid, 'now_money', $orderInfo['pay_price'], 'uid');
+        $res2 = UserBill::expend('购买学习计划', $uid, 'now_money', 'pay_product', $orderInfo['pay_price'], $orderInfo['id'], bcsub($userInfo['now_money'], $orderInfo['pay_price'], 2), '余额支付' . floatval($orderInfo['pay_price']) . '元购买专题');
+        $res3 = self::payPlanSuccess($order_id);
+        try {
+            HookService::listen('yue_pay_product', $userInfo, $orderInfo, false, PaymentBehavior::class);
+        } catch (\Exception $e) {
+            self::rollbackTrans();
+            return self::setErrorInfo($e->getMessage());
+        }
+        $res = $res1 && $res2 && $res3;
+        self::checkTrans($res);
+        return $res;
+    }
+
 }

+ 146 - 4
application/wap/view/first/studyplan/details.html

xqd xqd xqd
@@ -41,10 +41,34 @@
     .plan_header img{width: 100%; height: 4rem; }
     .plan_title{ font-size: 0.4rem;font-weight: bolder;}
     .content1{ margin: 0.2rem; background:#F5F5F5;}
+    .activity-list .empty{margin-top: 0.2rem; background: none;}
+    footer .video_footer_btn .on{
+        width: 100% !important;
+        border-radius: 37px !important;
+    }
+    .video_footer_btn_right {
+        width: 50%;
+        height: 100%;
+        border-radius: 0px 37px 37px 0px;
+        /* background: linear-gradient(90deg, rgba(64, 157, 255, 1) 0%, rgba(30, 133, 251, 1) 100%); */
+        background-color: #191C6E;
+    }
+    .video_footer_btn_left_pic {
+        font-size: 0.28rem;
+        line-height: .22rem;
+        color: #fff;
+        text-align: center;
+    }
+    .video_footer_btn {
+        -webkit-flex: 1;
+        flex: 1;
+        height: 0.76rem;
+        border-radius: 37px;
+    }
 </style>
 {/block}
 {block name="content"}
-<div v-cloak id="app">
+<div v-cloak id="app" class="thematic-details">
     <div class="plan_header">
         <div>
             <img :src="planinfo.plan_head">
@@ -97,22 +121,82 @@
             <div>暂无数据</div>
         </div>
     </div>
-    <quick-menu></quick-menu>
+    <footer class="acea-row row-middle" ref="storeMenu">
+        <!-- <a class="link" href="{:Url('wap/index/index')}">
+            <div class="cont">
+                <img src="{__WAP_PATH}zsff/images/special01.png">
+                <div>首页</div>
+            </div>
+        </a>
+        <a class="link" href="javascript:" @click="customerService">
+            <div class="cont">
+                <img src="{__WAP_PATH}zsff/images/special02.png">
+                <div>客服</div>
+            </div>
+        </a> -->
+        <div class="wrap">
+            <div class="video_footer_btn acea-row">
+                <div class="video_footer_btn_right acea-row on">
+                    <span @click="OpenPay()" class="acea-row row-center-wrapper video_footer_btn_left_pic" style="flex: 1;">购买学习</span>
+                </div>
+            </div>
+        </div>
+    </footer>
+    <!-- 支付弹窗 -->
+    <pay-dialog :open.sync="payDialogOpen" :money="money" :now_money="now_money" :special_id="planinfo.id" :link_pay_uid="link_pay_uid"
+                :pay_type_num="pay_type_num" :pink-id="pinkId" :is-wechat="isWechat" :is-alipay="is_alipay" :is-balance="is_yue"
+                :template-id="templateId" :wxpay-h5="wxpayH5" :is-member="isMember" @change="changeVal">
+    </pay-dialog>
+    <!-- 登录弹窗 -->
+    <base-login :login-show="loginShow" :site-name="site_name" @login-close="loginClose"></base-login>
 </div>
 {/block}
 {block name="foot"}
 <script>
-    require(['vue', 'store', 'helper', '{__WAP_PATH}zsff/js/quick.js'], function (Vue, store, $h) {
+    require(['vue', 'store', 'helper', '{__WAP_PATH}zsff/js/quick.js', 
+    'components/pay-dialog/index', 'components/base-login/index'], 
+    function (Vue, store, $h, quick, PayDialog, BaseLogin) {
         var planinfo = {$planinfo};
         var steps = {$steps};
         var itemsList = {$itemsList};
-        console.log(planinfo);
+        var isPay = 0;
+        var link_pay_uid = 0;//联合支付
+        var is_yue = {$is_yue? 'true': 'false'};
+        var is_alipay = {$is_alipay? 'true': 'false'};
+        var isWechat = {$isWechat? 'true': 'false'};
+        var isPay = {$isPay? 'true': 'false'};
+        var wxpayH5 = {$is_h5_wechat_payment_switch? 'true': 'false'};
+        var now_money = {$now_money};
+        var isMember = {$is_member};
+        // 站点名称
+        var site_name = '{$Auth_site_name}';
         var app = new Vue({
             el: '#app',
+            components: {
+                'base-login': BaseLogin,
+                'pay-dialog': PayDialog,
+            },
             data: {
                 planinfo:planinfo,
                 steps:steps,
                 itemsList: itemsList,
+                //支付登录相关
+                payDialogOpen: false,
+                loginShow: false,
+                is_pay: isPay,
+                money:planinfo.sales,
+                link_pay_uid:link_pay_uid,
+                pay_type_num: 7, //新增的 学习计划支付类型
+                pinkId: 0,
+                isWechat: isWechat,
+                is_pay: isPay,
+                is_alipay: is_alipay, //支付宝是否开启
+                is_yue: is_yue, //余额是否开启
+                now_money: now_money, //余额
+                templateId: '',
+                wxpayH5:wxpayH5,
+                isMember:isMember,
+                site_name:site_name,
             },
             mounted: function () {
                 this.$nextTick(function () {
@@ -129,6 +213,64 @@
                 study: function (){
                     alert('去学习');
                 },
+                //关闭登录
+                loginClose: function (val) {
+                    this.loginShow = false;
+                    val && this.logComplete();
+                },
+                // 点击客服
+                customerService: function () {
+                    store.baseGet($h.U({
+                        c: 'public_api',
+                        a: 'public_data'
+                    }), function (res) {
+                        var data = res.data.data;
+                        if (data.customer_service === '3') {
+                            if (data.site_service_phone) {
+                                layer.confirm('是否拨打 <a href="tel:' + data.site_service_phone + '">' + data.site_service_phone + '</a> 进行咨询?', {
+                                    title: false,
+                                    closeBtn: false,
+                                    btn: ['拨打', '取消']
+                                }, function (index) {
+                                    window.location.assign('tel:' + data.site_service_phone);
+                                    layer.close(index);
+                                });
+                            } else {
+                                layer.msg('抱歉,无法联系客服');
+                            }
+                        } else {
+                            window.location.assign($h.U({
+                                c: 'service',
+                                a: 'service_list'
+                            }));
+                        }
+                    });
+                },
+                //所有插件回调处理事件
+                changeVal: function (opt) {
+                    if (typeof opt != 'object') opt = {};
+                    var action = opt.action || '';
+                    var value = opt.value || '';
+                    this[action] && this[action](value);
+                },
+                //打开支付插件,并检测登录状态,没有登录,打开登录插件
+                OpenPay: function () {
+                    var vm = this;
+                    store.baseGet($h.U({c: 'index', a: 'user_login'}), function (res) {
+                        this.money = this.money;
+                        this.payDialogOpen = true;
+                        // var opt = {
+                        //     c: 'studyplan',
+                        //     a: 'details',
+                        //     q: {
+                        //         id: this.planinfo.id
+                        //     }
+                        // };
+                        // window.location.assign($h.U(opt));
+                    }.bind(this), function () {
+                        vm.loginShow = true;
+                    });
+                },
             }
         });
     });

+ 4 - 2
public/wap/first/zsff/components/pay-dialog/index.js

xqd xqd
@@ -115,6 +115,7 @@ define([
             if (find) {
                 this.payChecked = find.value;
             }
+            
             if (this.isWechat) {
                 // 无法使用微信开放标签触发WeixinOpenTagsError事件
                 document.addEventListener('WeixinOpenTagsError', function () {
@@ -150,9 +151,10 @@ define([
                 if (this.pay_type_num === 40) {
                     backUrlCRshlcICwGdGY.useGold = this.useGold;
                 }
-
                 // 创建订单
-                axios.post('/wap/special/create_order', backUrlCRshlcICwGdGY).then(function (res) {
+                let url = '/wap/special/create_order';
+                if (this.pay_type_num == 7) url = '/wap/studyplan/create_order';
+                axios.post(url, backUrlCRshlcICwGdGY).then(function (res) {
                     if (res.data.code === 200) {
                         this.$emit('change', {
                             action: 'pay_order',