| | |
| | | $points = SettingModel::getItem('points'); |
| | | $detail['points_ratio'] = $points['discount']['discount_ratio']; // 积分抵扣比例 |
| | | // 获取报名用户列表 |
| | | $userList = (new ActivityUserModel())->getListForActivity(['activity_id' => $activity_id], false, 8); |
| | | $userList = (new ActivityUserModel())->getListForActivity(['activity_id' => $activity_id], false, 7); |
| | | return $this->renderSuccess('', compact('detail', 'userList')); |
| | | } |
| | | |
| | |
| | | if ($product['is_newcomer'] == 1) { |
| | | return $this->renderError('新人专区商品不能加入购物车'); |
| | | } |
| | | 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\api\controller\Controller; |
| | | use app\api\model\supplier\DepositOrder as DepositOrderModel; |
| | | use app\api\model\supplier\DepositRefund as DepositRefundModel; |
| | | use app\api\model\supplier\member\Order as MemberOrderModel; |
| | | use app\api\model\supplier\member\Plan as MemberPlanModel; |
| | | use app\api\model\supplier\Supplier as SupplierModel; |
| | | use app\api\model\plus\coupon\Coupon as CouponModel; |
| | | use app\api\model\page\Ad as AdModel; |
| | | use app\api\model\order\Order as OrderModel; |
| | | use app\api\model\user\Visit as VisitModel; |
| | | use app\common\service\statistics\OrderService; |
| | | use app\common\service\supplier\MemberService; |
| | | use app\supplier\service\statistics\UserService; |
| | | use app\supplier\model\order\OrderSettled as OrderSettledModel; |
| | | use app\api\model\settings\Setting as SettingModel; |
| | |
| | | } |
| | | $params = $this->request->param(); |
| | | |
| | | $plans = (new MemberPlanModel())->detail($params['plan_id']); |
| | | $result=['data'=>['order_id'=>0]]; |
| | | if ($plans['price'] > 0){ |
| | | $memberService = new MemberService(); |
| | | $result = $memberService->createOrder($supplier['shop_supplier_id'], $params['plan_id'], $user); |
| | | if (!$result['status']){ |
| | | return $this->renderError($result['msg'] ?: '创建订单失败'); |
| | | } |
| | | } |
| | | // 生成订单 |
| | | $model = new DepositOrderModel; |
| | | $order_id = $model->createOrder($user, $supplier); |
| | | $order_id = $model->createOrder($user, $supplier,$result); |
| | | |
| | | if (!$order_id) { |
| | | return $this->renderError($model->getError() ?: '创建订单失败'); |
| | | } |
| | |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\supplier\member\Plan as MemberPlanModel; |
| | | use app\api\service\order\paysuccess\type\SupplierMemberPaySuccessService; |
| | | use app\common\enum\user\balanceLog\BalanceLogSceneEnum; |
| | | use app\common\model\app\App as AppModel; |
| | | use app\common\model\supplier\Supplier as SupplierModel; |
| | |
| | | public function plans() |
| | | { |
| | | $plans = (new MemberPlanModel())->getEnabledPlans(); |
| | | return $this->renderSuccess('',compact('plans')); |
| | | } |
| | | /** |
| | | * 获取年卡套餐列表(包含默认年卡) |
| | | */ |
| | | public function plansAll() |
| | | { |
| | | $plans = (new MemberPlanModel())->getEnabledPlansAll(); |
| | | return $this->renderSuccess('',compact('plans')); |
| | | } |
| | | |
| | |
| | | if ($user['balance'] < $order['price']) { |
| | | return $this->renderError('余额不足'); |
| | | } |
| | | // 扣除余额并激活会员 |
| | | $user->where('user_id', '=', $user['user_id']) |
| | | ->dec('balance', $order['price']) |
| | | ->update(); |
| | | BalanceLogModel::add(BalanceLogSceneEnum::CONSUME, [ |
| | | 'user_id' => $user['user_id'], |
| | | 'money' => -$order['price'], |
| | | ], ['order_no' => $order['order_no']]); |
| | | //$user->setDecBalance($order['price'], '购买年卡'); |
| | | |
| | | $SupplierMemberPaySuccessService = new SupplierMemberPaySuccessService($order['order_no']); |
| | | $SupplierMemberPaySuccessService->onPaySuccess(10, []); |
| | | $memberService = new MemberService(); |
| | | $memberService->activateMember($param['order_id']); |
| | | return $this->renderSuccess('支付成功', [ |
| | |
| | | { |
| | | $list=$this->where('user_id', '=', $user_id) |
| | | ->order('create_time', 'desc')->find(); |
| | | $data=[]; |
| | | $data=[ |
| | | 'province_id'=>'', |
| | | 'city_id'=>'', |
| | | 'region_id'=>'', |
| | | 'recommend_name'=>'', |
| | | 'recommend_mobile'=>'', |
| | | 'real_name'=>'', |
| | | 'mobile'=>'', |
| | | 'branch_id'=>'', |
| | | 'company'=>'', |
| | | 'branch_name'=>'', |
| | | 'region'=>'', |
| | | ]; |
| | | if ($list){ |
| | | $branch=(new Branch())->detail($list['branch_id']); |
| | | $data=[ |
| | |
| | | $data[] = [ |
| | | 'product_id' => $product['product_id'], |
| | | 'product_name' => $product['product_name'], |
| | | 'cart' => $product['cart'], |
| | | 'product_sku' => $product['product_sku'], |
| | | 'selling_point' => $product['selling_point'], |
| | | 'image' => $product['image'][0]['file_path'], |
| | | 'product_image' => $product['image'][0]['file_path'], |
| | |
| | | if (empty($config['become__buy_product_ids'])) { |
| | | return false; |
| | | } |
| | | // 整理商品id集 |
| | | /*// 整理商品id集 |
| | | $productIds = helper::getArrayColumn($order['product'], 'product_id'); |
| | | // 判断商品是否在设置范围内 |
| | | $intersect = array_intersect($productIds, $config['become__buy_product_ids']); |
| | | if (empty($intersect)) { |
| | | return false; |
| | | } |
| | | |
| | | }*/ |
| | | // 每买一个指定商品就生成一个分红订单 |
| | | foreach ($order['product'] as $product) { |
| | | // 检查商品是否是指定的分红商品 |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])) { |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])||$product['is_vip']==1) { |
| | | // 获取商品数量 |
| | | $quantity = $product['total_num']; |
| | | // 为每个商品生成分红订单 |
| | |
| | | /** |
| | | * 创建订单 |
| | | */ |
| | | public function createOrder($user, $supplier) |
| | | public function createOrder($user, $supplier,$result) |
| | | { |
| | | if($supplier['status'] != 20){ |
| | | $this->error = '您已支付保证金'; |
| | |
| | | 'user_id' => $user['user_id'], |
| | | 'pay_source' => 'wx', |
| | | 'pay_price' => $price, |
| | | 'deposit_price' => $price, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | if ($result['data']['order_id'] > 0){ |
| | | $data['member_order_id'] = $result['data']['order_id']; |
| | | $data['pay_price']=bcadd($price,$result['data']['price'],2); |
| | | $data['member_price']=$result['data']['price']; |
| | | } |
| | | $this->save($data); |
| | | } |
| | | return $this['order_id']; |
| | |
| | | private function getProductListWeight($productList, $orderTotalPrice) |
| | | { |
| | | foreach ($productList as &$product) { |
| | | $product['weight'] = $product[$this->price_column] / $orderTotalPrice; |
| | | $product['weight'] = bcdiv($product[$this->price_column], $orderTotalPrice, 6); |
| | | } |
| | | return $this->arraySortByWeight($productList); |
| | | } |
| | |
| | | use app\api\model\supplier\DepositOrder as DepositOrderModel; |
| | | use app\common\enum\order\OrderPayTypeEnum; |
| | | use app\common\enum\user\balanceLog\BalanceLogSceneEnum; |
| | | use app\common\model\supplier\member\Order as MemberOrderModel; |
| | | use app\common\model\user\BalanceLog as BalanceLogModel; |
| | | use app\common\service\BaseService; |
| | | use app\common\model\supplier\User as SupplierUserModel; |
| | |
| | | //更新 |
| | | $supplier->save([ |
| | | 'status' => 0, |
| | | 'deposit_money' => $this->model['pay_price'] |
| | | 'deposit_money' => $this->model['deposit_price'] |
| | | ]); |
| | | } |
| | | } |
| | |
| | | if ($payType == OrderPayTypeEnum::WECHAT) { |
| | | $order['transaction_id'] = $payData['transaction_id']; |
| | | } |
| | | if ($this->model['member_order_id'] > 0){ |
| | | $MemberOrder=MemberOrderModel::detail($this->model['member_order_id']); |
| | | $SupplierMemberPaySuccessService = new SupplierMemberPaySuccessService($MemberOrder['order_no']); |
| | | $SupplierMemberPaySuccessService->onPaySuccess($payType, $payData); |
| | | } |
| | | // 更新订单状态 |
| | | return $this->model->save($order); |
| | | } |
| | |
| | | if ($this->model['balance'] > 0) { |
| | | // 更新用户余额 |
| | | (new UserModel())->where('user_id', '=', $this->user['user_id']) |
| | | ->dec('balance', $this->model['balance']) |
| | | ->dec('balance', $this->model['deposit_price']) |
| | | ->update(); |
| | | // 余额日志 |
| | | BalanceLogModel::add(BalanceLogSceneEnum::CONSUME, [ |
| | | 'user_id' => $this->user['user_id'], |
| | | 'money' => -$this->model['balance'], |
| | | 'money' => -$this->model['deposit_price'], |
| | | ], ['描述' => '支付开店押金']); |
| | | } |
| | | } |
| | |
| | | |
| | | namespace app\api\service\order\paysuccess\type; |
| | | |
| | | use app\api\model\user\User as UserModel; |
| | | use app\common\enum\order\OrderPayTypeEnum; |
| | | use app\common\enum\user\balanceLog\BalanceLogSceneEnum; |
| | | use app\common\model\user\BalanceLog as BalanceLogModel; |
| | | use app\common\service\BaseService; |
| | | use app\common\model\supplier\member\Order as MemberOrderModel; |
| | | use app\common\service\supplier\MemberService; |
| | |
| | | { |
| | | // 订单模型 |
| | | public $model; |
| | | // 当前用户信息 |
| | | private $user; |
| | | |
| | | /** |
| | | * 构造函数 |
| | |
| | | { |
| | | // 实例化订单模型 |
| | | $this->model = MemberOrderModel::getPayDetail($orderNo); |
| | | // 获取用户信息 |
| | | $this->user = UserModel::detail($this->model['user_id']); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!$status) { |
| | | return false; |
| | | } |
| | | |
| | | // 激活年卡 |
| | | $memberService = new MemberService(); |
| | | $result = $memberService->activateMember($this->model['order_id']); |
| | | |
| | | if (!$result) { |
| | | $this->error = '激活年卡失败'; |
| | | return false; |
| | |
| | | 'pay_type' => $payType, |
| | | 'pay_time' => time(), |
| | | ]; |
| | | |
| | | // 余额支付 |
| | | if ($this->model['price'] > 0) { |
| | | // 更新用户余额 |
| | | (new UserModel())->where('user_id', '=', $this->user['user_id']) |
| | | ->dec('balance', $this->model['price']) |
| | | ->update(); |
| | | // 余额日志 |
| | | BalanceLogModel::add(BalanceLogSceneEnum::CONSUME, [ |
| | | 'user_id' => $this->user['user_id'], |
| | | 'money' => -$this->model['price'], |
| | | ], ['描述' => '支付年卡']); |
| | | } |
| | | if ($payType == OrderPayTypeEnum::WECHAT || $payType == OrderPayTypeEnum::ALIPAY) { |
| | | $order['transaction_id'] = $payData['transaction_id']; |
| | | } |
| | |
| | | // 团队分红添加队长 by lyzflash |
| | | $model = new TeamApplyModel; |
| | | $model->becomeTeamByAgent($agent_id, 40, $app_id); |
| | | $model->becomeTeamByAgent($user_id, 70,$app_id); |
| | | |
| | | return true; |
| | | } |
| | |
| | | ], $data)); |
| | | $user=(new \app\common\model\user\User())->find($user_id); |
| | | if ($user){ |
| | | $user_ids=(new ActivityUserModel)->where(['recommend_name'=>$user['real_name'],'recommend_mobile'=>$user['mobile']])->column('user_id'); |
| | | if ($user_ids){ |
| | | foreach ($user_id as $value) |
| | | { |
| | | (new \app\common\model\user\User())->where(['user_id'=>$value])->update(['referee_id'=>$user_id]) |
| | | (new refereeModel())->createRelation($value,$user_id); |
| | | if($user['real_name']!=''&&$user['mobile']!=''){ |
| | | $user_ids=(new ActivityUserModel)->where(['recommend_name'=>$user['real_name'],'recommend_mobile'=>$user['mobile']])->column('user_id'); |
| | | if ($user_ids){ |
| | | foreach ($user_ids as $value) |
| | | { |
| | | (new \app\common\model\user\User())->where(['user_id'=>$value])->update(['referee_id'=>$user_id]) |
| | | (new refereeModel())->createRelation($value,$user_id); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | event('AgentUserGrade', $model['referee_id']); |
| | | return true; |
| | |
| | | // 团队分红添加队长 by yj |
| | | $teamModel = new TeamApplyModel; |
| | | $teamModel->becomeTeamByAgent($user_id, 50, $model['app_id']); |
| | | $teamModel->becomeTeamByAgent($user_id, 70, $model['app_id']); |
| | | // 股东分红添加股东 by yj |
| | | $shareholdModel = new ShareholderApplyModel; |
| | | $shareholdModel->becomeShareholderByAgent($user_id, 50, $model['app_id']); |
| | |
| | | if (empty($config['become__buy_product_ids'])) { |
| | | return false; |
| | | } |
| | | // 判断商品是否在设置范围内 |
| | | $intersect = array_intersect($productIds, $config['become__buy_product_ids']); |
| | | if (empty($intersect)) { |
| | | return false; |
| | | } |
| | | $purchase_count=0; |
| | | // 每买一个指定商品就生成一个分红订单 |
| | | foreach ($order['product'] as $product) { |
| | | // 检查商品是否是指定的分红商品 |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])) { |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])||$product['is_vip']==1) { |
| | | // 获取商品数量 |
| | | $quantity = $product['total_num']; |
| | | $purchase_count+=$quantity; |
| | |
| | | } |
| | | } |
| | | } |
| | | // 判断商品是否在设置范围内 |
| | | $intersect = array_intersect($productIds, $config['become__buy_product_ids']); |
| | | if ($purchase_count<=0) { |
| | | return false; |
| | | } |
| | | if(User::isBonusUser($userId)) { |
| | | return false; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | $purchase_count=self::getUserOrderCount($order['user_id']); |
| | | /*$user=User::detail($order['user_id']); |
| | | $user=User::detail($order['user_id']); |
| | | if ($user['purchase_count']<=$purchase_count&&$user['purchase_count']!=11){ |
| | | return false; |
| | | }*/ |
| | | } |
| | | // 检查商品是否设置独立分红 |
| | | $one_money = $setting['one_money']; |
| | | $two_money = $setting['two_money']; |
| | |
| | | <?php
namespace app\common\model\plus\team;
use app\common\model\BaseModel;
use app\common\model\plus\agent\User as AgentUserModel;
/**
* 队长申请模型
*/
class Apply extends BaseModel
{
protected $name = 'team_apply';
protected $pk = 'apply_id';
/**
* 申请状态
* @var array
*/
public $applyStatus = [
10 => '待审核',
20 => '审核通过',
30 => '驳回',
];
/**
* 申请时间
* @param $value
* @return false|string
*/
public function getApplyTimeAttr($value)
{
return date('Y-m-d H:i:s', $value);
}
/**
* 审核时间
* @param $value
* @return false|int|string
*/
public function getAuditTimeAttr($value)
{
return $value > 0 ? date('Y-m-d H:i:s', $value) : 0;
}
/**
* 关联推荐人表
* @return \think\model\relation\BelongsTo
*/
public function referee()
{
return $this->belongsTo('app\common\model\user\User', 'referee_id')
->field(['user_id', 'nickName']);
}
/**
* 销商申请记录详情
* @param $where
* @return array|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function detail($where)
{
$filter = is_array($where) ? $where : ['apply_id' => $where];
return (new static())->where($filter)->find();
}
/**
* 根据分销判断成为队长
* @param $userId
* @param $appId
* @return bool
*/
public function becomeTeamByAgent($userId, $become_type, $appId)
{
//log_write($become_type);
// 验证是否设置
$config = Setting::getItem('basic', $appId);
if (empty($config['is_open'])) {
return false;
}
if ($config['become'] != $become_type) {
return false;
}
$agent = AgentUserModel::detail($userId);
if (!$agent) {
return false;
}
$becomeTeam = false;
//分销商总数
if ($become_type == '40') {
$agent_total = $agent['first_num'] + $agent['second_num'] + $agent['third_num'];
if ($agent_total >= $config['totalfxs_down']) {
$becomeTeam = true;
}
}
//分销佣金总数
if ($become_type == '50') {
$agent_money = $agent['total_money'] + $agent['money'] + $agent['freeze_money'];
if ($agent_money >= $config['total_money']) {
$becomeTeam = true;
}
}
if($become_type == '70'){
$vipNum=(new \app\common\model\user\User)->getRefereeGradeCount([$userId],$config['referee_grade_ids']);
$supplierNum=(new \app\common\model\supplier\User)->getSubordinateNum([$userId]);
$user=(new \app\common\model\user\User)->where(['user_id'=>$userId,'is_delete'=>0])->find();
if ($vipNum >= $config['totalvip_down'] && $supplierNum >= $config['totalsh_down']&&$user['purchase_count']>=$config['purchase_count']) {
$BecomeTeam = true;
}
}
// 新增队长用户
if ($BecomeTeam) {
User::add($userId, [
'referee_id' => $agent['referee_id'], //推荐人id
'app_id' => $appId,
]);
}
return true;
}
/**
* 审核状态
* @param $value
* @return array
*/
public function getApplyStatusAttr($value)
{
$method = [10 => '待审核', 20 => '审核通过', '30' => '驳回'];
return ['text' => $method[$value], 'value' => $value];
}
/**
* 审核方式
* @param $value
* @return array
*/
public function getApplyTypeAttr($value)
{
$method = [10 => '后台审核', 20 => '无需审核'];
return ['text' => $method[$value], 'value' => $value];
}
} |
| | | <?php
namespace app\common\model\plus\team;
use app\common\model\BaseModel;
use app\common\model\plus\agent\User as AgentUserModel;
/**
* 队长申请模型
*/
class Apply extends BaseModel
{
protected $name = 'team_apply';
protected $pk = 'apply_id';
/**
* 申请状态
* @var array
*/
public $applyStatus = [
10 => '待审核',
20 => '审核通过',
30 => '驳回',
];
/**
* 申请时间
* @param $value
* @return false|string
*/
public function getApplyTimeAttr($value)
{
return date('Y-m-d H:i:s', $value);
}
/**
* 审核时间
* @param $value
* @return false|int|string
*/
public function getAuditTimeAttr($value)
{
return $value > 0 ? date('Y-m-d H:i:s', $value) : 0;
}
/**
* 关联推荐人表
* @return \think\model\relation\BelongsTo
*/
public function referee()
{
return $this->belongsTo('app\common\model\user\User', 'referee_id')
->field(['user_id', 'nickName']);
}
/**
* 销商申请记录详情
* @param $where
* @return array|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function detail($where)
{
$filter = is_array($where) ? $where : ['apply_id' => $where];
return (new static())->where($filter)->find();
}
/**
* 根据分销判断成为队长
* @param $userId
* @param $appId
* @return bool
*/
public function becomeTeamByAgent($userId, $become_type, $appId)
{
//log_write($become_type);
// 验证是否设置
$config = Setting::getItem('basic', $appId);
if (empty($config['is_open'])) {
return false;
}
if ($config['become'] != $become_type) {
return false;
}
$agent = AgentUserModel::detail($userId);
if (!$agent) {
return false;
}
$becomeTeam = false;
//分销商总数
if ($become_type == '40') {
$agent_total = $agent['first_num'] + $agent['second_num'] + $agent['third_num'];
if ($agent_total >= $config['totalfxs_down']) {
$becomeTeam = true;
}
}
//分销佣金总数
if ($become_type == '50') {
$agent_money = $agent['total_money'] + $agent['money'] + $agent['freeze_money'];
if ($agent_money >= $config['total_money']) {
$becomeTeam = true;
}
}
if($become_type == '70'){
$vipNum=(new \app\common\model\user\User)->getRefereeGradeCount([$userId],$config['referee_grade_ids']);
$supplierNum=(new \app\common\model\supplier\Supplier)->getSubordinateNum([$userId]);
$user=(new \app\common\model\user\User)->where(['user_id'=>$userId,'is_delete'=>0])->find();
if ($vipNum >= $config['totalvip_down'] && $supplierNum >= $config['totalsh_down']&&$user['purchase_count']>=$config['purchase_count']) {
$becomeTeam = true;
}
}
// 新增队长用户
if ($becomeTeam) {
User::add($userId, [
'referee_id' => $agent['referee_id'], //推荐人id
'app_id' => $appId,
]);
}
return true;
}
/**
* 审核状态
* @param $value
* @return array
*/
public function getApplyStatusAttr($value)
{
$method = [10 => '待审核', 20 => '审核通过', '30' => '驳回'];
return ['text' => $method[$value], 'value' => $value];
}
/**
* 审核方式
* @param $value
* @return array
*/
public function getApplyTypeAttr($value)
{
$method = [10 => '后台审核', 20 => '无需审核'];
return ['text' => $method[$value], 'value' => $value];
}
} |
| | |
| | | } |
| | | // 判断商品是否在设置范围内 |
| | | $intersect = array_intersect($productIds, $config['become__buy_product_ids']); |
| | | if (empty($intersect)) { |
| | | $purchase_count=0; |
| | | foreach ($order['product'] as $product) { |
| | | // 检查商品是否是指定的分红商品 |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])||$product['is_vip']==1) { |
| | | // 获取商品数量 |
| | | $quantity = $product['total_num']; |
| | | $purchase_count+=$quantity; |
| | | } |
| | | } |
| | | if ($purchase_count<=0){ |
| | | return false; |
| | | } |
| | | |
| | |
| | | if ($product['is_repurchase']==1){ |
| | | $viewpoint_money=bcadd($viewpoint_money,($product['is_viewpoint_money']?$product['viewpoint_money']:$vipGrade['viewpoint_money']),2); |
| | | } |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])) { |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])||$product['is_vip']) { |
| | | // 获取商品数量 |
| | | $quantity = $product['total_num']; |
| | | // 为每个商品生成分红订单 |
| | |
| | | */ |
| | | public function getEnabledPlans() |
| | | { |
| | | return $this->where(['status' => 1, 'is_default' =>0]) |
| | | return $this->where(['status' => 1, 'is_default' =>0,'is_delete'=>0]) |
| | | ->order(['sort' => 'asc', 'create_time' => 'desc']) |
| | | ->select(); |
| | | } |
| | | /** |
| | | * 获取启用的年卡列表(包含默认年卡) |
| | | */ |
| | | public function getEnabledPlansAll() |
| | | { |
| | | return $this->where(['status' => 1,'is_delete'=>0]) |
| | | ->order(['sort' => 'asc', 'create_time' => 'desc']) |
| | | ->select(); |
| | | } |
| | |
| | | public function activateMember($orderId) |
| | | { |
| | | // 获取订单信息 |
| | | $order = MemberOrderModel::where(['order_id' => $orderId, 'pay_status' => MemberOrderStatusEnum::PENDING])->find(); |
| | | $order = MemberOrderModel::where(['order_id' => $orderId, 'pay_status' => MemberOrderStatusEnum::SUCCESS])->find(); |
| | | if (!$order) { |
| | | return false; |
| | | } |
| | |
| | | <text>{{ product.line_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> |
| | | </view> |
| | | </template> |
| | |
| | | .diy-product .display__slide .column__3 .product-item { |
| | | width: 200rpx; |
| | | } |
| | | //购物车 |
| | | .cart-action { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | .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; |
| | | } |
| | | </style> |
| | |
| | | <text>¥</text> |
| | | <text>{{ product.line_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> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | <image :src="item.avatarUrl" mode="aspectFill"></image> |
| | | <text class="text-ellipsis">{{item.real_name}}</text> |
| | | </view> |
| | | <view class="more d-c-c d-c" v-if="activityData.total > 6" @click="openUser"> |
| | | <view class="more d-c-c d-c" v-if="activityData.total > 5" @click="openUser"> |
| | | <view class="d-c-c more-icon"> |
| | | <text class="iconfont icon-gengduo"></text> |
| | | </view> |
| | |
| | | <view class="title ww100 tc f28">报名人员名单</view> |
| | | <view class="iconfont icon-guanbi" @click="closePopup(null)"></view> |
| | | </view> |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" :show-scrollbar="false" @scroll="handleScroll" lower-threshold="50" @scrolltolower="scrolltolowerFunc"> |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" :show-scrollbar="false" lower-threshold="50" @scrolltolower="scrolltolowerFunc"> |
| | | <!-- 图片 --> |
| | | <view class="user-box d-s-s f-w"> |
| | | <view class="user-item tc" v-for="(item, index) in listData" :key="index" @click="previewImage(index)"> |
| | | <image class="image" :src="item.avatarUrl" mode="aspectFill" lazy-load></image> |
| | | <text class="f28">{{item.real_name}}</text> |
| | | <text class="f28" style="width: 115rpx;">{{item.real_name}}</text> |
| | | </view> |
| | | </view> |
| | | <!-- 没有记录 --> |
| | |
| | | /*当前页面*/ |
| | | page: 1, |
| | | /*每页条数*/ |
| | | list_rows: 10, |
| | | list_rows: 35, |
| | | /*有没有更多*/ |
| | | no_more: false, |
| | | /*是否正在加载*/ |
| | |
| | | </view> |
| | | <view class="flex-1 ml20 f24"> |
| | | <view class="d-b-c mb16 f28 gray3">{{ item.nickName }}</view> |
| | | <view class="d-b-c mb16 f28 gray3">{{ item.real_name }}</view> |
| | | <view class="d-b-c mb16 f28 gray3">{{ item.mobile }}</view> |
| | | <view class="d-b-c mb16 f28 gray3">姓名:{{ item.real_name }}</view> |
| | | <view class="d-b-c mb16 f28 gray3">手机号:{{ item.mobile }}</view> |
| | | <view class="d-b-c mb16 f28 gray3">邀请人:{{ item.recommend_name }}</view> |
| | | <view class="gray9">报名时间:{{ item.create_time }}</view> |
| | | </view> |
| | | <view class="f26"> |
| | |
| | | <template> |
| | | <view class="category-wrap" :data-theme='theme()' :class="theme() || ''"> |
| | | <view class="category-wrap" :data-theme='theme()' :class="theme() || ''"> |
| | | <!-- #ifdef APP-PLUS --> |
| | | <header-bar></header-bar> |
| | | <!-- #endif --> |
| | |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | |
| | | |
| | | <!--一级分类 列表--> |
| | | <view class="cotegory-type cotegory-type-3" v-if="show_type==40"> |
| | | <view class="category-tab"> |
| | |
| | | </scroll-view> |
| | | </view> |
| | | <view class="category-content pr"> |
| | | <scroll-view scroll-y="true" @scrolltolower="scrolltolowerList" class="scroll-Y scroll-3" :style="'height:'+scrollviewHigh+'px;'"> |
| | | <scroll-view scroll-y="true" @scrolltolower="scrolltolowerList" 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 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_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 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)"> |
| | | <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)"> |
| | |
| | | </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)"> |
| | | <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="shop_body_l_item_info_others_sales">累计成交:{{item.product_sales}}笔</view> |
| | | </view> --> |
| | | </view> |
| | | |
| | | |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | <text class="iconfont icon-wushuju"></text> |
| | | <text class="cont">亲,暂无相关记录哦</text> |
| | | </view> |
| | | <uni-load-more v-else :loadingType="loadingType"></uni-load-more> |
| | | </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> |
| | | </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" 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" |
| | | <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)" |
| | | > |
| | | 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"> |
| | |
| | | <text class="icon iconfont icon-jian"></text> |
| | | </view> |
| | | <view class="quantity-display">{{ quantity }}</view> |
| | | <view class="quantity-btn" :class="{ disabled: quantity >= currentStock }" @click="increaseQuantity"> |
| | | <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> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import uniLoadMore from "@/components/uni-load-more.vue"; |
| | | export default { |
| | | components: {}, |
| | | components: { |
| | | uniLoadMore |
| | | }, |
| | | data() { |
| | | return { |
| | | isloadding: true, |
| | |
| | | childlist: [], |
| | | /*当前选中的分类*/ |
| | | select_index: 0, |
| | | productData:[], |
| | | catename:'', |
| | | productData: [], |
| | | catename: '', |
| | | /*底部加载*/ |
| | | loading: true, |
| | | index_open_city:0, |
| | | city_supplier_ids:[], |
| | | |
| | | /*没有更多*/ |
| | | no_more: false, |
| | | index_open_city: 0, |
| | | city_supplier_ids: [], |
| | | |
| | | // 购物车相关数据 |
| | | cartData: {}, // 存储各商品在购物车中的数量 |
| | | |
| | | |
| | | // 规格弹窗相关数据 |
| | | specPopupVisible: false, |
| | | selectedProduct: null, |
| | | selectedSpecs: [], |
| | | quantity: 1, |
| | | page:1, |
| | | last_page:1, |
| | | page: 1, |
| | | last_page: 1, |
| | | category_id: 0, |
| | | params: { |
| | | page: 1, |
| | | category_id: 0, |
| | | search: '', |
| | | sortType: '', |
| | | sortPrice: 0, |
| | | list_rows: 10, |
| | | }, |
| | | }; |
| | | }, |
| | | 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)) { |
| | | 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.selectedProduct ? this.selectedProduct.product_price : '0.00'; |
| | | }, |
| | | |
| | | |
| | | // 获取当前选中规格的库存 |
| | | currentStock() { |
| | | if (this.currentSku) { |
| | |
| | | } |
| | | return this.selectedProduct ? this.selectedProduct.product_stock : 0; |
| | | }, |
| | | |
| | | |
| | | /*加载中状态*/ |
| | | loadingType() { |
| | | if (this.isloadding) { |
| | | return 1; |
| | | } else { |
| | | if (this.listData.length != 0 && this.no_more) { |
| | | return 2; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.init(); |
| | | this.getData(); |
| | | }, |
| | | onShow(){ |
| | | onShow() { |
| | | this.getData(); |
| | | this.getTabBarLinks(); |
| | | }, |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | isInArray2(arr,value){ |
| | | value=parseInt(value); |
| | | var index = arr.indexOf(value); |
| | | if(index >= 0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | |
| | | isInArray2(arr, value) { |
| | | value = parseInt(value); |
| | | var index = arr.indexOf(value); |
| | | if (index >= 0) { |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | |
| | | /*判断是否有图片*/ |
| | |
| | | _this.select_index = 0; |
| | | |
| | | var city_supplier_ids = ''; |
| | | if(uni.getStorageSync('citySupplierRes')){ |
| | | let resData=uni.getStorageSync('citySupplierRes'); |
| | | _this.city_supplier_ids=resData.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}, function(res) { |
| | | _this._get('product.category/index', { |
| | | city_supplier_ids: city_supplier_ids |
| | | }, function(res) { |
| | | _this.listData = res.data.list; |
| | | _this.show_type = res.data.template.category_style; |
| | | if(_this.listData.length>0){ |
| | | if (_this.listData.length > 0) { |
| | | if (_this.listData[0].child) { |
| | | _this.childlist = _this.listData[0].child; |
| | | } |
| | | _this.category_id = _this.listData[0]['category_id']; |
| | | } |
| | | _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.productData = res.data.productList.data; |
| | | _this.index_open_city = res.data.store.index_open_city; |
| | | _this.isloadding = false; |
| | | _this.last_page = res.data.productList.last_page; |
| | | if (_this.last_page <= 1) { |
| | | _this.no_more = true; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | |
| | | }, |
| | | /*获取商品数据*/ |
| | | getProductData(e) { |
| | | if(this.select_index!=e){ |
| | | this.page=1 |
| | | if (this.select_index != e) { |
| | | this.page = 1 |
| | | } |
| | | this.select_index = e; |
| | | this.productData=[]; |
| | | 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; |
| | | 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 = self.page;; |
| | | let list_rows = 10; |
| | | let category_id =this.listData[e].category_id; |
| | | let category_id = this.listData[e].category_id; |
| | | this.category_id = category_id |
| | | this.no_more = false; |
| | | let search = ''; |
| | | let sortType = ''; |
| | | let sortPrice = 0; |
| | |
| | | sortType: sortType, |
| | | sortPrice: sortPrice, |
| | | list_rows: list_rows, |
| | | city_supplier_ids:city_supplier_ids |
| | | city_supplier_ids: city_supplier_ids |
| | | }, function(res) { |
| | | self.isloadding = false; |
| | | self.productData = res.data.list.data; |
| | | self.last_page = res.data.list.last_page; |
| | | self.index_open_city=res.data.store.index_open_city; |
| | | self.index_open_city = res.data.store.index_open_city; |
| | | if (self.last_page <= 1) { |
| | | self.no_more = true; |
| | | } |
| | | }); |
| | | }, |
| | | /*跳转产品列表*/ |
| | |
| | | '&search=' + search + |
| | | '&sortPrice=' + sortPrice); |
| | | }, |
| | | scrolltolowerList(){ |
| | | var self=this; |
| | | if(self.page<self.last_page){ |
| | | scrolltolowerList() { |
| | | var self = this; |
| | | if (self.page < self.last_page) { |
| | | self.page++ |
| | | self.isloadding = true; |
| | | var params=self.params; |
| | | params.category_id =self.category_id; |
| | | params.page =self.page; |
| | | var params = self.params; |
| | | params.category_id = self.category_id; |
| | | params.page = self.page; |
| | | self._get('product.product/lists', params, function(res) { |
| | | self.isloadding = false; |
| | | self.productData = self.productData.concat(res.data.list.data); |
| | | if (self.page >= self.last_page) { |
| | | self.no_more = true; |
| | | return; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | | wxGetUserInfo: function(res) { |
| | |
| | | return false; |
| | | } |
| | | }, |
| | | |
| | | |
| | | /*跳转搜索页面*/ |
| | | gotoSearch() { |
| | | this.gotoPage('/pages/product/search/search'); |
| | |
| | | path: '/pages/product/category?' + self.getShareUrlParams() |
| | | }; |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | // 添加到购物车或显示规格选择 |
| | | addToCartOrShowSpec(product,index) { |
| | | addToCartOrShowSpec(product, index) { |
| | | if (product.spec_type === 20) { |
| | | // 多规格商品,显示规格选择弹窗 |
| | | this.showSpecPopup(product); |
| | | } else { |
| | | // 单规格商品,直接添加到购物车 |
| | | this.directlyAddToCart(product,index); |
| | | this.directlyAddToCart(product, index); |
| | | } |
| | | }, |
| | | |
| | | |
| | | // 添加到购物车(单规格商品) |
| | | addToCart(product,index) { |
| | | this.directlyAddToCart(product,index); |
| | | addToCart(product, index) { |
| | | this.directlyAddToCart(product, index); |
| | | }, |
| | | |
| | | |
| | | // 直接添加到购物车(单规格商品) |
| | | 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 |
| | | if (!product.cart) { |
| | | product.cart = { |
| | | total_num: 0 |
| | | } |
| | | } |
| | | // 更新商品的购物车数量 |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // 显示规格选择弹窗 |
| | | showSpecPopup(product) { |
| | | this.selectedProduct = product; |
| | | this.quantity = 1; |
| | | let url='' |
| | | let url = '' |
| | | //#ifdef H5 |
| | | if (this.isWeixin()) { |
| | | url = window.location.href; |
| | |
| | | // 获取商品规格数据 |
| | | this._get('product.product/detail', { |
| | | product_id: product.product_id, |
| | | url:url, |
| | | 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); |
| | | |
| | | // 使用正确的路径获取规格数据 |
| | | 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; |
| | | } |
| | | |
| | | |
| | | 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: '获取商品规格失败', |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // 关闭规格选择弹窗 |
| | | 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() { |
| | | // 检查是否选择了所有规格 |
| | |
| | | }); |
| | | 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 |
| | | spec_sku_id: specSkuId ? specSkuId : 0 |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | // 更新商品的购物车数量 |
| | | const product = this.productData.find(p => p.product_id === this.selectedProduct.product_id); |
| | | const product = this.productData.find(p => p.product_id === this.selectedProduct |
| | | .product_id); |
| | | if (product) { |
| | | if(!product.cart){ |
| | | product.cart={ |
| | | total_num:0 |
| | | if (!product.cart) { |
| | | product.cart = { |
| | | total_num: 0 |
| | | } |
| | | } |
| | | product.cart.total_num++; |
| | | } |
| | | |
| | | |
| | | // 关闭弹窗 |
| | | this.closeSpecPopup(); |
| | | |
| | | |
| | | uni.showToast({ |
| | | title: '已添加到购物车', |
| | | icon: 'success' |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // 增加购物车商品数量 |
| | | increaseCart(product,index) { |
| | | increaseCart(product, index) { |
| | | this._post('order.cart/add', { |
| | | product_id: product.product_id, |
| | | total_num: 1, |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // 减少购物车商品数量 |
| | | decreaseCart(product,index) { |
| | | 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 |
| | | spec_sku_id: product.product_sku.spec_sku_id |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | this.productData[index].cart.total_num=0; |
| | | this.productData[index].cart.total_num = 0; |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | |
| | | // 否则减少数量 |
| | | this._post('order.cart/sub', { |
| | | product_id: product.product_id, |
| | | spec_sku_id:product.product_sku.spec_sku_id |
| | | spec_sku_id: product.product_sku.spec_sku_id |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | product.cart.total_num--; |
| | |
| | | background: #ffffff; |
| | | border-radius: 12px; |
| | | } |
| | | .catename{ |
| | | |
| | | .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; |
| | |
| | | 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%; |
| | |
| | | box-sizing: border-box; |
| | | position: relative; |
| | | } |
| | | |
| | | |
| | | .shop_body_l_item_info_title { |
| | | display: -webkit-box; |
| | | -webkit-box-orient: vertical; |
| | |
| | | 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; |
| | |
| | | text-align: center; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | |
| | | .shop_body_l_item_info_others_sales { |
| | | color: #333333; |
| | | } |
| | | |
| | | |
| | | .shop_body2 { |
| | | width: 100%; |
| | | display: flex; |
| | |
| | | flex-wrap: wrap; |
| | | background-color: #f2f2f2; |
| | | } |
| | | |
| | | |
| | | .shop_body_t_item { |
| | | width: 345rpx; |
| | | // margin: 0 2.5%; |
| | |
| | | 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; |
| | |
| | | padding: 20rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | |
| | | .shop_body_t_item_info_title { |
| | | display: -webkit-box; |
| | | -webkit-box-orient: vertical; |
| | |
| | | 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 { |
| | | |
| | | .cart-btn-add, |
| | | .cart-btn-sub { |
| | | width: 48rpx; |
| | | height: 48rpx; |
| | | border-radius: 50%; |
| | |
| | | color: white; |
| | | font-size: 24rpx; |
| | | } |
| | | |
| | | |
| | | .spec-select-btn { |
| | | padding: 2rpx 4rpx; |
| | | background: #ff6b6b; |
| | |
| | | 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; |
| | |
| | | opacity: 0; |
| | | transition: all 0.3s ease; |
| | | } |
| | | |
| | | |
| | | .spec-popup.visible { |
| | | visibility: visible; |
| | | opacity: 1; |
| | | } |
| | | |
| | | |
| | | .popup-mask { |
| | | position: absolute; |
| | | top: 0; |
| | |
| | | bottom: 0; |
| | | background: rgba(0, 0, 0, 0.6); |
| | | } |
| | | |
| | | |
| | | .popup-content { |
| | | position: absolute; |
| | | bottom: 0; |
| | |
| | | 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; |
| | |
| | | align-items: center; |
| | | gap: 20rpx; |
| | | } |
| | | |
| | | |
| | | .cart-badge { |
| | | position: absolute; |
| | | top: -12rpx; |
| | |
| | | padding: 0 6rpx; |
| | | z-index: 10; |
| | | } |
| | | |
| | | |
| | | .cart-count { |
| | | color: white; |
| | | font-size: 20rpx; |
| | | line-height: 1; |
| | | } |
| | | |
| | | |
| | | .close-btn { |
| | | width: 50rpx; |
| | | height: 50rpx; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | <view class="index-search-box index-search-box_re d-b-c" id="searchBox"> |
| | | <view class="index-search index-search_re t-c flex-1"> |
| | | <span class="icon iconfont icon-sousuo"></span> |
| | | <input type="text" v-model="search" class="flex-1 ml10 f26 gray3" value="" placeholder-class="f26 gray9" |
| | | placeholder="搜索商品" confirm-type="search" @confirm="searchFunc()" /> |
| | | <input type="text" v-model="search" class="flex-1 ml10 f26 gray3" value="" |
| | | placeholder-class="f26 gray9" placeholder="搜索商品" confirm-type="search" |
| | | @confirm="searchFunc()" /> |
| | | </view> |
| | | </view> |
| | | <view class="inner-tab"> |
| | |
| | | </view> |
| | | </view> |
| | | <view class="prodcut-list-wrap"> |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" lower-threshold="50" |
| | | @scrolltolower="scrolltolowerFunc"> |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" |
| | | lower-threshold="50" @scrolltolower="scrolltolowerFunc"> |
| | | <view :class="topRefresh?'top-refresh open':'top-refresh'"> |
| | | <view class="circle" v-for="(circle,n) in 3" :key="n"></view> |
| | | </view> |
| | | <view class="shop_body" v-if="isLieBiao ==true"> |
| | | <view class="shop_body_l_item" :class="index==listData.length-1?'noborder':''" v-for="(item,index) in listData" |
| | | :key="index" @click="gotoList(item.product_id)" v-if="index_open_city==0 || (index_open_city==1 && isInArray2(city_supplier_ids,item.shop_supplier_id))"> |
| | | <view class="shop_body_l_item" :class="index==listData.length-1?'noborder':''" |
| | | v-for="(item,index) in listData" :key="index" @click="gotoList(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_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 class="f24 shop_red">¥<text class="f32 fb">{{item.product_price}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="shop_body_l_item_info_others f22"> |
| | | <!-- <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> |
| | | <view class="shop_body2" v-if="isLieBiao ==false"> |
| | | <view class="shop_body_t_item" :class="index % 2 == 0?'ml20 mr20':' mr20'" v-for="(item,index) in listData" :key="index" |
| | | @click="gotoList(item.product_id)" v-if="index_open_city==0 || (index_open_city==1 && isInArray2(city_supplier_ids,item.shop_supplier_id))"> |
| | | <view class="shop_body_t_item" :class="index % 2 == 0?'ml20 mr20':' mr20'" |
| | | v-for="(item,index) in listData" :key="index" @click="gotoList(item.product_id)" |
| | | v-if="index_open_city==0 || (index_open_city==1 && isInArray2(city_supplier_ids,item.shop_supplier_id))"> |
| | | <image :src="item.product_image" mode=""></image> |
| | | <view class="shop_body_t_item_info"> |
| | | <view class="shop_body_t_item_info_title f26">{{item.product_name}}</view> |
| | | <view class="shop_body_t_item_info_others f24 gray9 mt"> |
| | | <!-- <view class="shop_body_t_item_info_others f24 gray9 mt"> |
| | | <view class="shop_body_t_item_info_others_sales">累计成交:{{item.product_sales}}笔</view> |
| | | </view> |
| | | </view> --> |
| | | <view class="shop_body_t_item_info_price"> |
| | | <view class="f20 redF6">¥<text class="f32">{{item.product_price}}</text></view> |
| | | <view class="f20 huaxianjia">¥<text class="24">{{item.line_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> |
| | | </view> |
| | | </view> |
| | |
| | | </view> |
| | | <uni-load-more v-else :loadingType="loadingType"></uni-load-more> |
| | | </scroll-view> |
| | | </view><!-- 规格选择弹窗 --> |
| | | <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> |
| | |
| | | sortPrice: 0, |
| | | list_rows: 10, |
| | | last_page: 0, |
| | | index_open_city:0, |
| | | city_supplier_ids:[], |
| | | index_open_city: 0, |
| | | city_supplier_ids: [], |
| | | // 购物车相关数据 |
| | | cartData: {}, // 存储各商品在购物车中的数量 |
| | | |
| | | // 规格弹窗相关数据 |
| | | specPopupVisible: false, |
| | | selectedProduct: null, |
| | | selectedSpecs: [], |
| | | quantity: 1, |
| | | page: 1, |
| | | last_page: 1, |
| | | category_id: 0, |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | isInArray2(arr,value){ |
| | | value=parseInt(value); |
| | | var index = arr.indexOf(value); |
| | | if(index >= 0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | isInArray2(arr, value) { |
| | | value = parseInt(value); |
| | | var index = arr.indexOf(value); |
| | | if (index >= 0) { |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | /*还原初始化*/ |
| | | restoreData() { |
| | |
| | | getData() { |
| | | let self = this; |
| | | var city_supplier_ids = ''; |
| | | if(uni.getStorageSync('citySupplierRes')){ |
| | | let resData=uni.getStorageSync('citySupplierRes'); |
| | | self.city_supplier_ids=resData.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 = self.page; |
| | | let list_rows = self.list_rows; |
| | | let category_id = self.category_id; |
| | |
| | | sortType: sortType, |
| | | sortPrice: sortPrice, |
| | | list_rows: list_rows, |
| | | city_supplier_ids:city_supplier_ids |
| | | city_supplier_ids: city_supplier_ids |
| | | }, function(res) { |
| | | self.loading = false; |
| | | self.listData = self.listData.concat(res.data.list.data); |
| | | self.last_page = res.data.list.last_page; |
| | | self.index_open_city=res.data.store.index_open_city; |
| | | self.index_open_city = res.data.store.index_open_city; |
| | | if (res.data.list.last_page <= 1) { |
| | | self.no_more = true; |
| | | } |
| | |
| | | path: "/pages/product/category?" + this.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.listData[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.listData.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.listData[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.listData[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.listData[index].cart.total_num = product.cart.total_num; |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | .noborder { |
| | | border: none; |
| | | } |
| | | </style> |
| | | |
| | | //购物车 |
| | | .cart-action { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | .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; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <view class="category-wrap" :data-theme='theme()' :class="theme() || ''"> |
| | | <view class="category-wrap" :data-theme='theme()' :class="theme() || ''"> |
| | | <!-- #ifdef APP-PLUS --> |
| | | <header-bar></header-bar> |
| | | <!-- #endif --> |
| | |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | |
| | | |
| | | <!--一级分类 列表--> |
| | | <view class="cotegory-type cotegory-type-3" v-if="show_type==40"> |
| | | <view class="category-tab"> |
| | |
| | | <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 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_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 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)"> |
| | | <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)"> |
| | |
| | | </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)"> |
| | | <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="shop_body_l_item_info_others_sales">累计成交:{{item.product_sales}}笔</view> |
| | | </view> --> |
| | | </view> |
| | | |
| | | |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | <text class="iconfont icon-wushuju"></text> |
| | | <text class="cont">亲,暂无相关记录哦</text> |
| | | </view> |
| | | <uni-load-more v-else :loadingType="loadingType"></uni-load-more> |
| | | </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> |
| | | </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" 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" |
| | | <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)" |
| | | > |
| | | 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"> |
| | |
| | | <text class="icon iconfont icon-jian"></text> |
| | | </view> |
| | | <view class="quantity-display">{{ quantity }}</view> |
| | | <view class="quantity-btn" :class="{ disabled: quantity >= currentStock }" @click="increaseQuantity"> |
| | | <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> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import uniLoadMore from "@/components/uni-load-more.vue"; |
| | | export default { |
| | | components: {}, |
| | | components: { |
| | | uniLoadMore |
| | | }, |
| | | data() { |
| | | return { |
| | | isloadding: true, |
| | |
| | | childlist: [], |
| | | /*当前选中的分类*/ |
| | | select_index: 0, |
| | | productData:[], |
| | | catename:'', |
| | | productData: [], |
| | | catename: '', |
| | | /*底部加载*/ |
| | | loading: true, |
| | | index_open_city:0, |
| | | city_supplier_ids:[], |
| | | |
| | | index_open_city: 0, |
| | | city_supplier_ids: [], |
| | | |
| | | // 购物车相关数据 |
| | | cartData: {}, // 存储各商品在购物车中的数量 |
| | | |
| | | |
| | | // 规格弹窗相关数据 |
| | | specPopupVisible: false, |
| | | selectedProduct: null, |
| | | selectedSpecs: [], |
| | | page:1, |
| | | last_page:1, |
| | | quantity: 1 |
| | | page: 1, |
| | | last_page: 1, |
| | | quantity: 1, |
| | | category_id: 1, |
| | | no_more: 1, |
| | | params: { |
| | | page: 1, |
| | | category_id: 0, |
| | | search: '', |
| | | sortType: '', |
| | | sortPrice: 0, |
| | | list_rows: 10, |
| | | }, |
| | | }; |
| | | }, |
| | | 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)) { |
| | | 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.selectedProduct ? this.selectedProduct.product_price : '0.00'; |
| | | }, |
| | | |
| | | |
| | | // 获取当前选中规格的库存 |
| | | currentStock() { |
| | | if (this.currentSku) { |
| | |
| | | } |
| | | return this.selectedProduct ? this.selectedProduct.product_stock : 0; |
| | | }, |
| | | |
| | | |
| | | /*加载中状态*/ |
| | | loadingType() { |
| | | if (this.isloadding) { |
| | | return 1; |
| | | } else { |
| | | if (this.listData.length != 0 && this.no_more) { |
| | | return 2; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.init(); |
| | | this.getData(); |
| | | }, |
| | | onShow(){ |
| | | onShow() { |
| | | this.getData(); |
| | | this.getTabBarLinks(); |
| | | }, |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | isInArray2(arr,value){ |
| | | value=parseInt(value); |
| | | var index = arr.indexOf(value); |
| | | if(index >= 0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | |
| | | isInArray2(arr, value) { |
| | | value = parseInt(value); |
| | | var index = arr.indexOf(value); |
| | | if (index >= 0) { |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | |
| | | /*判断是否有图片*/ |
| | |
| | | _this.select_index = 0; |
| | | |
| | | var city_supplier_ids = ''; |
| | | if(uni.getStorageSync('citySupplierRes')){ |
| | | let resData=uni.getStorageSync('citySupplierRes'); |
| | | _this.city_supplier_ids=resData.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._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.length > 0) { |
| | | if (_this.listData[0].child) { |
| | | _this.childlist = _this.listData[0].child; |
| | | } |
| | | _this.category_id = _this.listData[0]['category_id']; |
| | | } |
| | | _this.catename = _this.listData[0].name; |
| | | _this.background = res.data.background; |
| | | _this.productData=res.data.productList.data; |
| | | _this.productData = res.data.productList.data; |
| | | _this.last_page = res.data.list.last_page; |
| | | _this.index_open_city=res.data.store.index_open_city; |
| | | _this.index_open_city = res.data.store.index_open_city; |
| | | _this.isloadding = false; |
| | | if (_this.last_page <= 1) { |
| | | _this.no_more = true; |
| | | } |
| | | }); |
| | | }, |
| | | goback() { |
| | |
| | | }, |
| | | /*获取商品数据*/ |
| | | getProductData(e) { |
| | | if(this.select_index!=e){ |
| | | this.page=1 |
| | | if (this.select_index != e) { |
| | | this.page = 1 |
| | | } |
| | | this.select_index = e; |
| | | this.productData=[]; |
| | | 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; |
| | | 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 category_id = this.listData[e].category_id; |
| | | this.category_id = category_id; |
| | | let search = ''; |
| | | let sortType = ''; |
| | | let sortPrice = 0; |
| | |
| | | sortType: sortType, |
| | | sortPrice: sortPrice, |
| | | list_rows: list_rows, |
| | | city_supplier_ids:city_supplier_ids, |
| | | shop_supplier_id:uni.getStorageSync('shop_supplier_id') |
| | | city_supplier_ids: city_supplier_ids, |
| | | shop_supplier_id: uni.getStorageSync('shop_supplier_id') |
| | | }, function(res) { |
| | | self.isloadding = false; |
| | | self.productData = res.data.list.data; |
| | | self.last_page = res.data.list.last_page; |
| | | self.index_open_city=res.data.store.index_open_city; |
| | | self.index_open_city = res.data.store.index_open_city; |
| | | if (self.last_page <= 1) { |
| | | self.no_more = true; |
| | | } |
| | | }); |
| | | }, |
| | | scrolltolowerList(){ |
| | | var self=this; |
| | | if(self.page<self.last_page){ |
| | | scrolltolowerList() { |
| | | var self = this; |
| | | if (self.page < self.last_page) { |
| | | self.page++ |
| | | self.isloadding = true; |
| | | var params=self.params; |
| | | params.category_id =self.category_id; |
| | | params.page =self.page; |
| | | var params = self.params; |
| | | params.category_id = self.category_id; |
| | | params.page = self.page; |
| | | self._get('product.product/lists', params, function(res) { |
| | | self.isloadding = false; |
| | | self.productData = self.productData.concat(res.data.list.data); |
| | | if (self.page >= self.last_page) { |
| | | self.no_more = true; |
| | | return; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | }, |
| | | /*跳转产品列表*/ |
| | | gotoList2(e) { |
| | |
| | | return false; |
| | | } |
| | | }, |
| | | |
| | | |
| | | /*跳转搜索页面*/ |
| | | gotoSearch() { |
| | | this.gotoPage('/pages/product/search/search'); |
| | |
| | | path: '/pages/product/category?' + self.getShareUrlParams() |
| | | }; |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | // 添加到购物车或显示规格选择 |
| | | addToCartOrShowSpec(product,index) { |
| | | addToCartOrShowSpec(product, index) { |
| | | if (product.spec_type === 20) { |
| | | // 多规格商品,显示规格选择弹窗 |
| | | this.showSpecPopup(product); |
| | | } else { |
| | | // 单规格商品,直接添加到购物车 |
| | | this.directlyAddToCart(product,index); |
| | | this.directlyAddToCart(product, index); |
| | | } |
| | | }, |
| | | |
| | | |
| | | // 添加到购物车(单规格商品) |
| | | addToCart(product,index) { |
| | | this.directlyAddToCart(product,index); |
| | | addToCart(product, index) { |
| | | this.directlyAddToCart(product, index); |
| | | }, |
| | | |
| | | |
| | | // 直接添加到购物车(单规格商品) |
| | | 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 |
| | | if (!product.cart) { |
| | | product.cart = { |
| | | total_num: 0 |
| | | } |
| | | } |
| | | // 更新商品的购物车数量 |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // 显示规格选择弹窗 |
| | | showSpecPopup(product) { |
| | | this.selectedProduct = product; |
| | | this.quantity = 1; |
| | | let url='' |
| | | let url = '' |
| | | //#ifdef H5 |
| | | if (this.isWeixin()) { |
| | | url = window.location.href; |
| | |
| | | // 获取商品规格数据 |
| | | this._get('product.product/detail', { |
| | | product_id: product.product_id, |
| | | url:url, |
| | | 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); |
| | | |
| | | // 使用正确的路径获取规格数据 |
| | | 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; |
| | | } |
| | | |
| | | |
| | | 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: '获取商品规格失败', |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // 关闭规格选择弹窗 |
| | | 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() { |
| | | // 检查是否选择了所有规格 |
| | |
| | | }); |
| | | 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 |
| | | spec_sku_id: specSkuId ? specSkuId : 0 |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | // 更新商品的购物车数量 |
| | | const product = this.productData.find(p => p.product_id === this.selectedProduct.product_id); |
| | | const product = this.productData.find(p => p.product_id === this.selectedProduct |
| | | .product_id); |
| | | if (product) { |
| | | if(!product.cart){ |
| | | product.cart={ |
| | | total_num:0 |
| | | if (!product.cart) { |
| | | product.cart = { |
| | | total_num: 0 |
| | | } |
| | | } |
| | | product.cart.total_num++; |
| | | } |
| | | |
| | | |
| | | // 关闭弹窗 |
| | | this.closeSpecPopup(); |
| | | |
| | | |
| | | uni.showToast({ |
| | | title: '已添加到购物车', |
| | | icon: 'success' |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // 增加购物车商品数量 |
| | | increaseCart(product,index) { |
| | | increaseCart(product, index) { |
| | | this._post('order.cart/add', { |
| | | product_id: product.product_id, |
| | | total_num: 1, |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // 减少购物车商品数量 |
| | | decreaseCart(product,index) { |
| | | 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 |
| | | spec_sku_id: product.product_sku.spec_sku_id |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | this.productData[index].cart.total_num=0; |
| | | this.productData[index].cart.total_num = 0; |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | |
| | | // 否则减少数量 |
| | | this._post('order.cart/sub', { |
| | | product_id: product.product_id, |
| | | spec_sku_id:product.product_sku.spec_sku_id |
| | | spec_sku_id: product.product_sku.spec_sku_id |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | product.cart.total_num--; |
| | |
| | | background: #ffffff; |
| | | border-radius: 12px; |
| | | } |
| | | .catename{ |
| | | |
| | | .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; |
| | |
| | | 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%; |
| | |
| | | box-sizing: border-box; |
| | | position: relative; |
| | | } |
| | | |
| | | |
| | | .shop_body_l_item_info_title { |
| | | display: -webkit-box; |
| | | -webkit-box-orient: vertical; |
| | |
| | | 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; |
| | |
| | | text-align: center; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | |
| | | .shop_body_l_item_info_others_sales { |
| | | color: #333333; |
| | | } |
| | | |
| | | |
| | | .shop_body2 { |
| | | width: 100%; |
| | | display: flex; |
| | |
| | | flex-wrap: wrap; |
| | | background-color: #f2f2f2; |
| | | } |
| | | |
| | | |
| | | .shop_body_t_item { |
| | | width: 345rpx; |
| | | // margin: 0 2.5%; |
| | |
| | | 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; |
| | |
| | | padding: 20rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | |
| | | .shop_body_t_item_info_title { |
| | | display: -webkit-box; |
| | | -webkit-box-orient: vertical; |
| | |
| | | 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 { |
| | | |
| | | .cart-btn-add, |
| | | .cart-btn-sub { |
| | | width: 48rpx; |
| | | height: 48rpx; |
| | | border-radius: 50%; |
| | |
| | | color: white; |
| | | font-size: 24rpx; |
| | | } |
| | | |
| | | |
| | | .spec-select-btn { |
| | | padding: 2rpx 4rpx; |
| | | background: #ff6b6b; |
| | |
| | | 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; |
| | |
| | | opacity: 0; |
| | | transition: all 0.3s ease; |
| | | } |
| | | |
| | | |
| | | .spec-popup.visible { |
| | | visibility: visible; |
| | | opacity: 1; |
| | | } |
| | | |
| | | |
| | | .popup-mask { |
| | | position: absolute; |
| | | top: 0; |
| | |
| | | bottom: 0; |
| | | background: rgba(0, 0, 0, 0.6); |
| | | } |
| | | |
| | | |
| | | .popup-content { |
| | | position: absolute; |
| | | bottom: 0; |
| | |
| | | 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; |
| | |
| | | align-items: center; |
| | | gap: 20rpx; |
| | | } |
| | | |
| | | |
| | | .cart-badge { |
| | | position: absolute; |
| | | top: -12rpx; |
| | |
| | | padding: 0 6rpx; |
| | | z-index: 10; |
| | | } |
| | | |
| | | |
| | | .cart-count { |
| | | color: white; |
| | | font-size: 20rpx; |
| | | line-height: 1; |
| | | } |
| | | |
| | | |
| | | .close-btn { |
| | | width: 50rpx; |
| | | height: 50rpx; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | font-size: 32rpx; |
| | | border: none; |
| | | } |
| | | |
| | | |
| | | .reg180 { |
| | | padding-right: 20rpx; |
| | | text-align: right; |
| | |
| | | <template> |
| | | <view class="weidian" v-if="store_open"> |
| | | <view v-if="shop_data.supplier.money>0&&shop_data.supplier.status!=20"> |
| | | <view v-if="shop_data.supplier.money>0||shop_data.supplier.status!=20"> |
| | | <view class="weidian_head"> |
| | | <!-- #ifdef MP-WEIXIN || APP-PLUS --> |
| | | <view class="ww100" :style="'height:'+topBarTop()+'px;'"></view> |
| | |
| | | <view class="fb">缴纳保证金</view> |
| | | </view> |
| | | <!-- #endif --> |
| | | <view class="deposit_bg"> |
| | | <view class="deposit_bg"> |
| | | <view class="deposit_tit">类目:<text class="gray9">{{category.name}}</text></view> |
| | | <view class="deposit_tit borderb">保证金:<text class="gray9">¥{{category.deposit_money}}</text></view> |
| | | </view> |
| | | </view> |
| | | <view class="member"> |
| | | <view class="member-package" v-for="(item, index) in memberPackages" :key="index" @click="selectPackage(index)"> |
| | | <view class="package-header" :class="{ 'selected': selectedIndex === index }"> |
| | | <text class="package-name">{{ item.name }}</text> |
| | | <text class="package-price">¥{{ item.price }}</text> |
| | | </view> |
| | | <view class="package-body"> |
| | | <view class="package-description">{{ item.particulars }}</view> |
| | | <view class="package-expiry">有效期:{{ item.duration }}天</view> |
| | | <view class="common-form">保证金</view> |
| | | <view class="member-package"> |
| | | <view class="selected package-header"> |
| | | <view> |
| | | <text class="package-name">{{category.name}}</text> |
| | | <text class="package-price">¥{{ category.deposit_money }}</text> |
| | | </view> |
| | | <view> |
| | | <radio-group activeBackgroundColor="#e43130"> |
| | | <radio checked></radio> |
| | | </radio-group> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="buy-button-container"> |
| | | <button class="buy-button" @click="buyMemberPackage">立即购买</button> |
| | | <view class="common-form">年卡</view> |
| | | <radio-group activeBackgroundColor="#e43130"> |
| | | <view class="member-package" v-for="(item, index) in memberPackages" :key="index" |
| | | @click="selectPackage(index)"> |
| | | <view class="selected package-header"> |
| | | <view> |
| | | <text class="package-name">{{ item.name }}</text> |
| | | <text class="package-price">¥{{ item.price }}</text> |
| | | </view> |
| | | <view> |
| | | <radio :checked="selectedIndex==index"></radio> |
| | | </view> |
| | | </view> |
| | | <view class="package-body"> |
| | | <view class="package-description">{{ item.particulars }}</view> |
| | | <view class="package-expiry">有效期:{{ item.duration }}天</view> |
| | | </view> |
| | | </view> |
| | | </radio-group> |
| | | |
| | | <!--底部支付--> |
| | | <view class="foot-pay-btns"> |
| | | <template > |
| | | <view> |
| | | 应付 |
| | | <text class="fb theme-price">¥</text> |
| | | <text class="num theme-price fb f38">{{ order_total_front_price }}</text> |
| | | </view> |
| | | </template> |
| | | <button type="primary" @tap="SubmitOrder">提交订单</button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | memberPackages: [], |
| | | selectedIndex: 0, |
| | | category: {}, |
| | | loading: true |
| | | loading: true, |
| | | plan_id:0, |
| | | order_total_front_price:0, |
| | | } |
| | | }, |
| | | onShow() { |
| | |
| | | }, |
| | | onLoad() { |
| | | this.GetStatusBarHeight(); |
| | | this.getMemberPlans(); |
| | | this.getData(); |
| | | }, |
| | | methods: {// 获取年卡套餐列表 |
| | | methods: { // 获取年卡套餐列表 |
| | | getMemberPlans() { |
| | | let self = this; |
| | | self._get('supplier.member/plans', {}, function(res) { |
| | | self._get('supplier.member/plansAll', {}, function(res) { |
| | | self.memberPackages = res.data.plans; |
| | | self.plan_id = self.memberPackages[0].plan_id; |
| | | console.log(self.category); |
| | | self.order_total_front_price = (Number(self.memberPackages[0].price)+Number(self.category.deposit_money)).toFixed(2); |
| | | self.loading = false; |
| | | }); |
| | | }, |
| | | /*提交订单*/ |
| | | SubmitOrder() { |
| | | let self = this; |
| | | self._post( |
| | | 'supplier.index/deposit', { |
| | | plan_id:self.plan_id |
| | | }, |
| | | function(result) { |
| | | self.gotoPage('/pages/order/cashier?order_id=' + result.data.order_id+ '&order_type=20'); |
| | | } |
| | | ); |
| | | }, |
| | | selectPackage(index) { |
| | | this.selectedIndex = index; |
| | | this.plan_id = this.memberPackages[index].plan_id; |
| | | this.order_total_front_price = (Number(this.memberPackages[index].price)+Number(this.category.deposit_money)).toFixed(2); |
| | | }, |
| | | /*获取数据*/ |
| | | getData() { |
| | | let self = this; |
| | | self._get('supplier.index/deposit', {}, function(res) { |
| | | self.category = res.data.category; |
| | | self.getMemberPlans(); |
| | | }); |
| | | }, |
| | | GetStatusBarHeight() { |
| | |
| | | }) |
| | | }, |
| | | goback() { |
| | | uni.navigateBack(); |
| | | let self = this; |
| | | uni.navigateBack({ |
| | | delta:1, |
| | | fail:function(e){ |
| | | self.gotoPage('/pages/tabBar/user/index'); |
| | | } |
| | | }); |
| | | }, |
| | | // 支付保证金 |
| | | gotoPay() { |
| | |
| | | background-color: #FFFFFF; |
| | | border-top: 1rpx solid #efefef; |
| | | } |
| | | |
| | | .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%); |
| | | } |
| | | |
| | | .member { |
| | | padding: 0 20rpx; |
| | | } |
| | | |
| | | .member-package { |
| | | background-color: white; |
| | | border-radius: 10rpx; |
| | |
| | | overflow: hidden; |
| | | box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | |
| | | .package-header { |
| | | padding: 30rpx; |
| | | background-color: #f8f8f8; |
| | | border-left: 10rpx solid #ccc; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | |
| | | .package-header.selected { |
| | | background-color: #eef5ff; |
| | | border-left: 10rpx solid #409EFF; |
| | | background-color: #ffeeee; |
| | | border-left: 10rpx solid #e43130; |
| | | } |
| | | |
| | | |
| | | .package-name { |
| | | font-size: 32rpx; |
| | | font-weight: bold; |
| | | color: #333; |
| | | } |
| | | |
| | | |
| | | .package-price { |
| | | float: right; |
| | | font-size: 36rpx; |
| | | font-weight: bold; |
| | | color: #e43130; |
| | | margin-left: 30rpx; |
| | | } |
| | | |
| | | |
| | | .package-body { |
| | | padding: 30rpx; |
| | | } |
| | | |
| | | |
| | | .package-description { |
| | | font-size: 28rpx; |
| | | color: #666; |
| | |
| | | white-space: pre-line; |
| | | line-height: 1.6; |
| | | } |
| | | |
| | | |
| | | .package-features { |
| | | margin-bottom: 20rpx; |
| | | } |
| | | |
| | | |
| | | .feature { |
| | | font-size: 26rpx; |
| | | color: #555; |
| | | margin-bottom: 10rpx; |
| | | } |
| | | |
| | | |
| | | .feature .icon-duigou { |
| | | color: #4caf50; |
| | | margin-right: 10rpx; |
| | | } |
| | | |
| | | |
| | | .package-expiry { |
| | | font-size: 24rpx; |
| | | color: #999; |
| | | text-align: right; |
| | | } |
| | | |
| | | |
| | | .buy-button-container { |
| | | padding: 40rpx 0; |
| | | text-align: center; |
| | | } |
| | | |
| | | |
| | | .buy-button { |
| | | width: 80%; |
| | | background-color: #e43130; |
| | |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="见点奖" :label-width="formLabelWidth" prop="viewpoint_money"> |
| | | <el-input v-model="form.viewpoint_money" type="number" placeholder="请输入见点奖"> |
| | | <template slot="append">元</template> |
| | | <el-form-item label="复购专区级差计算" :label-width="formLabelWidth" prop="differential_prize"> |
| | | <el-input v-model="form.differential_prize" type="number" placeholder="请输入复购专区级差计算"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="复购专区平级奖" :label-width="formLabelWidth" prop="equal_level_award"> |
| | | <el-input v-model="form.equal_level_award" type="number" placeholder="请输入级复购专区平级奖"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="自动升级" :label-width="formLabelWidth" prop="auto_upgrade"> |
| | |
| | | referee_grade_count: 0, |
| | | /*见点奖*/ |
| | | viewpoint_money: 0, |
| | | /*平级奖*/ |
| | | equal_level_award: 0, |
| | | /*级差计算*/ |
| | | differential_prize: 0, |
| | | /*备注*/ |
| | | remark: '', |
| | | }, |
| | |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="见点奖" :label-width="formLabelWidth" prop="viewpoint_money"> |
| | | <el-input v-model="form.viewpoint_money" type="number" placeholder="见点奖"> |
| | | <template slot="append">元</template> |
| | | <el-form-item label="复购专区级差计算" :label-width="formLabelWidth" prop="differential_prize"> |
| | | <el-input v-model="form.differential_prize" type="number" placeholder="请输入复购专区级差计算"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="复购专区平级奖" :label-width="formLabelWidth" prop="equal_level_award"> |
| | | <el-input v-model="form.equal_level_award" type="number" placeholder="请输入级复购专区平级奖"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.is_default == 0" label="自动升级" :label-width="formLabelWidth" prop="auto_upgrade"> |
| | |
| | | <span class="orange">¥{{ scope.row.repurchase_money }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operating_subsidy" label="见点奖" > |
| | | <template slot-scope="scope"> |
| | | <span class="orange">¥{{ scope.row.viewpoint_money }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operating_subsidy" label="VIP专区补贴" > |
| | | <el-table-column prop="operating_subsidy" label="下级收益补贴" > |
| | | <template slot-scope="scope"> |
| | | <span class="orange">{{ scope.row.operating_subsidy }}%</span> |
| | | </template> |
| | |
| | | <span class="orange">{{ scope.row.supplier_money }}%</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operating_subsidy" label="复购专区级差计算" > |
| | | <template slot-scope="scope"> |
| | | <span class="orange">{{ scope.row.differential_prize }}%</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operating_subsidy" label="复购专区平级奖" > |
| | | <template slot-scope="scope"> |
| | | <span class="orange">{{ scope.row.equal_level_award }}%</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="升级条件" > |
| | | <template slot-scope="scope"> |
| | | <div v-html="keepTextStyle(scope.row.remark)"></div> |
| | |
| | | <template slot="append">元</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="VIP专区补贴" :label-width="formLabelWidth" prop="operating_subsidy"> |
| | | <el-input v-model="form.operating_subsidy" type="number" placeholder="请输入VIP专区补贴"> |
| | | <el-form-item label="下级收益补贴" :label-width="formLabelWidth" prop="operating_subsidy"> |
| | | <el-input v-model="form.operating_subsidy" type="number" placeholder="请输入下级收益补贴"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="直推店铺交易额佣金" :label-width="formLabelWidth" prop="commission"> |
| | | <el-input v-model="form.supplier_money" type="number" placeholder="请输入直推店铺交易额佣金"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="复购专区级差计算" :label-width="formLabelWidth" prop="differential_prize"> |
| | | <el-input v-model="form.differential_prize" type="number" placeholder="请输入复购专区级差计算"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="复购专区平级奖" :label-width="formLabelWidth" prop="equal_level_award"> |
| | | <el-input v-model="form.equal_level_award" type="number" placeholder="请输入级复购专区平级奖"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="自动升级" :label-width="formLabelWidth" prop="auto_upgrade"> |
| | | <el-radio-group v-model="form.auto_upgrade"> |
| | |
| | | </el-radio-group> |
| | | </div> |
| | | <div class="d-s-c mt16"> |
| | | <el-checkbox v-model="form.is_purchase_count">购买次数</el-checkbox> |
| | | <el-checkbox v-model="form.is_purchase_count">购买次数VIP专区商品</el-checkbox> |
| | | <el-input v-model="form.purchase_count" type="number" :disabled="!form.is_purchase_count" style="width: 160px; margin-left: 10px;" ></el-input> |
| | | <span class="ml10">次</span> |
| | | </div> |
| | | <div class="d-s-c mt16"> |
| | | <el-checkbox v-model="form.is_supplier_count">直推商家</el-checkbox> |
| | | <el-input v-model="form.supplier_count" type="number" :disabled="!form.is_supplier_count" style="width: 160px; margin-left: 10px;" ></el-input> |
| | | <span class="ml10">家</span> |
| | | </div> |
| | | <div class="d-s-c mt16"> |
| | | <el-checkbox v-model="form.is_referee_grade">直推指定会员等级</el-checkbox> |
| | | <el-select v-model="form.referee_grade_ids" multiple :disabled="!form.is_referee_grade" style="width: 160px; margin-left: 10px;"> |
| | | <el-option |
| | | v-for="item in userGradeList" |
| | | :key="item.grade_id" |
| | | :label="item.name" |
| | | :value="item.grade_id"> |
| | | </el-option> |
| | | </el-select> |
| | | <el-input v-model="form.referee_grade_count" type="number" :disabled="!form.is_referee_grade" style="width: 160px; margin-left: 10px;" ></el-input> |
| | | <span class="ml10">人</span> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | |
| | | <script> |
| | | import vipApi from '@/api/plus/vip.js'; |
| | | import UserApi from '@/api/user.js'; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | agent_money: 0, |
| | | /*推广复购佣金*/ |
| | | repurchase_money: 0, |
| | | /*VIP专区补贴*/ |
| | | /*下级收益补贴*/ |
| | | operating_subsidy: 0, |
| | | /*平台直推佣金*/ |
| | | commission: 0, |
| | | /*直推店铺交易额佣金*/ |
| | | supplier_money: 0, |
| | | /*自动升级*/ |
| | | auto_upgrade: 1, |
| | | /*升级条件*/ |
| | |
| | | is_purchase_count: 0, |
| | | /*购买次数*/ |
| | | purchase_count: 0, |
| | | /*是否开放直推商家*/ |
| | | is_supplier_count: 0, |
| | | /*直推商家*/ |
| | | supplier_count: 0, |
| | | /*是否开放直推指定会员等级*/ |
| | | is_referee_grade: 0, |
| | | /*直推指定会员等级IDs*/ |
| | | referee_grade_ids: [], |
| | | /*直推指定会员等级人数*/ |
| | | referee_grade_count: 0, |
| | | /*见点奖*/ |
| | | viewpoint_money: 0, |
| | | /*平级奖*/ |
| | | equal_level_award: 0, |
| | | /*级差计算*/ |
| | | differential_prize: 0, |
| | | /*备注*/ |
| | | remark: '', |
| | | }, |
| | | /*用户管理模块的等级列表*/ |
| | | userGradeList: [], |
| | | /*左边长度*/ |
| | | formLabelWidth: '120px', |
| | | /*是否显示*/ |
| | |
| | | props: ['open_add'], |
| | | created() { |
| | | this.dialogVisible = this.open_add; |
| | | this.getUserGradeList(); |
| | | }, |
| | | methods: { |
| | | /*获取用户管理模块的等级列表*/ |
| | | getUserGradeList() { |
| | | let self = this; |
| | | UserApi.gradelist({}, true) |
| | | .then(res => { |
| | | self.userGradeList = res.data.list.data || res.data.list; |
| | | }) |
| | | .catch(error => {}); |
| | | }, |
| | | /*添加等级*/ |
| | | addGrade() { |
| | | let self = this; |
| | |
| | | if (valid) { |
| | | self.submit_loading = true; |
| | | params.is_purchase_count = params.is_purchase_count == true ? 1 : 0; |
| | | params.is_supplier_count = params.is_supplier_count == true ? 1 : 0; |
| | | params.is_referee_grade = params.is_referee_grade == true ? 1 : 0; |
| | | vipApi.addgrade(params, true).then(data => { |
| | | self.submit_loading = false; |
| | | self.$message({ |
| | |
| | | <template slot="append">元</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="VIP专区补贴" :label-width="formLabelWidth" prop="operating_subsidy"> |
| | | <el-input v-model="form.operating_subsidy" type="number" placeholder="请输入VIP专区补贴"> |
| | | <el-form-item label="下级收益补贴" :label-width="formLabelWidth" prop="operating_subsidy"> |
| | | <el-input v-model="form.operating_subsidy" type="number" placeholder="请输入下级收益补贴"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="平台直推佣金" :label-width="formLabelWidth" prop="commission"> |
| | | <el-input v-model="form.commission" type="number" placeholder="请输入平台直推佣金"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="直推店铺交易额佣金" :label-width="formLabelWidth" prop="commission"> |
| | | <el-input v-model="form.supplier_money" type="number" placeholder="请输入直推店铺交易额佣金"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="复购专区级差计算" :label-width="formLabelWidth" prop="differential_prize"> |
| | | <el-input v-model="form.differential_prize" type="number" placeholder="请输入复购专区级差计算"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="复购专区平级奖" :label-width="formLabelWidth" prop="equal_level_award"> |
| | | <el-input v-model="form.equal_level_award" type="number" placeholder="请输入级复购专区平级奖"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | </el-radio-group> |
| | | </div> |
| | | <div class="d-s-c mt16"> |
| | | <el-checkbox v-model="form.is_purchase_count">购买次数</el-checkbox> |
| | | <el-checkbox v-model="form.is_purchase_count">购买次数VIP专区商品</el-checkbox> |
| | | <el-input v-model="form.purchase_count" type="number" :disabled="!form.is_purchase_count" style="width: 160px; margin-left: 10px;" ></el-input> |
| | | <span class="ml10">次</span> |
| | | </div> |
| | | <div class="d-s-c mt16"> |
| | | <el-checkbox v-model="form.is_supplier_count">直推商家</el-checkbox> |
| | | <el-input v-model="form.supplier_count" type="number" :disabled="!form.is_supplier_count" style="width: 160px; margin-left: 10px;" ></el-input> |
| | | <span class="ml10">家</span> |
| | | </div> |
| | | <div class="d-s-c mt16"> |
| | | <el-checkbox v-model="form.is_referee_grade">直推指定会员等级</el-checkbox> |
| | | <el-select v-model="form.referee_grade_ids" multiple :disabled="!form.is_referee_grade" style="width: 160px; margin-left: 10px;"> |
| | | <el-option |
| | | v-for="item in userGradeList" |
| | | :key="item.grade_id" |
| | | :label="item.name" |
| | | :value="item.grade_id"> |
| | | </el-option> |
| | | </el-select> |
| | | <el-input v-model="form.referee_grade_count" type="number" :disabled="!form.is_referee_grade" style="width: 160px; margin-left: 10px;" ></el-input> |
| | | <span class="ml10">人</span> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | |
| | | <script> |
| | | import vipApi from '@/api/plus/vip.js'; |
| | | import UserApi from '@/api/user.js'; |
| | | export default { |
| | | data() { |
| | | return { |
| | | /*用户管理模块的等级列表*/ |
| | | userGradeList: [], |
| | | /*左边长度*/ |
| | | formLabelWidth: '120px', |
| | | /*是否显示*/ |
| | |
| | | props: ['open_edit', 'form'], |
| | | created() { |
| | | this.form.is_purchase_count = this.form.is_purchase_count == 1 ? true : false; |
| | | this.form.is_supplier_count = this.form.is_supplier_count == 1 ? true : false; |
| | | this.form.is_referee_grade = this.form.is_referee_grade == 1 ? true : false; |
| | | // 等级id转换成数组 |
| | | for (let i = 0; i < this.form.referee_grade_ids.length; i++) { |
| | | this.form.referee_grade_ids[i] = parseInt(this.form.referee_grade_ids[i]); |
| | | } |
| | | this.dialogVisible = this.open_edit; |
| | | this.getUserGradeList(); |
| | | }, |
| | | methods: { |
| | | /*获取用户管理模块的等级列表*/ |
| | | getUserGradeList() { |
| | | let self = this; |
| | | UserApi.gradelist({}, true) |
| | | .then(res => { |
| | | self.userGradeList = res.data.list.data || res.data.list; |
| | | }) |
| | | .catch(error => {}); |
| | | }, |
| | | /*修改等级*/ |
| | | editGrade() { |
| | | let self = this; |
| | |
| | | if (valid) { |
| | | self.submit_loading = true; |
| | | params.is_purchase_count = params.is_purchase_count == true ? 1 : 0; |
| | | params.is_supplier_count = params.is_supplier_count == true ? 1 : 0; |
| | | params.is_referee_grade = params.is_referee_grade == true ? 1 : 0; |
| | | vipApi.editGrade(params, true) |
| | | .then(data => { |
| | | self.submit_loading = false; |
| | |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| | | <style></style> |
| | |
| | | <span class="orange">¥{{ scope.row.agent_money }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operating_subsidy" label="VIP专区补贴" > |
| | | <el-table-column prop="operating_subsidy" label="推广复购佣金" > |
| | | <template slot-scope="scope"> |
| | | <span class="orange">¥{{ scope.row.repurchase_money }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operating_subsidy" label="下级收益补贴" > |
| | | <template slot-scope="scope"> |
| | | <span class="orange">{{ scope.row.operating_subsidy }}%</span> |
| | | </template> |
| | |
| | | <span class="orange">{{ scope.row.commission }}%</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="升级条件" ></el-table-column> |
| | | <el-table-column prop="supplier_money" label="直推商家交易佣金" > |
| | | <template slot-scope="scope"> |
| | | <span class="orange">{{ scope.row.supplier_money }}%</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operating_subsidy" label="复购专区级差计算" > |
| | | <template slot-scope="scope"> |
| | | <span class="orange">{{ scope.row.differential_prize }}%</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operating_subsidy" label="复购专区平级奖" > |
| | | <template slot-scope="scope"> |
| | | <span class="orange">{{ scope.row.equal_level_award }}%</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="升级条件" > |
| | | <template slot-scope="scope"> |
| | | <div v-html="keepTextStyle(scope.row.remark)"></div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="create_time" label="创建时间" width="160"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.create_time }}</span> |
| | |
| | | this.getData(); |
| | | }, |
| | | methods: { |
| | | /*换行*/ |
| | | keepTextStyle(val){ |
| | | let str=val.replace(/(\\r\\n)/g,'<br/>'); |
| | | return str; |
| | | }, |
| | | /*获取列表数据*/ |
| | | getData() { |
| | | let self = this; |
| | |
| | | <div class="table-wrap"> |
| | | <el-table :data="tableData" style="width: 100%" v-loading="loading"> |
| | | <el-table-column prop="log_id" label="ID" width="80"></el-table-column> |
| | | <el-table-column prop="user.nickName" label="用户信息"> |
| | | <el-table-column prop="vipUser.nickName" label="用户信息"> |
| | | <template slot-scope="scope"> |
| | | <div class="d-s-c"> |
| | | <div class="head-img mr10"> |
| | | <img :src="scope.row.user.avatarUrl" alt="" /> |
| | | <img :src="scope.row.vipUser.avatarUrl" alt="" /> |
| | | </div> |
| | | <div> |
| | | <p>{{ scope.row.user.nickName }}</p> |
| | | <p>{{ scope.row.vipUser.nickName }}</p> |
| | | <p class="gray9">ID: {{ scope.row.user_id }}</p> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="old_grade.name" label="变更前等级"> |
| | | <el-table-column prop="oldGrade.name" label="变更前等级"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.old_grade">{{ scope.row.old_grade.name }}</span> |
| | | <span v-if="scope.row.oldGrade">{{ scope.row.oldGrade.name }}</span> |
| | | <span v-else class="gray9">无</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="new_grade.name" label="变更后等级"> |
| | | <el-table-column prop="grade.name" label="变更后等级"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.new_grade">{{ scope.row.new_grade.name }}</span> |
| | | <span v-if="scope.row.grade">{{ scope.row.grade.name }}</span> |
| | | <span v-else class="gray9">无</span> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="备注""> |
| | | <el-table-column prop="remark" label="备注"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.remark || '无' }}</span> |
| | | </template> |
| | |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| | | <style></style> |