diff --git a/.env b/.env index b58ff3f..d30629e 100755 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -APP_DEBUG = true +APP_DEBUG = false [APP] DEFAULT_TIMEZONE = Asia/Shanghai @@ -11,7 +11,7 @@ USERNAME = youda_test PASSWORD = youda_test HOSTPORT = 3306 CHARSET = utf8 -DEBUG = true +DEBUG = false [LANG] default_lang = zh-cn diff --git a/app/admin/controller/Goods.php b/app/admin/controller/Goods.php index 65f310f..179bdae 100755 --- a/app/admin/controller/Goods.php +++ b/app/admin/controller/Goods.php @@ -47,6 +47,8 @@ class Goods extends Base } if ($type !== '') { $where[] = ['type', '=', $type]; + } else { + $where[] = ['type', '!=', 15]; } $query = GoodsModel::where($where)->order('id desc'); @@ -566,7 +568,7 @@ class Goods extends Base #循环数据 $save_sports_data = []; $start_num = $info['stock'] + 1; - + // 获取宝箱类型的父奖品记录及其prize_code $box_prize_codes = []; foreach ($goods_list as $item) { @@ -574,7 +576,7 @@ class Goods extends Base $box_prize_codes[$item['prize_code']] = true; } } - + // 先处理父奖品(包括宝箱类型的父奖品) for ($i = $start_num; $i <= $data['stock']; $i++) { foreach ($goods_list as $k => $v) { @@ -587,23 +589,23 @@ class Goods extends Base $save_sports_data[] = $v; } } - + // 先插入父奖品 if (!empty($save_sports_data)) { $res[] = GoodsList::insertAll($save_sports_data); } - + // 如果有宝箱类型的奖品,需要处理子奖品 if (!empty($box_prize_codes)) { // 处理所有新套数的子奖品 for ($i = $start_num; $i <= $data['stock']; $i++) { // 先获取当前套数下所有新插入的宝箱类型父奖品 $new_box_parents = GoodsList::where([ - 'goods_id' => $info['id'], - 'num' => $i, - 'goods_type' => 4, - 'goods_list_id' => 0 - ]) + 'goods_id' => $info['id'], + 'num' => $i, + 'goods_type' => 4, + 'goods_list_id' => 0 + ]) ->select() ->toArray(); @@ -615,12 +617,12 @@ class Goods extends Base foreach ($new_box_parents as $new_box_parent) { // 找到第一套中相同prize_code的宝箱父奖品 $original_parent = GoodsList::where([ - 'goods_id' => $info['id'], - 'num' => 1, - 'goods_type' => 4, - 'prize_code' => $new_box_parent['prize_code'], - 'goods_list_id' => 0 - ]) + 'goods_id' => $info['id'], + 'num' => 1, + 'goods_type' => 4, + 'prize_code' => $new_box_parent['prize_code'], + 'goods_list_id' => 0 + ]) ->find(); if (!$original_parent) { @@ -629,9 +631,9 @@ class Goods extends Base // 获取原始父奖品的所有子奖品 $child_items = GoodsList::where([ - 'goods_id' => $info['id'], - 'goods_list_id' => $original_parent['id'] - ]) + 'goods_id' => $info['id'], + 'goods_list_id' => $original_parent['id'] + ]) ->select() ->toArray(); @@ -647,36 +649,36 @@ class Goods extends Base for ($j = 1; $j < $i; $j++) { // 找到对应套数的父奖品 $existing_parent = GoodsList::where([ - 'goods_id' => $info['id'], - 'num' => $j, - 'prize_code' => $new_box_parent['prize_code'], - 'goods_list_id' => 0 - ]) + 'goods_id' => $info['id'], + 'num' => $j, + 'prize_code' => $new_box_parent['prize_code'], + 'goods_list_id' => 0 + ]) ->find(); - + if ($existing_parent) { // 找到这个父奖品下与当前子奖品对应的子奖品 $similar_child = GoodsList::where([ - 'goods_id' => $info['id'], - 'num' => $j, - 'goods_list_id' => $existing_parent['id'], - 'title' => $child_item['title'], // 使用标题匹配相似子奖品 - 'shang_id' => $child_item['shang_id'] // 确保奖品类型相同 - ]) + 'goods_id' => $info['id'], + 'num' => $j, + 'goods_list_id' => $existing_parent['id'], + 'title' => $child_item['title'], // 使用标题匹配相似子奖品 + 'shang_id' => $child_item['shang_id'] // 确保奖品类型相同 + ]) ->find(); - + if ($similar_child) { $existing_children[] = $similar_child; } } } - + $child_data = $child_item; unset($child_data['id']); $child_data['num'] = $i; // 设置新的套数 $child_data['goods_list_id'] = $new_box_parent['id']; // 关联到新的父奖品 $child_data['surplus_stock'] = $child_data['stock']; // 重置库存 - + // 如果存在其他套数的相同子奖品,使用相同的prize_code if (!empty($existing_children)) { $child_data['prize_code'] = $existing_children[0]['prize_code']; @@ -684,7 +686,7 @@ class Goods extends Base // 否则生成新的prize_code $child_data['prize_code'] = getPrizeCode() . '_' . time() . '_' . mt_rand(1000, 9999); } - + $child_save_data[] = $child_data; } @@ -730,7 +732,7 @@ class Goods extends Base $result = GoodsModel::where(['id' => $id])->update(['status' => $status]); } elseif ($status == 3) { $result = GoodsModel::where(['id' => $id])->update(['delete_time' => time(), 'status' => 2]); - + } else { return $this->renderError("请求参数错误"); } @@ -796,9 +798,9 @@ class Goods extends Base $where[] = ['goods_list_id', '=', 0]; $query = GoodsList::where($where)->order('sort desc, shang_id asc, id asc'); $count = $query->count(); - + $real_pro = GoodsList::where($where)->sum('real_pro'); $list = $query->page($page, $limit)->select()->toArray(); - $real_pro = 0; + // $real_pro = 0; // 处理数据 foreach ($list as &$item) { @@ -807,7 +809,7 @@ class Goods extends Base if (!empty($item['imgurl_detail'])) { $item['imgurl_detail'] = imageUrl($item['imgurl_detail']); } - $real_pro += $item['real_pro']; + // $real_pro += $item['real_pro']; if ($item['goods_type'] == 4) { $goods_list = GoodsList::where('goods_id', $item['goods_id']) ->where('goods_list_id', '=', $item['id']) @@ -935,51 +937,51 @@ class Goods extends Base #循环数据 $save_sports_data = []; $prize_code = getPrizeCode() . '_' . time(); // 生成唯一的prize_code - + // 处理子奖品添加的情况 $goods_list_id = $request->param('goods_list_id/d', 0); // 获取父奖品ID,如果是子奖品 $is_box_type = ($data['goods_type'] == 4); // 是否为宝箱类型 - + if ($goods_list_id > 0) { // 获取父奖品信息,确保父奖品存在 $parent_prize = GoodsList::where('id', $goods_list_id)->find(); if (!$parent_prize) { return $this->renderError('宝箱父奖品不存在'); } - + // 子奖品应该生成自己的prize_code $data['prize_code'] = getPrizeCode() . '_' . time() . '_' . mt_rand(1000, 9999); $data['goods_list_id'] = $goods_list_id; $data['num'] = $parent_prize['num']; - + // 如果父奖品存在于多个套数中,需要为每个套数创建对应的子奖品 $same_prize_parents = GoodsList::where([ - 'goods_id' => $data['goods_id'], - 'prize_code' => $parent_prize['prize_code'], - 'goods_list_id' => 0 // 确保只查询父奖品 - ]) + 'goods_id' => $data['goods_id'], + 'prize_code' => $parent_prize['prize_code'], + 'goods_list_id' => 0 // 确保只查询父奖品 + ]) ->select() ->toArray(); - + if (count($same_prize_parents) > 1) { // 有多个套数的相同父奖品 $multi_data = []; - + foreach ($same_prize_parents as $same_parent) { if ($same_parent['id'] == $goods_list_id) { // 跳过当前指定的父奖品,因为下面要单独处理 continue; } - + $child_data = $data; $child_data['goods_list_id'] = $same_parent['id']; $child_data['num'] = $same_parent['num']; $multi_data[] = $child_data; } - + // 先插入指定父奖品的子奖品 $res = GoodsList::insert($data); - + // 再插入其他套数的子奖品 if (!empty($multi_data)) { GoodsList::insertAll($multi_data); @@ -988,18 +990,17 @@ class Goods extends Base // 只有一个套数,直接保存 $res = GoodsList::insert($data); } - } - else { + } else { // 添加正常奖品或宝箱父奖品,为所有套数都添加 $data['prize_code'] = $prize_code; // 使用新生成的prize_code for ($i = 1; $i <= $stock; $i++) { $data['num'] = $i; $save_sports_data[] = $data; } - + // 批量插入奖品 $res = GoodsList::insertAll($save_sports_data); - + // 如果是宝箱类型,则需要记录下插入后的ID,以供后续可能添加的子奖品使用 if ($is_box_type && $res) { // 获取已插入的宝箱奖品ID @@ -1007,7 +1008,7 @@ class Goods extends Base ->where('goods_id', $data['goods_id']) ->where('goods_type', 4) ->select()->toArray(); - + // 通知前端已成功添加宝箱类型,提示可继续添加子奖品 if (!empty($inserted_boxes)) { return $this->renderSuccess('添加成功,您可以继续为此宝箱添加子奖品', [ @@ -1015,7 +1016,7 @@ class Goods extends Base ]); } } - + } return $this->renderSuccess('添加成功'); } elseif (in_array($type, [2, 8, 9, 16])) { @@ -1040,51 +1041,51 @@ class Goods extends Base #循环数据 $save_sports_data = []; $prize_code = getPrizeCode() . '_' . time(); // 生成唯一的prize_code - + // 处理子奖品添加的情况 $goods_list_id = $request->param('goods_list_id/d', 0); // 获取父奖品ID,如果是子奖品 $is_box_type = ($data['goods_type'] == 4); // 是否为宝箱类型 - + if ($goods_list_id > 0) { // 获取父奖品信息,确保父奖品存在 $parent_prize = GoodsList::where('id', $goods_list_id)->find(); if (!$parent_prize) { return $this->renderError('宝箱父奖品不存在'); } - + // 子奖品应该生成自己的prize_code $data['prize_code'] = getPrizeCode() . '_' . time() . '_' . mt_rand(1000, 9999); $data['goods_list_id'] = $goods_list_id; $data['num'] = $parent_prize['num']; - + // 如果父奖品存在于多个套数中,需要为每个套数创建对应的子奖品 $same_prize_parents = GoodsList::where([ - 'goods_id' => $data['goods_id'], - 'prize_code' => $parent_prize['prize_code'], - 'goods_list_id' => 0 // 确保只查询父奖品 - ]) + 'goods_id' => $data['goods_id'], + 'prize_code' => $parent_prize['prize_code'], + 'goods_list_id' => 0 // 确保只查询父奖品 + ]) ->select() ->toArray(); - + if (count($same_prize_parents) > 1) { // 有多个套数的相同父奖品 $multi_data = []; - + foreach ($same_prize_parents as $same_parent) { if ($same_parent['id'] == $goods_list_id) { // 跳过当前指定的父奖品,因为下面要单独处理 continue; } - + $child_data = $data; $child_data['goods_list_id'] = $same_parent['id']; $child_data['num'] = $same_parent['num']; $multi_data[] = $child_data; } - + // 先插入指定父奖品的子奖品 $res = GoodsList::insert($data); - + // 再插入其他套数的子奖品 if (!empty($multi_data)) { GoodsList::insertAll($multi_data); @@ -1093,18 +1094,17 @@ class Goods extends Base // 只有一个套数,直接保存 $res = GoodsList::insert($data); } - } - else { + } else { // 添加正常奖品或宝箱父奖品,为所有套数都添加 $data['prize_code'] = $prize_code; // 使用新生成的prize_code for ($i = 1; $i <= $stock; $i++) { $data['num'] = $i; $save_sports_data[] = $data; } - + // 批量插入奖品 $res = GoodsList::insertAll($save_sports_data); - + // 如果是宝箱类型,则需要记录下插入后的ID,以供后续可能添加的子奖品使用 if ($is_box_type && $res) { // 获取已插入的宝箱奖品ID @@ -1112,7 +1112,7 @@ class Goods extends Base ->where('goods_id', $data['goods_id']) ->where('goods_type', 4) ->select()->toArray(); - + // 通知前端已成功添加宝箱类型,提示可继续添加子奖品 if (!empty($inserted_boxes)) { return $this->renderSuccess('添加成功,您可以继续为此宝箱添加子奖品', [ @@ -1121,7 +1121,7 @@ class Goods extends Base } } } - + if (RegInt($data['prize_num']) && $data['shang_id'] == 5) { return $this->renderError("擂台赏抽全局赏数量设置错误,请设置大于0的整数"); } @@ -1248,7 +1248,7 @@ class Goods extends Base // if ($type == 1 || $type == 5 || $type == 10 || $type == 6 || $type == 11 || $type == 15) { - + } elseif ($type == 2 || $type == 8 || $type == 9 || $type == 16 || $type == 17) { if (RegMoney($data['real_pro'] * 10000)) { @@ -1665,9 +1665,9 @@ class Goods extends Base ->where($whe) ->order('id desc') ->paginate([ - 'list_rows' => $this->page, - 'query' => request()->param(), - ]); + 'list_rows' => $this->page, + 'query' => request()->param(), + ]); // 获取所有相关的盒子信息 $goodsIds = array_column($list->items(), 'goods_id'); @@ -1725,7 +1725,7 @@ class Goods extends Base } $url .= 'api/goods/receive_sync'; - + // 获取盒子数据 $goods = GoodsModel::where(['id' => $id])->find(); if (!$goods) { @@ -1741,10 +1741,10 @@ class Goods extends Base // 获取盒子奖品数据 $goodsLists = GoodsList::where(['goods_id' => $id])->select()->toArray(); - + // 获取盒子扩展配置 $goodsExtend = GoodsExtend::where(['goods_id' => $id])->find(); - + // 收集所有奖励ID $rewardIds = []; foreach ($goodsLists as $item) { @@ -1752,7 +1752,7 @@ class Goods extends Base $rewardIds[] = $item['reward_id']; } } - + // 获取奖励数据 $rewards = []; if (!empty($rewardIds)) { @@ -1766,7 +1766,7 @@ class Goods extends Base 'async_code' => $async_code, 'rewards' => $rewards ]; - + if ($goodsExtend) { $postData['goodsExtend'] = $goodsExtend->toArray(); } @@ -1782,28 +1782,28 @@ class Goods extends Base 'Content-Type: application/json', 'Content-Length: ' . strlen(json_encode($postData)) ]); - + $response = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); - + if ($status !== 200) { return $this->renderError('同步失败,服务器返回状态码: ' . $status); } - + $responseData = json_decode($response, true); if (!$responseData || $responseData['code'] !== 1) { $errorMsg = isset($responseData['msg']) ? $responseData['msg'] : '服务器未返回预期响应'; return $this->renderError('同步失败: ' . $errorMsg); } - + // 更新同步状态 $goods->save([ 'sync_status' => 1, 'sync_url' => $url, 'sync_time' => date('Y-m-d H:i:s') ]); - + return $this->renderSuccess('同步成功'); } catch (\Exception $e) { return $this->renderError('同步失败: ' . $e->getMessage()); @@ -1871,7 +1871,7 @@ class Goods extends Base $goodsData['status'] = 2; // 默认下架状态 $goodsData['addtime'] = time(); $goodsData['async_code'] = ''; // 清空同步代码,避免混淆 - $goodsData['is_open'] = 0; + $goodsData['is_open'] = 0; $goodsData['king_user_id'] = 0; // 插入新盒子 $newGoods = new GoodsModel(); @@ -1890,7 +1890,7 @@ class Goods extends Base // 创建父奖品prize_code映射表 $parentPrizeCodeMapping = []; - + // 创建子奖品prize_code映射表 $childPrizeCodeMapping = []; @@ -1898,7 +1898,7 @@ class Goods extends Base $parentPrizes = GoodsList::where(['goods_id' => $id, 'goods_list_id' => 0]) ->select() ->toArray(); - + $prizeCodeGroups = []; foreach ($parentPrizes as $prize) { if (!isset($prizeCodeGroups[$prize['prize_code']])) { @@ -1906,12 +1906,12 @@ class Goods extends Base } $prizeCodeGroups[$prize['prize_code']][] = $prize; } - + // 为每个父prize_code组创建新的prize_code foreach ($prizeCodeGroups as $oldPrizeCode => $prizes) { $newPrizeCode = 'MHHZ' . date('YmdHis') . mt_rand(1000, 9999); $parentPrizeCodeMapping[$oldPrizeCode] = $newPrizeCode; - + // 复制每个prize_code组的奖品 foreach ($prizes as $prize) { $newPrizeData = $prize; @@ -1920,7 +1920,7 @@ class Goods extends Base $newPrizeData['prize_code'] = $newPrizeCode; $newPrizeData['addtime'] = time(); $newPrizeData['surplus_stock'] = $newPrizeData['stock']; - + // 处理奖励ID if ($newPrizeData['reward_id'] && $newPrizeData['reward_id'] != '') { $reward = Reward::where(['reward_id' => $newPrizeData['reward_id']])->select(); @@ -1936,19 +1936,19 @@ class Goods extends Base } } } - + // 插入新奖品 $newGoodsList = new GoodsList(); $newGoodsList->save($newPrizeData); } } - + // 获取所有子奖品 $childPrizes = GoodsList::where(['goods_id' => $id]) ->where('goods_list_id', '>', 0) ->select() ->toArray(); - + // 对子奖品按prize_code分组 $childGroups = []; foreach ($childPrizes as $child) { @@ -1958,13 +1958,13 @@ class Goods extends Base } $childGroups[$childPrizeCode][] = $child; } - + // 为每组子奖品创建新的prize_code映射 foreach ($childGroups as $oldChildCode => $group) { $newChildCode = 'MHHZ' . date('YmdHis') . mt_rand(1000, 9999); $childPrizeCodeMapping[$oldChildCode] = $newChildCode; } - + // 处理每个子奖品 foreach ($childPrizes as $childPrize) { // 查找子奖品对应的父奖品 @@ -1972,10 +1972,10 @@ class Goods extends Base if (!$parentPrize) { continue; // 如果找不到父奖品,跳过 } - + // 获取父奖品的prize_code $parentPrizeCode = $parentPrize['prize_code']; - + // 如果父奖品的prize_code有映射,则复制子奖品 if (isset($parentPrizeCodeMapping[$parentPrizeCode])) { // 找到新盒子中对应的父奖品 @@ -1984,14 +1984,14 @@ class Goods extends Base 'prize_code' => $parentPrizeCodeMapping[$parentPrizeCode], 'num' => $parentPrize['num'] // 确保套数也匹配 ])->find(); - + if ($newParent) { // 复制子奖品数据 $newChildData = $childPrize; unset($newChildData['id']); $newChildData['goods_id'] = $newGoodsId; $newChildData['goods_list_id'] = $newParent['id']; // 关联到新的父奖品 - + // 使用子奖品的prize_code映射,确保相同的子奖品有相同的prize_code if (isset($childPrizeCodeMapping[$childPrize['prize_code']])) { $newChildData['prize_code'] = $childPrizeCodeMapping[$childPrize['prize_code']]; @@ -2001,10 +2001,10 @@ class Goods extends Base $childPrizeCodeMapping[$childPrize['prize_code']] = $newChildCode; $newChildData['prize_code'] = $newChildCode; } - + $newChildData['addtime'] = time(); $newChildData['surplus_stock'] = $newChildData['stock']; - + // 处理奖励ID if ($newChildData['reward_id'] && $newChildData['reward_id'] != '') { $reward = Reward::where(['reward_id' => $newChildData['reward_id']])->select(); @@ -2020,7 +2020,7 @@ class Goods extends Base } } } - + // 插入新的子奖品 $newChildList = new GoodsList(); $newChildList->save($newChildData); diff --git a/app/admin/controller/Statistics.php b/app/admin/controller/Statistics.php index d605d80..35c18a0 100755 --- a/app/admin/controller/Statistics.php +++ b/app/admin/controller/Statistics.php @@ -550,4 +550,70 @@ class Statistics extends Base return View::fetch("Statistics/shipmentList"); } + /** + * 出货概览 + */ + public function productsOverview(Request $request) + { + $goodsId = $request->param('goods_id', 0, 'intval'); + + // 获取测试用户ID + $testUsers = User::where('istest', '>', 0)->column('id'); + + // 查询条件 + $where = [ + ['goods_id', '=', $goodsId] + ]; + + if (!empty($testUsers)) { + $where[] = ['user_id', 'not in', $testUsers]; + } + + // 第一个SQL:按奖品ID分组统计出货数量 + $productStats = OrderList::where($where) + ->field('goodslist_id, COUNT(1) as goods_count') + ->group('goodslist_id') + ->select() + ->toArray(); + + // 获取所有涉及的奖品ID + $goodslistIds = array_column($productStats, 'goodslist_id'); + + // 第二个SQL:查询奖品详细信息 + $productInfos = []; + if (!empty($goodslistIds)) { + $productInfos = GoodsList::where('id', 'in', $goodslistIds) + ->field('id, title, imgurl, price, money, sc_money, real_pro') + ->select() + ->toArray(); + } + + // 将两个查询结果合并,以奖品ID为键 + $productInfoMap = []; + foreach ($productInfos as $info) { + $productInfoMap[$info['id']] = $info; + } + + // 合并结果 + $result = []; + foreach ($productStats as $stat) { + $goodslistId = $stat['goodslist_id']; + if (array_key_exists($goodslistId, $productInfoMap)) { + $result[] = array_merge($stat, $productInfoMap[$goodslistId]); + } + } + + // 获取盒子信息 + $boxInfo = GoodsModel::where('id', $goodsId)->find(); + + // 传递数据给视图 + View::assign([ + 'list' => $result, + 'goods_id' => $goodsId, + 'boxInfo' => $boxInfo + ]); + + return View::fetch('Statistics/productsOverview'); + } + } diff --git a/app/admin/controller/User.php b/app/admin/controller/User.php index e4d138f..5db0260 100755 --- a/app/admin/controller/User.php +++ b/app/admin/controller/User.php @@ -38,6 +38,8 @@ class User extends Base public function list() { $param = $this->request->param(); + $limit = request()->param('limit', ''); + // 构建查询条件 $where = []; if (!empty($param['user_id'])) { @@ -62,7 +64,7 @@ class User extends Base } $field = '*'; $order = 'id desc'; - $data = UserModel::getList($where, $field, $order, $this->page); + $data = UserModel::getList($where, $field, $order, $limit); foreach ($data['list'] as &$value) { $pid_info = UserModel::field('id,nickname,headimg,uid')->where(['id' => $value['pid']])->find(); $value['pid_info'] = $pid_info; @@ -1405,4 +1407,40 @@ class User extends Base return json(['status' => 0, 'msg' => '重置失败:' . $e->getMessage()]); } } + + /** + * 绑定用户手机号 + */ + public function bindUserMobile(Request $request) + { + $id = $request->post('id/d', 0); + $mobile = $request->post('mobile', ''); + + // 验证手机号格式 + if (!preg_match('/^1\d{10}$/', $mobile)) { + return json(['status' => 0, 'msg' => '手机号格式不正确']); + } + + $user = UserModel::getInfo(['id' => $id]); + if (!$user) { + return json(['status' => 0, 'msg' => '用户不存在']); + } + + // 检查手机号是否已被其他用户使用 + $existUser = UserModel::where('mobile', $mobile) + ->where('id', '<>', $id) + ->find(); + if ($existUser) { + return json(['status' => 0, 'msg' => '该手机号已被其他用户使用']); + } + + // 更新用户手机号 + $result = $user->save(['mobile' => $mobile]); + + if ($result) { + return json(['status' => 1, 'msg' => '手机号绑定成功']); + } else { + return json(['status' => 0, 'msg' => '手机号绑定失败']); + } + } } diff --git a/app/admin/route/app.php b/app/admin/route/app.php index 7310630..06a9e6e 100755 --- a/app/admin/route/app.php +++ b/app/admin/route/app.php @@ -62,6 +62,7 @@ Route::rule('usermobileclear', 'User/usermobileclear', 'POST');//清空手机号 Route::rule('userwxclear', 'User/userwxclear', 'POST');//清空微信登录数据 Route::rule('userUidClear', 'User/userUidClear', 'POST');//清空UID Route::rule('resetUserSign', 'User/resetUserSign', 'POST');//重置用户签到数据 +Route::rule('bindUserMobile', 'User/bindUserMobile', 'POST');//绑定用户手机号 // 添加用户登录统计路由 Route::rule('user_loginStat', 'user/loginStat'); @@ -320,6 +321,8 @@ Route::rule('statistics_shipmentList', 'Statistics/shipmentList', 'GET'); Route::rule('statistics_orderList', 'Statistics/goodsList', 'GET'); //支付订单 Route::rule('statistics_order', 'Statistics/orderList', 'GET'); +//出货概览 +Route::rule('statistics_productsOverview', 'Statistics/productsOverview', 'GET'); //利润支出 Route::rule('ProfitExpenses', 'Profit/index', 'GET'); diff --git a/app/admin/view/Goods/goods.html b/app/admin/view/Goods/goods.html index 7107a8d..579ee3b 100755 --- a/app/admin/view/Goods/goods.html +++ b/app/admin/view/Goods/goods.html @@ -1,48 +1,54 @@ {include file="Public:header3"/} -
+
-
-
-
-
- +
+ +
+
+
+ +
-
-
-
- +
+
+ +
-
-
-
- +
+
+ +
+
+ + + +
+
+ 默认不显示福利屋数据,查看福利屋盒子,请在盒子类型选择福利屋单独查看。 +
+
-
- - - -
+ +
+ +
+
- -
-
-
-
@@ -245,13 +251,13 @@ $.ajax({ url: '{:url("/admin/api/goods/types")}', type: 'GET', - success: function(res) { + success: function (res) { if (res.code === 0) { // 保存类型数据到全局变量 window.goodsTypes = res.data; - + var html = ''; - $.each(res.data, function(index, item) { + $.each(res.data, function (index, item) { html += ''; }); $('#goodsType').html(html); @@ -269,6 +275,7 @@ lineStyle: 'height:150px', height: 'full-120', cols: [[ + { field: 'id', type: 'numbers', title: '序号',width:60 }, { field: 'id', title: '盒子ID', width: 80, templet: function (d) { if (d.type == 1 || d.type == 11) { @@ -280,7 +287,7 @@ }, { field: 'type', title: '盒子类型', width: 120, templet: '#typeTpl' }, { field: 'title', title: '盒子名称', width: 180 }, - { + { field: 'price_stock', title: '价格/套数', width: 140, templet: '#priceStockTpl' }, { @@ -294,28 +301,30 @@ } }, { field: 'limit_info', title: '限购信息', width: 160, templet: '#limitInfoTpl' }, - + { field: 'pay_info', title: '支付信息', width: 150, templet: '#payInfoTpl' }, { field: 'is_auto_xiajia', title: '自动下架', width: 150, templet: '#autoOffshelfTpl' }, { field: 'sort', title: '排序', width: 100, edit: 'text' }, - { field: 'is_flw', title: '福利屋信息', width: 200, templet: function(d) { - if (d.type == 15) { - var startTime = d.flw_start_time ? new Date(d.flw_start_time * 1000).toLocaleString() : '未设置'; - var endTime = d.flw_end_time ? new Date(d.flw_end_time * 1000).toLocaleString() : '未设置'; - var openTime = d.open_time ? new Date(d.open_time * 1000).toLocaleString() : '未设置'; - var isOpen = d.is_open == 1 ? '已开奖' : '未开奖'; - return '
开始: ' + startTime + '
' + - '
结束: ' + endTime + '
' + - '
开奖: ' + openTime + '
' + - '
状态: ' + isOpen + '
'; - } else { - return ''; + { + field: 'is_flw', title: '福利屋信息', width: 200, templet: function (d) { + if (d.type == 15) { + var startTime = d.flw_start_time ? new Date(d.flw_start_time * 1000).toLocaleString() : '未设置'; + var endTime = d.flw_end_time ? new Date(d.flw_end_time * 1000).toLocaleString() : '未设置'; + var openTime = d.open_time ? new Date(d.open_time * 1000).toLocaleString() : '未设置'; + var isOpen = d.is_open == 1 ? '已开奖' : '未开奖'; + return '
开始: ' + startTime + '
' + + '
结束: ' + endTime + '
' + + '
开奖: ' + openTime + '
' + + '
状态: ' + isOpen + '
'; + } else { + return ''; + } } - }}, + }, { field: 'show_lock', title: '显示/锁箱', width: 150, templet: '#showLockTpl' }, - - { - field: 'addtime', title: '添加/修改时间', width: 180, templet: function(d) { + + { + field: 'addtime', title: '添加/修改时间', width: 180, templet: function (d) { if (d.update_time) { return '
添加: ' + d.addtime_text + '
修改: ' + new Date(d.update_time * 1000).toLocaleString() + '
'; } else { @@ -323,7 +332,7 @@ } } }, - { fixed: 'right',field: 'status', title: '状态', width: 100, templet: '#statusTpl' }, + { fixed: 'right', field: 'status', title: '状态', width: 100, templet: '#statusTpl' }, { fixed: 'right', title: '操作', width: 200, toolbar: '#toolbarTpl' } ]], done: function () { @@ -399,13 +408,13 @@ goods_extend_del(data.id); } }); - + // 监听单元格编辑 - table.on('edit(goodsTable)', function(obj){ + table.on('edit(goodsTable)', function (obj) { var value = obj.value, // 得到修改后的值 data = obj.data, // 得到所在行所有键值 field = obj.field; // 得到字段 - + // 排序字段修改 if (field === 'sort') { var loadIndex = layer.load(2); @@ -417,19 +426,19 @@ id: data.id, sort: value }, - success: function(res) { + success: function (res) { layer.close(loadIndex); if (res.status === 1) { - layer.msg('排序修改成功', {icon: 1, time: 1000}); + layer.msg('排序修改成功', { icon: 1, time: 1000 }); } else { - layer.msg(res.msg || '修改失败', {icon: 2, anim: 6, time: 2000}); + layer.msg(res.msg || '修改失败', { icon: 2, anim: 6, time: 2000 }); // 重载表格以恢复原值 table.reload('goodsTable'); } }, - error: function() { + error: function () { layer.close(loadIndex); - layer.msg('网络错误,请稍后重试', {icon: 2, anim: 6, time: 2000}); + layer.msg('网络错误,请稍后重试', { icon: 2, anim: 6, time: 2000 }); // 重载表格以恢复原值 table.reload('goodsTable'); } @@ -673,7 +682,7 @@ $.post(url, { "goods_id": goods_id }, function (data) { layer.close(load); if (data.status == 1) { - layer.msg(data.msg, { icon: 1, time: 2000 }, function() { + layer.msg(data.msg, { icon: 1, time: 2000 }, function () { table.reload('goodsTable'); }); } else { @@ -688,41 +697,40 @@ function previewImg(obj) { var img = new Image(); img.src = obj.src; - + layer.open({ type: 1, title: false, closeBtn: 1, shadeClose: true, - area: [img.width > 800 ? '800px' : img.width+'px', ''], + area: [img.width > 800 ? '800px' : img.width + 'px', ''], content: '
' }); }