wupengfei 2 年 前
コミット
da906bd5c7

+ 76 - 0
application/store/controller/Convert.php

@@ -0,0 +1,76 @@
+<?php
+
+
+namespace app\store\controller;
+use library\Controller;
+use think\Db;
+
+
+/**
+ * 积分兑换
+ * Class Order
+ * @package app\store\controller
+ */
+class Convert  extends  Controller
+{
+    protected  $table = "IntegralConvert";
+
+    /**
+     * 订单列表
+     * @auth true
+     * @menu true
+     */
+    public function index()
+    {
+        $this->title = '列表';
+        $this->sh_status_desc = ['待审核','审核通过','审核拒绝'];
+        $query = $this->_query($this->table);
+        if($this->request->request('phone'))      $where[]= ['m.phone','like','%'.$this->request->request('phone').'%'];;
+        $this->sh_status = $this->request->request('sh_status',-1);
+        if($this->sh_status > -1 ) $where[]= ['o.sh_status','=',$this->request->request('sh_status')];
+        $query->alias('o')
+            ->field('o.* ,m.headimg,m.name,m.phone')
+            ->join('store_member m',' m.id = o.user_id  ','LEFT');
+        if(!empty($where)) $query->where($where);
+        $query ->order('o.sh_status asc ,o.id desc')->page();
+    }
+
+
+    /**
+     * 订单审核
+     * @auth true
+     * @menu true
+     */
+    public function audit()
+    {
+        $this->title = '审核';
+        $this->_form($this->table, 'form');
+    }
+
+
+    protected function _form_filter(&$data)
+    {
+        //  查看
+        if($this->request->isGet() && $this->request->action() == 'audit')
+        {
+            $this->user = Db::table('store_member')
+                ->field('headimg,name,phone')
+                ->find($data['user_id']);
+        }
+        // 积分赠送integral_info
+        if($this->request->isPost() && $this->request->action() == 'audit') {
+            $ck = Db::table('order_shift')->find($data['id']);
+            if($ck['sh_status'] != 1 &&  $data['sh_status'] == 1  && $data['integral'] > 0 && $data['user_id']) {
+                update_user_integral($data['user_id'],$data['integral'],10,'恭喜亲通过兑换获得'.$data['integral'].'积分',$data['id']);
+            }
+            if($ck['sh_status'] != 1 &&  $data['sh_status'] == 1  && $data['growth'] > 0 && $data['user_id']) {
+                update_user_growth($data['user_id'],$data['growth'],10,'恭喜亲通过兑换获得'.$data['growth'].'成长值',$data['id']);
+
+            }
+            $data['ck_time'] = date("Y-m-d H:i:s");
+        }
+
+    }
+
+
+}

+ 69 - 0
application/store/view/convert/form.html

@@ -0,0 +1,69 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body">
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">用户名:</label>
+            <label class="layui-col-xs10">
+                <input  style="background-color: #e6e6e6" readonly value='{$user.name|default=""}' placeholder="" class="layui-input">
+            </label>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">手机号:</label>
+            <label class="layui-col-xs10">
+                <input style="background-color: #e6e6e6" readonly value='{$user.phone|default=""}' placeholder="" class="layui-input">
+            </label>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">审核</label>
+            <div class="layui-input-inline">
+                <select name="sh_status" >
+                    <option value="0" {if $vo.sh_status eq 0}selected {/if} >暂不审核</option>
+                    <option value="1"  {if $vo.sh_status eq 1}selected {/if} >审核通过</option>
+                    <option value="2"  {if $vo.sh_status eq 2}selected {/if} >审核拒绝</option>
+                </select>
+            </div>
+        </div>
+
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">审核备注</label>
+            <div class="layui-input-inline" style="width: 80%">
+                <input  value='{$vo.desc|default=""}' placeholder="" class="layui-input">
+            </div>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">积分数</label>
+            <label class="layui-col-xs10">
+                <input name="integral"  type="number" step="1" value='{$vo.integral|default="0"}' placeholder="请输入积分" class="layui-input">
+            </label>
+        </div>
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">成长值</label>
+            <label class="layui-col-xs10">
+                <input name="growth"   type="number" step="1" value='{$vo.growth|default="0"}' placeholder="请输入成长值" class="layui-input">
+            </label>
+        </div>
+
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center">
+        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+        <input type='hidden' value='{$vo.uid}' name='uid'>
+        {if $vo.sh_status == 0}
+            <button class="layui-btn" type='submit'>确定审核</button>
+            <button class="layui-btn layui-btn-danger" type='button' data-close>取消审核</button>
+        {else}
+            <button class="layui-btn layui-btn-danger" type='button' data-close>关闭</button>
+        {/if}
+
+    </div>
+</form>
+<script>
+    window.form.render();
+</script>

