MchOrderSubmitPreviewForm.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\admin\models\order;
  8. use app\constants\OptionSetting;
  9. use app\models\Address;
  10. use app\models\District;
  11. use app\models\FoodFlag;
  12. use app\models\Goods;
  13. use app\models\Md;
  14. use app\models\Option;
  15. use app\models\Store;
  16. use app\utils\Notice\NoticeAction;
  17. use app\utils\OrderNo;
  18. use app\utils\Tools;
  19. use yii\helpers\Json;
  20. class MchOrderSubmitPreviewForm extends MchOrderForm
  21. {
  22. public function rules()
  23. {
  24. return parent::rules();
  25. }
  26. public function search()
  27. {
  28. if (!$this->validate())
  29. return [
  30. 'code' => 1,
  31. 'msg' => $this->getErrorSummary(false)[0],
  32. ];
  33. try {
  34. // 预生成订单号
  35. $order_no = OrderNo::getOrderNo(OrderNo::ORDER_MALL);
  36. cache()->set('delivery_order_no_' . $this->user->id, $order_no);
  37. $mchList = $this->getMchListData();
  38. if(isset($mchList['code']) && $mchList['code'] == 1){
  39. return $mchList;
  40. }
  41. } catch(\Exception $e) {
  42. return [
  43. 'code' => 1,
  44. 'line' => $e->getLine(),
  45. 'msg' => $e->getMessage(),
  46. 'file' => $e->getFile(),
  47. ];
  48. }
  49. return [
  50. 'code' => 0,
  51. 'msg' => 'OOKK',
  52. 'data' => [
  53. 'level' => $this->getLevelData(),
  54. 'mch_list' => $mchList,
  55. 'integral'=>$this->integral,
  56. 'user_integral' => $this->user->integral,
  57. 'user_money' => $this->user->money,
  58. 'address' => $this->getAddress(),
  59. 'address_id' => (string)(int)Address::findOne([
  60. 'user_id' => $this->saas_user->id,
  61. 'is_delete' => 0,
  62. 'is_default' => 1
  63. ])->id
  64. //'template_id' => $template_id,
  65. //'pay_type_list' => $this->getPayTypeList(),
  66. ],
  67. ];
  68. }
  69. }