Kirin il y a 3 ans
Parent
commit
162e5a64ff

+ 68 - 1
app/admin/controller/system/SystemStore.php

@@ -227,8 +227,75 @@ class SystemStore extends AuthController
     {
     {
         $store = SystemStoreApply::get($id);
         $store = SystemStoreApply::get($id);
         $users = User::field('uid,nickname,phone')->select();
         $users = User::field('uid,nickname,phone')->select();
-        $this->assign(compact('store','users'));
+        $this->assign(compact('store', 'users'));
 
 
         return $this->fetch();
         return $this->fetch();
     }
     }
+
+
+    /**
+     * 保存修改门店信息
+     * @param int $id
+     */
+    public function save_check_apply($id = 0)
+    {
+        $data = UtilService::postMore([
+            ['name', ''],
+            ['introduction', ''],
+            ['image', ''],
+            ['phone', ''],
+            ['address', ''],
+            ['detailed_address', ''],
+            ['latlng', ''],
+            ['uid', 0],
+            ['spread_uid', 0],
+            ['cert', ''],
+            ['leader', ''],
+            ['id_card', ''],
+            ['status', 0],
+            ['reason', 0],
+        ]);
+        SystemStoreApply::beginTrans();
+        try {
+            $data['address'] = implode(',', $data['address']);
+            $data['latlng'] = is_string($data['latlng']) ? explode(',', $data['latlng']) : $data['latlng'];
+            if (!isset($data['latlng'][0]) || !isset($data['latlng'][1])) return JsonService::fail('请选择门店位置');
+            $data['latitude'] = $data['latlng'][0];
+            $data['longitude'] = $data['latlng'][1];
+            unset($data['latlng']);
+            if ($data['image'] && strstr($data['image'], 'http') === false) {
+                $site_url = sys_config('site_url');
+                $data['image'] = $site_url . $data['image'];
+            }
+            if ($data['cert'] && strstr($data['cert'], 'http') === false) {
+                $site_url = sys_config('site_url');
+                $data['cert'] = $site_url . $data['cert'];
+            }
+            if (SystemStoreApply::where('id', $id)->update($data)) {
+                if ($data['status'] == 1) {
+                    $store_date = $data;
+                    $store_date['admin_id'] = $this->adminId;
+                    $store_date['is_triple'] = 1;
+                    $store_date['day_time'] = '00:00:00 - 23:59:59';
+                    $store_date['add_time'] = time();
+                    $store_date['is_show'] = 1;
+                    if ($res = SystemStoreModel::create($data)) {
+                        SystemStoreApply::commitTrans();
+                        return JsonService::success('审核成功', ['id' => $res->id]);
+                    } else {
+                        SystemStoreApply::rollbackTrans();
+                        return JsonService::fail('审核失败!');
+                    }
+                }
+                SystemStoreApply::commitTrans();
+                return JsonService::success('审核成功');
+            } else {
+                SystemStoreApply::rollbackTrans();
+                return JsonService::fail('修改失败或者您没有修改什么!');
+            }
+        } catch (\Exception $e) {
+            SystemStoreApply::rollbackTrans();
+            return JsonService::fail($e->getMessage());
+        }
+    }
 }
 }

+ 12 - 5
app/admin/view/system/system_store/check_apply.php

@@ -211,8 +211,16 @@
 <script src="{__ADMIN_PATH}js/layuiList.js"></script>
 <script src="{__ADMIN_PATH}js/layuiList.js"></script>
 
 
 <script>
 <script>
-    var storeData = {:json_encode($store)};
-    var userData = {:json_encode($users)};
+    var storeData = {
+    :
+    json_encode($store)
+    }
+    ;
+    var userData = {
+    :
+    json_encode($users)
+    }
+    ;
     mpFrame.start(function (Vue) {
     mpFrame.start(function (Vue) {
         $.each(city, function (key, item) {
         $.each(city, function (key, item) {
             city[key].value = item.label;
             city[key].value = item.label;
@@ -305,13 +313,12 @@
                     if (!that.form.address) return $eb.message('error', '请选择门店地址');
                     if (!that.form.address) return $eb.message('error', '请选择门店地址');
                     if (!that.form.detailed_address) return $eb.message('error', '请填写门店详细地址');
                     if (!that.form.detailed_address) return $eb.message('error', '请填写门店详细地址');
                     if (!that.form.image) return $eb.message('error', '请选择门店logo');
                     if (!that.form.image) return $eb.message('error', '请选择门店logo');
-                    if (!that.form.valid_time) return $eb.message('error', '请选择核销时效');
-                    if (!that.form.day_time) return $eb.message('error', '请选择门店营业时间');
                     if (!that.form.latlng) return $eb.message('error', '请选择门店经纬度!');
                     if (!that.form.latlng) return $eb.message('error', '请选择门店经纬度!');
+                    if (that.form.status == 2 && !that.form.reason) return $eb.message('error', '请输入驳回原因!');
                     var index = layer.load(1, {
                     var index = layer.load(1, {
                         shade: [0.5, '#fff']
                         shade: [0.5, '#fff']
                     });
                     });
-                    $eb.axios.post('{:Url("save")}' + (that.id ? '?id=' + that.id : ''), that.form).then(function (res) {
+                    $eb.axios.post('{:Url("save_check_apply")}' + (that.id ? '?id=' + that.id : ''), that.form).then(function (res) {
                         layer.close(index);
                         layer.close(index);
                         layer.msg(res.data.msg);
                         layer.msg(res.data.msg);
                         if (res.data.data.id) that.id = res.data.data.id;
                         if (res.data.data.id) that.id = res.data.data.id;