+ 59 - 0
application/store/view/convert/index.html

@@ -0,0 +1,59 @@
+{extend name='admin@main'}
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='order_shift/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='text-left nowrap'>用户信息</th>
+            <th class='text-left nowrap'>标题</th>
+            <th class='text-left nowrap'>截图</th>
+            <th class='text-left nowrap'>积分/成长值</th>
+            <th class='text-left nowrap'>状态</th>
+            <th class="text-center nowrap">添加时间</th>
+            <th class="text-center nowrap">操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>
+                <img data-tips-image style="width:50px;height:50px" src="{$vo.headimg|default=''}" class="margin-right-5 text-top">
+                <div class="inline-block">
+                    用户ID:{$vo.user_id|default='--'}<br>
+                    手机号:{$vo.phone|default='--'}<br>
+                    用户昵称:{$vo.name|default='--'}
+                </div>
+            </td>
+            <td class='text-left nowrap'>{$vo.title|default='--'}</td>
+            <td class='text-left nowrap'>
+                <img data-tips-image style="width:50px;height:50px" src="{$vo.image|default=''}" class="margin-right-5 text-top">
+            </td>
+            <td class='text-left nowrap'>
+                <div class="inline-block">
+                    积分:{$vo.integral|default='--'}<br>
+                    成长值:{$vo.growth|default='--'}
+                </div>
+            </td>
+            <td class='text-center nowrap'>
+                {eq name='vo.sh_status' value='0'}<span class="layui-badge layui-bg-orange margin-left-5">待审核</span>{/eq}
+                {eq name='vo.sh_status' value='1'}<span class="layui-badge layui-bg-green margin-left-5">审核通过</span>{/eq}
+                {eq name='vo.sh_status' value='2'}<span class="layui-badge layui-bg-black margin-left-5">审核拒绝</span>{/eq}
+            </td>
+            <td class='text-center nowrap'>{$vo.create_at}</td>
+            <td class='text-center nowrap'>
+                {if $vo['sh_status']}
+                    <a data-title="审核" class="layui-btn layui-btn-sm" data-modal='{:url("audit")}?id={$vo.id}'>查看</a>
+                {else}
+                    <a data-title="审核" class="layui-btn layui-btn-sm layui-btn-warm" data-modal='{:url("audit")}?id={$vo.id}'>审核</a>
+                {/if}
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+{/block}

+ 38 - 0
application/store/view/convert/index_search.html

@@ -0,0 +1,38 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">订单号</label>
+            <div class="layui-input-inline">
+                <input name="order_no" value="{$Think.get.order_no|default=''}" placeholder="请输入订单号" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">手机号</label>
+            <div class="layui-input-inline">
+                <input name="phone" value="{$Think.get.phone|default=''}" placeholder="请输入手机号" class="layui-input">
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">审核状态</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="sh_status">
+                    {foreach ['-1'=>'- 全部状态 -','0'=>'待审核','1'=>'审核通过','2'=>'审核拒绝'] as $k=>$v}
+                    {if $sh_status eq $k}
+                    <option selected value="{$k}">{$v}</option>
+                    {else}
+                    <option  value="{$k}">{$v}</option>
+                    {/if}
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>