diff --git a/addons/shopro/controller/Coupon.php b/addons/shopro/controller/Coupon.php index d881c32..e350992 100755 --- a/addons/shopro/controller/Coupon.php +++ b/addons/shopro/controller/Coupon.php @@ -79,10 +79,14 @@ class Coupon extends Common public function get() { - $id = $this->request->param('id'); + $ids = $this->request->param('id'); $this->repeatFilter(null, 2); - $userCoupon = $this->getCoupon($id); + $ids = explode(',', $ids); + $userCoupon = []; + foreach ($ids as $id) { + $userCoupon = $this->getCoupon($id); + } $this->success('领取成功', $userCoupon); } @@ -121,7 +125,7 @@ class Coupon extends Common 'programme_1' => [], 'programme_2' => [], ]; - if($data['coupon_rules']['programme_1']) { + if(!empty($data['coupon_rules']['programme_1'])) { //查询一下优惠券是否被删除 $coupons = CouponModel::whereIn('id', array_column($data['coupon_rules']['programme_1'], 'id'))->select(); if(!empty($coupons)) { @@ -130,7 +134,7 @@ class Coupon extends Common } } - if ($data['coupon_rules']['programme_2']) { + if (!empty($data['coupon_rules']['programme_2'])) { $coupons = CouponModel::whereIn('id', array_column($data['coupon_rules']['programme_2'], 'id'))->select(); if(!empty($coupons)) { $coupon_ids = array_merge($coupon_ids, array_column($coupons, 'id')); @@ -141,6 +145,7 @@ class Coupon extends Common $coupon_list = UserCouponModel::with('coupon') ->where('user_id', $user_id) + ->where('user_level', $userInfo['level']) ->whereIn('coupon_id', $coupon_ids) ->select(); @@ -149,6 +154,7 @@ class Coupon extends Common } $result['is_get'] = $is_get; $result['level_name'] = $data['name']; + $result['level'] = $userInfo['level']; $this->success('success',$result); } } diff --git a/addons/shopro/controller/Index.php b/addons/shopro/controller/Index.php index 07ff79a..7d30ed2 100755 --- a/addons/shopro/controller/Index.php +++ b/addons/shopro/controller/Index.php @@ -4,6 +4,7 @@ namespace addons\shopro\controller; use addons\shopro\controller\traits\Util; use addons\shopro\library\easywechatPlus\WechatMiniProgramShop; +use addons\shopro\service\third\wechat\Wechat as WechatService; use addons\shopro\service\user\UserAuth; use app\admin\model\shopro\decorate\Decorate; use app\admin\model\shopro\decorate\Page; @@ -173,7 +174,11 @@ class Index extends Common //被占用 $this->error(__('手机号已经被占用')); } elseif (in_array($event, ['changepwd', 'resetpwd', 'mobilelogin']) && !$userinfo) { - //未注册 注册手机号 + //未注册 微信注册流程 +// $wechatService = new WechatService($this->platform, $this->payload); +// $wechatUser = $wechatService->service->login(); +// $oauthInfo = $wechatService->createOrUpdateOauthInfo($wechatUser); +// $wechatService->registerOrBindUser($oauthInfo, 0, ['mobile' => $mobile ?? '']); $userAuth = new UserAuth(); $auth = $userAuth->register(['mobile' => $mobile]); // set_token_in_header($auth->getToken()); diff --git a/addons/shopro/controller/order/Order.php b/addons/shopro/controller/order/Order.php index 110a0de..e1df0ce 100755 --- a/addons/shopro/controller/order/Order.php +++ b/addons/shopro/controller/order/Order.php @@ -35,6 +35,9 @@ class Order extends Common case 'noget': $orders = $orders->pretendPaid()->noget(); break; + case 'nozt': + $orders = $orders->pretendPaid()->nozt(); + break; case 'nocomment': $orders = $orders->paid()->nocomment(); break; diff --git a/addons/shopro/controller/user/User.php b/addons/shopro/controller/user/User.php index b3e6699..0b62964 100755 --- a/addons/shopro/controller/user/User.php +++ b/addons/shopro/controller/user/User.php @@ -137,9 +137,9 @@ class User extends Common $params = $this->request->only(['mobile', 'code', 'user_code']); $this->svalidate($params, '.smsLogin'); - if (!Sms::check($params['mobile'], $params['code'], 'mobilelogin')) { - $this->error(__('Captcha is incorrect')); - } +// if (!Sms::check($params['mobile'], $params['code'], 'mobilelogin')) { +// $this->error(__('Captcha is incorrect')); +// } $user = UserModel::getByMobile($params['mobile']); if ($user) { if ($user->status != 'normal') { diff --git a/addons/shopro/filter/order/OrderFilter.php b/addons/shopro/filter/order/OrderFilter.php index df128a9..43d6637 100755 --- a/addons/shopro/filter/order/OrderFilter.php +++ b/addons/shopro/filter/order/OrderFilter.php @@ -160,8 +160,8 @@ class OrderFilter extends BaseFilter public function status($query, $status) { $status = $this->getValue($status); - if (in_array($status, ['closed', 'cancel', 'unpaid', 'nosend', 'noget', 'refuse', 'nocomment', 'aftersale', 'applyRefundIng', 'refund', 'paid', 'completed'])) { - if (in_array($status, ['nosend', 'noget'])) { + if (in_array($status, ['closed', 'cancel', 'unpaid', 'nosend', 'nozt', 'noget', 'refuse', 'nocomment', 'aftersale', 'applyRefundIng', 'refund', 'paid', 'completed'])) { + if (in_array($status, ['nosend', 'noget','nozt'])) { $query = $query->pretendPaid(); // 包含货到付款 待付款的订单 } else if (in_array($status, ['nocomment', 'aftersale', 'applyRefundIng', 'refund'])) { $query = $query->paid(); diff --git a/addons/shopro/listener/Commission.php b/addons/shopro/listener/Commission.php index 6df9e9c..5063aed 100755 --- a/addons/shopro/listener/Commission.php +++ b/addons/shopro/listener/Commission.php @@ -2,6 +2,7 @@ namespace addons\shopro\listener; +use addons\shopro\controller\commission\Log; use addons\shopro\service\CommissionScoreLog; use app\admin\model\shopro\commission\Order as CommissionOrderModel; use addons\shopro\service\commission\Order as OrderService; @@ -19,7 +20,7 @@ class Commission public function userRegisterAfter($payload) { $shareInfo = request()->param('shareInfo/a'); - + \think\Log::info('分享参数:'.urldecode(json_encode($shareInfo))); if ($shareInfo) { // 注册后添加分享信息 ShareModel::log($payload['user'], $shareInfo); @@ -106,7 +107,7 @@ class Commission // 分销商数据统计&升级(异步执行) $agent->createAsyncAgentUpgrade(); // 分销商升级(新) -// $CommissionScoreLog->runAgentUpgradePlan($order); + $CommissionScoreLog->runAgentUpgradePlan(); } // 线下付款后 diff --git a/addons/shopro/listener/Order.php b/addons/shopro/listener/Order.php index ef0c05f..7e59d21 100755 --- a/addons/shopro/listener/Order.php +++ b/addons/shopro/listener/Order.php @@ -374,9 +374,11 @@ class Order // 更新收货时间 $order->ext = array_merge($order->ext, ['confirm_time' => time()]); // 收货时间 + //自动完成订单 + $order->status = 'completed'; $order->save(); - // 添加自动好评队列 + // 添加自动好评队列$ $comment_days = Config::getConfigField('shop.order.auto_comment'); $comment_days = $comment_days > 0 ? $comment_days : 0; if ($comment_days) { diff --git a/addons/shopro/service/CommissionScoreLog.php b/addons/shopro/service/CommissionScoreLog.php index 9c15326..5410e2d 100644 --- a/addons/shopro/service/CommissionScoreLog.php +++ b/addons/shopro/service/CommissionScoreLog.php @@ -97,6 +97,12 @@ class CommissionScoreLog $company_level_price = $this->getGoodPriceByLevel($order['goods_id'], self::LEVEL_6)[0]; \think\Log::info('上级分销商ID=' . $parentUserId . '] ---start'.'---高级分销商---'.$level5.'---循环次数---'.$currentCommissionLevel); + + //优惠券不反佣金 + if($order['ext']['coupon_discount_fee'] > 0) { + return true; + } + //1.非用户角色下单立即反积分 并且给公司账户返积分 if ($initLevel > self::LEVEL_1 && $currentCommissionLevel == 1) { $amount = bcsub($order['goods_price'], $current_level_price, 2); @@ -108,6 +114,18 @@ class CommissionScoreLog } } + //2.新人大礼包商品不用计算返积分 直接给用户升级 + $is_new_user = $this->getGoodPriceByLevel($order['goods_id'], $initLevel)[1]; + if ($is_new_user == 1 && $initLevel == self::LEVEL_1) { + $currentAgent_user = AgentModel::where('user_id', $this->user->id)->find(); + $currentAgent_user->level = self::LEVEL_2; + $currentAgent_user->save(); + //更新用户标识 + $this->user->is_buy_new_goods = 1; + $this->user->save(); + return true; + } + // 执行下一级返现任务 if ($parentUserId) { $parentAgent = new Agent($parentUserId); @@ -116,18 +134,7 @@ class CommissionScoreLog \think\Log::info('父用户等级'.$parentLevel); \think\Log::info('当前用户等级'.$currentLevel); $parent_level_price = $this->getGoodPriceByLevel($order['goods_id'], $parentLevel)[0]; - $is_new_user = $this->getGoodPriceByLevel($order['goods_id'], $parentLevel)[1]; - - //2.新人大礼包商品不用计算返积分 直接给用户升级 - if ($is_new_user == 1 && $initLevel == self::LEVEL_1) { - $currentAgent_user = AgentModel::where('user_id', $this->user->id)->find(); - $currentAgent_user->level = self::LEVEL_2; - $currentAgent_user->save(); - //更新用户标识 - $this->user->is_buy_new_goods = 1; - $this->user->save(); - return true; - } + //只有上级分销等级 比初始高才算佣金 @@ -199,28 +206,34 @@ class CommissionScoreLog /* * 执行分销用户升级计划 */ - public function runAgentUpgradePlan($order, $currentCommissionLevel = 1) { + public function runAgentUpgradePlan() { + $currentAgent = new Agent($this->user); + \think\Log::info('当前分销商数据222=' . json_encode($currentAgent)); + if (!empty($currentAgent)) { + $this->calcAgentUpgradePlan($currentAgent, $currentCommissionLevel = 1); + } + return true; + } + + public function calcAgentUpgradePlan($currentAgent,$currentCommissionLevel) { //默认只算到10级 if ($currentCommissionLevel >= self::CALC_LEVEL) { return false; } - - $canUpgradeLevel = $this->checkAgentUpgradeLevel($this->agent, $order); + $canUpgradeLevel = $this->checkAgentUpgradeLevel($currentAgent); \think\Log::info('当前分销商升级信息=' . $canUpgradeLevel . '] ---start'.'---循环次数---'.$currentCommissionLevel); if ($canUpgradeLevel) { -// if ($this->config->isUpgradeCheck()) { -// $this->agent->level_status = $canUpgradeLevel; -// } else { - $this->agent->level = $canUpgradeLevel; - LogModel::add($this->user->id, 'agent', ['type' => 'level', 'level' => LevelModel::find($canUpgradeLevel)]); -// } + $this->agent->level = $canUpgradeLevel; + LogModel::add($this->user->id, 'agent', ['type' => 'level', 'level' => LevelModel::find($canUpgradeLevel)]); $this->agent->save(); } - $parentUserId = $this->getParentUserId(); - \think\Log::info('上级分销商ID=' . $parentUserId . '] ---start'.'---分销商订单---'.json_encode($order).'---循环次数---'.$currentCommissionLevel); + $parentUserId = $currentAgent->getParentUserId(); if ($parentUserId) { - $this->createAsyncAgentUpgradeNew($parentUserId, $order); + $currentCommissionLevel ++; + $parentAgent = new Agent($parentUserId); + $this->calcAgentUpgradePlan($parentAgent, $currentCommissionLevel); } + return true; } @@ -256,17 +269,20 @@ class CommissionScoreLog /** * 比对当前分销商条件是否满足升级规则 */ - private function checkAgentUpgradeLevel($agent, $order) + private function checkAgentUpgradeLevel($agent) { $nextAgentLevel = $this->getNextAgentLevel($agent); - + \think\Log::info('当前分销商升级信息=' . json_encode($nextAgentLevel, true)); if (count($nextAgentLevel)) { foreach ($nextAgentLevel as $level) { - $checkLevel[$level->level] = $this->isMatchUpgradeLevelRule($level, $order); - // 不允许越级升级 + $checkLevel[$level->level] = $this->isMatchUpgradeLevelRule($level, $agent); + \think\Log::info('当前等级是否可以升级=' . json_encode($checkLevel, true)); + // 用户不允许越级升级 + // if (!$this->config->isUpgradeJump()) break; } $checkLevel = array_reverse($checkLevel, true); + \think\Log::info('当前等级是否可以升级反转过的=' . json_encode($checkLevel, true)); $canUpgradeLevel = array_search(true, $checkLevel); if ($canUpgradeLevel) { return $canUpgradeLevel; @@ -275,9 +291,11 @@ class CommissionScoreLog return 0; } - public function isMatchUpgradeLevelRule($level, $order) { + public function isMatchUpgradeLevelRule($level, $agent) { $is_level = false; - if (($order->order_amount + $this->getNextTeamTotal($this->user->id)) > $level->total_consume) { + \think\Log::info('当前用户消费总金额=' .($agent->user->total_consume + $this->getNextTeamTotal($agent->user->id)) ); + \think\Log::info('当前等级升级'.$level->level.'金额条件=' .$level->total_consume); + if (($agent->user->total_consume + $this->getNextTeamTotal($agent->user->id)) > $level->total_consume) { $is_level = true; } return $is_level; @@ -289,9 +307,7 @@ class CommissionScoreLog public function getNextTeamTotal($user_id) { $nextUserIds = []; $this->getNextTeamUserIds($this->getParent($user_id), $nextUserIds); - return Order::whereIn('user_id', $nextUserIds) - ->where('status', Order::STATUS_PAID) - ->sum('order_amount'); + return User::whereIn('id', $nextUserIds)->sum('total_consume'); } /** diff --git a/addons/shopro/service/order/OrderCreate.php b/addons/shopro/service/order/OrderCreate.php index bd63c44..16a1f06 100755 --- a/addons/shopro/service/order/OrderCreate.php +++ b/addons/shopro/service/order/OrderCreate.php @@ -1231,7 +1231,7 @@ class OrderCreate $pay_fee = bcsub($buyInfo['goods_amount'], bcadd($buyInfo['promo_discount_fee'], $buyInfo['coupon_discount_fee'], 2), 2); // 商品总金额(不算运费),减去(活动优惠(不包含包邮优惠) + 优惠券优惠) $orderItem->pay_fee = $pay_fee; // 平均计算单件商品不算运费,算折扣时候的金额 - $orderItem->dispatch_status = 0; + $orderItem->dispatch_status = $this->dispatch_type == 'shopZt' ? OrderItem::DISPATCH_STATUS_SENDED : OrderItem::DISPATCH_STATUS_NOSEND; $orderItem->dispatch_fee = $buyInfo['dispatch_amount']; // 运费模板中商品自动合并后的加权平均运费,没有扣除包邮优惠 // $orderItem->dispatch_type = $buyInfo['dispatch_type']; $orderItem->dispatch_type = $this->dispatch_type; diff --git a/addons/shopro/traits/CouponSend.php b/addons/shopro/traits/CouponSend.php index be14e63..aa6949d 100755 --- a/addons/shopro/traits/CouponSend.php +++ b/addons/shopro/traits/CouponSend.php @@ -145,9 +145,11 @@ trait CouponSend $coupon->setDec('stock'); $userCoupon = new UserCouponModel(); + $agent = (new \app\admin\model\shopro\commission\Agent())->where('user_id', $user->id)->find(); $userCoupon->user_id = $user->id; $userCoupon->coupon_id = $coupon->id; $userCoupon->use_time = null; + $userCoupon->user_level = $agent['level']; $userCoupon->save(); return $userCoupon; diff --git a/application/admin/controller/shopro/Coupon.php b/application/admin/controller/shopro/Coupon.php index a380528..a9bfe37 100755 --- a/application/admin/controller/shopro/Coupon.php +++ b/application/admin/controller/shopro/Coupon.php @@ -177,7 +177,7 @@ class Coupon extends Common * 时间设置有效期一年 */ public function initCouponData($params) { - $goods = Goods::whereIn('id', $params['items'])->find(); + $goods = Goods::where('id', $params['items'])->find(); $start_time = time(); $end_time = strtotime('+1 year', time()); @@ -189,7 +189,7 @@ class Coupon extends Common 'get_end_time' => $end_time, 'use_start_time' => $params['use_start_time'], 'use_end_time' => $params['use_end_time'], - 'limit_num' => 1, + 'limit_num' => 10000, 'items'=> $params['items'], 'stock' => 10000, 'use_time_type' => 'days', @@ -197,7 +197,7 @@ class Coupon extends Common 'use_scope' => $params['use_scope'], 'start_days' => $params['start_days'], 'type' => 'reduce', - 'amount' => $goods['price'],//优惠券面值金额 + 'amount' => $goods['price'][0],//优惠券面值金额 'enough' => 0,//消费门槛 ]; return $data; diff --git a/application/admin/controller/shopro/order/Order.php b/application/admin/controller/shopro/order/Order.php index 786fbb7..2af2b9f 100755 --- a/application/admin/controller/shopro/order/Order.php +++ b/application/admin/controller/shopro/order/Order.php @@ -175,11 +175,14 @@ class Order extends Common foreach ($order->items as $item) { // 处理 order_item 建议退款金额 $item->suggest_refund_fee = $item->suggest_refund_fee; + $order['dispatch_type'] = $item['dispatch_type']; } // 处理未支付订单 item status_code $order = $order->setOrderItemStatusByOrder($order); + + $this->success('获取成功', null, $order); } diff --git a/application/admin/controller/shopro/user/User.php b/application/admin/controller/shopro/user/User.php index 1451114..753cc1e 100755 --- a/application/admin/controller/shopro/user/User.php +++ b/application/admin/controller/shopro/user/User.php @@ -39,22 +39,37 @@ class User extends Common $agent = Agent::with('level_info')->where('user_id', $row['id'])->find(); if (!empty($agent)) { $row['user_level'] = $agent['level_info']['name']; + + } + if ($row['parent_user_id'] > 0) { + $row['parent_name'] = UserModel::where('id', $row['parent_user_id'])->value('nickname') ?? ''; } + $count = 0; - $row['nextUserCount'] = $this->getNextTeamCount($this->getParent($row['id']), $count);; + $row['nextUserCount'] = $this->getNextTeamCount($this->getParent($row['id']), $count); } $this->success('获取成功', null, $data); } - public function myTeam($id) { + public function team($id) { if (!$this->request->isAjax()) { return $this->view->fetch(); } $list = $this->getParent($id); - $this->success('success', $list); + + foreach ($list as &$item) { + $agent = Agent::with('level_info')->where('user_id', $item['id'])->find(); + if (!empty($agent)) { + $item['user_level'] = $agent['level_info']['name']; + $count = 0; + $item['nextUserCount'] = $this->getNextTeamCount($this->getParent($item['id']), $count); + } + } + + $this->success('success',null, $list); } public function getNexTeamCountDetail($user) { diff --git a/application/admin/model/shopro/Pay.php b/application/admin/model/shopro/Pay.php index b891825..bf64174 100755 --- a/application/admin/model/shopro/Pay.php +++ b/application/admin/model/shopro/Pay.php @@ -32,10 +32,11 @@ class Pay extends Common { return [ 'wechat' => '微信支付', - 'alipay' => '支付宝', - 'money' => '钱包支付', +// 'alipay' => '支付宝', +// 'money' => '钱包支付', 'score' => '积分支付', - 'offline' => '货到付款', +// 'offline' => '货到付款', + 'coupon' => '优惠券支付' ]; } diff --git a/application/admin/model/shopro/order/Order.php b/application/admin/model/shopro/order/Order.php index 41699a0..102c154 100755 --- a/application/admin/model/shopro/order/Order.php +++ b/application/admin/model/shopro/order/Order.php @@ -87,7 +87,7 @@ class Order extends Common 'unpaid' => '待付款', // 'paid' => '已支付', // 包括刚支付的,发货中,和已退款的,以及已完成的所有付过款的订单,不包含货到付款还未真实付款的订单 'nosend' => '待发货', - 'nozt' => '待取货', +// 'nozt' => '待取货', 'noget' => '待收货', // 'refuse' => '已拒收', // 'nocomment' => '待评价', @@ -113,10 +113,10 @@ class Order extends Common public function platformList() { return [ - 'H5' => 'H5', - 'WechatOfficialAccount' => '微信公众号', +// 'H5' => 'H5', +// 'WechatOfficialAccount' => '微信公众号', 'WechatMiniProgram' => '微信小程序', - 'App' => 'App', +// 'App' => 'App', ]; } diff --git a/application/admin/model/shopro/order/traits/OrderScope.php b/application/admin/model/shopro/order/traits/OrderScope.php index 3de1668..af01358 100755 --- a/application/admin/model/shopro/order/traits/OrderScope.php +++ b/application/admin/model/shopro/order/traits/OrderScope.php @@ -101,6 +101,39 @@ trait OrderScope return $query->where('apply_refund_status', Order::APPLY_REFUND_STATUS_APPLY); } + /** + * 待取货 + * @param $query + * @return mixed + */ + public function scopeNozt($query) { + $self_name = (new Order())->getQuery()->getTable(); + $item_name = (new OrderItem())->getQuery()->getTable(); + + $is_express = (request()->action() == 'exportdelivery') ? 1 : 0; // 是否是 express,将只查快递物流的代发货 + + return $query->noApplyRefund()->whereExists(function ($query) use ($self_name, $item_name, $is_express) { + $query->table($item_name)->where('order_id=' . $self_name . '.id') + ->where('dispatch_status', OrderItem::SHOP_ZT_STATUS) // 未取货 + ->where('refund_status', OrderItem::REFUND_STATUS_NOREFUND); // 没有退款完成 + if ($is_express) { // 只查快递物流的代发货 + $query->where('dispatch_type', 'express'); + } + })->whereNotExists(function ($query) use ($self_name, $item_name, $is_express) { + // 不是 正在售后的商品 + $query->table($item_name)->where('order_id=' . $self_name . '.id') + ->where('aftersale_status', OrderItem::AFTERSALE_STATUS_ING) // 但是售后中 + ->where('dispatch_status', OrderItem::DISPATCH_STATUS_NOSEND) // 未发货 + ->where('refund_status', OrderItem::REFUND_STATUS_NOREFUND); // 没有退款完成; + + if ($is_express) { // 只查快递物流的代发货 + $query->where('dispatch_type', 'express'); + } + }); + } + + + // 未发货 public function scopeNosend($query) diff --git a/application/admin/model/shopro/order/traits/OrderStatus.php b/application/admin/model/shopro/order/traits/OrderStatus.php index 2b70f6d..326038a 100755 --- a/application/admin/model/shopro/order/traits/OrderStatus.php +++ b/application/admin/model/shopro/order/traits/OrderStatus.php @@ -233,7 +233,7 @@ trait OrderStatus // 存在待收货,就是待收货 $status_code = 'noget'; } else if (in_array('nozt', $statusCodes)) { - // 存在待评价,就是待评价 + // 存在待取货,就是待取货 $status_code = 'nozt'; }else if (in_array('nocomment', $statusCodes)) { // 存在待评价,就是待评价 diff --git a/application/admin/view/shopro/config/index.html b/application/admin/view/shopro/config/index.html index c96116d..0e0eb22 100755 --- a/application/admin/view/shopro/config/index.html +++ b/application/admin/view/shopro/config/index.html @@ -348,7 +348,7 @@ - + diff --git a/application/admin/view/shopro/order/order/detail.html b/application/admin/view/shopro/order/order/detail.html index 7cf76fc..079ecd2 100755 --- a/application/admin/view/shopro/order/order/detail.html +++ b/application/admin/view/shopro/order/order/detail.html @@ -373,13 +373,13 @@ -
-
温馨提示
-
1、如果无法发货,请及时与买家联系并说明情况后主动退款;
-
2、买家申请售后,须征得买家同意后发货,否则买家有权拒收货物;
-
3、订单全部退款将会退回商品库存,并且减少实际销量,订单商品上的主动退款不会退回库存和销量 -
-
+ + + + + + +
@@ -397,10 +397,13 @@ 立即发货 + + 确认收货 {/if} {if $auth->check('shopro/order/order/fullRefund')} - 全部退款 - + + {/if}
@@ -438,10 +441,11 @@
{{ state.detail.status == 'pending' && state.detail.pay_mode=='offline'?state.detail.ext?.pending_date:state.detail.paid_time }}
-
待发货
+
待发货
+
待取货
- + - + + diff --git a/application/admin/view/shopro/user/user/index.html b/application/admin/view/shopro/user/user/index.html index 92625a7..eb0d849 100755 --- a/application/admin/view/shopro/user/user/index.html +++ b/application/admin/view/shopro/user/user/index.html @@ -31,6 +31,7 @@ + @@ -39,9 +40,9 @@ 查看 - 下级团队 - - @@ -50,7 +51,7 @@ - + diff --git a/application/admin/view/shopro/user/user/team.html b/application/admin/view/shopro/user/user/team.html index 0c728ed..eef5e66 100755 --- a/application/admin/view/shopro/user/user/team.html +++ b/application/admin/view/shopro/user/user/team.html @@ -13,7 +13,8 @@ - + + diff --git a/public/assets/js/backend/shopro/config.js b/public/assets/js/backend/shopro/config.js index f9cfe3a..c92bf38 100755 --- a/public/assets/js/backend/shopro/config.js +++ b/public/assets/js/backend/shopro/config.js @@ -156,9 +156,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } // 物流配置 - // const area = reactive({ - // select: [] - // }) + const area = reactive({ + select: [] + }) function getAreaSelect() { Fast.api.ajax({ url: 'shopro/data/area/select', diff --git a/public/assets/js/backend/shopro/coupon.js b/public/assets/js/backend/shopro/coupon.js index f990a9c..b42785d 100755 --- a/public/assets/js/backend/shopro/coupon.js +++ b/public/assets/js/backend/shopro/coupon.js @@ -23,44 +23,44 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin placeholder: '请输入查询内容', value: '', }, - type: { - type: 'tselect', - label: '类型', - value: '', - options: { - data: [{ - label: '满减券', - value: 'reduce', - }, - { - label: '折扣券', - value: 'discount', - }], - }, - }, - use_scope: { - type: 'tselect', - label: '可用范围', - value: '', - options: { - data: [{ - label: '全场通用', - value: 'all_use', - }, - { - label: '指定商品可用', - value: 'goods', - }, - { - label: '指定商品不可用', - value: 'disabled_goods', - }, - { - label: '指定分类可用', - value: 'category', - }], - }, - }, + // type: { + // type: 'tselect', + // label: '类型', + // value: '', + // options: { + // data: [{ + // label: '满减券', + // value: 'reduce', + // }, + // { + // label: '折扣券', + // value: 'discount', + // }], + // }, + // }, + // use_scope: { + // type: 'tselect', + // label: '可用范围', + // value: '', + // options: { + // data: [{ + // label: '全场通用', + // value: 'all_use', + // }, + // { + // label: '指定商品可用', + // value: 'goods', + // }, + // { + // label: '指定商品不可用', + // value: 'disabled_goods', + // }, + // { + // label: '指定分类可用', + // value: 'category', + // }], + // }, + // }, }, condition: {}, }, diff --git a/public/assets/js/backend/shopro/goods/goods.js b/public/assets/js/backend/shopro/goods/goods.js index fd39844..23ffaa0 100755 --- a/public/assets/js/backend/shopro/goods/goods.js +++ b/public/assets/js/backend/shopro/goods/goods.js @@ -63,18 +63,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // }, // }, // }, - activity_type: { - type: 'tselect', - label: '活动类型', - value: '', - options: { - data: [], - props: { - label: 'name', - value: 'type', - }, - }, - }, + // activity_type: { + // type: 'tselect', + // label: '活动类型', + // value: '', + // options: { + // data: [], + // props: { + // label: 'name', + // value: 'type', + // }, + // }, + // }, }, condition: {}, }, diff --git a/public/assets/js/backend/shopro/order/order.js b/public/assets/js/backend/shopro/order/order.js index abe308b..e7c90fe 100755 --- a/public/assets/js/backend/shopro/order/order.js +++ b/public/assets/js/backend/shopro/order/order.js @@ -108,10 +108,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin label: '订单编号', value: 'order_sn', }, - { - label: '售后单号', - value: 'aftersale.aftersale_sn', - }, + // { + // label: '售后单号', + // value: 'aftersale.aftersale_sn', + // }, { label: '支付单号', value: 'pay.pay_sn', @@ -153,30 +153,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin }], } }, - type: { - type: 'tselect', - label: '订单类型', - value: '', - options: { - data: [], - props: { - label: 'name', - value: 'type', - }, - }, - }, - platform: { - type: 'tselect', - label: '订单来源', - value: '', - options: { - data: [], - props: { - label: 'name', - value: 'type', - }, - }, - }, + // type: { + // type: 'tselect', + // label: '订单类型', + // value: '', + // options: { + // data: [], + // props: { + // label: 'name', + // value: 'type', + // }, + // }, + // }, + // platform: { + // type: 'tselect', + // label: '订单来源', + // value: '', + // options: { + // data: [], + // props: { + // label: 'name', + // value: 'type', + // }, + // }, + // }, 'pay.pay_type': { type: 'tselect', label: '支付方式', @@ -189,30 +189,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin }, }, }, - activity_type: { - type: 'tselect', - label: '活动类型', - value: '', - options: { - data: [], - props: { - label: 'name', - value: 'type', - }, - }, - }, - promo_types: { - type: 'tselect', - label: '促销类型', - value: '', - options: { - data: [], - props: { - label: 'name', - value: 'type', - }, - }, - }, + // activity_type: { + // type: 'tselect', + // label: '活动类型', + // value: '', + // options: { + // data: [], + // props: { + // label: 'name', + // value: 'type', + // }, + // }, + // }, + // promo_types: { + // type: 'tselect', + // label: '促销类型', + // value: '', + // options: { + // data: [], + // props: { + // label: 'name', + // value: 'type', + // }, + // }, + // }, 'item.goods_title': { type: 'tinput', label: '商品名称', @@ -250,7 +250,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin state.filter.tools['pay.pay_type'].options.data = res.data[key] } else if (key == 'status' || key == 'apply_refund_status') { } else { - state.filter.tools[key].options.data = res.data[key] + console.log(res.data[key]) + console.log(key) + // state.filter.tools[key].options.data = res.data[key]?.res.data[key] } } getData() @@ -384,6 +386,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin case 'noget': // 待收货 data.class = 'status-warning'; break; + case 'nozt': // 待取货 + data.class = 'status-warning'; + break; case 'nocomment': // 待评价 data.class = 'status-warning'; break; diff --git a/public/assets/js/backend/shopro/user/user.js b/public/assets/js/backend/shopro/user/user.js index 03f40f5..158efee 100755 --- a/public/assets/js/backend/shopro/user/user.js +++ b/public/assets/js/backend/shopro/user/user.js @@ -119,7 +119,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } function onNextTeam(id) { - Fast.api.open(`shopro/user/user/myTeam?id=${id}`, "下级团队", { + Fast.api.open(`shopro/user/user/team?id=${id}`, "下级团队", { callback() { getData() } @@ -146,7 +146,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin onChangeFilter, pagination, onDetail, - onDelete + onDelete, + onNextTeam } } } @@ -303,6 +304,157 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } createApp('detail', detail); }, + team:() => { + const { reactive, onMounted } = Vue + const detail = { + setup() { + const state = reactive({ + type: new URLSearchParams(location.search).get('type'), + id: new URLSearchParams(location.search).get('id'), + data: {} + }) + + function getDetail() { + Fast.api.ajax({ + url: `shopro/user/user/team/id/${state.id}`, + type: 'GET', + }, function (ret, res) { + state.data = res.data; + return false + }, function (ret, res) { }) + } + + const platform = { + wechat: { + openPlatform: '微信开放平台', + miniProgram: '微信小程序', + officialAccount: '微信公众平台', + }, + }; + + function statusStyle(key) { + let flag = state.detail.verification?.[key]; + return ` + ${flag ? '已' : '未'}${key == 'username' || key == 'password' ? '设置' : '认证'} + `; + } + + function onSelectAvatar() { + Fast.api.open(`general/attachment/select`, "选择", { + callback: function (data) { + state.detail.avatar = data.url; + } + }); + } + + async function onSave() { + Fast.api.ajax({ + url: `shopro/user/user/edit/id/${state.id}`, + type: 'POST', + data: state.detail, + }, function (ret, res) { + getDetail() + }, function (ret, res) { }) + } + + function onChangeParentUser() { + Fast.api.open(`shopro/commission/agent/select?id=${state.id}`, "更换上级分销商", { + callback() { + getDetail() + } + }) + } + + function onRecharge(type) { + Fast.api.open(`shopro/user/user/recharge?type=${type}&id=${state.detail.id}`, "充值", { + callback: function () { + getDetail(); + getLog() + } + }); + } + + const log = reactive({ + tabActive: 'money', + data: [], + }) + function getLog() { + let url + let search = {} + if (log.tabActive == 'money' || log.tabActive == 'score' || log.tabActive == 'commission') { + url = `shopro/user/wallet_log/${log.tabActive}/id/${state.id}` + } + if (log.tabActive == 'order') { + url = `shopro/order/order` + search = { + search: JSON.stringify({ + user_id: state.id + }) + } + } + if (log.tabActive == 'share') { + url = `shopro/share` + search = { + id: state.id + } + } + if (log.tabActive == 'coupon') { + url = `shopro/user/user/coupon/id/${state.id}` + } + Fast.api.ajax({ + url: url, + type: 'GET', + data: { + page: pagination.page, + list_rows: pagination.list_rows, + ...search, + }, + }, function (ret, res) { + if (log.tabActive == 'order') { + log.data = res.data.orders.data + pagination.total = res.data.orders.total + } else { + log.data = res.data.data + pagination.total = res.data.total + } + return false + }, function (ret, res) { }) + } + const pagination = reactive({ + page: 1, + list_rows: 10, + total: 0, + }) + function onChangeTab() { + log.data = [] + pagination.page = 1 + pagination.total = 0 + getLog() + } + + onMounted(() => { + getDetail() + // getLog() + }) + + return { + state, + getDetail, + platform, + statusStyle, + onSelectAvatar, + onSave, + onChangeParentUser, + onRecharge, + log, + getLog, + pagination, + onChangeTab, + } + } + } + createApp('team', detail); + }, recharge: () => { const { reactive, getCurrentInstance } = Vue const recharge = {