7 files added
38 files modified
| | |
| | | return $this->renderSuccess('', compact('order_id')); |
| | | } |
| | | } |
| | | |
| | | public function getRegistrationInformation($user_id = 0) |
| | | { |
| | | // 生成报名用户 |
| | | $model = new ActivityUserModel(); |
| | | $userId = $user_id!=0?$user_id:$this->getUser()['user_id']; |
| | | $registrationInformation = $model->getRegistrationInformation($userId); |
| | | return $this->renderSuccess('', compact('registrationInformation')); |
| | | } |
| | | /** |
| | | * 生成活动海报 |
| | | */ |
| | |
| | | if ($product['is_newcomer'] == 1) { |
| | | return $this->renderError('新人专区商品不能加入购物车'); |
| | | } |
| | | if ($product['is_vip'] == 1) { |
| | | return $this->renderError('vip专区商品不能加入购物车'); |
| | | } |
| | | if ($product['is_vip'] == 1) { |
| | | return $this->renderError('vip专区商品不能加入购物车'); |
| | | } |
| | | if ($product['is_repurchase'] == 1) { |
| | | return $this->renderError('复购专区商品不能加入购物车'); |
| | | } |
| | | if (!$model->add($this->user, $product_id, $product_num, $spec_sku_id)) { |
| | | return $this->renderError($model->getError() ?: '加入购物车失败'); |
| | | } |
| | |
| | | use app\common\model\user\BalanceLog as BalanceLogModel; |
| | | use app\common\model\branch\User as BranchUserModel; |
| | | use app\common\model\branch\Setting as BranchSettingModel; |
| | | |
| | | use app\common\model\settings\Region as RegionModel; |
| | | /** |
| | | * 用户模型 |
| | | */ |
| | |
| | | { |
| | | $detail = ActivityModel::detail($params["activity_id"]); |
| | | // 如果用户还没加入连盟并且不是帮朋友报名 |
| | | if (!$params['is_member'] && !$params['is_friend']) { |
| | | /*if (!$params['is_member'] && !$params['is_friend']) { |
| | | $this->addMember($detail, $params, $user); |
| | | } |
| | | }*/ |
| | | // 验证数据 |
| | | if (!$this->validateData($detail, $params, $user)) { |
| | | return false; |
| | |
| | | 'status' => $params['online_money'] > 0 ? 0 : 1, //报名状态,如果不需要在线支付则则直接报名成功 |
| | | 'pay_type' => $params['pay_type'], |
| | | 'in_radius' => $params['in_radius'], |
| | | 'province_id' => $params['province_id'], |
| | | 'city_id' => $params['city_id'], |
| | | 'region_id' => $params['region_id'], |
| | | 'company' => $params['company'], |
| | | 'recommend_name' => $params['recommend_name'], |
| | | 'recommend_mobile' => $params['recommend_mobile'], |
| | | 'real_name' => $params['recommend_name'], |
| | | 'mobile' => $params['mobile'], |
| | | 'branch_id' => $params['branch_id'], |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | // 如果是帮朋友报名,把用户信息记录下来 |
| | |
| | | } |
| | | return $this; |
| | | } |
| | | public function getRegistrationInformation($user_id) |
| | | { |
| | | $list=$this->where('user_id', '=', $user_id) |
| | | ->order('create_time', 'desc')->find(); |
| | | if (!$list){ |
| | | }else{ |
| | | $data=[ |
| | | 'province_id'=>$list['province_id'], |
| | | 'city_id'=>$list['city_id'], |
| | | 'region_id'=>$list['region_id'], |
| | | 'recommend_name'=>$list['recommend_name'], |
| | | 'recommend_mobile'=>$list['recommend_mobile'], |
| | | 'real_name'=>$list['real_name'], |
| | | 'mobile'=>$list['mobile'], |
| | | 'branch_id'=>$list['branch_id'], |
| | | 'company'=>$list['company'], |
| | | 'branch_name'=>(new Branch())->detail($list['branch_id'])['name'], |
| | | 'region'=>RegionModel::getNameById($list['province_id']).','.RegionModel::getNameById($list['city_id']).','.RegionModel::getNameById($list['region_id']), |
| | | |
| | | ]; |
| | | } |
| | | |
| | | return $data; |
| | | } |
| | | public function addMember($activity, $params, $user) |
| | | { |
| | | $data = [ |
| | |
| | | foreach ($productList as &$item) { |
| | | // 商品单价 |
| | | $item['product_price'] = $item['product_sku']['product_price']; |
| | | $item['settlement_price'] = $item['product_sku']['settlement_price']; |
| | | // 商品购买数量 |
| | | $item['total_num'] = $params['product_num']; |
| | | $item['spec_sku_id'] = $item['product_sku']['spec_sku_id']; |
| | |
| | | use app\common\enum\order\OrderSourceEnum; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | use app\common\model\settings\Setting as SettingModel; |
| | | use app\api\service\points\ConsumptionDeductService; |
| | | use app\api\service\consumption\ConsumptionDeductService; |
| | | use app\api\model\store\Store as StoreModel; |
| | | use app\api\service\user\UserService; |
| | | use app\common\enum\settings\DeliveryTypeEnum; |
| | |
| | | use app\common\service\BaseService; |
| | | use app\common\service\product\factory\ProductFactory; |
| | | use app\api\service\fullreduce\FullDeductService; |
| | | use app\common\model\plus\table\Record as RecordModel; //by lyzflash |
| | | use app\common\model\plus\table\Record as RecordModel; |
| | | |
| | | //by lyzflash |
| | | use app\common\model\order\OrderTrade as OrderTradeModel; |
| | | use app\common\model\branch\ActivityOrder as BranchActivityOrderModel; |
| | | use app\common\model\user\PointsLog as PointsLogModel; |
| | | use app\api\service\points\PointsDeductService; |
| | | |
| | | /** |
| | | * 订单结算服务基类 |
| | |
| | | $totalPoints = 0; |
| | | $totalProductReduce = 0; |
| | | $totalServicePrice = 0; |
| | | $totalConsumptionMoney = 0; |
| | | $totalConsumption = 0; |
| | | $this->commonOrderData = $this->getCommonOrderData(); |
| | | // 供应商 |
| | | foreach ($this->supplierData as &$supplier) { |
| | | // 整理订单数据 |
| | | $this->orderData = $this->getOrderData($supplier['shop_supplier_id'],$supplier['productList']); |
| | | $this->orderData = $this->getOrderData($supplier['shop_supplier_id'], $supplier['productList']); |
| | | // 订单商品总数量 |
| | | $orderTotalNum += helper::getArrayColumnSum($supplier['productList'], 'total_num'); |
| | | // 设置订单商品总服务费用 |
| | |
| | | $orderTotalPrice += $this->orderData['order_total_price']; |
| | | // 计算积分商城抵扣 |
| | | $this->setOrderPoints($supplier['productList'], $this->settledRule['force_points']); |
| | | // 计算积分商城抵扣 |
| | | $this->setOrderConsumption($supplier['productList']); |
| | | // 计算订单商品的实际付款金额 |
| | | $this->setOrderProductPayPrice($supplier['productList']); |
| | | |
| | | // 设置默认配送方式 |
| | | if(!isset($this->params['supplier'])){ |
| | | $deliveryType=SettingModel::getItem('store')['delivery_type']; |
| | | $delivery=$this->params['delivery']; |
| | | if(in_array($delivery,$deliveryType)){ |
| | | $delivery=$delivery; |
| | | }else if(in_array("10",$deliveryType)){ |
| | | $delivery=10; |
| | | }else if(in_array("40",$deliveryType)){ |
| | | $delivery=40; |
| | | }else{ |
| | | $delivery = $deliveryType[0]; |
| | | } |
| | | |
| | | if (!isset($this->params['supplier'])) { |
| | | $deliveryType = SettingModel::getItem('store')['delivery_type']; |
| | | $delivery = $this->params['delivery']; |
| | | if (in_array($delivery, $deliveryType)) { |
| | | $delivery = $delivery; |
| | | } else if (in_array("10", $deliveryType)) { |
| | | $delivery = 10; |
| | | } else if (in_array("40", $deliveryType)) { |
| | | $delivery = 40; |
| | | } else { |
| | | $delivery = $deliveryType[0]; |
| | | } |
| | | |
| | | $this->orderData['delivery'] = $supplier['productList'][0]['is_virtual'] == 1 || $supplier['productList'][0]['is_virtual'] == 2 || $supplier['productList'][0]['is_virtual'] == 3 ? 30 : $delivery; |
| | | }else{ |
| | | if($supplier['productList'][0]['is_virtual'] == 1 || $supplier['productList'][0]['is_virtual'] == 2 || $supplier['productList'][0]['is_virtual'] == 3){ |
| | | } else { |
| | | if ($supplier['productList'][0]['is_virtual'] == 1 || $supplier['productList'][0]['is_virtual'] == 2 || $supplier['productList'][0]['is_virtual'] == 3) { |
| | | $this->orderData['delivery'] = 30; |
| | | }else { |
| | | } else { |
| | | $this->orderData['delivery'] = $this->params['supplier'][$supplier['shop_supplier_id']]['delivery']; |
| | | } |
| | | $this->orderData['store_id'] = $this->params['supplier'][$supplier['shop_supplier_id']]['store_id']; |
| | | } |
| | | |
| | | |
| | | // 处理配送方式 |
| | | if ($this->orderData['delivery'] == DeliveryTypeEnum::EXPRESS) { |
| | | $this->setOrderExpress($supplier['productList']); |
| | |
| | | } elseif ($this->orderData['delivery'] == DeliveryTypeEnum::EXTRACT) { |
| | | $this->orderData['store_id'] > 0 && $this->orderData['extract_store'] = StoreModel::detail($this->params['supplier'][$supplier['shop_supplier_id']]['store_id']); |
| | | } elseif ($this->orderData['delivery'] == DeliveryTypeEnum::STORESS) { |
| | | $this->orderData['extract_store_id'] = isset($this->params['delivery_store']) ? $this->params['delivery_store'] : $this->orderData['store_id']; |
| | | } |
| | | $this->orderData['extract_store_id'] = isset($this->params['delivery_store']) ? $this->params['delivery_store'] : $this->orderData['store_id']; |
| | | } |
| | | |
| | | // 计算订单最终金额 |
| | | $this->setOrderPayPrice($supplier['productList']); |
| | |
| | | $this->setOrderPoints($supplier['productList'], $this->settledRule['force_points']); |
| | | $totalPointsMoney += $this->orderData['points_money']; |
| | | $totalPoints += $this->orderData['points_num']; |
| | | // 计算可用消费券抵扣 |
| | | $this->setOrderConsumption($supplier['productList']); |
| | | $totalConsumptionMoney += $this->orderData['consumption_money']; |
| | | $totalConsumption += $this->orderData['consumption_num']; |
| | | // 商品总价 - 积分抵扣 |
| | | foreach ($supplier['productList'] as &$product) { |
| | | $value = $product['total_pay_price']; |
| | | // 减去积分抵扣金额 |
| | | if ($this->orderData['is_allow_points'] && $this->commonOrderData['is_use_points'] && !$this->settledRule['force_points']) { |
| | | $value = helper::bcsub($product['total_pay_price'], $product['points_money']); |
| | | }// 减去消费券抵扣金额 |
| | | if ($this->orderData['is_allow_consumption'] && $this->commonOrderData['is_use_consumption'] && !$this->settledRule['force_points']) { |
| | | $value = helper::bcsub($value, $product['consumption_money']); |
| | | } |
| | | $product['total_pay_price'] = helper::number2($value); |
| | | } |
| | |
| | | $this->commonOrderData['is_use_points'] && $orderPayPrice = $orderPayPrice - $totalPointsMoney; |
| | | // 计算订单积分赠送数量 |
| | | $this->setOrderPointsBonus(); |
| | | // 计算订单消费券赠送数量 |
| | | $this->setOrderConsumptionBonus(); |
| | | |
| | | //订单数据 |
| | | $this->commonOrderData = array_merge([ |
| | |
| | | 'order_pay_price' => helper::number2($orderPayPrice), // 商品总价,最终支付 |
| | | 'total_service_price' => helper::number2($totalServicePrice), // 商品总服务费 |
| | | 'coupon_list' => [], |
| | | 'coupon_id_sys' =>'', |
| | | 'coupon_id_sys' => '', |
| | | 'coupon_money_sys' => 0, |
| | | 'points_money' => $totalPointsMoney, |
| | | 'points_num' => $totalPoints, |
| | | 'is_real_use_points' => $this->params['is_use_points'], |
| | | 'is_real_use_consumption' => $this->params['is_use_consumption'], |
| | | 'product_reduce_money' => $totalProductReduce, |
| | | 'consumption_money' => $totalConsumptionMoney, |
| | | 'consumption_num' => $totalConsumption, |
| | | 'verify_data' => $verify_data, |
| | | 'booking_data' => $booking_data, |
| | | 'last_extract' => UserService::getLastExtract($this->user['user_id']), |
| | | // 房间id |
| | | 'room_id' => isset($this->params['room_id']) && $this->params['room_id'] > 0 ? $this->params['room_id'] : 0, |
| | | // 计次卡 |
| | | 'counting_id' => 0, |
| | | 'counting_id' => 0, |
| | | 'user_counting_data' => [], |
| | | 'activity_id' => $this->params['activity_id'], //活动id |
| | | ], $this->commonOrderData, $this->settledRule); |
| | |
| | | return false; |
| | | } |
| | | // 判断是否超过限购数量 |
| | | if($product['limit_num'] > 0){ |
| | | if ($product['limit_num'] > 0) { |
| | | $hasNum = OrderModel::getHasBuyOrderNum($this->user['user_id'], $product['product_id']); |
| | | if($hasNum + $product['total_num'] > $product['limit_num']){ |
| | | if ($hasNum + $product['total_num'] > $product['limit_num']) { |
| | | $this->error = "很抱歉,购买超过此商品最大限购数量"; |
| | | return false; |
| | | } |
| | |
| | | if ($this->orderData['is_allow_points'] && $this->commonOrderData['is_use_points'] && !$this->settledRule['force_points']) { |
| | | $value = helper::bcsub($value, $product['points_money']); |
| | | } |
| | | // 减去消费券抵扣金额 |
| | | if ($this->orderData['is_allow_consumption'] && $this->commonOrderData['is_use_consumption'] && !$this->settledRule['force_points']) { |
| | | $value = helper::bcsub($value, $product['consumption_money']); |
| | | } |
| | | $product['total_pay_price'] = helper::number2($value); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 整理订单数据(结算台初始化) |
| | | */ |
| | | private function getOrderData($shop_supplier_id,$productList=[]) |
| | | private function getOrderData($shop_supplier_id, $productList = []) |
| | | { |
| | | // 系统支持的配送方式 (后台设置) |
| | | $deliveryType = SettingModel::getItem('store')['delivery_type']; |
| | | |
| | | $deliveryType = SettingModel::getItem('store')['delivery_type']; |
| | | |
| | | // 积分设置 |
| | | $pointsSetting = SettingModel::getItem('points'); |
| | | |
| | | if(isset($this->params['supplier'])){ |
| | | if (isset($this->params['supplier'])) { |
| | | $delivery = $this->params['supplier'][$shop_supplier_id]['delivery']; |
| | | }else{ |
| | | if(in_array("10",$deliveryType)){ |
| | | $delivery=10; |
| | | }else if(in_array("40",$deliveryType)){ |
| | | $delivery=40; |
| | | }else{ |
| | | $delivery = $deliveryType[0]; |
| | | } |
| | | } |
| | | } else { |
| | | if (in_array("10", $deliveryType)) { |
| | | $delivery = 10; |
| | | } else if (in_array("40", $deliveryType)) { |
| | | $delivery = 40; |
| | | } else { |
| | | $delivery = $deliveryType[0]; |
| | | } |
| | | } |
| | | |
| | | if(!empty($productList) && ($productList[0]['is_virtual'] == 1 || $productList[0]['is_virtual'] == 3)){ |
| | | if (!empty($productList) && ($productList[0]['is_virtual'] == 1 || $productList[0]['is_virtual'] == 3)) { |
| | | //虚拟商品核销 by yj |
| | | $verify_data = [ |
| | | 'is_verify' => $productList[0]['is_verify'] && empty($productList[0]['virtual_auto']) ? 1 : 0, //必须是手动发货并且支持核销 |
| | |
| | | $verify_data['verify_start_time'] = date('Y-m-d', $productList[0]['verify_start_time']); |
| | | $verify_data['verify_end_time'] = date('Y-m-d', $productList[0]['verify_end_time']); |
| | | } |
| | | }else{ |
| | | } else { |
| | | $verify_data = []; |
| | | } |
| | | |
| | | //通过收货地址获取最近的门店 |
| | | if(!empty($this->user['address_default'])){ |
| | | if (!empty($this->user['address_default'])) { |
| | | $address = $this->user['address_default']; |
| | | $store_list = (new storeModel())->getList(false,$address["longitude"],$address["latitude"],false,$shop_supplier_id); |
| | | if(!empty($store_list)){ |
| | | $store_list = (new storeModel())->getList(false, $address["longitude"], $address["latitude"], false, $shop_supplier_id); |
| | | if (!empty($store_list)) { |
| | | $sell_store_id = $store_list[0]["store_id"]; |
| | | } |
| | | } |
| | |
| | | //优惠券id |
| | | 'coupon_id' => 0, |
| | | //优惠金额 |
| | | 'coupon_money'=>0, |
| | | 'coupon_money' => 0, |
| | | //总服务费用金额 |
| | | 'total_service_price'=>0, |
| | | 'total_service_price' => 0, |
| | | // 通过收货地址获取最近的门店出货 |
| | | 'sell_store_id' => empty($sell_store_id) ? 0 : $sell_store_id, |
| | | ]; |
| | |
| | | /*if( $this->user['user_id'] == 8743){ |
| | | print_r("a".$cityId);exit; |
| | | }*/ |
| | | /* if(empty($cityId)){ |
| | | $this->error = "请先完善您的收货地址再提交订单"; |
| | | return false; |
| | | }*/ |
| | | /* if(empty($cityId)){ |
| | | $this->error = "请先完善您的收货地址再提交订单"; |
| | | return false; |
| | | }*/ |
| | | |
| | | // 初始化配送服务类 |
| | | $ExpressService = new ExpressService( |
| | |
| | | //如果是积分兑换,判断用户积分是否足够 |
| | | if ($this->settledRule['force_points']) { |
| | | //因为积分会过期问题 所以现在读取现在有的积分 |
| | | $points = ( new PointsLogModel())->getUserPoints($this->user['user_id']); |
| | | $points = (new PointsLogModel())->getUserPoints($this->user['user_id']); |
| | | if ($points < $order['orderData']['points_num']) { |
| | | $this->error = '用户积分不足,无法使用积分兑换'; |
| | | return false; |
| | |
| | | $this->saveOrderAddress($commomOrder['address'], $status); |
| | | } elseif ($supplier['orderData']['delivery'] == DeliveryTypeEnum::EXTRACT) { |
| | | // 记录自提信息 |
| | | if(!empty($this->params['linkman']) && !empty($this->params['phone'])){ |
| | | if (!empty($this->params['linkman']) && !empty($this->params['phone'])) { |
| | | $this->saveOrderExtract($this->params['linkman'], $this->params['phone']); |
| | | }else{ |
| | | } else { |
| | | $this->saveOrderExtract($commomOrder['address']['name'], $commomOrder['address']['phone']); |
| | | } |
| | | } |
| | |
| | | $this->saveOrderProduct($supplier, $status, $commomOrder); |
| | | |
| | | // 更新商品库存 (针对下单减库存的商品) |
| | | if(!empty($commomOrder["extract_store_id"])){ |
| | | if (!empty($commomOrder["extract_store_id"])) { |
| | | //自提门店 |
| | | $sell_store_id = $commomOrder["extract_store_id"]; |
| | | }elseif(!empty($commomOrder["sell_store_id"])){ |
| | | } elseif (!empty($commomOrder["sell_store_id"])) { |
| | | //没有自提门店,判断出货门店 |
| | | $sell_store_id = $supplier['orderData']["sell_store_id"]; |
| | | }else{ |
| | | } else { |
| | | $sell_store_id = 0; |
| | | } |
| | | // 减库存 |
| | |
| | | // 积分兑换扣除用户积分 |
| | | if ($commomOrder['force_points']) { |
| | | $describe = "用户积分兑换消费:{$this->model['order_no']}"; |
| | | $this->user->setIncPoints(-$commomOrder['points_num'], $describe,0,true,$status); |
| | | $this->user->setIncPoints(-$commomOrder['points_num'], $describe, 0, true, $status); |
| | | } else { |
| | | // 积分抵扣情况下扣除用户积分 |
| | | if ($commomOrder['is_allow_points'] && $commomOrder['is_real_use_points'] && $commomOrder['points_num'] > 0) { |
| | | $describe = "用户消费:{$this->model['order_no']}"; |
| | | $this->user->setIncPoints(-$commomOrder['points_num'], $describe,0,true,$status); |
| | | $this->user->setIncPoints(-$commomOrder['points_num'], $describe, 0, true, $status); |
| | | } |
| | | if ($commomOrder['is_allow_consumption'] && $commomOrder['is_real_use_consumption'] && $commomOrder['consumption_num'] > 0) { |
| | | $describe = "用户消费:{$this->model['order_no']}"; |
| | | $this->user->setIncConsumption(-$commomOrder['consumptions_num'], $describe,0,true,$status); |
| | | $this->user->setIncConsumption(-$commomOrder['consumptions_num'], $describe, 0, true, $status); |
| | | } |
| | | } |
| | | return $status; |
| | |
| | | 'order_price' => $order['order_price'], |
| | | 'coupon_id' => 0, |
| | | 'coupon_money' => $supplier['orderData']['coupon_money'], |
| | | 'coupon_id_sys'=>0, |
| | | 'coupon_money_sys'=>0, |
| | | 'points_money' => $commomOrder['is_real_use_points'] == 1?$supplier['orderData']['points_money']:0, |
| | | 'points_num' => $commomOrder['is_real_use_points'] == 1?$supplier['orderData']['points_num']:0, |
| | | 'coupon_id_sys' => 0, |
| | | 'coupon_money_sys' => 0, |
| | | 'points_money' => $commomOrder['is_real_use_points'] == 1 ? $supplier['orderData']['points_money'] : 0, |
| | | 'points_num' => $commomOrder['is_real_use_points'] == 1 ? $supplier['orderData']['points_num'] : 0, |
| | | 'pay_price' => $order['order_pay_price'], |
| | | 'delivery_type' => $supplier['orderData']['delivery'], |
| | | 'pay_type' => $commomOrder['pay_type'], |
| | |
| | | 'buyer_remark' => $this->params['supplier'][$supplier['shop_supplier_id']]['remark'], |
| | | 'order_source' => $this->orderSource['source'], |
| | | 'points_bonus' => $supplier['orderData']['points_bonus'], |
| | | 'is_agent' => $this->settledRule['is_agent']? 1:0, |
| | | 'is_agent' => $this->settledRule['is_agent'] ? 1 : 0, |
| | | 'shop_supplier_id' => $supplier['shop_supplier_id'], |
| | | 'supplier_money' => $order['supplier_money'], |
| | | 'sys_money' => $order['sys_money'], |
| | | 'app_id' => $this->app_id, |
| | | 'room_id' => $commomOrder['room_id'], |
| | | 'virtual_auto' => $supplier['productList'][0]['virtual_auto'], |
| | | 'is_verify' => isset($supplier['productList'][0]['is_verify'])?$supplier['productList'][0]['is_verify']:0, //是否支持核销 by yj |
| | | 'is_verify' => isset($supplier['productList'][0]['is_verify']) ? $supplier['productList'][0]['is_verify'] : 0, //是否支持核销 by yj |
| | | 'is_virtual' => $supplier['productList'][0]['is_virtual'], //是否是服务商品 by yj |
| | | 'product_reduce_money' => 0, |
| | | 'product_reduce_money' => 0, |
| | | 'user_counting_id' => empty($commomOrder['user_counting_data']) ? 0 : $commomOrder['user_counting_data']["order_id"], |
| | | 'total_service_price' => empty($order['total_service_price']) ? 0 : $order['total_service_price'], |
| | | // 'sell_store_id' => empty($sell_store_id) ? 0 : $sell_store_id, |
| | |
| | | $data['express_price'] = $order['express_price']; |
| | | } elseif ($supplier['orderData']['delivery'] == DeliveryTypeEnum::EXTRACT) { |
| | | $data['extract_store_id'] = $order['extract_store']['store_id']; |
| | | }elseif ($supplier['orderData']['delivery'] == DeliveryTypeEnum::STORESS) { |
| | | } elseif ($supplier['orderData']['delivery'] == DeliveryTypeEnum::STORESS) { |
| | | //配送门店 |
| | | $data['delivery_store'] = isset($this->params['delivery_store']) ? $this->params['delivery_store'] : $order['extract_store_id']; |
| | | $data['extract_store_id'] = isset($this->params['delivery_store']) ? $this->params['delivery_store'] : $order['extract_store_id']; |
| | | } |
| | | $data['delivery_store'] = isset($this->params['delivery_store']) ? $this->params['delivery_store'] : $order['extract_store_id']; |
| | | $data['extract_store_id'] = isset($this->params['delivery_store']) ? $this->params['delivery_store'] : $order['extract_store_id']; |
| | | } |
| | | |
| | | //随主订单配置 |
| | | $config = SettingModel::getItem('trade'); |
| | |
| | | $this->model->save($data); |
| | | $order_id = $this->model['order_id']; |
| | | $activity_order = new BranchActivityOrderModel(); |
| | | $activity_order->save(['order_id'=>$order_id,'activity_id'=>$commomOrder['activity_id'], 'app_id' => $this->app_id, 'shop_supplier_id' => $supplier['shop_supplier_id']]); |
| | | $activity_order->save(['order_id' => $order_id, 'activity_id' => $commomOrder['activity_id'], 'app_id' => $this->app_id, 'shop_supplier_id' => $supplier['shop_supplier_id']]); |
| | | return $order_id; |
| | | } |
| | | |
| | |
| | | 'line_price' => $product['product_sku']['line_price'], |
| | | 'product_weight' => empty($product['product_sku']['product_weight']) ? 0 : $product['product_sku']['product_weight'], |
| | | 'is_user_grade' => (int)$product['is_user_grade'], |
| | | 'grade_ratio' => $product['grade_ratio']??0, |
| | | 'grade_product_price' => isset($product['grade_product_price'])?$product['grade_product_price']:0, |
| | | 'grade_total_money' => $product['grade_total_money']??0, |
| | | 'coupon_money' => isset($product['coupon_money'])?$product['coupon_money']:0, |
| | | 'points_money' => isset($product['points_money']) && $commomOrder['is_real_use_points']?$product['points_money']:0, |
| | | 'points_num' => isset($product['points_num']) && $commomOrder['is_real_use_points']?$product['points_num']:0, |
| | | 'points_bonus' => isset($product['points_bonus'])?$product['points_bonus']:0, |
| | | 'grade_ratio' => $product['grade_ratio'] ?? 0, |
| | | 'grade_product_price' => isset($product['grade_product_price']) ? $product['grade_product_price'] : 0, |
| | | 'grade_total_money' => $product['grade_total_money'] ?? 0, |
| | | 'coupon_money' => isset($product['coupon_money']) ? $product['coupon_money'] : 0, |
| | | 'points_money' => isset($product['points_money']) && $commomOrder['is_real_use_points'] ? $product['points_money'] : 0, |
| | | 'points_num' => isset($product['points_num']) && $commomOrder['is_real_use_points'] ? $product['points_num'] : 0, |
| | | 'points_bonus' => isset($product['points_bonus']) ? $product['points_bonus'] : 0, |
| | | 'total_num' => $product['total_num'], |
| | | 'total_price' => $product['total_price'], |
| | | 'total_pay_price' => $product['total_pay_price'], |
| | |
| | | 'first_money' => $product['first_money'], |
| | | 'second_money' => $product['second_money'], |
| | | 'third_money' => $product['third_money'], |
| | | 'fullreduce_money' => isset($product['fullreduce_money'])?$product['fullreduce_money']:0, |
| | | 'fullreduce_money' => isset($product['fullreduce_money']) ? $product['fullreduce_money'] : 0, |
| | | 'virtual_content' => $product['virtual_content'], |
| | | 'is_alone_team' => $product['is_alone_team'], |
| | | 'alone_team_equity' => $product['alone_team_equity'], |
| | |
| | | 'is_verify' => $product['is_verify'], |
| | | 'verify_type' => $product['verify_type'], |
| | | 'verify_day' => $product['verify_day'], |
| | | 'service_name' => !empty($product['service_name'])?$product['service_name']:'', |
| | | 'service_price' => !empty($product['service_price'])?$product['service_price']:0, |
| | | 'service_name' => !empty($product['service_name']) ? $product['service_name'] : '', |
| | | 'service_price' => !empty($product['service_price']) ? $product['service_price'] : 0, |
| | | ]; |
| | | |
| | | // 记录订单商品来源id |
| | |
| | | $this->orderData['is_allow_points'] = true; |
| | | |
| | | //因为积分会过期问题 所以现在读取现在有的积分 |
| | | $points = ( new PointsLogModel())->getUserPoints($this->user['user_id']); |
| | | $points = (new PointsLogModel())->getUserPoints($this->user['user_id']); |
| | | if ($points < $productList[0]['points_num']) { |
| | | $this->error = '用户积分不足,无法使用积分兑换'; |
| | | return false; |
| | | } |
| | | /* if ($this->user['points'] < $productList[0]['points_num']) { |
| | | $this->error = '积分不足,去多赚点积分吧!'; |
| | | return false; |
| | | }*/ |
| | | /* if ($this->user['points'] < $productList[0]['points_num']) { |
| | | $this->error = '积分不足,去多赚点积分吧!'; |
| | | return false; |
| | | }*/ |
| | | return true; |
| | | } |
| | | if($force_points){ |
| | | if ($force_points) { |
| | | return true; |
| | | } |
| | | // 积分设置 |
| | |
| | | return false; |
| | | } |
| | | // 计算订单商品实际抵扣的积分数量和金额 |
| | | $ProductDeduct = new ConsumptionDeductService($productList); |
| | | $ProductDeduct = new PointsDeductService($productList); |
| | | $ProductDeduct->setProductPoints($maxPointsNumCount, $actualPointsNum); |
| | | // 积分抵扣总金额 |
| | | $orderPointsMoney = helper::getArrayColumnSum($productList, 'points_money'); |
| | |
| | | // 最多可抵扣的积分数量 |
| | | $product['max_points_num'] = helper::bcdiv($maxPointsMoney, $setting['discount']['discount_ratio'], 0); |
| | | // 如果超过商品最大抵扣数量 |
| | | if($product['max_points_discount'] > 0 && $product['max_points_num'] > $product['max_points_discount'] * $product['total_num']){ |
| | | if ($product['max_points_discount'] > 0 && $product['max_points_num'] > $product['max_points_discount'] * $product['total_num']) { |
| | | $product['max_points_num'] = $product['max_points_discount'] * $product['total_num']; |
| | | } |
| | | } |
| | |
| | | private function setOrderPointsBonus() |
| | | { |
| | | // 初始化商品积分赠送数量 |
| | | foreach ($this->supplierData as &$supplier){ |
| | | foreach ($supplier['productList'] as $product){ |
| | | foreach ($this->supplierData as &$supplier) { |
| | | foreach ($supplier['productList'] as $product) { |
| | | $product['points_bonus'] = 0; |
| | | } |
| | | $supplier['orderData']['points_bonus'] = 0; |
| | |
| | | |
| | | |
| | | /** |
| | | * 计算订单可用消费券抵扣 |
| | | */ |
| | | private function setOrderConsumption($productList) |
| | | { |
| | | $this->orderData['consumption_money'] = 0; |
| | | // 消费券抵扣总数量 |
| | | $this->orderData['consumption_num'] = 0; |
| | | // 允许消费券抵扣 |
| | | $this->orderData['is_allow_consumption'] = false; |
| | | // 消费券设置 |
| | | $setting = SettingModel::getItem('consumption'); |
| | | // 条件:后台开启下单使用消费券抵扣 |
| | | if (!$setting['is_shopping_discount']) { |
| | | return false; |
| | | } |
| | | // 条件:订单金额满足[?]元 |
| | | if (helper::bccomp($setting['discount']['full_order_price'], $this->orderData['order_total_price']) === 1) { |
| | | return false; |
| | | } |
| | | // 计算订单商品最多可抵扣的消费券数量 |
| | | $this->setOrderConsumptionMaxPointsNum($productList); |
| | | // 订单最多可抵扣的消费券总数量 |
| | | $maxConsumptionNumCount = helper::getArrayColumnSum($productList, 'max_consumption_num'); |
| | | // 实际可抵扣的消费券数量 |
| | | $actualConsumptionNum = min($maxConsumptionNumCount, $this->user['consumer_coupon']); |
| | | if ($actualConsumptionNum < 1) { |
| | | $this->orderData['consumption_money'] = 0; |
| | | // 消费券抵扣总数量 |
| | | $this->orderData['consumption_num'] = 0; |
| | | // 允许消费券抵扣 |
| | | $this->orderData['is_allow_consumption'] = true; |
| | | return false; |
| | | } |
| | | // 计算订单商品实际抵扣的消费券数量和金额 |
| | | $ProductDeduct = new ConsumptionDeductService($productList); |
| | | $ProductDeduct->setProductConsumption($maxConsumptionNumCount, $actualConsumptionNum); |
| | | // 消费券抵扣总金额 |
| | | $orderConsumptionMoney = helper::getArrayColumnSum($productList, 'consumption_money'); |
| | | $this->orderData['consumption_money'] = helper::number2($orderConsumptionMoney); |
| | | // 消费券抵扣总数量 |
| | | $this->orderData['consumption_num'] = $actualConsumptionNum; |
| | | // 允许消费券抵扣 |
| | | $this->orderData['is_allow_consumption'] = true; |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 计算订单商品最多可抵扣的消费券数量 |
| | | */ |
| | | private function setOrderConsumptionMaxPointsNum($productList) |
| | | { |
| | | // 消费券设置 |
| | | $setting = SettingModel::getItem('consumption'); |
| | | foreach ($productList as &$product) { |
| | | // 商品不允许消费券抵扣 |
| | | if (!$product['is_consumption_discount'] || $product['is_repurchase'] || $product['is_newcomer'] || $product['is_vip']) continue; |
| | | // 消费券抵扣比例 |
| | | $deductionRatio = helper::bcdiv($setting['discount']['max_money_ratio'], 100); |
| | | // 最多可抵扣的金额 |
| | | $maxPointsMoney = helper::bcmul($product['total_price'], $deductionRatio); |
| | | // 最多可抵扣的消费券数量 |
| | | $product['max_consumption_num'] = helper::bcdiv($maxPointsMoney, $setting['discount']['discount_ratio'], 0); |
| | | // 如果超过商品最大抵扣数量 |
| | | if ($product['max_consumption_discount'] > 0 && $product['max_consumption_num'] > $product['max_consumption_discount'] * $product['total_num']) { |
| | | $product['max_consumption_num'] = $product['max_consumption_discount'] * $product['total_num']; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算订单消费券赠送数量 |
| | | */ |
| | | private function setOrderConsumptionBonus() |
| | | { |
| | | // 初始化商品消费券赠送数量 |
| | | foreach ($this->supplierData as &$supplier) { |
| | | foreach ($supplier['productList'] as $product) { |
| | | $product['consumption_bonus'] = 0; |
| | | } |
| | | $supplier['orderData']['consumption_bonus'] = 0; |
| | | } |
| | | // 消费券设置 |
| | | $setting = SettingModel::getItem('consumption'); |
| | | // 条件:后台开启开启购物送消费券 |
| | | if (!$setting['is_shopping_gift']) { |
| | | return false; |
| | | } |
| | | // 设置商品消费券赠送数量 |
| | | foreach ($this->supplierData as &$supplier) { |
| | | foreach ($supplier['productList'] as &$product) { |
| | | // 消费券赠送比例 |
| | | $ratio = $setting['gift_ratio'] / 100; |
| | | // 计算抵扣的消费券数量 |
| | | $product['consumption_bonus'] = !$product['is_consumption_gift'] ? 0 : helper::bcmul($product['total_pay_price'], $ratio, 0); |
| | | } |
| | | // 订单消费券赠送数量 |
| | | $supplier['orderData']['consumption_bonus'] = helper::getArrayColumnSum($supplier['productList'], 'consumption_bonus'); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 设置订单商品服务费用 |
| | | */ |
| | | private function setProductService($productList) |
| | |
| | | $productListTemp = helper::getArrayColumns($productList, ['total_price']); |
| | | $service = new FullDeductService; |
| | | $completed = $service->setProductFullreduceMoney($productListTemp, $reduce['reduced_price']); |
| | | if($completed){ |
| | | if ($completed) { |
| | | // 分配订单商品优惠券抵扣金额 |
| | | foreach ($productList as $key => &$product) { |
| | | $product['fullreduce_money'] = $completed[$key]['fullreduce_money'] / 100; |
| | |
| | | private function setOrderFinalPrice() |
| | | { |
| | | |
| | | foreach ($this->supplierData as &$supplier){ |
| | | foreach ($this->supplierData as &$supplier) { |
| | | //商户独立抽成 |
| | | $config = SettingModel::getSupplierCommissionRate($supplier["shop_supplier_id"]); |
| | | $sys_percent = intval($config['commission_rate']); |
| | | $supplier_percent = 100 - $sys_percent; |
| | | // 供应商结算金额,包括运费 |
| | | $supplier['orderData']['supplier_money'] = helper::number2($supplier['orderData']['order_price'] * $supplier_percent/100 + $supplier['orderData']['express_price']); |
| | | $supplier['orderData']['supplier_money'] = helper::number2($supplier['orderData']['order_price'] * $supplier_percent / 100 + $supplier['orderData']['express_price']); |
| | | // 平台分佣金额 |
| | | $supplier['orderData']['sys_money'] = helper::number2($supplier['orderData']['order_price'] * $sys_percent/100); |
| | | $supplier['orderData']['sys_money'] = helper::number2($supplier['orderData']['order_price'] * $sys_percent / 100); |
| | | // 产品价格 |
| | | // 结算金额不包括运费 |
| | | foreach ($supplier['productList'] as &$product){ |
| | | foreach ($supplier['productList'] as &$product) { |
| | | |
| | | $product['supplier_money'] = helper::number2($product['total_pay_price'] * $supplier_percent/100); |
| | | $product['sys_money'] = helper::number2($product['total_pay_price'] * $sys_percent/100); |
| | | $product['supplier_money'] = helper::number2($product['total_pay_price'] * $supplier_percent / 100); |
| | | $product['sys_money'] = helper::number2($product['total_pay_price'] * $sys_percent / 100); |
| | | } |
| | | } |
| | | $price = 0; |
| | | foreach ($this->supplierData as &$supplier){ |
| | | foreach ($this->supplierData as &$supplier) { |
| | | $price += $supplier['orderData']['order_pay_price']; |
| | | } |
| | | |
| | |
| | | use app\api\model\plus\coupon\UserCoupon as UserCouponModel; |
| | | use app\api\model\product\Category; |
| | | use app\api\service\consumption\ConsumptionDeductService; |
| | | use app\api\service\points\PointsDeductService; |
| | | use app\common\enum\order\OrderPayTypeEnum; |
| | | use app\common\enum\order\OrderSourceEnum; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | |
| | | $totalConsumptionMoney = 0; |
| | | $totalConsumption = 0; |
| | | $totalProductReduce = 0; |
| | | $settlementPrice=0; |
| | | $this->commonOrderData = $this->getCommonOrderData(); |
| | | // 供应商 |
| | | foreach ($this->supplierData as &$supplier) { |
| | |
| | | // 设置订单商品总金额(不含优惠折扣) |
| | | $this->setOrderTotalPrice($supplier['productList']); |
| | | $orderTotalPrice += $this->orderData['order_total_price']; |
| | | // 设置订单商品总结算金额(不含优惠折扣) |
| | | $this->setOrderSettlementPrice($supplier['productList']); |
| | | $settlementPrice += $this->orderData['settlement_price']; |
| | | // 先计算商品满减 |
| | | $this->setProductReduce($supplier['productList']); |
| | | $totalProductReduce += $this->orderData['product_reduce_money']; |
| | |
| | | $this->commonOrderData = array_merge([ |
| | | 'order_total_num' => $orderTotalNum, // 商品总数量 |
| | | 'order_total_price' => helper::number2($orderTotalPrice), // 商品总价 |
| | | 'settlement_price' => helper::number2($settlementPrice), // 商品总结算价 |
| | | 'order_pay_price' => helper::number2($orderPayPrice), // 商品总价,最终支付 |
| | | 'coupon_list' => $couponList, |
| | | 'coupon_id_sys' => $coupon_id, |
| | |
| | | // 订单商品的总金额(不含优惠券折扣) |
| | | $this->orderData['order_total_price'] = helper::number2(helper::getArrayColumnSum($productList, 'total_price')); |
| | | } |
| | | /** |
| | | * 设置订单的商品总结算金额(不含优惠折扣) |
| | | */ |
| | | private function setOrderSettlementPrice($productList) |
| | | { |
| | | // 订单商品的总金额(不含优惠券折扣) |
| | | $this->orderData['settlement_price'] = helper::number2(helper::getArrayColumnSum($productList, 'settlement_price')); |
| | | } |
| | | |
| | | /** |
| | | * 当前用户可用的优惠券列表 |
| | |
| | | if ($this->orderData['is_allow_points'] && $this->commonOrderData['is_use_points'] && !$this->settledRule['force_points']) { |
| | | $value = helper::bcsub($value, $product['points_money']); |
| | | } |
| | | // 减去积分抵扣金额 |
| | | // 减去消费券抵扣金额 |
| | | if ($this->orderData['is_allow_consumption'] && $this->commonOrderData['is_use_consumption'] && !$this->settledRule['force_points']) { |
| | | $value = helper::bcsub($value, $product['consumption_money']); |
| | | } |
| | |
| | | 'user_id' => $this->user['user_id'], |
| | | 'order_no' => $this->model->orderNo(), |
| | | 'total_price' => $order['order_total_price'], |
| | | 'settlement_price' => $order['settlement_price'], |
| | | 'order_price' => $order['order_price'], |
| | | 'coupon_id' => $supplier['orderData']['coupon_id'], |
| | | 'coupon_money' => $supplier['orderData']['coupon_money'], |
| | |
| | | 'product_no' => $product['product_sku']['product_no'], |
| | | 'product_price' => $product['product_sku']['product_price'], |
| | | 'line_price' => $product['product_sku']['line_price'], |
| | | 'settlement_price' => $product['product_sku']['settlement_price'], |
| | | 'product_weight' => $product['product_sku']['product_weight'], |
| | | 'is_user_grade' => (int)$product['is_user_grade'], |
| | | 'grade_ratio' => $product['grade_ratio'], |
| | |
| | | return false; |
| | | } |
| | | // 计算订单商品实际抵扣的积分数量和金额 |
| | | $ProductDeduct = new ConsumptionDeductService($productList); |
| | | $ProductDeduct = new PointsDeductService($productList); |
| | | $ProductDeduct->setProductPoints($maxPointsNumCount, $actualPointsNum); |
| | | // 积分抵扣总金额 |
| | | $orderPointsMoney = helper::getArrayColumnSum($productList, 'points_money'); |
| | |
| | | $level = Setting::getItem('basic', $order['app_id'])['level']; |
| | | // 分销订单佣金数据 |
| | | $capital = [ |
| | | // 订单总金额(不含运费) |
| | | 'orderPrice' => bcsub($order['pay_price'], $order['express_price'], 2), |
| | | // 订单总金额(不含运费) 减去 结算价 = 订单利润 |
| | | 'orderPrice' => bcsub(bcsub($order['pay_price'], $order['express_price'], 2), $order['settlement_price'], 2), |
| | | // 一级分销佣金 |
| | | 'first_money' => 0.00, |
| | | // 二级分销佣金 |
| | |
| | | 'user_id' => $order['user_id'], |
| | | 'order_id' => $order['order_id'], |
| | | 'order_type' => $order_type, |
| | | 'total_price' => $capital['total_price'], |
| | | 'order_price' => $capital['orderPrice'], |
| | | 'is_settled' => 0, |
| | | 'shop_supplier_id' => $order['shop_supplier_id'], |
| | |
| | | $setting = Setting::getItem('basic', $order['app_id']); |
| | | $capital = [ |
| | | // 订单总金额(不含运费) |
| | | 'orderPrice' => bcsub($order['pay_price'], $order['express_price'], 2), |
| | | 'total_price' => bcsub($order['pay_price'], $order['express_price'], 2), |
| | | // 订单总金额(不含运费) 减去 结算价 = 订单利润 |
| | | 'orderPrice' => bcsub(bcsub($order['pay_price'], $order['express_price'], 2), $order['settlement_price'], 2), |
| | | // 是否记录 |
| | | 'is_record' => true |
| | | ]; |
| | |
| | | <?php
namespace app\common\model\plus\team;
use app\common\model\BaseModel;
use app\common\enum\order\OrderTypeEnum;
use app\common\model\plus\shareholder\Apply as ShareholderApplyModel;
/**
* 队长订单模型
*/
class Order extends BaseModel
{
protected $name = 'team_order';
protected $pk = 'id';
/**
* 订单所属用户
* @return \think\model\relation\BelongsTo
*/
public function user()
{
return $this->belongsTo('app\common\model\user\User');
}
/**
* 队长用户
* @return \think\model\relation\BelongsTo
*/
public function teamHeads()
{
return $this->belongsTo('app\common\model\user\User', 'heads_id');
}
/**
* 订单类型
* @param $value
* @return array
*/
public function getOrderTypeAttr($value)
{
$types = OrderTypeEnum::getTypeName();
return ['text' => $types[$value], 'value' => $value];
}
/**
* 分红类型
* @param $value
* @return array
*/
public function getBonusTypeAttr($value)
{
$bonus_type = ['10' => '分红', '20' => '级差奖', '30' => '平级奖'];
return ['text' => $bonus_type[$value], 'value' => $value];
}
/**
* 订单详情
*/
public static function orderDetail($id)
{
return (new static())->where('id', '=', $id)->find();
}
/**
* 订单详情
*/
public static function getDetailByOrderId($orderId, $orderType)
{
return (new static())->where('order_id', '=', $orderId)
->where('order_type', '=', $orderType)
->select();
}
// 统计队长团队业绩
public static function getOrderAllPrice($userId, $bonusType = 10)
{
return (new static())->where('heads_id', '=', $userId)
//->where('is_settled', '=', 1)
->where('bonus_type', '=', $bonusType)
->sum('order_price');
}
/**
* 发放订单分红
* @param $order
* @param int $orderType
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function grantMoney($order, $orderType = OrderTypeEnum::MASTER)
{
// 订单是否已完成
if ($order['order_status']['value'] != 30) {
return false;
}
$model = new static;
// 分红订单详情
$teamOrderList = self::getDetailByOrderId($order['order_id'], $orderType);
if(!$teamOrderList) {
return false;
}
// 佣金结算天数
$settleDays = Setting::getItem('settlement', $order['app_id'])['settle_days'];
$teamUser = [];
// 写入结算时间
foreach ($teamOrderList as $orderItem) {
$deadlineTime = $orderItem['settle_end_time'];
if($deadlineTime == 0){
$deadlineTime = $order['receipt_time'] + $settleDays * 86400;
$orderModel = self::orderDetail($orderItem['id']);
$orderModel->save([
'settle_end_time' => $deadlineTime
]);
}
$teamUser[] = [
'heads_id' => $orderItem['heads_id'],
'bonus_type' => $orderItem['bonus_type'],
'bonus_percent' => $orderItem['bonus_percent'] //分红比例
];
}
// 判断该订单是否满足结算时间 (订单完成时间 + 佣金结算时间) ≤ 当前时间
$deadlineTime = $order['receipt_time'] + ((int)$settleDays * 86400);
if ($settleDays > 0 && $deadlineTime > time()) {
return false;
}
// 重新计算分红
$capital = $model->getCapitalByOrder($order, $teamUser);
foreach ($teamOrderList as $item) {
if ($item['is_settled'] == 1) {
continue;
}
// 发放队长分红
$item['heads_id'] > 0 && User::grantMoney($item['heads_id'], $capital['user'][$item['heads_id']], $item['bonus_type']);
$teamOrder = self::orderDetail($item['id']);
$teamOrder->save([
'is_settled' => 1,
'order_price' => $capital['orderPrice'],
'bonus_money' => $capital['user'][$item['heads_id']],
'settle_time' => time()
]);
// 更新队长等级
if ($item['bonus_type']['value'] == 10) {
// 根据分红订单判断股东 by yj
$shareholderModel = new ShareholderApplyModel;
$shareholderModel->becomeShareholderByTeam($item['user_id'], 70, $order['app_id']);
if ($item['heads_id']) {
$shareholderModel->becomeShareholderByTeam($item['heads_id'], 70, $order['app_id']);
event('TeamUserGrade', $item['heads_id']);
}
// 自己的订单也检查更新等级
event('TeamUserGrade', $item['user_id']);
}
}
return true;
}
/**
* 计算订单分销佣金
* @param $order
* @return array
*/
protected function getCapitalByOrder($order, $teamUser, $source = 'create')
{
// 分红设置
$setting = Setting::getItem('basic', $order['app_id']);
$capital = [
// 订单总金额(不含运费)
'orderPrice' => bcsub($order['pay_price'], $order['express_price'], 2),
// 是否记录
'is_record' => true,
'user' => []
];
$total_count = count($order['product']);
$productPriceTotal = 0;
// 计算分红
foreach ($order['product'] as $product) {
// 判断商品存在售后退款则不计算佣金
if ($this->checkProductRefund($product)) {
continue;
}
//log_write('is_enable_team:'.$product['is_enable_team']);
if (empty($product['is_enable_team'])) {
continue;
}
// 商品实付款金额
$productPriceTotal += min($capital['orderPrice'], $product['total_pay_price']);
}
foreach ($teamUser as $user) {
$capital['user'][$user['heads_id']] = $productPriceTotal * $user['bonus_percent'] * 0.01;
}
if($total_count == 0){
$capital['is_record'] = false;
}
return $capital;
}
/**
* 计算商品实际佣金
* @param $setting
* @param $product
* @param $productPrice
* @return float[]|int[]
*/
private function calculateProductCapital($setting, $product, $productPrice)
{
// 分红佣金类型:百分比
return [
'first_money' => $productPrice,
'second_money' => $productPrice,
'third_money' => $productPrice
];
}
/**
* 验证商品是否存在售后
* @param $product
* @return bool
*/
private function checkProductRefund($product)
{
return !empty($product['refund'])
&& $product['refund']['type']['value'] != 20
&& $product['refund']['is_agree']['value'] != 20;
}
}
|
| | | <?php
namespace app\common\model\plus\team;
use app\common\model\BaseModel;
use app\common\enum\order\OrderTypeEnum;
use app\common\model\plus\shareholder\Apply as ShareholderApplyModel;
/**
* 队长订单模型
*/
class Order extends BaseModel
{
protected $name = 'team_order';
protected $pk = 'id';
/**
* 订单所属用户
* @return \think\model\relation\BelongsTo
*/
public function user()
{
return $this->belongsTo('app\common\model\user\User');
}
/**
* 队长用户
* @return \think\model\relation\BelongsTo
*/
public function teamHeads()
{
return $this->belongsTo('app\common\model\user\User', 'heads_id');
}
/**
* 订单类型
* @param $value
* @return array
*/
public function getOrderTypeAttr($value)
{
$types = OrderTypeEnum::getTypeName();
return ['text' => $types[$value], 'value' => $value];
}
/**
* 分红类型
* @param $value
* @return array
*/
public function getBonusTypeAttr($value)
{
$bonus_type = ['10' => '分红', '20' => '级差奖', '30' => '平级奖'];
return ['text' => $bonus_type[$value], 'value' => $value];
}
/**
* 订单详情
*/
public static function orderDetail($id)
{
return (new static())->where('id', '=', $id)->find();
}
/**
* 订单详情
*/
public static function getDetailByOrderId($orderId, $orderType)
{
return (new static())->where('order_id', '=', $orderId)
->where('order_type', '=', $orderType)
->select();
}
// 统计队长团队业绩
public static function getOrderAllPrice($userId, $bonusType = 10)
{
return (new static())->where('heads_id', '=', $userId)
//->where('is_settled', '=', 1)
->where('bonus_type', '=', $bonusType)
->sum('order_price');
}
/**
* 发放订单分红
* @param $order
* @param int $orderType
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function grantMoney($order, $orderType = OrderTypeEnum::MASTER)
{
// 订单是否已完成
if ($order['order_status']['value'] != 30) {
return false;
}
$model = new static;
// 分红订单详情
$teamOrderList = self::getDetailByOrderId($order['order_id'], $orderType);
if(!$teamOrderList) {
return false;
}
// 佣金结算天数
$settleDays = Setting::getItem('settlement', $order['app_id'])['settle_days'];
$teamUser = [];
// 写入结算时间
foreach ($teamOrderList as $orderItem) {
$deadlineTime = $orderItem['settle_end_time'];
if($deadlineTime == 0){
$deadlineTime = $order['receipt_time'] + $settleDays * 86400;
$orderModel = self::orderDetail($orderItem['id']);
$orderModel->save([
'settle_end_time' => $deadlineTime
]);
}
$teamUser[] = [
'heads_id' => $orderItem['heads_id'],
'bonus_type' => $orderItem['bonus_type'],
'bonus_percent' => $orderItem['bonus_percent'] //分红比例
];
}
// 判断该订单是否满足结算时间 (订单完成时间 + 佣金结算时间) ≤ 当前时间
$deadlineTime = $order['receipt_time'] + ((int)$settleDays * 86400);
if ($settleDays > 0 && $deadlineTime > time()) {
return false;
}
// 重新计算分红
$capital = $model->getCapitalByOrder($order, $teamUser);
foreach ($teamOrderList as $item) {
if ($item['is_settled'] == 1) {
continue;
}
// 发放队长分红
$item['heads_id'] > 0 && User::grantMoney($item['heads_id'], $capital['user'][$item['heads_id']], $item['bonus_type']);
$teamOrder = self::orderDetail($item['id']);
$teamOrder->save([
'is_settled' => 1,
'order_price' => $capital['orderPrice'],
'bonus_money' => $capital['user'][$item['heads_id']],
'settle_time' => time()
]);
// 更新队长等级
if ($item['bonus_type']['value'] == 10) {
// 根据分红订单判断股东 by yj
$shareholderModel = new ShareholderApplyModel;
$shareholderModel->becomeShareholderByTeam($item['user_id'], 70, $order['app_id']);
if ($item['heads_id']) {
$shareholderModel->becomeShareholderByTeam($item['heads_id'], 70, $order['app_id']);
event('TeamUserGrade', $item['heads_id']);
}
// 自己的订单也检查更新等级
event('TeamUserGrade', $item['user_id']);
}
}
return true;
}
/**
* 计算订单分销佣金
* @param $order
* @return array
*/
protected function getCapitalByOrder($order, $teamUser, $source = 'create')
{
// 分红设置
$setting = Setting::getItem('basic', $order['app_id']);
$capital = [
// 订单总金额(不含运费)
// 订单总金额(不含运费) 减去 结算价 = 订单利润
'orderPrice' => bcsub(bcsub($order['pay_price'], $order['express_price'], 2), $order['settlement_price'], 2),
// 是否记录
'is_record' => true,
'user' => []
];
$total_count = count($order['product']);
$productPriceTotal = 0;
// 计算分红
foreach ($order['product'] as $product) {
// 判断商品存在售后退款则不计算佣金
if ($this->checkProductRefund($product)) {
continue;
}
//log_write('is_enable_team:'.$product['is_enable_team']);
if (empty($product['is_enable_team'])) {
continue;
}
// 商品实付款金额
$productPriceTotal += min($capital['orderPrice'], $product['total_pay_price']);
}
foreach ($teamUser as $user) {
$capital['user'][$user['heads_id']] = $productPriceTotal * $user['bonus_percent'] * 0.01;
}
if($total_count == 0){
$capital['is_record'] = false;
}
return $capital;
}
/**
* 计算商品实际佣金
* @param $setting
* @param $product
* @param $productPrice
* @return float[]|int[]
*/
private function calculateProductCapital($setting, $product, $productPrice)
{
// 分红佣金类型:百分比
return [
'first_money' => $productPrice,
'second_money' => $productPrice,
'third_money' => $productPrice
];
}
/**
* 验证商品是否存在售后
* @param $product
* @return bool
*/
private function checkProductRefund($product)
{
return !empty($product['refund'])
&& $product['refund']['type']['value'] != 20
&& $product['refund']['is_agree']['value'] != 20;
}
}
|
| | |
| | | 'order_id' => $order['order_id'], |
| | | 'order_type' => $order_type, |
| | | 'order_price' => $order['pay_price'], |
| | | 'settlement_price' => $order['settlement_price'], |
| | | 'vip_area_user_id' => 0, |
| | | 'referee_id' => 0, |
| | | 'vip_area_money' => 0, |
| | |
| | | ]; |
| | | $list=[]; |
| | | // 计算佣金金额 |
| | | $orderPrice = bcsub($order['pay_price'], $order['express_price'], 2); |
| | | $orderPrice = bcsub(bcsub($order['pay_price'], $order['express_price'], 2), $order['settlement_price'], 2); |
| | | $viewpoint_money=0; |
| | | // 获取当前买家的推荐人信息 |
| | | $userModel = UserModel::detail($order['user_id']); |
| | |
| | | // 检查并处理直推佣金 |
| | | $directReferralsCount=0; |
| | | $user=UserModel::detail($order['user_id']); |
| | | //见点奖 |
| | | if (!empty($user['referee_id'])){ |
| | | // 检查推荐人是否满足直推条件(直推用户数量) |
| | | $directReferralsCount = UserModel::where('referee_id', '=', $user['referee_id'])->count(); |
| | |
| | | } |
| | | } |
| | | $requiredReferralCount = $setting['referee_buy_count'] ?? 0; |
| | | if ($vipGrade['commission']>0 && $directReferralsCount >= $requiredReferralCount){ |
| | | if ($vipGrade['commission']>0 && $directReferralsCount >= $requiredReferralCount&&$orderPrice>0){ |
| | | // 计算平台直推佣金金额 |
| | | $commissionAmount = bcmul($orderPrice, bcdiv($vipGrade['commission'], '100', 4), 2); |
| | | $list[]=array_merge($data,['vip_area_type'=>40,'vip_area_money'=>$commissionAmount]); |
| | |
| | | $supplierReferee=VipUserModel::detail($order['supplier']['referee_id']); |
| | | if ($supplierReferee){ |
| | | $vipGradeSupplier=Grade::detail($supplierReferee['grade_id']); |
| | | if ($vipGradeSupplier['supplier_money']>0){ |
| | | if ($vipGradeSupplier['supplier_money']>0&&$orderPrice>0){ |
| | | // 计算直推店铺交易额佣金金额 |
| | | $supplier_money = bcmul($orderPrice, bcdiv($vipGrade['supplier_money'], '100', 4), 2); |
| | | $list[]=array_merge($data,['vip_area_type'=>50,'vip_area_money'=>$supplier_money,'vip_area_user_id'=>$supplierReferee['user_id'],'referee_id'=>$supplierReferee['referee_id']]); |
| | |
| | | 'is_shopping_gift' => '0', // 是否开启购物送消费券 |
| | | 'gift_ratio' => '100', // 是否开启购物送消费券 |
| | | 'is_shopping_discount' => '0', // 是否允许下单使用消费券抵扣 |
| | | 'give_away'=> 0,//直推赠送 |
| | | 'is_trans_balance' => '0', // 是否允许转换余额 |
| | | 'discount' => [ // 消费券抵扣 |
| | | 'discount_ratio' => '0.01', // 消费券抵扣比例 |
| | |
| | | use app\common\model\supplier\User as SupplierUserModel; |
| | | use app\common\model\store\Clerk as StoreClerkModel; |
| | | use app\common\model\user\User as UserModel; |
| | | use app\common\model\settings\Setting as SettingModel; |
| | | use think\facade\Db; // by lyzflash |
| | | use app\common\model\plus\bonus\User as BonusUserModel; |
| | | use app\common\model\user\ConsumptionLog as ConsumptionLogModel; |
| | |
| | | if ($purchase_count==1&&$user['referee_id']){ |
| | | $referee= self::detail($user['referee_id']); |
| | | if ($referee){ |
| | | $referee->setIncConsumption(10, '直推首单礼包'); |
| | | $settingConsumption=SettingModel::getItem('consumption'); |
| | | if ($settingConsumption['give_away']){ |
| | | $referee->setIncConsumption($settingConsumption['give_away'], '直推首单礼包'); |
| | | } |
| | | } |
| | | } |
| | | /*if ($purchase_count>11){ |
| | |
| | | if ($type == 'no_audit') { |
| | | $model = $model->where('audit_status', '=', 20); |
| | | } |
| | | return $model->where('is_delete', '=', 0) |
| | | return $model |
| | | ->alias('product') |
| | | ->join('supplier supplier', 'product.shop_supplier_id = supplier.shop_supplier_id','left')->where('supplier.is_delete', '=', 0)->where('product.is_delete', '=', 0) |
| | | ->count(); |
| | | } |
| | | |
| | |
| | | } |
| | | $userChange = true; |
| | | } |
| | | $user=UserModel::detail($supplier['user_id']); |
| | | $supplier['referee_id'] = $user['referee_id']; |
| | | // 修改供应商 |
| | | $this->save($supplier); |
| | | // 修改登录用户 |
| | |
| | | use app\common\enum\user\grade\ChangeTypeEnum; |
| | | use app\common\enum\user\balanceLog\BalanceLogSceneEnum as SceneEnum; |
| | | use app\shop\model\user\PointsLog as PointsLogModel; |
| | | use app\shop\model\user\ConsumptionLog as ConsumptionLogModel; |
| | | use app\shop\model\plus\agent\User as AgentUserModel; |
| | | /** |
| | | * 用户模型 |
| | |
| | | return $this->rechargeToBalance($storeUserName, $data['balance']); |
| | | } elseif ($source == 1) { |
| | | return $this->rechargeToPoints($storeUserName, $data['points']); |
| | | } elseif ($source == 2) { |
| | | return $this->rechargeToconCumption($storeUserName, $data['consumption']); |
| | | } |
| | | return false; |
| | | } |
| | |
| | | event('UserGrade', $this['user_id']); |
| | | return true; |
| | | } |
| | | /** |
| | | * 用户充值:消费券 |
| | | */ |
| | | private function rechargeToconCumption($storeUserName, $data) |
| | | { |
| | | if (!isset($data['value']) || $data['value'] === '' || $data['value'] < 0) { |
| | | $this->error = '请输入正确的消费券数量'; |
| | | return false; |
| | | } |
| | | $consumer_coupon = 0; |
| | | // 判断充值方式,计算最终消费券 |
| | | if ($data['mode'] === 'inc') { |
| | | $diffMoney = $this['consumer_coupon'] + $data['value']; |
| | | $consumer_coupon = $data['value']; |
| | | } elseif ($data['mode'] === 'dec') { |
| | | $diffMoney = $this['consumer_coupon'] - $data['value'] <= 0 ? 0 : $this['consumer_coupon'] - $data['value']; |
| | | $consumer_coupon = -$data['value']; |
| | | } else { |
| | | $diffMoney = $data['value']; |
| | | $consumer_coupon= $data['value'] - $this['consumer_coupon']; |
| | | } |
| | | // 更新记录 |
| | | $this->transaction(function () use ($storeUserName, $data, $diffMoney, $consumer_coupon) { |
| | | $total_expend_money = $this['total_expend_money'] + $consumer_coupon <= 0? 0 : $this['total_expend_money'] + $consumer_coupon; |
| | | // 更新账户消费券 |
| | | $this->where('user_id', '=', $this['user_id'])->update([ |
| | | 'consumer_coupon' => $diffMoney, |
| | | 'total_expend_money' => $total_expend_money |
| | | ]); |
| | | // 新增消费券变动记录 |
| | | ConsumptionLogModel::add([ |
| | | 'user_id' => $this['user_id'], |
| | | 'value' => $consumer_coupon, |
| | | 'describe' => "后台管理员 [{$storeUserName}] 操作", |
| | | 'remark' => $data['remark'], |
| | | ]); |
| | | }); |
| | | event('UserGrade', $this['user_id']); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | namespace app\supplier\controller\product; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\common\model\product\Category as CategoryModel; |
| | | use app\supplier\model\product\Category as CategoryModel; |
| | | |
| | | /** |
| | | * 商品分类 |
| | |
| | | public function index() |
| | | { |
| | | $model = new CategoryModel; |
| | | $list = $model->getCacheTree(); |
| | | $shop_supplier_id = $this->getSupplierId(); |
| | | $list = $model->getSupplierCacheTree($shop_supplier_id); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 删除商品分类 |
| | | */ |
| | | public function delete($category_id) |
| | | { |
| | | $model = (new CategoryModel())->find($category_id); |
| | | if ($model->remove($category_id)) { |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?:'删除失败'); |
| | | } |
| | | |
| | | /** |
| | | * 添加商品分类 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new CategoryModel; |
| | | $data = $this->request->post(); |
| | | $data['shop_supplier_id'] = $this->getSupplierId(); |
| | | // 新增记录 |
| | | if ($model->add($data)) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?:'添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 编辑商品分类 |
| | | */ |
| | | public function edit($category_id) |
| | | { |
| | | // 模板详情 |
| | | $model = CategoryModel::detail($category_id); |
| | | // 更新记录 |
| | | if ($model->edit($this->request->post())) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | /** |
| | | * 得到修改图片 |
| | | * @return array |
| | | */ |
| | | public function image($category_id) |
| | | { |
| | | $model = new CategoryModel; |
| | | $detail = $model->detailWithImage(['category_id' => $category_id]); |
| | | return $this->renderSuccess('', compact('detail')); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | use app\common\model\settings\Setting; |
| | | use app\supplier\model\product\Product as ProductModel; |
| | | use app\common\model\product\Category as CategoryModel; |
| | | use app\supplier\model\product\Category as CategoryModel; |
| | | use app\supplier\service\ProductService; |
| | | use app\supplier\model\supplier\Supplier as SupplierModel; |
| | | use app\supplier\controller\Controller; |
| | | use think\facade\Cache; |
| | | |
| | | /** |
| | | * 商品管理控制器 |
| | |
| | | $model = new ProductModel; |
| | | $list = $model->getList(array_merge(['status' => -1, 'shop_supplier_id' => $this->getSupplierId()], $this->postData())); |
| | | // 商品分类 |
| | | $category = CategoryModel::getCacheTree(); |
| | | $category = CategoryModel::getSupplierCacheTree($this->getSupplierId()); |
| | | |
| | | // 数量 |
| | | $product_count = [ |
| | | 'sell' => $model->getCount('sell', $this->getSupplierId()), |
| | |
| | | public function index() |
| | | { |
| | | $model = new PageModel; |
| | | $list = $model->getList($this->postData()); |
| | | $data = $this->postData(); |
| | | $data['shop_supplier_id'] = $this->getSupplierId(); |
| | | $list = $model->getList($data); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\product; |
| | | |
| | | use think\facade\Cache; |
| | | use app\common\model\product\Category as CategoryModel; |
| | | |
| | | /** |
| | | * 商品分类模型 |
| | | */ |
| | | class Category extends CategoryModel |
| | | { |
| | | /** |
| | | * 所有分类 |
| | | */ |
| | | public static function getSupplierALL($shop_supplier_id) |
| | | { |
| | | $model = new static; |
| | | if (!Cache::get('category_supplier_' . $shop_supplier_id)) { |
| | | $data = $model->with(['images']) |
| | | ->where('shop_supplier_id','in',[0,$shop_supplier_id]) |
| | | ->order(['sort' => 'asc', 'create_time' => 'asc'])->select(); |
| | | $all = !empty($data) ? $data->toArray() : []; |
| | | $tree = []; |
| | | foreach ($all as $first) { |
| | | if ($first['parent_id'] != 0) continue; |
| | | $twoTree = []; |
| | | foreach ($all as $two) { |
| | | if ($two['parent_id'] != $first['category_id']) continue; |
| | | $threeTree = []; |
| | | foreach ($all as $three) |
| | | $three['parent_id'] == $two['category_id'] |
| | | && $threeTree[$three['category_id']] = $three; |
| | | !empty($threeTree) && $two['child'] = $threeTree; |
| | | array_push($twoTree, $two); |
| | | } |
| | | if (!empty($twoTree)) { |
| | | $temp_two_tree = array_column($twoTree, 'sort'); |
| | | array_multisort($temp_two_tree, SORT_ASC, $twoTree); |
| | | $first['child'] = $twoTree; |
| | | } |
| | | array_push($tree, $first); |
| | | } |
| | | Cache::tag('cache')->set('category_supplier_' .$shop_supplier_id, compact('all', 'tree')); |
| | | } |
| | | return Cache::get('category_supplier_' . $shop_supplier_id); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有分类 |
| | | */ |
| | | public static function getSupplierCacheAll($shop_supplier_id) |
| | | { |
| | | return self::getSupplierALL($shop_supplier_id)['all']; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有分类(树状结构) |
| | | */ |
| | | public static function getSupplierCacheTree($shop_supplier_id) |
| | | { |
| | | return self::getSupplierALL($shop_supplier_id)['tree']; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有分类(树状结构) |
| | | * @return string |
| | | */ |
| | | public static function getSupplierCacheTreeJson($shop_supplier_id) |
| | | { |
| | | return json_encode(static::getSupplierCacheTree($shop_supplier_id)); |
| | | } |
| | | /** |
| | | * 获取所有一级分类 |
| | | */ |
| | | public static function getSupplierFirstCategory($shop_supplier_id) |
| | | { |
| | | return (new static())->where('parent_id', '=', 0) |
| | | ->where('shop_supplier_id', '=', $shop_supplier_id) |
| | | ->order(['sort' => 'asc', 'create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | /** |
| | | * 添加新记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | $this->deleteCache($data['shop_supplier_id']); |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 编辑记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | // 验证:一级分类如果存在子类,则不允许移动 |
| | | if ($data['parent_id'] > 0 && static::hasSubCategory($this['category_id'])) { |
| | | $this->error = '该分类下存在子分类,不可以移动'; |
| | | return false; |
| | | } |
| | | $this->deleteCache($this['shop_supplier_id']); |
| | | // !array_key_exists('image_id', $data) && $data['image_id'] = 0; |
| | | return $this->save($data) !== false; |
| | | } |
| | | |
| | | /** |
| | | * 删除商品分类 |
| | | */ |
| | | public function remove($categoryId) |
| | | { |
| | | // 判断是否存在商品 |
| | | if ($productCount = (new Product)->getProductTotal(['category_id' => $categoryId])) { |
| | | $this->error = '该分类下存在' . $productCount . '个商品,不允许删除'; |
| | | return false; |
| | | } |
| | | // 判断是否存在子分类 |
| | | if (static::hasSubCategory($categoryId)) { |
| | | $this->error = '该分类下存在子分类,请先删除'; |
| | | return false; |
| | | } |
| | | $this->deleteCache($this['shop_supplier_id']); |
| | | return $this->delete(); |
| | | } |
| | | |
| | | /** |
| | | * 删除缓存 |
| | | */ |
| | | private function deleteCache($shop_supplier_id) |
| | | { |
| | | Cache::delete('category_supplier_'.$shop_supplier_id); |
| | | return Cache::delete('category_' . static::$app_id); |
| | | } |
| | | |
| | | } |
| | |
| | | let lat=event.latLng.getLat(), |
| | | lng=event.latLng.getLng(); |
| | | let url = encodeURI("https://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lng + |
| | | "&key=LS7BZ-NHSWK-CWOJQ-AJC7Y-H5HE2-UGBWR&output=jsonp&&callback=?"); |
| | | "&key=SWSBZ-PY7EN-VXFFT-SUXJU-H5UY2-JFFJS&output=jsonp&&callback=?"); |
| | | getJson(url, 'QQmap', function(res) { |
| | | if (res.status == 0) { |
| | | self.$emit('chose', res.result); |
| | |
| | | return; |
| | | } |
| | | let url = encodeURI( |
| | | 'https://apis.map.qq.com/ws/place/v1/suggestion/?keyword=' + Value + '®ion=' + this.select_city + '&key=LS7BZ-NHSWK-CWOJQ-AJC7Y-H5HE2-UGBWR&output=jsonp&&callback=?' |
| | | 'https://apis.map.qq.com/ws/place/v1/suggestion/?keyword=' + Value + '®ion=' + this.select_city + '&key=SWSBZ-PY7EN-VXFFT-SUXJU-H5UY2-JFFJS&output=jsonp&&callback=?' |
| | | ); |
| | | |
| | | getJson(url, 'QQmap', function(res) { |
| | |
| | | value + |
| | | '&boundary=region(' + |
| | | query_city + |
| | | ',0)&page_size=9&page_index=1&key=LS7BZ-NHSWK-CWOJQ-AJC7Y-H5HE2-UGBWR&output=jsonp&&callback=?' |
| | | ',0)&page_size=9&page_index=1&key=SWSBZ-PY7EN-VXFFT-SUXJU-H5UY2-JFFJS&output=jsonp&&callback=?' |
| | | ); |
| | | |
| | | /*通过关键字搜索*/ |
| | |
| | | } |
| | | |
| | | }, { |
| | | "path": "pages/shop/category", |
| | | "style": { |
| | | "navigationBarTitleText": "店铺分类", |
| | | "navigationStyle": "custom", |
| | | "app-plus": { |
| | | "navigationBarTextStyle": "black", |
| | | "titleNView": false, |
| | | "animationType": "none" |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "pages/shop/application_status", |
| | | "style": { |
| | | "navigationBarTitleText": "申请状态", |
| | |
| | | { |
| | | "root": "pages/user", |
| | | "pages": [{ |
| | | "path": "userinfo/userinfo", |
| | | "style": { |
| | | "navigationBarTitleText": "用户信息", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | "path": "userinfo/userinfo", |
| | | "style": { |
| | | "navigationBarTitleText": "用户信息", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "address/address", |
| | | "style": { |
| | | "navigationBarTitleText": "设置地址", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "address/address", |
| | | "style": { |
| | | "navigationBarTitleText": "设置地址", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-wallet/my-wallet", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的钱包", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my-wallet/my-wallet", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的钱包", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-wallet/my-balance", |
| | | "style": { |
| | | "navigationBarTitleText": "钱包明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my-wallet/my-balance", |
| | | "style": { |
| | | "navigationBarTitleText": "钱包明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-wallet/my-supplier-balance", |
| | | "style": { |
| | | "navigationBarTitleText": "商户余额", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my-wallet/my-supplier-balance", |
| | | "style": { |
| | | "navigationBarTitleText": "商户余额", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "address/add/add", |
| | | "style": { |
| | | "navigationBarTitleText": "添加收货地址", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "address/add/add", |
| | | "style": { |
| | | "navigationBarTitleText": "添加收货地址", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "address/edit/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "地址编辑", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "address/edit/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "地址编辑", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-coupon/my-coupon", |
| | | "style": { |
| | | "navigationBarTitleText": "我的优惠券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my-coupon/my-coupon", |
| | | "style": { |
| | | "navigationBarTitleText": "我的优惠券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-coupon/my-detail", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "优惠券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my-coupon/my-detail", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "优惠券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-qrcode/my-qrcode", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "会员码", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my-qrcode/my-qrcode", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "会员码", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "points/points", |
| | | "style": { |
| | | "navigationBarTitleText": "积分", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "points/points", |
| | | "style": { |
| | | "navigationBarTitleText": "积分", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-bargain/my-bargain", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的砍价", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my-bargain/my-bargain", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的砍价", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "set/set", |
| | | "style": { |
| | | "navigationBarTitleText": "设置", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "set/set", |
| | | "style": { |
| | | "navigationBarTitleText": "设置", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_attention/my_attention", |
| | | "style": { |
| | | "navigationBarTitleText": "我的收藏", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_attention/my_attention", |
| | | "style": { |
| | | "navigationBarTitleText": "我的收藏", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_collect/my_collect", |
| | | "style": { |
| | | "navigationBarTitleText": "我的关注", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_collect/my_collect", |
| | | "style": { |
| | | "navigationBarTitleText": "我的关注", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的店铺", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/my_shop", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的店铺", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/member/member", |
| | | "style": { |
| | | "navigationBarTitleText": "年卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/member/member", |
| | | "style": { |
| | | "navigationBarTitleText": "年卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "提现申请", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "提现申请", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现列表", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现列表", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "register/register", |
| | | "style": { |
| | | "navigationBarTitleText": "注册", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "register/register", |
| | | "style": { |
| | | "navigationBarTitleText": "注册", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop_order", |
| | | "style": { |
| | | "navigationBarTitleText": "店铺订单", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/my_shop_order", |
| | | "style": { |
| | | "navigationBarTitleText": "店铺订单", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/after_sale", |
| | | "style": { |
| | | "navigationBarTitleText": "", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/after_sale", |
| | | "style": { |
| | | "navigationBarTitleText": "", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_shop/my_shop_password", |
| | | "style": { |
| | | "navigationBarTitleText": "修改密码", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/my_shop_password", |
| | | "style": { |
| | | "navigationBarTitleText": "修改密码", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "modify-phone/modify-phone", |
| | | "style": { |
| | | "navigationBarTitleText": "绑定手机号", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "modify-phone/modify-phone", |
| | | "style": { |
| | | "navigationBarTitleText": "绑定手机号", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "modify-real/modify-real", |
| | | "style": { |
| | | "navigationBarTitleText": "实名认证", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "modify-real/modify-real", |
| | | "style": { |
| | | "navigationBarTitleText": "实名认证", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "modify-real/modify-edit", |
| | | "style": { |
| | | "navigationBarTitleText": "修改银行卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "modify-real/modify-edit", |
| | | "style": { |
| | | "navigationBarTitleText": "修改银行卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_shop/pro_admin", |
| | | "style": { |
| | | "navigationBarTitleText": "商品管理", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/pro_admin", |
| | | "style": { |
| | | "navigationBarTitleText": "商品管理", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/product_add", |
| | | "style": { |
| | | "navigationBarTitleText": "商品添加", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/product_add", |
| | | "style": { |
| | | "navigationBarTitleText": "商品添加", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/product_edit", |
| | | "style": { |
| | | "navigationBarTitleText": "商品编辑", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/product_edit", |
| | | "style": { |
| | | "navigationBarTitleText": "商品编辑", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop_data", |
| | | "style": { |
| | | "navigationBarTitleText": "店铺数据", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/my_shop_data", |
| | | "style": { |
| | | "navigationBarTitleText": "店铺数据", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop_detail", |
| | | "style": { |
| | | "navigationBarTitleText": "订单详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "my_shop/my_shop_detail", |
| | | "style": { |
| | | "navigationBarTitleText": "订单详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "cash/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "提现申请", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | "titleNView": false, //禁用原生导航栏 |
| | | "scrollIndicator": "none" |
| | | }, { |
| | | "path": "cash/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "提现申请", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | "titleNView": false, //禁用原生导航栏 |
| | | "scrollIndicator": "none" |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "cash/list", |
| | | "style": { |
| | | "navigationBarTitleText": "余额提现", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | "titleNView": false, //禁用原生导航栏 |
| | | "scrollIndicator": "none" |
| | | }, { |
| | | "path": "cash/list", |
| | | "style": { |
| | | "navigationBarTitleText": "余额提现", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | "titleNView": false, //禁用原生导航栏 |
| | | "scrollIndicator": "none" |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "card/card", |
| | | "style": { |
| | | "navigationBarTitleText": "会员卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "card/card", |
| | | "style": { |
| | | "navigationBarTitleText": "会员卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "card/list", |
| | | "style": { |
| | | "navigationBarTitleText": "会员卡列表", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, { |
| | | "path": "card/list", |
| | | "style": { |
| | | "navigationBarTitleText": "会员卡列表", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_activity/index", |
| | | "style": { |
| | | "navigationBarTitleText": "我参与的活动", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_activity/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "报名详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "consumer/consumer", |
| | | "style": { |
| | | "navigationBarTitleText": "消费券" |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_activity/index", |
| | | "style": { |
| | | "navigationBarTitleText": "我参与的活动", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_activity/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "报名详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "consumer/consumer", |
| | | "style": { |
| | | "navigationBarTitleText": "消费券" |
| | | } |
| | | } |
| | | ] |
| | | ] |
| | | }, |
| | | { |
| | | "root": "pages/store", |
| | |
| | | if (this.activityData) { |
| | | return { |
| | | title: `${this.activityData.name}`, |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}&referee_id=${this.getUserId()}` |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}` |
| | | }; |
| | | } |
| | | return { |
| | |
| | | if (this.activityData) { |
| | | return { |
| | | title: `${this.activityData.name}`, |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}&referee_id=${this.getUserId()}` |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}` |
| | | }; |
| | | } |
| | | return { |
| | | title: '活动详情', |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}&referee_id=${this.getUserId()}` |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}` |
| | | }; |
| | | } |
| | | } |
| | |
| | | /*当前页面*/ |
| | | page: 1, |
| | | /*每页条数*/ |
| | | list_rows: 10, |
| | | list_rows: 20, |
| | | /*有没有更多*/ |
| | | no_more: false, |
| | | /*是否正在加载*/ |
| | |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'"> |
| | | <view class="pb30"> |
| | | <!-- 如果不是连盟汇会员,需要填写个人信息,报名后会自动加入活动发起的分会 --> |
| | | <view class="reg-section join-box p30 radius24 bg-white" v-if="!activityData.is_member || is_friend"> |
| | | <view class="tips f28 p20 radius12" v-if="!activityData.is_member && !is_friend"><text class="iconfont icon-gantanhao mr10"></text> 您还不是{{activityData.store_name}}的会员,请完善以下信息,提交报名后即可成为会员。</view> |
| | | <view class="tips f28 p20 radius12 friend" v-if="is_friend"><text class="iconfont icon-gantanhao mr10"></text>您正在帮朋友报名,以下信息请填写您朋友的信息</view> |
| | | <view class="reg-section join-box p30 radius24 bg-white"> |
| | | <!-- <view class="tips f28 p20 radius12" v-if="!activityData.is_member && !is_friend"><text class="iconfont icon-gantanhao mr10"></text> 您还不是{{activityData.store_name}}的会员,请完善以下信息,提交报名后即可成为会员。</view> |
| | | <view class="tips f28 p20 radius12 friend" v-if="is_friend"><text class="iconfont icon-gantanhao mr10"></text>您正在帮朋友报名,以下信息请填写您朋友的信息</view> --> |
| | | <view class="common-form">报名信息</view> |
| | | <view class="item d-s-c"> |
| | | <view class="item-name">走访活动编号</view> |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入走访活动编号" |
| | | v-model="formData.real_name" placeholder-class="placeholder" /> |
| | | </view> |
| | | <view class="item d-s-c"> |
| | | <view class="item-name">真实姓名</view> |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入真实姓名" v-model="formData.real_name" placeholder-class= |
| | | "placeholder" /> |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入真实姓名" |
| | | v-model="formData.real_name" placeholder-class="placeholder" /> |
| | | </view> |
| | | <view class="item d-s-c"> |
| | | <view class="item-name">手机号码</view> |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入常用的手机号码" v-model="formData.mobile" placeholder-class= |
| | | "placeholder" /> |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入常用的手机号码" |
| | | v-model="formData.mobile" placeholder-class="placeholder" /> |
| | | </view> |
| | | <view class="item d-s-c"> |
| | | <view class="item-name">单位/公司名称</view> |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入单位/公司名称" v-model="formData.company" placeholder-class= |
| | | "placeholder" /> |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入单位/公司名称" |
| | | v-model="formData.company" placeholder-class="placeholder" /> |
| | | </view> |
| | | <view class="item d-b-c border-b-e"> |
| | | <view class="item-name">所在城市</view> |
| | | <view class="d-s-c flex-1" @click="showMulLinkageThreePicker"> |
| | | <input class="tr flex-1" type="text" placeholder="请选择所在城市" placeholder-class="gray9" |
| | | v-model="selectCity" disabled="true" /> |
| | | <view class="icon iconfont icon-jiantou f24"></view> |
| | | </view> |
| | | </view> |
| | | <!-- 加入哪个分会 --> |
| | | <view class="item d-s-c"> |
| | |
| | | <text class="gray6 flex-1" v-else>去选择</text> |
| | | <text class='iconfont icon-jiantou'></text> |
| | | </view> |
| | | </view> |
| | | <view class="common-form">邀请人</view> |
| | | <view class="item d-s-c" style="padding-top: 0;"> |
| | | <view class="item-name">邀请人姓名</view> |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入邀请人姓名,如:张三" |
| | | v-model="formData.recommend_name" placeholder-class="placeholder" /> |
| | | </view> |
| | | <view class="item d-s-c"> |
| | | <view class="item-name">邀请人电话</view> |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入邀请人电话,如:134XXXXXX21" |
| | | v-model="formData.recommend_mobile" placeholder-class="placeholder" /> |
| | | </view> |
| | | </view> |
| | | <view class="reg-section pay-box p30 radius24 bg-white" v-if="activityData.fee > 0"> |
| | |
| | | 无可用 |
| | | </text> |
| | | <text class="theme-price" v-else-if="formData.points_num > 0" @click="onPoints"> |
| | | -<text class="f24">¥</text>{{formData.points_money}} <text class='iconfont icon-jiantou'></text> |
| | | -<text class="f24">¥</text>{{formData.points_money}} <text |
| | | class='iconfont icon-jiantou'></text> |
| | | </text> |
| | | <text class="gray6 f28" v-else @click="onPoints"> |
| | | 去选择 <text class='iconfont icon-jiantou'></text> |
| | |
| | | 无可用 |
| | | </text> |
| | | <view class="price" v-else> |
| | | <text class="f24 gray9" v-if="parseFloat(activityData.balance) < parseFloat(activityData.fee) && formData.is_combined_pay==1">需组合支付</text> |
| | | <switch style="transform: scale(0.7); margin-right: -20rpx;" :checked="is_checked_balance" @change="onUseBalance" /> |
| | | <text class="f24 gray9" |
| | | v-if="parseFloat(activityData.balance) < parseFloat(activityData.fee) && formData.is_combined_pay==1">需组合支付</text> |
| | | <switch style="transform: scale(0.7); margin-right: -20rpx;" |
| | | :checked="is_checked_balance" @change="onUseBalance" /> |
| | | </view> |
| | | |
| | | |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | <i class="icon iconfont icon-xuanze"></i> |
| | | </view> |
| | | </view> |
| | | <view v-if="showAlipay" class="item d-b-c" :class="{'active':formData.pay_type == 30}" @click="payTypeFunc(30)"> |
| | | <!-- <view v-if="showAlipay" class="item d-b-c" :class="{'active':formData.pay_type == 30}" |
| | | @click="payTypeFunc(30)"> |
| | | <view class="d-s-c"> |
| | | <view class="icon-left d-c-c mr10"> |
| | | <i class="icon iconfont icon-zhifubao"></i> |
| | |
| | | <view class="icon-right"> |
| | | <i class="icon iconfont icon-xuanze"></i> |
| | | </view> |
| | | </view> |
| | | </view> --> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | |
| | | </view> |
| | | </view> |
| | | <!-- 积分弹窗 --> |
| | | <PointsForm :isOpenPoints="isOpenPoints" :activityData="activityData" :max_price="onlinePrice+formData.points_money" @close="closePointsFunc"></PointsForm> |
| | | <PointsForm :isOpenPoints="isOpenPoints" :activityData="activityData" |
| | | :max_price="onlinePrice+formData.points_money" @close="closePointsFunc"></PointsForm> |
| | | <!-- 分会弹窗 --> |
| | | <Branch :isOpenBranch="isOpenBranch" @close="closeBranchFunc"></Branch> |
| | | <!-- 区域选择 --> |
| | | <mpvue-city-picker v-if="is_loaded" ref="mpvueCityPicker" :province="province" :city="city" :area="area" |
| | | :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm"></mpvue-city-picker> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { pay } from '@/common/pay.js'; |
| | | import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue'; |
| | | import { |
| | | pay |
| | | } from '@/common/pay.js'; |
| | | import PointsForm from './points'; // 积分选择弹窗 |
| | | import Branch from './branch'; // 分会选择弹窗 |
| | | export default { |
| | | components: { |
| | | mpvueCityPicker, |
| | | PointsForm, |
| | | Branch |
| | | }, |
| | |
| | | real_name: '', |
| | | mobile: '', |
| | | company: '', |
| | | recommend_name: '', |
| | | recommend_mobile: '', |
| | | shop_supplier_id: 0, |
| | | points_num: 0, // 抵扣的积分数量 |
| | | points_money: 0, // 积分抵扣的金额 |
| | |
| | | is_combined_pay: 0, // 是否需要组合支付 |
| | | pay_type: 20, // 支付方式,默认微信支付 |
| | | branch_id: '', // 所在分会 |
| | | province_id: 0, |
| | | city_id: 0, |
| | | region_id: 0, |
| | | }, |
| | | /*尺寸比例*/ |
| | | ratio: 1, |
| | | showAlipay: true, /*是否显示支付宝支付,只有在h5,非微信内打开才显示*/ |
| | | showAlipay: true, |
| | | /*是否显示支付宝支付,只有在h5,非微信内打开才显示*/ |
| | | use_balance: 0, // 使用的余额 |
| | | is_checked_balance: false, // 是否 |
| | | activityData: {}, |
| | |
| | | isFirst: false, |
| | | branch_name: '', |
| | | isOpenBranch: false, |
| | | is_loaded: false, |
| | | province: [], |
| | | city: [], |
| | | area: [], |
| | | cityPickerValueDefault: [0, 0, 0], |
| | | selectCity: '选择省,市,区', |
| | | }; |
| | | }, |
| | | props: ['isOpenReg', 'in_radius', 'is_friend'], |
| | |
| | | self.phoneHeight = res.windowHeight; |
| | | self.ratio = res.windowWidth / 750; |
| | | self.getHeight(); |
| | | self.getDataProvince(); |
| | | } |
| | | }); |
| | | }, |
| | | getRegistrationInformation() { |
| | | let self = this; |
| | | self._get('branch.activity/getRegistrationInformation', {}, function(res) { |
| | | if (res.data.registrationInformation) { |
| | | let data=res.data.registrationInformation; |
| | | self.formData.province_id = data.province_id; |
| | | self.formData.city_id = data.city_id; |
| | | self.formData.region_id = data.region_id; |
| | | self.formData.recommend_name = data.recommend_name; |
| | | self.formData.recommend_mobile = data.recommend_mobile; |
| | | self.formData.real_name = data.real_name; |
| | | self.formData.mobile = data.mobile; |
| | | self.formData.branch_id = data.branch_id; |
| | | self.formData.company = data.company; |
| | | self.selectCity = res.data.registrationInformation.region; |
| | | if (res.data.registrationInformation.branch_name) { |
| | | self.branch_name = res.data.registrationInformation.branch_name; |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | // 获取省市区 |
| | | getDataProvince() { |
| | | let self = this; |
| | | self._get('settings/getRegion', {}, function(res) { |
| | | self.province = res.data.regionData[0]; |
| | | self.city = res.data.regionData[1]; |
| | | self.area = res.data.regionData[2]; |
| | | self.is_loaded = true; |
| | | self.getRegistrationInformation(); |
| | | }); |
| | | }, |
| | | |
| | | /*三级联动选择*/ |
| | | showMulLinkageThreePicker() { |
| | | console.log(this.$refs.mpvueCityPicker); |
| | | this.$refs.mpvueCityPicker.show(); |
| | | }, |
| | | |
| | | /*确定选择的省市区*/ |
| | | onConfirm(e) { |
| | | this.selectCity = e.label; |
| | | this.formData.province_id = e.cityCode[0]; |
| | | this.formData.city_id = e.cityCode[1]; |
| | | this.formData.region_id = e.cityCode[2]; |
| | | }, |
| | | |
| | | /*获取高度*/ |
| | |
| | | this.scrollviewHigh = 600 * this.ratio; |
| | | } |
| | | } |
| | | this.getRegistrationInformation() |
| | | }, |
| | | |
| | | |
| | | // 半屏小程序返回 |
| | | onPayResult(e) { |
| | | console.log(e) |
| | |
| | | if (e.pay_result == 'success') { |
| | | self.paySuccess(self.payData); |
| | | } else { |
| | | if(self.order_id > 0){ |
| | | if (self.order_id > 0) { |
| | | //兼容重新付款 |
| | | }else{ |
| | | } else { |
| | | self.payError(self.payData); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | |
| | | paySuccess(result) { |
| | | let self = this; |
| | | self.showSuccess("支付成功", function() { |
| | | self.$emit('close', 1); |
| | | }) |
| | | |
| | | |
| | | }, |
| | | payError(result) { |
| | | let self = this; |
| | |
| | | self.$emit('close', 2); |
| | | }) |
| | | }, |
| | | |
| | | |
| | | // 是否使用余额支付 |
| | | onUseBalance(e) { |
| | | if (e.target.value == true) { |
| | |
| | | this.formData.is_combined_pay = 0; |
| | | } |
| | | }, |
| | | |
| | | |
| | | /*选择支付方式*/ |
| | | payTypeFunc(e){ |
| | | payTypeFunc(e) { |
| | | this.formData.pay_type = e; |
| | | }, |
| | | |
| | | |
| | | /*提交报名*/ |
| | | onSubmit() { |
| | | let self = this; |
| | |
| | | path: res.data.payment.embed_path, |
| | | extraData: res.data.payment.extraData, |
| | | envVersion: 'release', // develop开发版 trial体验版 release正式版 |
| | | success:function() { |
| | | success: function() { |
| | | console.log('打开半屏小程序成功'); |
| | | }, |
| | | fail:function() { |
| | | fail: function() { |
| | | console.log('打开半屏小程序失败'); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | pay(res, self, self.paySuccess, self.payError); |
| | | pay(res, self, self.paySuccess, self.payError); |
| | | } else if (res.code != 1) { |
| | | reg_success = 2; // 失败 |
| | | } |
| | |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | |
| | | // 验证数据 |
| | | validateForm() { |
| | | let self = this; |
| | |
| | | self.validate = true; |
| | | return true; |
| | | }, |
| | | |
| | | |
| | | // 提示框 |
| | | showTips(title, duration = 1000, icon = 'none') { |
| | | uni.showToast({ |
| | |
| | | closePopup(e) { |
| | | this.$emit('close', e); |
| | | }, |
| | | |
| | | |
| | | /*打开积分弹窗*/ |
| | | onPoints() { |
| | | this.isOpenPoints = true; |
| | | }, |
| | | |
| | | |
| | | /*关闭积分弹窗*/ |
| | | closePointsFunc(e) { |
| | | if (e !== null) { |
| | |
| | | } |
| | | this.isOpenPoints = false; |
| | | }, |
| | | |
| | | |
| | | openBranch() { |
| | | this.isOpenBranch = true; |
| | | }, |
| | | |
| | | |
| | | /*关闭分会弹窗*/ |
| | | closeBranchFunc(e) { |
| | | if (e !== null) { |
| | |
| | | color: #ffffff; |
| | | border-radius: 88rpx; |
| | | } |
| | | |
| | | |
| | | .popup-title { |
| | | .iconfont { |
| | | position: absolute; |
| | |
| | | color: #999999; |
| | | } |
| | | } |
| | | |
| | | |
| | | .reg-section { |
| | | + .reg-section { |
| | | +.reg-section { |
| | | margin-top: 30rpx; |
| | | } |
| | | } |
| | | |
| | | |
| | | .join-box { |
| | | .item { |
| | | padding-top: 60rpx; |
| | | |
| | | .item-name { |
| | | font-size: 28rpx; |
| | | width: 200rpx; |
| | | } |
| | | } |
| | | |
| | | .tips { |
| | | background-color: #f7f7f7; |
| | | color: #333; |
| | | |
| | | |
| | | &.friend { |
| | | background-color: #FCF8ED; |
| | | color: #CEAD60; |
| | | |
| | | .iconfont{ |
| | | |
| | | .iconfont { |
| | | color: #CEAD60; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .pay-box { |
| | | .pay-item { |
| | | font-size: 30rpx; |
| | | .title { |
| | | |
| | | } |
| | | |
| | | .title {} |
| | | |
| | | .theme-price { |
| | | text { |
| | | font-size: 24rpx; |
| | | } |
| | | } |
| | | |
| | | .icon-jiantou { |
| | | font-size: 24rpx; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .pay-type { |
| | | .item { |
| | | .icon-left { |
| | |
| | | font-size: 60rpx; |
| | | color: #04BE01; |
| | | } |
| | | |
| | | .icon-zhifubao { |
| | | font-size: 50rpx; |
| | | color: #1281ff; |
| | | } |
| | | } |
| | | |
| | | .key { |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .icon-right { |
| | | .iconfont { |
| | | font-size: 48rpx; |
| | | } |
| | | } |
| | | + .item { |
| | | |
| | | +.item { |
| | | margin-top: 45rpx; |
| | | } |
| | | |
| | | &.active { |
| | | .icon-right { |
| | | .iconfont { |
| | |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | | |
| | | .common-form { |
| | | position: relative; |
| | | height: 80rpx; |
| | | padding-left: 40rpx; |
| | | line-height: 80rpx; |
| | | font-size: 28rpx; |
| | | font-weight: 700; |
| | | margin-top: 24rpx; |
| | | } |
| | | |
| | | .common-form:before { |
| | | background: #3a8ee6; |
| | | } |
| | | |
| | | .common-form:before { |
| | | position: absolute; |
| | | content: ""; |
| | | width: 4px; |
| | | height: 14px; |
| | | left: 0; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | } |
| | | </style> |
| | |
| | | self.is_loaded = true; |
| | | }); |
| | | }, |
| | | getRegistrationInformation(user_id) { |
| | | let self = this; |
| | | self._get('branch.activity/getRegistrationInformation', {user_id}, function(res) { |
| | | if (res.data.registrationInformation) { |
| | | let data=res.data.registrationInformation; |
| | | self.formData.province_id = data.province_id; |
| | | self.formData.city_id = data.city_id; |
| | | self.formData.region_id = data.region_id; |
| | | self.formData.real_name = data.real_name; |
| | | self.formData.mobile = data.mobile; |
| | | self.formData.shop_supplier_id = data.shop_supplier_id; |
| | | self.supplier_name = data.supplier_name; |
| | | self.selectCity = res.data.registrationInformation.region; |
| | | if (res.data.registrationInformation.branch_name) { |
| | | self.branch_name = res.data.registrationInformation.branch_name; |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 提交 |
| | | formSubmit() { |
| | |
| | | closeUserFunc(e) { |
| | | if (e != null) { |
| | | this.formData.user_id = e.user_id; |
| | | this.getRegistrationInformation(this.formData.user_id ) |
| | | this.user_info.name = e.real_name ? e.real_name : e.nickName; |
| | | this.user_info.avatarUrl = e.avatarUrl; |
| | | if (!this.formData.avatarUrl) { |
| New file |
| | |
| | | <template> |
| | | <view class="category-wrap" :data-theme='theme()' :class="theme() || ''"> |
| | | <!-- #ifdef APP-PLUS --> |
| | | <header-bar></header-bar> |
| | | <!-- #endif --> |
| | | <!-- 搜索框 --> |
| | | <view class="index-search-box-cate d-b-c" id="searchBox" |
| | | :style="topBarHeight() == 0 ? '': 'height:'+topBarHeight()+'px;padding-top:'+topBarTop()+'px'"> |
| | | <view class="reg180" @click="goback"><text class="icon iconfont icon-jiantou"></text></view> |
| | | <view class="index-search-cate flex-1 t-c" @click="gotoSearch"> |
| | | <span class="icon iconfont icon-sousuo"></span> |
| | | <text class="ml10">{{ searchName }}</text> |
| | | </view> |
| | | <!-- #ifdef MP-WEIXIN --> |
| | | <view class="wx-top-right"></view> |
| | | <!-- #endif --> |
| | | </view> |
| | | <!--类别列表--> |
| | | <view class="category-content"> |
| | | <!--一级分类 大图--> |
| | | <view class="cotegory-type cotegory-type-1" v-if="show_type==10"> |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:'+scrollviewHigh+'px;'"> |
| | | <view class="list"> |
| | | <view class="item" v-for="(item,index) in listData" :key="index" |
| | | @click="gotoList(item.category_id)"> |
| | | <view class="pic"> |
| | | <image :src="hasImages(item)" mode="widthFix"></image> |
| | | </view> |
| | | <view class="p-20-0 fb tc f34"> |
| | | {{item.name}} |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | |
| | | <!--一级分类 小图--> |
| | | <view class="cotegory-type cotegory-type-2" v-if="show_type==20"> |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:'+scrollviewHigh+'px;'"> |
| | | <view class="list"> |
| | | <view class="item" v-for="(item,index) in listData" :key="index" |
| | | @click="gotoList(item.category_id)"> |
| | | <image :src="hasImages(item)" mode="aspectFit"></image> |
| | | <text>{{item.name}}</text> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | |
| | | <!--一级分类 列表--> |
| | | <view class="cotegory-type cotegory-type-3" v-if="show_type==40"> |
| | | <view class="category-tab"> |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:'+scrollviewHigh+'px;'"> |
| | | <view :class="index==select_index?'item active':'item'" v-for="(item,index) in listData" |
| | | :key="index" @click="getProductData(index)"> |
| | | <text>{{item.name}}</text> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | <view class="category-content pr"> |
| | | <scroll-view scroll-y="true" class="scroll-Y scroll-3" :style="'height:'+scrollviewHigh+'px;'"> |
| | | <view class="shop_body"> |
| | | <view class="shop_body_l_item" :class="index==productData.length-1?'noborder':''" v-for="(item,index) in productData" |
| | | :key="index" @click="gotoList2(item.product_id)" v-if="index_open_city==0 || (index_open_city==1 && isInArray2(city_supplier_ids,item.shop_supplier_id))"> |
| | | <view> |
| | | <image :src="item.product_image" mode=""></image> |
| | | </view> |
| | | <view class="shop_body_l_item_info"> |
| | | <view class="shop_body_l_item_info_title gray3 f32">{{item.product_name}}</view> |
| | | <view class="d-b-c pb10"> |
| | | <view class="shop_body_l_item_info_price"> |
| | | <view class="f24 shop_red">¥<text class="f32 fb">{{item.product_price}}</text></view> |
| | | </view> |
| | | <!-- 购物车操作组件 --> |
| | | <view class="cart-action"> |
| | | <!-- 多规格商品显示选择规格按钮 --> |
| | | <view class="spec-select-btn" v-if="item.spec_type === 20" @click.stop="showSpecPopup(item,index)"> |
| | | <text>选择规格</text> |
| | | <!-- 购物车数量徽章 --> |
| | | <view class="cart-badge" v-if="(item.cart && item.cart.total_num > 0)"> |
| | | <text class="cart-count">{{ item.cart.total_num || 0 }}</text> |
| | | </view> |
| | | </view> |
| | | <!-- 单规格商品显示购物车操作 --> |
| | | <template v-else> |
| | | <view class="cart-btn-add" v-if="!item.cart.total_num || item.cart.total_num <= 0" @click.stop="addToCart(item,index)"> |
| | | <text class="icon iconfont icon-jia"></text> |
| | | </view> |
| | | <view class="cart-number-controller" v-else> |
| | | <view class="cart-btn-sub" @click.stop="decreaseCart(item,index)"> |
| | | <text class="icon iconfont icon-jian"></text> |
| | | </view> |
| | | <view class="cart-number">{{ item.cart.total_num }}</view> |
| | | <view class="cart-btn-add" @click.stop="increaseCart(item,index)"> |
| | | <text class="icon iconfont icon-jia"></text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | </view> |
| | | <!-- <view class="shop_body_l_item_info_others f22"> |
| | | <view class="shop_body_l_item_info_others_sales">累计成交:{{item.product_sales}}笔</view> |
| | | </view> --> |
| | | </view> |
| | | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 没有记录 --> |
| | | <view class="d-c-c p30" v-if="productData.length==0 && !isloadding"> |
| | | <text class="iconfont icon-wushuju"></text> |
| | | <text class="cont">亲,暂无相关记录哦</text> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!--二级分类--> |
| | | <view class="cotegory-type cotegory-type-3" v-if="show_type==30"> |
| | | <view class="category-tab"> |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:'+scrollviewHigh+'px;'"> |
| | | <view :class="index==select_index?'item active':'item'" v-for="(item,index) in listData" |
| | | :key="index" @click="selectCategory(index)"> |
| | | <text>{{item.name}}</text> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | <view class="category-content pr"> |
| | | <scroll-view scroll-y="true" class="scroll-Y scroll-3" :style="'height:'+scrollviewHigh+'px;'"> |
| | | <view class="f26 catename">{{catename}}</view> |
| | | <view class="list"> |
| | | <view class="item" v-for="(item,index) in childlist" :key="index" |
| | | @click="gotoList(item.category_id)"> |
| | | <image :src="hasImages(item)" mode="aspectFit"></image> |
| | | <text class="type-name">{{item.name}}</text> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | </view> |
| | | |
| | | </view> |
| | | <tabBar></tabBar> |
| | | <request-loading :loadding='isloadding'></request-loading> |
| | | |
| | | <!-- 规格选择弹窗 --> |
| | | <view class="spec-popup" :class="specPopupVisible ? 'visible' : ''" @touchmove.stop.prevent=""> |
| | | <view class="popup-mask" @click="closeSpecPopup"></view> |
| | | <view class="popup-content" v-if="selectedProduct"> |
| | | <view class="popup-header"> |
| | | <image :src="selectedProduct.product_image" mode="aspectFit"></image> |
| | | <view class="popup-header-info"> |
| | | <view class="price">¥{{ currentPrice }}</view> |
| | | <view class="stock">库存:{{ currentStock }}</view> |
| | | <view class="selected-spec">{{ selectedSpecText }}</view> |
| | | </view> |
| | | <view class="popup-header-right"> |
| | | <view class="close-btn" @click="closeSpecPopup"> |
| | | <text class="icon iconfont icon-guanbi"></text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="spec-section" v-if="selectedProduct.spec_type === 20 && selectedProduct.specData"> |
| | | <view class="spec-group" v-for="(specGroup, groupIndex) in selectedProduct.specData.spec_attr" :key="groupIndex"> |
| | | <view class="spec-group-name">{{ specGroup.group_name }}</view> |
| | | <view class="spec-options"> |
| | | <view |
| | | class="spec-option" |
| | | :class="{ active: selectedSpecs[groupIndex] === specItem.item_id }" |
| | | v-for="(specItem, itemIndex) in specGroup.spec_items" |
| | | :key="itemIndex" |
| | | @click="selectSpec(groupIndex, specItem.item_id)" |
| | | > |
| | | {{ specItem.spec_value }} |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="quantity-section"> |
| | | <view class="quantity-label">数量</view> |
| | | <view class="quantity-controller"> |
| | | <view class="quantity-btn" :class="{ disabled: quantity <= 1 }" @click="decreaseQuantity"> |
| | | <text class="icon iconfont icon-jian"></text> |
| | | </view> |
| | | <view class="quantity-display">{{ quantity }}</view> |
| | | <view class="quantity-btn" :class="{ disabled: quantity >= currentStock }" @click="increaseQuantity"> |
| | | <text class="icon iconfont icon-jia"></text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="action-buttons"> |
| | | <button class="add-cart-btn" @click="confirmAddToCart">加入购物车</button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | components: {}, |
| | | data() { |
| | | return { |
| | | isloadding: true, |
| | | searchName: '搜索商品', |
| | | /*展示方式*/ |
| | | show_type: 3, |
| | | /*手机高度*/ |
| | | phoneHeight: 0, |
| | | /*可滚动视图区域高度*/ |
| | | scrollviewHigh: 0, |
| | | /*数据*/ |
| | | listData: [], |
| | | /*子类数据*/ |
| | | childlist: [], |
| | | /*当前选中的分类*/ |
| | | select_index: 0, |
| | | productData:[], |
| | | catename:'', |
| | | /*底部加载*/ |
| | | loading: true, |
| | | index_open_city:0, |
| | | city_supplier_ids:[], |
| | | |
| | | // 购物车相关数据 |
| | | cartData: {}, // 存储各商品在购物车中的数量 |
| | | |
| | | // 规格弹窗相关数据 |
| | | specPopupVisible: false, |
| | | selectedProduct: null, |
| | | selectedSpecs: [], |
| | | quantity: 1 |
| | | }; |
| | | }, |
| | | computed: { |
| | | selectedSpecText() { |
| | | if (!this.selectedProduct || !this.selectedProduct.specData) return '请选择规格'; |
| | | |
| | | const selectedNames = this.selectedSpecs |
| | | .map((specId, index) => { |
| | | const specGroup = this.selectedProduct.specData.spec_attr[index]; |
| | | if (!specGroup) return ''; |
| | | |
| | | const selectedItem = specGroup.spec_items.find(item => item.item_id === specId); |
| | | return selectedItem ? selectedItem.spec_value : ''; |
| | | }) |
| | | .filter(name => name !== ''); |
| | | |
| | | return selectedNames.length > 0 ? `已选: "${selectedNames.join(' ')}"` : '请选择规格'; |
| | | }, |
| | | |
| | | // 根据选中的规格获取当前SKU |
| | | currentSku() { |
| | | if (!this.selectedProduct || !this.selectedProduct.sku || this.selectedSpecs.includes(null) || this.selectedSpecs.includes(undefined)) { |
| | | return null; |
| | | } |
| | | |
| | | const specSkuId = this.selectedSpecs.join('_'); |
| | | return this.selectedProduct.sku.find(sku => sku.spec_sku_id === specSkuId); |
| | | }, |
| | | |
| | | // 获取当前选中规格的价格 |
| | | currentPrice() { |
| | | if (this.currentSku) { |
| | | return this.currentSku.product_price; |
| | | } |
| | | return this.selectedProduct ? this.selectedProduct.product_price : '0.00'; |
| | | }, |
| | | |
| | | // 获取当前选中规格的库存 |
| | | currentStock() { |
| | | if (this.currentSku) { |
| | | return this.currentSku.stock_num; |
| | | } |
| | | return this.selectedProduct ? this.selectedProduct.product_stock : 0; |
| | | }, |
| | | |
| | | |
| | | }, |
| | | mounted() { |
| | | this.init(); |
| | | this.getData(); |
| | | }, |
| | | onShow(){ |
| | | this.getData(); |
| | | this.getTabBarLinks(); |
| | | }, |
| | | methods: { |
| | | /*初始化*/ |
| | | init() { |
| | | let _this = this; |
| | | uni.getSystemInfo({ |
| | | success(res) { |
| | | _this.phoneHeight = res.windowHeight; |
| | | // 计算组件的高度 |
| | | let view = uni.createSelectorQuery().select('#searchBox'); |
| | | view.boundingClientRect(data => { |
| | | let h = _this.phoneHeight - data.height; |
| | | _this.scrollviewHigh = h; |
| | | }).exec(); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | isInArray2(arr,value){ |
| | | value=parseInt(value); |
| | | var index = arr.indexOf(value); |
| | | if(index >= 0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | |
| | | /*判断是否有图片*/ |
| | | hasImages(e) { |
| | | if (e.images != null && e.images.file_path != null) { |
| | | return e.images.file_path; |
| | | } else { |
| | | return ''; |
| | | } |
| | | }, |
| | | |
| | | /*获取数据*/ |
| | | getData() { |
| | | let _this = this; |
| | | _this.select_index = 0; |
| | | |
| | | var city_supplier_ids = ''; |
| | | if(uni.getStorageSync('citySupplierRes')){ |
| | | let resData=uni.getStorageSync('citySupplierRes'); |
| | | _this.city_supplier_ids=resData.supplier_ids; |
| | | city_supplier_ids = _this.city_supplier_ids.join(",") |
| | | } |
| | | _this.isloadding = true; |
| | | _this._get('product.category/index', {city_supplier_ids:city_supplier_ids,shop_supplier_id:uni.getStorageSync('shop_supplier_id')}, function(res) { |
| | | _this.listData = res.data.list; |
| | | _this.show_type = res.data.template.category_style; |
| | | if(_this.listData.length>0){ |
| | | if (_this.listData[0].child) { |
| | | _this.childlist = _this.listData[0].child; |
| | | } |
| | | } |
| | | _this.catename = _this.listData[0].name; |
| | | _this.background = res.data.background; |
| | | _this.productData=res.data.productList.data; |
| | | _this.index_open_city=res.data.store.index_open_city; |
| | | _this.isloadding = false; |
| | | }); |
| | | }, |
| | | goback() { |
| | | uni.navigateBack({ |
| | | |
| | | }) |
| | | }, |
| | | |
| | | /*选择分类*/ |
| | | selectCategory(e) { |
| | | if (this.listData[e].child) { |
| | | this.childlist = this.listData[e].child; |
| | | this.select_index = e; |
| | | } |
| | | }, |
| | | /*获取商品数据*/ |
| | | getProductData(e) { |
| | | this.select_index = e; |
| | | this.productData=[]; |
| | | let self = this; |
| | | var city_supplier_ids = ''; |
| | | if(uni.getStorageSync('citySupplierRes')){ |
| | | let resData=uni.getStorageSync('citySupplierRes'); |
| | | self.city_supplier_ids=resData.supplier_ids; |
| | | city_supplier_ids = self.city_supplier_ids.join(",") |
| | | } |
| | | let page = 1; |
| | | let list_rows = 10; |
| | | let category_id =this.listData[e].category_id; |
| | | let search = ''; |
| | | let sortType = ''; |
| | | let sortPrice = 0; |
| | | self.isloadding = true; |
| | | self._get('product.product/lists', { |
| | | page: page || 1, |
| | | category_id: category_id, |
| | | search: search, |
| | | sortType: sortType, |
| | | sortPrice: sortPrice, |
| | | list_rows: list_rows, |
| | | city_supplier_ids:city_supplier_ids |
| | | }, function(res) { |
| | | self.isloadding = false; |
| | | self.productData = res.data.list.data; |
| | | self.index_open_city=res.data.store.index_open_city; |
| | | }); |
| | | }, |
| | | /*跳转产品列表*/ |
| | | gotoList2(e) { |
| | | let url = 'pages/product/detail/detail?product_id=' + e |
| | | this.gotoPage(url); |
| | | }, |
| | | /*跳转产品列表*/ |
| | | gotoList(e) { |
| | | let category_id = e; |
| | | let sortType = 'all'; |
| | | let search = ''; |
| | | let sortPrice = 0; |
| | | this.gotoPage('/pages/product/list/list?category_id=' + category_id + '&sortType=' + sortType + |
| | | '&search=' + search + |
| | | '&sortPrice=' + sortPrice); |
| | | }, |
| | | |
| | | wxGetUserInfo: function(res) { |
| | | if (!res.detail.iv) { |
| | | uni.showToast({ |
| | | title: "您取消了授权,登录失败", |
| | | icon: "none" |
| | | }); |
| | | return false; |
| | | } |
| | | }, |
| | | |
| | | /*跳转搜索页面*/ |
| | | gotoSearch() { |
| | | this.gotoPage('/pages/product/search/search'); |
| | | }, |
| | | /** |
| | | * 设置分享内容 |
| | | */ |
| | | onShareAppMessage() { |
| | | let self = this; |
| | | return { |
| | | title: self.templet.share_title, |
| | | path: '/pages/product/category?' + self.getShareUrlParams() |
| | | }; |
| | | }, |
| | | |
| | | |
| | | // 添加到购物车或显示规格选择 |
| | | addToCartOrShowSpec(product,index) { |
| | | if (product.spec_type === 20) { |
| | | // 多规格商品,显示规格选择弹窗 |
| | | this.showSpecPopup(product); |
| | | } else { |
| | | // 单规格商品,直接添加到购物车 |
| | | this.directlyAddToCart(product,index); |
| | | } |
| | | }, |
| | | |
| | | // 添加到购物车(单规格商品) |
| | | addToCart(product,index) { |
| | | this.directlyAddToCart(product,index); |
| | | }, |
| | | |
| | | // 直接添加到购物车(单规格商品) |
| | | directlyAddToCart(product,index) { |
| | | this._post('order.cart/add', { |
| | | product_id: product.product_id, |
| | | total_num: 1, |
| | | spec_sku_id: 0 |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | if(!product.cart){ |
| | | product.cart={ |
| | | total_num:0 |
| | | } |
| | | } |
| | | // 更新商品的购物车数量 |
| | | product.cart.total_num++; |
| | | this.productData[index].cart.total_num = product.cart.total_num; |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 显示规格选择弹窗 |
| | | showSpecPopup(product) { |
| | | this.selectedProduct = product; |
| | | this.quantity = 1; |
| | | let url='' |
| | | //#ifdef H5 |
| | | if (this.isWeixin()) { |
| | | url = window.location.href; |
| | | } |
| | | //#endif |
| | | // 获取商品规格数据 |
| | | this._get('product.product/detail', { |
| | | product_id: product.product_id, |
| | | url:url, |
| | | visitcode: this.getVisitcode() |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | |
| | | // 使用正确的路径获取规格数据 |
| | | let specData = res.data.detail.product_multi_spec || res.data.detail; |
| | | this.$set(this.selectedProduct, 'specData', specData); |
| | | // 同时设置SKU数据 |
| | | if (res.data.detail.sku) { |
| | | this.$set(this.selectedProduct, 'sku', res.data.detail.sku); |
| | | } |
| | | console.log(this.selectedSpecs); |
| | | // 初始化选中规格数组 |
| | | |
| | | if (specData && specData.spec_attr) { |
| | | this.selectedSpecs = specData.spec_attr.map(specGroup => { |
| | | return specGroup.spec_items && specGroup.spec_items.length > 0 ? specGroup.spec_items[0].item_id : null; |
| | | }); |
| | | this.specPopupVisible = true; |
| | | |
| | | } else { |
| | | uni.showToast({ |
| | | title: '获取商品规格失败', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | } else { |
| | | uni.showToast({ |
| | | title: '获取商品规格失败', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 关闭规格选择弹窗 |
| | | closeSpecPopup() { |
| | | this.specPopupVisible = false; |
| | | this.selectedProduct = null; |
| | | this.selectedSpecs = []; |
| | | }, |
| | | |
| | | // 选择规格 |
| | | selectSpec(groupIndex, itemId) { |
| | | // 使用 Vue.set 确保响应式更新 |
| | | this.$set(this.selectedSpecs, groupIndex, itemId); |
| | | }, |
| | | |
| | | // 增加数量 |
| | | increaseQuantity() { |
| | | if (this.quantity < this.currentStock) { |
| | | this.quantity++; |
| | | } |
| | | }, |
| | | |
| | | // 减少数量 |
| | | decreaseQuantity() { |
| | | if (this.quantity > 1) { |
| | | this.quantity--; |
| | | } |
| | | }, |
| | | |
| | | // 确认添加到购物车 |
| | | confirmAddToCart() { |
| | | // 检查是否选择了所有规格 |
| | | if (this.selectedSpecs.includes(null) || this.selectedSpecs.includes(undefined)) { |
| | | uni.showToast({ |
| | | title: '请选择完整的商品规格', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 构造规格SKU ID |
| | | const specSkuId = this.selectedSpecs.join('_'); |
| | | |
| | | this._post('order.cart/add', { |
| | | product_id: this.selectedProduct.product_id, |
| | | total_num: this.quantity, |
| | | spec_sku_id: specSkuId?specSkuId:0 |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | // 更新商品的购物车数量 |
| | | const product = this.productData.find(p => p.product_id === this.selectedProduct.product_id); |
| | | if (product) { |
| | | if(!product.cart){ |
| | | product.cart={ |
| | | total_num:0 |
| | | } |
| | | } |
| | | product.cart.total_num++; |
| | | } |
| | | |
| | | // 关闭弹窗 |
| | | this.closeSpecPopup(); |
| | | |
| | | uni.showToast({ |
| | | title: '已添加到购物车', |
| | | icon: 'success' |
| | | }); |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 增加购物车商品数量 |
| | | increaseCart(product,index) { |
| | | this._post('order.cart/add', { |
| | | product_id: product.product_id, |
| | | total_num: 1, |
| | | spec_sku_id: 0 |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | product.cart.total_num++; |
| | | this.productData[index].cart.total_num = product.cart.total_num; |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 减少购物车商品数量 |
| | | decreaseCart(product,index) { |
| | | if (product.cart.total_num <= 1) { |
| | | // 如果数量为1,执行删除操作 |
| | | this._post('order.cart/delete', { |
| | | product_id: product.product_id, |
| | | cart_id: product.cart.cart_id, |
| | | spec_sku_id:product.product_sku.spec_sku_id |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | this.productData[index].cart.total_num=0; |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | } else { |
| | | // 否则减少数量 |
| | | this._post('order.cart/sub', { |
| | | product_id: product.product_id, |
| | | spec_sku_id:product.product_sku.spec_sku_id |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | product.cart.total_num--; |
| | | this.productData[index].cart.total_num = product.cart.total_num; |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | @import '@/common/mixin.scss'; |
| | | |
| | | .foot_ { |
| | | height: 98rpx; |
| | | width: 100%; |
| | | } |
| | | |
| | | .cotegory-type { |
| | | line-height: 40rpx; |
| | | background: #ffffff; |
| | | } |
| | | |
| | | .cotegory-type image { |
| | | width: 100%; |
| | | } |
| | | |
| | | .cotegory-type-1 .list { |
| | | padding: 20rpx; |
| | | } |
| | | |
| | | .cotegory-type-1 .list .item { |
| | | margin-top: 30rpx; |
| | | } |
| | | |
| | | .cotegory-type-1 .list .item .pic { |
| | | border: 1px solid #e3e3e3; |
| | | width: 710rpx; |
| | | height: auto; |
| | | overflow: hidden; |
| | | border-radius: 8px; |
| | | } |
| | | |
| | | .cotegory-type-1 .list .item image { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | |
| | | .cotegory-type-2 .list, |
| | | .cotegory-type-3 .list { |
| | | padding: 0 20rpx; |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | justify-content: flex-start; |
| | | } |
| | | |
| | | .cotegory-type-2 .list .item, |
| | | .cotegory-type-3 .list .item { |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | |
| | | .cotegory-type-2 .list .item { |
| | | padding: 0 16rpx; |
| | | width: 200rpx; |
| | | height: 300rpx; |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .cotegory-type-2 .list .item image { |
| | | width: 180rpx; |
| | | height: 180rpx; |
| | | margin-bottom: 20rpx; |
| | | } |
| | | |
| | | .cotegory-type-3 { |
| | | display: flex; |
| | | } |
| | | |
| | | .cotegory-type-3 .category-tab { |
| | | width: 200rpx; |
| | | background: #FFFFFF; |
| | | // border-right: 1px solid #e3e3e3; |
| | | } |
| | | |
| | | .cotegory-type-3 .category-tab .item { |
| | | padding: 40rpx 0; |
| | | font-size: 26rpx; |
| | | text-align: center; |
| | | color: #666666; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .cotegory-type-3 .category-tab .item.active { |
| | | position: relative; |
| | | background: #ffffff; |
| | | |
| | | color: #333333; |
| | | } |
| | | |
| | | .cotegory-type-3 .category-tab .item.active::after { |
| | | position: absolute; |
| | | content: ''; |
| | | top: 40rpx; |
| | | bottom: 40rpx; |
| | | left: 0; |
| | | width: 6rpx; |
| | | height: 22rpx; |
| | | margin: auto; |
| | | @include background_linear('titleft1', 'titleft2', 180deg, 0%, 100%); |
| | | } |
| | | |
| | | .cotegory-type-3 .category-content { |
| | | flex: 1; |
| | | margin: 0 20rpx; |
| | | } |
| | | |
| | | .cotegory-type-3 .list .item { |
| | | width: 140rpx; |
| | | height: 200rpx; |
| | | margin-top: 40rpx; |
| | | margin-right: 20rpx; |
| | | font-size: 24rpx; |
| | | } |
| | | |
| | | .cotegory-type-3 .list .item:nth-child(3n) { |
| | | margin-right: 0; |
| | | } |
| | | |
| | | .cotegory-type-3 .list .item image { |
| | | width: 140rpx; |
| | | height: 140rpx; |
| | | } |
| | | |
| | | .cotegory-type-3 .list .item .type-name { |
| | | display: block; |
| | | margin-top: 20rpx; |
| | | height: 80rpx; |
| | | line-height: 60rpx; |
| | | text-overflow: ellipsis; |
| | | width: 100%; |
| | | color: #818181; |
| | | font-size: 26rpx; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-align: center; |
| | | } |
| | | |
| | | .scroll-3 { |
| | | position: absolute; |
| | | background: #ffffff; |
| | | border-radius: 12px; |
| | | } |
| | | .catename{ |
| | | padding-top: 10rpx; |
| | | line-height: 60rpx; |
| | | border-bottom: 1rpx solid #D9D9D9; |
| | | } |
| | | .shop_body { |
| | | width: 100%; |
| | | background-color: #ffffff; |
| | | padding: 0rpx 20rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .shop_body_l_item { |
| | | // width: 90%; |
| | | // height: 250rpx; |
| | | margin: 0 auto; |
| | | background-color: white; |
| | | // border-radius: 15rpx; |
| | | // margin-top: 20rpx; |
| | | display: flex; |
| | | padding: 40rpx 0; |
| | | box-sizing: border-box; |
| | | border-bottom: 1rpx solid #D9D9D9; |
| | | |
| | | } |
| | | |
| | | .shop_body_l_item image { |
| | | width: 150rpx; |
| | | height: 150rpx; |
| | | border-radius: 12rpx; |
| | | background-color: rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .shop_body_l_item_info { |
| | | // width: 70%; |
| | | // height: 100%; |
| | | flex: 1; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | flex-direction: column; |
| | | padding-left: 20rpx; |
| | | box-sizing: border-box; |
| | | position: relative; |
| | | } |
| | | |
| | | .shop_body_l_item_info_title { |
| | | display: -webkit-box; |
| | | -webkit-box-orient: vertical; |
| | | -webkit-line-clamp: 2; |
| | | text-overflow: ellipsis; |
| | | -webkit-box-orient: vertical; |
| | | word-wrap: break-word; |
| | | word-break: break-all; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .shop_body_l_item_info_price { |
| | | display: flex; |
| | | align-items: flex-end; |
| | | } |
| | | |
| | | .shop_body_l_item_info_price view { |
| | | margin-right: 15rpx; |
| | | } |
| | | |
| | | .shop_body_l_item_info_others { |
| | | // width: 100%; |
| | | height: 30rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .shop_body_l_item_info_others_activity { |
| | | width: 150rpx; |
| | | height: 30rpx; |
| | | line-height: 30rpx; |
| | | border: 1rpx #E22319 solid; |
| | | border-radius: 30rpx; |
| | | /* font-size: 16rpx; */ |
| | | color: #E22319; |
| | | text-align: center; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .shop_body_l_item_info_others_sales { |
| | | color: #333333; |
| | | } |
| | | |
| | | .shop_body2 { |
| | | width: 100%; |
| | | display: flex; |
| | | justify-content: flex-start; |
| | | flex-wrap: wrap; |
| | | background-color: #f2f2f2; |
| | | } |
| | | |
| | | .shop_body_t_item { |
| | | width: 345rpx; |
| | | // margin: 0 2.5%; |
| | | margin-bottom: 20rpx; |
| | | height: 520rpx; |
| | | overflow: hidden; |
| | | background-color: white; |
| | | border-radius: 12rpx; |
| | | } |
| | | |
| | | .collect text { |
| | | color: #FFFFFF; |
| | | } |
| | | |
| | | .shop_body_t_item image { |
| | | width: 100%; |
| | | height: 337.5rpx; |
| | | background-color: rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .shop_body_t_item_info { |
| | | // height: 182.5rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: flex-start; |
| | | padding: 20rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .shop_body_t_item_info_title { |
| | | display: -webkit-box; |
| | | -webkit-box-orient: vertical; |
| | | -webkit-line-clamp: 1; |
| | | text-overflow: ellipsis; |
| | | -webkit-box-orient: vertical; |
| | | word-wrap: break-word; |
| | | word-break: break-all; |
| | | overflow: hidden; |
| | | margin-bottom: 30rpx; |
| | | } |
| | | |
| | | .shop_body_t_item_info_price { |
| | | display: flex; |
| | | align-items: flex-end; |
| | | |
| | | } |
| | | |
| | | .shop_body_t_item_info_others { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-bottom: 8rpx; |
| | | } |
| | | |
| | | .shop_body_t_item_info_others_activity {} |
| | | |
| | | .shop_body_t_item_info_others_sales { |
| | | color: #999999; |
| | | } |
| | | |
| | | .huaxianjia { |
| | | text-decoration: line-through; |
| | | color: #999; |
| | | margin-left: 5rpx; |
| | | } |
| | | |
| | | .shop_red { |
| | | color: #F6220C; |
| | | } |
| | | |
| | | .inner-tab .item .icon-sanjiao2 { |
| | | font-size: 13rpx; |
| | | } |
| | | |
| | | .inner-tab .item .icon-sanjiao1 { |
| | | font-size: 13rpx; |
| | | } |
| | | |
| | | .noborder { |
| | | border: none; |
| | | } |
| | | |
| | | /* 购物车操作样式 */ |
| | | .cart-action { |
| | | /* position: absolute; |
| | | right: 0; |
| | | bottom: 0; */ |
| | | } |
| | | |
| | | .cart-btn-add, .cart-btn-sub { |
| | | width: 48rpx; |
| | | height: 48rpx; |
| | | border-radius: 50%; |
| | | background: #ff6b6b; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | color: white; |
| | | font-size: 24rpx; |
| | | } |
| | | |
| | | .spec-select-btn { |
| | | padding: 2rpx 4rpx; |
| | | background: #ff6b6b; |
| | | color: white; |
| | | border-radius: 24rpx; |
| | | font-size: 24rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | min-width: 120rpx; |
| | | height: 48rpx; |
| | | position: relative; |
| | | } |
| | | |
| | | .cart-btn-sub { |
| | | background: #f0f0f0; |
| | | color: #666; |
| | | } |
| | | |
| | | .cart-number { |
| | | margin: 0 10rpx; |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .cart-number-controller { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | /* 规格选择弹窗样式 */ |
| | | .spec-popup { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | z-index: 1000; |
| | | visibility: hidden; |
| | | opacity: 0; |
| | | transition: all 0.3s ease; |
| | | } |
| | | |
| | | .spec-popup.visible { |
| | | visibility: visible; |
| | | opacity: 1; |
| | | } |
| | | |
| | | .popup-mask { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | background: rgba(0, 0, 0, 0.6); |
| | | } |
| | | |
| | | .popup-content { |
| | | position: absolute; |
| | | bottom: 0; |
| | | left: 0; |
| | | right: 0; |
| | | background: white; |
| | | border-top-left-radius: 20rpx; |
| | | border-top-right-radius: 20rpx; |
| | | padding: 30rpx; |
| | | transform: translateY(100%); |
| | | transition: transform 0.3s ease; |
| | | max-height: 80%; |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .spec-popup.visible .popup-content { |
| | | transform: translateY(0); |
| | | } |
| | | |
| | | .popup-header { |
| | | display: flex; |
| | | position: relative; |
| | | padding-right: 60rpx; |
| | | margin-bottom: 30rpx; |
| | | } |
| | | |
| | | .popup-header image { |
| | | width: 160rpx; |
| | | height: 160rpx; |
| | | border-radius: 10rpx; |
| | | } |
| | | |
| | | .popup-header-info { |
| | | margin-left: 20rpx; |
| | | flex: 1; |
| | | } |
| | | |
| | | .price { |
| | | font-size: 36rpx; |
| | | color: #ff6b6b; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .stock { |
| | | font-size: 24rpx; |
| | | color: #999; |
| | | margin-top: 10rpx; |
| | | } |
| | | |
| | | .selected-spec { |
| | | font-size: 24rpx; |
| | | color: #666; |
| | | margin-top: 10rpx; |
| | | } |
| | | |
| | | .popup-header-right { |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 20rpx; |
| | | } |
| | | |
| | | .cart-badge { |
| | | position: absolute; |
| | | top: -12rpx; |
| | | right: -12rpx; |
| | | background: #ff4757; |
| | | color: white; |
| | | border-radius: 50%; |
| | | min-width: 32rpx; |
| | | height: 32rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | font-size: 20rpx; |
| | | line-height: 1; |
| | | padding: 0 6rpx; |
| | | z-index: 10; |
| | | } |
| | | |
| | | .cart-count { |
| | | color: white; |
| | | font-size: 20rpx; |
| | | line-height: 1; |
| | | } |
| | | |
| | | .close-btn { |
| | | width: 50rpx; |
| | | height: 50rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | color: #999; |
| | | } |
| | | |
| | | .spec-section { |
| | | margin-bottom: 30rpx; |
| | | } |
| | | |
| | | .spec-group { |
| | | margin-bottom: 30rpx; |
| | | } |
| | | |
| | | .spec-group-name { |
| | | font-size: 28rpx; |
| | | font-weight: bold; |
| | | margin-bottom: 20rpx; |
| | | } |
| | | |
| | | .spec-options { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | } |
| | | |
| | | .spec-option { |
| | | padding: 10rpx 20rpx; |
| | | border: 1rpx solid #ddd; |
| | | border-radius: 10rpx; |
| | | margin-right: 20rpx; |
| | | margin-bottom: 20rpx; |
| | | font-size: 26rpx; |
| | | } |
| | | |
| | | .spec-option.active { |
| | | border-color: #ff6b6b; |
| | | color: #ff6b6b; |
| | | } |
| | | |
| | | .quantity-section { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-bottom: 30rpx; |
| | | } |
| | | |
| | | .quantity-label { |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .quantity-controller { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .quantity-btn { |
| | | width: 50rpx; |
| | | height: 50rpx; |
| | | border: 1rpx solid #ddd; |
| | | border-radius: 10rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | font-size: 24rpx; |
| | | } |
| | | |
| | | .quantity-btn.disabled { |
| | | opacity: 0.5; |
| | | } |
| | | |
| | | .quantity-display { |
| | | margin: 0 20rpx; |
| | | font-size: 28rpx; |
| | | min-width: 60rpx; |
| | | text-align: center; |
| | | } |
| | | |
| | | .action-buttons { |
| | | text-align: center; |
| | | } |
| | | |
| | | .add-cart-btn { |
| | | width: 100%; |
| | | height: 80rpx; |
| | | background: linear-gradient(90deg, #ff6b6b, #ff8e8e); |
| | | border-radius: 40rpx; |
| | | color: white; |
| | | font-size: 32rpx; |
| | | border: none; |
| | | } |
| | | |
| | | .reg180 { |
| | | padding-right: 20rpx; |
| | | text-align: right; |
| | | transform: rotateY(180deg); |
| | | // position: absolute; |
| | | // bottom: 0; |
| | | } |
| | | </style> |
| | | </file> |
| | |
| | | let self = this; |
| | | self.GetStatusBarHeight(); |
| | | self.shop_supplier_id = option.shop_supplier_id; |
| | | uni.setStorageSync('shop_supplier_id',self.shop_supplier_id) |
| | | //#ifdef H5 |
| | | if (this.isWeixin()) { |
| | | this.url = window.location.href; |
| New file |
| | |
| | | <template> |
| | | <view :data-theme='theme()' :class="theme() || ''"> |
| | | <view class="points-top theme-bg d-b-c"> |
| | | <image class="bg-points" src="/static/bg-points.png" mode=""></image> |
| | | <view class="d-c d-c-c pr ww100 hh100"> |
| | | <text class="f28 mb30">{{consumption_name()}}</text> |
| | | <text class="f72 fb">{{consumer_coupon}}</text> |
| | | </view> |
| | | </view> |
| | | <!--列表--> |
| | | |
| | | <view class="p-0-30 bg-white"> |
| | | <view class="d-b-c border-b p-30-0" v-for="(item, index) in tableData" :key="index"> |
| | | <view class="d-s-s f-w d-c flex-1"> |
| | | <text class="f28">{{consumption_name(item.describe)}}</text> |
| | | <text class="pt10 gray9 20">{{item.create_time}}</text> |
| | | </view> |
| | | <view class="red f28" v-if="item.value>0">+{{item.value}}</view> |
| | | <view class="red f28" v-else>{{item.value}}</view> |
| | | </view> |
| | | <!-- 没有记录 --> |
| | | <view class="d-c-c p30" v-if="tableData.length==0 && !loading"> |
| | | <text class="iconfont icon-wushuju"></text> |
| | | <text class="cont">亲,暂无相关记录哦</text> |
| | | </view> |
| | | <uni-load-more v-else :loadingType="loadingType"></uni-load-more> |
| | | </view> |
| | | <recharge :isPop="isPop" :discount_ratio="discount_ratio" @close="closePop"></recharge> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import uniLoadMore from "@/components/uni-load-more.vue"; |
| | | import recharge from "./part/recharge.vue"; |
| | | export default { |
| | | components: { |
| | | uniLoadMore, |
| | | recharge |
| | | }, |
| | | data() { |
| | | return { |
| | | isPop: false, |
| | | /*是否加载完成*/ |
| | | loadding: true, |
| | | indicatorDots: true, |
| | | autoplay: true, |
| | | interval: 2000, |
| | | duration: 500, |
| | | /*顶部刷新*/ |
| | | topRefresh: false, |
| | | /*手机高度*/ |
| | | phoneHeight: 0, |
| | | /*可滚动视图区域高度*/ |
| | | scrollviewHigh: 0, |
| | | /*数据列表*/ |
| | | tableData: [], |
| | | /*最后一页码数*/ |
| | | last_page: 0, |
| | | /*当前页面*/ |
| | | page: 1, |
| | | /*每页条数*/ |
| | | list_rows: 20, |
| | | no_more: false, |
| | | loading: true, |
| | | consumer_coupon: 0, |
| | | is_open: false, |
| | | discount_ratio:'0', |
| | | is_trans_balance:false |
| | | }; |
| | | }, |
| | | computed:{ |
| | | |
| | | /*加载中状态*/ |
| | | loadingType() { |
| | | if (this.loading) { |
| | | return 1; |
| | | } else { |
| | | if (this.tableData.length != 0 && this.no_more) { |
| | | return 2; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | onReady() { |
| | | uni.setNavigationBarTitle({ |
| | | title: this.consumption_name() |
| | | }); |
| | | }, |
| | | mounted() { |
| | | /*获取数据*/ |
| | | this.getData(); |
| | | }, |
| | | onReachBottom() { |
| | | let self = this; |
| | | if (self.page < self.last_page) { |
| | | self.page++; |
| | | self.getData(); |
| | | } |
| | | self.no_more = true; |
| | | |
| | | }, |
| | | methods: { |
| | | closePop(e) { |
| | | if(e!=null){ |
| | | this.page = 1; |
| | | this.tableData = []; |
| | | this.getData(); |
| | | } |
| | | this.isPop = false; |
| | | }, |
| | | /*获取数据*/ |
| | | getData() { |
| | | let self = this; |
| | | let page = self.page; |
| | | let list_rows = self.list_rows; |
| | | self._get('consumption.log/index', { |
| | | page: page || 1, |
| | | list_rows: list_rows, |
| | | }, function(data) { |
| | | self.loading = false; |
| | | self.consumer_coupon = data.data.consumer_coupon; |
| | | self.discount_ratio = data.data.discount_ratio; |
| | | self.is_open = data.data.is_open; |
| | | self.is_trans_balance = data.data.is_trans_balance; |
| | | self.tableData = self.tableData.concat(data.data.list.data); |
| | | self.last_page = data.data.list.last_page; |
| | | if (data.data.list.last_page <= 1) { |
| | | self.no_more = true; |
| | | return false; |
| | | } |
| | | |
| | | }); |
| | | }, |
| | | |
| | | /*跳转积分商城*/ |
| | | gotoShop(){ |
| | | this.gotoPage('/pages/plus/points/list/list'); |
| | | } |
| | | |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | .points-top { |
| | | box-sizing: border-box; |
| | | height: 346rpx; |
| | | padding: 0 30rpx; |
| | | color: #FFFFFF; |
| | | position: relative; |
| | | z-index: 1; |
| | | .bg-points{ |
| | | width: 750rpx; |
| | | height: 346rpx; |
| | | z-index: 0; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | } |
| | | } |
| | | |
| | | .re-btn { |
| | | height: 60rpx; |
| | | line-height: 60rpx; |
| | | width: 190rpx; |
| | | padding: 0 8rpx; |
| | | background-color: #FFFFFF; |
| | | border-radius: 30rpx; |
| | | margin-top: 46rpx; |
| | | text-align: center; |
| | | font-size: 28rpx; |
| | | } |
| | | .right-btn{ |
| | | font-size: 28rpx; |
| | | font-weight: 500; |
| | | color: #FFFFFF; |
| | | position: absolute; |
| | | right: 21rpx; |
| | | top: 12rpx; |
| | | background: none; |
| | | border: none; |
| | | padding: 0; |
| | | } |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <view :class="Visible ? 'pop-bg open' : 'pop-bg close'" @click.stop="closePop(null)"> |
| | | <view class="pop-content" @click.stop> |
| | | <view class="recharge-top theme-bg mb30"> |
| | | <view class="recharge-icon left"></view> |
| | | <view class="recharge-icon right"></view> |
| | | </view> |
| | | <view class="f30 gray3 ww100 mb35 tc fb">{{points_name()}}提现</view> |
| | | <view class="input-box"><input type="text" :placeholder="'请输入兑换'+points_name()+'值'" v-model="value" /> |
| | | <image class="input-err" src="/static/icon/input-err.png" mode="" @click="value = ''"></image> |
| | | </view> |
| | | <view class="gray9 f26 tc mt30" style="margin-bottom: 56rpx;">注:1{{points_name()}} = {{discount_ratio}} 余额</view> |
| | | <view class="ww100 d-c-c"> |
| | | <view class="sub-btn theme-btn" @click="submit()">确认</view> |
| | | <view class="close-btn theme-borderbtn" @click="closePop(null)">取消</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import uniLoadMore from "@/components/uni-load-more.vue"; |
| | | export default { |
| | | components: { |
| | | uniLoadMore |
| | | }, |
| | | data() { |
| | | return { |
| | | input_len: 6, |
| | | /*是否可见*/ |
| | | Visible: false, |
| | | value: '', |
| | | is_send: false, |
| | | } |
| | | }, |
| | | props: ['isPop', 'discount_ratio'], |
| | | watch: { |
| | | isPop: function(n, o) { |
| | | let self = this; |
| | | if (n != o) { |
| | | self.Visible = n; |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | submit() { |
| | | let self = this; |
| | | if (self.is_send) { |
| | | return |
| | | } |
| | | self.is_send = true; |
| | | let page = self.page; |
| | | let list_rows = self.list_rows; |
| | | self._get('user.User/transPoints', { |
| | | points: self.value |
| | | }, function(res) { |
| | | self.is_send = false; |
| | | self.showSuccess(res.msg, () => { |
| | | self.closePop(true); |
| | | }) |
| | | }, (err) => { |
| | | self.is_send = false; |
| | | }); |
| | | }, |
| | | closePop(e) { |
| | | this.$emit('close', e); |
| | | this.value = ''; |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | .recharge-top { |
| | | height: 75rpx; |
| | | position: relative; |
| | | border-radius: 25rpx 25rpx 0 0; |
| | | .recharge-icon { |
| | | width: 12rpx; |
| | | height: 49rpx; |
| | | background: #FFFFFF; |
| | | box-shadow: 0rpx 8rpx 3rpx 0rpx rgba(6, 0, 1, 0.03); |
| | | border-radius: 6rpx; |
| | | position: absolute; |
| | | top: -15rpx; |
| | | |
| | | } |
| | | |
| | | .recharge-icon.left { |
| | | left: 156rpx; |
| | | } |
| | | |
| | | .recharge-icon.right { |
| | | right: 156rpx; |
| | | } |
| | | } |
| | | |
| | | .input-box { |
| | | width: 428rpx; |
| | | height: 72rpx; |
| | | border: 1rpx solid #EEEEEE; |
| | | border-radius: 15rpx; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | padding: 0 14rpx 0 21rpx; |
| | | margin: 0 auto; |
| | | |
| | | input { |
| | | border: none; |
| | | font-size: 26rpx; |
| | | color: #999999; |
| | | flex: 1; |
| | | } |
| | | } |
| | | |
| | | .input-err { |
| | | width: 42rpx; |
| | | height: 42rpx; |
| | | flex-shrink: 0; |
| | | margin-left: 18rpx; |
| | | } |
| | | |
| | | .sub-btn { |
| | | width: 148rpx; |
| | | height: 48rpx; |
| | | border-radius: 36rpx; |
| | | font-size: 28rpx; |
| | | color: #FFFFFF; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-content: center; |
| | | margin-right: 93rpx; |
| | | line-height: 48rpx; |
| | | } |
| | | |
| | | .close-btn { |
| | | width: 148rpx; |
| | | height: 48rpx; |
| | | border-radius: 36rpx; |
| | | font-size: 28rpx; |
| | | color: #FFFFFF; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-content: center; |
| | | line-height: 48rpx; |
| | | } |
| | | |
| | | .dominant { |
| | | color: $dominant-color; |
| | | } |
| | | |
| | | .pop-bg { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100vh; |
| | | background: rgba(0, 0, 0, 0.5); |
| | | z-index: 99; |
| | | |
| | | .pop-content { |
| | | position: fixed; |
| | | z-index: 100; |
| | | bottom: 0; |
| | | left: 0; |
| | | right: 0; |
| | | top: 0; |
| | | margin: auto; |
| | | width: 516rpx; |
| | | height: 477rpx; |
| | | padding: 0 0 32rpx 0; |
| | | box-sizing: border-box; |
| | | transform: translate3d(0, 0, 0); |
| | | transition: transform 0.2s cubic-bezier(0, 0, 0.25, 1); |
| | | background-color: #FFFFFF; |
| | | border-radius: 25rpx; |
| | | } |
| | | } |
| | | |
| | | .pop-bg.close { |
| | | // display: none; |
| | | height: 0; |
| | | |
| | | .pop-content { |
| | | transform: translate3d(0, 2000rpx, 0); |
| | | } |
| | | } |
| | | |
| | | .code-image { |
| | | width: 360rpx; |
| | | height: 360rpx; |
| | | |
| | | } |
| | | |
| | | .icon-img { |
| | | width: 40rpx; |
| | | height: 40rpx; |
| | | margin-right: 16rpx; |
| | | |
| | | } |
| | | |
| | | .close-img { |
| | | width: 32rpx; |
| | | height: 32rpx; |
| | | position: absolute; |
| | | right: 32rpx; |
| | | top: 32rpx; |
| | | } |
| | | |
| | | .input-item { |
| | | width: 72rpx; |
| | | height: 96rpx; |
| | | background: #ffffff; |
| | | border-radius: 0px; |
| | | font-size: 40rpx; |
| | | color: rgba(0, 0, 0, 0.87); |
| | | font-weight: 600; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | border-bottom: 2rpx solid #00BDBD; |
| | | margin-right: 16rpx; |
| | | text-align: center; |
| | | line-height: 96rpx; |
| | | } |
| | | |
| | | .input-item:last-child { |
| | | margin-right: 0; |
| | | } |
| | | |
| | | .input-hid { |
| | | margin-left: -100%; |
| | | } |
| | | |
| | | .get-code-btn { |
| | | background-color: #FFFFFF; |
| | | color: $dominant-color; |
| | | background: none; |
| | | padding: 0; |
| | | margin: 0 auto; |
| | | } |
| | | |
| | | button[disabled]:not([type]).get-code-btn { |
| | | background-color: #FFFFFF; |
| | | color: #999999; |
| | | } |
| | | </style> |
| | |
| | | @click="form.model.is_virtual = 1">虚拟商品</view> |
| | | <view class="radio-item" :class="{ active: form.model.is_virtual === 2 }" |
| | | @click="form.model.is_virtual = 2">券商品</view> |
| | | <view class="radio-item" :class="{ active: form.model.is_virtual === 3 }" |
| | | @click="form.model.is_virtual = 3">服务商品</view> |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | </view> |
| | | |
| | | <!-- 虚拟商品设置 --> |
| | | <view class="form-item" v-if="form.model.is_virtual === 1"> |
| | | <view class="form-item" v-if="form.model.is_virtual === 1 || form.model.is_virtual === 3"> |
| | | <view class="item-label">发货类型</view> |
| | | <view class="radio-group"> |
| | | <view class="radio-item" :class="{ active: form.model.virtual_auto === 1 }" |
| | |
| | | <input class="item-input" v-model="form.model.virtual_content" placeholder="请输入虚拟物品内容" /> |
| | | </view> |
| | | |
| | | <view class="form-item" v-if="form.model.is_virtual === 1 && form.model.virtual_auto === 0"> |
| | | <view class="form-item" v-if=" form.model.is_virtual === 3"> |
| | | <view class="item-label">服务商品内容</view> |
| | | <input class="item-input" v-model="form.model.service_content" placeholder="请输入服务商品内容" /> |
| | | </view> |
| | | |
| | | <view class="form-item" v-if="(form.model.is_virtual === 1 || form.model.is_virtual === 3)&& form.model.virtual_auto === 0"> |
| | | <view class="item-label">支持线下核销</view> |
| | | <view class="radio-group"> |
| | | <view class="radio-item" :class="{ active: form.model.is_verify === 1 }" |
| | |
| | | </view> |
| | | |
| | | <view class="form-item" |
| | | v-if="form.model.is_virtual === 1 && form.model.virtual_auto === 0 && form.model.is_verify === 1"> |
| | | v-if="(form.model.is_virtual === 1 || form.model.is_virtual === 3) && form.model.virtual_auto === 0 && form.model.is_verify === 1"> |
| | | <view class="item-label">核销到期类型</view> |
| | | <view class="radio-group"> |
| | | <view class="radio-item" :class="{ active: form.model.verify_type === 10 }" |
| | |
| | | </view> |
| | | |
| | | <view class="form-item" |
| | | v-if="form.model.is_virtual === 1 && form.model.virtual_auto === 0 && form.model.is_verify === 1 && form.model.verify_type === 10"> |
| | | v-if="(form.model.is_virtual === 1 || form.model.is_virtual === 3) && form.model.virtual_auto === 0 && form.model.is_verify === 1 && form.model.verify_type === 10"> |
| | | <view class="item-label">核销有效天数</view> |
| | | <input class="item-input" v-model="form.model.verify_day" placeholder="请输入有效天数,0或留空表示永久有效" |
| | | type="number" /> |
| | | </view> |
| | | |
| | | <view class="form-item" |
| | | v-if="form.model.is_virtual === 1 && form.model.virtual_auto === 0 && form.model.is_verify === 1 && form.model.verify_type === 20"> |
| | | v-if="(form.model.is_virtual === 1 || form.model.is_virtual === 3) && form.model.virtual_auto === 0 && form.model.is_verify === 1 && form.model.verify_type === 20"> |
| | | <view class="item-label">核销有效时间</view> |
| | | <picker mode="daterange" class="item-picker" @change="verifyTimeChange" :value="verifyTimeArray"> |
| | | <view class="picker-text">{{ verifyTimeText || '请选择核销有效时间' }}</view> |
| | |
| | | spec_type: 10, |
| | | deduct_stock_type: 20, |
| | | is_picture: 0, |
| | | service_content: '', |
| | | sku: { |
| | | product_no: '', |
| | | product_price: '', |
| | |
| | | @click="form.model.is_virtual = 1">虚拟商品</view> |
| | | <view class="radio-item" :class="{ active: form.model.is_virtual === 2 }" |
| | | @click="form.model.is_virtual = 2">券商品</view> |
| | | <view class="radio-item" :class="{ active: form.model.is_virtual === 3 }" |
| | | @click="form.model.is_virtual = 3">服务商品</view> |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | </view> |
| | | |
| | | <!-- 虚拟商品设置 --> |
| | | <view class="form-item" v-if="form.model.is_virtual === 1"> |
| | | <view class="form-item" v-if="form.model.is_virtual === 1 || form.model.is_virtual === 3"> |
| | | <view class="item-label">发货类型</view> |
| | | <view class="radio-group"> |
| | | <view class="radio-item" :class="{ active: form.model.virtual_auto === 1 }" |
| | |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="form-item" v-if="form.model.is_virtual === 1"> |
| | | <view class="form-item" v-if="form.model.is_virtual === 1 "> |
| | | <view class="item-label">虚拟内容</view> |
| | | <input class="item-input" v-model="form.model.virtual_content" placeholder="请输入虚拟物品内容" /> |
| | | </view> |
| | | |
| | | <view class="form-item" v-if="form.model.is_virtual === 1 && form.model.virtual_auto === 0"> |
| | | <view class="form-item" v-if=" form.model.is_virtual === 3"> |
| | | <view class="item-label">服务商品内容</view> |
| | | <input class="item-input" v-model="form.model.service_content" placeholder="请输入服务商品内容" /> |
| | | </view> |
| | | |
| | | <view class="form-item" v-if="(form.model.is_virtual === 1 || form.model.is_virtual === 3) && form.model.virtual_auto === 0"> |
| | | <view class="item-label">支持线下核销</view> |
| | | <view class="radio-group"> |
| | | <view class="radio-item" :class="{ active: form.model.is_verify === 1 }" |
| | |
| | | </view> |
| | | |
| | | <view class="form-item" |
| | | v-if="form.model.is_virtual === 1 && form.model.virtual_auto === 0 && form.model.is_verify === 1"> |
| | | v-if="(form.model.is_virtual === 1 || form.model.is_virtual === 3) && form.model.virtual_auto === 0 && form.model.is_verify === 1"> |
| | | <view class="item-label">核销到期类型</view> |
| | | <view class="radio-group"> |
| | | <view class="radio-item" :class="{ active: form.model.verify_type === 10 }" |
| | |
| | | </view> |
| | | |
| | | <view class="form-item" |
| | | v-if="form.model.is_virtual === 1 && form.model.virtual_auto === 0 && form.model.is_verify === 1 && form.model.verify_type === 10"> |
| | | v-if="(form.model.is_virtual === 1 || form.model.is_virtual === 3) && form.model.virtual_auto === 0 && form.model.is_verify === 1 && form.model.verify_type === 10"> |
| | | <view class="item-label">核销有效天数</view> |
| | | <input class="item-input" v-model="form.model.verify_day" placeholder="请输入有效天数,0或留空表示永久有效" |
| | | type="number" /> |
| | | </view> |
| | | |
| | | <view class="form-item" |
| | | v-if="form.model.is_virtual === 1 && form.model.virtual_auto === 0 && form.model.is_verify === 1 && form.model.verify_type === 20"> |
| | | v-if="(form.model.is_virtual === 1 || form.model.is_virtual === 3) && form.model.virtual_auto === 0 && form.model.is_verify === 1 && form.model.verify_type === 20"> |
| | | <view class="item-label">核销有效时间</view> |
| | | <picker mode="daterange" class="item-picker" @change="verifyTimeChange" :value="verifyTimeArray"> |
| | | <view class="picker-text">{{ verifyTimeText || '请选择核销有效时间' }}</view> |
| | |
| | | deduction_price: 0, |
| | | virtual_auto: 0, |
| | | virtual_content: '', |
| | | service_content: '', |
| | | is_preview: 0, |
| | | preview_time: '', |
| | | is_verify: 0, |
| | |
| | | let lat=event.latLng.getLat(), |
| | | lng=event.latLng.getLng(); |
| | | let url = encodeURI("https://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lng + |
| | | "&key=KWPBZ-ANNW4-MZ5UU-KCKNC-YCTUO-ZSFO5&output=jsonp&&callback=?"); |
| | | "&key=SWSBZ-PY7EN-VXFFT-SUXJU-H5UY2-JFFJS&output&output=jsonp&&callback=?"); |
| | | getJson(url, 'QQmap', function(res) { |
| | | if (res.status == 0) { |
| | | self.$emit('chose', res.result); |
| | |
| | | return; |
| | | } |
| | | let url = encodeURI( |
| | | 'https://apis.map.qq.com/ws/place/v1/suggestion/?keyword=' + Value + '®ion=' + this.select_city + '&key=KWPBZ-ANNW4-MZ5UU-KCKNC-YCTUO-ZSFO5&output=jsonp&&callback=?' |
| | | 'https://apis.map.qq.com/ws/place/v1/suggestion/?keyword=' + Value + '®ion=' + this.select_city + '&key=SWSBZ-PY7EN-VXFFT-SUXJU-H5UY2-JFFJS&output=jsonp&&callback=?' |
| | | ); |
| | | |
| | | getJson(url, 'QQmap', function(res) { |
| | |
| | | value + |
| | | '&boundary=region(' + |
| | | query_city + |
| | | ',0)&page_size=9&page_index=1&key=KWPBZ-ANNW4-MZ5UU-KCKNC-YCTUO-ZSFO5&output=jsonp&&callback=?' |
| | | ',0)&page_size=9&page_index=1&key=SWSBZ-PY7EN-VXFFT-SUXJU-H5UY2-JFFJS&output=jsonp&&callback=?' |
| | | ); |
| | | |
| | | /*通过关键字搜索*/ |
| | |
| | | <span class="fb orange">{{ scope.row.orderMaster.pay_price }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="orderMaster.settlement_price" label="结算价" width="100"> |
| | | <template slot-scope="scope"> |
| | | <span class="fb orange">{{ scope.row.orderMaster.settlement_price }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="user.nickName" label="买家" width="100"></el-table-column> |
| | | <el-table-column prop="mobile" label="交易状态" width="130"> |
| | | <template slot-scope="scope"> |
| | |
| | | <p> 例:订单付款金额(100.00元) * 消费券赠送比例(100%) = 实际赠送的消费券(100消费券)</p> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="直推赠送消费券 " prop="gift_ratio" :rules="[{required: true,message: ' '}]"> |
| | | <el-input placeholder="请输入内容" v-model="form.give_away" class="max-w460"> |
| | | <template slot="append">消费券</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="生日消费赠送 " prop="birthday_ratio" :rules="[{required: true,message: ' '}]"> |
| | | <el-input placeholder="请输入内容" v-model="form.birthday_ratio" class="max-w460"> |
| | | <template slot="append">倍</template> |
| | |
| | | form: { |
| | | is_shopping_gift: 1, |
| | | gift_ratio: 10, |
| | | give_away: 10, |
| | | is_shopping_discount: 1, |
| | | discount: { |
| | | discount_ratio: 0, |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="充值消费券" name="third"> |
| | | <el-form size="small" :model="form"> |
| | | <el-form-item label="消费券" :label-width="formLabelWidth"> |
| | | <el-input v-model="form.consumer_coupon" autocomplete="off" disabled="disabled"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="充值方式" :label-width="formLabelWidth"> |
| | | <el-radio-group v-model="recharge.consumption.mode"> |
| | | <el-radio label="inc">增加</el-radio> |
| | | <el-radio label="dec">减少</el-radio> |
| | | <el-radio label="final">最终消费券</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="变跟数量" :label-width="formLabelWidth"> |
| | | <el-input v-model="recharge.consumption.value" autocomplete="off" placeholder="请输入变更数量"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="管理员备注" :label-width="formLabelWidth"> |
| | | <el-input type="textarea" v-model="recharge.consumption.remark" placeholder="请输入管理员备注"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | |
| | | |
| | |
| | | points: { |
| | | mode: 'inc', |
| | | remark: '', |
| | | }, |
| | | consumption: { |
| | | mode: 'inc', |
| | | remark: '', |
| | | } |
| | | }, |
| | | source: 0, |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="points" label="积分"></el-table-column> |
| | | <el-table-column prop="consumer_coupon" label="消费券"></el-table-column> |
| | | <el-table-column prop="balance" label="余额"></el-table-column> |
| | | <el-table-column prop="referee_name" label="推荐人"> |
| | | <template slot-scope="scope"> |
| | |
| | | let lat=event.latLng.getLat(), |
| | | lng=event.latLng.getLng(); |
| | | let url = encodeURI("https://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lng + |
| | | "&key=LS7BZ-NHSWK-CWOJQ-AJC7Y-H5HE2-UGBWR&output=jsonp&&callback=?"); |
| | | "&key=SWSBZ-PY7EN-VXFFT-SUXJU-H5UY2-JFFJS&output=jsonp&&callback=?"); |
| | | getJson(url, 'QQmap', function(res) { |
| | | if (res.status == 0) { |
| | | self.$emit('chose', res.result); |
| | |
| | | return; |
| | | } |
| | | let url = encodeURI( |
| | | 'https://apis.map.qq.com/ws/place/v1/suggestion/?keyword=' + Value + '®ion=' + this.select_city + '&key=LS7BZ-NHSWK-CWOJQ-AJC7Y-H5HE2-UGBWR&output=jsonp&&callback=?' |
| | | 'https://apis.map.qq.com/ws/place/v1/suggestion/?keyword=' + Value + '®ion=' + this.select_city + '&key=SWSBZ-PY7EN-VXFFT-SUXJU-H5UY2-JFFJS&output=jsonp&&callback=?' |
| | | ); |
| | | |
| | | getJson(url, 'QQmap', function(res) { |
| | |
| | | value + |
| | | '&boundary=region(' + |
| | | query_city + |
| | | ',0)&page_size=9&page_index=1&key=LS7BZ-NHSWK-CWOJQ-AJC7Y-H5HE2-UGBWR&output=jsonp&&callback=?' |
| | | ',0)&page_size=9&page_index=1&key=SWSBZ-PY7EN-VXFFT-SUXJU-H5UY2-JFFJS&output=jsonp&&callback=?' |
| | | ); |
| | | |
| | | /*通过关键字搜索*/ |
| | |
| | | <el-dialog title="超链接设置" :visible.sync="dialogVisible" @close="dialogFormVisible" :close-on-click-modal="false" :close-on-press-escape="false"> |
| | | <!--内容--> |
| | | <el-tabs type="border-card" v-model="activeName"> |
| | | <el-tab-pane label="页面" name="pages"> |
| | | <Pages v-if="activeName == 'pages'" @changeData="activeDataFunc"></Pages> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="产品" name="product"> |
| | | <Product v-if="activeName == 'product'" @changeData="activeDataFunc"></Product> |
| | | </el-tab-pane> |
| | |
| | | |
| | | <script> |
| | | import Product from './part/Product.vue'; |
| | | import Pages from './part/Pages.vue'; |
| | | export default { |
| | | components: { |
| | | Product |
| | | Product, |
| | | Pages |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | return { |
| | | /*页面数据*/ |
| | | pages: [ |
| | | { |
| | | /*{ |
| | | url: 'pages/index/index', |
| | | name: '首页', |
| | | type: '页面' |
| | | }, |
| | | },*/ |
| | | { |
| | | url: 'pages/product/category', |
| | | url: 'pages/shop/category', |
| | | name: '分类', |
| | | type: '页面' |
| | | }, |
| | | { |
| | | /*{ |
| | | url: 'pages/article/list/list', |
| | | name: '文章首页', |
| | | type: '页面', |
| | |
| | | url: 'pages/plus/vip/index', |
| | | name: 'VIP专区', |
| | | type: '页面', |
| | | } |
| | | }*/ |
| | | ], |
| | | /*选中的值*/ |
| | | activePage: '首页' |
| | | activePage: '分类' |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | --> |
| | | <div class="marketing-box"> |
| | | <el-tabs v-model="activeTab"> |
| | | <el-tab-pane label="分类" name="type"></el-tab-pane> |
| | | <el-tab-pane label="详情" name="detail"></el-tab-pane> |
| | | </el-tabs> |
| | | |
| | | <div class="product" v-if="activeTab == 'type'"> |
| | | <!--内容--> |
| | | <div class="product-content" v-loading="loading"> |
| | | <div class="table-wrap type-table"> |
| | | <el-cascader class="ww100" |
| | | ref="cascader" |
| | | v-model="categoryActive" |
| | | :options="categoryList" |
| | | :props="{ children: 'child', value: 'category_id', label: 'name' }" |
| | | @change="changeCategory"> |
| | | </el-cascader> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="product-list" v-if="activeTab == 'detail'" v-loading="loading"> |
| | | <!--搜索表单--> |
| | | <div class="common-seach-wrap"> |
| | |
| | | activeTab: function(n, o) { |
| | | if (n != o) { |
| | | this.tableData = []; |
| | | if (n == 'type') { |
| | | this.autoType(); |
| | | } |
| | | if (n == 'detail') { |
| | | this.getData(); |
| | | } |
| | |
| | | .then(data => { |
| | | self.loading = false; |
| | | self.tableData = data.data.list.data; |
| | | self.categoryList = data.data.category; |
| | | self.totalDataNumber = data.data.list.total; |
| | | if(self.curPage==1&&self.tableData.length>0){ |
| | | self.changeFunc(self.tableData[0]); |
| | |
| | | /*选中的值*/ |
| | | changeFunc(e) { |
| | | let obj={}; |
| | | if (this.activeTab == 'type') { |
| | | obj.name = e.name; |
| | | obj.url = 'pages/product/list/list?category_id=' + e.category_id; |
| | | obj.type = '商品分类'; |
| | | } |
| | | if (this.activeTab == 'detail') { |
| | | obj.name = e.product_name; |
| | | obj.url = 'pages/product/detail/detail?product_id=' + e.product_id; |
| | |
| | | } |
| | | |
| | | this.$emit('changeData', obj); |
| | | } |
| | | }, |
| | | /*自动选择类别*/ |
| | | autoType(i){ |
| | | i=i|0; |
| | | this.categoryActive=[]; |
| | | if(this.categoryList.length>0){ |
| | | let item=this.categoryList[i]; |
| | | this.categoryActive.push(item.category_id); |
| | | if(item.child&&typeof item.child!='undefined'&&item.child.length>0){ |
| | | this.categoryActive.push(item.child[0].category_id); |
| | | this.changeFunc(item.child[0]); |
| | | }else{ |
| | | i++; |
| | | this.autoType(i); |
| | | } |
| | | } |
| | | }, |
| | | /*选择类别*/ |
| | | changeCategory(e){ |
| | | let item= this.$refs['cascader'].getCheckedNodes(); |
| | | this.changeFunc(item[0].data); |
| | | }, |
| | | |
| | | |
| | | } |
| | |
| | | <span class="fb orange">{{ scope.row.orderMaster.pay_price }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="orderMaster.settlement_price" label="结算价" width="100"> |
| | | <template slot-scope="scope"> |
| | | <span class="fb orange">{{ scope.row.orderMaster.settlement_price }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="user.nickName" label="买家" width="100"></el-table-column> |
| | | <el-table-column prop="mobile" label="交易状态" width="130"> |
| | | <template slot-scope="scope"> |
| New file |
| | |
| | | <template> |
| | | <!-- |
| | | 作者:wangxw |
| | | 时间:2019-10-26 |
| | | 描述:产品分类-添加 |
| | | --> |
| | | <el-dialog title="添加分类" :visible.sync="dialogVisible" @close="dialogFormVisible" :close-on-click-modal="false" |
| | | :close-on-press-escape="false"> |
| | | <el-form size="small" :model="form" :rules="formRules" ref="form"> |
| | | <el-form-item label="所属分类" :label-width="formLabelWidth"> |
| | | <el-select v-model="form.parent_id"> |
| | | <el-option label="顶级分类" value="0"></el-option> |
| | | <el-option :value="cat.category_id" :label="cat.name" :key="cat.category_id" v-for="cat in addform.catList"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="分类名称" prop="name" :label-width="formLabelWidth"> |
| | | <el-input v-model="form.name" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="分类图片" prop="image_id" :label-width="formLabelWidth"> |
| | | <el-row> |
| | | <el-button type="primary" @click="openUpload">选择图片</el-button> |
| | | <div v-if="form.image_id!=''" class="img"> |
| | | <img :src="file_path" width="100" height="100" /> |
| | | </div> |
| | | </el-row> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="分类排序" prop="sort" :label-width="formLabelWidth"> |
| | | <el-input v-model.number="form.sort" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible">取 消</el-button> |
| | | <el-button type="primary" @click="addUser" :loading="loading">确 定</el-button> |
| | | </div> |
| | | <!--上传图片组件--> |
| | | <Upload v-if="isupload" :isupload="isupload" :type="type" @returnImgs="returnImgsFunc">上传图片</Upload> |
| | | </el-dialog> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | import PorductApi from '@/api/product.js'; |
| | | import Upload from '@/components/file/Upload'; |
| | | export default { |
| | | components: { |
| | | Upload |
| | | }, |
| | | data() { |
| | | return { |
| | | form: { |
| | | parent_id: '0', |
| | | name: '', |
| | | sort: 100, |
| | | image_id: '' |
| | | }, |
| | | formRules: { |
| | | name: [{ |
| | | required: true, |
| | | message: '请输入分类名称', |
| | | trigger: 'blur' |
| | | }], |
| | | image_id: [{ |
| | | required: true, |
| | | message: '请上传分类图片', |
| | | trigger: 'blur' |
| | | }], |
| | | sort: [{ |
| | | required: true, |
| | | message: '分类排序不能为空' |
| | | }, { |
| | | type: 'number', |
| | | message: '分类排序必须为数字' |
| | | }] |
| | | }, |
| | | /*左边长度*/ |
| | | formLabelWidth: '120px', |
| | | /*是否显示*/ |
| | | dialogVisible: false, |
| | | loading: false, |
| | | /*是否上传图片*/ |
| | | isupload: false, |
| | | }; |
| | | }, |
| | | props: ['open_add', 'addform'], |
| | | created() { |
| | | this.dialogVisible = this.open_add; |
| | | }, |
| | | methods: { |
| | | /*添加用户*/ |
| | | addUser() { |
| | | let self = this; |
| | | let params = self.form; |
| | | self.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | self.loading = true; |
| | | PorductApi.catAdd(params).then(data => { |
| | | self.loading = false; |
| | | self.$message({ |
| | | message: '添加成功', |
| | | type: 'success' |
| | | }); |
| | | self.dialogFormVisible(true); |
| | | }).catch(error => { |
| | | self.loading = false; |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | /*关闭弹窗*/ |
| | | dialogFormVisible(e) { |
| | | if (e) { |
| | | this.$emit('closeDialog', { |
| | | type: 'success', |
| | | openDialog: false |
| | | }) |
| | | } else { |
| | | this.$emit('closeDialog', { |
| | | type: 'error', |
| | | openDialog: false |
| | | }) |
| | | } |
| | | }, |
| | | /*上传*/ |
| | | openUpload(e) { |
| | | this.type = e; |
| | | this.isupload = true; |
| | | }, |
| | | /*获取图片*/ |
| | | returnImgsFunc(e) { |
| | | if (e != null && e.length > 0) { |
| | | this.file_path = e[0].file_path; |
| | | this.form.image_id = e[0].file_id; |
| | | } |
| | | this.isupload = false; |
| | | }, |
| | | |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | .img { |
| | | margin-top: 10px; |
| | | } |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <!-- |
| | | 作者:wangxw |
| | | 时间:2019-10-26 |
| | | 描述:产品分类-修改 |
| | | --> |
| | | <el-dialog title="修改分类" :visible.sync="dialogVisible" @close="dialogFormVisible" :close-on-click-modal="false" |
| | | :close-on-press-escape="false"> |
| | | <el-form size="small" :model="form" :rules="formRules" ref="form"> |
| | | <el-form-item label="所属分类" :label-width="formLabelWidth"> |
| | | <el-select v-model="form.parent_id"> |
| | | <el-option label="顶级分类" :value="0"></el-option> |
| | | <el-option :value="cat.category_id" :label="cat.name" :key="cat.category_id" v-for="cat in editform.catList"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="分类名称" prop="name" :label-width="formLabelWidth"> |
| | | <el-input v-model="form.name" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="分类图片" prop="image_id" :label-width="formLabelWidth"> |
| | | <el-row> |
| | | <el-button type="primary" @click="openUpload">选择图片</el-button> |
| | | <div v-if="form.image_id!=''" class="img"> |
| | | <img :src="file_path" width="100" height="100" /> |
| | | </div> |
| | | </el-row> |
| | | </el-form-item> |
| | | <el-form-item label="分类排序" prop="sort" :label-width="formLabelWidth"> |
| | | <el-input v-model.number="form.sort" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible">取 消</el-button> |
| | | <el-button type="primary" @click="addUser" :loading="loading">确 定</el-button> |
| | | </div> |
| | | <!--上传图片组件--> |
| | | <Upload v-if="isupload" :isupload="isupload" :type="type" @returnImgs="returnImgsFunc">上传图片</Upload> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import PorductApi from '@/api/product.js'; |
| | | import Upload from '@/components/file/Upload'; |
| | | export default { |
| | | components: { |
| | | Upload |
| | | }, |
| | | data() { |
| | | return { |
| | | form: { |
| | | category_id: 0, |
| | | parent_id: 0, |
| | | name: '', |
| | | image_id: '', |
| | | sort: '' |
| | | }, |
| | | file_path: '', |
| | | formRules: { |
| | | name: [{ |
| | | required: true, |
| | | message: '请输入分类名称', |
| | | trigger: 'blur' |
| | | }], |
| | | image_id: [{ |
| | | required: true, |
| | | message: '请上传分类图片', |
| | | trigger: 'blur' |
| | | }], |
| | | sort: [{ |
| | | required: true, |
| | | message: '分类排序不能为空' |
| | | }, { |
| | | type: 'number', |
| | | message: '分类排序必须为数字' |
| | | }] |
| | | }, |
| | | /*左边长度*/ |
| | | formLabelWidth: '120px', |
| | | /*是否显示*/ |
| | | dialogVisible: false, |
| | | loading: false, |
| | | /*是否上传图片*/ |
| | | isupload: false, |
| | | }; |
| | | }, |
| | | props: ['open_edit', 'editform'], |
| | | created() { |
| | | this.dialogVisible = this.open_edit; |
| | | console.log(this.editform.model); |
| | | this.form.category_id = this.editform.model.category_id; |
| | | this.form.parent_id = this.editform.model.parent_id; |
| | | this.form.name = this.editform.model.name; |
| | | this.form.sort = this.editform.model.sort; |
| | | this.form.image_id = this.editform.model.image_id; |
| | | this.file_path = this.editform.model.images.file_path; |
| | | }, |
| | | methods: { |
| | | /*修改用户*/ |
| | | addUser() { |
| | | let self = this; |
| | | let params = self.form; |
| | | self.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | self.loading = true; |
| | | PorductApi.catEdit(params, true).then(data => { |
| | | self.loading = false; |
| | | self.$message({ |
| | | message: '修改成功', |
| | | type: 'success' |
| | | }); |
| | | self.dialogFormVisible(true); |
| | | }).catch(error => { |
| | | self.loading = false; |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | /*关闭弹窗*/ |
| | | dialogFormVisible(e) { |
| | | if (e) { |
| | | this.$emit('closeDialog', { |
| | | type: 'success', |
| | | openDialog: false |
| | | }) |
| | | } else { |
| | | this.$emit('closeDialog', { |
| | | type: 'error', |
| | | openDialog: false |
| | | }) |
| | | } |
| | | }, |
| | | /*上传*/ |
| | | openUpload(e) { |
| | | this.type = e; |
| | | this.isupload = true; |
| | | }, |
| | | /*获取图片*/ |
| | | returnImgsFunc(e) { |
| | | if (e != null && e.length > 0) { |
| | | this.file_path = e[0].file_path; |
| | | this.form.image_id = e[0].file_id; |
| | | } |
| | | this.isupload = false; |
| | | }, |
| | | |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | .img { |
| | | margin-top: 10px; |
| | | } |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <!-- |
| | | 作者:wangxw |
| | | 时间:2019-10-26 |
| | | 描述:产品分类管理 |
| | | --> |
| | | <div class="product"> |
| | | |
| | | <!--添加产品分类--> |
| | | <div class="common-level-rail"> |
| | | <el-button size="small" type="primary" @click="addClick" icon="el-icon-plus" v-auth="'/product/category/add'">添加分类</el-button> |
| | | </div> |
| | | |
| | | <!--内容--> |
| | | <div class="product-content"> |
| | | <div class="table-wrap"> |
| | | <el-table size="small" :data="tableData" row-key="category_id" default-expand-all :tree-props="{children: 'child'}" |
| | | style="width: 100%" v-loading="loading"> |
| | | <el-table-column prop="name" label="分类名称" width="180"></el-table-column> |
| | | <el-table-column prop="" label="图片" width="180"> |
| | | <template slot-scope="scope"> |
| | | <img v-img-url="hasImages(scope.row.images)" alt="" width="50px" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="sort" label="分类排序"></el-table-column> |
| | | <el-table-column prop="create_time" label="添加时间"></el-table-column> |
| | | <el-table-column prop="status" label="状态"> |
| | | <template slot-scope="scope"> |
| | | <el-checkbox v-model="scope.row.status" :checked="scope.row.status" @change="checked => statusChange(checked,scope.row)">启用</el-checkbox> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="操作" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-button @click="editClick(scope.row)" type="text" size="small" v-auth="'/product/category/edit'">编辑</el-button> |
| | | <el-button @click="deleteClick(scope.row)" type="text" size="small" v-auth="'/product/category/delete'">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | |
| | | <!--添加--> |
| | | <Add v-if="open_add" :open_add="open_add" :addform="categoryModel" @closeDialog="closeDialogFunc($event, 'add')"></Add> |
| | | <!--修改--> |
| | | <Edit v-if="open_edit" :open_edit="open_edit" :editform="categoryModel" @closeDialog="closeDialogFunc($event, 'edit')"></Edit> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import PorductApi from '@/api/product.js'; |
| | | import Add from './Add.vue'; |
| | | import Edit from './Edit.vue'; |
| | | export default { |
| | | components: { |
| | | Add, |
| | | Edit |
| | | }, |
| | | data() { |
| | | return { |
| | | /*是否加载完成*/ |
| | | loading: true, |
| | | /*列表数据*/ |
| | | tableData: [], |
| | | /*是否打开添加弹窗*/ |
| | | open_add: false, |
| | | /*是否打开编辑弹窗*/ |
| | | open_edit: false, |
| | | /*当前编辑的对象*/ |
| | | categoryModel: { |
| | | catList: [], |
| | | model: {} |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | /*获取列表*/ |
| | | this.getData(); |
| | | }, |
| | | methods: { |
| | | |
| | | hasImages(e) { |
| | | if (e) { |
| | | return e.file_path; |
| | | } else { |
| | | return ''; |
| | | } |
| | | }, |
| | | |
| | | /*获取列表*/ |
| | | getData() { |
| | | let self = this; |
| | | PorductApi.catList({}, true) |
| | | .then(data => { |
| | | self.loading = false; |
| | | self.tableData = data.data.list; |
| | | self.categoryModel.catList = self.tableData; |
| | | }) |
| | | .catch(error => { |
| | | self.loading = false; |
| | | }); |
| | | }, |
| | | /*打开添加*/ |
| | | addClick() { |
| | | this.open_add = true; |
| | | }, |
| | | |
| | | /*打开编辑*/ |
| | | editClick(item) { |
| | | this.categoryModel.model = item; |
| | | this.open_edit = true; |
| | | }, |
| | | |
| | | /*关闭弹窗*/ |
| | | closeDialogFunc(e, f) { |
| | | if (f == 'add') { |
| | | this.open_add = e.openDialog; |
| | | if (e.type == 'success') { |
| | | this.getData(); |
| | | } |
| | | } |
| | | if (f == 'edit') { |
| | | this.open_edit = e.openDialog; |
| | | if (e.type == 'success') { |
| | | this.getData(); |
| | | } |
| | | } |
| | | }, |
| | | /*删除分类*/ |
| | | deleteClick(row) { |
| | | let self = this; |
| | | self.$confirm('删除后不可恢复,确认删除该记录吗?', '提示', { |
| | | type: 'warning' |
| | | }).then(() => { |
| | | PorductApi.catDel({ |
| | | category_id: row.category_id |
| | | }).then(data => { |
| | | self.$message({ |
| | | message: '删除成功', |
| | | type: 'success' |
| | | }); |
| | | self.getData(); |
| | | }); |
| | | }); |
| | | }, |
| | | /*启用*/ |
| | | statusChange: function(checked,row) { |
| | | let self = this; |
| | | // if(row.child.length>0){ |
| | | // self.$message({ |
| | | // message: '其分类下有下级分类,不能修改状态', |
| | | // type: 'error' |
| | | // }); |
| | | // row.status = !checked; |
| | | // return; |
| | | // } |
| | | let status=checked?1:0; |
| | | self.loading = true; |
| | | let params={ |
| | | category_id: row.category_id, |
| | | parent_id:row.parent_id, |
| | | status:status |
| | | }; |
| | | PorductApi.catEdit( |
| | | params, |
| | | true |
| | | ) |
| | | .then(data => { |
| | | self.loading = false; |
| | | row.status = checked; |
| | | }) |
| | | .catch(error => { |
| | | self.loading = false; |
| | | row.status = checked?0:1; |
| | | }); |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| | |
| | | <el-form-item label="联系地址" :rules="[{required: true,message: '请输入联系地址'}]"> |
| | | <el-input v-model="formData.address" placeholder="请输入联系地址" class="max-w460"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="坐标"> |
| | | <el-row class="mb16"> |
| | | <el-col :span="24"> |
| | | <el-input v-model="form.supplier.coordinate" class="max-w460"></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row class="mb16"> |
| | | <el-col :span="24"> |
| | | <Getpoint :form="form.supplier" @getMapdata="getMapdataFunc" @chose="choseFunc"></Getpoint> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="商家介绍" :rules="[{required: true,message: '请输入商家介绍'}]"> |
| | | <el-input type="textarea" v-model="formData.description" placeholder="请输入商家介绍" class="max-w460"></el-input> |
| | |
| | | |
| | | import SettingApi from '@/api/setting.js'; |
| | | import Upload from '@/components/file/Upload'; |
| | | import Getpoint from '@/components/map/Getpoint.vue'; |
| | | export default{ |
| | | components:{ |
| | | Getpoint, |
| | | Upload |
| | | }, |
| | | data(){ |
| | |
| | | this.getParams(); |
| | | }, |
| | | methods:{ |
| | | /*初始化城市id*/ |
| | | initCity() { |
| | | this.form.supplier.city_id = '' |
| | | }, |
| | | |
| | | /*初始化区id*/ |
| | | initRegion() { |
| | | this.form.supplier.region_id = '' |
| | | }, |
| | | |
| | | /*获取经纬度*/ |
| | | getMapdataFunc(e) { |
| | | this.form.supplier.coordinate = e.data[0].toFixed(6) + ',' + e.data[1].toFixed(6); |
| | | }, |
| | | /*选择的地址*/ |
| | | choseFunc(e){ |
| | | this.form.supplier.coordinate=e.location.lat+','+e.location.lng; |
| | | this.form.supplier.address=e.address; |
| | | |
| | | }, |
| | | |
| | | /*获取配置数据*/ |
| | | getParams() { |