SupplierBehaviors::class ] ]); } //获取运费规则 public function actionSupplierGetRules(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierGetRules()); } //删除运费规则 public function actionSupplierDelRules(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierDelRules()); } //删除运费规则 public function actionSupplierSetStatus(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierSetStatus()); } //获取运费规则列表 public function actionSupplierGetRulesList(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierGetRulesList()); } //订单取消审核 // public function actionSupplierOrderCancel(){ // $post = post_params(); // $form = new SupplierForm(); // $form->attributes = $post; // $this->asJson($form->supplierOrderCancel()); // } //订单取消审核 public function actionSupplierOrderRevoke(){ $form = new OrderForm(); $form->attributes = post_params(); // $form->delete_pass = 1; // $form->remark = ''; $cloud_order_id = (string)post_params('order_id', 0); $order = PurchaseOrder::find()->where(['cloud_order_id' => $cloud_order_id, 'is_delete' => 0])->one(); if (!$order) { return $this->asJson([ 'code' => 1, 'msg' => '订单不存在' ]); } return $this->asJson($form->revokeApply($order)); } //供货单修改收货地址 / 卖家备注 public function actionSupplierOrderSetAddress(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierOrderSetAddress()); } //转单修改收货地址 / 卖家备注 public function actionSupplierPurchaseOrderSetAddress(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierPurchaseOrderSetAddress()); } //供货单发货 public function actionSupplierOrderSend(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierOrderSend()); } //供货单xlsx发货 public function actionSupplierOrderXlsxSend(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierOrderSend()); } //供货单列表 public function actionSupplierOrderList(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson(OrderListForm::appendOrderInfo($form->supplierOrderList())); } //供货单列表 public function actionSupplierSendTypeList(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson(OrderListForm::appendOrderInfo($form->supplierSendTypeList())); } //云仓库存列表 public function actionGetCloudPreviewNum(){ $post = get_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->getCloudPreviewNum()); } //云仓库存详情 public function actionGetCloudPreviewNumInfo(){ $post = get_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->getCloudPreviewNumInfo()); } //订单取消审核 public function actionSupplierPurchaseCancel(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierPurchaseCancel()); } //订单发货 public function actionSupplierPurchaseSend(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierPurchaseSend()); } //订单发货 public function actionUpdateOrderSendInfo(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->updateOrderSendInfo()); } //订单删除 public function actionSupplierPurchaseDel(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierPurchaseDel()); } //订单删除 public function actionSupplierOrderDel(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierOrderDel()); } //转单列表 public function actionSupplierPurchaseOrderList(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierPurchaseOrderList()); } //转单售后列表 public function actionSupplierPurchaseOrderRefundList(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierPurchaseOrderRefundList()); } //转单售后列表 public function actionSupplierSendTypeRefundList(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierSendTypeRefundList()); } //处理退换货请求 public function actionSupplierApplyHandle() { $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierApplyHandle()); } //供货商提现申请 public function actionSetSupplierCash(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->storeSetSupplierCash()); } //余额记录 public function actionSupplierGetBalanceLog(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierGetBalanceLog()); } //余额冻结记录 public function actionSupplierGetBalanceFrozenLog(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->supplierGetBalanceFrozenLog()); } //编辑运费 public function actionSetRules(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->setRules()); } //提交审核 public function actionAuditSubmit(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->auditSubmit()); } //商品上下架操作 public function actionSetGoodsStatus(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->setGoodsStatus()); } //添加编辑规格 public function actionSetGoodsAttr(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->setGoodsAttr()); } //创建编辑商品 public function actionSetGoods(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->setGoods()); } //获取供货商商品列表 public function actionGoodsList(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->goodsList()); } //获取供货商商品列表 public function actionGoodsAuditList(){ $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->goodsAuditList()); } //获取供货商转单订单详情 public function actionPurchaseOrderInfo(){ $post = get_params(); $form = new SupplierForm(); $form->attributes = $post; // $this->asJson($form->purchaseOrderInfo(111)); $form->purchaseOrderInfo(get_params("order_id"), get_params("supplier_id")); } //获取集采列表 public function actionAgentOrderGroupList(){ $post = get_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->agentOrderGroupList()); } //生成配货单 public function actionAgentOrderDistribution() { $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->agentOrderDistribution()); } //配送单列表 public function actionAgentOrderDistributionList() { $post = get_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->agentOrderDistributionList()); } //更改配货单状态 public function actionSetDistributionStatus() { $post = post_params(); $form = new SupplierForm(); $form->attributes = $post; $this->asJson($form->setDistributionStatus()); } public function actionGetKefuInfo() { $supplier = Supplier::findOne(get_supplier_id()); if (!$supplier) { return $this->asJson([ 'code' => 1, 'msg' => '数据不存在', ]); } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data'=> [ 'kefu_id' => $supplier->kefu_id ?: '', ] ]); } public function actionSetKefuInfo() { $kefu_id = \post_params('kefu_id'); $supplier = Supplier::findOne(get_supplier_id()); if (!$supplier) { return $this->asJson([ 'code' => 1, 'msg' => '数据不存在', ]); } if (!empty($kefu_id)) { $url = Kefu::API_HOST; $host = \str_replace(['http://', 'https://'], '', \Yii::$app->request->hostInfo); $res = http_post($url . '/api/regKefu', [ 'form_params' => [ 'token' => \Yii::$app->getKefuApiToken(), 'host' => $host, 'mobile' => $kefu_id, ] ]); if ($res->getStatusCode() != 200) { return $this->asJson([ 'code' => 1, 'msg' => '请求出错!', ]); } $content = json_decode((string)$res->getBody(), true); if ($content['code'] == 0) { $supplier->kefu_id = $kefu_id; $supplier->save(); } } else { $supplier->kefu_id = ''; $supplier->save(); $content = [ 'code' => 0, 'msg' => '保存成功', ]; } return $this->asJson($content); } /** * 修改价格 * @return mixed */ public function actionModifyPrice() { $form = new SupplierForm(); $form->attributes = post_params(); return $this->asJson($form->modifyPrice()); } //获取仓库采购订单 public function actionPurchaseList() { $form = new \app\modules\admin\models\agent\front_erp\PurchaseForm(); // $admin = get_admin(); // if (!$admin) { // return $this->asJson([ // 'code' => 1, // 'msg' => '需要登录' // ]); // } // if ($admin->type !== Admin::ADMIN_TYPE_SUPPLIER) { // return $this->asJson([ // 'code' => 1, // 'msg' => '当前供货商身份验证失败' // ]); // } $form->admin_supplier_id = get_supplier_id(); $form->attributes = post_params(); return $this->asJson($form->search()); } //获取仓库采购订单 public function actionPurchaseInfo() { $form = new \app\modules\admin\models\agent\front_erp\PurchaseForm(); // $admin = get_admin(); // if (!$admin) { // return $this->asJson([ // 'code' => 1, // 'msg' => '需要登录' // ]); // } // if ($admin->type !== Admin::ADMIN_TYPE_SUPPLIER) { // return $this->asJson([ // 'code' => 1, // 'msg' => '当前供货商身份验证失败' // ]); // } $form->admin_supplier_id = get_supplier_id(); $form->attributes = all_params(); return $this->asJson($form->info()); } //打印仓库采购订单 public function actionPrintPurchase() { $form = new \app\modules\admin\models\agent\front_erp\PurchaseForm(); $form->admin_supplier_id = get_supplier_id(); $form->attributes = all_params(); $res = $form->searchPurchase(); return $this->asJson($res); } //供货商修改采购订单状态(发货) public function actionSetPurchaseOrderStatus() { $form = new \app\modules\admin\models\agent\front_erp\PurchaseForm(); // $admin = get_admin(); // if (!$admin) { // return $this->asJson([ // 'code' => 1, // 'msg' => '需要登录' // ]); // } // if ($admin->type !== Admin::ADMIN_TYPE_SUPPLIER) { // return $this->asJson([ // 'code' => 1, // 'msg' => '当前供货商身份验证失败' // ]); // } $form->admin_supplier_id = get_supplier_id(); $form->attributes = all_params(); return $this->asJson($form->setPurchaseOrderStatus()); } }