get_user_id(), 'store_id' => get_store_id(), 'is_delete' => 0]); if (empty($shop)) { $shop = new Shop(); } else { $shop = $shop->toArray(); $shop['province_name'] = District::findOne($shop['province'])->name; $shop['city_name'] = District::findOne($shop['city'])->name; $shop['district_name'] = District::findOne($shop['district'])->name; } return $this->asJson([ 'code' => 0, 'data' => [ 'shop' => $shop ] ]); } /** * 保存审核数据 */ public function actionApplySubmit() { $form = new ShopApplyForm(); $form->attributes = post_params(); return $this->asJson($form->search()); } /** * 后台数据 */ public function actionAdmin() { $form = new ShopAdminForm(); return $this->asJson($form->search()); } /** * 订单数据 */ public function actionOrder() { $form = new ShopAdminForm(); $form->status = get_params('status', -1); $form->page = get_params('page', 1); return $this->asJson($form->order()); } /** * 附近门店 */ public function actionNearby() { $form = new ShopListForm(); $form->page = get_params('page', 1); $form->longitude = get_params('longitude', 1); $form->latitude = get_params('latitude', 1); return $this->asJson($form->search()); } /** * 附近门店 */ public function actionInfo() { $id = get_params('id', 0); $shop = Shop::findOne([ 'id' => $id, 'shop_audit' => 1 ]); return $this->asJson([ 'code' => 0, 'data' => [ 'shop' => $shop ] ]); } /** * 订单确认收货 */ public function actionConfirm() { $form = new ShopAdminForm(); return $this->asJson($form->confirm(get_params('order_id'))); } /** * 订单确认收货 */ public function actionClerk() { $form = new ShopClerkForm(); $form->attributes = get_params(); return $this->asJson($form->search()); } /** * 核销卡预览 */ public function actionCardInfo() { $form = new ShopClerkForm(); return $this->asJson($form->cardInfo(get_params('id', 0))); } /** * 核销卡核销 */ public function actionCardClerk() { $form = new ShopClerkForm(); $form->num = get_params('num', 1); return $this->asJson($form->cardClerk(get_params('id', 0))); } /** * 提现预览 */ public function actionCash() { $cash_type = get_params('cash_type', 1); $cash = Cash::findOne(['status' => 0, 'user_id' => get_user_id(), 'cash_type' => $cash_type]); $user = User::findOne(get_user_id()); $resInfo = CashForm::getPayTyle(); if ($cash_type == 0) { // 分销商提现 $resInfo['cash_price'] = $user->price; } else { // 自提点提现 $resInfo['cash_price'] = $user->tuan_price; } $setting = Option::get('share_basic_setting', $this->store_id); $setting = $setting ? Json::decode($setting['value']) : []; $resInfo['cash_max_day'] = floatval($setting['cash_max_day']['value']); $res = [ 'code' => 0, 'data' => $resInfo, 'is_exist' => $cash ? 1 : 0, 'template_id' => NoticeAction::getSendTamplateId(['cash_success', 'cash_fail']) ]; return $this->asJson($res); } /** * 提交提现 */ public function actionCashSubmit() { $form = new CashForm(); $form->user_id = get_user_id(); $form->store_id = get_store_id(); $form->cash_type = get_params('cash_type', 1); // 0: 分销商提现, 1:自提点提现 $form->attributes = get_params(); return $this->asJson($form->save()); } /** * 通知取货 */ public function actionSmsSend() { $form = new ShopAdminForm(); return $this->asJson($form->smsSend()); } }