Browse Source

后台充值配置赠送礼物,套餐赠送礼物

lizhen_gitee 1 year ago
parent
commit
a5bbbc4e4f

+ 1 - 1
application/admin/controller/Coupons.php

@@ -44,7 +44,7 @@ class Coupons extends Backend
         if ($this->request->isAjax()) {
             //如果发送的来源是Selectpage,则转发到Selectpage
             if ($this->request->request('keyField')) {
-                return $this->company_selectpage();
+                return $this->selectpage();
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 

+ 7 - 4
application/admin/controller/Packagegift.php

@@ -24,6 +24,12 @@ class Packagegift extends Backend
         parent::_initialize();
         $this->model = new \app\admin\model\Packagegift;
 
+        $package_id = input('package_id',0);
+        $company_id = input('company_id',0);
+        $this->assign('package_id',$package_id);
+        $this->assign('company_id',$company_id);
+        $this->assignconfig('package_id',$package_id);
+        $this->assignconfig('company_id',$company_id);
     }
 
 
@@ -44,8 +50,7 @@ class Packagegift extends Backend
         $this->relationSearch = true;
         //设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
-        $package_id = input('package_id',0);
-        $this->assignconfig('package_id',$package_id);
+
         if ($this->request->isAjax()) {
             //如果发送的来源是Selectpage,则转发到Selectpage
             if ($this->request->request('keyField')) {
@@ -80,10 +85,8 @@ class Packagegift extends Backend
      */
     public function add()
     {
-        $package_id = input('package_id',0);
 
         if (false === $this->request->isPost()) {
-            $this->assign('package_id',$package_id);
             return $this->view->fetch();
         }
         $params = $this->request->post('row/a');

+ 9 - 5
application/admin/controller/RechargeGift.php

@@ -23,6 +23,13 @@ class RechargeGift extends Backend
         parent::_initialize();
         $this->model = new \app\admin\model\RechargeGift;
 
+
+        $config_id  = input('config_id',0);
+        $company_id = input('company_id',0);
+        $this->assign('config_id',$config_id);
+        $this->assign('company_id',$company_id);
+        $this->assignconfig('config_id',$config_id);
+        $this->assignconfig('company_id',$company_id);
     }
 
 
@@ -44,8 +51,6 @@ class RechargeGift extends Backend
         //设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
 
-        $config_id = input('config_id',0);
-        $this->assignconfig('config_id',$config_id);
 
         if ($this->request->isAjax()) {
             //如果发送的来源是Selectpage,则转发到Selectpage
@@ -57,7 +62,6 @@ class RechargeGift extends Backend
             $list = $this->model
                     ->with(['coupons'])
                     ->where($where)
-                    //->where('recharge_gift.config_id',$config_id)
                     ->order($sort, $order)
                     ->paginate($limit);
 
@@ -81,10 +85,10 @@ class RechargeGift extends Backend
      */
     public function add()
     {
-        $config_id = input('config_id',0);
+
 
         if (false === $this->request->isPost()) {
-            $this->assign('config_id',$config_id);
+
             return $this->view->fetch();
         }
         $params = $this->request->post('row/a');

+ 1 - 1
application/admin/view/recharge_gift/add.html

@@ -10,7 +10,7 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Number')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-number" class="form-control" name="row[number]" type="number">
+            <input id="c-number" data-rule="required" class="form-control" name="row[number]" type="number" value="0">
         </div>
     </div>
     <div class="form-group layer-footer">

+ 1 - 1
application/admin/view/recharge_gift/edit.html

@@ -10,7 +10,7 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Number')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-number" class="form-control" name="row[number]" type="number" value="{$row.number|htmlentities}">
+            <input id="c-number" data-rule="required" class="form-control" name="row[number]" type="number" value="{$row.number|htmlentities}">
         </div>
     </div>
     <div class="form-group layer-footer">

+ 1 - 1
application/api/controller/company/Coupon.php

@@ -222,7 +222,7 @@ class Coupon extends Apic
         }
 
 
-        $rs = Db::name('order')->where($map)->update(['status'=>2,'hexiao_time'=>time()]);
+        $rs = Db::name('order')->where($map)->update(['status'=>2,'hexiao_time'=>time(),'staff_id'=>$this->auth->id]);
         if($rs === false){
             Db::rollback();
             $this->error('核销失败');

+ 2 - 2
application/api/controller/company/User.php

@@ -197,9 +197,9 @@ class User extends Apic
                 if (!$companyRes) {
                     throw new Exception('更新门店信息失败');
                 }
-                $miniCode = $httpStr.$fileUrl;
+                $miniCode = $httpStr.$fileUrl.'?v='.time();
             } else {
-                $miniCode = $httpStr.$company['mini_code'];
+                $miniCode = $httpStr.$company['mini_code'].'?v='.time();
             }
             $result = [
                 'mini_code' => $miniCode,

+ 3 - 1
public/assets/js/backend/package.js

@@ -52,7 +52,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     text: '赠送列表',
                                     title: '赠送列表',
                                     classname: 'btn btn-xs btn-primary btn-dialog',
-                                    url:'packagegift/index/package_id/{ids}?dialog=1',
+                                    url:function(row){
+                                        return 'packagegift/index/package_id/'+ row.id +'/company_id/'+ row.company_id +'?dialog=1';
+                                    },
                                     icon: 'fa fa-list',
                                     target: '_self',
                                     extend: 'data-area=["90%","90%"]',

+ 8 - 11
public/assets/js/backend/packagegift.js

@@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.init({
                 extend: {
                     index_url: 'packagegift/index/package_id/' + Config.package_id + location.search,
-                    add_url: 'packagegift/add/package_id/' + Config.package_id,
-                    edit_url: 'packagegift/edit',
+                    add_url:  'packagegift/add/package_id/' + Config.package_id + '/company_id/' + Config.company_id,
+                    edit_url: 'packagegift/edit/package_id/'+ Config.package_id + '/company_id/' + Config.company_id,
                     del_url: 'packagegift/del',
                     multi_url: 'packagegift/multi',
                     import_url: 'packagegift/import',
@@ -47,18 +47,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         },
         api: {
             bindevent: function () {
-                $("#c-company_id").data("params",function(){
-                    return {custom:{status:1}};
-                });
-                $("#c-package_id").data("params",function(){
-                    return {custom:{company_id:$('#c-company_id').val(),status:1}};
-                });
-                $("#c-coupon_id").data("params",function(){
-                    return {custom:{company_id:$('#c-company_id').val(),status:1}};
-                });
                 Form.api.bindevent($("form[role=form]"));
             }
         }
     };
     return Controller;
 });
+$("#c-coupon_id").data("params", function (obj) {
+    return {
+        custom: {company_id: Config.company_id}
+    };
+});
+

+ 3 - 1
public/assets/js/backend/recharge_config.js

@@ -39,7 +39,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     text: '赠送列表',
                                     title: '赠送列表',
                                     classname: 'btn btn-xs btn-primary btn-dialog',
-                                    url:'recharge_gift/index/config_id/{ids}?dialog=1',
+                                    url:function(row){
+                                        return 'recharge_gift/index/config_id/'+ row.id +'/company_id/'+ row.company_id +'?dialog=1';
+                                    },
                                     icon: 'fa fa-list',
                                     target: '_self',
                                     extend: 'data-area=["90%","90%"]',

+ 7 - 2
public/assets/js/backend/recharge_gift.js

@@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.init({
                 extend: {
                     index_url: 'recharge_gift/index/config_id/' + Config.config_id + location.search,
-                    add_url: 'recharge_gift/add/config_id/'+ Config.config_id,
-                    edit_url: 'recharge_gift/edit',
+                    add_url:  'recharge_gift/add/config_id/' + Config.config_id + '/company_id/' + Config.company_id,
+                    edit_url: 'recharge_gift/edit/config_id/'+ Config.config_id + '/company_id/' + Config.company_id,
                     del_url: 'recharge_gift/del',
                     multi_url: 'recharge_gift/multi',
                     import_url: 'recharge_gift/import',
@@ -55,3 +55,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
     };
     return Controller;
 });
+$("#c-coupon_id").data("params", function (obj) {
+    return {
+        custom: {company_id: Config.company_id}
+    };
+});