hrjy 2 anni fa
parent
commit
86f9d4cb7d

+ 181 - 0
app/admin/controller/user/Out.php

@@ -0,0 +1,181 @@
+<?php
+namespace app\admin\controller\user;
+
+use app\admin\controller\AuthController;
+use app\admin\controller\Union;
+use app\admin\model\User;
+use crmeb\services\{ExpressService,
+    FormBuilder,
+    JsonService,
+    MiniProgramService,
+    upload\Upload,
+    WechatService,
+    FormBuilder as Form,
+    CacheService,
+    UtilService as Util,
+    JsonService as Json};
+use app\admin\model\system\{SystemAdmin,
+    SystemAttachment as SystemAttachmentModel,
+    SystemAttachmentCategory as Category};
+use think\Db;
+use think\facade\Route as Url;
+use think\facade\Validate;
+use app\admin\model\user\Out as model;
+
+class Out extends AuthController
+{
+
+
+    public function index()
+    {
+
+        $this->assign('admin', $this->adminInfo);
+        return $this->fetch();
+    }
+
+
+    public function list()
+    {
+        $where = Util::getMore([
+            ['status', ''],
+            ['page', 1],
+            ['limit', 20],
+            ['auction'],
+            ['uid'],
+            ['null']
+        ]);
+
+        $data = model::list($where);
+        return Json::successlayui($data);
+    }
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function create($id = 0)
+    {
+        $f = [];
+        $f[] = Form::input('name', '名称')->col(12);
+        $f[] = Form::textarea('info', '简介');
+        $f[] = Form::number('number', '达标额度')->col(12);
+        $f[] = Form::radio('status', '状态', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
+        $form = Form::make_post_form('添加', $f, Url::buildUrl('save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+
+    public function save()
+    {
+        $mode  = new model;
+        $data = Util::postMore([
+            'name',
+            'info',
+            'number',
+            'status',
+        ]);
+        $validate = Validate::rule('name', 'require')->rule([
+            'name' => 'require',
+            'number' => 'require',
+        ]);
+        $validate->message([
+            'name.require' => '名称不能为空',
+            'number.require' => '达标额度不能为空',
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $res = $mode->save($data);
+        if ($res){
+            return Json::success('添加成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+
+    }
+
+    /**
+     * 删除
+     * @param $id
+     * @return void
+     * @throws \Exception
+     */
+    public function delete($id)
+    {
+        if (!$id) Json::fail('删除失败');
+        $model = new model;
+
+        $res = $model->where('id', $id)->delete();
+        if ($res){
+            return Json::success('删除成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+
+    }
+
+
+    public function set_status($id, $status)
+    {
+
+        if (empty($id))return Json::fail('修改失败');
+
+        $res = model::update(['status' => $status, 'id' => $id]);
+        if ($res){
+            return Json::success('修改成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+    }
+
+    public function edit($id)
+    {
+        if (!$id) Json::fail('数据不存在');
+        $data = model::find($id);
+        $f = [];
+        $f[] = Form::input('name', '名称',$data->getData('name'))->col(12);
+        $f[] = Form::textarea('info', '介绍',$data->getData('info'));
+        $f[] = Form::number('number', '达标额度', $data->getData('number'))->col(12);
+        $f[] = Form::radio('status', '状态', $data->getData('status'))->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
+
+
+        $form = Form::make_post_form('修改', $f, Url::buildUrl('update', compact('id')));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+    public function update()
+    {
+        $data = Util::postMore([
+            'id',
+            'name',
+            'info',
+            'status',
+            'number',
+        ]);
+
+        $validate = Validate::rule('name', 'require')->rule([
+            'name' => 'require',
+            'number' => 'require',
+        ]);
+        $validate->message([
+            'name.require' => '名称不能为空',
+            'number.require' => '达标数量不能为空',
+
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $res = model::update($data);
+        if ($res){
+            return Json::success('修改成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+
+
+    }
+
+}

+ 177 - 0
app/admin/controller/user/UserPartake.php

@@ -0,0 +1,177 @@
+<?php
+namespace app\admin\controller\user;
+
+use app\admin\controller\AuthController;
+use app\admin\controller\Union;
+use app\admin\model\User;
+use crmeb\services\{ExpressService,
+    FormBuilder,
+    JsonService,
+    MiniProgramService,
+    upload\Upload,
+    WechatService,
+    FormBuilder as Form,
+    CacheService,
+    UtilService as Util,
+    JsonService as Json};
+use app\admin\model\system\{SystemAdmin,
+    SystemAttachment as SystemAttachmentModel,
+    SystemAttachmentCategory as Category};
+use think\Db;
+use think\facade\Route as Url;
+use think\facade\Validate;
+use app\admin\model\user\UserPartake as model;
+
+class UserPartake extends AuthController
+{
+    public function index()
+    {
+
+        $this->assign('admin', $this->adminInfo);
+        return $this->fetch();
+    }
+
+
+    public function list()
+    {
+        $where = Util::getMore([
+            ['status', ''],
+            ['page', 1],
+            ['limit', 20],
+            ['name'],
+        ]);
+
+        $data = model::list($where);
+        return Json::successlayui($data);
+    }
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function create($id = 0)
+    {
+        $f = [];
+        $f[] = Form::input('name', '名称')->col(12);
+        $f[] = Form::textarea('info', '简介');
+        $f[] = Form::number('number', '达标额度')->col(12);
+        $f[] = Form::radio('status', '状态', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
+        $form = Form::make_post_form('添加', $f, Url::buildUrl('save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+
+    public function save()
+    {
+        $mode  = new model;
+        $data = Util::postMore([
+            'name',
+            'info',
+            'number',
+            'status',
+        ]);
+        $validate = Validate::rule('name', 'require')->rule([
+            'name' => 'require',
+            'number' => 'require',
+        ]);
+        $validate->message([
+            'name.require' => '名称不能为空',
+            'number.require' => '达标额度不能为空',
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $res = $mode->save($data);
+        if ($res){
+            return Json::success('添加成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+
+    }
+
+    /**
+     * 删除
+     * @param $id
+     * @return void
+     * @throws \Exception
+     */
+    public function delete($id)
+    {
+        if (!$id) Json::fail('删除失败');
+        $model = new model;
+
+        $res = $model->where('id', $id)->delete();
+        if ($res){
+            return Json::success('删除成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+
+    }
+
+
+    public function set_status($id, $status)
+    {
+
+        if (empty($id))return Json::fail('修改失败');
+
+        $res = model::update(['status' => $status, 'id' => $id]);
+        if ($res){
+            return Json::success('修改成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+    }
+
+    public function edit($id)
+    {
+        if (!$id) Json::fail('数据不存在');
+        $data = model::find($id);
+        $f = [];
+        $f[] = Form::input('name', '名称',$data->getData('name'))->col(12);
+        $f[] = Form::textarea('info', '介绍',$data->getData('info'));
+        $f[] = Form::number('number', '达标额度', $data->getData('number'))->col(12);
+        $f[] = Form::radio('status', '状态', $data->getData('status'))->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
+
+
+        $form = Form::make_post_form('修改', $f, Url::buildUrl('update', compact('id')));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+    public function update()
+    {
+        $data = Util::postMore([
+            'id',
+            'name',
+            'info',
+            'status',
+            'number',
+        ]);
+
+        $validate = Validate::rule('name', 'require')->rule([
+            'name' => 'require',
+            'number' => 'require',
+        ]);
+        $validate->message([
+            'name.require' => '名称不能为空',
+            'number.require' => '达标数量不能为空',
+
+        ]);
+        if (!$validate->check($data)) {
+            return Json::fail($validate->getError());
+        }
+        $res = model::update($data);
+        if ($res){
+            return Json::success('修改成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+
+
+    }
+
+}

+ 55 - 0
app/admin/model/user/Out.php

@@ -0,0 +1,55 @@
+<?php
+
+namespace app\admin\model\user;
+
+use app\models\store\StoreProduct;
+use crmeb\services\SystemConfigService;
+use think\facade\Db;
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+
+/**
+ * TODO 场馆model
+ * Class Article
+ * @package app\models\article
+ */
+class Out extends BaseModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 模型名称
+     * @var string
+     */
+    protected $name = 'out';
+    protected $autoWriteTimestamp = true;
+
+    use ModelTrait;
+
+    public static function list($where)
+    {
+        $model = self::alias('a')
+            ->field('*')
+            ->order('id DESC');
+
+        $data['count'] = $model->count();
+        if ($where['page'] && $where['limit']){
+            $model->page($where['page'], $where['limit']);
+        }else{
+            $model->page(20, 1);
+        }
+
+
+        $list = $model->select();
+        $list = count($list) ? $list->toArray() : [];
+
+        $data['data'] = $list;
+        return $data;
+
+    }
+
+}

+ 77 - 0
app/admin/model/user/UserPartake.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace app\admin\model\user;
+
+use app\admin\model\order\StoreOrder;
+use app\models\store\StoreProduct;
+use crmeb\services\SystemConfigService;
+use think\facade\Db;
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+
+/**
+ * TODO 场馆model
+ * Class Article
+ * @package app\models\article
+ */
+class UserPartake extends BaseModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 模型名称
+     * @var string
+     */
+    protected $name = 'user_partake';
+    protected $autoWriteTimestamp = true;
+
+    use ModelTrait;
+
+    public static function list($where)
+    {
+        $model = self::alias('a')
+            ->field('a.*,b.nickname,c.name')
+            ->order('a.id DESC')
+            ->leftJoin('user b', 'b.uid = a.uid')
+            ->leftJoin('out c', 'c.id = a.out_id');
+
+        if ($where['name']) $model->where('b.nickname|a.uid', 'like', '%'.$where['name'].'%');
+        if ($where['status'] == 1){
+            $model->where('a.status', 0);
+        }
+        if ($where['status'] == 2){
+            $model->where('a.status', 1);
+        }
+        if ($where['status'] == 3){
+            $model->where('a.status', 2);
+        }
+        if ($where['status'] == 4){
+            $model->where('a.status', -1);
+        }
+
+        $data['count'] = $model->count();
+        if ($where['page'] && $where['limit']){
+            $model->page($where['page'], $where['limit']);
+        }else{
+            $model->page(20, 1);
+        }
+
+
+        $list = $model->select();
+        $list = count($list) ? $list->toArray() : [];
+        foreach ($list as &$item)
+        {
+            if ($item['money'] == 0){
+                $item['money'] = User::where('uid', $item['uid'])->find()['pay_price'];
+            }
+        }
+        $data['data'] = $list;
+        return $data;
+
+    }
+
+}

+ 873 - 0
app/admin/view/user/out/create.php

@@ -0,0 +1,873 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link href="{__FRAME_PATH}css/font-awesome.min.css" rel="stylesheet">
+    <link href="{__ADMIN_PATH}plug/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/jquery.min.js"></script>
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/template.min.js"></script>
+    <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.config.js"></script>
+    <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.min.js"></script>
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/lang/zh-cn/zh-cn.js"></script>
+    <link rel="stylesheet" href="/static/plug/layui/css/layui.css">
+    <script src="/static/plug/layui/layui.js"></script>
+    <script src="{__PLUG_PATH}vue/dist/vue.min.js"></script>
+    <script src="/static/plug/axios.min.js"></script>
+    <script src="{__MODULE_PATH}widget/aliyun-oss-sdk-4.4.4.min.js"></script>
+    <script src="{__MODULE_PATH}widget/cos-js-sdk-v5.min.js"></script>
+    <script src="{__MODULE_PATH}widget/qiniu-js-sdk-2.5.5.js"></script>
+    <script src="{__MODULE_PATH}widget/plupload.full.min.js"></script>
+    <script src="{__MODULE_PATH}widget/videoUpload.js"></script>
+    <style>
+        .layui-form-item {
+            margin-bottom: 0px;
+        }
+
+        .pictrueBox {
+            display: inline-block !important;
+        }
+
+        .pictrue {
+            width: 60px;
+            height: 60px;
+            border: 1px dotted rgba(0, 0, 0, 0.1);
+            margin-right: 15px;
+            display: inline-block;
+            position: relative;
+            cursor: pointer;
+        }
+
+        .pictrue img {
+            width: 100%;
+            height: 100%;
+        }
+
+        .upLoad {
+            width: 58px;
+            height: 58px;
+            line-height: 58px;
+            border: 1px dotted rgba(0, 0, 0, 0.1);
+            border-radius: 4px;
+            background: rgba(0, 0, 0, 0.02);
+            cursor: pointer;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+        }
+
+        .rulesBox {
+            display: flex;
+            flex-wrap: wrap;
+            margin-left: 10px;
+        }
+
+        .layui-tab-content {
+            margin-top: 15px;
+        }
+
+        .ml110 {
+            margin: 18px 0 4px 110px;
+        }
+
+        .rules {
+            display: flex;
+        }
+
+        .rules-btn-sm {
+            height: 30px;
+            line-height: 30px;
+            font-size: 12px;
+            width: 109px;
+        }
+
+        .rules-btn-sm input {
+            width: 79% !important;
+            height: 84% !important;
+            padding: 0 10px;
+        }
+
+        .ml10 {
+            margin-left: 10px !important;
+        }
+
+        .ml40 {
+            margin-left: 40px !important;
+        }
+
+        .closes {
+            position: absolute;
+            left: 86%;
+            top: -18%;
+        }
+        .red {
+            color: red;
+        }
+        .layui-input-block .layui-video-box{
+            width: 22%;
+            height: 180px;
+            border-radius: 10px;
+            background-color: #707070;
+            margin-top: 10px;
+            position: relative;
+            overflow: hidden;
+        }
+        .layui-input-block .layui-video-box i{
+            color: #fff;
+            line-height: 180px;
+            margin: 0 auto;
+            width: 50px;
+            height: 50px;
+            display: inherit;
+            font-size: 50px;
+        }
+        .layui-input-block .layui-video-box .mark{
+            position: absolute;
+            width: 100%;
+            height: 30px;
+            top: 0;
+            background-color: rgba(0,0,0,.5);
+            text-align: center;
+        }
+        .store_box{
+            display: flex;
+        }
+        .info{
+            color: #c9c9c9;
+            padding-left: 10px;
+            line-height: 30px;
+        }
+    </style>
+</head>
+<body>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15"  id="app" v-cloak="">
+        <div class="layui-card">
+            <div class="layui-card-header">
+                <span class="">竞拍添加</span>
+                <button style="margin-left: 20px" type="button" class="layui-btn layui-btn-primary layui-btn-xs" @click="goBack">返回列表</button>
+            </div>
+            <div class="layui-card-body">
+                <form class="layui-form" action="" v-cloak="">
+                    <div class="layui-tab layui-tab-brief" lay-filter="docTabBrief">
+                        <div class="layui-tab-content">
+                            <div class="layui-tab-item layui-show">
+                                <div class="layui-row layui-col-space15">
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">会官名称<i class="red">*</i></label>
+                                                <div class="layui-input-block">
+                                                    <input type="text" name="name" lay-verify="title" autocomplete="off"
+                                                           placeholder="场馆名称" class="layui-input" v-model="formData.name" maxlength="100">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">会馆封面图<i class="red">*</i></label>
+                                                <div class="pictrueBox">
+                                                    <div class="pictrue" v-if="formData.image" @click="uploadImage('image')">
+                                                        <img :src="formData.image"></div>
+                                                    <div class="upLoad" @click="uploadImage('image')" v-else>
+                                                        <i class="layui-icon layui-icon-camera" class="iconfont"
+                                                           style="font-size: 26px;"></i>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">绑定用户</label>
+                                                <div class="layui-input-inline">
+                                                    <select id="uid" name="uid" lay-verify="title" v-model="formData.uid">
+                                                        {foreach $user as $key=>$vo }
+                                                        <option value="{$vo.uid}">{$vo.nickname}<option>
+                                                            {/foreach}
+                                                    </select>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item layui-form-text">
+                                                <label class="layui-form-label">会馆简介</label>
+                                                <div class="layui-input-block">
+                                                    <textarea name="info" v-model="formData.info"
+                                                              placeholder="请输入商品简介" class="layui-textarea"></textarea>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-tab-item">
+                                        <div class="layui-row layui-col-space15">
+                                            <textarea type="text/plain" name="description" id="myEditor" style="width:100%;">{{formData.description}}</textarea>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">排序<i class="red">*</i></label>
+                                                <div class="layui-input-inline">
+                                                    <input type="number" name="sort" lay-verify="title" autocomplete="off" class="layui-input" v-model="formData.sort" maxlength="100" value="0">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+
+
+                            </div>
+
+
+                        </div>
+                        <div class="layui-tab-content">
+                            <div class="layui-row layui-col-space15">
+                                <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                    <button class="layui-btn layui-btn-normal layui-btn-sm" id="submit" type="button" @click="handleSubmit()">提交</button>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+
+    var id = {$id};
+    //Demo
+    layui.use('form', function(){
+        var form = layui.form;
+
+        //监听提交
+        form.on('submit(formDemo)', function(data){
+            layer.msg(JSON.stringify(data.field));
+            return false;
+        });
+    });
+
+    new Vue({
+        el: '#app',
+        data: {
+            id:id,
+            //分类列表
+            cateList: [],
+            //运费模板
+            tempList: [],
+            upload:{
+                videoIng:false
+            },
+            formData: {
+                name: '',
+                image:'',
+                description: '',
+                info: '',
+                sort: 10,
+                uid:''
+            },
+            rule: { //多图选择规则
+                slider_image: {
+                    maxLength: 1
+                }
+            },
+            attr: [],//临时属性
+            newRule: false,//是否添加新规则
+            radioRule: ['status'],//radio 当选规则
+            ruleList:[],
+            ruleIndex:-1,
+            progress: 0,
+            um: null,//编译器实例化
+            form: null,//layui.form
+            layTabId: 1,
+            ruleBool: id ? true : false,
+        },
+        watch:{
+            'formData.is_sub':function (n) {
+                if (n == 1) {
+                    this.formHeader.push({title:'一级返佣(元)'});
+                    this.formHeader.push({title:'二级级返佣(元)'});
+                } else {
+                    this.formHeader.pop();
+                    this.formHeader.pop();
+                }
+            },
+            'formData.spec_type':function (n) {
+                if (n) {
+                    this.render();
+                }
+            },
+            // 'formData.image':function (n) {
+            //     if(!this.batchAttr.pic){
+            //         this.batchAttr.pic = n;
+            //     }
+            //     if(!this.formData.attr.pic){
+            //         this.formData.attr.pic = n;
+            //     }
+            // }
+        },
+        methods: {
+            back:function(){
+                var that = this;
+                layui.use(['element'], function () {
+                    layui.element.tabChange('docTabBrief', that.layTabId == 1 ? 1 : parseInt(that.layTabId) - 1);
+                });
+            },
+            next:function(){
+                var that = this;
+                layui.use(['element'], function () {
+                    layui.element.tabChange('docTabBrief', that.layTabId == 3 ? 3 : parseInt(that.layTabId) + 1);
+                });
+            },
+            goBack:function(){
+                location.href = this.U({c:'auction.auction_gu',a:'index'});
+            },
+            U: function (opt) {
+                var m = opt.m || 'admin', c = opt.c || window.controlle || '', a = opt.a || 'index', q = opt.q || '',
+                    p = opt.p || {};
+                var params = Object. keys(p).map(function (key) {
+                    return key + '/' + p[key];
+                }).join('/');
+                var gets = Object.keys(q).map(function (key) {
+                    return key+'='+ q[key];
+                }).join('&');
+
+                return '/' + m + '/' + c + '/' + a + (params == '' ? '' : '/' + params) + (gets == '' ? '' : '?' + gets);
+            },
+            /**
+             * 提示
+             * */
+            showMsg: function (msg, success) {
+                $('#submit').removeAttr('disabled').text('提交');
+                layui.use(['layer'], function () {
+                    layui.layer.msg(msg, success);
+                });
+            },
+            addBrokerage:function(){
+                if (this.brokerage.brokerage >= 0 && this.brokerage.brokerage_two >= 0){
+                    var that = this;
+                    this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
+                        item.brokerage = that.brokerage.brokerage;
+                        item.brokerage_two = that.brokerage.brokerage_two;
+                        return item;
+                    }));
+                } else {
+                    return this.showMsg('请填写返佣金额在进行批量添加');
+                }
+            },
+            batchClear:function(){
+                this.$set(this,'batchAttr',{
+                    pic: '',
+                    price: 0,
+                    cost: 0,
+                    ot_price: 0,
+                    stock: 0,
+                    bar_code: '',
+                    weight: 0,
+                    volume: 0,
+                });
+            },
+            /**
+             * 批量添加
+             * */
+            batchAdd:function(){
+                var that = this;
+                this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
+                    if (that.batchAttr.pic) {
+                        item.pic = that.batchAttr.pic;
+                    }
+                    if (that.batchAttr.price > 0){
+                        item.price = that.batchAttr.price;
+                    }
+                    if (that.batchAttr.cost > 0){
+                        item.cost = that.batchAttr.cost;
+                    }
+                    if (that.batchAttr.ot_price > 0){
+                        item.ot_price = that.batchAttr.ot_price;
+                    }
+                    if (that.batchAttr.stock > 0){
+                        item.stock = that.batchAttr.stock;
+                    }
+                    if (that.batchAttr.bar_code != ''){
+                        item.bar_code = that.batchAttr.bar_code;
+                    }
+                    if (that.batchAttr.weight > 0){
+                        item.weight = that.batchAttr.weight;
+                    }
+                    if (that.batchAttr.volume > 0){
+                        item.volume = that.batchAttr.volume;
+                    }
+                    return item;
+                }));
+
+            },
+            /**
+             * 获取商品信息
+             * */
+            getProductInfo: function () {
+                var that = this;
+                that.requestGet(that.U({c:"store.StoreProduct",a:'get_product_info',q:{id:that.id}})).then(function (res) {
+                    that.$set(that,'cateList',res.data.cateList);
+                    that.$set(that,'tempList',res.data.tempList);
+                    var productInfo = res.data.productInfo || {};
+                    if(productInfo.id && that.id){
+                        that.$set(that,'formData',productInfo);
+                        that.generate();
+                    }
+                    that.getRuleList();
+                    that.init();
+                }).catch(function (res) {
+                    that.showMsg(res.msg);
+                })
+            },
+            /**
+             * 给某个属性添加属性值
+             * @param item
+             * */
+            addDetail: function (item) {
+                if (!item.detailValue) return false;
+                if (item.detail.find(function (val) {
+                    if(item.detailValue == val){
+                        return true;
+                    }
+                })) {
+                    return this.showMsg('添加的属性值重复');
+                }
+                item.detail.push(item.detailValue);
+                item.detailValue = '';
+            },
+            /**
+             * 删除某个属性值
+             * @param item 父级循环集合
+             * @param inx 子集index
+             * */
+            deleteValue: function (item, inx) {
+                if (item.detail.length > 1) {
+                    item.detail.splice(inx, 1);
+                } else {
+                    return this.showMsg('请设置至少一个属性');
+                }
+            },
+            /**
+             * 删除某条属性
+             * @param index
+             * */
+            deleteItem: function (index) {
+                this.formData.items.splice(index, 1);
+            },
+            /**
+             * 删除某条属性
+             * @param index
+             * */
+            deleteAttrs: function (index) {
+                var that = this;
+                if(that.id > 0){
+                    that.requestGet(that.U({c:"store.StoreProduct",a:'check_activity',q:{id:that.id}})).then(function (res) {
+                        that.showMsg(res.msg);
+                    }).catch(function (res) {
+                        if (that.formData.attrs.length > 1) {
+                            that.formData.attrs.splice(index, 1);
+                        } else {
+                            return that.showMsg('请设置至少一个规则');
+                        }
+                    })
+                }else{
+                    if (that.formData.attrs.length > 1) {
+                        that.formData.attrs.splice(index, 1);
+                    } else {
+                        return that.showMsg('请设置至少一个规则');
+                    }
+                }
+            },
+            /**
+             * 创建属性
+             * */
+            createAttrName: function () {
+                if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
+                    if (this.formData.items.find(function (val) {
+                        if (val.value == this.formDynamic.attrsName) {
+                            return true;
+                        }
+                    }.bind(this))) {
+                        return this.showMsg('添加的属性重复');
+                    }
+                    this.formData.items.push({
+                        value: this.formDynamic.attrsName,
+                        detailValue: '',
+                        attrHidden: false,
+                        detail: [this.formDynamic.attrsVal]
+                    });
+                    this.formDynamic.attrsName = '';
+                    this.formDynamic.attrsVal = '';
+                    this.newRule = false;
+                } else {
+                    return this.showMsg('请添加完整的规格!');
+                }
+            },
+            /**
+             * 删除图片
+             * */
+            deleteImage: function (key, index) {
+                var that = this;
+                if (index != undefined) {
+                    that.formData[key].splice(index, 1);
+                    that.$set(that.formData, key, that.formData[key]);
+                } else {
+                    that.$set(that.formData, key, '');
+                }
+            },
+            createFrame: function (title, src, opt) {
+                opt === undefined && (opt = {});
+                var h = 0;
+                if (window.innerHeight < 800 && window.innerHeight >= 700) {
+                    h = window.innerHeight - 50;
+                } else if (window.innerHeight < 900 && window.innerHeight >= 800) {
+                    h = window.innerHeight - 100;
+                } else if (window.innerHeight < 1000 && window.innerHeight >= 900) {
+                    h = window.innerHeight - 150;
+                } else if (window.innerHeight >= 1000) {
+                    h = window.innerHeight - 200;
+                } else {
+                    h = window.innerHeight;
+                }
+                var area = [(opt.w || window.innerWidth / 2) + 'px', (!opt.h || opt.h > h ? h : opt.h) + 'px'];
+                layui.use('layer',function () {
+                    return layer.open({
+                        type: 2,
+                        title: title,
+                        area: area,
+                        fixed: false, //不固定
+                        maxmin: true,
+                        moveOut: false,//true  可以拖出窗外  false 只能在窗内拖
+                        anim: 5,//出场动画 isOutAnim bool 关闭动画
+                        offset: 'auto',//['100px','100px'],//'auto',//初始位置  ['100px','100px'] t[ 上 左]
+                        shade: 0,//遮罩
+                        resize: true,//是否允许拉伸
+                        content: src,//内容
+                        move: '.layui-layer-title'
+                    });
+                });
+            },
+            changeIMG: function (name, value) {
+                if (this.getRule(name).maxLength !== undefined) {
+                    var that = this;
+                    value.map(function (v) {
+                        that.formData[name].push(v);
+                    });
+                    this.$set(this.formData, name, this.formData[name]);
+                } else {
+                    if(name == 'batchAttr.pic'){
+                        this.batchAttr.pic = value;
+                    } else {
+                        if (name.indexOf('.') !== -1) {
+                            var key = name.split('.');
+                            if (key.length == 2){
+                                this.formData[key[0]][key[1]] = value;
+                            } else if(key.length == 3){
+                                this.formData[key[0]][key[1]][key[2]] = value;
+                            } else if(key.length == 4){
+                                this.$set(this.formData[key[0]][key[1]][key[2]],key[3],value)
+                            }
+                        } else {
+                            this.formData[name] = value;
+                        }
+                    }
+                }
+            },
+            getRule: function (name) {
+                return this.rule[name] || {};
+            },
+            uploadImage: function (name) {
+                return this.createFrame('选择图片',this.U({c:"widget.images",a:'index',p:{fodder:name}}),{h:545,w:900});
+            },
+            uploadVideo: function () {
+                if (this.videoLink) {
+                    this.formData.video_link = this.videoLink;
+                } else {
+                    $(this.$refs.filElem).click();
+                }
+            },
+            delVideo: function () {
+                var that = this;
+                that.$set(that.formData, 'video_link', '');
+            },
+            insertEditor: function (list) {
+                this.um.execCommand('insertimage', list);
+            },
+            insertEditorVideo: function (src) {
+                this.um.setContent('<div><video style="width: 99%" src="'+src+'" class="video-ue" controls="controls" width="100"><source src="'+src+'"></source></video></div><br>',true);
+            },
+            getContent: function () {
+                return this.um.getContent();
+            },
+            /**
+             * 监听radio字段
+             */
+            eeventRadio: function () {
+                var that = this;
+                that.radioRule.map(function (val) {
+                    that.form.on('radio(' + val + ')', function (res) {
+                        that.formData[val] = res.value;
+                    });
+                })
+            },
+            init: function () {
+                var that = this;
+                window.UMEDITOR_CONFIG.toolbar = [
+                    // 加入一个 test
+                    'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
+                    'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize',
+                    '| justifyleft justifycenter justifyright justifyjustify |',
+                    'link unlink | emotion selectimgs video  | map',
+                    '| horizontal print preview fullscreen', 'drafts', 'formula'
+                ];
+                UM.registerUI('selectimgs', function (name) {
+                    var me = this;
+                    var $btn = $.eduibutton({
+                        icon: 'image',
+                        click: function () {
+                            that.createFrame('选择图片', "{:Url('widget.images/index',['fodder'=>'editor'])}");
+                        },
+                        title: '选择图片'
+                    });
+
+                    this.addListener('selectionchange', function () {
+                        //切换为不可编辑时,把自己变灰
+                        var state = this.queryCommandState(name);
+                        $btn.edui().disabled(state == -1).active(state == 1)
+                    });
+                    return $btn;
+
+                });
+                UM.registerUI('video', function (name) {
+                    var me = this;
+                    var $btn = $.eduibutton({
+                        icon: 'video',
+                        click: function () {
+                            that.createFrame('选择视频', "{:Url('widget.video/index',['fodder'=>'video'])}");
+                        },
+                        title: '选择视频'
+                    });
+
+                    this.addListener('selectionchange', function () {
+                        //切换为不可编辑时,把自己变灰
+                        var state = this.queryCommandState(name);
+                        $btn.edui().disabled(state == -1).active(state == 1)
+                    });
+                    return $btn;
+
+                });
+                //实例化编辑器
+                this.um = UM.getEditor('myEditor', {initialFrameWidth: '99%', initialFrameHeight: 400});
+                this.um.setContent(that.formData.description);
+                that.$nextTick(function () {
+                    layui.use(['form','element'], function () {
+                        that.form = layui.form;
+                        that.form.render();
+                        that.form.on('select(temp_id)', function (data) {
+                            that.$set(that.formData, 'temp_id', data.value);
+                        });
+                        that.form.on('select(rule_index)', function (data) {
+                            that.ruleIndex = data.value;
+                        });
+                        layui.element.on('tab(docTabBrief)', function(){
+                            that.layTabId = this.getAttribute('lay-id');
+                        });
+                        that.eeventRadio();
+                    });
+                })
+            },
+            requestPost: function (url, data) {
+                return new Promise(function (resolve, reject) {
+                    axios.post(url, data).then(function (res) {
+                        if (res.status == 200 && res.data.code == 200) {
+                            resolve(res.data)
+                        } else {
+                            reject(res.data);
+                        }
+                    }).catch(function (err) {
+                        reject({msg:err})
+                    });
+                })
+            },
+            requestGet: function (url) {
+                return new Promise(function (resolve, reject) {
+                    axios.get(url).then(function (res) {
+                        if (res.status == 200 && res.data.code == 200) {
+                            resolve(res.data)
+                        } else {
+                            reject(res.data);
+                        }
+                    }).catch(function (err) {
+                        reject({msg:err})
+                    });
+                })
+            },
+            generates: function () {
+                var that = this;
+                that.generate(1);
+            },
+            generate: function (type = 0) {
+                var that = this;
+                this.requestPost(that.U({c:"store.StoreProduct",a:'is_format_attr',p:{id:that.id,type:type}}), {attrs:this.formData.items}).then(function (res) {
+                    that.$set(that.formData, 'attrs', res.data.value);
+                    that.$set(that, 'formHeader', res.data.header);
+                    if (that.id && that.formData.is_sub == 1 && that.formData.spec_type == 1) {
+                        that.formHeader.push({title:'一级返佣(元)'});
+                        that.formHeader.push({title:'二级级返佣(元)'});
+                    }
+                }).catch(function (res) {
+                    return that.showMsg(res.msg);
+                });
+            },
+            handleSubmit:function () {
+                var that = this;
+
+                var uid = $('#uid').val();
+                console.log(uid);
+                that.formData.uid = uid;
+                if (!that.formData['uid']){
+                    return that.showMsg('请绑定用户');
+                }
+                if (!that.formData['name']){
+                    return that.showMsg('请填写名称');
+                }
+                if (!that.formData['image']){
+                    return that.showMsg('请上传图片');
+                }
+
+                that.formData.description = that.getContent();
+                that.requestPost(that.U({c:'auction.auction_gu',a:'save',p:{id:that.id}}),that.formData).then(function (res) {
+                    that.confirm();
+                }).catch(function (res) {
+                    that.showMsg(res.msg);
+                });
+
+            },
+            confirm: function(){
+                var that = this;
+                layui.use(['layer'], function () {
+                    var layer = layui.layer;
+                    layer.confirm(that.id ? '修改成功是否返回产品列表' : '添加成功是否返回产品列表', {
+                        btn: ['返回列表',that.id ? '继续修改' : '继续添加'] //按钮
+                    }, function(){
+                        location.href = that.U({c:'auction.auction_gu',a:'index'});
+                    }, function(){
+                        location.reload();
+                    });
+                });
+            },
+            render:function(){
+                this.$nextTick(function(){
+                    layui.use(['form'], function () {
+                        layui.form.render('select');
+                    });
+                })
+            },
+            // 移动
+            handleDragStart (e, item) {
+                this.dragging = item;
+            },
+            handleDragEnd (e, item) {
+                this.dragging = null
+            },
+            handleDragOver (e) {
+                e.dataTransfer.dropEffect = 'move'
+            },
+            handleDragEnter (e, item) {
+                e.dataTransfer.effectAllowed = 'move'
+                if (item === this.dragging) {
+                    return
+                }
+                var newItems = [...this.formData.activity];
+                var src = newItems.indexOf(this.dragging);
+                var dst = newItems.indexOf(item);
+                newItems.splice(dst, 0, ...newItems.splice(src, 1))
+                this.formData.activity = newItems;
+            },
+            getRuleList:function (type) {
+                var that = this;
+                that.requestGet(that.U({c:'store.StoreProduct',a:'get_rule'})).then(function (res) {
+                    that.$set(that,'ruleList',res.data);
+                    if(type !== undefined){
+                        that.render();
+                    }
+                });
+            },
+            addRule:function(){
+                return this.createFrame('添加商品规则',this.U({c:'store.StoreProductRule',a:'create'}));
+            },
+            allRule:function () {
+                if (this.ruleIndex != -1) {
+                    var rule = this.ruleList[this.ruleIndex];
+                    if (rule) {
+                        this.ruleBool = true;
+                        var rule_value = rule.rule_value.map(function (item) {
+                            return item;
+                        });
+                        this.$set(this.formData,'items',rule_value);
+                        this.$set(this.formData,'attrs',[]);
+                        this.$set(this,'formHeader',[]);
+                        return true;
+                    }
+                }
+                this.showMsg('选择的属性无效');
+            }
+        },
+        mounted: function () {
+            var that = this;
+            axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
+            that.getProductInfo();
+            window.$vm = that;
+            window.changeIMG = that.changeIMG;
+            window.insertEditor = that.insertEditor;
+            window.insertEditorVideo = that.insertEditorVideo;
+            window.successFun = function(){
+                that.getRuleList(1);
+            }
+            $(that.$refs.filElem).change(function () {
+                var inputFile = this.files[0];
+                that.requestPost(that.U({c:"widget.video",a:'get_signature'})).then(function (res) {
+                    AdminUpload.upload(res.data.uploadType,{
+                        token: res.data.uploadToken || '',
+                        file: inputFile,
+                        accessKeyId: res.data.accessKey || '',
+                        accessKeySecret: res.data.secretKey || '',
+                        bucketName: res.data.storageName || '',
+                        region: res.data.storageRegion || '',
+                        domain: res.data.domain || '',
+                        uploadIng:function (progress) {
+                            that.upload.videoIng = true;
+                            that.progress = progress;
+                        }
+                    }).then(function (res) {
+                        //成功
+                        that.$set(that.formData, 'video_link', res.url);
+                        that.progress = 0;
+                        that.upload.videoIng = false;
+                        return that.showMsg('上传成功');
+                    }).catch(function (err) {
+                        //失败
+                        console.info(err);
+                        return that.showMsg('上传错误请检查您的配置');
+                    });
+                }).catch(function (res) {
+                    return that.showMsg(res.msg || '获取密钥失败,请检查您的配置');
+                });
+            })
+        }
+    });
+</script>
+</body>
+</html>
+<script>
+    import Layout from "../../../../../public/static/plug/iview/dist/iview";
+    export default {
+        components: {Layout}
+    }
+</script>

+ 812 - 0
app/admin/view/user/out/edit.php

@@ -0,0 +1,812 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link href="{__FRAME_PATH}css/font-awesome.min.css" rel="stylesheet">
+    <link href="{__ADMIN_PATH}plug/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/jquery.min.js"></script>
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/template.min.js"></script>
+    <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.config.js"></script>
+    <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.min.js"></script>
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/lang/zh-cn/zh-cn.js"></script>
+    <link rel="stylesheet" href="/static/plug/layui/css/layui.css">
+    <script src="/static/plug/layui/layui.js"></script>
+    <script src="{__PLUG_PATH}vue/dist/vue.min.js"></script>
+    <script src="/static/plug/axios.min.js"></script>
+    <script src="{__MODULE_PATH}widget/aliyun-oss-sdk-4.4.4.min.js"></script>
+    <script src="{__MODULE_PATH}widget/cos-js-sdk-v5.min.js"></script>
+    <script src="{__MODULE_PATH}widget/qiniu-js-sdk-2.5.5.js"></script>
+    <script src="{__MODULE_PATH}widget/plupload.full.min.js"></script>
+    <script src="{__MODULE_PATH}widget/videoUpload.js"></script>
+    <style>
+        .layui-form-item {
+            margin-bottom: 0px;
+        }
+
+        .pictrueBox {
+            display: inline-block !important;
+        }
+
+        .pictrue {
+            width: 60px;
+            height: 60px;
+            border: 1px dotted rgba(0, 0, 0, 0.1);
+            margin-right: 15px;
+            display: inline-block;
+            position: relative;
+            cursor: pointer;
+        }
+
+        .pictrue img {
+            width: 100%;
+            height: 100%;
+        }
+
+        .upLoad {
+            width: 58px;
+            height: 58px;
+            line-height: 58px;
+            border: 1px dotted rgba(0, 0, 0, 0.1);
+            border-radius: 4px;
+            background: rgba(0, 0, 0, 0.02);
+            cursor: pointer;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+        }
+
+        .rulesBox {
+            display: flex;
+            flex-wrap: wrap;
+            margin-left: 10px;
+        }
+
+        .layui-tab-content {
+            margin-top: 15px;
+        }
+
+        .ml110 {
+            margin: 18px 0 4px 110px;
+        }
+
+        .rules {
+            display: flex;
+        }
+
+        .rules-btn-sm {
+            height: 30px;
+            line-height: 30px;
+            font-size: 12px;
+            width: 109px;
+        }
+
+        .rules-btn-sm input {
+            width: 79% !important;
+            height: 84% !important;
+            padding: 0 10px;
+        }
+
+        .ml10 {
+            margin-left: 10px !important;
+        }
+
+        .ml40 {
+            margin-left: 40px !important;
+        }
+
+        .closes {
+            position: absolute;
+            left: 86%;
+            top: -18%;
+        }
+        .red {
+            color: red;
+        }
+        .layui-input-block .layui-video-box{
+            width: 22%;
+            height: 180px;
+            border-radius: 10px;
+            background-color: #707070;
+            margin-top: 10px;
+            position: relative;
+            overflow: hidden;
+        }
+        .layui-input-block .layui-video-box i{
+            color: #fff;
+            line-height: 180px;
+            margin: 0 auto;
+            width: 50px;
+            height: 50px;
+            display: inherit;
+            font-size: 50px;
+        }
+        .layui-input-block .layui-video-box .mark{
+            position: absolute;
+            width: 100%;
+            height: 30px;
+            top: 0;
+            background-color: rgba(0,0,0,.5);
+            text-align: center;
+        }
+        .store_box{
+            display: flex;
+        }
+        .info{
+            color: #c9c9c9;
+            padding-left: 10px;
+            line-height: 30px;
+        }
+    </style>
+</head>
+<body>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15"  id="app" v-cloak="">
+        <div class="layui-card">
+            <div class="layui-card-header">
+                <span class="">竞拍添加</span>
+                <button style="margin-left: 20px" type="button" class="layui-btn layui-btn-primary layui-btn-xs" @click="goBack">返回列表</button>
+            </div>
+            <div class="layui-card-body">
+                <form class="layui-form" action="" v-cloak="">
+                    <div class="layui-tab layui-tab-brief" lay-filter="docTabBrief">
+                        <div class="layui-tab-content">
+                            <div class="layui-tab-item layui-show">
+                                <div class="layui-row layui-col-space15">
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">会官名称<i class="red">*</i></label>
+                                                <div class="layui-input-block">
+                                                    <input type="text" name="name" lay-verify="title" autocomplete="off"
+                                                           placeholder="场馆名称" class="layui-input" v-model="formData.name" maxlength="100">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                 <label class="layui-form-label">会馆封面图<i class="red">*</i></label>
+                                                <div class="pictrueBox">
+                                                    <div class="pictrue" v-if="formData.image" @click="uploadImage('image')">
+                                                        <img :src="formData.image"></div>
+                                                    <div class="upLoad" @click="uploadImage('image')" v-else>
+                                                        <i class="layui-icon layui-icon-camera" class="iconfont"
+                                                           style="font-size: 26px;"></i>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    {if $admin['roles'] == 1}
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">绑定用户</label>
+                                                <div class="layui-input-inline">
+                                                    <select id="uid" name="uid" lay-verify="title" v-model="formData.uid">
+                                                        {foreach $user as $key=>$vo }
+                                                        <option value="{$vo.uid}">{$vo.nickname}<option>
+                                                            {/foreach}
+                                                    </select>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    {/if}
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item layui-form-text">
+                                                <label class="layui-form-label">会馆简介</label>
+                                                <div class="layui-input-block">
+                                                    <textarea name="info" v-model="formData.info"
+                                                              placeholder="请输入商品简介" class="layui-textarea"></textarea>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-tab-item">
+                                        <div class="layui-row layui-col-space15">
+                                            <textarea type="text/plain" name="description" id="myEditor" style="width:100%;">{{formData.description}}</textarea>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">排序<i class="red">*</i></label>
+                                                <div class="layui-input-inline">
+                                                    <input type="number" name="sort" lay-verify="title" autocomplete="off" class="layui-input" v-model="formData.sort" maxlength="100" value="0">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+
+
+                                </div>
+
+
+                            </div>
+                        <div class="layui-tab-content">
+                            <div class="layui-row layui-col-space15">
+                                <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                    <button class="layui-btn layui-btn-normal layui-btn-sm" id="submit" type="button" @click="handleSubmit()">提交</button>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+
+    var id = {$id};
+    //Demo
+    layui.use('form', function(){
+        var form = layui.form;
+
+        //监听提交
+        form.on('submit(formDemo)', function(data){
+            layer.msg(JSON.stringify(data.field));
+            return false;
+        });
+    });
+
+    new Vue({
+        el: '#app',
+        data: {
+            id:id,
+            //分类列表
+            cateList: [],
+            //运费模板
+            tempList: [],
+            upload:{
+                videoIng:false
+            },
+            formData: {
+                name: '',
+                image:'',
+                sort:'',
+                description: '',
+                info: '',
+                uid:''
+
+            },
+            rule: { //多图选择规则
+                slider_image: {
+                    maxLength: 1
+                }
+            },
+            attr: [],//临时属性
+            newRule: false,//是否添加新规则
+            radioRule: ['status'],//radio 当选规则
+            ruleList:[],
+            ruleIndex:-1,
+            progress: 0,
+            um: null,//编译器实例化
+            form: null,//layui.form
+            layTabId: 1,
+            ruleBool: id ? true : false,
+        },
+        watch:{
+            'formData.is_sub':function (n) {
+                if (n == 1) {
+                    this.formHeader.push({title:'一级返佣(元)'});
+                    this.formHeader.push({title:'二级级返佣(元)'});
+                } else {
+                    this.formHeader.pop();
+                    this.formHeader.pop();
+                }
+            },
+            'formData.spec_type':function (n) {
+                if (n) {
+                    this.render();
+                }
+            },
+            // 'formData.image':function (n) {
+            //     if(!this.batchAttr.pic){
+            //         this.batchAttr.pic = n;
+            //     }
+            //     if(!this.formData.attr.pic){
+            //         this.formData.attr.pic = n;
+            //     }
+            // }
+        },
+        methods: {
+            back:function(){
+                var that = this;
+                layui.use(['element'], function () {
+                    layui.element.tabChange('docTabBrief', that.layTabId == 1 ? 1 : parseInt(that.layTabId) - 1);
+                });
+            },
+            next:function(){
+                var that = this;
+                layui.use(['element'], function () {
+                    layui.element.tabChange('docTabBrief', that.layTabId == 3 ? 3 : parseInt(that.layTabId) + 1);
+                });
+            },
+            goBack:function(){
+                location.href = this.U({c:'auction.auction_gu',a:'index'});
+            },
+            U: function (opt) {
+                var m = opt.m || 'admin', c = opt.c || window.controlle || '', a = opt.a || 'index', q = opt.q || '',
+                    p = opt.p || {};
+                var params = Object. keys(p).map(function (key) {
+                    return key + '/' + p[key];
+                }).join('/');
+                var gets = Object.keys(q).map(function (key) {
+                    return key+'='+ q[key];
+                }).join('&');
+
+                return '/' + m + '/' + c + '/' + a + (params == '' ? '' : '/' + params) + (gets == '' ? '' : '?' + gets);
+            },
+            /**
+             * 提示
+             * */
+            showMsg: function (msg, success) {
+                $('#submit').removeAttr('disabled').text('提交');
+                layui.use(['layer'], function () {
+                    layui.layer.msg(msg, success);
+                });
+            },
+            addBrokerage:function(){
+                if (this.brokerage.brokerage >= 0 && this.brokerage.brokerage_two >= 0){
+                    var that = this;
+                    this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
+                        item.brokerage = that.brokerage.brokerage;
+                        item.brokerage_two = that.brokerage.brokerage_two;
+                        return item;
+                    }));
+                } else {
+                    return this.showMsg('请填写返佣金额在进行批量添加');
+                }
+            },
+            batchClear:function(){
+                this.$set(this,'batchAttr',{
+                    pic: '',
+                    price: 0,
+                    cost: 0,
+                    ot_price: 0,
+                    stock: 0,
+                    bar_code: '',
+                    weight: 0,
+                    volume: 0,
+                });
+            },
+            /**
+             * 批量添加
+             * */
+            batchAdd:function(){
+                var that = this;
+                this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
+                    if (that.batchAttr.pic) {
+                        item.pic = that.batchAttr.pic;
+                    }
+                    if (that.batchAttr.price > 0){
+                        item.price = that.batchAttr.price;
+                    }
+                    if (that.batchAttr.cost > 0){
+                        item.cost = that.batchAttr.cost;
+                    }
+                    if (that.batchAttr.ot_price > 0){
+                        item.ot_price = that.batchAttr.ot_price;
+                    }
+                    if (that.batchAttr.stock > 0){
+                        item.stock = that.batchAttr.stock;
+                    }
+                    if (that.batchAttr.bar_code != ''){
+                        item.bar_code = that.batchAttr.bar_code;
+                    }
+                    if (that.batchAttr.weight > 0){
+                        item.weight = that.batchAttr.weight;
+                    }
+                    if (that.batchAttr.volume > 0){
+                        item.volume = that.batchAttr.volume;
+                    }
+                    return item;
+                }));
+
+            },
+            /**
+             * 获取商品信息
+             * */
+            getProductInfo: function () {
+                var that = this;
+                that.requestGet(that.U({c:"auction.auction_gu",a:'get_auction',q:{id:that.id}})).then(function (res) {
+
+                    var productInfo = res.data.productInfo || {};
+                    if(productInfo.id && that.id){
+                        that.$set(that,'formData',productInfo);
+                        that.generate();
+                    }
+                    that.getRuleList();
+                    that.init();
+                }).catch(function (res) {
+                    that.showMsg(res.msg);
+                })
+            },
+            /**
+             * 给某个属性添加属性值
+             * @param item
+             * */
+            addDetail: function (item) {
+                if (!item.detailValue) return false;
+                if (item.detail.find(function (val) {
+                    if(item.detailValue == val){
+                        return true;
+                    }
+                })) {
+                    return this.showMsg('添加的属性值重复');
+                }
+                item.detail.push(item.detailValue);
+                item.detailValue = '';
+            },
+            /**
+             * 删除某个属性值
+             * @param item 父级循环集合
+             * @param inx 子集index
+             * */
+            deleteValue: function (item, inx) {
+                if (item.detail.length > 1) {
+                    item.detail.splice(inx, 1);
+                } else {
+                    return this.showMsg('请设置至少一个属性');
+                }
+            },
+            /**
+             * 删除某条属性
+             * @param index
+             * */
+            deleteItem: function (index) {
+                this.formData.items.splice(index, 1);
+            },
+            /**
+             * 删除某条属性
+             * @param index
+             * */
+            deleteAttrs: function (index) {
+                var that = this;
+                if(that.id > 0){
+                    that.requestGet(that.U({c:"store.StoreProduct",a:'check_activity',q:{id:that.id}})).then(function (res) {
+                        that.showMsg(res.msg);
+                    }).catch(function (res) {
+                        if (that.formData.attrs.length > 1) {
+                            that.formData.attrs.splice(index, 1);
+                        } else {
+                            return that.showMsg('请设置至少一个规则');
+                        }
+                    })
+                }else{
+                    if (that.formData.attrs.length > 1) {
+                        that.formData.attrs.splice(index, 1);
+                    } else {
+                        return that.showMsg('请设置至少一个规则');
+                    }
+                }
+            },
+            /**
+             * 创建属性
+             * */
+            createAttrName: function () {
+                if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
+                    if (this.formData.items.find(function (val) {
+                        if (val.value == this.formDynamic.attrsName) {
+                            return true;
+                        }
+                    }.bind(this))) {
+                        return this.showMsg('添加的属性重复');
+                    }
+                    this.formData.items.push({
+                        value: this.formDynamic.attrsName,
+                        detailValue: '',
+                        attrHidden: false,
+                        detail: [this.formDynamic.attrsVal]
+                    });
+                    this.formDynamic.attrsName = '';
+                    this.formDynamic.attrsVal = '';
+                    this.newRule = false;
+                } else {
+                    return this.showMsg('请添加完整的规格!');
+                }
+            },
+            /**
+             * 删除图片
+             * */
+            deleteImage: function (key, index) {
+                var that = this;
+                if (index != undefined) {
+                    that.formData[key].splice(index, 1);
+                    that.$set(that.formData, key, that.formData[key]);
+                } else {
+                    that.$set(that.formData, key, '');
+                }
+            },
+            createFrame: function (title, src, opt) {
+                opt === undefined && (opt = {});
+                var h = 0;
+                if (window.innerHeight < 800 && window.innerHeight >= 700) {
+                    h = window.innerHeight - 50;
+                } else if (window.innerHeight < 900 && window.innerHeight >= 800) {
+                    h = window.innerHeight - 100;
+                } else if (window.innerHeight < 1000 && window.innerHeight >= 900) {
+                    h = window.innerHeight - 150;
+                } else if (window.innerHeight >= 1000) {
+                    h = window.innerHeight - 200;
+                } else {
+                    h = window.innerHeight;
+                }
+                var area = [(opt.w || window.innerWidth / 2) + 'px', (!opt.h || opt.h > h ? h : opt.h) + 'px'];
+                layui.use('layer',function () {
+                    return layer.open({
+                        type: 2,
+                        title: title,
+                        area: area,
+                        fixed: false, //不固定
+                        maxmin: true,
+                        moveOut: false,//true  可以拖出窗外  false 只能在窗内拖
+                        anim: 5,//出场动画 isOutAnim bool 关闭动画
+                        offset: 'auto',//['100px','100px'],//'auto',//初始位置  ['100px','100px'] t[ 上 左]
+                        shade: 0,//遮罩
+                        resize: true,//是否允许拉伸
+                        content: src,//内容
+                        move: '.layui-layer-title'
+                    });
+                });
+            },
+            changeIMG: function (name, value) {
+                if (this.getRule(name).maxLength !== undefined) {
+                    var that = this;
+                    value.map(function (v) {
+                        that.formData[name].push(v);
+                    });
+                    this.$set(this.formData, name, this.formData[name]);
+                } else {
+                    if(name == 'batchAttr.pic'){
+                        this.batchAttr.pic = value;
+                    } else {
+                        if (name.indexOf('.') !== -1) {
+                            var key = name.split('.');
+                            if (key.length == 2){
+                                this.formData[key[0]][key[1]] = value;
+                            } else if(key.length == 3){
+                                this.formData[key[0]][key[1]][key[2]] = value;
+                            } else if(key.length == 4){
+                                this.$set(this.formData[key[0]][key[1]][key[2]],key[3],value)
+                            }
+                        } else {
+                            this.formData[name] = value;
+                        }
+                    }
+                }
+            },
+            getRule: function (name) {
+                return this.rule[name] || {};
+            },
+            uploadImage: function (name) {
+                return this.createFrame('选择图片',this.U({c:"widget.images",a:'index',p:{fodder:name}}),{h:545,w:900});
+            },
+            uploadVideo: function () {
+                if (this.videoLink) {
+                    this.formData.video_link = this.videoLink;
+                } else {
+                    $(this.$refs.filElem).click();
+                }
+            },
+            delVideo: function () {
+                var that = this;
+                that.$set(that.formData, 'video_link', '');
+            },
+            insertEditor: function (list) {
+                this.um.execCommand('insertimage', list);
+            },
+            insertEditorVideo: function (src) {
+                this.um.setContent('<div><video style="width: 99%" src="'+src+'" class="video-ue" controls="controls" width="100"><source src="'+src+'"></source></video></div><br>',true);
+            },
+            /**
+             * 监听radio字段
+             */
+            eeventRadio: function () {
+                var that = this;
+                that.radioRule.map(function (val) {
+                    that.form.on('radio(' + val + ')', function (res) {
+                        that.formData[val] = res.value;
+                    });
+                })
+            },
+            init: function () {
+                var that = this;
+                window.UMEDITOR_CONFIG.toolbar = [
+                    // 加入一个 test
+                    'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
+                    'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize',
+                    '| justifyleft justifycenter justifyright justifyjustify |',
+                    'link unlink | emotion selectimgs video  | map',
+                    '| horizontal print preview fullscreen', 'drafts', 'formula'
+                ];
+                UM.registerUI('selectimgs', function (name) {
+                    var me = this;
+                    var $btn = $.eduibutton({
+                        icon: 'image',
+                        click: function () {
+                            that.createFrame('选择图片', "{:Url('widget.images/index',['fodder'=>'editor'])}");
+                        },
+                        title: '选择图片'
+                    });
+
+                    this.addListener('selectionchange', function () {
+                        //切换为不可编辑时,把自己变灰
+                        var state = this.queryCommandState(name);
+                        $btn.edui().disabled(state == -1).active(state == 1)
+                    });
+                    return $btn;
+
+                });
+                UM.registerUI('video', function (name) {
+                    var me = this;
+                    var $btn = $.eduibutton({
+                        icon: 'video',
+                        click: function () {
+                            that.createFrame('选择视频', "{:Url('widget.video/index',['fodder'=>'video'])}");
+                        },
+                        title: '选择视频'
+                    });
+
+                    this.addListener('selectionchange', function () {
+                        //切换为不可编辑时,把自己变灰
+                        var state = this.queryCommandState(name);
+                        $btn.edui().disabled(state == -1).active(state == 1)
+                    });
+                    return $btn;
+
+                });
+                //实例化编辑器
+                this.um = UM.getEditor('myEditor', {initialFrameWidth: '99%', initialFrameHeight: 400});
+                this.um.setContent(that.formData.description);
+                that.$nextTick(function () {
+                    layui.use(['form','element'], function () {
+                        that.form = layui.form;
+                        that.form.render();
+                        that.form.on('select(temp_id)', function (data) {
+                            that.$set(that.formData, 'temp_id', data.value);
+                        });
+                        that.form.on('select(rule_index)', function (data) {
+                            that.ruleIndex = data.value;
+                        });
+                        layui.element.on('tab(docTabBrief)', function(){
+                            that.layTabId = this.getAttribute('lay-id');
+                        });
+                        that.eeventRadio();
+                    });
+                })
+            },
+            requestPost: function (url, data) {
+                return new Promise(function (resolve, reject) {
+                    axios.post(url, data).then(function (res) {
+                        if (res.status == 200 && res.data.code == 200) {
+                            resolve(res.data)
+                        } else {
+                            reject(res.data);
+                        }
+                    }).catch(function (err) {
+                        reject({msg:err})
+                    });
+                })
+            },
+            requestGet: function (url) {
+                return new Promise(function (resolve, reject) {
+                    axios.get(url).then(function (res) {
+                        if (res.status == 200 && res.data.code == 200) {
+                            resolve(res.data)
+                        } else {
+                            reject(res.data);
+                        }
+                    }).catch(function (err) {
+                        reject({msg:err})
+                    });
+                })
+            },
+            generates: function () {
+                var that = this;
+                that.generate(1);
+            },
+            handleSubmit:function () {
+                var that = this;
+                var that = this;
+
+                var uid = $('#uid').val();
+                console.log(uid);
+                that.formData.uid = uid;
+                if (!that.formData['uid']){
+                    return that.showMsg('请绑定用户');
+                }
+                if (!that.formData['name']){
+                    return that.showMsg('请填写名称');
+                }
+                if (!that.formData['image']){
+                    return that.showMsg('请上传图片');
+                }
+
+                $('#submit').attr('disabled', 'disabled').text('修改中...');
+                that.requestPost(that.U({c:'auction.auction_gu',a:'update',p:{id:that.id}}),that.formData).then(function (res) {
+                    that.confirm();
+                }).catch(function (res) {
+                    that.showMsg(res.msg);
+                });
+
+            },
+            confirm: function(){
+                var that = this;
+                layui.use(['layer'], function () {
+                    var layer = layui.layer;
+                    layer.confirm(that.id ? '修改成功是否返回产品列表' : '修改成功是否返回产品列表', {
+                        btn: ['返回列表',that.id ? '继续修改' : '继续修改'] //按钮
+                    }, function(){
+                        location.href = that.U({c:'auction.auction_gu',a:'index'});
+                    }, function(){
+                        location.reload();
+                    });
+                });
+            },
+            render:function(){
+                this.$nextTick(function(){
+                    layui.use(['form'], function () {
+                        layui.form.render('select');
+                    });
+                })
+            },
+            // 移动
+            handleDragStart (e, item) {
+                this.dragging = item;
+            },
+            handleDragEnd (e, item) {
+                this.dragging = null
+            },
+            handleDragOver (e) {
+                e.dataTransfer.dropEffect = 'move'
+            },
+            handleDragEnter (e, item) {
+                e.dataTransfer.effectAllowed = 'move'
+                if (item === this.dragging) {
+                    return
+                }
+                var newItems = [...this.formData.activity];
+                var src = newItems.indexOf(this.dragging);
+                var dst = newItems.indexOf(item);
+                newItems.splice(dst, 0, ...newItems.splice(src, 1))
+                this.formData.activity = newItems;
+            },
+            addRule:function(){
+                return this.createFrame('添加商品规则',this.U({c:'store.StoreProductRule',a:'create'}));
+            },
+            allRule:function () {
+                if (this.ruleIndex != -1) {
+                    var rule = this.ruleList[this.ruleIndex];
+                    if (rule) {
+                        this.ruleBool = true;
+                        var rule_value = rule.rule_value.map(function (item) {
+                            return item;
+                        });
+                        this.$set(this.formData,'items',rule_value);
+                        this.$set(this.formData,'attrs',[]);
+                        this.$set(this,'formHeader',[]);
+                        return true;
+                    }
+                }
+                this.showMsg('选择的属性无效');
+            }
+        },
+        mounted: function () {
+            var that = this;
+            that.getProductInfo();
+            window.changeIMG = that.changeIMG;
+            window.$vm = that;
+        }
+    });
+</script>
+</body>
+</html>
+<script>
+
+</script>

+ 163 - 0
app/admin/view/user/out/index.php

@@ -0,0 +1,163 @@
+{extend name="public/container"}
+{block name="head_top"}
+
+{/block}
+{block name="content"}
+<style>
+    .btn-outline{
+        border:none;
+    }
+    .btn-outline:hover{
+        background-color: #0e9aef;
+        color: #fff;
+    }
+    .layui-form-item .layui-btn {
+        margin-top: 5px;
+        margin-right: 10px;
+    }
+    .layui-btn-primary{
+        margin-right: 10px;
+        margin-left: 0!important;
+    }
+    label{
+        margin-bottom: 0!important;
+        margin-top: 4px;
+    }
+</style>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15" id="app">
+        <!--搜索条件-->
+<!--        <div class="layui-col-md12">-->
+<!--            <div class="layui-card">-->
+<!--                <div class="layui-card-header">搜索条件</div>-->
+<!--                <div class="layui-card-body">-->
+<!--                    <div class="layui-carousel layadmin-carousel layadmin-shortcut" lay-anim="" lay-indicator="inside" lay-arrow="none" style="background:none">-->
+<!--                        <form class="layui-form layui-form-pane" action="">-->
+<!--                            <div class="layui-form-item">-->
+<!---->
+<!--                                <div class="layui-col-lg12">-->
+<!--                                    <label class="layui-form-label" style="top: -5.5px;">搜索条件</label>-->
+<!--                                    <div class="layui-input-inline">-->
+<!--                                        <input type="text" id="auction" name="auction" class="layui-input" placeholder="请输入名称,编号">-->
+<!--                                    </div>-->
+<!--                                </div>-->
+<!--                                <div class="layui-inline">-->
+<!--                                    <div class="layui-input-inline">-->
+<!--                                        <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">-->
+<!--                                            <i class="layui-icon layui-icon-search"></i>搜索</button>-->
+<!--                                    </div>-->
+<!--                                </div>-->
+<!--                            </div>-->
+<!--                        </form>-->
+<!--                    </div>-->
+<!--                </div>-->
+<!--            </div>-->
+<!--        </div>-->
+
+        <!-- 中间详细信息-->
+        <div :class="item.col!=undefined ? 'layui-col-sm'+item.col+' '+'layui-col-md'+item.col:'layui-col-sm6 layui-col-md3'"
+             v-for="item in badge" v-cloak="" v-if="item.count > 0">
+        </div>
+        <!--enb-->
+    </div>
+    <!--列表-->
+    <div class="layui-row layui-col-space15">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">出局奖励列表</div>
+                <div class="layui-card-body">
+                    <div class="layui-btn-container" id="container-action">
+                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:700,w:1100})">添加出局奖励</a>
+<!--                        <button class="layui-btn layui-btn-sm" data-type="del_auction">批量删除</button>-->
+                    </div>
+                    <table class="layui-hide" id="List" lay-filter="List"></table>
+
+
+                    <script type="text/html" id="image">
+                        <img style="cursor: pointer" lay-event="open_image" src="{{d.image}}" >
+                    </script>
+                    <script type="text/html" id="status">
+                        <input type='checkbox' name='id' lay-skin='switch' value="{{d.id}}" lay-filter='status' lay-text='使用|禁用'  {{ d.status  == 1 ? 'checked' : '' }}>
+                    </script>
+                    <script type="text/html" id="act">
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('{{d.title}}-编辑','{:Url('edit')}?id={{d.id}}',{h:700,w:1100})">
+                            编辑
+                        </button>
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">
+                            删除
+                        </button>
+                    </script>
+                </div>
+            </div>
+        </div>
+    </div>
+    <!--end-->
+</div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name="script"}
+<script>
+    layList.tableList('List', "{:Url('list')}", function () {
+        return [
+            {type: 'checkbox'},
+            {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%', templet: '#id'},
+            {field: 'name', title: '名称', align: 'center'},
+            {field: 'info', title: '简介', align: 'center'},
+            {field: 'number', title: '达标额度', align: 'center'},
+            {field: 'status', title: '状态', templet: '#status', align: 'center'},
+            {field: 'right', title: '操作', align: 'center', toolbar: '#act'},
+        ];
+    });
+
+    //查询
+    layList.search('search',function(where){
+        layList.reload(where,true);
+    });
+
+    //点击事件绑定
+    layList.tool(function (event,data,obj) {
+        switch (event) {
+            case 'delete':
+                var url=layList.U({c:'user.out',a:'delete',q:{id:data.id}});
+                var code = {title:"操作提示",text:"确定将该商品移入回收站吗?",type:'info',confirm:'是的,移入回收站'};
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            obj.del();
+                            location.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },code)
+                break;
+            case 'open_image':
+                $eb.openImage(data.image);
+                break;
+            case 'edit':
+                location.href = layList.U({a:'edit',q:{id:data.id}});
+                break;
+        }
+    })
+
+
+    //改状态
+    layList.switch('status',function (odj,value) {
+        if(odj.elem.checked==true){
+            layList.baseGet(layList.Url({c:'user.out',a:'set_status',p:{status:1,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }else{
+            layList.baseGet(layList.Url({c:'user.out',a:'set_status',p:{status:0,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }
+    });
+</script>
+{/block}

+ 873 - 0
app/admin/view/user/user_partake/create.php

@@ -0,0 +1,873 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link href="{__FRAME_PATH}css/font-awesome.min.css" rel="stylesheet">
+    <link href="{__ADMIN_PATH}plug/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/jquery.min.js"></script>
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/template.min.js"></script>
+    <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.config.js"></script>
+    <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.min.js"></script>
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/lang/zh-cn/zh-cn.js"></script>
+    <link rel="stylesheet" href="/static/plug/layui/css/layui.css">
+    <script src="/static/plug/layui/layui.js"></script>
+    <script src="{__PLUG_PATH}vue/dist/vue.min.js"></script>
+    <script src="/static/plug/axios.min.js"></script>
+    <script src="{__MODULE_PATH}widget/aliyun-oss-sdk-4.4.4.min.js"></script>
+    <script src="{__MODULE_PATH}widget/cos-js-sdk-v5.min.js"></script>
+    <script src="{__MODULE_PATH}widget/qiniu-js-sdk-2.5.5.js"></script>
+    <script src="{__MODULE_PATH}widget/plupload.full.min.js"></script>
+    <script src="{__MODULE_PATH}widget/videoUpload.js"></script>
+    <style>
+        .layui-form-item {
+            margin-bottom: 0px;
+        }
+
+        .pictrueBox {
+            display: inline-block !important;
+        }
+
+        .pictrue {
+            width: 60px;
+            height: 60px;
+            border: 1px dotted rgba(0, 0, 0, 0.1);
+            margin-right: 15px;
+            display: inline-block;
+            position: relative;
+            cursor: pointer;
+        }
+
+        .pictrue img {
+            width: 100%;
+            height: 100%;
+        }
+
+        .upLoad {
+            width: 58px;
+            height: 58px;
+            line-height: 58px;
+            border: 1px dotted rgba(0, 0, 0, 0.1);
+            border-radius: 4px;
+            background: rgba(0, 0, 0, 0.02);
+            cursor: pointer;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+        }
+
+        .rulesBox {
+            display: flex;
+            flex-wrap: wrap;
+            margin-left: 10px;
+        }
+
+        .layui-tab-content {
+            margin-top: 15px;
+        }
+
+        .ml110 {
+            margin: 18px 0 4px 110px;
+        }
+
+        .rules {
+            display: flex;
+        }
+
+        .rules-btn-sm {
+            height: 30px;
+            line-height: 30px;
+            font-size: 12px;
+            width: 109px;
+        }
+
+        .rules-btn-sm input {
+            width: 79% !important;
+            height: 84% !important;
+            padding: 0 10px;
+        }
+
+        .ml10 {
+            margin-left: 10px !important;
+        }
+
+        .ml40 {
+            margin-left: 40px !important;
+        }
+
+        .closes {
+            position: absolute;
+            left: 86%;
+            top: -18%;
+        }
+        .red {
+            color: red;
+        }
+        .layui-input-block .layui-video-box{
+            width: 22%;
+            height: 180px;
+            border-radius: 10px;
+            background-color: #707070;
+            margin-top: 10px;
+            position: relative;
+            overflow: hidden;
+        }
+        .layui-input-block .layui-video-box i{
+            color: #fff;
+            line-height: 180px;
+            margin: 0 auto;
+            width: 50px;
+            height: 50px;
+            display: inherit;
+            font-size: 50px;
+        }
+        .layui-input-block .layui-video-box .mark{
+            position: absolute;
+            width: 100%;
+            height: 30px;
+            top: 0;
+            background-color: rgba(0,0,0,.5);
+            text-align: center;
+        }
+        .store_box{
+            display: flex;
+        }
+        .info{
+            color: #c9c9c9;
+            padding-left: 10px;
+            line-height: 30px;
+        }
+    </style>
+</head>
+<body>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15"  id="app" v-cloak="">
+        <div class="layui-card">
+            <div class="layui-card-header">
+                <span class="">竞拍添加</span>
+                <button style="margin-left: 20px" type="button" class="layui-btn layui-btn-primary layui-btn-xs" @click="goBack">返回列表</button>
+            </div>
+            <div class="layui-card-body">
+                <form class="layui-form" action="" v-cloak="">
+                    <div class="layui-tab layui-tab-brief" lay-filter="docTabBrief">
+                        <div class="layui-tab-content">
+                            <div class="layui-tab-item layui-show">
+                                <div class="layui-row layui-col-space15">
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">会官名称<i class="red">*</i></label>
+                                                <div class="layui-input-block">
+                                                    <input type="text" name="name" lay-verify="title" autocomplete="off"
+                                                           placeholder="场馆名称" class="layui-input" v-model="formData.name" maxlength="100">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">会馆封面图<i class="red">*</i></label>
+                                                <div class="pictrueBox">
+                                                    <div class="pictrue" v-if="formData.image" @click="uploadImage('image')">
+                                                        <img :src="formData.image"></div>
+                                                    <div class="upLoad" @click="uploadImage('image')" v-else>
+                                                        <i class="layui-icon layui-icon-camera" class="iconfont"
+                                                           style="font-size: 26px;"></i>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">绑定用户</label>
+                                                <div class="layui-input-inline">
+                                                    <select id="uid" name="uid" lay-verify="title" v-model="formData.uid">
+                                                        {foreach $user as $key=>$vo }
+                                                        <option value="{$vo.uid}">{$vo.nickname}<option>
+                                                            {/foreach}
+                                                    </select>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item layui-form-text">
+                                                <label class="layui-form-label">会馆简介</label>
+                                                <div class="layui-input-block">
+                                                    <textarea name="info" v-model="formData.info"
+                                                              placeholder="请输入商品简介" class="layui-textarea"></textarea>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-tab-item">
+                                        <div class="layui-row layui-col-space15">
+                                            <textarea type="text/plain" name="description" id="myEditor" style="width:100%;">{{formData.description}}</textarea>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">排序<i class="red">*</i></label>
+                                                <div class="layui-input-inline">
+                                                    <input type="number" name="sort" lay-verify="title" autocomplete="off" class="layui-input" v-model="formData.sort" maxlength="100" value="0">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+
+
+                            </div>
+
+
+                        </div>
+                        <div class="layui-tab-content">
+                            <div class="layui-row layui-col-space15">
+                                <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                    <button class="layui-btn layui-btn-normal layui-btn-sm" id="submit" type="button" @click="handleSubmit()">提交</button>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+
+    var id = {$id};
+    //Demo
+    layui.use('form', function(){
+        var form = layui.form;
+
+        //监听提交
+        form.on('submit(formDemo)', function(data){
+            layer.msg(JSON.stringify(data.field));
+            return false;
+        });
+    });
+
+    new Vue({
+        el: '#app',
+        data: {
+            id:id,
+            //分类列表
+            cateList: [],
+            //运费模板
+            tempList: [],
+            upload:{
+                videoIng:false
+            },
+            formData: {
+                name: '',
+                image:'',
+                description: '',
+                info: '',
+                sort: 10,
+                uid:''
+            },
+            rule: { //多图选择规则
+                slider_image: {
+                    maxLength: 1
+                }
+            },
+            attr: [],//临时属性
+            newRule: false,//是否添加新规则
+            radioRule: ['status'],//radio 当选规则
+            ruleList:[],
+            ruleIndex:-1,
+            progress: 0,
+            um: null,//编译器实例化
+            form: null,//layui.form
+            layTabId: 1,
+            ruleBool: id ? true : false,
+        },
+        watch:{
+            'formData.is_sub':function (n) {
+                if (n == 1) {
+                    this.formHeader.push({title:'一级返佣(元)'});
+                    this.formHeader.push({title:'二级级返佣(元)'});
+                } else {
+                    this.formHeader.pop();
+                    this.formHeader.pop();
+                }
+            },
+            'formData.spec_type':function (n) {
+                if (n) {
+                    this.render();
+                }
+            },
+            // 'formData.image':function (n) {
+            //     if(!this.batchAttr.pic){
+            //         this.batchAttr.pic = n;
+            //     }
+            //     if(!this.formData.attr.pic){
+            //         this.formData.attr.pic = n;
+            //     }
+            // }
+        },
+        methods: {
+            back:function(){
+                var that = this;
+                layui.use(['element'], function () {
+                    layui.element.tabChange('docTabBrief', that.layTabId == 1 ? 1 : parseInt(that.layTabId) - 1);
+                });
+            },
+            next:function(){
+                var that = this;
+                layui.use(['element'], function () {
+                    layui.element.tabChange('docTabBrief', that.layTabId == 3 ? 3 : parseInt(that.layTabId) + 1);
+                });
+            },
+            goBack:function(){
+                location.href = this.U({c:'auction.auction_gu',a:'index'});
+            },
+            U: function (opt) {
+                var m = opt.m || 'admin', c = opt.c || window.controlle || '', a = opt.a || 'index', q = opt.q || '',
+                    p = opt.p || {};
+                var params = Object. keys(p).map(function (key) {
+                    return key + '/' + p[key];
+                }).join('/');
+                var gets = Object.keys(q).map(function (key) {
+                    return key+'='+ q[key];
+                }).join('&');
+
+                return '/' + m + '/' + c + '/' + a + (params == '' ? '' : '/' + params) + (gets == '' ? '' : '?' + gets);
+            },
+            /**
+             * 提示
+             * */
+            showMsg: function (msg, success) {
+                $('#submit').removeAttr('disabled').text('提交');
+                layui.use(['layer'], function () {
+                    layui.layer.msg(msg, success);
+                });
+            },
+            addBrokerage:function(){
+                if (this.brokerage.brokerage >= 0 && this.brokerage.brokerage_two >= 0){
+                    var that = this;
+                    this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
+                        item.brokerage = that.brokerage.brokerage;
+                        item.brokerage_two = that.brokerage.brokerage_two;
+                        return item;
+                    }));
+                } else {
+                    return this.showMsg('请填写返佣金额在进行批量添加');
+                }
+            },
+            batchClear:function(){
+                this.$set(this,'batchAttr',{
+                    pic: '',
+                    price: 0,
+                    cost: 0,
+                    ot_price: 0,
+                    stock: 0,
+                    bar_code: '',
+                    weight: 0,
+                    volume: 0,
+                });
+            },
+            /**
+             * 批量添加
+             * */
+            batchAdd:function(){
+                var that = this;
+                this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
+                    if (that.batchAttr.pic) {
+                        item.pic = that.batchAttr.pic;
+                    }
+                    if (that.batchAttr.price > 0){
+                        item.price = that.batchAttr.price;
+                    }
+                    if (that.batchAttr.cost > 0){
+                        item.cost = that.batchAttr.cost;
+                    }
+                    if (that.batchAttr.ot_price > 0){
+                        item.ot_price = that.batchAttr.ot_price;
+                    }
+                    if (that.batchAttr.stock > 0){
+                        item.stock = that.batchAttr.stock;
+                    }
+                    if (that.batchAttr.bar_code != ''){
+                        item.bar_code = that.batchAttr.bar_code;
+                    }
+                    if (that.batchAttr.weight > 0){
+                        item.weight = that.batchAttr.weight;
+                    }
+                    if (that.batchAttr.volume > 0){
+                        item.volume = that.batchAttr.volume;
+                    }
+                    return item;
+                }));
+
+            },
+            /**
+             * 获取商品信息
+             * */
+            getProductInfo: function () {
+                var that = this;
+                that.requestGet(that.U({c:"store.StoreProduct",a:'get_product_info',q:{id:that.id}})).then(function (res) {
+                    that.$set(that,'cateList',res.data.cateList);
+                    that.$set(that,'tempList',res.data.tempList);
+                    var productInfo = res.data.productInfo || {};
+                    if(productInfo.id && that.id){
+                        that.$set(that,'formData',productInfo);
+                        that.generate();
+                    }
+                    that.getRuleList();
+                    that.init();
+                }).catch(function (res) {
+                    that.showMsg(res.msg);
+                })
+            },
+            /**
+             * 给某个属性添加属性值
+             * @param item
+             * */
+            addDetail: function (item) {
+                if (!item.detailValue) return false;
+                if (item.detail.find(function (val) {
+                    if(item.detailValue == val){
+                        return true;
+                    }
+                })) {
+                    return this.showMsg('添加的属性值重复');
+                }
+                item.detail.push(item.detailValue);
+                item.detailValue = '';
+            },
+            /**
+             * 删除某个属性值
+             * @param item 父级循环集合
+             * @param inx 子集index
+             * */
+            deleteValue: function (item, inx) {
+                if (item.detail.length > 1) {
+                    item.detail.splice(inx, 1);
+                } else {
+                    return this.showMsg('请设置至少一个属性');
+                }
+            },
+            /**
+             * 删除某条属性
+             * @param index
+             * */
+            deleteItem: function (index) {
+                this.formData.items.splice(index, 1);
+            },
+            /**
+             * 删除某条属性
+             * @param index
+             * */
+            deleteAttrs: function (index) {
+                var that = this;
+                if(that.id > 0){
+                    that.requestGet(that.U({c:"store.StoreProduct",a:'check_activity',q:{id:that.id}})).then(function (res) {
+                        that.showMsg(res.msg);
+                    }).catch(function (res) {
+                        if (that.formData.attrs.length > 1) {
+                            that.formData.attrs.splice(index, 1);
+                        } else {
+                            return that.showMsg('请设置至少一个规则');
+                        }
+                    })
+                }else{
+                    if (that.formData.attrs.length > 1) {
+                        that.formData.attrs.splice(index, 1);
+                    } else {
+                        return that.showMsg('请设置至少一个规则');
+                    }
+                }
+            },
+            /**
+             * 创建属性
+             * */
+            createAttrName: function () {
+                if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
+                    if (this.formData.items.find(function (val) {
+                        if (val.value == this.formDynamic.attrsName) {
+                            return true;
+                        }
+                    }.bind(this))) {
+                        return this.showMsg('添加的属性重复');
+                    }
+                    this.formData.items.push({
+                        value: this.formDynamic.attrsName,
+                        detailValue: '',
+                        attrHidden: false,
+                        detail: [this.formDynamic.attrsVal]
+                    });
+                    this.formDynamic.attrsName = '';
+                    this.formDynamic.attrsVal = '';
+                    this.newRule = false;
+                } else {
+                    return this.showMsg('请添加完整的规格!');
+                }
+            },
+            /**
+             * 删除图片
+             * */
+            deleteImage: function (key, index) {
+                var that = this;
+                if (index != undefined) {
+                    that.formData[key].splice(index, 1);
+                    that.$set(that.formData, key, that.formData[key]);
+                } else {
+                    that.$set(that.formData, key, '');
+                }
+            },
+            createFrame: function (title, src, opt) {
+                opt === undefined && (opt = {});
+                var h = 0;
+                if (window.innerHeight < 800 && window.innerHeight >= 700) {
+                    h = window.innerHeight - 50;
+                } else if (window.innerHeight < 900 && window.innerHeight >= 800) {
+                    h = window.innerHeight - 100;
+                } else if (window.innerHeight < 1000 && window.innerHeight >= 900) {
+                    h = window.innerHeight - 150;
+                } else if (window.innerHeight >= 1000) {
+                    h = window.innerHeight - 200;
+                } else {
+                    h = window.innerHeight;
+                }
+                var area = [(opt.w || window.innerWidth / 2) + 'px', (!opt.h || opt.h > h ? h : opt.h) + 'px'];
+                layui.use('layer',function () {
+                    return layer.open({
+                        type: 2,
+                        title: title,
+                        area: area,
+                        fixed: false, //不固定
+                        maxmin: true,
+                        moveOut: false,//true  可以拖出窗外  false 只能在窗内拖
+                        anim: 5,//出场动画 isOutAnim bool 关闭动画
+                        offset: 'auto',//['100px','100px'],//'auto',//初始位置  ['100px','100px'] t[ 上 左]
+                        shade: 0,//遮罩
+                        resize: true,//是否允许拉伸
+                        content: src,//内容
+                        move: '.layui-layer-title'
+                    });
+                });
+            },
+            changeIMG: function (name, value) {
+                if (this.getRule(name).maxLength !== undefined) {
+                    var that = this;
+                    value.map(function (v) {
+                        that.formData[name].push(v);
+                    });
+                    this.$set(this.formData, name, this.formData[name]);
+                } else {
+                    if(name == 'batchAttr.pic'){
+                        this.batchAttr.pic = value;
+                    } else {
+                        if (name.indexOf('.') !== -1) {
+                            var key = name.split('.');
+                            if (key.length == 2){
+                                this.formData[key[0]][key[1]] = value;
+                            } else if(key.length == 3){
+                                this.formData[key[0]][key[1]][key[2]] = value;
+                            } else if(key.length == 4){
+                                this.$set(this.formData[key[0]][key[1]][key[2]],key[3],value)
+                            }
+                        } else {
+                            this.formData[name] = value;
+                        }
+                    }
+                }
+            },
+            getRule: function (name) {
+                return this.rule[name] || {};
+            },
+            uploadImage: function (name) {
+                return this.createFrame('选择图片',this.U({c:"widget.images",a:'index',p:{fodder:name}}),{h:545,w:900});
+            },
+            uploadVideo: function () {
+                if (this.videoLink) {
+                    this.formData.video_link = this.videoLink;
+                } else {
+                    $(this.$refs.filElem).click();
+                }
+            },
+            delVideo: function () {
+                var that = this;
+                that.$set(that.formData, 'video_link', '');
+            },
+            insertEditor: function (list) {
+                this.um.execCommand('insertimage', list);
+            },
+            insertEditorVideo: function (src) {
+                this.um.setContent('<div><video style="width: 99%" src="'+src+'" class="video-ue" controls="controls" width="100"><source src="'+src+'"></source></video></div><br>',true);
+            },
+            getContent: function () {
+                return this.um.getContent();
+            },
+            /**
+             * 监听radio字段
+             */
+            eeventRadio: function () {
+                var that = this;
+                that.radioRule.map(function (val) {
+                    that.form.on('radio(' + val + ')', function (res) {
+                        that.formData[val] = res.value;
+                    });
+                })
+            },
+            init: function () {
+                var that = this;
+                window.UMEDITOR_CONFIG.toolbar = [
+                    // 加入一个 test
+                    'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
+                    'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize',
+                    '| justifyleft justifycenter justifyright justifyjustify |',
+                    'link unlink | emotion selectimgs video  | map',
+                    '| horizontal print preview fullscreen', 'drafts', 'formula'
+                ];
+                UM.registerUI('selectimgs', function (name) {
+                    var me = this;
+                    var $btn = $.eduibutton({
+                        icon: 'image',
+                        click: function () {
+                            that.createFrame('选择图片', "{:Url('widget.images/index',['fodder'=>'editor'])}");
+                        },
+                        title: '选择图片'
+                    });
+
+                    this.addListener('selectionchange', function () {
+                        //切换为不可编辑时,把自己变灰
+                        var state = this.queryCommandState(name);
+                        $btn.edui().disabled(state == -1).active(state == 1)
+                    });
+                    return $btn;
+
+                });
+                UM.registerUI('video', function (name) {
+                    var me = this;
+                    var $btn = $.eduibutton({
+                        icon: 'video',
+                        click: function () {
+                            that.createFrame('选择视频', "{:Url('widget.video/index',['fodder'=>'video'])}");
+                        },
+                        title: '选择视频'
+                    });
+
+                    this.addListener('selectionchange', function () {
+                        //切换为不可编辑时,把自己变灰
+                        var state = this.queryCommandState(name);
+                        $btn.edui().disabled(state == -1).active(state == 1)
+                    });
+                    return $btn;
+
+                });
+                //实例化编辑器
+                this.um = UM.getEditor('myEditor', {initialFrameWidth: '99%', initialFrameHeight: 400});
+                this.um.setContent(that.formData.description);
+                that.$nextTick(function () {
+                    layui.use(['form','element'], function () {
+                        that.form = layui.form;
+                        that.form.render();
+                        that.form.on('select(temp_id)', function (data) {
+                            that.$set(that.formData, 'temp_id', data.value);
+                        });
+                        that.form.on('select(rule_index)', function (data) {
+                            that.ruleIndex = data.value;
+                        });
+                        layui.element.on('tab(docTabBrief)', function(){
+                            that.layTabId = this.getAttribute('lay-id');
+                        });
+                        that.eeventRadio();
+                    });
+                })
+            },
+            requestPost: function (url, data) {
+                return new Promise(function (resolve, reject) {
+                    axios.post(url, data).then(function (res) {
+                        if (res.status == 200 && res.data.code == 200) {
+                            resolve(res.data)
+                        } else {
+                            reject(res.data);
+                        }
+                    }).catch(function (err) {
+                        reject({msg:err})
+                    });
+                })
+            },
+            requestGet: function (url) {
+                return new Promise(function (resolve, reject) {
+                    axios.get(url).then(function (res) {
+                        if (res.status == 200 && res.data.code == 200) {
+                            resolve(res.data)
+                        } else {
+                            reject(res.data);
+                        }
+                    }).catch(function (err) {
+                        reject({msg:err})
+                    });
+                })
+            },
+            generates: function () {
+                var that = this;
+                that.generate(1);
+            },
+            generate: function (type = 0) {
+                var that = this;
+                this.requestPost(that.U({c:"store.StoreProduct",a:'is_format_attr',p:{id:that.id,type:type}}), {attrs:this.formData.items}).then(function (res) {
+                    that.$set(that.formData, 'attrs', res.data.value);
+                    that.$set(that, 'formHeader', res.data.header);
+                    if (that.id && that.formData.is_sub == 1 && that.formData.spec_type == 1) {
+                        that.formHeader.push({title:'一级返佣(元)'});
+                        that.formHeader.push({title:'二级级返佣(元)'});
+                    }
+                }).catch(function (res) {
+                    return that.showMsg(res.msg);
+                });
+            },
+            handleSubmit:function () {
+                var that = this;
+
+                var uid = $('#uid').val();
+                console.log(uid);
+                that.formData.uid = uid;
+                if (!that.formData['uid']){
+                    return that.showMsg('请绑定用户');
+                }
+                if (!that.formData['name']){
+                    return that.showMsg('请填写名称');
+                }
+                if (!that.formData['image']){
+                    return that.showMsg('请上传图片');
+                }
+
+                that.formData.description = that.getContent();
+                that.requestPost(that.U({c:'auction.auction_gu',a:'save',p:{id:that.id}}),that.formData).then(function (res) {
+                    that.confirm();
+                }).catch(function (res) {
+                    that.showMsg(res.msg);
+                });
+
+            },
+            confirm: function(){
+                var that = this;
+                layui.use(['layer'], function () {
+                    var layer = layui.layer;
+                    layer.confirm(that.id ? '修改成功是否返回产品列表' : '添加成功是否返回产品列表', {
+                        btn: ['返回列表',that.id ? '继续修改' : '继续添加'] //按钮
+                    }, function(){
+                        location.href = that.U({c:'auction.auction_gu',a:'index'});
+                    }, function(){
+                        location.reload();
+                    });
+                });
+            },
+            render:function(){
+                this.$nextTick(function(){
+                    layui.use(['form'], function () {
+                        layui.form.render('select');
+                    });
+                })
+            },
+            // 移动
+            handleDragStart (e, item) {
+                this.dragging = item;
+            },
+            handleDragEnd (e, item) {
+                this.dragging = null
+            },
+            handleDragOver (e) {
+                e.dataTransfer.dropEffect = 'move'
+            },
+            handleDragEnter (e, item) {
+                e.dataTransfer.effectAllowed = 'move'
+                if (item === this.dragging) {
+                    return
+                }
+                var newItems = [...this.formData.activity];
+                var src = newItems.indexOf(this.dragging);
+                var dst = newItems.indexOf(item);
+                newItems.splice(dst, 0, ...newItems.splice(src, 1))
+                this.formData.activity = newItems;
+            },
+            getRuleList:function (type) {
+                var that = this;
+                that.requestGet(that.U({c:'store.StoreProduct',a:'get_rule'})).then(function (res) {
+                    that.$set(that,'ruleList',res.data);
+                    if(type !== undefined){
+                        that.render();
+                    }
+                });
+            },
+            addRule:function(){
+                return this.createFrame('添加商品规则',this.U({c:'store.StoreProductRule',a:'create'}));
+            },
+            allRule:function () {
+                if (this.ruleIndex != -1) {
+                    var rule = this.ruleList[this.ruleIndex];
+                    if (rule) {
+                        this.ruleBool = true;
+                        var rule_value = rule.rule_value.map(function (item) {
+                            return item;
+                        });
+                        this.$set(this.formData,'items',rule_value);
+                        this.$set(this.formData,'attrs',[]);
+                        this.$set(this,'formHeader',[]);
+                        return true;
+                    }
+                }
+                this.showMsg('选择的属性无效');
+            }
+        },
+        mounted: function () {
+            var that = this;
+            axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
+            that.getProductInfo();
+            window.$vm = that;
+            window.changeIMG = that.changeIMG;
+            window.insertEditor = that.insertEditor;
+            window.insertEditorVideo = that.insertEditorVideo;
+            window.successFun = function(){
+                that.getRuleList(1);
+            }
+            $(that.$refs.filElem).change(function () {
+                var inputFile = this.files[0];
+                that.requestPost(that.U({c:"widget.video",a:'get_signature'})).then(function (res) {
+                    AdminUpload.upload(res.data.uploadType,{
+                        token: res.data.uploadToken || '',
+                        file: inputFile,
+                        accessKeyId: res.data.accessKey || '',
+                        accessKeySecret: res.data.secretKey || '',
+                        bucketName: res.data.storageName || '',
+                        region: res.data.storageRegion || '',
+                        domain: res.data.domain || '',
+                        uploadIng:function (progress) {
+                            that.upload.videoIng = true;
+                            that.progress = progress;
+                        }
+                    }).then(function (res) {
+                        //成功
+                        that.$set(that.formData, 'video_link', res.url);
+                        that.progress = 0;
+                        that.upload.videoIng = false;
+                        return that.showMsg('上传成功');
+                    }).catch(function (err) {
+                        //失败
+                        console.info(err);
+                        return that.showMsg('上传错误请检查您的配置');
+                    });
+                }).catch(function (res) {
+                    return that.showMsg(res.msg || '获取密钥失败,请检查您的配置');
+                });
+            })
+        }
+    });
+</script>
+</body>
+</html>
+<script>
+    import Layout from "../../../../../public/static/plug/iview/dist/iview";
+    export default {
+        components: {Layout}
+    }
+</script>

+ 812 - 0
app/admin/view/user/user_partake/edit.php

@@ -0,0 +1,812 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link href="{__FRAME_PATH}css/font-awesome.min.css" rel="stylesheet">
+    <link href="{__ADMIN_PATH}plug/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/jquery.min.js"></script>
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/template.min.js"></script>
+    <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.config.js"></script>
+    <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.min.js"></script>
+    <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/lang/zh-cn/zh-cn.js"></script>
+    <link rel="stylesheet" href="/static/plug/layui/css/layui.css">
+    <script src="/static/plug/layui/layui.js"></script>
+    <script src="{__PLUG_PATH}vue/dist/vue.min.js"></script>
+    <script src="/static/plug/axios.min.js"></script>
+    <script src="{__MODULE_PATH}widget/aliyun-oss-sdk-4.4.4.min.js"></script>
+    <script src="{__MODULE_PATH}widget/cos-js-sdk-v5.min.js"></script>
+    <script src="{__MODULE_PATH}widget/qiniu-js-sdk-2.5.5.js"></script>
+    <script src="{__MODULE_PATH}widget/plupload.full.min.js"></script>
+    <script src="{__MODULE_PATH}widget/videoUpload.js"></script>
+    <style>
+        .layui-form-item {
+            margin-bottom: 0px;
+        }
+
+        .pictrueBox {
+            display: inline-block !important;
+        }
+
+        .pictrue {
+            width: 60px;
+            height: 60px;
+            border: 1px dotted rgba(0, 0, 0, 0.1);
+            margin-right: 15px;
+            display: inline-block;
+            position: relative;
+            cursor: pointer;
+        }
+
+        .pictrue img {
+            width: 100%;
+            height: 100%;
+        }
+
+        .upLoad {
+            width: 58px;
+            height: 58px;
+            line-height: 58px;
+            border: 1px dotted rgba(0, 0, 0, 0.1);
+            border-radius: 4px;
+            background: rgba(0, 0, 0, 0.02);
+            cursor: pointer;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+        }
+
+        .rulesBox {
+            display: flex;
+            flex-wrap: wrap;
+            margin-left: 10px;
+        }
+
+        .layui-tab-content {
+            margin-top: 15px;
+        }
+
+        .ml110 {
+            margin: 18px 0 4px 110px;
+        }
+
+        .rules {
+            display: flex;
+        }
+
+        .rules-btn-sm {
+            height: 30px;
+            line-height: 30px;
+            font-size: 12px;
+            width: 109px;
+        }
+
+        .rules-btn-sm input {
+            width: 79% !important;
+            height: 84% !important;
+            padding: 0 10px;
+        }
+
+        .ml10 {
+            margin-left: 10px !important;
+        }
+
+        .ml40 {
+            margin-left: 40px !important;
+        }
+
+        .closes {
+            position: absolute;
+            left: 86%;
+            top: -18%;
+        }
+        .red {
+            color: red;
+        }
+        .layui-input-block .layui-video-box{
+            width: 22%;
+            height: 180px;
+            border-radius: 10px;
+            background-color: #707070;
+            margin-top: 10px;
+            position: relative;
+            overflow: hidden;
+        }
+        .layui-input-block .layui-video-box i{
+            color: #fff;
+            line-height: 180px;
+            margin: 0 auto;
+            width: 50px;
+            height: 50px;
+            display: inherit;
+            font-size: 50px;
+        }
+        .layui-input-block .layui-video-box .mark{
+            position: absolute;
+            width: 100%;
+            height: 30px;
+            top: 0;
+            background-color: rgba(0,0,0,.5);
+            text-align: center;
+        }
+        .store_box{
+            display: flex;
+        }
+        .info{
+            color: #c9c9c9;
+            padding-left: 10px;
+            line-height: 30px;
+        }
+    </style>
+</head>
+<body>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15"  id="app" v-cloak="">
+        <div class="layui-card">
+            <div class="layui-card-header">
+                <span class="">竞拍添加</span>
+                <button style="margin-left: 20px" type="button" class="layui-btn layui-btn-primary layui-btn-xs" @click="goBack">返回列表</button>
+            </div>
+            <div class="layui-card-body">
+                <form class="layui-form" action="" v-cloak="">
+                    <div class="layui-tab layui-tab-brief" lay-filter="docTabBrief">
+                        <div class="layui-tab-content">
+                            <div class="layui-tab-item layui-show">
+                                <div class="layui-row layui-col-space15">
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">会官名称<i class="red">*</i></label>
+                                                <div class="layui-input-block">
+                                                    <input type="text" name="name" lay-verify="title" autocomplete="off"
+                                                           placeholder="场馆名称" class="layui-input" v-model="formData.name" maxlength="100">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                 <label class="layui-form-label">会馆封面图<i class="red">*</i></label>
+                                                <div class="pictrueBox">
+                                                    <div class="pictrue" v-if="formData.image" @click="uploadImage('image')">
+                                                        <img :src="formData.image"></div>
+                                                    <div class="upLoad" @click="uploadImage('image')" v-else>
+                                                        <i class="layui-icon layui-icon-camera" class="iconfont"
+                                                           style="font-size: 26px;"></i>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    {if $admin['roles'] == 1}
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">绑定用户</label>
+                                                <div class="layui-input-inline">
+                                                    <select id="uid" name="uid" lay-verify="title" v-model="formData.uid">
+                                                        {foreach $user as $key=>$vo }
+                                                        <option value="{$vo.uid}">{$vo.nickname}<option>
+                                                            {/foreach}
+                                                    </select>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    {/if}
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item layui-form-text">
+                                                <label class="layui-form-label">会馆简介</label>
+                                                <div class="layui-input-block">
+                                                    <textarea name="info" v-model="formData.info"
+                                                              placeholder="请输入商品简介" class="layui-textarea"></textarea>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-tab-item">
+                                        <div class="layui-row layui-col-space15">
+                                            <textarea type="text/plain" name="description" id="myEditor" style="width:100%;">{{formData.description}}</textarea>
+                                        </div>
+                                    </div>
+                                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                        <div class="grid-demo grid-demo-bg1">
+                                            <div class="layui-form-item">
+                                                <label class="layui-form-label">排序<i class="red">*</i></label>
+                                                <div class="layui-input-inline">
+                                                    <input type="number" name="sort" lay-verify="title" autocomplete="off" class="layui-input" v-model="formData.sort" maxlength="100" value="0">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+
+
+                                </div>
+
+
+                            </div>
+                        <div class="layui-tab-content">
+                            <div class="layui-row layui-col-space15">
+                                <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
+                                    <button class="layui-btn layui-btn-normal layui-btn-sm" id="submit" type="button" @click="handleSubmit()">提交</button>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+
+    var id = {$id};
+    //Demo
+    layui.use('form', function(){
+        var form = layui.form;
+
+        //监听提交
+        form.on('submit(formDemo)', function(data){
+            layer.msg(JSON.stringify(data.field));
+            return false;
+        });
+    });
+
+    new Vue({
+        el: '#app',
+        data: {
+            id:id,
+            //分类列表
+            cateList: [],
+            //运费模板
+            tempList: [],
+            upload:{
+                videoIng:false
+            },
+            formData: {
+                name: '',
+                image:'',
+                sort:'',
+                description: '',
+                info: '',
+                uid:''
+
+            },
+            rule: { //多图选择规则
+                slider_image: {
+                    maxLength: 1
+                }
+            },
+            attr: [],//临时属性
+            newRule: false,//是否添加新规则
+            radioRule: ['status'],//radio 当选规则
+            ruleList:[],
+            ruleIndex:-1,
+            progress: 0,
+            um: null,//编译器实例化
+            form: null,//layui.form
+            layTabId: 1,
+            ruleBool: id ? true : false,
+        },
+        watch:{
+            'formData.is_sub':function (n) {
+                if (n == 1) {
+                    this.formHeader.push({title:'一级返佣(元)'});
+                    this.formHeader.push({title:'二级级返佣(元)'});
+                } else {
+                    this.formHeader.pop();
+                    this.formHeader.pop();
+                }
+            },
+            'formData.spec_type':function (n) {
+                if (n) {
+                    this.render();
+                }
+            },
+            // 'formData.image':function (n) {
+            //     if(!this.batchAttr.pic){
+            //         this.batchAttr.pic = n;
+            //     }
+            //     if(!this.formData.attr.pic){
+            //         this.formData.attr.pic = n;
+            //     }
+            // }
+        },
+        methods: {
+            back:function(){
+                var that = this;
+                layui.use(['element'], function () {
+                    layui.element.tabChange('docTabBrief', that.layTabId == 1 ? 1 : parseInt(that.layTabId) - 1);
+                });
+            },
+            next:function(){
+                var that = this;
+                layui.use(['element'], function () {
+                    layui.element.tabChange('docTabBrief', that.layTabId == 3 ? 3 : parseInt(that.layTabId) + 1);
+                });
+            },
+            goBack:function(){
+                location.href = this.U({c:'auction.auction_gu',a:'index'});
+            },
+            U: function (opt) {
+                var m = opt.m || 'admin', c = opt.c || window.controlle || '', a = opt.a || 'index', q = opt.q || '',
+                    p = opt.p || {};
+                var params = Object. keys(p).map(function (key) {
+                    return key + '/' + p[key];
+                }).join('/');
+                var gets = Object.keys(q).map(function (key) {
+                    return key+'='+ q[key];
+                }).join('&');
+
+                return '/' + m + '/' + c + '/' + a + (params == '' ? '' : '/' + params) + (gets == '' ? '' : '?' + gets);
+            },
+            /**
+             * 提示
+             * */
+            showMsg: function (msg, success) {
+                $('#submit').removeAttr('disabled').text('提交');
+                layui.use(['layer'], function () {
+                    layui.layer.msg(msg, success);
+                });
+            },
+            addBrokerage:function(){
+                if (this.brokerage.brokerage >= 0 && this.brokerage.brokerage_two >= 0){
+                    var that = this;
+                    this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
+                        item.brokerage = that.brokerage.brokerage;
+                        item.brokerage_two = that.brokerage.brokerage_two;
+                        return item;
+                    }));
+                } else {
+                    return this.showMsg('请填写返佣金额在进行批量添加');
+                }
+            },
+            batchClear:function(){
+                this.$set(this,'batchAttr',{
+                    pic: '',
+                    price: 0,
+                    cost: 0,
+                    ot_price: 0,
+                    stock: 0,
+                    bar_code: '',
+                    weight: 0,
+                    volume: 0,
+                });
+            },
+            /**
+             * 批量添加
+             * */
+            batchAdd:function(){
+                var that = this;
+                this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
+                    if (that.batchAttr.pic) {
+                        item.pic = that.batchAttr.pic;
+                    }
+                    if (that.batchAttr.price > 0){
+                        item.price = that.batchAttr.price;
+                    }
+                    if (that.batchAttr.cost > 0){
+                        item.cost = that.batchAttr.cost;
+                    }
+                    if (that.batchAttr.ot_price > 0){
+                        item.ot_price = that.batchAttr.ot_price;
+                    }
+                    if (that.batchAttr.stock > 0){
+                        item.stock = that.batchAttr.stock;
+                    }
+                    if (that.batchAttr.bar_code != ''){
+                        item.bar_code = that.batchAttr.bar_code;
+                    }
+                    if (that.batchAttr.weight > 0){
+                        item.weight = that.batchAttr.weight;
+                    }
+                    if (that.batchAttr.volume > 0){
+                        item.volume = that.batchAttr.volume;
+                    }
+                    return item;
+                }));
+
+            },
+            /**
+             * 获取商品信息
+             * */
+            getProductInfo: function () {
+                var that = this;
+                that.requestGet(that.U({c:"auction.auction_gu",a:'get_auction',q:{id:that.id}})).then(function (res) {
+
+                    var productInfo = res.data.productInfo || {};
+                    if(productInfo.id && that.id){
+                        that.$set(that,'formData',productInfo);
+                        that.generate();
+                    }
+                    that.getRuleList();
+                    that.init();
+                }).catch(function (res) {
+                    that.showMsg(res.msg);
+                })
+            },
+            /**
+             * 给某个属性添加属性值
+             * @param item
+             * */
+            addDetail: function (item) {
+                if (!item.detailValue) return false;
+                if (item.detail.find(function (val) {
+                    if(item.detailValue == val){
+                        return true;
+                    }
+                })) {
+                    return this.showMsg('添加的属性值重复');
+                }
+                item.detail.push(item.detailValue);
+                item.detailValue = '';
+            },
+            /**
+             * 删除某个属性值
+             * @param item 父级循环集合
+             * @param inx 子集index
+             * */
+            deleteValue: function (item, inx) {
+                if (item.detail.length > 1) {
+                    item.detail.splice(inx, 1);
+                } else {
+                    return this.showMsg('请设置至少一个属性');
+                }
+            },
+            /**
+             * 删除某条属性
+             * @param index
+             * */
+            deleteItem: function (index) {
+                this.formData.items.splice(index, 1);
+            },
+            /**
+             * 删除某条属性
+             * @param index
+             * */
+            deleteAttrs: function (index) {
+                var that = this;
+                if(that.id > 0){
+                    that.requestGet(that.U({c:"store.StoreProduct",a:'check_activity',q:{id:that.id}})).then(function (res) {
+                        that.showMsg(res.msg);
+                    }).catch(function (res) {
+                        if (that.formData.attrs.length > 1) {
+                            that.formData.attrs.splice(index, 1);
+                        } else {
+                            return that.showMsg('请设置至少一个规则');
+                        }
+                    })
+                }else{
+                    if (that.formData.attrs.length > 1) {
+                        that.formData.attrs.splice(index, 1);
+                    } else {
+                        return that.showMsg('请设置至少一个规则');
+                    }
+                }
+            },
+            /**
+             * 创建属性
+             * */
+            createAttrName: function () {
+                if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
+                    if (this.formData.items.find(function (val) {
+                        if (val.value == this.formDynamic.attrsName) {
+                            return true;
+                        }
+                    }.bind(this))) {
+                        return this.showMsg('添加的属性重复');
+                    }
+                    this.formData.items.push({
+                        value: this.formDynamic.attrsName,
+                        detailValue: '',
+                        attrHidden: false,
+                        detail: [this.formDynamic.attrsVal]
+                    });
+                    this.formDynamic.attrsName = '';
+                    this.formDynamic.attrsVal = '';
+                    this.newRule = false;
+                } else {
+                    return this.showMsg('请添加完整的规格!');
+                }
+            },
+            /**
+             * 删除图片
+             * */
+            deleteImage: function (key, index) {
+                var that = this;
+                if (index != undefined) {
+                    that.formData[key].splice(index, 1);
+                    that.$set(that.formData, key, that.formData[key]);
+                } else {
+                    that.$set(that.formData, key, '');
+                }
+            },
+            createFrame: function (title, src, opt) {
+                opt === undefined && (opt = {});
+                var h = 0;
+                if (window.innerHeight < 800 && window.innerHeight >= 700) {
+                    h = window.innerHeight - 50;
+                } else if (window.innerHeight < 900 && window.innerHeight >= 800) {
+                    h = window.innerHeight - 100;
+                } else if (window.innerHeight < 1000 && window.innerHeight >= 900) {
+                    h = window.innerHeight - 150;
+                } else if (window.innerHeight >= 1000) {
+                    h = window.innerHeight - 200;
+                } else {
+                    h = window.innerHeight;
+                }
+                var area = [(opt.w || window.innerWidth / 2) + 'px', (!opt.h || opt.h > h ? h : opt.h) + 'px'];
+                layui.use('layer',function () {
+                    return layer.open({
+                        type: 2,
+                        title: title,
+                        area: area,
+                        fixed: false, //不固定
+                        maxmin: true,
+                        moveOut: false,//true  可以拖出窗外  false 只能在窗内拖
+                        anim: 5,//出场动画 isOutAnim bool 关闭动画
+                        offset: 'auto',//['100px','100px'],//'auto',//初始位置  ['100px','100px'] t[ 上 左]
+                        shade: 0,//遮罩
+                        resize: true,//是否允许拉伸
+                        content: src,//内容
+                        move: '.layui-layer-title'
+                    });
+                });
+            },
+            changeIMG: function (name, value) {
+                if (this.getRule(name).maxLength !== undefined) {
+                    var that = this;
+                    value.map(function (v) {
+                        that.formData[name].push(v);
+                    });
+                    this.$set(this.formData, name, this.formData[name]);
+                } else {
+                    if(name == 'batchAttr.pic'){
+                        this.batchAttr.pic = value;
+                    } else {
+                        if (name.indexOf('.') !== -1) {
+                            var key = name.split('.');
+                            if (key.length == 2){
+                                this.formData[key[0]][key[1]] = value;
+                            } else if(key.length == 3){
+                                this.formData[key[0]][key[1]][key[2]] = value;
+                            } else if(key.length == 4){
+                                this.$set(this.formData[key[0]][key[1]][key[2]],key[3],value)
+                            }
+                        } else {
+                            this.formData[name] = value;
+                        }
+                    }
+                }
+            },
+            getRule: function (name) {
+                return this.rule[name] || {};
+            },
+            uploadImage: function (name) {
+                return this.createFrame('选择图片',this.U({c:"widget.images",a:'index',p:{fodder:name}}),{h:545,w:900});
+            },
+            uploadVideo: function () {
+                if (this.videoLink) {
+                    this.formData.video_link = this.videoLink;
+                } else {
+                    $(this.$refs.filElem).click();
+                }
+            },
+            delVideo: function () {
+                var that = this;
+                that.$set(that.formData, 'video_link', '');
+            },
+            insertEditor: function (list) {
+                this.um.execCommand('insertimage', list);
+            },
+            insertEditorVideo: function (src) {
+                this.um.setContent('<div><video style="width: 99%" src="'+src+'" class="video-ue" controls="controls" width="100"><source src="'+src+'"></source></video></div><br>',true);
+            },
+            /**
+             * 监听radio字段
+             */
+            eeventRadio: function () {
+                var that = this;
+                that.radioRule.map(function (val) {
+                    that.form.on('radio(' + val + ')', function (res) {
+                        that.formData[val] = res.value;
+                    });
+                })
+            },
+            init: function () {
+                var that = this;
+                window.UMEDITOR_CONFIG.toolbar = [
+                    // 加入一个 test
+                    'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
+                    'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize',
+                    '| justifyleft justifycenter justifyright justifyjustify |',
+                    'link unlink | emotion selectimgs video  | map',
+                    '| horizontal print preview fullscreen', 'drafts', 'formula'
+                ];
+                UM.registerUI('selectimgs', function (name) {
+                    var me = this;
+                    var $btn = $.eduibutton({
+                        icon: 'image',
+                        click: function () {
+                            that.createFrame('选择图片', "{:Url('widget.images/index',['fodder'=>'editor'])}");
+                        },
+                        title: '选择图片'
+                    });
+
+                    this.addListener('selectionchange', function () {
+                        //切换为不可编辑时,把自己变灰
+                        var state = this.queryCommandState(name);
+                        $btn.edui().disabled(state == -1).active(state == 1)
+                    });
+                    return $btn;
+
+                });
+                UM.registerUI('video', function (name) {
+                    var me = this;
+                    var $btn = $.eduibutton({
+                        icon: 'video',
+                        click: function () {
+                            that.createFrame('选择视频', "{:Url('widget.video/index',['fodder'=>'video'])}");
+                        },
+                        title: '选择视频'
+                    });
+
+                    this.addListener('selectionchange', function () {
+                        //切换为不可编辑时,把自己变灰
+                        var state = this.queryCommandState(name);
+                        $btn.edui().disabled(state == -1).active(state == 1)
+                    });
+                    return $btn;
+
+                });
+                //实例化编辑器
+                this.um = UM.getEditor('myEditor', {initialFrameWidth: '99%', initialFrameHeight: 400});
+                this.um.setContent(that.formData.description);
+                that.$nextTick(function () {
+                    layui.use(['form','element'], function () {
+                        that.form = layui.form;
+                        that.form.render();
+                        that.form.on('select(temp_id)', function (data) {
+                            that.$set(that.formData, 'temp_id', data.value);
+                        });
+                        that.form.on('select(rule_index)', function (data) {
+                            that.ruleIndex = data.value;
+                        });
+                        layui.element.on('tab(docTabBrief)', function(){
+                            that.layTabId = this.getAttribute('lay-id');
+                        });
+                        that.eeventRadio();
+                    });
+                })
+            },
+            requestPost: function (url, data) {
+                return new Promise(function (resolve, reject) {
+                    axios.post(url, data).then(function (res) {
+                        if (res.status == 200 && res.data.code == 200) {
+                            resolve(res.data)
+                        } else {
+                            reject(res.data);
+                        }
+                    }).catch(function (err) {
+                        reject({msg:err})
+                    });
+                })
+            },
+            requestGet: function (url) {
+                return new Promise(function (resolve, reject) {
+                    axios.get(url).then(function (res) {
+                        if (res.status == 200 && res.data.code == 200) {
+                            resolve(res.data)
+                        } else {
+                            reject(res.data);
+                        }
+                    }).catch(function (err) {
+                        reject({msg:err})
+                    });
+                })
+            },
+            generates: function () {
+                var that = this;
+                that.generate(1);
+            },
+            handleSubmit:function () {
+                var that = this;
+                var that = this;
+
+                var uid = $('#uid').val();
+                console.log(uid);
+                that.formData.uid = uid;
+                if (!that.formData['uid']){
+                    return that.showMsg('请绑定用户');
+                }
+                if (!that.formData['name']){
+                    return that.showMsg('请填写名称');
+                }
+                if (!that.formData['image']){
+                    return that.showMsg('请上传图片');
+                }
+
+                $('#submit').attr('disabled', 'disabled').text('修改中...');
+                that.requestPost(that.U({c:'auction.auction_gu',a:'update',p:{id:that.id}}),that.formData).then(function (res) {
+                    that.confirm();
+                }).catch(function (res) {
+                    that.showMsg(res.msg);
+                });
+
+            },
+            confirm: function(){
+                var that = this;
+                layui.use(['layer'], function () {
+                    var layer = layui.layer;
+                    layer.confirm(that.id ? '修改成功是否返回产品列表' : '修改成功是否返回产品列表', {
+                        btn: ['返回列表',that.id ? '继续修改' : '继续修改'] //按钮
+                    }, function(){
+                        location.href = that.U({c:'auction.auction_gu',a:'index'});
+                    }, function(){
+                        location.reload();
+                    });
+                });
+            },
+            render:function(){
+                this.$nextTick(function(){
+                    layui.use(['form'], function () {
+                        layui.form.render('select');
+                    });
+                })
+            },
+            // 移动
+            handleDragStart (e, item) {
+                this.dragging = item;
+            },
+            handleDragEnd (e, item) {
+                this.dragging = null
+            },
+            handleDragOver (e) {
+                e.dataTransfer.dropEffect = 'move'
+            },
+            handleDragEnter (e, item) {
+                e.dataTransfer.effectAllowed = 'move'
+                if (item === this.dragging) {
+                    return
+                }
+                var newItems = [...this.formData.activity];
+                var src = newItems.indexOf(this.dragging);
+                var dst = newItems.indexOf(item);
+                newItems.splice(dst, 0, ...newItems.splice(src, 1))
+                this.formData.activity = newItems;
+            },
+            addRule:function(){
+                return this.createFrame('添加商品规则',this.U({c:'store.StoreProductRule',a:'create'}));
+            },
+            allRule:function () {
+                if (this.ruleIndex != -1) {
+                    var rule = this.ruleList[this.ruleIndex];
+                    if (rule) {
+                        this.ruleBool = true;
+                        var rule_value = rule.rule_value.map(function (item) {
+                            return item;
+                        });
+                        this.$set(this.formData,'items',rule_value);
+                        this.$set(this.formData,'attrs',[]);
+                        this.$set(this,'formHeader',[]);
+                        return true;
+                    }
+                }
+                this.showMsg('选择的属性无效');
+            }
+        },
+        mounted: function () {
+            var that = this;
+            that.getProductInfo();
+            window.changeIMG = that.changeIMG;
+            window.$vm = that;
+        }
+    });
+</script>
+</body>
+</html>
+<script>
+
+</script>

+ 226 - 0
app/admin/view/user/user_partake/index.php

@@ -0,0 +1,226 @@
+{extend name="public/container"}
+{block name="head_top"}
+
+{/block}
+{block name="content"}
+<style>
+    .btn-outline{
+        border:none;
+    }
+    .btn-outline:hover{
+        background-color: #0e9aef;
+        color: #fff;
+    }
+    .layui-form-item .layui-btn {
+        margin-top: 5px;
+        margin-right: 10px;
+    }
+    .layui-btn-primary{
+        margin-right: 10px;
+        margin-left: 0!important;
+    }
+    label{
+        margin-bottom: 0!important;
+        margin-top: 4px;
+    }
+</style>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15" id="app">
+        <!--搜索条件-->
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">搜索条件</div>
+                <div class="layui-card-body">
+                    <div class="layui-carousel layadmin-carousel layadmin-shortcut" lay-anim="" lay-indicator="inside" lay-arrow="none" style="background:none">
+                        <form class="layui-form layui-form-pane" action="">
+                            <div class="layui-form-item">
+
+                                <div class="layui-inline">
+                                    <div class="layui-col-lg12">
+                                        <label class="layui-form-label" style="top: -5.5px;">搜索条件</label>
+                                        <div class="layui-input-inline">
+                                            <input type="text" id="auction" name="name" class="layui-input" placeholder="请输入昵称">
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
+                                    <label class="layui-form-label" style="top: -4.5px">状态</label>
+                                    <div class="layui-input-block">
+                                        <select name="status">
+                                            <option value="">全部</option>
+                                            <option value="1">正常</option>
+                                            <option value="2">待核销</option>
+                                            <option value="3">已核销</option>
+                                            <option value="4">未完成</option>
+                                        </select>
+                                    </div>
+                                </div>
+
+                                <div class="layui-inline">
+                                    <div class="layui-input-inline">
+                                        <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
+                                            <i class="layui-icon layui-icon-search"></i>搜索</button>
+                                    </div>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <!-- 中间详细信息-->
+        <div :class="item.col!=undefined ? 'layui-col-sm'+item.col+' '+'layui-col-md'+item.col:'layui-col-sm6 layui-col-md3'"
+             v-for="item in badge" v-cloak="" v-if="item.count > 0">
+        </div>
+        <!--enb-->
+    </div>
+    <!--列表-->
+    <div class="layui-row layui-col-space15">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">出局奖励列表</div>
+                <div class="layui-card-body">
+                    <div class="layui-btn-container" id="container-action">
+<!--                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:700,w:1100})">添加出局奖励</a>-->
+<!--                        <button class="layui-btn layui-btn-sm" data-type="del_auction">批量删除</button>-->
+                    </div>
+                    <table class="layui-hide" id="List" lay-filter="List"></table>
+
+
+                    <script type="text/html" id="status">
+                        {{# if(d.status == -1){ }}
+                        <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" style="color: red">未完成</button>
+                        {{# } }}
+                        {{# if(d.status == 0){ }}
+                        <button type="button" class="layui-btn layui-btn-primary layui-btn-xs">正常</button>
+                        {{# } }}
+                        {{# if(d.status == 1){ }}
+                        <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" style="color: #00b7ee">待核销</button>
+                        {{# } }}
+                        {{# if(d.status == 2){ }}
+                        <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" style="color: yellowgreen">已核销</button>
+                        {{# } }}
+
+
+                    </script>
+                    <script type="text/html" id="act">
+                        {{# if(d.status == 0){ }}
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-warm" lay-event='hx' id="">
+                            核销
+                        </button>
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-warm" lay-event='wwc' id="">
+                            未完成
+                        </button>
+                        {{# } }}
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">
+                            删除
+                        </button>
+                    </script>
+                </div>
+            </div>
+        </div>
+    </div>
+    <!--end-->
+</div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name="script"}
+<script>
+    layList.form.render();
+    layList.tableList('List', "{:Url('list')}", function () {
+        return [
+            {type: 'checkbox'},
+            {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%', templet: '#id'},
+            {field: 'uid', title: 'UID', align: 'center'},
+            {field: 'nickname', title: '用户昵称', align: 'center'},
+            {field: 'name', title: '出局名称', align: 'center'},
+            {field: 'status', title: '状态', templet: '#status', align: 'center'},
+            {field: 'money', title: '累计金额', align: 'center'},
+            {field: 'create_time', title: '参与时间', align: 'center'},
+            {field: 'right', title: '操作', align: 'center', toolbar: '#act'},
+        ];
+    });
+
+    //查询
+    layList.search('search',function(where){
+        layList.reload(where,true);
+    });
+
+    //点击事件绑定
+    layList.tool(function (event,data,obj) {
+        switch (event) {
+            case 'hx':
+                var url=layList.U({c:'user.user_partake',a:'set_status',q:{id:data.id,status:2}});
+                var code = {title:"操作提示",text:"确定核销吗?",type:'info',confirm:'是的'};
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            location.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },code)
+                break;
+            case 'wwc':
+                var url=layList.U({c:'user.user_partake',a:'set_status',q:{id:data.id,status:-1}});
+                var code = {title:"操作提示",text:"确定未完成吗?",type:'info',confirm:'是的'};
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            location.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },code)
+                break;
+            case 'delete':
+                var url=layList.U({c:'user.user_partake',a:'delete',q:{id:data.id}});
+                var code = {title:"操作提示",text:"确定将移入回收站吗?",type:'info',confirm:'是的,移入回收站'};
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            obj.del();
+                            location.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },code)
+                break;
+            case 'open_image':
+                $eb.openImage(data.image);
+                break;
+            case 'edit':
+                location.href = layList.U({a:'edit',q:{id:data.id}});
+                break;
+        }
+    })
+
+
+    //改状态
+    layList.switch('status',function (odj,value) {
+        if(odj.elem.checked==true){
+            layList.baseGet(layList.Url({c:'user.out',a:'set_status',p:{status:1,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }else{
+            layList.baseGet(layList.Url({c:'user.out',a:'set_status',p:{status:0,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }
+    });
+</script>
+{/block}

+ 99 - 0
app/api/controller/user/UserPartakeController.php

@@ -0,0 +1,99 @@
+<?php
+
+namespace app\api\controller\user;
+
+use app\models\system\SystemGroupData;
+use app\models\user\Out;
+use app\models\user\User;
+use app\models\user\UserPartake;
+use app\Request;
+use crmeb\services\GroupDataService;
+use crmeb\services\SystemConfigService;
+use crmeb\services\UtilService;
+use think\facade\Db;
+
+class UserPartakeController
+{
+    /**
+     * 出局奖励列表
+     * @return void
+     */
+    public function out_list(Request $request)
+    {
+        $list = Out::where('status', 1)->order('id DESC')->select()->toArray();
+
+        return app('json')->success($list);
+    }
+
+    /**
+     * 参加
+     * @return void
+     */
+    public function participate_in(Request $request)
+    {
+        $data = UtilService::postMore([
+            'out_id'
+        ]);
+        Db::startTrans();
+        $user = User::where('uid', $request->uid())->find();
+        if ($user['level'] < 2) return app('json')->fail('等级为团队合伙人才能参与');
+
+        $out = Out::where('id', $data['out_id'])->find();
+        if (empty($out)) return app('json')->fail('参与项目不存在');
+        if ($out['status'] == 0) return app('json')->fail('参与项目已关闭');
+
+        $partake = UserPartake::where('uid', $request->uid())->where('status', 0)->find();
+        if ($partake) return app('json')->fail('当前已有参与中项目,无法参加');
+
+        $res = UserPartake::create([
+            'uid' => $request->uid(),
+            'out_id' => $data['out_id'],
+        ]);
+        if ($res) {
+            Db::commit();
+            return app('json')->success('参与成功');
+        }else{
+            Db::rollback();
+            return app('json')->fail('参与失败');
+        }
+
+    }
+
+
+    /**
+     * 参与记录
+     * @param Request $request
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function partake(Request $request)
+    {
+        $where = UtilService::getMore([
+            ['page', 1],
+            ['limit', 20],
+        ]);
+
+        $data = UserPartake::alias('a')
+            ->field('a.*,c.name')
+            ->order('a.id DESC')
+            ->leftJoin('out c', 'c.id = a.out_id')
+            ->where('uid', $request->uid())
+            ->page($where['page'], $where['limit'])
+            ->select();
+        $data = count($data) ? $data->toArray() : [];
+        foreach ($data as &$item)
+        {
+            if ($item['money'] == 0){
+                $item['money'] = User::where('uid', $item['uid'])->find()['pay_price'];
+            }
+        }
+        return app('json')->success($data);
+
+    }
+
+
+
+
+}

+ 17 - 0
app/common.php

@@ -606,3 +606,20 @@ if (!function_exists('pr')) {
 
     }
 }
+
+if (!function_exists('getParents')){
+    //获取指定级别的所有上级
+    function getParents($p_id,$array) {
+        $subs=array();
+        foreach($array as $item){
+            if($item['uid'] == $p_id){
+                $subs[]=$item['uid'];//这里自己看着办,我是获取用户名
+                $subs=array_merge($subs,getParents($item['spread_uid'],$array));
+            }
+
+        }
+        return $subs;
+    }
+}
+
+

+ 90 - 13
app/models/store/StoreOrder.php

@@ -18,7 +18,7 @@ use crmeb\traits\ModelTrait;
 use think\facade\Log;
 use app\models\system\SystemStore;
 use app\models\routine\RoutineTemplate;
-use app\models\user\{ProxyAddress, User, UserAddress, UserBill, UserSpread, WechatUser};
+use app\models\user\{Out, ProxyAddress, User, UserAddress, UserBill, UserPartake, UserSpread, WechatUser};
 use crmeb\services\{
     SystemConfigService, WechatTemplateService, workerman\ChannelService
 };
@@ -926,19 +926,11 @@ class StoreOrder extends BaseModel
                 self::rollbackTrans();
                 return self::setErrorInfo($e->getMessage());
             }
-            $address = explode(' ', $order['user_address']);
-            $proxy = ProxyAddress::where(['province' => $address[0], 'city' => $address[1], 'district' => $address[2]])->select()->toArray();
-            foreach ($proxy as $item)
-            {
-                $user = User::where('uid', $item['uid'])->find();
-                if ($user['level'] == 3){
-                    $to_ground = sys_config('to_ground');
-                    $jl = $order['pay_price'] * ($to_ground/100);
-                    UserBill::income('佣金', $user['uid'], 'now_money', 'brokerage', $jl, '', $user['brokerage_price']+$jl, '落地奖励佣金');
-                    User::where('uid', $user['uid'])->inc('brokerage_price', $jl)->update();
-                }
 
-            }
+            self::cumulative($order);
+            self::team($order);
+            self::proxy($order);
+
             self::commitTrans();
             event('UserLevelAfter', [User::get($uni)]);
             event('UserOrderTake', $uni);
@@ -951,6 +943,91 @@ class StoreOrder extends BaseModel
         }
     }
 
+    /**
+     * 参与累计金额
+     * @param $order
+     * @return void
+     */
+    public static function cumulative($order)
+    {
+        User::where('uid', $order['uid'])->inc('pay_price', $order['pay_price'])->update();
+        $user = User::where('uid', $order['uid'])->find();
+        $partake = UserPartake::where('uid', $order['uid'])->where('status', 0)->find();
+        if ($partake){
+            $out = Out::where('id', $partake['out_id'])->find();
+            if ($user['pay_price'] >= $out['number']){
+                $user['pay_price'] -= $out['number'];
+                $user['use_price'] += $out['number'];
+                $user->save();
+                $partake['status'] = 1;
+                $partake['money'] = $out['number'];
+                $partake->save();
+            }
+        }
+    }
+
+    /**
+     * 发放团队奖励
+     * @param $order
+     * @return void
+     */
+    public static function team($order)
+    {
+        $user = User::where('uid', $order['uid'])->find();
+        $uids = getParents($user['spread_uid'],User::select());
+        if ($uids){
+            $v1 = 0;//团队
+            $v2 = 0;//联创
+            $city = sys_config('city')/100;//城市比列
+            $lianchuang = sys_config('lianchuang')/100;//联创比列
+            foreach ($uids as $item)
+            {
+                $spread = User::where('uid', $item)->find();
+                if ($spread['level'] == 3){
+                    if ($v1 == 0){
+                        $jl = $order['pay_price'] * $city;
+                        UserBill::income('佣金', $spread['uid'], 'now_money', 'brokerage', $jl, '', $spread['brokerage_price']+$jl, '下级消费'.$order['pay_price'].'城市合伙人团队佣金');
+                        User::where('uid', $spread['uid'])->inc('brokerage_price', $jl)->update();
+                        $v1++;
+                    }
+                }
+
+                if ($spread['level'] == 4){
+                    if ($v2 == 0){
+                        $jl = $order['pay_price'] * $lianchuang;
+                        UserBill::income('佣金', $spread['uid'], 'now_money', 'brokerage', $jl, '', $spread['brokerage_price']+$jl, '下级消费'.$order['pay_price'].'联创团队佣金');
+                        User::where('uid', $spread['uid'])->inc('brokerage_price', $jl)->update();
+                        $v2++;
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 发放落地奖励
+     * @param $order
+     * @param $uid
+     * @return void
+     */
+    public static function proxy($order)
+    {
+        $address = explode(' ', $order['user_address']);
+        $proxy = ProxyAddress::where(['province' => $address[0], 'city' => $address[1], 'district' => $address[2]])->select()->toArray();
+        foreach ($proxy as $item)
+        {
+            $user = User::where('uid', $item['uid'])->find();
+            if ($user['level'] == 3){
+                $to_ground = sys_config('to_ground');
+                $jl = $order['pay_price'] * ($to_ground/100);
+                UserBill::income('佣金', $user['uid'], 'now_money', 'brokerage', $jl, '', $user['brokerage_price']+$jl, '落地奖励佣金');
+                User::where('uid', $user['uid'])->inc('brokerage_price', $jl)->update();
+            }
+
+        }
+    }
+
     /**
      * 获取订单状态购物车等信息
      * @param $order

+ 15 - 0
app/models/user/Out.php

@@ -0,0 +1,15 @@
+<?php
+
+
+namespace app\models\user;
+
+
+use think\Model;
+
+class Out extends Model
+{
+    protected $name = 'out';
+
+
+    protected $autoWriteTimestamp = true;
+}

+ 42 - 0
app/models/user/UserPartake.php

@@ -0,0 +1,42 @@
+<?php
+
+
+namespace app\models\user;
+
+
+use think\Model;
+
+class UserPartake extends Model
+{
+    protected $name = 'user_partake';
+
+
+    protected $autoWriteTimestamp = true;
+
+    /**
+     * 参与累计金额
+     * @param $order
+     * @return void
+     */
+    public static function cumulative()
+    {
+        $user = User::select();
+        foreach ($user as $item){
+            $partake = UserPartake::where('uid', $item['uid'])->where('status', 0)->find();
+            if ($partake){
+                $out = Out::where('id', $partake['out_id'])->find();
+                if ($item['pay_price'] >= $out['number']){
+                    User::where('uid', $item['uid'])->dec('pay_price', $out['number'])->update();
+                    User::where('uid', $item['uid'])->inc('use_price', $out['number'])->update();
+                    $partake['status'] = 1;
+                    $partake['money'] = $out['number'];
+                    $partake->save();
+                }
+            }
+        }
+
+
+    }
+
+
+}

+ 9 - 0
crmeb/subscribes/TaskSubscribe.php

@@ -6,6 +6,7 @@ use app\admin\model\system\SystemAttachment;
 use app\models\store\StoreBargainUser;
 use app\models\store\StoreOrder;
 use app\models\store\StorePink;
+use app\models\user\UserPartake;
 use app\models\user\UserToken;
 use think\facade\Db;
 
@@ -75,6 +76,14 @@ class TaskSubscribe
         } catch (\Exception $e) {
             Db::rollback();
         }
+
+        try {
+            Db::startTrans();
+            UserPartake::cumulative();//出局计算
+            Db::commit();
+        } catch (\Exception $e) {
+            Db::rollback();
+        }
     }
 
     /**

+ 5 - 0
route/api/route.php

@@ -164,6 +164,11 @@ Route::group(function () {
     Route::get('user/level/task/:id', 'user.UserLevelController/task')->name('userLevelTask');//获取等级任务
     //首页获取未支付订单
     Route::get('order/nopay', 'order.StoreOrderController/get_noPay')->name('getNoPay');//获取未支付订单
+
+    //出局奖励
+    Route::get('partake/out', 'user.UserPartakeController/out_list')->name('outList');//出局奖励列表
+    Route::post('partake/participate_in', 'user.UserPartakeController/participate_in')->name('participate_in');//参与
+    Route::get('partake/partake', 'user.UserPartakeController/partake')->name('partake');//参与记录
 })->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\http\middleware\AuthTokenMiddleware::class, true);
 //未授权接口
 Route::group(function () {