您现在的位置是:crmeb增加电子码发货方式(业务逻辑和后台页面)

crmeb增加电子码发货方式(业务逻辑和后台页面)

crmeb 日期:2020-07-22点击:216

电子卡发货.png


717-1.jpg


\app\admin\controller\order\StoreOrder.php

修改:function update_delivery($id = 0)


    /**
     * TODO 送货信息提交
     * @param Request $request
     * @param $id
     */
    public function update_delivery($id = 0)
    {
        $data = Util::postMore([
            ['type', 1],
            ['delivery_name', ''],
            ['delivery_id', ''],
            ['sh_delivery_name', ''],
            ['sh_delivery_id', ''],
            // yuli 20200717 增加兑换码发货方式
            ['card_delivery_name', ''],
            ['card_delivery_id', ''],
        ], $this->request);
        switch ((int)$data['type']) {
/**********  **********  **********  省略  **********  **********  **********/
            case 4:
                // yuli 20200717 增加兑换码发货方式
                // 兑换码
                $data['delivery_type'] = 'card';
                $data['delivery_name'] = $data['card_delivery_name'];
                $data['delivery_id'] = $data['card_delivery_id'];
                if (!$data['delivery_name']) return Json::fail('请选择供货商');
                if (!$data['delivery_id']) return Json::fail('请输入兑换码');
                $data['status'] = 1;
                StoreOrderModel::edit($data, $id);
                event('StoreProductOrderDeliveryGoodsAfter', [$data, $id]);
                StoreOrderStatus::setStatus($id, 'delivery_goods', '已发货 供货商:' . $data['delivery_name'] . ' 兑换码:' . $data['delivery_id']);
                break;
            default:
                return Json::fail('暂时不支持其他发货类型');
                break;
        }
        //短信发送
        event('ShortMssageSend', [StoreOrderModel::where('id', $id)->value('order_id'), 'Deliver']);
        return Json::successful('修改成功!');
    }


\app\admin\model\order\StoreOrder.php

修改:function orderPostageAfter($oid, $postageData = [])


    /**
     * 微信 订单发货
     * @param $oid
     * @param array $postageData
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function orderPostageAfter($oid, $postageData = [])
    {
/**********  **********  **********  省略  **********  **********  **********/
            // yuli 20200717 增加兑换码发货方式
            if ($order['is_channel'] == 1) {
                //小程序发货模版消息
                RoutineTemplate::sendOrderPostage($order, 1);
            } else {//公众号
                $openid = WechatUser::where('uid', $order['uid'])->value('openid');
                $group = array_merge($group, [
                    'first' => '供货商:'.$postageData['delivery_name'],
                    'keyword1' => $order['delivery_id'],
                ]);
                WechatTemplateService::sendTemplate($openid, WechatTemplateService::ORDER_CARD_SUCCESS, $group, $url);
            }
        }
    }


后台发货页面 \app\admin\view\order\store_order\order_goods.php

修改:

第一处


            <div class="layui-input-block">
                <input type="radio" name="type" value="1" lay-filter="type" title="发货" checked>
                <input type="radio" name="type" value="2" lay-filter="type" title="送货">
                <!-- yuli 20200717 增加兑换码发货方式 -->
                <input type="radio" name="type" value="4" lay-filter="type" title="电子券">
                <input type="radio" name="type" value="3" lay-filter="type" title="虚拟">
            </div>


第二处


        <!-- yuli 20200717 增加兑换码发货方式 -->
        <div class="type" data-type="4" style="display: none">
            <div class="layui-form-item">
                <label class="layui-form-label">供货商</label>
                <div class="layui-input-block">
                    <input type="text" name="card_delivery_name"   placeholder="请输入供货商" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">兑换码</label>
                <div class="layui-input-block">
                    <input type="text" name="card_delivery_id"   placeholder="请输入兑换码" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>


第三处


        // yuli yuli 20200717 增加兑换码发货方式
        if(data.type == '4'){
            if(!data.card_delivery_name) return layList.msg('请填写兑换码');
            if(!data.card_delivery_id) return layList.msg('请填写供货商');
        }



标签: PHP crmeb

站长简介

姓名:喻理
微信:yuli0927
邮箱:yuli0927@126.com
不懂业务的运维工程师不是一个好程序员。

分类

最新文章

热门文章

友情链接