From 2aadae8ef7888d3555d5eacd74047a4cb7257a7f Mon Sep 17 00:00:00 2001 From: zengyyh Date: Fri, 2 Aug 2024 14:36:27 +0800 Subject: [PATCH] 1 --- app/admin/controller/RetailDescribe.php | 2 +- app/api/controller/Retail.php | 52 ++++++++++------- app/common/enum/RetailDescribeEnum.php | 42 +++++++++++++ app/common/model/MerchantRemarks.php | 52 +++++++++++++++++ app/store/controller/order/Event.php | 78 +++++++++++++++++++++++++ 5 files changed, 203 insertions(+), 23 deletions(-) create mode 100644 app/common/enum/RetailDescribeEnum.php create mode 100644 app/common/model/MerchantRemarks.php diff --git a/app/admin/controller/RetailDescribe.php b/app/admin/controller/RetailDescribe.php index 9dbab88a..7780931e 100644 --- a/app/admin/controller/RetailDescribe.php +++ b/app/admin/controller/RetailDescribe.php @@ -25,7 +25,7 @@ class RetailDescribe extends Controller public function add(){ $model = new retDescribeModel; - if($model->add($this->postData())){ + if($model->add($this->postForm())){ return $this->renderSuccess('添加成功'); } return $this->renderError($model->getError() ?: '添加失败'); diff --git a/app/api/controller/Retail.php b/app/api/controller/Retail.php index 1dd50f8a..0937c243 100644 --- a/app/api/controller/Retail.php +++ b/app/api/controller/Retail.php @@ -18,6 +18,7 @@ use app\api\model\Agreement as AgreementModel; use app\common\model\RetailDescribe as RetailDescribeModel; use app\api\service\order\Checkout as CheckoutService; use app\api\service\User as UserService; +use app\common\enum\RetailDescribeEnum; class Retail extends Controller { @@ -64,27 +65,27 @@ class Retail extends Controller } $model =new \app\api\service\Retail(); $list = $model->userCenter($client); - $list['retail'] = '开通零售商城的10大优势\n - 1-客户直接在商城查看价格,快速比价、下单\n - 2-所有会员、分销数字化管理\n - 3-所有订单,调货记录,物流状态实时查询\n - 4-供应链资源快速对接\n - 5-商品数据快速上架,商城之间数据实时传输\n - 6-商品市场价实时自动更新\n - 7-货款到账时间支持当天或隔天,支付费率低至千分之2.x\n - 8-支持到店自提、同城闪送\n - 9-促进清洗、安装、维修、回收、租赁服务与产品销售一体化\n + $list['retail'] = '开通零售商城的10大优势/n + 1-客户直接在商城查看价格,快速比价、下单/n + 2-所有会员、分销数字化管理/n + 3-所有订单,调货记录,物流状态实时查询/n + 4-供应链资源快速对接/n + 5-商品数据快速上架,商城之间数据实时传输/n + 6-商品市场价实时自动更新/n + 7-货款到账时间支持当天或隔天,支付费率低至千分之2.x/n + 8-支持到店自提、同城闪送/n + 9-促进清洗、安装、维修、回收、租赁服务与产品销售一体化/n 10-促进本地商家联盟数字化平台化发展'; - $list['wholesale'] = '开通批发商城的10大优势\n - 1-采购代发商家实名注册认证,在线直接下单\n - 2-认证商家、服务商数字化管理\n - 3-所有订单,发货记录,物流状态实时查询\n - 4-所有调货记录在线实时查看\n - 5-审单实时做电话、地址校验比对,避免平台单\n - 6-供应链资源快速对接\n - 7-商品数据快速上架,商城之间商品数据实时传输\n - 8-商品市场价实时自动更新\n - 9-货款到账时间支持当天或隔天,支付费率低至千分之2.x\n + $list['wholesale'] = '开通批发商城的10大优势/n + 1-采购代发商家实名注册认证,在线直接下单/n + 2-认证商家、服务商数字化管理/n + 3-所有订单,发货记录,物流状态实时查询/n + 4-所有调货记录在线实时查看/n + 5-审单实时做电话、地址校验比对,避免平台单/n + 6-供应链资源快速对接/n + 7-商品数据快速上架,商城之间商品数据实时传输/n + 8-商品市场价实时自动更新/n + 9-货款到账时间支持当天或隔天,支付费率低至千分之2.x/n 10-供应商、服务商入驻,销售和推广效益提升'; return $this->renderSuccess(compact('list')); } @@ -115,9 +116,16 @@ class Retail extends Controller * 商厂权限 */ public function describe() - { $type = $this->request->get('type')??10; + { + $type = $this->request->get('type')??10; $list = RetailDescribeModel::withoutGlobalScope()->where(['description_status' =>10,'type' => $type])->select(); - return $this->renderSuccess(compact('list')); + $group = []; + foreach($list as $item){ + + $group[$item['plate_id']]['list'][] = $item; + $group[$item['plate_id']]['name'] = RetailDescribeEnum::$version[$item['plate_id']] ?? "" ; + } + return $this->renderSuccess(compact('group')); } diff --git a/app/common/enum/RetailDescribeEnum.php b/app/common/enum/RetailDescribeEnum.php new file mode 100644 index 00000000..191246e1 --- /dev/null +++ b/app/common/enum/RetailDescribeEnum.php @@ -0,0 +1,42 @@ + "商品", + self::DATA => "数据", + self::PRODUCT_ORDER => "商品订单", + self::SERVICE_ORDER => "服务订单", + self::RECYCLE_ORDER => "回收订单", + self::PAYMENT => "支付", + self::FINANCE => "财务", + self::STORE_DISPLAY => "店铺展示", + self::ROLE => "角色", + self::MARKETING => "营销", + self::MULTI_MERCHANT => "多商户", + self::CONTENT_MANAGEMENT => "内容管理", + self::OTHER_FEATURES => "其他功能", + ]; + + private function __construct() { + + } // 防止实例化 + +} \ No newline at end of file diff --git a/app/common/model/MerchantRemarks.php b/app/common/model/MerchantRemarks.php new file mode 100644 index 00000000..c0069ddf --- /dev/null +++ b/app/common/model/MerchantRemarks.php @@ -0,0 +1,52 @@ + +// +---------------------------------------------------------------------- +declare (strict_types=1); + +namespace app\common\model; +use cores\BaseModel; + +class MerchantRemarks extends BaseModel +{ + // 定义表名 + protected $name = 'merchant_remarks'; + + // 定义主键 + protected $pk = 'id'; + + // 定义时间戳字段名 + protected $createTime = 'create_time'; + protected $updateTime = 'update_time'; + + + + + public function add($data){ + return self::save($data); + } + + public function orderDetail($orderId){ + return $this->where('order_id',$orderId)->order('create_time asc')->select(); + } + + public static function detail($MerchantRemarkId) + { + return self::get($MerchantRemarkId); + } + + public function setRemarks($data){ + return $this->save($data); + } + + public function setDelete($MerchantRemarkId){ + return $this->where('id', $MerchantRemarkId)->delete(); + } + +} \ No newline at end of file diff --git a/app/store/controller/order/Event.php b/app/store/controller/order/Event.php index a87ecc5c..fc6bf324 100644 --- a/app/store/controller/order/Event.php +++ b/app/store/controller/order/Event.php @@ -15,6 +15,9 @@ namespace app\store\controller\order; use think\response\Json; use app\store\controller\Controller; use app\store\model\Order as OrderModel; +use app\common\model\MerchantRemarks as MerchantRemarksModel; +use app\common\service\store\User as StoreUserService; +use app\common\model\UploadFile; /** * 订单事件控制器 @@ -114,4 +117,79 @@ class Event extends Controller } return $this->renderError($model->getError() ?: '操作失败'); } + + /** + * 添加商家备注 + * @param int $orderId + */ + public function addRemark(int $orderId): Json + { + $data = $this->postForm(); + $data['store_id'] = $this->store['store_id']; + $storeUser = StoreUserService::getLoginInfo(); + $data['user_id'] = $storeUser['user']['store_user_id']; + $data['order_id'] = $orderId; + $model = new MerchantRemarksModel; + if(isset($data['image_id']) && !empty($data['image_id'])){ + $image_ids = $data['image_id']; + $image = array( + "image_id" => $image_ids + ); + $data['image_id'] = json_encode($image); + } + if ($model->add($data)) { + return $this->renderSuccess('操作成功'); + } + return $this->renderError($model->getError() ?: '操作失败'); + } + + + /** + * 查看商家备注 + * @param int $orderId + * @return Json + */ + public function getRemark(int $orderId): Json + { + $model = new MerchantRemarksModel; + // 备注详情 + $list = $model->orderDetail($orderId); + if($list){ + foreach($list as $key => $value){ + if(isset($value['image_id']) && !empty($value['image_id'])) + $value['image_id'] = json_decode($value['image_id'],true); + $value['image_id'] = $value['image_id']['image_id']; + + $value['image_url'] = UploadFile::getFileList($value['image_id']); + } + } + return $this->renderSuccess(compact('list')); + + } + + + /** + * 修改商家备注 + * @param int $MerchantRemarkId + * @return Json + */ + public function modifyRemark(int $MerchantRemarkId): Json + { + // 订单详情 + $model = MerchantRemarksModel::detail($MerchantRemarkId); + // 确认核销 + if ($model->setRemarks($this->postForm())) { + return $this->renderSuccess('操作成功'); + } + return $this->renderError($model->getError() ?: '操作失败'); + } + + public function deleteRemark(int $MerchantRemarkId): Json + { + // 确认核销 + if ($model->setDelete($MerchantRemarkId)) { + return $this->renderSuccess('删除成功'); + } + return $this->renderError($model->getError() ?: '操作失败'); + } }